blob: 92459cdf84e489c86cad4461ea6b1aacaac9533f [file] [log] [blame]
Richard Barryb6df57c2006-05-02 09:39:15 +00001/*
Paul Bartell08dc6f62021-05-25 21:44:10 -07002 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
Paul Bartelladfc5332021-05-25 21:46:15 -07003 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Richard Barrycfc26882017-11-29 16:53:26 +00004 *
Paul Bartelleec42332021-06-01 12:01:32 -07005 * SPDX-License-Identifier: MIT
6 *
Richard Barrycfc26882017-11-29 16:53:26 +00007 * 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
Richard Barry13651932017-12-18 22:54:18 +000015 * copies or substantial portions of the Software.
Richard Barrycfc26882017-11-29 16:53:26 +000016 *
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 *
alfred gedeon0b0a2062020-08-20 14:59:28 -070024 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
Richard Barrycfc26882017-11-29 16:53:26 +000026 *
Richard Barrycfc26882017-11-29 16:53:26 +000027 */
Richard Barryb6df57c2006-05-02 09:39:15 +000028
29#ifndef PORTMACRO_H
alfred gedeon86653e22020-08-17 10:51:02 -070030#define PORTMACRO_H
Richard Barryb6df57c2006-05-02 09:39:15 +000031
alfred gedeon86653e22020-08-17 10:51:02 -070032#ifdef __cplusplus
33extern "C" {
34#endif
Richard Barry620d3992007-11-05 16:44:39 +000035
Richard Barryb6df57c2006-05-02 09:39:15 +000036/*-----------------------------------------------------------
Richard Barry3e20aa72013-12-29 14:06:04 +000037 * Port specific definitions.
Richard Barryb6df57c2006-05-02 09:39:15 +000038 *
39 * The settings in this file configure FreeRTOS correctly for the
40 * given hardware and compiler.
41 *
42 * These settings should not be altered.
43 *-----------------------------------------------------------
44 */
45
46/* Type definitions. */
alfred gedeon86653e22020-08-17 10:51:02 -070047#define portCHAR char
48#define portFLOAT float
49#define portDOUBLE double
50#define portLONG long
51#define portSHORT short
52#define portSTACK_TYPE uint32_t
53#define portBASE_TYPE long
Richard Barry3e20aa72013-12-29 14:06:04 +000054
alfred gedeon86653e22020-08-17 10:51:02 -070055typedef portSTACK_TYPE StackType_t;
56typedef long BaseType_t;
57typedef unsigned long UBaseType_t;
Richard Barryb6df57c2006-05-02 09:39:15 +000058
alfred gedeon86653e22020-08-17 10:51:02 -070059#if( configUSE_16_BIT_TICKS == 1 )
60 typedef uint16_t TickType_t;
61 #define portMAX_DELAY ( TickType_t ) 0xffff
62#else
63 typedef uint32_t TickType_t;
64 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
Richard Barryf407b702014-12-18 11:02:15 +000065
alfred gedeon86653e22020-08-17 10:51:02 -070066 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
67 not need to be guarded with a critical section. */
68 #define portTICK_TYPE_IS_ATOMIC 1
69#endif
Richard Barry3e20aa72013-12-29 14:06:04 +000070/*-----------------------------------------------------------*/
Richard Barryb6df57c2006-05-02 09:39:15 +000071
72/* Interrupt control macros. */
alfred gedeon86653e22020-08-17 10:51:02 -070073void microblaze_disable_interrupts( void );
74void microblaze_enable_interrupts( void );
75#define portDISABLE_INTERRUPTS() microblaze_disable_interrupts()
76#define portENABLE_INTERRUPTS() microblaze_enable_interrupts()
Richard Barryb6df57c2006-05-02 09:39:15 +000077/*-----------------------------------------------------------*/
78
79/* Critical section macros. */
alfred gedeon86653e22020-08-17 10:51:02 -070080void vPortEnterCritical( void );
81void vPortExitCritical( void );
82#define portENTER_CRITICAL() { \
83 extern UBaseType_t uxCriticalNesting; \
84 microblaze_disable_interrupts(); \
85 uxCriticalNesting++; \
86 }
Richard Barry3e20aa72013-12-29 14:06:04 +000087
alfred gedeon86653e22020-08-17 10:51:02 -070088#define portEXIT_CRITICAL() { \
89 extern UBaseType_t uxCriticalNesting; \
90 /* Interrupts are disabled, so we can */ \
91 /* access the variable directly. */ \
92 uxCriticalNesting--; \
93 if( uxCriticalNesting == 0 ) \
94 { \
95 /* The nesting has unwound and we \
96 can enable interrupts again. */ \
97 portENABLE_INTERRUPTS(); \
98 } \
99 }
Richard Barryb6df57c2006-05-02 09:39:15 +0000100
101/*-----------------------------------------------------------*/
102
103/* Task utilities. */
alfred gedeon86653e22020-08-17 10:51:02 -0700104void vPortYield( void );
105#define portYIELD() vPortYield()
Richard Barryb6df57c2006-05-02 09:39:15 +0000106
alfred gedeon86653e22020-08-17 10:51:02 -0700107void vTaskSwitchContext();
108#define portYIELD_FROM_ISR() vTaskSwitchContext()
Richard Barryb6df57c2006-05-02 09:39:15 +0000109/*-----------------------------------------------------------*/
110
111/* Hardware specifics. */
alfred gedeon86653e22020-08-17 10:51:02 -0700112#define portBYTE_ALIGNMENT 4
113#define portSTACK_GROWTH ( -1 )
114#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
115#define portNOP() asm volatile ( "NOP" )
Richard Barryb6df57c2006-05-02 09:39:15 +0000116/*-----------------------------------------------------------*/
117
118/* Task function macros as described on the FreeRTOS.org WEB site. */
alfred gedeon86653e22020-08-17 10:51:02 -0700119#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
120#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
Richard Barryb6df57c2006-05-02 09:39:15 +0000121
alfred gedeon86653e22020-08-17 10:51:02 -0700122#ifdef __cplusplus
123}
124#endif
Richard Barry620d3992007-11-05 16:44:39 +0000125
Richard Barryb6df57c2006-05-02 09:39:15 +0000126#endif /* PORTMACRO_H */
alfred gedeon86653e22020-08-17 10:51:02 -0700127