E:/Projects/AvrLib/kernel/ByteQueue.c File Reference

#include "stdio.h"
#include "task.h"
#include "ByteQueue.h"

Include dependency graph for ByteQueue.c:

Go to the source code of this file.

Functions

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 BQWrite (BQ *pBQ, char *b, int n)


Detailed Description

Definition in file ByteQueue.c.


Function Documentation

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

Parameters:
pBQ pointer to the queue to get a char from
Returns:
returns a negative value on error, a positive value on success, suspends task if there are no characters to get

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

Parameters:
pBQ pointer to queue to put data into
c character to add to queue
Returns:
0 on success, negative value on fail

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.

Parameters:
pBQ pointer to the byte queue to initialize
b pointer to a char array to use as the buffer size size of the buffer
ByteQueue.c

Definition at line 38 of file ByteQueue.c.

References BQ::Head, BQ::nChar, BQ::pBfr, BQ::Size, BQ::Tail, and BQ::task_h.


Generated on Sun Aug 31 13:30:56 2008 for FrankenRTOS by  doxygen 1.5.6