| | |
| | | #ifndef __MYQUEUE_H__ |
| | | #define __MYQUEUE_H__ |
| | | |
| | | #pragma anon_unions |
| | | typedef struct |
| | | { |
| | | unsigned char * buf1; |
| | | int Caps; |
| | | volatile int wp; //Write Pointor |
| | | volatile int rp; //Read Pointor |
| | | short Caps; |
| | | volatile short wp; //Write Pointor |
| | | volatile short rp; //Read Pointor |
| | | // volatile int DataSize; |
| | | volatile int RecvBytes; |
| | | volatile int bFull; |
| | | volatile int bEmpty; |
| | | volatile int state; |
| | | // volatile short RecvBytes; |
| | | union{ |
| | | volatile unsigned char state; |
| | | struct{ |
| | | volatile unsigned char bFull:1; |
| | | volatile unsigned char bEmpty:1; |
| | | }; |
| | | }; |
| | | |
| | | }stMyQueue,* pMyQueue; |
| | | |
| | |
| | | } |
| | | static __inline int GetDataLen(pMyQueue theQueue) |
| | | { |
| | | int size=theQueue->wp -theQueue->rp; |
| | | int size=theQueue->wp - theQueue->rp; |
| | | if (theQueue->bFull) |
| | | { |
| | | return theQueue->Caps; |