Edit online

数据结构设计

5 Jul 2024
Read time: 1 minute(s)

aic_psadc_data

记录各个通道的数据信息:
struct aic_psadc_data {
    int             num_bits;
    const struct iio_chan_spec  *channels;
    int             num_channels;
    u32             fifo_depth[AIC_PSADC_MAX_CH];
};

struct aic_psadc_dev

管理 PSADC 控制器的设备资源:
struct aic_psadc_dev {
    struct platform_device      *pdev;
    void __iomem                *regs;
    struct clk                  *clk;
    struct reset_control        *rst;
    u32                         irq;
    u32                         pclk_rate;

    struct aic_psadc_ch         chan[AIC_PSADC_MAX_CH];
    const struct aic_psadc_data *data;
};

struct aic_psadc_ch

记录各个通道的配置信息:
struct aic_psadc_ch {
    u32 id;
    bool available;
    enum aic_psadc_mode mode;
    u16 latest_data;
    struct completion complete;
};