1 /*
2  * FreeRTOS Kernel V11.1.0
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 #include "embARC.h"
32 
33 /* *INDENT-OFF* */
34 #ifdef __cplusplus
35     extern "C" {
36 #endif
37 /* *INDENT-ON* */
38 
39 /* record stack high address for stack check */
40 #ifndef configRECORD_STACK_HIGH_ADDRESS
41     #define configRECORD_STACK_HIGH_ADDRESS    1
42 #endif
43 
44 /*-----------------------------------------------------------
45  * Port specific definitions.
46  *
47  * The settings in this file configure FreeRTOS correctly for the
48  * given hardware and compiler.
49  *
50  * These settings should not be altered.
51  *-----------------------------------------------------------
52  */
53 
54 /* Type definitions. */
55 #define portCHAR          char
56 #define portFLOAT         float
57 #define portDOUBLE        double
58 #define portLONG          long
59 #define portSHORT         short
60 #define portSTACK_TYPE    unsigned int
61 #define portBASE_TYPE     portLONG
62 
63 #ifndef Asm
64     #define Asm           __asm__ volatile
65 #endif
66 
67 /*
68  *  normal constants
69  */
70 #ifndef NULL
71     #define NULL    0           /* invalid pointer */
72 #endif /* NULL */
73 
74 #ifndef true
75     #define true    1           /* true */
76 #endif /* true */
77 
78 #ifndef false
79     #define false    0          /* false */
80 #endif /* false */
81 
82 typedef portSTACK_TYPE   StackType_t;
83 typedef long             BaseType_t;
84 typedef unsigned long    UBaseType_t;
85 
86 #if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
87     typedef uint16_t     TickType_t;
88     #define portMAX_DELAY    ( TickType_t ) 0xffff
89 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
90     typedef uint32_t     TickType_t;
91     #define portMAX_DELAY    ( TickType_t ) 0xffffffffUL
92 #else
93     #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
94 #endif
95 
96 #define portNO_CRITICAL_NESTING    ( ( uint32_t ) 0 )
97 #define portSTACK_GROWTH           ( -1 )
98 #define portTICK_PERIOD_MS         ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
99 #define portBYTE_ALIGNMENT         8
100 #define portNOP()               Asm( "nop_s" );
101 #define IPM_ENABLE_ALL             1
102 
103 #define portYIELD_FROM_ISR()    vPortYieldFromIsr()
104 #define portYIELD()             vPortYield()
105 
106 /* Critical section management. */
107 #define portDISABLE_INTERRUPTS() \
108     {                            \
109         arc_lock();              \
110     }                            \
111 
112 #define portENABLE_INTERRUPTS() \
113     {                           \
114         arc_unlock();           \
115     }                           \
116 
117 extern volatile unsigned int ulCriticalNesting;
118 
119 #define portENTER_CRITICAL()     \
120     {                            \
121         portDISABLE_INTERRUPTS() \
122         ulCriticalNesting++;     \
123     }
124 
125 
126 #define portEXIT_CRITICAL()                                    \
127     {                                                          \
128         if( ulCriticalNesting > portNO_CRITICAL_NESTING )      \
129         {                                                      \
130             ulCriticalNesting--;                               \
131             if( ulCriticalNesting == portNO_CRITICAL_NESTING ) \
132             {                                                  \
133                 portENABLE_INTERRUPTS()                        \
134             }                                                  \
135         }                                                      \
136     }
137 
138 
139 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters )    void vFunction( void * pvParameters )
140 #define portTASK_FUNCTION( vFunction, pvParameters )          void vFunction( void * pvParameters )
141 
142 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()              do {} while( 0 )     /* we use the timer */
143 #define portALT_GET_RUN_TIME_COUNTER_VALUE( dest )            ( dest = xTickCount )
144 
145 void vPortYield( void );
146 void vPortYieldFromIsr( void );
147 
148 /* *INDENT-OFF* */
149 #ifdef __cplusplus
150     }
151 #endif
152 /* *INDENT-ON* */
153 
154 #endif /* PORTMACRO_H */
155