diff --git a/display/interfaces/include/display_gralloc.h b/display/interfaces/include/display_gralloc.h index 5e23feaa743b6dd6667776a56359e1e4bd2e5dd4..44617418b439b17e2fe6b75f118a108a88ae814b 100644 --- a/display/interfaces/include/display_gralloc.h +++ b/display/interfaces/include/display_gralloc.h @@ -50,9 +50,9 @@ typedef struct { /** * @brief Allocates memory based on the parameters passed by the GUI. * - * The allocated memory can be classified into shared memory, memory with cache, and memory without cache. + * @param info Indicates the pointer to the description info of the memory to allocate. * - * @param buffer Indicates the pointer to the buffer of the memory to allocate. + * @param handle Indicates the double pointer to the buffer of the memory to allocate. * * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} * otherwise. @@ -64,7 +64,7 @@ typedef struct { /** * @brief Releases memory. * - * @param buffer Indicates the pointer to the buffer of the memory to release. + * @param handle Indicates the pointer to the buffer of the memory to release. * * @since 1.0 * @version 1.0 @@ -74,7 +74,7 @@ typedef struct { /** * @brief Maps memory to memory without cache in the process's address space. * - * @param buffer Indicates the pointer to the buffer of the memory to map. + * @param handle Indicates the pointer to the buffer of the memory to map. * * @return Returns the pointer to a valid address if the operation is successful; returns NULL otherwise. * @since 1.0 @@ -85,18 +85,18 @@ typedef struct { /** * @brief Maps memory to memory with cache in the process's address space. * - * @param buffer Indicates the pointer to the buffer of the memory to map. + * @param handle Indicates the pointer to the buffer of the memory to map. * * @return Returns the pointer to a valid address if the operation is successful; returns NULL otherwise. * @since 1.0 * @version 1.0 */ - void *(*MmapCache)(GrallocBuffer *buffer); + void *(*MmapCache)(BufferHandle *handle); /** * @brief Unmaps memory, that is, removes any mappings in the process's address space. * - * @param buffer Indicates the pointer to the buffer of the memory to unmap. + * @param handle Indicates the pointer to the buffer of the memory to unmap. * * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} * otherwise. @@ -108,7 +108,7 @@ typedef struct { /** * @brief Flushes data from the cache to memory and invalidates the data in the cache. * - * @param buffer Indicates the pointer to the buffer of the cache to flush. + * @param handle Indicates the pointer to the buffer of the cache to flush. * * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} * otherwise. @@ -120,19 +120,19 @@ typedef struct { /** * @brief Flushes data from the cache mapped via {@link Mmap} to memory and invalidates the data in the cache. * - * @param buffer Indicates the pointer to the buffer of the cache to flush. + * @param handle Indicates the pointer to the buffer of the cache to flush. * * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} * otherwise. * @since 1.0 * @version 1.0 */ - int32_t (*FlushMCache)(BufferHandle *buffer); + int32_t (*FlushMCache)(BufferHandle *handle); /** * @brief Invalidate the Cache, it will update the cache from memory. * - * @param buffer Indicates the pointer to the buffer of the cache which will been invalidated + * @param handle Indicates the pointer to the buffer of the cache which will been invalidated * * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} * otherwise. diff --git a/wlan/README.md b/wlan/README.md index 8d630195911d4779882b92d54f1c2324ab9b5c0b..ee166779c8c54d44ce84b2f01faa693fe0f921c5 100644 --- a/wlan/README.md +++ b/wlan/README.md @@ -14,7 +14,7 @@ This repository defines and implements the WLAN-related Hardware Driver Interfac 2. Obtaining the WLAN features supported by the device 3. Creating a WLAN feature instance -**Figure 1** WLAN driver module architecture +**Figure 1** WLAN driver module architecture ![](figures/wlan-driver-module-architecture.png "wlan-driver-module-architecture") ## Directory Structure @@ -35,7 +35,7 @@ The directory structure of the WLAN repository is as follows: ## Available APIs -The WLAN HAL module provides APIs for the Wi-Fi service, such as creating and destroying an **IWiFi** object and setting the MAC address. +The WLAN HAL module provides APIs for the Wi-Fi service, such as creating and destroying an **IWiFi** object and setting the MAC address. The following table lists the APIs. **Table 1** APIs provided by the WLAN HAL module @@ -48,7 +48,7 @@ The WLAN HAL module provides APIs for the Wi-Fi service, such as creating and de -

wifi_hal.h

+

wifi_hal.h

int32_t WifiConstruct(struct IWiFi **wifiInstance);

@@ -61,21 +61,100 @@ The WLAN HAL module provides APIs for the Wi-Fi service, such as creating and de

Destroys an IWiFi object.

-

int32_t (*start)(struct IWiFi *);

+

int32_t (*CallbackFunc)(int32_t event, struct HdfSBuf *reqData);

+ +

Defines a callback to listen for IWiFi asynchronous events.

+ + +

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 *);

+

int32_t (*stop)(struct IWiFi *);

Stops the channel between the HAL and the driver.

-

wifi_hal_base_feature.h

+

int32_t (*getSupportFeature)(uint8_t *supType, uint32_t size);

+ +

Obtains the WLAN features available for the device no matter whether it works as an AP, STA, or P2P server/client.

+ + +

int32_t (*getSupportCombo)(uint64_t *combo, uint32_t size);

+ +

Obtains the WLAN features available for the device that plays different roles simultaneously (any combination of AP, STA, and P2P server/client).

+ + +

int32_t (*createFeature)(int32_t type, struct IWiFiBaseFeature **ifeature);

+ +

Creates an IWiFiBaseFeature object of a specified type.

+ + +

int32_t (*getFeatureByIfName)(const char *ifName, struct IWiFiBaseFeature **ifeature);

+ +

Obtains an IWiFiBaseFeature object based on a specified network interface name.

+ + +

int32_t (*registerEventCallback)(CallbackFunc cbFunc);

-

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

+

Registers a callback to listen for IWiFi asynchronous events.

+ + +

int32_t (*unRegisterEventCallback)(void);

+ +

Unregisters an IWiFi callback.

+ + +

int32_t (*destroyFeature)(struct IWiFiBaseFeature *ifeature);

+ +

Destroys a specified IWiFiBaseFeature object.

+ + +

int32_t (*resetDriver)(const uint8_t chipId);

+ +

Resets the WLAN driver with a specified chip ID.

+ + +

wifi_hal_ap_feature.h

+ +

int32_t (*getAsscociatedStas)(const struct IWiFiAp *apFeature, struct StaInfo *staInfo, uint32_t count, uint32_t *num);

+ +

Obtains information (MAC addresses only in the current version) about all the connected STAs.

+ + +

int32_t (*setCountryCode)(const struct IWiFiAp *apFeature, const char *code, uint32_t len);

-

Obtains the feature type.

+

Sets the country/region code.

+ + +

int32_t InitApFeature(struct IWiFiAp **fe);

+ +

Initializes a specified AP feature. This function is called during the AP feature creation.

+ + +

wifi_hal_sta_feature.h

+ +

int32_t (*setScanningMacAddres)(const struct IWiFiSta *staFeature, unsigned char *scanMac, uint8_t len);

+ +

Sets a single MAC address to scan for.

+ + +

int32_t InitStaFeature(struct IWiFiSta **fe);

+ +

Initializes a specified STA feature. This function is called during the STA feature creation.

+ + +

wifi_hal_base_feature.h

+ +

const char *(*getNetworkIfaceName)(const struct IWiFiBaseFeature *baseFeature);

+ +

Obtains the name of a network interface.

+ + +

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

+ +

Obtains the feature type.

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

@@ -88,11 +167,31 @@ The WLAN HAL module provides APIs for the Wi-Fi service, such as creating and de

Obtains the device MAC address.

-

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

+

int32_t (*getValidFreqsWithBand)(const struct IWiFiBaseFeature *baseFeature, int32_t band, int32_t *freqs, uint32_t count, uint32_t *num);

+ +

Obtains the frequencies supported by the 2.4 GHz or 5 GHz band.

+ + +

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

Sets the transmit power.

+

int32_t (*getChipId)(const struct IWiFiBaseFeature *baseFeature, uint8_t *chipId);

+ +

Obtains the chip ID of the current driver.

+ + +

int32_t (*getIfNamesByChipId)(const uint8_t chipId, char **ifNames, uint32_t *num);

+ +

Obtains names of all the NICs of the current chip based on the chip ID.

+ + +

int32_t InitBaseFeature(struct IWiFiBaseFeature **fe);

+ +

Initializes a specified base feature. This function is called during the base feature creation.

+ + @@ -102,7 +201,7 @@ The following describes how to use the WLAN HAL module. 1. Call the **WifiConstruct** function to create an **IWiFi** object. 2. Use the created **IWiFi** object to call the **start** function to create a channel between the HAL and the driver and obtain the driver NIC information. -3. Call the **createFeature** function to create an AP feature or station feature. You can call functions to perform operations on the created feature \(use an AP feature as an example\). +3. Call the **createFeature** function to create an AP feature or STA feature. You can call functions to perform operations on the created feature \(use an AP feature as an example\). 4. Call functions to perform operations, such as calling the **setMacAddress** function to set the MAC address and calling the **getDeviceMacAddress** function to obtain the device MAC address. 5. Call the **destroyFeature** function to destroy the created feature. 6. Call the **stop** function to stop the channel between the HAL and the driver. diff --git a/wlan/README_zh.md b/wlan/README_zh.md index 7ce27373412edbf6ec548a4b1b70ceb251101b25..782f0cf60bfc2b4c383c434a996e6274c11e654e 100644 --- a/wlan/README_zh.md +++ b/wlan/README_zh.md @@ -35,25 +35,25 @@ WLAN源代码目录结构如下所示: ## 接口说明 -WLAN驱动HAL模块提供给Wi-Fi service可直接调用的能力接口,主要功能有:创建/销毁 IWiFi对象、设置MAC地址等。提供的部分接口说明如下表所示: +WLAN驱动HAL模块提供给Wi-Fi service可直接调用的能力接口,主要功能有:创建/销毁 IWiFi对象、设置MAC地址等。提供的接口说明如下表所示: **表 1** hal层对外接口 - - - - - - + + + - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + +

头文件

接口名称

+

接口名称

功能描述

+

功能描述

wifi_hal.h

+

wifi_hal.h

int32_t WifiConstruct(struct IWiFi **wifiInstance);

+

int32_t WifiConstruct(struct IWiFi **wifiInstance);

创建IWiFi对象,提供IWiFi基本能力。

+

创建IWiFi对象,提供IWiFi基本能力。

int32_t WifiDestruct(struct IWiFi **wifiInstance);

@@ -61,21 +61,100 @@ WLAN驱动HAL模块提供给Wi-Fi service可直接调用的能力接口,主要

销毁IWiFi对象。

int32_t (*start)(struct IWiFi *);

+

int32_t (*CallbackFunc)(int32_t event, struct HdfSBuf *reqData);

+

定义IWiFi回调函数的原型,监听异步事件。

+

int32_t (*start)(struct IWiFi *);

创建HAL和驱动之间的通道及获取驱动支持的网卡信息。

int32_t (*stop)(struct IWiFi *);

+

int32_t (*stop)(struct IWiFi *);

销毁通道。

wifi_hal_base_feature.h

+

int32_t (*getSupportFeature)(uint8_t *supType, uint32_t size);

+

获取该设备支持的WLAN特性(不考虑当前的使用状态)。

+

int32_t (*getSupportCombo)(uint64_t *combo, uint32_t size);

+

获取多网卡共存情况。

+

int32_t (*createFeature)(int32_t type, struct IWiFiBaseFeature **ifeature);

+

根据输入类型创建对应的特性。

+

int32_t (*getFeatureByIfName)(const char *ifName, struct IWiFiBaseFeature **ifeature);

+

通过网络接口名字获取对应的特性。

+

int32_t (*registerEventCallback)(CallbackFunc cbFunc);

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

+

注册IWiFi的回调函数,监听异步事件。

+

int32_t (*unRegisterEventCallback)(void);

+

去注册IWiFi的回调函数。

+

int32_t (*destroyFeature)(struct IWiFiBaseFeature *ifeature);

+

销毁对应的特性。

+

int32_t (*resetDriver)(const uint8_t chipId);

+

WLAN驱动进行重置。

+

wifi_hal_ap_feature.h

+

int32_t (*getAsscociatedStas)(const struct IWiFiAp *apFeature, struct StaInfo *staInfo, uint32_t count, uint32_t *num);

+

获取连接上的所有STA的信息(目前只包含MAC地址)。

+

int32_t (*setCountryCode)(const struct IWiFiAp *apFeature, const char *code, uint32_t len);

获取特性的类型。

+

设置国家码。

+

int32_t InitApFeature(struct IWiFiAp **fe);

+

初始化AP特性。wifi service在创建AP类型的特性时调用。

+

wifi_hal_sta_feature.h

+

int32_t (*setScanningMacAddres)(const struct IWiFiSta *staFeature, unsigned char *scanMac, uint8_t len);

+

设置扫描单个MAC地址。

+

int32_t InitStaFeature(struct IWiFiSta **fe);

+

初始化STA特性。wifi service在创建STA类型的特性时调用。

+

wifi_hal_base_feature.h

+

const char *(*getNetworkIfaceName)(const struct IWiFiBaseFeature *baseFeature);

+

获取网络接口的名字。

+

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

+

获取特性的类型。

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

@@ -83,16 +162,36 @@ WLAN驱动HAL模块提供给Wi-Fi service可直接调用的能力接口,主要

设置MAC地址。

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

+

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

获取设备持久化的MAC地址。

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

+

int32_t (*getValidFreqsWithBand)(const struct IWiFiBaseFeature *baseFeature, int32_t band, int32_t *freqs, uint32_t count, uint32_t *num);

+

获取指定频段(2.4G或者5G)下支持的频率。

+

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

设置发射功率。

int32_t (*getChipId)(const struct IWiFiBaseFeature *baseFeature, uint8_t *chipId);

+

获得当前驱动的芯片ID。

+

int32_t (*getIfNamesByChipId)(const uint8_t chipId, char **ifNames, uint32_t *num);

+

通过芯片ID获得当前芯片所有的网卡名。

+

int32_t InitBaseFeature(struct IWiFiBaseFeature **fe);

+

初始化基本特性。用于wifi service在创建任何类型的特性时。

+
@@ -102,8 +201,8 @@ HAL模块使用步骤: 1. 使用WifiConstruct创建一个WiFi实体。 2. 用创建的WiFi实体调用start开启HAL和驱动之间的通道,获得驱动网卡信息。 -3. 通过createFeature创建一个apFeature或者staFeature。后面可通过这些Feature去调用具体的实现接口。 -4. 下面基于创建的apFeature调用和使用相关接口:如setMacAddress设置MAC地址、getDeviceMacAddress获取设备的MAC地址等。 +3. 通过createFeature一个apFeature或者staFeature。后面可通过这些Feature去调用具体的实现接口,下面基于创建的apFeature。 +4. 调用和使用相关接口:如setMacAddress设置MAC地址、getDeviceMacAddress获取设备的MAC地址等。 5. 调用destroyFeature,销毁掉创建的这个Feature。 6. 调用stop销毁创建的通道。 7. 执行WifiDestruct销毁创建的WiFi实体。 diff --git a/wlan/figures/wlan-driver-module-architecture.png b/wlan/figures/wlan-driver-module-architecture.png index 1b1f40fd62bafa62601e0b7162be16a6ea838c4f..9f6a4dd58ae1268484f9d5526ce88f8825fc8569 100755 Binary files a/wlan/figures/wlan-driver-module-architecture.png and b/wlan/figures/wlan-driver-module-architecture.png differ diff --git a/wlan/figures/wlan-driver-module-architecture_zh.png b/wlan/figures/wlan-driver-module-architecture_zh.png old mode 100755 new mode 100644 index 390ab818469113d21d48399a3e73bcffc718add3..8f7187276d2dca898c6810928b03d170b6fa645f Binary files a/wlan/figures/wlan-driver-module-architecture_zh.png and b/wlan/figures/wlan-driver-module-architecture_zh.png differ