TI's CC3100 websocket camera demo with Arducam mini ov5642 and freertos. Should work with other M3's. Work in progress test demo.
heap_1.c
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 /* 00072 * The simplest possible implementation of pvPortMalloc(). Note that this 00073 * implementation does NOT allow allocated memory to be freed again. 00074 * 00075 * See heap_2.c, heap_3.c and heap_4.c for alternative implementations, and the 00076 * memory management pages of http://www.FreeRTOS.org for more information. 00077 */ 00078 #include <stdlib.h> 00079 00080 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining 00081 all the API functions to use the MPU wrappers. That should only be done when 00082 task.h is included from an application file. */ 00083 #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE 00084 00085 #include "FreeRTOS.h" 00086 #include "task.h" 00087 00088 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE 00089 00090 /* A few bytes might be lost to byte aligning the heap start address. */ 00091 #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) 00092 00093 /* Allocate the memory for the heap. */ 00094 static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; 00095 static size_t xNextFreeByte = ( size_t ) 0; 00096 00097 /*-----------------------------------------------------------*/ 00098 00099 void *pvPortMalloc( size_t xWantedSize ) 00100 { 00101 void *pvReturn = NULL; 00102 static uint8_t *pucAlignedHeap = NULL; 00103 00104 /* Ensure that blocks are always aligned to the required number of bytes. */ 00105 #if portBYTE_ALIGNMENT != 1 00106 if( xWantedSize & portBYTE_ALIGNMENT_MASK ) 00107 { 00108 /* Byte alignment required. */ 00109 xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); 00110 } 00111 #endif 00112 00113 vTaskSuspendAll(); 00114 { 00115 if( pucAlignedHeap == NULL ) 00116 { 00117 /* Ensure the heap starts on a correctly aligned boundary. */ 00118 pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); 00119 } 00120 00121 /* Check there is enough room left for the allocation. */ 00122 if( ( ( xNextFreeByte + xWantedSize ) < configADJUSTED_HEAP_SIZE ) && 00123 ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) )/* Check for overflow. */ 00124 { 00125 /* Return the next free byte then increment the index past this 00126 block. */ 00127 pvReturn = pucAlignedHeap + xNextFreeByte; 00128 xNextFreeByte += xWantedSize; 00129 } 00130 00131 traceMALLOC( pvReturn, xWantedSize ); 00132 } 00133 ( void ) xTaskResumeAll(); 00134 00135 #if( configUSE_MALLOC_FAILED_HOOK == 1 ) 00136 { 00137 if( pvReturn == NULL ) 00138 { 00139 extern void vApplicationMallocFailedHook( void ); 00140 vApplicationMallocFailedHook(); 00141 } 00142 } 00143 #endif 00144 00145 return pvReturn; 00146 } 00147 /*-----------------------------------------------------------*/ 00148 00149 void vPortFree( void *pv ) 00150 { 00151 /* Memory cannot be freed using this scheme. See heap_2.c, heap_3.c and 00152 heap_4.c for alternative implementations, and the memory management pages of 00153 http://www.FreeRTOS.org for more information. */ 00154 ( void ) pv; 00155 00156 /* Force an assert as it is invalid to call this function. */ 00157 configASSERT( pv == NULL ); 00158 } 00159 /*-----------------------------------------------------------*/ 00160 00161 void vPortInitialiseBlocks( void ) 00162 { 00163 /* Only required when static memory is not cleared. */ 00164 xNextFreeByte = ( size_t ) 0; 00165 } 00166 /*-----------------------------------------------------------*/ 00167 00168 size_t xPortGetFreeHeapSize( void ) 00169 { 00170 return ( configADJUSTED_HEAP_SIZE - xNextFreeByte ); 00171 } 00172 00173 00174 00175
Generated on Wed Jul 13 2022 15:58:45 by 1.7.2