32 #ifndef SPITEM_PORTABLE_INC_LLD_OC_SPI_LLD_H_ 33 #define SPITEM_PORTABLE_INC_LLD_OC_SPI_LLD_H_ 37 #include <oc_errors.h> 40 #if oC_Channel_IsModuleDefined(SPI) == false 41 #error SPI module channels are not defined 42 #elif oC_ModulePinFunctions_IsModuleDefined(SPI) == false 43 #error SPI module pin functions are not defined 44 #elif oC_ModulePin_IsModuleDefined(SPI) == false 45 #error SPI module pins are not defined 53 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 54 #define MODULE_NAME SPI 77 oC_ModulePinFunction_DefineType;
87 oC_ModulePin_DefineType;
106 oC_SPI_LLD_BitOrder_MSBFirst ,
107 oC_SPI_LLD_BitOrder_LSBFirst
108 } oC_SPI_LLD_BitOrder_t;
119 oC_SPI_LLD_FrameWidth_NotConfigured,
120 oC_SPI_LLD_FrameWidth_1Bit,
121 oC_SPI_LLD_FrameWidth_2Bits,
122 oC_SPI_LLD_FrameWidth_3Bits,
123 oC_SPI_LLD_FrameWidth_4Bits,
124 oC_SPI_LLD_FrameWidth_5Bits,
125 oC_SPI_LLD_FrameWidth_6Bits,
126 oC_SPI_LLD_FrameWidth_7Bits,
127 oC_SPI_LLD_FrameWidth_8Bits,
128 oC_SPI_LLD_FrameWidth_9Bits,
129 oC_SPI_LLD_FrameWidth_10Bits,
130 oC_SPI_LLD_FrameWidth_11Bits,
131 oC_SPI_LLD_FrameWidth_12Bits,
132 oC_SPI_LLD_FrameWidth_13Bits,
133 oC_SPI_LLD_FrameWidth_14Bits,
134 oC_SPI_LLD_FrameWidth_15Bits,
135 oC_SPI_LLD_FrameWidth_16Bits,
136 oC_SPI_LLD_FrameWidth_32Bits
137 } oC_SPI_LLD_FrameWidth_t;
148 oC_SPI_LLD_Phase_FirstEdge ,
149 oC_SPI_LLD_Phase_SecondEdge
150 } oC_SPI_LLD_Phase_t;
161 oC_SPI_LLD_Polarity_HighWhenActive ,
162 oC_SPI_LLD_Polarity_LowWhenActive
163 } oC_SPI_LLD_Polarity_t;
172 oC_SPI_LLD_State_Active ,
173 oC_SPI_LLD_State_NotActive
174 } oC_SPI_LLD_State_t;
185 oC_SPI_LLD_Mode_Master,
186 oC_SPI_LLD_Mode_SlaveEnabledOutput,
187 oC_SPI_LLD_Mode_SlaveDisabledOutput
201 typedef bool (*oC_SPI_LLD_Interrupt_t)( oC_SPI_Channel_t Channel );
204 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 211 #define _________________________________________MACROS_SECTION_____________________________________________________________________________ 232 #define oC_SPI_LLD_ForEachChannel( Channel ) oC_Channel_Foreach( SPI , Channel ) 234 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________ 241 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________ 256 extern bool oC_SPI_LLD_IsChannelCorrect( oC_SPI_Channel_t Channel );
280 extern bool oC_SPI_LLD_IsModulePinDefined( oC_SPI_Pin_t ModulePin );
292 extern oC_ChannelIndex_t oC_SPI_LLD_ChannelToChannelIndex( oC_SPI_Channel_t Channel );
304 extern oC_SPI_Channel_t oC_SPI_LLD_ChannelIndexToChannel(
oC_ChannelIndex_t Channel );
317 extern oC_SPI_Channel_t oC_SPI_LLD_GetChannelOfModulePin( oC_SPI_Pin_t ModulePin );
337 extern oC_ErrorCode_t oC_SPI_LLD_TurnOnDriver(
void );
358 extern oC_ErrorCode_t oC_SPI_LLD_TurnOffDriver(
void );
383 extern oC_ErrorCode_t oC_SPI_LLD_SetDriverInterruptHandlers( oC_SPI_LLD_Interrupt_t RxFull , oC_SPI_LLD_Interrupt_t TxEmpty );
409 extern oC_ErrorCode_t oC_SPI_LLD_SetPower( oC_SPI_Channel_t Channel ,
oC_Power_t Power );
424 extern oC_ErrorCode_t oC_SPI_LLD_ReadModulePinsOfPin( oC_Pins_t Pin , oC_SPI_Pin_t * outPeripheralPinsArray , uint32_t * ArraySize);
451 extern oC_ErrorCode_t oC_SPI_LLD_ReadPower( oC_SPI_Channel_t Channel ,
oC_Power_t * outPower );
474 extern oC_ErrorCode_t oC_SPI_LLD_DisableOperations( oC_SPI_Channel_t Channel );
498 extern oC_ErrorCode_t oC_SPI_LLD_EnableOperations( oC_SPI_Channel_t Channel );
519 extern oC_ErrorCode_t oC_SPI_LLD_RestoreDefaultStateOnChannel( oC_SPI_Channel_t Channel );
549 extern oC_ErrorCode_t oC_SPI_LLD_SetBitOrder( oC_SPI_Channel_t Channel , oC_SPI_LLD_BitOrder_t BitOrder );
574 extern oC_ErrorCode_t oC_SPI_LLD_ReadBitOrder( oC_SPI_Channel_t Channel , oC_SPI_LLD_BitOrder_t * outBitOrder );
604 extern oC_ErrorCode_t oC_SPI_LLD_SetFrameWidth( oC_SPI_Channel_t Channel , oC_SPI_LLD_FrameWidth_t FrameWidth );
631 extern oC_ErrorCode_t oC_SPI_LLD_ReadFrameWidth( oC_SPI_Channel_t Channel , oC_SPI_LLD_FrameWidth_t * outFrameWidth );
661 extern oC_ErrorCode_t oC_SPI_LLD_SetClockPhase( oC_SPI_Channel_t Channel , oC_SPI_LLD_Phase_t Phase );
686 extern oC_ErrorCode_t oC_SPI_LLD_ReadClockPhase( oC_SPI_Channel_t Channel , oC_SPI_LLD_Phase_t * outPhase );
716 extern oC_ErrorCode_t oC_SPI_LLD_SetClockPolarity( oC_SPI_Channel_t Channel , oC_SPI_LLD_Polarity_t Polarity );
741 extern oC_ErrorCode_t oC_SPI_LLD_ReadClockPolarity( oC_SPI_Channel_t Channel , oC_SPI_LLD_Polarity_t * outPolarity );
771 extern oC_ErrorCode_t oC_SPI_LLD_SetChipSelectPolarity( oC_SPI_Channel_t Channel , oC_SPI_LLD_Polarity_t Polarity );
796 extern oC_ErrorCode_t oC_SPI_LLD_ReadChipSelectPolarity( oC_SPI_Channel_t Channel , oC_SPI_LLD_Polarity_t * outPolarity );
825 oC_ErrorCode_t oC_SPI_LLD_SetLoopback( oC_SPI_Channel_t Channel ,
bool Loopback );
850 oC_ErrorCode_t oC_SPI_LLD_ReadLoopback( oC_SPI_Channel_t Channel ,
bool* outLoopback);
882 extern oC_ErrorCode_t oC_SPI_LLD_SetFrequency( oC_SPI_Channel_t Channel ,
oC_Frequency_t Frequency ,
oC_Frequency_t AcceptableDifference );
908 extern oC_ErrorCode_t oC_SPI_LLD_ReadFrequency( oC_SPI_Channel_t Channel ,
oC_Frequency_t * outFrequency );
930 extern oC_ErrorCode_t oC_SPI_LLD_SetChannelUsed( oC_SPI_Channel_t Channel );
952 extern oC_ErrorCode_t oC_SPI_LLD_SetChannelUnused( oC_SPI_Channel_t Channel );
965 extern bool oC_SPI_LLD_IsChannelUsed( oC_SPI_Channel_t Channel );
991 extern oC_ErrorCode_t oC_SPI_LLD_ConnectModulePin( oC_SPI_Pin_t ModulePin );
1017 extern oC_ErrorCode_t oC_SPI_LLD_SetMode( oC_SPI_Channel_t Channel, oC_SPI_LLD_Mode_t Mode );
1042 extern oC_ErrorCode_t oC_SPI_LLD_ReadMode( oC_SPI_Channel_t Channel, oC_SPI_LLD_Mode_t * outMode );
1070 extern oC_ErrorCode_t oC_SPI_LLD_ConfigureGeneralChipSelectPin( oC_SPI_Channel_t Channel , oC_Pins_t Pin );
1094 extern oC_ErrorCode_t oC_SPI_LLD_UnconfigureGeneralChipSelectPin( oC_SPI_Channel_t Channel , oC_Pins_t Pin );
1119 extern oC_ErrorCode_t oC_SPI_LLD_SetGeneralChipSelectState( oC_SPI_Channel_t Channel , oC_Pins_t Pin , oC_SPI_LLD_State_t State );
1132 extern bool oC_SPI_LLD_IsDmaSupportPossible( oC_SPI_Channel_t Channel );
1155 extern oC_ErrorCode_t oC_SPI_LLD_ConfigureDma( oC_SPI_Channel_t Channel ,
void * RxBuffer , uint32_t RxSize ,
void * TxBuffer , uint32_t TxSize );
1177 extern oC_ErrorCode_t oC_SPI_LLD_UnconfigureDma( oC_SPI_Channel_t Channel );
1208 extern oC_ErrorCode_t oC_SPI_LLD_Write( oC_SPI_Channel_t Channel ,
void * Buffer , oC_UInt_t BufferSize , oC_UInt_t ElementSize , oC_IoFlags_t IoFlags );
1240 extern oC_ErrorCode_t oC_SPI_LLD_Read( oC_SPI_Channel_t Channel ,
void * Buffer , oC_UInt_t BufferSize , oC_UInt_t ElementSize , oC_IoFlags_t IoFlags );
1271 extern oC_ErrorCode_t oC_SPI_LLD_WriteWithDma( oC_SPI_Channel_t Channel ,
void * Buffer , oC_UInt_t Size , oC_UInt_t ElementSize , oC_IoFlags_t IoFlags );
1302 extern oC_ErrorCode_t oC_SPI_LLD_ReadWithDma( oC_SPI_Channel_t Channel ,
void * outBuffer , oC_UInt_t Size , oC_UInt_t ElementSize , oC_IoFlags_t IoFlags );
1304 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________ The file with frequency definitions.
double oC_Frequency_t
type to store frequency
#define oC_ModuleChannel_DefineType
defines module channel type
The file with LLD interface for the CLOCK driver.
oC_Channel_t
stores machine channel
The file with interface for the machine module.
oC_Power_t
stores registers power state