3 * - Abstract Data Types
12 typedef struct sRingBuffer
14 size_t Start; //!< Start of data in ring buffer
15 size_t Length; //!< Number of data bytes in buffer
16 size_t Space; //!< Allocated space in buffer
17 tShortSpinlock Lock; //!< Lock to prevent collisions
18 char Data[]; //!< Buffer
22 * \brief Create a ring buffer \a Space bytes large
23 * \param Space Ammount of space to allocate within the buffer
24 * \return Pointer to the buffer structure
26 extern tRingBuffer *RingBuffer_Create(size_t Space);
28 * \brief Read at most \a Length bytes from the buffer
29 * \param Dest Destinaton buffer
30 * \param Buffer Source ring buffer
31 * \param Length Requested number of bytes
32 * \return Number of bytes read
34 extern size_t RingBuffer_Read(void *Dest, tRingBuffer *Buffer, size_t Length);
36 * \brief Write at most \a Length bytes to the buffer
37 * \param Buffer Destination ring buffer
38 * \param Source Source buffer
39 * \param Length Provided number of bytes
40 * \return Number of bytes written
42 extern size_t RingBuffer_Write(tRingBuffer *Buffer, const void *Source, size_t Length);