Go to the source code of this file.
Data Structures | |
struct | BQ |
Functions | |
int | BQWrite (BQ *pBQ, char *b, int n) |
void | CreateBQ (BQ *pBQ, char *b, unsigned Size) |
Create a Byte Queue for send a Byte Stream to a Task. | |
int | BQget (BQ *pBQ) |
Get a character from the queue. | |
int | BQPut (BQ *pBQ, int c) |
Put a character into the queue. |
int BQget | ( | BQ * | pBQ | ) |
Get a character from the queue.
This function gets a byte from a byte queue. If there is no data in the buffer, then this function will block until at least 1 byte has been put into the buffer
pBQ | pointer to the queue to get a char from |
Definition at line 60 of file ByteQueue.c.
References ActiveTasks, CurrentTask, Delete(), Disable(), DoSwap(), Enable(), EVENT_NOERROR, EVENT_NOTASKS, BQ::Head, BQ::nChar, NextTask, BQ::pBfr, BQ::Size, tcb::status, BQ::task_h, tcb::TimeStamp, and TStamp.
int BQPut | ( | BQ * | pBQ, | |
int | c | |||
) |
Put a character into the queue.
This function is intended to be used inside of an interrupt routine to signal a waiting task that data is ready. It can also be used at the task level, however if the buffer overflows, we just do nothing (well we return an error...but that is it Interrupt routines cannot care if the queue is full
pBQ | pointer to queue to put data into | |
c | character to add to queue |
Definition at line 132 of file ByteQueue.c.
References ActiveTasks, Disable(), Enable(), EVENT_NOERROR, EVENT_OVERFLOW, Insert(), BQ::nChar, BQ::pBfr, BQ::Size, tcb::status, BQ::Tail, BQ::task_h, and Yeild().
int BQWrite | ( | BQ * | pBQ, | |
char * | b, | |||
int | n | |||
) |
Definition at line 182 of file ByteQueue.c.
void CreateBQ | ( | BQ * | pBQ, | |
char * | b, | |||
unsigned | size | |||
) |
Create a Byte Queue for send a Byte Stream to a Task.
This function is used to send a stream of bytes from one task to another.
If the Byte Queue is empty, the task will block until another task puts a byte (or bytes) into the queue It should be noted that there is no way to tell where any one particular byte comes from. They are just a stream of bytes.
It should be noted that this function does not allocate any memory for the byte queue.
pBQ | pointer to the byte queue to initialize | |
b | pointer to a char array to use as the buffer size size of the buffer |
Definition at line 38 of file ByteQueue.c.
References BQ::Head, BQ::nChar, BQ::pBfr, BQ::Size, BQ::Tail, and BQ::task_h.