Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.

Dependencies:   mbed

Committer:
dflet
Date:
Wed Jun 24 09:54:16 2015 +0000
Revision:
0:50cedd586816
Child:
19:3dd3e7f30f8b
First commit work in progress

Who changed what in which revision?

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