]> git.sur5r.net Git - freertos/blobdiff - Source/portable/GCC/CORTUS_APS3/portmacro.h
Work in progress on the Cortus port.
[freertos] / Source / portable / GCC / CORTUS_APS3 / portmacro.h
index d9f6715bca67c4a5e8b6aaafe07d3e3cb009209b..975759ce0bd3bfe0377580dac241af6c0cfbcad1 100644 (file)
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-    more details. You should have received a copy of the GNU General Public 
-    License and the FreeRTOS license exception along with FreeRTOS; if not it 
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained 
+    more details. You should have received a copy of the GNU General Public
+    License and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
     by writing to Richard Barry, contact details for whom are available on the
     FreeRTOS WEB site.
 
@@ -114,6 +114,20 @@ extern volatile unsigned portBASE_TYPE uxInterruptNestingCount;
 #define portYIELD()            asm __volatile__( " trap #%0 "::"i"(portIRQ_TRAP_YIELD):"memory")
 /*---------------------------------------------------------------------------*/
 
+extern void vTaskEnterCritical( void );
+extern void vTaskExitCritical( void );
+#define portENTER_CRITICAL()           vTaskEnterCritical()
+#define portEXIT_CRITICAL()                    vTaskExitCritical()
+/*---------------------------------------------------------------------------*/
+
+/* Critical section management. */
+#define portDISABLE_INTERRUPTS() ic->cpl = ( portSYSTEM_INTERRUPT_PRIORITY_LEVEL + 1 )
+#define portENABLE_INTERRUPTS() ic->cpl = portKERNEL_INTERRUPT_PRIORITY_LEVEL
+
+#define portSET_INTERRUPT_MASK_FROM_ISR() ic->cpl; portDISABLE_INTERRUPTS()
+#define portRESTORE_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) ic->cpl = uxSavedInterruptStatus
+/*---------------------------------------------------------------------------*/
+
 #define portYIELD_FROM_ISR()                                                                                                                           \
        {                                                                                                                                                                               \
                asm __volatile__(                                                                                                                                       \
@@ -132,43 +146,13 @@ extern volatile unsigned portBASE_TYPE uxInterruptNestingCount;
                        :"i"(portSYSTEM_INTERRUPT_PRIORITY_LEVEL+1)                                                                             \
                        :"r2","r3");                                                                                                                                    \
        }
-/*---------------------------------------------------------------------------*/
-
-extern void vTaskEnterCritical( void );
-extern void vTaskExitCritical( void );
-#define portENTER_CRITICAL()           vTaskEnterCritical()
-#define portEXIT_CRITICAL()                    vTaskExitCritical()
-/*---------------------------------------------------------------------------*/
-
-/* Critical section management. */
-#define portDISABLE_INTERRUPTS()                                                                       \
-       { /*ic->cpl = ( portSYSTEM_INTERRUPT_PRIORITY_LEVEL + 1 );*/    \
-               asm __volatile__(                                                                                       \
-                               " movhi r2, #16384              \n"                                                     \
-                               " mov r3, #%0                   \n"                                                     \
-                               " stb r3, [r2]+2"                                                                       \
-                               :                                                                                                       \
-                               :"i"(portSYSTEM_INTERRUPT_PRIORITY_LEVEL+1)                     \
-                               :"r2", "r3"                             );                                                      \
-       }
-/*---------------------------------------------------------------------------*/
 
-#define portENABLE_INTERRUPTS()                                                                                \
-       { /*ic->cpl = portKERNEL_INTERRUPT_PRIORITY_LEVEL;*/                    \
-               asm __volatile__(                                                                                       \
-                               " movhi r2, #16384              \n"                                                     \
-                               " mov r3, #%0                   \n"                                                     \
-                               " stb r3, [r2]+2"                                                                       \
-                               :                                                                                                       \
-                               :"i"(portKERNEL_INTERRUPT_PRIORITY_LEVEL)                       \
-                               :"r2", "r3"                             );                                                      \
-       }
 /*---------------------------------------------------------------------------*/
 
 #define portSAVE_CONTEXT_REDUCED()                             \
        {                                                                                       \
                asm __volatile__(                                               \
-                       /* "sub r1, #0x28"              */                      \
+                       /* "sub r1, #0x28"              */                      /* Prologue generated by the compiler. */ \
                        /* "stq r4, [r1]+0x8"   */                      \
                        /* "mov r6, psr"                */                      \
                        /* "mov r7, rtt"                */                      \
@@ -221,7 +205,7 @@ extern void vTaskExitCritical( void );
                        "ldq    r8, [r1]                                \n"     \
                        "add    r1, #0x1c                               \n"     \
                        "mov    r14, r1                                 \n"     \
-                       /* "mov r1, r14"                */                      \
+                       /* "mov r1, r14"                */              /* Epilogue generated by the compiler. */       \
                        /* "ldd r6, [r1]+0x20"  */                      \
                        /* "mov psr, r6"                */                      \
                        /* "mov rtt, r7"                */                      \