Choco OS  V.0.16.9.0
Join to the chocolate world
oc_interrupts.h
Go to the documentation of this file.
1 
32 #ifndef SYSTEM_PORTABLE_INC_OC_INTERRUPTS_H_
33 #define SYSTEM_PORTABLE_INC_OC_INTERRUPTS_H_
34 
35 #include <oc_interrupts_defs.h>
36 #include <oc_ba.h>
37 #include <oc_compiler.h>
38 #include <oc_mcs.h>
39 
45 #define _________________________________________MACROS_SECTION_____________________________________________________________________________
46 
49 //==========================================================================================================================================
54 //==========================================================================================================================================
55 #define oC_InterruptType_(TYPE_NAME) oC_1WORD_FROM_2( oC_InterruptType_ , TYPE_NAME )
56 //==========================================================================================================================================
61 //==========================================================================================================================================
62 #define oC_InterruptIndex_(BASE_NAME,TYPE_NAME) oC_1WORD_FROM_4( oC_InterruptIndex_ , BASE_NAME , _ , TYPE_NAME )
63 //==========================================================================================================================================
68 //==========================================================================================================================================
69 #define oC_InterruptNumber_(BASE_NAME,TYPE_NAME) oC_1WORD_FROM_4( oC_InterruptNumber_ , BASE_NAME , _ , TYPE_NAME )
70 //==========================================================================================================================================
80 //==========================================================================================================================================
81 #define oC_InterruptBaseAddress_(BASE_NAME,TYPE_NAME) oC_1WORD_FROM_4( oC_InterruptBaseAddress_ , BASE_NAME , _ , TYPE_NAME )
82 
83 //==========================================================================================================================================
109 //==========================================================================================================================================
110 #define oc_InterruptHandlerName(BASE_NAME,TYPE_NAME) oC_1WORD_FROM_4( oC_InterruptHandler_ , BASE_NAME , _ , TYPE_NAME )
111 //==========================================================================================================================================
138 //==========================================================================================================================================
139 #define oC_InterruptHandlerPrototype(BASE_NAME,TYPE_NAME) void oc_InterruptHandlerName(BASE_NAME , TYPE_NAME) (void)
140 //==========================================================================================================================================
145 //==========================================================================================================================================
146 #define oC_InterruptHandlerWeakPrototype(BASE_NAME,TYPE_NAME) oC_InterruptHandlerPrototype(BASE_NAME , TYPE_NAME) __attribute__ ((interrupt, weak, alias(oC_TO_STRING(oC_DEFAULT_INTERRUPT_HANDLER_NAME))))
147 //==========================================================================================================================================
166 //==========================================================================================================================================
167 #define oC_InterruptHandler(BASE_NAME,TYPE_NAME) oC_InterruptHandlerPrototype(BASE_NAME , TYPE_NAME)
168 
169 //==========================================================================================================================================
225 //==========================================================================================================================================
226 #define oC_DefaultInterruptHandler void oC_DEFAULT_INTERRUPT_HANDLER_NAME(void)
227 //==========================================================================================================================================
232 //==========================================================================================================================================
233 #define oC_DefaultInterruptHandlerPrototype oC_DefaultInterruptHandler __attribute__ ((interrupt))
234 
235 //==========================================================================================================================================
240 //==========================================================================================================================================
241 #define oC_ResetInterruptHandlerName Reset_Handler
242 //==========================================================================================================================================
247 //==========================================================================================================================================
248 #define oC_ResetInterruptHandler void oC_ResetInterruptHandlerName( void )
249 //==========================================================================================================================================
254 //==========================================================================================================================================
255 #define oC_ResetInterruptHandlerPrototype oC_ResetInterruptHandler
256 
257 #undef _________________________________________MACROS_SECTION_____________________________________________________________________________
258 
265 #define _________________________________________TYPES_SECTION______________________________________________________________________________
266 
269 //==========================================================================================================================================
282 //==========================================================================================================================================
283 typedef enum
284 {
285 #define MAKE(TYPE_NAME) oC_InterruptType_(TYPE_NAME) ,
287  oC_InterruptType_(NumberOfElements)
288 #undef MAKE
290 
291 //==========================================================================================================================================
298 //==========================================================================================================================================
299 typedef enum
300 {
301 #define MAKE_INTERRUPT_NUMBER(BASE_ADDRESS_NAME , TYPE_NAME , PRIORITY , NUMBER) \
302  oC_InterruptIndex_(BASE_ADDRESS_NAME , TYPE_NAME) = NUMBER ,
303  oC_MACHINE_INTERRUPTS_LIST(MAKE_INTERRUPT_NUMBER)
304 #undef MAKE_INTERRUPT_NUMBER
305  oC_InterruptIndex_NumberOfElements
307 
308 //==========================================================================================================================================
315 //==========================================================================================================================================
316 typedef enum
317 {
318 #define MAKE_INTERRUPT_PRIORITY(BASE_ADDRESS_NAME , TYPE_NAME , PRIORITY , NUMBER) \
319  oC_InterruptNumber_(BASE_ADDRESS_NAME , TYPE_NAME) = PRIORITY ,
320  oC_MACHINE_INTERRUPTS_LIST(MAKE_INTERRUPT_PRIORITY)
321 #undef MAKE_INTERRUPT_PRIORITY
322  oC_InterruptNumber_NumberOfElements
324 
325 //==========================================================================================================================================
333 //==========================================================================================================================================
334 typedef enum
335 {
336 #define MAKE(BASE_ADDRESS_NAME , TYPE_NAME , PRIORITY , NUMBER) \
337  oC_InterruptBaseAddress_(BASE_ADDRESS_NAME , TYPE_NAME) = oC_BaseAddress_(BASE_ADDRESS_NAME) ,
339 #undef MAKE
340  oC_InterruptBaseAddress_NumberOfElements
342 
343 //==========================================================================================================================================
361 //==========================================================================================================================================
362 typedef void (*oC_InterruptHandler_t)(void);
363 
364 //==========================================================================================================================================
371 //==========================================================================================================================================
372 typedef struct
373 {
374  oC_InterruptBaseAddress_t BaseAddress;
375  oC_InterruptType_t Type;
376  oC_InterruptIndex_t InterruptIndex;
377  oC_InterruptNumber_t InterruptNumber;
379 
380 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
381 
388 #define _________________________________________PROTOTYPES_SECTION_________________________________________________________________________
389 
390 extern const oC_InterruptData_t * oC_Interrupt_GetData( oC_InterruptBaseAddress_t BaseAddress , oC_InterruptType_t InterruptType );
391 
392 #undef _________________________________________PROTOTYPES_SECTION_________________________________________________________________________
393 
394 
400 #define _________________________________________VARIABLES_SECTION__________________________________________________________________________
401 
404 //==========================================================================================================================================
421 //==========================================================================================================================================
423 
424 //==========================================================================================================================================
428 //==========================================================================================================================================
429 extern const oC_InterruptData_t oC_InterruptData[oC_InterruptIndex_NumberOfElements];
430 
431 #undef _________________________________________VARIABLES_SECTION__________________________________________________________________________
432 
434 #endif /* SYSTEM_PORTABLE_INC_OC_INTERRUPTS_H_ */
oC_InterruptHandler_t oC_UnexpectedInterruptHandler
Handler for unexpected interrupts.
Definition: oc_interrupts.c:43
#define oC_MACHINE_INTERRUPTS_TYPES_LIST(ADD_INTERRUPT_TYPE)
definition with types of interrupts
void(* oC_InterruptHandler_t)(void)
Stores interrupt handler pointer.
The file contains definitions for the compiler, that helps to manage errors, etc. ...
#define oC_InterruptType_(TYPE_NAME)
Returns value from oC_InterruptType_t. It is an index of interrupt type.
Definition: oc_interrupts.h:55
#define oC_MACHINE_INTERRUPTS_LIST(ADD_INTERRUPT)
Definition of interrupts.
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
oC_InterruptType_t
Stores interrupt type.
oC_InterruptBaseAddress_t
Base address connected to the interrupt.
Contains machine core specific functions.
const oC_InterruptData_t oC_InterruptData[oC_InterruptIndex_NumberOfElements]
Data for interrupts.
Definition: oc_interrupts.c:66
oC_InterruptIndex_t
Index of interrupt in the interrupt vector.
oC_InterruptNumber_t
Number of interrupt in system.
Interface for Machine Base Addresses (BA) module.