Chris BAYLEY / Mbed 2 deprecated UARTSnoop

Dependencies:   MODSERIAL Terminal mbed

Embed: (wiki syntax)

« Back to documentation index

Tiny Queue

Tiny Queues implements a 4 byte queue for iPhone events with just 1 byte of management overhead. More...

Data Structures

struct  tinyQ_t
 a tinyQ tracks a 8 * queue with just 1 byte overhead More...

Functions

int Qpush (tinyQ_t *q, void *p)
 Push an Accessibility Event onto our queue for sending to the iphone.
int Qjump (tinyQ_t *q, void *p)
 Push an Accessibility Event onto front of our queue for sending to the iphone.
int Qpop (tinyQ_t *q, void **p)
 Pop an Accessibility Event off our queue for sending to the iphone.

Variables

unsigned char tail:8
 the bit depth MUST be that power of 2 that is the Q_SIZE
unsigned char fill:9
 Must be 1 bit bigger than the head and tail pointers.
void * data [Q_SIZE]
 NOTE: Q_SIZE MUST be == 2 ^ widthof( tinyQ_t.head )

Detailed Description

Tiny Queues implements a 4 byte queue for iPhone events with just 1 byte of management overhead.

Head and Tail pointers both inherently wrap at the end of the buffer and no bounds checking is necesary IFF the buffer size is set as a power of 2 equal to the width of the pointers !! i.e head is 2 bits wide so the buffer must be 2^2 = 4 bytes deep.


Function Documentation

int Qjump ( tinyQ_t q,
void *  p 
)

Push an Accessibility Event onto front of our queue for sending to the iphone.

Parameters:
qpointer to our tinyQ_t
cthe Event to send to the iphone
Returns:
null if Q full, 1 on success
See also:
Qpush(), Qpop()

Definition at line 33 of file TinyQueue.cpp.

int Qpop ( tinyQ_t q,
void **  p 
)

Pop an Accessibility Event off our queue for sending to the iphone.

Parameters:
qpointer to our tinyQ_t
cpointer to receive the Event
Returns:
null if Q empty, 1 on success
See also:
Qpop(), Qjump()

Definition at line 52 of file TinyQueue.cpp.

int Qpush ( tinyQ_t q,
void *  p 
)

Push an Accessibility Event onto our queue for sending to the iphone.

Parameters:
qpointer to our tinyQ_t
cthe Event to send to the iphone
Returns:
null if Q full, 1 on success
See also:
Qpop(), Qjump()

Definition at line 14 of file TinyQueue.cpp.


Variable Documentation

void* data[Q_SIZE] [inherited]

NOTE: Q_SIZE MUST be == 2 ^ widthof( tinyQ_t.head )

Definition at line 20 of file TinyQueue.h.

unsigned char fill [inherited]

Must be 1 bit bigger than the head and tail pointers.

Definition at line 19 of file TinyQueue.h.

unsigned char tail [inherited]

the bit depth MUST be that power of 2 that is the Q_SIZE

Definition at line 18 of file TinyQueue.h.