]> begriffs open source - cmsis-freertos/blob - Source/portable/Renesas/SH2A_FPU/portmacro.h
Sources updated to FreeRTOS 10.2.0
[cmsis-freertos] / Source / portable / Renesas / SH2A_FPU / portmacro.h
1 /*
2  * FreeRTOS Kernel V10.2.0
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
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  * http://www.FreeRTOS.org
23  * http://aws.amazon.com/freertos
24  *
25  * 1 tab == 4 spaces!
26  */
27
28
29 #ifndef PORTMACRO_H
30 #define PORTMACRO_H
31
32 #include <machine.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*-----------------------------------------------------------
39  * Port specific definitions.
40  *
41  * The settings in this file configure FreeRTOS correctly for the
42  * given hardware and compiler.
43  *
44  * These settings should not be altered.
45  *-----------------------------------------------------------
46  */
47
48 /* Type definitions - these are a bit legacy and not really used now, other than
49 portSTACK_TYPE and portBASE_TYPE. */
50 #define portCHAR                char
51 #define portFLOAT               float
52 #define portDOUBLE              double
53 #define portLONG                long
54 #define portSHORT               short
55 #define portSTACK_TYPE  uint32_t
56 #define portBASE_TYPE   long
57
58 typedef portSTACK_TYPE StackType_t;
59 typedef long BaseType_t;
60 typedef unsigned long UBaseType_t;
61
62 #if( configUSE_16_BIT_TICKS == 1 )
63         typedef uint16_t TickType_t;
64         #define portMAX_DELAY ( TickType_t ) 0xffff
65 #else
66         typedef uint32_t TickType_t;
67         #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
68
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
72 #endif
73 /*-----------------------------------------------------------*/
74
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 )
83
84 void vPortYield( void );
85 #define portYIELD()                                             vPortYield()
86
87 extern void vTaskSwitchContext( void );
88 #define portYIELD_FROM_ISR( x )                 if( x != pdFALSE ) vTaskSwitchContext()
89
90 /*
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.
94  */
95 BaseType_t xPortUsesFloatingPoint( void* xTask );
96
97 /*
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.
100  */
101 void vPortSaveFlopRegisters( void *pulBuffer );
102 void vPortRestoreFlopRegisters( void *pulBuffer );
103
104 /*
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.
108  */
109 #define traceTASK_SWITCHED_OUT() if( pxCurrentTCB->pxTaskTag != NULL ) vPortSaveFlopRegisters( pxCurrentTCB->pxTaskTag )
110 #define traceTASK_SWITCHED_IN() if( pxCurrentTCB->pxTaskTag != NULL ) vPortRestoreFlopRegisters( pxCurrentTCB->pxTaskTag )
111
112 /*
113  * These macros should be called directly, but through the taskENTER_CRITICAL()
114  * and taskEXIT_CRITICAL() macros.
115  */
116 #define portENABLE_INTERRUPTS()         set_imask( 0x00 )
117 #define portDISABLE_INTERRUPTS()        set_imask( portKERNEL_INTERRUPT_PRIORITY )
118
119 /* Critical nesting counts are stored in the TCB. */
120 #define portCRITICAL_NESTING_IN_TCB ( 1 )
121
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();
127
128 /*-----------------------------------------------------------*/
129
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 )
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* PORTMACRO_H */
139