Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers portable.h Source File

portable.h

00001 /*
00002     FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
00003     All rights reserved
00004 
00005     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
00006 
00007     This file is part of the FreeRTOS distribution.
00008 
00009     FreeRTOS is free software; you can redistribute it and/or modify it under
00010     the terms of the GNU General Public License (version 2) as published by the
00011     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
00012 
00013     ***************************************************************************
00014     >>!   NOTE: The modification to the GPL is included to allow you to     !<<
00015     >>!   distribute a combined work that includes FreeRTOS without being   !<<
00016     >>!   obliged to provide the source code for proprietary components     !<<
00017     >>!   outside of the FreeRTOS kernel.                                   !<<
00018     ***************************************************************************
00019 
00020     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
00021     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00022     FOR A PARTICULAR PURPOSE.  Full license text is available on the following
00023     link: http://www.freertos.org/a00114.html
00024 
00025     ***************************************************************************
00026      *                                                                       *
00027      *    FreeRTOS provides completely free yet professionally developed,    *
00028      *    robust, strictly quality controlled, supported, and cross          *
00029      *    platform software that is more than just the market leader, it     *
00030      *    is the industry's de facto standard.                               *
00031      *                                                                       *
00032      *    Help yourself get started quickly while simultaneously helping     *
00033      *    to support the FreeRTOS project by purchasing a FreeRTOS           *
00034      *    tutorial book, reference manual, or both:                          *
00035      *    http://www.FreeRTOS.org/Documentation                              *
00036      *                                                                       *
00037     ***************************************************************************
00038 
00039     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
00040     the FAQ page "My application does not run, what could be wrong?".  Have you
00041     defined configASSERT()?
00042 
00043     http://www.FreeRTOS.org/support - In return for receiving this top quality
00044     embedded software for free we request you assist our global community by
00045     participating in the support forum.
00046 
00047     http://www.FreeRTOS.org/training - Investing in training allows your team to
00048     be as productive as possible as early as possible.  Now you can receive
00049     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
00050     Ltd, and the world's leading authority on the world's leading RTOS.
00051 
00052     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
00053     including FreeRTOS+Trace - an indispensable productivity tool, a DOS
00054     compatible FAT file system, and our tiny thread aware UDP/IP stack.
00055 
00056     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
00057     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
00058 
00059     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
00060     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
00061     licenses offer ticketed support, indemnification and commercial middleware.
00062 
00063     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
00064     engineered and independently SIL3 certified version for use in safety and
00065     mission critical applications that require provable dependability.
00066 
00067     1 tab == 4 spaces!
00068 */
00069 
00070 /*-----------------------------------------------------------
00071  * Portable layer API.  Each function must be defined for each port.
00072  *----------------------------------------------------------*/
00073 
00074 #ifndef PORTABLE_H
00075 #define PORTABLE_H
00076 
00077 /* Each FreeRTOS port has a unique portmacro.h header file.  Originally a
00078 pre-processor definition was used to ensure the pre-processor found the correct
00079 portmacro.h file for the port being used.  That scheme was deprecated in favour
00080 of setting the compiler's include path such that it found the correct
00081 portmacro.h file - removing the need for the constant and allowing the
00082 portmacro.h file to be located anywhere in relation to the port being used.
00083 Purely for reasons of backward compatibility the old method is still valid, but
00084 to make it clear that new projects should not use it, support for the port
00085 specific constants has been moved into the deprecated_definitions.h header
00086 file. */
00087 #include "deprecated_definitions.h"
00088 
00089 /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
00090 did not result in a portmacro.h header file being included - and it should be
00091 included here.  In this case the path to the correct portmacro.h header file
00092 must be set in the compiler's include path. */
00093 #ifndef portENTER_CRITICAL
00094     #include "portmacro.h"
00095 #endif
00096 
00097 #if portBYTE_ALIGNMENT == 8
00098     #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
00099 #endif
00100 
00101 #if portBYTE_ALIGNMENT == 4
00102     #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
00103 #endif
00104 
00105 #if portBYTE_ALIGNMENT == 2
00106     #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
00107 #endif
00108 
00109 #if portBYTE_ALIGNMENT == 1
00110     #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
00111 #endif
00112 
00113 #ifndef portBYTE_ALIGNMENT_MASK
00114     #error "Invalid portBYTE_ALIGNMENT definition"
00115 #endif
00116 
00117 #ifndef portNUM_CONFIGURABLE_REGIONS
00118     #define portNUM_CONFIGURABLE_REGIONS 1
00119 #endif
00120 
00121 #ifdef __cplusplus
00122 extern "C" {
00123 #endif
00124 
00125 #include "mpu_wrappers.h"
00126 #include "projdefs.h"
00127 
00128 /*
00129  * Setup the stack of a new task so it is ready to be placed under the
00130  * scheduler control.  The registers have to be placed on the stack in
00131  * the order that the port expects to find them.
00132  *
00133  */
00134 #if( portUSING_MPU_WRAPPERS == 1 )
00135     StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION;
00136 #else
00137     StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;
00138 #endif
00139 
00140 /* Used by heap_5.c. */
00141 typedef struct HeapRegion
00142 {
00143     uint8_t *pucStartAddress;
00144     size_t xSizeInBytes;
00145 } HeapRegion_t;
00146 
00147 /*
00148  * Used to define multiple heap regions for use by heap_5.c.  This function
00149  * must be called before any calls to pvPortMalloc() - not creating a task,
00150  * queue, semaphore, mutex, software timer, event group, etc. will result in
00151  * pvPortMalloc being called.
00152  *
00153  * pxHeapRegions passes in an array of HeapRegion_t structures - each of which
00154  * defines a region of memory that can be used as the heap.  The array is
00155  * terminated by a HeapRegions_t structure that has a size of 0.  The region
00156  * with the lowest start address must appear first in the array.
00157  */
00158 void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
00159 
00160 
00161 /*
00162  * Map to the memory management routines required for the port.
00163  */
00164 void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
00165 void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
00166 void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
00167 size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
00168 size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
00169 
00170 /*
00171  * Setup the hardware ready for the scheduler to take control.  This generally
00172  * sets up a tick interrupt and sets timers for the correct tick frequency.
00173  */
00174 BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
00175 
00176 /*
00177  * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
00178  * the hardware is left in its original condition after the scheduler stops
00179  * executing.
00180  */
00181 void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
00182 
00183 /*
00184  * The structures and methods of manipulating the MPU are contained within the
00185  * port layer.
00186  *
00187  * Fills the xMPUSettings structure with the memory region information
00188  * contained in xRegions.
00189  */
00190 #if( portUSING_MPU_WRAPPERS == 1 )
00191     struct xMEMORY_REGION;
00192     void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;
00193 #endif
00194 
00195 #ifdef __cplusplus
00196 }
00197 #endif
00198 
00199 #endif /* PORTABLE_H */
00200 
00201