34 #ifndef SYSTEM_PORTABLE_INC_OC_CHANNELS_H_ 35 #define SYSTEM_PORTABLE_INC_OC_CHANNELS_H_ 38 #include <oc_channels_defs.h> 49 #define _________________________________________MACROS_SECTION_____________________________________________________________________________ 62 #define oC_ChannelMask ( (1<<(oC_CHANNEL_MASK_WIDTH)) - 1 ) 70 #define oC_Channel_(CHANNEL_NAME,...) oC_1WORD_FROM_2(oC_Channel_ , CHANNEL_NAME) 77 #define oC_ChannelModule_(CHANNEL_NAME,...) oC_1WORD_FROM_2(oC_ChannelModule_ , CHANNEL_NAME) 100 #define oC_ChannelStartIndex_(MODULE_NAME,...) oC_1WORD_FROM_3(oC_Channel_ , MODULE_NAME , _StartIndex ) 125 #define oC_ChannelEndIndex_(MODULE_NAME,...) oC_1WORD_FROM_3(oC_Channel_ , MODULE_NAME , _EndIndex ) 137 #define oC_ModuleChannel_(MODULE_NAME,CHANNEL_NAME,...) oC_1WORD_FROM_4(oC_ , MODULE_NAME , _Channel_ , CHANNEL_NAME ) 161 #define oC_Channel_InterruptHandlerName(INTERRUPT_TYPE_NAME) oC_1WORD_FROM_2( INTERRUPT_TYPE_NAME , ChannelHandler ) 185 #define oC_Channel_InterruptHandlerPrototype(INTERRUPT_TYPE_NAME,ChannelVariableName) static void oC_Channel_InterruptHandlerName(INTERRUPT_TYPE_NAME) ( oC_Channel_t ChannelVariableName ) 193 #define oC_Make_ModuleWithChannels(MODULE_NAME) oC_MODULE_CHANNELS_(MODULE_NAME)(MAKE_CHANNEL) 200 #define oC_Make_ChannelForModule(CHANNEL_NAME,...) oC_ModuleChannel_(MODULE_NAME,CHANNEL_NAME) = oC_Channel_(CHANNEL_NAME) , 208 #define oC_Make_InterruptHandlerForChannel(CHANNEL_NAME,BASE_NAME,...) \ 209 oC_InterruptHandler(BASE_NAME,INTERRUPT_TYPE_NAME) \ 211 oC_Channel_InterruptHandlerName(INTERRUPT_TYPE_NAME)(oC_Channel_(CHANNEL_NAME));\ 229 #define oC_ChannelData_(CHANNEL_NAME) (&oC_ChannelsData[oC_Channel_(CHANNEL_NAME)]) 244 #define oC_Channel_IsModuleDefined(MODULE_NAME) (defined(oC_MODULE_CHANNELS_##MODULE_NAME)) 266 #define oC_Channel_GetData(Channel) (&oC_ChannelsData[Channel]) 283 #define oC_Channel_IsCorrect(MODULE_NAME,Channel) ((((oC_Channel_t)(Channel)) > oC_ChannelStartIndex_(MODULE_NAME)) && (((oC_Channel_t)(Channel)) < oC_ChannelEndIndex_(MODULE_NAME))) 298 #define oC_Channel_ToIndex(MODULE_NAME,Channel) (Channel - oC_ChannelStartIndex_(MODULE_NAME) - 1) 313 #define oC_Channel_FromIndex(MODULE_NAME,ChannelIndex) (ChannelIndex + oC_ChannelStartIndex_(MODULE_NAME) + 1) 327 #define oC_Channel_GetBaseAddress(Channel) oC_Channel_GetData(Channel)->BaseAddress 344 #define oC_Channel_GetPowerBaseAddress(Channel) oC_Channel_GetData(Channel)->PowerBaseAddress 355 #define oC_Channel_GetPowerOffset(Channel) oC_Channel_GetData(Channel)->PowerOffset 365 #define oC_Channel_GetPowerBitIndex(Channel) oC_Channel_GetData(Channel)->PowerBitIndex 374 #define oC_Channel_GetRegisterMap(Channel) oC_Channel_GetData(Channel)->RegisterMap 391 #define oC_Channel_GetName(Channel) oC_Channel_GetData(Channel)->ChannelName 407 #define oC_Channel_PowerBaseAddressExist(Channel) (oC_PowerBaseAddress_Exist( oC_Channel_GetPowerBaseAddress(Channel) ) ) 422 #define oC_Channel_PowerOffsetExist(Channel) (oC_PowerOffset_Exist( oC_Channel_GetPowerOffset(Channel) ) ) 437 #define oC_Channel_PowerBitIndexExist(Channel) (oC_PowerBit_Exist( oC_Channel_GetPowerBitIndex(Channel) ) ) 455 #define oC_Channel_Register(Channel,REGISTER_NAME) oC_RegisterByBaseAddress( oC_Channel_GetBaseAddress(Channel) , REGISTER_NAME ) 465 #define oC_ModuleChannel_NumberOfElements(MODULE_NAME) (oC_ChannelEndIndex_(MODULE_NAME) - oC_ChannelStartIndex_(MODULE_NAME) - 1) 485 #define oC_Channel_Foreach(MODULE_NAME,Channel) for(oC_Channel_t Channel = oC_ChannelStartIndex_(MODULE_NAME) + 1 ; Channel < oC_ChannelEndIndex_(MODULE_NAME) ; Channel++) 514 #define oC_Channel_InterruptHandler(ChannelVariableName) \ 515 oC_Channel_InterruptHandlerPrototype(INTERRUPT_TYPE_NAME,ChannelVariableName);\ 516 oC_MODULE_CHANNELS_(MODULE_NAME)(oC_Make_InterruptHandlerForChannel)\ 517 oC_Channel_InterruptHandlerPrototype(INTERRUPT_TYPE_NAME,ChannelVariableName) 541 #define oC_ModuleChannel_DefineType \ 543 oC_MODULE_CHANNELS_(MODULE_NAME)(oC_Make_ChannelForModule) \ 544 } oC_ModuleChannel_(MODULE_NAME,t) 546 #define oC_Channel_SetInterruptPriority( Channel , INTERRUPT_TYPE , InterruptPriority ) oC_Channel_SetInterruptPriorityFunction( Channel , oC_InterruptType_(INTERRUPT_TYPE) , InterruptPriority ) 547 #define oC_Channel_EnableInterrupt( Channel , INTERRUPT_TYPE ) oC_Channel_EnableInterruptFunction( Channel , oC_InterruptType_(INTERRUPT_TYPE) ) 548 #define oC_Channel_DisableInterrupt( Channel , INTERRUPT_TYPE ) oC_Channel_DisableInterruptFunction( Channel , oC_InterruptType_(INTERRUPT_TYPE) ) 549 #define oC_Channel_IsInterruptEnabled( Channel , INTERRUPT_TYPE ) oC_Channel_IsInterruptEnabledFunction( Channel , oC_InterruptType_(INTERRUPT_TYPE) ) 551 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________ 559 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 575 #define MAKE_MODULE(MODULE_NAME) \ 576 oC_ChannelStartIndex_(MODULE_NAME), \ 577 oC_MODULE_CHANNELS_(MODULE_NAME)(MAKE_CHANNEL) \ 578 oC_ChannelEndIndex_(MODULE_NAME), 579 #define MAKE_CHANNEL(CHANNEL_NAME,BASE_ADDRESS_NAME,REGISTER_MAP_NAME,...) oC_Channel_(CHANNEL_NAME) , 580 oC_MODULES_LIST(MAKE_MODULE)
581 oC_Channel_MaximumChannelNumber ,
582 oC_Channel_System = oC_Channel_MaximumChannelNumber,
583 oC_Channel_Software = oC_Channel_MaximumChannelNumber
599 #if oC_Channel_MaximumChannelNumber > oC_ChannelMask 600 # error Channel mask width is too small! 627 #define MAKE_MODULE(MODULE_NAME) oC_ChannelModule_(MODULE_NAME) , 628 oC_MODULES_LIST(MAKE_MODULE)
646 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 654 #define _________________________________________PROTOTYPES_SECTION_________________________________________________________________________ 661 #undef _________________________________________PROTOTYPES_SECTION_________________________________________________________________________ 669 #define _________________________________________VARIABLES_SECTION__________________________________________________________________________ 685 #undef _________________________________________VARIABLES_SECTION__________________________________________________________________________ The file with interface for registers module.
Contains macros for creating one word from more words in macros.
oC_RegisterMap_t RegisterMap
Index of register map.
bool oC_Channel_DisableInterruptFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType)
disables interrupt according to channel and type
void(* oC_ChannelInterruptHandler_t)(oC_Channel_t Channel)
stores pointer of channel interrupt function
oC_BaseAddress_t BaseAddress
Start address in memory.
const oC_ChannelData_t oC_ChannelsData[]
stores data of channels
oC_PowerBit_t
stores number of bit in the Power Register
const char * ChannelName
Name of the given register map.
oC_InterruptPriotity_t
stores priority of interrupts
oC_ChannelModule_t
stores index of channel module (UART,SPI,etc)
oC_PowerOffset_t
stores offset of the Power Register
oC_PowerOffset_t PowerOffset
Power register offset.
oC_Channel_t
stores machine channel
The file with interface for register maps module.
oC_InterruptType_t
Stores interrupt type.
bool oC_Channel_SetInterruptPriorityFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType, oC_InterruptPriotity_t Priority)
set interrupt priority according to channel and type
oC_RegisterMap_t
Type for storing register map ID.
oC_PowerBaseAddress_t PowerBaseAddress
Power register base address.
The file with interface interrupt module.
oC_PowerBaseAddress_t
stores base address of the Power Register
bool oC_Channel_IsInterruptEnabledFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType)
checks if interrupt is enabled according to channel and type
oC_PowerBit_t PowerBitIndex
Bit in power register for enabling power for the channel.
bool oC_Channel_EnableInterruptFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType)
enables interrupt according to channel and type
oC_Channel_t oC_ChannelIndex_t
stores index of channel
Interface for Machine Base Addresses (BA) module.
oC_BaseAddress_t
type for storing base address