Marco Hsu / WIFI_API
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nmi_wifi_adapter.h Source File

nmi_wifi_adapter.h

00001 /*
00002  * wpa_supplicant/hostapd / OS specific functions
00003  * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #ifndef __NMI_WIFI_ADAPER_H__
00016 #define __NMI_WIFI_ADAPER_H__
00017 
00018 #include <stddef.h>
00019 #include <stdarg.h>
00020 
00021 //#include "os_api.h"
00022 
00023 //#include "wifisupp_api.h"   //ksong 2012.8.28
00024 
00025 #include <stdbool.h>
00026 #include <stdint.h>
00027     /* exact-width signed integer types */
00028 typedef   signed          char int8;
00029 typedef   signed short     int int16;
00030 typedef   signed           int int32;
00031 typedef   signed       __int64 int64;
00032 
00033 typedef   signed          char sint8;
00034 typedef   signed short     int sint16;
00035 typedef   signed           int sint32;
00036 typedef   signed       __int64 sint64;
00037 
00038     /* exact-width unsigned integer types */
00039 typedef unsigned          char uint8;
00040 typedef unsigned short     int uint16;
00041 typedef unsigned           int uint32;
00042 typedef unsigned       __int64 uint64;
00043 
00044 //#include "nmi_wlan_if.h"  command by Tsungta
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 /*******************************************************************************/
00051 //#define GPIO_WIFI_IRQ_ID 0
00052 
00053 
00054 #define NMI_INVALID_THREAD_ID    SCI_INVALID_BLOCK_ID
00055 
00056 
00057 /********************************************
00058 
00059     Debug Flags
00060 
00061 ********************************************/
00062 #define NMI_INIT            0x00000001
00063 #define NMI_ERR         0x00000002
00064 #define NMI_TX          0x00000004
00065 #define NMI_INTR        0x00000008
00066 #define NMI_RX          0x00000010
00067 #define NMI_SCAN        0x00000020
00068 #define NMI_JOIN            0x00000040
00069 #define NMI_STATUS      0x00000080
00070 #define NMI_POLL        0x00000100
00071 #define NMI_IF          0x00000200
00072 #define NMI_ALL         0xffffffff
00073 
00074 /*******************************************************************************/
00075 
00076 typedef unsigned char BOOLEAN;
00077 typedef long os_time_t;
00078 typedef unsigned long       NMI_TCPIP_IP_ADDR_T; 
00079 typedef unsigned long       NMI_TCPIP_NET_ID_T; 
00080 typedef unsigned char       NMI_BOOLEAN_T;
00081 typedef unsigned long       NMI_BLOCK_ID;
00082 typedef void *  NMI_SCI_EVENT_GROUP_PTR;
00083 typedef void *  NMI_SCI_MUTEX_PTR;
00084 typedef void *  NMI_SCI_SEMAPHORE_PTR;
00085 
00086 #if 0//Ryan
00087 typedef enum
00088 {
00089     NMI_MESSAGE_START = WIFISUPP_SIG_CUSTOM_START,
00090     NMI_MESSAGE_RESTART_MAC,
00091     NMI_MESSAGE_POWER_SAVE,
00092     NMI_MESSAGE_SLEEP,
00093     NMI_MESSAGE_MAX = WIFISUPP_SIG_CUSTOM_END
00094 }NMI_MESSAGE_E;
00095 #endif
00096 
00097 //#define CFLWCHAR        unsigned short    // uni-code char
00098 #define SFS_MAX_PATH    255
00099 
00100 // EAPOL data receive upcall function
00101 typedef void (*NMI_TCPIP_EAPOL_RX_CALLBACK_FPTR)( 
00102     const unsigned char*    data_ptr,       /* EAPOL data pointer */
00103     unsigned int            data_len,       /* EAPOL data length */
00104     const unsigned char*    src_mac_ptr,    /* source mac address pointer */
00105     unsigned int            src_mac_len,    /* source mac length, unit: byte for ethernet, it should be 6 */
00106     NMI_TCPIP_NET_ID_T      net_id );       /* net interface ID */
00107 
00108 
00109 // TCPIP interface error enum
00110 typedef enum
00111 {
00112     NMI_TCPIP_ERROR_OK = 0,     /* no error */
00113     NMI_TCPIP_ERROR_INVALPARAM, /* invalid parameter */
00114     NMI_TCPIP_ERROR_INVALNETID, /* invalid net id */
00115     NMI_TCPIP_ERROR_MEMALLOC,   /* memory alloc fail */
00116     NMI_TCPIP_ERROR_LOGICAL,    /* calling or running logical error */
00117     NMI_TCPIP_ERROR_TIMEOUT,    /* time out */
00118     NMI_TCPIP_ERROR_MAX
00119 } NMI_TCPIP_ERROR_E;
00120 
00121 
00122 typedef enum
00123 {
00124     NMI_TCPIP_PKTTYPE_NULL = 0,
00125     NMI_TCPIP_PKTTYPE_IP,       /* packet is encapsulated as IP */
00126     NMI_TCPIP_PKTTYPE_ETHER,    /* packet is encapsulated as Ethernet */
00127     NMI_TCPIP_PKTTYPE_MAX
00128 } NMI_TCPIP_PACKET_TYPE_E;
00129 
00130 
00131 // TCPIP net interface IP addresses
00132 // NOTES : IP addresses should be in Big-Ending
00133 typedef struct _netif_ipaddr_tag
00134 {
00135     NMI_TCPIP_IP_ADDR_T  ipaddr;     /* host IP */
00136     NMI_TCPIP_IP_ADDR_T  snmask;     /* subnet mask */
00137     NMI_TCPIP_IP_ADDR_T  gateway;    /* gateway */
00138     NMI_TCPIP_IP_ADDR_T  dns1;       /* primary DNS */
00139     NMI_TCPIP_IP_ADDR_T  dns2;       /* secondary DNS */
00140 } NMI_TCPIP_NETIF_IPADDR_T;
00141 
00142 // TCPIP net interface hardware address
00143 typedef struct _netif_haddr_tag
00144 {
00145     unsigned char*  addr_ptr;           /* hard address pointer */
00146     unsigned int    addr_len;           /* hard address length, unit: byte */
00147 } NMI_TCPIP_NETIF_HADDR_T;
00148 
00149 
00150 // TCPIP packet info struct
00151 typedef struct _packet_info_tag
00152 {
00153     unsigned char*      data_ptr;   /* data pointer */
00154     unsigned int        data_len;   /* data length - full packet encapsulation length */
00155     NMI_TCPIP_NET_ID_T  net_id;     /* net interface ID */
00156 } NMI_TCPIP_PACKET_INFO_T;
00157 
00158 
00159 typedef unsigned int (*NMI_TCPIP_TX_REQ_FPTR)( 
00160     const NMI_TCPIP_PACKET_INFO_T*  pkt_info_ptr );
00161 
00162 // TCPIP receive flow control setting function 
00163 typedef void (*NMI_TCPIP_RX_FLCTRL_FPTR)(
00164     NMI_BOOLEAN_T         is_set,     /* flow control flag: TRUE - set; FALSE - not set */
00165     NMI_TCPIP_NET_ID_T   net_id );   /* net interface ID */
00166 
00167 
00168 
00169 // TCPIP net interface configuration struct
00170 typedef struct _netif_cfg_tag
00171 {
00172     NMI_TCPIP_PACKET_TYPE_E     pkt_type;       /* packet type between tcpip and low layer */
00173     NMI_TCPIP_TX_REQ_FPTR       tx_req_fptr;    /* tx function pointer for data sending from tcpip to low layer */
00174     NMI_BOOLEAN_T               is_async_tx;    /* tx mode: TRUE - async send; FALSE - sync send */
00175     NMI_TCPIP_NETIF_IPADDR_T    saddr;          /* soft (IP) address */
00176     NMI_TCPIP_NETIF_HADDR_T     haddr;          /* hard (MAC) address */
00177     unsigned int                mtu;            /* MTU of the low layer */
00178     unsigned int                tx_rate;        /* max tx send rate - it's useful in tx flow control */
00179     NMI_TCPIP_RX_FLCTRL_FPTR    rx_flctrl_fptr; /* rx flow control function pointer, this is optional, can be NULL */
00180     char*                       netif_name_ptr; /* net interface name, given by low layer, it can be NULL, but we recommend caller set one for better debug */
00181 } NMI_TCPIP_NETIF_CFG_T;
00182 
00183 
00184 /*******************************************************************************/
00185 
00186 /**--------------------------------------------------------------------------*
00187  **                         MACRO DEFINITION                                 *
00188  **--------------------------------------------------------------------------*/
00189 #define NMI_WIFISUPP_BSSID_LEN              6               //the length of BSSID in bytes
00190 #define NMI_WIFISUPP_SSID_MAX_LEN           32              //the MAX length of SSID in bytes
00191 #define NMI_WIFISUPP_WEP_IV_LEN             3               //the length of IV in WEP
00192 #define NMI_WIFISUPP_WEP_64BITS_KEY_LEN     8               //the length of 64bits WEP key
00193 #define NMI_WIFISUPP_WEP_128BITS_KEY_LEN    16              //the length of 128bits WEP key
00194 #define NMI_WIFISUPP_WPA_PSK_LEN            64              //the length of WPA PSK
00195 #ifdef WLAN_SUPPORT
00196 #define NMI_WIFISUPP_WAPI_PSK_LEN           64              //the length of WAPI PSK
00197 #endif
00198 #define NMI_WIFISUPP_MAX_FILE_PATH_LEN      SFS_MAX_PATH    //the MAX file path supported
00199 #define NMI_WIFISUPP_WEP_KEY_ID_MAX         4               //the max WEP key ID
00200 
00201 #define NMI_WIFISUPP_MAX_USERNAME_LEN       32
00202 #define NMI_WIFISUPP_MAX_PSW_LEN            32
00203 /**--------------------------------------------------------------------------*
00204  **                         typedef                                          *
00205  **--------------------------------------------------------------------------*/
00206 /*---------------------------------------------------------------------------*/
00207 /*                          Enum                                             */
00208 /*---------------------------------------------------------------------------*/
00209 typedef enum
00210 {
00211     NMI_WIFISUPP_NETWORK_MODE_INFRASTRUCTURE,   //infrastructure
00212     NMI_WIFISUPP_NETWORK_MODE_ADHOC,            //ad-hoc
00213     NMI_WIFISUPP_NETWORK_MODE_MAX
00214 } NMI_WIFISUPP_NETWORK_MODE_E;
00215 
00216 typedef enum
00217 {
00218     NMI_WIFISUPP_RESULT_SUCC,           //success
00219     NMI_WIFISUPP_RESULT_FAIL,           //fail
00220     NMI_WIFISUPP_RESULT_NOT_FOUND,      //the AP is not found
00221     NMI_WIFISUPP_RESULT_TIMEOUT,        //operation time out
00222     NMI_WIFISUPP_RESULT_RESTRICTED,     //connection is restricted
00223     NMI_WIFISUPP_WRONG_PASSPHRASE,
00224     NMI_WIFISUPP_RESULT_MAX
00225 } NMI_WIFISUPP_RESULT_E;
00226 
00227 typedef enum
00228 {
00229     NMI_WIFISUPP_ENCRYP_PROTOCOL_OPENSYS,   //open system
00230     NMI_WIFISUPP_ENCRYP_PROTOCOL_WEP,       //WEP
00231     NMI_WIFISUPP_ENCRYP_PROTOCOL_WPA,       //WPA
00232     NMI_WIFISUPP_ENCRYP_PROTOCOL_WPA2,      //WPA2
00233     NMI_WIFISUPP_ENCRYP_PROTOCOL_WAPI,      //WAPI
00234     NMI_WIFISUPP_ENCRYP_PROTOCOL_MAX
00235 }NMI_WIFISUPP_ENCRYP_PROTOCOL_E;
00236 
00237 typedef enum
00238 {
00239     NMI_WIFISUPP_CIPHER_TKIP,       //TKIP
00240     NMI_WIFISUPP_CIPHER_CCMP,       //CCMP
00241     NMI_WIFISUPP_CIPHER_WEP,        //wep
00242     NMI_WIFISUPP_CIPHER_SMS4,        //WAPI SMS4
00243     NMI_WIFISUPP_CIPHER_MAX
00244 }NMI_WIFISUPP_CIPHER_E;
00245 
00246 typedef enum
00247 {
00248     NMI_WIFISUPP_WEP_KEY_TYPE_64BITS,       //64bits_type WEP Key
00249     NMI_WIFISUPP_WEP_KEY_TYPE_128BITS,      //128bits_type WEP Key
00250     NMI_WIFISUPP_WEP_KEY_TYPE_MAX
00251 }NMI_WIFISUPP_WEP_KEY_TYPE_E;
00252 
00253 typedef enum
00254 {
00255     NMI_WIFISUPP_WPA_CREDENTIAL_TYPE_PSK,   //WPA using PSK
00256     NMI_WIFISUPP_WPA_CREDENTIAL_TYPE_EAP,   //WPA using EAP   802.1X
00257     NMI_WIFISUPP_WPA_CREDENTIAL_TYPE_MAX
00258 }NMI_WIFISUPP_WPA_CREDENTIAL_TYPE_E;
00259 
00260 typedef enum
00261 {
00262     NMI_WIFISUPP_WAPI_CREDENTIAL_TYPE_PSK,   //WAPI using PSK
00263     NMI_WIFISUPP_WAPI_CREDENTIAL_TYPE_CER,   //WAPI using certificate
00264     NMI_WIFISUPP_WAPI_CREDENTIAL_TYPE_MAX
00265 }NMI_WIFISUPP_WAPI_CREDENTIAL_TYPE_E;
00266 
00267 typedef enum
00268 {
00269     NMI_WIFISUPP_CREDENTIAL_TYPE_PSK,
00270     NMI_WIFISUPP_CREDENTIAL_TYPE_RADIUS,
00271     NMI_WIFISUPP_CREDENTIAL_TYPE_CER,
00272     NMI_WIFISUPP_CREDENTIAL_TYPE_MAX
00273 }NMI_WIFISUPP_CREDENTIAL_TYPE_E;
00274 
00275 
00276 typedef enum
00277 {
00278     NMI_WIFISUPP_WPA_EAP_TYPE_TLS,          //EAP using TLS
00279     NMI_WIFISUPP_WPA_EAP_TYPE_TTLS,         //EAP using TTLS
00280     NMI_WIFISUPP_WPA_EAP_TYPE_PEAP,         //EAP using PEAP
00281     NMI_WIFISUPP_WPA_EAP_TYPE_LEAP,         //EAP using LEAP
00282     NMI_WIFISUPP_WPA_EAP_TYPE_SIM,          //EAP using SIM
00283     NMI_WIFISUPP_WPA_EAP_TYPE_AKA,          //EAP using AKA
00284     NMI_WIFISUPP_WPA_EAP_TYPE_FAST,         //EAP using FAST
00285     NMI_WIFISUPP_WPA_EAP_TYPE_MAX
00286 } NMI_WIFISUPP_WPA_EAP_TYPE_E;
00287 
00288 typedef enum
00289 {
00290     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_CHAP,        //CHAP credential
00291     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_PAP,         //PAP credential
00292     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_MSCHAP,      //MSCHAP credential
00293     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_MSCHAP_V2,   //MACHAP_V2 credential
00294     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_GTC,         //GTC credential
00295     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_MAX
00296 } NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_E;
00297 
00298 //bruce add for coexistence: DHCP notice
00299 typedef enum
00300 {
00301     NMI_WIFISUPP_DHCP_NOTICE_START,     //APP begin to do dhcp
00302     NMI_WIFISUPP_DHCP_NOTICE_END,           //APP end dhcp
00303     NMI_WIFISUPP_DHCP_NOTICE_MAX
00304 }NMI_WIFISUPP_DHCP_NOTICE_E;
00305 
00306 /*---------------------------------------------------------------------------*/
00307 /*                          Struct                                           */
00308 /*---------------------------------------------------------------------------*/
00309 typedef struct
00310 {
00311     unsigned char ssid[NMI_WIFISUPP_SSID_MAX_LEN];
00312     unsigned char ssid_len;
00313 } NMI_WIFISUPP_SSID_T;  //SSID
00314 
00315 typedef struct
00316 {
00317     unsigned char bssid[NMI_WIFISUPP_BSSID_LEN];
00318 } NMI_WIFISUPP_BSSID_T; //BSSID
00319 
00320 typedef struct
00321 {
00322     NMI_WIFISUPP_SSID_T             ssid;
00323     NMI_WIFISUPP_BSSID_T            bssid_info;
00324     signed int                      signal_qua;         //signal quality: RSSI
00325     unsigned int                    noise;              //SNR: signal noise ratio
00326     unsigned int                    beacon_interval;    //the BEACON interval
00327     unsigned int                    channel;            //the channel using
00328     NMI_WIFISUPP_ENCRYP_PROTOCOL_E  encryp_protocol;    //the protocol used by encryption    
00329     unsigned int                    rate;               //the rate
00330     NMI_WIFISUPP_NETWORK_MODE_E     network_mode;       //network mode
00331 
00332     NMI_WIFISUPP_CIPHER_E           pairwise_cipher;
00333     NMI_WIFISUPP_CIPHER_E           group_cipher;
00334 
00335     NMI_WIFISUPP_CREDENTIAL_TYPE_E      credential_type;    //AKM type
00336 } NMI_WIFISUPP_SCAN_AP_INFO_T;  //the AP info scanned
00337 
00338 
00339 typedef struct
00340 {
00341     unsigned char   psk[NMI_WIFISUPP_WPA_PSK_LEN];
00342 }NMI_WIFISUPP_WPA_PSK_T;    //WPA Pre_shared Key
00343 
00344 typedef struct
00345 {
00346     BOOLEAN         is_use_file;
00347     unsigned short  certificate_file_path[NMI_WIFISUPP_MAX_FILE_PATH_LEN];  //the tls certificate file path, this MAY NOT available when using buffer
00348     unsigned char   *certificate_buf_ptr;   //the tls certificate buffer, this MAY NOT available when using file
00349     unsigned int    certificate_buf_len;    //the tls certificate buffer length, this MAY NOT available when using file
00350 } NMI_WIFISUPP_WPA_EAP_TLS_T;   //EAP_TLS information
00351 
00352 typedef struct
00353 {
00354     NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_E    inner_credential_type;
00355     char                                    username_arr[NMI_WIFISUPP_MAX_USERNAME_LEN+1];
00356     char                                    psw_arr[NMI_WIFISUPP_MAX_PSW_LEN+1];
00357 } NMI_WIFISUPP_WPA_EAP_TTLS_PEAP_T; //EAP_TTLS/EAP_PEAP information
00358 
00359 typedef struct
00360 {
00361     char    username_arr[NMI_WIFISUPP_MAX_USERNAME_LEN+1];
00362     char    psw_arr[NMI_WIFISUPP_MAX_PSW_LEN+1];
00363 }NMI_WIFISUPP_WPA_EAP_LEAP_T;   //EAP_LEAP information
00364 
00365 typedef struct
00366 {
00367     BOOLEAN         is_use_file;
00368     unsigned short  pac_file_path[NMI_WIFISUPP_MAX_FILE_PATH_LEN];//the FAST PAC file path, this MAY NOT available when using buffer
00369     unsigned char   *pac_buf_ptr;   //the FAST PAC buffer, this MAY NOT available when using file
00370     unsigned int    pac_buf_len;    //the FAST PAC buffer length, this MAY NOT available when using file
00371     char            username_arr[NMI_WIFISUPP_MAX_USERNAME_LEN+1];
00372     char            psw_arr[NMI_WIFISUPP_MAX_PSW_LEN+1];
00373 }NMI_WIFISUPP_WPA_EAP_FAST_T;   //EAP_FAST information
00374 
00375 typedef struct
00376 {
00377     NMI_WIFISUPP_SSID_T     ssid;
00378 }NMI_WIFISUPP_DISCONNECT_REQ_INFO_T;    //information in the request for disconnecting a connection
00379 
00380 typedef struct
00381 {
00382     NMI_WIFISUPP_WPA_EAP_TYPE_E eap_type;
00383     union
00384     {
00385         NMI_WIFISUPP_WPA_EAP_TLS_T          tls_info;
00386         NMI_WIFISUPP_WPA_EAP_TTLS_PEAP_T    ttls_info;
00387         NMI_WIFISUPP_WPA_EAP_TTLS_PEAP_T    peap_info;
00388         NMI_WIFISUPP_WPA_EAP_LEAP_T         leap_info;
00389         NMI_WIFISUPP_WPA_EAP_FAST_T         fast_info;
00390     }eap_info;
00391 } NMI_WIFISUPP_WPA_EAP_T; //WPA EAP information
00392 
00393 #ifdef WLAN_SUPPORT
00394 typedef struct
00395 {
00396     unsigned char   psk[NMI_WIFISUPP_WAPI_PSK_LEN];
00397 }NMI_WIFISUPP_WAPI_PSK_T;
00398 
00399 typedef struct
00400 {
00401     unsigned char    *as_certificate_buf_ptr;
00402     unsigned int    as_certificate_buf_len; 
00403     unsigned char    *asue_certificate_buf_ptr;
00404     unsigned int    asue_certificate_buf_len; 
00405 }NMI_WIFISUPP_WAPI_CER_T;
00406 
00407 typedef struct
00408 {
00409     NMI_WIFISUPP_WAPI_CREDENTIAL_TYPE_E  credential_type;
00410     union
00411     {
00412         NMI_WIFISUPP_WAPI_PSK_T  wapi_psk_info;
00413         NMI_WIFISUPP_WAPI_CER_T  wapi_cer_info;
00414     }credential_info;
00415 }NMI_WIFISUPP_WAPI_CREDENTIAL_T;
00416 #endif
00417 
00418 typedef struct
00419 {
00420     NMI_WIFISUPP_WPA_CREDENTIAL_TYPE_E  credential_type;
00421     union
00422     {
00423         NMI_WIFISUPP_WPA_PSK_T  wpa_psk_info;
00424         NMI_WIFISUPP_WPA_EAP_T  wpa_eap_info;
00425     }credential_info;
00426 } NMI_WIFISUPP_WPA_CREDENTIAL_T;    //WPA credential information
00427 
00428 typedef struct
00429 {
00430     NMI_WIFISUPP_WEP_KEY_TYPE_E key_type;
00431     BOOLEAN                     is_open_mode;
00432     unsigned int                key_in_use;
00433     union
00434     {   
00435         unsigned char   key_64bits_arr[NMI_WIFISUPP_WEP_KEY_ID_MAX][NMI_WIFISUPP_WEP_64BITS_KEY_LEN - NMI_WIFISUPP_WEP_IV_LEN];
00436         unsigned char   key_128bits_arr[NMI_WIFISUPP_WEP_KEY_ID_MAX][NMI_WIFISUPP_WEP_128BITS_KEY_LEN - NMI_WIFISUPP_WEP_IV_LEN];
00437     }key;
00438 } NMI_WIFISUPP_WEP_CREDENTIAL_T;    //WEP credential information
00439 
00440 typedef struct
00441 {
00442     NMI_WIFISUPP_SSID_T             ssid;
00443     NMI_WIFISUPP_BSSID_T            bssid_info;
00444     NMI_WIFISUPP_NETWORK_MODE_E     network_mode;
00445     NMI_WIFISUPP_ENCRYP_PROTOCOL_E  encryp_protocol;
00446     unsigned int                    channel;
00447     union
00448     {
00449         NMI_WIFISUPP_WEP_CREDENTIAL_T   wep_credential;
00450         NMI_WIFISUPP_WPA_CREDENTIAL_T   wpa_credential;
00451     #ifdef WLAN_SUPPORT
00452         NMI_WIFISUPP_WAPI_CREDENTIAL_T   wapi_credential;
00453     #endif
00454     }credential;
00455 
00456     NMI_WIFISUPP_CIPHER_E           pairwise_cipher;
00457     NMI_WIFISUPP_CIPHER_E           group_cipher;
00458 } NMI_WIFISUPP_SSID_CONFIG_T;   //the config of a SSID
00459 
00460 typedef struct
00461 {
00462     NMI_WIFISUPP_RESULT_E   result;
00463     NMI_WIFISUPP_SSID_T     ssid;
00464     NMI_WIFISUPP_BSSID_T    bssid_info;
00465     unsigned int            channel;
00466     signed int              rssi;
00467 } NMI_WIFISUPP_CONNECT_RESULT_T;    //connect result
00468 
00469 typedef struct 
00470 {
00471     NMI_WIFISUPP_RESULT_E   result;
00472     NMI_WIFISUPP_SSID_T     ssid;
00473 } NMI_WIFISUPP_DISCONNECT_RESULT_T; //disconnect result
00474 
00475 typedef struct
00476 {
00477     NMI_WIFISUPP_SSID_T     ssid;
00478 } NMI_WIFISUPP_DISCONNECT_INFO_T;   //disconnect information
00479 
00480 typedef struct
00481 {
00482    // _ATH_SIGNAL_VARS
00483     NMI_WIFISUPP_DISCONNECT_INFO_T      disc_info;
00484 } NMI_WIFISUPP_DISCONNECT_IND_T;    //disconnect indication
00485 
00486 typedef struct
00487 {
00488     NMI_WIFISUPP_SSID_T     ssid;
00489     NMI_WIFISUPP_BSSID_T    new_bssid_info;
00490     unsigned int            channel;            //the channel using
00491 } NMI_WIFISUPP_BSSID_CHANGED_INFO_T;    //new bssid information
00492 
00493 typedef struct
00494 {
00495     //_ATH_SIGNAL_VARS
00496     NMI_WIFISUPP_BSSID_CHANGED_INFO_T   bssid_changed_info;
00497 } NMI_WIFISUPP_BSSID_CHANGED_IND_T; //BSSID changed indication
00498 
00499 typedef struct
00500 {
00501     NMI_WIFISUPP_SSID_T     ssid;
00502     NMI_WIFISUPP_BSSID_T    bssid_info;
00503     signed int            new_signal_qua;
00504 } NMI_WIFISUPP_RSSI_CHANGED_INFO_T; //RSSI information
00505 
00506 typedef struct
00507 {
00508     //_ATH_SIGNAL_VARS
00509     NMI_WIFISUPP_RSSI_CHANGED_INFO_T    rssi_changed_info;
00510 } NMI_WIFISUPP_RSSI_CHANGED_IND_T;  //RSSI changed indication
00511 
00512 typedef struct
00513 {
00514     NMI_WIFISUPP_RESULT_E   wifi_on_result;
00515     unsigned int            net_id;             //the net id got from TCP/IP
00516     BOOLEAN                 is_support_roam;    //wether support roam
00517     BOOLEAN                 is_support_protocol[NMI_WIFISUPP_ENCRYP_PROTOCOL_MAX];  //the encrypt protocol supported
00518     BOOLEAN                 is_support_eap[NMI_WIFISUPP_WPA_EAP_TYPE_MAX];          //the EAP methods supported
00519     BOOLEAN                 is_support_inner_eap[NMI_WIFISUPP_INNER_CREDENTIAL_TYPE_MAX];   //the inner eap methos supported
00520 } NMI_WIFISUPP_ON_RESULT_T; // wifi on result
00521 
00522 typedef struct 
00523 {
00524     NMI_WIFISUPP_RESULT_E   wifi_off_result;
00525 } NMI_WIFISUPP_OFF_RESULT_T;    //wifi off result
00526 
00527 #ifdef WLAN_SUPPORT
00528 typedef struct
00529 {
00530     NMI_WIFISUPP_SSID_T     ssid;
00531 } NMI_WIFISUPP_SCAN_REQ_INFO_T;
00532 
00533 typedef struct
00534 {
00535     unsigned int is_enter;
00536     unsigned int threshold; 
00537 }NMI_WIFISUPP_DEEPSLEEP_CMD_INFO_T;
00538 
00539 typedef struct
00540 {
00541     unsigned int is_enable;
00542     unsigned int interval;
00543 }NMI_WIFISUPP_AUTOSCAN_REQ_INFO_T;
00544 
00545 typedef struct
00546 {
00547     NMI_WIFISUPP_RESULT_E   wifi_autoscan_result;
00548 } NMI_WIFISUPP_AUTOSCAN_RESULT_T;    
00549 
00550 typedef struct
00551 {
00552     //_ATH_SIGNAL_VARS
00553     NMI_WIFISUPP_AUTOSCAN_RESULT_T  autoscan_result;
00554 } NMI_WIFISUPP_AUTOSCAN_CNF_T;   
00555 
00556 typedef struct
00557 {
00558    // _ATH_SIGNAL_VARS
00559 } NMI_WIFISUPP_SCAN_BEGIN_IND_T;   
00560 
00561 #else
00562 typedef struct NMI_WIFISUPP_SCAN_REQ_INFO_tag
00563 {
00564     NMI_WIFISUPP_SSID_T     ssid;
00565 } NMI_WIFISUPP_SCAN_REQ_INFO_T;
00566 #endif
00567 
00568 #if 0//Ryan
00569 typedef struct
00570 {
00571     _SIGNAL_VARS
00572     void    *msg_body;
00573 } NMI_WIFISUPP_CUST_MSG_T;    
00574 #endif
00575 
00576 typedef enum{
00577     NMI_DISCONNECTTED = 0,
00578     NMI_CONNECTTING = 1,
00579     NMI_CONNECTTED = 2,
00580     NMI_DISCONNECTTING = 3,
00581     NMI_MAX
00582 }NMI_STATE_T;
00583 /*---------------------------------------------------------------------------*/
00584 unsigned char ath_set_eut_mode(uint8 is_enter);
00585 int ath_set_eut_rxtx_channel(int channel);
00586 int ath_set_eut_tx_rate(int ratio);
00587 int ath_set_eut_tx_pwr(int pwr);
00588 unsigned char ath_eut_set_TX_para(unsigned char on_off, int tx_packet_mode);
00589 unsigned char ath_eut_set_RX_para(int rx_command);
00590 unsigned char ath_eut_get_RX_packets(unsigned long *tatal_packets_ptr, unsigned long *err_packets_ptr);
00591 unsigned char ath_eut_set_crystallcap(unsigned char CrystalcapIn,unsigned char CrystalcapOut);
00592 
00593 unsigned char ath_eut_get_cal_data(char* pBuf, unsigned int len);
00594 unsigned char ath_eut_update_cal_data(const char* pBuf, unsigned int len);
00595 
00596 
00597 void nmi_os_trace(char *log);
00598 void nmi_TraceLow(const char * x_format,...);
00599 
00600 unsigned int nmi_os_get_ms(void);
00601 
00602 unsigned int nmi_os_getSystemTickCount(void);
00603 
00604 void nmi_os_sleep_ms(unsigned int msecs);
00605 
00606 int nmi_spi_interface_init(void* spi_dma_isr);
00607 
00608 
00609 uint32 nmi_spi_interface_read( uint8 * buf_ptr, uint32 lenght);
00610 
00611 
00612 uint32 nmi_spi_interface_write( uint8 * buf_ptr, uint32 lenght);
00613 
00614 
00615 uint32 nmi_spi_interface_deinit(void* spi_dma_isr);
00616 
00617 #ifdef SPI_RW_SEPARATE
00618 uint32 nmi_spi_interface_writeread(uint8 * out_buf_ptr, uint32 out_buf_len, uint8 * in_buf_ptr, uint32 in_buf_len);  //kyu
00619 #else
00620 uint32 nmi_spi_interface_writeread(uint8 * out_buf_ptr, uint8 * in_buf_ptr, uint32 length);  //ksong 2012.7.12
00621 #endif
00622 
00623 
00624 BOOLEAN nmc1000_wifi_on(void); 
00625 BOOLEAN nmc1000_wifi_off(void); 
00626 
00627 void wifi_handle_event(uint8_t * event);//added by Tsungta
00628 void ap_disconnect();//added by Tsungta
00629 void nmc1000_pmk_info_callback(unsigned int ptr, unsigned int len);
00630 void nmc1000_set_pmk_cache_info(uint8_t reset);
00631 
00632 #ifdef __cplusplus
00633 }
00634 #endif
00635 
00636 #endif  /* __NMC1000_WIFI_ADAPER_H__ */
00637 
00638