1 /*
2  * Copyright 2020 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  */
9 
10 #ifndef __FSL_COMPONENT_LOG_BACKEND_RINGBUFFER_H__
11 #define __FSL_COMPONENT_LOG_BACKEND_RINGBUFFER_H__
12 
13 #include "fsl_common.h"
14 
15 /*
16  * Log backend ring buffer usage:
17  * Since, the multiple backend feature is supported by log component, the
18  * backend should be initialized individually in application by calling
19  * backend initialization function (for example,
20  * LOG_InitBackendRingbuffer id the backend of log component is ring
21  * buffer).
22  * Also, the backend could be de-initialized by calling backend
23  * de-initialization function (for example, LOG_DeinitBackendRingbuffer
24  * is the backend of log component is ring buffer).
25  */
26 
27 /*!
28  * @addtogroup fsl_component_log_backend_ring_buffer
29  * @ingroup fsl_component_log
30  * @{
31  */
32 
33 /*******************************************************************************
34  * Definitions
35  ******************************************************************************/
36 /*! @brief ring buffer configuration structure */
37 typedef struct log_backend_ring_buffer_config
38 {
39     uint8_t *ringBuffer;     /*!< ring buffer address */
40     size_t ringBufferLength; /*!< ring buffer length */
41 } log_backend_ring_buffer_config_t;
42 
43 /*******************************************************************************
44  * API
45  ******************************************************************************/
46 
47 #if defined(__cplusplus)
48 extern "C" {
49 #endif /* _cplusplus */
50 
51 /*!
52  * @brief Initializes the backend ringbuffer for log component.
53  *
54  * @details This function initializes the backend ringbuffer for log component.
55  * The function should be called in application layer. The function
56  * should be called after the log component has been initialized
57  * (the function LOG_Init has been called).
58  *
59  * @param config Ring buffer configuration for backend ring buffer.
60  */
61 void LOG_InitBackendRingbuffer(log_backend_ring_buffer_config_t *config);
62 
63 /*!
64  * @brief De-initializes the backend ringbuffer for log component.
65  *
66  * @details This function de-initializes the backend ringbuffer for log component.
67  */
68 void LOG_DeinitBackendRingbuffer(void);
69 
70 #if defined(__cplusplus)
71 }
72 #endif
73 /*! @} */
74 
75 #endif /* __FSL_COMPONENT_LOG_BACKEND_RINGBUFFER_H__ */
76