]> begriffs open source - freertos/blob - portable/ThirdParty/GCC/Posix/portmacro.h
Change kernel revision in each file header from V10.4.3 to <DEVELOPMENT BRANCH>
[freertos] / portable / ThirdParty / GCC / Posix / portmacro.h
1 /*
2  * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3  * Copyright 2020 Cambridge Consultants Ltd.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * https://www.FreeRTOS.org
23  * https://github.com/FreeRTOS
24  *
25  */
26
27
28 #ifndef PORTMACRO_H
29 #define PORTMACRO_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <limits.h>
36
37 /*-----------------------------------------------------------
38  * Port specific definitions.
39  *
40  * The settings in this file configure FreeRTOS correctly for the
41  * given hardware and compiler.
42  *
43  * These settings should not be altered.
44  *-----------------------------------------------------------
45  */
46
47 /* Type definitions. */
48 #define portCHAR                char
49 #define portFLOAT               float
50 #define portDOUBLE              double
51 #define portLONG                long
52 #define portSHORT               short
53 #define portSTACK_TYPE  unsigned long
54 #define portBASE_TYPE   long
55 #define portPOINTER_SIZE_TYPE intptr_t
56
57 typedef portSTACK_TYPE StackType_t;
58 typedef long BaseType_t;
59 typedef unsigned long UBaseType_t;
60
61 typedef unsigned long TickType_t;
62 #define portMAX_DELAY ( TickType_t ) ULONG_MAX
63
64 #define portTICK_TYPE_IS_ATOMIC 1
65
66 /*-----------------------------------------------------------*/
67
68 /* Architecture specifics. */
69 #define portSTACK_GROWTH                        ( -1 )
70 #define portHAS_STACK_OVERFLOW_CHECKING ( 1 )
71 #define portTICK_PERIOD_MS                      ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
72 #define portTICK_RATE_MICROSECONDS      ( ( portTickType ) 1000000 / configTICK_RATE_HZ )
73 #define portBYTE_ALIGNMENT                      8
74 /*-----------------------------------------------------------*/
75
76 /* Scheduler utilities. */
77 extern void vPortYield( void );
78
79 #define portYIELD() vPortYield()
80
81 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield()
82 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
83 /*-----------------------------------------------------------*/
84
85 /* Critical section management. */
86 extern void vPortDisableInterrupts( void );
87 extern void vPortEnableInterrupts( void );
88 #define portSET_INTERRUPT_MASK()        ( vPortDisableInterrupts() )
89 #define portCLEAR_INTERRUPT_MASK()      ( vPortEnableInterrupts() )
90
91 extern portBASE_TYPE xPortSetInterruptMask( void );
92 extern void vPortClearInterruptMask( portBASE_TYPE xMask );
93
94 extern void vPortEnterCritical( void );
95 extern void vPortExitCritical( void );
96 #define portSET_INTERRUPT_MASK_FROM_ISR()               xPortSetInterruptMask()
97 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x)    vPortClearInterruptMask(x)
98 #define portDISABLE_INTERRUPTS()                                portSET_INTERRUPT_MASK()
99 #define portENABLE_INTERRUPTS()                                 portCLEAR_INTERRUPT_MASK()
100 #define portENTER_CRITICAL()                                    vPortEnterCritical()
101 #define portEXIT_CRITICAL()                                             vPortExitCritical()
102
103 /*-----------------------------------------------------------*/
104
105 extern void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield );
106 extern void vPortCancelThread( void *pxTaskToDelete );
107 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortThreadDying( ( pvTaskToDelete ), ( pxPendYield ) )
108 #define portCLEAN_UP_TCB( pxTCB )       vPortCancelThread( pxTCB )
109 /*-----------------------------------------------------------*/
110
111 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
112 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
113 /*-----------------------------------------------------------*/
114
115 /*
116  * Tasks run in their own pthreads and context switches between them
117  * are always a full memory barrier. ISRs are emulated as signals
118  * which also imply a full memory barrier.
119  *
120  * Thus, only a compilier barrier is needed to prevent the compiler
121  * reordering.
122  */
123 #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )
124
125 extern unsigned long ulPortGetRunTime( void );
126 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() /* no-op */
127 #define portGET_RUN_TIME_COUNTER_VALUE()         ulPortGetRunTime()
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif /* PORTMACRO_H */