diff --git a/en/device-dev/driver/driver-peripherals-external-des.md b/en/device-dev/driver/driver-peripherals-external-des.md index 996ad2805200510f4be2c358e9ede6b596408a31..4c75f57c50e2ad762001fbce49128f66c3bcf6c7 100644 --- a/en/device-dev/driver/driver-peripherals-external-des.md +++ b/en/device-dev/driver/driver-peripherals-external-des.md @@ -1,243 +1,164 @@ -# WLAN - -## Overview - -The WLAN module is developed based on the Hardware Driver Foundation \(HDF\). It supports cross-OS migration, component adaptation, and modular assembly and compilation. Based on the unified APIs provided by the WLAN module, driver developers of WLAN vendors can adapt their driver code and are capable of creating, disabling, scanning, and connecting to WLAN hotspots. The WLAN driver provides the Hardware Device Interface \(HDI\) layer with the capabilities of setting and obtaining the device MAC address and setting the transmit power. The following figure shows the framework of the WLAN module: - -**Figure 1** WLAN framework -![](figures/wlan-framework.png "wlan-framework") - -### WLAN Driver API Architecture - -The WLAN module provides the following three types of APIs: - -1. Capability APIs for the HDI layer - -2. Capability APIs directly invoked by drivers - -3. Capability APIs for vendors - -**Figure 2** Available APIs of the WLAN module -![](figures/available-apis-of-the-wlan-module.png "available-apis-of-the-wlan-module") - -## Available APIs - -The WLAN driver module provides APIs that can be directly called by driver developers, such as creating/releasing a **WifiModule**, connecting to/disconnecting from a WLAN hotspot, applying for/releasing a **NetBuf**, and converting between the **pbuf** structure of Lightweight IP \(lwIP\) and a **NetBuf**. [Table 1](#table1521573319472) describes some APIs. - -**Table 1** APIs that can be directly called by driver developers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

File

-

Function

-

Description

-

wifi_module.h

-

-

struct WifiModule *WifiModuleCreate(const struct HdfConfigWifiModuleConfig *config);

-

Creates a WifiModule.

-

void WifiModuleDelete(struct WifiModule *module);

-

Deletes a WifiModule and releases its data.

-

int32_t DelFeature(struct WifiModule *module, uint16_t featureType);

-

Deletes a feature from a WifiModule.

-

int32_t AddFeature(struct WifiModule *module, uint16_t featureType, struct WifiFeature *featureData);

-

Adds a feature to a WifiModule.

-

wifi_mac80211_ops.h

-

int32_t (*startAp)(NetDevice *netDev);

-

Starts an AP.

-

int32_t (*stopAp)(NetDevice *netDev);

-

Stops an AP.

-

int32_t (*connect)(NetDevice *netDev, WifiConnectParams *param);

-

Connects to a hotspot.

-

int32_t (*disconnect)(NetDevice *netDev, uint16_t reasonCode);

-

Disconnects from a hotspot.

-

hdf_netbuf.h

-

static inline void NetBufQueueInit(struct NetBufQueue *q);

-

Initializes a NetBuf queue.

-

struct NetBuf *NetBufAlloc(uint32_t size);

-

Applies for a NetBuf.

-

void NetBufFree(struct NetBuf *nb);

-

Releases a NetBuf.

-

struct NetBuf *Pbuf2NetBuf(const struct NetDevice *netdev, struct pbuf *lwipBuf);

-

Converts the pbuf structure of lwIP to a NetBuf.

-

struct pbuf *NetBuf2Pbuf(const struct NetBuf *nb);

-

Converts a NetBuf to the pbuf structure of lwIP.

