Host Platform Adaptation Guide

[中文]

This section mainly introduces the BK7239N host platform adaptation guide. After modifying the host platform code according to the documents in this section, BK7239N host platform adaptation can be completed.

BK7239N host side code is released in source code form, and the related code can be put into the host platform code to participate in compilation, mainly divided into two parts: - Kernel modifications - User space API interfaces

Linux Kernel Modifications

Linux kernel mainly adds BK7239N driver, which is described in detail below.

Note

BK7239N driver source code is provided in source code form, related file path /bk_idk_controller/host/driver/linux/beken_vnet

BK7239N Driver

beken_vnet driver is the core code of BK7239N driver. First, put the code in the kernel /kernel/drivers/net/wireless/beken_vnet directory, then modify the makefile and Kconfig in /kernel/drivers/net/wireless directory to compile the code into the kernel. The specific modifications are shown in the following figures:

Kconfig

makefile

User Space API Interface

User space mainly contains bk_ioctl API interfaces and demo APP, related code path: /bk_idk_controller/host/demo_app/bk_ioctrl

bk_ioctl API Interface

For convenient application development, API interfaces are provided in Linux system user space, this part code path: /bk_idk_controller/host/demo_app/bk_ioctrl/bk_ioctl_api.h Basic API interfaces provided by SDK are as follows:

 1 /**************************WLAN API**************************/
 2 int bk_ioctl_scan_wifi(void);
 3 int bk_ioctl_set_sta(char *ssid, char *key);
 4 int bk_ioctl_disc_sta(void);
 5 int bk_ioctl_start_softap(char *ssid, char *pw);
 6 int bk_ioctl_stop_softap(void);
 7 int bk_ioctl_get_wlan_status(bk_ioctl_wlan_status_t *status);
 8 int bk_ioctl_wifi_multimedia_config(bool wifi_mmd_en);
 9 int bk_ioctl_set_net_info(struct bk_ioctl_net_info *info);
10 int bk_ioctl_get_net_info(bk_ioctl_net_info_t *net_info);
11 int bk_ioctl_get_rssi(int32_t *rssi);
12 int bk_ioctl_get_wifi_info(bk_wifi_info *info);
13 int bk_ioctl_set_auto_reconnect(bool auto_connect_en);
14
15 /**************************BLE API**************************/
16 int bk_ioctl_open_ble(void);
17 int bk_ioctl_close_ble(void);
18
19 /**************************SYSTEM API**************************/
20 int bk_ioctl_set_mac(uint8_t *mac);
21 int bk_ioctl_get_mac(uint8_t *mac, int len);
22 int bk_ioctl_enter_sleep(void);
23 int bk_ioctl_exit_sleep(void);
24 int bk_ioctl_send_at(char *at_str);
25 int bk_ioctl_keepalive_cfg(struct bk_ioctl_keepalive_cfg *cfg);
26 int bk_ioctl_set_time(uint32_t time);
27 int bk_ioctl_get_time(uint32_t *time);
28 int bk_ioctl_send_customer_data(uint8_t *data, uint16_t len, uint8_t *rsp_data, uint16_t rsp_len);
29 int bk_ioctl_start_ota(void);
30 int bk_ioctl_send_ota_pkt(bk_ioctl_ota_req_t *ota_info, uint16_t len);
31 int bk_ioctl_stop_ota(void);
32
33 /**************************Other API**************************/
34 void bk_ioctl_register_callback(bk_ioctl_callback_t callback);
35 int bk_ioctl_init(void);
36 void bk_ioctl_deinit(void);

Note

For specific meaning of API interfaces, please refer to /bk_idk_controller/host/demo_app/bk_ioctrl/bk_ioctl_api.h

demo APP

bk_ioctrl directory provides upper demo applications corresponding to beken_vnet driver,分别是bk_ioctrl and bk_rx_evt Users can operate BK7239N through related commands in bk_ioctrl, such as Wi-Fi scanning and connection, complete message registration reception through bk_ioctl_register_callback, implement receiving Controller actively reported messages

bk_ioctrl supported commands and bk_rx_evt supported messages can refer to Host Demo APP Introduction