SAM4S-EK_FreeRTOS+FAT-SL  1.0
An example project to test the functionality of FreeRTOS+FAT-SL using SD card as data storage medium
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
portmacro.h
Go to the documentation of this file.
1 /*
2  FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.
3  All rights reserved
4 
5  VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 
7  ***************************************************************************
8  * *
9  * FreeRTOS provides completely free yet professionally developed, *
10  * robust, strictly quality controlled, supported, and cross *
11  * platform software that has become a de facto standard. *
12  * *
13  * Help yourself get started quickly and support the FreeRTOS *
14  * project by purchasing a FreeRTOS tutorial book, reference *
15  * manual, or both from: http://www.FreeRTOS.org/Documentation *
16  * *
17  * Thank you! *
18  * *
19  ***************************************************************************
20 
21  This file is part of the FreeRTOS distribution.
22 
23  FreeRTOS is free software; you can redistribute it and/or modify it under
24  the terms of the GNU General Public License (version 2) as published by the
25  Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
26 
27  >>! NOTE: The modification to the GPL is included to allow you to !<<
28  >>! distribute a combined work that includes FreeRTOS without being !<<
29  >>! obliged to provide the source code for proprietary components !<<
30  >>! outside of the FreeRTOS kernel. !<<
31 
32  FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
33  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34  FOR A PARTICULAR PURPOSE. Full license text is available from the following
35  link: http://www.freertos.org/a00114.html
36 
37  1 tab == 4 spaces!
38 
39  ***************************************************************************
40  * *
41  * Having a problem? Start by reading the FAQ "My application does *
42  * not run, what could be wrong?" *
43  * *
44  * http://www.FreeRTOS.org/FAQHelp.html *
45  * *
46  ***************************************************************************
47 
48  http://www.FreeRTOS.org - Documentation, books, training, latest versions,
49  license and Real Time Engineers Ltd. contact details.
50 
51  http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
52  including FreeRTOS+Trace - an indispensable productivity tool, a DOS
53  compatible FAT file system, and our tiny thread aware UDP/IP stack.
54 
55  http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
56  Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
57  licenses offer ticketed support, indemnification and middleware.
58 
59  http://www.SafeRTOS.com - High Integrity Systems also provide a safety
60  engineered and independently SIL3 certified version for use in safety and
61  mission critical applications that require provable dependability.
62 
63  1 tab == 4 spaces!
64 */
65 
66 
67 #ifndef PORTMACRO_H
68 #define PORTMACRO_H
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 /*-----------------------------------------------------------
75  * Port specific definitions.
76  *
77  * The settings in this file configure FreeRTOS correctly for the
78  * given hardware and compiler.
79  *
80  * These settings should not be altered.
81  *-----------------------------------------------------------
82  */
83 
84 /* Type definitions. */
85 #define portCHAR char
86 #define portFLOAT float
87 #define portDOUBLE double
88 #define portLONG long
89 #define portSHORT short
90 #define portSTACK_TYPE uint32_t
91 #define portBASE_TYPE long
92 
94 typedef long BaseType_t;
95 typedef unsigned long UBaseType_t;
96 
97 #if( configUSE_16_BIT_TICKS == 1 )
98  typedef uint16_t TickType_t;
99  #define portMAX_DELAY ( TickType_t ) 0xffff
100 #else
101  typedef uint32_t TickType_t;
102  #define portMAX_DELAY ( TickType_t ) 0xffffffffUL
103 #endif
104 /*-----------------------------------------------------------*/
105 
106 /* Architecture specifics. */
107 #define portSTACK_GROWTH ( -1 )
108 #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
109 #define portBYTE_ALIGNMENT 8
110 /*-----------------------------------------------------------*/
111 
112 
113 /* Scheduler utilities. */
114 extern void vPortYield( void );
115 #define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
116 #define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
117 #define portYIELD() vPortYield()
118 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
119 #define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
120 /*-----------------------------------------------------------*/
121 
122 /* Critical section management. */
123 extern void vPortEnterCritical( void );
124 extern void vPortExitCritical( void );
125 extern uint32_t ulPortSetInterruptMask( void );
126 extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );
127 #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask()
128 #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
129 #define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
130 #define portENABLE_INTERRUPTS() vPortClearInterruptMask(0)
131 #define portENTER_CRITICAL() vPortEnterCritical()
132 #define portEXIT_CRITICAL() vPortExitCritical()
133 /*-----------------------------------------------------------*/
134 
135 /* Task function macros as described on the FreeRTOS.org WEB site. These are
136 not necessary for to use this port. They are defined so the common demo files
137 (which build with all the ports) will build. */
138 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
139 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
140 /*-----------------------------------------------------------*/
141 
142 /* Tickless idle/low power functionality. */
143 #ifndef portSUPPRESS_TICKS_AND_SLEEP
144  extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime );
145  #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime )
146 #endif
147 /*-----------------------------------------------------------*/
148 
149 /* Architecture specific optimisations. */
150 #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
151 
152  /* Generic helper function. */
153  __attribute__( ( always_inline ) ) static inline uint8_t ucPortCountLeadingZeros( uint32_t ulBitmap )
154  {
155  uint8_t ucReturn;
156 
157  __asm volatile ( "clz %0, %1" : "=r" ( ucReturn ) : "r" ( ulBitmap ) );
158  return ucReturn;
159  }
160 
161  /* Check the configuration. */
162  #if( configMAX_PRIORITIES > 32 )
163  #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
164  #endif
165 
166  /* Store/clear the ready priorities in a bit map. */
167  #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
168  #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
169 
170  /*-----------------------------------------------------------*/
171 
172  #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
173 
174 #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
175 
176 /*-----------------------------------------------------------*/
177 
178 #ifdef configASSERT
179  void vPortValidateInterruptPriority( void );
180  #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
181 #endif
182 
183 /* portNOP() is not required by this port. */
184 #define portNOP()
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif /* PORTMACRO_H */
191 
#define portSTACK_TYPE
Definition: portmacro.h:90
void vPortClearInterruptMask(uint32_t ulNewMaskValue)
void vPortYield(void)
Definition: port.c:359
void vPortExitCritical(void)
Definition: port.c:380
unsigned long UBaseType_t
Definition: portmacro.h:95
void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime)
uint32_t TickType_t
Definition: portmacro.h:101
void vPortEnterCritical(void)
Definition: port.c:371
long BaseType_t
Definition: portmacro.h:94
__attribute__((naked))
Definition: port.c:391
portSTACK_TYPE StackType_t
Definition: portmacro.h:93
uint32_t ulPortSetInterruptMask(void)