Edit online

数据结构设计

2 Dec 2024
Read time: 1 minute(s)
  • struct aic_gpai_data:记录各个通道的数据信息
    struct aic_gpai_data {
        int             num_bits;
        const struct iio_chan_spec  *channels;
        int             num_channels;
        u32             fifo_depth[AIC_GPAI_MAX_CH];
    };
  • struct aic_gpai_ch:记录各个通道的配置信息
    struct aic_gpai_ch {
        u32 id;
        bool available;
        enum aic_gpai_mode mode;
        u16 latest_data;
        u16 fifo_thd;
        u32 smp_period;
    
        bool hla_enable; // high-level alarm
        u16 hla_thd;
        u16 hla_rm_thd;
        bool lla_enable; // low-level alarm
        u16 lla_thd;
        u16 lla_rm_thd;
    
        struct completion complete;
    };
  • struct aic_gpai_dev:管理 GPAI 控制器的设备资源
    struct aic_gpai_dev {
        struct platform_device      *pdev;
        void __iomem            *regs;
        struct clk          *clk;
        struct reset_control        *rst;
        u32             irq;
        u32             pclk_rate;
    
        struct aic_gpai_ch      chan[AIC_GPAI_MAX_CH];
        const struct aic_gpai_data  *data;
    };