数据结构设计
2 Dec 2024
Read time: 1 minute(s)
Driver 层数据结构
typedef struct aic_cir
{
struct rt_device dev;
aic_cir_ctrl_t aic_cir_ctrl;
cir_config_t config;
} aic_cir_t;
HAL 层数据结构
typedef enum {
CIR_EVENT_RECEIVE_COMPLETE,
CIR_EVENT_ERROR,
} cir_event_t;
typedef struct aic_cir_ctrl aic_cir_ctrl_t;
struct aic_cir_ctrl {
unsigned long cir_base;
uint8_t irq_num;
uint8_t clk_idx;
void (*callback)(aic_cir_ctrl_t *aic_cir_ctrl, cir_event_t event,
void *arg);
void *arg;
uint8_t tx_data[128];
uint8_t rx_data[128];
uint32_t rx_idx;
uint8_t rx_level;
uint8_t rx_flag; /* Indicates if rxfifo has received data */
};