Choco OS  V.0.16.9.0
Join to the chocolate world
oc_channels.c
Go to the documentation of this file.
1 
27 #include <oc_channels.h>
28 #include <stdbool.h>
29 #include <stddef.h>
30 #include <oc_assert.h>
31 #include <oc_mcs.h>
32 
34 #define MAKE_CHANNEL(CHANNEL_NAME,BASE_ADDRESS_NAME,REGISTER_MAP_NAME,...) \
35  [oC_Channel_(CHANNEL_NAME)] = { \
36  .BaseAddress = oC_BaseAddress_(BASE_ADDRESS_NAME),\
37  .PowerBaseAddress = oC_PowerBaseAddress_(BASE_ADDRESS_NAME),\
38  .PowerOffset = oC_PowerOffset_(BASE_ADDRESS_NAME),\
39  .PowerBitIndex = oC_PowerBit_(BASE_ADDRESS_NAME),\
40  .RegisterMap = oC_RegisterMap_(REGISTER_MAP_NAME),\
41  .ChannelName = #CHANNEL_NAME ,\
42  },
43  oC_MODULES_LIST(oC_Make_ModuleWithChannels)
44 #undef MAKE_CHANNEL
45 };
46 
52 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
53 //==========================================================================================================================================
66 //==========================================================================================================================================
68 {
69  bool success = false;
70  const oC_InterruptData_t * interruptData = oC_Interrupt_GetData(oC_Channel_GetBaseAddress(Channel),InterruptType);
71 
72  if(interruptData != NULL)
73  {
74  success = oC_MCS_SetInterruptPriority( interruptData->InterruptNumber , Priority );
75  }
76 
77  return success;
78 }
79 //==========================================================================================================================================
92 //==========================================================================================================================================
94 {
95  bool success = false;
96  const oC_InterruptData_t * interruptData = oC_Interrupt_GetData(oC_Channel_GetBaseAddress(Channel),InterruptType);
97 
98  if(interruptData != NULL)
99  {
100  success = oC_MCS_EnableInterrupt(interruptData->InterruptNumber);
101  }
102 
103  return success;
104 }
105 
106 //==========================================================================================================================================
119 //==========================================================================================================================================
121 {
122  bool success = false;
123  const oC_InterruptData_t * interruptData = oC_Interrupt_GetData(oC_Channel_GetBaseAddress(Channel),InterruptType);
124 
125  if(interruptData != NULL)
126  {
127  success = oC_MCS_DisableInterrupt(interruptData->InterruptNumber);
128  }
129 
130  return success;
131 }
132 
133 //==========================================================================================================================================
146 //==========================================================================================================================================
148 {
149  bool success = false;
150  const oC_InterruptData_t * interruptData = oC_Interrupt_GetData(oC_Channel_GetBaseAddress(Channel),InterruptType);
151 
152  if(interruptData != NULL)
153  {
154  success = oC_MCS_IsInterruptEnabled(interruptData->InterruptNumber);
155  }
156 
157  return success;
158 }
159 
160 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________
const oC_ChannelData_t oC_ChannelsData[]
stores data of channels
Definition: oc_channels.c:33
bool oC_MCS_SetInterruptPriority(IRQn_Type InterruptNumber, oC_InterruptPriotity_t Priority)
sets interrupt priority
Definition: oc_mcs.c:400
oC_InterruptPriotity_t
stores priority of interrupts
Definition: oc_mcs.h:174
stores data for channel
Definition: oc_channels.h:610
bool oC_Channel_EnableInterruptFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType)
enables interrupt according to channel and type
Definition: oc_channels.c:93
bool oC_MCS_EnableInterrupt(IRQn_Type InterruptNumber)
enables interrupt with specified number
Definition: oc_mcs.c:368
structure with data for interrupts
const oC_InterruptData_t * oC_Interrupt_GetData(oC_InterruptBaseAddress_t BaseAddress, oC_InterruptType_t InterruptType)
returns data pointer for interrupt
Definition: oc_interrupts.c:98
#define oC_Channel_GetBaseAddress(Channel)
returns base address assigned to the channel
Definition: oc_channels.h:327
oC_Channel_t
stores machine channel
Definition: oc_channels.h:573
bool oC_MCS_IsInterruptEnabled(IRQn_Type InterruptNumber)
checks if interrupt is enabled
Definition: oc_mcs.c:390
bool oC_Channel_IsInterruptEnabledFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType)
checks if interrupt is enabled according to channel and type
Definition: oc_channels.c:147
oC_InterruptType_t
Stores interrupt type.
bool oC_Channel_DisableInterruptFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType)
disables interrupt according to channel and type
Definition: oc_channels.c:120
FILE__DESCRIPTION
Contains machine core specific functions.
bool oC_Channel_SetInterruptPriorityFunction(oC_Channel_t Channel, oC_InterruptType_t InterruptType, oC_InterruptPriotity_t Priority)
set interrupt priority according to channel and type
Definition: oc_channels.c:67
#define oC_Make_ModuleWithChannels(MODULE_NAME)
makes module with channels. Not for user usage.
Definition: oc_channels.h:193
bool oC_MCS_DisableInterrupt(IRQn_Type InterruptNumber)
disables interrupt with specified number
Definition: oc_mcs.c:379
The file with interface for Channel module.
#define NULL
pointer to a zero
Definition: oc_null.h:37