Update revision to use TI's mqtt and Freertos.
Dependencies: mbed client server
Fork of cc3100_Test_mqtt_CM3 by
cc3100_user.h
00001 /* 00002 * user.h - CC31xx/CC32xx Host Driver Implementation 00003 * 00004 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 00038 #ifndef USER_H_ 00039 #define USER_H_ 00040 00041 /*! 00042 00043 \addtogroup Porting 00044 @{ 00045 00046 */ 00047 00048 /*! 00049 ****************************************************************************** 00050 00051 \defgroup porting_user_include User Include Files 00052 00053 This section IS NOT REQUIRED in case user provided primitives are handled 00054 in makefiles or project configurations (IDE) 00055 00056 PORTING ACTION: 00057 - Include all required header files for the definition of: 00058 -# Transport layer library API (e.g. SPI, UART) 00059 -# OS primitives definitions (e.g. Task spawn, Semaphores) 00060 -# Memory management primitives (e.g. alloc, free) 00061 00062 ****************************************************************************** 00063 */ 00064 00065 #include <string.h> 00066 00067 #ifndef SL_IF_TYPE_UART 00068 #include "cc3100_spi.h" 00069 #else 00070 #include "uart.h" 00071 #endif 00072 00073 00074 /*! 00075 ****************************************************************************** 00076 00077 \defgroup porting_capabilities Capability Set Definition 00078 00079 This section IS NOT REQUIRED in case one of the following pre defined 00080 capabilities set is in use: 00081 - SL_TINY 00082 - SL_SMALL 00083 - SL_FULL 00084 00085 PORTING ACTION: 00086 - Define one of the pre-defined capabilities set or uncomment the 00087 relevant definitions below to select the required capabilities 00088 in order to "install" external SimpleLink library one should follow the next steps: 00089 1. Include the external library API header file (i.e. #include "IOT.h") 00090 2. Define each one of the desired external lib with one (out of 5) of the following: 00091 #define SL_EXT_LIB_1 <Your external lib name> 00092 #define SL_EXT_LIB_2 <Your external lib name> 00093 #define SL_EXT_LIB_3 <Your external lib name> 00094 #define SL_EXT_LIB_4 <Your external lib name> 00095 #define SL_EXT_LIB_5 <Your external lib name> 00096 @{ 00097 ******************************************************************************* 00098 */ 00099 00100 #define SL_FULL 00101 00102 /*! 00103 \def MAX_CONCURRENT_ACTIONS 00104 00105 \brief Defines the maximum number of concurrent action in the system 00106 Min:1 , Max: 32 00107 00108 Actions which has async events as return, can be 00109 00110 \sa 00111 00112 \note In case there are not enough resources for the actions needed in the system, 00113 error is received: POOL_IS_EMPTY 00114 one option is to increase MAX_CONCURRENT_ACTIONS 00115 (improves performance but results in memory consumption) 00116 Other option is to call the API later (decrease performance) 00117 00118 \warning In case of setting to one, recommend to use non-blocking recv\recvfrom to allow 00119 multiple socket recv 00120 */ 00121 #ifndef SL_TINY_EXT 00122 #define MAX_CONCURRENT_ACTIONS 10 00123 #else 00124 #define MAX_CONCURRENT_ACTIONS 1 00125 #endif 00126 00127 /*! 00128 \def CPU_FREQ_IN_MHZ 00129 \brief Defines CPU frequency for Host side, for better accuracy of busy loops, if any 00130 \sa 00131 \note 00132 00133 \warning If not set the default CPU frequency is set to 200MHz 00134 This option will be deprecated in future release 00135 */ 00136 /* 00137 #define CPU_FREQ_IN_MHZ 25 00138 */ 00139 00140 00141 /*! 00142 \def SL_INC_ARG_CHECK 00143 00144 \brief Defines whether the SimpleLink driver perform argument check 00145 or not 00146 00147 When defined, the SimpleLink driver perform argument check on 00148 function call. Removing this define could reduce some code 00149 size and improve slightly the performances but may impact in 00150 unpredictable behaviour in case of invalid arguments 00151 00152 \sa 00153 00154 \note belongs to \ref porting_sec 00155 00156 \warning Removing argument check may cause unpredictable behaviour in 00157 case of invalid arguments. 00158 In this case the user is responsible to argument validity 00159 (for example all handlers must not be NULL) 00160 */ 00161 #define SL_INC_ARG_CHECK 00162 00163 00164 /*! 00165 \def SL_INC_STD_BSD_API_NAMING 00166 00167 \brief Defines whether SimpleLink driver should expose standard BSD 00168 APIs or not 00169 00170 When defined, the SimpleLink driver in addition to its alternative 00171 BSD APIs expose also standard BSD APIs. 00172 Standard BSD API includes the following functions: 00173 socket , close , accept , bind , listen , connect , select , 00174 setsockopt , getsockopt , recv , recvfrom , write , send , sendto , 00175 gethostbyname 00176 00177 \sa 00178 00179 \note belongs to \ref porting_sec 00180 00181 \warning 00182 */ 00183 00184 #define SL_INC_STD_BSD_API_NAMING 00185 00186 00187 /*! 00188 \brief Defines whether to include extended API in SimpleLink driver 00189 or not 00190 00191 When defined, the SimpleLink driver will include also all 00192 extended API of the included packages 00193 00194 \sa ext_api 00195 00196 \note belongs to \ref porting_sec 00197 00198 \warning 00199 */ 00200 #define SL_INC_EXT_API 00201 00202 /*! 00203 \brief Defines whether to include WLAN package in SimpleLink driver 00204 or not 00205 00206 When defined, the SimpleLink driver will include also 00207 the WLAN package 00208 00209 \sa 00210 00211 \note belongs to \ref porting_sec 00212 00213 \warning 00214 */ 00215 #define SL_INC_WLAN_PKG 00216 00217 /*! 00218 \brief Defines whether to include SOCKET package in SimpleLink 00219 driver or not 00220 00221 When defined, the SimpleLink driver will include also 00222 the SOCKET package 00223 00224 \sa 00225 00226 \note belongs to \ref porting_sec 00227 00228 \warning 00229 */ 00230 #define SL_INC_SOCKET_PKG 00231 00232 /*! 00233 \brief Defines whether to include NET_APP package in SimpleLink 00234 driver or not 00235 00236 When defined, the SimpleLink driver will include also the 00237 NET_APP package 00238 00239 \sa 00240 00241 \note belongs to \ref porting_sec 00242 00243 \warning 00244 */ 00245 #define SL_INC_NET_APP_PKG 00246 00247 /*! 00248 \brief Defines whether to include NET_CFG package in SimpleLink 00249 driver or not 00250 00251 When defined, the SimpleLink driver will include also 00252 the NET_CFG package 00253 00254 \sa 00255 00256 \note belongs to \ref porting_sec 00257 00258 \warning 00259 */ 00260 #define SL_INC_NET_CFG_PKG 00261 00262 /*! 00263 \brief Defines whether to include NVMEM package in SimpleLink 00264 driver or not 00265 00266 When defined, the SimpleLink driver will include also the 00267 NVMEM package 00268 00269 \sa 00270 00271 \note belongs to \ref porting_sec 00272 00273 \warning 00274 */ 00275 #define SL_INC_NVMEM_PKG 00276 00277 /*! 00278 \brief Defines whether to include socket server side APIs 00279 in SimpleLink driver or not 00280 00281 When defined, the SimpleLink driver will include also socket 00282 server side APIs 00283 00284 \sa server_side 00285 00286 \note 00287 00288 \warning 00289 */ 00290 #define SL_INC_SOCK_SERVER_SIDE_API 00291 00292 /*! 00293 \brief Defines whether to include socket client side APIs in SimpleLink 00294 driver or not 00295 00296 When defined, the SimpleLink driver will include also socket 00297 client side APIs 00298 00299 \sa client_side 00300 00301 \note belongs to \ref porting_sec 00302 00303 \warning 00304 */ 00305 #define SL_INC_SOCK_CLIENT_SIDE_API 00306 00307 /*! 00308 \brief Defines whether to include socket receive APIs in SimpleLink 00309 driver or not 00310 00311 When defined, the SimpleLink driver will include also socket 00312 receive side APIs 00313 00314 \sa recv_api 00315 00316 \note belongs to \ref porting_sec 00317 00318 \warning 00319 */ 00320 #define SL_INC_SOCK_RECV_API 00321 00322 /*! 00323 \brief Defines whether to include socket send APIs in SimpleLink 00324 driver or not 00325 00326 When defined, the SimpleLink driver will include also socket 00327 send side APIs 00328 00329 \sa send_api 00330 00331 \note belongs to \ref porting_sec 00332 00333 \warning 00334 */ 00335 #define SL_INC_SOCK_SEND_API 00336 00337 /*! 00338 00339 Close the Doxygen group. 00340 @} 00341 00342 */ 00343 00344 00345 /*! 00346 ****************************************************************************** 00347 00348 \defgroup porting_enable_device Device Enable/Disable IO 00349 00350 The enable/disable API provide mechanism to enable/disable the network processor 00351 00352 00353 PORTING ACTION: 00354 - None 00355 @{ 00356 00357 ****************************************************************************** 00358 */ 00359 /*! 00360 \brief Preamble to the enabling the Network Processor. 00361 Placeholder to implement any pre-process operations 00362 before enabling networking operations. 00363 00364 \sa sl_DeviceEnable 00365 00366 \note belongs to \ref ported_sec 00367 00368 */ 00369 #define sl_DeviceEnablePreamble() 00370 00371 /*! 00372 \brief Enable the Network Processor 00373 00374 \sa sl_DeviceDisable 00375 00376 \note belongs to \ref porting_sec 00377 00378 */ 00379 //#define sl_DeviceEnable _spi->CC3100_enable 00380 00381 /*! 00382 \brief Disable the Network Processor 00383 00384 \sa sl_DeviceEnable 00385 00386 \note belongs to \ref porting_sec 00387 */ 00388 //#define sl_DeviceDisable _spi->CC3100_disable 00389 00390 /*! 00391 00392 Close the Doxygen group. 00393 @} 00394 00395 */ 00396 00397 /*! 00398 ****************************************************************************** 00399 00400 \defgroup porting_interface Hardware Transport Interface 00401 00402 The simple link device can work with different transport interfaces 00403 (namely,SPI or UART). Texas Instruments provides single driver 00404 that can work with all these types. This section binds the 00405 physical transport interface with the SimpleLink driver 00406 00407 00408 \note Correct and efficient implementation of this driver is critical 00409 for the performances of the SimpleLink device on this platform. 00410 00411 00412 PORTING ACTION: 00413 - None 00414 00415 @{ 00416 00417 ****************************************************************************** 00418 */ 00419 00420 #define _SlFd_t int32_t 00421 00422 /*! 00423 \brief Opens an interface communication port to be used for communicating 00424 with a SimpleLink device 00425 00426 Given an interface name and option flags, this function opens 00427 the communication port and creates a file descriptor. 00428 This file descriptor is used afterwards to read and write 00429 data from and to this specific communication channel. 00430 The speed, clock polarity, clock phase, chip select and all other 00431 specific attributes of the channel are all should be set to hardcoded 00432 in this function. 00433 00434 \param ifName - points to the interface name/path. The interface name is an 00435 optional attributes that the simple link driver receives 00436 on opening the driver (sl_Start). 00437 In systems that the spi channel is not implemented as 00438 part of the OS device drivers, this parameter could be NULL. 00439 00440 \param flags - optional flags parameters for future use 00441 00442 \return upon successful completion, the function shall open the channel 00443 and return a non-negative integer representing the file descriptor. 00444 Otherwise, -1 shall be returned 00445 00446 \sa sl_IfClose , sl_IfRead , sl_IfWrite 00447 00448 \note The prototype of the function is as follow: 00449 Fd_t xxx_IfOpen(char* pIfName , unsigned long flags); 00450 00451 \note belongs to \ref porting_sec 00452 00453 \warning 00454 */ 00455 //#define sl_IfOpen _spi->spi_Open 00456 00457 /*! 00458 \brief Closes an opened interface communication port 00459 00460 \param fd - file descriptor of opened communication channel 00461 00462 \return upon successful completion, the function shall return 0. 00463 Otherwise, -1 shall be returned 00464 00465 \sa sl_IfOpen , sl_IfRead , sl_IfWrite 00466 00467 \note The prototype of the function is as follow: 00468 int xxx_IfClose(Fd_t Fd); 00469 00470 \note belongs to \ref porting_sec 00471 00472 \warning 00473 */ 00474 //#define sl_IfClose _spi->spi_Close 00475 00476 /*! 00477 \brief Attempts to read up to len bytes from an opened communication channel 00478 into a buffer starting at pBuff. 00479 00480 \param fd - file descriptor of an opened communication channel 00481 00482 \param pBuff - pointer to the first location of a buffer that contains enough 00483 space for all expected data 00484 00485 \param len - number of bytes to read from the communication channel 00486 00487 \return upon successful completion, the function shall return the number of read bytes. 00488 Otherwise, 0 shall be returned 00489 00490 \sa sl_IfClose , sl_IfOpen , sl_IfWrite 00491 00492 00493 \note The prototype of the function is as follow: 00494 int xxx_IfRead(Fd_t Fd , char* pBuff , int Len); 00495 00496 \note belongs to \ref porting_sec 00497 00498 \warning 00499 */ 00500 //#define sl_IfRead _spi->spi_Read 00501 00502 /*! 00503 \brief attempts to write up to len bytes to the SPI channel 00504 00505 \param fd - file descriptor of an opened communication channel 00506 00507 \param pBuff - pointer to the first location of a buffer that contains 00508 the data to send over the communication channel 00509 00510 \param len - number of bytes to write to the communication channel 00511 00512 \return upon successful completion, the function shall return the number of sent bytes. 00513 otherwise, 0 shall be returned 00514 00515 \sa sl_IfClose , sl_IfOpen , sl_IfRead 00516 00517 \note This function could be implemented as zero copy and return only upon successful completion 00518 of writing the whole buffer, but in cases that memory allocation is not too tight, the 00519 function could copy the data to internal buffer, return back and complete the write in 00520 parallel to other activities as long as the other SPI activities would be blocked until 00521 the entire buffer write would be completed 00522 00523 The prototype of the function is as follow: 00524 int xxx_IfWrite(Fd_t Fd , char* pBuff , int Len); 00525 00526 \note belongs to \ref porting_sec 00527 00528 \warning 00529 */ 00530 //#define sl_IfWrite _spi->spi_Write 00531 00532 /*! 00533 \brief register an interrupt handler routine for the host IRQ 00534 00535 \param InterruptHdl - pointer to interrupt handler routine 00536 00537 \param pValue - pointer to a memory structure that is passed 00538 to the interrupt handler. 00539 00540 \return upon successful registration, the function shall return 0. 00541 Otherwise, -1 shall be returned 00542 00543 \sa 00544 00545 \note If there is already registered interrupt handler, the function 00546 should overwrite the old handler with the new one 00547 00548 \note If the handler is a null pointer, the function should un-register the 00549 interrupt handler, and the interrupts can be disabled. 00550 00551 \note belongs to \ref porting_sec 00552 00553 \warning 00554 */ 00555 //#define sl_IfRegIntHdlr(InterruptHdl , pValue) \ 00556 // _spi->registerInterruptHandler(InterruptHdl , pValue) 00557 /*! 00558 \brief Masks the Host IRQ 00559 00560 \sa sl_IfUnMaskIntHdlr 00561 00562 00563 00564 \note belongs to \ref porting_sec 00565 00566 \warning 00567 */ 00568 00569 //#define sl_IfMaskIntHdlr() 00570 00571 /*! 00572 \brief Unmasks the Host IRQ 00573 00574 \sa sl_IfMaskIntHdlr 00575 00576 00577 00578 \note belongs to \ref porting_sec 00579 00580 \warning 00581 */ 00582 00583 //#define sl_IfUnMaskIntHdlr() 00584 00585 /*! 00586 \brief Write Handers for statistics debug on write 00587 00588 \param interface handler - pointer to interrupt handler routine 00589 00590 00591 \return no return value 00592 00593 \sa 00594 00595 \note An optional hooks for monitoring before and after write info 00596 00597 \note belongs to \ref porting_sec 00598 00599 \warning 00600 */ 00601 /* 00602 #define SL_START_WRITE_STAT 00603 */ 00604 00605 #ifdef SL_START_WRITE_STAT 00606 #define sl_IfStartWriteSequence 00607 #define sl_IfEndWriteSequence 00608 #endif 00609 /*! 00610 00611 Close the Doxygen group. 00612 @} 00613 00614 */ 00615 00616 /*! 00617 ****************************************************************************** 00618 00619 \defgroup porting_mem_mgm Memory Management 00620 00621 This section declare in which memory management model the SimpleLink driver 00622 will run: 00623 -# Static 00624 -# Dynamic 00625 00626 This section IS NOT REQUIRED in case Static model is selected. 00627 00628 The default memory model is Static 00629 00630 PORTING ACTION: 00631 - If dynamic model is selected, define the alloc and free functions. 00632 00633 @{ 00634 00635 ***************************************************************************** 00636 */ 00637 00638 /*! 00639 \brief Defines whether the SimpleLink driver is working in dynamic 00640 memory model or not 00641 00642 When defined, the SimpleLink driver use dynamic allocations 00643 if dynamic allocation is selected malloc and free functions 00644 must be retrieved 00645 00646 \sa 00647 00648 \note belongs to \ref porting_sec 00649 00650 \warning 00651 */ 00652 /* 00653 #define SL_MEMORY_MGMT_DYNAMIC 00654 */ 00655 00656 #ifdef SL_MEMORY_MGMT_DYNAMIC 00657 00658 /*! 00659 \brief 00660 00661 \sa 00662 00663 \note belongs to \ref porting_sec 00664 00665 \warning 00666 */ 00667 #define sl_Malloc(Size) malloc(Size) 00668 00669 /*! 00670 \brief 00671 00672 \sa 00673 00674 \note belongs to \ref porting_sec 00675 00676 \warning 00677 */ 00678 #define sl_Free(pMem) free(pMem) 00679 00680 #endif 00681 00682 /*! 00683 00684 Close the Doxygen group. 00685 @} 00686 00687 */ 00688 00689 /*! 00690 ****************************************************************************** 00691 00692 \defgroup porting_os Operating System (OS) 00693 00694 The simple link driver can run on multi-threaded environment as well 00695 as non-os environment (main loop) 00696 00697 This section IS NOT REQUIRED in case you are working on non-os environment. 00698 00699 If you choose to work in multi-threaded environment under any operating system 00700 you will have to provide some basic adaptation routines to allow the driver 00701 to protect access to resources from different threads (locking object) and 00702 to allow synchronization between threads (sync objects). 00703 00704 PORTING ACTION: 00705 -# Uncomment SL_PLATFORM_MULTI_THREADED define 00706 -# Bind locking object routines 00707 -# Bind synchronization object routines 00708 -# Optional - Bind spawn thread routine 00709 00710 @{ 00711 00712 ****************************************************************************** 00713 */ 00714 00715 00716 //#define SL_PLATFORM_MULTI_THREADED 00717 00718 00719 #ifdef SL_PLATFORM_MULTI_THREADED 00720 00721 /*! 00722 \brief 00723 \sa 00724 \note belongs to \ref porting_sec 00725 \warning 00726 */ 00727 #define SL_OS_RET_CODE_OK ((int)OSI_OK) 00728 00729 /*! 00730 \brief 00731 \sa 00732 \note belongs to \ref porting_sec 00733 \warning 00734 */ 00735 #define SL_OS_WAIT_FOREVER ((OsiTime_t)OSI_WAIT_FOREVER) 00736 00737 /*! 00738 \brief 00739 \sa 00740 \note belongs to \ref porting_sec 00741 \warning 00742 */ 00743 #define SL_OS_NO_WAIT ((OsiTime_t)OSI_NO_WAIT) 00744 00745 /*! 00746 \brief type definition for a time value 00747 00748 \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc. 00749 00750 \note belongs to \ref porting_sec 00751 */ 00752 #define _SlTime_t OsiTime_tv 00753 00754 /*! 00755 \brief type definition for a sync object container 00756 00757 Sync object is object used to synchronize between two threads or thread and interrupt handler. 00758 One thread is waiting on the object and the other thread send a signal, which then 00759 release the waiting thread. 00760 The signal must be able to be sent from interrupt context. 00761 This object is generally implemented by binary semaphore or events. 00762 00763 \note On each porting or platform the type could be whatever is needed - integer, structure etc. 00764 00765 \note belongs to \ref porting_sec 00766 */ 00767 #define _SlSyncObj_t OsiSyncObj_t 00768 00769 00770 /*! 00771 \brief This function creates a sync object 00772 00773 The sync object is used for synchronization between different thread or ISR and 00774 a thread. 00775 00776 \param pSyncObj - pointer to the sync object control block 00777 00778 \return upon successful creation the function should return 0 00779 Otherwise, a negative value indicating the error code shall be returned 00780 00781 \note belongs to \ref porting_sec 00782 \warning 00783 */ 00784 #define sl_SyncObjCreate(pSyncObj,pName) osi_SyncObjCreate(pSyncObj) 00785 00786 00787 /*! 00788 \brief This function deletes a sync object 00789 00790 \param pSyncObj - pointer to the sync object control block 00791 00792 \return upon successful deletion the function should return 0 00793 Otherwise, a negative value indicating the error code shall be returned 00794 \note belongs to \ref porting_sec 00795 \warning 00796 */ 00797 #define sl_SyncObjDelete(pSyncObj) osi_SyncObjDelete(pSyncObj) 00798 00799 00800 /*! 00801 \brief This function generates a sync signal for the object. 00802 00803 All suspended threads waiting on this sync object are resumed 00804 00805 \param pSyncObj - pointer to the sync object control block 00806 00807 \return upon successful signalling the function should return 0 00808 Otherwise, a negative value indicating the error code shall be returned 00809 \note the function could be called from ISR context 00810 \warning 00811 */ 00812 #define sl_SyncObjSignal(pSyncObj) osi_SyncObjSignal(pSyncObj) 00813 00814 /*! 00815 \brief This function generates a sync signal for the object from Interrupt 00816 00817 This is for RTOS that should signal from IRQ using a dedicated API 00818 00819 \param pSyncObj - pointer to the sync object control block 00820 00821 \return upon successful signalling the function should return 0 00822 Otherwise, a negative value indicating the error code shall be returned 00823 \note the function could be called from ISR context 00824 \warning 00825 */ 00826 #define sl_SyncObjSignalFromIRQ(pSyncObj) osi_SyncObjSignalFromISR( pSyncObj) 00827 /*! 00828 \brief This function waits for a sync signal of the specific sync object 00829 00830 \param pSyncObj - pointer to the sync object control block 00831 \param Timeout - numeric value specifies the maximum number of mSec to 00832 stay suspended while waiting for the sync signal 00833 Currently, the simple link driver uses only two values: 00834 - OSI_WAIT_FOREVER 00835 - OSI_NO_WAIT 00836 00837 \return upon successful reception of the signal within the timeout window return 0 00838 Otherwise, a negative value indicating the error code shall be returned 00839 \note belongs to \ref porting_sec 00840 \warning 00841 */ 00842 #define sl_SyncObjWait(pSyncObj,Timeout) osi_SyncObjWait( pSyncObj , Timeout) 00843 00844 /*! 00845 \brief type definition for a locking object container 00846 00847 Locking object are used to protect a resource from mutual accesses of two or more threads. 00848 The locking object should support reentrant locks by a signal thread. 00849 This object is generally implemented by mutex semaphore 00850 00851 \note On each porting or platform the type could be whatever is needed - integer, structure etc. 00852 \note belongs to \ref porting_sec 00853 */ 00854 #define _SlLockObj_t OsiLockObj_t 00855 00856 /*! 00857 \brief This function creates a locking object. 00858 00859 The locking object is used for protecting a shared resources between different 00860 threads. 00861 00862 \param pLockObj - pointer to the locking object control block 00863 00864 \return upon successful creation the function should return 0 00865 Otherwise, a negative value indicating the error code shall be returned 00866 \note belongs to \ref porting_sec 00867 \warning 00868 */ 00869 #define sl_LockObjCreate(pLockObj,pName) osi_LockObjCreate(pLockObj) 00870 00871 /*! 00872 \brief This function deletes a locking object. 00873 00874 \param pLockObj - pointer to the locking object control block 00875 00876 \return upon successful deletion the function should return 0 00877 Otherwise, a negative value indicating the error code shall be returned 00878 \note belongs to \ref porting_sec 00879 \warning 00880 */ 00881 #define sl_LockObjDelete(pLockObj) osi_LockObjDelete(pLockObj) 00882 00883 /*! 00884 \brief This function locks a locking object. 00885 00886 All other threads that call this function before this thread calls 00887 the osi_LockObjUnlock would be suspended 00888 00889 \param pLockObj - pointer to the locking object control block 00890 \param Timeout - numeric value specifies the maximum number of mSec to 00891 stay suspended while waiting for the locking object 00892 Currently, the simple link driver uses only two values: 00893 - OSI_WAIT_FOREVER 00894 - OSI_NO_WAIT 00895 00896 00897 \return upon successful reception of the locking object the function should return 0 00898 Otherwise, a negative value indicating the error code shall be returned 00899 \note belongs to \ref porting_sec 00900 \warning 00901 */ 00902 #define sl_LockObjLock(pLockObj,Timeout) osi_LockObjLock( pLockObj , Timeout) 00903 00904 /*! 00905 \brief This function unlock a locking object. 00906 00907 \param pLockObj - pointer to the locking object control block 00908 00909 \return upon successful unlocking the function should return 0 00910 Otherwise, a negative value indicating the error code shall be returned 00911 \note belongs to \ref porting_sec 00912 \warning 00913 */ 00914 #define sl_LockObjUnlock(pLockObj) osi_LockObjUnlock( pLockObj) 00915 00916 #endif 00917 /*! 00918 \brief This function call the pEntry callback from a different context 00919 00920 \param pEntry - pointer to the entry callback function 00921 00922 \param pValue - pointer to any type of memory structure that would be 00923 passed to pEntry callback from the execution thread. 00924 00925 \param flags - execution flags - reserved for future usage 00926 00927 \return upon successful registration of the spawn the function should return 0 00928 (the function is not blocked till the end of the execution of the function 00929 and could be returned before the execution is actually completed) 00930 Otherwise, a negative value indicating the error code shall be returned 00931 \note belongs to \ref porting_sec 00932 \warning 00933 */ 00934 00935 #define SL_PLATFORM_EXTERNAL_SPAWN 00936 00937 00938 #ifdef SL_PLATFORM_EXTERNAL_SPAWN 00939 #define sl_Spawn(pEntry,pValue,flags) osi_Spawn(pEntry,pValue,flags) 00940 #endif 00941 00942 /*! 00943 00944 Close the Doxygen group. 00945 @} 00946 00947 */ 00948 00949 00950 /*! 00951 ****************************************************************************** 00952 00953 \defgroup porting_events Event Handlers 00954 00955 This section includes the asynchronous event handlers routines 00956 00957 PORTING ACTION: 00958 -Uncomment the required handler and define your routine as the value 00959 of this handler 00960 00961 @{ 00962 00963 ****************************************************************************** 00964 */ 00965 00966 /*! 00967 \brief 00968 00969 \sa 00970 00971 \note belongs to \ref porting_sec 00972 00973 \warning 00974 */ 00975 #define sl_GeneralEvtHdlr SimpleLinkGeneralEventHandler 00976 00977 00978 /*! 00979 \brief An event handler for WLAN connection or disconnection indication 00980 This event handles async WLAN events. 00981 Possible events are: 00982 SL_WLAN_CONNECT_EVENT - indicates WLAN is connected 00983 SL_WLAN_DISCONNECT_EVENT - indicates WLAN is disconnected 00984 \sa 00985 00986 \note belongs to \ref porting_sec 00987 00988 \warning 00989 */ 00990 #define sl_WlanEvtHdlr SimpleLinkWlanEventHandler 00991 00992 /*! 00993 \brief An event handler for IP address asynchronous event. Usually accepted after new WLAN connection. 00994 This event handles networking events. 00995 Possible events are: 00996 SL_NETAPP_IPV4_ACQUIRED - IP address was acquired (DHCP or Static) 00997 00998 \sa 00999 01000 \note belongs to \ref porting_sec 01001 01002 \warning 01003 */ 01004 01005 #define sl_NetAppEvtHdlr SimpleLinkNetAppEventHandler 01006 01007 /*! 01008 \brief A callback for HTTP server events. 01009 Possible events are: 01010 SL_NETAPP_HTTPGETTOKENVALUE - NWP requests to get the value of a specific token 01011 SL_NETAPP_HTTPPOSTTOKENVALUE - NWP post to the host a new value for a specific token 01012 01013 \param pServerEvent - Contains the relevant event information (SL_NETAPP_HTTPGETTOKENVALUE or SL_NETAPP_HTTPPOSTTOKENVALUE) 01014 01015 \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) 01016 01017 \sa 01018 01019 \note belongs to \ref porting_sec 01020 01021 \warning 01022 */ 01023 01024 #define sl_HttpServerCallback SimpleLinkHttpServerCallback 01025 01026 /*! 01027 \brief 01028 01029 \sa 01030 01031 \note belongs to \ref porting_sec 01032 01033 \warning 01034 */ 01035 #define sl_SockEvtHdlr SimpleLinkSockEventHandler 01036 01037 01038 01039 /*! 01040 01041 Close the Doxygen group. 01042 @} 01043 01044 */ 01045 01046 #endif /* __USER_H__ */ 01047
Generated on Tue Jul 12 2022 18:55:10 by 1.7.2