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.
simplelink/user.h@0:33d4e66780c0, 2017-02-24 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Fri Feb 24 11:23:12 2017 -0600
- Revision:
- 0:33d4e66780c0
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IanBenzMaxim | 0:33d4e66780c0 | 1 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 2 | * user.h - CC31xx/CC32xx Host Driver Implementation |
IanBenzMaxim | 0:33d4e66780c0 | 3 | * |
IanBenzMaxim | 0:33d4e66780c0 | 4 | * Copyright (C) 2014 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 | |
IanBenzMaxim | 0:33d4e66780c0 | 38 | #ifndef __USER_H__ |
IanBenzMaxim | 0:33d4e66780c0 | 39 | #define __USER_H__ |
IanBenzMaxim | 0:33d4e66780c0 | 40 | |
IanBenzMaxim | 0:33d4e66780c0 | 41 | |
IanBenzMaxim | 0:33d4e66780c0 | 42 | #ifdef __cplusplus |
IanBenzMaxim | 0:33d4e66780c0 | 43 | extern "C" { |
IanBenzMaxim | 0:33d4e66780c0 | 44 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 45 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 46 | |
IanBenzMaxim | 0:33d4e66780c0 | 47 | \addtogroup Porting |
IanBenzMaxim | 0:33d4e66780c0 | 48 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 49 | |
IanBenzMaxim | 0:33d4e66780c0 | 50 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 51 | |
IanBenzMaxim | 0:33d4e66780c0 | 52 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 53 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 54 | |
IanBenzMaxim | 0:33d4e66780c0 | 55 | \defgroup porting_user_include User Include Files |
IanBenzMaxim | 0:33d4e66780c0 | 56 | |
IanBenzMaxim | 0:33d4e66780c0 | 57 | This section IS NOT REQUIRED in case user provided primitives are handled |
IanBenzMaxim | 0:33d4e66780c0 | 58 | in makefiles or project configurations (IDE) |
IanBenzMaxim | 0:33d4e66780c0 | 59 | |
IanBenzMaxim | 0:33d4e66780c0 | 60 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 61 | - Include all required header files for the definition of: |
IanBenzMaxim | 0:33d4e66780c0 | 62 | -# Transport layer library API (e.g. SPI, UART) |
IanBenzMaxim | 0:33d4e66780c0 | 63 | -# OS primitives definitions (e.g. Task spawn, Semaphores) |
IanBenzMaxim | 0:33d4e66780c0 | 64 | -# Memory management primitives (e.g. alloc, free) |
IanBenzMaxim | 0:33d4e66780c0 | 65 | |
IanBenzMaxim | 0:33d4e66780c0 | 66 | in order to "install" external SimpleLink library one should follow the next steps: |
IanBenzMaxim | 0:33d4e66780c0 | 67 | 1. Include the external library API header file (i.e. #include "IOT.h") |
IanBenzMaxim | 0:33d4e66780c0 | 68 | 2. Define each one of the desired external lib with one (out of 5) of the following: |
IanBenzMaxim | 0:33d4e66780c0 | 69 | #define SL_EXT_LIB_1 <Your external lib name> |
IanBenzMaxim | 0:33d4e66780c0 | 70 | #define SL_EXT_LIB_2 <Your external lib name> |
IanBenzMaxim | 0:33d4e66780c0 | 71 | #define SL_EXT_LIB_3 <Your external lib name> |
IanBenzMaxim | 0:33d4e66780c0 | 72 | #define SL_EXT_LIB_4 <Your external lib name> |
IanBenzMaxim | 0:33d4e66780c0 | 73 | #define SL_EXT_LIB_5 <Your external lib name> |
IanBenzMaxim | 0:33d4e66780c0 | 74 | |
IanBenzMaxim | 0:33d4e66780c0 | 75 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 76 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 77 | #include <string.h> |
IanBenzMaxim | 0:33d4e66780c0 | 78 | #include <CC3100_transport.h> |
IanBenzMaxim | 0:33d4e66780c0 | 79 | |
IanBenzMaxim | 0:33d4e66780c0 | 80 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 81 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 82 | |
IanBenzMaxim | 0:33d4e66780c0 | 83 | \defgroup porting_capabilities Capability Set Definition |
IanBenzMaxim | 0:33d4e66780c0 | 84 | |
IanBenzMaxim | 0:33d4e66780c0 | 85 | This section IS NOT REQUIRED in case one of the following pre defined |
IanBenzMaxim | 0:33d4e66780c0 | 86 | capabilities set is in use: |
IanBenzMaxim | 0:33d4e66780c0 | 87 | - SL_TINY |
IanBenzMaxim | 0:33d4e66780c0 | 88 | - SL_SMALL |
IanBenzMaxim | 0:33d4e66780c0 | 89 | - SL_FULL |
IanBenzMaxim | 0:33d4e66780c0 | 90 | |
IanBenzMaxim | 0:33d4e66780c0 | 91 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 92 | - Define one of the pre-defined capabilities set or uncomment the |
IanBenzMaxim | 0:33d4e66780c0 | 93 | relevant definitions below to select the required capabilities |
IanBenzMaxim | 0:33d4e66780c0 | 94 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 95 | ******************************************************************************* |
IanBenzMaxim | 0:33d4e66780c0 | 96 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 97 | |
IanBenzMaxim | 0:33d4e66780c0 | 98 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 99 | \def MAX_CONCURRENT_ACTIONS |
IanBenzMaxim | 0:33d4e66780c0 | 100 | |
IanBenzMaxim | 0:33d4e66780c0 | 101 | \brief Defines the maximum number of concurrent action in the system |
IanBenzMaxim | 0:33d4e66780c0 | 102 | Min:1 , Max: 32 |
IanBenzMaxim | 0:33d4e66780c0 | 103 | |
IanBenzMaxim | 0:33d4e66780c0 | 104 | Actions which has async events as return, can be |
IanBenzMaxim | 0:33d4e66780c0 | 105 | |
IanBenzMaxim | 0:33d4e66780c0 | 106 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 107 | |
IanBenzMaxim | 0:33d4e66780c0 | 108 | \note In case there are not enough resources for the actions needed in the system, |
IanBenzMaxim | 0:33d4e66780c0 | 109 | error is received: POOL_IS_EMPTY |
IanBenzMaxim | 0:33d4e66780c0 | 110 | one option is to increase MAX_CONCURRENT_ACTIONS |
IanBenzMaxim | 0:33d4e66780c0 | 111 | (improves performance but results in memory consumption) |
IanBenzMaxim | 0:33d4e66780c0 | 112 | Other option is to call the API later (decrease performance) |
IanBenzMaxim | 0:33d4e66780c0 | 113 | |
IanBenzMaxim | 0:33d4e66780c0 | 114 | \warning In case of setting to one, recommend to use non-blocking recv\recvfrom to allow |
IanBenzMaxim | 0:33d4e66780c0 | 115 | multiple socket recv |
IanBenzMaxim | 0:33d4e66780c0 | 116 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 117 | |
IanBenzMaxim | 0:33d4e66780c0 | 118 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 119 | #define MAX_CONCURRENT_ACTIONS 10 |
IanBenzMaxim | 0:33d4e66780c0 | 120 | #else |
IanBenzMaxim | 0:33d4e66780c0 | 121 | #define MAX_CONCURRENT_ACTIONS 1 |
IanBenzMaxim | 0:33d4e66780c0 | 122 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 123 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 124 | \def CPU_FREQ_IN_MHZ |
IanBenzMaxim | 0:33d4e66780c0 | 125 | \brief Defines CPU frequency for Host side, for better accuracy of busy loops, if any |
IanBenzMaxim | 0:33d4e66780c0 | 126 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 127 | \note |
IanBenzMaxim | 0:33d4e66780c0 | 128 | |
IanBenzMaxim | 0:33d4e66780c0 | 129 | \warning If not set the default CPU frequency is set to 200MHz |
IanBenzMaxim | 0:33d4e66780c0 | 130 | This option will be deprecated in future release |
IanBenzMaxim | 0:33d4e66780c0 | 131 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 132 | #define CPU_FREQ_IN_MHZ 25 |
IanBenzMaxim | 0:33d4e66780c0 | 133 | |
IanBenzMaxim | 0:33d4e66780c0 | 134 | |
IanBenzMaxim | 0:33d4e66780c0 | 135 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 136 | \def SL_INC_ARG_CHECK |
IanBenzMaxim | 0:33d4e66780c0 | 137 | |
IanBenzMaxim | 0:33d4e66780c0 | 138 | \brief Defines whether the SimpleLink driver perform argument check |
IanBenzMaxim | 0:33d4e66780c0 | 139 | or not |
IanBenzMaxim | 0:33d4e66780c0 | 140 | |
IanBenzMaxim | 0:33d4e66780c0 | 141 | When defined, the SimpleLink driver perform argument check on |
IanBenzMaxim | 0:33d4e66780c0 | 142 | function call. Removing this define could reduce some code |
IanBenzMaxim | 0:33d4e66780c0 | 143 | size and improve slightly the performances but may impact in |
IanBenzMaxim | 0:33d4e66780c0 | 144 | unpredictable behaviour in case of invalid arguments |
IanBenzMaxim | 0:33d4e66780c0 | 145 | |
IanBenzMaxim | 0:33d4e66780c0 | 146 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 147 | |
IanBenzMaxim | 0:33d4e66780c0 | 148 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 149 | |
IanBenzMaxim | 0:33d4e66780c0 | 150 | \warning Removing argument check may cause unpredictable behaviour in |
IanBenzMaxim | 0:33d4e66780c0 | 151 | case of invalid arguments. |
IanBenzMaxim | 0:33d4e66780c0 | 152 | In this case the user is responsible to argument validity |
IanBenzMaxim | 0:33d4e66780c0 | 153 | (for example all handlers must not be NULL) |
IanBenzMaxim | 0:33d4e66780c0 | 154 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 155 | #define SL_INC_ARG_CHECK |
IanBenzMaxim | 0:33d4e66780c0 | 156 | |
IanBenzMaxim | 0:33d4e66780c0 | 157 | |
IanBenzMaxim | 0:33d4e66780c0 | 158 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 159 | \def SL_INC_STD_BSD_API_NAMING |
IanBenzMaxim | 0:33d4e66780c0 | 160 | |
IanBenzMaxim | 0:33d4e66780c0 | 161 | \brief Defines whether SimpleLink driver should expose standard BSD |
IanBenzMaxim | 0:33d4e66780c0 | 162 | APIs or not |
IanBenzMaxim | 0:33d4e66780c0 | 163 | |
IanBenzMaxim | 0:33d4e66780c0 | 164 | When defined, the SimpleLink driver in addition to its alternative |
IanBenzMaxim | 0:33d4e66780c0 | 165 | BSD APIs expose also standard BSD APIs. |
IanBenzMaxim | 0:33d4e66780c0 | 166 | Standard BSD API includes the following functions: |
IanBenzMaxim | 0:33d4e66780c0 | 167 | socket , close , accept , bind , listen , connect , select , |
IanBenzMaxim | 0:33d4e66780c0 | 168 | setsockopt , getsockopt , recv , recvfrom , write , send , sendto , |
IanBenzMaxim | 0:33d4e66780c0 | 169 | gethostbyname |
IanBenzMaxim | 0:33d4e66780c0 | 170 | |
IanBenzMaxim | 0:33d4e66780c0 | 171 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 172 | |
IanBenzMaxim | 0:33d4e66780c0 | 173 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 174 | |
IanBenzMaxim | 0:33d4e66780c0 | 175 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 176 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 177 | #define SL_INC_STD_BSD_API_NAMING |
IanBenzMaxim | 0:33d4e66780c0 | 178 | |
IanBenzMaxim | 0:33d4e66780c0 | 179 | |
IanBenzMaxim | 0:33d4e66780c0 | 180 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 181 | \brief Defines whether to include extended API in SimpleLink driver |
IanBenzMaxim | 0:33d4e66780c0 | 182 | or not |
IanBenzMaxim | 0:33d4e66780c0 | 183 | |
IanBenzMaxim | 0:33d4e66780c0 | 184 | When defined, the SimpleLink driver will include also all |
IanBenzMaxim | 0:33d4e66780c0 | 185 | extended API of the included packages |
IanBenzMaxim | 0:33d4e66780c0 | 186 | |
IanBenzMaxim | 0:33d4e66780c0 | 187 | \sa ext_api |
IanBenzMaxim | 0:33d4e66780c0 | 188 | |
IanBenzMaxim | 0:33d4e66780c0 | 189 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 190 | |
IanBenzMaxim | 0:33d4e66780c0 | 191 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 192 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 193 | #define SL_INC_EXT_API |
IanBenzMaxim | 0:33d4e66780c0 | 194 | |
IanBenzMaxim | 0:33d4e66780c0 | 195 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 196 | \brief Defines whether to include WLAN package in SimpleLink driver |
IanBenzMaxim | 0:33d4e66780c0 | 197 | or not |
IanBenzMaxim | 0:33d4e66780c0 | 198 | |
IanBenzMaxim | 0:33d4e66780c0 | 199 | When defined, the SimpleLink driver will include also |
IanBenzMaxim | 0:33d4e66780c0 | 200 | the WLAN package |
IanBenzMaxim | 0:33d4e66780c0 | 201 | |
IanBenzMaxim | 0:33d4e66780c0 | 202 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 203 | |
IanBenzMaxim | 0:33d4e66780c0 | 204 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 205 | |
IanBenzMaxim | 0:33d4e66780c0 | 206 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 207 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 208 | #define SL_INC_WLAN_PKG |
IanBenzMaxim | 0:33d4e66780c0 | 209 | |
IanBenzMaxim | 0:33d4e66780c0 | 210 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 211 | \brief Defines whether to include SOCKET package in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 212 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 213 | |
IanBenzMaxim | 0:33d4e66780c0 | 214 | When defined, the SimpleLink driver will include also |
IanBenzMaxim | 0:33d4e66780c0 | 215 | the SOCKET package |
IanBenzMaxim | 0:33d4e66780c0 | 216 | |
IanBenzMaxim | 0:33d4e66780c0 | 217 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 218 | |
IanBenzMaxim | 0:33d4e66780c0 | 219 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 220 | |
IanBenzMaxim | 0:33d4e66780c0 | 221 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 222 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 223 | #define SL_INC_SOCKET_PKG |
IanBenzMaxim | 0:33d4e66780c0 | 224 | |
IanBenzMaxim | 0:33d4e66780c0 | 225 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 226 | \brief Defines whether to include NET_APP package in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 227 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 228 | |
IanBenzMaxim | 0:33d4e66780c0 | 229 | When defined, the SimpleLink driver will include also the |
IanBenzMaxim | 0:33d4e66780c0 | 230 | NET_APP package |
IanBenzMaxim | 0:33d4e66780c0 | 231 | |
IanBenzMaxim | 0:33d4e66780c0 | 232 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 233 | |
IanBenzMaxim | 0:33d4e66780c0 | 234 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 235 | |
IanBenzMaxim | 0:33d4e66780c0 | 236 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 237 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 238 | #define SL_INC_NET_APP_PKG |
IanBenzMaxim | 0:33d4e66780c0 | 239 | |
IanBenzMaxim | 0:33d4e66780c0 | 240 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 241 | \brief Defines whether to include NET_CFG package in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 242 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 243 | |
IanBenzMaxim | 0:33d4e66780c0 | 244 | When defined, the SimpleLink driver will include also |
IanBenzMaxim | 0:33d4e66780c0 | 245 | the NET_CFG package |
IanBenzMaxim | 0:33d4e66780c0 | 246 | |
IanBenzMaxim | 0:33d4e66780c0 | 247 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 248 | |
IanBenzMaxim | 0:33d4e66780c0 | 249 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 250 | |
IanBenzMaxim | 0:33d4e66780c0 | 251 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 252 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 253 | #define SL_INC_NET_CFG_PKG |
IanBenzMaxim | 0:33d4e66780c0 | 254 | |
IanBenzMaxim | 0:33d4e66780c0 | 255 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 256 | \brief Defines whether to include NVMEM package in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 257 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 258 | |
IanBenzMaxim | 0:33d4e66780c0 | 259 | When defined, the SimpleLink driver will include also the |
IanBenzMaxim | 0:33d4e66780c0 | 260 | NVMEM package |
IanBenzMaxim | 0:33d4e66780c0 | 261 | |
IanBenzMaxim | 0:33d4e66780c0 | 262 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 263 | |
IanBenzMaxim | 0:33d4e66780c0 | 264 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 265 | |
IanBenzMaxim | 0:33d4e66780c0 | 266 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 267 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 268 | #define SL_INC_NVMEM_PKG |
IanBenzMaxim | 0:33d4e66780c0 | 269 | |
IanBenzMaxim | 0:33d4e66780c0 | 270 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 271 | \brief Defines whether to include socket server side APIs |
IanBenzMaxim | 0:33d4e66780c0 | 272 | in SimpleLink driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 273 | |
IanBenzMaxim | 0:33d4e66780c0 | 274 | When defined, the SimpleLink driver will include also socket |
IanBenzMaxim | 0:33d4e66780c0 | 275 | server side APIs |
IanBenzMaxim | 0:33d4e66780c0 | 276 | |
IanBenzMaxim | 0:33d4e66780c0 | 277 | \sa server_side |
IanBenzMaxim | 0:33d4e66780c0 | 278 | |
IanBenzMaxim | 0:33d4e66780c0 | 279 | \note |
IanBenzMaxim | 0:33d4e66780c0 | 280 | |
IanBenzMaxim | 0:33d4e66780c0 | 281 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 282 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 283 | #define SL_INC_SOCK_SERVER_SIDE_API |
IanBenzMaxim | 0:33d4e66780c0 | 284 | |
IanBenzMaxim | 0:33d4e66780c0 | 285 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 286 | \brief Defines whether to include socket client side APIs in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 287 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 288 | |
IanBenzMaxim | 0:33d4e66780c0 | 289 | When defined, the SimpleLink driver will include also socket |
IanBenzMaxim | 0:33d4e66780c0 | 290 | client side APIs |
IanBenzMaxim | 0:33d4e66780c0 | 291 | |
IanBenzMaxim | 0:33d4e66780c0 | 292 | \sa client_side |
IanBenzMaxim | 0:33d4e66780c0 | 293 | |
IanBenzMaxim | 0:33d4e66780c0 | 294 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 295 | |
IanBenzMaxim | 0:33d4e66780c0 | 296 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 297 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 298 | #define SL_INC_SOCK_CLIENT_SIDE_API |
IanBenzMaxim | 0:33d4e66780c0 | 299 | |
IanBenzMaxim | 0:33d4e66780c0 | 300 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 301 | \brief Defines whether to include socket receive APIs in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 302 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 303 | |
IanBenzMaxim | 0:33d4e66780c0 | 304 | When defined, the SimpleLink driver will include also socket |
IanBenzMaxim | 0:33d4e66780c0 | 305 | receive side APIs |
IanBenzMaxim | 0:33d4e66780c0 | 306 | |
IanBenzMaxim | 0:33d4e66780c0 | 307 | \sa recv_api |
IanBenzMaxim | 0:33d4e66780c0 | 308 | |
IanBenzMaxim | 0:33d4e66780c0 | 309 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 310 | |
IanBenzMaxim | 0:33d4e66780c0 | 311 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 312 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 313 | #define SL_INC_SOCK_RECV_API |
IanBenzMaxim | 0:33d4e66780c0 | 314 | |
IanBenzMaxim | 0:33d4e66780c0 | 315 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 316 | \brief Defines whether to include socket send APIs in SimpleLink |
IanBenzMaxim | 0:33d4e66780c0 | 317 | driver or not |
IanBenzMaxim | 0:33d4e66780c0 | 318 | |
IanBenzMaxim | 0:33d4e66780c0 | 319 | When defined, the SimpleLink driver will include also socket |
IanBenzMaxim | 0:33d4e66780c0 | 320 | send side APIs |
IanBenzMaxim | 0:33d4e66780c0 | 321 | |
IanBenzMaxim | 0:33d4e66780c0 | 322 | \sa send_api |
IanBenzMaxim | 0:33d4e66780c0 | 323 | |
IanBenzMaxim | 0:33d4e66780c0 | 324 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 325 | |
IanBenzMaxim | 0:33d4e66780c0 | 326 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 327 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 328 | #define SL_INC_SOCK_SEND_API |
IanBenzMaxim | 0:33d4e66780c0 | 329 | |
IanBenzMaxim | 0:33d4e66780c0 | 330 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 331 | |
IanBenzMaxim | 0:33d4e66780c0 | 332 | Close the Doxygen group. |
IanBenzMaxim | 0:33d4e66780c0 | 333 | @} |
IanBenzMaxim | 0:33d4e66780c0 | 334 | |
IanBenzMaxim | 0:33d4e66780c0 | 335 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 336 | |
IanBenzMaxim | 0:33d4e66780c0 | 337 | |
IanBenzMaxim | 0:33d4e66780c0 | 338 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 339 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 340 | |
IanBenzMaxim | 0:33d4e66780c0 | 341 | \defgroup porting_enable_device Device Enable/Disable IO |
IanBenzMaxim | 0:33d4e66780c0 | 342 | |
IanBenzMaxim | 0:33d4e66780c0 | 343 | The enable/disable API provide mechanism to enable/disable the network processor |
IanBenzMaxim | 0:33d4e66780c0 | 344 | |
IanBenzMaxim | 0:33d4e66780c0 | 345 | |
IanBenzMaxim | 0:33d4e66780c0 | 346 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 347 | - None |
IanBenzMaxim | 0:33d4e66780c0 | 348 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 349 | |
IanBenzMaxim | 0:33d4e66780c0 | 350 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 351 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 352 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 353 | \brief Preamble to the enabling the Network Processor. |
IanBenzMaxim | 0:33d4e66780c0 | 354 | Placeholder to implement any pre-process operations |
IanBenzMaxim | 0:33d4e66780c0 | 355 | before enabling networking operations. |
IanBenzMaxim | 0:33d4e66780c0 | 356 | |
IanBenzMaxim | 0:33d4e66780c0 | 357 | \sa sl_DeviceEnable |
IanBenzMaxim | 0:33d4e66780c0 | 358 | |
IanBenzMaxim | 0:33d4e66780c0 | 359 | \note belongs to \ref ported_sec |
IanBenzMaxim | 0:33d4e66780c0 | 360 | |
IanBenzMaxim | 0:33d4e66780c0 | 361 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 362 | #define sl_DeviceEnablePreamble() |
IanBenzMaxim | 0:33d4e66780c0 | 363 | |
IanBenzMaxim | 0:33d4e66780c0 | 364 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 365 | \brief Enable the Network Processor |
IanBenzMaxim | 0:33d4e66780c0 | 366 | |
IanBenzMaxim | 0:33d4e66780c0 | 367 | \sa sl_DeviceDisable |
IanBenzMaxim | 0:33d4e66780c0 | 368 | |
IanBenzMaxim | 0:33d4e66780c0 | 369 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 370 | |
IanBenzMaxim | 0:33d4e66780c0 | 371 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 372 | #define sl_DeviceEnable sl_DeviceEnable |
IanBenzMaxim | 0:33d4e66780c0 | 373 | |
IanBenzMaxim | 0:33d4e66780c0 | 374 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 375 | \brief Disable the Network Processor |
IanBenzMaxim | 0:33d4e66780c0 | 376 | |
IanBenzMaxim | 0:33d4e66780c0 | 377 | \sa sl_DeviceEnable |
IanBenzMaxim | 0:33d4e66780c0 | 378 | |
IanBenzMaxim | 0:33d4e66780c0 | 379 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 380 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 381 | #define sl_DeviceDisable sl_DeviceDisable |
IanBenzMaxim | 0:33d4e66780c0 | 382 | |
IanBenzMaxim | 0:33d4e66780c0 | 383 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 384 | |
IanBenzMaxim | 0:33d4e66780c0 | 385 | Close the Doxygen group. |
IanBenzMaxim | 0:33d4e66780c0 | 386 | @} |
IanBenzMaxim | 0:33d4e66780c0 | 387 | |
IanBenzMaxim | 0:33d4e66780c0 | 388 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 389 | |
IanBenzMaxim | 0:33d4e66780c0 | 390 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 391 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 392 | |
IanBenzMaxim | 0:33d4e66780c0 | 393 | \defgroup porting_interface Hardware Transport Interface |
IanBenzMaxim | 0:33d4e66780c0 | 394 | |
IanBenzMaxim | 0:33d4e66780c0 | 395 | The simple link device can work with different transport interfaces |
IanBenzMaxim | 0:33d4e66780c0 | 396 | (namely,SPI or UART). Texas Instruments provides single driver |
IanBenzMaxim | 0:33d4e66780c0 | 397 | that can work with all these types. This section binds the |
IanBenzMaxim | 0:33d4e66780c0 | 398 | physical transport interface with the SimpleLink driver |
IanBenzMaxim | 0:33d4e66780c0 | 399 | |
IanBenzMaxim | 0:33d4e66780c0 | 400 | |
IanBenzMaxim | 0:33d4e66780c0 | 401 | \note Correct and efficient implementation of this driver is critical |
IanBenzMaxim | 0:33d4e66780c0 | 402 | for the performances of the SimpleLink device on this platform. |
IanBenzMaxim | 0:33d4e66780c0 | 403 | |
IanBenzMaxim | 0:33d4e66780c0 | 404 | |
IanBenzMaxim | 0:33d4e66780c0 | 405 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 406 | - None |
IanBenzMaxim | 0:33d4e66780c0 | 407 | |
IanBenzMaxim | 0:33d4e66780c0 | 408 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 409 | |
IanBenzMaxim | 0:33d4e66780c0 | 410 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 411 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 412 | |
IanBenzMaxim | 0:33d4e66780c0 | 413 | #define _SlFd_t SlFd_t |
IanBenzMaxim | 0:33d4e66780c0 | 414 | |
IanBenzMaxim | 0:33d4e66780c0 | 415 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 416 | \brief Opens an interface communication port to be used for communicating |
IanBenzMaxim | 0:33d4e66780c0 | 417 | with a SimpleLink device |
IanBenzMaxim | 0:33d4e66780c0 | 418 | |
IanBenzMaxim | 0:33d4e66780c0 | 419 | Given an interface name and option flags, this function opens |
IanBenzMaxim | 0:33d4e66780c0 | 420 | the communication port and creates a file descriptor. |
IanBenzMaxim | 0:33d4e66780c0 | 421 | This file descriptor is used afterwards to read and write |
IanBenzMaxim | 0:33d4e66780c0 | 422 | data from and to this specific communication channel. |
IanBenzMaxim | 0:33d4e66780c0 | 423 | The speed, clock polarity, clock phase, chip select and all other |
IanBenzMaxim | 0:33d4e66780c0 | 424 | specific attributes of the channel are all should be set to hardcoded |
IanBenzMaxim | 0:33d4e66780c0 | 425 | in this function. |
IanBenzMaxim | 0:33d4e66780c0 | 426 | |
IanBenzMaxim | 0:33d4e66780c0 | 427 | \param ifName - points to the interface name/path. The interface name is an |
IanBenzMaxim | 0:33d4e66780c0 | 428 | optional attributes that the simple link driver receives |
IanBenzMaxim | 0:33d4e66780c0 | 429 | on opening the driver (sl_Start). |
IanBenzMaxim | 0:33d4e66780c0 | 430 | In systems that the spi channel is not implemented as |
IanBenzMaxim | 0:33d4e66780c0 | 431 | part of the OS device drivers, this parameter could be NULL. |
IanBenzMaxim | 0:33d4e66780c0 | 432 | |
IanBenzMaxim | 0:33d4e66780c0 | 433 | \param flags - optional flags parameters for future use |
IanBenzMaxim | 0:33d4e66780c0 | 434 | |
IanBenzMaxim | 0:33d4e66780c0 | 435 | \return upon successful completion, the function shall open the channel |
IanBenzMaxim | 0:33d4e66780c0 | 436 | and return a non-negative integer representing the file descriptor. |
IanBenzMaxim | 0:33d4e66780c0 | 437 | Otherwise, -1 shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 438 | |
IanBenzMaxim | 0:33d4e66780c0 | 439 | \sa sl_IfClose , sl_IfRead , sl_IfWrite |
IanBenzMaxim | 0:33d4e66780c0 | 440 | |
IanBenzMaxim | 0:33d4e66780c0 | 441 | \note The prototype of the function is as follow: |
IanBenzMaxim | 0:33d4e66780c0 | 442 | Fd_t xxx_IfOpen(char* pIfName , unsigned long flags); |
IanBenzMaxim | 0:33d4e66780c0 | 443 | |
IanBenzMaxim | 0:33d4e66780c0 | 444 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 445 | |
IanBenzMaxim | 0:33d4e66780c0 | 446 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 447 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 448 | #define sl_IfOpen sl_IfOpen |
IanBenzMaxim | 0:33d4e66780c0 | 449 | |
IanBenzMaxim | 0:33d4e66780c0 | 450 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 451 | \brief Closes an opened interface communication port |
IanBenzMaxim | 0:33d4e66780c0 | 452 | |
IanBenzMaxim | 0:33d4e66780c0 | 453 | \param fd - file descriptor of opened communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 454 | |
IanBenzMaxim | 0:33d4e66780c0 | 455 | \return upon successful completion, the function shall return 0. |
IanBenzMaxim | 0:33d4e66780c0 | 456 | Otherwise, -1 shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 457 | |
IanBenzMaxim | 0:33d4e66780c0 | 458 | \sa sl_IfOpen , sl_IfRead , sl_IfWrite |
IanBenzMaxim | 0:33d4e66780c0 | 459 | |
IanBenzMaxim | 0:33d4e66780c0 | 460 | \note The prototype of the function is as follow: |
IanBenzMaxim | 0:33d4e66780c0 | 461 | int xxx_IfClose(Fd_t Fd); |
IanBenzMaxim | 0:33d4e66780c0 | 462 | |
IanBenzMaxim | 0:33d4e66780c0 | 463 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 464 | |
IanBenzMaxim | 0:33d4e66780c0 | 465 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 466 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 467 | #define sl_IfClose sl_IfClose |
IanBenzMaxim | 0:33d4e66780c0 | 468 | |
IanBenzMaxim | 0:33d4e66780c0 | 469 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 470 | \brief Attempts to read up to len bytes from an opened communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 471 | into a buffer starting at pBuff. |
IanBenzMaxim | 0:33d4e66780c0 | 472 | |
IanBenzMaxim | 0:33d4e66780c0 | 473 | \param fd - file descriptor of an opened communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 474 | |
IanBenzMaxim | 0:33d4e66780c0 | 475 | \param pBuff - pointer to the first location of a buffer that contains enough |
IanBenzMaxim | 0:33d4e66780c0 | 476 | space for all expected data |
IanBenzMaxim | 0:33d4e66780c0 | 477 | |
IanBenzMaxim | 0:33d4e66780c0 | 478 | \param len - number of bytes to read from the communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 479 | |
IanBenzMaxim | 0:33d4e66780c0 | 480 | \return upon successful completion, the function shall return the number of read bytes. |
IanBenzMaxim | 0:33d4e66780c0 | 481 | Otherwise, 0 shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 482 | |
IanBenzMaxim | 0:33d4e66780c0 | 483 | \sa sl_IfClose , sl_IfOpen , sl_IfWrite |
IanBenzMaxim | 0:33d4e66780c0 | 484 | |
IanBenzMaxim | 0:33d4e66780c0 | 485 | |
IanBenzMaxim | 0:33d4e66780c0 | 486 | \note The prototype of the function is as follow: |
IanBenzMaxim | 0:33d4e66780c0 | 487 | int xxx_IfRead(Fd_t Fd , char* pBuff , int Len); |
IanBenzMaxim | 0:33d4e66780c0 | 488 | |
IanBenzMaxim | 0:33d4e66780c0 | 489 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 490 | |
IanBenzMaxim | 0:33d4e66780c0 | 491 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 492 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 493 | #define sl_IfRead sl_IfRead |
IanBenzMaxim | 0:33d4e66780c0 | 494 | |
IanBenzMaxim | 0:33d4e66780c0 | 495 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 496 | \brief attempts to write up to len bytes to the SPI channel |
IanBenzMaxim | 0:33d4e66780c0 | 497 | |
IanBenzMaxim | 0:33d4e66780c0 | 498 | \param fd - file descriptor of an opened communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 499 | |
IanBenzMaxim | 0:33d4e66780c0 | 500 | \param pBuff - pointer to the first location of a buffer that contains |
IanBenzMaxim | 0:33d4e66780c0 | 501 | the data to send over the communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 502 | |
IanBenzMaxim | 0:33d4e66780c0 | 503 | \param len - number of bytes to write to the communication channel |
IanBenzMaxim | 0:33d4e66780c0 | 504 | |
IanBenzMaxim | 0:33d4e66780c0 | 505 | \return upon successful completion, the function shall return the number of sent bytes. |
IanBenzMaxim | 0:33d4e66780c0 | 506 | otherwise, 0 shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 507 | |
IanBenzMaxim | 0:33d4e66780c0 | 508 | \sa sl_IfClose , sl_IfOpen , sl_IfRead |
IanBenzMaxim | 0:33d4e66780c0 | 509 | |
IanBenzMaxim | 0:33d4e66780c0 | 510 | \note This function could be implemented as zero copy and return only upon successful completion |
IanBenzMaxim | 0:33d4e66780c0 | 511 | of writing the whole buffer, but in cases that memory allocation is not too tight, the |
IanBenzMaxim | 0:33d4e66780c0 | 512 | function could copy the data to internal buffer, return back and complete the write in |
IanBenzMaxim | 0:33d4e66780c0 | 513 | parallel to other activities as long as the other SPI activities would be blocked until |
IanBenzMaxim | 0:33d4e66780c0 | 514 | the entire buffer write would be completed |
IanBenzMaxim | 0:33d4e66780c0 | 515 | |
IanBenzMaxim | 0:33d4e66780c0 | 516 | The prototype of the function is as follow: |
IanBenzMaxim | 0:33d4e66780c0 | 517 | int xxx_IfWrite(Fd_t Fd , char* pBuff , int Len); |
IanBenzMaxim | 0:33d4e66780c0 | 518 | |
IanBenzMaxim | 0:33d4e66780c0 | 519 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 520 | |
IanBenzMaxim | 0:33d4e66780c0 | 521 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 522 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 523 | #define sl_IfWrite sl_IfWrite |
IanBenzMaxim | 0:33d4e66780c0 | 524 | |
IanBenzMaxim | 0:33d4e66780c0 | 525 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 526 | \brief register an interrupt handler routine for the host IRQ |
IanBenzMaxim | 0:33d4e66780c0 | 527 | |
IanBenzMaxim | 0:33d4e66780c0 | 528 | \param InterruptHdl - pointer to interrupt handler routine |
IanBenzMaxim | 0:33d4e66780c0 | 529 | |
IanBenzMaxim | 0:33d4e66780c0 | 530 | \param pValue - pointer to a memory structure that is passed |
IanBenzMaxim | 0:33d4e66780c0 | 531 | to the interrupt handler. |
IanBenzMaxim | 0:33d4e66780c0 | 532 | |
IanBenzMaxim | 0:33d4e66780c0 | 533 | \return upon successful registration, the function shall return 0. |
IanBenzMaxim | 0:33d4e66780c0 | 534 | Otherwise, -1 shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 535 | |
IanBenzMaxim | 0:33d4e66780c0 | 536 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 537 | |
IanBenzMaxim | 0:33d4e66780c0 | 538 | \note If there is already registered interrupt handler, the function |
IanBenzMaxim | 0:33d4e66780c0 | 539 | should overwrite the old handler with the new one |
IanBenzMaxim | 0:33d4e66780c0 | 540 | |
IanBenzMaxim | 0:33d4e66780c0 | 541 | \note If the handler is a null pointer, the function should un-register the |
IanBenzMaxim | 0:33d4e66780c0 | 542 | interrupt handler, and the interrupts can be disabled. |
IanBenzMaxim | 0:33d4e66780c0 | 543 | |
IanBenzMaxim | 0:33d4e66780c0 | 544 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 545 | |
IanBenzMaxim | 0:33d4e66780c0 | 546 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 547 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 548 | #define sl_IfRegIntHdlr(InterruptHdl , pValue) sl_IfRegIntHdlr(InterruptHdl , pValue) |
IanBenzMaxim | 0:33d4e66780c0 | 549 | |
IanBenzMaxim | 0:33d4e66780c0 | 550 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 551 | \brief Masks the Host IRQ |
IanBenzMaxim | 0:33d4e66780c0 | 552 | |
IanBenzMaxim | 0:33d4e66780c0 | 553 | \sa sl_IfUnMaskIntHdlr |
IanBenzMaxim | 0:33d4e66780c0 | 554 | |
IanBenzMaxim | 0:33d4e66780c0 | 555 | |
IanBenzMaxim | 0:33d4e66780c0 | 556 | |
IanBenzMaxim | 0:33d4e66780c0 | 557 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 558 | |
IanBenzMaxim | 0:33d4e66780c0 | 559 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 560 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 561 | #define sl_IfMaskIntHdlr() |
IanBenzMaxim | 0:33d4e66780c0 | 562 | |
IanBenzMaxim | 0:33d4e66780c0 | 563 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 564 | \brief Unmasks the Host IRQ |
IanBenzMaxim | 0:33d4e66780c0 | 565 | |
IanBenzMaxim | 0:33d4e66780c0 | 566 | \sa sl_IfMaskIntHdlr |
IanBenzMaxim | 0:33d4e66780c0 | 567 | |
IanBenzMaxim | 0:33d4e66780c0 | 568 | |
IanBenzMaxim | 0:33d4e66780c0 | 569 | |
IanBenzMaxim | 0:33d4e66780c0 | 570 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 571 | |
IanBenzMaxim | 0:33d4e66780c0 | 572 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 573 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 574 | #define sl_IfUnMaskIntHdlr() |
IanBenzMaxim | 0:33d4e66780c0 | 575 | |
IanBenzMaxim | 0:33d4e66780c0 | 576 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 577 | \brief Write Handers for statistics debug on write |
IanBenzMaxim | 0:33d4e66780c0 | 578 | |
IanBenzMaxim | 0:33d4e66780c0 | 579 | \param interface handler - pointer to interrupt handler routine |
IanBenzMaxim | 0:33d4e66780c0 | 580 | |
IanBenzMaxim | 0:33d4e66780c0 | 581 | |
IanBenzMaxim | 0:33d4e66780c0 | 582 | \return no return value |
IanBenzMaxim | 0:33d4e66780c0 | 583 | |
IanBenzMaxim | 0:33d4e66780c0 | 584 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 585 | |
IanBenzMaxim | 0:33d4e66780c0 | 586 | \note An optional hooks for monitoring before and after write info |
IanBenzMaxim | 0:33d4e66780c0 | 587 | |
IanBenzMaxim | 0:33d4e66780c0 | 588 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 589 | |
IanBenzMaxim | 0:33d4e66780c0 | 590 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 591 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 592 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 593 | #define SL_START_WRITE_STAT |
IanBenzMaxim | 0:33d4e66780c0 | 594 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 595 | |
IanBenzMaxim | 0:33d4e66780c0 | 596 | #ifdef SL_START_WRITE_STAT |
IanBenzMaxim | 0:33d4e66780c0 | 597 | #define sl_IfStartWriteSequence |
IanBenzMaxim | 0:33d4e66780c0 | 598 | #define sl_IfEndWriteSequence |
IanBenzMaxim | 0:33d4e66780c0 | 599 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 600 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 601 | |
IanBenzMaxim | 0:33d4e66780c0 | 602 | Close the Doxygen group. |
IanBenzMaxim | 0:33d4e66780c0 | 603 | @} |
IanBenzMaxim | 0:33d4e66780c0 | 604 | |
IanBenzMaxim | 0:33d4e66780c0 | 605 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 606 | |
IanBenzMaxim | 0:33d4e66780c0 | 607 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 608 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 609 | |
IanBenzMaxim | 0:33d4e66780c0 | 610 | \defgroup porting_mem_mgm Memory Management |
IanBenzMaxim | 0:33d4e66780c0 | 611 | |
IanBenzMaxim | 0:33d4e66780c0 | 612 | This section declare in which memory management model the SimpleLink driver |
IanBenzMaxim | 0:33d4e66780c0 | 613 | will run: |
IanBenzMaxim | 0:33d4e66780c0 | 614 | -# Static |
IanBenzMaxim | 0:33d4e66780c0 | 615 | -# Dynamic |
IanBenzMaxim | 0:33d4e66780c0 | 616 | |
IanBenzMaxim | 0:33d4e66780c0 | 617 | This section IS NOT REQUIRED in case Static model is selected. |
IanBenzMaxim | 0:33d4e66780c0 | 618 | |
IanBenzMaxim | 0:33d4e66780c0 | 619 | The default memory model is Static |
IanBenzMaxim | 0:33d4e66780c0 | 620 | |
IanBenzMaxim | 0:33d4e66780c0 | 621 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 622 | - If dynamic model is selected, define the alloc and free functions. |
IanBenzMaxim | 0:33d4e66780c0 | 623 | |
IanBenzMaxim | 0:33d4e66780c0 | 624 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 625 | |
IanBenzMaxim | 0:33d4e66780c0 | 626 | ***************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 627 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 628 | |
IanBenzMaxim | 0:33d4e66780c0 | 629 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 630 | \brief Defines whether the SimpleLink driver is working in dynamic |
IanBenzMaxim | 0:33d4e66780c0 | 631 | memory model or not |
IanBenzMaxim | 0:33d4e66780c0 | 632 | |
IanBenzMaxim | 0:33d4e66780c0 | 633 | When defined, the SimpleLink driver use dynamic allocations |
IanBenzMaxim | 0:33d4e66780c0 | 634 | if dynamic allocation is selected malloc and free functions |
IanBenzMaxim | 0:33d4e66780c0 | 635 | must be retrieved |
IanBenzMaxim | 0:33d4e66780c0 | 636 | |
IanBenzMaxim | 0:33d4e66780c0 | 637 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 638 | |
IanBenzMaxim | 0:33d4e66780c0 | 639 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 640 | |
IanBenzMaxim | 0:33d4e66780c0 | 641 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 642 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 643 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 644 | #define SL_MEMORY_MGMT_DYNAMIC |
IanBenzMaxim | 0:33d4e66780c0 | 645 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 646 | |
IanBenzMaxim | 0:33d4e66780c0 | 647 | #ifdef SL_MEMORY_MGMT_DYNAMIC |
IanBenzMaxim | 0:33d4e66780c0 | 648 | |
IanBenzMaxim | 0:33d4e66780c0 | 649 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 650 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 651 | |
IanBenzMaxim | 0:33d4e66780c0 | 652 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 653 | |
IanBenzMaxim | 0:33d4e66780c0 | 654 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 655 | |
IanBenzMaxim | 0:33d4e66780c0 | 656 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 657 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 658 | #define sl_Malloc(Size) malloc(Size) |
IanBenzMaxim | 0:33d4e66780c0 | 659 | |
IanBenzMaxim | 0:33d4e66780c0 | 660 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 661 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 662 | |
IanBenzMaxim | 0:33d4e66780c0 | 663 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 664 | |
IanBenzMaxim | 0:33d4e66780c0 | 665 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 666 | |
IanBenzMaxim | 0:33d4e66780c0 | 667 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 668 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 669 | #define sl_Free(pMem) free(pMem) |
IanBenzMaxim | 0:33d4e66780c0 | 670 | |
IanBenzMaxim | 0:33d4e66780c0 | 671 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 672 | |
IanBenzMaxim | 0:33d4e66780c0 | 673 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 674 | |
IanBenzMaxim | 0:33d4e66780c0 | 675 | Close the Doxygen group. |
IanBenzMaxim | 0:33d4e66780c0 | 676 | @} |
IanBenzMaxim | 0:33d4e66780c0 | 677 | |
IanBenzMaxim | 0:33d4e66780c0 | 678 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 679 | |
IanBenzMaxim | 0:33d4e66780c0 | 680 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 681 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 682 | |
IanBenzMaxim | 0:33d4e66780c0 | 683 | \defgroup porting_os Operating System (OS) |
IanBenzMaxim | 0:33d4e66780c0 | 684 | |
IanBenzMaxim | 0:33d4e66780c0 | 685 | The simple link driver can run on multi-threaded environment as well |
IanBenzMaxim | 0:33d4e66780c0 | 686 | as non-os environment (main loop) |
IanBenzMaxim | 0:33d4e66780c0 | 687 | |
IanBenzMaxim | 0:33d4e66780c0 | 688 | This section IS NOT REQUIRED in case you are working on non-os environment. |
IanBenzMaxim | 0:33d4e66780c0 | 689 | |
IanBenzMaxim | 0:33d4e66780c0 | 690 | If you choose to work in multi-threaded environment under any operating system |
IanBenzMaxim | 0:33d4e66780c0 | 691 | you will have to provide some basic adaptation routines to allow the driver |
IanBenzMaxim | 0:33d4e66780c0 | 692 | to protect access to resources from different threads (locking object) and |
IanBenzMaxim | 0:33d4e66780c0 | 693 | to allow synchronization between threads (sync objects). |
IanBenzMaxim | 0:33d4e66780c0 | 694 | |
IanBenzMaxim | 0:33d4e66780c0 | 695 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 696 | -# Uncomment SL_PLATFORM_MULTI_THREADED define |
IanBenzMaxim | 0:33d4e66780c0 | 697 | -# Bind locking object routines |
IanBenzMaxim | 0:33d4e66780c0 | 698 | -# Bind synchronization object routines |
IanBenzMaxim | 0:33d4e66780c0 | 699 | -# Optional - Bind spawn thread routine |
IanBenzMaxim | 0:33d4e66780c0 | 700 | |
IanBenzMaxim | 0:33d4e66780c0 | 701 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 702 | |
IanBenzMaxim | 0:33d4e66780c0 | 703 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 704 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 705 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 706 | #define SL_PLATFORM_MULTI_THREADED |
IanBenzMaxim | 0:33d4e66780c0 | 707 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 708 | |
IanBenzMaxim | 0:33d4e66780c0 | 709 | #ifdef SL_PLATFORM_MULTI_THREADED |
IanBenzMaxim | 0:33d4e66780c0 | 710 | |
IanBenzMaxim | 0:33d4e66780c0 | 711 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 712 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 713 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 714 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 715 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 716 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 717 | #define SL_OS_RET_CODE_OK ((int)OSI_OK) |
IanBenzMaxim | 0:33d4e66780c0 | 718 | |
IanBenzMaxim | 0:33d4e66780c0 | 719 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 720 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 721 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 722 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 723 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 724 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 725 | #define SL_OS_WAIT_FOREVER ((OsiTime_t)OSI_WAIT_FOREVER) |
IanBenzMaxim | 0:33d4e66780c0 | 726 | |
IanBenzMaxim | 0:33d4e66780c0 | 727 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 728 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 729 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 730 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 731 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 732 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 733 | #define SL_OS_NO_WAIT ((OsiTime_t)OSI_NO_WAIT) |
IanBenzMaxim | 0:33d4e66780c0 | 734 | |
IanBenzMaxim | 0:33d4e66780c0 | 735 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 736 | \brief type definition for a time value |
IanBenzMaxim | 0:33d4e66780c0 | 737 | |
IanBenzMaxim | 0:33d4e66780c0 | 738 | \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc. |
IanBenzMaxim | 0:33d4e66780c0 | 739 | |
IanBenzMaxim | 0:33d4e66780c0 | 740 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 741 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 742 | #define _SlTime_t |
IanBenzMaxim | 0:33d4e66780c0 | 743 | |
IanBenzMaxim | 0:33d4e66780c0 | 744 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 745 | \brief type definition for a sync object container |
IanBenzMaxim | 0:33d4e66780c0 | 746 | |
IanBenzMaxim | 0:33d4e66780c0 | 747 | Sync object is object used to synchronize between two threads or thread and interrupt handler. |
IanBenzMaxim | 0:33d4e66780c0 | 748 | One thread is waiting on the object and the other thread send a signal, which then |
IanBenzMaxim | 0:33d4e66780c0 | 749 | release the waiting thread. |
IanBenzMaxim | 0:33d4e66780c0 | 750 | The signal must be able to be sent from interrupt context. |
IanBenzMaxim | 0:33d4e66780c0 | 751 | This object is generally implemented by binary semaphore or events. |
IanBenzMaxim | 0:33d4e66780c0 | 752 | |
IanBenzMaxim | 0:33d4e66780c0 | 753 | \note On each porting or platform the type could be whatever is needed - integer, structure etc. |
IanBenzMaxim | 0:33d4e66780c0 | 754 | |
IanBenzMaxim | 0:33d4e66780c0 | 755 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 756 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 757 | #define _SlSyncObj_t |
IanBenzMaxim | 0:33d4e66780c0 | 758 | |
IanBenzMaxim | 0:33d4e66780c0 | 759 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 760 | \brief This function creates a sync object |
IanBenzMaxim | 0:33d4e66780c0 | 761 | |
IanBenzMaxim | 0:33d4e66780c0 | 762 | The sync object is used for synchronization between different thread or ISR and |
IanBenzMaxim | 0:33d4e66780c0 | 763 | a thread. |
IanBenzMaxim | 0:33d4e66780c0 | 764 | |
IanBenzMaxim | 0:33d4e66780c0 | 765 | \param pSyncObj - pointer to the sync object control block |
IanBenzMaxim | 0:33d4e66780c0 | 766 | |
IanBenzMaxim | 0:33d4e66780c0 | 767 | \return upon successful creation the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 768 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 769 | |
IanBenzMaxim | 0:33d4e66780c0 | 770 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 771 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 772 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 773 | #define sl_SyncObjCreate(pSyncObj,pName) |
IanBenzMaxim | 0:33d4e66780c0 | 774 | |
IanBenzMaxim | 0:33d4e66780c0 | 775 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 776 | \brief This function deletes a sync object |
IanBenzMaxim | 0:33d4e66780c0 | 777 | |
IanBenzMaxim | 0:33d4e66780c0 | 778 | \param pSyncObj - pointer to the sync object control block |
IanBenzMaxim | 0:33d4e66780c0 | 779 | |
IanBenzMaxim | 0:33d4e66780c0 | 780 | \return upon successful deletion the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 781 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 782 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 783 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 784 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 785 | #define sl_SyncObjDelete(pSyncObj) |
IanBenzMaxim | 0:33d4e66780c0 | 786 | |
IanBenzMaxim | 0:33d4e66780c0 | 787 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 788 | \brief This function generates a sync signal for the object. |
IanBenzMaxim | 0:33d4e66780c0 | 789 | |
IanBenzMaxim | 0:33d4e66780c0 | 790 | All suspended threads waiting on this sync object are resumed |
IanBenzMaxim | 0:33d4e66780c0 | 791 | |
IanBenzMaxim | 0:33d4e66780c0 | 792 | \param pSyncObj - pointer to the sync object control block |
IanBenzMaxim | 0:33d4e66780c0 | 793 | |
IanBenzMaxim | 0:33d4e66780c0 | 794 | \return upon successful signalling the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 795 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 796 | \note the function could be called from ISR context |
IanBenzMaxim | 0:33d4e66780c0 | 797 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 798 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 799 | #define sl_SyncObjSignal(pSyncObj) |
IanBenzMaxim | 0:33d4e66780c0 | 800 | |
IanBenzMaxim | 0:33d4e66780c0 | 801 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 802 | \brief This function generates a sync signal for the object from Interrupt |
IanBenzMaxim | 0:33d4e66780c0 | 803 | |
IanBenzMaxim | 0:33d4e66780c0 | 804 | This is for RTOS that should signal from IRQ using a dedicated API |
IanBenzMaxim | 0:33d4e66780c0 | 805 | |
IanBenzMaxim | 0:33d4e66780c0 | 806 | \param pSyncObj - pointer to the sync object control block |
IanBenzMaxim | 0:33d4e66780c0 | 807 | |
IanBenzMaxim | 0:33d4e66780c0 | 808 | \return upon successful signalling the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 809 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 810 | \note the function could be called from ISR context |
IanBenzMaxim | 0:33d4e66780c0 | 811 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 812 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 813 | #define sl_SyncObjSignalFromIRQ(pSyncObj) |
IanBenzMaxim | 0:33d4e66780c0 | 814 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 815 | \brief This function waits for a sync signal of the specific sync object |
IanBenzMaxim | 0:33d4e66780c0 | 816 | |
IanBenzMaxim | 0:33d4e66780c0 | 817 | \param pSyncObj - pointer to the sync object control block |
IanBenzMaxim | 0:33d4e66780c0 | 818 | \param Timeout - numeric value specifies the maximum number of mSec to |
IanBenzMaxim | 0:33d4e66780c0 | 819 | stay suspended while waiting for the sync signal |
IanBenzMaxim | 0:33d4e66780c0 | 820 | Currently, the simple link driver uses only two values: |
IanBenzMaxim | 0:33d4e66780c0 | 821 | - OSI_WAIT_FOREVER |
IanBenzMaxim | 0:33d4e66780c0 | 822 | - OSI_NO_WAIT |
IanBenzMaxim | 0:33d4e66780c0 | 823 | |
IanBenzMaxim | 0:33d4e66780c0 | 824 | \return upon successful reception of the signal within the timeout window return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 825 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 826 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 827 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 828 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 829 | #define sl_SyncObjWait(pSyncObj,Timeout) |
IanBenzMaxim | 0:33d4e66780c0 | 830 | |
IanBenzMaxim | 0:33d4e66780c0 | 831 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 832 | \brief type definition for a locking object container |
IanBenzMaxim | 0:33d4e66780c0 | 833 | |
IanBenzMaxim | 0:33d4e66780c0 | 834 | Locking object are used to protect a resource from mutual accesses of two or more threads. |
IanBenzMaxim | 0:33d4e66780c0 | 835 | The locking object should support reentrant locks by a signal thread. |
IanBenzMaxim | 0:33d4e66780c0 | 836 | This object is generally implemented by mutex semaphore |
IanBenzMaxim | 0:33d4e66780c0 | 837 | |
IanBenzMaxim | 0:33d4e66780c0 | 838 | \note On each porting or platform the type could be whatever is needed - integer, structure etc. |
IanBenzMaxim | 0:33d4e66780c0 | 839 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 840 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 841 | #define _SlLockObj_t |
IanBenzMaxim | 0:33d4e66780c0 | 842 | |
IanBenzMaxim | 0:33d4e66780c0 | 843 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 844 | \brief This function creates a locking object. |
IanBenzMaxim | 0:33d4e66780c0 | 845 | |
IanBenzMaxim | 0:33d4e66780c0 | 846 | The locking object is used for protecting a shared resources between different |
IanBenzMaxim | 0:33d4e66780c0 | 847 | threads. |
IanBenzMaxim | 0:33d4e66780c0 | 848 | |
IanBenzMaxim | 0:33d4e66780c0 | 849 | \param pLockObj - pointer to the locking object control block |
IanBenzMaxim | 0:33d4e66780c0 | 850 | |
IanBenzMaxim | 0:33d4e66780c0 | 851 | \return upon successful creation the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 852 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 853 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 854 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 855 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 856 | #define sl_LockObjCreate(pLockObj,pName) |
IanBenzMaxim | 0:33d4e66780c0 | 857 | |
IanBenzMaxim | 0:33d4e66780c0 | 858 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 859 | \brief This function deletes a locking object. |
IanBenzMaxim | 0:33d4e66780c0 | 860 | |
IanBenzMaxim | 0:33d4e66780c0 | 861 | \param pLockObj - pointer to the locking object control block |
IanBenzMaxim | 0:33d4e66780c0 | 862 | |
IanBenzMaxim | 0:33d4e66780c0 | 863 | \return upon successful deletion the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 864 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 865 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 866 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 867 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 868 | #define sl_LockObjDelete(pLockObj) |
IanBenzMaxim | 0:33d4e66780c0 | 869 | |
IanBenzMaxim | 0:33d4e66780c0 | 870 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 871 | \brief This function locks a locking object. |
IanBenzMaxim | 0:33d4e66780c0 | 872 | |
IanBenzMaxim | 0:33d4e66780c0 | 873 | All other threads that call this function before this thread calls |
IanBenzMaxim | 0:33d4e66780c0 | 874 | the osi_LockObjUnlock would be suspended |
IanBenzMaxim | 0:33d4e66780c0 | 875 | |
IanBenzMaxim | 0:33d4e66780c0 | 876 | \param pLockObj - pointer to the locking object control block |
IanBenzMaxim | 0:33d4e66780c0 | 877 | \param Timeout - numeric value specifies the maximum number of mSec to |
IanBenzMaxim | 0:33d4e66780c0 | 878 | stay suspended while waiting for the locking object |
IanBenzMaxim | 0:33d4e66780c0 | 879 | Currently, the simple link driver uses only two values: |
IanBenzMaxim | 0:33d4e66780c0 | 880 | - OSI_WAIT_FOREVER |
IanBenzMaxim | 0:33d4e66780c0 | 881 | - OSI_NO_WAIT |
IanBenzMaxim | 0:33d4e66780c0 | 882 | |
IanBenzMaxim | 0:33d4e66780c0 | 883 | |
IanBenzMaxim | 0:33d4e66780c0 | 884 | \return upon successful reception of the locking object the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 885 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 886 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 887 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 888 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 889 | #define sl_LockObjLock(pLockObj,Timeout) |
IanBenzMaxim | 0:33d4e66780c0 | 890 | |
IanBenzMaxim | 0:33d4e66780c0 | 891 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 892 | \brief This function unlock a locking object. |
IanBenzMaxim | 0:33d4e66780c0 | 893 | |
IanBenzMaxim | 0:33d4e66780c0 | 894 | \param pLockObj - pointer to the locking object control block |
IanBenzMaxim | 0:33d4e66780c0 | 895 | |
IanBenzMaxim | 0:33d4e66780c0 | 896 | \return upon successful unlocking the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 897 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 898 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 899 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 900 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 901 | #define sl_LockObjUnlock(pLockObj) |
IanBenzMaxim | 0:33d4e66780c0 | 902 | |
IanBenzMaxim | 0:33d4e66780c0 | 903 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 904 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 905 | \brief This function call the pEntry callback from a different context |
IanBenzMaxim | 0:33d4e66780c0 | 906 | |
IanBenzMaxim | 0:33d4e66780c0 | 907 | \param pEntry - pointer to the entry callback function |
IanBenzMaxim | 0:33d4e66780c0 | 908 | |
IanBenzMaxim | 0:33d4e66780c0 | 909 | \param pValue - pointer to any type of memory structure that would be |
IanBenzMaxim | 0:33d4e66780c0 | 910 | passed to pEntry callback from the execution thread. |
IanBenzMaxim | 0:33d4e66780c0 | 911 | |
IanBenzMaxim | 0:33d4e66780c0 | 912 | \param flags - execution flags - reserved for future usage |
IanBenzMaxim | 0:33d4e66780c0 | 913 | |
IanBenzMaxim | 0:33d4e66780c0 | 914 | \return upon successful registration of the spawn the function should return 0 |
IanBenzMaxim | 0:33d4e66780c0 | 915 | (the function is not blocked till the end of the execution of the function |
IanBenzMaxim | 0:33d4e66780c0 | 916 | and could be returned before the execution is actually completed) |
IanBenzMaxim | 0:33d4e66780c0 | 917 | Otherwise, a negative value indicating the error code shall be returned |
IanBenzMaxim | 0:33d4e66780c0 | 918 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 919 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 920 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 921 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 922 | #define SL_PLATFORM_EXTERNAL_SPAWN |
IanBenzMaxim | 0:33d4e66780c0 | 923 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 924 | |
IanBenzMaxim | 0:33d4e66780c0 | 925 | #ifdef SL_PLATFORM_EXTERNAL_SPAWN |
IanBenzMaxim | 0:33d4e66780c0 | 926 | #define sl_Spawn(pEntry,pValue,flags) |
IanBenzMaxim | 0:33d4e66780c0 | 927 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 928 | |
IanBenzMaxim | 0:33d4e66780c0 | 929 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 930 | |
IanBenzMaxim | 0:33d4e66780c0 | 931 | Close the Doxygen group. |
IanBenzMaxim | 0:33d4e66780c0 | 932 | @} |
IanBenzMaxim | 0:33d4e66780c0 | 933 | |
IanBenzMaxim | 0:33d4e66780c0 | 934 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 935 | |
IanBenzMaxim | 0:33d4e66780c0 | 936 | |
IanBenzMaxim | 0:33d4e66780c0 | 937 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 938 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 939 | |
IanBenzMaxim | 0:33d4e66780c0 | 940 | \defgroup porting_events Event Handlers |
IanBenzMaxim | 0:33d4e66780c0 | 941 | |
IanBenzMaxim | 0:33d4e66780c0 | 942 | This section includes the asynchronous event handlers routines |
IanBenzMaxim | 0:33d4e66780c0 | 943 | |
IanBenzMaxim | 0:33d4e66780c0 | 944 | PORTING ACTION: |
IanBenzMaxim | 0:33d4e66780c0 | 945 | -Uncomment the required handler and define your routine as the value |
IanBenzMaxim | 0:33d4e66780c0 | 946 | of this handler |
IanBenzMaxim | 0:33d4e66780c0 | 947 | |
IanBenzMaxim | 0:33d4e66780c0 | 948 | @{ |
IanBenzMaxim | 0:33d4e66780c0 | 949 | |
IanBenzMaxim | 0:33d4e66780c0 | 950 | ****************************************************************************** |
IanBenzMaxim | 0:33d4e66780c0 | 951 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 952 | |
IanBenzMaxim | 0:33d4e66780c0 | 953 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 954 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 955 | |
IanBenzMaxim | 0:33d4e66780c0 | 956 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 957 | |
IanBenzMaxim | 0:33d4e66780c0 | 958 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 959 | |
IanBenzMaxim | 0:33d4e66780c0 | 960 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 961 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 962 | #define sl_GeneralEvtHdlr SimpleLinkGeneralEventHandler |
IanBenzMaxim | 0:33d4e66780c0 | 963 | |
IanBenzMaxim | 0:33d4e66780c0 | 964 | |
IanBenzMaxim | 0:33d4e66780c0 | 965 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 966 | \brief An event handler for WLAN connection or disconnection indication |
IanBenzMaxim | 0:33d4e66780c0 | 967 | This event handles async WLAN events. |
IanBenzMaxim | 0:33d4e66780c0 | 968 | Possible events are: |
IanBenzMaxim | 0:33d4e66780c0 | 969 | SL_WLAN_CONNECT_EVENT - indicates WLAN is connected |
IanBenzMaxim | 0:33d4e66780c0 | 970 | SL_WLAN_DISCONNECT_EVENT - indicates WLAN is disconnected |
IanBenzMaxim | 0:33d4e66780c0 | 971 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 972 | |
IanBenzMaxim | 0:33d4e66780c0 | 973 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 974 | |
IanBenzMaxim | 0:33d4e66780c0 | 975 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 976 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 977 | #define sl_WlanEvtHdlr SimpleLinkWlanEventHandler |
IanBenzMaxim | 0:33d4e66780c0 | 978 | |
IanBenzMaxim | 0:33d4e66780c0 | 979 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 980 | \brief An event handler for IP address asynchronous event. Usually accepted after new WLAN connection. |
IanBenzMaxim | 0:33d4e66780c0 | 981 | This event handles networking events. |
IanBenzMaxim | 0:33d4e66780c0 | 982 | Possible events are: |
IanBenzMaxim | 0:33d4e66780c0 | 983 | SL_NETAPP_IPV4_ACQUIRED - IP address was acquired (DHCP or Static) |
IanBenzMaxim | 0:33d4e66780c0 | 984 | |
IanBenzMaxim | 0:33d4e66780c0 | 985 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 986 | |
IanBenzMaxim | 0:33d4e66780c0 | 987 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 988 | |
IanBenzMaxim | 0:33d4e66780c0 | 989 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 990 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 991 | #define sl_NetAppEvtHdlr SimpleLinkNetAppEventHandler |
IanBenzMaxim | 0:33d4e66780c0 | 992 | |
IanBenzMaxim | 0:33d4e66780c0 | 993 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 994 | \brief A callback for HTTP server events. |
IanBenzMaxim | 0:33d4e66780c0 | 995 | Possible events are: |
IanBenzMaxim | 0:33d4e66780c0 | 996 | SL_NETAPP_HTTPGETTOKENVALUE - NWP requests to get the value of a specific token |
IanBenzMaxim | 0:33d4e66780c0 | 997 | SL_NETAPP_HTTPPOSTTOKENVALUE - NWP post to the host a new value for a specific token |
IanBenzMaxim | 0:33d4e66780c0 | 998 | |
IanBenzMaxim | 0:33d4e66780c0 | 999 | \param pServerEvent - Contains the relevant event information (SL_NETAPP_HTTPGETTOKENVALUE or SL_NETAPP_HTTPPOSTTOKENVALUE) |
IanBenzMaxim | 0:33d4e66780c0 | 1000 | |
IanBenzMaxim | 0:33d4e66780c0 | 1001 | \param pServerResponse - Should be filled by the user with the relevant response information (i.e SL_NETAPP_HTTPSETTOKENVALUE as a response to SL_NETAPP_HTTPGETTOKENVALUE event) |
IanBenzMaxim | 0:33d4e66780c0 | 1002 | |
IanBenzMaxim | 0:33d4e66780c0 | 1003 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 1004 | |
IanBenzMaxim | 0:33d4e66780c0 | 1005 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 1006 | |
IanBenzMaxim | 0:33d4e66780c0 | 1007 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 1008 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 1009 | //#define sl_HttpServerCallback SimpleLinkHttpServerCallback |
IanBenzMaxim | 0:33d4e66780c0 | 1010 | |
IanBenzMaxim | 0:33d4e66780c0 | 1011 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 1012 | \brief |
IanBenzMaxim | 0:33d4e66780c0 | 1013 | |
IanBenzMaxim | 0:33d4e66780c0 | 1014 | \sa |
IanBenzMaxim | 0:33d4e66780c0 | 1015 | |
IanBenzMaxim | 0:33d4e66780c0 | 1016 | \note belongs to \ref porting_sec |
IanBenzMaxim | 0:33d4e66780c0 | 1017 | |
IanBenzMaxim | 0:33d4e66780c0 | 1018 | \warning |
IanBenzMaxim | 0:33d4e66780c0 | 1019 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 1020 | #define sl_SockEvtHdlr SimpleLinkSockEventHandler |
IanBenzMaxim | 0:33d4e66780c0 | 1021 | |
IanBenzMaxim | 0:33d4e66780c0 | 1022 | |
IanBenzMaxim | 0:33d4e66780c0 | 1023 | |
IanBenzMaxim | 0:33d4e66780c0 | 1024 | /*! |
IanBenzMaxim | 0:33d4e66780c0 | 1025 | |
IanBenzMaxim | 0:33d4e66780c0 | 1026 | Close the Doxygen group. |
IanBenzMaxim | 0:33d4e66780c0 | 1027 | @} |
IanBenzMaxim | 0:33d4e66780c0 | 1028 | |
IanBenzMaxim | 0:33d4e66780c0 | 1029 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 1030 | |
IanBenzMaxim | 0:33d4e66780c0 | 1031 | |
IanBenzMaxim | 0:33d4e66780c0 | 1032 | #ifdef __cplusplus |
IanBenzMaxim | 0:33d4e66780c0 | 1033 | } |
IanBenzMaxim | 0:33d4e66780c0 | 1034 | #endif /* __cplusplus */ |
IanBenzMaxim | 0:33d4e66780c0 | 1035 | |
IanBenzMaxim | 0:33d4e66780c0 | 1036 | #endif /* __USER_H__ */ |
IanBenzMaxim | 0:33d4e66780c0 | 1037 |