|
LCM — CH32V003 Light Control Module
Light Control Module, I2C slave
|
#include "event_log.h"#include "lcm_module.h"#include "ch32v00x_conf.h"#include "core_riscv.h"#include <stdarg.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | EventLog_Rec |
Macros | |
| #define | EVENT_LOG_BAUD 115200U |
| #define | EVENT_LOG_LINE_SIZE 96U |
| #define | EVENT_LOG_RING_SIZE 48U |
Enumerations | |
| enum | EventLog_Id { EVT_LCM_ERR = 0 , EVT_NVM , EVT_SYS , EVT_I2C_CMD , EVT_I2C_READ } |
Functions | |
| static void | EventLog_UartPutChar (char ch) |
| static void | EventLog_UartWrite (const char *s) |
| static void | EventLog_UartInit (void) |
| static void | EventLog_PushRaw (uint8_t id, uint8_t a, uint8_t b, uint8_t c) |
| static const char * | EventLog_LcmErrName (uint8_t code) |
| static const char * | EventLog_UserDataName (uint8_t st) |
| static void | EventLog_FormatRecord (const EventLog_Rec *rec) |
| void | EventLog_Init (void) |
| void | EventLog_Process (void) |
| void | EventLog_Printf (const char *fmt,...) |
| void | EventLog_BootBanner (void) |
| void | EventLog_UserDataInit (UserData_Status st) |
| void | EventLog_LcmConfig (uint8_t i2c_addr, const uint8_t group_mask[4], uint8_t relay_state) |
| void | EventLog_PushI2cCmd (uint8_t cmd, uint8_t param, uint8_t has_param) |
| void | EventLog_PushI2cReadArm (uint8_t cmd) |
| void | EventLog_PushLcmError (uint8_t lcm_err_code) |
| void | EventLog_PushNvm (uint8_t tag, uint8_t status) |
| void | EventLog_PushSystem (uint8_t tag) |
Variables | |
| static volatile uint8_t | s_ring_head |
| static volatile uint8_t | s_ring_tail |
| static EventLog_Rec | s_ring [EVENT_LOG_RING_SIZE] |
| static uint32_t | s_seq |
| static char | s_line [EVENT_LOG_LINE_SIZE] |
| #define EVENT_LOG_BAUD 115200U |
Definition at line 16 of file event_log.c.
Referenced by EventLog_BootBanner(), and EventLog_UartInit().
| #define EVENT_LOG_LINE_SIZE 96U |
Definition at line 17 of file event_log.c.
| #define EVENT_LOG_RING_SIZE 48U |
Definition at line 18 of file event_log.c.
Referenced by EventLog_Process(), and EventLog_PushRaw().
| enum EventLog_Id |
| Enumerator | |
|---|---|
| EVT_LCM_ERR | |
| EVT_NVM | |
| EVT_SYS | |
| EVT_I2C_CMD | |
| EVT_I2C_READ | |
Definition at line 28 of file event_log.c.
| void EventLog_BootBanner | ( | void | ) |
Definition at line 396 of file event_log.c.
References EVENT_LOG_BAUD, EventLog_Printf(), and LCM_ID.
Referenced by main().
|
static |
Definition at line 265 of file event_log.c.
References EventLog_Rec::a, EventLog_Rec::b, EventLog_Rec::c, EventLog_LcmErrName(), EventLog_UartWrite(), EventLog_UserDataName(), EVT_I2C_CMD, EVT_I2C_READ, EVT_LCM_ERR, EVT_NVM, EVT_SYS, EventLog_Rec::id, s_line, and s_seq.
Referenced by EventLog_Process().
| void EventLog_Init | ( | void | ) |
Definition at line 335 of file event_log.c.
References EventLog_UartInit(), s_ring_head, s_ring_tail, and s_seq.
Referenced by main().
| void EventLog_LcmConfig | ( | uint8_t | i2c_addr, |
| const uint8_t | group_mask[4], | ||
| uint8_t | relay_state ) |
Definition at line 414 of file event_log.c.
References EventLog_Printf(), and s_seq.
Referenced by main().
|
static |
Definition at line 193 of file event_log.c.
References LCM_ERR_BAD_PARAM, LCM_ERR_GPIO_CLEAR, LCM_ERR_GPIO_CLEAR_ALL, LCM_ERR_GPIO_GET, LCM_ERR_GPIO_INIT, LCM_ERR_GPIO_SET, LCM_ERR_GPIO_SET_ALL, LCM_ERR_I2C_ARLO, LCM_ERR_I2C_BERR, LCM_ERR_I2C_OVR, LCM_ERR_NONE, LCM_ERR_UNKNOWN_CMD, LCM_ERR_USER_DATA_BUSY, LCM_ERR_USER_DATA_COMMIT, LCM_ERR_USER_DATA_FLASH, LCM_ERR_USER_DATA_PARAM, and LCM_ERR_USER_DATA_RANGE.
Referenced by EventLog_FormatRecord().
| void EventLog_Printf | ( | const char * | fmt, |
| ... ) |
Definition at line 381 of file event_log.c.
References EventLog_UartWrite(), and s_line.
Referenced by EventLog_BootBanner(), EventLog_LcmConfig(), and EventLog_UserDataInit().
| void EventLog_Process | ( | void | ) |
Definition at line 356 of file event_log.c.
References EVENT_LOG_RING_SIZE, EventLog_FormatRecord(), s_ring, s_ring_head, and s_ring_tail.
Referenced by LCM_Module_Poll(), and main().
| void EventLog_PushI2cCmd | ( | uint8_t | cmd, |
| uint8_t | param, | ||
| uint8_t | has_param ) |
Definition at line 425 of file event_log.c.
References EventLog_PushRaw(), and EVT_I2C_CMD.
Referenced by LCM_I2C_OnRxData().
| void EventLog_PushI2cReadArm | ( | uint8_t | cmd | ) |
Definition at line 430 of file event_log.c.
References EventLog_PushRaw(), and EVT_I2C_READ.
Referenced by LCM_I2C_OnRxData().
| void EventLog_PushLcmError | ( | uint8_t | lcm_err_code | ) |
Definition at line 435 of file event_log.c.
References EventLog_PushRaw(), and EVT_LCM_ERR.
Referenced by LCM_SetError().
| void EventLog_PushNvm | ( | uint8_t | tag, |
| uint8_t | status ) |
Definition at line 440 of file event_log.c.
References EventLog_PushRaw(), and EVT_NVM.
Referenced by LCM_Module_Poll(), LCM_SetUserDataCommitError(), and LCM_SetUserDataError().
|
static |
Definition at line 161 of file event_log.c.
References EventLog_Rec::a, EventLog_Rec::b, EventLog_Rec::c, EVENT_LOG_RING_SIZE, EventLog_Rec::id, s_ring, s_ring_head, and s_ring_tail.
Referenced by EventLog_PushI2cCmd(), EventLog_PushI2cReadArm(), EventLog_PushLcmError(), EventLog_PushNvm(), and EventLog_PushSystem().
| void EventLog_PushSystem | ( | uint8_t | tag | ) |
Definition at line 445 of file event_log.c.
References EventLog_PushRaw(), and EVT_SYS.
Referenced by LCM_Module_Poll(), and main().
|
static |
Definition at line 112 of file event_log.c.
References EVENT_LOG_BAUD.
Referenced by EventLog_Init().
|
static |
Definition at line 81 of file event_log.c.
Referenced by EventLog_UartWrite().
|
static |
Definition at line 93 of file event_log.c.
References EventLog_UartPutChar().
Referenced by EventLog_FormatRecord(), and EventLog_Printf().
| void EventLog_UserDataInit | ( | UserData_Status | st | ) |
Definition at line 404 of file event_log.c.
References EventLog_Printf(), EventLog_UserDataName(), s_seq, and USER_DATA_OK.
Referenced by main().
|
static |
Definition at line 226 of file event_log.c.
References USER_DATA_ERR_BUSY, USER_DATA_ERR_FLASH, USER_DATA_ERR_PARAM, USER_DATA_ERR_RANGE, and USER_DATA_OK.
Referenced by EventLog_FormatRecord(), and EventLog_UserDataInit().
|
static |
Definition at line 63 of file event_log.c.
Referenced by EventLog_FormatRecord(), and EventLog_Printf().
|
static |
Definition at line 61 of file event_log.c.
Referenced by EventLog_Process(), and EventLog_PushRaw().
|
static |
Definition at line 59 of file event_log.c.
Referenced by EventLog_Init(), EventLog_Process(), and EventLog_PushRaw().
|
static |
Definition at line 60 of file event_log.c.
Referenced by EventLog_Init(), EventLog_Process(), and EventLog_PushRaw().
|
static |
Definition at line 62 of file event_log.c.
Referenced by EventLog_FormatRecord(), EventLog_Init(), EventLog_LcmConfig(), and EventLog_UserDataInit().