Ring Buffer Demo

Overview

There is an example implementation of the Ring Buffer Demo application available in the apps folder. In this implementation, it contains all the API functions and demos for how to use them.

Features

  • This application The structure is initialised, push and pop from the structure via the ring buffer concept, data is obtained from the structure, and all structure elements are flushed.

  • In every API for this driver, the Structure input argument is provided by the user.

  • The sample application includes Test Suite APIs. The test suite API was used to test the ring buffer driver API functions in a single shot with custom input.

Example Usecase

Circular queue or ring buffer, Data in a ring buffer is pushed, popped, peeked, and flushed until the buffer reaches its maximum capacity. Data will be stored in a circular manner. Below is the use case for the ring buffer operation.

Example input data:

****** MENU ******
1.To insert the element in the buffer(push)
2.To Delete the element in the buffer (Pop)
3.To Peek the element in the buffer (Peek)
4.To get free space in the buffer
5.To Print the data
6.To Flush all the elements in the buffer(Flush)
7.Testing ring buffer
8.Quit

Insert operation:
Enter the value :
5
3
2
4
6
Data successfully pushed to the buffer

Peek Operation:
Peek succeed
Peek Message Data :
0x5
0x3
0x2
0x4
0x6

Delete Operation:
Enter the number of bytes to read : 3
POP succeed
Data[0] = 0x5
Data[1] = 0x3
Data[2] = 0x2

Ring Buffer Module Driver

Please refer below section,