Lines Matching refs:device

51 rt_err_t rt_wlan_dev_init(struct rt_wlan_device *device, rt_wlan_mode_t mode)  in rt_wlan_dev_init()  argument
56 LOG_D("F:%s L:%d is run device:0x%08x mode:%d", __FUNCTION__, __LINE__, device, mode); in rt_wlan_dev_init()
57 if ((device == RT_NULL) || (mode >= RT_WLAN_MODE_MAX)) in rt_wlan_dev_init()
59 … LOG_E("F:%s L:%d Parameter Wrongful device:0x%08x mode:%d", __FUNCTION__, __LINE__, device, mode); in rt_wlan_dev_init()
63 if (mode == RT_WLAN_AP && device->flags & RT_WLAN_FLAG_STA_ONLY) in rt_wlan_dev_init()
68 else if (mode == RT_WLAN_STATION && device->flags & RT_WLAN_FLAG_AP_ONLY) in rt_wlan_dev_init()
74 result = rt_device_init(RT_DEVICE(device)); in rt_wlan_dev_init()
80 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_MODE, (void *)&mode); in rt_wlan_dev_init()
86 device->mode = mode; in rt_wlan_dev_init()
90 rt_err_t rt_wlan_dev_connect(struct rt_wlan_device *device, struct rt_wlan_info *info, const char *… in rt_wlan_dev_connect() argument
95 if (device == RT_NULL) in rt_wlan_dev_connect()
121 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_JOIN, &sta_info); in rt_wlan_dev_connect()
125 rt_err_t rt_wlan_dev_fast_connect(struct rt_wlan_device *device, struct rt_wlan_info *info, const c… in rt_wlan_dev_fast_connect() argument
130 if (device == RT_NULL) in rt_wlan_dev_fast_connect()
146 buff.len = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_FAST_CONNECT_INFO, buff.data); in rt_wlan_dev_fast_connect()
153 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_FAST_CONNECT, &buff); in rt_wlan_dev_fast_connect()
158 rt_err_t rt_wlan_dev_disconnect(struct rt_wlan_device *device) in rt_wlan_dev_disconnect() argument
162 if (device == RT_NULL) in rt_wlan_dev_disconnect()
167 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_DISCONNECT, RT_NULL); in rt_wlan_dev_disconnect()
171 rt_err_t rt_wlan_dev_ap_start(struct rt_wlan_device *device, struct rt_wlan_info *info, const char … in rt_wlan_dev_ap_start() argument
176 if (device == RT_NULL) in rt_wlan_dev_ap_start()
203 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SOFTAP, &ap_info); in rt_wlan_dev_ap_start()
207 rt_err_t rt_wlan_dev_ap_stop(struct rt_wlan_device *device) in rt_wlan_dev_ap_stop() argument
211 if (device == RT_NULL) in rt_wlan_dev_ap_stop()
216 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_AP_STOP, RT_NULL); in rt_wlan_dev_ap_stop()
220 rt_err_t rt_wlan_dev_ap_deauth(struct rt_wlan_device *device, rt_uint8_t mac[6]) in rt_wlan_dev_ap_deauth() argument
224 if (device == RT_NULL) in rt_wlan_dev_ap_deauth()
229 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_AP_DEAUTH, mac); in rt_wlan_dev_ap_deauth()
233 int rt_wlan_dev_get_rssi(struct rt_wlan_device *device) in rt_wlan_dev_get_rssi() argument
238 if (device == RT_NULL) in rt_wlan_dev_get_rssi()
244 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_RSSI, &rssi); in rt_wlan_dev_get_rssi()
254 rt_err_t rt_wlan_dev_get_info(struct rt_wlan_device *device, struct rt_wlan_info *info) in rt_wlan_dev_get_info() argument
258 if (device == RT_NULL) in rt_wlan_dev_get_info()
263 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_INFO, info); in rt_wlan_dev_get_info()
273 rt_err_t rt_wlan_dev_ap_get_info(struct rt_wlan_device *device, struct rt_wlan_info *info) in rt_wlan_dev_ap_get_info() argument
277 if (device == RT_NULL) in rt_wlan_dev_ap_get_info()
282 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_AP_GET_INFO, info); in rt_wlan_dev_ap_get_info()
292 rt_err_t rt_wlan_dev_get_mac(struct rt_wlan_device *device, rt_uint8_t mac[6]) in rt_wlan_dev_get_mac() argument
296 if (device == RT_NULL) in rt_wlan_dev_get_mac()
301 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_MAC, &mac[0]); in rt_wlan_dev_get_mac()
305 rt_err_t rt_wlan_dev_set_mac(struct rt_wlan_device *device, rt_uint8_t mac[6]) in rt_wlan_dev_set_mac() argument
309 if (device == RT_NULL) in rt_wlan_dev_set_mac()
314 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SET_MAC, &mac[0]); in rt_wlan_dev_set_mac()
318 rt_err_t rt_wlan_dev_set_powersave(struct rt_wlan_device *device, int level) in rt_wlan_dev_set_powersave() argument
322 if (device == RT_NULL) in rt_wlan_dev_set_powersave()
327 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SET_POWERSAVE, &level); in rt_wlan_dev_set_powersave()
331 int rt_wlan_dev_get_powersave(struct rt_wlan_device *device) in rt_wlan_dev_get_powersave() argument
336 if (device == RT_NULL) in rt_wlan_dev_get_powersave()
342 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_POWERSAVE, &level); in rt_wlan_dev_get_powersave()
351 rt_err_t rt_wlan_dev_register_event_handler(struct rt_wlan_device *device, rt_wlan_dev_event_t even… in rt_wlan_dev_register_event_handler() argument
356 if (device == RT_NULL) in rt_wlan_dev_register_event_handler()
368 if (device->handler_table[event][i].handler == RT_NULL) in rt_wlan_dev_register_event_handler()
370 device->handler_table[event][i].handler = handler; in rt_wlan_dev_register_event_handler()
371 device->handler_table[event][i].parameter = parameter; in rt_wlan_dev_register_event_handler()
382 rt_err_t rt_wlan_dev_unregister_event_handler(struct rt_wlan_device *device, rt_wlan_dev_event_t ev… in rt_wlan_dev_unregister_event_handler() argument
387 if (device == RT_NULL) in rt_wlan_dev_unregister_event_handler()
399 if (device->handler_table[event][i].handler == handler) in rt_wlan_dev_unregister_event_handler()
401 rt_memset(&device->handler_table[event][i], 0, sizeof(struct rt_wlan_dev_event_desc)); in rt_wlan_dev_unregister_event_handler()
411 void rt_wlan_dev_indicate_event_handle(struct rt_wlan_device *device, rt_wlan_dev_event_t event, st… in rt_wlan_dev_indicate_event_handle() argument
418 if (device == RT_NULL) in rt_wlan_dev_indicate_event_handle()
431 handler[i] = device->handler_table[event][i].handler; in rt_wlan_dev_indicate_event_handle()
432 parameter[i] = device->handler_table[event][i].parameter; in rt_wlan_dev_indicate_event_handle()
441 handler[i](device, event, buff, parameter[i]); in rt_wlan_dev_indicate_event_handle()
446 rt_err_t rt_wlan_dev_enter_promisc(struct rt_wlan_device *device) in rt_wlan_dev_enter_promisc() argument
451 if (device == RT_NULL) in rt_wlan_dev_enter_promisc()
456 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_CFG_PROMISC, &enable); in rt_wlan_dev_enter_promisc()
460 rt_err_t rt_wlan_dev_exit_promisc(struct rt_wlan_device *device) in rt_wlan_dev_exit_promisc() argument
465 if (device == RT_NULL) in rt_wlan_dev_exit_promisc()
470 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_CFG_PROMISC, &enable); in rt_wlan_dev_exit_promisc()
474 rt_err_t rt_wlan_dev_set_promisc_callback(struct rt_wlan_device *device, rt_wlan_pormisc_callback_t… in rt_wlan_dev_set_promisc_callback() argument
476 if (device == RT_NULL) in rt_wlan_dev_set_promisc_callback()
480 device->pormisc_callback = callback; in rt_wlan_dev_set_promisc_callback()
485 void rt_wlan_dev_promisc_handler(struct rt_wlan_device *device, void *data, int len) in rt_wlan_dev_promisc_handler() argument
489 if (device == RT_NULL) in rt_wlan_dev_promisc_handler()
494 callback = device->pormisc_callback; in rt_wlan_dev_promisc_handler()
498 callback(device, data, len); in rt_wlan_dev_promisc_handler()
502 rt_err_t rt_wlan_dev_cfg_filter(struct rt_wlan_device *device, struct rt_wlan_filter *filter) in rt_wlan_dev_cfg_filter() argument
506 if (device == RT_NULL) in rt_wlan_dev_cfg_filter()
515 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_CFG_FILTER, filter); in rt_wlan_dev_cfg_filter()
519 rt_err_t rt_wlan_dev_set_channel(struct rt_wlan_device *device, int channel) in rt_wlan_dev_set_channel() argument
523 if (device == RT_NULL) in rt_wlan_dev_set_channel()
532 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SET_CHANNEL, &channel); in rt_wlan_dev_set_channel()
536 int rt_wlan_dev_get_channel(struct rt_wlan_device *device) in rt_wlan_dev_get_channel() argument
541 if (device == RT_NULL) in rt_wlan_dev_get_channel()
547 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_CHANNEL, &channel); in rt_wlan_dev_get_channel()
557 rt_err_t rt_wlan_dev_set_country(struct rt_wlan_device *device, rt_country_code_t country_code) in rt_wlan_dev_set_country() argument
561 if (device == RT_NULL) in rt_wlan_dev_set_country()
566 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SET_COUNTRY, &country_code); in rt_wlan_dev_set_country()
570 rt_country_code_t rt_wlan_dev_get_country(struct rt_wlan_device *device) in rt_wlan_dev_get_country() argument
575 if (device == RT_NULL) in rt_wlan_dev_get_country()
581 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_GET_COUNTRY, &country_code); in rt_wlan_dev_get_country()
591 rt_err_t rt_wlan_dev_scan(struct rt_wlan_device *device, struct rt_wlan_info *info) in rt_wlan_dev_scan() argument
597 if (device == RT_NULL) in rt_wlan_dev_scan()
624 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SCAN, p_scan_info); in rt_wlan_dev_scan()
628 rt_err_t rt_wlan_dev_scan_stop(struct rt_wlan_device *device) in rt_wlan_dev_scan_stop() argument
632 if (device == RT_NULL) in rt_wlan_dev_scan_stop()
637 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SCAN_STOP, RT_NULL); in rt_wlan_dev_scan_stop()
641 rt_err_t rt_wlan_dev_report_data(struct rt_wlan_device *device, void *buff, int len) in rt_wlan_dev_report_data() argument
644 return rt_wlan_dev_transfer_prot(device, buff, len); in rt_wlan_dev_report_data()
650 rt_err_t rt_wlan_dev_enter_mgnt_filter(struct rt_wlan_device *device) in rt_wlan_dev_enter_mgnt_filter() argument
655 if (device == RT_NULL) in rt_wlan_dev_enter_mgnt_filter()
660 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_CFG_MGNT_FILTER, &enable); in rt_wlan_dev_enter_mgnt_filter()
664 rt_err_t rt_wlan_dev_exit_mgnt_filter(struct rt_wlan_device *device) in rt_wlan_dev_exit_mgnt_filter() argument
669 if (device == RT_NULL) in rt_wlan_dev_exit_mgnt_filter()
674 result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_CFG_MGNT_FILTER, &enable); in rt_wlan_dev_exit_mgnt_filter()
678 rt_err_t rt_wlan_dev_set_mgnt_filter_callback(struct rt_wlan_device *device, rt_wlan_mgnt_filter_ca… in rt_wlan_dev_set_mgnt_filter_callback() argument
680 if (device == RT_NULL) in rt_wlan_dev_set_mgnt_filter_callback()
684 device->mgnt_filter_callback = callback; in rt_wlan_dev_set_mgnt_filter_callback()
689 void rt_wlan_dev_mgnt_filter_handler(struct rt_wlan_device *device, void *data, int len) in rt_wlan_dev_mgnt_filter_handler() argument
693 if (device == RT_NULL) in rt_wlan_dev_mgnt_filter_handler()
698 callback = device->mgnt_filter_callback; in rt_wlan_dev_mgnt_filter_handler()
702 callback(device, data, len); in rt_wlan_dev_mgnt_filter_handler()
706 int rt_wlan_dev_send_raw_frame(struct rt_wlan_device *device, void *buff, int len) in rt_wlan_dev_send_raw_frame() argument
708 if (device == RT_NULL) in rt_wlan_dev_send_raw_frame()
713 if (device->ops->wlan_send_raw_frame) in rt_wlan_dev_send_raw_frame()
715 return device->ops->wlan_send_raw_frame(device, buff, len); in rt_wlan_dev_send_raw_frame()
1009 wlan->device.ops = &wlan_ops; in rt_wlan_dev_register()
1011 wlan->device.init = _rt_wlan_dev_init; in rt_wlan_dev_register()
1012 wlan->device.open = RT_NULL; in rt_wlan_dev_register()
1013 wlan->device.close = RT_NULL; in rt_wlan_dev_register()
1014 wlan->device.read = RT_NULL; in rt_wlan_dev_register()
1015 wlan->device.write = RT_NULL; in rt_wlan_dev_register()
1016 wlan->device.control = _rt_wlan_dev_control; in rt_wlan_dev_register()
1019 wlan->device.user_data = RT_NULL; in rt_wlan_dev_register()
1021 wlan->device.type = RT_Device_Class_NetIf; in rt_wlan_dev_register()
1027 err = rt_device_register(&wlan->device, name, RT_DEVICE_FLAG_RDWR); in rt_wlan_dev_register()