Updated to use external spawn.

Fork of simplelink_V2 by David Fletcher

Committer:
dflet
Date:
Sat Jun 06 13:48:29 2015 +0000
Revision:
1:9b68e650b3f6
Parent:
0:1a07906111ec
Oppps

Who changed what in which revision?

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