]> begriffs open source - freertos/blob - portable/ThirdParty/GCC/ARC_EM_HS/portmacro.h
[AUTO][RELEASE]: Bump file header version to "10.4.4"
[freertos] / portable / ThirdParty / GCC / ARC_EM_HS / portmacro.h
1 /*
2  * FreeRTOS Kernel V10.4.4
3  * Copyright (C) 2020 Synopsys, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
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:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
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.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28
29 #ifndef PORTMACRO_H
30 #define PORTMACRO_H
31
32 /* *INDENT-OFF* */
33 #ifdef __cplusplus
34     extern "C" {
35 #endif
36 /* *INDENT-ON* */
37
38 /* record stack high address for stack check */
39 #ifndef configRECORD_STACK_HIGH_ADDRESS
40     #define configRECORD_STACK_HIGH_ADDRESS    1
41 #endif
42
43 /*-----------------------------------------------------------
44  * Port specific definitions.
45  *
46  * The settings in this file configure FreeRTOS correctly for the
47  * given hardware and compiler.
48  *
49  * These settings should not be altered.
50  *-----------------------------------------------------------
51  */
52
53 /* Type definitions. */
54 #define portCHAR          char
55 #define portFLOAT         float
56 #define portDOUBLE        double
57 #define portLONG          long
58 #define portSHORT         short
59 #define portSTACK_TYPE    unsigned int
60 #define portBASE_TYPE     portLONG
61
62 #ifndef Asm
63     #define Asm           __asm__ volatile
64 #endif
65
66 /*
67  *  normal constants
68  */
69 #ifndef NULL
70     #define NULL    0           /* invalid pointer */
71 #endif /* NULL */
72
73 #ifndef true
74     #define true    1           /* true */
75 #endif /* true */
76
77 #ifndef false
78     #define false    0          /* false */
79 #endif /* false */
80
81 typedef portSTACK_TYPE     StackType_t;
82 typedef long               BaseType_t;
83 typedef unsigned long      UBaseType_t;
84
85 #if ( configUSE_16_BIT_TICKS == 1 )
86     typedef uint16_t       TickType_t;
87     #define portMAX_DELAY          ( TickType_t ) 0xffff
88 #else
89     typedef unsigned int   TickType_t;
90     #define portMAX_DELAY          ( TickType_t ) 0xffffffffUL
91 #endif
92
93 #define portNO_CRITICAL_NESTING    ( ( uint32_t ) 0 )
94 #define portSTACK_GROWTH           ( -1 )
95 #define portTICK_PERIOD_MS         ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
96 #define portBYTE_ALIGNMENT         8
97 #define portNOP()               Asm( "nop_s" );
98 #define IPM_ENABLE_ALL             1
99
100 #define portYIELD_FROM_ISR()    vPortYieldFromIsr()
101 #define portYIELD()             vPortYield()
102
103 /* Critical section management. */
104 #define portDISABLE_INTERRUPTS() \
105     {                            \
106         Asm( "clri" );           \
107         Asm( "" ::: "memory" );  \
108     }                            \
109
110 #define portENABLE_INTERRUPTS() \
111     {                           \
112         Asm( "" ::: "memory" ); \
113         Asm( "seti" );          \
114     }                           \
115
116 extern volatile unsigned int ulCriticalNesting;
117
118 #define portENTER_CRITICAL()     \
119     {                            \
120         portDISABLE_INTERRUPTS() \
121         ulCriticalNesting++;     \
122     }
123
124
125 #define portEXIT_CRITICAL()                                    \
126     {                                                          \
127         if( ulCriticalNesting > portNO_CRITICAL_NESTING )      \
128         {                                                      \
129             ulCriticalNesting--;                               \
130             if( ulCriticalNesting == portNO_CRITICAL_NESTING ) \
131             {                                                  \
132                 portENABLE_INTERRUPTS()                        \
133             }                                                  \
134         }                                                      \
135     }
136
137
138 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters )    void vFunction( void * pvParameters )
139 #define portTASK_FUNCTION( vFunction, pvParameters )          void vFunction( void * pvParameters )
140
141 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()              do {} while( 0 )     /* we use the timer */
142 #define portALT_GET_RUN_TIME_COUNTER_VALUE( dest )            ( dest = xTickCount )
143
144 #if defined( __MW__ )
145     extern void task_end_hook( void * pxTCB );
146     #define portCLEAN_UP_TCB( pxTCB )    task_end_hook( ( void * ) pxTCB )
147 #else
148     #define portCLEAN_UP_TCB( pxTCB )    ( void ) pxTCB
149 #endif
150
151 void vPortYield( void );
152 void vPortYieldFromIsr( void );
153
154 /* *INDENT-OFF* */
155 #ifdef __cplusplus
156     }
157 #endif
158 /* *INDENT-ON* */
159
160 #endif /* PORTMACRO_H */