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

Dependencies:   mbed

Fork of cc3100_Test_Demo2 by 高 杨

Committer:
dflet
Date:
Sun Feb 15 11:01:37 2015 +0000
Revision:
2:b3fd5b3d9860
Parent:
0:e89ba455dbcf
Removed more debug comments, defined sl_Free & sl_Malloc. Also remove some duplicate #defines

Who changed what in which revision?

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