[cpp]
struct spi_device { struct device dev; //内嵌标准device结构体 struct spi_master *master; //spi主控制器 u32 max_speed_hz; //时钟速率 u8 chip_select; //设备编号 u8 mode; //模式 #define SPI_CPHA 0x01 /* clock phase */ #define SPI_CPOL 0x02 /* clock polarity */ #define SPI_MODE_0 (0|0) /* (original MicroWire) */ #define SPI_MODE_1 (0|SPI_CPHA) #define SPI_MODE_2 (SPI_CPOL|0) #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) #define SPI_CS_HIGH 0x04 /* chipselect active high? */ #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */ #define SPI_3WIRE 0x10 /* SI/SO signals shared */ #define SPI_LOOP 0x20 /* loopback mode */ #define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */ #define SPI_READY 0x80 /* slave pulls low to pause */ u8 bits_per_word; int irq; //中断号 void *controller_state; //控制状态 void *controller_data; //私有数据 char modalias[SPI_NAME_SIZE]; //名字 /* * likely need more hooks for more protocol options affecting how * the controller talks to each chip, like: * - memory packing (12 bit samples into low bits, others zeroed) * - priority * - drop chipselect after each word * - chipselect delays * - ... */ };Linux设备模型之spi子系统(3)
内容版权声明:除非注明,否则皆为本站原创文章。