]> git.sur5r.net Git - freertos/commitdiff
Tidy up and comment.
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 28 Jan 2009 12:37:04 +0000 (12:37 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 28 Jan 2009 12:37:04 +0000 (12:37 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@631 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/IAR/V850ES_Fx3/ISR_Support.h
Source/portable/IAR/V850ES_Fx3/port.c
Source/portable/IAR/V850ES_Fx3/portmacro.h

index efb4cd5615ba35b8eca8512716f0c725455af1c4..1047a994662166112ef76957dcc4efdcfa8c541b 100644 (file)
 \r
 portSAVE_CONTEXT MACRO\r
 \r
-    add     -0x0C,sp                          ; prepare stack to save necessary values\r
-    st.w    lp,8[sp]                        ; store LP to stack\r
+    add     -0x0C,sp                   ; prepare stack to save necessary values\r
+    st.w    lp,8[sp]                   ; store LP to stack\r
     stsr    0,r31\r
-    st.w    lp,4[sp]                        ; store EIPC to stack\r
+    st.w    lp,4[sp]                   ; store EIPC to stack\r
     stsr    1,lp\r
-    st.w    lp,0[sp]                        ; store EIPSW to stack\r
+    st.w    lp,0[sp]                   ; store EIPSW to stack\r
 #if configDATA_MODE == 1                                        ; Using the Tiny data model\r
     prepare {r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30},76,sp ; save general purpose registers\r
     sst.w   r19,72[ep]\r
@@ -102,10 +102,10 @@ portSAVE_CONTEXT MACRO
 #endif /* configDATA_MODE */\r
     sst.w   r2,8[ep]\r
     sst.w   r1,4[ep]\r
-    MOVHI   hi1(usCriticalNesting),r0,r1                        ; save usCriticalNesting value to stack\r
+    MOVHI   hi1(usCriticalNesting),r0,r1       ; save usCriticalNesting value to stack\r
     ld.w    lw1(usCriticalNesting)[r1],r2\r
     sst.w   r2,0[ep]\r
-    MOVHI   hi1(pxCurrentTCB),r0,r1                             ; save SP to top of current TCB\r
+    MOVHI   hi1(pxCurrentTCB),r0,r1                    ; save SP to top of current TCB\r
     ld.w    lw1(pxCurrentTCB)[r1],r2\r
     st.w    sp,0[r2]\r
     ENDM\r
@@ -113,17 +113,17 @@ portSAVE_CONTEXT MACRO
 \r
 portRESTORE_CONTEXT MACRO\r
 \r
-    MOVHI   hi1(pxCurrentTCB),r0,r1         ; get Stackpointer address\r
+    MOVHI   hi1(pxCurrentTCB),r0,r1                    ; get Stackpointer address\r
     ld.w    lw1(pxCurrentTCB)[r1],sp\r
     MOV     sp,r1\r
-    ld.w    0[r1],sp                        ; load stackpointer\r
-    MOV     sp,ep                           ; set stack pointer to element pointer\r
-    sld.w   0[ep],r1                        ; load usCriticalNesting value from stack\r
+    ld.w    0[r1],sp                                           ; load stackpointer\r
+    MOV     sp,ep                                                      ; set stack pointer to element pointer\r
+    sld.w   0[ep],r1                                           ; load usCriticalNesting value from stack\r
     MOVHI   hi1(usCriticalNesting),r0,r2\r
     st.w    r1,lw1(usCriticalNesting)[r2]\r
-    sld.w   4[ep],r1                        ; restore general purpose registers\r
+    sld.w   4[ep],r1                                           ; restore general purpose registers\r
     sld.w   8[ep],r2\r
-#if configDATA_MODE == 1                    ; Using Tiny data model\r
+#if configDATA_MODE == 1                                       ; Using Tiny data model\r
     sld.w   12[ep],r4\r
     sld.w   16[ep],r5\r
     sld.w   20[ep],r6\r
@@ -141,7 +141,7 @@ portRESTORE_CONTEXT MACRO
     sld.w   68[ep],r18\r
     sld.w   72[ep],r19\r
     dispose 76,{r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30}\r
-#else                                       ; Using Small/Large data model\r
+#else                                                                          ; Using Small/Large data model\r
     sld.w   12[ep],r5\r
     sld.w   16[ep],r6\r
     sld.w   20[ep],r7\r
@@ -159,12 +159,12 @@ portRESTORE_CONTEXT MACRO
     sld.w   68[ep],r19\r
     dispose 72,{r20,r21,r22,r23,r24,r26,r27,r28,r29,r30}\r
 #endif /* configDATA_MODE */\r
-    ld.w    0[sp],lp                        ; restore EIPSW from stack\r
+    ld.w    0[sp],lp                                           ; restore EIPSW from stack\r
     ldsr    lp,1\r
-    ld.w    4[sp],lp                        ; restore EIPC from stack\r
+    ld.w    4[sp],lp                                           ; restore EIPC from stack\r
     ldsr    lp,0\r
-    ld.w    8[sp],lp                        ; restore LP from stack\r
-    add     0x0C,sp                         ; set SP to right position\r
+    ld.w    8[sp],lp                                           ; restore LP from stack\r
+    add     0x0C,sp                                                    ; set SP to right position\r
 \r
     RETI\r
 \r
index 4ab01375b7bd3020edb6006f5752e7d1363dc01c..df9fbbb27d591b3d27e589e7b5266de3fcb0da22 100644 (file)
 #include "FreeRTOS.h"\r
 #include "task.h"\r
 \r
+/* Critical nesting should be initialised to a non zero value so interrupts don't\r
+accidentally get enabled before the scheduler is started. */\r
 #define portINITIAL_CRITICAL_NESTING  (( portSTACK_TYPE ) 10)\r
 \r
+/* The PSW value assigned to tasks when they start to run for the first time. */\r
 #define portPSW                  (( portSTACK_TYPE ) 0x00000000)\r
 \r
 /* We require the address of the pxCurrentTCB variable, but don't want to know\r
@@ -63,11 +66,14 @@ any details of its type. */
 typedef void tskTCB;\r
 extern volatile tskTCB * volatile pxCurrentTCB;\r
 \r
+/* Keeps track of the nesting level of critical sections. */\r
 volatile portSTACK_TYPE usCriticalNesting = portINITIAL_CRITICAL_NESTING;\r
 /*-----------------------------------------------------------*/\r
 \r
+/* Sets up the timer to generate the tick interrupt. */\r
 static void prvSetupTimerInterrupt( void );\r
 \r
+/*-----------------------------------------------------------*/\r
 portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
 {\r
        *pxTopOfStack = ( portSTACK_TYPE ) pxCode;          /* Task function start address */\r
index 55a802b13589ba1a84335317b07ebefc464d1b62..92afd1b303f1461c4ddba45dc4fa140588972da1 100644 (file)
@@ -91,34 +91,34 @@ extern "C" {
 /* Critical section control macros. */\r
 #define portNO_CRITICAL_SECTION_NESTING                ( ( unsigned portBASE_TYPE ) 0 )\r
 \r
-#define portENTER_CRITICAL()                                                           \\r
-{                                                                                      \\r
-extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting;                                       \\r
-                                                                                       \\r
-       portDISABLE_INTERRUPTS();                                                       \\r
-                                                                                       \\r
-       /* Now interrupts are disabled ulCriticalNesting can be accessed */             \\r
-       /* directly.  Increment ulCriticalNesting to keep a count of how many */        \\r
-       /* times portENTER_CRITICAL() has been called. */                               \\r
-       usCriticalNesting++;                                                            \\r
+#define portENTER_CRITICAL()                                                                                                           \\r
+{                                                                                                                                                                      \\r
+extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting;                       \\r
+                                                                                                                                                                       \\r
+       portDISABLE_INTERRUPTS();                                                                                                               \\r
+                                                                                                                                                                       \\r
+       /* Now interrupts are disabled ulCriticalNesting can be accessed */                             \\r
+       /* directly.  Increment ulCriticalNesting to keep a count of how many */                \\r
+       /* times portENTER_CRITICAL() has been called. */                                                               \\r
+       usCriticalNesting++;                                                                                                                    \\r
 }\r
 \r
-#define portEXIT_CRITICAL()                                                            \\r
-{                                                                                      \\r
-extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting;                                       \\r
-                                                                                       \\r
-       if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING )                       \\r
-       {                                                                               \\r
-               /* Decrement the nesting count as we are leaving a critical section. */ \\r
-               usCriticalNesting--;                                                    \\r
-                                                                                       \\r
-               /* If the nesting level has reached zero then interrupts should be */   \\r
-               /* re-enabled. */                                                       \\r
-               if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING )              \\r
-               {                                                                       \\r
-                       portENABLE_INTERRUPTS();                                        \\r
-               }                                                                       \\r
-       }                                                                               \\r
+#define portEXIT_CRITICAL()                                                                                                                    \\r
+{                                                                                                                                                                      \\r
+extern volatile /*unsigned portSHORT*/ portSTACK_TYPE usCriticalNesting;                       \\r
+                                                                                                                                                                       \\r
+       if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING )                                               \\r
+       {                                                                                                                                                               \\r
+               /* Decrement the nesting count as we are leaving a critical section. */         \\r
+               usCriticalNesting--;                                                                                                            \\r
+                                                                                                                                                                       \\r
+               /* If the nesting level has reached zero then interrupts should be */           \\r
+               /* re-enabled. */                                                                                                                       \\r
+               if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING )                                      \\r
+               {                                                                                                                                                       \\r
+                       portENABLE_INTERRUPTS();                                                                                                \\r
+               }                                                                                                                                                       \\r
+       }                                                                                                                                                               \\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -127,7 +127,6 @@ extern void vPortYield( void );
 extern void vPortStart( void );\r
 extern void portSAVE_CONTEXT( void );\r
 extern void portRESTORE_CONTEXT( void );\r
-//#define portYIELD()  vPortYield()\r
 #define portYIELD()    __asm ( "trap 0" )\r
 #define portNOP()      __asm ( "NOP" )\r
 extern void vTaskSwitchContext( void );\r
@@ -146,9 +145,6 @@ extern void vTaskSwitchContext( void );
 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )\r
 \r
 \r
-static __interrupt void MD_INTP0(void);\r
-\r
-\r
 #ifdef __cplusplus\r
 }\r
 #endif\r