Choco OS  V.0.16.9.0
Join to the chocolate world
oc_gpio_lld.h
Go to the documentation of this file.
1 
125 #ifndef GPIOTEM_PORTABLE_INC_LLD_OC_GPIO_LLD_H_
126 #define GPIOTEM_PORTABLE_INC_LLD_OC_GPIO_LLD_H_
127 
128 #include <oc_machine.h>
129 #include <oc_errors.h>
130 #include <stdbool.h>
131 
132 #if oC_Channel_IsModuleDefined(GPIO) == false
133 #error GPIO module is not defined
134 #else
135 
141 #define _________________________________________TYPES_SECTION______________________________________________________________________________
142 #define MODULE_NAME GPIO
145 
146 //==========================================================================================================================================
153 //==========================================================================================================================================
155 
156 //==========================================================================================================================================
162 //==========================================================================================================================================
163 typedef enum
164 {
165  oC_GPIO_LLD_Protection_DontUnlockProtectedPins ,
166  oC_GPIO_LLD_Protection_UnlockProtectedPins
167 } oC_GPIO_LLD_Protection_t;
168 
169 //==========================================================================================================================================
176 //==========================================================================================================================================
177 typedef enum
178 {
179  oC_GPIO_LLD_Speed_Default ,
180  oC_GPIO_LLD_Speed_Minimum ,
181  oC_GPIO_LLD_Speed_Medium ,
182  oC_GPIO_LLD_Speed_Maximum ,
183  oC_GPIO_LLD_Speed_NumberOfElements
184 } oC_GPIO_LLD_Speed_t;
185 
186 //==========================================================================================================================================
192 //==========================================================================================================================================
193 typedef enum
194 {
195  oC_GPIO_LLD_Current_Default ,
196  oC_GPIO_LLD_Current_Minimum ,
197  oC_GPIO_LLD_Current_Medium ,
198  oC_GPIO_LLD_Current_Maximum
199 } oC_GPIO_LLD_Current_t;
200 
201 //==========================================================================================================================================
207 //==========================================================================================================================================
208 typedef enum
209 {
210  oC_GPIO_LLD_Mode_Default ,
211  oC_GPIO_LLD_Mode_Input ,
212  oC_GPIO_LLD_Mode_Output ,
213  oC_GPIO_LLD_Mode_Alternate
214 } oC_GPIO_LLD_Mode_t;
215 
216 //==========================================================================================================================================
222 //==========================================================================================================================================
223 typedef enum
224 {
225  oC_GPIO_LLD_Pull_Default ,
226  oC_GPIO_LLD_Pull_Up ,
227  oC_GPIO_LLD_Pull_Down
228 } oC_GPIO_LLD_Pull_t;
229 
230 //==========================================================================================================================================
236 //==========================================================================================================================================
237 typedef enum
238 {
239  oC_GPIO_LLD_OutputCircuit_Default ,
240  oC_GPIO_LLD_OutputCircuit_OpenDrain ,
241  oC_GPIO_LLD_OutputCircuit_PushPull
242 } oC_GPIO_LLD_OutputCircuit_t;
243 
244 
245 //==========================================================================================================================================
251 //==========================================================================================================================================
252 typedef enum
253 {
254  oC_GPIO_LLD_IntTrigger_Default ,
255  oC_GPIO_LLD_IntTrigger_Off = 0 ,
256  oC_GPIO_LLD_IntTrigger_RisingEdge = (1<<0),
257  oC_GPIO_LLD_IntTrigger_FallingEdge = (1<<1),
258  oC_GPIO_LLD_IntTrigger_BothEdges = (1<<0) | (1<<1),
259  oC_GPIO_LLD_IntTrigger_HighLevel = (1<<2),
260  oC_GPIO_LLD_IntTrigger_LowLevel = (1<<3),
261  oC_GPIO_LLD_IntTrigger_BothLevels = (1<<2) | (1<<3)
262 } oC_GPIO_LLD_IntTrigger_t;
263 
264 //==========================================================================================================================================
271 //==========================================================================================================================================
272 typedef enum
273 {
274  oC_GPIO_LLD_PinsState_AllLow = 0,
275  oC_GPIO_LLD_PinsState_AllHigh = oC_Pin_PinsInPortMask
276 } oC_GPIO_LLD_PinsState_t;
277 
278 //==========================================================================================================================================
287 //==========================================================================================================================================
288 typedef void (*oC_GPIO_LLD_Interrupt_t)( oC_Pins_t Pins );
289 
290 #undef MODULE_NAME
291 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
292 
299 #define _________________________________________MACROS_SECTION_____________________________________________________________________________
300 
303 //==========================================================================================================================================
324 //==========================================================================================================================================
325 #define oC_GPIO_LLD_ForEachPort( PortVariable ) oC_Channel_Foreach(GPIO , PortVariable )
326 
327 //==========================================================================================================================================
340 //==========================================================================================================================================
341 #define oC_GPIO_LLD_GetImportantBitsMaskForPins( Pins ) ( oC_Pin_ChannelMask | (oC_Pin_PinsInPortMask & Pins ) )
342 
343 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________
344 
351 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
352 
355 //==========================================================================================================================================
364 //==========================================================================================================================================
365 extern oC_ErrorCode_t oC_GPIO_LLD_TurnOnDriver( void );
366 //==========================================================================================================================================
376 //==========================================================================================================================================
377 extern oC_ErrorCode_t oC_GPIO_LLD_TurnOffDriver( void );
378 //==========================================================================================================================================
388 //==========================================================================================================================================
389 extern bool oC_GPIO_LLD_IsPortCorrect( oC_Port_t Port );
390 //==========================================================================================================================================
400 //==========================================================================================================================================
401 extern bool oC_GPIO_LLD_IsPortIndexCorrect( oC_PortIndex_t PortIndex );
402 //==========================================================================================================================================
420 //==========================================================================================================================================
421 extern oC_PinsMask_t oC_GPIO_LLD_GetPinsMaskOfPins( oC_Pins_t Pins );
422 //==========================================================================================================================================
432 //==========================================================================================================================================
433 extern oC_Port_t oC_GPIO_LLD_GetPortOfPins( oC_Pins_t Pins );
434 //==========================================================================================================================================
444 //==========================================================================================================================================
445 extern oC_PortIndex_t oC_GPIO_LLD_PortToPortIndex( oC_Port_t Port );
446 //==========================================================================================================================================
456 //==========================================================================================================================================
457 extern oC_Port_t oC_GPIO_LLD_PortIndexToPort( oC_PortIndex_t PortIndex );
458 //==========================================================================================================================================
470 //==========================================================================================================================================
471 extern bool oC_GPIO_LLD_IsPinDefined( oC_Pin_t Pin );
472 //==========================================================================================================================================
483 //==========================================================================================================================================
484 extern bool oC_GPIO_LLD_ArePinsDefined( oC_Pins_t Pins );
485 //==========================================================================================================================================
495 //==========================================================================================================================================
496 extern bool oC_GPIO_LLD_ArePinsCorrect( oC_Pins_t Pins );
497 //==========================================================================================================================================
522 //==========================================================================================================================================
523 extern bool oC_GPIO_LLD_IsSinglePin( oC_Pins_t Pins );
524 
525 //==========================================================================================================================================
543 //==========================================================================================================================================
544 extern oC_Pins_t oC_GPIO_LLD_GetPinsFor( oC_Port_t Port , oC_PinsMask_t Pins );
545 
546 //==========================================================================================================================================
556 //==========================================================================================================================================
557 extern const char * oC_GPIO_LLD_GetPortName( oC_Port_t Port );
558 //==========================================================================================================================================
569 //==========================================================================================================================================
570 extern const char * oC_GPIO_LLD_GetPinName( oC_Pin_t Pin );
571 //==========================================================================================================================================
586 //==========================================================================================================================================
587 extern oC_ErrorCode_t oC_GPIO_LLD_SetDriverInterruptHandler( oC_GPIO_LLD_Interrupt_t Handler );
588 //==========================================================================================================================================
607 //==========================================================================================================================================
608 extern oC_ErrorCode_t oC_GPIO_LLD_BeginConfiguration( oC_Pins_t Pins );
609 //==========================================================================================================================================
628 //==========================================================================================================================================
629 extern oC_ErrorCode_t oC_GPIO_LLD_FinishConfiguration( oC_Pins_t Pins );
630 //==========================================================================================================================================
645 //==========================================================================================================================================
646 extern oC_ErrorCode_t oC_GPIO_LLD_SetPower( oC_Pins_t Pins , oC_Power_t Power );
647 //==========================================================================================================================================
661 //==========================================================================================================================================
662 extern oC_ErrorCode_t oC_GPIO_LLD_ReadPower( oC_Pins_t Pins , oC_Power_t * outPower );
663 //==========================================================================================================================================
674 //==========================================================================================================================================
675 extern bool oC_GPIO_LLD_IsPinProtected( oC_Pins_t Pins );
676 //==========================================================================================================================================
691 //==========================================================================================================================================
692 extern oC_ErrorCode_t oC_GPIO_LLD_UnlockProtection( oC_Pins_t Pins , oC_GPIO_LLD_Protection_t Protection );
693 //==========================================================================================================================================
707 //==========================================================================================================================================
708 extern oC_ErrorCode_t oC_GPIO_LLD_LockProtection( oC_Pins_t Pins );
709 //==========================================================================================================================================
720 //==========================================================================================================================================
721 extern oC_ErrorCode_t oC_GPIO_LLD_CheckIsPinUnlocked( oC_Pins_t Pins , bool * outPinUnlocked );
722 //==========================================================================================================================================
737 //==========================================================================================================================================
738 extern oC_ErrorCode_t oC_GPIO_LLD_SetSpeed( oC_Pins_t Pins , oC_GPIO_LLD_Speed_t Speed );
739 //==========================================================================================================================================
754 //==========================================================================================================================================
755 extern oC_ErrorCode_t oC_GPIO_LLD_ReadSpeed( oC_Pins_t Pins , oC_GPIO_LLD_Speed_t * outSpeed );
756 //==========================================================================================================================================
771 //==========================================================================================================================================
772 extern oC_ErrorCode_t oC_GPIO_LLD_SetCurrent( oC_Pins_t Pins , oC_GPIO_LLD_Current_t Current );
773 //==========================================================================================================================================
788 //==========================================================================================================================================
789 extern oC_ErrorCode_t oC_GPIO_LLD_ReadCurrent( oC_Pins_t Pins , oC_GPIO_LLD_Current_t * outCurrent );
790 //==========================================================================================================================================
804 //==========================================================================================================================================
805 extern oC_ErrorCode_t oC_GPIO_LLD_SetMode( oC_Pins_t Pins , oC_GPIO_LLD_Mode_t Mode );
806 //==========================================================================================================================================
820 //==========================================================================================================================================
821 extern oC_ErrorCode_t oC_GPIO_LLD_ReadMode( oC_Pins_t Pins , oC_GPIO_LLD_Mode_t * outMode );
822 //==========================================================================================================================================
836 //==========================================================================================================================================
837 extern oC_ErrorCode_t oC_GPIO_LLD_SetPull( oC_Pins_t Pins , oC_GPIO_LLD_Pull_t Pull );
838 //==========================================================================================================================================
852 //==========================================================================================================================================
853 extern oC_ErrorCode_t oC_GPIO_LLD_ReadPull( oC_Pins_t Pins , oC_GPIO_LLD_Pull_t * outPull );
854 //==========================================================================================================================================
869 //==========================================================================================================================================
870 extern oC_ErrorCode_t oC_GPIO_LLD_SetOutputCircuit( oC_Pins_t Pins , oC_GPIO_LLD_OutputCircuit_t OutputCircuit );
871 //==========================================================================================================================================
886 //==========================================================================================================================================
887 extern oC_ErrorCode_t oC_GPIO_LLD_ReadOutputCircuit( oC_Pins_t Pins , oC_GPIO_LLD_OutputCircuit_t * outOutputCircuit );
888 //==========================================================================================================================================
903 //==========================================================================================================================================
904 extern oC_ErrorCode_t oC_GPIO_LLD_SetInterruptTrigger( oC_Pins_t Pins , oC_GPIO_LLD_IntTrigger_t InterruptTrigger );
905 //==========================================================================================================================================
920 //==========================================================================================================================================
921 extern oC_ErrorCode_t oC_GPIO_LLD_ReadInterruptTrigger( oC_Pins_t Pins , oC_GPIO_LLD_IntTrigger_t * outInterruptTrigger );
922 //==========================================================================================================================================
934 //==========================================================================================================================================
935 extern oC_ErrorCode_t oC_GPIO_LLD_SetPinsUsed( oC_Pins_t Pins );
936 //==========================================================================================================================================
948 //==========================================================================================================================================
949 extern oC_ErrorCode_t oC_GPIO_LLD_SetPinsUnused( oC_Pins_t Pins );
950 //==========================================================================================================================================
963 //==========================================================================================================================================
964 extern oC_ErrorCode_t oC_GPIO_LLD_CheckIsPinUsed( oC_Pins_t Pins , bool * outPinUsed );
965 //==========================================================================================================================================
980 //==========================================================================================================================================
981 extern oC_ErrorCode_t oC_GPIO_LLD_ArePinsUnused( oC_Pins_t Pins , bool * outPinsUnused );
982 //==========================================================================================================================================
996 //==========================================================================================================================================
997 extern oC_ErrorCode_t oC_GPIO_LLD_WriteData( oC_Pins_t Pins , oC_PinsMask_t Data );
998 //==========================================================================================================================================
1011 //==========================================================================================================================================
1012 extern oC_ErrorCode_t oC_GPIO_LLD_ReadData( oC_Pins_t Pins , oC_PinsMask_t * outData );
1013 //==========================================================================================================================================
1051 //==========================================================================================================================================
1052 // TODO: Change to Input / Output
1053 extern oC_ErrorCode_t oC_GPIO_LLD_ReadDataReference( oC_Pins_t Pins , oC_UInt_t ** outDataReference );
1054 //==========================================================================================================================================
1082 //==========================================================================================================================================
1083 extern oC_Pins_t oC_GPIO_LLD_GetHighStatePins( oC_Pins_t Pins );
1084 //==========================================================================================================================================
1114 //==========================================================================================================================================
1115 extern oC_Pins_t oC_GPIO_LLD_GetLowStatePins( oC_Pins_t Pins );
1116 //==========================================================================================================================================
1148 //==========================================================================================================================================
1149 extern bool oC_GPIO_LLD_IsPinsState( oC_Pins_t Pins , oC_GPIO_LLD_PinsState_t ExpectedPinsState );
1150 //==========================================================================================================================================
1170 //==========================================================================================================================================
1171 extern void oC_GPIO_LLD_SetPinsState( oC_Pins_t Pins , oC_GPIO_LLD_PinsState_t PinsState );
1172 //==========================================================================================================================================
1198 //==========================================================================================================================================
1199 extern void oC_GPIO_LLD_TogglePinsState( oC_Pins_t Pins );
1200 
1201 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
1202 
1204 #endif /* GPIO module is not defined */
1205 #endif /* GPIOTEM_PORTABLE_INC_LLD_OC_GPIO_LLD_H_ */
#define oC_ModuleChannel_DefineType
defines module channel type
Definition: oc_channels.h:541
The file with interface for the machine module.
oC_Power_t
stores registers power state
Definition: oc_stdtypes.h:249