2 * FreeRTOS Kernel V10.4.3
3 * Copyright (C) 2020 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 * https://www.FreeRTOS.org
23 * https://github.com/FreeRTOS
36 /* Hardware specifics. */
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 - these are a bit legacy and not really used now, other
50 than portSTACK_TYPE and portBASE_TYPE. */
52 #define portFLOAT float
53 #define portDOUBLE double
55 #define portSHORT short
56 #define portSTACK_TYPE uint32_t
57 #define portBASE_TYPE long
59 typedef portSTACK_TYPE StackType_t;
60 typedef long BaseType_t;
61 typedef unsigned long UBaseType_t;
63 #if( configUSE_16_BIT_TICKS == 1 )
64 typedef uint16_t TickType_t;
65 #define portMAX_DELAY ( TickType_t ) 0xffff
67 typedef uint32_t TickType_t;
68 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
70 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
71 not need to be guarded with a critical section. */
72 #define portTICK_TYPE_IS_ATOMIC 1
74 /*-----------------------------------------------------------*/
76 /* Hardware specifics. */
77 #define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */
78 #define portSTACK_GROWTH -1
79 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
80 #define portNOP() nop()
82 #pragma inline_asm vPortYield
83 static void vPortYield( void )
85 /* Save clobbered register - may not actually be necessary if inline asm
86 functions are considered to use the same rules as function calls by the
92 /* Read back to ensure the value is taken before proceeding. */
94 /* Restore clobbered register to its previous value. */
97 #define portYIELD() vPortYield()
98 #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) { portYIELD(); }
100 /* These macros should not be called directly, but through the
101 taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is
102 performed if configASSERT() is defined to ensure an assertion handler does not
103 inadvertently attempt to lower the IPL when the call to assert was triggered
104 because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY
105 when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API
106 functions are those that end in FromISR. FreeRTOS maintains a separate
107 interrupt API to ensure API function and interrupt entry is as fast and as
108 simple as possible. */
109 #define portENABLE_INTERRUPTS() set_ipl( ( long ) 0 )
111 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( get_ipl() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) )
112 #define portDISABLE_INTERRUPTS() if( get_ipl() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY )
114 #define portDISABLE_INTERRUPTS() set_ipl( ( long ) configMAX_SYSCALL_INTERRUPT_PRIORITY )
117 /* Critical nesting counts are stored in the TCB. */
118 #define portCRITICAL_NESTING_IN_TCB ( 1 )
120 /* The critical nesting functions defined within tasks.c. */
121 extern void vTaskEnterCritical( void );
122 extern void vTaskExitCritical( void );
123 #define portENTER_CRITICAL() vTaskEnterCritical()
124 #define portEXIT_CRITICAL() vTaskExitCritical()
126 /* As this port allows interrupt nesting... */
127 #define portSET_INTERRUPT_MASK_FROM_ISR() ( UBaseType_t ) get_ipl(); set_ipl( ( signed long ) configMAX_SYSCALL_INTERRUPT_PRIORITY )
128 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) set_ipl( ( signed long ) uxSavedInterruptStatus )
130 /*-----------------------------------------------------------*/
132 /* Tickless idle/low power functionality. */
133 #if configUSE_TICKLESS_IDLE == 1
134 #ifndef portSUPPRESS_TICKS_AND_SLEEP
135 extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
136 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
140 /*-----------------------------------------------------------*/
142 /* Task function macros as described on the FreeRTOS.org WEB site. */
143 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
144 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
150 #endif /* PORTMACRO_H */