@@ -412,6 +412,14 @@ typedef enum
412412 DLT_RECEIVE_FD
413413} DltReceiverType ;
414414
415+ /**
416+ * Type to specify what action to handle when ringbuffer is full
417+ */
418+ typedef enum {
419+ DLT_RINGBUFFER_DISCARD_NEW_MESSAGE ,
420+ DLT_RINGBUFFER_REMOVE_OLDEST_MESSAGE
421+ } DltRingBufferFullStrategy ;
422+
415423/**
416424 * The definition of the serial header containing the characters "DLS" + 0x01.
417425 */
@@ -795,6 +803,7 @@ typedef struct
795803 uint32_t min_size ; /**< Minimum size of buffer */
796804 uint32_t max_size ; /**< Maximum size of buffer */
797805 uint32_t step_size ; /**< Step size of buffer */
806+ DltRingBufferFullStrategy full_strategy ; /**< strategy when ringbuffer is full */
798807} DltBuffer ;
799808
800809typedef struct
@@ -1321,9 +1330,10 @@ DltReturnValue dlt_check_rcv_data_size(int received, int required);
13211330 * @param buf Pointer to ringbuffer structure
13221331 * @param ptr Ptr to ringbuffer memory
13231332 * @param size Maximum size of buffer in bytes
1333+ * @param full_strategy the strategy when ringbuffer is full
13241334 * @return negative value if there was an error
13251335 */
1326- DltReturnValue dlt_buffer_init_static_server (DltBuffer * buf , const unsigned char * ptr , uint32_t size );
1336+ DltReturnValue dlt_buffer_init_static_server (DltBuffer * buf , const unsigned char * ptr , uint32_t size , DltRingBufferFullStrategy full_strategy );
13271337
13281338/**
13291339 * Initialize static ringbuffer with a size of size.
@@ -1332,9 +1342,10 @@ DltReturnValue dlt_buffer_init_static_server(DltBuffer *buf, const unsigned char
13321342 * @param buf Pointer to ringbuffer structure
13331343 * @param ptr Ptr to ringbuffer memory
13341344 * @param size Maximum size of buffer in bytes
1345+ * @param full_strategy the strategy when ringbuffer is full
13351346 * @return negative value if there was an error
13361347 */
1337- DltReturnValue dlt_buffer_init_static_client (DltBuffer * buf , const unsigned char * ptr , uint32_t size );
1348+ DltReturnValue dlt_buffer_init_static_client (DltBuffer * buf , const unsigned char * ptr , uint32_t size , DltRingBufferFullStrategy full_strategy );
13381349
13391350/**
13401351 * Initialize dynamic ringbuffer with a size of size.
@@ -1346,9 +1357,10 @@ DltReturnValue dlt_buffer_init_static_client(DltBuffer *buf, const unsigned char
13461357 * @param min_size Minimum size of buffer in bytes
13471358 * @param max_size Maximum size of buffer in bytes
13481359 * @param step_size size of which ringbuffer is increased
1360+ * @param full_strategy the strategy when ringbuffer is full
13491361 * @return negative value if there was an error
13501362 */
1351- DltReturnValue dlt_buffer_init_dynamic (DltBuffer * buf , uint32_t min_size , uint32_t max_size , uint32_t step_size );
1363+ DltReturnValue dlt_buffer_init_dynamic (DltBuffer * buf , uint32_t min_size , uint32_t max_size , uint32_t step_size , DltRingBufferFullStrategy full_strategy );
13521364
13531365/**
13541366 * Deinitilaise usage of static ringbuffer
0 commit comments