-
- -The WLAN driver module provides APIs for driver developers, such as initializing/deregistering, opening/stopping a **NetDevice**, and obtaining the state of a **NetDevice**. [Table 2](#table74613501475) describes some APIs. - -**Table 2** APIs for driver developers of WLAN vendors to implement - - - - - - - - - - - - - - - - - - - - - - - - - - - -

File

-

Function

-

Description

-

net_device.h

-

int32_t (*init)(struct NetDevice *netDev);

-

Initializes a NetDevice.

-

struct NetDevStats *(*getStats)(struct NetDevice *netDev);

-

Obtains the state of a NetDevice.

-

int32_t (*setMacAddr)(struct NetDevice *netDev, void *addr);

-

Sets the MAC address.

-

void (*deInit)(struct NetDevice *netDev);

-

Deinitializes a NetDevice.

-

int32_t (*open)(struct NetDevice *netDev);

-

Opens a NetDevice.

-

int32_t (*stop)(struct NetDevice *netDev);

-

Stops a NetDevice.

-
- -The WLAN driver provides the HDI layer with the APIs for creating and destroying an **IWiFi** object and setting the MAC address. [Table 3](#table141076311618) describes some APIs. - -**Table 3** APIs provided by the WLAN HAL module - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Header File

-

Function

-

Description

-

wifi_hal.h

-

-

int32_t WifiConstruct(struct IWiFi **wifiInstance);

-

Creates an IWiFi object with basic capabilities.

-

int32_t WifiDestruct(struct IWiFi **wifiInstance);

-

Destroys an IWiFi object.

-

int32_t (*start)(struct IWiFi *);

-

Creates a channel between the HAL and the driver and obtains the NIC supported by the driver.

-

int32_t (*stop)(struct IWiFi *);

-

Stops the channel between the HAL and the driver.

-

wifi_hal_base_feature.h

-

int32_t (*getFeatureType)(const struct IWiFiBaseFeature *);

-

Obtains the feature type.

-

int32_t (*setMacAddress)(const struct IWiFiBaseFeature *, unsigned char *, uint8_t);

-

Sets the MAC address.

-

int32_t (*getDeviceMacAddress)(const struct IWiFiBaseFeature *, unsigned char *, uint8_t);

-

Obtains the device MAC address.

-

int32_t (*setTxPower)(const struct IWiFiBaseFeature *, int32_t);

-

Sets the transmit power.

-
- -## How to Develop - -The WLAN driver is developed based on the HDF and PLATFORM. It provides a unified driver model for WLAN modules of different vendors regardless of the operating system \(OS\) and system on a chip \(SoC\). - -1. Set hardware parameters such as **module** \(different features\) and **chip** in the **wifi\_config.hcs** file. -2. Parse the **wifi\_config.hcs** file and generate a structure with the configured parameters. -3. Initialize and create a module. -4. Mount and initialize the chip. -5. Initialize the bus. -6. Mount the upper-layer WPA service. - ->![](../public_sys-resources/icon-note.gif) **NOTE:**
->Some of the above adaptation steps have been provided. For details, see [Development Example](#section1395253612512). The steps waiting to be performed by developers include setting configuration parameters based on hardware attributes, adapting and mounting a chip, and performing tests and verification. - -## Development Example +# WLAN + + +## Overview + +### WLAN + +The Wireless Local Area Network (WLAN) Driver module in OpenHarmony is developed based on the Hardware Driver Foundation (HDF). It features cross-OS porting, self-adaptation to component differences, and modular assembly and build. + +### Working Principles + +You can adapt your driver code based on the unified interfaces provided by the WLAN module. The WLAN module provides: + +- A unified underlying interface to implement capabilities, such as setting up or closing a WLAN hotspot, scanning hotspots, and connecting to or disconnecting from a hotspot. +- A unified interface to the Hardware Device Interface (HDI) layer to implement capabilities, such as setting or obtaining the device Media Access Control (MAC) address and setting the transmit power. + +The figure below shows the WLAN architecture. The WLAN Driver module implements startup loading, parses configuration files, and provides bus abstraction APIs. The WLAN Chip Driver module provides the MAC Sublayer Management Entity (MLME). + + **Figure 1** WLAN architecture + + ![image](figures/WLAN_architecture.png "WLAN architecture") + + The figure below shows the WLAN driver architecture. + + **Figure 2** WLAN driver architecture + + ![image](figures/WLAN_driver_architecture.png "WLAN driver architecture") + +The WLAN driver consists of the following modules: + +1. WLAN Message: provides an independent interface for each service or a composite service interface for multiple dependent services. It can run in the user mode, kernel mode, and MCU to implement complete decoupling between components. + +2. WLAN Configuration Core: parses WLAN configuration files. + +3. Access point (AP): provides a WLAN access interface for devices. + +4. Station (STA): a terminal that accesses the WLAN system. + +5. mac80211: defines MAC-layer interfaces for underlying drivers. + +6. Bus: provides a unified bus abstract interface for the upper layer. It shields the differences between different kernels by calling the Secure Digital Input Output (SDIO) interfaces provided by the platform layer and encapsulating the adapted USB and PCIe interfaces. It also encapsulates different types of bus operations in a unified manner to shield differences between different chipsets. The complete bus driving capabilities provided by the bus module help simplify and streamline the development of different chip vendors. + +7. NetDevice: creates dedicated network devices to shield differences between OSs, provides unified interfaces for Wi-Fi drivers, unified HDF NetDevice data structure, and unified management, registration, and deregistration capabilities, and connects to the Linux network device layer on mini-, small-, standard, and large-system devices. + +8. NetBuf: encapsulates the unified data structure of the Linux or LiteOS native network data buffer and the operation interfaces for network data. + +9. FlowCtl: performs flow control. + +10. HCC-CFG: configures WLAN parameters, including the board configuration, driver configuration, and module configuration. + +The relationships between the main modules are as follows: + +1. The WLAN driver works with HCC-CFG and WLAN Configuration Core to parse and load configuration files. + +2. The WLAN Message module distributes user-mode messages to the AP and STA by component. + +3. Commands are delivered to mac80211, and then forwarded by the Bus module to the WLAN chip firmware. + +4. The protocol stack works with the NetDevice, NetBuf, and FlowCtl modules to exchange data flows. + +## Development Guidelines + +### Available APIs + +The WLAN module provides the following types of APIs: + +- WLAN APIs that can be directly called by drivers + +- APIs for vendors + +- APIs for the HDI layer + + + **Figure 3** WLAN driver APIs + + ![image](figures/WLAN_driver_APIs.png "WLAN Driver APIs") + +- The WLAN Driver module provides APIs that you can directly use to create or release a **WifiModule**, connect to or disconnect from a WLAN hotspot, request or release a **NetBuf**, and convert between the **pbuf** structure of Lightweight IP (lwIP) and a **NetBuf**. + + Tables 1 to 3 describe these APIs. + + **Table 1** wifi_module.h (HDF-based WLAN driver development) + + | API| Description| + | -------- | -------- | + | struct WifiModule \*WifiModuleCreate(const struct HdfConfigWifiModuleConfig \*config) | Creates a **WifiModule**.| + | void WifiModuleDelete(struct WifiModule \*module) | Deletes a **WifiModule** and releases its data.| + | int32_t DelFeature(struct WifiModule \*module, uint16_t featureType) | Deletes a feature from a **WifiModule**.| + | int32_t AddFeature(struct WifiModule \*module, uint16_t featureType, struct WifiFeature \*featureData) | Adds a feature to a **WifiModule**.| + + **Table 2** wifi_mac80211_ops.h + + | API| Description| + | -------- | -------- | + | int32_t (\*startAp)(NetDevice \*netDev) | Starts an AP.| + | int32_t (\*stopAp)(NetDevice \*netDev) | Stops an AP.| + | int32_t (\*connect)(NetDevice \*netDev, WifiConnectParams \*param) | Connects to a hotspot.| + | int32_t (\*disconnect)(NetDevice \*netDev, uint16_t reasonCode) | Disconnects from a hotspot.| + + **Table 3** hdf_netbuf.h + + | API| Description| + | -------- | -------- | + | static inline void NetBufQueueInit(struct NetBufQueue \*q) | Initializes a **NetBuf** queue.| + | struct NetBuf \*NetBufAlloc(uint32_t size) | Allocates a **NetBuf**.| + | void NetBufFree(struct NetBuf \*nb) | Releases a **NetBuf**.| + | struct NetBuf \*Pbuf2NetBuf(const struct NetDevice \*netdev, struct pbuf \*lwipBuf) | Converts the **pbuf** structure of lwIP to a **NetBuf**.| + | struct pbuf \*NetBuf2Pbuf(const struct NetBuf \*nb) | Converts a **NetBuf** to the **pbuf** structure of lwIP.| + +- The WLAN Driver module also provides APIs that you need to fill in the implementation. This type of APIs can be used to initialize/deinitialize a **NetDevice**, opening/stopping a **NetDevice**, and obtaining the **NetDevice** status. Table 4 describes some of these APIs. + + **Table 4** net_device.h + + | API| Description| + | -------- | -------- | + | int32_t (\*init)(struct NetDevice \*netDev) | Initializes a **NetDevice**.| + | struct NetDevStats \*(\*getStats)(struct NetDevice \*netDev) | Obtains the state of a **NetDevice**.| + | int32_t (\*setMacAddr)(struct NetDevice \*netDev, void \*addr) | Sets the MAC address.| + | void (\*deInit)(struct NetDevice \*netDev) | Deinitializes a **NetDevice**.| + | int32_t (\*open)(struct NetDevice \*netDev) | Opens a **NetDevice**.| + | int32_t (\*stop)(struct NetDevice \*netDev) | Stops a **NetDevice**.| + +- The WLAN Driver module also provides APIs to the HDI layer for creating and destroying an **IWiFi** object and setting the MAC address. Tables 5 and 6 describe some of the APIs. + + **Table 5** wifi_hal.h + + | API| Description| + | -------- | -------- | + | int32_t WifiConstruct(struct IWiFi \*\*wifiInstance) | Creates an **IWiFi** object with basic capabilities.| + | int32_t WifiDestruct(struct IWiFi \*\*wifiInstance) | Destroys an **IWiFi** object.| + | int32_t (\*start)(struct IWiFi \*) | Creates a channel between the HAL and the driver and obtains the NICs supported by the driver.| + | int32_t (\*stop)(struct IWiFi \*) | Stops the channel between the HAL and the driver.| + + **Table 6** wifi_hal_base_feature.h + + | API| Description| + | -------- | -------- | + | int32_t (\*getFeatureType)(const struct IWiFiBaseFeature \*) | Obtains the feature type.| + | int32_t (\*setMacAddress)(const struct IWiFiBaseFeature \*, unsigned char \*, uint8_t) | Sets the MAC address.| + | int32_t (\*getDeviceMacAddress)(const struct IWiFiBaseFeature \*, unsigned char \*, uint8_t) | Obtains the device MAC address.| + | int32_t (\*setTxPower)(const struct IWiFiBaseFeature \*, int32_t) | Sets the transmit power.| + + +### How to Develop + +The WLAN driver module developed based on the HDF and Platform frameworks provides a unified driver model for WLAN modules of different vendors regardless of the OS and system on a chip (SoC). + + +1. Configure hardware (such as modules and chips) parameters in the **wifi_config.hcs** file. This configuration file is parsed by the corresponding API in the HDF to generate a structure object for full configuration. + +2. Initialize and create a module. + +3. Attach and initialize the chip. + +4. Implement the upper-layer Wi-Fi Protected Access (WPA) service. + +### Development Example This example describes how to initialize a WLAN module. The following uses the Hi3881 WLAN chip as an example: -1. Set parameters for the WLAN module based on hardware attributes. + 1. Set parameters for the WLAN module based on hardware attributes. ``` /* Set parameters in the wlan_platform.hcs file based on hardware attributes. The following is an example of the WLAN platform configuration. */ @@ -246,29 +167,29 @@ hisi :& deviceList { deviceInstId = 0; powers { power0 { - powerSeqDelay = 0; /* Power supply sequencing delay */ - powerType = 1; /* Power supply type. Value 0 indicates that the power supply is always on, and value 1 indicates power supply through general-purpose input/output (GPIO). */ - gpioId = 1; /* GPIO pin ID */ - activeLevel=1; /* Active level. Value 0 indicates a low level, and value 1 indicates a high level. */ + powerSeqDelay = 0; /* Power sequence delay. */ + powerType = 1; /* Power supply type. The value 0 indicates that the device is always powered on, and 1 indicates power supply through general-purpose input/output (GPIO). */ + gpioId = 1; /* GPIO pin number. */ + activeLevel=1; /* Active level. The value 0 indicates low level, and 1 indicates high level. */ } power1 { - powerSeqDelay = 0; /* Power supply sequencing delay */ - powerType = 0; /* Power supply type. Value 0 indicates that the power supply is always on, and value 1 indicates power supply through GPIO. */ + powerSeqDelay = 0; /* Power sequence delay. */ + powerType = 0; /* The value 0 indicates that the device is always powered on, and 1 indicates power supply through GPIO. */ } } reset { - resetType = 0; /* Reset type. Value 0 indicates that reset is not supported, and value 1 indicates reset through GPIO. */ - gpioId = 2; /* GPIO pin ID */ - activeLevel=1; /* Active level. Value 0 indicates a low level, and value 1 indicates a high level. */ - resetHoldTime = 30; /* Hold time (ms) for a reset */ + resetType = 0; /* Reset type. The value 0 indicates that reset is dynamically determined, and value 1 indicates reset through GPIO. */ + gpioId = 2; /* GPIO pin number. */ + activeLevel=1; /* Active level. The value 0 indicates low level, and 1 indicates high level. */ + resetHoldTime = 30; /* Hold time (ms) after a reset. */ } - bootUpTimeout = 30; /* Boot timeout duration (ms) */ + bootUpTimeout = 30; /* Boot timeout duration (ms). */ bus { - busType = 0; /* Bus type. Value 0 indicates secure digital input/output (SDIO). */ - busId = 2; /* Bus ID */ - funcNum = [1]; /* SDIO function number */ - timeout = 1000; /* Timeout duration for data read/write */ - blockSize = 512; /* Size of the data block to read or write */ + busType = 0; /* Bus type. The value 0 indicates SDIO. */ + busId = 2; /* Bus number. */ + funcNum = [1]; /* SDIO function number. */ + timeout = 1000; /* Timeout duration for data read/write. */ + blockSize = 512; /* Size of the data block to read or write. */ } } } @@ -277,11 +198,11 @@ root { wlan_config { hi3881 :& chipList { chipHi3881 :: chipInst { - match_attr = "hdf_wlan_chips_hi3881"; /* Match attribute */ - chipName = "hi3881"; /* WLAN chip name */ + match_attr = "hdf_wlan_chips_hi3881"; /* Attribute used to match the chip. */ + chipName = "hi3881"; /* WLAN chip name. */ sdio { - vendorId = 0x0296; /* Vendor ID */ - deviceId = [0x5347]; /* Device ID */ + vendorId = 0x0296; /* Vendor ID. */ + deviceId = [0x5347]; /* Device ID. */ } } } @@ -289,10 +210,10 @@ root { } ``` -2. Mount the **init** and **deinit** functions of the WLAN chip and WLAN chip driver. + 2. Hook the **init** and **deinit** functions of the WLAN chip and WLAN chip driver. ``` -/* WLAN module initialization and mount process */ +/* Process of implementing WLAN module initialization. */ #include "hdf_device_desc.h" #include "hdf_wifi_product.h" #include "hdf_log.h" @@ -305,19 +226,19 @@ root { #define HDF_LOG_TAG Hi3881Driver -/* Functions for initializing and deinitializing the WLAN chip */ +/* Functions for initializing and deinitializing a WLAN chip. */ int32_t InitHi3881Chip(struct HdfWlanDevice *device); int32_t DeinitHi3881Chip(struct HdfWlanDevice *device); -/* Functions for initializing and deinitializing the WLAN chip driver */ +/* Functions for initializing and deinitializing a WLAN chip driver. */ int32_t Hi3881Deinit(struct HdfChipDriver* chipDriver, struct NetDevice *netDevice); int32_t Hi3881Init(struct HdfChipDriver* chipDriver, struct NetDevice *netDevice); -/* Initialize mac80211 and mount functions of the chip. */ +/* Initialize mac80211 by hooking the functions of the chip. */ hi_void HiMac80211Init(struct HdfChipDriver *chipDriver); static const char* const HI3881_DRIVER_NAME = "hisi"; -/* Mount the WLAN chip driver and the functions of mac80211 and the chip. */ +/* Hook the functions of the WLAN chip driver, mac80211, and chip. */ static struct HdfChipDriver *BuildHi3881Driver(struct HdfWlanDevice *device, uint8_t ifIndex) { struct HdfChipDriver *specificDriver = NULL; @@ -369,7 +290,7 @@ static uint8_t GetHi3881GetMaxIFCount(struct HdfChipDriverFactory *factory) { return 1; } -/* Register functions related to the WLAN chip. */ +/* Register WLAN chip functions. */ static int32_t HDFWlanRegHisiDriverFactory(void) { static struct HdfChipDriverFactory tmpFactory = { 0 }; @@ -409,6 +330,7 @@ struct HdfDriverEntry g_hdfHisiChipEntry = { HDF_INIT(g_hdfHisiChipEntry); ``` + ``` #include "hdf_wifi_product.h" #include "hi_wifi_api.h" @@ -418,12 +340,12 @@ HDF_INIT(g_hdfHisiChipEntry); #endif #include "wifi_mac80211_ops.h" #include "wal_cfg80211.h" -#include "net_adpater.h" +#include "net_adapter.h" #include "hdf_wlan_utils.h" #define HDF_LOG_TAG Hi3881Driver -/* Initialize the WLAN chip. */ +/* Function for initializing the WLAN chip. */ int32_t InitHi3881Chip(struct HdfWlanDevice *device) { uint8_t maxPortCount = 1; @@ -451,7 +373,7 @@ int32_t InitHi3881Chip(struct HdfWlanDevice *device) return HI_SUCCESS; } -/* Deinitialize the WLAN chip. */ +/* Function for deinitializing the WLAN chip. */ int32_t DeinitHi3881Chip(struct HdfWlanDevice *device) { (void)device; @@ -462,7 +384,7 @@ int32_t DeinitHi3881Chip(struct HdfWlanDevice *device) return ret; } -/* Initialize the WLAN chip driver. */ +/* Function for initializing the WLAN chip driver. */ int32_t Hi3881Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) { HDF_LOGI("%s: start...", __func__); @@ -492,7 +414,7 @@ int32_t Hi3881Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice return ret; } -/* Deinitialize the WLAN chip driver. */ +/* Function for deinitializing the WLAN chip driver. */ int32_t Hi3881Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) { (void)chipDriver; @@ -504,7 +426,7 @@ int32_t Hi3881Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevi } ``` -3. During the chip initialization, call the **NetDeviceInit\(\)** function to initialize a network device, call the **NetDeviceAdd\(\)** function to add the network device to a protocol stack, and implement some function pointers of **netdev**. + 3. During the chip initialization process, call **NetDeviceInit()** to initialize a network device, call **NetDeviceAdd()** to add the network device to a protocol stack, and hook function pointers of **netdev**. ``` hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi_char* ifname, hi_u32* len) @@ -521,7 +443,7 @@ hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi return HI_SUCCESS; } -/* Mount some function pointers of NetDeviceInterFace. */ +/* Hook pointers of NetDeviceInterFace(). */ oal_net_device_ops_stru g_wal_net_dev_ops = { .getStats = wal_netdev_get_stats, @@ -553,12 +475,13 @@ hi_s32 wal_init_netif(nl80211_iftype_uint8 type, oal_net_device_stru *netdev, co } ``` -4. Implement functions of **WifiMac80211Ops**. +4. Hook functions of **WifiMac80211Ops**. + ``` -/* Mount some function pointers of mac80211. */ +/* Hook function pointers of mac80211. */ -/* MAC-layer APIs for basic capabilities that need to be implemented by the driver */ +/* Define the functions for implementing the basic capabilities in the MAC layer for the driver. */ static struct HdfMac80211BaseOps g_baseOps = { .SetMode = WalSetMode, .AddKey = WalAddKey, @@ -571,7 +494,7 @@ static struct HdfMac80211BaseOps g_baseOps = { .GetHwCapability = WalGetHwCapability }; -/* MAC-layer APIs for station capabilities that need to be implemented by the driver */ +/* Define the functions for implementing the STA capabilities in the MAC layer for the driver. */ static struct HdfMac80211STAOps g_staOps = { .Connect = WalConnect, .Disconnect = WalDisconnect, @@ -580,7 +503,7 @@ static struct HdfMac80211STAOps g_staOps = { .SetScanningMacAddress = WalSetScanningMacAddress, }; -/* MAC-layer APIs for AP capabilities that need to be implemented by the driver */ +/* Define the functions for implementing the AP capabilities in the MAC layer for the driver. */ static struct HdfMac80211APOps g_apOps = { .ConfigAp = WalConfigAp, .StartAp = WalStartAp, @@ -592,7 +515,7 @@ static struct HdfMac80211APOps g_apOps = { .GetAssociatedStasInfo = WalGetAssociatedStasInfo }; -/* Initialize mac80211 and mount functions of the chip. */ +/* Initialize mac80211 and hook functions of the chip. */ hi_void HiMac80211Init(struct HdfChipDriver *chipDriver) { if (chipDriver == NULL) { @@ -603,4 +526,29 @@ hi_void HiMac80211Init(struct HdfChipDriver *chipDriver) chipDriver->staOps = &g_staOps; chipDriver->apOps = &g_apOps; } -``` \ No newline at end of file +``` +## Reference + +- Code repositories: + + [drivers\_hdf\_core](https://gitee.com/openharmony/drivers_hdf_core) + + [drivers\_peripheral](https://gitee.com/openharmony/drivers_peripheral) + +- Code paths: + + Adaptation of WLAN FlowCtl component on LiteOS: **//drivers/hdf_core/adapter/khdf/liteos/model/network/wifi** + + Adaptation of HDF network model on LiteOS: **//drivers/hdf_core/adapter/khdf/liteos/model/network** + + Adaptation of WLAN FlowCtl component on Linux, build of the HDF WLAN model, and build of the vendor's WLAN driver: + + **//drivers/hdf_core/adapter/khdf/linux/model/network/wifi** + + Core code for implementing the WLAN module: **//drivers/hdf_core/framework/model/network/wifi** + + External APIs of the WLAN module: **//drivers/hdf_core/framework/include/wifi** + + HDF network model APIs: **//drivers/hdf_core/framework/include/net** + + WLAN HDI APIs and implementation: **//drivers/peripheral/wlan** diff --git a/en/device-dev/driver/figures/WLAN_architecture.png b/en/device-dev/driver/figures/WLAN_architecture.png new file mode 100644 index 0000000000000000000000000000000000000000..2479e5101bf555d57c0ed700d82e7671b868bc3a Binary files /dev/null and b/en/device-dev/driver/figures/WLAN_architecture.png differ diff --git a/en/device-dev/driver/figures/WLAN_driver_APIs.png b/en/device-dev/driver/figures/WLAN_driver_APIs.png new file mode 100644 index 0000000000000000000000000000000000000000..19cee91371e94ae6c375c4011174f65b2e0f5664 Binary files /dev/null and b/en/device-dev/driver/figures/WLAN_driver_APIs.png differ diff --git a/en/device-dev/driver/figures/WLAN_driver_architecture.png b/en/device-dev/driver/figures/WLAN_driver_architecture.png new file mode 100644 index 0000000000000000000000000000000000000000..a902741d5f92c6a3b80ad5e51cb2f9343ed91787 Binary files /dev/null and b/en/device-dev/driver/figures/WLAN_driver_architecture.png differ diff --git a/en/device-dev/driver/figures/available-apis-of-the-wlan-module.png b/en/device-dev/driver/figures/available-apis-of-the-wlan-module.png deleted file mode 100644 index 9e5c77122219d9aeb1b7bd0647c6fe0b81f297fa..0000000000000000000000000000000000000000 Binary files a/en/device-dev/driver/figures/available-apis-of-the-wlan-module.png and /dev/null differ diff --git a/en/device-dev/driver/figures/wlan-framework.png b/en/device-dev/driver/figures/wlan-framework.png deleted file mode 100644 index 87b45b288d127e85f836d8673fda820f1069186b..0000000000000000000000000000000000000000 Binary files a/en/device-dev/driver/figures/wlan-framework.png and /dev/null differ