1 /* 2 * Copyright 2017 NXP 3 * All rights reserved. 4 * 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 * 8 */ 9 10 #ifndef _FSL_LOG_H 11 #define _FSL_LOG_H 12 13 #include "fsl_common.h" 14 15 /******************************************************************************* 16 * Definitions 17 ******************************************************************************/ 18 19 /************************************************************************************************* 20 * Prototypes 21 ************************************************************************************************/ 22 #if defined(__cplusplus) 23 extern "C" { 24 #endif /* __cplusplus */ 25 26 /*! 27 * @brief Initializes 28 * 29 * Call this function to init the buffer 30 * @param baseAddr, device base address 31 * @param device, device type 32 * @param baudRate, device communicate baudrate 33 * @param clkSrcFreq, device source clock freq 34 * 35 * @return Indicates whether initialization was successful or not. 36 * @retval kStatus_Success Execution successfully 37 * @retval kStatus_Fail Execution failure 38 */ 39 status_t LOG_Init(uint32_t baseAddr, uint8_t device, uint32_t baudRate, uint32_t clkSrcFreq); 40 41 /*! 42 * @brief De-Initializes 43 * 44 * Call this function to deinit the buffer 45 * 46 * @return Indicates whether Deinit was successful or not. 47 */ 48 void LOG_Deinit(void); 49 50 /*! 51 * @brief log push interface 52 * 53 * Call this function to print log 54 * @param fmt, buffer pointer 55 * @param size, avaliable size 56 * @return indicate the push size 57 * @retval-1 indicate buffer is full or transfer fail. 58 * @retval size return the push log size. 59 */ 60 int LOG_Push(uint8_t *buf, size_t size); 61 62 /*! 63 * @brief log read one line function 64 * 65 * Call this function to print log 66 * @param fmt, buffer pointer 67 * @param size, avaliable size 68 * @reutrn the number of the recieved character 69 */ 70 int LOG_ReadLine(uint8_t *buf, size_t size); 71 72 /*! 73 * @brief log read one character function 74 * 75 * Call this function to GETCHAR 76 * @param ch receive address 77 * @reutrn the number of the recieved character 78 */ 79 int LOG_ReadCharacter(uint8_t *ch); 80 81 /*! 82 * @brief wait log and io idle 83 * 84 * Call this function to wait log buffer empty and io idle before enter low power mode. 85 * @return Indicates whether wait idle was successful or not. 86 */ 87 status_t LOG_WaitIdle(void); 88 89 /*! 90 * @brief log pop function 91 * 92 * Call this function to pop log from buffer. 93 * @param buf buffer address to pop 94 * @param size log size to pop 95 * @return pop log size. 96 */ 97 int LOG_Pop(uint8_t *buf, size_t size); 98 99 #if defined(__cplusplus) 100 } 101 #endif /* __cplusplus */ 102 103 #endif 104