1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
22 #include "irq_types.h"
\r
25 typedef void ( * func_t)(void);
\r
29 #if (OS_SC2==STD_ON) || (OS_SC4==STD_ON)
\r
30 #define HAVE_SC2_SC4(_value) _value
\r
32 #define HAVE_SC2_SC4(_value)
\r
35 #define IRQ_NAME(_vector) IrqVector_ ## _vector
\r
37 #define IRQ_DECL_ISR2_TIMING_PROT( \
\r
39 _max_all_interrupt_lock_time, \
\r
41 _os_interrupt_lock_budget, \
\r
43 _resource_lock_list )
\r
46 #define IRQ_DECL_ISR1(_name, _vector, _core, _prio, _entry ) \
\r
47 const OsIsrConstType Irq_VectorConst_ ## _vector = { \
\r
49 .vector = (_vector), \
\r
52 .entry = (_entry), \
\r
53 .type = ISR_TYPE_1, \
\r
57 #define IRQ_DECL_ISR2(_name,_vector, _core, _prio, _entry, _resource_mask, _timing_prot) \
\r
58 const OsIsrConstType Irq_VectorConst_ ## _vector = { \
\r
60 .vector = (_vector), \
\r
63 .entry = (_entry), \
\r
64 .type = ISR_TYPE_2, \
\r
65 .resourceMask = (_resource_mask), \
\r
66 .timingProtPtr = (_timing_prot) \
\r
70 #define IRQ_ATTACH(_vector) Irq_Attach(&Irq_VectorConst_ ## _vector)
\r
73 * IRQ_DECL_ISR2_RESOURCE(res2, RES_ID_2, 500000U ); // Max 50us
\r
74 * IRQ_DECL_ISR2_TIMING_PROT(timing,0,0,0,0,res2);
\r
75 * IRQ_DECL_ISR2("MyIsr",10,10,MyIsr,HAVE_SC2_SC4(RES_ID_1),HAVE_SC2_SC4(timing));
\r
79 // typedef _Bool IsrType;
\r
82 * Init the interrupt controller
\r
84 void Irq_Init( void );
\r
87 #if defined(CFG_HC1X)
\r
90 * @param stack Ptr to the current stack.
\r
91 * @param irq_nr The nr. of the interrupt being handled.
\r
93 * The stack holds C, NVGPR, VGPR and the EXC frame.
\r
96 void *Irq_Entry( uint8_t irq_nr, void *stack );
\r
101 * @param stack_p Ptr to the current stack.
\r
103 * The stack holds C, NVGPR, VGPR and the EXC frame.
\r
106 void *Irq_Entry( void *stack_p );
\r
111 * Generates a soft interrupt
\r
114 void Irq_GenerateSoftInt( IrqType vector );
\r
116 * Get the current priority from the interrupt controller.
\r
120 uint8_t Irq_GetCurrentPriority( Cpu_t cpu);
\r
123 * Set the priority in the interrupt controller for vector
\r
125 void Irq_SetPriority( Cpu_t cpu, IrqType vector, uint8_t prio );
\r
127 void Irq_EnableVector( int16_t vector, int priority, int core );
\r
130 void Irq_EOI( void );
\r
133 #endif /* IRQ_H_ */
\r