9 Stream & Message Buffers Flashcards

1
Q

What can stream buffers be used for?

A

Stream buffers can be used as an alternative to queues, there are more light-weight in implantation. They are single read and write. They are used to send streams of bytes with no start or end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What can message buffers be used for?

A

Used as an alternative to queues, its more light-weight in impletation and is single read and write. They can be used to send packets of data of varying sizes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is data passed in stream buffers?

A

Through packets of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do the 10 and 5 parameters mean?

streamBuffer = xStreamBufferCreate(10,5);

A

10: The stream buffer can hold up to 10 bytes.
5: The receive task will unblock when there are 5 bytes in the stream buffer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What do each of these parameters mean?

xStreamBufferSend(streamBuffer, &num, 1, 0);

A

streamBuffer – name/handler of the stream buffer.
&num – a pointer to a variable that holds the data to be passed to the stream buffer
1 – number of bytes to be copied into the stream buffer
0 – Time to wait before timing out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What do each of these parameters mean?

xStreamBufferReceive(streamBuffer, &rxData, SampleTrigger, pdMS_TO_TICKS(110000));

A

streamBuffer – name/handle of the stream buffer.
&rxData – pointer to the buffer where the bytes will be
copied
sampleTrigger – Size of the receive buffer. Max number
of bytes that can be received.
pdMS_TO_TICKS – time to wait before timing out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Give an example of where a stream buffer can be used?

A

Use a stream buffer to stream a sample reading every second using a timer interrupt. If you were to do it with a queue, you would need to allocate a buffer in the interrupt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do each of these parameters mean?

xMessageBufferReceive(dataMessageBuffer, rxData, sizeof(rxData), pdmMs_TO_TICKS(1000));

A

dataMessageBuffer - name/handle of message buffer.
rxData – pointer to buffer where received bytes will be
copied.
Sizeof(rxData) – the size of the message buffer.
pdMS_TO_TICKS – Time before timing out.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Give an example of a message buffer.

A

Send GPS data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Compare Stream Buffer vs Message Buffer vs Queue.

A

Stream buffer
* Single read and write.
* Sends stream of bytes.
* Light-weight compared to a queue.

Message buffer
* Single read and write.
* Built on stream buffer
* Designed to handle variable sized messages
* Sent in fixed packets.
* Light-weight compared to a queue.

Queue
* Most advanced communication object.
* Most common communication object used in
FreeRTOS.
* Can have multiple read and write, between tasks,
interrupt handlers.
* A queue uses a fixed message.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly