Francisco Paez / freertos-cm3

Dependents:   mbed_lpc1768_freertos_lib

Committer:
fep
Date:
Wed May 31 02:36:43 2017 +0000
Revision:
0:5ff20db10a96
FreeRTOS v9.0.0 for ARM Cortex-M3 based boards.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fep 0:5ff20db10a96 1 /*
fep 0:5ff20db10a96 2 FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
fep 0:5ff20db10a96 3 All rights reserved
fep 0:5ff20db10a96 4
fep 0:5ff20db10a96 5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
fep 0:5ff20db10a96 6
fep 0:5ff20db10a96 7 This file is part of the FreeRTOS distribution.
fep 0:5ff20db10a96 8
fep 0:5ff20db10a96 9 FreeRTOS is free software; you can redistribute it and/or modify it under
fep 0:5ff20db10a96 10 the terms of the GNU General Public License (version 2) as published by the
fep 0:5ff20db10a96 11 Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
fep 0:5ff20db10a96 12
fep 0:5ff20db10a96 13 ***************************************************************************
fep 0:5ff20db10a96 14 >>! NOTE: The modification to the GPL is included to allow you to !<<
fep 0:5ff20db10a96 15 >>! distribute a combined work that includes FreeRTOS without being !<<
fep 0:5ff20db10a96 16 >>! obliged to provide the source code for proprietary components !<<
fep 0:5ff20db10a96 17 >>! outside of the FreeRTOS kernel. !<<
fep 0:5ff20db10a96 18 ***************************************************************************
fep 0:5ff20db10a96 19
fep 0:5ff20db10a96 20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
fep 0:5ff20db10a96 21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
fep 0:5ff20db10a96 22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
fep 0:5ff20db10a96 23 link: http://www.freertos.org/a00114.html
fep 0:5ff20db10a96 24
fep 0:5ff20db10a96 25 ***************************************************************************
fep 0:5ff20db10a96 26 * *
fep 0:5ff20db10a96 27 * FreeRTOS provides completely free yet professionally developed, *
fep 0:5ff20db10a96 28 * robust, strictly quality controlled, supported, and cross *
fep 0:5ff20db10a96 29 * platform software that is more than just the market leader, it *
fep 0:5ff20db10a96 30 * is the industry's de facto standard. *
fep 0:5ff20db10a96 31 * *
fep 0:5ff20db10a96 32 * Help yourself get started quickly while simultaneously helping *
fep 0:5ff20db10a96 33 * to support the FreeRTOS project by purchasing a FreeRTOS *
fep 0:5ff20db10a96 34 * tutorial book, reference manual, or both: *
fep 0:5ff20db10a96 35 * http://www.FreeRTOS.org/Documentation *
fep 0:5ff20db10a96 36 * *
fep 0:5ff20db10a96 37 ***************************************************************************
fep 0:5ff20db10a96 38
fep 0:5ff20db10a96 39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
fep 0:5ff20db10a96 40 the FAQ page "My application does not run, what could be wrong?". Have you
fep 0:5ff20db10a96 41 defined configASSERT()?
fep 0:5ff20db10a96 42
fep 0:5ff20db10a96 43 http://www.FreeRTOS.org/support - In return for receiving this top quality
fep 0:5ff20db10a96 44 embedded software for free we request you assist our global community by
fep 0:5ff20db10a96 45 participating in the support forum.
fep 0:5ff20db10a96 46
fep 0:5ff20db10a96 47 http://www.FreeRTOS.org/training - Investing in training allows your team to
fep 0:5ff20db10a96 48 be as productive as possible as early as possible. Now you can receive
fep 0:5ff20db10a96 49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
fep 0:5ff20db10a96 50 Ltd, and the world's leading authority on the world's leading RTOS.
fep 0:5ff20db10a96 51
fep 0:5ff20db10a96 52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
fep 0:5ff20db10a96 53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
fep 0:5ff20db10a96 54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
fep 0:5ff20db10a96 55
fep 0:5ff20db10a96 56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
fep 0:5ff20db10a96 57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
fep 0:5ff20db10a96 58
fep 0:5ff20db10a96 59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
fep 0:5ff20db10a96 60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
fep 0:5ff20db10a96 61 licenses offer ticketed support, indemnification and commercial middleware.
fep 0:5ff20db10a96 62
fep 0:5ff20db10a96 63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
fep 0:5ff20db10a96 64 engineered and independently SIL3 certified version for use in safety and
fep 0:5ff20db10a96 65 mission critical applications that require provable dependability.
fep 0:5ff20db10a96 66
fep 0:5ff20db10a96 67 1 tab == 4 spaces!
fep 0:5ff20db10a96 68 */
fep 0:5ff20db10a96 69
fep 0:5ff20db10a96 70 /*-----------------------------------------------------------
fep 0:5ff20db10a96 71 * Portable layer API. Each function must be defined for each port.
fep 0:5ff20db10a96 72 *----------------------------------------------------------*/
fep 0:5ff20db10a96 73
fep 0:5ff20db10a96 74 #ifndef PORTABLE_H
fep 0:5ff20db10a96 75 #define PORTABLE_H
fep 0:5ff20db10a96 76
fep 0:5ff20db10a96 77 /* Each FreeRTOS port has a unique portmacro.h header file. Originally a
fep 0:5ff20db10a96 78 pre-processor definition was used to ensure the pre-processor found the correct
fep 0:5ff20db10a96 79 portmacro.h file for the port being used. That scheme was deprecated in favour
fep 0:5ff20db10a96 80 of setting the compiler's include path such that it found the correct
fep 0:5ff20db10a96 81 portmacro.h file - removing the need for the constant and allowing the
fep 0:5ff20db10a96 82 portmacro.h file to be located anywhere in relation to the port being used.
fep 0:5ff20db10a96 83 Purely for reasons of backward compatibility the old method is still valid, but
fep 0:5ff20db10a96 84 to make it clear that new projects should not use it, support for the port
fep 0:5ff20db10a96 85 specific constants has been moved into the deprecated_definitions.h header
fep 0:5ff20db10a96 86 file. */
fep 0:5ff20db10a96 87 #include "deprecated_definitions.h"
fep 0:5ff20db10a96 88
fep 0:5ff20db10a96 89 /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
fep 0:5ff20db10a96 90 did not result in a portmacro.h header file being included - and it should be
fep 0:5ff20db10a96 91 included here. In this case the path to the correct portmacro.h header file
fep 0:5ff20db10a96 92 must be set in the compiler's include path. */
fep 0:5ff20db10a96 93 #ifndef portENTER_CRITICAL
fep 0:5ff20db10a96 94 #include "portmacro.h"
fep 0:5ff20db10a96 95 #endif
fep 0:5ff20db10a96 96
fep 0:5ff20db10a96 97 #if portBYTE_ALIGNMENT == 32
fep 0:5ff20db10a96 98 #define portBYTE_ALIGNMENT_MASK ( 0x001f )
fep 0:5ff20db10a96 99 #endif
fep 0:5ff20db10a96 100
fep 0:5ff20db10a96 101 #if portBYTE_ALIGNMENT == 16
fep 0:5ff20db10a96 102 #define portBYTE_ALIGNMENT_MASK ( 0x000f )
fep 0:5ff20db10a96 103 #endif
fep 0:5ff20db10a96 104
fep 0:5ff20db10a96 105 #if portBYTE_ALIGNMENT == 8
fep 0:5ff20db10a96 106 #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
fep 0:5ff20db10a96 107 #endif
fep 0:5ff20db10a96 108
fep 0:5ff20db10a96 109 #if portBYTE_ALIGNMENT == 4
fep 0:5ff20db10a96 110 #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
fep 0:5ff20db10a96 111 #endif
fep 0:5ff20db10a96 112
fep 0:5ff20db10a96 113 #if portBYTE_ALIGNMENT == 2
fep 0:5ff20db10a96 114 #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
fep 0:5ff20db10a96 115 #endif
fep 0:5ff20db10a96 116
fep 0:5ff20db10a96 117 #if portBYTE_ALIGNMENT == 1
fep 0:5ff20db10a96 118 #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
fep 0:5ff20db10a96 119 #endif
fep 0:5ff20db10a96 120
fep 0:5ff20db10a96 121 #ifndef portBYTE_ALIGNMENT_MASK
fep 0:5ff20db10a96 122 #error "Invalid portBYTE_ALIGNMENT definition"
fep 0:5ff20db10a96 123 #endif
fep 0:5ff20db10a96 124
fep 0:5ff20db10a96 125 #ifndef portNUM_CONFIGURABLE_REGIONS
fep 0:5ff20db10a96 126 #define portNUM_CONFIGURABLE_REGIONS 1
fep 0:5ff20db10a96 127 #endif
fep 0:5ff20db10a96 128
fep 0:5ff20db10a96 129 #ifdef __cplusplus
fep 0:5ff20db10a96 130 extern "C" {
fep 0:5ff20db10a96 131 #endif
fep 0:5ff20db10a96 132
fep 0:5ff20db10a96 133 #include "mpu_wrappers.h"
fep 0:5ff20db10a96 134
fep 0:5ff20db10a96 135 /*
fep 0:5ff20db10a96 136 * Setup the stack of a new task so it is ready to be placed under the
fep 0:5ff20db10a96 137 * scheduler control. The registers have to be placed on the stack in
fep 0:5ff20db10a96 138 * the order that the port expects to find them.
fep 0:5ff20db10a96 139 *
fep 0:5ff20db10a96 140 */
fep 0:5ff20db10a96 141 #if( portUSING_MPU_WRAPPERS == 1 )
fep 0:5ff20db10a96 142 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 143 #else
fep 0:5ff20db10a96 144 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 145 #endif
fep 0:5ff20db10a96 146
fep 0:5ff20db10a96 147 /* Used by heap_5.c. */
fep 0:5ff20db10a96 148 typedef struct HeapRegion
fep 0:5ff20db10a96 149 {
fep 0:5ff20db10a96 150 uint8_t *pucStartAddress;
fep 0:5ff20db10a96 151 size_t xSizeInBytes;
fep 0:5ff20db10a96 152 } HeapRegion_t;
fep 0:5ff20db10a96 153
fep 0:5ff20db10a96 154 /*
fep 0:5ff20db10a96 155 * Used to define multiple heap regions for use by heap_5.c. This function
fep 0:5ff20db10a96 156 * must be called before any calls to pvPortMalloc() - not creating a task,
fep 0:5ff20db10a96 157 * queue, semaphore, mutex, software timer, event group, etc. will result in
fep 0:5ff20db10a96 158 * pvPortMalloc being called.
fep 0:5ff20db10a96 159 *
fep 0:5ff20db10a96 160 * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
fep 0:5ff20db10a96 161 * defines a region of memory that can be used as the heap. The array is
fep 0:5ff20db10a96 162 * terminated by a HeapRegions_t structure that has a size of 0. The region
fep 0:5ff20db10a96 163 * with the lowest start address must appear first in the array.
fep 0:5ff20db10a96 164 */
fep 0:5ff20db10a96 165 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 166
fep 0:5ff20db10a96 167
fep 0:5ff20db10a96 168 /*
fep 0:5ff20db10a96 169 * Map to the memory management routines required for the port.
fep 0:5ff20db10a96 170 */
fep 0:5ff20db10a96 171 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 172 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 173 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 174 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 175 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 176
fep 0:5ff20db10a96 177 /*
fep 0:5ff20db10a96 178 * Setup the hardware ready for the scheduler to take control. This generally
fep 0:5ff20db10a96 179 * sets up a tick interrupt and sets timers for the correct tick frequency.
fep 0:5ff20db10a96 180 */
fep 0:5ff20db10a96 181 BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 182
fep 0:5ff20db10a96 183 /*
fep 0:5ff20db10a96 184 * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
fep 0:5ff20db10a96 185 * the hardware is left in its original condition after the scheduler stops
fep 0:5ff20db10a96 186 * executing.
fep 0:5ff20db10a96 187 */
fep 0:5ff20db10a96 188 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 189
fep 0:5ff20db10a96 190 /*
fep 0:5ff20db10a96 191 * The structures and methods of manipulating the MPU are contained within the
fep 0:5ff20db10a96 192 * port layer.
fep 0:5ff20db10a96 193 *
fep 0:5ff20db10a96 194 * Fills the xMPUSettings structure with the memory region information
fep 0:5ff20db10a96 195 * contained in xRegions.
fep 0:5ff20db10a96 196 */
fep 0:5ff20db10a96 197 #if( portUSING_MPU_WRAPPERS == 1 )
fep 0:5ff20db10a96 198 struct xMEMORY_REGION;
fep 0:5ff20db10a96 199 void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
fep 0:5ff20db10a96 200 #endif
fep 0:5ff20db10a96 201
fep 0:5ff20db10a96 202 #ifdef __cplusplus
fep 0:5ff20db10a96 203 }
fep 0:5ff20db10a96 204 #endif
fep 0:5ff20db10a96 205
fep 0:5ff20db10a96 206 #endif /* PORTABLE_H */
fep 0:5ff20db10a96 207
fep 0:5ff20db10a96 208