Go to the source code of this file.
Classes | |
struct | queue_state_t |
Defines | |
#define | _SPANDSP_QUEUE_H_ |
#define | QUEUE_READ_ATOMIC 0x0001 |
#define | QUEUE_WRITE_ATOMIC 0x0002 |
#define | QUEUE_STATE_T_SIZE(len) (sizeof(queue_state_t) + len + 1) |
Functions | |
int | queue_empty (queue_state_t *s) |
Check if a queue is empty. | |
int | queue_free_space (queue_state_t *s) |
Check available free space. | |
int | queue_contents (queue_state_t *s) |
Check the contents of a queue. | |
void | queue_flush (queue_state_t *s) |
Flush the contents of a queue. | |
int | queue_view (queue_state_t *s, uint8_t *buf, int len) |
Copy bytes from a queue. | |
int | queue_read (queue_state_t *s, uint8_t *buf, int len) |
Read bytes from a queue. | |
int | queue_read_byte (queue_state_t *s) |
Read a byte from a queue. | |
int | queue_write (queue_state_t *s, const uint8_t *buf, int len) |
Write bytes to a queue. | |
int | queue_write_byte (queue_state_t *s, uint8_t byte) |
Write a byte to a queue. | |
int | queue_state_test_msg (queue_state_t *s) |
Test message length. | |
int | queue_read_msg (queue_state_t *s, uint8_t *buf, int len) |
Read a message from a queue. | |
int | queue_write_msg (queue_state_t *s, const uint8_t *buf, int len) |
Write a message to a queue. | |
queue_state_t * | queue_init (queue_state_t *s, int len, int flags) |
Initialise a queue. | |
int | queue_free (queue_state_t *s) |
Delete a queue. |
#define QUEUE_READ_ATOMIC 0x0001 |
Flag bit to indicate queue reads are atomic operations. This must be set if the queue is to be used with the message oriented functions.
Referenced by bell_mf_tx_init(), dtmf_tx_init(), queue_read(), queue_view(), and t31_init().
#define QUEUE_WRITE_ATOMIC 0x0002 |
Flag bit to indicate queue writes are atomic operations. This must be set if the queue is to be used with the message oriented functions.
Referenced by bell_mf_tx_init(), dtmf_tx_init(), queue_write(), queue_write_byte(), and t31_init().
int queue_contents | ( | queue_state_t * | s | ) |
Check the contents of a queue.
Check the contents of a queue.
s | The queue context. |
References queue_state_t::iptr, queue_state_t::len, and queue_state_t::optr.
int queue_empty | ( | queue_state_t * | s | ) |
Check if a queue is empty.
Check if a queue is empty.
s | The queue context. |
References queue_state_t::iptr, and queue_state_t::optr.
Referenced by v8_rx().
void queue_flush | ( | queue_state_t * | s | ) |
Flush the contents of a queue.
Flush the contents of a queue.
s | The queue context. |
References queue_state_t::iptr, and queue_state_t::optr.
Referenced by v8_rx().
int queue_free | ( | queue_state_t * | s | ) |
Delete a queue.
Delete a queue.
s | The queue context. |
Referenced by v8_release().
int queue_free_space | ( | queue_state_t * | s | ) |
Check available free space.
Check the available free space in a queue's buffer.
s | The queue context. |
References queue_state_t::iptr, queue_state_t::len, and queue_state_t::optr.
Referenced by bell_mf_tx_put(), and dtmf_tx_put().
queue_state_t* queue_init | ( | queue_state_t * | s, | |
int | len, | |||
int | flags | |||
) |
Initialise a queue.
Initialise a queue.
s | The queue context. If is imperative that the context this points to is immediately followed by a buffer of the required size + 1 octet. | |
len | The length of the queue's buffer. | |
flags | Flags controlling the operation of the queue. Valid flags are QUEUE_READ_ATOMIC and QUEUE_WRITE_ATOMIC. |
References queue_state_t::flags, queue_state_t::iptr, queue_state_t::len, and queue_state_t::optr.
Referenced by bell_mf_tx_init(), dtmf_tx_init(), t31_init(), v42_init(), and v8_init().
int queue_read | ( | queue_state_t * | s, | |
uint8_t * | buf, | |||
int | len | |||
) |
Read bytes from a queue.
Read bytes from a queue.
s | The queue context. | |
buf | The buffer into which the bytes will be read. | |
len | The length of the buffer. |
References queue_state_t::flags, queue_state_t::iptr, queue_state_t::len, queue_state_t::optr, and QUEUE_READ_ATOMIC.
Referenced by queue_read_msg().
int queue_read_byte | ( | queue_state_t * | s | ) |
Read a byte from a queue.
Read a byte from a queue.
s | The queue context. |
References queue_state_t::iptr, queue_state_t::len, and queue_state_t::optr.
Referenced by bell_mf_tx(), and dtmf_tx().
int queue_read_msg | ( | queue_state_t * | s, | |
uint8_t * | buf, | |||
int | len | |||
) |
Read a message from a queue.
Read a message from a queue. If the message is longer than the buffer provided, only the first len bytes of the message will be returned. The remainder of the message will be discarded.
s | The queue context. | |
buf | The buffer into which the message will be read. | |
len | The length of the buffer. |
References queue_read().
int queue_state_test_msg | ( | queue_state_t * | s | ) |
Test message length.
Test the length of the message at the head of a queue.
s | The queue context. |
References queue_view().
int queue_view | ( | queue_state_t * | s, | |
uint8_t * | buf, | |||
int | len | |||
) |
Copy bytes from a queue.
Copy bytes from a queue. This is similar to queue_read, but the data remains in the queue.
s | The queue context. | |
buf | The buffer into which the bytes will be read. | |
len | The length of the buffer. |
References queue_state_t::flags, queue_state_t::iptr, queue_state_t::len, queue_state_t::optr, and QUEUE_READ_ATOMIC.
Referenced by queue_state_test_msg().
int queue_write | ( | queue_state_t * | s, | |
const uint8_t * | buf, | |||
int | len | |||
) |
Write bytes to a queue.
Write bytes to a queue.
s | The queue context. | |
buf | The buffer containing the bytes to be written. | |
len | The length of the buffer. |
References queue_state_t::flags, queue_state_t::iptr, queue_state_t::len, queue_state_t::optr, and QUEUE_WRITE_ATOMIC.
Referenced by bell_mf_tx_put(), dtmf_tx_put(), lapm_tx(), and v8_rx().
int queue_write_byte | ( | queue_state_t * | s, | |
uint8_t | byte | |||
) |
Write a byte to a queue.
Write a byte to a queue.
s | The queue context. | |
byte | The byte to be written. |
References queue_state_t::flags, queue_state_t::iptr, queue_state_t::len, queue_state_t::optr, and QUEUE_WRITE_ATOMIC.
int queue_write_msg | ( | queue_state_t * | s, | |
const uint8_t * | buf, | |||
int | len | |||
) |
Write a message to a queue.
Write a message to a queue.
s | The queue context. | |
buf | The buffer from which the message will be written. | |
len | The length of the message. |
References queue_state_t::iptr, queue_state_t::len, and queue_state_t::optr.