From 1137f9f82e53b2c06179c9bca4b5d757488049ab Mon Sep 17 00:00:00 2001 From: duangavin123 Date: Wed, 21 Jul 2021 19:26:55 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AF=BC=E5=85=A5OpenHarmony=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: duangavin123 --- en/device-dev/driver/Readme-EN.md | 44 +-- en/device-dev/driver/drive-hdf.md | 15 - en/device-dev/driver/drive-peripherals.md | 11 - en/device-dev/driver/drive-platform.md | 19 - en/device-dev/driver/drive.md | 9 - ...velopment.md => driver-hdf-development.md} | 2 +- ...ive-hdf-manage.md => driver-hdf-manage.md} | 0 .../{drive-hdf-news.md => driver-hdf-news.md} | 0 ...hdf-overview.md => driver-hdf-overview.md} | 0 ...ive-hdf-sample.md => driver-hdf-sample.md} | 0 ...emanage.md => driver-hdf-servicemanage.md} | 0 en/device-dev/driver/driver-hdf.md | 15 + ....md => driver-peripherals-external-des.md} | 0 ...d-des.md => driver-peripherals-lcd-des.md} | 0 ...es.md => driver-peripherals-sensor-des.md} | 4 +- ...des.md => driver-peripherals-touch-des.md} | 6 +- en/device-dev/driver/driver-peripherals.md | 11 + ...pio-des.md => driver-platform-gpio-des.md} | 0 ...-i2c-des.md => driver-platform-i2c-des.md} | 0 ...-des.md => driver-platform-mipidsi-des.md} | 0 ...-rtc-des.md => driver-platform-rtc-des.md} | 0 ...dio-des.md => driver-platform-sdio-des.md} | 0 ...-spi-des.md => driver-platform-spi-des.md} | 0 ...art-des.md => driver-platform-uart-des.md} | 0 ...des.md => driver-platform-watchdog-des.md} | 0 en/device-dev/driver/driver-platform.md | 19 + en/device-dev/driver/driver.md | 9 + en/device-dev/guide/Readme-EN.md | 4 +- ...ce-drive-demo.md => device-driver-demo.md} | 2 +- ...ive-demo.md => device-outerdriver-demo.md} | 2 +- en/device-dev/guide/device.md | 4 +- en/device-dev/overview.md | 2 +- en/device-dev/subsystems/Readme-EN.md | 8 +- en/device-dev/subsystems/subsys-densor.md | 9 - ...s-densor-demo.md => subsys-sensor-demo.md} | 0 ...densor-guide.md => subsys-sensor-guide.md} | 0 ...-overview.md => subsys-sensor-overview.md} | 0 en/device-dev/subsystems/subsys-sensor.md | 9 + en/device-dev/subsystems/subsys.md | 2 +- en/readme.md | 4 +- zh-cn/device-dev/driver/Readme-CN.md | 42 +- zh-cn/device-dev/driver/drive-peripherals.md | 11 - zh-cn/device-dev/driver/drive-platform.md | 19 - zh-cn/device-dev/driver/drive.md | 19 - ...velopment.md => driver-hdf-development.md} | 4 +- ...ive-hdf-manage.md => driver-hdf-manage.md} | 0 .../{drive-hdf-news.md => driver-hdf-news.md} | 2 +- ...hdf-overview.md => driver-hdf-overview.md} | 0 ...ive-hdf-sample.md => driver-hdf-sample.md} | 0 ...emanage.md => driver-hdf-servicemanage.md} | 0 ....md => driver-peripherals-external-des.md} | 0 ...d-des.md => driver-peripherals-lcd-des.md} | 2 +- ...es.md => driver-peripherals-sensor-des.md} | 4 +- ...des.md => driver-peripherals-touch-des.md} | 6 +- zh-cn/device-dev/driver/driver-peripherals.md | 11 + ...pio-des.md => driver-platform-gpio-des.md} | 0 ...-i2c-des.md => driver-platform-i2c-des.md} | 0 ...-des.md => driver-platform-mipidsi-des.md} | 0 ...-rtc-des.md => driver-platform-rtc-des.md} | 0 ...dio-des.md => driver-platform-sdio-des.md} | 0 ...-spi-des.md => driver-platform-spi-des.md} | 0 ...art-des.md => driver-platform-uart-des.md} | 0 ...des.md => driver-platform-watchdog-des.md} | 0 zh-cn/device-dev/driver/driver-platform.md | 19 + zh-cn/device-dev/driver/driver.md | 19 + zh-cn/device-dev/guide/Readme-CN.md | 4 +- ...ce-drive-demo.md => device-driver-demo.md} | 2 +- ...ive-demo.md => device-outerdriver-demo.md} | 4 +- zh-cn/device-dev/guide/device.md | 4 +- zh-cn/device-dev/porting/Readme-CN.md | 61 ++- .../porting/standard_system_porting_guide.md | 374 ++++++++++++++++++ zh-cn/device-dev/subsystems/Readme-CN.md | 8 +- zh-cn/device-dev/subsystems/subsys-densor.md | 9 - ...s-densor-demo.md => subsys-sensor-demo.md} | 0 ...densor-guide.md => subsys-sensor-guide.md} | 0 ...-overview.md => subsys-sensor-overview.md} | 0 zh-cn/device-dev/subsystems/subsys-sensor.md | 9 + zh-cn/device-dev/subsystems/subsys.md | 2 +- .../device-dev/\345\257\274\350\257\273.md" | 2 +- zh-cn/readme.md | 4 +- 80 files changed, 610 insertions(+), 241 deletions(-) delete mode 100644 en/device-dev/driver/drive-hdf.md delete mode 100644 en/device-dev/driver/drive-peripherals.md delete mode 100644 en/device-dev/driver/drive-platform.md delete mode 100644 en/device-dev/driver/drive.md rename en/device-dev/driver/{drive-hdf-development.md => driver-hdf-development.md} (99%) rename en/device-dev/driver/{drive-hdf-manage.md => driver-hdf-manage.md} (100%) rename en/device-dev/driver/{drive-hdf-news.md => driver-hdf-news.md} (100%) rename en/device-dev/driver/{drive-hdf-overview.md => driver-hdf-overview.md} (100%) rename en/device-dev/driver/{drive-hdf-sample.md => driver-hdf-sample.md} (100%) rename en/device-dev/driver/{drive-hdf-servicemanage.md => driver-hdf-servicemanage.md} (100%) create mode 100644 en/device-dev/driver/driver-hdf.md rename en/device-dev/driver/{drive-peripherals-external-des.md => driver-peripherals-external-des.md} (100%) rename en/device-dev/driver/{drive-peripherals-lcd-des.md => driver-peripherals-lcd-des.md} (100%) rename en/device-dev/driver/{drive-peripherals-sensor-des.md => driver-peripherals-sensor-des.md} (99%) rename en/device-dev/driver/{drive-peripherals-touch-des.md => driver-peripherals-touch-des.md} (97%) create mode 100644 en/device-dev/driver/driver-peripherals.md rename en/device-dev/driver/{drive-platform-gpio-des.md => driver-platform-gpio-des.md} (100%) rename en/device-dev/driver/{drive-platform-i2c-des.md => driver-platform-i2c-des.md} (100%) rename en/device-dev/driver/{drive-platform-mipidsi-des.md => driver-platform-mipidsi-des.md} (100%) rename en/device-dev/driver/{drive-platform-rtc-des.md => driver-platform-rtc-des.md} (100%) rename en/device-dev/driver/{drive-platform-sdio-des.md => driver-platform-sdio-des.md} (100%) rename en/device-dev/driver/{drive-platform-spi-des.md => driver-platform-spi-des.md} (100%) rename en/device-dev/driver/{drive-platform-uart-des.md => driver-platform-uart-des.md} (100%) rename en/device-dev/driver/{drive-platform-watchdog-des.md => driver-platform-watchdog-des.md} (100%) create mode 100644 en/device-dev/driver/driver-platform.md create mode 100644 en/device-dev/driver/driver.md rename en/device-dev/guide/{device-drive-demo.md => device-driver-demo.md} (98%) rename en/device-dev/guide/{device-outerdrive-demo.md => device-outerdriver-demo.md} (99%) delete mode 100644 en/device-dev/subsystems/subsys-densor.md rename en/device-dev/subsystems/{subsys-densor-demo.md => subsys-sensor-demo.md} (100%) rename en/device-dev/subsystems/{subsys-densor-guide.md => subsys-sensor-guide.md} (100%) rename en/device-dev/subsystems/{subsys-densor-overview.md => subsys-sensor-overview.md} (100%) create mode 100644 en/device-dev/subsystems/subsys-sensor.md delete mode 100644 zh-cn/device-dev/driver/drive-peripherals.md delete mode 100644 zh-cn/device-dev/driver/drive-platform.md delete mode 100644 zh-cn/device-dev/driver/drive.md rename zh-cn/device-dev/driver/{drive-hdf-development.md => driver-hdf-development.md} (98%) rename zh-cn/device-dev/driver/{drive-hdf-manage.md => driver-hdf-manage.md} (100%) rename zh-cn/device-dev/driver/{drive-hdf-news.md => driver-hdf-news.md} (98%) rename zh-cn/device-dev/driver/{drive-hdf-overview.md => driver-hdf-overview.md} (100%) rename zh-cn/device-dev/driver/{drive-hdf-sample.md => driver-hdf-sample.md} (100%) rename zh-cn/device-dev/driver/{drive-hdf-servicemanage.md => driver-hdf-servicemanage.md} (100%) rename zh-cn/device-dev/driver/{drive-peripherals-external-des.md => driver-peripherals-external-des.md} (100%) rename zh-cn/device-dev/driver/{drive-peripherals-lcd-des.md => driver-peripherals-lcd-des.md} (97%) rename zh-cn/device-dev/driver/{drive-peripherals-sensor-des.md => driver-peripherals-sensor-des.md} (99%) rename zh-cn/device-dev/driver/{drive-peripherals-touch-des.md => driver-peripherals-touch-des.md} (96%) create mode 100644 zh-cn/device-dev/driver/driver-peripherals.md rename zh-cn/device-dev/driver/{drive-platform-gpio-des.md => driver-platform-gpio-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-i2c-des.md => driver-platform-i2c-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-mipidsi-des.md => driver-platform-mipidsi-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-rtc-des.md => driver-platform-rtc-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-sdio-des.md => driver-platform-sdio-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-spi-des.md => driver-platform-spi-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-uart-des.md => driver-platform-uart-des.md} (100%) rename zh-cn/device-dev/driver/{drive-platform-watchdog-des.md => driver-platform-watchdog-des.md} (100%) create mode 100644 zh-cn/device-dev/driver/driver-platform.md create mode 100644 zh-cn/device-dev/driver/driver.md rename zh-cn/device-dev/guide/{device-drive-demo.md => device-driver-demo.md} (98%) rename zh-cn/device-dev/guide/{device-outerdrive-demo.md => device-outerdriver-demo.md} (99%) create mode 100644 zh-cn/device-dev/porting/standard_system_porting_guide.md delete mode 100644 zh-cn/device-dev/subsystems/subsys-densor.md rename zh-cn/device-dev/subsystems/{subsys-densor-demo.md => subsys-sensor-demo.md} (100%) rename zh-cn/device-dev/subsystems/{subsys-densor-guide.md => subsys-sensor-guide.md} (100%) rename zh-cn/device-dev/subsystems/{subsys-densor-overview.md => subsys-sensor-overview.md} (100%) create mode 100644 zh-cn/device-dev/subsystems/subsys-sensor.md diff --git a/en/device-dev/driver/Readme-EN.md b/en/device-dev/driver/Readme-EN.md index bbcc73ae3c..c82515419f 100644 --- a/en/device-dev/driver/Readme-EN.md +++ b/en/device-dev/driver/Readme-EN.md @@ -1,23 +1,23 @@ -# Drivers +# drivers -- [HDF](drive-hdf.md) - - [HDF Overview](drive-hdf-overview.md) - - [Driver Development](drive-hdf-development.md) - - [Driver Service Management](drive-hdf-servicemanage.md) - - [Driver Message Mechanism Management](drive-hdf-news.md) - - [Driver Configuration Management](drive-hdf-manage.md) - - [HDF Development Example](drive-hdf-sample.md) -- [Platform Drivers](drive-platform.md) - - [GPIO](drive-platform-gpio-des.md) - - [I2C](drive-platform-i2c-des.md) - - [RTC](drive-platform-rtc-des.md) - - [SDIO](drive-platform-sdio-des.md) - - [SPI](drive-platform-spi-des.md) - - [UART](drive-platform-uart-des.md) - - [Watchdog](drive-platform-watchdog-des.md) - - [MIPI DSI](drive-platform-mipidsi-des.md) -- [Peripherals](drive-peripherals.md) - - [LCD](drive-peripherals-lcd-des.md) - - [TOUCHSCREEN](drive-peripherals-touch-des.md) - - [Sensor](drive-peripherals-sensor-des.md) - - [WLAN](drive-peripherals-external-des.md) \ No newline at end of file +- [HDF](driver-hdf.md) + - [HDF Overview](driver-hdf-overview.md) + - [driverr Development](driver-hdf-development.md) + - [driverr Service Management](driver-hdf-servicemanage.md) + - [driverr Message Mechanism Management](driver-hdf-news.md) + - [driverr Configuration Management](driver-hdf-manage.md) + - [HDF Development Example](driver-hdf-sample.md) +- [Platform driverrs](driver-platform.md) + - [GPIO](driver-platform-gpio-des.md) + - [I2C](driver-platform-i2c-des.md) + - [RTC](driver-platform-rtc-des.md) + - [SDIO](driver-platform-sdio-des.md) + - [SPI](driver-platform-spi-des.md) + - [UART](driver-platform-uart-des.md) + - [Watchdog](driver-platform-watchdog-des.md) + - [MIPI DSI](driver-platform-mipidsi-des.md) +- [Peripherals](driver-peripherals.md) + - [LCD](driver-peripherals-lcd-des.md) + - [TOUCHSCREEN](driver-peripherals-touch-des.md) + - [Sensor](driver-peripherals-sensor-des.md) + - [WLAN](driver-peripherals-external-des.md) \ No newline at end of file diff --git a/en/device-dev/driver/drive-hdf.md b/en/device-dev/driver/drive-hdf.md deleted file mode 100644 index 488b6c1760..0000000000 --- a/en/device-dev/driver/drive-hdf.md +++ /dev/null @@ -1,15 +0,0 @@ -# HDF - -- **[HDF Overview](drive-hdf-overview.md)** - -- **[Driver Development](drive-hdf-development.md)** - -- **[Driver Service Management](drive-hdf-servicemanage.md)** - -- **[Driver Message Mechanism Management](drive-hdf-news.md)** - -- **[Driver Configuration Management](drive-hdf-manage.md)** - -- **[HDF Development Example](drive-hdf-sample.md)** - - diff --git a/en/device-dev/driver/drive-peripherals.md b/en/device-dev/driver/drive-peripherals.md deleted file mode 100644 index 074c08226b..0000000000 --- a/en/device-dev/driver/drive-peripherals.md +++ /dev/null @@ -1,11 +0,0 @@ -# Peripherals - -- **[LCD](drive-peripherals-lcd-des.md)** - -- **[TOUCHSCREEN](drive-peripherals-touch-des.md)** - -- **[Sensor](drive-peripherals-sensor-des.md)** - -- **[WLAN](drive-peripherals-external-des.md)** - - diff --git a/en/device-dev/driver/drive-platform.md b/en/device-dev/driver/drive-platform.md deleted file mode 100644 index 98ac4fa190..0000000000 --- a/en/device-dev/driver/drive-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -# Platform Drivers - -- **[GPIO](drive-platform-gpio-des.md)** - -- **[I2C](drive-platform-i2c-des.md)** - -- **[RTC](drive-platform-rtc-des.md)** - -- **[SDIO](drive-platform-sdio-des.md)** - -- **[SPI](drive-platform-spi-des.md)** - -- **[UART](drive-platform-uart-des.md)** - -- **[Watchdog](drive-platform-watchdog-des.md)** - -- **[MIPI DSI](drive-platform-mipidsi-des.md)** - - diff --git a/en/device-dev/driver/drive.md b/en/device-dev/driver/drive.md deleted file mode 100644 index b448704264..0000000000 --- a/en/device-dev/driver/drive.md +++ /dev/null @@ -1,9 +0,0 @@ -# Driver Usage Guidelines - -- **[HDF](drive-hdf.md)** - -- **[Platform Drivers](drive-platform.md)** - -- **[Peripherals](drive-peripherals.md)** - - diff --git a/en/device-dev/driver/drive-hdf-development.md b/en/device-dev/driver/driver-hdf-development.md similarity index 99% rename from en/device-dev/driver/drive-hdf-development.md rename to en/device-dev/driver/driver-hdf-development.md index 3bff3b0910..7d9e91390c 100644 --- a/en/device-dev/driver/drive-hdf-development.md +++ b/en/device-dev/driver/driver-hdf-development.md @@ -89,7 +89,7 @@ Driver development based on the HDF consists of two parts: driver implementation 3. Configure the driver. - HDF Configuration Source \(HCS\) is the source code that describes the configuration of the HDF. For details about the HCS, see [Driver Configuration Management](drive-hdf-manage.md). + HDF Configuration Source \(HCS\) is the source code that describes the configuration of the HDF. For details about the HCS, see [Driver Configuration Management](driver-hdf-manage.md). The driver configuration consists of the driver device description defined by the HDF and private driver configuration information. diff --git a/en/device-dev/driver/drive-hdf-manage.md b/en/device-dev/driver/driver-hdf-manage.md similarity index 100% rename from en/device-dev/driver/drive-hdf-manage.md rename to en/device-dev/driver/driver-hdf-manage.md diff --git a/en/device-dev/driver/drive-hdf-news.md b/en/device-dev/driver/driver-hdf-news.md similarity index 100% rename from en/device-dev/driver/drive-hdf-news.md rename to en/device-dev/driver/driver-hdf-news.md diff --git a/en/device-dev/driver/drive-hdf-overview.md b/en/device-dev/driver/driver-hdf-overview.md similarity index 100% rename from en/device-dev/driver/drive-hdf-overview.md rename to en/device-dev/driver/driver-hdf-overview.md diff --git a/en/device-dev/driver/drive-hdf-sample.md b/en/device-dev/driver/driver-hdf-sample.md similarity index 100% rename from en/device-dev/driver/drive-hdf-sample.md rename to en/device-dev/driver/driver-hdf-sample.md diff --git a/en/device-dev/driver/drive-hdf-servicemanage.md b/en/device-dev/driver/driver-hdf-servicemanage.md similarity index 100% rename from en/device-dev/driver/drive-hdf-servicemanage.md rename to en/device-dev/driver/driver-hdf-servicemanage.md diff --git a/en/device-dev/driver/driver-hdf.md b/en/device-dev/driver/driver-hdf.md new file mode 100644 index 0000000000..cc7e51c2b5 --- /dev/null +++ b/en/device-dev/driver/driver-hdf.md @@ -0,0 +1,15 @@ +# HDF + +- **[HDF Overview](driver-hdf-overview.md)** + +- **[driverr Development](driver-hdf-development.md)** + +- **[driverr Service Management](driver-hdf-servicemanage.md)** + +- **[driverr Message Mechanism Management](driver-hdf-news.md)** + +- **[driverr Configuration Management](driver-hdf-manage.md)** + +- **[HDF Development Example](driver-hdf-sample.md)** + + diff --git a/en/device-dev/driver/drive-peripherals-external-des.md b/en/device-dev/driver/driver-peripherals-external-des.md similarity index 100% rename from en/device-dev/driver/drive-peripherals-external-des.md rename to en/device-dev/driver/driver-peripherals-external-des.md diff --git a/en/device-dev/driver/drive-peripherals-lcd-des.md b/en/device-dev/driver/driver-peripherals-lcd-des.md similarity index 100% rename from en/device-dev/driver/drive-peripherals-lcd-des.md rename to en/device-dev/driver/driver-peripherals-lcd-des.md diff --git a/en/device-dev/driver/drive-peripherals-sensor-des.md b/en/device-dev/driver/driver-peripherals-sensor-des.md similarity index 99% rename from en/device-dev/driver/drive-peripherals-sensor-des.md rename to en/device-dev/driver/driver-peripherals-sensor-des.md index a787e632d8..5ad5682a94 100644 --- a/en/device-dev/driver/drive-peripherals-sensor-des.md +++ b/en/device-dev/driver/driver-peripherals-sensor-des.md @@ -264,7 +264,7 @@ Regardless of the OS and system on a chip \(SoC\), the sensor driver is develope ## Development Example -This section uses a code example to demonstrate how to load and start the acceleration sensor driver based on the HDF driver model. For details about the mechanism, see [Driver Development](drive-hdf-development.md). This example uses the Bosch BMI160 acceleration sensor that communicates over I2C. +This section uses a code example to demonstrate how to load and start the acceleration sensor driver based on the HDF driver model. For details about the mechanism, see [Driver Development](driver-hdf-development.md). This example uses the Bosch BMI160 acceleration sensor that communicates over I2C. 1. Register the driver entry of the acceleration sensor. @@ -286,7 +286,7 @@ HDF_INIT(g_sensorAccelDevEntry); - Acceleration sensor configuration -The acceleration sensor model uses the HCS as the configuration source code. For details about the HCS configuration fields, see [Driver Configuration Management](drive-hdf-manage.md). +The acceleration sensor model uses the HCS as the configuration source code. For details about the HCS configuration fields, see [Driver Configuration Management](driver-hdf-manage.md). ``` /* HCS configuration of the acceleration sensor device */ diff --git a/en/device-dev/driver/drive-peripherals-touch-des.md b/en/device-dev/driver/driver-peripherals-touch-des.md similarity index 97% rename from en/device-dev/driver/drive-peripherals-touch-des.md rename to en/device-dev/driver/driver-peripherals-touch-des.md index 274355990e..f4bfd35be3 100644 --- a/en/device-dev/driver/drive-peripherals-touch-des.md +++ b/en/device-dev/driver/driver-peripherals-touch-des.md @@ -46,7 +46,7 @@ - **Advantages of developing drivers based on the HDF** - The touchscreen driver is developed based on the [HDF](drive-hdf-development.md) and is implemented via calls to the OSAL and platform APIs, including bus APIs and OS native APIs \(such as memory, lock, thread, and timer\). The OSAL and platform APIs hide the differences of underlying hardware, so that the touchscreen driver can be migrated across platforms and OSs. In this regard, you can develop the touchscreen driver only once but deploy it on multiple devices. + The touchscreen driver is developed based on the [HDF](driver-hdf-development.md) and is implemented via calls to the OSAL and platform APIs, including bus APIs and OS native APIs \(such as memory, lock, thread, and timer\). The OSAL and platform APIs hide the differences of underlying hardware, so that the touchscreen driver can be migrated across platforms and OSs. In this regard, you can develop the touchscreen driver only once but deploy it on multiple devices. ### Available APIs @@ -101,7 +101,7 @@ Regardless of the OS and system on a chip \(SoC\), the input driver is developed 1. Add the touchscreen driver-related descriptions. - Currently, the input driver is developed based on the HDF and is loaded and started by the HDF. Register the driver information, such as whether to load the driver and the loading priority in the configuration file. Then, the HDF starts the registered driver modules one by one. For details about the driver configuration, see [Driver Development](drive-hdf-development.md#section1969312275533). + Currently, the input driver is developed based on the HDF and is loaded and started by the HDF. Register the driver information, such as whether to load the driver and the loading priority in the configuration file. Then, the HDF starts the registered driver modules one by one. For details about the driver configuration, see [Driver Development](driver-hdf-development.md#section1969312275533). 2. Complete the board-level configuration and private data configuration of the touchscreen. @@ -118,7 +118,7 @@ This example describes how to develop the touchscreen driver. ### Add the touchscreen driver-related descriptions. -The information about modules of the input driver model is shown as follows and enables the HDF to load the modules in sequence. For details, see [Driver Development](drive-hdf-development.md). +The information about modules of the input driver model is shown as follows and enables the HDF to load the modules in sequence. For details, see [Driver Development](driver-hdf-development.md). ``` input :: host { diff --git a/en/device-dev/driver/driver-peripherals.md b/en/device-dev/driver/driver-peripherals.md new file mode 100644 index 0000000000..02e7a9e357 --- /dev/null +++ b/en/device-dev/driver/driver-peripherals.md @@ -0,0 +1,11 @@ +# Peripherals + +- **[LCD](driver-peripherals-lcd-des.md)** + +- **[TOUCHSCREEN](driver-peripherals-touch-des.md)** + +- **[Sensor](driver-peripherals-sensor-des.md)** + +- **[WLAN](driver-peripherals-external-des.md)** + + diff --git a/en/device-dev/driver/drive-platform-gpio-des.md b/en/device-dev/driver/driver-platform-gpio-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-gpio-des.md rename to en/device-dev/driver/driver-platform-gpio-des.md diff --git a/en/device-dev/driver/drive-platform-i2c-des.md b/en/device-dev/driver/driver-platform-i2c-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-i2c-des.md rename to en/device-dev/driver/driver-platform-i2c-des.md diff --git a/en/device-dev/driver/drive-platform-mipidsi-des.md b/en/device-dev/driver/driver-platform-mipidsi-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-mipidsi-des.md rename to en/device-dev/driver/driver-platform-mipidsi-des.md diff --git a/en/device-dev/driver/drive-platform-rtc-des.md b/en/device-dev/driver/driver-platform-rtc-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-rtc-des.md rename to en/device-dev/driver/driver-platform-rtc-des.md diff --git a/en/device-dev/driver/drive-platform-sdio-des.md b/en/device-dev/driver/driver-platform-sdio-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-sdio-des.md rename to en/device-dev/driver/driver-platform-sdio-des.md diff --git a/en/device-dev/driver/drive-platform-spi-des.md b/en/device-dev/driver/driver-platform-spi-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-spi-des.md rename to en/device-dev/driver/driver-platform-spi-des.md diff --git a/en/device-dev/driver/drive-platform-uart-des.md b/en/device-dev/driver/driver-platform-uart-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-uart-des.md rename to en/device-dev/driver/driver-platform-uart-des.md diff --git a/en/device-dev/driver/drive-platform-watchdog-des.md b/en/device-dev/driver/driver-platform-watchdog-des.md similarity index 100% rename from en/device-dev/driver/drive-platform-watchdog-des.md rename to en/device-dev/driver/driver-platform-watchdog-des.md diff --git a/en/device-dev/driver/driver-platform.md b/en/device-dev/driver/driver-platform.md new file mode 100644 index 0000000000..c15f954770 --- /dev/null +++ b/en/device-dev/driver/driver-platform.md @@ -0,0 +1,19 @@ +# Platform drivers + +- **[GPIO](driver-platform-gpio-des.md)** + +- **[I2C](driver-platform-i2c-des.md)** + +- **[RTC](driver-platform-rtc-des.md)** + +- **[SDIO](driver-platform-sdio-des.md)** + +- **[SPI](driver-platform-spi-des.md)** + +- **[UART](driver-platform-uart-des.md)** + +- **[Watchdog](driver-platform-watchdog-des.md)** + +- **[MIPI DSI](driver-platform-mipidsi-des.md)** + + diff --git a/en/device-dev/driver/driver.md b/en/device-dev/driver/driver.md new file mode 100644 index 0000000000..a046ce6e68 --- /dev/null +++ b/en/device-dev/driver/driver.md @@ -0,0 +1,9 @@ +# Driver Usage Guidelines + +- **[HDF](driver-hdf.md)** + +- **[Platform Drivers](driver-platform.md)** + +- **[Peripherals](driver-peripherals.md)** + + diff --git a/en/device-dev/guide/Readme-EN.md b/en/device-dev/guide/Readme-EN.md index f5cbdaea83..ca124ea327 100644 --- a/en/device-dev/guide/Readme-EN.md +++ b/en/device-dev/guide/Readme-EN.md @@ -28,5 +28,5 @@ - [Running on the Device](device-camera-visual-run.md) - [FAQs](device-camera-visual-faqs.md) - [Development Guidelines on Clock Apps](oem_device_clockapp_des.md) -- [Development Example for Platform Drivers](device-drive-demo.md) -- [Development Example for Peripheral Drivers](device-outerdrive-demo.md) \ No newline at end of file +- [Development Example for Platform Drivers](device-driver-demo.md) +- [Development Example for Peripheral Drivers](device-outerdriver-demo.md) \ No newline at end of file diff --git a/en/device-dev/guide/device-drive-demo.md b/en/device-dev/guide/device-driver-demo.md similarity index 98% rename from en/device-dev/guide/device-drive-demo.md rename to en/device-dev/guide/device-driver-demo.md index 7abded8c93..9415d53230 100644 --- a/en/device-dev/guide/device-drive-demo.md +++ b/en/device-dev/guide/device-driver-demo.md @@ -161,7 +161,7 @@ Configure the **device\_info.hcs** file and obtain and parse device configurat 2. \(Optional\) Add configuration parameters. - The driver may require private configuration information to ensure that the register configuration meets the requirements of different products. If private configuration data is required, you can add a driver configuration file to store some default configuration information about the driver. When loading the driver, the HDF obtains the specified configuration information, saves it in the **property** attribute of **HdfDeviceObject**, and passes it to the driver via **Bind** and **Init**. For details about how to use **Bind** and **Init**, see [Driver Development](../driver/drive-hdf-development.md). You can create a configuration file and reference it in the **hdf.hcs** file of the board-level driver. In this example, configuration parameters are directly added to the existing configuration file **i2c\_config.hcs**. + The driver may require private configuration information to ensure that the register configuration meets the requirements of different products. If private configuration data is required, you can add a driver configuration file to store some default configuration information about the driver. When loading the driver, the HDF obtains the specified configuration information, saves it in the **property** attribute of **HdfDeviceObject**, and passes it to the driver via **Bind** and **Init**. For details about how to use **Bind** and **Init**, see [Driver Development](../driver/driver-hdf-development.md). You can create a configuration file and reference it in the **hdf.hcs** file of the board-level driver. In this example, configuration parameters are directly added to the existing configuration file **i2c\_config.hcs**. The following configuration parameters are added to the **i2c\_config.hcs** file: diff --git a/en/device-dev/guide/device-outerdrive-demo.md b/en/device-dev/guide/device-outerdriver-demo.md similarity index 99% rename from en/device-dev/guide/device-outerdrive-demo.md rename to en/device-dev/guide/device-outerdriver-demo.md index 06e6ef8f47..6ac02acd64 100644 --- a/en/device-dev/guide/device-outerdrive-demo.md +++ b/en/device-dev/guide/device-outerdriver-demo.md @@ -61,7 +61,7 @@ You can configure the device driver description in the configuration file at ** The **device\_info.hcs** file contains all necessary information for registering drivers in the input driver model with the HDF. You do not need to make any modification for the information unless otherwise required in special scenarios. The private configuration data of each driver uses the **deviceMatchAttr** field to match the **match\_attr** field in the **input\_config.hcs** file. -The input-related fields in the configuration file are as follows. For details about these fields, see [Driver Development](../driver/drive-hdf-development.md). +The input-related fields in the configuration file are as follows. For details about these fields, see [Driver Development](../driver/driver-hdf-development.md). ``` input :: host { diff --git a/en/device-dev/guide/device.md b/en/device-dev/guide/device.md index 80fbb7796e..bbce9d52a9 100644 --- a/en/device-dev/guide/device.md +++ b/en/device-dev/guide/device.md @@ -8,8 +8,8 @@ - **[Development Guidelines on Clock Apps](oem_device_clockapp_des.md)** -- **[Development Example for Platform Drivers](device-drive-demo.md)** +- **[Development Example for Platform Drivers](device-driver-demo.md)** -- **[Development Example for Peripheral Drivers](device-outerdrive-demo.md)** +- **[Development Example for Peripheral Drivers](device-outerdriver-demo.md)** diff --git a/en/device-dev/overview.md b/en/device-dev/overview.md index 388d13e000..d8e511406e 100644 --- a/en/device-dev/overview.md +++ b/en/device-dev/overview.md @@ -146,7 +146,7 @@ In addition, OpenHarmony provides a series of optional system components that ca

