2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
4 * SPDX-License-Identifier: MIT
6 * Permission is hereby granted, free of charge, to any person obtaining a copy of
7 * this software and associated documentation files (the "Software"), to deal in
8 * the Software without restriction, including without limitation the rights to
9 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 * the Software, and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 extern void vPortYield(void);
39 /*-----------------------------------------------------------
40 * Port specific definitions.
42 * The settings in this file configure FreeRTOS correctly for the
43 * given hardware and compiler.
45 * These settings should not be altered.
46 *-----------------------------------------------------------
49 /* Type definitions. */
51 #define portFLOAT float
52 #define portDOUBLE double
54 #define portSHORT short
55 #define portSTACK_TYPE uint32_t
56 #define portBASE_TYPE long
58 typedef portSTACK_TYPE StackType_t;
59 typedef long BaseType_t;
60 typedef unsigned long UBaseType_t;
61 typedef void (*portvectorfunc)(void);
63 #if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
64 typedef uint16_t TickType_t;
65 #define portMAX_DELAY ( TickType_t ) 0xffff
66 #elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
67 typedef uint32_t TickType_t;
68 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
70 #error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
74 /* Hardware specifics. */
75 #define portBYTE_ALIGNMENT 8
76 #define portSTACK_GROWTH -1
77 #define portMS_PERIOD_TICK 10
78 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
81 static inline void vPortEnableInterrupt( void )
86 static inline void vPortDisableInterrupt( void )
91 static inline portLONG GetCurrentPSR (void)
96 static inline portLONG SaveLocalPSR (void)
98 portLONG flags = __get_PSR();
103 static inline void RestoreLocalPSR (portLONG newMask)
105 __asm__ __volatile__(
113 extern void vPortEnterCritical( void );
114 extern void vPortExitCritical( void );
115 extern __attribute__((naked)) void cpu_yeild(void);
117 #define portDISABLE_INTERRUPTS() vPortDisableInterrupt()
118 #define portENABLE_INTERRUPTS() vPortEnableInterrupt()
119 #define portENTER_CRITICAL() vPortEnterCritical()
120 #define portEXIT_CRITICAL() vPortExitCritical()
121 #define portSET_INTERRUPT_MASK_FROM_ISR() SaveLocalPSR()
122 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(a) RestoreLocalPSR(a)
124 #define portNOP() asm("nop")
126 extern portLONG ulCriticalNesting;
127 extern portLONG pendsvflag;
129 #define portYIELD() if (ulCriticalNesting == 0) \
139 /*-----------------------------------------------------------*/
141 /* Task function macros as described on the FreeRTOS.org WEB site. */
142 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__((noreturn))
143 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
144 /*-----------------------------------------------------------*/
146 #define portEND_SWITCHING_ISR( xSwitchRequired ) do { \
147 if( xSwitchRequired != pdFALSE ) \
153 #define portYIELD_FROM_ISR( a ) vTaskSwitchContext()
161 #endif /* PORTMACRO_H */