HIT Project #3 https://community.freescale.com/docs/DOC-99621

Dependencies:   EthernetInterface WebSocketClient mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Queue.h Source File

Queue.h

00001 #include <stdio.h>
00002 #include <stdarg.h>
00003 #include <stdint.h>
00004 
00005 #ifndef QUEUE_H_
00006 #define QUEUE_H_
00007 
00008 
00009 typedef struct {
00010     
00011     uint16_t ReadPtr;
00012     uint16_t WritePtr;
00013     uint16_t QueueSize;
00014     uint8_t *QueueStorage;
00015     
00016 } ByteQueue;
00017 
00018 #define QUEUE_FULL       -1
00019 #define QUEUE_EMPTY      -2
00020 #define QUEUE_OK          0
00021 
00022 
00023 void InitByteQueue(ByteQueue *BQ,uint16_t Size,uint8_t * Storage); 
00024 uint16_t BytesInQueue(ByteQueue *BQ);
00025 int16_t ByteEnqueue(ByteQueue *BQ,uint8_t Val);
00026 int16_t ByteArrayEnqueue(ByteQueue *BQ,uint8_t *Buf,uint16_t);
00027 int16_t ByteDequeue(ByteQueue *BQ,uint8_t *Val);
00028 uint8_t ForcedByteDequeue(ByteQueue *BQ);
00029 int16_t Qprintf(ByteQueue *BQ, const char *FormatString,...);
00030 
00031 
00032 
00033 
00034 #endif /* TFC_QUEUE_H_ */