FreeRTOS Tetris
portmacro.h
1 /*
2  FreeRTOS.org V5.2.0 - Copyright (C) 2003-2009 Richard Barry.
3 
4  This file is part of the FreeRTOS.org distribution.
5 
6  FreeRTOS.org is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License (version 2) as published
8  by the Free Software Foundation and modified by the FreeRTOS exception.
9 
10  FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59
17  Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 
19  A special exception to the GPL is included to allow you to distribute a
20  combined work that includes FreeRTOS.org without being obliged to provide
21  the source code for any proprietary components. See the licensing section
22  of http://www.FreeRTOS.org for full details.
23 
24 
25  ***************************************************************************
26  * *
27  * Get the FreeRTOS eBook! See http://www.FreeRTOS.org/Documentation *
28  * *
29  * This is a concise, step by step, 'hands on' guide that describes both *
30  * general multitasking concepts and FreeRTOS specifics. It presents and *
31  * explains numerous examples that are written using the FreeRTOS API. *
32  * Full source code for all the examples is provided in an accompanying *
33  * .zip file. *
34  * *
35  ***************************************************************************
36 
37  1 tab == 4 spaces!
38 
39  Please ensure to read the configuration and relevant port sections of the
40  online documentation.
41 
42  http://www.FreeRTOS.org - Documentation, latest information, license and
43  contact details.
44 
45  http://www.SafeRTOS.com - A version that is certified for use in safety
46  critical systems.
47 
48  http://www.OpenRTOS.com - Commercial support, development, porting,
49  licensing and training services.
50 */
51 
52 /*
53  * Updated by Alex Hoffman - alxhoff@gmail.com July 2019
54  * FreeRTOS version V9.0.0
55  * */
56 
57 
58 #ifndef PORTMACRO_H
59 #define PORTMACRO_H
60 
61 #include <stdint.h>
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /*-----------------------------------------------------------
68  * Port specific definitions.
69  *
70  * The settings in this file configure FreeRTOS correctly for the
71  * given hardware and compiler.
72  *
73  * These settings should not be altered.
74  *-----------------------------------------------------------
75  */
76 
77 /* Type definitions. Legacy*/
78 #define portCHAR char
79 #define portFLOAT float
80 #define portDOUBLE double
81 #define portLONG int
82 #define portSHORT short
83 #define portSTACK_TYPE uint32_t
84 #define portBASE_TYPE long
85 
90 typedef portSTACK_TYPE StackType_t;
91 typedef long BaseType_t;
92 typedef unsigned long UBaseType_t;
93 
94 #if( configUSE_16_BIT_TICKS == 1 )
95 typedef uint16_t TickType_t;
96 #define portMAX_DELAY ( TickType_t ) 0xffff
97 #else
98 typedef uint32_t TickType_t;
99 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
100 
101 
102 
104 #define portTICK_TYPE_IS_ATOMIC 1
105 #endif
106 /*-----------------------------------------------------------*/
107 
108 /* Architecture specifics. */
109 #define portSTACK_GROWTH ( -1 )
110 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
111 #define portTICK_PERIOD_MICROSECONDS ( ( TickType_t ) 1000000 / configTICK_RATE_HZ )
112 #define portBYTE_ALIGNMENT 4
113 #define portREMOVE_STATIC_QUALIFIER
114 /*-----------------------------------------------------------*/
115 
118 
119 
120 
121 /* Scheduler utilities. */
122 extern void vPortYieldFromISR(void);
123 extern void vPortYield(void);
124 
125 #define portYIELD() vPortYield()
126 
127 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYieldFromISR()
128 #define portYIELD_FROM_ISR( xSwitchRequired ) portEND_SWITCHING_ISR( xSwitchRequired )
129 /*-----------------------------------------------------------*/
130 
131 
132 /* Critical section management. */
133 extern void vPortDisableInterrupts(void);
134 extern void vPortEnableInterrupts(void);
135 #define portSET_INTERRUPT_MASK() ( vPortDisableInterrupts() )
136 #define portCLEAR_INTERRUPT_MASK() ( vPortEnableInterrupts() )
137 
138 extern BaseType_t xPortSetInterruptMask(void);
139 extern void vPortClearInterruptMask(BaseType_t xMask);
140 
141 #define portSET_INTERRUPT_MASK_FROM_ISR() xPortSetInterruptMask()
142 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
143 
144 
145 extern void vPortEnterCritical(void);
146 extern void vPortExitCritical(void);
147 
148 #define portDISABLE_INTERRUPTS() portSET_INTERRUPT_MASK()
149 #define portENABLE_INTERRUPTS() portCLEAR_INTERRUPT_MASK()
150 #define portENTER_CRITICAL() vPortEnterCritical()
151 #define portEXIT_CRITICAL() vPortExitCritical()
152 /*-----------------------------------------------------------*/
153 
154 /* Task function macros as described on the FreeRTOS.org WEB site. */
155 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
156 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
157 
158 #define portNOP()
159 
160 #define portOUTPUT_BYTE( a, b )
161 
162 extern void vPortForciblyEndThread(void *pxTaskToDelete);
163 #define traceTASK_DELETE( pxTaskToDelete ) vPortForciblyEndThread( pxTaskToDelete )
164 
165 extern void vPortAddTaskHandle(void *pxTaskHandle);
166 #define traceTASK_CREATE( pxNewTCB ) vPortAddTaskHandle( pxNewTCB )
167 
168 /* Posix Signal definitions that can be changed or read as appropriate. */
169 #define SIG_SUSPEND SIGUSR1
170 #define SIG_RESUME SIGUSR2
171 
172 /* Enable the following hash defines to make use of the real-time tick where time progresses at real-time. */
173 #define SIG_TICK SIGALRM
174 #define TIMER_TYPE ITIMER_REAL
175 /* Enable the following hash defines to make use of the process tick where time progresses only when the process is executing.
176 #define SIG_TICK SIGVTALRM
177 #define TIMER_TYPE ITIMER_VIRTUAL */
178 /* Enable the following hash defines to make use of the profile tick where time progresses when the process or system calls are executing.
179 #define SIG_TICK SIGPROF
180 #define TIMER_TYPE ITIMER_PROF */
181 
182 /* Make use of times(man 2) to gather run-time statistics on the tasks. */
183 extern void vPortFindTicksPerSecond(void);
184 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vPortFindTicksPerSecond() /* Nothing to do because the timer is already present. */
185 extern unsigned long ulPortGetTimerValue(void);
186 #define portGET_RUN_TIME_COUNTER_VALUE() ulPortGetTimerValue() /* Query the System time stats for this process. */
187 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 #endif /* PORTMACRO_H */
193 
TickType_t
uint32_t TickType_t
FreeRTOS definition for a single tick.
Definition: portmacro.h:98
UBaseType_t
unsigned long UBaseType_t
FreeRTOS definition for unsigned long ints.
Definition: portmacro.h:92
BaseType_t
long BaseType_t
FreeRTOS definition for long ints.
Definition: portmacro.h:91
StackType_t
portSTACK_TYPE StackType_t
FreeRTOS defintions for the Stack Type.
Definition: portmacro.h:90