RTEMS: cpukit/include/rtems/ringbuf.h File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Structures | Macros
ringbuf.h File Reference

Simple Ring Buffer Functionality. More...

`#include <rtems.h>`

Go to the source code of this file.

## Data Structures
struct | Ring_buffer_t

## Macros
#define | RINGBUF_QUEUE_LENGTH 128
#define | Ring_buffer_Initialize(_buffer)
#define | Ring_buffer_Destory(_buffer)
#define | Ring_buffer_Is_empty(_buffer) ( (_buffer)->head == (_buffer)->tail )
#define | Ring_buffer_Is_full(_buffer) ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH )
#define | Ring_buffer_Add_character(_buffer, _ch)
#define | Ring_buffer_Remove_character(_buffer, _ch)

## Detailed Description

Simple Ring Buffer Functionality.

This file provides simple ring buffer functionality.

## Macro Definition Documentation

## ◆ Ring_buffer_Add_character

#define Ring_buffer_Add_character | ( |  | _buffer,
|  |  | _ch
| ) |  |

Value:
do { \
rtems_interrupt_lock_context lock_context; \
\
rtems_interrupt_lock_acquire( &(_buffer)->lock, &lock_context ); \
(_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \
(_buffer)->buffer[ (_buffer)->tail ] = (_ch); \
rtems_interrupt_lock_release( &(_buffer)->lock, &lock_context ); \
} while ( 0 )
ISR_lock_Context
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65

## ◆ Ring_buffer_Destory

#define Ring_buffer_Destory | ( |  | _buffer | ) |

Value:
do { \
rtems_interrupt_lock_destroy(&(_buffer)->lock); \
} while ( 0 )

## ◆ Ring_buffer_Initialize

#define Ring_buffer_Initialize | ( |  | _buffer | ) |

Value:
do { \
(_buffer)->head = (_buffer)->tail = 0; \
rtems_interrupt_lock_initialize(&(_buffer)->lock, "ring buffer"); \
} while ( 0 )

## ◆ Ring_buffer_Remove_character

#define Ring_buffer_Remove_character | ( |  | _buffer,
|  |  | _ch
| ) |  |

Value:
do { \
rtems_interrupt_lock_context lock_context; \
\
rtems_interrupt_lock_acquire( &(_buffer)->lock, &lock_context ); \
(_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \
(_ch) = (_buffer)->buffer[ (_buffer)->head ]; \
rtems_interrupt_lock_release( &(_buffer)->lock, &lock_context ); \
} while ( 0 )