2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright 2020 Cambridge Consultants Ltd.
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:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
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.
22 * https://www.FreeRTOS.org
23 * https://github.com/FreeRTOS
37 /*-----------------------------------------------------------
38 * Port specific definitions.
40 * The settings in this file configure FreeRTOS correctly for the
41 * given hardware and compiler.
43 * These settings should not be altered.
44 *-----------------------------------------------------------
47 /* Type definitions. */
49 #define portFLOAT float
50 #define portDOUBLE double
52 #define portSHORT short
53 #define portSTACK_TYPE unsigned long
54 #define portBASE_TYPE long
55 #define portPOINTER_SIZE_TYPE intptr_t
57 typedef portSTACK_TYPE StackType_t;
58 typedef long BaseType_t;
59 typedef unsigned long UBaseType_t;
61 typedef unsigned long TickType_t;
62 #define portMAX_DELAY ( TickType_t ) ULONG_MAX
64 #define portTICK_TYPE_IS_ATOMIC 1
66 /*-----------------------------------------------------------*/
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 /*-----------------------------------------------------------*/
76 /* Scheduler utilities. */
77 extern void vPortYield( void );
79 #define portYIELD() vPortYield()
81 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) vPortYield()
82 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
83 /*-----------------------------------------------------------*/
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() )
91 extern portBASE_TYPE xPortSetInterruptMask( void );
92 extern void vPortClearInterruptMask( portBASE_TYPE xMask );
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()
103 /*-----------------------------------------------------------*/
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 /*-----------------------------------------------------------*/
111 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
112 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
113 /*-----------------------------------------------------------*/
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.
120 * Thus, only a compilier barrier is needed to prevent the compiler
123 #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )
125 extern unsigned long ulPortGetRunTime( void );
126 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() /* no-op */
127 #define portGET_RUN_TIME_COUNTER_VALUE() ulPortGetRunTime()
133 #endif /* PORTMACRO_H */