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.
xternal/simplelink/source/driver.h@16:a004191a79ab, 2019-10-03 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Thu Oct 03 11:40:13 2019 -0500
- Revision:
- 16:a004191a79ab
- Parent:
- simplelink/source/driver.h@0:33d4e66780c0
Updated MaximInterface to version 2.0. Updated mbed-os to version 5.5.7. Cleaned up code styling.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IanBenzMaxim | 0:33d4e66780c0 | 1 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 2 | * driver.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 __DRIVER_INT_H__ |
IanBenzMaxim | 0:33d4e66780c0 | 38 | #define __DRIVER_INT_H__ |
IanBenzMaxim | 0:33d4e66780c0 | 39 | |
IanBenzMaxim | 0:33d4e66780c0 | 40 | #define TIMEOUT_STATE_EXPIRY (0) |
IanBenzMaxim | 0:33d4e66780c0 | 41 | #define TIMEOUT_ONE_MORE_SHOT (1) |
IanBenzMaxim | 0:33d4e66780c0 | 42 | #define TIMEOUT_STATE_INIT_VAL (2) |
IanBenzMaxim | 0:33d4e66780c0 | 43 | |
IanBenzMaxim | 0:33d4e66780c0 | 44 | |
IanBenzMaxim | 0:33d4e66780c0 | 45 | /* Timeouts for the sync objects */ |
IanBenzMaxim | 0:33d4e66780c0 | 46 | #ifndef SL_DRIVER_TIMEOUT_SHORT |
IanBenzMaxim | 0:33d4e66780c0 | 47 | #define SL_DRIVER_TIMEOUT_SHORT (1000) /* msec units */ |
IanBenzMaxim | 0:33d4e66780c0 | 48 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 49 | #ifndef SL_DRIVER_TIMEOUT_LONG |
IanBenzMaxim | 0:33d4e66780c0 | 50 | #define SL_DRIVER_TIMEOUT_LONG (65535) /* msec units */ |
IanBenzMaxim | 0:33d4e66780c0 | 51 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 52 | |
IanBenzMaxim | 0:33d4e66780c0 | 53 | #define INIT_COMPLETE_TIMEOUT SL_DRIVER_TIMEOUT_LONG |
IanBenzMaxim | 0:33d4e66780c0 | 54 | #define STOP_DEVICE_TIMEOUT SL_DRIVER_TIMEOUT_LONG |
IanBenzMaxim | 0:33d4e66780c0 | 55 | #ifndef SYNC_PATTERN_TIMEOUT_IN_MSEC |
IanBenzMaxim | 0:33d4e66780c0 | 56 | #define SYNC_PATTERN_TIMEOUT_IN_MSEC (50) /* the sync patttern timeout in milliseconds units */ |
IanBenzMaxim | 0:33d4e66780c0 | 57 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 58 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 59 | /* Macro declarations */ |
IanBenzMaxim | 0:33d4e66780c0 | 60 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 61 | |
IanBenzMaxim | 0:33d4e66780c0 | 62 | #ifndef CPU_FREQ_IN_MHZ |
IanBenzMaxim | 0:33d4e66780c0 | 63 | #define CPU_FREQ_IN_MHZ (200) |
IanBenzMaxim | 0:33d4e66780c0 | 64 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 65 | #define USEC_DELAY (50) |
IanBenzMaxim | 0:33d4e66780c0 | 66 | |
IanBenzMaxim | 0:33d4e66780c0 | 67 | #define SL_DRV_PROTECTION_OBJ_UNLOCK() (void)_SlDrvProtectionObjUnLock(); |
IanBenzMaxim | 0:33d4e66780c0 | 68 | #define SL_DRV_PROTECTION_OBJ_LOCK_FOREVER() (void)_SlDrvProtectionObjLockWaitForever(); |
IanBenzMaxim | 0:33d4e66780c0 | 69 | #define SL_DRV_OBJ_UNLOCK(pObj) (void)_SlDrvObjUnLock(pObj); |
IanBenzMaxim | 0:33d4e66780c0 | 70 | #define SL_DRV_OBJ_LOCK_FOREVER(pObj) (void)_SlDrvObjLockWaitForever(pObj); |
IanBenzMaxim | 0:33d4e66780c0 | 71 | #define SL_DRV_SYNC_OBJ_SIGNAL(pObj) (void)_SlDrvSyncObjSignal(pObj); |
IanBenzMaxim | 0:33d4e66780c0 | 72 | #define SL_DRV_SYNC_OBJ_CLEAR(pObj) (void)sl_SyncObjWait(pObj,SL_OS_NO_WAIT); |
IanBenzMaxim | 0:33d4e66780c0 | 73 | |
IanBenzMaxim | 0:33d4e66780c0 | 74 | |
IanBenzMaxim | 0:33d4e66780c0 | 75 | #ifdef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 76 | #define SL_DRV_SYNC_OBJ_WAIT_FOREVER(SyncObj) (void)_SlDrvSyncObjWaitForever(SyncObj); |
IanBenzMaxim | 0:33d4e66780c0 | 77 | #define SL_DRV_LOCK_GLOBAL_LOCK_FOREVER() (void)_SlDrvObjGlobalLockWaitForever(); |
IanBenzMaxim | 0:33d4e66780c0 | 78 | #define SL_DRV_LOCK_GLOBAL_UNLOCK() (void)_SlDrvGlobalObjUnLock(); |
IanBenzMaxim | 0:33d4e66780c0 | 79 | #else |
IanBenzMaxim | 0:33d4e66780c0 | 80 | #define SL_DRV_SYNC_OBJ_WAIT_FOREVER(SyncObj) { \ |
IanBenzMaxim | 0:33d4e66780c0 | 81 | if (SL_API_ABORTED == _SlDrvSyncObjWaitForever(SyncObj)) \ |
IanBenzMaxim | 0:33d4e66780c0 | 82 | { \ |
IanBenzMaxim | 0:33d4e66780c0 | 83 | return SL_API_ABORTED; \ |
IanBenzMaxim | 0:33d4e66780c0 | 84 | } \ |
IanBenzMaxim | 0:33d4e66780c0 | 85 | } |
IanBenzMaxim | 0:33d4e66780c0 | 86 | |
IanBenzMaxim | 0:33d4e66780c0 | 87 | #define SL_DRV_SYNC_OBJ_WAIT_TIMEOUT(SyncObj, timeoutVal, apiIdx) { \ |
IanBenzMaxim | 0:33d4e66780c0 | 88 | if (SL_API_ABORTED == _SlDrvSyncObjWaitTimeout(SyncObj, timeoutVal, apiIdx)) \ |
IanBenzMaxim | 0:33d4e66780c0 | 89 | { \ |
IanBenzMaxim | 0:33d4e66780c0 | 90 | return SL_API_ABORTED; \ |
IanBenzMaxim | 0:33d4e66780c0 | 91 | } \ |
IanBenzMaxim | 0:33d4e66780c0 | 92 | } |
IanBenzMaxim | 0:33d4e66780c0 | 93 | #define SL_DRV_LOCK_GLOBAL_LOCK_FOREVER() { \ |
IanBenzMaxim | 0:33d4e66780c0 | 94 | _SlReturnVal_t retVal; \ |
IanBenzMaxim | 0:33d4e66780c0 | 95 | \ |
IanBenzMaxim | 0:33d4e66780c0 | 96 | retVal = _SlDrvObjGlobalLockWaitForever(); \ |
IanBenzMaxim | 0:33d4e66780c0 | 97 | if (retVal) \ |
IanBenzMaxim | 0:33d4e66780c0 | 98 | { \ |
IanBenzMaxim | 0:33d4e66780c0 | 99 | return retVal; \ |
IanBenzMaxim | 0:33d4e66780c0 | 100 | } \ |
IanBenzMaxim | 0:33d4e66780c0 | 101 | } |
IanBenzMaxim | 0:33d4e66780c0 | 102 | |
IanBenzMaxim | 0:33d4e66780c0 | 103 | #define SL_DRV_LOCK_GLOBAL_UNLOCK() { \ |
IanBenzMaxim | 0:33d4e66780c0 | 104 | _SlReturnVal_t retVal; \ |
IanBenzMaxim | 0:33d4e66780c0 | 105 | \ |
IanBenzMaxim | 0:33d4e66780c0 | 106 | retVal = _SlDrvGlobalObjUnLock(); \ |
IanBenzMaxim | 0:33d4e66780c0 | 107 | if (retVal) \ |
IanBenzMaxim | 0:33d4e66780c0 | 108 | { \ |
IanBenzMaxim | 0:33d4e66780c0 | 109 | return retVal; \ |
IanBenzMaxim | 0:33d4e66780c0 | 110 | } \ |
IanBenzMaxim | 0:33d4e66780c0 | 111 | } |
IanBenzMaxim | 0:33d4e66780c0 | 112 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 113 | |
IanBenzMaxim | 0:33d4e66780c0 | 114 | |
IanBenzMaxim | 0:33d4e66780c0 | 115 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 116 | /* Structure/Enum declarations */ |
IanBenzMaxim | 0:33d4e66780c0 | 117 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 118 | |
IanBenzMaxim | 0:33d4e66780c0 | 119 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 120 | { |
IanBenzMaxim | 0:33d4e66780c0 | 121 | _u32 TSPrev; |
IanBenzMaxim | 0:33d4e66780c0 | 122 | _u32 TSCurr; |
IanBenzMaxim | 0:33d4e66780c0 | 123 | _u32 DeltaTicks; |
IanBenzMaxim | 0:33d4e66780c0 | 124 | _u32 DeltaTicksReminder; |
IanBenzMaxim | 0:33d4e66780c0 | 125 | _i32 Total10MSecUnits; |
IanBenzMaxim | 0:33d4e66780c0 | 126 | } _SlTimeoutParams_t; |
IanBenzMaxim | 0:33d4e66780c0 | 127 | |
IanBenzMaxim | 0:33d4e66780c0 | 128 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 129 | { |
IanBenzMaxim | 0:33d4e66780c0 | 130 | _u8 *pAsyncMsgBuff; |
IanBenzMaxim | 0:33d4e66780c0 | 131 | _u8 bInCmdContext; |
IanBenzMaxim | 0:33d4e66780c0 | 132 | } DeviceEventInfo_t; |
IanBenzMaxim | 0:33d4e66780c0 | 133 | |
IanBenzMaxim | 0:33d4e66780c0 | 134 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 135 | { |
IanBenzMaxim | 0:33d4e66780c0 | 136 | _SlOpcode_t Opcode; |
IanBenzMaxim | 0:33d4e66780c0 | 137 | _SlArgSize_t TxDescLen; |
IanBenzMaxim | 0:33d4e66780c0 | 138 | _SlArgSize_t RxDescLen; |
IanBenzMaxim | 0:33d4e66780c0 | 139 | }_SlCmdCtrl_t; |
IanBenzMaxim | 0:33d4e66780c0 | 140 | |
IanBenzMaxim | 0:33d4e66780c0 | 141 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 142 | { |
IanBenzMaxim | 0:33d4e66780c0 | 143 | _u16 TxPayloadLen; |
IanBenzMaxim | 0:33d4e66780c0 | 144 | _i16 RxPayloadLen; |
IanBenzMaxim | 0:33d4e66780c0 | 145 | _i16 ActualRxPayloadLen; |
IanBenzMaxim | 0:33d4e66780c0 | 146 | _u8 *pTxPayload; |
IanBenzMaxim | 0:33d4e66780c0 | 147 | _u8 *pRxPayload; |
IanBenzMaxim | 0:33d4e66780c0 | 148 | }_SlCmdExt_t; |
IanBenzMaxim | 0:33d4e66780c0 | 149 | |
IanBenzMaxim | 0:33d4e66780c0 | 150 | |
IanBenzMaxim | 0:33d4e66780c0 | 151 | typedef struct _SlArgsData_t |
IanBenzMaxim | 0:33d4e66780c0 | 152 | { |
IanBenzMaxim | 0:33d4e66780c0 | 153 | _u8 *pArgs; |
IanBenzMaxim | 0:33d4e66780c0 | 154 | _u8 *pData; |
IanBenzMaxim | 0:33d4e66780c0 | 155 | } _SlArgsData_t; |
IanBenzMaxim | 0:33d4e66780c0 | 156 | |
IanBenzMaxim | 0:33d4e66780c0 | 157 | |
IanBenzMaxim | 0:33d4e66780c0 | 158 | typedef struct _SlPoolObj_t |
IanBenzMaxim | 0:33d4e66780c0 | 159 | { |
IanBenzMaxim | 0:33d4e66780c0 | 160 | _SlSyncObj_t SyncObj; |
IanBenzMaxim | 0:33d4e66780c0 | 161 | _u8 *pRespArgs; |
IanBenzMaxim | 0:33d4e66780c0 | 162 | _u8 ActionID; |
IanBenzMaxim | 0:33d4e66780c0 | 163 | _u8 AdditionalData; /* use for socketID and one bit which indicate supprt IPV6 or not (1=support, 0 otherwise) */ |
IanBenzMaxim | 0:33d4e66780c0 | 164 | _u8 NextIndex; |
IanBenzMaxim | 0:33d4e66780c0 | 165 | |
IanBenzMaxim | 0:33d4e66780c0 | 166 | } _SlPoolObj_t; |
IanBenzMaxim | 0:33d4e66780c0 | 167 | |
IanBenzMaxim | 0:33d4e66780c0 | 168 | |
IanBenzMaxim | 0:33d4e66780c0 | 169 | typedef enum |
IanBenzMaxim | 0:33d4e66780c0 | 170 | { |
IanBenzMaxim | 0:33d4e66780c0 | 171 | SOCKET_0, |
IanBenzMaxim | 0:33d4e66780c0 | 172 | SOCKET_1, |
IanBenzMaxim | 0:33d4e66780c0 | 173 | SOCKET_2, |
IanBenzMaxim | 0:33d4e66780c0 | 174 | SOCKET_3, |
IanBenzMaxim | 0:33d4e66780c0 | 175 | SOCKET_4, |
IanBenzMaxim | 0:33d4e66780c0 | 176 | SOCKET_5, |
IanBenzMaxim | 0:33d4e66780c0 | 177 | SOCKET_6, |
IanBenzMaxim | 0:33d4e66780c0 | 178 | SOCKET_7, |
IanBenzMaxim | 0:33d4e66780c0 | 179 | MAX_SOCKET_ENUM_IDX, |
IanBenzMaxim | 0:33d4e66780c0 | 180 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 181 | ACCEPT_ID = MAX_SOCKET_ENUM_IDX, |
IanBenzMaxim | 0:33d4e66780c0 | 182 | CONNECT_ID, |
IanBenzMaxim | 0:33d4e66780c0 | 183 | #else |
IanBenzMaxim | 0:33d4e66780c0 | 184 | CONNECT_ID = MAX_SOCKET_ENUM_IDX, |
IanBenzMaxim | 0:33d4e66780c0 | 185 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 186 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 187 | SELECT_ID, |
IanBenzMaxim | 0:33d4e66780c0 | 188 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 189 | GETHOSYBYNAME_ID, |
IanBenzMaxim | 0:33d4e66780c0 | 190 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 191 | GETHOSYBYSERVICE_ID, |
IanBenzMaxim | 0:33d4e66780c0 | 192 | PING_ID, |
IanBenzMaxim | 0:33d4e66780c0 | 193 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 194 | START_STOP_ID, |
IanBenzMaxim | 0:33d4e66780c0 | 195 | RECV_ID |
IanBenzMaxim | 0:33d4e66780c0 | 196 | }_SlActionID_e; |
IanBenzMaxim | 0:33d4e66780c0 | 197 | |
IanBenzMaxim | 0:33d4e66780c0 | 198 | typedef struct _SlActionLookup_t |
IanBenzMaxim | 0:33d4e66780c0 | 199 | { |
IanBenzMaxim | 0:33d4e66780c0 | 200 | _u8 ActionID; |
IanBenzMaxim | 0:33d4e66780c0 | 201 | _u16 ActionAsyncOpcode; |
IanBenzMaxim | 0:33d4e66780c0 | 202 | _SlSpawnEntryFunc_t AsyncEventHandler; |
IanBenzMaxim | 0:33d4e66780c0 | 203 | |
IanBenzMaxim | 0:33d4e66780c0 | 204 | } _SlActionLookup_t; |
IanBenzMaxim | 0:33d4e66780c0 | 205 | |
IanBenzMaxim | 0:33d4e66780c0 | 206 | |
IanBenzMaxim | 0:33d4e66780c0 | 207 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 208 | { |
IanBenzMaxim | 0:33d4e66780c0 | 209 | _u8 TxPoolCnt; |
IanBenzMaxim | 0:33d4e66780c0 | 210 | _SlLockObj_t TxLockObj; |
IanBenzMaxim | 0:33d4e66780c0 | 211 | _SlSyncObj_t TxSyncObj; |
IanBenzMaxim | 0:33d4e66780c0 | 212 | }_SlFlowContCB_t; |
IanBenzMaxim | 0:33d4e66780c0 | 213 | |
IanBenzMaxim | 0:33d4e66780c0 | 214 | typedef enum |
IanBenzMaxim | 0:33d4e66780c0 | 215 | { |
IanBenzMaxim | 0:33d4e66780c0 | 216 | RECV_RESP_CLASS, |
IanBenzMaxim | 0:33d4e66780c0 | 217 | CMD_RESP_CLASS, |
IanBenzMaxim | 0:33d4e66780c0 | 218 | ASYNC_EVT_CLASS, |
IanBenzMaxim | 0:33d4e66780c0 | 219 | DUMMY_MSG_CLASS |
IanBenzMaxim | 0:33d4e66780c0 | 220 | }_SlRxMsgClass_e; |
IanBenzMaxim | 0:33d4e66780c0 | 221 | |
IanBenzMaxim | 0:33d4e66780c0 | 222 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 223 | { |
IanBenzMaxim | 0:33d4e66780c0 | 224 | _u8 *pAsyncBuf; /* place to write pointer to buffer with CmdResp's Header + Arguments */ |
IanBenzMaxim | 0:33d4e66780c0 | 225 | _u8 ActionIndex; |
IanBenzMaxim | 0:33d4e66780c0 | 226 | _SlSpawnEntryFunc_t AsyncEvtHandler; /* place to write pointer to AsyncEvent handler (calc-ed by Opcode) */ |
IanBenzMaxim | 0:33d4e66780c0 | 227 | _SlRxMsgClass_e RxMsgClass; /* type of Rx message */ |
IanBenzMaxim | 0:33d4e66780c0 | 228 | } AsyncExt_t; |
IanBenzMaxim | 0:33d4e66780c0 | 229 | |
IanBenzMaxim | 0:33d4e66780c0 | 230 | typedef _u8 _SlSd_t; |
IanBenzMaxim | 0:33d4e66780c0 | 231 | |
IanBenzMaxim | 0:33d4e66780c0 | 232 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 233 | { |
IanBenzMaxim | 0:33d4e66780c0 | 234 | _SlCmdCtrl_t *pCmdCtrl; |
IanBenzMaxim | 0:33d4e66780c0 | 235 | _u8 *pTxRxDescBuff; |
IanBenzMaxim | 0:33d4e66780c0 | 236 | _SlCmdExt_t *pCmdExt; |
IanBenzMaxim | 0:33d4e66780c0 | 237 | AsyncExt_t AsyncExt; |
IanBenzMaxim | 0:33d4e66780c0 | 238 | }_SlFunctionParams_t; |
IanBenzMaxim | 0:33d4e66780c0 | 239 | |
IanBenzMaxim | 0:33d4e66780c0 | 240 | |
IanBenzMaxim | 0:33d4e66780c0 | 241 | typedef struct |
IanBenzMaxim | 0:33d4e66780c0 | 242 | { |
IanBenzMaxim | 0:33d4e66780c0 | 243 | _SlFd_t FD; |
IanBenzMaxim | 0:33d4e66780c0 | 244 | _SlLockObj_t GlobalLockObj; |
IanBenzMaxim | 0:33d4e66780c0 | 245 | _SlCommandHeader_t TempProtocolHeader; |
IanBenzMaxim | 0:33d4e66780c0 | 246 | P_INIT_CALLBACK pInitCallback; |
IanBenzMaxim | 0:33d4e66780c0 | 247 | |
IanBenzMaxim | 0:33d4e66780c0 | 248 | _SlPoolObj_t ObjPool[MAX_CONCURRENT_ACTIONS]; |
IanBenzMaxim | 0:33d4e66780c0 | 249 | _u8 FreePoolIdx; |
IanBenzMaxim | 0:33d4e66780c0 | 250 | _u8 PendingPoolIdx; |
IanBenzMaxim | 0:33d4e66780c0 | 251 | _u8 ActivePoolIdx; |
IanBenzMaxim | 0:33d4e66780c0 | 252 | _u32 ActiveActionsBitmap; |
IanBenzMaxim | 0:33d4e66780c0 | 253 | _SlLockObj_t ProtectionLockObj; |
IanBenzMaxim | 0:33d4e66780c0 | 254 | |
IanBenzMaxim | 0:33d4e66780c0 | 255 | _SlSyncObj_t CmdSyncObj; |
IanBenzMaxim | 0:33d4e66780c0 | 256 | _u8 IsCmdRespWaited; |
IanBenzMaxim | 0:33d4e66780c0 | 257 | _SlFlowContCB_t FlowContCB; |
IanBenzMaxim | 0:33d4e66780c0 | 258 | _u8 TxSeqNum; |
IanBenzMaxim | 0:33d4e66780c0 | 259 | _u8 RxDoneCnt; |
IanBenzMaxim | 0:33d4e66780c0 | 260 | _u8 SocketNonBlocking; |
IanBenzMaxim | 0:33d4e66780c0 | 261 | _u8 SocketTXFailure; |
IanBenzMaxim | 0:33d4e66780c0 | 262 | /* for stack reduction the parameters are globals */ |
IanBenzMaxim | 0:33d4e66780c0 | 263 | _SlFunctionParams_t FunctionParams; |
IanBenzMaxim | 0:33d4e66780c0 | 264 | |
IanBenzMaxim | 0:33d4e66780c0 | 265 | _u8 ActionIndex; |
IanBenzMaxim | 0:33d4e66780c0 | 266 | }_SlDriverCb_t; |
IanBenzMaxim | 0:33d4e66780c0 | 267 | |
IanBenzMaxim | 0:33d4e66780c0 | 268 | extern _volatile _u8 RxIrqCnt; |
IanBenzMaxim | 0:33d4e66780c0 | 269 | |
IanBenzMaxim | 0:33d4e66780c0 | 270 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 271 | extern _volatile _u8 g_bDeviceRestartIsRequired; |
IanBenzMaxim | 0:33d4e66780c0 | 272 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 273 | |
IanBenzMaxim | 0:33d4e66780c0 | 274 | extern _SlDriverCb_t* g_pCB; |
IanBenzMaxim | 0:33d4e66780c0 | 275 | extern P_SL_DEV_PING_CALLBACK pPingCallBackFunc; |
IanBenzMaxim | 0:33d4e66780c0 | 276 | |
IanBenzMaxim | 0:33d4e66780c0 | 277 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 278 | /* Function prototypes */ |
IanBenzMaxim | 0:33d4e66780c0 | 279 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 280 | |
IanBenzMaxim | 0:33d4e66780c0 | 281 | extern _SlReturnVal_t _SlDrvDriverCBInit(void); |
IanBenzMaxim | 0:33d4e66780c0 | 282 | extern _SlReturnVal_t _SlDrvDriverCBDeinit(void); |
IanBenzMaxim | 0:33d4e66780c0 | 283 | extern _SlReturnVal_t _SlDrvRxIrqHandler(void *pValue); |
IanBenzMaxim | 0:33d4e66780c0 | 284 | extern _SlReturnVal_t _SlDrvCmdOp(_SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt); |
IanBenzMaxim | 0:33d4e66780c0 | 285 | extern _SlReturnVal_t _SlDrvCmdSend(_SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt); |
IanBenzMaxim | 0:33d4e66780c0 | 286 | extern _SlReturnVal_t _SlDrvDataReadOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt); |
IanBenzMaxim | 0:33d4e66780c0 | 287 | extern _SlReturnVal_t _SlDrvDataWriteOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt); |
IanBenzMaxim | 0:33d4e66780c0 | 288 | extern _SlReturnVal_t _sl_HandleAsync_InitComplete(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 289 | extern _SlReturnVal_t _sl_HandleAsync_Connect(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 290 | extern _SlReturnVal_t _SlDrvGlobalObjUnLock(void); |
IanBenzMaxim | 0:33d4e66780c0 | 291 | extern _SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue); |
IanBenzMaxim | 0:33d4e66780c0 | 292 | |
IanBenzMaxim | 0:33d4e66780c0 | 293 | |
IanBenzMaxim | 0:33d4e66780c0 | 294 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 295 | extern _i16 _SlDrvBasicCmd(_SlOpcode_t Opcode); |
IanBenzMaxim | 0:33d4e66780c0 | 296 | extern _SlReturnVal_t _sl_HandleAsync_Accept(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 297 | extern _SlReturnVal_t _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 298 | extern _SlReturnVal_t _sl_HandleAsync_Select(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 299 | #ifdef sl_GetTimestamp |
IanBenzMaxim | 0:33d4e66780c0 | 300 | extern void _SlDrvStartMeasureTimeout(_SlTimeoutParams_t *pTimeoutInfo, _u32 TimeoutInMsec); |
IanBenzMaxim | 0:33d4e66780c0 | 301 | extern _u8 _SlDrvIsTimeoutExpired(_SlTimeoutParams_t *pTimeoutInfo); |
IanBenzMaxim | 0:33d4e66780c0 | 302 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 303 | |
IanBenzMaxim | 0:33d4e66780c0 | 304 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 305 | extern _SlReturnVal_t _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 306 | extern _SlReturnVal_t _sl_HandleAsync_DnsGetHostByAddr(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 307 | extern _SlReturnVal_t _sl_HandleAsync_PingResponse(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 308 | extern _SlReturnVal_t _SlDrvNetAppEventHandler(void* pArgs); |
IanBenzMaxim | 0:33d4e66780c0 | 309 | |
IanBenzMaxim | 0:33d4e66780c0 | 310 | #if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS) |
IanBenzMaxim | 0:33d4e66780c0 | 311 | extern void _SlDrvDispatchHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse); |
IanBenzMaxim | 0:33d4e66780c0 | 312 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 313 | |
IanBenzMaxim | 0:33d4e66780c0 | 314 | extern void _sl_HandleAsync_Stop(void *pVoidBuf); |
IanBenzMaxim | 0:33d4e66780c0 | 315 | extern _u8 _SlDrvWaitForPoolObj(_u8 ActionID, _u8 SocketID); |
IanBenzMaxim | 0:33d4e66780c0 | 316 | extern void _SlDrvReleasePoolObj(_u8 pObj); |
IanBenzMaxim | 0:33d4e66780c0 | 317 | extern _u16 _SlDrvAlignSize(_u16 msgLen); |
IanBenzMaxim | 0:33d4e66780c0 | 318 | extern _u8 _SlDrvProtectAsyncRespSetting(_u8 *pAsyncRsp, _SlActionID_e ActionID, _u8 SocketID); |
IanBenzMaxim | 0:33d4e66780c0 | 319 | |
IanBenzMaxim | 0:33d4e66780c0 | 320 | |
IanBenzMaxim | 0:33d4e66780c0 | 321 | |
IanBenzMaxim | 0:33d4e66780c0 | 322 | extern _SlReturnVal_t _SlDrvDeviceEventHandler(void* pEventInfo); |
IanBenzMaxim | 0:33d4e66780c0 | 323 | extern _SlReturnVal_t _SlDrvSyncObjWaitForever(_SlSyncObj_t *pSyncObj); |
IanBenzMaxim | 0:33d4e66780c0 | 324 | extern _SlReturnVal_t _SlDrvObjLockWaitForever(_SlLockObj_t *pLockObj); |
IanBenzMaxim | 0:33d4e66780c0 | 325 | extern _SlReturnVal_t _SlDrvSyncObjWaitTimeout(_SlSyncObj_t *pSyncObj, |
IanBenzMaxim | 0:33d4e66780c0 | 326 | _u32 timeoutVal, |
IanBenzMaxim | 0:33d4e66780c0 | 327 | SlDriverAPIWithTimeout_e apiIdx); |
IanBenzMaxim | 0:33d4e66780c0 | 328 | |
IanBenzMaxim | 0:33d4e66780c0 | 329 | extern _SlReturnVal_t _SlDrvSyncObjSignal(_SlSyncObj_t *pSyncObj); |
IanBenzMaxim | 0:33d4e66780c0 | 330 | extern _SlReturnVal_t _SlDrvObjLock(_SlLockObj_t *pLockObj, _SlTime_t Timeout); |
IanBenzMaxim | 0:33d4e66780c0 | 331 | extern _SlReturnVal_t _SlDrvProtectionObjLockWaitForever(void); |
IanBenzMaxim | 0:33d4e66780c0 | 332 | extern _SlReturnVal_t _SlDrvObjUnLock(_SlLockObj_t *pLockObj); |
IanBenzMaxim | 0:33d4e66780c0 | 333 | extern _SlReturnVal_t _SlDrvProtectionObjUnLock(void); |
IanBenzMaxim | 0:33d4e66780c0 | 334 | |
IanBenzMaxim | 0:33d4e66780c0 | 335 | extern void _SlDrvMemZero(void* Addr, _u16 size); |
IanBenzMaxim | 0:33d4e66780c0 | 336 | extern void _SlDrvResetCmdExt(_SlCmdExt_t* pCmdExt); |
IanBenzMaxim | 0:33d4e66780c0 | 337 | |
IanBenzMaxim | 0:33d4e66780c0 | 338 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 339 | extern void _SlDriverHandleError(SlDeviceDriverError_e eError, _u32 info1, _u32 info2); |
IanBenzMaxim | 0:33d4e66780c0 | 340 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 341 | |
IanBenzMaxim | 0:33d4e66780c0 | 342 | #define _SL_PROTOCOL_ALIGN_SIZE(msgLen) (((msgLen)+3) & (~3)) |
IanBenzMaxim | 0:33d4e66780c0 | 343 | #define _SL_IS_PROTOCOL_ALIGNED_SIZE(msgLen) (!((msgLen) & 3)) |
IanBenzMaxim | 0:33d4e66780c0 | 344 | |
IanBenzMaxim | 0:33d4e66780c0 | 345 | |
IanBenzMaxim | 0:33d4e66780c0 | 346 | #define _SL_PROTOCOL_CALC_LEN(pCmdCtrl,pCmdExt) ((pCmdExt) ? \ |
IanBenzMaxim | 0:33d4e66780c0 | 347 | (_SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen) + _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->TxPayloadLen)) : \ |
IanBenzMaxim | 0:33d4e66780c0 | 348 | (_SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen))) |
IanBenzMaxim | 0:33d4e66780c0 | 349 | #endif /* __DRIVER_INT_H__ */ |