2 * FreeRTOS Kernel V10.2.0
3 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
38 /*-----------------------------------------------------------
39 * Port specific definitions.
41 * The settings in this file configure FreeRTOS correctly for the
42 * given hardware and compiler.
44 * These settings should not be altered.
45 *-----------------------------------------------------------
48 /* Type definitions - these are a bit legacy and not really used now, other than
49 portSTACK_TYPE and portBASE_TYPE. */
51 #define portFLOAT float
52 #define portDOUBLE double
54 #define portSHORT short
55 #define portSTACK_TYPE uint32_t
56 #define portBASE_TYPE long
58 typedef portSTACK_TYPE StackType_t;
59 typedef long BaseType_t;
60 typedef unsigned long UBaseType_t;
62 #if( configUSE_16_BIT_TICKS == 1 )
63 typedef uint16_t TickType_t;
64 #define portMAX_DELAY ( TickType_t ) 0xffff
66 typedef uint32_t TickType_t;
67 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
69 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
70 not need to be guarded with a critical section. */
71 #define portTICK_TYPE_IS_ATOMIC 1
73 /*-----------------------------------------------------------*/
75 /* Hardware specifics. */
76 #define portBYTE_ALIGNMENT 8
77 #define portSTACK_GROWTH -1
78 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
79 #define portNOP() nop()
80 #define portSTART_SCHEDULER_TRAP_NO ( 32 )
81 #define portYIELD_TRAP_NO ( 33 )
82 #define portKERNEL_INTERRUPT_PRIORITY ( 1 )
84 void vPortYield( void );
85 #define portYIELD() vPortYield()
87 extern void vTaskSwitchContext( void );
88 #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) vTaskSwitchContext()
91 * This function tells the kernel that the task referenced by xTask is going to
92 * use the floating point registers and therefore requires the floating point
93 * registers saved as part of its context.
95 BaseType_t xPortUsesFloatingPoint( void* xTask );
98 * The flop save and restore functions are defined in portasm.src and called by
99 * the trace "task switched in" and "trace task switched out" macros.
101 void vPortSaveFlopRegisters( void *pulBuffer );
102 void vPortRestoreFlopRegisters( void *pulBuffer );
105 * pxTaskTag is used to point to the buffer into which the floating point
106 * context should be saved. If pxTaskTag is NULL then the task does not use
107 * a floating point context.
109 #define traceTASK_SWITCHED_OUT() if( pxCurrentTCB->pxTaskTag != NULL ) vPortSaveFlopRegisters( pxCurrentTCB->pxTaskTag )
110 #define traceTASK_SWITCHED_IN() if( pxCurrentTCB->pxTaskTag != NULL ) vPortRestoreFlopRegisters( pxCurrentTCB->pxTaskTag )
113 * These macros should be called directly, but through the taskENTER_CRITICAL()
114 * and taskEXIT_CRITICAL() macros.
116 #define portENABLE_INTERRUPTS() set_imask( 0x00 )
117 #define portDISABLE_INTERRUPTS() set_imask( portKERNEL_INTERRUPT_PRIORITY )
119 /* Critical nesting counts are stored in the TCB. */
120 #define portCRITICAL_NESTING_IN_TCB ( 1 )
122 /* The critical nesting functions defined within tasks.c. */
123 extern void vTaskEnterCritical( void );
124 extern void vTaskExitCritical( void );
125 #define portENTER_CRITICAL() vTaskEnterCritical();
126 #define portEXIT_CRITICAL() vTaskExitCritical();
128 /*-----------------------------------------------------------*/
130 /* Task function macros as described on the FreeRTOS.org WEB site. */
131 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
132 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
138 #endif /* PORTMACRO_H */