2 * FreeRTOS Kernel V10.5.1
3 * Copyright 2020 Cambridge Consultants Ltd.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
39 /*-----------------------------------------------------------
40 * Port specific definitions.
42 * The settings in this file configure FreeRTOS correctly for the
43 * given hardware and compiler.
45 * These settings should not be altered.
46 *-----------------------------------------------------------
49 /* Type definitions. */
51 #define portFLOAT float
52 #define portDOUBLE double
54 #define portSHORT short
55 #define portSTACK_TYPE unsigned long
56 #define portBASE_TYPE long
57 #define portPOINTER_SIZE_TYPE intptr_t
59 typedef portSTACK_TYPE StackType_t;
60 typedef long BaseType_t;
61 typedef unsigned long UBaseType_t;
63 typedef unsigned long TickType_t;
64 #define portMAX_DELAY ( TickType_t ) ULONG_MAX
66 #define portTICK_TYPE_IS_ATOMIC 1
68 /*-----------------------------------------------------------*/
70 /* Architecture specifics. */
71 #define portSTACK_GROWTH ( -1 )
72 #define portHAS_STACK_OVERFLOW_CHECKING ( 1 )
73 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
74 #define portTICK_RATE_MICROSECONDS ( ( portTickType ) 1000000 / configTICK_RATE_HZ )
75 #define portBYTE_ALIGNMENT 8
76 /*-----------------------------------------------------------*/
78 /* Scheduler utilities. */
79 extern void vPortYield( void );
81 #define portYIELD() vPortYield()
83 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield()
84 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
85 /*-----------------------------------------------------------*/
87 /* Critical section management. */
88 extern void vPortDisableInterrupts( void );
89 extern void vPortEnableInterrupts( void );
90 #define portSET_INTERRUPT_MASK() ( vPortDisableInterrupts() )
91 #define portCLEAR_INTERRUPT_MASK() ( vPortEnableInterrupts() )
93 extern portBASE_TYPE xPortSetInterruptMask( void );
94 extern void vPortClearInterruptMask( portBASE_TYPE xMask );
96 extern void vPortEnterCritical( void );
97 extern void vPortExitCritical( void );
98 #define portSET_INTERRUPT_MASK_FROM_ISR() xPortSetInterruptMask()
99 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
100 #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK()
101 #define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK()
102 #define portENTER_CRITICAL() vPortEnterCritical()
103 #define portEXIT_CRITICAL() vPortExitCritical()
105 /*-----------------------------------------------------------*/
107 extern void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield );
108 extern void vPortCancelThread( void *pxTaskToDelete );
109 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortThreadDying( ( pvTaskToDelete ), ( pxPendYield ) )
110 #define portCLEAN_UP_TCB( pxTCB ) vPortCancelThread( pxTCB )
111 /*-----------------------------------------------------------*/
113 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
114 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
115 /*-----------------------------------------------------------*/
118 * Tasks run in their own pthreads and context switches between them
119 * are always a full memory barrier. ISRs are emulated as signals
120 * which also imply a full memory barrier.
122 * Thus, only a compilier barrier is needed to prevent the compiler
125 #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )
127 extern unsigned long ulPortGetRunTime( void );
128 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() /* no-op */
129 #define portGET_RUN_TIME_COUNTER_VALUE() ulPortGetRunTime()
135 #endif /* PORTMACRO_H */