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.
cc3100_nonos.cpp
00001 /* 00002 * nonos.c - CC31xx/CC32xx Host Driver Implementation 00003 * 00004 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 00038 00039 /*****************************************************************************/ 00040 /* Include files */ 00041 /*****************************************************************************/ 00042 00043 #include "cc3100_simplelink.h" 00044 #include "fPtr_func.h" 00045 00046 //#ifndef SL_PLATFORM_MULTI_THREADED 00047 #if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN)) 00048 #include "cc3100_nonos.h" 00049 00050 namespace mbed_cc3100 { 00051 00052 #ifndef SL_TINY_EXT 00053 #define NONOS_MAX_SPAWN_ENTRIES 5 00054 #else 00055 #define NONOS_MAX_SPAWN_ENTRIES 1 00056 #endif 00057 00058 cc3100_nonos::cc3100_nonos(cc3100_driver &driver) 00059 : _driver(driver) 00060 { 00061 00062 } 00063 00064 cc3100_nonos::~cc3100_nonos() 00065 { 00066 00067 } 00068 00069 typedef struct { 00070 _SlSpawnEntryFunc_t pEntry; 00071 void* pValue; 00072 } _SlNonOsSpawnEntry_t; 00073 00074 typedef struct { 00075 _SlNonOsSpawnEntry_t SpawnEntries[NONOS_MAX_SPAWN_ENTRIES]; 00076 } _SlNonOsCB_t; 00077 00078 _SlNonOsCB_t g_SlNonOsCB; 00079 00080 00081 _SlNonOsRetVal_t cc3100_nonos::_SlNonOsSemSet(_SlNonOsSemObj_t* pSemObj , _SlNonOsSemObj_t Value) 00082 { 00083 *pSemObj = Value; 00084 return NONOS_RET_OK; 00085 } 00086 00087 _SlNonOsRetVal_t cc3100_nonos::_SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout) 00088 { 00089 #ifdef _SlSyncWaitLoopCallback 00090 _SlNonOsTime_t timeOutRequest = Timeout; 00091 #endif 00092 00093 while (Timeout > 0) { 00094 if (WaitValue == *pSyncObj) { 00095 *pSyncObj = SetValue; 00096 break; 00097 } 00098 if (Timeout != NONOS_WAIT_FOREVER) { 00099 Timeout--; 00100 } 00101 _SlNonOsMainLoopTask(); 00102 00103 #ifdef _SlSyncWaitLoopCallback 00104 if( (__NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue) && (timeOutRequest != NONOS_NO_WAIT) ) { 00105 if (WaitValue == *pSyncObj) { 00106 *pSyncObj = SetValue; 00107 break; 00108 } 00109 _SlSyncWaitLoopCallback(); 00110 } 00111 #endif 00112 00113 } 00114 00115 if (0 == Timeout) { 00116 return NONOS_RET_ERR; 00117 } else { 00118 return NONOS_RET_OK; 00119 } 00120 } 00121 00122 00123 _SlNonOsRetVal_t cc3100_nonos::_SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags) 00124 { 00125 int8_t i = 0; 00126 00127 #ifndef SL_TINY_EXT 00128 for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++) 00129 #endif 00130 { 00131 _SlNonOsSpawnEntry_t* pE = &g_SlNonOsCB.SpawnEntries[i]; 00132 00133 if (NULL == pE->pEntry) 00134 { 00135 pE->pValue = pValue; 00136 pE->pEntry = pEntry; 00137 #ifndef SL_TINY_EXT 00138 break; 00139 #endif 00140 } 00141 } 00142 00143 00144 return NONOS_RET_OK; 00145 } 00146 00147 _SlNonOsRetVal_t cc3100_nonos::_SlNonOsMainLoopTask(void) 00148 { 00149 printf("_SlNonOsMainLoopTask\r\n"); 00150 int8_t i = 0; 00151 00152 #ifndef SL_TINY_EXT 00153 for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++) 00154 #endif 00155 { 00156 _SlNonOsSpawnEntry_t* pE = &g_SlNonOsCB.SpawnEntries[i]; 00157 _SlSpawnEntryFunc_t pF = pE->pEntry; 00158 00159 if (NULL != pF) 00160 { 00161 if(RxIrqCnt != (g_pCB)->RxDoneCnt) { 00162 _SlDrvMsgReadSpawnCtx(0); 00163 //pF(0);/*(pValue);*//*Function pointer*/ 00164 } 00165 pE->pEntry = NULL; 00166 pE->pValue = NULL; 00167 } 00168 } 00169 00170 return NONOS_RET_OK; 00171 } 00172 00173 }//namespace mbed_cc3100 00174 00175 #endif /*(SL_PLATFORM != SL_PLATFORM_NON_OS)*/ 00176 00177 00178 00179 00180
Generated on Tue Jul 12 2022 22:22:38 by 1.7.2