Developing smart devices based on system capabilities

- +

Porting and adaptation

diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index e25ab80a3c..0b5b089be5 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -39,10 +39,10 @@ - [KWS SDK](subsys-aiframework-demo-sdk.md) - [KWS Plug-in](subsys-aiframework-demo-plugin.md) - [KWS Configuration File](subsys-aiframework-demo-conf.md) -- [Sensors](subsys-densor.md) - - [Sensors Overview](subsys-densor-overview.md) - - [Sensors Usage Guidelines](subsys-densor-guide.md) - - [Sensors Usage Example](subsys-densor-demo.md) +- [Sensors](subsys-sensor.md) + - [Sensors Overview](subsys-sensor-overview.md) + - [Sensors Usage Guidelines](subsys-sensor-guide.md) + - [Sensors Usage Example](subsys-sensor-demo.md) - [Application Framework](subsys-application-framework.md) - [Overview](subsys-application-framework-overview.md) - [Setting Up a Development Environment](subsys-application-framework-builden.md) diff --git a/en/device-dev/subsystems/subsys-densor.md b/en/device-dev/subsystems/subsys-densor.md deleted file mode 100644 index 590bc4c966..0000000000 --- a/en/device-dev/subsystems/subsys-densor.md +++ /dev/null @@ -1,9 +0,0 @@ -# Sensors - -- **[Sensors Overview](subsys-densor-overview.md)** - -- **[Sensors Usage Guidelines](subsys-densor-guide.md)** - -- **[Sensors Usage Example](subsys-densor-demo.md)** - - diff --git a/en/device-dev/subsystems/subsys-densor-demo.md b/en/device-dev/subsystems/subsys-sensor-demo.md similarity index 100% rename from en/device-dev/subsystems/subsys-densor-demo.md rename to en/device-dev/subsystems/subsys-sensor-demo.md diff --git a/en/device-dev/subsystems/subsys-densor-guide.md b/en/device-dev/subsystems/subsys-sensor-guide.md similarity index 100% rename from en/device-dev/subsystems/subsys-densor-guide.md rename to en/device-dev/subsystems/subsys-sensor-guide.md diff --git a/en/device-dev/subsystems/subsys-densor-overview.md b/en/device-dev/subsystems/subsys-sensor-overview.md similarity index 100% rename from en/device-dev/subsystems/subsys-densor-overview.md rename to en/device-dev/subsystems/subsys-sensor-overview.md diff --git a/en/device-dev/subsystems/subsys-sensor.md b/en/device-dev/subsystems/subsys-sensor.md new file mode 100644 index 0000000000..937d03221f --- /dev/null +++ b/en/device-dev/subsystems/subsys-sensor.md @@ -0,0 +1,9 @@ +# Sensors + +- **[Sensors Overview](subsys-sensor-overview.md)** + +- **[Sensors Usage Guidelines](subsys-sensor-guide.md)** + +- **[Sensors Usage Example](subsys-sensor-demo.md)** + + diff --git a/en/device-dev/subsystems/subsys.md b/en/device-dev/subsystems/subsys.md index 64d3b35c40..9d1d0bdfb4 100644 --- a/en/device-dev/subsystems/subsys.md +++ b/en/device-dev/subsystems/subsys.md @@ -12,7 +12,7 @@ - **[AI Framework](subsys-aiframework.md)** -- **[Sensors](subsys-densor.md)** +- **[Sensors](subsys-sensor.md)** - **[Application Framework](subsys-application-framework.md)** diff --git a/en/readme.md b/en/readme.md index 8325d965b2..4931059a15 100644 --- a/en/readme.md +++ b/en/readme.md @@ -42,8 +42,8 @@ This project stores OpenHarmony documentation, including the quick start guide, - **guide**: - [Clock apps](device-dev/guide/oem_device_clockapp_des.md) - - [Platform drivers](device-dev/guide/device-drive-demo.md) - - [Peripheral drivers](device-dev/guide/device-outerdrive-demo.md) + - [Platform drivers](device-dev/guide/device-driver-demo.md) + - [Peripheral drivers](device-dev/guide/device-outerdriver-demo.md) - **porting**: diff --git a/zh-cn/device-dev/driver/Readme-CN.md b/zh-cn/device-dev/driver/Readme-CN.md index 39991f33ca..6651085f35 100755 --- a/zh-cn/device-dev/driver/Readme-CN.md +++ b/zh-cn/device-dev/driver/Readme-CN.md @@ -1,24 +1,24 @@ # 驱动使用指南 -- [HDF驱动框架](drive.md) - - [HDF开发概述](drive-hdf-overview.md) - - [驱动开发](drive-hdf-development.md) - - [驱动服务管理](drive-hdf-servicemanage.md) - - [驱动消息机制管理](drive-hdf-news.md) - - [配置管理](drive-hdf-manage.md) - - [HDF开发实例](drive-hdf-sample.md) -- [平台驱动](drive-platform.md) - - [GPIO](drive-platform-gpio-des.md) - - [I2C](drive-platform-i2c-des.md) - - [RTC](drive-platform-rtc-des.md) - - [SDIO](drive-platform-sdio-des.md) - - [SPI](drive-platform-spi-des.md) - - [UART](drive-platform-uart-des.md) - - [WATCHDOG](drive-platform-watchdog-des.md) - - [MIPI DSI](drive-platform-mipidsi-des.md) -- [外设](drive-peripherals.md) - - [LCD](drive-peripherals-lcd-des.md) - - [TOUCHSCREEN](drive-peripherals-touch-des.md) - - [SENSOR](drive-peripherals-sensor-des.md) - - [WLAN](drive-peripherals-external-des.md) +- [HDF驱动框架](driver.md) + - [HDF开发概述](driver-hdf-overview.md) + - [驱动开发](driver-hdf-development.md) + - [驱动服务管理](driver-hdf-servicemanage.md) + - [驱动消息机制管理](driver-hdf-news.md) + - [配置管理](driver-hdf-manage.md) + - [HDF开发实例](driver-hdf-sample.md) +- [平台驱动](driver-platform.md) + - [GPIO](driver-platform-gpio-des.md) + - [I2C](driver-platform-i2c-des.md) + - [RTC](driver-platform-rtc-des.md) + - [SDIO](driver-platform-sdio-des.md) + - [SPI](driver-platform-spi-des.md) + - [UART](driver-platform-uart-des.md) + - [WATCHDOG](driver-platform-watchdog-des.md) + - [MIPI DSI](driver-platform-mipidsi-des.md) +- [外设](driver-peripherals.md) + - [LCD](driver-peripherals-lcd-des.md) + - [TOUCHSCREEN](driver-peripherals-touch-des.md) + - [SENSOR](driver-peripherals-sensor-des.md) + - [WLAN](driver-peripherals-external-des.md) diff --git a/zh-cn/device-dev/driver/drive-peripherals.md b/zh-cn/device-dev/driver/drive-peripherals.md deleted file mode 100644 index 176fb421cd..0000000000 --- a/zh-cn/device-dev/driver/drive-peripherals.md +++ /dev/null @@ -1,11 +0,0 @@ -# 外设 - -- **[LCD](drive-peripherals-lcd-des.md)** - -- **[TOUCHSCREEN](drive-peripherals-touch-des.md)** - -- **[SENSOR](drive-peripherals-sensor-des.md)** - -- **[WLAN](drive-peripherals-external-des.md)** - - diff --git a/zh-cn/device-dev/driver/drive-platform.md b/zh-cn/device-dev/driver/drive-platform.md deleted file mode 100644 index 6fd91defa4..0000000000 --- a/zh-cn/device-dev/driver/drive-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -# 平台驱动 - -- **[GPIO](drive-platform-gpio-des.md)** - -- **[I2C](drive-platform-i2c-des.md)** - -- **[RTC](drive-platform-rtc-des.md)** - -- **[SDIO](drive-platform-sdio-des.md)** - -- **[SPI](drive-platform-spi-des.md)** - -- **[UART](drive-platform-uart-des.md)** - -- **[WATCHDOG](drive-platform-watchdog-des.md)** - -- **[MIPI DSI](drive-platform-mipidsi-des.md)** - - diff --git a/zh-cn/device-dev/driver/drive.md b/zh-cn/device-dev/driver/drive.md deleted file mode 100644 index 0e8e677c95..0000000000 --- a/zh-cn/device-dev/driver/drive.md +++ /dev/null @@ -1,19 +0,0 @@ -# 驱动使用指南 - -- **[HDF开发概述](drive-hdf-overview.md)** - -- **[驱动开发](drive-hdf-development.md)** - -- **[驱动服务管理](drive-hdf-servicemanage.md)** - -- **[驱动消息机制管理](drive-hdf-news.md)** - -- **[配置管理](drive-hdf-manage.md)** - -- **[HDF开发实例](drive-hdf-sample.md)** - -- **[平台驱动](drive-platform.md)** - -- **[外设](drive-peripherals.md)** - - diff --git a/zh-cn/device-dev/driver/drive-hdf-development.md b/zh-cn/device-dev/driver/driver-hdf-development.md similarity index 98% rename from zh-cn/device-dev/driver/drive-hdf-development.md rename to zh-cn/device-dev/driver/driver-hdf-development.md index b01173490a..492abc6c66 100644 --- a/zh-cn/device-dev/driver/drive-hdf-development.md +++ b/zh-cn/device-dev/driver/driver-hdf-development.md @@ -89,7 +89,7 @@ HDF框架以组件化的驱动模型作为核心设计思路,为开发者提 3. 驱动配置 - HDF使用HCS作为配置描述源码,HCS详细介绍参考[配置管理](drive-hdf-manage.md)介绍。 + HDF使用HCS作为配置描述源码,HCS详细介绍参考[配置管理](driver-hdf-manage.md)介绍。 驱动配置包含两部分,HDF框架定义的驱动设备描述和驱动的私有配置信息,具体写法如下: @@ -169,7 +169,7 @@ HDF框架以组件化的驱动模型作为核心设计思路,为开发者提 > DEVICE_PRELOAD_INVALID > } DevicePreload; > ``` -> 配置文件中preload 字段配成 0 (DEVICE\_PRELOAD\_ENABLE ),则系统启动过程中默认加载;配成1(DEVICE\_PRELOAD\_ENABLE\_STEP2),当系统支持快启的时候,则在系统系统完成之后再加载这一类驱动,否则和DEVICE\_PRELOAD\_ENABLE 含义相同;配成2(DEVICE\_PRELOAD\_DISABLE),则系统启动过程中默认不加载,支持后续动态加载,当用户态获取驱动服务(参考[消息机制](drive-hdf-news.md))时,如果驱动服务不存在时,HDF框架会尝试动态加载该驱动。 +> 配置文件中preload 字段配成 0 (DEVICE\_PRELOAD\_ENABLE ),则系统启动过程中默认加载;配成1(DEVICE\_PRELOAD\_ENABLE\_STEP2),当系统支持快启的时候,则在系统系统完成之后再加载这一类驱动,否则和DEVICE\_PRELOAD\_ENABLE 含义相同;配成2(DEVICE\_PRELOAD\_DISABLE),则系统启动过程中默认不加载,支持后续动态加载,当用户态获取驱动服务(参考[消息机制](driver-hdf-news.md))时,如果驱动服务不存在时,HDF框架会尝试动态加载该驱动。 >- 按序加载(需要驱动为默认加载) > 配置文件中的priority(取值范围为整数0到200)是用来表示host和驱动的优先级,不同的host内的驱动,host的priority值越小,驱动加载优先级越高;同一个host内驱动的priority值越小,加载优先级越高。 diff --git a/zh-cn/device-dev/driver/drive-hdf-manage.md b/zh-cn/device-dev/driver/driver-hdf-manage.md similarity index 100% rename from zh-cn/device-dev/driver/drive-hdf-manage.md rename to zh-cn/device-dev/driver/driver-hdf-manage.md diff --git a/zh-cn/device-dev/driver/drive-hdf-news.md b/zh-cn/device-dev/driver/driver-hdf-news.md similarity index 98% rename from zh-cn/device-dev/driver/drive-hdf-news.md rename to zh-cn/device-dev/driver/driver-hdf-news.md index d57a99d58b..a956303a57 100644 --- a/zh-cn/device-dev/driver/drive-hdf-news.md +++ b/zh-cn/device-dev/driver/driver-hdf-news.md @@ -49,7 +49,7 @@ ## 开发步骤 -1. 将驱动配置信息中服务策略policy字段设置为2(SERVICE\_POLICY\_CAPACITY,参考[policy定义](drive-hdf-servicemanage.md))。 +1. 将驱动配置信息中服务策略policy字段设置为2(SERVICE\_POLICY\_CAPACITY,参考[policy定义](driver-hdf-servicemanage.md))。 ``` device_sample :: Device { diff --git a/zh-cn/device-dev/driver/drive-hdf-overview.md b/zh-cn/device-dev/driver/driver-hdf-overview.md similarity index 100% rename from zh-cn/device-dev/driver/drive-hdf-overview.md rename to zh-cn/device-dev/driver/driver-hdf-overview.md diff --git a/zh-cn/device-dev/driver/drive-hdf-sample.md b/zh-cn/device-dev/driver/driver-hdf-sample.md similarity index 100% rename from zh-cn/device-dev/driver/drive-hdf-sample.md rename to zh-cn/device-dev/driver/driver-hdf-sample.md diff --git a/zh-cn/device-dev/driver/drive-hdf-servicemanage.md b/zh-cn/device-dev/driver/driver-hdf-servicemanage.md similarity index 100% rename from zh-cn/device-dev/driver/drive-hdf-servicemanage.md rename to zh-cn/device-dev/driver/driver-hdf-servicemanage.md diff --git a/zh-cn/device-dev/driver/drive-peripherals-external-des.md b/zh-cn/device-dev/driver/driver-peripherals-external-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-peripherals-external-des.md rename to zh-cn/device-dev/driver/driver-peripherals-external-des.md diff --git a/zh-cn/device-dev/driver/drive-peripherals-lcd-des.md b/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md similarity index 97% rename from zh-cn/device-dev/driver/drive-peripherals-lcd-des.md rename to zh-cn/device-dev/driver/driver-peripherals-lcd-des.md index 1e195e52db..90f54e12fb 100644 --- a/zh-cn/device-dev/driver/drive-peripherals-lcd-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md @@ -10,7 +10,7 @@ ## 概述 -LCD(Liquid Crystal Display)液晶显示驱动,对LCD进行上电,并通过接口初始化LCD内部寄存器,使LCD正常工作。Display驱动模型基于HDF( Hardware Driver Foundation)[驱动框架](drive-hdf-overview.md)开发,实现跨OS、跨平台,为LCD硬件提供上下电功能、发送初始化序列功能,使LCD进入正常的工作模式,显示芯片平台侧的图像数据,基于HDF驱动框架的Display驱动模型如[图1](#fig69138814229)。 +LCD(Liquid Crystal Display)液晶显示驱动,对LCD进行上电,并通过接口初始化LCD内部寄存器,使LCD正常工作。Display驱动模型基于HDF( Hardware Driver Foundation)[驱动框架](driver-hdf-overview.md)开发,实现跨OS、跨平台,为LCD硬件提供上下电功能、发送初始化序列功能,使LCD进入正常的工作模式,显示芯片平台侧的图像数据,基于HDF驱动框架的Display驱动模型如[图1](#fig69138814229)。 **图 1** 基于HDF驱动框架的Display驱动模型 ![](figure/基于HDF驱动框架的Display驱动模型.png "基于HDF驱动框架的Display驱动模型") diff --git a/zh-cn/device-dev/driver/drive-peripherals-sensor-des.md b/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md similarity index 99% rename from zh-cn/device-dev/driver/drive-peripherals-sensor-des.md rename to zh-cn/device-dev/driver/driver-peripherals-sensor-des.md index b471e33124..a548abe552 100644 --- a/zh-cn/device-dev/driver/drive-peripherals-sensor-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md @@ -264,7 +264,7 @@ Sensor驱动是基于HDF框架、PLATFORM和OSAL基础接口进行开发,不 ## 开发实例 -基于HDF驱动模型,加载启动加速度计传感器驱动,代码形式如下,具体原理可参考[HDF驱动开发指南](drive-hdf-development.md)。加速度传感器选择通讯接口方式为I2C,厂家选择博世BMI160加速度传感器。 +基于HDF驱动模型,加载启动加速度计传感器驱动,代码形式如下,具体原理可参考[HDF驱动开发指南](driver-hdf-development.md)。加速度传感器选择通讯接口方式为I2C,厂家选择博世BMI160加速度传感器。 1. 加速度计传感器驱动入口注册 @@ -286,7 +286,7 @@ HDF_INIT(g_sensorAccelDevEntry); - 加速度计传感器设备配置描述 -加速度传感器模型使用HCS作为配置描述源码,HCS配置字段详细介绍参考[配置管理](drive-hdf-manage.md)介绍。 +加速度传感器模型使用HCS作为配置描述源码,HCS配置字段详细介绍参考[配置管理](driver-hdf-manage.md)介绍。 ``` /* 加速度计传感器设备HCS配置 */ diff --git a/zh-cn/device-dev/driver/drive-peripherals-touch-des.md b/zh-cn/device-dev/driver/driver-peripherals-touch-des.md similarity index 96% rename from zh-cn/device-dev/driver/drive-peripherals-touch-des.md rename to zh-cn/device-dev/driver/driver-peripherals-touch-des.md index 107b2ce618..5f4c46ba8b 100644 --- a/zh-cn/device-dev/driver/drive-peripherals-touch-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-touch-des.md @@ -46,7 +46,7 @@ - **基于HDF驱动框架开发器件驱动的优势** - 在HDF(Hardware Driver Foundation)[驱动管理框架](drive-hdf-development.md)的基础上,input驱动模型调用OSAL接口层和Platfom接口层提供的基础接口进行开发,包括bus通信接口、操作系统原生接口(memory、lock、thread、timer等)。由于OSAL接口和Platform接口屏蔽了芯片平台差异,所以基于input驱动模型实现的touchscreen驱动可以进行跨平台、跨OS迁移,以便逐步实现驱动的一次开发,多端部署。 + 在HDF(Hardware Driver Foundation)[驱动管理框架](driver-hdf-development.md)的基础上,input驱动模型调用OSAL接口层和Platfom接口层提供的基础接口进行开发,包括bus通信接口、操作系统原生接口(memory、lock、thread、timer等)。由于OSAL接口和Platform接口屏蔽了芯片平台差异,所以基于input驱动模型实现的touchscreen驱动可以进行跨平台、跨OS迁移,以便逐步实现驱动的一次开发,多端部署。 ### 接口说明 @@ -101,7 +101,7 @@ Input驱动模型是基于HDF框架、Platform接口和OSAL接口开发,不区 1. 设备描述配置 - 目前Input驱动基于HDF驱动框架编写,驱动的加载启动由HDF驱动管理框架统一处理。首先需要在对应的配置文件中,将驱动信息注册进去,如是否加载、加载优先级,此后HDF驱动框架会逐一启动注册过的驱动模块。驱动的相关配置请参考[HDF驱动框架配置指导](drive-hdf-development.md#section1969312275533)。 + 目前Input驱动基于HDF驱动框架编写,驱动的加载启动由HDF驱动管理框架统一处理。首先需要在对应的配置文件中,将驱动信息注册进去,如是否加载、加载优先级,此后HDF驱动框架会逐一启动注册过的驱动模块。驱动的相关配置请参考[HDF驱动框架配置指导](driver-hdf-development.md#section1969312275533)。 2. 板级配置及Touchscreen器件私有配置 @@ -118,7 +118,7 @@ Input驱动模型是基于HDF框架、Platform接口和OSAL接口开发,不区 ### 设备描述配置 -如下配置主要包含input驱动模型各模块层级信息,具体原理可参考[HDF驱动开发指南](drive-hdf-development.md),HDF框架依据该配置信息实现对Input模型各模块的依次加载等。 +如下配置主要包含input驱动模型各模块层级信息,具体原理可参考[HDF驱动开发指南](driver-hdf-development.md),HDF框架依据该配置信息实现对Input模型各模块的依次加载等。 ``` input :: host { diff --git a/zh-cn/device-dev/driver/driver-peripherals.md b/zh-cn/device-dev/driver/driver-peripherals.md new file mode 100644 index 0000000000..12db978ab6 --- /dev/null +++ b/zh-cn/device-dev/driver/driver-peripherals.md @@ -0,0 +1,11 @@ +# 外设 + +- **[LCD](driver-peripherals-lcd-des.md)** + +- **[TOUCHSCREEN](driver-peripherals-touch-des.md)** + +- **[SENSOR](driver-peripherals-sensor-des.md)** + +- **[WLAN](driver-peripherals-external-des.md)** + + diff --git a/zh-cn/device-dev/driver/drive-platform-gpio-des.md b/zh-cn/device-dev/driver/driver-platform-gpio-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-gpio-des.md rename to zh-cn/device-dev/driver/driver-platform-gpio-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-i2c-des.md b/zh-cn/device-dev/driver/driver-platform-i2c-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-i2c-des.md rename to zh-cn/device-dev/driver/driver-platform-i2c-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-mipidsi-des.md b/zh-cn/device-dev/driver/driver-platform-mipidsi-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-mipidsi-des.md rename to zh-cn/device-dev/driver/driver-platform-mipidsi-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-rtc-des.md b/zh-cn/device-dev/driver/driver-platform-rtc-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-rtc-des.md rename to zh-cn/device-dev/driver/driver-platform-rtc-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-sdio-des.md b/zh-cn/device-dev/driver/driver-platform-sdio-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-sdio-des.md rename to zh-cn/device-dev/driver/driver-platform-sdio-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-spi-des.md b/zh-cn/device-dev/driver/driver-platform-spi-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-spi-des.md rename to zh-cn/device-dev/driver/driver-platform-spi-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-uart-des.md b/zh-cn/device-dev/driver/driver-platform-uart-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-uart-des.md rename to zh-cn/device-dev/driver/driver-platform-uart-des.md diff --git a/zh-cn/device-dev/driver/drive-platform-watchdog-des.md b/zh-cn/device-dev/driver/driver-platform-watchdog-des.md similarity index 100% rename from zh-cn/device-dev/driver/drive-platform-watchdog-des.md rename to zh-cn/device-dev/driver/driver-platform-watchdog-des.md diff --git a/zh-cn/device-dev/driver/driver-platform.md b/zh-cn/device-dev/driver/driver-platform.md new file mode 100644 index 0000000000..a05dec1767 --- /dev/null +++ b/zh-cn/device-dev/driver/driver-platform.md @@ -0,0 +1,19 @@ +# 平台驱动 + +- **[GPIO](driver-platform-gpio-des.md)** + +- **[I2C](driver-platform-i2c-des.md)** + +- **[RTC](driver-platform-rtc-des.md)** + +- **[SDIO](driver-platform-sdio-des.md)** + +- **[SPI](driver-platform-spi-des.md)** + +- **[UART](driver-platform-uart-des.md)** + +- **[WATCHDOG](driver-platform-watchdog-des.md)** + +- **[MIPI DSI](driver-platform-mipidsi-des.md)** + + diff --git a/zh-cn/device-dev/driver/driver.md b/zh-cn/device-dev/driver/driver.md new file mode 100644 index 0000000000..a0825c12d1 --- /dev/null +++ b/zh-cn/device-dev/driver/driver.md @@ -0,0 +1,19 @@ +# 驱动使用指南 + +- **[HDF开发概述](driver-hdf-overview.md)** + +- **[驱动开发](driver-hdf-development.md)** + +- **[驱动服务管理](driver-hdf-servicemanage.md)** + +- **[驱动消息机制管理](driver-hdf-news.md)** + +- **[配置管理](driver-hdf-manage.md)** + +- **[HDF开发实例](driver-hdf-sample.md)** + +- **[平台驱动](driver-platform.md)** + +- **[外设](driver-peripherals.md)** + + diff --git a/zh-cn/device-dev/guide/Readme-CN.md b/zh-cn/device-dev/guide/Readme-CN.md index b447b4990a..aa2470b29a 100755 --- a/zh-cn/device-dev/guide/Readme-CN.md +++ b/zh-cn/device-dev/guide/Readme-CN.md @@ -33,7 +33,7 @@ - [常见问题](device-camera-visual-faqs.md) - [时钟应用开发指导](device-clock-guide.md) -- [平台驱动开发示例](device-drive-demo.md) -- [外设驱动开发示例](device-outerdrive-demo.md) +- [平台驱动开发示例](device-driver-demo.md) +- [外设驱动开发示例](device-outerdriver-demo.md) diff --git a/zh-cn/device-dev/guide/device-drive-demo.md b/zh-cn/device-dev/guide/device-driver-demo.md similarity index 98% rename from zh-cn/device-dev/guide/device-drive-demo.md rename to zh-cn/device-dev/guide/device-driver-demo.md index bb103f846c..73e75ffda8 100644 --- a/zh-cn/device-dev/guide/device-drive-demo.md +++ b/zh-cn/device-dev/guide/device-driver-demo.md @@ -161,7 +161,7 @@ HDF_INIT(g_sampleI2cDriverEntry); 2. 添加配置参数(可选)。 - 有时驱动可能会需要私有配置信息,以确保寄存器的配置可以满足不同产品的需求。如需要私有配置信息,则可以添加一个驱动的配置文件,用来存放一些驱动的默认配置信息,HDF框架在加载驱动的时候,会将对应的配置信息获取并保存在HdfDeviceObject 中的property里面,通过Bind和Init(参考[驱动开发](../driver/drive-hdf-development.md))传递给驱动。驱动开发者可新建配置文件,并在板级驱动hdf.hcs中引用新建的配置文件,本例中直接在原有的配置文件i2c\_config.hcs内添加配置参数。 + 有时驱动可能会需要私有配置信息,以确保寄存器的配置可以满足不同产品的需求。如需要私有配置信息,则可以添加一个驱动的配置文件,用来存放一些驱动的默认配置信息,HDF框架在加载驱动的时候,会将对应的配置信息获取并保存在HdfDeviceObject 中的property里面,通过Bind和Init(参考[驱动开发](../driver/driver-hdf-development.md))传递给驱动。驱动开发者可新建配置文件,并在板级驱动hdf.hcs中引用新建的配置文件,本例中直接在原有的配置文件i2c\_config.hcs内添加配置参数。 本例中编辑i2c\_config.hcs,添加配置参数: diff --git a/zh-cn/device-dev/guide/device-outerdrive-demo.md b/zh-cn/device-dev/guide/device-outerdriver-demo.md similarity index 99% rename from zh-cn/device-dev/guide/device-outerdrive-demo.md rename to zh-cn/device-dev/guide/device-outerdriver-demo.md index afeffb7863..9526546a58 100644 --- a/zh-cn/device-dev/guide/device-outerdrive-demo.md +++ b/zh-cn/device-dev/guide/device-outerdriver-demo.md @@ -40,7 +40,7 @@ Input驱动模型核心部分由设备管理层、公共驱动层、器件驱动 此外,Input模型预先实现了数据通道以及设备配置信息解析等函数。 -关于Input模型的详细介绍请参考《[Touchscreen开发概述](../driver/drive-peripherals-touch-des.md#section175431838101617)》。 +关于Input模型的详细介绍请参考《[Touchscreen开发概述](../driver/driver-peripherals-touch-des.md#section175431838101617)》。 ## 环境搭建 @@ -61,7 +61,7 @@ Input驱动模型核心部分由设备管理层、公共驱动层、器件驱动 device\_info.hcs中的信息主要提供给HDF框架使用,包含了Input模型各层驱动注册到HDF框架所必需的信息,开发者无特殊场景需求无需改动。各驱动层私有配置信息通过“deviceMatchAttr”字段与input\_config.hcs中的“match\_attr”相关内容进行匹配。 -配置文件中与input模块相关的内容如下所示,相关字段的详细含义可以参考《[驱动配置](../driver/drive-hdf-development.md)》: +配置文件中与input模块相关的内容如下所示,相关字段的详细含义可以参考《[驱动配置](../driver/driver-hdf-development.md)》: ``` input :: host { diff --git a/zh-cn/device-dev/guide/device.md b/zh-cn/device-dev/guide/device.md index 2c7d789c20..1cb2d60315 100644 --- a/zh-cn/device-dev/guide/device.md +++ b/zh-cn/device-dev/guide/device.md @@ -8,8 +8,8 @@ - **[时钟应用开发指导](device-clock-guide.md)** -- **[平台驱动开发示例](device-drive-demo.md)** +- **[平台驱动开发示例](device-driver-demo.md)** -- **[外设驱动开发示例](device-outerdrive-demo.md)** +- **[外设驱动开发示例](device-outerdriver-demo.md)** diff --git a/zh-cn/device-dev/porting/Readme-CN.md b/zh-cn/device-dev/porting/Readme-CN.md index 6e960a48da..dd73e8cbbf 100755 --- a/zh-cn/device-dev/porting/Readme-CN.md +++ b/zh-cn/device-dev/porting/Readme-CN.md @@ -1,33 +1,28 @@ -# 移植指南 - -- [三方库移植指导](transplant-thirdparty.md) - - [概述](transplant-thirdparty-overview.md) - - [CMake方式组织编译的库移植](transplant-thirdparty-cmake.md) - - [Makefile方式组织编译的库移植](transplant-thirdparty-makefile.md) -- [轻量系统芯片移植指导](transplant-minichip.md) - - [移植准备](transplant-chip-prepare.md) - - [移植须知](transplant-chip-prepare-knows.md) - - [编译构建适配流程](transplant-chip-prepare-process.md) - - [内核移植](transplant-chip-kernel.md) - - [移植概述](transplant-chip-kernel-overview.md) - - [内核基础适配](transplant-chip-kernel-adjustment.md) - - [内核移植验证](transplant-chip-kernel-verify.md) - - [板级系统移植](transplant-chip-board.md) - - [移植概述](transplant-chip-board-overview.md) - - [板级驱动适配](transplant-chip-board-drive.md) - - [HAL层实现](transplant-chip-board-hal.md) - - [系统组件调用](transplant-chip-board-component.md) - - [三方组件适配](transplant-chip-board-bundle.md) - - [XTS认证](transplant-chip-board-xts.md) - - [常见问题](transplant-chip-faqs.md) -- [小型系统芯片移植指导](transplant-smallchip.md) - - [移植准备](transplant-smallchip-prepare.md) - - [移植须知](transplant-smallchip-prepare-needs.md) - - [编译构建](transplant-smallchip-prepare-building.md) - - [移植内核](transplant-smallchip-kernel.md) - - [LiteOS-A内核](transplant-smallchip-kernel-a.md) - - [Linux内核](transplant-smallchip-kernel-linux.md) - - [驱动移植](transplant-smallchip-drive.md) - - [移植概述](transplant-smallchip-drive-des.md) - - [平台驱动移植](transplant-smallchip-drive-plat.md) - - [器件驱动移植](transplant-smallchip-drive-oom.md) \ No newline at end of file + +# 开发板移植 +目前OpenHarmony已经成立了SIG组[sig-devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)。该SIG组以支持更多第三方开发板为目标,提供开发板移植的支撑。 + +在了解开发板移植前,需要先了解一下OpenHarmony对设备的分类。不同设备类型的移植方法会有较大差异。 + +| 设备类型 | 硬件要求 | 支持的内核 | +|---------|-------------|----------------| +| 轻量系统类设备 | 内存>128KB | LiteOS-M | +| 小型系统类设备 | 内存>1MB、有MMU | LiteOS-A、Linux | +| 标准系统类设备 | 内存>128MB | Linux | + +# 1. 代码准备 + +目前OpenHarmony已经为各厂家创建了仓库并在openharmony-sig中进行孵化。参与孵化仓开发,需要使用如下方法初始化和下载代码。 + +```shell +repo init -u https://gitee.com/openharmony-sig/manifest.git -b master -m devboard.xml --no-repo-verify +``` + +其他下载步骤与主线相同。 + +# 2. 开始移植你的开发板 + +- [轻量级系统](transplant-minichip.md) +- [小型系统](transplant-smallchip.md) +- [标准系统](standard_system_porting_guide.md) + diff --git a/zh-cn/device-dev/porting/standard_system_porting_guide.md b/zh-cn/device-dev/porting/standard_system_porting_guide.md new file mode 100644 index 0000000000..f0676596ab --- /dev/null +++ b/zh-cn/device-dev/porting/standard_system_porting_guide.md @@ -0,0 +1,374 @@ +# 标准系统移植指南 + + + + + +- [定义开发板](#定义开发板) + - [1. 定义SOC](#1-定义soc) + - [2. 定义产品](#2-定义产品) + - [3. 移植验证](#3-移植验证) +- [内核移植](#内核移植) + - [1. 为SOC添加内核构建的子系统](#1-为soc添加内核构建的子系统) + - [2. 编译内核](#2-编译内核) + - [3. 移植验证](#3-移植验证-1) +- [HDF驱动移植](#hdf驱动移植) + - [1. LCD](#1-lcd) + - [2. 触摸屏](#2-触摸屏) + - [3. WLAN](#3-wlan) + + + + + +## 定义开发板 + +本文以移植名为MyProduct的开发板为例讲解移植过程,假定MyProduct是MyProductVendor公司的开发板,使用MySoCVendor公司生产的MySOC芯片作为处理器。 + +### 1. 定义SOC + +在`//productdefine/common/device`目录下创建以SOC名字命名的json文件,并指定CPU的架构。 + +如要移植一个叫MySOC的SOC,这个SOC采用32位ARM内核。配置如下: + +`//productdefine/common/device/MySOC.json` +```json +{ + "target_os": "ohos", + "target_cpu": "arm" +} +``` +根据实际情况,这里的target_cpu也可能是arm64 、riscv、 x86等。当前仅支持arm作为target_cpu。 + +### 2. 定义产品 + +在`//productdefine/common/products`目录下创建以产品名命名的json文件。该文件用于描述产品所使用的SOC 以及 所需的子系统。 +配置如下 +`//productdefine/common/products/MyProduct.json` +```json +{ + "product_name": "MyProduct", + "product_company" : "MyProductVendor", + "product_device": "MySOC", + "version": "2.0", + "type": "standard", + "parts":{ + "ace:ace_engine_standard":{}, + "ace:napi":{}, + ... + "xts:phone_tests":{} + } +} + +``` +主要的配置内容包括: + +1. `product_device`:配置所使用的SOC +2. `type`: 配置系统的级别, 这里直接standard即可 +3. `parts`: 系统需要启用的子系统。子系统可以简单理解位一块独立构建的功能块。 + +已定义的子系统可以在`//build/subsystem_config.json`中找到。当然你也可以定制子系统。 + +这里建议先拷贝Hi3516DV300 开发板的配置文件,删除掉 hisilicon_products 这个子系统。这个子系统为Hi3516DV300 SOC编译内核,显然不适合MySOC。 + +### 3. 移植验证 + +至此,你可以使用如下命令,启动你产品的构建了: + +`./build.sh --product-name MyProduct ` + +构建完成后,可以在如下目录看到构建出来的OpenHarmony镜像文件 + +`//out/ohos-arm-release/packages/phone/images` + +## 内核移植 + +这一步需要移植Linux内核,让Linux内核可以成功运行起来。 + +### 1. 为SOC添加内核构建的子系统 + +修改文件 `//build/subsystem_config.json` 增加一个子系统. 配置如下: + +```json + "MySOCVendor_products": { + "project": "hmf/MySOCVendor_products", + "path": "device/MySOCVendor/MySOC/build", + "name": "MySOCVendor_products", + "dir": "device/MySOCVendor" + }, +``` + +接着需要修改定义产品的配置文件`//productdefine/common/products/MyProduct.json`。将刚刚定义的子系统加入到产品中 + +### 2. 编译内核 + +在上一节定义subsystem的时候,定义了构建的路径path,即`//device/MySOCVendor/MySOC/build`。这一节会在这个目录创建构建脚本,告诉构建系统如何构建内核。 + +目前OpenHarmony源码中提供了Linux 4.19的内核,归档在`//kernel/linux-4.19`。请尽可能使用这个内核。 +每个SOC必然需要对内核做一些修改或扩展,建议采用补丁的方式。 + +建议的目录结构 +``` +├── build +│   ├── kernel +│   │ ├── linux +│   │ ├──standard_patch_for_4_19.patch +│   ├── BUILD.gn +│   ├── ohos.build +``` +BUILD.gn是subsystem构建的唯一入口。 + +期望的构建结果 + +| 文件 | 文件说明| +|------|------| +|$root_build_dir/packages/phone/images/uImage| 内核镜像| +|$root_build_dir/packages/phone/images/uboot | bootloader镜像| + +### 3. 移植验证 + +启动编译,验证预期的kernel镜像是否成功生成。 + +## HDF驱动移植 + +### 1. LCD +HDF为LCD设计了驱动模型。支持一块新的LCD,需要编写一个驱动,在驱动中生成模型的实例,并完成注册。 + +这些LCD的驱动被放置在`//drivers/framework/model/display/driver/panel`目录中。 + +- 创建Panel驱动 + +在驱动的Init方法中,需要调用RegisterPanel接口注册模型实例。如: +```C +int32_t XXXInit(struct HdfDeviceObject *object) +{ + struct PanelData *panel = CreateYourPanel(); + + // 注册 + if (RegisterPanel(panel) != HDF_SUCCESS) { + HDF_LOGE("%s: RegisterPanel failed", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +struct HdfDriverEntry g_xxxxDevEntry = { + .moduleVersion = 1, + .moduleName = "LCD_XXXX", + .Init = XXXInit, +}; + +HDF_INIT(g_xxxxDevEntry); +``` + +- 配置加载panel驱动 +产品的所有设备信息被定义在文件`//vendor/MyProductVendor/MyProduct/config/device_info/device_info.hcs`中。修改该文件,在display的host中,名为device_lcd的device中增加配置。 +注意:moduleName 要与panel驱动中的moduleName相同。 + +```hcs +root { + ... + display :: host { + device_lcd :: device { + deviceN :: deviceNode { + policy = 0; + priority = 100; + preload = 2; + moduleName = "LCD_XXXX"; + } + } + } +} +``` + +更详细的驱动开发指导,请参考 [LCD](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/LCD.md) + +### 2. 触摸屏 +本节描述如何移植触摸屏驱动。触摸屏的驱动被放置在`//drivers/framework/model/input/driver/touchscreen`目录中。移植触摸屏驱动主要工作是向系统注册ChipDevice模型实例。 + +- 创建触摸屏器件驱动 + +在目录中创建名为`touch_ic_name.c`的文件。代码模板如下: +注意:请替换ic_name为你所适配芯片的名称 + +```C +#include "hdf_touch.h" + +static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device) +{ + ChipDevice *tpImpl = CreateXXXXTpImpl(); + if(RegisterChipDevice(tpImpl) != HDF_SUCCESS) { + ReleaseXXXXTpImpl(tpImpl); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +struct HdfDriverEntry g_touchXXXXChipEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH_XXXX", + .Init = HdfXXXXChipInit, +}; + +HDF_INIT(g_touchXXXXChipEntry); +``` + +其中ChipDevice中要提供若干方法 +| 方法| 实现说明| +|------|------| +|int32_t (*Init)(ChipDevice *device)| 器件初始化| +|int32_t (*Detect)(ChipDevice *device)| 器件探测| +|int32_t (*Suspend)(ChipDevice *device)| 器件休眠| +|int32_t (*Resume)(ChipDevice *device)| 器件唤醒| +|int32_t (*DataHandle)(ChipDevice *device)| 从器件读取数据,将触摸点数据填写入device->driver->frameData中| +|int32_t (*UpdateFirmware)(ChipDevice *device)| 固件升级| + +- 配置产品,加载器件驱动 + +产品的所有设备信息被定义在文件`//vendor/MyProductVendor/MyProduct/config/device_info/device_info.hcs`中。修改该文件,在名为input的host中,名为device_touch_chip的device中增加配置。 +注意:moduleName 要与触摸屏驱动中的moduleName相同。 + +```hcs + deviceN :: deviceNode { + policy = 0; + priority = 130; + preload = 0; + permission = 0660; + moduleName = "HDF_TOUCH_XXXX"; + deviceMatchAttr = "touch_XXXX_configs"; + } +``` + +更详细的驱动开发指导,请参考 [TOUCHSCREEN](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/TOUCHSCREEN.md) + + +### 3. WLAN + +![tu](./figures/HDF_WIFI.png) + +Wi-Fi驱动分为两部分,一部分负责管理WLAN设备,另一个部分负责处理WLAN流量。`HDF WLAN`分别为这两部分做了抽象。目前支持SDIO接口的WLAN芯片 + +主要需要实现的接口有: + +| 接口| 定义头文件| 说明| +|------|------|------| +| HdfChipDriverFactory| `//drivers/framework/include/wifi/hdf_wlan_chipdriver_manager.h`| ChipDriver的Factory,用于支持一个芯片多个Wi-Fi端口| +| HdfChipDriver | `//drivers/framework/include/wifi/wifi_module.h`| 每个WLAN端口对应一个HdfChipDriver,用来管理一个特定的WLAN端口| +|NetDeviceInterFace| `//drivers/framework/include/wifi/net_device.h`| 与协议栈之间的接口,如发送数据、设置网络接口状态等| + +建议适配按如下步骤操作: + +1. 创建HDF驱动 +建议将代码放置在`//device/MySoCVendor/peripheral/wifi/chip_name/` + +```C +static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) { + static struct HdfChipDriverFactory factory = CreateChipDriverFactory(); + struct HdfChipDriverManager *driverMgr = HdfWlanGetChipDriverMgr(); + if (driverMgr->RegChipDriver(&factory) != HDF_SUCCESS) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +struct HdfDriverEntry g_hdfXXXChipEntry = { + .moduleVersion = 1, + .Init = HdfWlanXXXChipDriverInit, + .Release = HdfWlanXXXChipRelease, + .moduleName = "HDF_WIFI_CHIP_XXX" +}; + +HDF_INIT(g_hdfXXXChipEntry); +``` + +在CreateChipDriverFactory中,需要创建一个HdfChipDriverFactory +| 接口| 说明| +|------|------| +|const char *driverName| 当前driverName | +|int32_t (*InitChip)(struct HdfWlanDevice *device)| 初始化芯片| +|int32_t (*DeinitChip)(struct HdfWlanDevice *device)| 去初始化芯片| +|void (*ReleaseFactory)(struct HdfChipDriverFactory *factory)| 释放HdfChipDriverFactory对象| +|struct HdfChipDriver *(*Build)(struct HdfWlanDevice *device, uint8_t ifIndex)|创建一个HdfChipDriver;输入参数中,device是设备信息,ifIndex是当前创建的接口在这个芯片中的序号| +|void (*Release)(struct HdfChipDriver *chipDriver)| 释放chipDriver +|uint8_t (*GetMaxIFCount)(struct HdfChipDriverFactory *factory)| 获取当前芯片支持的最大接口数| + +HdfChipDriver需要实现的接口有 + +|接口| 说明| +|------|------| +|int32_t (*init)(struct HdfChipDriver *chipDriver, NetDevice *netDev)| 初始化当前网络接口,这里需要向netDev提供接口NetDeviceInterFace| +|int32_t (*deinit)(struct HdfChipDriver *chipDriver, NetDevice *netDev)| 去初始化当前网络接口| +|struct HdfMac80211BaseOps *ops| WLAN基础能力接口集| +|struct HdfMac80211STAOps *staOps| 支持STA模式所需的接口集| +|struct HdfMac80211APOps *apOps| 支持AP模式所需要的接口集| + + + +2. 编写配置文件,描述驱动支持的设备 +在产品配置目录下创建芯片的配置文件`//vendor/MyProductVendor/MyProduct/config/wifi/wlan_chip_chip_name.hcs` + +注意: 路径中的vendor_name、product_name、chip_name请替换成实际名称 +```hcs +root { + wlan_config { + chip_name :& chipList { + chip_name :: chipInst { + match_attr = "hdf_wlan_chips_chip_name"; /* 这是配置匹配属性,用于提供驱动的配置根 */ + driverName = "driverName"; /* 需要与HdfChipDriverFactory中的driverName相同*/ + sdio { + vendorId = 0x0296; + deviceId = [0x5347]; + } + } + } + } +} +``` + +3. 编写配置文件,加载驱动 + +产品的所有设备信息被定义在文件`//vendor/MyProductVendor/MyProduct/config/device_info/device_info.hcs`中。修改该文件,在名为network的host中,名为device_wlan_chips的device中增加配置。 +注意:moduleName 要与触摸屏驱动中的moduleName相同。 + +```hcs + deviceN :: deviceNode { + policy = 0; + preload = 2; + moduleName = "HDF_WLAN_CHIPS"; + deviceMatchAttr = "hdf_wlan_chips_chip_name"; + serviceName = "driverName"; + } +``` + +4. 构建驱动 + +- 创建内核菜单 +在 `//device/MySoCVendor/peripheral` 目录中创建Kconfig文件,内容模板如下: +``` +config DRIVERS_WLAN_XXX + bool "Enable XXX WLAN Host driver" + default n + depends on DRIVERS_HDF_WIFI + help + Answer Y to enable XXX Host driver. Support chip xxx +``` + +接着修改文件 `//drivers/adapter/khdf/linux/model/network/wifi/Kconfig`,在文件末尾加入如下代码将配置菜单加入内核中 +``` +source "../../../../../device/MySoCVendor/peripheral/Kconfig" +``` + +- 创建构建脚本 + +在`//drivers/adapter/khdf/linux/model/network/wifi/Makefile` 文件末尾增加配置,模板如下 + +``` +HDF_DEVICE_ROOT := $(HDF_DIR_PREFIX)/../device +obj-$(CONFIG_DRIVERS_WLAN_XXX) += $(HDF_DEVICE_ROOT)/MySoCVendor/peripheral/build/standard/ +``` + +当在内核中开启`DRIVERS_WLAN_XXX`开关时,会调用`//device/MySoCVendor/peripheral/build/standard/`中的makefile + + +更多详细的开发手册,请参考[WLAN开发](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/WLAN.md) diff --git a/zh-cn/device-dev/subsystems/Readme-CN.md b/zh-cn/device-dev/subsystems/Readme-CN.md index 7dc0b03cfa..843563ec81 100755 --- a/zh-cn/device-dev/subsystems/Readme-CN.md +++ b/zh-cn/device-dev/subsystems/Readme-CN.md @@ -42,10 +42,10 @@ - [唤醒词识别SDK的开发示例](subsys-aiframework-demo-sdk.md) - [唤醒词识别插件的开发示例](subsys-aiframework-demo-plugin.md) - [唤醒词识别配置文件的开发示例](subsys-aiframework-demo-conf.md) -- [Sensor服务](subsys-densor.md) - - [Sensor服务子系概述](subsys-densor-overview.md) - - [Sensor服务子系使用指导](subsys-densor-guide.md) - - [Sensor服务子系使用实例](subsys-densor-demo.md) +- [Sensor服务](subsys-sensor.md) + - [Sensor服务子系概述](subsys-sensor-overview.md) + - [Sensor服务子系使用指导](subsys-sensor-guide.md) + - [Sensor服务子系使用实例](subsys-sensor-demo.md) - [用户程序框架](subsys-application-framework.md) - [概述](subsys-application-framework-overview.md) - [搭建环境](subsys-application-framework-builden.md) diff --git a/zh-cn/device-dev/subsystems/subsys-densor.md b/zh-cn/device-dev/subsystems/subsys-densor.md deleted file mode 100644 index 2c5ea0dbbe..0000000000 --- a/zh-cn/device-dev/subsystems/subsys-densor.md +++ /dev/null @@ -1,9 +0,0 @@ -# Sensor服务 - -- **[Sensor服务子系概述](subsys-densor-overview.md)** - -- **[Sensor服务子系使用指导](subsys-densor-guide.md)** - -- **[Sensor服务子系使用实例](subsys-densor-demo.md)** - - diff --git a/zh-cn/device-dev/subsystems/subsys-densor-demo.md b/zh-cn/device-dev/subsystems/subsys-sensor-demo.md similarity index 100% rename from zh-cn/device-dev/subsystems/subsys-densor-demo.md rename to zh-cn/device-dev/subsystems/subsys-sensor-demo.md diff --git a/zh-cn/device-dev/subsystems/subsys-densor-guide.md b/zh-cn/device-dev/subsystems/subsys-sensor-guide.md similarity index 100% rename from zh-cn/device-dev/subsystems/subsys-densor-guide.md rename to zh-cn/device-dev/subsystems/subsys-sensor-guide.md diff --git a/zh-cn/device-dev/subsystems/subsys-densor-overview.md b/zh-cn/device-dev/subsystems/subsys-sensor-overview.md similarity index 100% rename from zh-cn/device-dev/subsystems/subsys-densor-overview.md rename to zh-cn/device-dev/subsystems/subsys-sensor-overview.md diff --git a/zh-cn/device-dev/subsystems/subsys-sensor.md b/zh-cn/device-dev/subsystems/subsys-sensor.md new file mode 100644 index 0000000000..415eec2bde --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-sensor.md @@ -0,0 +1,9 @@ +# Sensor服务 + +- **[Sensor服务子系概述](subsys-sensor-overview.md)** + +- **[Sensor服务子系使用指导](subsys-sensor-guide.md)** + +- **[Sensor服务子系使用实例](subsys-sensor-demo.md)** + + diff --git a/zh-cn/device-dev/subsystems/subsys.md b/zh-cn/device-dev/subsystems/subsys.md index d4d4822436..b301414e12 100644 --- a/zh-cn/device-dev/subsystems/subsys.md +++ b/zh-cn/device-dev/subsystems/subsys.md @@ -12,7 +12,7 @@ - **[AI框架](subsys-aiframework.md)** -- **[Sensor服务](subsys-densor.md)** +- **[Sensor服务](subsys-sensor.md)** - **[用户程序框架](subsys-application-framework.md)** diff --git "a/zh-cn/device-dev/\345\257\274\350\257\273.md" "b/zh-cn/device-dev/\345\257\274\350\257\273.md" index 44b738359b..99b56c52bd 100644 --- "a/zh-cn/device-dev/\345\257\274\350\257\273.md" +++ "b/zh-cn/device-dev/\345\257\274\350\257\273.md" @@ -146,7 +146,7 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按

结合系统能力开发智能设备

- +

移植适配

diff --git a/zh-cn/readme.md b/zh-cn/readme.md index 15528919ed..a6b0a1ab30 100644 --- a/zh-cn/readme.md +++ b/zh-cn/readme.md @@ -42,8 +42,8 @@ - guide:开发示例 - [时钟应用](device-dev/guide/device-clock-guide.md) - - [平台驱动](device-dev/guide/device-drive-demo.md) - - [外设驱动](device-dev/guide/device-outerdrive-demo.md) + - [平台驱动](device-dev/guide/device-driver-demo.md) + - [外设驱动](device-dev/guide/device-outerdriver-demo.md) - porting:移植适配 -- GitLab