AUTOSAR下的SPI相关结构体
作者:互联网
可能不全,但也是很大一部分了,需要的拿走,我也是第一次学习加整理。
//Std_VersionInfoType
typedef struct
{
uint16_t vendorID;
uint16_t moduleID;
uint8_t sw_major_version;
uint8_t sw_minor_version;
uint8_t sw_patch_version;
}Std_VersionInfoType;
//Spi_JobPriorityType
typedef enum
{
SPI_JOB_PRIORITY_0,// 优先级0 - 低
SPI_JOB_PRIORITY_1,// 1
SPI_JOB_PRIORITY_2,// 2
SPI_JOB_PRIORITY_3,// 3 - 高
}Spi_JobPriorityType;
//Spi_AsyncModeType
typedef enum
{
SPI_POLLING_MODE,//异步机制通过轮询来确保,因此与异步处理的SPI总线相关的中断将被禁用
SPI_INTERRUPT_MODE,//异步机制由中断确保,因此启用与异步处理的SPI总线相关的中断
}Spi_AsyncModeType;
//Spi_HwUnitResultType
typedef enum
{
SPI_HW_UNIT_OK,//硬件单元结果正常
SPI_HW_UNIT_PENDING,//硬件单元结果待定
SPI_HW_UNIT_FAILED,//硬件单元结果失败
}Spi_HwUnitResultType;
//Spi_SeqResultType
typedef enum
{
SPI_SEQ_OK,//序列的最后一次传输已成功完成
SPI_SEQ_PENDING,//SPI 处理程序/驱动程序正在执行 SPI 序列。这种地位的含义等于SPI_BUSY
SPI_SEQ_FAILED,//序列的最后一次传输失败
SPI_SEQ_CANCELLED,//序列的最后一次传输已被用户取消
}Spi_SeqResultType;
//Spi_JobResultType
typedef enum
{
SPI_JOB_OK,//JOB的最后一次传输已成功完成
SPI_JOB_PENDING,//SPI 处理程序/驱动程序正在执行 SPI JOB。这种地位的含义等于SPI_BUSY
SPI_JOB_FAILED,//JOB的最后一次传输失败
SPI_JOB_QUEUED,//异步传输JOB已被接受,但此JOB的实际传输尚未开始
}Spi_JobResultType;
//Spi_HwUnitType
typedef enum
{
CSIB0,//MCU MCSPI0 instance
CSIB1,//MCU MCSPI1 instance
CSIB2,//MCU MCSPI2 instance
CSIB3,//MCSPI0 instance
CSIB4,//MCSPI1 instance
CSIB5,//MCSPI2 instance
CSIB6,//MCSPI3 instance
CSIB7,//MCSPI4 instance
CSIB8,//MCSPI5 instance
CSIB9,//MCSPI6 instance
CSIB10,//MCSPI7 instance
}Spi_HwUnitType;
//Spi_StatusType
typedef enum
{
SPI_UNINIT, //SPI 处理程序/驱动程序未初始化或不可用
SPI_IDLE, //SPI 处理程序/驱动程序当前空闲
SPI_BUSY, //SPI 处理程序/驱动程序当前忙
}Spi_StatusType;
//Spi_RegisterReadbackType
typedef struct
{
uint32_t mcspiHlRev;
uint32_t mcspiHlHwInfo;
uint32_t mcspiHlSysConfig;
uint32_t mcspiRev;
uint32_t mcspiSysStatus;
uint32_t mcspiSyst;
}Spi_RegisterReadbackType;
//Spi_DataLineTransmitType
typedef enum
{
DATA_LINE_NO_TRANSMISSION,//数据线上无传输
DATA_LINE_0_TRANSMISSION,//选择传输数据线 0 (SPIDAT[0])
DATA_LINE_1_TRANSMISSION,//选择传输数据线 1 (SPIDAT[1])
DATA_LINE_BOTH_TRANSMISSION,//选择传输数据线 0 和 1 (SPIDAT[0] 和 SPIDAT[1])
}Spi_DataLineTransmitType;
//Spi_DataLineReceiveType
typedef enum
{
DATA_LINE_0_RECEPTION,//选择数据线 0 (SPI DAT[0]) 进行接收
DATA_LINE_1_RECEPTION,//选择接收数据线 1 (SPI DAT[1])进行接收
}Spi_DataLineReceiveType;
//Spi_TxRxMode
typedef enum
{
SPI_TX_RX_MODE_BOTH,//TX 和 RX 均已启用
SPI_TX_RX_MODE_TX_ONLY,//仅启用 TX
}Spi_TxRxMode;
//Spi_ClkMode
typedef enum
{
SPI_CLK_MODE_0,//SPI 时钟相位 = 0(上升沿锁存器),极性 = 0(高电平有效)
SPI_CLK_MODE_1,//SPI 时钟相位 = 1 (下降沿锁存器), 极性 = 0 (高电平有效)
SPI_CLK_MODE_2,//SPI 时钟相位 = 0(上升沿锁存器),极性 = 1(低电平有效)
SPI_CLK_MODE_3,//SPI 时钟相位 = 1 (下降沿锁存器), 极性 = 1 (低电平有效)
}Spi_ClkMode;
//Spi_DataDelayType
typedef enum
{
SPI_DATADELAY_0, //0.5 时钟周期延迟
SPI_DATADELAY_1, //1.5 时钟周期延迟
SPI_DATADELAY_2, //2.5 时钟周期延迟
SPI_DATADELAY_3, //3.5 时钟周期延迟
}Spi_DataDelayType;
//Spi_LevelType
typedef enum
{
SPI_LOW, //低时钟或芯片选择
SPI_HIGH, //高时钟或芯片选择
}Spi_LevelType;
//Spi_CsModeType
typedef enum
{
SPI_SINGLE, //芯片选择模式 - 单片。仅当传输处于打开状态时才处于活动状态。
SPI_CONTINUOUS, //芯片选择模式 - 连续。始终处于活动状态。
}Spi_CsModeType;
//Spi_McspiExternalDeviceConfigType
typedef struct
{
uint16_t csEnable;
Spi_CsModeType csMode;
Spi_LevelType csPolarity;
Spi_DataDelayType csIdleTime;
uint32_t clkDivider;
Spi_ClkMode clkMode;
Spi_TxRxMode txRxMode;
uint16_t startBitEnable;
Spi_LevelType startBitLevel;
Spi_DataLineReceiveType receptionLineEnable;
Spi_DataLineTransmitType transmissionLineEnable;
}Spi_McspiExternalDeviceConfigType;
//Spi_ExternalDeviceConfigType
typedef struct
{
Spi_McspiExternalDeviceConfigType mcspi;
}Spi_ExternalDeviceConfigType;
//Spi_TransferType
typedef enum
{
SPI_MSB = 0, //MSB 首先转移。仅支持此功能
SPI_LSB = 1, //LSB 首先转移。这不受支持
}Spi_TransferType;
//Spi_HwUnitConfigType
typedef struct
{
Spi_HWUnitType hwUnitId;
}Spi_HwUnitConfigType;
//Spi_SeqConfigType
typedef struct
{
Spi_SequenceType seqId;
}Spi_SeqConfigType;
//Spi_CsPinType
typedef enum
{
SPI_CS0 = 0,
SPI_CS1 = 1,
SPI_CS2 = 2,
SPI_CS3 = 3,
}Spi_CsPinType;
//Spi_JobConfigType
typedef struct
{
uint16_t jobId;//(Spi_JobType)
Spi_CsPinType csPin;
uint8_t externalDeviceCfgId;
}Spi_JobConfigType;
//Spi_ChannelConfigType
typedef struct
{
uint8_t channelBufType;
uint8_t dataWidth;
uint32_t defaultTxData;
uint16_t maxBufLength; //Spi_NumberOfDataType
Spi_TransferType transferType;
}Spi_ChannelConfigType;
//Spi_ConfigType
typedef struct
{
uint8_t ID;
uint8_t maxChannels;
uint8_t maxJobs;
uint8_t maxSeq;
uint8_t maxHwUnit;
uint8_t maxExtDevCfg;
Spi_ChannelConfigType channelCfg[SPI_MAX_CHANNELS];
Spi_JobConfigType jobCfg[SPI_MAX_JOBS];
Spi_SeqConfigType seqCfg[SPI_MAX_SEQ];
Spi_HwUnitConfigType hwUnitCfg[SPI_MAX_HW_UNIT];
Spi_ExternalDeviceConfigType extDevCfg[SPI_MAX_EXT_DEV];
}Spi_ConfigType;
标签:AUTOSAR,Spi,enum,typedef,uint8,SPI,JOB,相关 来源: https://blog.csdn.net/qq_59364137/article/details/122390499