]> git.sur5r.net Git - freertos/blob - FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portmacro.h
Update license information text files for the CLI, TCP and UDP products to be correct...
[freertos] / FreeRTOS / Source / portable / CCS / ARM_Cortex-R4 / portmacro.h
1 /*\r
2  * FreeRTOS Kernel V10.0.0\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29 #ifndef __PORTMACRO_H__\r
30 #define __PORTMACRO_H__\r
31 \r
32 /*-----------------------------------------------------------\r
33  * Port specific definitions.\r
34  *\r
35  * The settings in this file configure FreeRTOS correctly for the\r
36  * given hardware and compiler.\r
37  *\r
38  * These settings should not be altered.\r
39  *-----------------------------------------------------------\r
40  */\r
41 \r
42 /* Type definitions. */\r
43 #define portCHAR        char\r
44 #define portFLOAT       float\r
45 #define portDOUBLE      double\r
46 #define portLONG        long\r
47 #define portSHORT       short\r
48 #define portSTACK_TYPE  uint32_t\r
49 #define portBASE_TYPE   long\r
50 \r
51 typedef portSTACK_TYPE StackType_t;\r
52 typedef long BaseType_t;\r
53 typedef unsigned long UBaseType_t;\r
54 \r
55 #if (configUSE_16_BIT_TICKS == 1)\r
56     typedef uint16_t TickType_t;\r
57     #define portMAX_DELAY (TickType_t) 0xFFFF\r
58 #else\r
59     typedef uint32_t TickType_t;\r
60     #define portMAX_DELAY (TickType_t) 0xFFFFFFFFF\r
61 \r
62         /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do\r
63         not need to be guarded with a critical section. */\r
64         #define portTICK_TYPE_IS_ATOMIC 1\r
65 #endif\r
66 \r
67 \r
68 /* Architecture specifics. */\r
69 #define portSTACK_GROWTH    (-1)\r
70 #define portTICK_PERIOD_MS    ((TickType_t) 1000 / configTICK_RATE_HZ)\r
71 #define portBYTE_ALIGNMENT  8\r
72 \r
73 /* Critical section handling. */\r
74 extern void vPortEnterCritical(void);\r
75 extern void vPortExitCritical(void);\r
76 #define portENTER_CRITICAL()            vPortEnterCritical()\r
77 #define portEXIT_CRITICAL()                     vPortExitCritical()\r
78 #define portDISABLE_INTERRUPTS()        asm( " CPSID I" )\r
79 #define portENABLE_INTERRUPTS()         asm( " CPSIE I" )\r
80 \r
81 /* Scheduler utilities. */\r
82 #pragma SWI_ALIAS( vPortYield, 0 )\r
83 extern void vPortYield( void );\r
84 #define portYIELD()                     vPortYield()\r
85 #define portSYS_SSIR1_REG                       ( * ( ( volatile uint32_t * ) 0xFFFFFFB0 ) )\r
86 #define portSYS_SSIR1_SSKEY                     ( 0x7500UL )\r
87 #define portYIELD_WITHIN_API()          { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY;  asm( " DSB " ); asm( " ISB " ); }\r
88 #define portYIELD_FROM_ISR( x )         if( x != pdFALSE ){ portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY;  ( void ) portSYS_SSIR1_REG; }\r
89 \r
90 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION\r
91         #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1\r
92 #endif\r
93 \r
94 /* Architecture specific optimisations. */\r
95 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1\r
96 \r
97         /* Check the configuration. */\r
98         #if( configMAX_PRIORITIES > 32 )\r
99                 #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32.  It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.\r
100         #endif\r
101 \r
102         /* Store/clear the ready priorities in a bit map. */\r
103         #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )\r
104         #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )\r
105 \r
106         /*-----------------------------------------------------------*/\r
107 \r
108         #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __clz( ( uxReadyPriorities ) ) )\r
109 \r
110 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */\r
111 \r
112 \r
113 /* Task function macros as described on the FreeRTOS.org WEB site. */\r
114 #define portTASK_FUNCTION(vFunction, pvParameters)       void vFunction(void *pvParameters)\r
115 #define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters)\r
116 \r
117 #endif /* __PORTMACRO_H__ */\r
118 \r