17 #ifndef _RDA5991H_WLAND_H_ 18 #define _RDA5991H_WLAND_H_ 21 #include "wland_types.h" 28 extern unsigned char user_mac[6];
29 extern unsigned char gssid[32+1];
30 extern unsigned char gpass[64+1];
31 extern unsigned char gchannel;
32 extern unsigned char gbssid[6];
34 extern unsigned char gssid_ap[32+1];
35 extern unsigned char gpass_ap[64+1];
36 extern unsigned char gchannel_ap;
37 extern void *wland_msgQ;
38 extern void *wifi_auth_sem;
46 WLAND_DISCONNECT_ERROR,
50 WLAND_AP_EAPOL_3_OF_4,
57 WLAND_MAC_AP_CONNECTED,
92 #define WLAND_DBG_DUMP 0 93 #define WPA_DBG_DUMP 0 94 #define HUT_DBG_DUMP 0 95 #define WLAND_DBG_LEVEL D_NONE_LEVEL 96 #define WPA_DBG_LEBEL D_NONE_LEVEL 97 #define WLANDLIB_DBG_LEVEL D_NONE_LEVEL 102 #define ENCRYPT_NONE (0) 103 #define ENCRYPT_WPA_TKIP BIT0 104 #define ENCRYPT_WPA_CCMP BIT1 105 #define ENCRYPT_WPA2_TKIP BIT2 106 #define ENCRYPT_WPA2_CCMP BIT3 107 #define ENCRYPT_WEP BIT4 111 struct netif *netif_sta;
112 struct netif *netif_ap;
113 sys_thread_t wland_thread;
114 sys_thread_t maclib_thread;
115 sys_mbox_t maclib_mbox;
116 sys_mbox_t wland_mbox;
119 __STATIC_INLINE
int mac_is_valid(
char* mac)
121 return (mac[0] | mac[1] | mac[2] | mac[3] | mac[4] | mac[5]);
129 extern void wland_txip_data(
void *data,
unsigned int len,
int mode);
130 extern void *wland_get_databuf(
void);
131 extern void wland_sta_init(
void);
132 extern void wland_reg_func(
void);
133 extern void r91h_phy_task(
void *data);
134 extern void wland_task(
void *arg);
135 extern void rda_get_macaddr(u8_t *macaddr,
int mode);
136 extern void rda5981_send_rawdata(
char* data,
unsigned int len);
137 extern int rda5981_send_nulldata(
int power_save);
138 extern void rda5981_set_country_code(
unsigned char country_code);
139 extern int rda5981_set_retrans_policy(
unsigned char count);
140 extern int rda5981_set_channel(
unsigned char channel);
142 extern int rda5981_filter_multicast(
unsigned char enable);
144 extern void rda5981_set_AP_hidden_type(
unsigned char mode);
145 extern void rda5981_set_AP_link_num(
unsigned char num);
146 extern char* rda5981_get_ver(
void);
147 extern int rda5981_enter_CE_MODE(
unsigned char enable);
173 extern int rda5981_set_data_rate(
unsigned char mode,
unsigned char rate);
174 extern void rda5981_set_mode(
unsigned char bgn_enable);
175 extern void rda5981_set_auth_timeout(
unsigned char timeout_enable);
177 char BSSID[ETH_ALEN];
180 unsigned char SSID_len;
181 unsigned char channel;
182 unsigned char secure_type;
185 unsigned short capability;
186 unsigned int ie_length;
190 unsigned char mac[ETH_ALEN];
195 int rda5981_scan(
const char *SSID,
const unsigned char SSID_len,
const unsigned char channel);
197 int rda5981_scan_v2(
const char *SSID,
const unsigned char SSID_len,
const unsigned char channel,
const unsigned char mode, \
198 const unsigned char scan_time);
199 int rda5981_get_scan_num();
204 int rda5981_check_scan_result_name(
const char *name);
205 int rda5981_check_scan_result(
const char *ssid,
const char *bssid,
const unsigned channel);
206 int rda5981_check_scan_result_name_bssid(
const unsigned char *name,
const unsigned char *bssid);
207 int rda5981_del_scan_all_result(
void);
208 void rda5981_set_expired_time(
unsigned int expired_time);
210 s8 rda5981_get_rssi();
211 void rda5981_set_main_queue(
void* queue);
213 void rda5981_set_sta_listen_interval(
unsigned char interval);
214 void rda5981_set_sta_link_loss_time(
unsigned char time);
215 unsigned int rda5981_get_ap_join_info(
rda5981_apsta_info *buf,
const unsigned char len);
216 void rda5981_set_AP_white_list(
unsigned char flag,
unsigned char *mac);
217 int wland_set_joined_sta_ip(
char *mac,
unsigned int ip);
222 int rda5981_flash_read_mac_addr(
unsigned char *mac_addr);
223 int rda5981_flash_write_mac_addr(
unsigned char *mac_addr);
228 int rda5981_flash_erase_uart(
void);
229 int rda5981_flash_read_uart(
unsigned int *uart);
230 int rda5981_flash_write_uart(
unsigned int *uart);
235 int rda5981_flash_read_ip_addr(
unsigned char *ip_addr,
unsigned char *server_addr);
236 int rda5981_flash_write_ip_addr(
unsigned char *ip_add,
unsigned char *server_addr);
241 int rda5981_flash_erase_dhcp_data(
void);
242 int rda5981_flash_read_dhcp_data(
unsigned int *enable,
unsigned int *ip,
unsigned int *msk,
unsigned int *gw);
243 int rda5981_flash_write_dhcp_data(
unsigned int enable,
unsigned int ip,
unsigned int msk,
unsigned int gw);
248 int rda5981_flash_read_ap_data(
char *ssid,
char *passwd,
unsigned char *channel);
249 int rda5981_flash_write_ap_data(
const char *ssid,
const char *passwd,
unsigned char channel);
250 int rda5981_flash_erase_ap_data(
void);
255 int rda5981_flash_read_ap_net_data(
unsigned int *ip,
unsigned int *msk,
unsigned int *gw,
256 unsigned int *dhcps,
unsigned int *dhcpe);
257 int rda5981_flash_write_ap_net_data(
unsigned int ip,
unsigned int msk,
unsigned int gw,
258 unsigned int dhcps,
unsigned int dhcpe);
259 int rda5981_flash_erase_ap_net_data(
void);
264 int rda5981_flash_read_sta_data(
char *ssid,
char *passwd);
265 int rda5981_flash_write_sta_data(
const char *ssid,
const char *passwd);
266 int rda5981_flash_erase_sta_data(
void);
273 int rda5981_flash_read_3rdparter_data_length(
void);
281 int rda5981_flash_read_3rdparter_data(
unsigned char *buf,
unsigned int buf_len);
289 int rda5981_flash_write_3rdparter_data(
const unsigned char *buf,
unsigned int buf_len);
295 int rda5981_flash_erase_3rdparter_data(
void);
302 int rda5981_set_flash_size(
const unsigned int size);
315 int rda5981_set_user_data_addr(
const unsigned int sys_data_addr,
316 const unsigned int user_data_addr,
const unsigned int user_data_len);
324 int rda5981_erase_flash(
unsigned int addr,
unsigned int len);
333 int rda5981_write_flash(
unsigned int addr,
char *buf,
unsigned int len);
342 int rda5981_read_flash(
unsigned int addr,
char *buf,
unsigned int len);
351 int rda5981_read_user_data(
unsigned char *data,
unsigned short len,
unsigned int flag);
360 int rda5981_write_user_data(
unsigned char *data,
unsigned short len,
unsigned int flag);
367 int rda5981_erase_user_data(
unsigned int flag);
373 int update_tx_power_from_efuse(
void);
379 int update_xtal_cal_from_efuse(
void);
385 int update_mac_addr_from_efuse(
void);
391 int update_tx_power_from_flash(
void);
397 int update_tx_power_rf_from_flash(
void);
403 int update_tx_power_phy_from_flash(
void);
409 int update_xtal_cal_from_flash(
void);
415 int update_mac_addr_from_flash(
void);
424 int wland_rf_write(
unsigned short reg,
unsigned short value);
434 int wland_rf_write_all_channels(
unsigned short reg,
unsigned short *value,
unsigned short len);
442 int wland_rf_read(
unsigned short reg,
unsigned short *value);
451 int wland_rf_read_all_channels(
unsigned short reg,
unsigned short *value);
459 int wland_phy_write(
unsigned int reg,
unsigned int value);
468 int wland_phy_write_all_channels(
unsigned int reg,
unsigned int *value,
unsigned short len);
476 int wland_phy_read(
unsigned int reg,
unsigned int *value);
484 int wland_phy_read_all_channels(
unsigned int reg,
unsigned int *value);
494 int wland_read_efuse(
unsigned char *value);
501 int wland_read_tx_power_from_efuse(
unsigned char *tx_power);
509 int wland_write_tx_power_to_efuse(
unsigned char *tx_power,
unsigned char len);
516 int wland_read_xtal_cal_from_efuse(
unsigned char *cal_val);
524 int wland_write_xtal_cal_to_efuse(
unsigned char *xtal_cal,
unsigned char len);
531 int wland_read_mac_addr_from_efuse(
unsigned char *mac_addr);
539 int wland_write_mac_addr_to_efuse(
unsigned char*mac_addr,
unsigned char len);
549 int wland_start_rf_test(
unsigned int argc,
unsigned int *argv,
unsigned int is_tx);
555 int wland_stop_rx_test(
void);
562 int wland_get_rx_result(
char *result);
568 int wland_restart_rx_test(
void);
574 int wland_stop_tx_test(
void);
580 int wland_restart_tx_test(
void);
582 #define RDA5981_FIRMWARE_INFO_ADDR 0x18003000 590 int rda5981_reboot_to_addr(
unsigned int firmware_info_addr,
unsigned int reboot_addr);
599 int rda5981_read_user_data_regs(
unsigned char *reg,
unsigned char *value,
unsigned int flag);
608 int rda5981_write_user_data_regs(
unsigned char *reg,
unsigned char *value,
unsigned int flag);
616 int rda5981_erase_user_data_regs(
unsigned char *reg,
unsigned int flag);
623 int rda5981_flash_get_mid(
unsigned char *mid);
630 int rda5981_flash_get_did(
unsigned char *did);
637 int rda5981_flash_get_jdid(
unsigned short *jdid);
645 int wland_mac_reg_read(
unsigned short reg,
unsigned int *value);
653 int wland_mac_reg_write(
unsigned short reg,
unsigned int value);