2 FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
\r
5 ***************************************************************************
\r
7 * FreeRTOS tutorial books are available in pdf and paperback. *
\r
8 * Complete, revised, and edited pdf reference manuals are also *
\r
11 * Purchasing FreeRTOS documentation will not only help you, by *
\r
12 * ensuring you get running as quickly as possible and with an *
\r
13 * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
14 * the FreeRTOS project to continue with its mission of providing *
\r
15 * professional grade, cross platform, de facto standard solutions *
\r
16 * for microcontrollers - completely free of charge! *
\r
18 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
20 * Thank you for using FreeRTOS, and thank you for your support! *
\r
22 ***************************************************************************
\r
25 This file is part of the FreeRTOS distribution.
\r
27 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
28 the terms of the GNU General Public License (version 2) as published by the
\r
29 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
30 >>>NOTE<<< The modification to the GPL is included to allow you to
\r
31 distribute a combined work that includes FreeRTOS without being obliged to
\r
32 provide the source code for proprietary components outside of the FreeRTOS
\r
33 kernel. FreeRTOS is distributed in the hope that it will be useful, but
\r
34 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
35 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
36 more details. You should have received a copy of the GNU General Public
\r
37 License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
38 can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
39 by writing to Richard Barry, contact details for whom are available on the
\r
44 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
47 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
50 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
51 licensing and training services.
\r
62 #include <mb_interface.h>
\r
63 #include <xparameters.h>
\r
65 /*-----------------------------------------------------------
\r
66 * Port specific definitions.
\r
68 * The settings in this file configure FreeRTOS correctly for the
\r
69 * given hardware and compiler.
\r
71 * These settings should not be altered.
\r
72 *-----------------------------------------------------------
\r
75 /* Type definitions. */
\r
76 #define portCHAR char
\r
77 #define portFLOAT float
\r
78 #define portDOUBLE double
\r
79 #define portLONG long
\r
80 #define portSHORT short
\r
81 #define portSTACK_TYPE unsigned portLONG
\r
82 #define portBASE_TYPE portLONG
\r
84 #if( configUSE_16_BIT_TICKS == 1 )
\r
85 typedef unsigned portSHORT portTickType;
\r
86 #define portMAX_DELAY ( portTickType ) 0xffff
\r
88 typedef unsigned portLONG portTickType;
\r
89 #define portMAX_DELAY ( portTickType ) 0xffffffff
\r
91 /*-----------------------------------------------------------*/
\r
93 /* Interrupt control macros and functions. */
\r
94 void microblaze_disable_interrupts( void );
\r
95 void microblaze_enable_interrupts( void );
\r
96 #define portDISABLE_INTERRUPTS() microblaze_disable_interrupts()
\r
97 #define portENABLE_INTERRUPTS() microblaze_enable_interrupts()
\r
100 * Installs pxHandler as the interrupt handler for the peripheral specified by
\r
101 * the ucInterruptID parameter.
\r
105 * The ID of the peripheral that will have pxHandler assigned as its interrupt
\r
106 * handler. Peripheral IDs are defined in the xparameters.h header file, which
\r
107 * is itself part of the BSP project. For example, in the official demo
\r
108 * application for this port, xparameters.h defines the following IDs for the
\r
109 * four possible interrupt sources:
\r
111 * XPAR_INTC_0_UARTLITE_1_VEC_ID - for the UARTlite peripheral.
\r
112 * XPAR_INTC_0_TMRCTR_0_VEC_ID - for the AXI Timer 0 peripheral.
\r
113 * XPAR_INTC_0_EMACLITE_0_VEC_ID - for the Ethernet lite peripheral.
\r
114 * XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs.
\r
119 * A pointer to the interrupt handler function itself. This must be a void
\r
120 * function that takes a (void *) parameter.
\r
125 * The parameter passed into the handler function. In many cases this will not
\r
126 * be used and can be NULL. Some times it is used to pass in a reference to
\r
127 * the peripheral instance variable, so it can be accessed from inside the
\r
128 * handler function.
\r
131 * pdPASS is returned if the function executes successfully. Any other value
\r
132 * being returned indicates that the function did not execute correctly.
\r
134 portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef );
\r
138 * Enables the interrupt, within the interrupt controller, for the peripheral
\r
139 * specified by the ucInterruptID parameter.
\r
143 * The ID of the peripheral that will have its interrupt enabled in the
\r
144 * interrupt controller. Peripheral IDs are defined in the xparameters.h header
\r
145 * file, which is itself part of the BSP project. For example, in the official
\r
146 * demo application for this port, xparameters.h defines the following IDs for
\r
147 * the four possible interrupt sources:
\r
149 * XPAR_INTC_0_UARTLITE_1_VEC_ID - for the UARTlite peripheral.
\r
150 * XPAR_INTC_0_TMRCTR_0_VEC_ID - for the AXI Timer 0 peripheral.
\r
151 * XPAR_INTC_0_EMACLITE_0_VEC_ID - for the Ethernet lite peripheral.
\r
152 * XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs.
\r
155 void vPortEnableInterrupt( unsigned char ucInterruptID );
\r
158 * Disables the interrupt, within the interrupt controller, for the peripheral
\r
159 * specified by the ucInterruptID parameter.
\r
163 * The ID of the peripheral that will have its interrupt disabled in the
\r
164 * interrupt controller. Peripheral IDs are defined in the xparameters.h header
\r
165 * file, which is itself part of the BSP project. For example, in the official
\r
166 * demo application for this port, xparameters.h defines the following IDs for
\r
167 * the four possible interrupt sources:
\r
169 * XPAR_INTC_0_UARTLITE_1_VEC_ID - for the UARTlite peripheral.
\r
170 * XPAR_INTC_0_TMRCTR_0_VEC_ID - for the AXI Timer 0 peripheral.
\r
171 * XPAR_INTC_0_EMACLITE_0_VEC_ID - for the Ethernet lite peripheral.
\r
172 * XPAR_INTC_0_GPIO_1_VEC_ID - for the button inputs.
\r
175 void vPortDisableInterrupt( unsigned char ucInterruptID );
\r
177 void vApplicationSetupTimerInterrupt( void );
\r
179 /*-----------------------------------------------------------*/
\r
181 /* Critical section macros. */
\r
182 void vPortEnterCritical( void );
\r
183 void vPortExitCritical( void );
\r
184 #define portENTER_CRITICAL() { \
\r
185 extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\r
186 microblaze_disable_interrupts(); \
\r
187 uxCriticalNesting++; \
\r
190 #define portEXIT_CRITICAL() { \
\r
191 extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\r
192 /* Interrupts are disabled, so we can */ \
\r
193 /* access the variable directly. */ \
\r
194 uxCriticalNesting--; \
\r
195 if( uxCriticalNesting == 0 ) \
\r
197 /* The nesting has unwound and we \
\r
198 can enable interrupts again. */ \
\r
199 portENABLE_INTERRUPTS(); \
\r
203 /*-----------------------------------------------------------*/
\r
205 /* The yield macro maps directly to the vPortYield() function. */
\r
206 void vPortYield( void );
\r
207 #define portYIELD() vPortYield()
\r
209 /* portYIELD_FROM_ISR() does not directly call vTaskSwitchContext(), but instead
\r
210 sets a flag to say that a yield has been requested. The interrupt exit code
\r
211 then checks this flag, and calls vTaskSwitchContext() before restoring a task
\r
212 context, if the flag is not false. This is done to prevent multiple calls to
\r
213 vTaskSwitchContext() being made from a single interrupt, as a single interrupt
\r
214 can result in multiple peripherals being serviced. */
\r
215 extern volatile unsigned long ulTaskSwitchRequested;
\r
216 #define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) ulTaskSwitchRequested = 1
\r
217 /*-----------------------------------------------------------*/
\r
219 /* Hardware specifics. */
\r
220 #define portBYTE_ALIGNMENT 4
\r
221 #define portSTACK_GROWTH ( -1 )
\r
222 #define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
\r
223 #define portNOP() asm volatile ( "NOP" )
\r
224 /*-----------------------------------------------------------*/
\r
226 /* Task function macros as described on the FreeRTOS.org WEB site. */
\r
227 #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
\r
228 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
\r
229 /*-----------------------------------------------------------*/
\r
231 /* The following structure is used by the FreeRTOS exception handler. It is
\r
232 filled with the MicroBlaze context as it was at the time the exception occurred.
\r
233 This is done as an aid to debugging exception occurrences. */
\r
234 typedef struct PORT_REGISTER_DUMP
\r
236 /* The following structure members hold the values of the MicroBlaze
\r
237 registers at the time the exception was raised. */
\r
238 unsigned long ulR1_SP;
\r
239 unsigned long ulR2_small_data_area;
\r
240 unsigned long ulR3;
\r
241 unsigned long ulR4;
\r
242 unsigned long ulR5;
\r
243 unsigned long ulR6;
\r
244 unsigned long ulR7;
\r
245 unsigned long ulR8;
\r
246 unsigned long ulR9;
\r
247 unsigned long ulR10;
\r
248 unsigned long ulR11;
\r
249 unsigned long ulR12;
\r
250 unsigned long ulR13_read_write_small_data_area;
\r
251 unsigned long ulR14_return_address_from_interrupt;
\r
252 unsigned long ulR15_return_address_from_subroutine;
\r
253 unsigned long ulR16_return_address_from_trap;
\r
254 unsigned long ulR17_return_address_from_exceptions; /* The exception entry code will copy the BTR into R17 if the exception occurred in the delay slot of a branch instruction. */
\r
255 unsigned long ulR18;
\r
256 unsigned long ulR19;
\r
257 unsigned long ulR20;
\r
258 unsigned long ulR21;
\r
259 unsigned long ulR22;
\r
260 unsigned long ulR23;
\r
261 unsigned long ulR24;
\r
262 unsigned long ulR25;
\r
263 unsigned long ulR26;
\r
264 unsigned long ulR27;
\r
265 unsigned long ulR28;
\r
266 unsigned long ulR29;
\r
267 unsigned long ulR30;
\r
268 unsigned long ulR31;
\r
269 unsigned long ulPC;
\r
270 unsigned long ulESR;
\r
271 unsigned long ulMSR;
\r
272 unsigned long ulEAR;
\r
273 unsigned long ulFSR;
\r
274 unsigned long ulEDR;
\r
276 /* A human readable description of the exception cause. The strings used
\r
277 are the same as the #define constant names found in the
\r
278 microblaze_exceptions_i.h header file */
\r
279 signed char *pcExceptionCause;
\r
281 /* The human readable name of the task that was running at the time the
\r
282 exception occurred. This is the name that was given to the task when the
\r
283 task was created using the FreeRTOS xTaskCreate() API function. */
\r
284 signed char *pcCurrentTaskName;
\r
286 /* The handle of the task that was running a the time the exception
\r
288 void * xCurrentTaskHandle;
\r
290 } xPortRegisterDump;
\r
292 void vPortExceptionsInstallHandlers( void );
\r
293 void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump );
\r
299 #endif /* PORTMACRO_H */
\r