Maxim Integrated / Mbed OS MAXREFDES155#

Dependencies:   MaximInterface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers device.h Source File

device.h

00001 /*
00002  * device.h - CC31xx/CC32xx Host Driver Implementation
00003  *
00004  * Copyright (C) 2015 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 /* Include files                                                             */
00039 /*****************************************************************************/
00040 #include "simplelink.h"
00041 
00042 #ifndef __DEVICE_H__
00043 #define __DEVICE_H__
00044 
00045 
00046 
00047 #ifdef __cplusplus
00048 extern "C" {
00049 #endif
00050 
00051 
00052 
00053 /*!
00054 
00055     \addtogroup device
00056     @{
00057 
00058 */
00059 
00060 /*****************************************************************************/
00061 /* Macro declarations                                                        */
00062 /*****************************************************************************/
00063      
00064      
00065 /* SL internal Error codes */
00066          
00067 /* Receive this error in case there are no resources to issue the command
00068    If possible, increase the number of MAX_CUNCURENT_ACTIONS (result in memory increase)
00069    If not, try again later */
00070 #define SL_POOL_IS_EMPTY (-2000)
00071          
00072 /* Receive this error in case a given length for RX buffer was too small. 
00073    Receive payload was bigger than the given buffer size. Therefore, payload is cut according to receive size 
00074    Recommend to increase buffer size */
00075 #define SL_ESMALLBUF     (-2001)
00076 
00077 /* Receive this error in case zero length is supplied to a "get" API
00078    Recommend to supply length according to requested information (view options defines for help) */
00079 #define SL_EZEROLEN      (-2002)
00080 
00081 /* User supplied invalid parameter */
00082 #define SL_INVALPARAM    (-2003)
00083 
00084 
00085 /* Failed to open interface  */
00086 #define SL_BAD_INTERFACE    (-2004)
00087 
00088 /* API has been aborted due to an error detected by host driver */
00089 #define SL_API_ABORTED      (-100)
00090 
00091 /* End of SL internal Error codes */
00092 
00093 
00094 
00095 /*****************************************************************************/
00096 /* Errors returned from the general error async event                        */
00097 /*****************************************************************************/
00098 
00099 /* Send types */
00100 typedef enum
00101 {
00102     SL_ERR_SENDER_HEALTH_MON,
00103     SL_ERR_SENDER_CLI_UART,
00104     SL_ERR_SENDER_SUPPLICANT,
00105     SL_ERR_SENDER_NETWORK_STACK,
00106     SL_ERR_SENDER_WLAN_DRV_IF,
00107     SL_ERR_SENDER_WILINK,
00108     SL_ERR_SENDER_INIT_APP,
00109     SL_ERR_SENDER_NETX,
00110     SL_ERR_SENDER_HOST_APD,
00111     SL_ERR_SENDER_MDNS,
00112     SL_ERR_SENDER_HTTP_SERVER,
00113     SL_ERR_SENDER_DHCP_SERVER,
00114     SL_ERR_SENDER_DHCP_CLIENT,
00115     SL_ERR_DISPATCHER,
00116     SL_ERR_NUM_SENDER_LAST=0xFF
00117 }SlErrorSender_e; 
00118 
00119 
00120 typedef enum
00121 {
00122     SL_DRIVER_API_DEVICE_SL_START = 0,
00123     SL_DRIVER_API_DEVICE_SL_STOP,
00124     SL_DRIVER_API_NETAPP_PING_START,
00125     SL_DRIVER_API_SOCKET_CONNECT,
00126     SL_DRIVER_API_SOCKET_ACCEPT,
00127     SL_DRIVER_API_SOCKET_SELECT,
00128     SL_DRIVER_API_SOCKET_RECV,
00129     SL_DRIVER_API_SOCKET_RECVFROM
00130    
00131 } SlDriverAPIWithTimeout_e;
00132 
00133 
00134 /* Error codes */
00135 #define SL_ERROR_STATIC_ADDR_SUBNET_ERROR                   (-60)  /* network stack error*/
00136 #define SL_ERROR_ILLEGAL_CHANNEL                            (-61)  /* supplicant error */
00137 #define SL_ERROR_SUPPLICANT_ERROR                           (-72)  /* init error code */
00138 #define SL_ERROR_HOSTAPD_INIT_FAIL                          (-73)  /* init error code */
00139 #define SL_ERROR_HOSTAPD_INIT_IF_FAIL                       (-74)  /* init error code */
00140 #define SL_ERROR_WLAN_DRV_INIT_FAIL                         (-75)  /* init error code */
00141 #define SL_ERROR_WLAN_DRV_START_FAIL                        (-76)  /* wlan start error */
00142 #define SL_ERROR_FS_FILE_TABLE_LOAD_FAILED                  (-77)  /* init file system failed */
00143 #define SL_ERROR_PREFERRED_NETWORKS_FILE_LOAD_FAILED        (-78)  /* init file system failed */
00144 #define SL_ERROR_HOSTAPD_BSSID_VALIDATION_ERROR             (-79)  /* Ap configurations BSSID error */
00145 #define SL_ERROR_HOSTAPD_FAILED_TO_SETUP_INTERFACE          (-80)  /* Ap configurations interface error */
00146 #define SL_ERROR_MDNS_ENABLE_FAIL                           (-81)  /* mDNS enable failed                */
00147 #define SL_ERROR_HTTP_SERVER_ENABLE_FAILED                  (-82)  /* HTTP server enable failed         */
00148 #define SL_ERROR_DHCP_SERVER_ENABLE_FAILED                  (-83)  /* DHCP server enable failed         */
00149 #define SL_ERROR_PREFERRED_NETWORK_LIST_FULL                (-93)  /* supplicant error  */
00150 #define SL_ERROR_PREFERRED_NETWORKS_FILE_WRITE_FAILED       (-94)  /* supplicant error  */
00151 #define SL_ERROR_DHCP_CLIENT_RENEW_FAILED                   (-100) /* DHCP client error */
00152 /* WLAN Connection management status */
00153 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_UNSPECIFIED                (-102)  
00154 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_AUTH_REJECT                (-103)  
00155 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_ASSOC_REJECT               (-104)  
00156 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_SECURITY_FAILURE           (-105)  
00157 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_AP_DEAUTHENTICATE          (-106)  
00158 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_AP_DISASSOCIATE            (-107)  
00159 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_ROAMING_TRIGGER            (-108)  
00160 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_DISCONNECT_DURING_CONNECT  (-109)  
00161 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_SG_RESELECT                (-110)  
00162 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_ROC_FAILURE                (-111)  
00163 #define SL_GENERAL_ERROR_CON_MGMT_STATUS_MIC_FAILURE                (-112)  
00164 /* end of WLAN connection management error statuses */
00165 #define SL_ERROR_WAKELOCK_ERROR_PREFIX                      (-115)  /* Wake lock expired */
00166 #define SL_ERROR_LENGTH_ERROR_PREFIX                        (-116)  /* Uart header length error */
00167 #define SL_ERROR_MDNS_CREATE_FAIL                           (-121)  /* mDNS create failed */
00168 #define SL_ERROR_GENERAL_ERROR                              (-127)
00169 
00170 
00171 
00172 #define SL_DEVICE_GENERAL_CONFIGURATION           (1)
00173 #define SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME (11)
00174 #define SL_DEVICE_GENERAL_VERSION                 (12)
00175 #define SL_DEVICE_STATUS                          (2)
00176 
00177 /*
00178     Declare the different event group classifications
00179     The SimpleLink device send asynchronous events. Each event has a group 
00180     classification according to its nature.
00181 */
00182 
00183 /* SL_EVENT_CLASS_WLAN connection user events */
00184 #define SL_WLAN_CONNECT_EVENT                     (1)
00185 #define SL_WLAN_DISCONNECT_EVENT                  (2)
00186 /* WLAN Smart Config user events */
00187 #define SL_WLAN_SMART_CONFIG_COMPLETE_EVENT       (3)
00188 #define SL_WLAN_SMART_CONFIG_STOP_EVENT           (4)
00189 /* WLAN AP user events */
00190 #define SL_WLAN_STA_CONNECTED_EVENT               (5)
00191 #define SL_WLAN_STA_DISCONNECTED_EVENT            (6)
00192 /* WLAN P2P user events */
00193 #define SL_WLAN_P2P_DEV_FOUND_EVENT               (7)
00194 #define    SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT     (8)
00195 #define SL_WLAN_CONNECTION_FAILED_EVENT           (9)
00196 
00197 typedef enum
00198 {
00199     SL_DEVICE_GENERAL_ERROR_EVENT = 1,
00200     SL_DEVICE_ABORT_ERROR_EVENT,
00201     SL_DEVICE_DRIVER_ASSERT_ERROR_EVENT,
00202     SL_DEVICE_DRIVER_TIMEOUT_CMD_COMPLETE,
00203     SL_DEVICE_DRIVER_TIMEOUT_SYNC_PATTERN,
00204     SL_DEVICE_DRIVER_TIMEOUT_ASYNC_EVENT,
00205     SL_DEVICE_ERROR_MAX
00206 } 
00207 SlDeviceDriverError_e;
00208 
00209 /* SL_EVENT_CLASS_BSD user events */               
00210 #define    SL_SOCKET_TX_FAILED_EVENT              (1) 
00211 #define SL_SOCKET_ASYNC_EVENT                     (2)
00212 /* SL_EVENT_CLASS_NETAPP user events */   
00213 #define    SL_NETAPP_IPV4_IPACQUIRED_EVENT        (1)
00214 #define    SL_NETAPP_IPV6_IPACQUIRED_EVENT        (2)
00215 #define SL_NETAPP_IP_LEASED_EVENT                 (3)
00216 #define SL_NETAPP_IP_RELEASED_EVENT               (4)
00217 
00218 /* Server Events */
00219 #define SL_NETAPP_HTTPGETTOKENVALUE_EVENT          (1)
00220 #define SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT         (2)
00221 
00222 
00223 /*
00224     Declare the different event group classifications for sl_DevGet
00225     for getting status indications
00226  */
00227 
00228 /* Events list to mask/unmask*/
00229 #define SL_EVENT_CLASS_GLOBAL                     (0)
00230 #define SL_EVENT_CLASS_DEVICE                     (1)
00231 #define SL_EVENT_CLASS_WLAN                       (2)
00232 #define SL_EVENT_CLASS_BSD                        (3)
00233 #define SL_EVENT_CLASS_NETAPP                     (4)
00234 #define SL_EVENT_CLASS_NETCFG                     (5)
00235 #define SL_EVENT_CLASS_FS                         (6)
00236 
00237   
00238 /******************  DEVICE CLASS status ****************/
00239 #define EVENT_DROPPED_DEVICE_ASYNC_GENERAL_ERROR          (0x00000001L)
00240 #define STATUS_DEVICE_SMART_CONFIG_ACTIVE                 (0x80000000L)
00241   
00242 /******************  WLAN CLASS status ****************/
00243 #define EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE      (0x00000001L)
00244 #define EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE  (0x00000002L)
00245 #define EVENT_DROPPED_WLAN_STA_CONNECTED                  (0x00000004L)
00246 #define EVENT_DROPPED_WLAN_STA_DISCONNECTED               (0x00000008L)
00247 #define STATUS_WLAN_STA_CONNECTED                         (0x80000000L)
00248                       
00249 /******************  NETAPP CLASS status ****************/
00250 #define EVENT_DROPPED_NETAPP_IPACQUIRED                   (0x00000001L)
00251 #define EVENT_DROPPED_NETAPP_IPACQUIRED_V6                (0x00000002L)
00252 #define EVENT_DROPPED_NETAPP_IP_LEASED                    (0x00000004L)
00253 #define EVENT_DROPPED_NETAPP_IP_RELEASED                  (0x00000008L)
00254                       
00255 /******************  BSD CLASS status ****************/
00256 #define EVENT_DROPPED_SOCKET_TXFAILEDASYNCRESPONSE        (0x00000001L)
00257   
00258 /******************  FS CLASS  ****************/
00259   
00260 
00261 
00262 
00263 /********************************************
00264 For backward compatability (version 1.0.0.10)
00265 *********************************************/
00266 #define SL_ERROR_CON_MGMT_STATUS_UNSPECIFIED                SL_GENERAL_ERROR_CON_MGMT_STATUS_UNSPECIFIED
00267 #define SL_ERROR_CON_MGMT_STATUS_AUTH_REJECT                SL_GENERAL_ERROR_CON_MGMT_STATUS_AUTH_REJECT
00268 #define SL_ERROR_CON_MGMT_STATUS_ASSOC_REJECT               SL_GENERAL_ERROR_CON_MGMT_STATUS_ASSOC_REJECT
00269 #define SL_ERROR_CON_MGMT_STATUS_SECURITY_FAILURE           SL_GENERAL_ERROR_CON_MGMT_STATUS_SECURITY_FAILURE
00270 #define SL_ERROR_CON_MGMT_STATUS_AP_DEAUTHENTICATE          SL_GENERAL_ERROR_CON_MGMT_STATUS_AP_DEAUTHENTICATE
00271 #define SL_ERROR_CON_MGMT_STATUS_AP_DISASSOCIATE            SL_GENERAL_ERROR_CON_MGMT_STATUS_AP_DISASSOCIATE
00272 #define SL_ERROR_CON_MGMT_STATUS_ROAMING_TRIGGER            SL_GENERAL_ERROR_CON_MGMT_STATUS_ROAMING_TRIGGER
00273 #define SL_ERROR_CON_MGMT_STATUS_DISCONNECT_DURING_CONNECT  SL_GENERAL_ERROR_CON_MGMT_STATUS_DISCONNECT_DURING_CONNECT
00274 #define SL_ERROR_CON_MGMT_STATUS_SG_RESELECT                SL_GENERAL_ERROR_CON_MGMT_STATUS_SG_RESELECT
00275 #define SL_ERROR_CON_MGMT_STATUS_ROC_FAILURE                SL_GENERAL_ERROR_CON_MGMT_STATUS_ROC_FAILURE
00276 #define SL_ERROR_CON_MGMT_STATUS_MIC_FAILURE                SL_GENERAL_ERROR_CON_MGMT_STATUS_MIC_FAILURE
00277 #define SL_DEVICE_FATAL_ERROR_EVENT                         SL_DEVICE_GENERAL_ERROR_EVENT  
00278 
00279 
00280 /*****************************************************************************/
00281 /* Structure/Enum declarations                                               */
00282 /*****************************************************************************/
00283 
00284 
00285 #ifdef SL_IF_TYPE_UART
00286 typedef struct  
00287 {
00288     _u32             BaudRate;
00289     _u8              FlowControlEnable;
00290     _u8              CommPort;
00291 } SlUartIfParams_t;
00292 #endif
00293 
00294 typedef struct
00295 {
00296     _u32               ChipId;
00297     _u32               FwVersion[4];
00298     _u8                PhyVersion[4];
00299 }_SlPartialVersion;
00300 
00301 typedef struct
00302 {
00303     _SlPartialVersion ChipFwAndPhyVersion;
00304     _u32               NwpVersion[4];
00305     _u16               RomVersion;
00306     _u16               Padding;
00307 }SlVersionFull;
00308 
00309 typedef struct
00310 {
00311     _u32                AbortType;
00312     _u32                AbortData;
00313 }sl_DeviceReportAbort;
00314 
00315 
00316 typedef struct
00317 {
00318     _i8                status;
00319     SlErrorSender_e        sender;
00320 }sl_DeviceReport;
00321 
00322 typedef struct
00323 {
00324     _u32  info;
00325 }sl_DeviceDriverErrorReport;
00326 typedef union
00327 {
00328   sl_DeviceReport           deviceEvent; 
00329   sl_DeviceReportAbort      deviceReport;  
00330   sl_DeviceDriverErrorReport deviceDriverReport;
00331 } SlDeviceEventData_u;
00332 
00333 typedef struct
00334 {
00335    SlDeviceDriverError_e Event;
00336    SlDeviceEventData_u  EventData;
00337 } SlDeviceEvent_t;
00338 
00339 typedef struct  
00340 {
00341        /* time */
00342     _u32                sl_tm_sec;
00343     _u32                sl_tm_min;
00344     _u32                sl_tm_hour;
00345        /* date */
00346     _u32                sl_tm_day; /* 1-31 */
00347     _u32                sl_tm_mon; /* 1-12 */
00348     _u32                sl_tm_year; /*  YYYY 4 digits  */
00349     _u32                sl_tm_week_day; /* not required */
00350     _u32                sl_tm_year_day; /* not required */ 
00351     _u32                reserved[3];  
00352 }SlDateTime_t;
00353 
00354 /******************************************************************************/
00355 /* Type declarations                                                          */
00356 /******************************************************************************/
00357 typedef void (*P_INIT_CALLBACK)(_u32 Status);
00358 
00359 /*****************************************************************************/
00360 /* Function prototypes                                                       */
00361 /*****************************************************************************/
00362 
00363 /*!
00364     \brief Start the SimpleLink device
00365     
00366     This function initialize the communication interface, set the enable pin 
00367     of the device, and call to the init complete callback.
00368 
00369     \param[in]      pIfHdl              Opened Interface Object. In case the interface 
00370                                         must be opened outside the SimpleLink Driver, the
00371                                         user might give the handler to be used in \n
00372                                         any access of the communication interface with the 
00373                                         device (UART/SPI). \n
00374                                         The SimpleLink driver will open an interface port
00375                                         only if this parameter is null! \n
00376     \param[in]      pDevName            The name of the device to open. Could be used when 
00377                                         the pIfHdl is null, to transfer information to the 
00378                                         open interface function \n
00379                                         This pointer could be used to pass additional information to
00380                                         sl_IfOpen in case it is required (e.g. UART com port name)
00381     \param[in]      pInitCallBack       Pointer to function that would be called
00382                                         on completion of the initialization process.\n
00383                                         If this parameter is NULL the function is 
00384                                         blocked until the device initialization 
00385                                         is completed, otherwise the function returns 
00386                                         immediately.
00387 
00388     \return         Returns the current active role (STA/AP/P2P) or an error code:
00389                     - ROLE_STA, ROLE_AP, ROLE_P2P in case of success, 
00390                       otherwise in failure one of the following is return:
00391                     - ROLE_STA_ERR  (Failure to load MAC/PHY in STA role)
00392                     - ROLE_AP_ERR  (Failure to load MAC/PHY in AP role)
00393                     - ROLE_P2P_ERR  (Failure to load MAC/PHY in P2P role)
00394 
00395     
00396      \sa             sl_Stop
00397 
00398     \note           belongs to \ref basic_api
00399 
00400     \warning        This function must be called before any other SimpleLink API is used, or after sl_Stop is called for reinit the device
00401     \par            Example:
00402     \code            
00403                    An example for open interface without callback routine. The interface name and handler are
00404                    handled by the sl_IfOpen routine: 
00405 
00406                     if( sl_Start(NULL, NULL, NULL) < 0 )
00407                    {
00408                        LOG("Error opening interface to device\n"); 
00409                    }
00410     \endcode
00411 */
00412 #if _SL_INCLUDE_FUNC(sl_Start)
00413 _i16 sl_Start(const void* pIfHdl, _i8*  pDevName, const P_INIT_CALLBACK pInitCallBack);
00414 #endif
00415 
00416 /*!
00417     \brief Stop the SimpleLink device
00418 
00419     This function clears the enable pin of the device, closes the communication \n
00420     interface and invokes the stop complete callback 
00421 
00422     \param[in]      timeout                       Stop timeout in msec. Should be used to give the device time to finish \n 
00423                                                   any transmission/reception that is not completed when the function was called. \n
00424                     Additional options:
00425                     - 0                             Enter to hibernate immediately \n
00426                     - 0xFFFF                        Host waits for device's response before \n
00427                                                     hibernating, without timeout protection \n      
00428                     - 0 < Timeout[msec] < 0xFFFF    Host waits for device's response before \n
00429                                                     hibernating, with a defined timeout protection \n
00430                                                     This timeout defines the max time to wait. The NWP \n
00431                                                     response can be sent earlier than this timeout.
00432 
00433     \return         On success, zero is returned. On error, -1 is returned     
00434  
00435     \sa             sl_Start
00436 
00437     \note           This API will shutdown the device and invoke the "i/f close" function regardless \n
00438                     if it was opened implicitly or explicitly. \n
00439                     It is up to the platform interface library to properly handle interface close \n
00440                     routine \n
00441                     belongs to \ref basic_api \n
00442     \warning     
00443 */
00444 #if _SL_INCLUDE_FUNC(sl_Stop)
00445 _i16 sl_Stop(const _u16 timeout);
00446 #endif
00447 
00448 
00449 /*!
00450     \brief     Internal function for setting device configurations
00451 
00452     \return    On success, zero is returned. On error, -1 is 
00453                returned
00454    
00455     \param[in] DeviceSetId   configuration id
00456     \param[in] Option         configurations option
00457     \param[in] ConfigLen     configurations len
00458     \param[in] pValues         configurations values
00459 
00460     \sa         
00461     \note 
00462     \warning     
00463     \par   Examples:
00464     \code
00465          Setting device time and date example:
00466 
00467          SlDateTime_t dateTime= {0};
00468          dateTime.sl_tm_day =   (_u32)23;          // Day of month (DD format) range 1-31
00469          dateTime.sl_tm_mon =   (_u32)6;           // Month (MM format) in the range of 1-12 
00470          dateTime.sl_tm_year =  (_u32)2014;        // Year (YYYY format) 
00471          dateTime.sl_tm_hour =  (_u32)17;          // Hours in the range of 0-23
00472          dateTime.sl_tm_min =   (_u32)55;          // Minutes in the range of 0-59
00473          dateTime.sl_tm_sec =   (_u32)22;          // Seconds in the range of  0-59
00474          sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
00475                    SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
00476                    sizeof(SlDateTime_t),
00477                    (_u8 *)(&dateTime));
00478 
00479     \endcode
00480 */
00481 #if _SL_INCLUDE_FUNC(sl_DevSet)
00482 _i32 sl_DevSet(const _u8 DeviceSetId ,const _u8 Option,const _u8 ConfigLen,const _u8 *pValues);
00483 #endif
00484 
00485 /*!
00486     \brief      Internal function for getting device configurations
00487     \return     On success, zero is returned. On error, -1 is 
00488                 returned
00489     \param[in]  DeviceGetId   configuration id - example SL_DEVICE_STATUS
00490     \param[out] pOption   Get configurations option, example for get status options
00491                             - SL_EVENT_CLASS_GLOBAL
00492                             - SL_EVENT_CLASS_DEVICE
00493                             - SL_EVENT_CLASS_WLAN  
00494                             - SL_EVENT_CLASS_BSD   
00495                             - SL_EVENT_CLASS_NETAPP
00496                             - SL_EVENT_CLASS_NETCFG
00497                             - SL_EVENT_CLASS_FS 
00498     \param[out] pConfigLen   The length of the allocated memory as input, when the
00499                              function complete, the value of this parameter would be
00500                              the len that actually read from the device.\n 
00501                              If the device return length that is longer from the input 
00502                              value, the function will cut the end of the returned structure
00503                              and will return SL_ESMALLBUF
00504     \param[out] pValues      Get configurations values
00505     \sa         
00506     \note 
00507     \warning  
00508     \par        Examples:
00509     \code
00510      Example for getting WLAN class status:
00511      _u32 statusWlan;
00512      _u8 pConfigOpt;
00513      _u8 pConfigLen;
00514      pConfigOpt = SL_EVENT_CLASS_WLAN;
00515      pConfigLen = sizeof(_u32);
00516      sl_DevGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(_u8 *)(&statusWlan));
00517      Example for getting version:
00518      SlVersionFull ver;
00519      pConfigLen = sizeof(ver);
00520      pConfigOpt = SL_DEVICE_GENERAL_VERSION;
00521      sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&pConfigOpt,&pConfigLen,(_u8 *)(&ver));
00522      printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST %d.%d.%d.%d\n",
00523              ver.ChipFwAndPhyVersion.ChipId,
00524              ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
00525              ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
00526              ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
00527              ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
00528              ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
00529              ver.RomVersion,
00530              SL_MAJOR_VERSION_NUM,SL_MINOR_VERSION_NUM,SL_VERSION_NUM,SL_SUB_VERSION_NUM);
00531 
00532      \endcode
00533      \code
00534          Getting Device time and date example:
00535          
00536          SlDateTime_t dateTime =  {0};  
00537          _i8 configLen = sizeof(SlDateTime_t); 
00538          _i8 configOpt = SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME;
00539          sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&configOpt, &configLen,(_u8 *)(&dateTime)); 
00540          
00541          printf("Day %d,Mon %d,Year %d,Hour %,Min %d,Sec %d\n",dateTime.sl_tm_day,dateTime.sl_tm_mon,dateTime.sl_tm_year
00542                  dateTime.sl_tm_hour,dateTime.sl_tm_min,dateTime.sl_tm_sec);
00543      \endcode
00544 */
00545 #if _SL_INCLUDE_FUNC(sl_DevGet)
00546 _i32 sl_DevGet(const _u8 DeviceGetId,_u8 *pOption,_u8 *pConfigLen, _u8 *pValues);
00547 #endif
00548 
00549 
00550 /*!
00551     \brief          Set asynchronous event mask
00552     
00553     Mask asynchronous events from the device. Masked events do not
00554     generate asynchronous messages from the device. 
00555     By default - all events are active
00556     
00557     \param[in]      EventClass          The classification groups that the 
00558                                         mask is referred to. Need to be one of
00559                                         the following:
00560                                         - SL_EVENT_CLASS_GLOBAL
00561                                         - SL_EVENT_CLASS_DEVICE
00562                                         - SL_EVENT_CLASS_WLAN  
00563                                         - SL_EVENT_CLASS_BSD   
00564                                         - SL_EVENT_CLASS_NETAPP
00565                                         - SL_EVENT_CLASS_NETCFG
00566                                         - SL_EVENT_CLASS_FS 
00567 
00568 
00569     \param[in]      Mask               Event Mask bitmap. Valid mask are (per group):
00570                                         - SL_EVENT_CLASS_WLAN user events
00571                                           - SL_WLAN_CONNECT_EVENT                     
00572                                           - SL_WLAN_DISCONNECT_EVENT
00573                                         - SL_EVENT_CLASS_DEVICE user events
00574                                           - SL_DEVICE_GENERAL_ERROR_EVENT
00575                                         - SL_EVENT_CLASS_BSD user events
00576                                           - SL_SOCKET_TX_FAILED_EVENT     
00577                                           - SL_SOCKET_ASYNC_EVENT 
00578                                         - SL_EVENT_CLASS_NETAPP user events
00579                                           - SL_NETAPP_IPV4_IPACQUIRED_EVENT 
00580                                           - SL_NETAPP_IPV6_IPACQUIRED_EVENT
00581      
00582     \return         On success, zero is returned. On error, -1 is returned       
00583 
00584     \sa             sl_EventMaskGet
00585 
00586     \note           belongs to \ref ext_api
00587      
00588     \warning     
00589     \par           Example:
00590     \code          
00591 
00592     An example of masking connection/disconnection async events from WLAN class:
00593                    sl_EventMaskSet(SL_EVENT_CLASS_WLAN, (SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
00594     
00595     \endcode
00596 */
00597 #if _SL_INCLUDE_FUNC(sl_EventMaskSet)
00598 _i16 sl_EventMaskSet(const _u8 EventClass ,const _u32 Mask);
00599 #endif
00600 
00601 /*!
00602     \brief Get current event mask of the device
00603     
00604     return the events bit mask from the device. In case that event is 
00605     masked, the device is not sending this event.  
00606     
00607     \param[in]      EventClass          The classification groups that the 
00608                                         mask is referred to. Need to be one of
00609                                         the following:
00610                                         - SL_EVENT_CLASS_GLOBAL
00611                                         - SL_EVENT_CLASS_DEVICE
00612                                         - SL_EVENT_CLASS_WLAN  
00613                                         - SL_EVENT_CLASS_BSD   
00614                                         - SL_EVENT_CLASS_NETAPP
00615                                         - SL_EVENT_CLASS_NETCFG
00616                                         - SL_EVENT_CLASS_FS 
00617 
00618     \param[out]      pMask              Pointer to Mask bitmap where the 
00619                                         value should be stored. Bitmasks are the same as in \ref sl_EventMaskSet
00620      
00621     \return         On success, zero is returned. On error, -1 is returned       
00622      
00623     \sa             sl_EventMaskSet         
00624 
00625     \note           belongs to \ref ext_api
00626 
00627     \warning     
00628     \par           Example:
00629     \code          
00630 
00631     An example of getting an event mask for WLAN class
00632     _u32 maskWlan;
00633                    sl_StatusGet(SL_EVENT_CLASS_WLAN,&maskWlan);
00634 
00635    \endcode
00636 */
00637 #if _SL_INCLUDE_FUNC(sl_EventMaskGet)
00638 _i16 sl_EventMaskGet(const _u8 EventClass,_u32 *pMask);
00639 #endif
00640 
00641 
00642 /*!
00643     \brief the simple link task entry
00644 
00645     \Param
00646     This function must be called from the main loop or from dedicated thread in
00647     the following cases:
00648         - Non-Os Platform - should be called from the mail loop
00649         - Multi Threaded Platform when the user does not implement the external spawn functions - 
00650            should be called from dedicated thread allocated to the simplelink driver.
00651            In this mode the function never return.
00652     
00653     \return         None
00654     
00655     \sa             sl_Stop
00656 
00657     \note           belongs to \ref basic_api
00658 
00659     \warning        This function must be called from a thread that is start running before 
00660                     any call to other simple link API
00661 */
00662 #if _SL_INCLUDE_FUNC(sl_Task)
00663 void sl_Task(void);
00664 #endif
00665 
00666 
00667 /*!
00668     \brief Setting the internal uart mode 
00669 
00670     \param[in]      pUartParams          Pointer to the uart configuration parameter set: 
00671                                          baudrate     - up to 711 Kbps
00672                                          flow control - enable/disable 
00673                                          comm port    - the comm port number
00674     
00675     \return         On success zero is returned, otherwise - Failed.   
00676     
00677     \sa             sl_Stop
00678 
00679     \note           belongs to \ref basic_api
00680 
00681     \warning        This function must consider the host uart capability
00682 */
00683 #ifdef SL_IF_TYPE_UART
00684 #if _SL_INCLUDE_FUNC(sl_UartSetMode)
00685 _i16 sl_UartSetMode(const SlUartIfParams_t* pUartParams);
00686 #endif
00687 #endif
00688 
00689 /*!
00690 
00691  Close the Doxygen group.
00692  @}
00693 
00694  */
00695 
00696 
00697 #ifdef  __cplusplus
00698 }
00699 #endif /*  __cplusplus */
00700 
00701 #endif  /*  __DEVICE_H__ */
00702 
00703