]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/portable/GCC/ARM_CM3/port.c
Update version number ready for release.
[freertos] / FreeRTOS / Source / portable / GCC / ARM_CM3 / port.c
index 0b80e07efb926e40475145ac2386e29774e51803..01956f5484eea49393ebc8c05feda190fdd946ec 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
     the terms of the GNU General Public License (version 2) as published by the\r
     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
 \r
-    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
-    >>! a combined work that includes FreeRTOS without being obliged to provide\r
-    >>! the source code for proprietary components outside of the FreeRTOS\r
-    >>! kernel.\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
 \r
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
@@ -89,10 +89,10 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */
 #endif\r
 \r
 /* Constants required to manipulate the core.  Registers first... */\r
-#define portNVIC_SYSTICK_CTRL_REG                      ( * ( ( volatile unsigned long * ) 0xe000e010 ) )\r
-#define portNVIC_SYSTICK_LOAD_REG                      ( * ( ( volatile unsigned long * ) 0xe000e014 ) )\r
-#define portNVIC_SYSTICK_CURRENT_VALUE_REG     ( * ( ( volatile unsigned long * ) 0xe000e018 ) )\r
-#define portNVIC_SYSPRI2_REG                           ( * ( ( volatile unsigned long * ) 0xe000ed20 ) )\r
+#define portNVIC_SYSTICK_CTRL_REG                      ( * ( ( volatile uint32_t * ) 0xe000e010 ) )\r
+#define portNVIC_SYSTICK_LOAD_REG                      ( * ( ( volatile uint32_t * ) 0xe000e014 ) )\r
+#define portNVIC_SYSTICK_CURRENT_VALUE_REG     ( * ( ( volatile uint32_t * ) 0xe000e018 ) )\r
+#define portNVIC_SYSPRI2_REG                           ( * ( ( volatile uint32_t * ) 0xe000ed20 ) )\r
 /* ...then bits in the registers. */\r
 #define portNVIC_SYSTICK_INT_BIT                       ( 1UL << 1UL )\r
 #define portNVIC_SYSTICK_ENABLE_BIT                    ( 1UL << 0UL )\r
@@ -100,16 +100,16 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */
 #define portNVIC_PENDSVCLEAR_BIT                       ( 1UL << 27UL )\r
 #define portNVIC_PEND_SYSTICK_CLEAR_BIT                ( 1UL << 25UL )\r
 \r
-#define portNVIC_PENDSV_PRI                                    ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )\r
-#define portNVIC_SYSTICK_PRI                           ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )\r
+#define portNVIC_PENDSV_PRI                                    ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 16UL )\r
+#define portNVIC_SYSTICK_PRI                           ( ( ( uint32_t ) configKERNEL_INTERRUPT_PRIORITY ) << 24UL )\r
 \r
 /* Constants required to check the validity of an interrupt priority. */\r
 #define portFIRST_USER_INTERRUPT_NUMBER                ( 16 )\r
 #define portNVIC_IP_REGISTERS_OFFSET_16        ( 0xE000E3F0 )\r
-#define portAIRCR_REG                                          ( * ( ( volatile unsigned long * ) 0xE000ED0C ) )\r
-#define portMAX_8_BIT_VALUE                                    ( ( unsigned char ) 0xff )\r
-#define portTOP_BIT_OF_BYTE                                    ( ( unsigned char ) 0x80 )\r
-#define portMAX_PRIGROUP_BITS                          ( ( unsigned char ) 7 )\r
+#define portAIRCR_REG                                          ( * ( ( volatile uint32_t * ) 0xE000ED0C ) )\r
+#define portMAX_8_BIT_VALUE                                    ( ( uint8_t ) 0xff )\r
+#define portTOP_BIT_OF_BYTE                                    ( ( uint8_t ) 0x80 )\r
+#define portMAX_PRIGROUP_BITS                          ( ( uint8_t ) 7 )\r
 #define portPRIORITY_GROUP_MASK                                ( 0x07UL << 8UL )\r
 #define portPRIGROUP_SHIFT                                     ( 8UL )\r
 \r
@@ -135,7 +135,7 @@ debugger. */
 \r
 /* Each task maintains its own interrupt status in the critical nesting\r
 variable. */\r
-static unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;\r
+static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;\r
 \r
 /*\r
  * Setup the timer to generate the tick interrupts.  The implementation in this\r
@@ -167,7 +167,7 @@ static void prvTaskExitError( void );
  * The number of SysTick increments that make up one tick period.\r
  */\r
 #if configUSE_TICKLESS_IDLE == 1\r
