Dump SPI from input to pc.serial
Embed:
(wiki syntax)
Show/hide line numbers
tinyQ.h
00001 /** \defgroup tinyQ Tiny Queue 00002 * Tiny Queues implements a 4 byte queue for iPhone events with just 1 byte of management overhead. 00003 * Head and Tail pointers both inherently wrap at the end of the buffer and no bounds checking is 00004 * necesary IFF the buffer size is set as a power of 2 equal to the width of the pointers !! 00005 * i.e head is 2 bits wide so the buffer must be 2^2 = 4 bytes deep. 00006 * @{ 00007 */ 00008 /** NOTE: Q_SIZE MUST be == 2 ^ widthof( tinyQ_t.head ) */ 00009 #define Q_SIZE 256 00010 00011 00012 00013 /** a tinyQ tracks a 4 byte queue with just 1 byte overhead */ 00014 typedef struct 00015 { 00016 unsigned int head:8; ///< the bit depth MUST be that power of 2 that is the Q_SIZE 00017 unsigned int tail:8; ///< the bit depth MUST be that power of 2 that is the Q_SIZE 00018 unsigned int fill:9; ///< Must be 1 bit bigger than the head and tail pointers 00019 char data[Q_SIZE]; ///< NOTE: Q_SIZE MUST be == 2 ^ widthof( tinyQ_t.head ) 00020 }tinyQ_t; 00021 00022 00023 /** 00024 * \brief Push an Accessibility Event onto our queue for sending to the iphone 00025 * \param q pointer to our tinyQ_t 00026 * \param c the Event to send to the iphone 00027 * \return null if Q full, 1 on success 00028 * \sa Qpop(), Qjump() 00029 * \ingroup tinyQ 00030 */ 00031 int Qpush( tinyQ_t* q, char c ); 00032 00033 /** 00034 * \brief Pop an Accessibility Event off our queue for sending to the iphone 00035 * \param q pointer to our tinyQ_t 00036 * \param c pointer to receive the Event 00037 * \return null if Q empty, 1 on success 00038 * \sa Qpop(), Qjump() 00039 * \ingroup tinyQ 00040 */ 00041 int Qpop( tinyQ_t* q, char * c); 00042 00043 int Qfree( tinyQ_t* q ); 00044 void Qinit( tinyQ_t* q );
Generated on Tue Jul 12 2022 23:42:02 by
1.7.2