TI's CC3100 websocket camera demo with Arducam mini ov5642 and freertos. Should work with other M3's. Work in progress test demo.
list.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 #include <stdlib.h> 00072 #include "FreeRTOS.h" 00073 #include "list.h" 00074 00075 /*----------------------------------------------------------- 00076 * PUBLIC LIST API documented in list.h 00077 *----------------------------------------------------------*/ 00078 00079 void vListInitialise( List_t * const pxList ) 00080 { 00081 /* The list structure contains a list item which is used to mark the 00082 end of the list. To initialise the list the list end is inserted 00083 as the only list entry. */ 00084 pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 00085 00086 /* The list end value is the highest possible value in the list to 00087 ensure it remains at the end of the list. */ 00088 pxList->xListEnd.xItemValue = portMAX_DELAY; 00089 00090 /* The list end next and previous pointers point to itself so we know 00091 when the list is empty. */ 00092 pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 00093 pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 00094 00095 pxList->uxNumberOfItems = ( UBaseType_t ) 0U; 00096 00097 /* Write known values into the list if 00098 configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ 00099 listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ); 00100 listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ); 00101 } 00102 /*-----------------------------------------------------------*/ 00103 00104 void vListInitialiseItem( ListItem_t * const pxItem ) 00105 { 00106 /* Make sure the list item is not recorded as being on a list. */ 00107 pxItem->pvContainer = NULL; 00108 00109 /* Write known values into the list item if 00110 configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ 00111 listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); 00112 listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); 00113 } 00114 /*-----------------------------------------------------------*/ 00115 00116 void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem ) 00117 { 00118 ListItem_t * const pxIndex = pxList->pxIndex; 00119 00120 /* Only effective when configASSERT() is also defined, these tests may catch 00121 the list data structures being overwritten in memory. They will not catch 00122 data errors caused by incorrect configuration or use of FreeRTOS. */ 00123 listTEST_LIST_INTEGRITY( pxList ); 00124 listTEST_LIST_ITEM_INTEGRITY( pxNewListItem ); 00125 00126 /* Insert a new list item into pxList, but rather than sort the list, 00127 makes the new list item the last item to be removed by a call to 00128 listGET_OWNER_OF_NEXT_ENTRY(). */ 00129 pxNewListItem->pxNext = pxIndex; 00130 pxNewListItem->pxPrevious = pxIndex->pxPrevious; 00131 00132 /* Only used during decision coverage testing. */ 00133 mtCOVERAGE_TEST_DELAY(); 00134 00135 pxIndex->pxPrevious->pxNext = pxNewListItem; 00136 pxIndex->pxPrevious = pxNewListItem; 00137 00138 /* Remember which list the item is in. */ 00139 pxNewListItem->pvContainer = ( void * ) pxList; 00140 00141 ( pxList->uxNumberOfItems )++; 00142 } 00143 /*-----------------------------------------------------------*/ 00144 00145 void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ) 00146 { 00147 ListItem_t *pxIterator; 00148 const TickType_t xValueOfInsertion = pxNewListItem->xItemValue; 00149 00150 /* Only effective when configASSERT() is also defined, these tests may catch 00151 the list data structures being overwritten in memory. They will not catch 00152 data errors caused by incorrect configuration or use of FreeRTOS. */ 00153 listTEST_LIST_INTEGRITY( pxList ); 00154 listTEST_LIST_ITEM_INTEGRITY( pxNewListItem ); 00155 00156 /* Insert the new list item into the list, sorted in xItemValue order. 00157 00158 If the list already contains a list item with the same item value then the 00159 new list item should be placed after it. This ensures that TCB's which are 00160 stored in ready lists (all of which have the same xItemValue value) get a 00161 share of the CPU. However, if the xItemValue is the same as the back marker 00162 the iteration loop below will not end. Therefore the value is checked 00163 first, and the algorithm slightly modified if necessary. */ 00164 if( xValueOfInsertion == portMAX_DELAY ) 00165 { 00166 pxIterator = pxList->xListEnd.pxPrevious; 00167 } 00168 else 00169 { 00170 /* *** NOTE *********************************************************** 00171 If you find your application is crashing here then likely causes are 00172 listed below. In addition see http://www.freertos.org/FAQHelp.html for 00173 more tips, and ensure configASSERT() is defined! 00174 http://www.freertos.org/a00110.html#configASSERT 00175 00176 1) Stack overflow - 00177 see http://www.freertos.org/Stacks-and-stack-overflow-checking.html 00178 2) Incorrect interrupt priority assignment, especially on Cortex-M 00179 parts where numerically high priority values denote low actual 00180 interrupt priorities, which can seem counter intuitive. See 00181 http://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition 00182 of configMAX_SYSCALL_INTERRUPT_PRIORITY on 00183 http://www.freertos.org/a00110.html 00184 3) Calling an API function from within a critical section or when 00185 the scheduler is suspended, or calling an API function that does 00186 not end in "FromISR" from an interrupt. 00187 4) Using a queue or semaphore before it has been initialised or 00188 before the scheduler has been started (are interrupts firing 00189 before vTaskStartScheduler() has been called?). 00190 **********************************************************************/ 00191 00192 for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 00193 { 00194 /* There is nothing to do here, just iterating to the wanted 00195 insertion position. */ 00196 } 00197 } 00198 00199 pxNewListItem->pxNext = pxIterator->pxNext; 00200 pxNewListItem->pxNext->pxPrevious = pxNewListItem; 00201 pxNewListItem->pxPrevious = pxIterator; 00202 pxIterator->pxNext = pxNewListItem; 00203 00204 /* Remember which list the item is in. This allows fast removal of the 00205 item later. */ 00206 pxNewListItem->pvContainer = ( void * ) pxList; 00207 00208 ( pxList->uxNumberOfItems )++; 00209 } 00210 /*-----------------------------------------------------------*/ 00211 00212 UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) 00213 { 00214 /* The list item knows which list it is in. Obtain the list from the list 00215 item. */ 00216 List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer; 00217 00218 pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; 00219 pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; 00220 00221 /* Only used during decision coverage testing. */ 00222 mtCOVERAGE_TEST_DELAY(); 00223 00224 /* Make sure the index is left pointing to a valid item. */ 00225 if( pxList->pxIndex == pxItemToRemove ) 00226 { 00227 pxList->pxIndex = pxItemToRemove->pxPrevious; 00228 } 00229 else 00230 { 00231 mtCOVERAGE_TEST_MARKER(); 00232 } 00233 00234 pxItemToRemove->pvContainer = NULL; 00235 ( pxList->uxNumberOfItems )--; 00236 00237 return pxList->uxNumberOfItems; 00238 } 00239 /*-----------------------------------------------------------*/ 00240 00241
Generated on Wed Jul 13 2022 15:58:45 by 1.7.2