-       static unsigned long ulTimerCountsForOneTick = 0;\r
+       static uint32_t ulTimerCountsForOneTick = 0;\r
 #endif /* configUSE_TICKLESS_IDLE */\r
 \r
 /*\r
@@ -175,7 +175,7 @@ static void prvTaskExitError( void );
  * 24 bit resolution of the SysTick timer.\r
  */\r
 #if configUSE_TICKLESS_IDLE == 1\r
-       static unsigned long xMaximumPossibleSuppressedTicks = 0;\r
+       static uint32_t xMaximumPossibleSuppressedTicks = 0;\r
 #endif /* configUSE_TICKLESS_IDLE */\r
 \r
 /*\r
@@ -183,7 +183,7 @@ static void prvTaskExitError( void );
  * power functionality only.\r
  */\r
 #if configUSE_TICKLESS_IDLE == 1\r
-       static unsigned long ulStoppedTimerCompensation = 0;\r
+       static uint32_t ulStoppedTimerCompensation = 0;\r
 #endif /* configUSE_TICKLESS_IDLE */\r
 \r
 /*\r
@@ -192,9 +192,9 @@ static void prvTaskExitError( void );
  * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.\r
  */\r
 #if ( configASSERT_DEFINED == 1 )\r
-        static unsigned char ucMaxSysCallPriority = 0;\r
-        static unsigned long ulMaxPRIGROUPValue = 0;\r
-        static const volatile unsigned char * const pcInterruptPriorityRegisters = ( const volatile unsigned char * const ) portNVIC_IP_REGISTERS_OFFSET_16;\r
+        static uint8_t ucMaxSysCallPriority = 0;\r
+        static uint32_t ulMaxPRIGROUPValue = 0;\r
+        static const volatile uint8_t * const pcInterruptPriorityRegisters = ( const volatile uint8_t * const ) portNVIC_IP_REGISTERS_OFFSET_16;\r
 #endif /* configASSERT_DEFINED */\r
 \r
 /*-----------------------------------------------------------*/\r
@@ -202,18 +202,18 @@ static void prvTaskExitError( void );
 /*\r
  * See header file for description.\r
  */\r
-portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
+StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )\r
 {\r
        /* Simulate the stack frame as it would be created by a context switch\r
        interrupt. */\r
        pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */\r
        *pxTopOfStack = portINITIAL_XPSR;       /* xPSR */\r
        pxTopOfStack--;\r
-       *pxTopOfStack = ( portSTACK_TYPE ) pxCode;      /* PC */\r
+       *pxTopOfStack = ( StackType_t ) pxCode; /* PC */\r
        pxTopOfStack--;\r
-       *pxTopOfStack = ( portSTACK_TYPE ) portTASK_RETURN_ADDRESS;     /* LR */\r
+       *pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS;        /* LR */\r
        pxTopOfStack -= 5;      /* R12, R3, R2 and R1. */\r
-       *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;        /* R0 */\r
+       *pxTopOfStack = ( StackType_t ) pvParameters;   /* R0 */\r
        pxTopOfStack -= 8;      /* R11, R10, R9, R8, R7, R6, R5 and R4. */\r
 \r
        return pxTopOfStack;\r
@@ -273,7 +273,7 @@ static void prvPortStartFirstTask( void )
 /*\r
  * See header file for description.\r
  */\r
-portBASE_TYPE xPortStartScheduler( void )\r
+BaseType_t xPortStartScheduler( void )\r
 {\r
        /* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.\r
        See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */\r
@@ -281,9 +281,9 @@ portBASE_TYPE xPortStartScheduler( void )
 \r
        #if( configASSERT_DEFINED == 1 )\r
        {\r
-               volatile unsigned long ulOriginalPriority;\r
-               volatile char * const pcFirstUserPriorityRegister = ( volatile char * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );\r
-               volatile unsigned char ucMaxPriorityValue;\r
+               volatile uint32_t ulOriginalPriority;\r
+               volatile uint8_t * const pucFirstUserPriorityRegister = ( volatile uint8_t * const ) ( portNVIC_IP_REGISTERS_OFFSET_16 + portFIRST_USER_INTERRUPT_NUMBER );\r
+               volatile uint8_t ucMaxPriorityValue;\r
 \r
                /* Determine the maximum priority from which ISR safe FreeRTOS API\r
                functions can be called.  ISR safe functions are those that end in\r
@@ -291,14 +291,14 @@ portBASE_TYPE xPortStartScheduler( void )
                ensure interrupt entry is as fast and simple as possible.\r
 \r
                Save the interrupt priority value that is about to be clobbered. */\r
-               ulOriginalPriority = *pcFirstUserPriorityRegister;\r
+               ulOriginalPriority = *pucFirstUserPriorityRegister;\r
 \r
                /* Determine the number of priority bits available.  First write to all\r
                possible bits. */\r
-               *pcFirstUserPriorityRegister = portMAX_8_BIT_VALUE;\r
+               *pucFirstUserPriorityRegister = portMAX_8_BIT_VALUE;\r
 \r
                /* Read the value back to see how many bits stuck. */\r
-               ucMaxPriorityValue = *pcFirstUserPriorityRegister;\r
+               ucMaxPriorityValue = *pucFirstUserPriorityRegister;\r
 \r
                /* Use the same mask on the maximum system call priority. */\r
                ucMaxSysCallPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY & ucMaxPriorityValue;\r
@@ -309,7 +309,7 @@ portBASE_TYPE xPortStartScheduler( void )
                while( ( ucMaxPriorityValue & portTOP_BIT_OF_BYTE ) == portTOP_BIT_OF_BYTE )\r
                {\r
                        ulMaxPRIGROUPValue--;\r
-                       ucMaxPriorityValue <<= ( unsigned char ) 0x01;\r
+                       ucMaxPriorityValue <<= ( uint8_t ) 0x01;\r
                }\r
 \r
                /* Shift the priority group value back to its position within the AIRCR\r
@@ -319,7 +319,7 @@ portBASE_TYPE xPortStartScheduler( void )
 \r
                /* Restore the clobbered interrupt priority register to its original\r
                value. */\r
-               *pcFirstUserPriorityRegister = ulOriginalPriority;\r
+               *pucFirstUserPriorityRegister = ulOriginalPriority;\r
        }\r
        #endif /* conifgASSERT_DEFINED */\r
 \r
@@ -388,7 +388,7 @@ void vPortExitCritical( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-__attribute__(( naked )) unsigned long ulPortSetInterruptMask( void )\r
+__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void )\r
 {\r
        __asm volatile                                                                                                          \\r
        (                                                                                                                                       \\r
@@ -405,7 +405,7 @@ __attribute__(( naked )) unsigned long ulPortSetInterruptMask( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-__attribute__(( naked )) void vPortClearInterruptMask( unsigned long ulNewMaskValue )\r
+__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue )\r
 {\r
        __asm volatile                                                                                                  \\r
        (                                                                                                                               \\r
@@ -478,10 +478,10 @@ void xPortSysTickHandler( void )
 \r
 #if configUSE_TICKLESS_IDLE == 1\r
 \r
-       __attribute__((weak)) void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )\r
+       __attribute__((weak)) void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )\r
        {\r
-       unsigned long ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;\r
-       portTickType xModifiableIdleTime;\r
+       uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements, ulSysTickCTRL;\r
+       TickType_t xModifiableIdleTime;\r
 \r
                /* Make sure the SysTick reload value does not overflow the counter. */\r
                if( xExpectedIdleTime > xMaximumPossibleSuppressedTicks )\r
@@ -567,7 +567,7 @@ void xPortSysTickHandler( void )
 \r
                        if( ( ulSysTickCTRL & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 )\r
                        {\r
-                               unsigned long ulCalculatedLoadValue;\r
+                               uint32_t ulCalculatedLoadValue;\r
 \r
                                /* The tick interrupt has already executed, and the SysTick\r
                                count reloaded with ulReloadValue.  Reset the\r
@@ -644,7 +644,7 @@ __attribute__(( weak )) void vPortSetupTimerInterrupt( void )
        #endif /* configUSE_TICKLESS_IDLE */\r
 \r
        /* Configure SysTick to interrupt at the requested rate. */\r
-       portNVIC_SYSTICK_LOAD_REG = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;;\r
+       portNVIC_SYSTICK_LOAD_REG = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;\r
        portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT );\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -653,8 +653,8 @@ __attribute__(( weak )) void vPortSetupTimerInterrupt( void )
 \r
        void vPortValidateInterruptPriority( void )\r
        {\r
-       unsigned long ulCurrentInterrupt;\r
-       unsigned char ucCurrentPriority;\r
+       uint32_t ulCurrentInterrupt;\r
+       uint8_t ucCurrentPriority;\r
 \r
                /* Obtain the number of the currently executing interrupt. */\r
                __asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );\r