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