DeepCover Embedded Security in IoT: Public-key Secured Data Paths

Dependencies:   MaximInterface

The MAXREFDES155# is an internet-of-things (IoT) embedded-security reference design, built to authenticate and control a sensing node using elliptic-curve-based public-key cryptography with control and notification from a web server.

The hardware includes an ARM® mbed™ shield and attached sensor endpoint. The shield contains a DS2476 DeepCover® ECDSA/SHA-2 coprocessor, Wifi communication, LCD push-button controls, and status LEDs. The sensor endpoint is attached to the shield using a 300mm cable and contains a DS28C36 DeepCover ECDSA/SHA-2 authenticator, IR-thermal sensor, and aiming laser for the IR sensor. The MAXREFDES155# is equipped with a standard Arduino® form-factor shield connector for immediate testing using an mbed board such as the MAX32600MBED#. The combination of these two devices represent an IoT device. Communication to the web server is accomplished with the shield Wifi circuitry. Communication from the shield to the attached sensor module is accomplished over I2C . The sensor module represents an IoT endpoint that generates small data with a requirement for message authenticity/integrity and secure on/off operational control.

The design is hierarchical with each mbed platform and shield communicating data from the sensor node to a web server that maintains a centralized log and dispatches notifications as necessary. The simplicity of this design enables rapid integration into any star-topology IoT network to provide security with the low overhead and cost provided by the ECDSA-P256 asymmetric-key and SHA-256 symmetric-key algorithms.

More information about the MAXREFDES155# is available on the Maxim Integrated website.

Committer:
IanBenzMaxim
Date:
Tue Dec 03 12:56:25 2019 -0600
Revision:
18:c2631e985780
Parent:
16:a004191a79ab
Updated MaximInterface to version 2.1.

Who changed what in which revision?

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