mTower
portmacro.h
1 
21 /*
22  * FreeRTOS Kernel V10.1.1
23  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
24  *
25  * Permission is hereby granted, free of charge, to any person obtaining a copy of
26  * this software and associated documentation files (the "Software"), to deal in
27  * the Software without restriction, including without limitation the rights to
28  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
29  * the Software, and to permit persons to whom the Software is furnished to do so,
30  * subject to the following conditions:
31  *
32  * The above copyright notice and this permission notice shall be included in all
33  * copies or substantial portions of the Software.
34  *
35  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
37  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
38  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41  *
42  * http://www.FreeRTOS.org
43  * http://aws.amazon.com/freertos
44  *
45  * 1 tab == 4 spaces!
46  */
47 
48 #ifndef __FREERTOS_PORTABLE_GCC_ARMV8M_PORTMACRO_H
49 #define __FREERTOS_PORTABLE_GCC_ARMV8M_PORTMACRO_H
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #define __dsb(x) __asm volatile(" dsb\n")
56 #define __isb(x) __asm volatile(" isb\n")
57 
58 #include "M2351.h"
59 
60 /* The settings in this file configure FreeRTOS correctly for the given
61  * hardware and compiler. These settings should not be altered.
62  */
63 
64 /* Type definitions. */
65 #define portCHAR char
66 #define portFLOAT float
67 #define portDOUBLE double
68 #define portLONG long
69 #define portSHORT short
70 #define portSTACK_TYPE uint32_t
71 #define portBASE_TYPE long
72 
73 typedef portSTACK_TYPE StackType_t;
74 typedef long BaseType_t;
75 typedef unsigned long UBaseType_t;
76 
77 #if( configUSE_16_BIT_TICKS == 1 )
78 typedef uint16_t TickType_t;
79 #define portMAX_DELAY ( TickType_t ) 0xffff
80 #else
81 typedef uint32_t TickType_t;
82 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
83 
84 /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
85  not need to be guarded with a critical section. */
86 #define portTICK_TYPE_IS_ATOMIC 1
87 #endif
88 
89 /* Architecture specifics. */
90 #define portSTACK_GROWTH ( -1 )
91 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
92 #define portBYTE_ALIGNMENT 8
93 
94 /* Scheduler utilities. */
95 extern void vPortYield( void );
96 #define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
97 
98 #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
99 #define portNVIC_PENDSVCLEAR_BIT ( 1UL << 27UL )
100 #define portYIELD() vPortYield()
101 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
102 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
103 
104 /* Critical section management. */
105 extern void vPortEnterCritical( void );
106 extern void vPortExitCritical( void );
107 extern uint32_t ulSetInterruptMaskFromISR( void );
108 extern void vClearInterruptMaskFromISR( uint32_t ulMask );
109 
110 #define portSET_INTERRUPT_MASK_FROM_ISR() ulSetInterruptMaskFromISR()
111 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vClearInterruptMaskFromISR( x )
112 #define portDISABLE_INTERRUPTS() __disable_irq()
113 #define portENABLE_INTERRUPTS() __enable_irq()
114 #define portENTER_CRITICAL() vPortEnterCritical()
115 #define portEXIT_CRITICAL() vPortExitCritical()
116 
117 /* Task function macros as described on the FreeRTOS.org WEB site. */
118 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
119 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
120 
121 #define portNOP()
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* __FREERTOS_PORTABLE_GCC_ARMV8M_PORTMACRO_H */
128