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

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cc3100_user.h Source File

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 20
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 #include "osi.h"
00721 
00722 
00723 /*!
00724     \brief
00725     \sa
00726     \note           belongs to \ref porting_sec
00727     \warning
00728 */
00729 #define SL_OS_RET_CODE_OK      ((int32_t)OSI_OK)
00730 
00731 /*!
00732     \brief
00733     \sa
00734     \note           belongs to \ref porting_sec
00735     \warning
00736 */
00737 #define SL_OS_WAIT_FOREVER     ((OsiTime_t)OSI_WAIT_FOREVER)
00738 
00739 /*!
00740     \brief
00741     \sa
00742     \note           belongs to \ref porting_sec
00743     \warning
00744 */
00745 #define SL_OS_NO_WAIT      ((OsiTime_t)OSI_NO_WAIT)
00746 
00747 /*!
00748     \brief type definition for a time value
00749 
00750     \note   On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
00751 
00752     \note       belongs to \ref porting_sec
00753 */
00754 #define _SlTime_t      OsiTime_t
00755 
00756 /*!
00757     \brief  type definition for a sync object container
00758 
00759     Sync object is object used to synchronize between two threads or thread and interrupt handler.
00760     One thread is waiting on the object and the other thread send a signal, which then
00761     release the waiting thread.
00762     The signal must be able to be sent from interrupt context.
00763     This object is generally implemented by binary semaphore or events.
00764 
00765     \note   On each porting or platform the type could be whatever is needed - integer, structure etc.
00766 
00767     \note       belongs to \ref porting_sec
00768 */
00769 #define _SlSyncObj_t  OsiSyncObj_t
00770 
00771 
00772 /*!
00773     \brief  This function creates a sync object
00774 
00775     The sync object is used for synchronization between different thread or ISR and
00776     a thread.
00777 
00778     \param  pSyncObj    -   pointer to the sync object control block
00779 
00780     \return upon successful creation the function should return 0
00781             Otherwise, a negative value indicating the error code shall be returned
00782 
00783     \note       belongs to \ref porting_sec
00784     \warning
00785 */
00786 #define sl_SyncObjCreate(pSyncObj,pName)    osi_SyncObjCreate(pSyncObj)
00787 
00788 /*!
00789     \brief  This function deletes a sync object
00790 
00791     \param  pSyncObj    -   pointer to the sync object control block
00792 
00793     \return upon successful deletion the function should return 0
00794             Otherwise, a negative value indicating the error code shall be returned
00795     \note       belongs to \ref porting_sec
00796     \warning
00797 */
00798 #define sl_SyncObjDelete(pSyncObj)    osi_SyncObjDelete(pSyncObj)
00799 
00800 
00801 /*!
00802     \brief      This function generates a sync signal for the object.
00803 
00804     All suspended threads waiting on this sync object are resumed
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_SyncObjSignal(pSyncObj)     osi_SyncObjSignal(pSyncObj)
00814 
00815 /*!
00816     \brief      This function generates a sync signal for the object from Interrupt
00817 
00818     This is for RTOS that should signal from IRQ using a dedicated API
00819 
00820     \param      pSyncObj    -   pointer to the sync object control block
00821 
00822     \return     upon successful signalling the function should return 0
00823                 Otherwise, a negative value indicating the error code shall be returned
00824     \note       the function could be called from ISR context
00825     \warning
00826 */
00827 #define sl_SyncObjSignalFromIRQ(pSyncObj)     osi_SyncObjSignalFromISR( pSyncObj)
00828 /*!
00829     \brief  This function waits for a sync signal of the specific sync object
00830 
00831     \param  pSyncObj    -   pointer to the sync object control block
00832     \param  Timeout     -   numeric value specifies the maximum number of mSec to
00833                             stay suspended while waiting for the sync signal
00834                             Currently, the simple link driver uses only two values:
00835                                 - OSI_WAIT_FOREVER
00836                                 - OSI_NO_WAIT
00837 
00838     \return upon successful reception of the signal within the timeout window return 0
00839             Otherwise, a negative value indicating the error code shall be returned
00840     \note       belongs to \ref porting_sec
00841     \warning
00842 */
00843 #define sl_SyncObjWait(pSyncObj,Timeout)    osi_SyncObjWait( pSyncObj , Timeout)
00844 
00845 /*!
00846     \brief  type definition for a locking object container
00847 
00848     Locking object are used to protect a resource from mutual accesses of two or more threads.
00849     The locking object should support reentrant locks by a signal thread.
00850     This object is generally implemented by mutex semaphore
00851 
00852     \note   On each porting or platform the type could be whatever is needed - integer, structure etc.
00853     \note       belongs to \ref porting_sec
00854 */
00855 #define _SlLockObj_t   OsiLockObj_t
00856 
00857 /*!
00858     \brief  This function creates a locking object.
00859 
00860     The locking object is used for protecting a shared resources between different
00861     threads.
00862 
00863     \param  pLockObj    -   pointer to the locking object control block
00864 
00865     \return upon successful creation the function should return 0
00866             Otherwise, a negative value indicating the error code shall be returned
00867     \note       belongs to \ref porting_sec
00868     \warning
00869 */
00870 #define sl_LockObjCreate(pLockObj,pName)     osi_LockObjCreate(pLockObj)
00871 
00872 /*!
00873     \brief  This function deletes a locking object.
00874 
00875     \param  pLockObj    -   pointer to the locking object control block
00876 
00877     \return upon successful deletion the function should return 0
00878             Otherwise, a negative value indicating the error code shall be returned
00879     \note       belongs to \ref porting_sec
00880     \warning
00881 */
00882 #define sl_LockObjDelete(pLockObj)     osi_LockObjDelete(pLockObj)
00883 
00884 /*!
00885     \brief  This function locks a locking object.
00886 
00887     All other threads that call this function before this thread calls
00888     the osi_LockObjUnlock would be suspended
00889 
00890     \param  pLockObj    -   pointer to the locking object control block
00891     \param  Timeout     -   numeric value specifies the maximum number of mSec to
00892                             stay suspended while waiting for the locking object
00893                             Currently, the simple link driver uses only two values:
00894                                 - OSI_WAIT_FOREVER
00895                                 - OSI_NO_WAIT
00896 
00897 
00898     \return upon successful reception of the locking object the function should return 0
00899             Otherwise, a negative value indicating the error code shall be returned
00900     \note       belongs to \ref porting_sec
00901     \warning
00902 */
00903 #define sl_LockObjLock(pLockObj,Timeout)   osi_LockObjLock( pLockObj , Timeout)
00904 
00905 /*!
00906     \brief  This function unlock a locking object.
00907 
00908     \param  pLockObj    -   pointer to the locking object control block
00909 
00910     \return upon successful unlocking the function should return 0
00911             Otherwise, a negative value indicating the error code shall be returned
00912     \note       belongs to \ref porting_sec
00913     \warning
00914 */
00915 #define sl_LockObjUnlock(pLockObj)    osi_LockObjUnlock( pLockObj)
00916 
00917 #endif
00918 /*!
00919     \brief  This function call the pEntry callback from a different context
00920 
00921     \param  pEntry      -   pointer to the entry callback function
00922 
00923     \param  pValue      -   pointer to any type of memory structure that would be
00924                             passed to pEntry callback from the execution thread.
00925 
00926     \param  flags       -   execution flags - reserved for future usage
00927 
00928     \return upon successful registration of the spawn the function should return 0
00929             (the function is not blocked till the end of the execution of the function
00930             and could be returned before the execution is actually completed)
00931             Otherwise, a negative value indicating the error code shall be returned
00932     \note       belongs to \ref porting_sec
00933     \warning
00934 */
00935 
00936 #define SL_PLATFORM_EXTERNAL_SPAWN
00937 
00938 
00939 #ifdef SL_PLATFORM_EXTERNAL_SPAWN
00940 #define sl_Spawn(pEntry,pValue,flags)     osi_Spawn(pEntry,pValue,flags)
00941 #endif
00942 
00943 /*!
00944 
00945  Close the Doxygen group.
00946  @}
00947 
00948  */
00949 
00950 
00951 /*!
00952  ******************************************************************************
00953 
00954     \defgroup       porting_events      Event Handlers
00955 
00956     This section includes the asynchronous event handlers routines
00957 
00958     PORTING ACTION:
00959         -Uncomment the required handler and define your routine as the value
00960         of this handler
00961 
00962     @{
00963 
00964  ******************************************************************************
00965  */
00966 
00967 /*!
00968     \brief
00969 
00970     \sa
00971 
00972     \note       belongs to \ref porting_sec
00973 
00974     \warning
00975 */
00976 #define sl_GeneralEvtHdlr       SimpleLinkGeneralEventHandler
00977 
00978 
00979 /*!
00980     \brief          An event handler for WLAN connection or disconnection indication
00981                     This event handles async WLAN events.
00982                     Possible events are:
00983                     SL_WLAN_CONNECT_EVENT - indicates WLAN is connected
00984                     SL_WLAN_DISCONNECT_EVENT - indicates WLAN is disconnected
00985     \sa
00986 
00987     \note           belongs to \ref porting_sec
00988 
00989     \warning
00990 */
00991 #define sl_WlanEvtHdlr          SimpleLinkWlanEventHandler
00992 
00993 /*!
00994     \brief          An event handler for IP address asynchronous event. Usually accepted after new WLAN connection.
00995                     This event handles networking events.
00996                     Possible events are:
00997                     SL_NETAPP_IPV4_ACQUIRED - IP address was acquired (DHCP or Static)
00998 
00999     \sa
01000 
01001     \note           belongs to \ref porting_sec
01002 
01003     \warning
01004 */
01005 
01006 #define sl_NetAppEvtHdlr        SimpleLinkNetAppEventHandler
01007 
01008 /*!
01009     \brief          A callback for HTTP server events.
01010                     Possible events are:
01011                     SL_NETAPP_HTTPGETTOKENVALUE - NWP requests to get the value of a specific token
01012                     SL_NETAPP_HTTPPOSTTOKENVALUE - NWP post to the host a new value for a specific token
01013 
01014     \param          pServerEvent - Contains the relevant event information (SL_NETAPP_HTTPGETTOKENVALUE or SL_NETAPP_HTTPPOSTTOKENVALUE)
01015 
01016     \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)
01017 
01018     \sa
01019 
01020     \note           belongs to \ref porting_sec
01021 
01022     \warning
01023 */
01024 
01025 #define sl_HttpServerCallback   SimpleLinkHttpServerCallback
01026 
01027 /*!
01028     \brief
01029 
01030     \sa
01031 
01032     \note           belongs to \ref porting_sec
01033 
01034     \warning
01035 */
01036 #define sl_SockEvtHdlr          SimpleLinkSockEventHandler
01037 
01038 
01039 
01040 /*!
01041 
01042  Close the Doxygen group.
01043  @}
01044 
01045  */
01046 
01047 #endif /* __USER_H__ */
01048