Choco OS
V.0.16.9.0
Join to the chocolate world
|
Module for managing machine module channels. More...
Data Structures | |
struct | oC_ChannelData_t |
stores data for channel More... | |
Macros | |
#define | oC_ChannelMask |
mask for channel type width More... | |
#define | oC_Channel_(CHANNEL_NAME, ...) |
returns channel for oC_Channel_t type | |
#define | oC_ChannelModule_(CHANNEL_NAME, ...) |
returns module index of channel with the given name | |
#define | oC_ChannelStartIndex_(MODULE_NAME, ...) |
returns start channel index for module More... | |
#define | oC_ChannelEndIndex_(MODULE_NAME, ...) |
returns end channel index for module More... | |
#define | oC_ModuleChannel_(MODULE_NAME, CHANNEL_NAME, ...) |
returns channel of module More... | |
#define | oC_Channel_InterruptHandlerName(INTERRUPT_TYPE_NAME) |
returns name of interrupt handler More... | |
#define | oC_Channel_InterruptHandlerPrototype(INTERRUPT_TYPE_NAME, ChannelVariableName) |
Prototype for channels interrupt. More... | |
#define | oC_Make_ModuleWithChannels(MODULE_NAME) |
makes module with channels. Not for user usage. | |
#define | oC_Make_ChannelForModule(CHANNEL_NAME, ...) |
makes module with channels. Not for user usage. | |
#define | oC_Make_InterruptHandlerForChannel(CHANNEL_NAME, BASE_NAME, ...) |
makes handler of interrupt for channel. Not for user usage. | |
#define | oC_ChannelData_(CHANNEL_NAME) |
returns pointer to channel's data More... | |
#define | oC_Channel_IsModuleDefined(MODULE_NAME) |
macro for checking if module is defined More... | |
#define | oC_Channel_GetData(Channel) |
returns data of channel More... | |
#define | oC_Channel_IsCorrect(MODULE_NAME, Channel) |
checks if channel is correct More... | |
#define | oC_Channel_ToIndex(MODULE_NAME, Channel) |
returns index in module according to channel More... | |
#define | oC_Channel_FromIndex(MODULE_NAME, ChannelIndex) |
returns channel according to index in module More... | |
#define | oC_Channel_GetBaseAddress(Channel) |
returns base address assigned to the channel More... | |
#define | oC_Channel_GetPowerBaseAddress(Channel) |
returns base address of power register More... | |
#define | oC_Channel_GetPowerOffset(Channel) |
returns offset of power register More... | |
#define | oC_Channel_GetPowerBitIndex(Channel) |
returns index of bit for power register More... | |
#define | oC_Channel_GetRegisterMap(Channel) |
returns index of register map More... | |
#define | oC_Channel_GetName(Channel) |
returns name of channel More... | |
#define | oC_Channel_Register(Channel, REGISTER_NAME) |
checks if base address of power register exist More... | |
#define | oC_ModuleChannel_NumberOfElements(MODULE_NAME) |
Number of elements in module channel. More... | |
#define | oC_Channel_Foreach(MODULE_NAME, Channel) |
loop for each module channel More... | |
#define | oC_Channel_InterruptHandler(ChannelVariableName) |
creates common interrupt handler for channel More... | |
#define | oC_ModuleChannel_DefineType |
defines module channel type More... | |
Typedefs | |
typedef oC_Channel_t | oC_ChannelIndex_t |
stores index of channel More... | |
typedef void(* | oC_ChannelInterruptHandler_t) (oC_Channel_t Channel) |
stores pointer of channel interrupt function More... | |
Enumerations |
Variables | |
const oC_ChannelData_t | oC_ChannelsData [] |
stores data of channels More... | |
The module contains interface for managing machine module channels, for example SPI, UART, TIMER and more...
#define oC_Channel_Foreach | ( | MODULE_NAME, | |
Channel | |||
) |
Creates a loop for each channel in the module.
MODULE_NAME | name of module from the oc_channels_defs.h file |
Channel | A channel variable name |
Definition at line 485 of file oc_channels.h.
#define oC_Channel_FromIndex | ( | MODULE_NAME, | |
ChannelIndex | |||
) |
The macro returns channel from the index in the given module. Example of usage:
Definition at line 313 of file oc_channels.h.
#define oC_Channel_GetBaseAddress | ( | Channel | ) |
The macro returns base address of channel.
Definition at line 327 of file oc_channels.h.
#define oC_Channel_GetData | ( | Channel | ) |
The macro is to get channel's data. The parameter, that is given to it should be variable (channel index). If you want to get data of channel according to the name, you should use oC_ChannelData_.
Channel | Variable with channel index |
Example of usage:
Definition at line 266 of file oc_channels.h.
#define oC_Channel_GetName | ( | Channel | ) |
The macro returns printable name of the channel.
Example of usage:
Definition at line 391 of file oc_channels.h.
#define oC_Channel_GetPowerBaseAddress | ( | Channel | ) |
The macro returns base address of power register.
Definition at line 344 of file oc_channels.h.
#define oC_Channel_GetPowerBitIndex | ( | Channel | ) |
The macro returns index of bit in power register, that should be set to enable power for the register map that is assigned with the channel.
Definition at line 365 of file oc_channels.h.
#define oC_Channel_GetPowerOffset | ( | Channel | ) |
The macro returns offset of power register.
Definition at line 355 of file oc_channels.h.
#define oC_Channel_GetRegisterMap | ( | Channel | ) |
The macro returns index of register map connected to the channel.
Definition at line 374 of file oc_channels.h.
#define oC_Channel_InterruptHandler | ( | ChannelVariableName | ) |
The macro creates interrupt handler for channel (common for each module channels). It require 2 additional definitions before usage: MODULE_NAME with name of the module from oc_channels_defs.h file and INTERRUPT_TYPE_NAME from the oc_interrupts_defs.h file.
The function, that is created by the macro is local (static).
ChannelVariableName | Name of the variable, that stores channel |
Example of usage:
Definition at line 514 of file oc_channels.h.
#define oC_Channel_InterruptHandlerName | ( | INTERRUPT_TYPE_NAME | ) |
The macro returns name of channel interrupt handler name.
INTERRUPT_TYPE_NAME | Name of the type from oc_interrupts_defs.h file |
Example of usage:
Definition at line 161 of file oc_channels.h.
#define oC_Channel_InterruptHandlerPrototype | ( | INTERRUPT_TYPE_NAME, | |
ChannelVariableName | |||
) |
This is a macro for definition of channels interrupt handler prototype.
INTERRUPT_TYPE_NAME | Name of the type from oc_interrupts_defs.h file |
ChannelVariableName | Name of variable, that will store channel |
Example of usage:
Definition at line 185 of file oc_channels.h.
#define oC_Channel_IsCorrect | ( | MODULE_NAME, | |
Channel | |||
) |
The macro is for checking if the given channel is correct for the given module.
Definition at line 283 of file oc_channels.h.
#define oC_Channel_IsModuleDefined | ( | MODULE_NAME | ) |
The macro checks if the module with the given name is defined. It can be used only in hash conditions. Example of usage:
Definition at line 244 of file oc_channels.h.
#define oC_Channel_Register | ( | Channel, | |
REGISTER_NAME | |||
) |
The macro returns true if base address of the power register is configured for the given channel.
Definition at line 455 of file oc_channels.h.
#define oC_Channel_ToIndex | ( | MODULE_NAME, | |
Channel | |||
) |
The macro returns index of channel in the given module. Example of usage:
Definition at line 298 of file oc_channels.h.
#define oC_ChannelData_ | ( | CHANNEL_NAME | ) |
The macro returns pointer to data from the oC_ChannelsData array for the given channel.
CHANNEL_NAME | Name of the channel from oc_channels_defs.h file |
Example of usage:
Definition at line 229 of file oc_channels.h.
#define oC_ChannelEndIndex_ | ( | MODULE_NAME, | |
... | |||
) |
This macro returns end index of channels for the given module. Channels are defined in the oC_Channel_t type. Each channel has it's own unique number (index) in the global array named oC_ChannelsData. Thanks to the index, it is possible to read data of the channel, such as register map, base address, power register data, etc.
MODULE_NAME | Name of module of channels |
Example of usage:
Definition at line 125 of file oc_channels.h.
#define oC_ChannelMask |
This definition keep mask for the oC_Channel_t type. It has all bits taken by this type set. It is created using #oC_CHANNEL_MASK_WIDTH from the oc_channels_defs.h file.
Definition at line 62 of file oc_channels.h.
#define oC_ChannelStartIndex_ | ( | MODULE_NAME, | |
... | |||
) |
This macro returns start index of channels for the given module. Channels are defined in the oC_Channel_t type. Each channel has it's own unique number (index) in the global array named oC_ChannelsData. Thanks to the index, it is possible to read data of the channel, such as register map, base address, power register data, etc.
Example of usage:
Definition at line 100 of file oc_channels.h.
#define oC_ModuleChannel_ | ( | MODULE_NAME, | |
CHANNEL_NAME, | |||
... | |||
) |
This macro returns channel of the module channel type. A module channels should be defined first by using oC_ModuleChannel_DefineType macro.
MODULE_NAME | Name of module of channels |
CHANNEL_NAME | Name of a channel from oc_channels_defs.h file |
Definition at line 137 of file oc_channels.h.
#define oC_ModuleChannel_DefineType |
The macro is for definition of channel type for the module. Require MODULE_NAME definition
Example of usage:
Definition at line 541 of file oc_channels.h.
#define oC_ModuleChannel_NumberOfElements | ( | MODULE_NAME | ) |
Definition with number of channels in module channel type.
Definition at line 465 of file oc_channels.h.
typedef oC_Channel_t oC_ChannelIndex_t |
The type is for storing index of a channel in a module. For example, for the SPI1 channel, the channel index will be 1, and for UART1 it will be also 1.
Definition at line 597 of file oc_channels.h.
typedef void(* oC_ChannelInterruptHandler_t) (oC_Channel_t Channel) |
The type is for storing special interrupt handler - common for each channel of a module. A parameter #Channel point to the channel, that cause the interrupt.
Channel | Interrupt source |
Definition at line 644 of file oc_channels.h.
enum oC_Channel_t |
The type is for storing machine channels. This type is generated from definitions in the oc_channels_defs.h file. The channel is an ID in global array with assigned base address and register map. This type is generic for all machine modules (UART,SPI,I2C,GPIO,etc) and each channel in this enum is different.
Definition at line 573 of file oc_channels.h.
const oC_ChannelData_t oC_ChannelsData[] |
This is a global array, that stores data for each channel. Channels are indexes in the array.
Definition at line 33 of file oc_channels.c.