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
21 * Since this types and methods defined here are used by the drivers, they should
\r
22 * include it. E.g. #include "isr.h"
\r
24 * This file is also used internally by the kernel
\r
27 * irq_types.h ( Vector enums )
\r
28 * irq.h ( Interface )
\r
31 * Os_Cfg.h needs types from isr.h
\r
35 /* ----------------------------[includes]------------------------------------*/
\r
36 /* ----------------------------[define]--------------------------------------*/
\r
38 #define ISR_TYPE_1 0
\r
39 #define ISR_TYPE_2 1
\r
41 /* ----------------------------[macro]---------------------------------------*/
\r
42 #define ISR_DECLARE_ISR2(_name, _entry, _unique, _vector,_priority,_app ) \
\r
43 const OsIsrConstType _entry ## _unique = { \
\r
44 .vector = _vector, \
\r
45 .type = ISR_TYPE_2, \
\r
46 .priority = _priority, \
\r
49 .resourceMask = 0, \
\r
50 .timingProtPtr = NULL, \
\r
54 #define _ISR_INSTALL_ISR2(_name, _entry, _unique, _vector,_priority,_app ) \
\r
56 const OsIsrConstType _entry ## _unique = { \
\r
57 .vector = _vector, \
\r
58 .type = ISR_TYPE_2, \
\r
59 .priority = _priority, \
\r
62 .resourceMask = 0, \
\r
63 .timingProtPtr = NULL, \
\r
66 Os_IsrAdd( & _entry ## _unique); \
\r
69 #define ISR_INSTALL_ISR2(_name,_entry, _vector,_priority,_app) \
\r
70 _ISR_INSTALL_ISR2(_name,_entry, __LINE__, _vector,_priority,_app)
\r
73 /* ----------------------------[typedef]-------------------------------------*/
\r
77 /* STD container : OsIsrResourceLock
\r
80 * OsIsrResourceLockBudget 1 Float in seconds (MAXRESOURCELOCKINGTIME)
\r
81 * OsIsrResourceLockResourceRef 1 Ref to OsResource
\r
84 typedef struct OsIsrResourceLock {
\r
85 uint32_t lockBudget;
\r
86 uint32_t lockResourceRef; /* Wrong type */
\r
87 } OsIsrResourceLockType;
\r
90 /* STD container : OsIsrTimingProtection
\r
93 * OsIsrAllInterruptLockBudget 0..1 float
\r
94 * OsIsrExecutionBudget 0..1 float
\r
95 * OsIsrOsInterruptLockBudget 0..1 float
\r
96 * OsIsrTimeFrame 0..1 float
\r
97 * OsIsrResourceLock[C] 0..*
\r
100 typedef struct OsIsrTimingProtection {
\r
101 uint32_t allInterruptLockBudget;
\r
102 uint32_t executionBudget;
\r
103 uint32_t osInterruptLockBudget;
\r
104 uint32_t timeFrame;
\r
105 uint32_t resourceLock; /* Wrong type */
\r
106 } OsIsrTimingProtectionType;
\r
109 void *curr; /* Current stack ptr( at swap time ) */
\r
110 void *top; /* Top of the stack( low address ) */
\r
111 uint32 size; /* The size of the stack */
\r
115 /* STD container : OsIsr
\r
118 * OsIsrCategory: 1 CATEGORY_1 or CATEGORY_2
\r
119 * OsIsrResourceRef: 0..* Reference to OsResources
\r
120 * OsIsrTimingProtection[C] 0..1
\r
131 /* Mapped against OsIsrResourceRef */
\r
132 uint32_t resourceMask;
\r
133 #if ( OS_USE_ISR_TIMING_PROT == STD_ON )
\r
134 /* Mapped against OsIsrTimingProtection[C] */
\r
135 OsIsrTimingProtectionType *timingProtPtr;
\r
137 void *timingProtPtr;
\r
146 OsIsrStackType stack;
\r
148 const OsIsrConstType *constPtr;
\r
152 /* ----------------------------[functions]-----------------------------------*/
\r
154 void Os_IsrInit( void );
\r
155 ISRType Os_IsrAdd( const OsIsrConstType * restrict isrPtr );
\r
156 const OsIsrConstType * Os_IsrGet( int16_t vector);
\r
157 void Os_IsrGetStackInfo( OsIsrStackType *stack );
\r