TI's CC3100. A test demo with very little testing done!

Dependencies:   mbed

Fork of cc3100_Test_Demo2 by 高 杨

Committer:
dflet
Date:
Thu Mar 19 15:39:08 2015 +0000
Revision:
6:778b081f6a13
Updated to CC3100SDK1.1.0

Who changed what in which revision?

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