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