2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of
5 * this software and associated documentation files (the "Software"), to deal in
6 * the Software without restriction, including without limitation the rights to
7 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 * the Software, and to permit persons to whom the Software is furnished to do so,
9 * subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 extern void vPortYield(void);
38 /*-----------------------------------------------------------
39 * Port specific definitions.
41 * The settings in this file configure FreeRTOS correctly for the
42 * given hardware and compiler.
44 * These settings should not be altered.
45 *-----------------------------------------------------------
48 /* Type definitions. */
50 #define portFLOAT float
51 #define portDOUBLE double
53 #define portSHORT short
54 #define portSTACK_TYPE uint32_t
55 #define portBASE_TYPE long
57 typedef portSTACK_TYPE StackType_t;
58 typedef long BaseType_t;
59 typedef unsigned long UBaseType_t;
60 typedef void (*portvectorfunc)(void);
62 #if( configUSE_16_BIT_TICKS == 1 )
63 typedef uint16_t TickType_t;
64 #define portMAX_DELAY ( TickType_t ) 0xffff
66 typedef uint32_t TickType_t;
67 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
71 /* Hardware specifics. */
72 #define portBYTE_ALIGNMENT 8
73 #define portSTACK_GROWTH -1
74 #define portMS_PERIOD_TICK 10
75 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
78 static inline void vPortEnableInterrupt( void )
83 static inline void vPortDisableInterrupt( void )
88 static inline portLONG GetCurrentPSR (void)
93 static inline portLONG SaveLocalPSR (void)
95 portLONG flags = __get_PSR();
100 static inline void RestoreLocalPSR (portLONG newMask)
102 __asm__ __volatile__(
110 extern void vPortEnterCritical( void );
111 extern void vPortExitCritical( void );
112 extern __attribute__((naked)) void cpu_yeild(void);
114 #define portDISABLE_INTERRUPTS() vPortDisableInterrupt()
115 #define portENABLE_INTERRUPTS() vPortEnableInterrupt()
116 #define portENTER_CRITICAL() vPortEnterCritical()
117 #define portEXIT_CRITICAL() vPortExitCritical()
118 #define portSET_INTERRUPT_MASK_FROM_ISR() SaveLocalPSR()
119 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(a) RestoreLocalPSR(a)
121 #define portNOP() asm("nop")
123 extern portLONG ulCriticalNesting;
124 extern portLONG pendsvflag;
126 #define portYIELD() if (ulCriticalNesting == 0) \
136 /*-----------------------------------------------------------*/
138 /* Task function macros as described on the FreeRTOS.org WEB site. */
139 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__((noreturn))
140 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
141 /*-----------------------------------------------------------*/
143 #define portEND_SWITCHING_ISR( xSwitchRequired ) do { \
144 if( xSwitchRequired != pdFALSE ) \
150 #define portYIELD_FROM_ISR( a ) vTaskSwitchContext()
158 #endif /* PORTMACRO_H */