]> rtime.felk.cvut.cz Git - arc.git/blobdiff - include/isr.h
Merge branch 'mikulka' of git@rtime.felk.cvut.cz:arc into mikulka
[arc.git] / include / isr.h
index 73efee6580036c7f2b6024e9fc77f5e06d312db5..148dc3a4c6633f2670f1f71800bae4859bacd3ef 100644 (file)
@@ -21,7 +21,7 @@
 \r
 /*\r
  * INCLUDE "RULES"\r
- *  Since this types and methods defined here are used by the drivers, they should\r
+ *  Since the types and methods defined here are used by the drivers, they should\r
  *  include it. E.g. #include "isr.h"\r
  *\r
  *  This file is also used internally by the kernel\r
 #define ISR_TYPE_2                     1\r
 \r
 /* ----------------------------[macro]---------------------------------------*/\r
+#if 0\r
+//#ifdef CFG_DRIVERS_USE_CONFIG_ISRS\r
+#define ISR_INSTALL_ISR2( _name, _entry, _vector, _priority, _app )\r
+#define ISR_INSTALL_ISR1(_name,_entry, _vector,_priority,_app)\r
+#else\r
 #define ISR_DECLARE_ISR2(_name, _entry, _unique, _vector,_priority,_app )        \\r
-         const OsIsrConstType _entry ## _unique = { \\r
+         static const OsIsrConstType _entry ## _unique = { \\r
                        .vector = _vector,   \\r
                        .type = ISR_TYPE_2, \\r
                        .priority = _priority,      \\r
                        .appOwner = _app,      \\r
                  };                    \\r
 \r
-#define _ISR_INSTALL_ISR2(_name, _entry, _unique, _vector,_priority,_app )        \\r
+\r
+#define __ISR_INSTALL_ISR2(_name, _entry, _unique, _vector,_priority,_app )        \\r
        do { \\r
-         const OsIsrConstType _entry ## _unique = { \\r
+         static const OsIsrConstType _entry ## _unique = { \\r
                        .vector = _vector,   \\r
                        .type = ISR_TYPE_2, \\r
                        .priority = _priority,      \\r
          Os_IsrAdd( & _entry ## _unique);   \\r
        } while(0);\r
 \r
+\r
+\r
+#define _ISR_INSTALL_ISR2(_name,_entry, _unique, _vector,_priority,_app)        \\r
+               __ISR_INSTALL_ISR2(_name,_entry, _unique, _vector,_priority,_app)\r
+\r
 #define ISR_INSTALL_ISR2(_name,_entry, _vector,_priority,_app)        \\r
                _ISR_INSTALL_ISR2(_name,_entry, __LINE__, _vector,_priority,_app)\r
 \r
 \r
+#define ISR_DECLARE_ISR1(_name, _entry, _unique, _vector,_priority,_app )        \\r
+         static const OsIsrConstType _entry ## _unique = { \\r
+                       .vector = _vector,   \\r
+                       .type = ISR_TYPE_1, \\r
+                       .priority = _priority,      \\r
+                       .entry = _entry,      \\r
+                       .name = _name,      \\r
+                       .resourceMask = 0,  \\r
+                       .timingProtPtr = NULL, \\r
+                       .appOwner = _app,      \\r
+                 };                    \\r
+\r
+#define __ISR_INSTALL_ISR1(_name, _entry, _unique, _vector,_priority,_app )        \\r
+       do { \\r
+         static const OsIsrConstType _entry ## _unique = { \\r
+                       .vector = _vector,   \\r
+                       .type = ISR_TYPE_1, \\r
+                       .priority = _priority,      \\r
+                       .entry = _entry,      \\r
+                       .name = _name,      \\r
+                       .resourceMask = 0,  \\r
+                       .timingProtPtr = NULL, \\r
+                       .appOwner = _app,      \\r
+                 };                    \\r
+         Os_IsrAdd( & _entry ## _unique);   \\r
+       } while(0);\r
+\r
+#define _ISR_INSTALL_ISR1(_name,_entry, _unique, _vector,_priority,_app)        \\r
+               __ISR_INSTALL_ISR1(_name,_entry, _unique, _vector,_priority,_app)\r
+\r
+#define ISR_INSTALL_ISR1(_name,_entry, _vector,_priority,_app)        \\r
+               _ISR_INSTALL_ISR1(_name,_entry, __LINE__, _vector,_priority,_app)\r
+\r
+#endif\r
+\r
 /* ----------------------------[typedef]-------------------------------------*/\r
 \r
 \r
@@ -123,7 +169,7 @@ typedef struct {
  * OsIsrTimingProtection[C]    0..1\r
  * */\r
 \r
-typedef struct {\r
+typedef struct OsIsrConst {\r
        const char              *name;\r
        uint8_t                 core;\r
        int16_t                 vector;\r
@@ -144,11 +190,15 @@ typedef struct {
 /*\r
  *\r
  */\r
-typedef struct {\r
+typedef struct OsIsrVar{\r
        ISRType id;\r
 //     OsIsrStackType          stack;\r
        int                                     state;\r
        const OsIsrConstType *constPtr;\r
+#if defined(CFG_ARM_CR4)\r
+       int16_t activeVector;\r
+#endif\r
+\r
        /* List of resource held by this ISR */\r
        TAILQ_HEAD(,OsResource) resourceHead;\r
 } OsIsrVarType;\r
@@ -164,13 +214,21 @@ void Os_IsrInit( void );
 ISRType Os_IsrAdd( const OsIsrConstType * restrict isrPtr );\r
 void Os_IsrGetStackInfo( OsIsrStackType *stack );\r
 void *Os_Isr( void *stack, int16_t vector);\r
+#if defined(CFG_ARM_CR4)\r
+void *Os_Isr_cr4( void *stack, int16_t virtualVector, int16_t vector );\r
+#endif\r
 #if defined(CFG_ARM_CM3)\r
-void Os_Isr_cm3( void *isr_p );\r
+void Os_Isr_cm3( int16_t vector );\r
 void TailChaining(void *stack);\r
 #endif\r
 \r
 static inline const OsIsrVarType *Os_IsrGet( ISRType id ) {\r
+#if OS_ISR_CNT != 0\r
        return &Os_IsrVarList[id];\r
+#else\r
+       (void)id;\r
+       return NULL;\r
+#endif\r
 }\r
 \r
 static inline ApplicationType Os_IsrGetApplicationOwner( ISRType id ) {\r