Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
simplelink/cc3100_nonos.h@22:f9b5e0b80bf2, 2015-09-15 (annotated)
- Committer:
- dflet
- Date:
- Tue Sep 15 16:45:04 2015 +0000
- Revision:
- 22:f9b5e0b80bf2
- Parent:
- 19:3dd3e7f30f8b
Removed some debug.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dflet | 0:50cedd586816 | 1 | /* |
| dflet | 0:50cedd586816 | 2 | * nonos.h - CC31xx/CC32xx Host Driver Implementation |
| dflet | 0:50cedd586816 | 3 | * |
| dflet | 0:50cedd586816 | 4 | * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ |
| dflet | 0:50cedd586816 | 5 | * |
| dflet | 0:50cedd586816 | 6 | * |
| dflet | 0:50cedd586816 | 7 | * Redistribution and use in source and binary forms, with or without |
| dflet | 0:50cedd586816 | 8 | * modification, are permitted provided that the following conditions |
| dflet | 0:50cedd586816 | 9 | * are met: |
| dflet | 0:50cedd586816 | 10 | * |
| dflet | 0:50cedd586816 | 11 | * Redistributions of source code must retain the above copyright |
| dflet | 0:50cedd586816 | 12 | * notice, this list of conditions and the following disclaimer. |
| dflet | 0:50cedd586816 | 13 | * |
| dflet | 0:50cedd586816 | 14 | * Redistributions in binary form must reproduce the above copyright |
| dflet | 0:50cedd586816 | 15 | * notice, this list of conditions and the following disclaimer in the |
| dflet | 0:50cedd586816 | 16 | * documentation and/or other materials provided with the |
| dflet | 0:50cedd586816 | 17 | * distribution. |
| dflet | 0:50cedd586816 | 18 | * |
| dflet | 0:50cedd586816 | 19 | * Neither the name of Texas Instruments Incorporated nor the names of |
| dflet | 0:50cedd586816 | 20 | * its contributors may be used to endorse or promote products derived |
| dflet | 0:50cedd586816 | 21 | * from this software without specific prior written permission. |
| dflet | 0:50cedd586816 | 22 | * |
| dflet | 0:50cedd586816 | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| dflet | 0:50cedd586816 | 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| dflet | 0:50cedd586816 | 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| dflet | 0:50cedd586816 | 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| dflet | 0:50cedd586816 | 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| dflet | 0:50cedd586816 | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| dflet | 0:50cedd586816 | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| dflet | 0:50cedd586816 | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| dflet | 0:50cedd586816 | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| dflet | 0:50cedd586816 | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| dflet | 0:50cedd586816 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| dflet | 0:50cedd586816 | 34 | * |
| dflet | 0:50cedd586816 | 35 | */ |
| dflet | 0:50cedd586816 | 36 | |
| dflet | 0:50cedd586816 | 37 | #ifndef NONOS_H_ |
| dflet | 0:50cedd586816 | 38 | #define NONOS_H_ |
| dflet | 0:50cedd586816 | 39 | |
| dflet | 0:50cedd586816 | 40 | #include "cc3100_simplelink.h" |
| dflet | 0:50cedd586816 | 41 | |
| dflet | 0:50cedd586816 | 42 | /*****************************************************************************/ |
| dflet | 0:50cedd586816 | 43 | /* Macro declarations */ |
| dflet | 0:50cedd586816 | 44 | /*****************************************************************************/ |
| dflet | 0:50cedd586816 | 45 | |
| dflet | 19:3dd3e7f30f8b | 46 | //#ifndef SL_PLATFORM_MULTI_THREADED |
| dflet | 19:3dd3e7f30f8b | 47 | #if (!defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN)) |
| dflet | 0:50cedd586816 | 48 | |
| dflet | 0:50cedd586816 | 49 | namespace mbed_cc3100 { |
| dflet | 0:50cedd586816 | 50 | |
| dflet | 0:50cedd586816 | 51 | /* This function call the user defined function, if defined, from the sync wait loop */ |
| dflet | 0:50cedd586816 | 52 | /* The use case of this function is to allow nonos system to call a user function to put the device into sleep */ |
| dflet | 0:50cedd586816 | 53 | /* The wake up should be activated after getting an interrupt from the device to Host */ |
| dflet | 0:50cedd586816 | 54 | /* The user function must return without blocking to prevent a delay on the event handling */ |
| dflet | 0:50cedd586816 | 55 | /* |
| dflet | 0:50cedd586816 | 56 | #define _SlSyncWaitLoopCallback UserSleepFunction |
| dflet | 0:50cedd586816 | 57 | */ |
| dflet | 0:50cedd586816 | 58 | |
| dflet | 0:50cedd586816 | 59 | const uint8_t NONOS_WAIT_FOREVER = 0xFF; |
| dflet | 0:50cedd586816 | 60 | const uint8_t NONOS_NO_WAIT = 0x00; |
| dflet | 0:50cedd586816 | 61 | |
| dflet | 0:50cedd586816 | 62 | const uint8_t NONOS_RET_OK = 0; |
| dflet | 0:50cedd586816 | 63 | const int8_t NONOS_RET_ERR = 0xFF; |
| dflet | 0:50cedd586816 | 64 | //const uint8_t OSI_OK = 0; |
| dflet | 0:50cedd586816 | 65 | |
| dflet | 0:50cedd586816 | 66 | const uint8_t NON_OS_SYNC_OBJ_CLEAR_VALUE = 0x11; |
| dflet | 0:50cedd586816 | 67 | const uint8_t NON_OS_SYNC_OBJ_SIGNAL_VALUE = 0x22; |
| dflet | 0:50cedd586816 | 68 | const uint8_t NON_OS_LOCK_OBJ_UNLOCK_VALUE = 0x33; |
| dflet | 0:50cedd586816 | 69 | const uint8_t NON_OS_LOCK_OBJ_LOCK_VALUE = 0x44; |
| dflet | 0:50cedd586816 | 70 | |
| dflet | 0:50cedd586816 | 71 | #define _SlTime_t _SlNonOsTime_t |
| dflet | 0:50cedd586816 | 72 | |
| dflet | 0:50cedd586816 | 73 | #define _SlSyncObj_t _SlNonOsSemObj_t |
| dflet | 0:50cedd586816 | 74 | |
| dflet | 0:50cedd586816 | 75 | #define _SlLockObj_t _SlNonOsSemObj_t |
| dflet | 0:50cedd586816 | 76 | |
| dflet | 0:50cedd586816 | 77 | const uint8_t SL_OS_WAIT_FOREVER = NONOS_WAIT_FOREVER; |
| dflet | 0:50cedd586816 | 78 | |
| dflet | 0:50cedd586816 | 79 | const uint8_t SL_OS_RET_CODE_OK = NONOS_RET_OK; |
| dflet | 0:50cedd586816 | 80 | |
| dflet | 0:50cedd586816 | 81 | const uint8_t SL_OS_NO_WAIT = NONOS_NO_WAIT; |
| dflet | 0:50cedd586816 | 82 | |
| dflet | 0:50cedd586816 | 83 | |
| dflet | 0:50cedd586816 | 84 | /*****************************************************************************/ |
| dflet | 0:50cedd586816 | 85 | /* Function prototypes */ |
| dflet | 0:50cedd586816 | 86 | /*****************************************************************************/ |
| dflet | 0:50cedd586816 | 87 | |
| dflet | 0:50cedd586816 | 88 | /*! |
| dflet | 0:50cedd586816 | 89 | \brief This function creates a sync object |
| dflet | 0:50cedd586816 | 90 | |
| dflet | 0:50cedd586816 | 91 | The sync object is used for synchronization between different thread or ISR and |
| dflet | 0:50cedd586816 | 92 | a thread. |
| dflet | 0:50cedd586816 | 93 | |
| dflet | 0:50cedd586816 | 94 | \param pSyncObj - pointer to the sync object control block |
| dflet | 0:50cedd586816 | 95 | |
| dflet | 0:50cedd586816 | 96 | \return upon successful creation the function return 0 |
| dflet | 0:50cedd586816 | 97 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 98 | \note |
| dflet | 0:50cedd586816 | 99 | \warning |
| dflet | 0:50cedd586816 | 100 | */ |
| dflet | 0:50cedd586816 | 101 | #define _SlNonOsSyncObjCreate(pSyncObj) _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE) |
| dflet | 0:50cedd586816 | 102 | |
| dflet | 0:50cedd586816 | 103 | /*! |
| dflet | 0:50cedd586816 | 104 | \brief This function deletes a sync object |
| dflet | 0:50cedd586816 | 105 | |
| dflet | 0:50cedd586816 | 106 | \param pSyncObj - pointer to the sync object control block |
| dflet | 0:50cedd586816 | 107 | |
| dflet | 0:50cedd586816 | 108 | \return upon successful deletion the function should return 0 |
| dflet | 0:50cedd586816 | 109 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 110 | \note |
| dflet | 0:50cedd586816 | 111 | \warning |
| dflet | 0:50cedd586816 | 112 | */ |
| dflet | 0:50cedd586816 | 113 | #define _SlNonOsSyncObjDelete(pSyncObj) _SlNonOsSemSet(pSyncObj,0)// |
| dflet | 0:50cedd586816 | 114 | |
| dflet | 0:50cedd586816 | 115 | /*! |
| dflet | 0:50cedd586816 | 116 | \brief This function generates a sync signal for the object. |
| dflet | 0:50cedd586816 | 117 | |
| dflet | 0:50cedd586816 | 118 | All suspended threads waiting on this sync object are resumed |
| dflet | 0:50cedd586816 | 119 | |
| dflet | 0:50cedd586816 | 120 | \param pSyncObj - pointer to the sync object control block |
| dflet | 0:50cedd586816 | 121 | |
| dflet | 0:50cedd586816 | 122 | \return upon successful signaling the function should return 0 |
| dflet | 0:50cedd586816 | 123 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 124 | \note the function could be called from ISR context |
| dflet | 0:50cedd586816 | 125 | \warning |
| dflet | 0:50cedd586816 | 126 | */ |
| dflet | 0:50cedd586816 | 127 | #define _SlNonOsSyncObjSignal(pSyncObj) _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE)// |
| dflet | 0:50cedd586816 | 128 | |
| dflet | 0:50cedd586816 | 129 | /*! |
| dflet | 0:50cedd586816 | 130 | \brief This function waits for a sync signal of the specific sync object |
| dflet | 0:50cedd586816 | 131 | |
| dflet | 0:50cedd586816 | 132 | \param pSyncObj - pointer to the sync object control block |
| dflet | 0:50cedd586816 | 133 | \param Timeout - numeric value specifies the maximum number of mSec to |
| dflet | 0:50cedd586816 | 134 | stay suspended while waiting for the sync signal |
| dflet | 0:50cedd586816 | 135 | Currently, the simple link driver uses only two values: |
| dflet | 0:50cedd586816 | 136 | - NONOS_WAIT_FOREVER |
| dflet | 0:50cedd586816 | 137 | - NONOS_NO_WAIT |
| dflet | 0:50cedd586816 | 138 | |
| dflet | 0:50cedd586816 | 139 | \return upon successful reception of the signal within the timeout window return 0 |
| dflet | 0:50cedd586816 | 140 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 141 | \note |
| dflet | 0:50cedd586816 | 142 | \warning |
| dflet | 0:50cedd586816 | 143 | */ |
| dflet | 0:50cedd586816 | 144 | #define _SlNonOsSyncObjWait(pSyncObj,Timeout) _SlNonOsSemGet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,Timeout)// |
| dflet | 0:50cedd586816 | 145 | |
| dflet | 0:50cedd586816 | 146 | /*! |
| dflet | 0:50cedd586816 | 147 | \brief This function clears a sync object |
| dflet | 0:50cedd586816 | 148 | |
| dflet | 0:50cedd586816 | 149 | \param pSyncObj - pointer to the sync object control block |
| dflet | 0:50cedd586816 | 150 | |
| dflet | 0:50cedd586816 | 151 | \return upon successful clearing the function should return 0 |
| dflet | 0:50cedd586816 | 152 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 153 | \note |
| dflet | 0:50cedd586816 | 154 | \warning |
| dflet | 0:50cedd586816 | 155 | */ |
| dflet | 0:50cedd586816 | 156 | #define _SlNonOsSyncObjClear(pSyncObj) _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE)// |
| dflet | 0:50cedd586816 | 157 | |
| dflet | 0:50cedd586816 | 158 | /*! |
| dflet | 0:50cedd586816 | 159 | \brief This function creates a locking object. |
| dflet | 0:50cedd586816 | 160 | |
| dflet | 0:50cedd586816 | 161 | The locking object is used for protecting a shared resources between different |
| dflet | 0:50cedd586816 | 162 | threads. |
| dflet | 0:50cedd586816 | 163 | |
| dflet | 0:50cedd586816 | 164 | \param pLockObj - pointer to the locking object control block |
| dflet | 0:50cedd586816 | 165 | |
| dflet | 0:50cedd586816 | 166 | \return upon successful creation the function should return 0 |
| dflet | 0:50cedd586816 | 167 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 168 | \note |
| dflet | 0:50cedd586816 | 169 | \warning |
| dflet | 0:50cedd586816 | 170 | */ |
| dflet | 0:50cedd586816 | 171 | #define _SlNonOsLockObjCreate(pLockObj) _SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE) |
| dflet | 0:50cedd586816 | 172 | |
| dflet | 0:50cedd586816 | 173 | /*! |
| dflet | 0:50cedd586816 | 174 | \brief This function deletes a locking object. |
| dflet | 0:50cedd586816 | 175 | |
| dflet | 0:50cedd586816 | 176 | \param pLockObj - pointer to the locking object control block |
| dflet | 0:50cedd586816 | 177 | |
| dflet | 0:50cedd586816 | 178 | \return upon successful deletion the function should return 0 |
| dflet | 0:50cedd586816 | 179 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 180 | \note |
| dflet | 0:50cedd586816 | 181 | \warning |
| dflet | 0:50cedd586816 | 182 | */ |
| dflet | 0:50cedd586816 | 183 | #define _SlNonOsLockObjDelete(pLockObj) _SlNonOsSemSet(pLockObj,0)// |
| dflet | 0:50cedd586816 | 184 | |
| dflet | 0:50cedd586816 | 185 | /*! |
| dflet | 0:50cedd586816 | 186 | \brief This function locks a locking object. |
| dflet | 0:50cedd586816 | 187 | |
| dflet | 0:50cedd586816 | 188 | All other threads that call this function before this thread calls |
| dflet | 0:50cedd586816 | 189 | the _SlNonOsLockObjUnlock would be suspended |
| dflet | 0:50cedd586816 | 190 | |
| dflet | 0:50cedd586816 | 191 | \param pLockObj - pointer to the locking object control block |
| dflet | 0:50cedd586816 | 192 | \param Timeout - numeric value specifies the maximum number of mSec to |
| dflet | 0:50cedd586816 | 193 | stay suspended while waiting for the locking object |
| dflet | 0:50cedd586816 | 194 | Currently, the simple link driver uses only two values: |
| dflet | 0:50cedd586816 | 195 | - NONOS_WAIT_FOREVER |
| dflet | 0:50cedd586816 | 196 | - NONOS_NO_WAIT |
| dflet | 0:50cedd586816 | 197 | |
| dflet | 0:50cedd586816 | 198 | |
| dflet | 0:50cedd586816 | 199 | \return upon successful reception of the locking object the function should return 0 |
| dflet | 0:50cedd586816 | 200 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 201 | \note |
| dflet | 0:50cedd586816 | 202 | \warning |
| dflet | 0:50cedd586816 | 203 | */ |
| dflet | 0:50cedd586816 | 204 | #define _SlNonOsLockObjLock(pLockObj,Timeout) _SlNonOsSemGet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE,Timeout)// |
| dflet | 0:50cedd586816 | 205 | |
| dflet | 0:50cedd586816 | 206 | /*! |
| dflet | 0:50cedd586816 | 207 | \brief This function unlock a locking object. |
| dflet | 0:50cedd586816 | 208 | |
| dflet | 0:50cedd586816 | 209 | \param pLockObj - pointer to the locking object control block |
| dflet | 0:50cedd586816 | 210 | |
| dflet | 0:50cedd586816 | 211 | \return upon successful unlocking the function should return 0 |
| dflet | 0:50cedd586816 | 212 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 213 | \note |
| dflet | 0:50cedd586816 | 214 | \warning |
| dflet | 0:50cedd586816 | 215 | */ |
| dflet | 0:50cedd586816 | 216 | #define _SlNonOsLockObjUnlock(pLockObj) _SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE)// |
| dflet | 0:50cedd586816 | 217 | |
| dflet | 0:50cedd586816 | 218 | /***************************************************************************** |
| dflet | 0:50cedd586816 | 219 | |
| dflet | 0:50cedd586816 | 220 | Overwrite SimpleLink driver OS adaptation functions |
| dflet | 0:50cedd586816 | 221 | |
| dflet | 0:50cedd586816 | 222 | |
| dflet | 0:50cedd586816 | 223 | *****************************************************************************/ |
| dflet | 0:50cedd586816 | 224 | |
| dflet | 0:50cedd586816 | 225 | //class cc3100_nonos _nonos; |
| dflet | 0:50cedd586816 | 226 | |
| dflet | 0:50cedd586816 | 227 | #undef sl_SyncObjCreate |
| dflet | 0:50cedd586816 | 228 | #define sl_SyncObjCreate(pSyncObj,pName) _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE) |
| dflet | 0:50cedd586816 | 229 | |
| dflet | 0:50cedd586816 | 230 | #undef sl_SyncObjDelete |
| dflet | 0:50cedd586816 | 231 | #define sl_SyncObjDelete(pSyncObj) _SlNonOsSemSet(pSyncObj,0) |
| dflet | 0:50cedd586816 | 232 | |
| dflet | 0:50cedd586816 | 233 | #undef sl_SyncObjSignal |
| dflet | 0:50cedd586816 | 234 | #define sl_SyncObjSignal(pSyncObj) _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE) |
| dflet | 0:50cedd586816 | 235 | |
| dflet | 0:50cedd586816 | 236 | #undef sl_SyncObjSignalFromIRQ |
| dflet | 0:50cedd586816 | 237 | #define sl_SyncObjSignalFromIRQ(pSyncObj) _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE) |
| dflet | 0:50cedd586816 | 238 | |
| dflet | 0:50cedd586816 | 239 | #undef sl_SyncObjWait |
| dflet | 0:50cedd586816 | 240 | #define sl_SyncObjWait(pSyncObj,Timeout) _SlNonOsSemGet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,Timeout) |
| dflet | 0:50cedd586816 | 241 | |
| dflet | 0:50cedd586816 | 242 | #undef sl_LockObjCreate |
| dflet | 0:50cedd586816 | 243 | #define sl_LockObjCreate(pLockObj,pName) _SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE) |
| dflet | 0:50cedd586816 | 244 | |
| dflet | 0:50cedd586816 | 245 | #undef sl_LockObjDelete |
| dflet | 0:50cedd586816 | 246 | #define sl_LockObjDelete(pLockObj) _SlNonOsSemSet(pLockObj,0) |
| dflet | 0:50cedd586816 | 247 | |
| dflet | 0:50cedd586816 | 248 | #undef sl_LockObjLock |
| dflet | 0:50cedd586816 | 249 | #define sl_LockObjLock(pLockObj,Timeout) _SlNonOsSemGet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE,Timeout) |
| dflet | 0:50cedd586816 | 250 | |
| dflet | 0:50cedd586816 | 251 | #undef sl_LockObjUnlock |
| dflet | 0:50cedd586816 | 252 | #define sl_LockObjUnlock(pLockObj) _SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE) |
| dflet | 0:50cedd586816 | 253 | /* |
| dflet | 0:50cedd586816 | 254 | #undef sl_Spawn |
| dflet | 0:50cedd586816 | 255 | #define sl_Spawn(pEntry,pValue,flags) _nonos._SlNonOsSpawn(pEntry,pValue,flags) |
| dflet | 0:50cedd586816 | 256 | |
| dflet | 0:50cedd586816 | 257 | #undef _SlTaskEntry |
| dflet | 0:50cedd586816 | 258 | #define _SlTaskEntry _nonos._SlNonOsMainLoopTask |
| dflet | 0:50cedd586816 | 259 | */ |
| dflet | 0:50cedd586816 | 260 | /*! |
| dflet | 0:50cedd586816 | 261 | \brief type definition for the return values of this adaptation layer |
| dflet | 0:50cedd586816 | 262 | */ |
| dflet | 0:50cedd586816 | 263 | typedef int8_t _SlNonOsRetVal_t; |
| dflet | 0:50cedd586816 | 264 | |
| dflet | 0:50cedd586816 | 265 | /*! |
| dflet | 0:50cedd586816 | 266 | \brief type definition for a time value |
| dflet | 0:50cedd586816 | 267 | */ |
| dflet | 0:50cedd586816 | 268 | typedef uint8_t _SlNonOsTime_t; |
| dflet | 0:50cedd586816 | 269 | |
| dflet | 0:50cedd586816 | 270 | /*! |
| dflet | 0:50cedd586816 | 271 | \brief type definition for a sync object container |
| dflet | 0:50cedd586816 | 272 | |
| dflet | 0:50cedd586816 | 273 | Sync object is object used to synchronize between two threads or thread and interrupt handler. |
| dflet | 0:50cedd586816 | 274 | One thread is waiting on the object and the other thread send a signal, which then |
| dflet | 0:50cedd586816 | 275 | release the waiting thread. |
| dflet | 0:50cedd586816 | 276 | The signal must be able to be sent from interrupt context. |
| dflet | 0:50cedd586816 | 277 | This object is generally implemented by binary semaphore or events. |
| dflet | 0:50cedd586816 | 278 | */ |
| dflet | 0:50cedd586816 | 279 | typedef uint8_t _SlNonOsSemObj_t; |
| dflet | 0:50cedd586816 | 280 | |
| dflet | 0:50cedd586816 | 281 | class cc3100_driver; |
| dflet | 0:50cedd586816 | 282 | |
| dflet | 0:50cedd586816 | 283 | class cc3100_nonos |
| dflet | 0:50cedd586816 | 284 | { |
| dflet | 0:50cedd586816 | 285 | |
| dflet | 0:50cedd586816 | 286 | public: |
| dflet | 0:50cedd586816 | 287 | |
| dflet | 0:50cedd586816 | 288 | cc3100_nonos(cc3100_driver &driver); |
| dflet | 0:50cedd586816 | 289 | |
| dflet | 0:50cedd586816 | 290 | ~cc3100_nonos(); |
| dflet | 0:50cedd586816 | 291 | |
| dflet | 0:50cedd586816 | 292 | /*! |
| dflet | 0:50cedd586816 | 293 | \brief This function call the pEntry callback from a different context |
| dflet | 0:50cedd586816 | 294 | |
| dflet | 0:50cedd586816 | 295 | \param pEntry - pointer to the entry callback function |
| dflet | 0:50cedd586816 | 296 | |
| dflet | 0:50cedd586816 | 297 | \param pValue - pointer to any type of memory structure that would be |
| dflet | 0:50cedd586816 | 298 | passed to pEntry callback from the execution thread. |
| dflet | 0:50cedd586816 | 299 | |
| dflet | 0:50cedd586816 | 300 | \param flags - execution flags - reserved for future usage |
| dflet | 0:50cedd586816 | 301 | |
| dflet | 0:50cedd586816 | 302 | \return upon successful registration of the spawn the function return 0 |
| dflet | 0:50cedd586816 | 303 | (the function is not blocked till the end of the execution of the function |
| dflet | 0:50cedd586816 | 304 | and could be returned before the execution is actually completed) |
| dflet | 0:50cedd586816 | 305 | Otherwise, a negative value indicating the error code shall be returned |
| dflet | 0:50cedd586816 | 306 | \note |
| dflet | 0:50cedd586816 | 307 | \warning |
| dflet | 0:50cedd586816 | 308 | */ |
| dflet | 0:50cedd586816 | 309 | _SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags); |
| dflet | 0:50cedd586816 | 310 | |
| dflet | 0:50cedd586816 | 311 | |
| dflet | 0:50cedd586816 | 312 | /*! |
| dflet | 0:50cedd586816 | 313 | \brief This function must be called from the main loop in non-os paltforms |
| dflet | 0:50cedd586816 | 314 | |
| dflet | 0:50cedd586816 | 315 | \param None |
| dflet | 0:50cedd586816 | 316 | |
| dflet | 0:50cedd586816 | 317 | \return 0 - No more activities |
| dflet | 0:50cedd586816 | 318 | 1 - Activity still in progress |
| dflet | 0:50cedd586816 | 319 | \note |
| dflet | 0:50cedd586816 | 320 | \warning |
| dflet | 0:50cedd586816 | 321 | */ |
| dflet | 0:50cedd586816 | 322 | _SlNonOsRetVal_t _SlNonOsMainLoopTask(void); |
| dflet | 0:50cedd586816 | 323 | |
| dflet | 0:50cedd586816 | 324 | _SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout); |
| dflet | 0:50cedd586816 | 325 | _SlNonOsRetVal_t _SlNonOsSemSet(_SlNonOsSemObj_t* pSemObj , _SlNonOsSemObj_t Value); |
| dflet | 0:50cedd586816 | 326 | |
| dflet | 0:50cedd586816 | 327 | |
| dflet | 0:50cedd586816 | 328 | #if (defined(_SlSyncWaitLoopCallback)) |
| dflet | 0:50cedd586816 | 329 | void _SlSyncWaitLoopCallback(void); |
| dflet | 0:50cedd586816 | 330 | #endif |
| dflet | 0:50cedd586816 | 331 | |
| dflet | 0:50cedd586816 | 332 | private: |
| dflet | 0:50cedd586816 | 333 | |
| dflet | 0:50cedd586816 | 334 | cc3100_driver &_driver; |
| dflet | 0:50cedd586816 | 335 | |
| dflet | 0:50cedd586816 | 336 | };//class |
| dflet | 0:50cedd586816 | 337 | |
| dflet | 0:50cedd586816 | 338 | //extern _SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags); |
| dflet | 0:50cedd586816 | 339 | |
| dflet | 0:50cedd586816 | 340 | }//namespace mbed_cc3100 |
| dflet | 0:50cedd586816 | 341 | |
| dflet | 0:50cedd586816 | 342 | #endif /* !SL_PLATFORM_MULTI_THREADED */ |
| dflet | 0:50cedd586816 | 343 | |
| dflet | 0:50cedd586816 | 344 | |
| dflet | 0:50cedd586816 | 345 | |
| dflet | 0:50cedd586816 | 346 | #endif |
| dflet | 0:50cedd586816 | 347 |