diff --git a/en/device-dev/bundles/Readme-EN.md b/en/device-dev/bundles/Readme-EN.md index 2ae8dc847c778c4cef4a191f56f5d3e107a2d1c7..b95e0adea8e0b365a0c1a7736a77c8a8a1643ac2 100644 --- a/en/device-dev/bundles/Readme-EN.md +++ b/en/device-dev/bundles/Readme-EN.md @@ -1,20 +1,11 @@ -# Bundle Development - -- [Development Specifications](development-specifications.md) - - [Overview](overview.md) - - [Bundle Composition](bundle-composition.md) - - [Bundle Management](bundle-management.md) - - [Bundle Version](bundle-version.md) - - [Distribution](distribution.md) - - [Environment Variables](environment-variables.md) - -- [Development Guidelines](development-guidelines.md) - - [Overview](overview-0.md) - - [Preparations](preparations.md) - - [Bundle Development](bundle-development.md) - -- [HPM User Guide](hpm-user-guide.md) - - [Introduction](introduction.md) - - [Preparations](preparations-1.md) - - [Development Example](development-example.md) - +# Bundle Development + +- [Development Specifications](bundles-standard-rules.md) +- [Development Guidelines](bundles-guide.md) + - [Bundle Development](bundles-guide-overview.md) + - [Preparations](bundles-guide-prepare.md) + - [Bundle Development](bundles-guide-develop.md) +- [HPM User Guide](bundles-demo.md) + - [Introduction](bundles-demo-hpmdescription.md) + - [Preparations](bundles-demo-environment.md) + - [Development Example](bundles-demo-devsample.md) \ No newline at end of file diff --git a/en/device-dev/bundles/bundle-composition.md b/en/device-dev/bundles/bundle-composition.md deleted file mode 100644 index 754f38a7c428547cacc97f55d0042e6eae62bb75..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/bundle-composition.md +++ /dev/null @@ -1,99 +0,0 @@ -# Bundle Composition - -- [Code files](#section101483489110) -- [README File](#section10519101221211) -- [Metadata Description File](#section45511827111211) - -A bundle contains the following contents: - -- **src** directory for storing code files or code library -- **ohos\_bundles** folder for storing dependent bundles \(It is automatically generated during bundle installation, without the need to submit to the code library.\) -- **README.md** file for describing the bundle -- **bundle.json** file for declaring metadata of the bundle -- **LICENSE** file for open-source code - - ``` - my-bundle - |_ohos_bundles - |_src - |_bundle.json - |_README.md - |_LICENSE - ``` - - -## Code files - -Bundle code files are the same as those in a common code directory. The only difference lies in the open APIs \(declared in header files\) of a bundle, which are likely to be referenced by other bundles and need to be declared in the **dirs** of **bundle.json**. - -## README File - -**README.md** is a bundle self-description file using the markdown syntax. For details, see [Syntax Reference](https://www.markdownguide.org/getting-started/). - -To help you easily find and use the desired bundle on the HarmonyOS Package Manager \(HPM\) platform, a **README** file is provided in the root directory of each bundle. - -The **README** file may include instructions on how to install, configure, and use the instance code in the bundle, as well as any other information helpful to you. - -The **README** file is available in the bundle details page of the HPM platform. - -## Metadata Description File - -A **bundle.json** file describes the metadata of a bundle. Each bundle has its own **bundle.json** file. - -``` -{ - "name": "@myorg/demo-bundle", - "version": "1.0.0", - "license": "MIT", - "description": "bundle description", - "keywords": ["hos"], - "tags": ["applications", "drivers"], - "author": {"name":"","email":"","url":""}, - "contributors":[{"name":"","email":"","url":""},{"name":"","email":"","url":""}], - "homepage": "http://www.foo.bar.com", - "repository": "https://git@gitee.com:foo/bar.git", - "publishAs": "source", - "dirs": { - "src": ["src/**/*.c"], - "headers": ["headers/**/*.h"], - "bin": ["bin/**/*.o"] - }, - "scripts": { - "build": "make" - }, - "envs": {}, - "ohos": { - "os": "2.0.0", - "board": "hi3516", - "kernel": "liteos-a" - }, - "rom": "10240", - "ram": "1024", - "dependencies": { - "@myorg/net":"1.0.0" - } -} -``` - -Each **bundle.json** file has the following fields: - -- **name**: a bundle name, which starts with @ and is separated by /, for example, **@myorg/mybundle** - -- **version**: a bundle version number, for example, 1.0.0. The version number must comply with the Semantic Versioning Specification \(SemVer\) standards. - -- **description**: a brief description of a bundle -- **dependencies**: bundles that a bundle depends on - -- **envs**: parameters required for bundle compilation, including global parameters and dependency parameters. - -- **scripts**: commands executable to a bundle, such as those for compiling, building, testing, and burning - -- **publishAs**: bundle publishing type, which can be **source**, **binary**, **distribution**, or **code-segment** - -- **dirs**: directory structure \(such as the header file\) generated for publishing - -- **ram&rom**: statistical information about the estimated read-only memory \(ROM\) and random access memory \(RAM\) usage -- **ohos**: mappings among OpenHarmony versions, development boards, and kernels, separated by commas \(,\). -- Extended information: author, home page, code repository, license, tags, and keywords -- **base** \(only for a distribution\): a base distribution which others inherit from. - diff --git a/en/device-dev/bundles/bundle-version.md b/en/device-dev/bundles/bundle-version.md deleted file mode 100644 index d07118d86a36d626e1ba8a04112560d4fb25d4ad..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/bundle-version.md +++ /dev/null @@ -1,23 +0,0 @@ -# Bundle Version - -- [Version Number Naming Specifications](#section16893854141310) -- [Version Publishing](#section43401320171420) - -## Version Number Naming Specifications - -Each version name allows only lowercase letters, which can be separated by hyphens \(-\) or underscores \(\_\). For example, **bundle** and **my\_bundle** are allowed. - -A bundle version number is in the format of _major version number_._minor version number_._revision version number_ or _major version number_._minor version number_._revision version number_-_pre-release version number_, for example, **1.0.0** and **1.0.0-beta**. For details, see [https://semver.org](https://semver.org/). - -## Version Publishing - -You should upload bundles to the remote repository so that your peers have an option to use them. You can run the following command to upload the bundles: - -``` -hpm publish -``` - -After this command is executed, the system checks the bundle dependencies and downloads the missing dependencies. If the bundles you uploaded are in binary, the system compiles the entire bundle, generates a binary file, packs the file, and uploads it. If the bundles you uploaded are in another format, the system packs the bundle file in compliance with the defined packing rules and then uploads the file. - -Note: To publish a bundle, you need an HPM account for login. After logging in to the HPM platform, register with an organization and apply for authentication. After successful authentication, you will have the permission to publish the bundle. - diff --git a/en/device-dev/bundles/development-example.md b/en/device-dev/bundles/bundles-demo-devsample.md similarity index 95% rename from en/device-dev/bundles/development-example.md rename to en/device-dev/bundles/bundles-demo-devsample.md index 159de560311c2fe03fd03c947fbfa669c060f3fa..4b896d4811456deb410fab4abbab7baac6e2493c 100644 --- a/en/device-dev/bundles/development-example.md +++ b/en/device-dev/bundles/bundles-demo-devsample.md @@ -28,7 +28,7 @@ This following uses the Hi3861 platform as an example to describe how to install Installed. ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >Run the following command for the Hi3516 platform: >``` >hpm install @ohos/ip_camera_hi3516dv300 diff --git a/en/device-dev/bundles/preparations-1.md b/en/device-dev/bundles/bundles-demo-environment.md similarity index 91% rename from en/device-dev/bundles/preparations-1.md rename to en/device-dev/bundles/bundles-demo-environment.md index 6a0981f81bc1c1562946a9f1987eaabc30b50439..6780aa705ee1b918dd9f6d748c286b0deae34476 100644 --- a/en/device-dev/bundles/preparations-1.md +++ b/en/device-dev/bundles/bundles-demo-environment.md @@ -25,7 +25,7 @@ ln -s bash /bin/sh ## Node.js ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If the Node.js version of the source is outdated, run the following command before running **apt-get install**: >``` >curl -L https://deb.nodesource.com/setup_12.x | bash @@ -68,7 +68,7 @@ http_proxy = http://your-proxy-server:port # Configure the HTTP proxy. https_proxy = http://your-proxy-server:port # Configure the HTTPS proxy. ``` -For details about **hpm-cli** commands, see [HPM Commands](bundle-management.md). +For details about **hpm-cli** commands, see [HPM Commands](bundles-standard-rules.md). ## Python Environment @@ -81,7 +81,7 @@ sudo pip3 install setuptools sudo pip3 install kconfiglib # Install kconfiglib 13.2.0 or later. ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The preceding method is applicable to Hi3518 and Hi3516 platforms. For Hi3861, run the following commands to install the Python environment: >``` >sudo apt-get install python3.8 @@ -112,7 +112,7 @@ which mcopy # If mcopy is not found, run the following command: sudo apt-get install mtools ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Both Hi3518 and Hi3516 platforms require the file packaging tool. For Hi3861, the tool is not required. ## SCons @@ -131,9 +131,9 @@ sudo apt-get install mtools ``` **Figure 1** Successful installation \(SCons version requirement: 3.0.4 or later\) - ![](figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png "successful-installation-(scons-version-requirement-3-0-4-or-later)") + ![](figure/successful-installation-(scons-version-requirement-3-0-4-or-later)-25.png "successful-installation-(scons-version-requirement-3-0-4-or-later)-25") ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >SCons is required for the Hi3861 platform, but not for the Hi3518 or Hi3516 platform. diff --git a/en/device-dev/bundles/introduction.md b/en/device-dev/bundles/bundles-demo-hpmdescription.md similarity index 100% rename from en/device-dev/bundles/introduction.md rename to en/device-dev/bundles/bundles-demo-hpmdescription.md diff --git a/en/device-dev/bundles/bundles-demo.md b/en/device-dev/bundles/bundles-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..846d6b1bde058051ef3212edb3596a2d7ec22396 --- /dev/null +++ b/en/device-dev/bundles/bundles-demo.md @@ -0,0 +1,9 @@ +# HPM User Guide + +- **[Introduction](bundles-demo-hpmdescription.md)** + +- **[Preparations](bundles-demo-environment.md)** + +- **[Development Example](bundles-demo-devsample.md)** + + diff --git a/en/device-dev/bundles/bundle-development.md b/en/device-dev/bundles/bundles-guide-develop.md similarity index 96% rename from en/device-dev/bundles/bundle-development.md rename to en/device-dev/bundles/bundles-guide-develop.md index 09330f69915d1cc850b0125a3e198e4f1c8c163f..d7f0fdad1f664ab9f46ffbee7f40e07ae024dffb 100644 --- a/en/device-dev/bundles/bundle-development.md +++ b/en/device-dev/bundles/bundles-guide-develop.md @@ -1,6 +1,6 @@ # Bundle Development -- [Developing a OpenHarmony Bundle](#section1976410130540) +- [Developing OpenHarmony Bundles](#section1976410130540) - [Creating a Bundle](#section717481119145) - [Modifying a Bundle](#section102861955201410) - [Using HPM-provided Template to Create a Bundle](#section15882846181510) @@ -13,13 +13,12 @@ - [Burning](#section1746331545413) - [Debugging](#section6742131615549) -## Developing a OpenHarmony Bundle +## Developing OpenHarmony Bundles -You have an option to use any of the following methods to develop an OpenHarmony bundle: +You have an option to use any of the following methods to develop OpenHarmony bundles: - Develop a brand new bundle from scratch. - Rewrite code of an existing non-bundle to develop a bundle. - - Use HPM-provided bundle templates to quickly develop a bundle. ## Creating a Bundle @@ -109,7 +108,7 @@ The HPM provides **default** and **simple** templates as well as other templ You can run the **hpm search -t template** command to search for a template stored on the server. -![](figures/en-us_image_0000001051452177.png) +![](figure/en-us_image_0000001051452177.png) Then, select your desired template based on the information below **description**, use the selected template to quickly create the bundle scaffold, and run the following command with the **-t** and **-d** parameters specified: @@ -159,7 +158,7 @@ executable("hello_world") { } ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >- **executable** is a built-in template of **gn**. You can run the **gn help executable** command to view how to use this template. >- **sources** represents the source code path, and **include\_dirs** represents the header file path. @@ -173,7 +172,7 @@ hpm build After all building operations are complete, the message "build succeed" is displayed. You need to check the building result. -![](figures/en-us_image_0000001051770876.png) +![](figure/en-us_image_0000001051770876.png) ## Defining a Distribution diff --git a/en/device-dev/bundles/overview-0.md b/en/device-dev/bundles/bundles-guide-overview.md similarity index 49% rename from en/device-dev/bundles/overview-0.md rename to en/device-dev/bundles/bundles-guide-overview.md index 44fc41de4b49eaf811cc9b139d6751613452c21d..a6d16e00da5e950294612bc72454fe531fa3bbdf 100644 --- a/en/device-dev/bundles/overview-0.md +++ b/en/device-dev/bundles/bundles-guide-overview.md @@ -1,4 +1,16 @@ -# Overview +# Bundle Development + +- [Overview](#section112136415486) +- [Preparations](#section12731192104816) + - [Hardware Requirements](#section71851750144814) + - [Installing Node.js and the hpm-cli Tool](#section675199493) + - [\(Optional\) Modifying HPM Configurations](#section1940205015499) + - [Downloading OpenHarmony Code](#section42591118155217) + - [Installing Dependent Bundles](#section644212530524) + +- [Bundle Development](#section15640113715318) + +## Overview This document describes how to develop OpenHarmony bundles and distributions, and how to create, develop, and build code, as well as burn and debug devices by using a command line tool. @@ -50,5 +62,85 @@ This document describes how to develop OpenHarmony bundles and distributions, an **Figure 1** Composition of bundles and distributions -![](figures/组件0924.png) +![](figure/组件0924.png) + +## Preparations + +### Hardware Requirements + +- Development boards \(examples: Hi3861, Hi3516D V300, and Hi3518E V300\) +- Host computer \(Windows workstation\) +- Linux server + +**Figure 2** Hardware connections +![](figure/hardware-connections-23.png "hardware-connections-23") + +### Installing **Node.js** and the **hpm-cli** Tool + +1. Install **Node.js**. + + Download **Node.js** from its official website and install it on your local PC. + + You are advised to install [Node.js](https://nodejs.org/) 12.x \(including npm 6.14.4\) or a later version \(12.13.0 or later is recommended\). + +2. Install the **hpm-cli** tool using **npm** delivered with **Node.js**. Run the following command: + + ``` + npm install -g @ohos/hpm-cli + ``` + +3. Run the following command to check whether the installation is successful. If an HPM version is displayed, the installation is successful. + + ``` + hpm -V or hpm --version + ``` + +4. \(Optional\) Run the following command to upgrade the HPM version if needed: + + ``` + npm update -g @ohos/hpm-cli + ``` + + +### \(Optional\) Modifying HPM Configurations + +After the **hpm-cli** tool is installed, run the following command to view HPM configurations: + +``` +hpm config +``` + +Default HPM configurations are displayed upon the command execution. You can modify the default configurations as required. The following lists common HPM configurations: + +``` +registry = https://hpm.harmonyos.com/hpm/registry/api # Configure the address of the HPM registry (mandatory for downloading bundles). +login = https://hpm.harmonyos.com/hpm/auth/pk # Configure the address for HPM login (mandatory for publishing bundles). +loginUser = {your-account} # Configure the account for HPM login (mandatory for publishing bundles). +shellPath = C:\WINDOWS\System32\cmd.exe # Configure the shell for running HPM commands. +globalRepo = C:\Users\yourname\.global # Configure the path for storing bundles that are installed globally. +http_proxy = http://your-proxy-server:port # Configure the HTTP proxy. +https_proxy = http://your-proxy-server:port # Configure the HTTPS proxy. +``` + +For details about **hpm-cli** commands, see [HPM Commands](bundles-guide-overview.md). + +### Downloading OpenHarmony Code + +For details, see [Source Code Acquisition](../get-code/sourcecode-acquire.md). + +### Installing Dependent Bundles + +The HPM publishes commonly used development tools \(such as those for burning, compiling, and compression\) as bundles. You can run the following command to install these tools. After the command is executed, the system automatically downloads and installs the tools, which need to be installed globally only once. + +``` +hpm i -g @ohos/llvm +hpm i -g @ohos/ninja +hpm i -g @ohos/gn +hpm i -g @ohos/hc_gen +hpm i -g @ohos/sysroot +``` + +These are a set of development tools \(such as **gn** and **ninja**\). With these tools, you can start your general bundle development based on source code. + +## Bundle Development diff --git a/en/device-dev/bundles/preparations.md b/en/device-dev/bundles/bundles-guide-prepare.md similarity index 93% rename from en/device-dev/bundles/preparations.md rename to en/device-dev/bundles/bundles-guide-prepare.md index dedd9b41f76f016fd1a33e1a407113feadabff7f..f706e2c2f8ebf2c8307e60a5595d53eb9799d1c1 100644 --- a/en/device-dev/bundles/preparations.md +++ b/en/device-dev/bundles/bundles-guide-prepare.md @@ -8,12 +8,12 @@ ## Hardware Requirements -- Development boards \(examples: Hi3861, Hi3516DV300, and Hi3518EV300\) +- Development boards \(examples: Hi3861, Hi3516D V300, and Hi3518E V300\) - Host computer \(Windows workstation\) - Linux server **Figure 1** Hardware connections -![](figures/hardware-connections.png "hardware-connections") +![](figure/hardware-connections-24.png "hardware-connections-24") ## Installing **Node.js** and the **hpm-cli** Tool @@ -62,11 +62,11 @@ http_proxy = http://your-proxy-server:port # Configure t https_proxy = http://your-proxy-server:port # Configure the HTTPS proxy. ``` -For details about **hpm-cli** commands, see [HPM Commands](bundle-management.md). +For details about **hpm-cli** commands, see [HPM Commands](bundles-guide-overview.md). ## Downloading OpenHarmony Code -For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md). +For details, see [Source Code Acquisition](../get-code/sourcecode-acquire.md). ## Installing Dependent Bundles diff --git a/en/device-dev/bundles/development-guidelines.md b/en/device-dev/bundles/bundles-guide.md similarity index 30% rename from en/device-dev/bundles/development-guidelines.md rename to en/device-dev/bundles/bundles-guide.md index 6ae82a8f668402df6a4b967fad4fb85af5f59eef..162b7be93ab12c2b1da404fd0fca89f6a3b6e4d4 100644 --- a/en/device-dev/bundles/development-guidelines.md +++ b/en/device-dev/bundles/bundles-guide.md @@ -1,9 +1,9 @@ # Development Guidelines -- **[Overview](overview-0.md)** +- **[Bundle Development](bundles-guide-overview.md)** -- **[Preparations](preparations.md)** +- **[Preparations](bundles-guide-prepare.md)** -- **[Bundle Development](bundle-development.md)** +- **[Bundle Development](bundles-guide-develop.md)** diff --git a/en/device-dev/bundles/bundle-management.md b/en/device-dev/bundles/bundles-standard-rules.md similarity index 42% rename from en/device-dev/bundles/bundle-management.md rename to en/device-dev/bundles/bundles-standard-rules.md index 4511f3427ca7e4ba140bc844e3c4450fd545daf8..8adaac0e618ca9b141d52d7a4683a8ba3fa086ae 100644 --- a/en/device-dev/bundles/bundle-management.md +++ b/en/device-dev/bundles/bundles-standard-rules.md @@ -1,9 +1,162 @@ -# Bundle Management +# Development Specifications -- [Dependency](#section12657593129) -- [HPM Command Reference](#section1258849181312) +- [Overview](#section1725818533344) + - [Definition](#section4821219183514) + - [Bundle Division Principles](#section1089794263513) + - [Bundle Dependency](#section25701647163710) -## Dependency +- [Bundle Composition](#section185538333914) + - [Code Files](#section8431268393) + - [README File](#section168121548173914) + - [Metadata Description File](#section7107181819406) + +- [Bundle Management](#section32061634104110) + - [Dependency](#section791115242423) + - [HPM Command Reference](#section1183205411429) + +- [Bundle Version](#section12612142864316) + - [Version Number Naming Specifications](#section1487612416432) + - [Version Publishing](#section1548171014440) + +- [Distribution](#section1264139114413) +- [Environment Variables](#section15352105174512) + +## Overview + +This document describes the basic concepts of a bundle and how to define it in compliance with specifications. + +### Definition + +OpenHarmony software is developed on a per-bundle basis. In terms of the operating system, all software running on OpenHarmony are bundles. Generally, bundles are classified into the following types based on their application scopes: + +- Board-level bundles: device hardware-specific bundles, such as **board**, **arch**, and **mcu** +- System-level bundles: a set of bundles with independent features, such as the kernel, file system, and framework +- Application-level bundles: applications that provide services to users, such as **wifi\_iot** and **ip\_camera** + +Bundles are designed for reuse purposes. Any reusable modules can be defined as bundles. They are classified into the following types based on their forms: + +- Source code +- Binary system +- Code snippet +- Distribution + +### Bundle Division Principles + +In principle, bundles should be grouped at a fine-grained granularity as much as possible to achieve maximum reuse. The following factors are taken into account regarding bundle division: + +- Independence: Bundles provide relatively independent features and can be independently built. Each bundle is capable of providing its own APIs and services for external systems. +- Coupling: If a bundle must depend on another bundle to provide services, they can be coupled to one bundle. +- Correlation: If a group of bundles jointly implement a feature, and if other bundles never depend on them, the group of bundles can be combined into one bundle. + +### Bundle Dependency + +A bundle dependency can be mandatory or optional. + +- Mandatory dependency: If bundle A must depend on bundle B to implement a feature \(the APIs or services specific to bundle B must be invoked\), bundle B is a mandatory dependency of bundle A. +- Optional dependency: If bundle C or bundle D is required for bundle A to implement a feature and bundle C and bundle D are interchangeable, bundle C and bundle D are optional dependencies of bundle A. + +## Bundle Composition + +A bundle contains the following: + +- **src** directory for storing code files or code library +- **ohos\_bundles** folder for storing dependent bundles \(It is automatically generated during bundle installation, without the need to submit to the code library.\) +- **README.md** file for describing the bundle +- **bundle.json** file for declaring metadata of the bundle +- **LICENSE** file for open-source code + + ``` + my-bundle + |_ohos_bundles + |_src + |_bundle.json + |_README.md + |_LICENSE + ``` + + +### Code Files + +Bundle code files are the same as those in a common code directory. The only difference lies in the open APIs \(declared in header files\) of a bundle, which are likely to be referenced by other bundles and need to be declared in **dirs** of **bundle.json**. + +### README File + +**README.md** is a bundle self-description file using the markdown syntax. For details, see [Syntax Reference](https://www.markdownguide.org/getting-started/). + +To help you easily find and use the desired bundle on the HarmonyOS Package Manager \(HPM\) platform, a **README** file is provided in the root directory of each bundle. + +The **README** file may include instructions on how to install, configure, and use the instance code in the bundle, as well as any other information helpful to you. + +The **README** file is available in the bundle details page of the HPM platform. + +### Metadata Description File + +The **bundle.json** file describes the metadata of a bundle. Each bundle has its own **bundle.json** file. + +``` +{ + "name": "@myorg/demo-bundle", + "version": "1.0.0", + "license": "MIT", + "description": "bundle description", + "keywords": ["hos"], + "tags": ["applications", "drivers"], + "author": {"name":"","email":"","url":""}, + "contributors":[{"name":"","email":"","url":""},{"name":"","email":"","url":""}], + "homepage": "http://www.foo.bar.com", + "repository": "https://git@gitee.com:foo/bar.git", + "publishAs": "code-segment", + "segment":{ + "destPath":"/the/dest/path" + }, + "dirs": { + "src": ["src/**/*.c"], + "headers": ["headers/**/*.h"], + "bin": ["bin/**/*.o"] + }, + "scripts": { + "build": "make" + }, + "envs": {}, + "ohos": { + "os": "2.0.0", + "board": "hi3516", + "kernel": "liteos-a" + }, + "rom": "10240", + "ram": "1024", + "dependencies": { + "@myorg/net":"1.0.0" + } +} +``` + +Each **bundle.json** file has the following fields: + +- **name**: a bundle name, which starts with @ and is separated by /, for example, **@myorg/mybundle** + +- **version**: a bundle version number, for example, 1.0.0. The version number must comply with the Semantic Versioning Specification \(SemVer\) standards. + +- **description**: a brief description of a bundle +- **dependencies**: bundles that a bundle depends on + +- **envs**: parameters required for bundle compilation, including global parameters and dependency parameters. + +- **scripts**: commands executable to a bundle, such as commands for compiling, building, testing, and burning + +- **publishAs**: bundle publishing type, which can be **source**, **binary**, **distribution**, or **code-segment** + +- **segment**: destination path of the code-segment bundle. That is, the destination path of the files contained in the bundle package after the bundle is installed. +- **dirs**: directory structure \(such as the header file\) generated for publishing + +- **ram&rom**: statistical information about the estimated read-only memory \(ROM\) and random access memory \(RAM\) usage +- **ohos**: mappings among OpenHarmony versions, development boards, and kernels, separated by commas \(,\). +- Extended information: author, home page, code repository, license, tags, and keywords +- **base** \(only for a distribution\): a base distribution which others inherit from. + +## Bundle Management + +### Dependency A basic **bundle.json** file needs to be enriched by bundle dependencies to implement more complex features. Bundle names and version numbers should be defined in the **dependencies** field of **bundle.json**. @@ -41,20 +194,20 @@ $ hpm list | | +--@demo/dist_tools@4.0.0 ``` -Alternatively, you can view the dependencies of the current bundle in a graph by running the following command: +Alternatively, you can run the following command to view the dependencies of the current bundle in a visualized way: ``` -hpm dependencies +hpm ui ``` -A **deps\_visual** folder is generated in the current directory. The folder contains the **deps.html** and **deps-data.js** files. After you open the **deps.html** file via a browser, you can view bundle dependencies illustrated by a graph, as shown in the following figure. - -Each dependency type is indicated by a different color at the corresponding node. You can move the mouse pointer to a node to view the implied information. +A web service is started on the local host \(by default, the browser is open and the project page is displayed\). Click the project dependency icon on the sidebar. The list of dependent bundles is displayed. Click the button on the right to switch to the tree view. The bundle dependencies are displayed as shown in the following figure. **Figure 1** Bundle dependencies -![](figures/bundle-dependencies.png "bundle-dependencies") -## HPM Command Reference + +![](figure/en-us_image_0000001173313501.png) + +### HPM Command Reference You can use the hpm-cli tool to manage the lifecycle of a bundle. The following table describes available HPM commands. \(You can run the **hpm -h** command to get the command details\). @@ -63,7 +216,7 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following - @@ -71,21 +224,21 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following - - - - - - - - - - @@ -130,21 +283,21 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following - - - - - - + + + + + + + + + + + + + + + + + + + + - -

Function

Command

+

Command Line

Description

Querying version information

hpm -V or hpm --version

+

hpm -V or hpm --version

Queries the hpm-cli version number.

+

Displays the hpm-cli version number.

Querying help information

hpm -h or hpm --version

+

hpm -h or hpm --version

Queries the command list and help information.

+

Displays the command list and help information.

hpm -h

Queries command reference.

+

Displays command help information.

Creating a project

@@ -98,15 +251,15 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following

hpm init -t template

Creates a scaffolding project based on the template.

+

Creates a scaffolding project from a template.

Installing bundles

hpm install or hpm i

+

hpm install or hpm i

Installs dependent bundles in the bundle.json file.

+

Installs dependent bundles in the bundle.json file.

hpm install bundle@version

@@ -119,10 +272,10 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following

hpm uninstall bundle

Removes dependent bundles.

+

Uninstalls dependent bundles.

hpm remove or hpm rm bundlename

+

hpm remove or hpm rm bundlename

Removes dependent bundles.

Viewing information

hpm list or hpm ls

+

hpm list or hpm ls

Displays the bundle tree of available bundles and distributions.

hpm dependencies

Generates the dependency diagram (in HTML format) of available bundles and distributions.

+

Generates the dependency relationship data of a bundle or distribution. (This command is also integrated in the HPM UI to display the bundle dependencies intuitively.)

Searching for bundles

hpm search name

Searches for bundles. --json is used to specify the search result in JSON format, and -type is used to set the target type, which can be bundle, distribution, or code-segment.

+

Searches for bundles. --json is used to specify the search result in JSON format, and -type is used to set the target type, which can be bundle, distribution, or code-segment.

Setting HPM configuration items

@@ -182,7 +335,7 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following

hpm dist

Packs a distribution, depending on the dist script in scripts of bundle.json.

+

Builds a distribution. The build depends on the dist script in scripts of bundle.json.

Packing

@@ -196,7 +349,7 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following

hpm run flash

Burns the firmware, depending on the flash script in scripts of bundle.json.

+

Burns the firmware. The firmware burning depends on the flash script in scripts of bundle.json.

Publishing

@@ -210,23 +363,187 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following

hpm run

Runs the commands in scripts defined in bundle.json. Multiple commands can be executed in batches by using &&.

+

Runs the commands in scripts defined in bundle.json. Multiple commands can be executed at a time by using &&.

+

Decompressing

+

hpm extract

+

Decompresses files in zip, tar, tgz, or .tar.gz format.

+

Restarting GUI

+

hpm ui

+

Starts the HPM UI locally. You can use the -p parameter to specify a port. On the Windows platform, the default browser is used to open the HPM UI.

+

Changing language

+

hpm lang

+

Alternates between Chinese and English on the CLI and UI.

+

Converting to HPM format

+

hpm x2h

+

Converts a Maven or NPM package to an HPM package and publishes it to the HPM.

+

Code segment restoration or cleanup

+

hpm code clean|restore

+

Clears or restores the dependent code segment (code-segment). That is, copy or delete the code segment based on segment.destPath.

Generating a key

hpm gen-keys

Generates a public-private key pair and configures the public key on the HPM server, achieving password-free hpm-cli login for bundle publishing.

+

Generates a public-private key pair and configures the public key on the HPM server, which enables password-free hpm-cli login for bundle publishing.

Generating third-party open source notice

hpm gen-notice

Generates a joint file describing the notice on third-party open source based on the description of each bundle.

+

Generates a file providing the notice on third-party open source by combining the description of each bundle.

+## Bundle Version + +### Version Number Naming Specifications + +Each version name allows only lowercase letters, which can be separated by hyphens \(-\) or underscores \(\_\). For example, **bundle** and **my\_bundle** are allowed. + +A bundle version number is in the format of _major version number_._minor version number_._revision version number_ or _major version number_._minor version number_._revision version number_-_pre-release version number_, for example, **1.0.0** and **1.0.0-beta**. For details, see [https://semver.org](https://semver.org/). + +### Version Publishing + +You should upload bundles to the remote repository so that your peers have an option to use them. You can run the following command to upload the bundles: + +``` +hpm publish +``` + +After this command is executed, the system checks the bundle dependencies and downloads the missing dependencies. If the bundles you uploaded are in binary, the system compiles the entire bundle, generates a binary file, packs the file, and uploads it. If the bundles you uploaded are in another format, the system packs the bundle file in compliance with the defined packing rules and then uploads the file. + +Note: To publish a bundle, you need an HPM account for login. After logging in to the HPM platform, register with an organization and apply for authentication. After successful authentication, you will have the permission to publish the bundle. + +## Distribution + +A distribution refers to an image file of an executable OpenHarmony solution composed of a group of bundles. It contains many dependent bundles and provides scripts to illustrate how to compile and link these bundles. + +Generally, a distribution does not require code but contains only the **bundle.json** description \(**publishAs** set to **distribution**\) and some compilation scripts. + +As system-provided environment variables are required during distribution compiling, run the **dist** command in **scripts**. + +``` +{ + "publishAs":"distribution", + "scripts": { + "dist": "script compile command" + } +} +``` + +Run the following command: + +``` +hpm dist +``` + +As it is rather complex to redefine the functionality of a distribution, OpenHarmony allows inheritance from a distribution so that you can make a tailored distribution based on the existing functionality. To inherit from a distribution, you need to define the **base** field in **bundle.json**. + +``` +{ + "base": { + "name": "dist_wifi_iot", + "version": "1.0.0" + } +} +``` + +In this example, the current bundle inherits from the **dist-wifi-iot 1.0.0** bundle of the distribution. + +Each distribution consists of many dependent bundles, which are represented by the **dependencies** field in **bundle.json**. Some dependencies are mandatory, and others can be added or removed required. In the **bundle.json** file, bundle names prefixed with a question mark \(?\) represent optional dependent bundles. If you want to inherit from a distribution involving such bundles, you can remove them and then add other bundles. + +``` +{ + "dependencies": { + "?my_bundle": "1.0.0" + } +} +``` + +In this example, **my\_bundle** is an optional dependent bundle that can be removed by using the keyword **excludes**. + +``` +{ + "excludes": [ "my_bundle" ] +} +``` + +The removed **my-bundle** will not be involved in the build process. If you forcibly remove mandatory dependent bundles, an error message will be displayed. + +## Environment Variables + +During bundle compilation, system-provided environment variables are required to define the output and link the required binary files. These variables are injected into the context for executing scripts based on service requirements. Therefore, their values can be directly obtained from the scripts. The following environment variables are available: + +Global variables are defined by the **envs** attribute in **bundle.json**. All dependent bundles can obtain the values of global variables. + +``` +{ + "envs": { + "compileEnv": "arm" + } +} +``` + +Different parameters can be passed to bundles when introducing dependencies so that the compilation of dependent bundles can meet the requirements of the current bundle. The parameters defined in the dependencies can be obtained from the context for executing the corresponding scripts. + +``` +{ + "dependencies": { + "my-bundle": { + "version": "1.0.0", + "mode": "debug" + } + } +} +``` + +When linking to a binary file, the bundle needs to know the file path regarding the dependencies. Therefore, the path \(as an environment variable\) is passed to the bundle for compiling. + +The passed environment variable is in **DEP\__BundleName_** format, where **BundleName** indicates the name of the dependent bundle, for example, **DEP\_first\_bundle**. + +Tags can be defined to group dependent bundles. You can obtain the path of a group of dependent bundles based on their tag. A tag starts with a number sign \(\#\) and is defined as follows: + +``` +{ + "dependencies": { + "#tool": { + "first-bundle": "1.0.0", + "second-bundle": "1.0.0" + }, + "#drivers": { + "xx-bundle": "1.0.0", + "yy-bundle": "1.0.0" + } + } +} +``` + +There are two fixed environment variables: + +- **DEP\_OHOS\_BUNDLES**: path of the **ohos\_bundles** folder +- **DEP\_BUNDLE\_BASE**: path of the outermost bundle + diff --git a/en/device-dev/bundles/bundles.md b/en/device-dev/bundles/bundles.md new file mode 100644 index 0000000000000000000000000000000000000000..21586387bbddd35439986cadb9c812a6d0c58bc3 --- /dev/null +++ b/en/device-dev/bundles/bundles.md @@ -0,0 +1,9 @@ +# Bundle Development + +- **[Development Specifications](bundles-standard-rules.md)** + +- **[Development Guidelines](bundles-guide.md)** + +- **[HPM User Guide](bundles-demo.md)** + + diff --git a/en/device-dev/bundles/development-specifications.md b/en/device-dev/bundles/development-specifications.md deleted file mode 100644 index 6f583016abacb71b7bee2f3d550924cac1025286..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/development-specifications.md +++ /dev/null @@ -1,15 +0,0 @@ -# Development Specifications - -- **[Overview](overview.md)** - -- **[Bundle Composition](bundle-composition.md)** - -- **[Bundle Management](bundle-management.md)** - -- **[Bundle Version](bundle-version.md)** - -- **[Distribution](distribution.md)** - -- **[Environment Variables](environment-variables.md)** - - diff --git a/en/device-dev/bundles/distribution.md b/en/device-dev/bundles/distribution.md deleted file mode 100644 index 426905862509138efe9d65a22ddd1c5bc5b3d3f7..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/distribution.md +++ /dev/null @@ -1,56 +0,0 @@ -# Distribution - -A distribution refers to an image file of an executable OpenHarmony solution composed of a group of bundles. It contains many dependent bundles and provides scripts to illustrate how to compile and link these bundles. - -Generally, a distribution does not require code but contains only the **bundle.json** description \(**publishAs** set to **distribution**\) and some compilation scripts. - -As system-provided environment variables are required during distribution compiling, run the **dist** command in **scripts**. - -``` -{ - "publishAs":"distribution", - "scripts": { - "dist": "script compile command" - } -} -``` - -Run the following command: - -``` -hpm dist -``` - -As it is rather complex to redefine the functionality of a distribution, OpenHarmony allows inheritance from a distribution so that you can make a tailored distribution based on the existing functionality. To inherit from a distribution, you need to define the **base** field in **bundle.json**. - -``` -{ - "base": { - "name": "dist_wifi_iot", - "version": "1.0.0" - } -} -``` - -In this example, the current bundle inherits from the **dist-wifi-iot 1.0.0** bundle of the distribution. - -Each distribution consists of many dependent bundles, which are represented by the **dependencies** field in **bundle.json**. Some dependencies are mandatory, and others can be added or removed required. In the **bundle.json** file, bundle names prefixed with a question mark \(?\) represent optional dependent bundles. If you want to inherit from a distribution involving such bundles, you can remove them and then add other bundles. - -``` -{ - "dependencies": { - "?my_bundle": "1.0.0" - } -} -``` - -In this example, **my\_bundle** is an optional dependent bundle that can be removed by using the keyword "excludes". - -``` -{ - "excludes": [ "my_bundle" ] -} -``` - -After **my-bundle** is removed, it will not be involved in the building process. If you forcibly remove mandatory dependent bundles, an error message will be displayed. - diff --git a/en/device-dev/bundles/environment-variables.md b/en/device-dev/bundles/environment-variables.md deleted file mode 100644 index 933994a6818205f1a7958390a67876048369f67e..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/environment-variables.md +++ /dev/null @@ -1,53 +0,0 @@ -# Environment Variables - -During bundle compilation, system-provided environment variables are required to define the output and link the required binary files. These variables are injected into the context for executing scripts based on service requirements. Therefore, their values can be directly obtained from the scripts. Currently, there are global and fixed environment variables in the system. - -Global variables are defined by the **envs** attribute in **bundle.json**. All dependent bundles can obtain the values of global variables. - -``` -{ - "envs": { - "compileEnv": "arm" - } -} -``` - -Different parameters can be passed to bundles when introducing dependencies so that the compilation of dependent bundles can meet the requirements of the current bundle. The parameters defined in the dependencies can be obtained from the context for executing the corresponding scripts. - -``` -{ - "dependencies": { - "my-bundle": { - "version": "1.0.0", - "mode": "debug" - } - } -} -``` - -When linking to a binary file, the bundle needs to know the file path regarding the dependencies. Therefore, the path \(as an environment variable\) is passed to the bundle for compiling. - -The passed environment variable is in **DEP\__BundleName_** format, where **BundleName** indicates the name of the dependent bundle, for example, **DEP\_first-bundle**. - -Tags can be defined to group dependent bundles. You can obtain the path of a group of dependent bundles based on their tag. A tag starts with a number sign \(\#\) and is defined as follows: - -``` -{ - "dependencies": { - "#tool": { - "first-bundle": "1.0.0", - "second-bundle": "1.0.0" - }, - "#drivers": { - "xx-bundle": "1.0.0", - "yy-bundle": "1.0.0" - } - } -} -``` - -There are two fixed environment variables: - -- **DEP\_OHOS\_BUNDLES**: path of the **ohos\_bundles** folder -- **DEP\_BUNDLE\_BASE**: path of the outermost bundle - diff --git a/en/device-dev/bundles/figures/en-us_image_0000001051452177.png b/en/device-dev/bundles/figure/en-us_image_0000001051452177.png similarity index 100% rename from en/device-dev/bundles/figures/en-us_image_0000001051452177.png rename to en/device-dev/bundles/figure/en-us_image_0000001051452177.png diff --git a/en/device-dev/bundles/figures/en-us_image_0000001051770876.png b/en/device-dev/bundles/figure/en-us_image_0000001051770876.png similarity index 100% rename from en/device-dev/bundles/figures/en-us_image_0000001051770876.png rename to en/device-dev/bundles/figure/en-us_image_0000001051770876.png diff --git a/en/device-dev/bundles/figure/en-us_image_0000001173313501.png b/en/device-dev/bundles/figure/en-us_image_0000001173313501.png new file mode 100644 index 0000000000000000000000000000000000000000..52f943be7f91caa887bff689f6c37040858fa8ce Binary files /dev/null and b/en/device-dev/bundles/figure/en-us_image_0000001173313501.png differ diff --git a/en/device-dev/bundles/figures/hardware-connections.png b/en/device-dev/bundles/figure/hardware-connections-23.png similarity index 100% rename from en/device-dev/bundles/figures/hardware-connections.png rename to en/device-dev/bundles/figure/hardware-connections-23.png diff --git "a/zh-cn/device-dev/bundles/figures/\347\241\254\344\273\266\347\216\257\345\242\203\350\277\236\346\216\245\345\205\263\347\263\273.png" b/en/device-dev/bundles/figure/hardware-connections-24.png old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/bundles/figures/\347\241\254\344\273\266\347\216\257\345\242\203\350\277\236\346\216\245\345\205\263\347\263\273.png" rename to en/device-dev/bundles/figure/hardware-connections-24.png diff --git a/en/device-dev/bundles/figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png b/en/device-dev/bundles/figure/successful-installation-(scons-version-requirement-3-0-4-or-later)-25.png similarity index 100% rename from en/device-dev/bundles/figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png rename to en/device-dev/bundles/figure/successful-installation-(scons-version-requirement-3-0-4-or-later)-25.png diff --git "a/en/device-dev/bundles/figures/\347\273\204\344\273\2660924.png" "b/en/device-dev/bundles/figure/\347\273\204\344\273\2660924.png" similarity index 100% rename from "en/device-dev/bundles/figures/\347\273\204\344\273\2660924.png" rename to "en/device-dev/bundles/figure/\347\273\204\344\273\2660924.png" diff --git a/en/device-dev/bundles/figures/bundle-dependencies.png b/en/device-dev/bundles/figures/bundle-dependencies.png deleted file mode 100644 index 1b936a2cbc95d3f9d7ddab0187305c3d0c486b0a..0000000000000000000000000000000000000000 Binary files a/en/device-dev/bundles/figures/bundle-dependencies.png and /dev/null differ diff --git a/en/device-dev/bundles/hpm-user-guide.md b/en/device-dev/bundles/hpm-user-guide.md deleted file mode 100644 index daaf5734779208bf468d896807d4ecdb3dfc6f6f..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/hpm-user-guide.md +++ /dev/null @@ -1,9 +0,0 @@ -# HPM User Guide - -- **[Introduction](introduction.md)** - -- **[Preparations](preparations-1.md)** - -- **[Development Example](development-example.md)** - - diff --git a/en/device-dev/bundles/overview.md b/en/device-dev/bundles/overview.md deleted file mode 100644 index 3490dd84640d272e6c707c96d35fbee2c71b8da0..0000000000000000000000000000000000000000 --- a/en/device-dev/bundles/overview.md +++ /dev/null @@ -1,38 +0,0 @@ -# Overview - -- [Definition](#section177563344911) -- [Bundle Division Principles](#section2487162541016) -- [Bundle Dependency](#section185955409107) - -This document describes the basic concepts of a bundle and how to define it in compliance with specifications. - -## Definition - -OpenHarmony software is developed on a per-bundle basis. In terms of the operating system, all software running on OpenHarmony are bundles. Generally, bundles are classified into the following types based on their application scopes: - -- Board-level bundles: device hardware-specific bundles, such as **board**, **arch**, and **mcu** -- System-level bundles: a set of bundles with independent features, such as the kernel, file system, and framework -- Application-level bundles: applications that provide services to users, such as **wifi\_iot** and **ip\_camera** - -Bundles are designed for the reuse purpose. Any reusable modules can be defined as bundles. They are classified into the following types based on their forms: - -- Source code -- Binary system -- Code snippet -- Distribution - -## Bundle Division Principles - -In principle, bundles should be grouped at a fine-grained granularity as much as possible to achieve maximum reuse. The following factors are taken into account regarding bundle division: - -- Independence: Bundles provide relatively independent features and can be independently compiled. Each of them is capable of providing its own APIs and services for external systems. -- Coupling: If a bundle must depend on another bundle to provide services, they can be coupled to one bundle. -- Correlation: If a group of bundles jointly implement a feature, and if other bundles never depend on them, the group of bundles can be combined into one bundle. - -## Bundle Dependency - -A bundle dependency can be mandatory or optional. - -- Mandatory dependency: If bundle A must depend on bundle B to implement a feature, that is, the APIs or services specific to bundle B must be invoked, then bundle B is defined as the mandatory dependency of bundle A. -- Optional dependency: If either bundle C or bundle D is required for bundle A to implement a feature, and if bundle C and bundle D are interchangeable, then bundle C and bundle D are defined as optional dependencies of bundle A. - diff --git a/en/device-dev/driver/Readme-EN.md b/en/device-dev/driver/Readme-EN.md index 18678440ad06c989d251367330af5c65e8d93a59..c82515419fece430b91c9846b2c4ecba1df5f1fd 100644 --- a/en/device-dev/driver/Readme-EN.md +++ b/en/device-dev/driver/Readme-EN.md @@ -1,73 +1,23 @@ -# Drivers - -- [HDF](hdf.md) - - [HDF Overview](hdfoverview.md) - - [Driver Development](driver-development.md) - - [Driver Service Management](driver-service-management.md) - - [Driver Message Mechanism Management](driver-message-mechanism-management.md) - - [Driver Configuration Management](driver-configuration-management.md) - - [HDF Development Example](hdfdevelopment-example.md) - -- [Driver Platform](driver-platform.md) - - [GPIO](gpio.md) - - [GPIO Overview](gpiooverview.md) - - [GPIO Usage Guidelines](gpiousage-guidelines.md) - - [GPIO Usage Example](gpiousage-example.md) - - - [I2C](i2c.md) - - [I2C Overview](i2c-overview.md) - - [I2C Usage Guidelines](i2c-usage-guidelines.md) - - [I2C Usage Example](i2c-usage-example.md) - - - [RTC](rtc.md) - - [RTC Overview](rtc-overview.md) - - [RTC Usage Guidelines](rtc-usage-guidelines.md) - - [RTC Usage Example](rtc-usage-example.md) - - - [SDIO](sdio.md) - - [SDIO Overview](sdiooverview.md) - - [SDIO Usage Guidelines](sdiousage-guidelines.md) - - [SDIO Usage Example](sdiousage-example.md) - - - [SPI](spi.md) - - [SPI Overview](spioverview.md) - - [SPI Usage Guidelines](spiusage-guidelines.md) - - [SPI Usage Example](spiusage-example.md) - - - [UART](uart.md) - - [UART Overview](uartoverview.md) - - [UART Usage Guidelines](uartusage-guidelines.md) - - [UART Usage Example](uartusage-example.md) - - - [WATCHDOG](watchdog.md) - - [Watchdog Overview](watchdogoverview.md) - - [Watchdog Usage Guidelines](watchdogusage-guidelines.md) - - [Watchdog Usage Example](watchdogusage-example.md) - - - [MIPI DSI](mipi-dsi.md) - - [MIPI DSI Overview](mipi-dsi-overview.md) - - [Usage Guidelines](usage-guidelines.md) - - [Usage Example](usage-example.md) - -- [Peripherals](peripherals.md) - - [LCD](lcd.md) - - [LCD Overview](lcdoverview.md) - - [LCD Development Guidelines](lcddevelopment-guidelines.md) - - [LCD Development Example](lcddevelopment-example.md) - - - [TOUCHSCREEN](touchscreen.md) - - [Touchscreen Overview](touchscreenoverview.md) - - [Touchscreen Development Guidelines](touchscreendevelopment-guidelines.md) - - [Touchscreen Development Example](touchscreendevelopment-example.md) - - - [SENSOR](sensor.md) - - [Sensor Driver Overview](sensor-driver-overview.md) - - [Sensor Driver Development Guidelines](sensor-driver-development-guidelines.md) - - [Sensor Driver Development Example](sensor-driver-development-example.md) - - [Sensor Driver Test Guidelines](sensor-driver-test-guidelines.md) - - - [WLAN](wlan.md) - - [WLAN Overview](wlanoverview.md) - - [WLAN Development Guidelines](wlandevelopment-guidelines.md) - - [WLAN Development Example](wlandevelopment-example.md) - +# drivers + +- [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/driver-development.md b/en/device-dev/driver/driver-hdf-development.md similarity index 93% rename from en/device-dev/driver/driver-development.md rename to en/device-dev/driver/driver-hdf-development.md index f9c14ec11f06e6f5c5448751c6967e3de0dac1fa..7d9e91390c07c54b069f1e396d245cb9381d3790 100644 --- a/en/device-dev/driver/driver-development.md +++ b/en/device-dev/driver/driver-hdf-development.md @@ -5,12 +5,12 @@ ## Introduction -The HDF is designed based on the component-based driver model. It provides more refined driver management to make driver development and deployment more standard. Device drivers of the same type are placed in the same host. You can develop and deploy the drivers separately. One driver can have multiple nodes. The following figure shows the HDF driver management model. +The HDF is designed based on the component-based driver model. It provides more refined driver management to make driver development and deployment more standard. Device drivers of the same type are placed in the same host. You can develop and deploy the drivers separately. One driver can have multiple nodes. [Figure 1](#fig5487113011526) shows the HDF driver model. -**Figure 1** HDF driver management model +**Figure 1** HDF driver model -![](figures/en-us_image_0000001054564784.png) +![](figure/en-us_image_0000001054564784.png) ## How to Develop @@ -24,9 +24,9 @@ Driver development based on the HDF consists of two parts: driver implementation ``` #include "hdf_device_desc.h" // Header file that describes the APIs provided by the HDF to the driver. - #include "hdf_log.h" // Header file of the log interface provided by the HDF. + #include "hdf_log.h" // Header file that describes the log APIs provided by the HDF. - #define HDF_LOG_TAG "sample_driver" // Tag contained in logs. If the tag is not specified, HDF_TAG is used by default. + #define HDF_LOG_TAG "sample_driver" // Tag contained in logs. If no tag is not specified, the default HDF_TAG is used. // The driver service interface must be bound to the HDF for you to use the service capability. int32_t HdfSampleDriverBind(struct HdfDeviceObject *deviceObject) @@ -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](driver-configuration-management.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. @@ -123,7 +123,7 @@ Driver development based on the HDF consists of two parts: driver implementation device0 :: deviceNode { // DeviceNode of the sample driver policy = 1; // Driver service release policy. For details, see section Driver Service Management. priority = 100; // Driver startup priority (0-200). A larger value indicates a lower priority. The default value 100 is recommended. If the priorities are the same, the device loading sequence is random. - preload = 0; // On-demand driver loading. For details, see "NOTE" at the end of this section. + preload = 0; // On-demand loading of the driver. For details, see "NOTE" at the end of this section. permission = 0664; // Permission for the driver to create device nodes. moduleName = "sample_driver"; // Driver name. The value of this field must be the same as the value of moduleName in the driver entry structure. serviceName = "sample_service"; // Name of the service released by the driver. The name must be unique. @@ -158,7 +158,7 @@ Driver development based on the HDF consists of two parts: driver implementation ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >On-demand loading and sequential loading are supported. The detailed usage is as follows: >- On-demand loading > ``` @@ -169,7 +169,7 @@ Driver development based on the HDF consists of two parts: driver implementation > DEVICE_PRELOAD_INVALID > } DevicePreload; > ``` -> When the **preload** field in the configuration file is set to **0** \(**DEVICE\_PRELOAD\_ENABLE**\), the driver is loaded by default during system startup. When this field is set to **1** \(**DEVICE\_PRELOAD\_ENABLE\_STEP2**\), the driver is loaded after system startup if quick start is enabled; it is loaded during system startup otherwise. When this field is set to **2** \(**DEVICE\_PRELOAD\_DISABLE**\), the driver is not loaded by default during system startup and can be dynamically loaded later. If the driver service does not exist when a user-level application obtains the driver service \(for details about how to obtain the driver service, see [Driver Message Mechanism Management](driver-message-mechanism-management.md)\), the HDF attempts to dynamically load the driver. +> When the **preload** field in the configuration file is set to **0** \(**DEVICE\_PRELOAD\_ENABLE**\), the driver is loaded by default during system startup. When this field is set to **1** \(**DEVICE\_PRELOAD\_ENABLE\_STEP2**\), the driver is loaded after system startup if quick start is enabled; it is loaded during system startup otherwise. When this field is set to **2** \(**DEVICE\_PRELOAD\_DISABLE**\), the driver is not loaded by default during system startup and can be dynamically loaded later. If the driver service does not exist when a user-level application obtains the driver service \(for details about how to obtain the driver service, see [Driver Message Mechanism Management](drive-hdf-news.md)\), the HDF attempts to dynamically load the driver. >- Sequential loading \(drivers must be loaded by default\) > In the configuration file, the **priority** field \(the value is an integer ranging from 0 to 200\) indicates the priority of the host and driver. For drivers in different hosts, a smaller host priority value indicates a higher driver loading priority; for drivers in the same host, a smaller driver priority value indicates a higher driver loading priority. diff --git a/en/device-dev/driver/driver-configuration-management.md b/en/device-dev/driver/driver-hdf-manage.md similarity index 99% rename from en/device-dev/driver/driver-configuration-management.md rename to en/device-dev/driver/driver-hdf-manage.md index ed33878be0b20585b044940e475784685e7e1c6a..08a88cae19f8c85942cfbe4fe6a6bf73585fda77 100644 --- a/en/device-dev/driver/driver-configuration-management.md +++ b/en/device-dev/driver/driver-hdf-manage.md @@ -29,7 +29,7 @@ The following figure shows the typical application scenario of the HCB mode. **Figure 1** Process of using HCS -![](figures/en-us_image_0000001053405727.png) +![](figure/en-us_image_0000001053405727.png) The HCS is compiled using the HC-GEN tool to generate an HCB file. The HCS Parser module in the HDF recreates a configuration tree using the HCB file. Then, the HDF driver modules obtain the configurations using the API provided by the HCS Paser. @@ -202,7 +202,7 @@ Comments can be formatted as follows: */ ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >Multi-line comments cannot be nested. @@ -330,7 +330,7 @@ root { } ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The **delete** keyword cannot be used in the same HCS file. It is recommended that you delete unnecessary attributes directly from the configuration source code. ## Referencing an Attribute diff --git a/en/device-dev/driver/driver-message-mechanism-management.md b/en/device-dev/driver/driver-hdf-news.md similarity index 99% rename from en/device-dev/driver/driver-message-mechanism-management.md rename to en/device-dev/driver/driver-hdf-news.md index 3ea214d2ade48cb8955cd793fd84aadc2cc38d81..90f70d1aa93f3c0964e923e24b16c9b42c16171a 100644 --- a/en/device-dev/driver/driver-message-mechanism-management.md +++ b/en/device-dev/driver/driver-hdf-news.md @@ -49,7 +49,7 @@ The message mechanism provides the following features: ## How to Develop -1. Set the value of the **policy** field in the driver configuration information to **2** \(SERVICE\_POLICY\_CAPACITY, see [Driver Service Management](driver-service-management.md)\). +1. Set the value of the **policy** field in the driver configuration information to **2** \(SERVICE\_POLICY\_CAPACITY, see [Driver Service Management](drive-hdf-servicemanage.md)\). ``` device_sample :: Device { diff --git a/en/device-dev/driver/hdfoverview.md b/en/device-dev/driver/driver-hdf-overview.md similarity index 100% rename from en/device-dev/driver/hdfoverview.md rename to en/device-dev/driver/driver-hdf-overview.md diff --git a/en/device-dev/driver/hdfdevelopment-example.md b/en/device-dev/driver/driver-hdf-sample.md similarity index 99% rename from en/device-dev/driver/hdfdevelopment-example.md rename to en/device-dev/driver/driver-hdf-sample.md index 815706650b3e69638f9310ace1bdd00b93f71e38..722f9bb4e98bb5c14b30007e710ae3457020e80d 100644 --- a/en/device-dev/driver/hdfdevelopment-example.md +++ b/en/device-dev/driver/driver-hdf-sample.md @@ -229,7 +229,7 @@ int main() } ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The code compilation of user-level applications depends on the dynamic libraries **hdf\_core** and **osal** provided by the HDF because user-level applications use the message sending interface of the HDF. In the GN compilation file, add the following dependency relationships: >deps = \[ >"//drivers/adapter/lite/uhdf/manager:hdf\_core", diff --git a/en/device-dev/driver/driver-service-management.md b/en/device-dev/driver/driver-hdf-servicemanage.md similarity index 100% rename from en/device-dev/driver/driver-service-management.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 0000000000000000000000000000000000000000..cc7e51c2b541100f6d1109886b19bc9b1d9beb63 --- /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/wlanoverview.md b/en/device-dev/driver/driver-peripherals-external-des.md similarity index 56% rename from en/device-dev/driver/wlanoverview.md rename to en/device-dev/driver/driver-peripherals-external-des.md index 1d95ddb0028f2d5136f4e35154e5ff67506172ba..8cb36a1068e3bef6baba7e9c1a8060b4fd9ae588 100644 --- a/en/device-dev/driver/wlanoverview.md +++ b/en/device-dev/driver/driver-peripherals-external-des.md @@ -1,19 +1,24 @@ -# WLAN Overview +# WLAN -- [Introduction](#section23087361515) -- [WLAN Driver API Architecture](#section1533192516212) -- [Available APIs](#section87491484213) +- [Overview](#section729758162218) + - [WLAN Driver API Architecture](#section178022416377) + - [Available APIs](#section149681312202415) -## Introduction +- [Development Guidelines](#section15957746172412) + - [How to Develop](#section11776186132513) + +- [Development Example](#section1395253612512) + +## 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 Driver 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](#fig967034316227): **Figure 1** WLAN framework -![](figures/en-us_image_0000001055299108.png) +![](figure/en-us_image_0000001170383063.png) -## WLAN Driver API Architecture +### WLAN Driver API Architecture The WLAN module provides the following three types of APIs: @@ -26,11 +31,11 @@ The WLAN module provides the following three types of APIs: **Figure 2** Available APIs of the WLAN module -![](figures/接口分布图4.png) +![](figure/接口分布图4.png) -## Available APIs +### 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) provides some 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 @@ -53,7 +58,7 @@ The WLAN driver module provides APIs that can be directly called by driver devel

void WifiModuleDelete(struct WifiModule *module);

-

Deletes and releases data of a WifiModule.

+

Deletes a WifiModule and releases its data.

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

@@ -118,7 +123,7 @@ The WLAN driver module provides APIs that can be directly called by driver devel -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) provides some APIs. +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 @@ -166,7 +171,7 @@ The WLAN driver module provides APIs for driver developers, such as initializing -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) provides some APIs. +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 @@ -227,3 +232,391 @@ The WLAN driver provides the HDI layer with the APIs for creating and destroying +## Development Guidelines + +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\). + +### How to Develop + +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 + +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. + +``` +/* Set parameters in the wlan_platform.hcs file based on hardware attributes. The following is an example of the WLAN platform configuration. */ +hisi :& deviceList { + device0 :: deviceInst { + 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. */ + } + 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. */ + } + } + 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 */ + } + 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 */ + } + } +} +/* Add the configuration file wlan_chip_.hcs (for example, wlan_chip_hi3881.hcs) for each chip and set parameters. The following uses the Hi3881 chip as an example. */ +root { + wlan_config { + hi3881 :& chipList { + chipHi3881 :: chipInst { + match_attr = "hdf_wlan_chips_hi3881"; /* Match attribute */ + chipName = "hi3881"; /* WLAN chip name */ + sdio { + vendorId = 0x0296; /* Vendor ID */ + deviceId = [0x5347]; /* Device ID */ + } + } + } + } +} +``` + +2. Mount the **init** and **deinit** functions of the WLAN chip and WLAN chip driver. + +``` +/* WLAN module initialization and mount process */ +#include "hdf_device_desc.h" +#include "hdf_wifi_product.h" +#include "hdf_log.h" +#include "osal_mem.h" +#include "hdf_wlan_chipdriver_manager.h" +#include "securec.h" +#include "wifi_module.h" +#include "hi_wifi_api.h" +#include "hi_types_base.h" + +#define HDF_LOG_TAG Hi3881Driver + +/* Functions for initializing and deinitializing the WLAN chip */ +int32_t InitHi3881Chip(struct HdfWlanDevice *device); +int32_t DeinitHi3881Chip(struct HdfWlanDevice *device); +/* Functions for initializing and deinitializing the 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. */ +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. */ +static struct HdfChipDriver *BuildHi3881Driver(struct HdfWlanDevice *device, uint8_t ifIndex) +{ + struct HdfChipDriver *specificDriver = NULL; + if (device == NULL) { + HDF_LOGE("%s fail : channel is NULL", __func__); + return NULL; + } + (void)device; + (void)ifIndex; + specificDriver = (struct HdfChipDriver *)OsalMemCalloc(sizeof(struct HdfChipDriver)); + if (specificDriver == NULL) { + HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__); + return NULL; + } + if (memset_s(specificDriver, sizeof(struct HdfChipDriver), 0, sizeof(struct HdfChipDriver)) != EOK) { + HDF_LOGE("%s fail: memset_s fail!", __func__); + OsalMemFree(specificDriver); + return NULL; + } + + if (strcpy_s(specificDriver->name, MAX_WIFI_COMPONENT_NAME_LEN, HI3881_DRIVER_NAME) != EOK) { + HDF_LOGE("%s fail : strcpy_s fail", __func__); + OsalMemFree(specificDriver); + return NULL; + } + specificDriver->init = Hi3881Init; + specificDriver->deinit = Hi3881Deinit; + + HiMac80211Init(specificDriver); + + return specificDriver; +} + +/* Release the WLAN chip driver. */ +static void ReleaseHi3881Driver(struct HdfChipDriver *chipDriver) +{ + if (chipDriver == NULL) { + return; + } + if (strcmp(chipDriver->name, HI3881_DRIVER_NAME) != 0) { + HDF_LOGE("%s:Not my driver!", __func__); + return; + } + OsalMemFree(chipDriver); +} + +static uint8_t GetHi3881GetMaxIFCount(struct HdfChipDriverFactory *factory) { + (void)factory; + return 1; +} + +/* Register functions related to the WLAN chip. */ +static int32_t HDFWlanRegHisiDriverFactory(void) +{ + static struct HdfChipDriverFactory tmpFactory = { 0 }; + struct HdfChipDriverManager *driverMgr = NULL; + driverMgr = HdfWlanGetChipDriverMgr(); + if (driverMgr == NULL && driverMgr->RegChipDriver != NULL) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + tmpFactory.driverName = HI3881_DRIVER_NAME; + tmpFactory.GetMaxIFCount = GetHi3881GetMaxIFCount; + tmpFactory.InitChip = InitHi3881Chip; + tmpFactory.DeinitChip = DeinitHi3881Chip; + tmpFactory.Build = BuildHi3881Driver; + tmpFactory.Release = ReleaseHi3881Driver; + tmpFactory.ReleaseFactory = NULL; + if (driverMgr->RegChipDriver(&tmpFactory) != HDF_SUCCESS) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) +{ + (void)device; + return HDFWlanRegHisiDriverFactory(); +} + +struct HdfDriverEntry g_hdfHisiChipEntry = { + .moduleVersion = 1, + .Init = HdfWlanHisiChipDriverInit, + .moduleName = "HDF_WLAN_CHIPS" +}; + +HDF_INIT(g_hdfHisiChipEntry); +``` + +``` +#include "hdf_wifi_product.h" +#include "hi_wifi_api.h" +#if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) +#include "oal_thread.h" +#include "osal_time.h" +#endif +#include "wifi_mac80211_ops.h" +#include "wal_cfg80211.h" +#include "net_adpater.h" +#include "hdf_wlan_utils.h" + +#define HDF_LOG_TAG Hi3881Driver + +/* Initialize the WLAN chip. */ +int32_t InitHi3881Chip(struct HdfWlanDevice *device) +{ + uint8_t maxPortCount = 1; + int32_t ret = HI_SUCCESS; + uint8_t maxRetryCount = 2; + if (device == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HI_FAIL; + } + + do { + if (ret != HI_SUCCESS) { + if (device->reset != NULL && device->reset->Reset != NULL) { + device->reset->Reset(device->reset); + } + HDF_LOGE("%s:Retry init hi3881!last ret=%d", __func__, ret); + } + ret = hi_wifi_init(maxPortCount); + } while (ret != 0 && --maxRetryCount > 0); + + if (ret != 0) { + HDF_LOGE("%s:Init hi3881 driver failed!", __func__); + return ret; + } + return HI_SUCCESS; +} + +/* Deinitialize the WLAN chip. */ +int32_t DeinitHi3881Chip(struct HdfWlanDevice *device) +{ + (void)device; + int32_t ret = hi_wifi_deinit(); + if (ret != 0) { + HDF_LOGE("%s:Deinit failed!ret=%d", __func__, ret); + } + return ret; +} + +/* Initialize the WLAN chip driver. */ +int32_t Hi3881Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) +{ + HDF_LOGI("%s: start...", __func__); + hi_u16 mode = wal_get_vap_mode(); + int32_t ret; + nl80211_iftype_uint8 type; + (void)chipDriver; + + if (mode >= WAL_WIFI_MODE_BUTT) { + oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); + return HI_FAIL; + } + + if (mode == WAL_WIFI_MODE_STA) { + type = NL80211_IFTYPE_STATION; + } else if (mode == WAL_WIFI_MODE_AP) { + type = NL80211_IFTYPE_AP; + } else { + oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); + return HI_FAIL; + } + + ret = wal_init_drv_wlan_netdev(type, WAL_PHY_MODE_11N, netDevice); + if (ret != HI_SUCCESS) { + oam_error_log2(0, OAM_SF_ANY, "wal_init_drv_netdev %s failed.l_return:%d\n", netDevice->name, ret); + } + return ret; +} + +/* Deinitialize the WLAN chip driver. */ +int32_t Hi3881Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) +{ + (void)chipDriver; + int32_t ret = wal_deinit_drv_wlan_netdev(netDevice); + if (ret != HDF_SUCCESS) { + return ret; + } + return ReleasePlatformNetDevice(netDevice); +} +``` + +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**. + +``` +hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi_char* ifname, hi_u32* len) +{ + oal_net_device_stru *netdev = HI_NULL; + + ...... + /* Initialize the network device and obtain the initialized instance. */ + netdev = NetDeviceInit(ifname, *len, LITE_OS); + oal_wireless_dev *wdev = (oal_wireless_dev *)oal_mem_alloc(OAL_MEM_POOL_ID_LOCAL, sizeof(oal_wireless_dev)); + ret = wal_init_netif(type, netdev, wdev); + + ...... + + return HI_SUCCESS; +} +/* Mount some function pointers of NetDeviceInterFace. */ +oal_net_device_ops_stru g_wal_net_dev_ops = +{ + .getStats = wal_netdev_get_stats, + .open = wal_netdev_open, + .stop = wal_netdev_stop, + .xmit = hmac_bridge_vap_xmit, + .ioctl = wal_net_device_ioctl, + .changeMtu = oal_net_device_change_mtu, + .init = oal_net_device_init, + .deInit = oal_net_free_netdev, +#if (defined(_PRE_WLAN_FEATURE_FLOWCTL) || defined(_PRE_WLAN_FEATURE_OFFLOAD_FLOWCTL)) + .selectQueue = wal_netdev_select_queue, +#endif + .setMacAddr = wal_netdev_set_mac_addr, +#if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) + .netifNotify = HI_NULL, +#endif + .specialEtherTypeProcess = SpecialEtherTypeProcess, +}; + +hi_s32 wal_init_netif(nl80211_iftype_uint8 type, oal_net_device_stru *netdev, const oal_wireless_dev *wdev) +{ + /* Add the network device to a protocol stack. */ + hi_u32 ret = NetDeviceAdd(netdev, (Protocol80211IfType)type); + + ...... + + return HI_SUCCESS; +} +``` + +4. Implement functions of **WifiMac80211Ops**. + +``` +/* Mount some function pointers of mac80211. */ + +/* MAC-layer APIs for basic capabilities that need to be implemented by the driver */ +static struct HdfMac80211BaseOps g_baseOps = { + .SetMode = WalSetMode, + .AddKey = WalAddKey, + .DelKey = WalDelKey, + .SetDefaultKey = WalSetDefaultKey, + .GetDeviceMacAddr = WalGetDeviceMacAddr, + .SetMacAddr = WalSetMacAddr, + .SetTxPower = WalSetTxPower, + .GetValidFreqsWithBand = WalGetValidFreqsWithBand, + .GetHwCapability = WalGetHwCapability +}; + +/* MAC-layer APIs for station capabilities that need to be implemented by the driver */ +static struct HdfMac80211STAOps g_staOps = { + .Connect = WalConnect, + .Disconnect = WalDisconnect, + .StartScan = WalStartScan, + .AbortScan = WalAbortScan, + .SetScanningMacAddress = WalSetScanningMacAddress, +}; + +/* MAC-layer APIs for AP capabilities that need to be implemented by the driver */ +static struct HdfMac80211APOps g_apOps = { + .ConfigAp = WalConfigAp, + .StartAp = WalStartAp, + .StopAp = WalStopAp, + .ConfigBeacon = WalChangeBeacon, + .DelStation = WalDelStation, + .SetCountryCode = WalSetCountryCode, + .GetAssociatedStasCount = WalGetAssociatedStasCount, + .GetAssociatedStasInfo = WalGetAssociatedStasInfo +}; + +/* Initialize mac80211 and mount functions of the chip. */ +hi_void HiMac80211Init(struct HdfChipDriver *chipDriver) +{ + if (chipDriver == NULL) { + oam_error_log(0, OAM_SF_ANY, "%s:input is NULL!", __func__); + return; + } + chipDriver->ops = &g_baseOps; + chipDriver->staOps = &g_staOps; + chipDriver->apOps = &g_apOps; +} +``` + diff --git a/en/device-dev/driver/lcddevelopment-example.md b/en/device-dev/driver/driver-peripherals-lcd-des.md similarity index 64% rename from en/device-dev/driver/lcddevelopment-example.md rename to en/device-dev/driver/driver-peripherals-lcd-des.md index 35122ca4fa69878a8c36e658da23082b0c0084e0..2b8dd1543a584339b768c9bc929ea4287ea43ab4 100644 --- a/en/device-dev/driver/lcddevelopment-example.md +++ b/en/device-dev/driver/driver-peripherals-lcd-des.md @@ -1,4 +1,76 @@ -# LCD Development Example +# LCD + +- [Overview](#section141575391542) + - [API Description](#section14711163785519) + +- [Development Guidelines](#section12394223125615) + - [How to Develop](#section515923045814) + +- [Development Example](#section7441155155813) + +## Overview + +The Liquid Crystal Display \(LCD\) driver powers on the LCD and initializes internal LCD registers through APIs to enable the LCD to work properly. The display driver is developed based on the hardware driver foundation \([HDF](drive-hdf-overview.md)\). It provides power-on, power-off, and sending of the initialization sequence for LCD hardware across OSs and platforms. The display driver model is shown in [Figure 1](#fig69138814229). + +**Figure 1** Architecture of the display driver model +![](figure/architecture-of-the-display-driver-model.png "architecture-of-the-display-driver-model") + +- **Display driver model** + + The display driver model consists of the display common driver layer, SoC adapter layer, and third-party chip driver layer. The display driver model is developed based on the HDF and hides the differences between kernel forms through platform and OSAL APIs so the LCD driver can be migrated between different OSs and chip platforms. The display driver connects to the display common HAL, supports the implementation of Hardware Driver Interfaces \(HDIs\), and provides various driver interfaces for the graphics service through the display HDI. + + - Display common driver layer: connects to the display common HAL through the IOService data channel provided by the HDF to receive and process upper-layer calls in a centralized manner. + + - SoC adapter layer: decouples the display driver from the SoC driver, configures parameters related to the chip platform, and passes calls from the platform driver layer to the LCD driver layer. + + - Third-party chip driver layer: provides LCD-related APIs for sending the LCD initialization sequence, powering on or off the LCD device, and setting the backlight. + + The display driver model, capabilities, and APIs help you simplify the display driver development and improve the efficiency. + + +### API Description + +The LCD interfaces are classified into the Mobile Industry Processor Interface \(MIPI\) Display Serial Interface \(DSI\), Transistor-Transistor Logic \(TTL\) interfaces, and Low Voltage Differential Signaling \(LVDS\) interfaces. The MIPI DSI and TTL interfaces are commonly used. Here is a brief introduction to them. + +- MIPI DSI + + **Figure 2** MIPI DSI + ![](figure/mipi-dsi.png "mipi-dsi") + + The MIPI DSI is defined by MIPI Alliance. It is mainly used for mobile terminal display. The MIPI DSI is used to transmit image data, in compliance with the MIPI protocol. Generally, control information of the MIPI DSI is sent to the peer IC in the form of MIPI packets through the MIPI DSI. No additional interface is required. + +- TTL interface + + **Figure 3** TTL interface + ![](figure/ttl-interface.png "ttl-interface") + + TTL level signals are generated by TTL devices, which are a major type of digital integrated circuits. They are manufactured using the bipolar process and feature high speed, low power consumption, and multiple types. + + The TTL interface is used to transmit data in parallel mode under the control of control signals. It transmits data signals, clock signals, and control signals \(such as line synchronization signals, frame synchronization signals, and data validity signals\). Generally, the LCD of the TTL interface and the read/write of internal registers require additional peripheral interfaces, such as the Serial Peripheral Interface \(SPI\) and Inter-Integrated Circuit \(I2C\). + + +## Development Guidelines + +The display driver model is developed based on the HDF, platform APIs, and APIs at the OS abstraction layer \(OSAL\), and provides a unified driver model for the LCD regardless of the OS \(LiteOS or Linux OS\) and chip platforms \(such as Hi35xx, Hi38xx, and V3S\). + +### How to Develop + +1. Add the LCD driver-related hardware descriptions. +2. Add a driver that adapts to the chip at the SoC adapter layer. +3. Add the LCD panel driver and register the panel driver functions in the driver entry function **Init**. The functions provide capabilities for: + - Powering on/off the LCD device + + Based on the LCD hardware connection, use the GPIO interfaces provided by the platform to perform operations on the LCD pins, such as the reset pin and IOVCC pin. For details about the power-on sequence, see the SPEC provided by the LCD supplier. + + - Sending the initialization sequence + + Based on the LCD hardware interfaces, use the I2C, SPI, and MIPI interfaces provided by the platform to download the LCD initialization sequence. For details, see the SPEC provided by the LCD supplier. + + +4. Implement other HDF interfaces as required, for example, the **Release** interface. +5. Use the HDF to create other device nodes for implementing service logic or debugging as required. + +## Development Example Add the device description. @@ -106,7 +178,7 @@ The following example shows code for developing an LCD driver: #define VERTIACL_SYNC_WIDTH 2 #define FRAME_RATE 60 -/* Panel information structure */ +/* PanelInfo structure */ struct PanelInfo { uint32_t width; uint32_t height; diff --git a/en/device-dev/driver/sensor-driver-overview.md b/en/device-dev/driver/driver-peripherals-sensor-des.md similarity index 43% rename from en/device-dev/driver/sensor-driver-overview.md rename to en/device-dev/driver/driver-peripherals-sensor-des.md index b3d5e86797f93b7c753fdece5fa02adb18f8fbba..5ad5682a94344b9bf86b6d679af80d31318900a6 100644 --- a/en/device-dev/driver/sensor-driver-overview.md +++ b/en/device-dev/driver/driver-peripherals-sensor-des.md @@ -1,22 +1,28 @@ -# Sensor Driver Overview +# Sensor -- [Introduction](#section667413271505) -- [Available APIs](#section7255104114110) +- [Overview](#section3634112111) + - [Available APIs](#section188213414114) -## Introduction +- [Development Guidelines](#section1140943382) + - [How to Develop](#section7893102915819) + +- [Development Example](#section257750691) +- [Test Guidelines](#section106021256121219) + +## Overview The sensor driver module provides APIs for upper-layer sensor services to implement basic sensor capabilities, including querying the sensor list, enabling or disabling a sensor, subscribing to or unsubscribing from sensor data, and setting sensor options. The sensor driver model is developed based on the Hardware Driver Foundation \(HDF\) and supports functions such as cross-OS migration and differentiated device configuration. The following figure shows the architecture of the sensor driver model. **Figure 1** Architecture of the sensor driver model -![](figures/architecture-of-the-sensor-driver-model.png "architecture-of-the-sensor-driver-model") +![](figure/architecture-of-the-sensor-driver-model.png "architecture-of-the-sensor-driver-model") The sensor driver model offers the following APIs: -- Hardware Driver Interfaces \(HDIs\) for sensors: Facilitate service development. -- APIs for implementing sensor driver model capabilities: Implement the capabilities of registering, loading, and unregistering sensor drivers as well as detecting sensor devices depending on the HDF, normalize APIs for sensor devices of the same type, and offer APIs for parsing register configurations, abstract APIs for bus access, and abstract platform APIs. -- APIs to be implemented by developers: Based on the HDF Configuration Source \(HCS\), implement differentiated configuration for sensors of the same type and serialized configuration of sensor device parameters, and offer APIs for some sensor device operations to simplify sensor driver development. +- Hardware Driver Interfaces \(HDIs\) for sensors: These HDIs facilitate service development. +- APIs for implementing sensor driver model capabilities: These APIs implement the capabilities of registering, loading, and unregistering sensor drivers as well as detecting sensor devices depending on the HDF. The APIs include normalized APIs for sensor devices of the same type, APIs for parsing register configurations, abstract APIs for bus access, and abstract platform APIs. +- APIs to be implemented by developers: Based on the HDF Configuration Source \(HCS\), developers can implement differentiated configuration for sensors of the same type and serialized configuration of sensor device parameters. Some sensor device operations can be abstracted as APIs to simplify sensor driver development. -## Available APIs +### Available APIs The following table lists the APIs provided by the sensor driver model. @@ -199,7 +205,7 @@ The following table lists the APIs that need to be implemented by driver develop

int32_t init(void)

-

Initializes the configuration of a sensor device after it is detected successfully.

+

Initializes the configuration of a sensor device after it is detected.

int32_t GetInfo(struct SensorBasicInfo *info)

@@ -240,5 +246,684 @@ The following table lists the APIs that need to be implemented by driver develop -For details about the API implementation, see the [sensor driver development example](sensor-driver-development-example.md). +For details about the API implementation, see [Development Example](#section257750691). + +## Development Guidelines + +Regardless of the OS and system on a chip \(SoC\), the sensor driver is developed based on the HDF, platform, and OSAL APIs to provide a unified driver model for sensor devices. This section uses the acceleration sensor as an example to describe how to develop a sensor driver. + +### How to Develop + +1. Register the acceleration sensor driver. The HDF provides a unified driver management model. The HDF identifies and loads the target module driver based on the configuration of the acceleration sensor module. +2. Initialize and deinitialize the acceleration sensor driver. Using the **init** function, the HDF starts loading the sensor device driver and allocating configuration resources for sensor device data, respectively. Using the **release** function, the HDF releases the resources and configurations loaded by the driver. +3. Parse the configurations of the acceleration sensor register group. For different types of sensors, you must configure their respective HCS configuration files in the HCS, check whether the sensor device is in position during the device driver startup, and then load the corresponding configuration file to generate the configuration structure object. +4. Implement APIs for acceleration sensor driver operations. The driver APIs for various types of sensors, such as **init**, **GetInfo**, **Enable**, **Disable**, **SetBatch**, **SetMode**, **SetOption**, and **ReadSensorData**, are normalized to deliver sensor driver configurations and report sensor data. + +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>The sensor driver model provides a collection of APIs to implement sensor driver capabilities, including the driver device management, abstract bus and platform operation, general configuration, and configuration parsing capabilities. For details about the APIs, see [Table 2](#table1156812588320). You need to implement the following APIs: some operations to perform on sensors \([Table 3](#table1083014911336)\), differentiated data configuration of the sensor HCS, and verification of basic driver functions. + +## 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](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. + +- Implementation of the entry function + +``` +/* Register the entry structure object of the acceleration sensor. */ +struct HdfDriverEntry g_sensorAccelDevEntry = { + .moduleVersion = 1, /* Version of the acceleration sensor module */ + .moduleName = "HDF_SENSOR_ACCEL", /* Name of the acceleration sensor module. The value must be the same as that of moduleName in the device_info.hcs file. */ + .Bind = BindAccelDriver, /* Binding function of the acceleration sensor */ + .Init = InitAccelDriver, /* Initialization function of the acceleration sensor */ + .Release = ReleaseAccelDriver, /* Resource release function of the acceleration sensor */ +}; + +/* Call HDF_INIT to register the driver entry with the HDF. When loading the driver, the HDF calls the Bind function first and then the Init function. If the Init function fails to be called, the HDF will call Release to release the driver resource and exit. +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](driver-hdf-manage.md). + +``` +/* HCS configuration of the acceleration sensor device */ +device_sensor_accel :: device { + device0 :: deviceNode { + policy = 1; /* Policy for providing the driver service */ + priority = 105; /* Driver startup priority (0–200). A larger value indicates a lower priority. The default value 100 is recommended. The sequence for loading devices with the same priority is random. */ + preload = 2; /* Field for specifying whether to load the driver. The value 0 means to load the driver, and 2 means the opposite. */ + permission = 0664; /* Permission for the driver to create device nodes */ + moduleName = "HDF_SENSOR_ACCEL"; /* Driver name. The value must be the same as that of moduleName in the driver entry structure. */ + serviceName = "sensor_accel"; /* Name of the service provided by the driver. The name must be unique. */ + deviceMatchAttr = "hdf_sensor_accel_driver"; /* Keyword matching the private data of the driver. The value must be the same as that of match_attr in the private data configuration table of the driver. */ + } +} +``` + +1. Initialize and deinitialize the acceleration sensor driver. + +- Initialization entry function **init** + +``` +/* Bind the service provided by the acceleration sensor driver to the HDF. */ +int32_t BindAccelDriver(struct HdfDeviceObject *device) +{ + CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); + + static struct IDeviceIoService service = { + .object = {0}, + .Dispatch = DispatchAccel, + }; + device->service = &service; + + return HDF_SUCCESS; +} +/* After detecting that the device is in position, call RegisterAccelChipOps to register the differentiation adaptation function. */ +int32_t RegisterAccelChipOps(struct AccelOpsCall *ops) +{ + struct AccelDrvData *drvData = NULL; + + CHECK_NULL_PTR_RETURN_VALUE(ops, HDF_ERR_INVALID_PARAM); + + drvData = AccelGetDrvData(); + drvData->ops.Init = ops->Init; + drvData->ops.ReadData = ops->ReadData; + return HDF_SUCCESS; +} +/* Hook the acceleration sensor driver normalization function. */ +static int32_t InitAccelOps(struct SensorDeviceInfo *deviceInfo) +{ + struct AccelDrvData *drvData = AccelGetDrvData(); + + (void)memset_s((void *)deviceInfo, sizeof(*deviceInfo), 0, sizeof(*deviceInfo)); + deviceInfo->ops.GetInfo = SetAccelInfo; + deviceInfo->ops.Enable = SetAccelEnable; + deviceInfo->ops.Disable = SetAccelDisable; + deviceInfo->ops.SetBatch = SetAccelBatch; + deviceInfo->ops.SetMode = SetAccelMode; + deviceInfo->ops.SetOption = SetAccelOption; + + if (memcpy_s(&deviceInfo->sensorInfo, sizeof(deviceInfo->sensorInfo), + &drvData->accelCfg->sensorInfo, sizeof(drvData->accelCfg->sensorInfo)) != EOK) { + HDF_LOGE("%s: copy sensor info failed", __func__); + return HDF_FAILURE; + } + /* The sensor type ID can be configured in the HCS configuration file or here. */ + drvData->accelCfg->sensorInfo.sensorTypeId = SENSOR_TAG_ACCELEROMETER; + drvData->accelCfg->sensorInfo.sensorId = SENSOR_TAG_ACCELEROMETER; + + return HDF_SUCCESS; +} +/* Initialize the sensor register. */ +static int32_t InitAccelAfterConfig(void) +{ + struct SensorDeviceInfo deviceInfo; + + if (InitAccelConfig() != HDF_SUCCESS) { + HDF_LOGE("%s: init accel config failed", __func__); + return HDF_FAILURE; + } + + if (InitAccelOps(&deviceInfo) != HDF_SUCCESS) { + HDF_LOGE("%s: init accel ops failed", __func__); + return HDF_FAILURE; + } + + if (AddSensorDevice(&deviceInfo) != HDF_SUCCESS) { + HDF_LOGE("%s: add accel device failed", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} +/* Call the device detection function to hook the differentiated device function. */ +static int32_t DetectAccelChip(void) +{ + int32_t num; + int32_t ret; + int32_t loop; + struct AccelDrvData *drvData = AccelGetDrvData(); + CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); + + num = sizeof(g_accelDetectIfList) / sizeof(g_accelDetectIfList[0]); + for (loop = 0; loop < num; ++loop) { + if (g_accelDetectIfList[loop].DetectChip != NULL) { + ret = g_accelDetectIfList[loop].DetectChip(drvData->accelCfg); + if (ret == HDF_SUCCESS) { + drvData->detectFlag = true; + break; + } + } + } + + if (loop == num) { + HDF_LOGE("%s: detect accel device failed", __func__); + drvData->detectFlag = false; + return HDF_FAILURE; + } + return HDF_SUCCESS; +} +/* The entry function of the acceleration sensor driver is used to initialize the structure object of the sensor private data, allocate space for the HCS data configuration object of the sensor, invoke the entry function for initializing the sensor HCS data configuration, detect whether the sensor device is in position, create the sensor data reporting timer, implement the sensor normalization API, and register the sensor device. */ +int32_t InitAccelDriver(struct HdfDeviceObject *device) +{ + /* Obtain the private data structure object of the sensor. */ + struct AccelDrvData *drvData = AccelGetDrvData(); + + /* When detecting sensors of the same type from different vendors, the function checks whether this type of sensors is in position. If yes, it no longer detects the other sensors of this type and directly returns the result. */ + if (drvData->detectFlag) { + HDF_LOGE("%s: accel sensor have detected", __func__); + return HDF_SUCCESS; + } + + CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); + /* Allocate space for the private data structure objects for storing sensor data configurations. The allocated space needs to be released when the driver is released. */ + drvData->accelCfg = (struct SensorCfgData *)OsalMemCalloc(sizeof(*cfg)); + if (drvData->accelCfg == NULL) { + HDF_LOGE("%s: malloc sensor config data failed", __func__); + return HDF_FAILURE; + } + + drvData->accelCfg->regCfgGroup = &g_regCfgGroup[0]; + /* Initializing the sensor configuration data aims to parse the configuration information of the sensor communication bus, basic sensor information, sensor attributes, whether the sensor is in position, and register group information. */ + if (GetSensorBaseConfigData(device->property, drvData->accelCfg) != HDF_SUCCESS) { + HDF_LOGE("%s: get sensor base config failed", __func__); + goto Base_CONFIG_EXIT; + } + + if (DetectAccelChip() != HDF_SUCCESS) { + HDF_LOGE("%s: accel sensor detect device no exist", __func__); + goto DETECT_CHIP_EXIT; + } + drvData->detectFlag = true; + if (ParseSensorRegConfig(drvData->accelCfg) != HDF_SUCCESS) { + HDF_LOGE("%s: detect sensor device failed", __func__); + goto REG_CONFIG_EXIT; + } + + if (InitAccelAfterConfig() != HDF_SUCCESS) { + HDF_LOGE("%s: init accel after config failed", __func__); + goto INIT_EXIT; + } + + HDF_LOGI("%s: init accel driver success", __func__); + return HDF_SUCCESS; + +INIT_EXIT: + DestroySensorThread(&drvData->thread, &drvData->threadStatus); + (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); +REG_CONFIG_EXIT: + ReleaseSensorAllRegConfig(drvData->accelCfg); + (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); +DETECT_CHIP_EXIT: + drvData->detectFlag = false; +BASE_CONFIG_EXIT: + drvData->accelCfg->root = NULL; + drvData->accelCfg->regCfgGroup = NULL; + OsalMemFree(drvData->accelCfg); + drvData->accelCfg = NULL; + return HDF_FAILURE; +} + +/* Release the resources allocated during driver initialization. */ +void ReleaseAccelDriver(struct HdfDeviceObject *device) +{ + (void)device; + struct AccelDrvData *drvData = NULL; + + drvData = AccelGetDrvData(); + (void)DestroySensorThread(&drvData->thread, &drvData->threadStatus); + (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); + drvData->detectFlag = false; + + if (drvData->accelCfg != NULL) { + drvData->accelCfg->root = NULL; + drvData->accelCfg->regCfgGroup = NULL; + ReleaseSensorAllRegConfig(drvData->accelCfg); + (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); + OsalMemFree(drvData->accelCfg); + drvData->accelCfg = NULL; + } + + drvData->initStatus = false; +} +``` + +1. Configure the acceleration sensor register group. + +You only need to configure the acceleration sensor data according to the template. Template configuration parsing has been implemented via the **InitSensorConfigData** function and only needs to be called during initialization. If new configuration items are added, you need to modify this function accordingly. + +``` +Acceleration sensor data configuration template (accel_config.hcs) +root { + sensorAccelConfig { + accelChipConfig { + /* Sensor information template */ + template sensorInfo { + sensorName = "accelerometer"; /* Acceleration sensor name. The value contains a maximum of 16 bytes. */ + vendorName = "borsh_bmi160"; /* Sensor vendor name. The value contains a maximum of 16 bytes. */ + firmwareVersion = "1.0"; /* Sensor firmware version. The default value is 1.0. The value contains a maximum of 16 bytes. */ + hardwareVersion = "1.0"; /* Sensor hardware version. The default value is 1.0. The value contains a maximum of 16 bytes. */ + sensorTypeId = 1; /* Sensor type ID. For details, see SensorTypeTag. */ + sensorId = 1; /* Sensor ID, which is defined by the sensor driver developer. The SensorTypeTag enums are recommended. */ + maxRange = 8; /* Maximum measurement range of the sensor. Set this parameter based on your business requirements. */ + precision = 0; /* Sensor accuracy, which is used together with sensor data reporting. For details, see SensorEvents. */ + power = 230; /* Power consumption of the sensor */ + } + /* Template of the bus type and configuration information used by the sensor */ + template sensorBusConfig { + busType = 0; /* 0:i2c 1:spi */ + busNum = 6; /* Device ID allocated to the sensor on the chip */ + busAddr = 0; /* Address allocated to the sensor on the chip */ + regWidth = 1; /* Width of the sensor register address */ + regBigEndian = 0; /* Endian mode of the sensor register */ + } + /* Sensor attribute template */ + template sensorAttr { + chipName = ""; /* Sensor chip name */ + chipIdRegister = 0xf; /* Address of the register detecting whether the sensor is in position */ + chipIdValue = 0xd1; /* Value of the register detecting whether the sensor is in position */ + } + } + } +} + +/* You can modify the template configuration based on the differences of sensor devices. If no modification is made, the default template configuration is used. */ +root { + sensorAccelConfig { + accel_bmi160_chip_config : accelChipConfig { + match_attr = "hdf_sensor_accel_driver"; /* The value must be the same as the match_attr field configured for the acceleration sensor. */ + accelInfo :: sensorInfo { + vendorName = "borsh_bmi160"; + sensorTypeId = 1; + sensorId = 1; + } + accelBusConfig :: sensorBusConfig { + busType = 0; /* I2C communication mode */ + busNum = 6; + busAddr = 0x68; + regWidth = 1; /* 1-byte bit width */ + } + accelAttr :: sensorAttr { + chipName = "bmi160"; + chipIdRegister = 0x00; + chipIdValue = 0xd1; + } + accelRegConfig { + /* regAddr: Register address + value: Register value + mask: Mask of the register value + len: Length (in bytes) of the register value + delay: Register delay (in milliseconds) + opsType: Operation type. The options can be 0 (no operation), 1 (read), 2 (write), 3 (read and check), and 4 (bit update). + calType: Calculation type. The options can be 0 (none), 1 (write), 2 (negate), 3 (XOR) 4, (left shift), and 5 (right shift). + shiftNum: Number of shifts + debug: Debugging switch. The value can be 0 (disabled) or 1 (enabled). + save: Data saving switch. The value can be 0 (not save data) or 1 (save data). + */ + /* Groups of sensor register operations. Registers can be configured in sequence based on the groups. */ + /* Register address, register value, mask of the register value, data length of the register value, register delay, operation type, calculation type, number of shifts, debugging switch, data saving switch */ + /* Initialize the register groups. */ + initSeqConfig = [ + 0x7e, 0xb6, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + /* Enable the register groups. */ + enableSeqConfig = [ + 0x7e, 0x11, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x41, 0x03, 0xff, 1, 0, 2, 0, 0, 0, 0, + 0x40, 0x08, 0xff, 1, 0, 2, 0, 0, 0, 0 + ]; + /* Disable the register groups. */ + disableSeqConfig = [ + 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + } + } + } +} +``` + +1. Implement APIs for acceleration sensor driver operations. + +You need to implement normalized APIs based on sensor types. + +``` +/* Leave a function empty if it is not used. */ +static int32_t SetAccelInfo(struct SensorBasicInfo *info) +{ + (void)info; + + return HDF_ERR_NOT_SUPPORT; +} +/* Deliver the configuration of enabling the register groups. */ +static int32_t SetAccelEnable(void) +{ + int32_t ret; + struct AccelDrvData *drvData = AccelGetDrvData(); + + CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); + ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_ENABLE_GROUP]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel sensor disable config failed", __func__); + return HDF_FAILURE; + } + + drvData->threadStatus = SENSOR_THREAD_RUNNING; + + return HDF_SUCCESS; +} +/* Deliver the configuration of disabling the register groups. */ +static int32_t SetAccelDisable(void) +{ + int32_t ret; + struct AccelDrvData *drvData = AccelGetDrvData(); + + CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); + + ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_DISABLE_GROUP]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel sensor disable config failed", __func__); + return HDF_FAILURE; + } + + drvData->threadStatus = SENSOR_THREAD_STOPPED; + + return HDF_SUCCESS; +} +/* Set the sampling interval and data reporting interval of the sensor. */ +static int32_t SetAccelBatch(int64_t samplingInterval, int64_t interval) +{ + (void)interval; + + struct AccelDrvData *drvData = AccelGetDrvData(); + drvData->interval = samplingInterval; + + return HDF_SUCCESS; +} +/* Set the data reporting mode of the sensor. Currently, the real-time mode is supported. */ +static int32_t SetAccelMode(int32_t mode) +{ + return (mode == SENSOR_WORK_MODE_REALTIME) ? HDF_SUCCESS : HDF_FAILURE; +} +/* Set the sensor options. */ +static int32_t SetAccelOption(uint32_t option) +{ + (void)option; + return HDF_ERR_NOT_SUPPORT; +} +``` + +- Differentiated processing APIs + + ``` + /* If a device is detected, register the differentiated processing function to the accel driver model. */ + int32_t DetectAccelBim160Chip(struct SensorCfgData *data) + { + int32_t ret; + struct AccelOpsCall ops; + CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); + + if (strcmp(ACCEL_CHIP_NAME_BMI160, data->sensorAttr.chipName) != 0) { + return HDF_SUCCESS; + } + ret = InitAccelPreConfig(); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: init BMI160 bus mux config", __func__); + return HDF_FAILURE; + } + if (DetectSensorDevice(data) != HDF_SUCCESS) { + return HDF_FAILURE; + } + + /* Differentiated processing function */ + ops.Init = InitBmi160; + ops.ReadData = ReadBmi160Data; + ret = RegisterAccelChipOps(&ops); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: register BMI160 accel failed", __func__); + (void)ReleaseSensorBusHandle(&data->busCfg); + return HDF_FAILURE; + } + return HDF_SUCCESS; + } + /* Initialization processing function */ + static int32_t InitBmi160(struct SensorCfgData *data) + { + int32_t ret; + + CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); + ret = SetSensorRegCfgArray(&data->busCfg, data->regCfgGroup[SENSOR_INIT_GROUP]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: bmi160 sensor init config failed", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; + } + /* Data processing function */ + int32_t ReadBmi160Data(struct SensorCfgData *data) + { + int32_t ret; + struct AccelData rawData = { 0, 0, 0 }; + int32_t tmp[ACCEL_AXIS_NUM]; + struct SensorReportEvent event; + + (void)memset_s(&event, sizeof(event), 0, sizeof(event)); + + ret = ReadBmi160RawData(data, &rawData, &event.timestamp); + if (ret != HDF_SUCCESS) { + return HDF_FAILURE; + } + + event.sensorId = SENSOR_TAG_ACCELEROMETER; + event.option = 0; + event.mode = SENSOR_WORK_MODE_REALTIME; + + rawData.x = rawData.x * BMI160_ACC_SENSITIVITY_2G; + rawData.y = rawData.y * BMI160_ACC_SENSITIVITY_2G; + rawData.z = rawData.z * BMI160_ACC_SENSITIVITY_2G; + + tmp[ACCEL_X_AXIS] = (rawData.x * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; + tmp[ACCEL_Y_AXIS] = (rawData.y * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; + tmp[ACCEL_Z_AXIS] = (rawData.z * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; + + event.dataLen = sizeof(tmp); + event.data = (uint8_t *)&tmp; + ret = ReportSensorEvent(&event); + return ret; + } + ``` + +- Data processing function + +Create a sensor timer to periodically sample data based on the configured sampling interval and report the data to the data subscriber. + +``` +/* Scheduled working thread of the sensor */ +static int32_t ReadAccelDataThreadWorker(void *arg) +{ + (void)arg; + int64_t interval; + struct AccelDrvData *drvData = AccelGetDrvData(); + + drvData->threadStatus = SENSOR_THREAD_START; + while (true) { + if (drvData->threadStatus == SENSOR_THREAD_RUNNING) { + if (drvData->ops.ReadData != NULL) { + (void)drvData->ops.ReadData(drvData->accelCfg); + } + interval = OsalDivS64(drvData->interval, (SENSOR_CONVERT_UNIT * SENSOR_CONVERT_UNIT)); + OsalMSleep(interval); + } else if (drvData->threadStatus == SENSOR_THREAD_DESTROY) { + break; + } else { + OsalMSleep(ACC_DEFAULT_SAMPLING_200_MS / SENSOR_CONVERT_UNIT / SENSOR_CONVERT_UNIT); + } + + if ((!drvData->initStatus) || (drvData->interval < 0) || drvData->threadStatus != SENSOR_THREAD_RUNNING) { + continue; + } + } + + return HDF_SUCCESS; +} +/* Create a sensor timer and initialize the sensor device. */ +static int32_t InitAccelConfig(void) +{ + int32_t ret; + struct AccelDrvData *drvData = AccelGetDrvData(); + + if (drvData->threadStatus != SENSOR_THREAD_NONE && drvData->threadStatus != SENSOR_THREAD_DESTROY) { + HDF_LOGE("%s: accel thread have created", __func__); + return HDF_SUCCESS; + } + + ret = CreateSensorThread(&drvData->thread, ReadAccelDataThreadWorker, "hdf_sensor_accel", drvData); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel create thread failed", __func__); + drvData->threadStatus = SENSOR_THREAD_NONE; + return HDF_FAILURE; + } + + CHECK_NULL_PTR_RETURN_VALUE(drvData->ops.Init, HDF_ERR_INVALID_PARAM); + + ret = drvData->ops.Init(drvData->accelCfg); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel create thread failed", __func__); + drvData->threadStatus = SENSOR_THREAD_NONE; + return HDF_FAILURE; + } + drvData->initStatus = true; + return HDF_SUCCESS; +} +``` + +- Major data structures + +``` +/* Sensor conversion units */ +#define SENSOR_CONVERT_UNIT 1000 +#define SENSOR_1K_UNIT 1024 +/* Sensitivity conversion value of the sensor with a 2g measurement range */ +#define BMI160_ACC_SENSITIVITY_2G 61 +/* Address of the sensor data sampling register */ +#define BMI160_ACCEL_X_LSB_ADDR 0X12 +#define BMI160_ACCEL_X_MSB_ADDR 0X13 +#define BMI160_ACCEL_Y_LSB_ADDR 0X14 +#define BMI160_ACCEL_Y_MSB_ADDR 0X15 +#define BMI160_ACCEL_Z_LSB_ADDR 0X16 +#define BMI160_ACCEL_Z_MSB_ADDR 0X17 +/* Data dimension of the sensor */ +enum AccelAxisNum { + ACCEL_X_AXIS = 0, + ACCEL_Y_AXIS = 1, + ACCEL_Z_AXIS = 2, + ACCEL_AXIS_NUM = 3, +}; +/* Each dimension of the sensor */ +struct AccelData { + int32_t x; + int32_t y; + int32_t z; +}; +/* Private data structure of the sensor */ +struct AccelDrvData { + bool detectFlag; + uint8_t threadStatus; + uint8_t initStatus; + int64_t interval; + struct SensorCfgData *accelCfg; + struct OsalThread thread; + struct AccelOpsCall ops; +}; +/* Differentiation adaptation function */ +struct AccelOpsCall { + int32_t (*Init)(struct SensorCfgData *data); + int32_t (*ReadData)(struct SensorCfgData *data); +}; +``` + +## Test Guidelines + +After the driver is developed, you can develop self-test cases in the sensor unit test to verify the basic functions of the driver. The developer self-test platform is used as the test environment. + +``` +/* Specify whether to report sensor data. */ +static int32_t g_sensorDataFlag = 0; +/* Retain the address of the sensor interface instance. */ +static const struct SensorInterface *g_sensorDev = nullptr; + +/* Register the data reporting function. */ +static int SensorTestDataCallback(struct SensorEvents *event) +{ + if (event == nullptr) { + return -1; + } + float *data = (float*)event->data; + printf("time [%lld] sensor id [%d] x-[%f] y-[%f] z-[%f]\n\r", event->timestamp, + event->sensorId, (*data), *(data + 1), *(data + g_axisZ)); + if (*data > 1e-5) { + g_sensorDataFlag = 1; + } + return 0; +} +/* Initialize the sensor interface instance before executing the test cases. */ +void HdfSensorTest::SetUpTestCase() +{ + g_sensorDev = NewSensorInterfaceInstance(); + if (g_sensorDev == nullptr) { + printf("test sensorHdi get Module instace failed\n\r"); + } +} +/* Release case resources. */ +void HdfSensorTest::TearDownTestCase() +{ + if (g_sensorDev != nullptr) { + FreeSensorInterfaceInstance(); + g_sensorDev = nullptr; + } +} +/* Verify the sensor driver. */ +HWTEST_F(HdfSensorTest,TestAccelDriver_001, TestSize.Level0) +{ + int32_t sensorInterval = 1000000000; /* Data sampling interval, in nanoseconds */ + int32_t pollTime = 5; /* Data sampling duration, in seconds */ + int32_t accelSensorId = 1; /* Acceleration sensor type ID, which is 1 */ + int32_t count = 0; + int ret; + struct SensorInformation *sensorInfo = nullptr; + + ret = g_sensorDev->Register(SensorTestDataCallback) + EXPECT_EQ(SENSOR_NULL_PTR, ret); + + ret = g_sensorDev->GetAllSensors(&sensorInfo, &count); + EXPECT_EQ(0, ret); + if (sensorInfo == nullptr) { + EXPECT_NE(nullptr, sensorInfo); + return; + } + /* Print the obtained sensor list. */ + for (int i = 0; i < count; i++) { + printf("get sensoriId[%d], info name[%s]\n\r", sensorInfo[i]->sensorId, sensorInfo[i]->sensorName); + } + ret = g_sensorDev->Enable(accelSensorId); + EXPECT_EQ(0, ret); + g_sensorDataFlag = 0; + + ret = g_sensorDev->SetBatch(accelSensorId, sensorInterval, pollTime); + EXPECT_EQ(0, ret); + /* Observe the printed data within the period specified by pollTime. */ + OsalSleep(pollTime); + EXPECT_EQ(1, g_sensorDataFlag); + + ret = g_sensorDev->Disable(accelSensorId); + g_sensorDataFlag = 0; + EXPECT_EQ(0, ret); + + ret = g_sensorDev->Unregister(); + EXPECT_EQ(0, ret); +} +``` diff --git a/en/device-dev/driver/touchscreendevelopment-example.md b/en/device-dev/driver/driver-peripherals-touch-des.md similarity index 57% rename from en/device-dev/driver/touchscreendevelopment-example.md rename to en/device-dev/driver/driver-peripherals-touch-des.md index 8d49343af5e1b1c2e1aaaa1fc113d75f2dc8a540..f4bfd35be3cf06492694b92bf2b7711e703a409e 100644 --- a/en/device-dev/driver/touchscreendevelopment-example.md +++ b/en/device-dev/driver/driver-peripherals-touch-des.md @@ -1,14 +1,124 @@ -# Touchscreen Development Example +# TOUCHSCREEN -- [Device Description Configuration](#section85281142102317) -- [Board-level Hardware Configuration and Private Data Configuration](#section189081946192410) -- [Adding the Touchscreen Driver](#section19856687253) +- [Overview](#section175431838101617) + - [Available APIs](#section17667171301711) + +- [Development Guidelines](#section65745222184) + - [How to Develop](#section865734181916) + +- [Development Example](#section263714411191) + - [Add the touchscreen driver-related descriptions.](#section18249155619195) + - [Board-level Hardware Configuration and Private Data Configuration](#section3571192072014) + - [Adding the Touchscreen Driver](#section6356758162015) + + +## Overview + +- **Functions of the Touchscreen driver** + + The Touchscreen driver is used to power on its integrated circuit \(IC\), configure and initialize hardware pins, register interrupts, configure Inter-Integrated Circuit \(I2C\) or SPI APIs, set input-related configurations, and download and update firmware. + + +- **Layers of the Touchscreen driver** + + This section describes how to develop the touchscreen driver based on the input driver model. [Figure 1](#fig6251184817261) shows an overall architecture of the touchscreen driver. + + The input driver is developed based on the hardware driver foundation \(HDF\), platform APIs, and operating system abstraction layer \(OSAL\) APIs. It provides hardware driver capabilities through the input Hardware Driver Interfaces \(HDIs\) for upper-layer input services to control the touchscreen. + + +**Figure 1** Architecture of the input driver model +![](figure/architecture-of-the-input-driver-model.png "architecture-of-the-input-driver-model") + +- **Input driver model** + + The input driver model mainly consists of the device manager, common drivers, and chip drivers. The platform data channel provides capabilities for sending data generated by the touchscreen from the kernel to the user space. The driver model adapts to different touchscreen devices and hardware platforms via the configuration file, improving the efficiency of the touchscreen development. The description for each part of the input driver model is as follows: + + - Input device manager: provides input device drivers with the APIs for registering or unregistering input devices and manages the input device list. + + - Input common driver: provides common abstract drivers \(such as the touchscreen common driver\) of various input devices for initializing the board-level hardware, processing hardware interrupts, and registering input devices with the input device manager. + + - Input chip driver: provides different chip drivers of each vendor. You can minimize the workload for the input chip driver development by calling differentiated APIs reserved by the input platform driver. + + - Event hub: provides a unified data reporting channel, which enables input devices to report input events. + + - HDF input config: parses and manages the board-level configuration as well as the private configuration of input devices. + + +- **Advantages of developing drivers based on the HDF** + + 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 + +Based on the attributes of the pins, interfaces on the touchscreens can be classified into the following types: + +- Power interfaces +- I/O control interfaces +- Communications interfaces + +**Figure 2** Common pins of the touchscreen +![](figure/common-pins-of-the-touchscreen.png "common-pins-of-the-touchscreen") + +The interfaces shown in the figure are described as follows: + +1. **Power interfaces** + - LDO\_1P8: 1.8 V digital circuits + - LDO\_3P3: 3.3 V analog circuits + + Generally, the touchscreen driver IC is separated from the LCD driver IC. In this case, the touchscreen driver IC requires both 1.8 V and 3.3 V power supplies. Nowadays, the touchscreen driver IC and LCD driver IC can be integrated. Therefore, the touchscreen, requires only the 1.8 V power supply, and the 3.3 V power required internally is supplied by the LCD VSP power \(typical value: 5.5 V\) in the driver IC. + + +2. **I/O control interfaces** + - RESET: reset pin, which is used to reset the driver IC on the host when suspending or resuming the system. + - INT: interrupt pin, which needs to be set to the input direction and pull-up status during driver initialization. After detecting an external touch signal, the driver triggers the interrupt by operating the interrupt pin. The driver reads the touch reporting data in the ISR function. + +3. **Communications interfaces** + - I2C: Since only a small amount of touch data is reported by the touchscreen, I2C is used to transmit the reported data. For details about the I2C protocol and interfaces, see [I2C](drive-platform-i2c-des.md#section1695201514281). + - SPI: In addition to touch reporting data coordinates, some vendors need to obtain basic capacitance data. Therefore, Serial Peripheral Interface \(SPI\) is used to transmit such huge amount of data. For details about the SPI protocol and interfaces, see [SPI](drive-platform-spi-des.md#section71363452477). + + +## Development Guidelines + +Regardless of the OS and system on a chip \(SoC\), the input driver is developed based on the HDF, platform, and OSAL APIs to provide a unified driver model for touchscreen devices. + +- The following uses the touchscreen driver as an example to describe the loading process of the input driver model: + + \(1\) Complete the device description configuration, such as the loading priority, board-level hardware information, and private data, by referring to the existing template. + + \(2\) Load the input device management driver. The input management driver is loaded automatically by the HDF to create and initialize the device manager. + + \(3\) Load the platform driver. The platform driver is loaded automatically by the HDF to parse the board-level configuration, initialize the hardware, and provide the API for registering the touchscreen. + + \(4\) Load the touchscreen driver. The touchscreen driver is loaded automatically by the HDF to instantiate the touchscreen device, parse the private data, and implement differentiated APIs provided by the platform. + + \(5\) Register the instantiated touchscreen device with the platform driver. Then bind this device to the platform driver, and complete touchscreen initialization such as interrupt registration and power-on and power-off. + + \(6\) Instantiate the input device and register it with the input manager after the touchscreen is initialized. + + +### How to Develop + +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](driver-hdf-development.md#section1969312275533). + +2. Complete the board-level configuration and private data configuration of the touchscreen. + + Configure the required I/O pins. For example, configure a register for the I2C pin reserved for the touchscreen to use I2C for transmitting data. + +3. Implement differentiated adaptation APIs of the touchscreen. + + Use the platform APIs to perform operations for the reset pins, interrupt pins, and power based on the communications interfaces designed for boards. For details about the GPIO-related operations, see [GPIO](drive-platform-gpio-des.md#section259614242196). + + +## Development Example This example describes how to develop the touchscreen driver. -## Device Description Configuration +### 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](driver-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 { @@ -51,9 +161,9 @@ input :: host { } ``` -## Board-level Hardware Configuration and Private Data Configuration +### Board-level Hardware Configuration and Private Data Configuration -The following describes the configuration of the board-level hardware and private data of the touchscreen. You can modify the configuration based on the service requirements. +The following describes the configuration of the board-level hardware and private data of the touchscreen. You can modify the configuration based on service requirements. ``` root { @@ -140,7 +250,7 @@ root { } ``` -## Adding the Touchscreen Driver +### Adding the Touchscreen Driver The following example shows how to implement the differentiated APIs provided by the platform driver to obtain and parse the touchscreen data. You can adjust the development process based on the board and touchscreen in use. diff --git a/en/device-dev/driver/driver-peripherals.md b/en/device-dev/driver/driver-peripherals.md new file mode 100644 index 0000000000000000000000000000000000000000..02e7a9e357a6eb7484f8a0eea5a486c3a90b396a --- /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/gpiousage-guidelines.md b/en/device-dev/driver/driver-platform-gpio-des.md similarity index 57% rename from en/device-dev/driver/gpiousage-guidelines.md rename to en/device-dev/driver/driver-platform-gpio-des.md index 67c29e26454fde7b66ef285e993d01d08f09d8ba..045a23db3e998a174fd191525fd04742b9ca86a8 100644 --- a/en/device-dev/driver/gpiousage-guidelines.md +++ b/en/device-dev/driver/driver-platform-gpio-des.md @@ -1,23 +1,108 @@ -# GPIO Usage Guidelines - -- [How to Use](#section1583613406410) -- [Determining a GPIO Pin Number](#section135943361443) -- [Using APIs to Operate GPIO Pins](#section69151114115315) - -## How to Use +# GPIO + +- [Overview](#section1635911016188) + - [Available APIs](#section17715915181611) + +- [Usage Guidelines](#section259614242196) + - [How to Use](#section103477714216) + - [Determining a GPIO Pin Number](#section370083272117) + - [Using APIs to Operate GPIO Pins](#section13604050132118) + +- [Usage Example](#section25941262111) + +## Overview + +Generally, a general-purpose input/output \(GPIO\) controller manages all GPIO pins by group. Each group of GPIO pins is associated with one or more registers. The GPIO pins are operated by reading data from and writing data to the registers. + +The GPIO APIs define a set of standard functions for performing operations on GPIO pins, including: + +- Setting the pin direction, which can be input or output \(High impedance is not supported currently.\) + +- Reading and writing level values, which can be low or high +- Setting an interrupt service routine \(ISR\) function and interrupt trigger mode for a pin +- Enabling or disabling a pin interrupt + +### Available APIs + +**Table 1** APIs available for the GPIO driver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

GPIO read/write

+

GpioRead

+

Reads the level value of a GPIO pin.

+

GpioWrite

+

Writes the level value of a GPIO pin.

+

GPIO settings

+

GpioSetDir

+

Sets the direction for a GPIO pin.

+

GpioGetDir

+

Obtains the direction for a GPIO pin.

+

GPIO interrupt settings

+

GpioSetIrq

+

Sets the ISR function for a GPIO pin.

+

GpioUnSetIrq

+

Cancels the setting of the ISR function for a GPIO pin.

+

GpioEnableIrq

+

Enables a GPIO interrupt.

+

GpioDisableIrq

+

Disables a GPIO interrupt.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions provided in this document can be called only in kernel mode. + +## Usage Guidelines + +### How to Use The GPIO APIs use the GPIO pin number to specify a pin. [Figure 1](#fig1399416053717) shows the general process of using a GPIO. **Figure 1** Process of using a GPIO -![](figures/en-us_image_0000001057342245.png) +![](figure/en-us_image_0000001170187071.png) -## Determining a GPIO Pin Number +### Determining a GPIO Pin Number The method for converting GPIO pin numbers varies according to the GPIO controller model, parameters, and controller driver of different system on chips \(SoCs\). -- Hi3516D V300 +- Hi3516DV300 A controller manages 12 groups of GPIO pins. Each group contains 8 GPIO pins. @@ -25,7 +110,7 @@ The method for converting GPIO pin numbers varies according to the GPIO controll Example: GPIO number of GPIO10\_3 = 10 x 8 + 3 = 83 -- Hi3518E V300 +- Hi3518EV300 A controller manages 10 groups of GPIO pins. Each group contains 10 GPIO pins. @@ -34,7 +119,7 @@ The method for converting GPIO pin numbers varies according to the GPIO controll Example: GPIO pin number of GPIO7\_3 = 7 x 10 + 3 = 73 -## Using APIs to Operate GPIO Pins +### Using APIs to Operate GPIO Pins - Set the direction for a GPIO pin. @@ -42,12 +127,12 @@ The method for converting GPIO pin numbers varies according to the GPIO controll int32\_t GpioSetDir\(uint16\_t gpio, uint16\_t dir\); - **Table 1** Description of GpioSetDir + **Table 2** Description of GpioSetDir -

Parameter

+ - - - - -

Parameter

Description

+

Description

gpio

@@ -60,36 +145,37 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

Direction to set.

Return Value

+

Return Value

Description

+

Description

0

The setting is successful.

+

Succeeded in setting the direction for a GPIO pin.

Negative value

The setting failed.

+

Failed to set the direction for a GPIO pin.

+ - Read or write the level value for a GPIO pin. To read the level value of a GPIO pin, call the following function: int32\_t GpioRead\(uint16\_t gpio, uint16\_t \*val\); - **Table 2** Description of GpioRead + **Table 3** Description of GpioRead -

Parameter

+ - - -

Parameter

Description

+

Description

gpio

@@ -102,9 +188,9 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

Pointer to the level value.

Return Value

+

Return Value

Description

+

Description

0

@@ -124,12 +210,12 @@ The method for converting GPIO pin numbers varies according to the GPIO controll int32\_t GpioWrite\(uint16\_t gpio, uint16\_t val\); - **Table 3** Description of GpioWrite + **Table 4** Description of GpioWrite -

Parameter

+ - - -

Parameter

Description

+

Description

gpio

@@ -142,9 +228,9 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

Level value to write.

Return Value

+

Return Value

Description

+

Description

0

@@ -194,12 +280,12 @@ The method for converting GPIO pin numbers varies according to the GPIO controll int32\_t GpioSetIrq\(uint16\_t gpio, uint16\_t mode, GpioIrqFunc func, void \*arg\); - **Table 4** Description of GpioSetIrq + **Table 5** Description of GpioSetIrq -

Parameter

+ - - - - -

Parameter

Description

+

Description

gpio

@@ -222,37 +308,37 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

Pointer to the parameters passed to the ISR function.

Return Value

+

Return Value

Description

+

Description

0

The setting is successful.

+

Succeeded in setting the ISR function for a GPIO pin.

Negative value

The setting failed.

+

Failed to set the ISR function for a GPIO pin.

- >![](public_sys-resources/icon-caution.gif) **CAUTION:** + >![](../public_sys-resources/icon-caution.gif) **CAUTION:** >Only one ISR function can be set for a GPIO pin at a time. If **GpioSetIrq** is called repeatedly, the previous IRS function will be replaced. If the ISR function is no longer required, call the following function to cancel the setting: int32\_t GpioUnSetIrq\(uint16\_t gpio\); - **Table 5** Description of GpioUnSetIrq + **Table 6** Description of GpioUnSetIrq -

Parameter

+ - - - -

Parameter

Description

+

Description

gpio

@@ -260,14 +346,14 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

GPIO pin number.

Return Value

+

Return Value

Description

+

Description

0

The ISR function is canceled.

+

Succeeded in canceling the ISR function.

Negative value

@@ -282,12 +368,12 @@ The method for converting GPIO pin numbers varies according to the GPIO controll int32\_t GpioEnableIrq\(uint16\_t gpio\); - **Table 6** Description of GpioEnableIrq + **Table 7** Description of GpioEnableIrq -

Parameter

+ - - - -

Parameter

Description

+

Description

gpio

@@ -295,14 +381,14 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

GPIO pin number.

Return Value

+

Return Value

Description

+

Description

0

The GPIO interrupt is enabled.

+

Succeeded in enabling a GPIO interrupt.

Negative value

@@ -313,19 +399,19 @@ The method for converting GPIO pin numbers varies according to the GPIO controll
- >![](public_sys-resources/icon-caution.gif) **CAUTION:** - >The configured ISR function can be responded only after the ISR function is enabled. + >![](../public_sys-resources/icon-caution.gif) **CAUTION:** + >The configured ISR function can be responded only after the GPIO interrupt is enabled. Use the following function to disable the GPIO interrupt: int32\_t GpioDisableIrq\(uint16\_t gpio\); - **Table 7** Description of GpioDisableIrq + **Table 8** Description of GpioDisableIrq -

Parameter

+ - - - - - @@ -393,3 +479,82 @@ The method for converting GPIO pin numbers varies according to the GPIO controll ``` +## Usage Example + +In this example, we test the interrupt trigger of a GPIO pin as follows: Set the ISR function for the pin, set the trigger mode to rising edge and failing edge, write high and low levels to the pin alternately to generate level fluctuation, and observe the execution of the ISR function. + +Select an idle GPIO pin. This example uses a Hi3516D V300 development board and GPIO pin GPIO10\_3, which is numbered GPIO83. + +You can select an idle GPIO pin based on the development board and schematic diagram. + +``` +#include "gpio_if.h" +#include "hdf_log.h" +#include "osal_irq.h" +#include "osal_time.h" + +static uint32_t g_irqCnt; + +/* ISR function */ +static int32_t TestCaseGpioIrqHandler(uint16_t gpio, void *data) +{ + HDF_LOGE("%s: irq triggered! on gpio:%u, data=%p", __func__, gpio, data); + g_irqCnt++; /* If the ISR function is triggered, the number of global interrupts is incremented by 1. */ + return GpioDisableIrq(gpio); +} + +/* Test case function */ +static int32_t TestCaseGpioIrqEdge(void) +{ + int32_t ret; + uint16_t valRead; + uint16_t mode; + uint16_t gpio = 83; /* Number of the GPIO pin to test */ + uint32_t timeout; + + /* Set the output direction for the pin. */ + ret = GpioSetDir(gpio, GPIO_DIR_OUT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set dir fail! ret:%d\n", __func__, ret); + return ret; + } + + /* Disable the interrupt of the pin. */ + ret = GpioDisableIrq(gpio); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: disable irq fail! ret:%d\n", __func__, ret); + return ret; + } + + /* Set the ISR function for the pin. The trigger mode is both rising edge and falling edge. */ + mode = OSAL_IRQF_TRIGGER_RISING | OSAL_IRQF_TRIGGER_FALLING; + HDF_LOGE("%s: mode:%0x\n", __func__, mode); + ret = GpioSetIrq(gpio, mode, TestCaseGpioIrqHandler, NULL); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set irq fail! ret:%d\n", __func__, ret); + return ret; + } + + /* Enable the interrupt for this pin. */ + ret = GpioEnableIrq(gpio); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: enable irq fail! ret:%d\n", __func__, ret); + (void)GpioUnSetIrq(gpio); + return ret; + } + + g_irqCnt = 0; /* Reset the global counter. */ + timeout = 0; /* Reset the waiting time. */ + /* Wait for the ISR function of this pin to trigger. The timeout duration is 1000 ms. */ + while (g_irqCnt <= 0 && timeout < 1000) { + (void)GpioRead(gpio, &valRead); + (void)GpioWrite(gpio, (valRead == GPIO_VAL_LOW) ? GPIO_VAL_HIGH : GPIO_VAL_LOW); + HDF_LOGE("%s: wait irq timeout:%u\n", __func__, timeout); + OsalMDelay(200); /* wait for irq trigger */ + timeout += 200; + } + (void)GpioUnSetIrq(gpio); + return (g_irqCnt > 0) ? HDF_SUCCESS : HDF_FAILURE; +} +``` + diff --git a/en/device-dev/driver/i2c-usage-guidelines.md b/en/device-dev/driver/driver-platform-i2c-des.md similarity index 37% rename from en/device-dev/driver/i2c-usage-guidelines.md rename to en/device-dev/driver/driver-platform-i2c-des.md index 9a207bcc3878e779d7345ae5b14b18b0b4cdc46b..7b70a9fbd022795d0bdbfd142626fdeecf61346d 100644 --- a/en/device-dev/driver/i2c-usage-guidelines.md +++ b/en/device-dev/driver/driver-platform-i2c-des.md @@ -1,31 +1,94 @@ -# I2C Usage Guidelines +# I2C -- [How to Use](#section333203315215) -- [Opening an I2C Controller](#section123631358135713) -- [Performing I2C Communication](#section11091522125812) -- [Closing an I2C Controller](#section13519505589) +- [Overview](#section5361140416) + - [Available APIs](#section459052019177) -## How to Use +- [Usage Guidelines](#section1695201514281) + - [How to Use](#section1338373417288) + - [Opening an I2C Controller](#section13751110132914) + - [Performing I2C Communication](#section9202183372916) + - [Closing an I2C Controller](#section19481164133018) -[Figure 1](#fig166181128151112) illustrates the process of an I2C device. +- [Usage Example](#section5302202015300) -**Figure 1** Process of using an I2C device +## Overview +- The Inter-Integrated Circuit \(I2C\) is a simple, bidirectional, and synchronous serial bus that uses merely two wires. +- In an I2C communication, one controller communicates with one or more devices through the serial data line \(SDA\) and serial clock line \(SCL\), as shown in [Figure 1](#fig1135561232714). -![](figures/en-us_image_0000001057902344.png) +- I2C data transfer must begin with a **START** condition and end with a **STOP** condition. Data is transmitted byte-by-byte from the most significant bit to the least significant bit. +- Each I2C node is recognized by a unique address and can serve as either a controller or a device. When the controller needs to communicate with a device, it writes the device address to the bus through broadcast. A device matching this address sends a response to set up a data transfer channel. -## Opening an I2C Controller +- The I2C APIs define a set of common functions for I2C data transfer, including: + + - I2C controller management: opening or closing an I2C controller + - I2C message transfer: custom transfer by using a message array + + **Figure 1** Physical connection diagram for I2C + ![](figure/physical-connection-diagram-for-i2c.png "physical-connection-diagram-for-i2c") + + +### Available APIs + +**Table 1** APIs available for the I2C driver + + +

Parameter

Description

+

Description

gpio

@@ -333,19 +419,19 @@ The method for converting GPIO pin numbers varies according to the GPIO controll

GPIO pin number.

Return Value

+

Return Value

Description

+

Description

0

The GPIO interrupt is disabled.

+

Succeeded in disabling a GPIO interrupt.

Negative value

Failed to disable the GPIO interrupt.

+

Failed to disable a GPIO interrupt.

+ + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

I2C controller management

+

I2cOpen

+

Opens an I2C controller.

+

I2cClose

+

Closes an I2C controller.

+

I2C message transfer

+

I2cTransfer

+

Performs a custom transfer.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions provided in this document can be called only in kernel mode. + +## Usage Guidelines + +### How to Use + +[Figure 2](#fig166181128151112) illustrates the process of an I2C device. + +**Figure 2** Process of using an I2C device + + +![](figure/en-us_image_0000001123509750.png) + +### Opening an I2C Controller Call the following function to open an I2C controller: DevHandle I2cOpen\(int16\_t number\); -**Table 1** Description of I2cOpen +**Table 2** Description of I2cOpen -

Parameter

+ - @@ -34,9 +97,9 @@ DevHandle I2cOpen\(int16\_t number\); - -

Parameter

Description

+

Description

I2C controller ID.

Return Value

+

Return Value

Description

+

Description

NULL

@@ -65,18 +128,18 @@ if (i2cHandle == NULL) { } ``` -## Performing I2C Communication +### Performing I2C Communication Use the following function for message transfer: int32\_t I2cTransfer\(DevHandle handle, struct I2cMsg \*msgs, int16\_t count\); -**Table 2** Description of I2cTransfer +**Table 3** Description of I2cTransfer -

Parameter

+ - @@ -95,9 +158,9 @@ int32\_t I2cTransfer\(DevHandle handle, struct I2cMsg \*msgs, int16\_t count\); - -

Parameter

Description

+

Description

Length of the message array.

Return Value

+

Return Value

Description

+

Description

Positive integer

@@ -126,7 +189,7 @@ msgs[0].addr = 0x5A; /* The address of the device to write the data is 0x5A. msgs[0].flags = 0; /* The flag is 0, indicating the write operation. */ msgs[1].buf = rbuff; /* Data to read */ msgs[1].len = 2; /* The length of the data to read is 2. */ -msgs[1].addr = 0x5A; /* The address of the device to read the data is 0x5A. */ +msgs[1].addr = 0x5A; /* The address of the device to read is 0x5A. */ msgs[1].flags = I2C_FLAG_READ /* I2C_FLAG_READ is configured, indicating the read operation. */ /* Perform a custom transfer to transfer two messages. */ ret = I2cTransfer(i2cHandle, msgs, 2); @@ -136,19 +199,19 @@ if (ret != 2) { } ``` ->![](public_sys-resources/icon-caution.gif) **CAUTION:** +>![](../public_sys-resources/icon-caution.gif) **CAUTION:** >- The device address in the **I2cMsg** structure does not contain the read/write flag bit. The read/write information is transferred by the read/write control bit in the member variable **flags**. >- The **I2cTransfer** function does not limit the number of message structures, which is determined by the I2C controller. >- The **I2cTransfer** function does not limit the data length of each message structure, which is determined by the I2C controller. ->- The **I2cTransfer** function may cause the system to sleep and therefore cannot be invoked in the interrupt context. +>- The **I2cTransfer** function may cause the system to sleep and therefore cannot be called in the interrupt context. -## Closing an I2C Controller +### Closing an I2C Controller Call the following function to close the I2C controller after the communication is complete: -void I2cClose\(DevHandle handle\); +void I2cClose\(DevHandle \*handle\); -**Table 3** Description of I2cClose +**Table 4** Description of I2cClose

Parameter

@@ -169,3 +232,195 @@ void I2cClose\(DevHandle handle\); I2cClose(i2cHandle); /* Close the I2C controller. */ ``` +## Usage Example + +This example describes how to use I2C APIs with an I2C device on a development board. + +This example shows a simple register read/write operation on TouchPad on a Hi3516D V300 development board. The basic hardware information is as follows: + +- SoC: hi3516dv300 + +- Touch IC: The I2C address is 0x38, and the bit width of Touch IC's internal register is 1 byte. + +- Schematic diagram: TouchPad is mounted to I2C controller 3. The reset pin of Touch IC is GPIO3. + +In this example, first we reset Touch IC. \(The development board supplies power to Touch IC by default after being powered on, and this use case does not consider the power supply\). Then, we perform a read/write operation on an internal register to test whether the I2C channel is normal. + +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>The example focuses on I2C device access and verifies the I2C channel. The read and write values of the device register are not concerned. The behavior caused by the read and write operations on the register is determined by the device itself. + +Example: + +``` +#include "i2c_if.h" /* Header file of I2C APIs */ +#include "gpio_if.h" /* Header file of GPIO APIs */ +#include "hdf_log.h" /* Header file for log APIs */ +#include "osal_io.h" /* Header file of I/O read and write APIs */ +#include "osal_time.h" /* Header file of delay and sleep APIs */ + +/* Define a TP device structure to store I2C and GPIO hardware information. */ +struct TpI2cDevice { + uint16_t rstGpio; /* Reset pin */ + uint16_t busId; /* I2C bus ID */ + uint16_t addr; /* I2C device address */ + uint16_t regLen; /* Register bit width */ + DevHandle i2cHandle; /* I2C controller handle */ +}; + +/* I2C pin I/O configuration. For details, see the SoC register manual. */ +#define I2C3_DATA_REG_ADDR 0x112f008c /* Address of the SDA pin configuration register of I2C controller 3 +#define I2C3_CLK_REG_ADDR 0x112f0090 /* Address of the SCL pin configuration register of I2C controller 3 +#define I2C_REG_CFG 0x5f1 /* Configuration values of SDA and SCL pins of I2C controller 3 + +static void TpSocIoCfg(void) +{ + /* Set the I/O function of the two pins corresponding to I2C controller 3 to I2C. */ + OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_DATA_REG_ADDR)); + OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_CLK_REG_ADDR)); +} + +/* Initialize the reset pin of the TP. Pull up the pin for 20 ms, pull down the pin for 50 ms, and then pull up the pin for 20 ms to complete the resetting. */ +static int32_t TestCaseGpioInit(struct TpI2cDevice *tpDevice) +{ + int32_t ret; + + /* Set the output direction for the reset pin. */ + ret = GpioSetDir(tpDevice->rstGpio, GPIO_DIR_OUT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst dir fail!:%d", __func__, ret); + return ret; + } + + ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst hight fail!:%d", __func__, ret); + return ret; + } + OsalMSleep(20); + + ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_LOW); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst low fail!:%d", __func__, ret); + return ret; + } + OsalMSleep(50); + + ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst high fail!:%d", __func__, ret); + return ret; + } + OsalMSleep(20); + + return HDF_SUCCESS; +} + +/* Use I2cTransfer to encapsulate a register read/write auxiliary function. Use flag to indicate the read or write operation. */ +static int TpI2cReadWrite(struct TpI2cDevice *tpDevice, unsigned int regAddr, + unsigned char *regData, unsigned int dataLen, uint8_t flag) +{ + int index = 0; + unsigned char regBuf[4] = {0}; + struct I2cMsg msgs[2] = {0}; + + /* Perform length adaptation for the single- or dual-byte register. */ + if (tpDevice->regLen == 1) { + regBuf[index++] = regAddr & 0xFF; + } else { + regBuf[index++] = (regAddr >> 8) & 0xFF; + regBuf[index++] = regAddr & 0xFF; + } + + /* Fill in the I2cMsg message structure. */ + msgs[0].addr = tpDevice->addr; + msgs[0].flags = 0; /* The flag is 0, indicating the write operation. */ + msgs[0].len = tpDevice->regLen; + msgs[0].buf = regBuf; + + msgs[1].addr = tpDevice->addr; + msgs[1].flags = (flag == 1)? I2C_FLAG_READ: 0; /* Add the read flag. */ + msgs[1].len = dataLen; + msgs[1].buf = regData; + + if (I2cTransfer(tpDevice->i2cHandle, msgs, 2) != 2) { + HDF_LOGE("%s: i2c read err", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +/* TP register read function */ +static inline int TpI2cReadReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, + unsigned char *regData, unsigned int dataLen) +{ + return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 1); +} + +/* TP register write function */ +static inline int TpI2cWriteReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, + unsigned char *regData, unsigned int dataLen) +{ + return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 0); +} + +/* Main entry of I2C */ +static int32_t TestCaseI2c(void) +{ + int32_t i; + int32_t ret; + unsigned char bufWrite[7] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xA, 0xB, 0xC }; + unsigned char bufRead[7] = {0}; + static struct TpI2cDevice tpDevice; + + /* I/O pin function configuration */ + TpSocIoCfg(); + + /* Initialize TP device information. */ + tpDevice.rstGpio = 3; + tpDevice.busId = 3; + tpDevice.addr = 0x38; + tpDevice.regLen = 1; + tpDevice.i2cHandle = NULL; + + /* Initialize the GPIO pin. */ + ret = TestCaseGpioInit(&tpDevice); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: gpio init fail!:%d", __func__, ret); + return ret; + } + + /* Open an I2C controller. */ + tpDevice.i2cHandle = I2cOpen(tpDevice.busId); + if (tpDevice.i2cHandle == NULL) { + HDF_LOGE("%s: Open I2c:%u fail!", __func__, tpDevice.busId); + return -1; + } + + /* Continuously write 7-byte data to register 0xD5 of TP-IC. */ + ret = TpI2cWriteReg(&tpDevice, 0xD5, bufWrite, 7); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: tp i2c write reg fail!:%d", __func__, ret); + I2cClose(tpDevice.i2cHandle); + return -1; + } + OsalMSleep(10); + + /* Continuously read 7-byte data from register 0xDO of TP-IC. */ + ret = TpI2cReadReg(&tpDevice, 0xD5, bufRead, 7); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: tp i2c read reg fail!:%d", __func__, ret); + I2cClose(tpDevice.i2cHandle); + return -1; + } + + HDF_LOGE("%s: tp i2c write&read reg success!", __func__); + for (i = 0; i < 7; i++) { + HDF_LOGE("%s: bufRead[%d] = 0x%x", __func__, i, bufRead[i]); + } + + /* Close the I2C controller. */ + I2cClose(tpDevice.i2cHandle); + return ret; +} +``` + diff --git a/en/device-dev/driver/driver-platform-mipidsi-des.md b/en/device-dev/driver/driver-platform-mipidsi-des.md new file mode 100644 index 0000000000000000000000000000000000000000..250a419f0ee64f2364f03478a247bb11c0ff6d90 --- /dev/null +++ b/en/device-dev/driver/driver-platform-mipidsi-des.md @@ -0,0 +1,554 @@ +# MIPI DSI + +- [Overview](#section16806142183217) + - [Available APIs](#section129611916132011) + +- [Usage Guidelines](#section037231715335) + - [How to Use](#section49299119344) + - [Obtains a MIPI DSI device handle.](#section5126155683811) + - [Setting MIPI DSI Configuration Parameters](#section201164274344) + - [Sending/Receiving the Pointer to a Command](#section199401342173415) + - [Releasing the MIPI DSI Device Handle](#section161011610357) + +- [Usage Example](#section17470126123520) + +## Overview + +- The Display Serial Interface \(DSI\) is a specification stipulated by the Mobile Industry Processor Interface \(MIPI\) Alliance, aiming to reduce the cost of display controllers in a mobile device. It defines a serial bus and communication protocol among the host, the source of image data, and the target device. In this way, the DSI can send pixel data or commands to peripherals \(usually LCDs or similar display devices\) in serial mode, or reads information such as status and pixel from the peripherals. + +- MIPI DSI is capable of working in both high speed \(HS\) mode and low power \(LP\) mode. All data lanes can only travel from the DSI host to a peripheral in HS mode, except the first data lane, which can also receive data such as status information and pixels from the peripheral in LP mode. The clock lane is dedicated to transmitting synchronization clock signals in HS mode. +- [Figure 1](#fig1122611461203) shows a simplified DSI interface. Conceptually, a DSI-compliant interface has the same features as interfaces complying with DBI-2 and DPI-2 standards. It sends pixels or commands to a peripheral and can read status or pixel information from the peripheral. The main difference is that the DSI serializes all pixel data, commands, and events that, in traditional interfaces, are conveyed to and from the peripheral on a parallel data bus with additional control signals. + + **Figure 1** DSI transmitting and receiving interface + ![](figure/dsi-transmitting-and-receiving-interface.png "dsi-transmitting-and-receiving-interface") + + +### Available APIs + +**Table 1** APIs for MIPI DSI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

Setting/Obtaining MIPI DSI configuration parameters

+

MipiDsiSetCfg

+

Sets configuration parameters for a MIPI DSI device.

+

MipiDsiGetCfg

+

Obtains configuration parameters of a MIPI DSI device.

+

Obtaining /Releasing device handles

+

MipiDsiOpen

+

Obtains a MIPI DSI device handle.

+

MipiDsiClose

+

Releases a specified MIPI DSI device handle.

+

Setting the LP or HS mode

+

MipiDsiSetLpMode

+

Sets LP mode for a MIPI DSI device.

+

MipiDsiSetHsMode

+

Sets HS mode for a MIPI DSI device.

+

Reading/Sending commands

+

MipiDsiTx

+

Sends a display command set (DCS) command for sending data.

+

MipiDsiRx

+

Receives a DCS command for reading data with the specified length.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions described in this document can be called only in kernel space. + +## Usage Guidelines + +### How to Use + +[Figure 2](#fig99821771782) shows the process of using a MIPI DSI device. + +**Figure 2** Process of using a MIPI DSI device + + +![](figure/en-us_image_0000001123514210.png) + +### Obtains a MIPI DSI device handle. + +Before performing MIPI DSI communication, obtain a MIPI DSI device handle by calling **MipiDsiOpen**. This function returns a MIPI DSI device handle with a specified channel ID. + +DevHandle MipiDsiOpen\(uint8\_t id\); + +**Table 2** Description of **MipiDsiOpen** + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

id

+

MIPI DSI channel ID.

+

Return Value

+

Description

+

NULL

+

Failed to receive the specified command.

+

Device handle

+

MIPI DSI device handle with a specified channel ID, whose data type is DevHandle.

+
+ +The following example shows how to obtain a MIPI DSI device handle with the channel ID **0**: + +``` +DevHandle mipiDsiHandle = NULL; /* Device handle */ +chnId = 0; /* MIPI DSI channel ID */ + +/* Obtain the MIPI DSI device handle based on a specified channel ID. */ +mipiDsiHandle = MipiDsiOpen(chnId); +if (mipiDsiHandle == NULL) { + HDF_LOGE("MipiDsiOpen: failed\n"); + return; +} +``` + +### Setting MIPI DSI Configuration Parameters + +- Set MIPI DSI configuration parameters by calling the following function: + +int32\_t MipiDsiSetCfg\(DevHandle handle, struct MipiCfg \*cfg\); + +**Table 3** Description of **MipiDsiSetCfg** + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

handle

+

MIPI DSI device handle.

+

cfg

+

Pointer to MIPI DSI configuration parameters.

+

Return Value

+

Description

+

0

+

Succeeded in setting MIPI DSI configuration parameters.

+

Negative value

+

Failed to set MIPI DSI configuration parameters.

+
+ +``` +int32_t ret; +struct MipiCfg cfg = {0}; + +/* Configuration parameters of the connected device are as follows: */ +cfg.lane = DSI_4_LANES; +cfg.mode = DSI_CMD_MODE; +cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; +cfg.format = FORMAT_RGB_24_BIT; +cfg.pixelClk = 174; +cfg.phyDataRate = 384; +cfg.timingInfo.hsaPixels = 50; +cfg.timingInfo.hbpPixels = 55; +cfg.timingInfo.hlinePixels = 1200; +cfg.timingInfo.yResLines = 1800; +cfg.timingInfo.vbpLines = 33; +cfg.timingInfo.vsaLines = 76; +cfg.timingInfo.vfpLines = 120; +cfg.timingInfo.xResPixels = 1342; +/* Set MIPI DSI configuration parameters. */ +ret = MipiDsiSetCfg(g_handle, &cfg); +if (ret != 0) { + HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); + return -1; +} +``` + +- Obtain MIPI DSI configuration parameters by calling the following function: + +int32\_t MipiDsiGetCfg\(DevHandle handle, struct MipiCfg \*cfg\); + +**Table 4** Description of **MipiDsiGetCfg** + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

handle

+

MIPI DSI device handle.

+

cfg

+

Pointer to MIPI DSI configuration parameters.

+

Return Value

+

Description

+

0

+

Succeeded in receiving the specified command.

+

Negative value

+

Failed to receive the specified command.

+
+ +``` +int32_t ret; +struct MipiCfg cfg; +memset(&cfg, 0, sizeof(struct MipiCfg)); +ret = MipiDsiGetCfg(g_handle, &cfg); +if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: GetMipiCfg fail!\n", __func__); + return HDF_FAILURE; +} +``` + +### Sending/Receiving the Pointer to a Command + +- Send the pointer to a specified command by calling the following function: + +int32\_t MipiDsiTx\(PalHandle handle, struct DsiCmdDesc \*cmd\); + +**Table 5** Description of **MipiDsiTx** + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

handle

+

MIPI DSI device handle.

+

cmd

+

Pointer to the command to be sent.

+

Return Value

+

Description

+

0

+

Succeeded in sending the specified command.

+

Negative value

+

Failed to send the specified command.

+
+ +``` +int32_t ret; +struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); +if (cmd == NULL) { + return HDF_FAILURE; +} +cmd->dtype = DTYPE_DCS_WRITE; +cmd->dlen = 1; +cmd->payload = OsalMemCalloc(sizeof(uint8_t)); +if (cmd->payload == NULL) { + HdfFree(cmd); + return HDF_FAILURE; +} +*(cmd->payload) = DTYPE_GEN_LWRITE; +MipiDsiSetLpMode(mipiHandle); +ret = MipiDsiTx(mipiHandle, cmd); +MipiDsiSetHsMode(mipiHandle); +if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: PalMipiDsiTx fail! ret=%d\n", __func__, ret); + HdfFree(cmd->payload); + HdfFree(cmd); + return HDF_FAILURE; +} +HdfFree(cmd->payload); +HdfFree(cmd); +``` + +- Receive a specified command by calling the following function: + +int32\_t MipiDsiRx\(DevHandle handle, struct DsiCmdDesc \*cmd, uint32\_t readLen, uint8\_t \*out\); + +**Table 6** Description of **MipiDsiRx** + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

handle

+

MIPI DSI device handle.

+

cmd

+

Pointer to the command to be received.

+

readLen

+

Length of the data to read.

+

out

+

Pointer to the read data.

+

Return Value

+

Description

+

0

+

Succeeded in receiving the specified command.

+

Negative value

+

Failed to receive the specified command.

+
+ +``` +int32_t ret; +uint8_t readVal = 0; + +struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); +if (cmdRead == NULL) { + return HDF_FAILURE; +} +cmdRead->dtype = DTYPE_DCS_READ; +cmdRead->dlen = 1; +cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); +if (cmdRead->payload == NULL) { + HdfFree(cmdRead); + return HDF_FAILURE; +} +*(cmdRead->payload) = DDIC_REG_STATUS; +MipiDsiSetLpMode(g_handle); +ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); +MipiDsiSetHsMode(g_handle); +if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); + HdfFree(cmdRead->payload); + HdfFree(cmdRead); + return HDF_FAILURE; +} +HdfFree(cmdRead->payload); +HdfFree(cmdRead); +``` + +### Releasing the MIPI DSI Device Handle + +After the MIPI DSI communication, release the MIPI DSI device handle by calling the following function: + +void MipiDsiClose\(DevHandle handle\); + +This function releases the resources requested by **MipiDsiOpen**. + +**Table 7** Description of **MipiDsiClose** + + + + + + + + + + +

Parameter

+

Description

+

handle

+

MIPI DSI device handle.

+
+ +``` +MipiDsiClose(mipiHandle); /* Release the MIPI DSI device handle */ +``` + +## Usage Example + +The following is an example of using a MIPI DSI device: + +``` +#include "hdf.h" +#include "mipi_dsi_if.h" + +void PalMipiDsiTestSample(void) +{ + uint8_t chnId; + int32_t ret; + DevHandle handle = NULL; + + /* Device channel ID */ + chnId = 0; + /* Obtain the MIPI DSI device handle based on a specified channel ID. */ + handle = MipiDsiOpen(chnId); + if (handle == NULL) { + HDF_LOGE("MipiDsiOpen: failed!\n"); + return; + } + /* MIPI DSI configuration parameters */ + struct MipiCfg cfg = {0}; + cfg.lane = DSI_4_LANES; + cfg.mode = DSI_CMD_MODE; + cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; + cfg.format = FORMAT_RGB_24_BIT; + cfg.pixelClk = 174; + cfg.phyDataRate = 384; + cfg.timingInfo.hsaPixels = 50; + cfg.timingInfo.hbpPixels = 55; + cfg.timingInfo.hlinePixels = 1200; + cfg.timingInfo.yResLines = 1800; + cfg.timingInfo.vbpLines = 33; + cfg.timingInfo.vsaLines = 76; + cfg.timingInfo.vfpLines = 120; + cfg.timingInfo.xResPixels = 1342; + /* Set MIPI DSI configuration parameters. */ + ret = MipiDsiSetCfg(g_handle, &cfg); + if (ret != 0) { + HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); + return; + } + /* Send the command for initializing the PANEL register. */ + struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); + if (cmd == NULL) { + return; + } + cmd->dtype = DTYPE_DCS_WRITE; + cmd->dlen = 1; + cmd->payload = OsalMemCalloc(sizeof(uint8_t)); + if (cmd->payload == NULL) { + HdfFree(cmd); + return; + } + *(cmd->payload) = DTYPE_GEN_LWRITE; + MipiDsiSetLpMode(mipiHandle); + ret = MipiDsiTx(mipiHandle, cmd); + MipiDsiSetHsMode(mipiHandle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: MipiDsiTx fail! ret=%d\n", __func__, ret); + HdfFree(cmd->payload); + HdfFree(cmd); + return; + } + HdfFree(cmd->payload); + HdfFree(cmd); + /* Pointer to the register that reads the PANEL status */ + uint8_t readVal = 0; + struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); + if (cmdRead == NULL) { + return; + } + cmdRead->dtype = DTYPE_DCS_READ; + cmdRead->dlen = 1; + cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); + if (cmdRead->payload == NULL) { + HdfFree(cmdRead); + return; + } + *(cmdRead->payload) = DDIC_REG_STATUS; + MipiDsiSetLpMode(g_handle); + ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); + MipiDsiSetHsMode(g_handle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); + HdfFree(cmdRead->payload); + HdfFree(cmdRead); + return; + } + HdfFree(cmdRead->payload); + HdfFree(cmdRead); + /* Release the MIPI DSI device handle. */ + MipiDsiClose(handle); +} +``` + diff --git a/en/device-dev/driver/rtc-usage-guidelines.md b/en/device-dev/driver/driver-platform-rtc-des.md similarity index 61% rename from en/device-dev/driver/rtc-usage-guidelines.md rename to en/device-dev/driver/driver-platform-rtc-des.md index 3d0a2f6638021e4ab54ec680a06b134a873685b8..66e8a08cf14f76bd8e32165491c4387567db8f66 100644 --- a/en/device-dev/driver/rtc-usage-guidelines.md +++ b/en/device-dev/driver/driver-platform-rtc-des.md @@ -1,52 +1,158 @@ -# RTC Usage Guidelines +# RTC -- [How to Use](#section620515765714) -- [Creating an RTC Device Handle](#section0702183665711) -- [Releasing the RTC Device Handle](#section639962619542) -- [Registering RtcAlarmCallback](#section123631358135713) -- [Performing RTC-related Operations](#section11091522125812) +- [Overview](#section104842041574) + - [Available APIs](#section3373340142215) -## How to Use +- [Usage Guidelines](#section20636145604113) + - [How to Use](#section16919828134215) + - [Creating an RTC Device Handle](#section1131212144310) + - [Releasing the RTC Device Handle](#section10744117144314) + - [Registering RtcAlarmCallback](#section14839440184320) + - [Performing RTC-related Operations](#section161927578433) + +- [Usage Example](#section1186111020456) + +## Overview + +The real-time clock \(RTC\) driver provides precise real time for the operating system \(OS\). If the OS is powered off, the RTC driver continues to keep track of the system time using an external battery. + +### Available APIs + +**Table 1** APIs provided by the RTC driver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

RTC handle

+

RtcOpen

+

Opens the RTC device to obtain its handle.

+

RtcClose

+

Releases a specified handle of the RTC device.

+

RTC time

+

RtcReadTime

+

Reads time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond.

+

RtcWriteTime

+

Writes time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond.

+

RTC alarm

+

RtcReadAlarm

+

Reads the RTC alarm time that was set last time.

+

RtcWriteAlarm

+

Writes the RTC alarm time based on the alarm index.

+

RtcRegisterAlarmCallback

+

Registers RtcAlarmCallback that will be invoked when an alarm is generated at the specified time.

+

RtcAlarmInterruptEnable

+

Enables or disables RTC alarm interrupts.

+

RTC configuration

+

RtcGetFreq

+

Reads the frequency of the external crystal oscillator connected to the RTC driver.

+

RtcSetFreq

+

Sets the frequency of the external crystal oscillator connected to the RTC driver.

+

RtcReset

+

Resets the RTC.

+

Custom register

+

RtcReadReg

+

Reads the configuration of a custom RTC register based on the register index.

+

RtcWriteReg

+

Writes the configuration of a custom RTC register based on the register index.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions provided in this document can be called only in kernel mode. + +## Usage Guidelines + +### How to Use During the OS startup, the HDF loads the RTC driver based on the configuration file. The RTC driver detects the RTC component and initializes the driver. -[Figure 1](#fig166181128151112) illustrates the process of an RTC device. +[Figure 1](#fig166181128151112) illustrates the process of using an RTC device. **Figure 1** Process of using an RTC device -![](figures/en-us_image_0000001054728498.png) +![](figure/en-us_image_0000001123675706.png) -## Creating an RTC Device Handle +### Creating an RTC Device Handle -After the RTC driver is loaded successfully, you can use the API provided by the HDF and call APIs of the RTC driver. +After the RTC driver is loaded, you can use the API provided by the HDF and call APIs of the RTC driver. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Currently, only one RTC device is supported in the OS. DevHandle RtcOpen\(void\); -**Table 1** Description of **RtcOpen** +**Table 2** Description of RtcOpen -

Parameter

+ - - - - -

Parameter

Description

+

Description

void

N/A

+

NA

Return Value

+

Return Value

Description

+

Description

handle

Returns the pointer if the operation is successful.

+

Returns the if the operation is successful.

NULL

@@ -67,23 +173,23 @@ if (handle == NULL) { } ``` -## Releasing the RTC Device Handle +### Releasing the RTC Device Handle You can call the following function to release the RTC device handle, thereby releasing resources of the device: void RtcClose\(DevHandle handle\); -**Table 2** Description of **RtcClose** +**Table 3** Description of RtcClose -

Parameter

+ - - @@ -94,24 +200,24 @@ void RtcClose\(DevHandle handle\); RtcClose(handle); ``` -## Registering RtcAlarmCallback +### Registering RtcAlarmCallback After the OS is started, call the following function to register **RtcAlarmCallback**, which will be invoked when an alarm is generated at the specified time: int32\_t RtcRegisterAlarmCallback\(DevHandle handle, enum RtcAlarmIndex alarmIndex, RtcAlarmCallback cb\); -**Table 3** Description of **RtcRegisterAlarmCallback** +**Table 4** Description of RtcRegisterAlarmCallback -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle

+

RTC device handle.

Parameter

+ - - - - - @@ -153,7 +259,7 @@ int32_t RtcAlarmACallback(enum RtcAlarmIndex alarmIndex) } else if (alarmIndex == RTC_ALARM_INDEX_B) { /* Process alarm B. */ } else { - /* Process the error. */ + /* Process the error. */ } return 0; } @@ -165,25 +271,25 @@ if (ret != 0) { } ``` -## Performing RTC-related Operations +### Performing RTC-related Operations - Reading RTC time -Call the following function to read time information from the RTC driver, including the year, month, the day fo the week, day, hour, minute, second, and millisecond: +Call the following function to read time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond: int32\_t RtcReadTime\(DevHandle handle, struct RtcTime \*time\); -**Table 4** Description of **RtcReadTime** +**Table 5** Description of RtcReadTime -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

alarmIndex

@@ -124,9 +230,9 @@ int32\_t RtcRegisterAlarmCallback\(DevHandle handle, enum RtcAlarmIndex alarmInd

Callback that will be invoked when an alarm is generated at the specified time.

Return Value

+

Return Value

Description

+

Description

0

@@ -136,7 +242,7 @@ int32\_t RtcRegisterAlarmCallback\(DevHandle handle, enum RtcAlarmIndex alarmInd

Negative value

The operation fails.

+

The operation fails.

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

time

@@ -191,9 +297,9 @@ int32\_t RtcReadTime\(DevHandle handle, struct RtcTime \*time\);

Pointer to the time information read from the RTC driver. The time information includes the year, month, the day of the week, day, hour, minute, second, and millisecond.

Return Value

+

Return Value

Description

+

Description

0

@@ -226,17 +332,17 @@ Call the following function to set the RTC time: int32\_t RtcWriteTime\(DevHandle handle, struct RtcTime \*time\); -**Table 5** Description of **RtcWriteTime** +**Table 6** Description of RtcWriteTime -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

time

@@ -244,9 +350,9 @@ int32\_t RtcWriteTime\(DevHandle handle, struct RtcTime \*time\);

Pointer to the time information written into the RTC driver. The time information includes the year, month, the day of the week, day, hour, minute, second, and millisecond.

Return Value

+

Return Value

Description

+

Description

0

@@ -262,7 +368,7 @@ int32\_t RtcWriteTime\(DevHandle handle, struct RtcTime \*time\);
->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The RTC start time is 1970/01/01 Thursday 00:00:00 \(UTC\). The maximum value of **year** must be set based on the requirements specified in the product manual of the in-use component. You do not need to configure the day of the week. ``` @@ -290,17 +396,17 @@ Call the following function to read the alarm time: int32\_t RtcReadAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct RtcTime \*time\); -**Table 6** Description of **RtcReadAlarm** +**Table 7** Description of RtcReadAlarm -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

alarmIndex

@@ -313,9 +419,9 @@ int32\_t RtcReadAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct R

Pointer to the RTC alarm time information. The time information includes the year, month, the day of the week, day, hour, minute, second, and millisecond.

Return Value

+

Return Value

Description

+

Description

0

@@ -348,17 +454,17 @@ Call the following function to set the RTC alarm time based on the alarm index: int32\_t RtcWriteAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct RtcTime \*time\); -**Table 7** Description of **RtcWriteAlarm** +**Table 8** Description of RtcWriteAlarm -

Parameter

+ - - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

alarmIndex

@@ -371,9 +477,9 @@ int32\_t RtcWriteAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct

Pointer to the RTC alarm time information. The time information includes the year, month, the day of the week, day, hour, minute, second, and millisecond.

Return Value

+

Return Value

Description

+

Description

0

@@ -383,13 +489,13 @@ int32\_t RtcWriteAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct

Negative value

The operation fails.

+

The operation fails.

->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The RTC start time is 1970/01/01 Thursday 00:00:00 \(UTC\). The maximum value of **year** must be set based on the requirements specified in the product manual of the in-use component. You do not need to configure the day of the week. ``` @@ -413,21 +519,21 @@ if (ret != 0) { - Enabling or disabling alarm interrupts -Before performing alarm operations, use this function to enable alarm interrupts, so that **RtcAlarmCallback** will be called when the alarm is not generated upon a timeout. +Before performing alarm operations, use the following function to enable alarm interrupts, so that **RtcAlarmCallback** will be called when the alarm is not generated upon a timeout: int32\_t RtcAlarmInterruptEnable\(DevHandle handle, enum RtcAlarmIndex alarmIndex, uint8\_t enable\); -**Table 8** Description of **RtcAlarmInterruptEnable** +**Table 9** Description of RtcAlarmInterruptEnable -

Parameter

+ - - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

alarmIndex

@@ -437,12 +543,12 @@ int32\_t RtcAlarmInterruptEnable\(DevHandle handle, enum RtcAlarmIndex alarmInde

enable

Whether to enable RTC alarm interrupts. Value 1 means to enable alarm interrupts and value 0 means to disable alarm interrupts.

+

Whether to enable RTC alarm interrupts. The value 1 means to enable alarm interrupts and 0 means to disable alarm interrupts.

Return Value

+

Return Value

Description

+

Description

0

@@ -474,27 +580,27 @@ Call the following function to read the frequency of the external crystal oscill int32\_t RtcGetFreq\(DevHandle handle, uint32\_t \*freq\); -**Table 9** Description of **RtcGetFreq** +**Table 10** Description of RtcGetFreq -

Parameter

+ - - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

freq

Frequency to set for the external crystal oscillator, in Hz.

+

Pointer to the frequency to set for the external crystal oscillator, in Hz.

Return Value

+

Return Value

Description

+

Description

0

@@ -527,27 +633,27 @@ Call the following function to set the frequency of the external crystal oscilla int32\_t RtcSetFreq\(DevHandle handle, uint32\_t freq\); -**Table 10** Description of **RtcSetFreq** +**Table 11** Description of RtcSetFreq -

Parameter

+ - - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

freq

Frequency to set for the external crystal oscillator, in Hz.

+

Frequency to set for the external crystal oscillator, in Hz

Return Value

+

Return Value

Description

+

Description

0

@@ -576,26 +682,26 @@ if (ret != 0) { - Resetting the RTC driver -Call the following function to perform a reset on the RTC driver. After the reset, the registers are restored to the default values: +Call the following function to perform a reset on the RTC driver \(after the reset, the registers are restored to the default values\): int32\_t RtcReset\(DevHandle handle\); -**Table 11** Description of **RtcReset** +**Table 12** Description of RtcReset -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

Return Value

+

Return Value

Description

+

Description

0

@@ -627,32 +733,32 @@ Call the following function to read the configuration of a custom RTC register b int32\_t RtcReadReg\(DevHandle handle, uint8\_t usrDefIndex, uint8\_t \*value\); -**Table 12** Description of **RtcReadReg** +**Table 13** Description of RtcReadReg -

Parameter

+ - - - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

usrDefIndex

Index of the custom register.

+

Index of the custom register

value

Register value.

+

Pointer to the register value

Return Value

+

Return Value

Description

+

Description

0

@@ -686,32 +792,32 @@ Call the following function to configure a register based on the specified regis int32\_t RtcWriteReg\(DevHandle handle, uint8\_t usrDefIndex, uint8\_t value\); -**Table 13** Description of **RtcWriteReg** +**Table 14** Description of RtcWriteReg -

Parameter

+ - - - - - -

Parameter

Description

+

Description

handle

Pointer to the RTC device handle.

+

RTC device handle.

usrDefIndex

Index of the custom register.

+

Index of the custom register

value

Register value.

+

Register value

Return Value

+

Return Value

Description

+

Description

0

@@ -739,3 +845,100 @@ if (ret != 0) { } ``` +## Usage Example + +This section describes the process of using RTC APIs: + +1. During the OS startup, the HDF identifies the RTC component in the system. +2. The HDF initializes and creates the RTC device. +3. You can perform operations on the RTC device by calling different APIs. +4. Call the **RtcClose** function to release the device handle and device resources. + +Example: + +``` +#include "rtc_if.h" +int32_t RtcAlarmACallback(enum RtcAlarmIndex alarmIndex) +{ + if (alarmIndex == RTC_ALARM_INDEX_A) { + /* Process alarm A. */ + printf("RTC Alarm A callback function\n\r"); + } else if (alarmIndex == RTC_ALARM_INDEX_B) { + /* Process alarm B. */ + printf("RTC Alarm B callback function\n\r"); + } else { + /* Process the error. */ + } + return 0; +} + +void RtcTestSample(void) +{ + int32_t ret; + struct RtcTime tm; + struct RtcTime alarmTime; + uint32_t freq; + DevHandle handle = NULL; + + /* Obtain the RTC device handle. */ + handle = RtcOpen(); + if (handle == NULL) { + /* Process the error. */ + } + /* Register RtcAlarmCallback for alarm A. */ + ret = RtcRegisterAlarmCallback(handle, RTC_ALARM_INDEX_A, RtcAlarmACallback); + if (ret != 0) { + /* Process the error. */ + } + /* Set the RTC external crystal frequency. Note that the frequency must be configured in accordance with the requirements specified in the product manual of the in-use component. */ + freq = 32768; /* 32768 Hz */ + ret = RtcSetFreq(handle, freq); + if (ret != 0) { + /* Process the error. */ + } + /* Enable the RTC alarm interrupts. */ + ret = RtcAlarmInterruptEnable(handle, RTC_ALARM_INDEX_A, 1); + if (ret != 0) { + /* Process the error. */ + } + /* Set the RTC time to 2020/01/01 00:00:10 .990. */ + tm.year = 2020; + tm.month = 01; + tm.day = 01; + tm.hour= 0; + tm.minute = 0; + tm.second = 10; + tm.millisecond = 990; + /* Write the RTC time information. */ + ret = RtcWriteTime(handle, &tm); + if (ret != 0) { + /* Process the error. */ + } + /* Set the RTC alarm time to 2020/01/01 00:00:30 .100. */ + alarmTime.year = 2020; + alarmTime.month = 01; + alarmTime.day = 01; + alarmTime.hour = 0; + alarmTime.minute = 0; + alarmTime.second = 30; + alarmTime.millisecond = 100; + /* Set the alarm time information for RTC_ALARM_INDEX_A. When the specified time is reached, "RTC Alarm A callback function" is printed. */ + ret = RtcWriteAlarm(handle, RTC_ALARM_INDEX_A, &alarmTime); + if (ret != 0) { + /* Process the error. */ + } + + /* Read the RTC real time. */ + ret = RtcReadTime(handle, &tm); + if (ret != 0) { + /* Process the error. */ + } + sleep(5) + printf("RTC read time:\n\r"); + printf("year-month-date-weekday hour:minute:second .millisecond %04u-%02u-%02u-%u %02u:%02u:%02u .%03u", + tm.year, tm.month, tm.day, tm.weekday, tm.hour, tm.minute, tm.second, tm.millisecond); + /* Release the RTC device handle. */ + RtcClose(handle); +} +``` + diff --git a/en/device-dev/driver/sdiousage-guidelines.md b/en/device-dev/driver/driver-platform-sdio-des.md similarity index 61% rename from en/device-dev/driver/sdiousage-guidelines.md rename to en/device-dev/driver/driver-platform-sdio-des.md index 402cf305ebb98196a477530f749e0bc07f9710bd..4b5a27d35334ab5e75cbf0ea3cddffd9fd9341d3 100644 --- a/en/device-dev/driver/sdiousage-guidelines.md +++ b/en/device-dev/driver/driver-platform-sdio-des.md @@ -1,63 +1,215 @@ -# SDIO Usage Guidelines +# SDIO -- [How to Use](#section1962415610383) -- [Opening an SDIO Controller](#section814751015461) -- [Claiming a Host Exclusively](#section49274582455) -- [Enabling the SDIO Device](#section1431520410489) -- [Claiming an SDIO IRQ](#section3662781537) -- [Performing SDIO Communication](#section391941913484) -- [Releasing the SDIO IRQ](#section56205204481) -- [Disabling the SDIO Device](#section181181621124815) -- [Releasing the Exclusively Claimed Host](#section657117215486) -- [Closing an SDIO Controller](#section1898172114818) +- [Overview](#section1155271783811) + - [Available APIs](#section08064247248) -## How to Use +- [Usage Guidelines](#section1878939192515) + - [How to Use](#section1490685512255) + - [Opening an SDIO Controller](#section10782428132616) + - [Claiming a Host Exclusively](#section11263172312715) + - [Enabling the SDIO Device](#section17861486271) + - [Claiming an SDIO IRQ](#section521213262286) + - [Performing SDIO Communication](#section85661522153420) + - [Releasing the SDIO IRQ](#section1683449352) + - [Disabling the SDIO Device](#section15379324143611) + - [Releasing the Exclusively Claimed Host](#section536018263713) + - [Closing an SDIO Controller](#section4752739183716) -[Figure 1](spiusage-guidelines.md#fig23885455594) illustrates the process of using an SDIO. +- [Usage Example](#section376910122382) -**Figure 1** Process of using an SDIO +## Overview +- Secure Digital Input/Output \(SDIO\) is a peripheral interface evolved from the Secure Digital \(SD\) memory card interface. The SDIO interface is compatible with SD memory cards and can be connected to devices that support the SDIO interface. +- SDIO is widely used. Currently, many smartphones support SDIO, and many SDIO peripherals are developed for connections to smartphones. Common SDIO peripherals include WLAN, GPS, cameras, and Bluetooth. +- The SDIO bus has two ends, named host and device. All communication starts when the host sends a command. The device can communicate with the host as long as it can parse the command of the host. An SDIO host can connect to multiple devices, as shown in the figure below. -![](figures/en-us_image_0000001054440624.png) + - CLK signal: clock signal sent from the host to the device + - VDD signal: power signal + - VSS signal: ground signal + - D0-3 signal: four data lines. The DAT1 signal cable is multiplexed as the interrupt line. In 1-bit mode, DAT0 is used to transmit data. In 4-bit mode, DAT0 to DAT3 are used to transmit data. + - CMD signal: used by the host to send commands and the device to respond to commands. -## Opening an SDIO Controller + **Figure 1** Connections between the host and devices in SDIO + + + ![](figure/en-us_image_0000001054280608.png) + +- The SDIO interface defines a set of common methods for operating an SDIO device, including opening and closing an SDIO controller, exclusively claiming and releasing the host, enabling and disabling devices, claiming and releasing an SDIO IRQ, reading and writing data based on SDIO, and obtaining and setting common information. + +### Available APIs + +**Table 1** APIs available for the SDIO driver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

SDIO device opening/closing

+

SdioOpen

+

Opens an SDIO controller with a specified bus number.

+

SdioClose

+

Closes an SDIO controller.

+

SDIO reading/writing

+

SdioReadBytes

+

Incrementally reads a given length of data from a specified SDIO address.

+

SdioWriteBytes

+

Incrementally writes a given length of data into a specified SDIO address.

+

SdioReadBytesFromFixedAddr

+

Reads a given length of data from a fixed SDIO address.

+

SdioWriteBytesToFixedAddr

+

Writes a given length of data into a fixed SDIO address.

+

SdioReadBytesFromFunc0

+

Reads a given length of data from the address space of SDIO function 0.

+

SdioWriteBytesToFunc0

+

Writes a given length of data into the address space of SDIO function 0.

+

SDIO block size setting

+

SdioSetBlockSize

+

Sets the block size.

+

SDIO common information retrieval/setting

+

SdioGetCommonInfo

+

Obtains common information.

+

SdioSetCommonInfo

+

Sets common information.

+

SDIO data flushing

+

SdioFlushData

+

Flushes data.

+

SDIO host exclusively claiming or releasing

+

SdioClaimHost

+

Claims a host exclusively.

+

SdioReleaseHost

+

Releases the exclusively claimed host.

+

SDIO device enablement

+

SdioEnableFunc

+

Enables an SDIO device.

+

SdioDisableFunc

+

Disables an SDIO device.

+

SDIO IRQ claiming/releasing

+

SdioClaimIrq

+

Claims an SDIO IRQ.

+

SdioReleaseIrq

+

Releases an SDIO IRQ.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions provided in this document can be called only in kernel mode. + +## Usage Guidelines + +### How to Use + +[Figure 2](#fig1343742311264) illustrates the process of using an SDIO. + +**Figure 2** Process of using an SDIO + + +![](figure/en-us_image_0000001123540984.png) + +### Opening an SDIO Controller Before performing SDIO communication, obtain the device handle of an SDIO controller by calling **SdioOpen**. This function returns the device handle of the SDIO controller with a specified bus number. DevHandle SdioOpen\(int16\_t mmcBusNum, struct SdioFunctionConfig \*config\); -**Table 1** Parameters and return values of SdioOpen +**Table 2** Parameters and return values of SdioOpen - -

Parameter

+ + - - - - - - - - - - - @@ -78,24 +230,24 @@ if (handle == NULL) { } ``` -## Claiming a Host Exclusively +### Claiming a Host Exclusively After obtaining the device handle of an SDIO controller, exclusively claim the host before performing subsequent operations on the SDIO device. void SdioClaimHost\(DevHandle handle\); -**Table 2** Parameter description of SdioClaimHost +**Table 3** Parameter description of SdioClaimHost - -

Parameter

Description

+

Description

mmcBusNum

+

mmcBusNum

Bus number.

+

Bus number.

config

+

config

SDIO functionality configurations.

+

SDIO functionality configurations.

Return Value

+

Return Value

Description

+

Description

NULL

+

NULL

Failed to obtain the device handle of an SDIO controller.

+

Failed to obtain the device handle of an SDIO controller.

Device handle

+

Device handle

Device handle of an SDIO controller.

+

Device handle of an SDIO controller.

Parameter

+ + - - - @@ -107,13 +259,13 @@ The following example shows how to exclusively claim a host. SdioClaimHost(handle); /* Claim a host exclusively. */ ``` -## Enabling the SDIO Device +### Enabling the SDIO Device Before accessing a register, enable the SDIO device. int32\_t SdioEnableFunc\(DevHandle handle\); -**Table 3** Parameters and return values of SdioEnableFunc +**Table 4** Parameters and return values of SdioEnableFunc

Parameter

Description

+

Description

handle

+

handle

Device handle of an SDIO controller.

+

Device handle of an SDIO controller.

- -

Parameter

@@ -127,9 +279,9 @@ int32\_t SdioEnableFunc\(DevHandle handle\);

Device handle of an SDIO controller.

Return Value

+

Return Value

Description

+

Description

0

@@ -156,13 +308,13 @@ if (ret != 0) { } ``` -## Claiming an SDIO IRQ +### Claiming an SDIO IRQ Before SDIO communication, claim an SDIO IRQ. int32\_t SdioClaimIrq\(DevHandle handle, SdioIrqHandler \*handler\); -**Table 4** Parameters and return values of SdioClaimIrq +**Table 5** Parameters and return values of SdioClaimIrq - -

Parameter

@@ -181,9 +333,9 @@ int32\_t SdioClaimIrq\(DevHandle handle, SdioIrqHandler \*handler\);

Pointer to the SDIO IRQ function.

Return Value

+

Return Value

Description

+

Description

0

@@ -220,7 +372,7 @@ if (ret != 0) { } ``` -## Performing SDIO Communication +### Performing SDIO Communication - Incrementally write a given length of data into the SDIO device. @@ -228,7 +380,7 @@ The corresponding function is as follows: int32\_t SdioWriteBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**Table 5** Parameters and return values of SdioWriteBytes +**Table 6** Parameters and return values of SdioWriteBytes - -

Parameter

@@ -257,9 +409,9 @@ int32\_t SdioWriteBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint

Length of the data to write.

Return Value

+

Return Value

Description

+

Description

0

@@ -294,7 +446,7 @@ The corresponding function is as follows: int32\_t SdioReadBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**Table 6** Parameters and return values of SdioReadBytes +**Table 7** Parameters and return values of SdioReadBytes - -

Parameter

@@ -323,9 +475,9 @@ int32\_t SdioReadBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint3

Length of the data to read.

Return Value

+

Return Value

Description

+

Description

0

@@ -360,7 +512,7 @@ if (ret != 0) { int32\_t SdioWriteBytesToFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\); - **Table 7** Parameters and return values of SdioWriteBytesToFixedAddr + **Table 8** Parameters and return values of SdioWriteBytesToFixedAddr - - -

Parameter

@@ -391,12 +543,12 @@ if (ret != 0) {

scatterLen

Length of the scatter list. If the value is not 0, the data is of the scatter list type.

+

Length of the scatter list. If the value is not 0, the data is of the scatter list type.

Return Value

+

Return Value

Description

+

Description

0

@@ -431,7 +583,7 @@ if (ret != 0) { int32\_t SdioReadBytesFromFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\); - **Table 8** Parameters and return values of SdioReadBytesFromFixedAddr + **Table 9** Parameters and return values of SdioReadBytesFromFixedAddr - - -

Parameter

@@ -462,12 +614,12 @@ if (ret != 0) {

scatterLen

Length of the scatter list. If the value is not 0, the data is of the scatter list type.

+

Length of the scatter list. If the value is not 0, the data is of the scatter list type.

Return Value

+

Return Value

Description

+

Description

0

@@ -497,13 +649,13 @@ if (ret != 0) { ``` -- Write a given length of data into the address space of SDIO function 0. +- Writes a given length of data into the address space of SDIO function 0. Currently, only 1-byte data can be written. The corresponding function is as follows: int32\_t SdioWriteBytesToFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**Table 9** Parameters and return values of SdioWriteBytesToFunc0 +**Table 10** Parameters and return values of SdioWriteBytesToFunc0 - -

Parameter

@@ -532,9 +684,9 @@ int32\_t SdioWriteBytesToFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t add

Length of the data to write.

Return Value

+

Return Value

Description

+

Description

0

@@ -562,13 +714,13 @@ if (ret != 0) { } ``` -- Read a given length of data from the address space of SDIO function 0. +- Reads a given length of data from the address space of SDIO function 0. Currently, only 1-byte data can be read. The corresponding function is as follows: int32\_t SdioReadBytesFromFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**Table 10** Parameters and return values of SdioReadBytesFromFunc0 +**Table 11** Parameters and return values of SdioReadBytesFromFunc0 - -

Parameter

@@ -597,9 +749,9 @@ int32\_t SdioReadBytesFromFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t ad

Length of the data to read.

Return Value

+

Return Value

Description

+

Description

0

@@ -627,13 +779,13 @@ if (ret != 0) { } ``` -## Releasing the SDIO IRQ +### Releasing the SDIO IRQ After the SDIO communication, release the SDIO IRQ. int32\_t SdioReleaseIrq\(DevHandle handle\); -**Table 11** Parameters and return values of SdioReleaseIrq +**Table 12** Parameters and return values of SdioReleaseIrq - -

Parameter

@@ -647,9 +799,9 @@ int32\_t SdioReleaseIrq\(DevHandle handle\);

Device handle of an SDIO controller.

Return Value

+

Return Value

Description

+

Description

0

@@ -676,13 +828,13 @@ if (ret != 0) { } ``` -## Disabling the SDIO Device +### Disabling the SDIO Device After the SDIO communication, disable the SDIO device. int32\_t SdioDisableFunc\(DevHandle handle\); -**Table 12** Parameters and return values of SdioDisableFunc +**Table 13** Parameters and return values of SdioDisableFunc - -

Parameter

@@ -696,9 +848,9 @@ int32\_t SdioDisableFunc\(DevHandle handle\);

Device handle of an SDIO controller.

Return Value

+

Return Value

Description

+

Description

0

@@ -725,13 +877,13 @@ if (ret != 0) { } ``` -## Releasing the Exclusively Claimed Host +### Releasing the Exclusively Claimed Host After the SDIO communication, release the exclusively claimed host. void SdioReleaseHost\(DevHandle handle\); -**Table 13** Parameter description of SdioReleaseHost +**Table 14** Parameter description of SdioReleaseHost

Parameter

@@ -754,7 +906,7 @@ The following example shows how to release the exclusively claimed host. SdioReleaseHost(handle); /* Release the exclusively claimed host. */ ``` -## Closing an SDIO Controller +### Closing an SDIO Controller After the SDIO communication, close the SDIO controller. @@ -762,7 +914,7 @@ void SdioClose\(DevHandle handle\); This function releases the resources requested. -**Table 14** Parameter description of SdioClose +**Table 15** Parameter description of SdioClose

Parameter

@@ -785,3 +937,132 @@ The following example shows how to close an SDIO controller. SdioClose(handle); /* Close an SDIO controller. */ ``` +## Usage Example + +The following example shows how to use an SDIO device. First, open an SDIO controller whose bus number is 1, exclusively claim a host, enable the SDIO device, claim an SDIO IRQ, and then perform SDIO communication \(such as reading and writing\). After the SDIO communication, release the SDIO IRQ, disable the SDIO device, release the host, and close the SDIO controller. + +``` +#include "hdf_log.h" +#include "sdio_if.h" + +#define TEST_FUNC_NUM 1 /* The I/O function whose ID is 1 is used. */ +#define TEST_FBR_BASE_ADDR 0x100 /* FBR base address of the I/O function whose ID is 1 */ +#define TEST_ADDR_OFFSET 9 /* Address offset of the register to read or write */ +#define TEST_DATA_LEN 3 /* Length of the data to read or write */ +#define TEST_BLOCKSIZE 2 /* Size of a data block, in bytes */ + +/* Implement the SDIO IRQ function based on the application. */ +static void SdioIrqFunc(void *data) +{ + if (data == NULL) { + HDF_LOGE("SdioIrqFunc: data is NULL.\n"); + return; + } + /* You need to add specific implementations. */ +} + +void SdioTestSample(void) +{ + int32_t ret; + DevHandle handle = NULL; + uint8_t data[TEST_DATA_LEN] = {0}; + struct SdioFunctionConfig config = {1, 0x123, 0x456}; + uint8_t val; + uint32_t addr; + + /* Open an SDIO controller whose bus number is 1. */ + handle = SdioOpen(1, &config); + if (handle == NULL) { + HDF_LOGE("SdioOpen: failed!\n"); + return; + } + /* Claim a host exclusively. */ + SdioClaimHost(handle); + /* Enable the SDIO device. */ + ret = SdioEnableFunc(handle); + if (ret != 0) { + HDF_LOGE("SdioEnableFunc: failed, ret %d\n", ret); + goto ENABLE_ERR; + } + /* Claim an SDIO IRQ. */ + ret = SdioClaimIrq(handle, SdioIrqFunc); + if (ret != 0) { + HDF_LOGE("SdioClaimIrq: failed, ret %d\n", ret); + goto CLAIM_IRQ_ERR; + } + /* Set the block size to 2 bytes. */ + ret = SdioSetBlockSize(handle, TEST_BLOCKSIZE); + if (ret != 0) { + HDF_LOGE("SdioSetBlockSize: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Read 3-byte data from the incremental address of an SDIO device. */ + addr = TEST_FBR_BASE_ADDR * TEST_FUNC_NUM + TEST_ADDR_OFFSET; + ret = SdioReadBytes(handle, data, addr, TEST_DATA_LEN); + if (ret != 0) { + HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Write 3-byte data into the incremental address of an SDIO device. */ + ret = SdioWriteBytes(handle, data, addr, TEST_DATA_LEN); + if (ret != 0) { + HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Read 1-byte data from the SDIO device. */ + ret = SdioReadBytes(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Write 1-byte data into the SDIO device. */ + ret = SdioWriteBytes(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Read 3-byte data from the fixed address of an SDIO device. */ + ret = SdioReadBytesFromFixedAddr(handle, data, addr, TEST_DATA_LEN, 0); + if (ret != 0) { + HDF_LOGE("SdioReadBytesFromFixedAddr: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Write 1-byte data to the fixed address of an SDIO device. */ + ret = SdioWriteBytesToFixedAddr(handle, data, addr, 1, 0); + if (ret != 0) { + HDF_LOGE("SdioWriteBytesToFixedAddr: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Read 1-byte data from SDIO function 0. */ + addr = 0x02; + ret = SdioReadBytesFromFunc0(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioReadBytesFromFunc0: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* Write 1-byte data into SDIO function 0. */ + ret = SdioWriteBytesToFunc0(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioWriteBytesToFunc0: failed, ret %d\n", ret); + goto COMM_ERR; + } +COMM_ERR: + /* Release the SDIO IRQ. */ + ret = SdioReleaseIrq(handle); + if (ret != 0) { + HDF_LOGE("SdioReleaseIrq: failed, ret %d\n", ret); + } +CLAIM_IRQ_ERR: + /* Disable the SDIO device. */ + ret = SdioDisableFunc(handle); + if (ret != 0) { + HDF_LOGE("SdioDisableFunc: failed, ret %d\n", ret); + } +ENABLE_ERR: + /* Release the exclusively claimed host. */ + SdioReleaseHost(handle); + /* Close an SDIO controller. */ + SdioClose(handle); +} +``` + diff --git a/en/device-dev/driver/spiusage-guidelines.md b/en/device-dev/driver/driver-platform-spi-des.md similarity index 51% rename from en/device-dev/driver/spiusage-guidelines.md rename to en/device-dev/driver/driver-platform-spi-des.md index f5f9c482c055005b3544881cf16ef8e4e197abc3..b2c1b31147091e2d28ff902727f8ec7c1abfef80 100644 --- a/en/device-dev/driver/spiusage-guidelines.md +++ b/en/device-dev/driver/driver-platform-spi-des.md @@ -1,33 +1,143 @@ -# SPI Usage Guidelines +# SPI -- [How to Use](#section691514116412) -- [Obtaining an SPI Device Handle](#section12372204616215) -- [Obtaining SPI Device Configuration Parameters](#section17121446171311) -- [Setting SPI Device Configuration Parameters](#section97691946634) -- [Performing SPI Communication](#section197116254416) -- [Destroying the SPI Device Handle](#section117661819108) +- [Overview](#section193356154511) + - [Available APIs](#section232141411476) -## How to Use +- [Usage Guidelines](#section71363452477) + - [How to Use](#section32846814820) + - [Obtaining an SPI Device Handle](#section1927265711481) + - [Obtaining SPI Device Configuration Parameters](#section541133418493) + - [Setting SPI Device Configuration Parameters](#section7870106145010) + - [Performing SPI Communication](#section13324155195013) + - [Destroying the SPI Device Handle](#section19661632135117) -[Figure 1](#fig23885455594) shows the process of using an SPI device. +- [Usage Example](#section06541058155120) -**Figure 1** Process of using an SPI device +## Overview +- Serial Peripheral Interface \(SPI\) is a serial bus specification used for high-speed, full-duplex, and synchronous communication. +- SPI is developed by Motorola. It is commonly used for communication with flash memory, real-time clocks, sensors, and analog-to-digital \(A/D\) converters. +- SPI works in controller/device mode. Generally, there is one SPI controller that controls one or more SPI devices. They are connected via four wires: + - SCLK: clock signals output from the SPI controller + - MOSI: data output from the SPI controller and input into an SPI device + - MISO: data output from an SPI device and input into the SPI controller + - CS: signals enabled by an SPI device and controlled by the SPI controller -![](figures/en-us_image_0000001054726248.png) -## Obtaining an SPI Device Handle +- [Figure 1](#fig15227181812587) shows the connection between one SPI controller and two SPI devices \(device A and device B\). In this figure, device A and device B share three pins \(SCLK, MISO, and MOSI\) of the controller. CS0 of device A and CS1 of device B are connected to CS0 and CS1 of the controller, respectively. + +**Figure 1** SPI controller/device connection + + +![](figure/en-us_image_0000001123742254.png) + +- SPI communication is usually initiated by the SPI controller and is operated as follows: + +1. A single SPI device is selected at a time via the CS to communicate with the SPI controller. +2. Clock signals are provided for the selected SPI device via the SCLK. +3. The SPI controller sends data to SPI devices via the MOSI, and receives data from SPI devices via the MISO. + +- SPI can work in one of the following four modes, equivalent to one of the four possible states for Clock Polarity \(CPOL\) and Clock Phase \(CPHA\): + - If both CPOL and CPHA are **0**, the clock signal level is low in the idle state and data is sampled on the first clock edge. + - If CPOL is **0** and CPHA is **1**, the clock signal level is low in the idle state and data is sampled on the second clock edge. + - If CPOL is **1** and CPHA is **0**, the clock signal level is high in the idle state and data is sampled on the first clock edge. + - If both CPOL and CPHA are **1**, the clock signal level is high in the idle state and data is sampled on the second clock edge. + + +- SPI defines a set of common functions for operating an SPI device, including those for: + - Obtaining and releasing the handle of an SPI device. + - Reading or writing data of a specified length from or into an SPI device. + - Customizing data reading or writing via **SpiMsg**. + - Obtaining and setting SPI device configuration parameters. + + +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>Currently, these functions are only applicable in the communication initiated by the SPI controller. + +### Available APIs + +**Table 1** APIs for the SPI driver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

SPI device handle obtaining/releasing

+

SpiOpen

+

Obtains an SPI device handle.

+

SpiClose

+

Releases an SPI device handle.

+

SPI reading/writing

+

SpiRead

+

Reads data of a specified length from an SPI device.

+

SpiWrite

+

Writes data of a specified length into an SPI device.

+

SpiTransfer

+

Transfers SPI data.

+

SPI device configuration

+

+

SpiSetCfg

+

Sets configuration parameters for an SPI device.

+

SpiGetCfg

+

Obtains configuration parameters of an SPI device.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions provided in this document can be called only in kernel space. + +## Usage Guidelines + +### How to Use + +[Figure 2](#fig23885455594) shows the process of using an SPI device. + +**Figure 2** Process of using an SPI device + + +![](figure/en-us_image_0000001123703482.png) + +### Obtaining an SPI Device Handle Before performing SPI communication, obtain an SPI device handle by calling **SpiOpen**. This function returns an SPI device handle with a specified bus number and CS number. DevHandle SpiOpen\(const struct SpiDevInfo \*info\); -**Table 1** Description of **SpiOpen** +**Table 2** Description of **SpiOpen** -

Parameter

+ - - -

Parameter

Description

+

Description

info

@@ -35,9 +145,9 @@ DevHandle SpiOpen\(const struct SpiDevInfo \*info\);

Pointer to the SPI device descriptor.

Return Value

+

Return Value

Description

+

Description

NULL

@@ -69,23 +179,23 @@ if (spiHandle == NULL) { } ``` -## Obtaining SPI Device Configuration Parameters +### Obtaining SPI Device Configuration Parameters After obtaining the SPI device handle, obtain the SPI device configuration parameters by calling the following function: int32\_t SpiGetCfg\(DevHandle handle, struct SpiCfg \*cfg\); -**Table 2** Description of **SpiGetCfg** +**Table 3** Description of **SpiGetCfg** -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the SPI device handle.

+

SPI device handle.

cfg

@@ -93,9 +203,9 @@ int32\_t SpiGetCfg\(DevHandle handle, struct SpiCfg \*cfg\);

Pointer to SPI device configuration parameters.

Return Value

+

Return Value

Description

+

Description

0

@@ -114,29 +224,29 @@ int32\_t SpiGetCfg\(DevHandle handle, struct SpiCfg \*cfg\); ``` int32_t ret; struct SpiCfg cfg = {0}; /* SPI configuration information */ -ret = PalSpiSetCfg(spiHandle, &cfg); /* Set SPI device configuration parameters. */ +ret = SpiGetCfg(spiHandle, &cfg); /* Set SPI device configuration parameters. */ if (ret != 0) { HDF_LOGE("SpiGetCfg: failed, ret %d\n", ret); } ``` -## Setting SPI Device Configuration Parameters +### Setting SPI Device Configuration Parameters After obtaining the SPI device handle, set SPI device configuration parameters by calling the following function: int32\_t SpiSetCfg\(DevHandle handle, struct SpiCfg \*cfg\); -**Table 3** Description of **SpiSetCfg** +**Table 4** Description of **SpiSetCfg** -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the SPI device handle.

+

SPI device handle.

cfg

@@ -144,9 +254,9 @@ int32\_t SpiSetCfg\(DevHandle handle, struct SpiCfg \*cfg\);

Pointer to SPI device configuration parameters.

Return Value

+

Return Value

Description

+

Description

0

@@ -165,8 +275,8 @@ int32\_t SpiSetCfg\(DevHandle handle, struct SpiCfg \*cfg\); ``` int32_t ret; struct SpiCfg cfg = {0}; /* SPI configuration information */ -cfg.mode = SPI_MODE_LOOP; /* Communicate in loopback mode. */ -cfg.comMode = PAL_SPI_POLLING_TRANSFER; /* Communicate in polling mode. */ +cfg.mode = SPI_MODE_LOOP; /* Communication in loopback mode */ +cfg.transferMode = PAL_SPI_POLLING_TRANSFER; /* Communication in polling mode */ cfg.maxSpeedHz = 115200; /* Maximum transmission frequency */ cfg.bitsPerWord = 8; /* The width of per word to be read or written is 8 bits. */ ret = SpiSetCfg(spiHandle, &cfg); /* Set SPI device configuration parameters. */ @@ -175,25 +285,25 @@ if (ret != 0) { } ``` -## Performing SPI Communication +### Performing SPI Communication -- Writing data of a specified length into an SPI device +- Writing data of a specific length into an SPI device To write data into an SPI device only once, call the following function: int32\_t SpiWrite\(DevHandle handle, uint8\_t \*buf, uint32\_t len\); -**Table 4** Description of **SpiWrite** +**Table 5** Description of **SpiWrite** -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the SPI device handle.

+

SPI device handle.

buf

@@ -206,9 +316,9 @@ int32\_t SpiWrite\(DevHandle handle, uint8\_t \*buf, uint32\_t len\);

Length of the data to write.

Return Value

+

Return Value

Description

+

Description

0

@@ -227,30 +337,30 @@ int32\_t SpiWrite\(DevHandle handle, uint8\_t \*buf, uint32\_t len\); ``` int32_t ret; uint8_t wbuff[4] = {0x12, 0x34, 0x56, 0x78}; -/* Write data of a specified length into an SPI device. */ +/* Write data of a specific length into an SPI device. */ ret = SpiWrite(spiHandle, wbuff, 4); if (ret != 0) { HDF_LOGE("SpiWrite: failed, ret %d\n", ret); } ``` -- Reading data of a specified length from an SPI device +- Reading data of a specific length from an SPI device To read data from an SPI device only once, call the following function: int32\_t SpiRead\(DevHandle handle, uint8\_t \*buf, uint32\_t len\); -**Table 5** Description of **SpiRead** +**Table 6** Description of **SpiRead** -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the SPI device handle.

+

SPI device handle.

buf

@@ -263,9 +373,9 @@ int32\_t SpiRead\(DevHandle handle, uint8\_t \*buf, uint32\_t len\);

Length of the data to read.

Return Value

+

Return Value

Description

+

Description

0

@@ -284,7 +394,7 @@ int32\_t SpiRead\(DevHandle handle, uint8\_t \*buf, uint32\_t len\); ``` int32_t ret; uint8_t rbuff[4] = {0}; -/* Read data of a specified length from an SPI device. */ +/* Read data of a specific length from an SPI device. */ ret = SpiRead(spiHandle, rbuff, 4); if (ret != 0) { HDF_LOGE("SpiRead: failed, ret %d\n", ret); @@ -297,17 +407,17 @@ To launch a custom transfer, call the following function: int32\_t SpiTransfer\(DevHandle handle, struct SpiMsg \*msgs, uint32\_t count\); -**Table 6** Description of **SpiTransfer** +**Table 7** Description of **SpiTransfer** -

Parameter

+ - - - - -

Parameter

Description

+

Description

handle

Pointer to the SPI device handle.

+

SPI device handle.

msgs

@@ -317,12 +427,12 @@ int32\_t SpiTransfer\(DevHandle handle, struct SpiMsg \*msgs, uint32\_t count\);

count

Length of the message array.

+

Number of messages in the message array.

Return Value

+

Return Value

Description

+

Description

0

@@ -343,9 +453,9 @@ int32_t ret; uint8_t wbuff[1] = {0x12}; uint8_t rbuff[1] = {0}; struct SpiMsg msg; /* Custom message to be transferred */ -msg.wbuf = wbuff; /* Pointer to the data to read */ +msg.wbuf = wbuff; /* Pointer to the data to write */ msg.rbuf = rbuff; /* Pointer to the data to read */ -msg.len = 1; /* The length of the data to be read or written is 1 bit. */ +msg.len = 1; /* The length of the data to read or write is 1 bit. */ msg.csChange = 1; /* Disable the CS before the next transfer. */ msg.delayUs = 0; /* No delay before the next transfer */ msg.speed = 115200; /* Speed of this transfer */ @@ -356,7 +466,7 @@ if (ret != 0) { } ``` -## Destroying the SPI Device Handle +### Destroying the SPI Device Handle After the SPI communication, destroy the SPI device handle by calling the following function: @@ -364,17 +474,17 @@ void SpiClose\(DevHandle handle\); This function will release the resources previously obtained. -**Table 7** Description of **SpiClose** +**Table 8** Description of **SpiClose** -

Parameter

+ - - @@ -384,3 +494,73 @@ This function will release the resources previously obtained. PalHandleDestroy(spiHandle); /* Destroy the SPI device handle. */ ``` +## Usage Example + +The following example shows how to obtain an SPI device handle, set the configuration parameters, and then read or write data from or into the SPI device, and finally destroy the SPI device handle. + +``` +#include "hdf_log.h" +#include "spi_if.h" + +void SpiTestSample(void) +{ + int32_t ret; + struct SpiCfg cfg; /* SPI device configuration information */ + struct SpiDevInfo spiDevinfo; /* SPI device descriptor */ + DevHandle spiHandle = NULL; /* SPI device handle */ + struct SpiMsg msg; /* Custom message to be transferred */ + uint8_t rbuff[4] = { 0 }; + uint8_t wbuff[4] = { 0x12, 0x34, 0x56, 0x78 }; + uint8_t wbuff2[4] = { 0xa1, 0xb2, 0xc3, 0xd4 }; + + spiDevinfo.busNum = 0; /* SPI device bus number */ + spiDevinfo.csNum = 0; /* SPI device CS number */ + spiHandle = SpiOpen(&spiDevinfo); /* Obtain an SPI device handle based on spiDevinfo. */ + if (spiHandle == NULL) { + HDF_LOGE("SpiOpen: failed\n"); + return; + } + /* Obtain configuration parameters of an SPI device. */ + ret = SpiGetCfg(spiHandle, &cfg); + if (ret != 0) { + HDF_LOGE("SpiGetCfg: failed, ret %d\n", ret); + goto err; + } + cfg.maxSpeedHz = 115200; /* Change the maximum clock frequency to 115200. */ + cfg.bitsPerWord = 8; /* Change the word width to 8 bits. */ + /* Set configuration parameters for an SPI device. */ + ret = SpiSetCfg(spiHandle, &cfg); + if (ret != 0) { + HDF_LOGE("SpiSetCfg: failed, ret %d\n", ret); + goto err; + } + /* Write specified length of data into an SPI device. */ + ret = SpiWrite(spiHandle, wbuff, 4); + if (ret != 0) { + HDF_LOGE("SpiWrite: failed, ret %d\n", ret); + goto err; + } + /* Read data of a specified length from an SPI device. */ + ret = SpiRead(spiHandle, rbuff, 4); + if (ret != 0) { + HDF_LOGE("SpiRead: failed, ret %d\n", ret); + goto err; + } + msg.wbuf = wbuff2; /* Pointer to the data to write */ + msg.rbuf = rbuff; /* Pointer to the data to read */ + msg.len = 4; /* The length of the data to read or write is 4 bits. */ + msg.csChange = 1; /* Disable the CS before the next transfer. */ + msg.delayUs = 0; /* No delay before the next transfer */ + msg.speed = 115200; /* Speed of this transfer */ + /* Launch a custom transfer. The number of messages to be transferred is 1. */ + ret = SpiTransfer(spiHandle, &msg, 1); + if (ret != 0) { + HDF_LOGE("SpiTransfer: failed, ret %d\n", ret); + goto err; + } +err: + /* Destroy the SPI device handle. */ + SpiClose(spiHandle); +} +``` + diff --git a/en/device-dev/driver/uartusage-guidelines.md b/en/device-dev/driver/driver-platform-uart-des.md similarity index 58% rename from en/device-dev/driver/uartusage-guidelines.md rename to en/device-dev/driver/driver-platform-uart-des.md index edd894e92db887d324ef8b51934c720791bb8b5e..a789594525e5d6ebb9270dadd540a35e3d76f887 100644 --- a/en/device-dev/driver/uartusage-guidelines.md +++ b/en/device-dev/driver/driver-platform-uart-des.md @@ -1,37 +1,146 @@ -# UART Usage Guidelines +# UART -- [How to Use](#section47784125013) -- [Obtaining a UART Device Handle](#section146445153110) -- [Setting the UART Baud Rate](#section1862705516339) -- [Obtaining the UART Baud Rate](#section1263651563414) -- [Setting the UART Device Attributes](#section1770091483814) -- [Obtaining UART Device Attributes](#section117543316384) -- [Setting the UART Transmission Mode](#section187233112369) -- [Writing Data of a Specified Length into a UART Device](#section82416423368) -- [Reading Data of a Specified Length from a UART Device](#section192177171373) -- [Destroying the UART Device Handle](#section63131236354) +- [Overview](#section833012453535) + - [Available APIs](#section1680292311549) -## How to Use +- [Usage Guidelines](#section12779050105412) + - [How to Use](#section1858116395510) + - [Obtaining a UART Device Handle](#section124512065617) + - [Setting the UART Baud Rate](#section86881004579) + - [Obtaining the UART Baud Rate](#section897032965712) + - [Setting the UART Device Attributes](#section129141884588) + - [Obtaining UART Device Attributes](#section18689637165812) + - [Setting the UART Transmission Mode](#section72713435918) + - [Writing Data of a Specified Length into a UART Device](#section128001736155919) + - [Reading Data of a Specified Length from a UART Device](#section92851601604) + - [Destroying the UART Device Handle](#section1477410521406) -[Figure 1](#fig1852173020185) shows the process of using a UART device. +- [Usage Example](#section35404241311) -**Figure 1** Process of using a UART device +## Overview +- The Universal Asynchronous Receiver/Transmitter \(UART\) is a universal serial data bus used for asynchronous communication. It enables bi-directional communication between devices in full-duplex mode. +- UART is widely used to print information for debugging or to connect to various external modules such as GPS and Bluetooth. +- A UART is connected to other modules through two wires \(as shown in [Figure 1](#fig209936401896)\) or four wires \(as shown in [Figure 2](#fig1435614171015)\). + - TX: TX pin of the transmitting UART. It is connected to the RX pin of the peer UART. + - RX: RX pin of the receiving UART. It is connected to the TX pin of the peer UART. + - RTS: Request to Send signal pin. It is connected to the CTS pin of the peer UART and is used to indicate whether the local UART is ready to receive data. + - CTS: Clear to Send signal pin. It is connected to the RTS pin of the peer UART and is used to indicate whether the local UART is allowed to send data to the peer end. -![](figures/en-us_image_0000001054006983.png) + **Figure 1** 2-wire UART communication + -## Obtaining a UART Device Handle + ![](figure/en-us_image_0000001170262141.png) + + **Figure 2** 4-wire UART communication + + + ![](figure/en-us_image_0000001123582482.png) + + +- The transmitting and receiving UARTs must ensure that they have the same settings on particular attributes such as the baud rate and data format \(start bit, data bit, parity bit, and stop bit\) before they start to communicate. During data transmission, a UART sends data to the peer end over the TX pin and receives data from the peer end over the RX pin. When the size of the buffer used by a UART for storing received data reaches the preset threshold, the RTS signal of the UART changes to **1** \(data cannot be received\), and the peer UART stops sending data to it because its CTS signal does not allow it to send data. +- The UART interface defines a set of common functions for operating a UART port, including obtaining and releasing device handles, reading and writing data of a specified length, and obtaining and setting the baud rate, as well as the device attributes. + +### Available APIs + +**Table 1** APIs for the UART driver + + +

Parameter

Description

+

Description

handle

Pointer to the SPI device handle

+

SPI device handle.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

Obtaining and releasing device handles

+

+

UartOpen

+

Obtains the UART device handle.

+

UartClose

+

Releases a specified UART device handle.

+

Reading and writing data

+

+

UartRead

+

Reads data of a specified length from a UART device.

+

UartWrite

+

Writes data of a specified length into a UART device.

+

Obtaining and setting the baud rate

+

UartGetBaud

+

Obtains the UART baud rate.

+

UartSetBaud

+

Sets the UART baud rate.

+

Obtaining and setting device attributes

+

+

UartGetAttribute

+

Obtains the UART device attributes.

+

UartSetAttribute

+

Sets the UART device attributes.

+

Setting the transmission mode

+

UartSetTransMode

+

Sets the UART transmission mode.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All functions provided in this document can be called only in kernel space. + +## Usage Guidelines + +### How to Use + +[Figure 3](#fig1852173020185) shows the process of using a UART device. + +**Figure 3** Process of using a UART device + + +![](figure/en-us_image_0000001170227689.png) + +### Obtaining a UART Device Handle Before performing UART communication, call **UartOpen** to obtain a UART device handle. This function returns the pointer to the UART device handle with a specified port number. DevHandle UartOpen\(uint32\_t port\); -**Table 1** Description of **UartOpen** +**Table 2** Description of UartOpen -

Parameter

+ - @@ -40,9 +149,9 @@ DevHandle UartOpen\(uint32\_t port\); - - - @@ -70,24 +179,24 @@ if (handle == NULL) { } ``` -## Setting the UART Baud Rate +### Setting the UART Baud Rate After obtaining the UART device handle, set the UART baud rate by calling the following function: int32\_t UartSetBaud\(DevHandle handle, uint32\_t baudRate\); -**Table 2** Description of **UartSetBaud** +**Table 3** Description of UartSetBaud -

Parameter

Description

+

Description

UART port number.

Return Value

+

Return Value

Description

+

Description

NULL

@@ -52,7 +161,7 @@ DevHandle UartOpen\(uint32\_t port\);

Device handle

Pointer to the UART device handle.

+

UART device handle.

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

baudRate

@@ -95,9 +204,9 @@ int32\_t UartSetBaud\(DevHandle handle, uint32\_t baudRate\);

Baud rate of the UART to set.

Return Value

+

Return Value

Description

+

Description

0

@@ -124,24 +233,24 @@ if (ret != 0) { } ``` -## Obtaining the UART Baud Rate +### Obtaining the UART Baud Rate After setting the UART baud rate, obtain the current baud rate by calling the following function: int32\_t UartGetBaud\(DevHandle handle, uint32\_t \*baudRate\); -**Table 3** Description of **UartGetBaud** +**Table 4** Description of UartGetBaud -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

baudRate

@@ -149,9 +258,9 @@ int32\_t UartGetBaud\(DevHandle handle, uint32\_t \*baudRate\);

Pointer to the UART baud rate.

Return Value

+

Return Value

Description

+

Description

0

@@ -179,24 +288,24 @@ if (ret != 0) { } ``` -## Setting the UART Device Attributes +### Setting the UART Device Attributes Before performing UART communication, set the UART device attributes by calling the following function: int32\_t UartSetAttribute\(DevHandle handle, struct UartAttribute \*attribute\); -**Table 4** Description of **UartSetAttribute** +**Table 5** Description of UartSetAttribute -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

attribute

@@ -204,9 +313,9 @@ int32\_t UartSetAttribute\(DevHandle handle, struct UartAttribute \*attribute\);

Pointer to the UART device attributes to set.

Return Value

+

Return Value

Description

+

Description

0

@@ -241,24 +350,24 @@ if (ret != 0) { } ``` -## Obtaining UART Device Attributes +### Obtaining UART Device Attributes After setting the UART device attributes, obtain the current device attributes by calling the following function: int32\_t UartGetAttribute\(DevHandle handle, struct UartAttribute \*attribute\); -**Table 5** Description of **UartGetAttribute** +**Table 6** Description of UartGetAttribute -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

attribute

@@ -266,9 +375,9 @@ int32\_t UartGetAttribute\(DevHandle handle, struct UartAttribute \*attribute\);

Pointer to the UART device attributes.

Return Value

+

Return Value

Description

+

Description

0

@@ -296,24 +405,24 @@ if (ret != 0) { } ``` -## Setting the UART Transmission Mode +### Setting the UART Transmission Mode Before performing UART communication, set the UART transmission mode by calling the following function: int32\_t UartSetTransMode\(DevHandle handle, enum UartTransMode mode\); -**Table 6** Description of **UartSetTransMode** +**Table 7** Description of UartSetTransMode -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

mode

@@ -321,9 +430,9 @@ int32\_t UartSetTransMode\(DevHandle handle, enum UartTransMode mode\);

UART transmission mode to set.

Return Value

+

Return Value

Description

+

Description

0

@@ -350,24 +459,24 @@ if (ret != 0) { } ``` -## Writing Data of a Specified Length into a UART Device +### Writing Data of a Specified Length into a UART Device To write data into a UART device, call the following function: int32\_t UartWrite\(DevHandle handle, uint8\_t \*data, uint32\_t size\); -**Table 7** Description of **UartWrite** +**Table 8** Description of UartWrite -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

data

@@ -380,9 +489,9 @@ int32\_t UartWrite\(DevHandle handle, uint8\_t \*data, uint32\_t size\);

Length of the data to write.

Return Value

+

Return Value

Description

+

Description

0

@@ -410,24 +519,24 @@ if (ret != 0) { } ``` -## Reading Data of a Specified Length from a UART Device +### Reading Data of a Specified Length from a UART Device -To read data from a UART device, call the following function: +To write data into a UART device, call the following function: int32\_t UartRead\(DevHandle handle, uint8\_t \*data, uint32\_t size\); -**Table 8** Description of **UartRead** +**Table 9** Description of UartRead -

Parameter

+ - - - -

Parameter

Description

+

Description

handle

Pointer to the UART device handle.

+

UART device handle.

data

@@ -440,9 +549,9 @@ int32\_t UartRead\(DevHandle handle, uint8\_t \*data, uint32\_t size\);

Length of the data to read.

Return Value

+

Return Value

Description

+

Description

Non-negative value

@@ -470,10 +579,10 @@ if (ret < 0) { } ``` ->![](public_sys-resources/icon-caution.gif) **CAUTION:** +>![](../public_sys-resources/icon-caution.gif) **CAUTION:** >Data is successfully read from the UART device if a non-negative value is returned. If the return value is **0**, no valid data can be read from the UART device. If the return value is greater than **0**, the return value is the length of the data actually read from the UART device. The length is less than or equal to the value of **size** and does not exceed the maximum length of data to read at a time specified by the UART controller in use. -## Destroying the UART Device Handle +### Destroying the UART Device Handle After the UART communication, destroy the UART device handle by calling the following function: @@ -481,18 +590,18 @@ void UartClose\(DevHandle handle\); This function will release the resources previously obtained. -**Table 9** Description of **UartClose** +**Table 10** Description of UartClose -

Parameter

+ - - @@ -504,3 +613,70 @@ The following example shows how to destroy the UART device handle: UartClose(handle); /* Destroy the UART device handle. */ ``` +## Usage Example + +The following is a usage example of a UART device, including how to obtain the UART device handle, set the baud rate, device attributes, and transmission mode, read data from or write data into the UART device, and then destroy the UART device handle. + +``` +#include "hdf_log.h" +#include "uart_if.h" + +void UartTestSample(void) +{ + int32_t ret; + uint32_t port; + DevHandle handle = NULL; + uint8_t wbuff[5] = { 1, 2, 3, 4, 5 }; + uint8_t rbuff[5] = { 0 }; + struct UartAttribute attribute; + attribute.dataBits = UART_ATTR_DATABIT_7; /* Set the number of data bits to 7. */ + attribute.parity = UART_ATTR_PARITY_NONE; /* Set the parity bit to no parity. */ + attribute.stopBits = UART_ATTR_STOPBIT_1; /* Set the stop bit to 1. */ + attribute.rts = UART_ATTR_RTS_DIS; /* Disable the RTS signal. */ + attribute.cts = UART_ATTR_CTS_DIS; /* Disable the CTS signal. */ + attribute.fifoRxEn = UART_ATTR_RX_FIFO_EN; /* Enable RX FIFO. */ + attribute.fifoTxEn = UART_ATTR_TX_FIFO_EN; /* Enable TX FIFO. */ + /* Set the UART port number actually used. */ + port = 1; + /* Obtain the UART device handle. */ + handle = UartOpen(port); + if (handle == NULL) { + HDF_LOGE("UartOpen: failed!\n"); + return; + } + /* Set the UART baud rate to 9600. */ + ret = UartSetBaud(handle, 9600); + if (ret != 0) { + HDF_LOGE("UartSetBaud: failed, ret %d\n", ret); + goto _ERR; + } + /* Set the UART device attributes. */ + ret = UartSetAttribute(handle, &attribute); + if (ret != 0) { + HDF_LOGE("UartSetAttribute: failed, ret %d\n", ret); + goto _ERR; + } + /* Set the UART transmission mode to non-blocking mode. */ + ret = UartSetTransMode(handle, UART_MODE_RD_NONBLOCK); + if (ret != 0) { + HDF_LOGE("UartSetTransMode: failed, ret %d\n", ret); + goto _ERR; + } + /* Write 5-byte data into the UART device. */ + ret = UartWrite(handle, wbuff, 5); + if (ret != 0) { + HDF_LOGE("UartWrite: failed, ret %d\n", ret); + goto _ERR; + } + /* Read 5-byte data from the UART device. */ + ret = UartRead(handle, rbuff, 5); + if (ret < 0) { + HDF_LOGE("UartRead: failed, ret %d\n", ret); + goto _ERR; + } +_ERR: + /* Destroy the UART device handle. */ + UartClose(handle); +} +``` + diff --git a/en/device-dev/driver/watchdogusage-guidelines.md b/en/device-dev/driver/driver-platform-watchdog-des.md similarity index 55% rename from en/device-dev/driver/watchdogusage-guidelines.md rename to en/device-dev/driver/driver-platform-watchdog-des.md index e3eb5c091fb98497a9bc2f31dfe40cb69df93244..ddaddc1abe08efca457b46b26db353dc0df06f2e 100644 --- a/en/device-dev/driver/watchdogusage-guidelines.md +++ b/en/device-dev/driver/driver-platform-watchdog-des.md @@ -1,38 +1,117 @@ -# Watchdog Usage Guidelines +# Watchdog -- [How to Use](#section0719414187) -- [Opening a Watchdog](#section198171379261) -- [Obtaining the Watchdog Status](#section206592910275) -- [Setting the Timeout Duration](#section19605128182714) -- [Obtaining the Timeout Duration](#section11111516208) -- [Starting a Watchdog](#section141174192814) -- [Feeding a Watchdog](#section179101435113910) -- [Stopping a Watchdog](#section15282123192816) -- [Closing a Watchdog](#section7857850173411) +- [Overview](#section14918241977) + - [Available APIs](#section20177131219818) -## How to Use +- [Usage Guidelines](#section10103184312813) + - [How to Use](#section10181195910815) + - [Opening a Watchdog](#section66089201107) + - [Obtaining the Watchdog Status](#section786624341011) + - [Setting the Timeout Duration](#section182386137111) + - [Obtaining the Timeout Duration](#section1883310371114) + - [Starting a Watchdog](#section82501405123) + - [Feeding a Watchdog](#section3547530101211) + - [Stopping a Watchdog](#section944595841217) + - [Closing a Watchdog](#section96561824121311) + +- [Usage Example](#section1724514523135) + +## Overview + +A watchdog, also called a watchdog timer, is a hardware timing device. If an error occurs in the main program of the system and fails to reset the watchdog timer, the watchdog timer sends a reset signal to restore the system to a normal state. + +### Available APIs + +**Table 1** Watchdog APIs + + +

Parameter

Description

+

Description

handle

Pointer to the UART device handle

+

UART device handle.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Capability

+

Function

+

Description

+

Open/Close

+

WatchdogOpen

+

Opens a watchdog.

+

WatchdogClose

+

Closes a watchdog.

+

Start/Stop

+

WatchdogStart

+

Starts a watchdog.

+

WatchdogStop

+

Stops a watchdog.

+

Timeout duration

+

WatchdogSetTimeout

+

Sets the watchdog timeout duration.

+

WatchdogGetTimeout

+

Obtains the watchdog timeout duration.

+

Status

+

WatchdogGetStatus

+

Obtains the watchdog status.

+

Feeding

+

WatchdogFeed

+

Feeds a watchdog, or resets a watchdog timer.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>All watchdog functions provided in this document can be called only in kernel mode. + +## Usage Guidelines + +### How to Use [Figure 1](#fig19134125410189) illustrates the process of using a watchdog. **Figure 1** Process of using a watchdog -![](figures/en-us_image_0000001057622716.png) +![](figure/en-us_image_0000001170229891.png) -## Opening a Watchdog +### Opening a Watchdog -Use **WatchdogOpen** to open a watchdog. A system may have multiple watchdogs. You can open a specified watchdog by using the ID. +Use **WatchdogOpen** to open a watchdog. A system may have multiple watchdogs. You can open the specified watchdog by using the ID. -int32\_t WatchdogOpen\(int16\_t wdtId\); +int32\_t WatchdogOpen\(int16\_t wdtId\); -. - -**Table 1** Description of WatchdogOpen +**Table 2** Description of WatchdogOpen -

Parameter

+ - @@ -41,9 +120,9 @@ int32\_t WatchdogOpen\(int16\_t wdtId\); - - - @@ -68,18 +147,16 @@ if (handle == NULL) { } ``` -## Obtaining the Watchdog Status - -int32\_t WatchdogGetStatus\(DevHandle handle, int32\_t \*status\); +### Obtaining the Watchdog Status -. +int32\_t WatchdogGetStatus\(DevHandle handle, int32\_t \*status\); -**Table 2** Description of WatchdogGetStatus +**Table 3** Description of WatchdogGetStatus -

Parameter

Description

+

Description

Watchdog ID.

Return Value

+

Return Value

Description

+

Description

NULL

@@ -51,7 +130,7 @@ int32\_t WatchdogOpen\(int16\_t wdtId\);

Failed to open the watchdog.

DevHandle pointer

+

DevHandle pointer

Pointer to the watchdog handle.

Parameter

+ - @@ -93,9 +170,9 @@ int32\_t WatchdogGetStatus\(DevHandle handle, int32\_t \*status\); - -

Parameter

Description

+

Description

Pointer to the watchdog status.

Return Value

+

Return Value

Description

+

Description

0

@@ -122,16 +199,16 @@ if (ret != 0) { } ``` -## Setting the Timeout Duration +### Setting the Timeout Duration -int32\_t WatchdogSetTimeout\(PalHandle \*handle, uint32\_t seconds\); +int32\_t WatchdogSetTimeout\(PalHandle \*handle, uint32\_t seconds\); -**Table 3** Description of WatchdogSetTimeout +**Table 4** Description of WatchdogSetTimeout - - - -

Parameter

+ - @@ -145,9 +222,9 @@ int32\_t WatchdogSetTimeout\(PalHandle \*handle, uint32\_t seconds\); - - -

Parameter

Description

+

Description

Timeout duration, in seconds.

Return Value

+

Return Value

Description

+

Description

0

@@ -174,16 +251,16 @@ if (ret != 0) { } ``` -## Obtaining the Timeout Duration +### Obtaining the Timeout Duration -int32\_t WatchdogGetTimeout\(PalHandle \*handle, uint32\_t \*seconds\); +int32\_t WatchdogGetTimeout\(PalHandle \*handle, uint32\_t \*seconds\); -**Table 4** Description of WatchdogGetTimeout +**Table 5** Description of WatchdogGetTimeout - - diff --git a/en/device-dev/porting/porting-a-library-built-using-makefile.md b/en/device-dev/porting/transplant-thirdparty-makefile.md similarity index 98% rename from en/device-dev/porting/porting-a-library-built-using-makefile.md rename to en/device-dev/porting/transplant-thirdparty-makefile.md index ed7a88af264885f96282dd63ae5827083dfc8a49..a6d80725a238b519b3b72950255ccfb1ed9050df 100644 --- a/en/device-dev/porting/porting-a-library-built-using-makefile.md +++ b/en/device-dev/porting/transplant-thirdparty-makefile.md @@ -148,7 +148,7 @@ The following steps show how to configure and modify the toolchains for cross-co ## Library Test -The test procedure for the yxml library is similar to that for the double-conversion library. For details, see the procedure described in [Porting a Library Built Using CMake](porting-a-library-built-using-cmake.md#section6686144293611). The following describes how to use the test cases of the yxml library. +The test procedure for the yxml library is similar to that for the double-conversion library. For details, see the procedure described in [Porting a Library Built Using CMake](transplant-thirdparty-cmake.md#section6686144293611). The following describes how to use the test cases of the yxml library. **Table 3** Directory structure of the test directory @@ -236,7 +236,7 @@ The following operations are performed based on the assumption that the OpenHarm ## Adding the Compiled yxml Library to the OpenHarmony Project -The procedure for adding the yxml library is almost the same as that for adding the double-conversion library, except that the implementation of **build.gn** and **config.gni** files. For details, see the procedure described in [Porting a Library Built Using CMake](porting-a-library-built-using-cmake.md#section1651053153715). +The procedure for adding the yxml library is almost the same as that for adding the double-conversion library, except that the implementation of **build.gn** and **config.gni** files. For details, see the procedure described in [Porting a Library Built Using CMake](transplant-thirdparty-cmake.md#section1651053153715). - The implementation of the newly added **BUILD.gn** file in the yxml library is as follows: @@ -289,7 +289,7 @@ if (TEST_ENABLE == "YES") { - diff --git a/en/device-dev/porting/overview.md b/en/device-dev/porting/transplant-thirdparty-overview.md similarity index 100% rename from en/device-dev/porting/overview.md rename to en/device-dev/porting/transplant-thirdparty-overview.md diff --git a/en/device-dev/porting/transplant-thirdparty.md b/en/device-dev/porting/transplant-thirdparty.md new file mode 100644 index 0000000000000000000000000000000000000000..c8b071004faf57fb2255574649181cd04e7c12aa --- /dev/null +++ b/en/device-dev/porting/transplant-thirdparty.md @@ -0,0 +1,9 @@ +# Third-Party Library Porting Guide + +- **[Overview](transplant-thirdparty-overview.md)** + +- **[Porting a Library Built Using CMake](transplant-thirdparty-cmake.md)** + +- **[Porting a Library Built Using Makefile](transplant-thirdparty-makefile.md)** + + diff --git a/en/device-dev/porting/transplant.md b/en/device-dev/porting/transplant.md new file mode 100644 index 0000000000000000000000000000000000000000..059e5ea0f84e85155b49e626989d2585c81a56e4 --- /dev/null +++ b/en/device-dev/porting/transplant.md @@ -0,0 +1,9 @@ +# Porting + +- **[Third-Party Library Porting Guide](transplant-thirdparty.md)** + +- **[Mini System SoC Porting Guide](transplant-minichip.md)** + +- **[Small System SoC Porting Guide](transplant-smallchip.md)** + + diff --git a/en/device-dev/bundles/public_sys-resources/icon-caution.gif b/en/device-dev/public_sys-resources/icon-caution.gif similarity index 100% rename from en/device-dev/bundles/public_sys-resources/icon-caution.gif rename to en/device-dev/public_sys-resources/icon-caution.gif diff --git a/en/device-dev/bundles/public_sys-resources/icon-danger.gif b/en/device-dev/public_sys-resources/icon-danger.gif similarity index 100% rename from en/device-dev/bundles/public_sys-resources/icon-danger.gif rename to en/device-dev/public_sys-resources/icon-danger.gif diff --git a/en/device-dev/bundles/public_sys-resources/icon-note.gif b/en/device-dev/public_sys-resources/icon-note.gif similarity index 100% rename from en/device-dev/bundles/public_sys-resources/icon-note.gif rename to en/device-dev/public_sys-resources/icon-note.gif diff --git a/en/device-dev/bundles/public_sys-resources/icon-notice.gif b/en/device-dev/public_sys-resources/icon-notice.gif similarity index 100% rename from en/device-dev/bundles/public_sys-resources/icon-notice.gif rename to en/device-dev/public_sys-resources/icon-notice.gif diff --git a/en/device-dev/bundles/public_sys-resources/icon-tip.gif b/en/device-dev/public_sys-resources/icon-tip.gif similarity index 100% rename from en/device-dev/bundles/public_sys-resources/icon-tip.gif rename to en/device-dev/public_sys-resources/icon-tip.gif diff --git a/en/device-dev/bundles/public_sys-resources/icon-warning.gif b/en/device-dev/public_sys-resources/icon-warning.gif similarity index 100% rename from en/device-dev/bundles/public_sys-resources/icon-warning.gif rename to en/device-dev/public_sys-resources/icon-warning.gif diff --git a/en/device-dev/quick-start/Readme-EN.md b/en/device-dev/quick-start/Readme-EN.md index 7c52dded2505a5db6cd57a6614e2f3665ccf66e8..5918e119962acd7a10c1f97cc44404739148e0e9 100644 --- a/en/device-dev/quick-start/Readme-EN.md +++ b/en/device-dev/quick-start/Readme-EN.md @@ -1,42 +1,40 @@ -# Getting Started +# Getting Started -- [Overview](overview.md) -- [Mini and Small Systems](mini-and-small-systems.md) - - [Overview](overview-0.md) - - [Introduction to the Development Boards](introduction-to-the-development-boards.md) - - [Hi3861 Development Board](hi3861-development-board.md) - - [Hi3516 Development Board](hi3516-development-board.md) - - [Hi3518 Development Board](hi3518-development-board.md) +- [Mini and Small Systems](quickstart-lite.md) + - [Overview](quickstart-lite-overview.md) + - [Introduction to the Development Boards](quickstart-lite-introduction.md) + - [Hi3861 Development Board](quickstart-lite-introduction-hi3861.md) + - [Hi3516 Development Board](quickstart-lite-introduction-hi3516.md) + - [Hi3518 Development Board](quickstart-lite-introduction-hi3518.md) - - [Environment Setup](environment-setup.md) - - [Overview](overview-1.md) - - [Windows Development Environment](windows-development-environment.md) - - [Ubuntu Build Environment](ubuntu-build-environment.md) - - [FAQ](faq.md) + - [Environment Setup](quickstart-lite-env-setup.md) + - [Overview](quickstart-lite-env-setup-des.md) + - [Windows Development Environment](quickstart-lite-env-setup-win.md) + - [Ubuntu Build Environment](quickstart-lite-env-setup-lin.md) + - [FAQ](quickstart-lite-env-setup-faqs.md) - - [How to Develop](how-to-develop.md) - - [Hi3861](hi3861.md) - - [Setting Up the Environment](setting-up-the-environment.md) - - [WLAN Connection](wlan-connection.md) - - [Running a Hello World Program](running-a-hello-world-program.md) - - [FAQs](faqs.md) + - [How to Develop](quickstart-lite-steps.md) + - [Hi3861](quickstart-lite-steps-board3861.md) + - [Setting Up the Environment](quickstart-lite-steps-board3861-setting.md) + - [WLAN Connection](quickstart-lite-steps-board3861-connection.md) + - [Running a Hello World Program](quickstart-lite-steps-board3861-running.md) + - [FAQs](quickstart-lite-steps-board3861-faqs.md) - - [Hi3516](hi3516.md) - - [Setting Up the Environment](setting-up-the-environment-2.md) - - [Running a Hello OHOS Program](running-a-hello-ohos-program.md) - - [Developing a Driver](developing-a-driver.md) - - [FAQs](faqs-3.md) + - [Hi3516](quickstart-lite-steps-board3516.md) + - [Setting Up the Environment](quickstart-lite-steps-board3516-setting.md) + - [Running a Hello OHOS Program](quickstart-lite-steps-board3516-running.md) + - [Developing a Driver](quickstart-lite-steps-board3516-program.md) + - [FAQs](quickstart-lite-steps-board3516-faqs.md) - - [Hi3518](hi3518.md) - - [Setting Up the Environment](setting-up-the-environment-4.md) - - [Running a Hello OHOS Program](running-a-hello-ohos-program-5.md) - - [FAQs](faqs-6.md) - -- [Standard System](standard-system.md) - - [Introduction](introduction.md) - - [Setting Up Windows Development Environment](setting-up-windows-development-environment.md) - - [Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code](setting-up-ubuntu-development-environment-in-docker-mode-and-building-source-code.md) - - [Setting Up Ubuntu Development Environment with Installation Package and Building Source Code](setting-up-ubuntu-development-environment-with-installation-package-and-building-source-code.md) - - [Burning Images](burning-images.md) - - [FAQs](faqs-7.md) + - [Hi3518](quickstart-lite-steps-board3518.md) + - [Setting Up the Environment](quickstart-lite-steps-board3518-setting.md) + - [Running a Hello OHOS Program](quickstart-lite-steps-board3518-running.md) + - [FAQs](quickstart-lite-steps-board3518-faqs.md) +- [Standard System](quickstart-standard.md) + - [Introduction](quickstart-standard-description.md) + - [Setting Up Windows Development Environment](quickstart-standard-windows-environment.md) + - [Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code](quickstart-standard-docker-environment.md) + - [Setting Up Ubuntu Development Environment with Installation Package and Building Source Code](quickstart-standard-package-environment.md) + - [Burning Images](quickstart-standard-burn.md) + - [FAQs](quickstart-standard-faq.md) \ No newline at end of file diff --git a/en/device-dev/quick-start/environment-setup.md b/en/device-dev/quick-start/environment-setup.md deleted file mode 100644 index 289f31965d0c38aea69d9ff15c917b6df62d8019..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/environment-setup.md +++ /dev/null @@ -1,11 +0,0 @@ -# Environment Setup - -- **[Overview](overview-1.md)** - -- **[Windows Development Environment](windows-development-environment.md)** - -- **[Ubuntu Build Environment](ubuntu-build-environment.md)** - -- **[FAQ](faq.md)** - - diff --git a/en/device-dev/quick-start/figures/1.png b/en/device-dev/quick-start/figure/1.png similarity index 100% rename from en/device-dev/quick-start/figures/1.png rename to en/device-dev/quick-start/figure/1.png diff --git a/en/device-dev/quick-start/figures/10.png b/en/device-dev/quick-start/figure/10.png similarity index 100% rename from en/device-dev/quick-start/figures/10.png rename to en/device-dev/quick-start/figure/10.png diff --git a/en/device-dev/quick-start/figures/2.png b/en/device-dev/quick-start/figure/2.png similarity index 100% rename from en/device-dev/quick-start/figures/2.png rename to en/device-dev/quick-start/figure/2.png diff --git a/zh-cn/device-dev/quick-start/figures/2021-01-27_170334-17.png b/en/device-dev/quick-start/figure/2021-01-27_170334-17.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/2021-01-27_170334-17.png rename to en/device-dev/quick-start/figure/2021-01-27_170334-17.png diff --git a/en/device-dev/quick-start/figures/2021-01-27_170334-19.png b/en/device-dev/quick-start/figure/2021-01-27_170334-18.png similarity index 100% rename from en/device-dev/quick-start/figures/2021-01-27_170334-19.png rename to en/device-dev/quick-start/figure/2021-01-27_170334-18.png diff --git a/en/device-dev/quick-start/figures/2021-01-27_170334-2.png b/en/device-dev/quick-start/figure/2021-01-27_170334-2.png similarity index 100% rename from en/device-dev/quick-start/figures/2021-01-27_170334-2.png rename to en/device-dev/quick-start/figure/2021-01-27_170334-2.png diff --git a/en/device-dev/quick-start/figures/2021-01-27_170334-5.png b/en/device-dev/quick-start/figure/2021-01-27_170334-5.png similarity index 100% rename from en/device-dev/quick-start/figures/2021-01-27_170334-5.png rename to en/device-dev/quick-start/figure/2021-01-27_170334-5.png diff --git a/en/device-dev/quick-start/figures/2021-01-27_170334.png b/en/device-dev/quick-start/figure/2021-01-27_170334.png similarity index 100% rename from en/device-dev/quick-start/figures/2021-01-27_170334.png rename to en/device-dev/quick-start/figure/2021-01-27_170334.png diff --git a/en/device-dev/quick-start/figures/3-0.png b/en/device-dev/quick-start/figure/3-0.png similarity index 100% rename from en/device-dev/quick-start/figures/3-0.png rename to en/device-dev/quick-start/figure/3-0.png diff --git a/en/device-dev/quick-start/figures/3.png b/en/device-dev/quick-start/figure/3.png similarity index 100% rename from en/device-dev/quick-start/figures/3.png rename to en/device-dev/quick-start/figure/3.png diff --git "a/en/device-dev/quick-start/figures/3516\346\255\243\351\235\242.png" "b/en/device-dev/quick-start/figure/3516\346\255\243\351\235\242.png" similarity index 100% rename from "en/device-dev/quick-start/figures/3516\346\255\243\351\235\242.png" rename to "en/device-dev/quick-start/figure/3516\346\255\243\351\235\242.png" diff --git "a/en/device-dev/quick-start/figures/3861\346\255\243\351\235\242.png" "b/en/device-dev/quick-start/figure/3861\346\255\243\351\235\242.png" similarity index 100% rename from "en/device-dev/quick-start/figures/3861\346\255\243\351\235\242.png" rename to "en/device-dev/quick-start/figure/3861\346\255\243\351\235\242.png" diff --git a/en/device-dev/quick-start/figures/4.png b/en/device-dev/quick-start/figure/4.png similarity index 100% rename from en/device-dev/quick-start/figures/4.png rename to en/device-dev/quick-start/figure/4.png diff --git a/en/device-dev/quick-start/figures/5-1.png b/en/device-dev/quick-start/figure/5-1.png similarity index 100% rename from en/device-dev/quick-start/figures/5-1.png rename to en/device-dev/quick-start/figure/5-1.png diff --git a/en/device-dev/quick-start/figures/5.png b/en/device-dev/quick-start/figure/5.png similarity index 100% rename from en/device-dev/quick-start/figures/5.png rename to en/device-dev/quick-start/figure/5.png diff --git a/en/device-dev/quick-start/figures/6.png b/en/device-dev/quick-start/figure/6.png similarity index 100% rename from en/device-dev/quick-start/figures/6.png rename to en/device-dev/quick-start/figure/6.png diff --git a/en/device-dev/quick-start/figures/allowing-the-visual-studio-code-application-to-access-the-network-16.png b/en/device-dev/quick-start/figure/allowing-the-visual-studio-code-application-to-access-the-network-16.png similarity index 100% rename from en/device-dev/quick-start/figures/allowing-the-visual-studio-code-application-to-access-the-network-16.png rename to en/device-dev/quick-start/figure/allowing-the-visual-studio-code-application-to-access-the-network-16.png diff --git a/en/device-dev/quick-start/figures/allowing-the-visual-studio-code-application-to-access-the-network.png b/en/device-dev/quick-start/figure/allowing-the-visual-studio-code-application-to-access-the-network.png similarity index 100% rename from en/device-dev/quick-start/figures/allowing-the-visual-studio-code-application-to-access-the-network.png rename to en/device-dev/quick-start/figure/allowing-the-visual-studio-code-application-to-access-the-network.png diff --git a/en/device-dev/quick-start/figures/changjian1-11.png b/en/device-dev/quick-start/figure/changjian1-11.png similarity index 100% rename from en/device-dev/quick-start/figures/changjian1-11.png rename to en/device-dev/quick-start/figure/changjian1-11.png diff --git a/en/device-dev/quick-start/figures/changjian1.png b/en/device-dev/quick-start/figure/changjian1.png similarity index 100% rename from en/device-dev/quick-start/figures/changjian1.png rename to en/device-dev/quick-start/figure/changjian1.png diff --git a/en/device-dev/quick-start/figures/checking-whether-the-serial-port-is-used-9.png b/en/device-dev/quick-start/figure/checking-whether-the-serial-port-is-used-9.png similarity index 100% rename from en/device-dev/quick-start/figures/checking-whether-the-serial-port-is-used-9.png rename to en/device-dev/quick-start/figure/checking-whether-the-serial-port-is-used-9.png diff --git a/en/device-dev/quick-start/figures/checking-whether-the-serial-port-is-used.png b/en/device-dev/quick-start/figure/checking-whether-the-serial-port-is-used.png similarity index 100% rename from en/device-dev/quick-start/figures/checking-whether-the-serial-port-is-used.png rename to en/device-dev/quick-start/figure/checking-whether-the-serial-port-is-used.png diff --git a/en/device-dev/quick-start/figures/chuankou1-6.png b/en/device-dev/quick-start/figure/chuankou1-6.png similarity index 100% rename from en/device-dev/quick-start/figures/chuankou1-6.png rename to en/device-dev/quick-start/figure/chuankou1-6.png diff --git a/en/device-dev/quick-start/figures/chuankou1.png b/en/device-dev/quick-start/figure/chuankou1.png similarity index 100% rename from en/device-dev/quick-start/figures/chuankou1.png rename to en/device-dev/quick-start/figure/chuankou1.png diff --git a/en/device-dev/quick-start/figures/disabling-the-terminal-using-the-serial-port-10.png b/en/device-dev/quick-start/figure/disabling-the-terminal-using-the-serial-port-10.png similarity index 100% rename from en/device-dev/quick-start/figures/disabling-the-terminal-using-the-serial-port-10.png rename to en/device-dev/quick-start/figure/disabling-the-terminal-using-the-serial-port-10.png diff --git a/en/device-dev/quick-start/figures/disabling-the-terminal-using-the-serial-port.png b/en/device-dev/quick-start/figure/disabling-the-terminal-using-the-serial-port.png similarity index 100% rename from en/device-dev/quick-start/figures/disabling-the-terminal-using-the-serial-port.png rename to en/device-dev/quick-start/figure/disabling-the-terminal-using-the-serial-port.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001056814287.png b/en/device-dev/quick-start/figure/en-us_image_0000001056814287.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001056814287.png rename to en/device-dev/quick-start/figure/en-us_image_0000001056814287.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001057335403.png b/en/device-dev/quick-start/figure/en-us_image_0000001057335403.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001057335403.png rename to en/device-dev/quick-start/figure/en-us_image_0000001057335403.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001072468991.png b/en/device-dev/quick-start/figure/en-us_image_0000001072468991.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001072468991.png rename to en/device-dev/quick-start/figure/en-us_image_0000001072468991.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001072757874.png b/en/device-dev/quick-start/figure/en-us_image_0000001072757874.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001072757874.png rename to en/device-dev/quick-start/figure/en-us_image_0000001072757874.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001073840162.png b/en/device-dev/quick-start/figure/en-us_image_0000001073840162.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001073840162.png rename to en/device-dev/quick-start/figure/en-us_image_0000001073840162.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001096154076.png b/en/device-dev/quick-start/figure/en-us_image_0000001096154076.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001096154076.png rename to en/device-dev/quick-start/figure/en-us_image_0000001096154076.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001100641602.png b/en/device-dev/quick-start/figure/en-us_image_0000001100641602.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001100641602.png rename to en/device-dev/quick-start/figure/en-us_image_0000001100641602.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001113969542.png b/en/device-dev/quick-start/figure/en-us_image_0000001113969542.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001113969542.png rename to en/device-dev/quick-start/figure/en-us_image_0000001113969542.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001114129428.png b/en/device-dev/quick-start/figure/en-us_image_0000001114129428.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001114129428.png rename to en/device-dev/quick-start/figure/en-us_image_0000001114129428.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001114129432.png b/en/device-dev/quick-start/figure/en-us_image_0000001114129432.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001114129432.png rename to en/device-dev/quick-start/figure/en-us_image_0000001114129432.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001117463460.png b/en/device-dev/quick-start/figure/en-us_image_0000001117463460.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001117463460.png rename to en/device-dev/quick-start/figure/en-us_image_0000001117463460.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001117621400.png b/en/device-dev/quick-start/figure/en-us_image_0000001117621400.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001117621400.png rename to en/device-dev/quick-start/figure/en-us_image_0000001117621400.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311066.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311066.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311066.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311066.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311070.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311070.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311070.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311070.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311072.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311072.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311072.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311072.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311090.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311090.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311090.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311090.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311092.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311092.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311092.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311092.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311094.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311094.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311094.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311094.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311096.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311096.png old mode 100755 new mode 100644 similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311096.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311096.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311098.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311098.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311098.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311098.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311100.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311100.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311100.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311100.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311104.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311104.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311104.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311104.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311116.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311116.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311116.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311116.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128311118.png b/en/device-dev/quick-start/figure/en-us_image_0000001128311118.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128311118.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128311118.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470864.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470864.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470864.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470864.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470880.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470880.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470880.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470880.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470900.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470900.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470900.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470900.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470902.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470902.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470902.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470902.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470904.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470904.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470904.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470904.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470906.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470906.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470906.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470906.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470908.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470908.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470908.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470908.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128470922.png b/en/device-dev/quick-start/figure/en-us_image_0000001128470922.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001128470922.png rename to en/device-dev/quick-start/figure/en-us_image_0000001128470922.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001142794291.png b/en/device-dev/quick-start/figure/en-us_image_0000001142794291.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001142794291.png rename to en/device-dev/quick-start/figure/en-us_image_0000001142794291.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001142802505.png b/en/device-dev/quick-start/figure/en-us_image_0000001142802505.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001142802505.png rename to en/device-dev/quick-start/figure/en-us_image_0000001142802505.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001143154485.png b/en/device-dev/quick-start/figure/en-us_image_0000001143154485.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001143154485.png rename to en/device-dev/quick-start/figure/en-us_image_0000001143154485.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001160527611.png b/en/device-dev/quick-start/figure/en-us_image_0000001160527611.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001160527611.png rename to en/device-dev/quick-start/figure/en-us_image_0000001160527611.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001163045527.png b/en/device-dev/quick-start/figure/en-us_image_0000001163045527.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001163045527.png rename to en/device-dev/quick-start/figure/en-us_image_0000001163045527.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270699.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270699.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270699.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270699.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270713.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270713.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270713.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270713.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270715.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270715.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270715.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270715.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270727.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270727.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270727.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270727.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270729.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270729.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270729.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270729.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270731.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270731.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270731.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270731.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270733.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270733.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270733.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270733.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270735.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270735.png old mode 100755 new mode 100644 similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270735.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270735.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270737.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270737.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270737.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270737.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270739.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270739.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270739.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270739.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270743.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270743.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270743.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270743.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270749.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270749.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270749.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270749.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174270751.png b/en/device-dev/quick-start/figure/en-us_image_0000001174270751.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174270751.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174270751.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350615.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350615.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350615.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350615.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350623.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350623.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350623.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350623.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350633.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350633.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350633.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350633.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350641.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350641.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350641.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350641.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350643.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350643.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350643.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350643.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350647.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350647.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350647.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350647.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350649.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350649.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350649.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350649.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350651.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350651.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350651.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350651.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350653.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350653.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350653.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350653.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350655.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350655.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350655.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350655.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350659.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350659.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350659.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350659.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350661.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350661.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350661.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350661.png diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350669.png b/en/device-dev/quick-start/figure/en-us_image_0000001174350669.png similarity index 100% rename from en/device-dev/quick-start/figures/en-us_image_0000001174350669.png rename to en/device-dev/quick-start/figure/en-us_image_0000001174350669.png diff --git a/en/device-dev/quick-start/figures/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png b/en/device-dev/quick-start/figure/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png similarity index 100% rename from en/device-dev/quick-start/figures/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png rename to en/device-dev/quick-start/figure/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png diff --git a/en/device-dev/quick-start/figures/failed-to-obtain-the-image-file-due-to-unavailable-connection.png b/en/device-dev/quick-start/figure/failed-to-obtain-the-image-file-due-to-unavailable-connection.png similarity index 100% rename from en/device-dev/quick-start/figures/failed-to-obtain-the-image-file-due-to-unavailable-connection.png rename to en/device-dev/quick-start/figure/failed-to-obtain-the-image-file-due-to-unavailable-connection.png diff --git a/en/device-dev/quick-start/figures/failed-to-open-the-serial-port-8.png b/en/device-dev/quick-start/figure/failed-to-open-the-serial-port-8.png similarity index 100% rename from en/device-dev/quick-start/figures/failed-to-open-the-serial-port-8.png rename to en/device-dev/quick-start/figure/failed-to-open-the-serial-port-8.png diff --git a/en/device-dev/quick-start/figures/failed-to-open-the-serial-port.png b/en/device-dev/quick-start/figure/failed-to-open-the-serial-port.png similarity index 100% rename from en/device-dev/quick-start/figures/failed-to-open-the-serial-port.png rename to en/device-dev/quick-start/figure/failed-to-open-the-serial-port.png diff --git a/en/device-dev/quick-start/figures/firewall-and-network-protection-14.png b/en/device-dev/quick-start/figure/firewall-and-network-protection-14.png similarity index 100% rename from en/device-dev/quick-start/figures/firewall-and-network-protection-14.png rename to en/device-dev/quick-start/figure/firewall-and-network-protection-14.png diff --git a/en/device-dev/quick-start/figures/firewall-and-network-protection.png b/en/device-dev/quick-start/figure/firewall-and-network-protection.png similarity index 100% rename from en/device-dev/quick-start/figures/firewall-and-network-protection.png rename to en/device-dev/quick-start/figure/firewall-and-network-protection.png diff --git a/en/device-dev/quick-start/figures/front-view-of-the-hi3518e-v300-board.png b/en/device-dev/quick-start/figure/front-view-of-the-hi3518e-v300-board.png similarity index 100% rename from en/device-dev/quick-start/figures/front-view-of-the-hi3518e-v300-board.png rename to en/device-dev/quick-start/figure/front-view-of-the-hi3518e-v300-board.png diff --git a/en/device-dev/quick-start/figures/getting-started-for-the-standard-system.png b/en/device-dev/quick-start/figure/getting-started-for-the-standard-system.png similarity index 100% rename from en/device-dev/quick-start/figures/getting-started-for-the-standard-system.png rename to en/device-dev/quick-start/figure/getting-started-for-the-standard-system.png diff --git a/en/device-dev/quick-start/figures/hardware-connections-3.png b/en/device-dev/quick-start/figure/hardware-connections-3.png similarity index 100% rename from en/device-dev/quick-start/figures/hardware-connections-3.png rename to en/device-dev/quick-start/figure/hardware-connections-3.png diff --git a/en/device-dev/quick-start/figures/hardware-connections.png b/en/device-dev/quick-start/figure/hardware-connections.png similarity index 100% rename from en/device-dev/quick-start/figures/hardware-connections.png rename to en/device-dev/quick-start/figure/hardware-connections.png diff --git "a/en/device-dev/quick-start/figures/hi3518\346\255\243\350\203\214\351\235\242.png" "b/en/device-dev/quick-start/figure/hi3518\346\255\243\350\203\214\351\235\242.png" similarity index 100% rename from "en/device-dev/quick-start/figures/hi3518\346\255\243\350\203\214\351\235\242.png" rename to "en/device-dev/quick-start/figure/hi3518\346\255\243\350\203\214\351\235\242.png" diff --git a/en/device-dev/quick-start/figures/network-and-firewall-setting-13.png b/en/device-dev/quick-start/figure/network-and-firewall-setting-13.png similarity index 100% rename from en/device-dev/quick-start/figures/network-and-firewall-setting-13.png rename to en/device-dev/quick-start/figure/network-and-firewall-setting-13.png diff --git a/en/device-dev/quick-start/figures/network-and-firewall-setting.png b/en/device-dev/quick-start/figure/network-and-firewall-setting.png similarity index 100% rename from en/device-dev/quick-start/figures/network-and-firewall-setting.png rename to en/device-dev/quick-start/figure/network-and-firewall-setting.png diff --git a/en/device-dev/quick-start/figures/qi1.png b/en/device-dev/quick-start/figure/qi1.png similarity index 100% rename from en/device-dev/quick-start/figures/qi1.png rename to en/device-dev/quick-start/figure/qi1.png diff --git a/en/device-dev/quick-start/figures/selecting-the-visual-studio-code-application-15.png b/en/device-dev/quick-start/figure/selecting-the-visual-studio-code-application-15.png similarity index 100% rename from en/device-dev/quick-start/figures/selecting-the-visual-studio-code-application-15.png rename to en/device-dev/quick-start/figure/selecting-the-visual-studio-code-application-15.png diff --git a/en/device-dev/quick-start/figures/selecting-the-visual-studio-code-application.png b/en/device-dev/quick-start/figure/selecting-the-visual-studio-code-application.png similarity index 100% rename from en/device-dev/quick-start/figures/selecting-the-visual-studio-code-application.png rename to en/device-dev/quick-start/figure/selecting-the-visual-studio-code-application.png diff --git a/en/device-dev/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt.png b/en/device-dev/quick-start/figure/serial-port-displayed-after-the-u-boot-is-burnt.png similarity index 100% rename from en/device-dev/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt.png rename to en/device-dev/quick-start/figure/serial-port-displayed-after-the-u-boot-is-burnt.png diff --git a/en/device-dev/quick-start/figures/settings-4.png b/en/device-dev/quick-start/figure/settings-4.png similarity index 100% rename from en/device-dev/quick-start/figures/settings-4.png rename to en/device-dev/quick-start/figure/settings-4.png diff --git a/en/device-dev/quick-start/figures/settings.png b/en/device-dev/quick-start/figure/settings.png similarity index 100% rename from en/device-dev/quick-start/figures/settings.png rename to en/device-dev/quick-start/figure/settings.png diff --git a/en/device-dev/quick-start/figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png b/en/device-dev/quick-start/figure/successful-installation-(scons-version-requirement-3-0-4-or-later).png similarity index 100% rename from en/device-dev/quick-start/figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png rename to en/device-dev/quick-start/figure/successful-installation-(scons-version-requirement-3-0-4-or-later).png diff --git a/en/device-dev/quick-start/figures/successful-system-startup-and-program-execution-7.png b/en/device-dev/quick-start/figure/successful-system-startup-and-program-execution-7.png similarity index 100% rename from en/device-dev/quick-start/figures/successful-system-startup-and-program-execution-7.png rename to en/device-dev/quick-start/figure/successful-system-startup-and-program-execution-7.png diff --git a/en/device-dev/quick-start/figures/successful-system-startup-and-program-execution.png b/en/device-dev/quick-start/figure/successful-system-startup-and-program-execution.png similarity index 100% rename from en/device-dev/quick-start/figures/successful-system-startup-and-program-execution.png rename to en/device-dev/quick-start/figure/successful-system-startup-and-program-execution.png diff --git "a/en/device-dev/quick-start/figures/\346\210\252\345\233\276.png" "b/en/device-dev/quick-start/figure/\346\210\252\345\233\276.png" similarity index 100% rename from "en/device-dev/quick-start/figures/\346\210\252\345\233\276.png" rename to "en/device-dev/quick-start/figure/\346\210\252\345\233\276.png" diff --git "a/en/device-dev/quick-start/figures/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" "b/en/device-dev/quick-start/figure/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" similarity index 100% rename from "en/device-dev/quick-start/figures/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" rename to "en/device-dev/quick-start/figure/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" diff --git "a/en/device-dev/quick-start/figures/3516\346\255\243\351\235\242-17.png" "b/en/device-dev/quick-start/figures/3516\346\255\243\351\235\242-17.png" deleted file mode 100644 index 1ccb47f20022261cc291e8b435f263c00e8d4a27..0000000000000000000000000000000000000000 Binary files "a/en/device-dev/quick-start/figures/3516\346\255\243\351\235\242-17.png" and /dev/null differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001128471042.png b/en/device-dev/quick-start/figures/en-us_image_0000001128471042.png deleted file mode 100755 index dd4fd805a602980b08d54eb2856b27253b171d8d..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001128471042.png and /dev/null differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001174350781.png b/en/device-dev/quick-start/figures/en-us_image_0000001174350781.png deleted file mode 100755 index 8723967946c1f0bd471434d3422acc3bd6142535..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001174350781.png and /dev/null differ diff --git a/en/device-dev/quick-start/hi3516.md b/en/device-dev/quick-start/hi3516.md deleted file mode 100644 index e33aa899315932687a01de028a7f0fccba0a91b2..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/hi3516.md +++ /dev/null @@ -1,11 +0,0 @@ -# Hi3516 - -- **[Setting Up the Environment](setting-up-the-environment-2.md)** - -- **[Running a Hello OHOS Program](running-a-hello-ohos-program.md)** - -- **[Developing a Driver](developing-a-driver.md)** - -- **[FAQs](faqs-3.md)** - - diff --git a/en/device-dev/quick-start/hi3518.md b/en/device-dev/quick-start/hi3518.md deleted file mode 100644 index 817d4c826164210f795e36503f49dded0c49529e..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/hi3518.md +++ /dev/null @@ -1,9 +0,0 @@ -# Hi3518 - -- **[Setting Up the Environment](setting-up-the-environment-4.md)** - -- **[Running a Hello OHOS Program](running-a-hello-ohos-program-5.md)** - -- **[FAQs](faqs-6.md)** - - diff --git a/en/device-dev/quick-start/hi3861.md b/en/device-dev/quick-start/hi3861.md deleted file mode 100644 index 100cdfcabc277a736ed2238f4b8cd93e345624a0..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/hi3861.md +++ /dev/null @@ -1,11 +0,0 @@ -# Hi3861 - -- **[Setting Up the Environment](setting-up-the-environment.md)** - -- **[WLAN Connection](wlan-connection.md)** - -- **[Running a Hello World Program](running-a-hello-world-program.md)** - -- **[FAQs](faqs.md)** - - diff --git a/en/device-dev/quick-start/how-to-develop.md b/en/device-dev/quick-start/how-to-develop.md deleted file mode 100644 index 3e5f705cb569a6d3c7f9543dd24a75159e1682aa..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/how-to-develop.md +++ /dev/null @@ -1,9 +0,0 @@ -# How to Develop - -- **[Hi3861](hi3861.md)** - -- **[Hi3516](hi3516.md)** - -- **[Hi3518](hi3518.md)** - - diff --git a/en/device-dev/quick-start/introduction-to-the-development-boards.md b/en/device-dev/quick-start/introduction-to-the-development-boards.md deleted file mode 100644 index 3848dad5841c053f27b1b5f6280a8a34cb6b41c4..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/introduction-to-the-development-boards.md +++ /dev/null @@ -1,9 +0,0 @@ -# Introduction to the Development Boards - -- **[Hi3861 Development Board](hi3861-development-board.md)** - -- **[Hi3516 Development Board](hi3516-development-board.md)** - -- **[Hi3518 Development Board](hi3518-development-board.md)** - - diff --git a/en/device-dev/quick-start/mini-and-small-systems.md b/en/device-dev/quick-start/mini-and-small-systems.md deleted file mode 100644 index 458c7109f928cc610f7da07069bebcafa507cda7..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/mini-and-small-systems.md +++ /dev/null @@ -1,11 +0,0 @@ -# Mini and Small Systems - -- **[Overview](overview-0.md)** - -- **[Introduction to the Development Boards](introduction-to-the-development-boards.md)** - -- **[Environment Setup](environment-setup.md)** - -- **[How to Develop](how-to-develop.md)** - - diff --git a/en/device-dev/quick-start/overview.md b/en/device-dev/quick-start/overview.md deleted file mode 100644 index 4a5832db5a9e81baccd6d4cbb4bf500c0f5a06a3..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/overview.md +++ /dev/null @@ -1,175 +0,0 @@ -# Overview - -- [System Types](#section767218232110) -- [Document Outline](#section19810171681218) - -This topic provides a panorama of all documents for you to obtain helpful information quickly. These documents are classified based on your learning progress and development scenarios of OpenHarmony. - -## System Types - -It is good practice to understand the system types for you to find useful documents that can guide your development. - -OpenHarmony is an open-source distributed operating system for all scenarios. It uses a component-based design to tailor its features to better suit devices with 128 KiB to GiB-level of RAM. You can integrate a flexible combination of system components based on the hardware capabilities of the device. - -To make the integration simple and easy on different hardware, OpenHarmony defines three basic system types. You only need to select a suitable system type and configure the mandatory component set, thereby developing a system for your device at the minimum workload. The definitions of the basic system types are provided as follows for your reference: - -- Mini system - - A mini system runs on the devices whose memory is greater than or equal to 128 KiB and that are equipped with MCU processors such as Arm Cortex-M and 32-bit RISC-V. This system provides multiple lightweight network protocols and graphics frameworks, and a wide range of read/write components for the IoT bus. Typical products include connection modules, sensors, and wearables for smart home. - -- Small system - - A small system runs on the devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, and routers, and event data recorders \(EDRs\) for smart travel. - -- Standard system - - A standard system runs on the devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays. - - -In addition, OpenHarmony provides a series of optional system components that can be configured as required to support feature extension and customization. These system components are combined to form a series of system capabilities that, for better understanding, are described as features or functions for you to choose. - -## Document Outline - -- [Mini and Small System Development Guidelines](#table3762949121211) -- [Standard System Development Guidelines](#table17667535516) - -**Table 1** Mini and small system development guidelines \(reference memory < 128 MB\) - - -

Parameter

+ - @@ -197,14 +274,14 @@ int32\_t WatchdogGetTimeout\(PalHandle \*handle, uint32\_t \*seconds\); - - - - - - - - - - - @@ -125,42 +125,42 @@ In addition, OpenHarmony provides a series of optional system components that ca - - - - - - - - -

Parameter

Description

+

Description

Pointer to the timeout duration, in seconds.

Return Value

+

Return Value

Description

+

Description

0

The timeout duration is obtained.

+

The watchdog status is obtained.

Negative value

@@ -226,16 +303,16 @@ if (ret != 0) { } ``` -## Starting a Watchdog +### Starting a Watchdog -int32\_t WatchdogStart\(DevHandle handle\); +int32\_t WatchdogStart\(DevHandle handle\); -**Table 5** Description of WatchdogStart +**Table 6** Description of WatchdogStart -

Parameter

+ - @@ -244,9 +321,9 @@ int32\_t WatchdogStart\(DevHandle handle\); - -

Parameter

Description

+

Description

Watchdog handle.

Return Value

+

Return Value

Description

+

Description

0

@@ -272,16 +349,16 @@ if (ret != 0) { } ``` -## Feeding a Watchdog +### Feeding a Watchdog int32\_t WatchdogFeed\(DevHandle handle\); -**Table 6** Description of WatchdogFeed +**Table 7** Description of WatchdogFeed -

Parameter

+ - @@ -290,9 +367,9 @@ int32\_t WatchdogFeed\(DevHandle handle\); - -

Parameter

Description

+

Description

Watchdog handle.

Return Value

+

Return Value

Description

+

Description

0

@@ -318,16 +395,16 @@ if (ret != 0) { } ``` -## Stopping a Watchdog +### Stopping a Watchdog -int32\_t WatchdogStop\(DevHandle handle\); +int32\_t WatchdogStop\(DevHandle handle\); -**Table 7** Description of WatchdogStop +**Table 8** Description of WatchdogStop -

Parameter

+ - @@ -336,9 +413,9 @@ int32\_t WatchdogStop\(DevHandle handle\); - -

Parameter

Description

+

Description

Watchdog handle.

Return Value

+

Return Value

Description

+

Description

0

@@ -362,21 +439,20 @@ if (ret != 0) { HDF_LOGE("WatchdogStop: failed, ret %d\n", ret); return; } - ``` -## Closing a Watchdog +### Closing a Watchdog If the watchdog is no longer required, call **WatchdogClose** to close the watchdog handle. void WatchdogClose\(DevHandle handle\); -**Table 8** Description of WatchdogClose +**Table 9** Description of WatchdogClose - - @@ -252,7 +252,7 @@ To ensure the download performance, you are advised to download the source code - @@ -261,18 +261,18 @@ To ensure the download performance, you are advised to download the source code - - - - - @@ -333,7 +333,7 @@ To ensure the download performance, you are advised to download the source code - diff --git a/en/device-dev/get-code/sourcecode.md b/en/device-dev/get-code/sourcecode.md new file mode 100644 index 0000000000000000000000000000000000000000..5e118ce26fcaab05055610b3ca990fd6c3f676b0 --- /dev/null +++ b/en/device-dev/get-code/sourcecode.md @@ -0,0 +1,5 @@ +# Source Code Acquisition + +- **[Source Code Acquisition](sourcecode-acquire.md)** + + diff --git a/en/device-dev/glossary/Readme-EN.md b/en/device-dev/glossary/Readme-EN.md new file mode 100644 index 0000000000000000000000000000000000000000..1e7ccafe473286de0e48494b45a313bedad2c4e1 --- /dev/null +++ b/en/device-dev/glossary/Readme-EN.md @@ -0,0 +1,4 @@ +# Glossary + +[Glossary](glossary.md) + diff --git a/en/device-dev/guide/Readme-EN.md b/en/device-dev/guide/Readme-EN.md index 31bb3cfd5f930e15379766651d890690ab24f29c..ca124ea327c8b4af4d22f6e6d462df5c6de5592b 100644 --- a/en/device-dev/guide/Readme-EN.md +++ b/en/device-dev/guide/Readme-EN.md @@ -1,72 +1,32 @@ # Development Examples -- [WLAN-connected Products](wlan-connected-products.md) - - [LED Peripheral Control](led-peripheral-control.md) - - [Overview](overview.md) - - [Development](development.md) - - [Verification](verification.md) - -- [Cameras Without a Screen](cameras-without-a-screen.md) - - [Camera Control](camera-control.md) - - [Overview](overview-0.md) - - [Development Guidelines](development-guidelines.md) - - [Photographing](photographing.md) - - [Video Recording](video-recording.md) - - - [Use Case](use-case.md) - -- [Cameras with a Screen](cameras-with-a-screen.md) - - [Screen and Camera Control](screen-and-camera-control.md) - - [Overview](overview-1.md) - - [Development Guidelines](development-guidelines-2.md) - - [Photographing](photographing-3.md) - - [Video Recording](video-recording-4.md) - - [Previewing](previewing.md) - - - [Use Case](use-case-5.md) - - - [Visual Application Development](visual-application-development.md) - - [Overview](overview-6.md) - - [Preparations](preparations.md) - - [Adding Pages](adding-pages.md) - - [Building the Home Page](building-the-home-page.md) - - [Building the Details Page](building-the-details-page.md) - - [Debugging and Packaging](debugging-and-packaging.md) - - [Running on the Device](running-on-the-device.md) - - [FAQs](faqs.md) - -- [Development Example for Clock Apps](development-example-for-clock-apps.md) - - [Overview](overview-7.md) - - [Preparations](preparations-8.md) - - [How to Develop](how-to-develop.md) - - [Signing and Packaging](signing-and-packaging.md) - - [Running on the Device](running-on-the-device-9.md) - -- [Development Example for Platform Drivers](development-example-for-platform-drivers.md) - - [Overview](overview-10.md) - - [Preparations](preparations-11.md) - - [Development](development-12.md) - - [Building and Burning](building-and-burning.md) - -- [Development Example for Peripheral Drivers](development-example-for-peripheral-drivers.md) - - [Overview](overview-13.md) - - [Hardware Resources](hardware-resources.md) - - [Input Driver Model](input-driver-model.md) - - - [Setting Up the Environment](setting-up-the-environment.md) - - [Developing a Touchscreen Driver](developing-a-touchscreen-driver.md) - - [Configuring Device Driver Descriptions](configuring-device-driver-descriptions.md) - - [Configuring the Touchscreen](configuring-the-touchscreen.md) - - [Adapting to the Private Drivers of the Touchscreen](adapting-to-the-private-drivers-of-the-touchscreen.md) - - - [Building and Burning](building-and-burning-14.md) - - [Debugging and Verification](debugging-and-verification.md) - - [Startup Log Analysis](startup-log-analysis.md) - - - [Input Driver Model Workflow Analysis](input-driver-model-workflow-analysis.md) - - [Parsing Private Configuration Data](parsing-private-configuration-data.md) - - [Initializing the Input Device Manager and Registering the Driver with the HDF](initializing-the-input-device-manager-and-registering-the-driver-with-the-hdf.md) - - [Initializing the Input Common Driver and Registering the Driver with the HDF](initializing-the-input-common-driver-and-registering-the-driver-with-the-hdf.md) - - [Initializing the Input Chip Driver and Registering the Driver with the HDF](initializing-the-input-chip-driver-and-registering-the-driver-with-the-hdf.md) - - [Function Invocation Logic](function-invocation-logic.md) - +- [WLAN-connected Products](device-wifi.md) + - [LED Peripheral Control](device-wifi-led-outcontrol.md) + - [Third-Party SDK Integration](device-wifi-sdk.md) +- [Cameras Without a Screen](device-iotcamera.md) + - [Camera Control](device-iotcamera-control.md) + - [Overview](device-iotcamera-control-overview.md) + - [Development Guidelines](device-iotcamera-control-demo.md) + - [Photographing](device-iotcamera-control-demo-photodevguide.md) + - [Video Recording](device-iotcamera-control-demo-videodevguide.md) + - [Use Case](device-iotcamera-control-example.md) +- [Cameras with a Screen](device-camera.md) + - [Screen and Camera Control](device-camera-control.md) + - [Overview](device-camera-control-overview.md) + - [Development Guidelines](device-camera-control-demo.md) + - [Photographing](device-camera-control-demo-photoguide.md) + - [Video Recording](device-camera-control-demo-videoguide.md) + - [Previewing](device-camera-control-demo-previewguide.md) + - [Use Case](device-camera-control-example.md) + - [Visual Application Development](device-camera-visual.md) + - [Overview](device-camera-visual-overview.md) + - [Preparations](device-camera-visual-prepare.md) + - [Adding Pages](device-camera-visual-addpage.md) + - [Building the Home Page](device-camera-visual-first-page.md) + - [Building the Details Page](device-camera-visual-details.md) + - [Debugging and Packaging](device-camera-visual-debug.md) + - [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-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/adapting-to-the-private-drivers-of-the-touchscreen.md b/en/device-dev/guide/adapting-to-the-private-drivers-of-the-touchscreen.md deleted file mode 100644 index 80f6ba5513c1e2db8ecb7d566f91c82536311a5f..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/adapting-to-the-private-drivers-of-the-touchscreen.md +++ /dev/null @@ -1,99 +0,0 @@ -# Adapting to the Private Drivers of the Touchscreen - -The input driver model consists of three parts of drivers. To develop a brand-new touchscreen driver, you only need to adapt your code with the input chip driver and implement differentiated APIs. The sample code in this section illustrates how you will complete the adaptation. - -1. Implement differentiated APIs for the touchscreen to adapt to the input chip driver. - - You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**. - - ``` - static struct TouchChipOps g_gt911ChipOps = { // IC options of the touchscreen - .Init = ChipInit, // Initialize the chip. - .Detect = ChipDetect, // Detect the chip. - .Resume = ChipResume, // Resume the chip. - .Suspend = ChipSuspend, // Suspend the chip. - .DataHandle = ChipDataHandle, // Read the chip data. - .UpdateFirmware = UpdateFirmware, // Update the firmware. - }; - - /* The ICs may be different depending on the touchscreen vendors, and the corresponding register operations are also different. Therefore, the code for the input chip driver focuses only on the adaptation of differentiated APIs. The following sample code demonstrates the data parsing of GT911. */ - - static int32_t ChipDataHandle(ChipDevice *device) - { - ... - /* Read the status register before GT911 obtains coordinates. */ - reg[0] = (GT_BUF_STATE_ADDR >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; - reg[1] = GT_BUF_STATE_ADDR & ONE_BYTE_MASK; - ret = InputI2cRead(i2cClient, reg, GT_ADDR_LEN, &touchStatus, 1); - if (ret < 0 || touchStatus == GT_EVENT_INVALID) { - return HDF_FAILURE; - } - ... - /* Read data from the data register based on the value of the status register. */ - reg[0] = (GT_X_LOW_BYTE_BASE >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; - reg[1] = GT_X_LOW_BYTE_BASE & ONE_BYTE_MASK; - pointNum = touchStatus & GT_FINGER_NUM_MASK; - if (pointNum == 0 || pointNum > MAX_SUPPORT_POINT) { - HDF_LOGE("%s: pointNum is invalid, %u", __func__, pointNum); - (void)ChipCleanBuffer(i2cClient); - OsalMutexUnlock(&device->driver->mutex); - return HDF_FAILURE; - } - frame->realPointNum = pointNum; - frame->definedEvent = TOUCH_DOWN; - (void)InputI2cRead(i2cClient, reg, GT_ADDR_LEN, buf, GT_POINT_SIZE * pointNum); - /* Parse the obtained data. */ - ParsePointData(device, frame, buf, pointNum); - ... - } - static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, uint8_t pointNum) - { - ... - /* Each coordinate value consists of two bytes. Obtain the final coordinate value by combining the obtained single-byte data. */ - for (i = 0; i < pointNum; i++) { - frame->fingers[i].trackId = buf[GT_POINT_SIZE * i + GT_TRACK_ID]; - frame->fingers[i].y = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | - ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); - frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | - ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); - /* Print the parsed coordinate value. */ - HDF_LOGD("%s: x = %d, y = %d", __func__, frame->fingers[i].x, frame->fingers[i].y); - } - } - ``` - -2. Initialize the input chip driver and register the driver with the HDF. - - You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**. - - ``` - static int32_t HdfGoodixChipInit(struct HdfDeviceObject *device) - { - ... - /* Use the chipCfg structure to allocate memory, parse the configuration information, and mount the parsed data. */ - chipCfg = ChipConfigInstance(device); - ... - /* Instantiate the touchscreen device. */ - chipDev = ChipDeviceInstance(); - ... - /* Mount touchscreen chip configuration and private operation data. */ - chipDev->chipCfg = chipCfg; - chipDev->ops = &g_gt911ChipOps; - ... - /* Register the chip driver with the platform driver. */ - RegisterChipDevice(chipDev); - ... - } - struct HdfDriverEntry g_touchGoodixChipEntry = { - .moduleVersion = 1, - .moduleName = "HDF_TOUCH_GT911", // The value must match the moduleName field of the chip driver in the device_info.hcs file. - .Init = HdfGoodixChipInit, // Initialize the touchscreen chip driver. - }; - HDF_INIT(g_touchGoodixChipEntry); // Register the touchscreen chip driver with the HDF. - ``` - - The private chip drivers present the major differentiations among chip vendors, such as hibernation and wakeup, data parsing, and firmware update. - - Now, you have completed the adaptation for the touchscreen driver based on the HDF and input driver model. - - diff --git a/en/device-dev/guide/building-and-burning-14.md b/en/device-dev/guide/building-and-burning-14.md deleted file mode 100644 index d905b787acbb3639912138621c808faa46645a10..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/building-and-burning-14.md +++ /dev/null @@ -1,17 +0,0 @@ -# Building and Burning - -1. Compile the Makefile and add the following content in this example. - - The file is available at **./drivers/adapter/khdf/linux/model/input/Makefile**. - - Add the following content: - - ``` - obj-$(CONFIG_DRIVERS_HDF_TP_5P5_GT911) += \ - $(INPUT_ROOT_DIR)/touchscreen/touch_gt911.o - ``` - - **touch\_gt911.o** is the content added in this example. - -2. Conduct building and burn. For details about the building and burning operations, see [Build and Burn in Getting Started with Standard System](../quick-start/standard-system.md). - diff --git a/en/device-dev/guide/building-and-burning.md b/en/device-dev/guide/building-and-burning.md deleted file mode 100644 index 25f895cc93816b552eee5058a96b098ec7fdf7e9..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/building-and-burning.md +++ /dev/null @@ -1,20 +0,0 @@ -# Building and Burning - -1. Edit the Makefile and add a source file to it, as shown in the following example: - - ``` - include drivers/hdf/khdf/platform/platform.mk - - obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_core.o \ - $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_if.o \ - ./i2c_adapter.o \ - ./i2c_sample.o - ``` - - **./i2c\_sample.o** is the source file added to the Makefile in this example. - -2. Build the version and burn the system image to the development board. - - For details about the building and burning operations, see [Build and Burn in Getting Started with Standard System](../quick-start/standard-system.md). - - diff --git a/en/device-dev/guide/camera-control.md b/en/device-dev/guide/camera-control.md deleted file mode 100644 index 5694352afcf41a300ab8936b6dc2abfed5bc1a56..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/camera-control.md +++ /dev/null @@ -1,9 +0,0 @@ -# Camera Control - -- **[Overview](overview-0.md)** - -- **[Development Guidelines](development-guidelines.md)** - -- **[Use Case](use-case.md)** - - diff --git a/en/device-dev/guide/configuring-device-driver-descriptions.md b/en/device-dev/guide/configuring-device-driver-descriptions.md deleted file mode 100644 index d19a91a732b43d0f059d6c5dbd4d8430a386ce98..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/configuring-device-driver-descriptions.md +++ /dev/null @@ -1,64 +0,0 @@ -# Configuring Device Driver Descriptions - -You can configure the device driver description in the configuration file at **./drivers/adapter/khdf/linux/hcs/device\_info/device\_info.hcs**. - -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 content in the configuration file is as follows \(For details about these fields, see [Driver Development](https://device.harmonyos.com/en/docs/develop/drive/oem_drive_hdfdev_load-0000001051276785)[Driver Development](../driver/driver-development.md)\): - -``` -input :: host { - hostName = "input_host"; - priority = 100; - device_input_manager :: device { // Specify the device driver description of the input device manager. - device0 :: deviceNode { - policy = 2; // Services are released to both the kernel space and the user space. - priority = 100; // The default priority for the input device manager is 100. - preload = 0; // Load the driver. - permission = 0660; // Specify the permission for the driver to create device nodes. - moduleName = "HDF_INPUT_MANAGER"; // Match the moduleName in the driver entry structure. - serviceName = "hdf_input_host"; // Specify the device node name to be generated by the HDF. - deviceMatchAttr = ""; // Leave this field empty because private configuration data is not required by the input device manager currently. - } - } - - device_hdf_touch :: device { // Specify the device driver description of the input common driver. - device0 :: deviceNode { - policy = 2; // Services are released to both the kernel space and the user space. - priority = 120; // The default priority for the input common driver is 120. - preload = 0; // Load the driver. - permission = 0660; // Specify the permission for the driver to create device nodes. - moduleName = "HDF_TOUCH"; // Match the moduleName in the driver entry structure. - serviceName = "hdf_input_event1"; // Specify the device node name to be generated by the HDF. - deviceMatchAttr = "touch_device1"; // Keep this value the same as the match_attr value in the private configuration data. - } - } - - device_touch_chip :: device { // Specify the device description of the input chip driver. - device0 :: deviceNode { - policy = 0; // Services are not released to both the kernel space and the user space. - priority = 130; // The default priority for the input chip driver is 130. - preload = 0; // Load the driver. - permission = 0660; // Specify the permission for the driver to create device nodes. - moduleName = "HDF_TOUCH_GT911"; // Match the moduleName in the driver entry structure. - serviceName = "hdf_touch_gt911_service";// Specify the device node name to be generated by the HDF. - deviceMatchAttr = "zsj_gt911_5p5"; // Keep this value the same as the match_attr value in the private configuration data. - } - } - } -``` - -Pay attention to the following fields in the configuration file: - -**priority**: specifies the driver loading priority. - -**preload**: specifies whether to load the driver. - -**moduleName**: This value must be the same as the **moduleName** value in the driver entry structure. - -**serviceName**: This value is used by the HDF to create a device node name. - -**deviceMatchAttr**: This value must be the same as the **match\_attr** value in the private configuration data. - -After the device descriptions are configured, the HDF matches the configuration with the code registered with the driver entry structure based on the **moduleName** field, ensuring that drivers can be loaded properly. If multiple drivers are configured, the **priority** field determines the loading sequence of each driver. - diff --git a/en/device-dev/guide/configuring-the-touchscreen.md b/en/device-dev/guide/configuring-the-touchscreen.md deleted file mode 100644 index 6a6cc59f6aded4d77aea594e683f9e6e682324ed..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/configuring-the-touchscreen.md +++ /dev/null @@ -1,98 +0,0 @@ -# Configuring the Touchscreen - -You can configure the touchscreen in the configuration file at **./drivers/adapter/khdf/linux/hcs/input/input\_config.hcs**. - -The **input\_config.hcs** file consists of the private configuration data of both the common driver and chip driver. Information of this file is read and parsed by the driver code. The configuration in the file includes the board-level hardware information and private configuration of the touchscreen. You can tailor the configuration during your development. - -``` -root { - input_config { - touchConfig { - touch0 { // Configure the first touchscreen. - boardConfig { // Specify the board-level hardware information. - match_attr = "touch_device1"; // Keep this value the same as the match_attr field in the private configuration data of the input common driver in the device description. - inputAttr { - /* 0:touch 1:key 2:keyboard 3:mouse 4:button 5:crown 6:encoder */ - inputType = 0; // Set the input type to touch. - solutionX = 480; // Set the resolution in the X-axis. - solutionY = 960; // Set the resolution in the Y-axis. - devName = "main_touch"; // Set the device name. - } - busConfig { - /* 0:i2c 1:spi */ - busType = 0; // GT911 uses the I2C bus for communication. - busNum = 6; // Use the sixth bus of the chip to communicate with the development board through I2C. - clkGpio = 86; // Set the SCL pin of the chip. - dataGpio = 87; // Set the SDA pin of the chip. - i2cClkIomux = [0x114f0048, 0x403]; // Configure the SCL pin information. - i2cDataIomux = [0x114f004c, 0x403]; // Configure the SDA pin information. - } - pinConfig { - rstGpio = 3; // Set the reset pin. - intGpio = 4; // Set the interrupt pin. - rstRegCfg = [0x112f0094, 0x400]; // Configure the reset pin information. - intRegCfg = [0x112f0098, 0x400]; // Configure the interrupt pin information. - } - powerConfig { - /* Value 0 indicates that power supply is not used; value 1 indicates the LDO power supply; value 2 indicates the GPIO power supply; value 3 indicates the PMIC power supply. */ - vccType = 2; // Set the VCC type. Value 2 indicates the GPIO power supply. - vccNum = 20; // Set the VCC number. The GPIO number is 20. - vccValue = 1800; // Set the voltage amplitude to 1800 mV. - vciType = 1; // Set the VCI type. Value 1 indicates the LDO power supply. - vciNum = 12; // Set the VCI number. The LDO number is 12. - vciValue = 3300; // Set the voltage amplitude to 3300 mV. - } - - featureConfig { - capacitanceTest = 0; // Configure the capacitance test. - gestureMode = 0; // Configure the gesture mode. - gloverMode = 0; // Configure the gloves mode. - coverMode = 0; // Configure the cover mode. - chargerMode = 0; // Configure the charging mode. - knuckleMode = 0; // Configure the knuckle mode. - } - } - chipConfig { // Configure the private data of the touchscreen chip. - template touchChip { // Template - match_attr = ""; - chipName = "gt911"; // Set the touchscreen IC model. - vendorName = "zsj"; // Set the vendor name. - chipInfo = "AAAA11222"; // The first four characters indicate the product name. The fifth and sixth characters indicate the IC model. The last three characters indicate the chip model. - busType = 0; // 0 indicates the I2C bus, and 1 indicates the SPI bus. - deviceAddr = 0x5D; // Set the IC communication address. - irqFlag = 2; // Values 1 and 2 indicate that the interrupt is triggered on the rising and falling edges, respectively. Values 4 and 8 indicate that the interrupt is triggered by the high and low levels, respectively. - maxSpeed = 400; // Set the maximum communication rate to 400 Hz. - chipVersion = 0; // Set the touchscreen IC version. - powerSequence { - /* Power-on sequence is described as follows: - [Type, status, direction, delay] - Value 0 indicates the power or pin is empty. Values 1 and 2 indicate the VCC (1.8 V) and VCI (3.3 V) power, respectively. Values 3 and 4 indicate the reset and interrupt pins, respectively. - Values 0 and 1 indicate the power-off or pull-down, and the power-on or pull-up, respectively. Value 2 indicates that no operation is performed. - Values 0 and 1 indicate the input and output directions, respectively. Value 2 indicates that no operation is performed. - Delay time, in milliseconds. - */ - powerOnSeq = [4, 0, 1, 0, // Set the output direction for the interrupt pin and pull down the pin. - 3, 0, 1, 10, // Set the output direction for the reset pin and pull down the pin, with a delay of 10 ms. - 3, 1, 2, 60, // No operation is performed on the reset pin. Pull up the pin, with a delay of 60 ms. - 4, 2, 0, 0]; // Set the input direction for the interrupt pin. - suspendSeq = [3, 0, 2, 10]; // No operation is performed on the reset pin. Pull down the pin, with a delay of 10 ms. - resumeSeq = [3, 1, 2, 10]; // No operation is performed on the reset pin. Pull up the pin, with a delay of 10 ms. - powerOffSeq = [3, 0, 2, 10, // No operation is performed on the reset pin. Pull down the pin, with a delay of 10 ms. - 1, 0, 2, 20]; // No operation is performed on the positive pin. Pull down the pin, with a delay of 20 ms. - } - } - - chip0 :: touchChip { - match_attr = "zsj_gt911_5p5"; // Keep this value the same as the match_attr field in the touchscreen private configuration data in the device description. - chipInfo = "ZIDN45100"; // The chip information is composed of the product name, module number, and chip number, used to identity the current touchscreen in user space. - chipVersion = 0; // IC model version - } - } - } - } - } -} -``` - -In the example, **touchConfig** contains the **touch0** configuration, which describes the **boardConfig** and **chipConfig** configuration information. The **boardConfig** field provides the board-level hardware information of Hi3516D V300, and the **chipConfig** field provides the private configuration data of the touchscreen. To use another touchscreen, you can change the value of the **chipConfig** field. You can also configure multiple touchscreens for your product. In this example, **touch0** represents the hardware interface and chip configuration of the default touchscreen. If you need to configure a secondary touchscreen, add a **touch1** block parallel to **touch0**. - diff --git a/en/device-dev/guide/debugging-and-verification.md b/en/device-dev/guide/debugging-and-verification.md deleted file mode 100644 index 13a210d84987d51e46caf248980815b123107c74..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/debugging-and-verification.md +++ /dev/null @@ -1,5 +0,0 @@ -# Debugging and Verification - -- **[Startup Log Analysis](startup-log-analysis.md)** - - diff --git a/en/device-dev/guide/developing-a-touchscreen-driver.md b/en/device-dev/guide/developing-a-touchscreen-driver.md deleted file mode 100644 index 6fa833ae11f7f29760c9ec5f3822e7f8f41c28af..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/developing-a-touchscreen-driver.md +++ /dev/null @@ -1,17 +0,0 @@ -# Developing a Touchscreen Driver - -Complete the following tasks to adapt a touchscreen IC based on the input driver model: - -1. Configure the touchscreen driver description required for registering the driver with the HDF, for example, whether the driver is loaded and what is the loading priority. - -2. Configure the private data of the touchscreen \(such as the power-on and power-off sequence\) and the platform hardware information \(such as the GPIO port that connects the touchscreen to the development board\). - -3. Adapt to the private drivers of the touchscreen. The input driver model abstracts the development process of input devices. You only need to adapt to the input chip driver without making any modifications for the input device manager and common driver. - -- **[Configuring Device Driver Descriptions](configuring-device-driver-descriptions.md)** - -- **[Configuring the Touchscreen](configuring-the-touchscreen.md)** - -- **[Adapting to the Private Drivers of the Touchscreen](adapting-to-the-private-drivers-of-the-touchscreen.md)** - - diff --git a/en/device-dev/guide/development-example-for-clock-apps.md b/en/device-dev/guide/development-example-for-clock-apps.md deleted file mode 100644 index d461a0dd393f8283f806ded37aa1b4830e13a56f..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/development-example-for-clock-apps.md +++ /dev/null @@ -1,15 +0,0 @@ -# Development Example for Clock Apps - -- **[Overview](overview-7.md)** - -- **[Preparations](preparations-8.md)** - -- **[How to Develop](how-to-develop.md)** - -- **[Signing and Packaging](signing-and-packaging.md)** - -- **[Running on the Device](running-on-the-device-9.md)** - -- **[FAQs](faqs-10.md)** - - diff --git a/en/device-dev/guide/development-example-for-peripheral-drivers.md b/en/device-dev/guide/development-example-for-peripheral-drivers.md deleted file mode 100644 index 4333c26e067bd1ce6981ef3e0a558e5f03578822..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/development-example-for-peripheral-drivers.md +++ /dev/null @@ -1,15 +0,0 @@ -# Development Example for Peripheral Drivers - -- **[Overview](overview-13.md)** - -- **[Setting Up the Environment](setting-up-the-environment.md)** - -- **[Developing a Touchscreen Driver](developing-a-touchscreen-driver.md)** - -- **[Building and Burning](building-and-burning-14.md)** - -- **[Debugging and Verification](debugging-and-verification.md)** - -- **[Input Driver Model Workflow Analysis](input-driver-model-workflow-analysis.md)** - - diff --git a/en/device-dev/guide/development-example-for-platform-drivers.md b/en/device-dev/guide/development-example-for-platform-drivers.md deleted file mode 100644 index fbb47fb7d32d8b300c97f77d4f5fff0f1d616501..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/development-example-for-platform-drivers.md +++ /dev/null @@ -1,11 +0,0 @@ -# Development Example for Platform Drivers - -- **[Overview](overview-10.md)** - -- **[Preparations](preparations-11.md)** - -- **[Development](development-12.md)** - -- **[Building and Burning](building-and-burning.md)** - - diff --git a/en/device-dev/guide/development-guidelines-2.md b/en/device-dev/guide/development-guidelines-2.md deleted file mode 100644 index 6b5c9a629e1720512db8fa5d6f64388b80fb33fa..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/development-guidelines-2.md +++ /dev/null @@ -1,9 +0,0 @@ -# Development Guidelines - -- **[Photographing](photographing-3.md)** - -- **[Video Recording](video-recording-4.md)** - -- **[Previewing](previewing.md)** - - diff --git a/en/device-dev/guide/photographing-3.md b/en/device-dev/guide/device-camera-control-demo-photoguide.md similarity index 99% rename from en/device-dev/guide/photographing-3.md rename to en/device-dev/guide/device-camera-control-demo-photoguide.md index 7d6450e761f1a0d4823c683ae95546de5a0a18fb..eda733f15340836efaf5e6d25417821836bc333d 100644 --- a/en/device-dev/guide/photographing-3.md +++ b/en/device-dev/guide/device-camera-control-demo-photoguide.md @@ -385,6 +385,7 @@ None Surface *surface = Surface::CreateSurface(); if (surface == nullptr) { delete fc; + return; } surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */ fc->AddSurface(*surface); diff --git a/en/device-dev/guide/previewing.md b/en/device-dev/guide/device-camera-control-demo-previewguide.md similarity index 100% rename from en/device-dev/guide/previewing.md rename to en/device-dev/guide/device-camera-control-demo-previewguide.md diff --git a/en/device-dev/guide/video-recording-4.md b/en/device-dev/guide/device-camera-control-demo-videoguide.md similarity index 100% rename from en/device-dev/guide/video-recording-4.md rename to en/device-dev/guide/device-camera-control-demo-videoguide.md diff --git a/en/device-dev/guide/device-camera-control-demo.md b/en/device-dev/guide/device-camera-control-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..48b36ad9d6493fe655779cd63e2c9b8be7c2e1f4 --- /dev/null +++ b/en/device-dev/guide/device-camera-control-demo.md @@ -0,0 +1,9 @@ +# Development Guidelines + +- **[Photographing](device-camera-control-demo-photoguide.md)** + +- **[Video Recording](device-camera-control-demo-videoguide.md)** + +- **[Previewing](device-camera-control-demo-previewguide.md)** + + diff --git a/en/device-dev/guide/use-case-5.md b/en/device-dev/guide/device-camera-control-example.md similarity index 78% rename from en/device-dev/guide/use-case-5.md rename to en/device-dev/guide/device-camera-control-example.md index f4e481e1cef8c4815def24a9aa9c604df9b01680..9e77598359a5ec1e410e39d9354f0d541ac367fb 100644 --- a/en/device-dev/guide/use-case-5.md +++ b/en/device-dev/guide/device-camera-control-example.md @@ -3,9 +3,9 @@ This use case takes **camera\_sample** \(contained in the source code\) as an example for photographing, recording, and previewing on the development board. - You can obtain source code of the sample from **applications/sample/camera/media/camera\_sample.cpp**. -- Before running the sample camera, you need to compile, burn, and run the image. For details, see [Getting Started with Hi3516](../quick-start/hi3516-development-board.md). +- Before running the sample camera, you need to compile, burn, and run the image. For details, see [Hi3516 Development Board](../quick-start/quickstart-lite-introduction-hi3516.md#section26131214194212). - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >After the development board is started, the home screen is loaded and displayed above the media layer by default. To prevent covering **camera\_sample**, you should remove the home screen during compilation or packaging. >How to Remove: In **build/lite/components/applications.json**, comment out or delete the **//applications/sample/camera/launcher:launcher\_hap** line from the **target** field of **camera\_sample\_app**. @@ -18,7 +18,7 @@ This use case takes **camera\_sample** \(contained in the source code\) as an Recompile the source code repository and burn the code into the development board. Then you can find the **camera\_sample** file in the **bin** directory of the board. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >You should insert a TF card \(up to 128 GB supported\) for photographing and video recording before system startup. This way, the TF card will be automatically mounted to the **/sdcard** directory. If you insert the TF card after the system is started, you have to manually mount the TF card. >To view the photos and videos in the TF card, copy them to a computer. If you just want to preview photos and videos, you do not need to insert a TF card. @@ -27,38 +27,38 @@ This use case takes **camera\_sample** \(contained in the source code\) as an 1. Run the **cd** command to go to the end path of the executable program and start **camera\_sample** by running the command in the following figure. **Figure 1** Starting camera\_sample - ![](figures/starting-camera_sample.png "starting-camera_sample") + ![](figure/starting-camera_sample.png "starting-camera_sample") The control commands are displayed as shown in the preceding figure. Press **S** to stop the current operation \(including video recording and preview\), and press **Q** to exit the program. 2. Press **1** to take a photo in JPG format. The photo is saved in the **/sdcard** directory and named **Capture\***. **Figure 2** Serial port logs displayed after the photographing command is executed - ![](figures/serial-port-logs-displayed-after-the-photographing-command-is-executed.png "serial-port-logs-displayed-after-the-photographing-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-photographing-command-is-executed.png "serial-port-logs-displayed-after-the-photographing-command-is-executed") To view the saved file, exit the program and enter the file system. To start the program again, return to the previous step. **Figure 3** Saved files - ![](figures/saved-files.png "saved-files") + ![](figure/saved-files.png "saved-files") 3. Press **2** to start recording. The video file is in MP4 format and saved in the **/sdcard** directory with the name **Record\***. Press **S** to stop recording. **Figure 4** Serial port logs displayed after the recording command is executed - ![](figures/serial-port-logs-displayed-after-the-recording-command-is-executed.png "serial-port-logs-displayed-after-the-recording-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-recording-command-is-executed.png "serial-port-logs-displayed-after-the-recording-command-is-executed") 4. Press **3** to start preview. The preview is displayed on the screen. Press **S** to stop preview. **Figure 5** Serial port logs displayed after the preview command is executed - ![](figures/serial-port-logs-displayed-after-the-preview-command-is-executed.png "serial-port-logs-displayed-after-the-preview-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-preview-command-is-executed.png "serial-port-logs-displayed-after-the-preview-command-is-executed") The following figure shows the preview. **Figure 6** Preview effect - ![](figures/preview-effect.jpg "preview-effect") + ![](figure/preview-effect.jpg "preview-effect") 5. Press **Q** to exit. **Figure 7** Serial port logs displayed after the exit command is executed - ![](figures/serial-port-logs-displayed-after-the-exit-command-is-executed.png "serial-port-logs-displayed-after-the-exit-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-exit-command-is-executed.png "serial-port-logs-displayed-after-the-exit-command-is-executed") diff --git a/en/device-dev/guide/overview-1.md b/en/device-dev/guide/device-camera-control-overview.md similarity index 62% rename from en/device-dev/guide/overview-1.md rename to en/device-dev/guide/device-camera-control-overview.md index fb22f918ac419c6783e78bca66a00fb332b9bcad..61f5aa13eb0b6a3e4cdf4362bd5355846f7f4135 100644 --- a/en/device-dev/guide/overview-1.md +++ b/en/device-dev/guide/device-camera-control-overview.md @@ -4,7 +4,7 @@ This document describes how to use the IoT camera development board \(Hi3516D V3 This document helps you take a deep dive into OpenHarmony camera control. With this reference, you can develop devices, such as peephole cameras, smart rear-view mirrors, and smart displays. -If you want to view the running effect first, see [Use Case](use-case-5.md). To customize application behavior, modify the sample code by referring to APIs described in the "Development Guidelines" section. +If you want to view the running effect first, see [Use Case](device-camera-control-example.md). To customize application behavior, modify the sample code by referring to APIs described in the "Development Guidelines" section. -For basic concepts of camera development, see [Camera Development Overview](../subsystems/overview.md). +For basic concepts of camera development, see [Camera Development Overview](../subsystems/subsys-multimedia-camera-overview.md). diff --git a/en/device-dev/guide/screen-and-camera-control.md b/en/device-dev/guide/device-camera-control.md similarity index 30% rename from en/device-dev/guide/screen-and-camera-control.md rename to en/device-dev/guide/device-camera-control.md index e017e08b1bcec34edc084d41bbc1fd0f1773461f..062b965f7a68b9f00b602b2dfb8fe3b1cbacfbc1 100644 --- a/en/device-dev/guide/screen-and-camera-control.md +++ b/en/device-dev/guide/device-camera-control.md @@ -1,9 +1,9 @@ # Screen and Camera Control -- **[Overview](overview-1.md)** +- **[Overview](device-camera-control-overview.md)** -- **[Development Guidelines](development-guidelines-2.md)** +- **[Development Guidelines](device-camera-control-demo.md)** -- **[Use Case](use-case-5.md)** +- **[Use Case](device-camera-control-example.md)** diff --git a/en/device-dev/guide/adding-pages.md b/en/device-dev/guide/device-camera-visual-addpage.md similarity index 82% rename from en/device-dev/guide/adding-pages.md rename to en/device-dev/guide/device-camera-visual-addpage.md index 42eae0107fbdff36aff7879586df0fedebc792b2..2315fb68c61761574e12018baebf214b3006792a 100644 --- a/en/device-dev/guide/adding-pages.md +++ b/en/device-dev/guide/device-camera-visual-addpage.md @@ -8,7 +8,7 @@ Upon creation of the project, the **index** page is automatically generated, which is the home page of AirQuality. [Figure 1](#fig16545205773718) shows the project directory. **Figure 1** Project directory -![](figures/project-directory.png "project-directory") +![](figure/project-directory.png "project-directory") ## Creating the Details Page @@ -17,18 +17,18 @@ To the details page, perform the following steps: 1. Right-click **pages** and choose **New** \> **JS Page** from the shortcut menu. **Figure 2** Adding a page - ![](figures/adding-a-page.png "adding-a-page") + ![](figure/adding-a-page.png "adding-a-page") 2. Enter the page name. **Figure 3** Entering the page name - ![](figures/entering-the-page-name.png "entering-the-page-name") + ![](figure/entering-the-page-name.png "entering-the-page-name") 3. Confirm the creation. The following figure shows the application project directory after the **detail** page is created. It contains a **.hml** layout file, a **.css** file, and a **.js** file \(containing service logic code\). **Figure 4** Complete project directory - ![](figures/complete-project-directory.png "complete-project-directory") + ![](figure/complete-project-directory.png "complete-project-directory") diff --git a/en/device-dev/guide/debugging-and-packaging.md b/en/device-dev/guide/device-camera-visual-debug.md similarity index 37% rename from en/device-dev/guide/debugging-and-packaging.md rename to en/device-dev/guide/device-camera-visual-debug.md index 97df7e21ab4e36ac3420ba1494bf8452fa5f226e..2d4c192fb9c4948b510b6f0ad85d9e50f0a50a03 100644 --- a/en/device-dev/guide/debugging-and-packaging.md +++ b/en/device-dev/guide/device-camera-visual-debug.md @@ -1,4 +1,4 @@ # Debugging and Packaging -After the code is compiled, debug your application and package it into an App Pack. For details about how to debug and package an application, see [Debugging Your App](https://developer.harmonyos.com/en/docs/documentation/doc-guides/debug_overview-0000001053822404) and [Building Your App](https://developer.harmonyos.com/en/docs/documentation/doc-guides/build_overview-0000001055075201) in the [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387). Currently, IPCamera applications do not support signature. You should release an unsigned App Pack. +After the code is compiled, debug your application and package it into an App Pack. For details about how to debug and package an application, see [Debugging Your App](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ide_debug_device-0000001053822404) and [Building Your App](https://developer.harmonyos.com/en/docs/documentation/doc-guides/build_overview-0000001055075201) in the [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387). Currently, IPCamera applications do not support signature. You should release an unsigned App Pack. diff --git a/en/device-dev/guide/building-the-details-page.md b/en/device-dev/guide/device-camera-visual-details.md similarity index 97% rename from en/device-dev/guide/building-the-details-page.md rename to en/device-dev/guide/device-camera-visual-details.md index 915c74a318163d6a50cab13e46f919b129690d1d..60bd585e6dd6d90cbfe47c6e68cc7a7b5dc85dee 100644 --- a/en/device-dev/guide/building-the-details-page.md +++ b/en/device-dev/guide/device-camera-visual-details.md @@ -4,9 +4,9 @@ - [detail.css](#section2589154215301) - [detail.js](#section163410883117) -The **detail** page displays the air quality data of a week in a chart. There are two parts on the page: title bar and chart bar. Considering the display effect of the chart bar, use multiple **** components in stead of one **** component. +The **detail** page displays the air quality data of a week in a chart. There are two parts on the page: title bar and chart bar. Considering the display effect of the chart bar, use multiple **** components instead of one **** component. -Add a root ****, set the **flex-direction** attribute to **column** to arrange the two bars vertically. The example code is as follows: +Add a root ****, set the **flex-direction** attribute to **column** to arrange the two bars vertically. The sample code is as follows: ```
@@ -21,7 +21,7 @@ Add a root ****, set the **flex-direction** attribute to **column** t
``` -In the preceding example, **onclick="backMain"** indicates that the application returns to the home page when the click event is triggered. The example code for **detail.js** is as follows: +In the preceding example, **onclick="backMain"** indicates that the application returns to the home page when the click event is triggered. The sample code for **detail.js** is as follows: ``` import router from '@system.router' @@ -42,7 +42,7 @@ export default { Add **** components to the **** component to form a chart. -The complete example code in the three files is as follows. +The complete sample code in the three files is as follows. ## detail.hml diff --git a/en/device-dev/guide/faqs.md b/en/device-dev/guide/device-camera-visual-faqs.md similarity index 100% rename from en/device-dev/guide/faqs.md rename to en/device-dev/guide/device-camera-visual-faqs.md diff --git a/en/device-dev/guide/building-the-home-page.md b/en/device-dev/guide/device-camera-visual-first-page.md similarity index 98% rename from en/device-dev/guide/building-the-home-page.md rename to en/device-dev/guide/device-camera-visual-first-page.md index e50391cee73cb565eb6537ec06a70eb53ee996aa..5fe705f70f0dee725e2d4f485e7cf8652497b3b9 100644 --- a/en/device-dev/guide/building-the-home-page.md +++ b/en/device-dev/guide/device-camera-visual-first-page.md @@ -10,7 +10,7 @@ The home page of AirQuality consists of three parts: The following steps describe how to build the home page with a flexible layout that has three rows vertically arranged. -1. Add a root **** to the **.hml** file. Note that each **.hml** file can contain only one root component. The example code is as follows: +1. Add a root **** to the **.hml** file. Note that each **.hml** file can contain only one root component. The sample code is as follows: ```
@@ -29,7 +29,7 @@ The following steps describe how to build the home page with a flexible layout t The height and width of the root component **** are set in the style class. Note that the height and width must be explicitly specified \(except for some components, such as ****\). Otherwise, the component may fail to display. In the **container** style class, the **flex-direction** attribute is set to **column**, which means that child components of **** are vertically arranged from top to bottom for implementing the flexible page layout. -2. Add the title bar. The title bar consists of an exit button and title text that are horizontally arranged. Add a **** to hold the title bar and set the **flex-direction** attribute to **row** to arrange the child components from left to right. Add an **** and a **** component in sequence. The example code is as follows: +2. Add the title bar. The title bar consists of an exit button and title text that are horizontally arranged. Add a **** to hold the title bar and set the **flex-direction** attribute to **row** to arrange the child components from left to right. Add an **** and a **** component in sequence. The sample code is as follows: ```
@@ -83,7 +83,7 @@ The following steps describe how to build the home page with a flexible layout t After the code is compiled, run the project on the simulator. The following figure shows the display effect. **Figure 1** Title bar - ![](figures/title-bar.png "title-bar") + ![](figure/title-bar.png "title-bar") 3. The **** component is required to implement the switching between screens. @@ -177,7 +177,7 @@ The following steps describe how to build the home page with a flexible layout t After the code is compiled, the display effect on the simulator is as follows. **Figure 2** Title bar and information bar - ![](figures/title-bar-and-information-bar.png "title-bar-and-information-bar") + ![](figure/title-bar-and-information-bar.png "title-bar-and-information-bar") 5. Add the indicator bar. Currently, the **** component does not support indicator settings. You need to implement a dots indicator by adding **** components and setting the style. Add a **** as a child component to the root node and set the style. Add two **** to the parent ****, set **border-radius** for the two child ****, and dynamically change the background colors of the **** components in the swiping event. @@ -189,9 +189,9 @@ The following steps describe how to build the home page with a flexible layout t ``` **Figure 3** Indicator bar - ![](figures/indicator-bar.png "indicator-bar") + ![](figure/indicator-bar.png "indicator-bar") -6. Set the style, animation effect, and dynamic data binding for all components. The complete example code is as follows: +6. Set the style, animation effect, and dynamic data binding for all components. The complete sample code is as follows: - **index.hml** diff --git a/en/device-dev/guide/overview-6.md b/en/device-dev/guide/device-camera-visual-overview.md similarity index 62% rename from en/device-dev/guide/overview-6.md rename to en/device-dev/guide/device-camera-visual-overview.md index 13a514937591a52c53f35897110ab7d949505d7a..bf44297f7f42964b9883c939893a07bbbfe94a18 100644 --- a/en/device-dev/guide/overview-6.md +++ b/en/device-dev/guide/device-camera-visual-overview.md @@ -2,7 +2,7 @@ - [Display Effects](#section3997224182313) -This document describes how to quickly set up an application development environment \(using the Hi3516DV300 development board\) for event data recorders running on OpenHarmony. An air quality monitoring application, AirQuality, is used as an example to describe how to create, develop, and debug your application. +This document describes how to quickly set up an application development environment \(using the Hi3516D V300 development board\) for event data recorders running on OpenHarmony. An air quality monitoring application, AirQuality, is used as an example to describe how to create, develop, and debug your application. ## Display Effects @@ -11,5 +11,5 @@ AirQuality displays information about the urban air quality on two pages, the ho **Figure 1** Display effects of the AirQuality -![](figures/video_2020-07-25_173141.gif) +![](figure/video_2020-07-25_173141.gif) diff --git a/en/device-dev/guide/preparations.md b/en/device-dev/guide/device-camera-visual-prepare.md similarity index 96% rename from en/device-dev/guide/preparations.md rename to en/device-dev/guide/device-camera-visual-prepare.md index 9b4572fc68620f830d040b4537fecb852b9fc9dd..52beaf139d6ebb7fbe8460cc8bb01fea5b1aa78c 100644 --- a/en/device-dev/guide/preparations.md +++ b/en/device-dev/guide/device-camera-visual-prepare.md @@ -15,7 +15,7 @@ Download and install DevEco Studio. For details, see the [HUAWEI DevEco Studio 2. Choose the **Smart Vision** for **Device** and **Empty Feature Ability** for **Template**. - ![](figures/en-us_image_0000001082434703.png) + ![](figure/en-us_image_0000001082434703.png) 3. Click **Next** and configure the project. - **Project Name**: project name. diff --git a/en/device-dev/guide/running-on-the-device.md b/en/device-dev/guide/device-camera-visual-run.md similarity index 65% rename from en/device-dev/guide/running-on-the-device.md rename to en/device-dev/guide/device-camera-visual-run.md index 79167a2934ce10c5e799b2c59d09830ac68e7ac4..3668d68d278d34f1aae9f34c0fcda9ca1157269d 100644 --- a/en/device-dev/guide/running-on-the-device.md +++ b/en/device-dev/guide/device-camera-visual-run.md @@ -1,8 +1,8 @@ # Running on the Device -Before you install the application and run it on the development board, install the DevEco Device Tool by following operations provided in [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/tool_install-0000001050164976). Burn OpenHarmony into the development board, and run it on the board. For details about how to compile, burn, and run an image, see the [Getting Started with Hi3516](../quick-start/hi3516-development-board.md). After the image is running normally and the system is started properly, perform the following steps to install or uninstall the application: +Before you install the application and run it on the development board, install the DevEco Device Tool by following operations provided in [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905). Burn OpenHarmony into the development board, and run it on the board. For details about how to compile, burn, and run an image, see the [Hi3516 Development Board](../quick-start/quickstart-lite-introduction-hi3516.md#section26131214194212). After the image is running normally and the system is started properly, perform the following steps to install or uninstall the application: -1. Store the compiled unsigned application installation package and installation tool in an SD card and insert the SD card into the development board slot. The installation tool is in **idev\_tools** of the directory where the image file is generated. +1. Store the compiled unsigned application installation package and installation tool in an SD card and insert the SD card into the development board slot. The installation tool is in **dev\_tools** of the directory where the image file is generated. 2. Run the following command to disable signature verification, which is enabled by default for application installation: ``` @@ -20,7 +20,7 @@ Before you install the application and run it on the development board, install 4. After the application is installed, touch the application icon on the home screen to enter the application. **Figure 1** Home screen - ![](figures/home-screen.png "home-screen") + ![](figure/home-screen.png "home-screen") 5. \(Optional\) Uninstall the application. diff --git a/en/device-dev/guide/device-camera-visual.md b/en/device-dev/guide/device-camera-visual.md new file mode 100644 index 0000000000000000000000000000000000000000..183a3c5758f90bb42becc05c09e74379f53a9c28 --- /dev/null +++ b/en/device-dev/guide/device-camera-visual.md @@ -0,0 +1,19 @@ +# Visual Application Development + +- **[Overview](device-camera-visual-overview.md)** + +- **[Preparations](device-camera-visual-prepare.md)** + +- **[Adding Pages](device-camera-visual-addpage.md)** + +- **[Building the Home Page](device-camera-visual-first-page.md)** + +- **[Building the Details Page](device-camera-visual-details.md)** + +- **[Debugging and Packaging](device-camera-visual-debug.md)** + +- **[Running on the Device](device-camera-visual-run.md)** + +- **[FAQs](device-camera-visual-faqs.md)** + + diff --git a/en/device-dev/guide/cameras-with-a-screen.md b/en/device-dev/guide/device-camera.md similarity index 34% rename from en/device-dev/guide/cameras-with-a-screen.md rename to en/device-dev/guide/device-camera.md index b212cc236c70be6403f659c5eabdaeebfc7d677a..3fab60c51ec77fb4f023d1337edc3327aa29dbc0 100644 --- a/en/device-dev/guide/cameras-with-a-screen.md +++ b/en/device-dev/guide/device-camera.md @@ -1,7 +1,7 @@ # Cameras with a Screen -- **[Screen and Camera Control](screen-and-camera-control.md)** +- **[Screen and Camera Control](device-camera-control.md)** -- **[Visual Application Development](visual-application-development.md)** +- **[Visual Application Development](device-camera-visual.md)** diff --git a/en/device-dev/guide/development-12.md b/en/device-dev/guide/device-driver-demo.md similarity index 80% rename from en/device-dev/guide/development-12.md rename to en/device-dev/guide/device-driver-demo.md index 59fb5d8e5ee93659cfe90543390f8065bcae6b5b..9415d5323083e8dd5780360956a864b46988aec0 100644 --- a/en/device-dev/guide/development-12.md +++ b/en/device-dev/guide/device-driver-demo.md @@ -1,14 +1,47 @@ -# Development +# Development Example for Platform Drivers -- [Instantiating the Driver Entry](#section6586911816) -- [Setting Related Parameters](#section114323217503) -- [Adding a Controller](#section115187812516) +- [Overview](#section194201316174215) +- [Preparations](#section6926133918422) +- [Development](#section65801539470) + - [File Description](#section0708184454414) + - [Instantiating the Driver Entry](#section85325864412) + - [Setting Related Parameters](#section8155172019453) + - [Adding a Controller](#section1335374114452) -Platform driver development includes the following procedures: +- [Building Source Code and Burning Images](#section164824754712) -1. Instantiate the driver entry: Instantiate an **HdfDriverEntry** object as the driver entry. -2. Set related parameters: Configure the **device\_info.hcs** file and obtain and parse device configuration parameters from the HCS to ensure that the driver can be correctly loaded. -3. Add a controller: Initialize the controller hardware, call core-layer APIs to add or delete devices to or from the core layer, and implement a hook. +## Overview + +This document uses the I2C driver as an example to describe how to develop platform drivers based on the hardware driver foundation \(HDF\). + +>![](../public_sys-resources/icon-caution.gif) **CAUTION:** +>The sample code in this document is for reference only and cannot be directly used for commercial integration. + +The HDF provides a standard driver framework for common peripherals. To use the APIs provided by the HDF to perform operations on peripherals, you only need to adapt the specific driver to the HDF. + +In this example, an I2C driver is used. [Figure 1](#fig148041484161) shows the sequence diagram of the I2C driver. + +**Figure 1** I2C driver sequence diagram + + +![](figure/en-us_image_0000001169991055.png) + +- User Business: business-triggered driver +- i2cManagerEntry: entry to the I2C manager, which is used to register the I2C manager with the HDF +- I2cManager: I2C manager, which manages the I2C controller +- I2cCntlr: I2C controller +- i2cDriverEntry: entry to the I2C controller, which is used to register the I2C controller with the HDF + +## Preparations + +Follow the instructions in [Environment Setup for Standard System](../quick-start/quickstart-standard.md). + +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** +>This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment. + +## Development + +### File Description The following table lists the files involved in this example and their paths. @@ -39,7 +72,7 @@ The following table lists the files involved in this example and their paths.

- @@ -72,12 +105,12 @@ The following table lists the files involved in this example and their paths.

Parameter

+ - @@ -393,3 +469,89 @@ void WatchdogClose\(DevHandle handle\); ret = WatchdogClose(handle); ``` +## Usage Example + +This example provides a complete process for using a watchdog. + +In this example, open a watchdog, set the timeout duration, and start the watchdog. + +- Feed the watchdog periodically to ensure that the system is not reset due to timer expiry. +- Stop feeding the watchdog and check whether the system is reset after the timer expires. + +Example: + +``` +#include "watchdog_if.h" +#include "hdf_log.h" +#include "osal_irq.h" +#include "osal_time.h" + +#define WATCHDOG_TEST_TIMEOUT 2 +#define WATCHDOG_TEST_FEED_TIME 6 + +static int32_t TestCaseWatchdog(void) +{ + int32_t i; + int32_t ret; + uint32_t timeout; + DevHandle handle = NULL; + + /* Open watchdog 0. */ + handle = WatchdogOpen(0); + if (handle == NULL) { + HDF_LOGE("Open watchdog fail!"); + return -1; + } + + /* Set the timeout duration. */ + ret = WatchdogSetTimeout(handle, WATCHDOG_TEST_TIMEOUT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set timeout fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + + /* Obtain the configured timeout duration. */ + ret = WatchdogGetTimeout(handle, &timeout); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: get timeout fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + HDF_LOGI("%s: read timeout back:%u\n", __func__, timeout); + + /* Start the watchdog. The timer starts. */ + ret = WatchdogStart(handle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + + /* Feed the watchdog every 1s. */ + for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { + HDF_LOGE("%s: feeding watchdog %d times... \n", __func__, i); + ret = WatchdogFeed(handle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: feed dog fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + OsalSleep(1); + } + /* Because the interval for feeding the watchdog is shorter than the timeout duration, the system does not reset, and logs can be printed normally. */ + HDF_LOGE("%s: no reset ... feeding test OK!!!\n", __func__); + + /* Enable the timer to expire by stopping feeding the watchdog. */ + for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { + HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); + OsalSleep(1); + } + + /* The system resets when the timer expires. If the code is correct, the log below is not displayed. */ + HDF_LOGE("%s: dog has't buck!!! \n", __func__, i); + WatchdogClose(handle); + return -1; +} +``` + diff --git a/en/device-dev/driver/driver-platform.md b/en/device-dev/driver/driver-platform.md index d75727d7407e71e9088a907083d02278462474e3..c15f954770c9b49ba191a50de133f954d0c63bcd 100644 --- a/en/device-dev/driver/driver-platform.md +++ b/en/device-dev/driver/driver-platform.md @@ -1,19 +1,19 @@ -# Driver Platform +# Platform drivers -- **[GPIO](gpio.md)** +- **[GPIO](driver-platform-gpio-des.md)** -- **[I2C](i2c.md)** +- **[I2C](driver-platform-i2c-des.md)** -- **[RTC](rtc.md)** +- **[RTC](driver-platform-rtc-des.md)** -- **[SDIO](sdio.md)** +- **[SDIO](driver-platform-sdio-des.md)** -- **[SPI](spi.md)** +- **[SPI](driver-platform-spi-des.md)** -- **[UART](uart.md)** +- **[UART](driver-platform-uart-des.md)** -- **[WATCHDOG](watchdog.md)** +- **[Watchdog](driver-platform-watchdog-des.md)** -- **[MIPI DSI](mipi-dsi.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 0000000000000000000000000000000000000000..a046ce6e68b6b7ede4a835f772a75962b1fc870c --- /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/driver/figures/architecture-of-the-display-driver-model.png b/en/device-dev/driver/figure/architecture-of-the-display-driver-model.png similarity index 100% rename from en/device-dev/driver/figures/architecture-of-the-display-driver-model.png rename to en/device-dev/driver/figure/architecture-of-the-display-driver-model.png diff --git a/en/device-dev/driver/figures/architecture-of-the-input-driver-model.png b/en/device-dev/driver/figure/architecture-of-the-input-driver-model.png similarity index 100% rename from en/device-dev/driver/figures/architecture-of-the-input-driver-model.png rename to en/device-dev/driver/figure/architecture-of-the-input-driver-model.png diff --git a/en/device-dev/driver/figures/architecture-of-the-sensor-driver-model.png b/en/device-dev/driver/figure/architecture-of-the-sensor-driver-model.png similarity index 100% rename from en/device-dev/driver/figures/architecture-of-the-sensor-driver-model.png rename to en/device-dev/driver/figure/architecture-of-the-sensor-driver-model.png diff --git a/en/device-dev/driver/figures/common-pins-of-the-touchscreen.png b/en/device-dev/driver/figure/common-pins-of-the-touchscreen.png similarity index 100% rename from en/device-dev/driver/figures/common-pins-of-the-touchscreen.png rename to en/device-dev/driver/figure/common-pins-of-the-touchscreen.png diff --git a/en/device-dev/driver/figures/dsi-transmitting-and-receiving-interface.png b/en/device-dev/driver/figure/dsi-transmitting-and-receiving-interface.png similarity index 100% rename from en/device-dev/driver/figures/dsi-transmitting-and-receiving-interface.png rename to en/device-dev/driver/figure/dsi-transmitting-and-receiving-interface.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001053405727.png b/en/device-dev/driver/figure/en-us_image_0000001053405727.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001053405727.png rename to en/device-dev/driver/figure/en-us_image_0000001053405727.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054280608.png b/en/device-dev/driver/figure/en-us_image_0000001054280608.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054280608.png rename to en/device-dev/driver/figure/en-us_image_0000001054280608.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054564784.png b/en/device-dev/driver/figure/en-us_image_0000001054564784.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054564784.png rename to en/device-dev/driver/figure/en-us_image_0000001054564784.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001057902344.png b/en/device-dev/driver/figure/en-us_image_0000001123509750.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001057902344.png rename to en/device-dev/driver/figure/en-us_image_0000001123509750.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001072553354.png b/en/device-dev/driver/figure/en-us_image_0000001123514210.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001072553354.png rename to en/device-dev/driver/figure/en-us_image_0000001123514210.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054440624.png b/en/device-dev/driver/figure/en-us_image_0000001123540984.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054440624.png rename to en/device-dev/driver/figure/en-us_image_0000001123540984.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054007499.png b/en/device-dev/driver/figure/en-us_image_0000001123582482.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054007499.png rename to en/device-dev/driver/figure/en-us_image_0000001123582482.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054728498.png b/en/device-dev/driver/figure/en-us_image_0000001123675706.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054728498.png rename to en/device-dev/driver/figure/en-us_image_0000001123675706.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054726248.png b/en/device-dev/driver/figure/en-us_image_0000001123703482.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054726248.png rename to en/device-dev/driver/figure/en-us_image_0000001123703482.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054142582.png b/en/device-dev/driver/figure/en-us_image_0000001123742254.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054142582.png rename to en/device-dev/driver/figure/en-us_image_0000001123742254.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001057342245.png b/en/device-dev/driver/figure/en-us_image_0000001170187071.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001057342245.png rename to en/device-dev/driver/figure/en-us_image_0000001170187071.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001054006983.png b/en/device-dev/driver/figure/en-us_image_0000001170227689.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001054006983.png rename to en/device-dev/driver/figure/en-us_image_0000001170227689.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001057622716.png b/en/device-dev/driver/figure/en-us_image_0000001170229891.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001057622716.png rename to en/device-dev/driver/figure/en-us_image_0000001170229891.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001053926237.png b/en/device-dev/driver/figure/en-us_image_0000001170262141.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001053926237.png rename to en/device-dev/driver/figure/en-us_image_0000001170262141.png diff --git a/en/device-dev/driver/figures/en-us_image_0000001055299108.png b/en/device-dev/driver/figure/en-us_image_0000001170383063.png similarity index 100% rename from en/device-dev/driver/figures/en-us_image_0000001055299108.png rename to en/device-dev/driver/figure/en-us_image_0000001170383063.png diff --git a/en/device-dev/driver/figures/mipi-dsi.png b/en/device-dev/driver/figure/mipi-dsi.png similarity index 100% rename from en/device-dev/driver/figures/mipi-dsi.png rename to en/device-dev/driver/figure/mipi-dsi.png diff --git a/en/device-dev/driver/figures/physical-connection-diagram-for-i2c.png b/en/device-dev/driver/figure/physical-connection-diagram-for-i2c.png similarity index 100% rename from en/device-dev/driver/figures/physical-connection-diagram-for-i2c.png rename to en/device-dev/driver/figure/physical-connection-diagram-for-i2c.png diff --git a/en/device-dev/driver/figures/ttl-interface.png b/en/device-dev/driver/figure/ttl-interface.png similarity index 100% rename from en/device-dev/driver/figures/ttl-interface.png rename to en/device-dev/driver/figure/ttl-interface.png diff --git "a/en/device-dev/driver/figures/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" "b/en/device-dev/driver/figure/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" similarity index 100% rename from "en/device-dev/driver/figures/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" rename to "en/device-dev/driver/figure/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" diff --git a/en/device-dev/driver/gpio.md b/en/device-dev/driver/gpio.md deleted file mode 100644 index a35dc16408feb1ef8d9c6b7ad878a8d99d00fea6..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/gpio.md +++ /dev/null @@ -1,9 +0,0 @@ -# GPIO - -- **[GPIO Overview](gpiooverview.md)** - -- **[GPIO Usage Guidelines](gpiousage-guidelines.md)** - -- **[GPIO Usage Example](gpiousage-example.md)** - - diff --git a/en/device-dev/driver/gpiooverview.md b/en/device-dev/driver/gpiooverview.md deleted file mode 100644 index a05df150d2b1b166350337754bb024e4d58e7e67..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/gpiooverview.md +++ /dev/null @@ -1,85 +0,0 @@ -# GPIO Overview - -- [Introduction](#section15318165672215) -- [Available APIs](#section18977142162418) - -## Introduction - -GPIO is short for general-purpose input/output. Generally, a GPIO controller manages all GPIO pins by group. Each group of GPIO pins is associated with one or more registers. The GPIO pins are operated by reading data from and writing data to the registers. - -The GPIO APIs define a set of standard functions for performing operations on GPIO pins, including: - -- Setting the pin direction, which can be input or output \(High impedance is not supported currently.\) - -- Reading and writing level values, which can be low or high -- Setting an interrupt service routine \(ISR\) function and interrupt trigger mode for a pin -- Enabling or disabling a pin interrupt - -## Available APIs - -**Table 1** APIs available for the GPIO driver - - -

Parameter

Description

+

Description

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

GPIO read/write

-

GpioRead

-

Reads the level value of a GPIO pin.

-

GpioWrite

-

Writes the level value of a GPIO pin.

-

GPIO settings

-

GpioSetDir

-

Sets the direction for a GPIO pin.

-

GpioGetDir

-

Obtains the direction for a GPIO pin.

-

GPIO interrupt settings

-

-

-

-

GpioSetIrq

-

Sets the ISR function for a GPIO pin.

-

GpioUnSetIrq

-

Cancels the setting of the ISR function for a GPIO pin.

-

GpioEnableIrq

-

Enables a GPIO interrupt.

-

GpioDisableIrq

-

Disables a GPIO interrupt.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions provided in this document can be called only in kernel mode. - diff --git a/en/device-dev/driver/gpiousage-example.md b/en/device-dev/driver/gpiousage-example.md deleted file mode 100644 index bfdb21eed1d8feece2e48d130b8d0cea1ae17a58..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/gpiousage-example.md +++ /dev/null @@ -1,79 +0,0 @@ -# GPIO Usage Example - -In this example, we test the interrupt trigger of a GPIO pin as follows: Set the ISR function for the pin, set the trigger mode to rising edge and failing edge, write high and low levels to the pin alternately to generate level fluctuation, and observe the execution of the ISR function. - -Select an idle GPIO pin. This example uses a Hi3516D V300 development board and GPIO pin GPIO10\_3, which is numbered GPIO83. - -You can select an idle GPIO pin based on the development board and schematic diagram. - -``` -#include "gpio_if.h" -#include "hdf_log.h" -#include "osal_irq.h" -#include "osal_time.h" - -static uint32_t g_irqCnt; - -/* ISR function */ -static int32_t TestCaseGpioIrqHandler(uint16_t gpio, void *data) -{ - HDF_LOGE("%s: irq triggered! on gpio:%u, data=%p", __func__, gpio, data); - g_irqCnt++; /* If the ISR function is triggered, the number of global interrupts is incremented by 1. */ - return GpioDisableIrq(gpio); -} - -/* Test case function */ -static int32_t TestCaseGpioIrqEdge(void) -{ - int32_t ret; - uint16_t valRead; - uint16_t mode; - uint16_t gpio = 83; /* Number of the GPIO pin to test */ - uint32_t timeout; - - /* Set the output direction for the pin. */ - ret = GpioSetDir(gpio, GPIO_DIR_OUT); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set dir fail! ret:%d\n", __func__, ret); - return ret; - } - - /* Disable the interrupt of the pin. */ - ret = GpioDisableIrq(gpio); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: disable irq fail! ret:%d\n", __func__, ret); - return ret; - } - - /* Set the ISR function for the pin. The trigger mode is both rising edge and falling edge. */ - mode = OSAL_IRQF_TRIGGER_RISING | OSAL_IRQF_TRIGGER_FALLING; - HDF_LOGE("%s: mode:%0x\n", __func__, mode); - ret = GpioSetIrq(gpio, mode, TestCaseGpioIrqHandler, NULL); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set irq fail! ret:%d\n", __func__, ret); - return ret; - } - - /* Enable the interrupt for this pin. */ - ret = GpioEnableIrq(gpio); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: enable irq fail! ret:%d\n", __func__, ret); - (void)GpioUnSetIrq(gpio); - return ret; - } - - g_irqCnt = 0; /* Reset the global counter. */ - timeout = 0; /* Reset the waiting time. */ - /* Wait for the ISR function of this pin to trigger. The timeout duration is 1000 ms. */ - while (g_irqCnt <= 0 && timeout < 1000) { - (void)GpioRead(gpio, &valRead); - (void)GpioWrite(gpio, (valRead == GPIO_VAL_LOW) ? GPIO_VAL_HIGH : GPIO_VAL_LOW); - HDF_LOGE("%s: wait irq timeout:%u\n", __func__, timeout); - OsalMDelay(200); /* wait for irq trigger */ - timeout += 200; - } - (void)GpioUnSetIrq(gpio); - return (g_irqCnt > 0) ? HDF_SUCCESS : HDF_FAILURE; -} -``` - diff --git a/en/device-dev/driver/hdf.md b/en/device-dev/driver/hdf.md deleted file mode 100644 index 05183747d4acb2435125a02035725cedc28b5081..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/hdf.md +++ /dev/null @@ -1,15 +0,0 @@ -# HDF - -- **[HDF Overview](hdfoverview.md)** - -- **[Driver Development](driver-development.md)** - -- **[Driver Service Management](driver-service-management.md)** - -- **[Driver Message Mechanism Management](driver-message-mechanism-management.md)** - -- **[Driver Configuration Management](driver-configuration-management.md)** - -- **[HDF Development Example](hdfdevelopment-example.md)** - - diff --git a/en/device-dev/driver/i2c-overview.md b/en/device-dev/driver/i2c-overview.md deleted file mode 100644 index 407a149be21029b30d63559117a93b846ce70c00..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/i2c-overview.md +++ /dev/null @@ -1,60 +0,0 @@ -# I2C Overview - -- [Introduction](#section5361140416) -- [Available APIs](#section7606310210) - -## Introduction - -- The Inter-Integrated Circuit \(I2C\) is a simple, bidirectional, and synchronous serial bus that uses merely two wires. -- In an I2C communication, one controller communicates with one or more devices through the serial data line \(SDA\) and serial clock line \(SCL\), as shown in [Figure 1](#fig1135561232714). - -- I2C data transfer must begin with a **START** condition and end with a **STOP** condition. Data is transmitted byte-by-byte from the most significant bit to the least significant bit. -- Each I2C node is recognized by a unique address and can serve as either a controller or a device. When the controller needs to communicate with a device, it writes the device address to the bus through broadcast. A device matching this address sends a response to set up a data transfer channel. - -- The I2C APIs define a set of common functions for I2C data transfer, including: - - - I2C controller management: opening or closing an I2C controller - - I2C message transfer: custom transfer by using a message array - - **Figure 1** Physical connection diagram for I2C - ![](figures/physical-connection-diagram-for-i2c.png "physical-connection-diagram-for-i2c") - - -## Available APIs - -**Table 1** APIs available for the I2C driver - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

I2C controller management

-

I2cOpen

-

Opens an I2C controller.

-

I2cClose

-

Closes an I2C controller.

-

I2C message transfer

-

I2cTransfer

-

Performs a custom transfer.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions provided in this document can be called only in kernel mode. - diff --git a/en/device-dev/driver/i2c-usage-example.md b/en/device-dev/driver/i2c-usage-example.md deleted file mode 100644 index 438961611a6aba9bcb7e9a89617650a63e7dcd36..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/i2c-usage-example.md +++ /dev/null @@ -1,192 +0,0 @@ -# I2C Usage Example - -This example describes how to use I2C APIs by using an I2C device on a development board. - -This example shows a simple register read/write operation on TouchPad on a Hi3516D V300 development board. The basic hardware information is as follows: - -- SoC: hi3516dv300 - -- Touch IC: The I2C address is 0x38, and the bit width of Touch IC's internal register is 1 byte. - -- Schematic diagram: TouchPad is mounted to I2C controller 3. The reset pin of Touch IC is GPIO3. - -In this example, first we reset Touch IC. \(The development board supplies power to Touch IC by default after being powered on, and this use case does not consider the power supply\). Then, we perform a read/wirte operation on an internal register to test whether the I2C channel is normal. - ->![](public_sys-resources/icon-note.gif) **NOTE:** ->The example focuses on I2C device access and verifies the I2C channel. The read and write values of the device register are not concerned. The behavior caused by the read and write operations on the register is determined by the device itself. - -Example: - -``` -#include "i2c_if.h" /* Header file of I2C APIs */ -#include "gpio_if.h" /* Header file of GPIO APIs */ -#include "hdf_log.h" /* Header file for log APIs */ -#include "osal_io.h" /* Header file of I/O read and write APIs */ -#include "osal_time.h" /* Header file of delay and sleep APIs */ - -/* Define a TP device structure to store I2C and GPIO hardware information. */ -struct TpI2cDevice { - uint16_t rstGpio; /* Reset pin */ - uint16_t busId; /* I2C bus ID */ - uint16_t addr; /* I2C device address */ - uint16_t regLen; /* Register bit width */ - DevHandle i2cHandle; /* I2C controller handle */ -}; - -/* I2C pin I/O configuration. For details, see the SoC register manual. */ -#define I2C3_DATA_REG_ADDR 0x112f008c /* Address of the SDA pin configuration register of I2C controller 3 -#define I2C3_CLK_REG_ADDR 0x112f0090 /* Address of the SCL pin configuration register of I2C controller 3 -#define I2C_REG_CFG 0x5f1 /* Configuration values of SDA and SCL pins of I2C controller 3 - -static void TpSocIoCfg(void) -{ - /* Set the I/O function of the two pins corresponding to I2C controller 3 to I2C. */ - OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_DATA_REG_ADDR)); - OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_CLK_REG_ADDR)); -} - -/* Initialize the reset pin of the TP. Pull up the pin for 20 ms, pull down the pin for 50 ms, and then pull up the pin for 20 ms to complete the resetting. */ -static int32_t TestCaseGpioInit(struct TpI2cDevice *tpDevice) -{ - int32_t ret; - - /* Set the output direction for the reset pin. */ - ret = GpioSetDir(tpDevice->rstGpio, GPIO_DIR_OUT); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst dir fail!:%d", __func__, ret); - return ret; - } - - ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst hight fail!:%d", __func__, ret); - return ret; - } - OsalMSleep(20); - - ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_LOW); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst low fail!:%d", __func__, ret); - return ret; - } - OsalMSleep(50); - - ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst high fail!:%d", __func__, ret); - return ret; - } - OsalMSleep(20); - - return HDF_SUCCESS; -} - -/* Use I2cTransfer to encapsulate a register read/write auxiliary function. Use flag to indicate the read or write operation. */ -static int TpI2cReadWrite(struct TpI2cDevice *tpDevice, unsigned int regAddr, - unsigned char *regData, unsigned int dataLen, uint8_t flag) -{ - int index = 0; - unsigned char regBuf[4] = {0}; - struct I2cMsg msgs[2] = {0}; - - /* Perform length adaptation for the single- or dual-byte register. */ - if (tpDevice->regLen == 1) { - regBuf[index++] = regAddr & 0xFF; - } else { - regBuf[index++] = (regAddr >> 8) & 0xFF; - regBuf[index++] = regAddr & 0xFF; - } - - /* Fill in the I2cMsg message structure. */ - msgs[0].addr = tpDevice->addr; - msgs[0].flags = 0; /* The flag is 0, indicating the write operation. */ - msgs[0].len = tpDevice->regLen; - msgs[0].buf = regBuf; - - msgs[1].addr = tpDevice->addr; - msgs[1].flags = (flag == 1)? I2C_FLAG_READ: 0; /* Add the read flag. */ - msgs[1].len = dataLen; - msgs[1].buf = regData; - - if (I2cTransfer(tpDevice->i2cHandle, msgs, 2) != 2) { - HDF_LOGE("%s: i2c read err", __func__); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -/* TP register read function */ -static inline int TpI2cReadReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, - unsigned char *regData, unsigned int dataLen) -{ - return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 1); -} - -/* TP register write function */ -static inline int TpI2cWriteReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, - unsigned char *regData, unsigned int dataLen) -{ - return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 0); -} - -/* Main entry of I2C */ -static int32_t TestCaseI2c(void) -{ - int32_t i; - int32_t ret; - unsigned char bufWrite[7] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xA, 0xB, 0xC }; - unsigned char bufRead[7] = {0}; - static struct TpI2cDevice tpDevice; - - /* I/O pin function configuration */ - TpSocIoCfg(); - - /* Initialize TP device information. */ - tpDevice.rstGpio = 3; - tpDevice.busId = 3; - tpDevice.addr = 0x38; - tpDevice.regLen = 1; - tpDevice.i2cHandle = NULL; - - /* Initialize the GPIO pin. */ - ret = TestCaseGpioInit(&tpDevice); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: gpio init fail!:%d", __func__, ret); - return ret; - } - - /* Open an I2C controller. */ - tpDevice.i2cHandle = I2cOpen(tpDevice.busId); - if (tpDevice.i2cHandle == NULL) { - HDF_LOGE("%s: Open I2c:%u fail!", __func__, tpDevice.busId); - return -1; - } - - /* Continuously write 7-byte data to register 0xD5 of TP-IC. */ - ret = TpI2cWriteReg(&tpDevice, 0xD5, bufWrite, 7); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: tp i2c write reg fail!:%d", __func__, ret); - I2cClose(tpDevice.i2cHandle); - return -1; - } - OsalMSleep(10); - - /* Continuously read 7-byte data from register 0xDO of TP-IC. */ - ret = TpI2cReadReg(&tpDevice, 0xD5, bufRead, 7); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: tp i2c read reg fail!:%d", __func__, ret); - I2cClose(tpDevice.i2cHandle); - return -1; - } - - HDF_LOGE("%s: tp i2c write&read reg success!", __func__); - for (i = 0; i < 7; i++) { - HDF_LOGE("%s: bufRead[%d] = 0x%x", __func__, i, bufRead[i]); - } - - /* Close the I2C controller. */ - I2cClose(tpDevice.i2cHandle); - return ret; -} -``` - diff --git a/en/device-dev/driver/i2c.md b/en/device-dev/driver/i2c.md deleted file mode 100644 index 12167aeab9625b16e078335a504c96cf4cfe8422..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/i2c.md +++ /dev/null @@ -1,9 +0,0 @@ -# I2C - -- **[I2C Overview](i2c-overview.md)** - -- **[I2C Usage Guidelines](i2c-usage-guidelines.md)** - -- **[I2C Usage Example](i2c-usage-example.md)** - - diff --git a/en/device-dev/driver/lcd.md b/en/device-dev/driver/lcd.md deleted file mode 100644 index 9930511412c592f0dc36c9fe4b50ee9f206944a9..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/lcd.md +++ /dev/null @@ -1,9 +0,0 @@ -# LCD - -- **[LCD Overview](lcdoverview.md)** - -- **[LCD Development Guidelines](lcddevelopment-guidelines.md)** - -- **[LCD Development Example](lcddevelopment-example.md)** - - diff --git a/en/device-dev/driver/lcddevelopment-guidelines.md b/en/device-dev/driver/lcddevelopment-guidelines.md deleted file mode 100644 index a7d0f9cb7453fe32c2c9448eba76bd2cac09ec45..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/lcddevelopment-guidelines.md +++ /dev/null @@ -1,23 +0,0 @@ -# LCD Development Guidelines - -- [How to Develop](#section3904154911218) - -The display driver model is developed based on the HDF, platform APIs, and APIs at the OS abstraction layer \(OSAL\), and provides a unified driver model for the LCD regardless of the OS \(LiteOS or Linux OS\) and chip platforms \(such as Hi35xx, Hi38xx, and V3S\). - -## How to Develop - -1. Add the LCD driver-related hardware descriptions. -2. Add a driver that adapts to the chip at the SoC adapter layer. -3. Add the LCD panel driver and register the panel driver functions in the driver entry function **Init**. The functions provide capabilities for: - - Powering on/off the LCD device - - Based on the LCD hardware connection, use the GPIO interfaces provided by the platform to perform operations on the LCD pins, such as the reset pin and IOVCC pin. For details about the power-on sequence, see the SPEC provided by the LCD supplier. - - - Sending the initialization sequence - - Based on the LCD hardware interfaces, use the I2C, SPI, and MIPI interfaces provided by the platform to download the LCD initialization sequence. For details, see the SPEC provided by the LCD supplier. - - -4. Implement other HDF interfaces as required, for example, the **Release** interface. -5. Use the HDF to create other device nodes for implementing service logic or debugging as required. - diff --git a/en/device-dev/driver/lcdoverview.md b/en/device-dev/driver/lcdoverview.md deleted file mode 100644 index 08ba05e1f409a702a3b4334ce7124a4e80f5af57..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/lcdoverview.md +++ /dev/null @@ -1,46 +0,0 @@ -# LCD Overview - -- [Introduction](#section3781515122118) -- [API Description](#section20280192712120) - -## Introduction - -The Liquid Crystal Display \(LCD\) driver powers on the LCD and initializes internal LCD registers APIs to enable the LCD to work properly. The display driver is developed based on the hardware driver foundation \([HDF](hdfoverview.md)\). It provides power-on, power-off, and sending of the initialization sequence for LCD hardware across OSs and platforms. The display driver model is shown in [Figure 1](#fig69138814229). - -**Figure 1** Architecture of the display driver model -![](figures/architecture-of-the-display-driver-model.png "architecture-of-the-display-driver-model") - -- **Display driver model** - - The display driver model consists of the display common driver layer, SoC adapter layer, and third-party chip driver layer. It is developed based on the HDF and hides the differences between kernel forms through platform and OSAL APIs so the LCD driver can be migrated to different OSs and chip platforms. The display driver connects to the display common HAL, supports the implementation of Hardware Driver Interfaces \(HDIs\), and provides various driver interfaces for the graphics service through the display HDI. - - - Display common driver layer: connects to the display common HAL through the IOService data channel provided by the HDF to receive and process various upper-layer calls in a centralized manner. - - - SoC adapter layer: decouples the display driver from the SoC driver, configures parameters related to the chip platform, and passes the calls at the platform driver layer to the LCD driver layer. - - - Third-party chip driver layer: provides LCD-related APIs for sending the LCD initialization sequence, powering on or off the LCD device, and setting the backlight. - - Based on the display driver model, various capabilities, and APIs, you can greatly simplify the display driver development and improve the efficiency. - - -## API Description - -The LCD interfaces are classified into the Mobile Industry Processor Interface \(MIPI\) Display Serial Interface \(DSI\), Transistor Transistor Logic \(TTL\) interfaces, and Low Voltage Differential Signaling \(LVDS\) interfaces. The MIPI DSI and TTL interfaces are commonly used. Here is a brief introduction to them. - -- MIPI DSI - - **Figure 2** MIPI DSI - ![](figures/mipi-dsi.png "mipi-dsi") - - The MIPI DSI is defined by MIPI Alliance. It is mainly used for mobile terminal display. The MIPI DSI is used to transmit image data, in compliance with the MIPI protocol. Generally, control information of the MIPI DSI is sent to the peer IC in the form of MIPI packets through the MIPI DSI. No additional interface is required. - -- TTL interface - - **Figure 3** TTL interface - ![](figures/ttl-interface.png "ttl-interface") - - TTL level signals are generated by TTL devices, which are a major type of digital integrated circuits. They are manufactured using the bipolar process and feature high speed, low power consumption, and multiple types. - - The TTL interface is used to transmit data in parallel mode. It transmits data signals, clock signals, and control signals \(such as line synchronization signals, frame synchronization signals, and data validity signals\) under the control of control signals. Generally, the LCD of the TTL interface and the read/write of internal registers require additional peripheral interfaces, such as the Serial Peripheral Interface \(SPI\) and Inter-Integrated Circuit \(I2C\). - - diff --git a/en/device-dev/driver/mipi-dsi-overview.md b/en/device-dev/driver/mipi-dsi-overview.md deleted file mode 100644 index ec579fba093ecad64f31fd5d00b429878829a652..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/mipi-dsi-overview.md +++ /dev/null @@ -1,84 +0,0 @@ -# MIPI DSI Overview - -- [Introduction](#section1369320102013) -- [Available APIs](#section6577545192317) - -## Introduction - -- The Display Serial Interface \(DSI\) is a specification stipulated by the Mobile Industry Processor Interface \(MIPI\) Alliance, aiming to reduce the cost of display controllers in a mobile device. It defines a serial bus and communication protocol among the host, the source of image data, and the target device. In this way, the DSI can send pixel data or commands to peripherals \(usually LCDs or similar display devices\) in serial mode, or reads information such as status and pixel from the peripherals. - -- MIPI DSI is capable of working in both high speed \(HS\) mode and low power \(LP\) mode. All data lanes can only travel from the DSI host to a peripheral in HS mode, except the first data lane, which can also receive data such as status information and pixels from the peripheral in LP mode. The clock lane is dedicated to transmitting synchronization clock signals in HS mode. - - [Figure 1](#fig1122611461203) shows a simplified DSI interface. Conceptually, a DSI-compliant interface has the same features as interfaces complying with DBI-2 and DPI-2 standards. It sends pixels or commands to a peripheral and can read status or pixel information from the peripheral. The main difference is that the DSI serializes all pixel data, commands, and events that, in traditional interfaces, are conveyed to and from the peripheral on a parallel data bus with additional control signals. - - **Figure 1** DSI transmitting and receiving Interface - ![](figures/dsi-transmitting-and-receiving-interface.png "dsi-transmitting-and-receiving-interface") - - - -## Available APIs - -**Table 1** APIs for MIPI DSI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

Setting/Obtaining MIPI DSI configuration parameters

-

MipiDsiSetCfg

-

Sets configuration parameters for a MIPI DSI device.

-

MipiDsiGetCfg

-

Obtains the configuration parameters of a MIPI DSI device.

-

Obtaining /Releasing device handles

-

MipiDsiOpen

-

Obtains a MIPI DSI device handle.

-

MipiDsiClose

-

Releases a specified MIPI DSI device handle.

-

Setting the LP or HS mode

-

MipiDsiSetLpMode

-

Sets LP mode for a MIPI DSI device.

-

MipiDsiSetHsMode

-

Sets HS mode for a MIPI DSI device.

-

Reading/Sending commands

-

MipiDsiTx

-

Sends a display command set (DCS) command for sending data.

-

MipiDsiRx

-

Receives a DCS command for reading data with the specified length.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions described in this document can be called only in kernel space. - diff --git a/en/device-dev/driver/mipi-dsi.md b/en/device-dev/driver/mipi-dsi.md deleted file mode 100644 index f50672962f5c2602a93f63821ac290de3271ad02..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/mipi-dsi.md +++ /dev/null @@ -1,9 +0,0 @@ -# MIPI DSI - -- **[MIPI DSI Overview](mipi-dsi-overview.md)** - -- **[Usage Guidelines](usage-guidelines.md)** - -- **[Usage Example](usage-example.md)** - - diff --git a/en/device-dev/driver/peripherals.md b/en/device-dev/driver/peripherals.md deleted file mode 100644 index 42016f572c98cb63bfd17d6994f67367f3c8bc5d..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/peripherals.md +++ /dev/null @@ -1,11 +0,0 @@ -# Peripherals - -- **[LCD](lcd.md)** - -- **[TOUCHSCREEN](touchscreen.md)** - -- **[SENSOR](sensor.md)** - -- **[WLAN](wlan.md)** - - diff --git a/en/device-dev/driver/rtc-overview.md b/en/device-dev/driver/rtc-overview.md deleted file mode 100644 index 97aa8a24369a26fed6689751accb5ab46ce7fa89..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/rtc-overview.md +++ /dev/null @@ -1,103 +0,0 @@ -# RTC Overview - -- [Introduction](#section104842041574) -- [Available APIs](#section16892932155715) - -## Introduction - -The real-time clock \(RTC\) driver provides precise real time for the operating system \(OS\). If the OS is powered off, the RTC driver continues to keep track of the system time using an external battery. - -## Available APIs - -**Table 1** APIs provided by the RTC driver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

RTC handle

-

RtcOpen

-

Opens the RTC device to obtain its handle.

-

RtcClose

-

Releases a specified handle of the RTC device.

-

RTC time

-

RtcReadTime

-

Reads time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond.

-

RtcWriteTime

-

Writes time information from the RTC driver, including the year, month, the day of the week, day, hour, minute, second, and millisecond.

-

RTC alarm

-

RtcReadAlarm

-

Reads the RTC alarm time that was set last time.

-

RtcWriteAlarm

-

Writes the RTC alarm time based on the alarm index.

-

RtcRegisterAlarmCallback

-

Registers RtcAlarmCallback that will be invoked when an alarm is generated at the specified time.

-

RtcAlarmInterruptEnable

-

Enables or disables RTC alarm interrupts.

-

RTC configuration

-

RtcGetFreq

-

Reads the frequency of the external crystal oscillator connected to the RTC driver.

-

RtcSetFreq

-

Sets the frequency of the external crystal oscillator connected to the RTC driver.

-

RtcReset

-

Resets the RTC.

-

Custom register

-

RtcReadReg

-

Reads the configuration of a custom RTC register based on the register index.

-

RtcWriteReg

-

Writes the configuration of a custom RTC register based on the register index.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions provided in this document can be called only in kernel mode. - diff --git a/en/device-dev/driver/rtc-usage-example.md b/en/device-dev/driver/rtc-usage-example.md deleted file mode 100644 index e546c2f1433a2ce6810b93b43fd26f4c17f8e5a7..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/rtc-usage-example.md +++ /dev/null @@ -1,97 +0,0 @@ -# RTC Usage Example - -This section describes the process of using RTC APIs: - -1. During the OS startup, the HDF identifies the RTC component in the system. -2. The HDF initializes and creates the RTC device. -3. You can perform operations on the RTC device by calling different APIs. -4. Call the **RtcClose** function to release the device handle and device resources. - -Example: - -``` -#include "rtc_if.h" -int32_t RtcAlarmACallback(enum RtcAlarmIndex alarmIndex) -{ - if (alarmIndex == RTC_ALARM_INDEX_A) { - /* Process alarm A. */ - printf("RTC Alarm A callback function\n\r"); - } else if (alarmIndex == RTC_ALARM_INDEX_B) { - /* Process alarm B. */ - printf("RTC Alarm B callback function\n\r"); - } else { - /* Process the error. */ - } - return 0; -} - -void RtcTestSample(void) -{ - int32_t ret; - struct RtcTime tm; - struct RtcTime alarmTime; - uint32_t freq; - DevHandle handle = NULL; - - /* Obtain the RTC device handle. */ - handle = RtcOpen(); - if (handle == NULL) { - /* Process the error. */ - } - /* Register RtcAlarmCallback for alarm A. */ - ret = RtcRegisterAlarmCallback(handle, RTC_ALARM_INDEX_A, RtcAlarmACallback); - if (ret != 0) { - /* Process the error. */ - } - /* Set the RTC external crystal frequency. Note that the frequency must be configured in accordance with the requirements specified in the product manual of the in-use component. */ - freq = 32768; /* 32768 Hz */ - ret = RtcSetFreq(handle, freq); - if (ret != 0) { - /* Process the error. */ - } - /* Enable the RTC alarm interrupts. */ - ret = RtcAlarmInterruptEnable(handle, RTC_ALARM_INDEX_A, 1); - if (ret != 0) { - /* Process the error. */ - } - /* Set the RTC time to 2020/01/01 00:00:10 .990. */ - tm.year = 2020; - tm.month = 01; - tm.day = 01; - tm.hour= 0; - tm.minute = 0; - tm.second = 10; - tm.millisecond = 990; - /* Write the RTC time information. */ - ret = RtcWriteTime(handle, &tm); - if (ret != 0) { - /* Process the error. */ - } - /* Set the RTC alarm time to 2020/01/01 00:00:30 .100. */ - alarmTime.year = 2020; - alarmTime.month = 01; - alarmTime.day = 01; - alarmTime.hour = 0; - alarmTime.minute = 0; - alarmTime.second = 30; - alarmTime.millisecond = 100; - /* Set the alarm time information for RTC_ALARM_INDEX_A. When the specified time is reached, "RTC Alarm A callback function" is printed. */ - ret = RtcWriteAlarm(handle, RTC_ALARM_INDEX_A, &alarmTime); - if (ret != 0) { - /* Process the error. */ - } - - /* Read the RTC real time. */ - ret = RtcReadTime(handle, &tm); - if (ret != 0) { - /* Process the error. */ - } - sleep(5) - printf("RTC read time:\n\r"); - printf("year-month-date-weekday hour:minute:second .millisecond %04u-%02u-%02u-%u %02u:%02u:%02u .%03u", - tm.year, tm.month, tm.day, tm.weekday, tm.hour, tm.minute, tm.second, tm.millisecond); - /* Release the RTC device handle. */ - RtcClose(handle); -} -``` - diff --git a/en/device-dev/driver/rtc.md b/en/device-dev/driver/rtc.md deleted file mode 100644 index 50b89f7b7c1fb24aeac3e2922dce7da627864006..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/rtc.md +++ /dev/null @@ -1,9 +0,0 @@ -# RTC - -- **[RTC Overview](rtc-overview.md)** - -- **[RTC Usage Guidelines](rtc-usage-guidelines.md)** - -- **[RTC Usage Example](rtc-usage-example.md)** - - diff --git a/en/device-dev/driver/sdio.md b/en/device-dev/driver/sdio.md deleted file mode 100644 index 43fb762051920268c93821121065cd4ebec24ecb..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sdio.md +++ /dev/null @@ -1,9 +0,0 @@ -# SDIO - -- **[SDIO Overview](sdiooverview.md)** - -- **[SDIO Usage Guidelines](sdiousage-guidelines.md)** - -- **[SDIO Usage Example](sdiousage-example.md)** - - diff --git a/en/device-dev/driver/sdiooverview.md b/en/device-dev/driver/sdiooverview.md deleted file mode 100644 index 9890cf8f3c60999f90d41db98e8143600066308b..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sdiooverview.md +++ /dev/null @@ -1,149 +0,0 @@ -# SDIO Overview - -- [Introduction](#section1155271783811) -- [Available APIs](#section10204143763819) - -## Introduction - -- Secure Digital Input/Output \(SDIO\) is a peripheral interface evolved from the Secure Digital \(SD\) memory card interface. The SDIO interface is compatible with SD memory cards and can be connected to devices that support the SDIO interface. -- SDIO is widely used. Currently, many smartphones support SDIO, and many SDIO peripherals are developed for connections to smartphones. Common SDIO peripherals include WLAN, GPS, cameras, and Bluetooth. -- The SDIO bus has two ends, named host and device. All communication starts when the host sends a command. The device can communicate with the host as long as it can parse the command of the host. An SDIO host can connect to multiple devices, as shown in the figure below. - - - CLK signal: clock signal sent from the host to the device - - VDD signal: power signal - - VSS signal: ground signal - - D0-3 signal: four data lines. The DAT1 signal cable is multiplexed as the interrupt line. In 1-bit mode, DAT0 is used to transmit data. In 4-bit mode, DAT0 to DAT3 are used to transmit data. - - CMD signal: used by the host to send commands and the device to respond to commands. - - **Figure 1** Connections between the host and devices in SDIO - - - ![](figures/en-us_image_0000001054280608.png) - -- The SDIO interface defines a set of common methods for operating an SDIO device, including opening and closing an SDIO controller, exclusively claiming and releasing the host, enabling and disabling devices, claiming and releasing an SDIO IRQ, reading and writing data based on SDIO, and obtaining and setting common information. - -## Available APIs - -**Table 1** APIs available for the SDIO driver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

SDIO device opening/closing

-

SdioOpen

-

Opens an SDIO controller with a specified bus number.

-

SdioClose

-

Closes an SDIO controller.

-

SDIO reading/writing

-

SdioReadBytes

-

Incrementally reads a given length of data from a specified SDIO address.

-

SdioWriteBytes

-

Incrementally writes a given length of data into a specified SDIO address.

-

SdioReadBytesFromFixedAddr

-

Reads a given length of data from a fixed SDIO address.

-

SdioWriteBytesToFixedAddr

-

Writes a given length of data into a fixed SDIO address.

-

SdioReadBytesFromFunc0

-

Reads a given length of data from the address space of SDIO function 0.

-

SdioWriteBytesToFunc0

-

Writes a given length of data into the address space of SDIO function 0.

-

SDIO block size setting

-

SdioSetBlockSize

-

Sets the block size.

-

SDIO common information retrieval/setting

-

SdioGetCommonInfo

-

Obtains common information.

-

SdioSetCommonInfo

-

Sets common information.

-

SDIO data flushing

-

SdioFlushData

-

Flushes data.

-

SDIO host exclusively claiming or releasing

-

SdioClaimHost

-

Claims a host exclusively.

-

SdioReleaseHost

-

Releases the exclusively claimed host.

-

SDIO device enablement

-

SdioEnableFunc

-

Enables an SDIO device.

-

SdioDisableFunc

-

Disables an SDIO device.

-

SDIO IRQ claiming/releasing

-

SdioClaimIrq

-

Claims an SDIO IRQ.

-

SdioReleaseIrq

-

Releases an SDIO IRQ.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions provided in this document can be called only in kernel mode. - diff --git a/en/device-dev/driver/sdiousage-example.md b/en/device-dev/driver/sdiousage-example.md deleted file mode 100644 index 558f4cf191206f4a01f28850d14d667208b592fc..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sdiousage-example.md +++ /dev/null @@ -1,129 +0,0 @@ -# SDIO Usage Example - -The following example shows how to use an SDIO device. First, open an SDIO controller whose bus number is 1, exclusively claim a host, enable the SDIO device, claim an SDIO IRQ, and then perform SDIO communication \(such as reading and writing\). After the SDIO communication, release the SDIO IRQ, disable the SDIO device, release the host, and close the SDIO controller. - -``` -#include "hdf_log.h" -#include "sdio_if.h" - -#define TEST_FUNC_NUM 1 /* The I/O function whose ID is 1 is used. */ -#define TEST_FBR_BASE_ADDR 0x100 /* FBR base address of the I/O function whose ID is 1 */ -#define TEST_ADDR_OFFSET 9 /* Address offset of the register to read or write */ -#define TEST_DATA_LEN 3 /* Length of the data to read or write */ -#define TEST_BLOCKSIZE 2 /* Size of a data block, in bytes */ - -/* Implement the SDIO IRQ function based on the application. */ -static void SdioIrqFunc(void *data) -{ - if (data == NULL) { - HDF_LOGE("SdioIrqFunc: data is NULL.\n"); - return; - } - /* You need to add specific implementations. */ -} - -void SdioTestSample(void) -{ - int32_t ret; - DevHandle handle = NULL; - uint8_t data[TEST_DATA_LEN] = {0}; - struct SdioFunctionConfig config = {1, 0x123, 0x456}; - uint8_t val; - uint32_t addr; - - /* Open an SDIO controller whose bus number is 1. */ - handle = SdioOpen(1, &config); - if (handle == NULL) { - HDF_LOGE("SdioOpen: failed!\n"); - return; - } - /* Claim a host exclusively. */ - SdioClaimHost(handle); - /* Enable the SDIO device. */ - ret = SdioEnableFunc(handle); - if (ret != 0) { - HDF_LOGE("SdioEnableFunc: failed, ret %d\n", ret); - goto ENABLE_ERR; - } - /* Claim an SDIO IRQ. */ - ret = SdioClaimIrq(handle, SdioIrqFunc); - if (ret != 0) { - HDF_LOGE("SdioClaimIrq: failed, ret %d\n", ret); - goto CLAIM_IRQ_ERR; - } - /* Set the block size to 2 bytes. */ - ret = SdioSetBlockSize(handle, TEST_BLOCKSIZE); - if (ret != 0) { - HDF_LOGE("SdioSetBlockSize: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Read 3-byte data from the incremental address of an SDIO device. */ - addr = TEST_FBR_BASE_ADDR * TEST_FUNC_NUM + TEST_ADDR_OFFSET; - ret = SdioReadBytes(handle, data, addr, TEST_DATA_LEN); - if (ret != 0) { - HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Write 3-byte data into the incremental address of an SDIO device. */ - ret = SdioWriteBytes(handle, data, addr, TEST_DATA_LEN); - if (ret != 0) { - HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Read 1-byte data from the SDIO device. */ - ret = SdioReadBytes(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Write 1-byte data into the SDIO device. */ - ret = SdioWriteBytes(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Read 3-byte data from the fixed address of an SDIO device. */ - ret = SdioReadBytesFromFixedAddr(handle, data, addr, TEST_DATA_LEN, 0); - if (ret != 0) { - HDF_LOGE("SdioReadBytesFromFixedAddr: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Write 1-byte data to the fixed address of an SDIO device. */ - ret = SdioWriteBytesToFixedAddr(handle, data, addr, 1, 0); - if (ret != 0) { - HDF_LOGE("SdioWriteBytesToFixedAddr: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Read 1-byte data from SDIO function 0. */ - addr = 0x02; - ret = SdioReadBytesFromFunc0(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioReadBytesFromFunc0: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* Write 1-byte data into SDIO function 0. */ - ret = SdioWriteBytesToFunc0(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioWriteBytesToFunc0: failed, ret %d\n", ret); - goto COMM_ERR; - } -COMM_ERR: - /* Release the SDIO IRQ. */ - ret = SdioReleaseIrq(handle); - if (ret != 0) { - HDF_LOGE("SdioReleaseIrq: failed, ret %d\n", ret); - } -CLAIM_IRQ_ERR: - /* Disable the SDIO device. */ - ret = SdioDisableFunc(handle); - if (ret != 0) { - HDF_LOGE("SdioDisableFunc: failed, ret %d\n", ret); - } -ENABLE_ERR: - /* Release the exclusively claimed host. */ - SdioReleaseHost(handle); - /* Close an SDIO controller. */ - SdioClose(handle); -} -``` - diff --git a/en/device-dev/driver/sensor-driver-development-example.md b/en/device-dev/driver/sensor-driver-development-example.md deleted file mode 100644 index acab2c70f8f15eb2f313206a50e289af4ab759db..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sensor-driver-development-example.md +++ /dev/null @@ -1,583 +0,0 @@ -# Sensor Driver Development Example - -This section provides a code example of how to load and start the acceleration sensor driver based on the HDF driver model. For details about the mechanism, see [HDF Driver Development](driver-development.md). This example uses the Bosch BMI160 acceleration sensor that communicates over I2C. - -1. Register the driver entry of the acceleration sensor. - -- Implementation of the entry function - -``` -/* Register the entry structure object of the acceleration sensor. */ -struct HdfDriverEntry g_sensorAccelDevEntry = { - .moduleVersion = 1, /* Version number of the acceleration sensor module */ - .moduleName = "HDF_SENSOR_ACCEL", /* Name of the acceleration sensor module. The value must be the same as that of moduleName in the device_info.hcs file. */ - .Bind = BindAccelDriver, /* Binding function of the acceleration sensor */ - .Init = InitAccelDriver, /* Initialization function of the acceleration sensor */ - .Release = ReleaseAccelDriver, /* Resource release function of the acceleration sensor */ -}; - -/* Call HDF_INIT to register the driver entry with the HDF. When loading the driver, the HDF calls the Bind function first and then the Init function. If the Init function fails to be called, the HDF will call Release to release the driver resource and exit. -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](driver-configuration-management.md). - -``` -/* HCS configuration of the acceleration sensor device */ -device_sensor_accel :: device { - device0 :: deviceNode { - policy = 1; /* Policy for providing the driver service */ - priority = 105; /* Driver startup priority (0–200). A larger value indicates a lower priority. The default value 100 is recommended. The sequence for loading devices with the same priority is random. */ - preload = 2; /* Field for specifying whether to load the driver. Value 0 means to load the driver, and 2 means the opposite. */ - permission = 0664; /* Permission for the driver to create device nodes */ - moduleName = "HDF_SENSOR_ACCEL"; /* Driver name. The value must be the same as that of moduleName in the driver entry structure. */ - serviceName = "sensor_accel"; /* Name of the service provided by the driver. The name must be unique. */ - deviceMatchAttr = "hdf_sensor_accel_driver"; /* Keyword matching the private data of the driver. The value must be the same as that of match_attr in the private data configuration table of the driver. */ - } -} -``` - -1. Initialize and deinitialize the acceleration sensor driver. - -- Initialization entry function **init** - -``` -/* Bind the service provided by the acceleration sensor driver to the HDF. */ -int32_t BindAccelDriver(struct HdfDeviceObject *device) -{ - CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); - - static struct IDeviceIoService service = { - .object = {0}, - .Dispatch = DispatchAccel, - }; - device->service = &service; - - return HDF_SUCCESS; -} -/* After detecting that the device is in position, call RegisterAccelChipOps to register the differentiation adaptation function. */ -int32_t RegisterAccelChipOps(struct AccelOpsCall *ops) -{ - struct AccelDrvData *drvData = NULL; - - CHECK_NULL_PTR_RETURN_VALUE(ops, HDF_ERR_INVALID_PARAM); - - drvData = AccelGetDrvData(); - drvData->ops.Init = ops->Init; - drvData->ops.ReadData = ops->ReadData; - return HDF_SUCCESS; -} -/* Hook the acceleration sensor driver normalization function. */ -static int32_t InitAccelOps(struct SensorDeviceInfo *deviceInfo) -{ - struct AccelDrvData *drvData = AccelGetDrvData(); - - (void)memset_s((void *)deviceInfo, sizeof(*deviceInfo), 0, sizeof(*deviceInfo)); - deviceInfo->ops.GetInfo = SetAccelInfo; - deviceInfo->ops.Enable = SetAccelEnable; - deviceInfo->ops.Disable = SetAccelDisable; - deviceInfo->ops.SetBatch = SetAccelBatch; - deviceInfo->ops.SetMode = SetAccelMode; - deviceInfo->ops.SetOption = SetAccelOption; - - if (memcpy_s(&deviceInfo->sensorInfo, sizeof(deviceInfo->sensorInfo), - &drvData->accelCfg->sensorInfo, sizeof(drvData->accelCfg->sensorInfo)) != EOK) { - HDF_LOGE("%s: copy sensor info failed", __func__); - return HDF_FAILURE; - } - /* The sensor type ID can be configured in the HCS configuration file or here. */ - drvData->accelCfg->sensorInfo.sensorTypeId = SENSOR_TAG_ACCELEROMETER; - drvData->accelCfg->sensorInfo.sensorId = SENSOR_TAG_ACCELEROMETER; - - return HDF_SUCCESS; -} -/* Initialize the sensor register. */ -static int32_t InitAccelAfterConfig(void) -{ - struct SensorDeviceInfo deviceInfo; - - if (InitAccelConfig() != HDF_SUCCESS) { - HDF_LOGE("%s: init accel config failed", __func__); - return HDF_FAILURE; - } - - if (InitAccelOps(&deviceInfo) != HDF_SUCCESS) { - HDF_LOGE("%s: init accel ops failed", __func__); - return HDF_FAILURE; - } - - if (AddSensorDevice(&deviceInfo) != HDF_SUCCESS) { - HDF_LOGE("%s: add accel device failed", __func__); - return HDF_FAILURE; - } - - return HDF_SUCCESS; -} -/* Call the device detection function to hook the differentiated device function. */ -static int32_t DetectAccelChip(void) -{ - int32_t num; - int32_t ret; - int32_t loop; - struct AccelDrvData *drvData = AccelGetDrvData(); - CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); - - num = sizeof(g_accelDetectIfList) / sizeof(g_accelDetectIfList[0]); - for (loop = 0; loop < num; ++loop) { - if (g_accelDetectIfList[loop].DetectChip != NULL) { - ret = g_accelDetectIfList[loop].DetectChip(drvData->accelCfg); - if (ret == HDF_SUCCESS) { - drvData->detectFlag = true; - break; - } - } - } - - if (loop == num) { - HDF_LOGE("%s: detect accel device failed", __func__); - drvData->detectFlag = false; - return HDF_FAILURE; - } - return HDF_SUCCESS; -} -/* The entry function of the acceleration sensor driver is used to initialize the structure object of the sensor private data, allocate space for the HCS data configuration object of the sensor, invoke the entry function for initializing the sensor HCS data configuration, detect whether the sensor device is in position, create the sensor data reporting timer, implement the sensor normalization API, and register the sensor device. */ -int32_t InitAccelDriver(struct HdfDeviceObject *device) -{ - /* Obtain the private data structure object of the sensor. */ - struct AccelDrvData *drvData = AccelGetDrvData(); - - /* When detecting sensors of the same type from different vendors, the function checks whether this type of sensors is in position. If yes, it no longer detects the other sensors of this type and directly returns the result. */ - if (drvData->detectFlag) { - HDF_LOGE("%s: accel sensor have detected", __func__); - return HDF_SUCCESS; - } - - CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); - /* Allocate space for the private data structure objects for storing sensor data configurations. The allocated space needs to be released when the driver is released. */ - drvData->accelCfg = (struct SensorCfgData *)OsalMemCalloc(sizeof(*cfg)); - if (drvData->accelCfg == NULL) { - HDF_LOGE("%s: malloc sensor config data failed", __func__); - return HDF_FAILURE; - } - - drvData->accelCfg->regCfgGroup = &g_regCfgGroup[0]; - /* Initializing the sensor configuration data aims to parse the configuration information of the sensor communication bus, basic sensor information, sensor attributes, whether the sensor is in position, and register group information. */ - if (GetSensorBaseConfigData(device->property, drvData->accelCfg) != HDF_SUCCESS) { - HDF_LOGE("%s: get sensor base config failed", __func__); - goto Base_CONFIG_EXIT; - } - - if (DetectAccelChip() != HDF_SUCCESS) { - HDF_LOGE("%s: accel sensor detect device no exist", __func__); - goto DETECT_CHIP_EXIT; - } - drvData->detectFlag = true; - if (ParseSensorRegConfig(drvData->accelCfg) != HDF_SUCCESS) { - HDF_LOGE("%s: detect sensor device failed", __func__); - goto REG_CONFIG_EXIT; - } - - if (InitAccelAfterConfig() != HDF_SUCCESS) { - HDF_LOGE("%s: init accel after config failed", __func__); - goto INIT_EXIT; - } - - HDF_LOGI("%s: init accel driver success", __func__); - return HDF_SUCCESS; - -INIT_EXIT: - DestroySensorThread(&drvData->thread, &drvData->threadStatus); - (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); -REG_CONFIG_EXIT: - ReleaseSensorAllRegConfig(drvData->accelCfg); - (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); -DETECT_CHIP_EXIT: - drvData->detectFlag = false; -BASE_CONFIG_EXIT: - drvData->accelCfg->root = NULL; - drvData->accelCfg->regCfgGroup = NULL; - OsalMemFree(drvData->accelCfg); - drvData->accelCfg = NULL; - return HDF_FAILURE; -} - -/* Release the resources allocated during driver initialization. */ -void ReleaseAccelDriver(struct HdfDeviceObject *device) -{ - (void)device; - struct AccelDrvData *drvData = NULL; - - drvData = AccelGetDrvData(); - (void)DestroySensorThread(&drvData->thread, &drvData->threadStatus); - (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); - drvData->detectFlag = false; - - if (drvData->accelCfg != NULL) { - drvData->accelCfg->root = NULL; - drvData->accelCfg->regCfgGroup = NULL; - ReleaseSensorAllRegConfig(drvData->accelCfg); - (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); - OsalMemFree(drvData->accelCfg); - drvData->accelCfg = NULL; - } - - drvData->initStatus = false; -} -``` - -1. Configure the acceleration sensor register group. - -You only need to configure the acceleration sensor data according to the template. Template configuration parsing has been implemented via the **InitSensorConfigData** function and only needs to be called during initialization. If new configuration items are added, you need to modify this function accordingly. - -``` -Acceleration sensor data configuration template (accel_config.hcs) -root { - sensorAccelConfig { - accelChipConfig { - /* Sensor information template */ - template sensorInfo { - sensorName = "accelerometer"; /* Acceleration sensor name. The value contains a maximum of 16 bytes. */ - vendorName = "borsh_bmi160"; /* Sensor vendor name. The value contains a maximum of 16 bytes. */ - firmwareVersion = "1.0"; /* Sensor firmware version number. The default value is 1.0. The value contains a maximum of 16 bytes. */ - hardwareVersion = "1.0"; /* Sensor hardware version number. The default value is 1.0. The value contains a maximum of 16 bytes. */ - sensorTypeId = 1; /* Sensor type ID. For details, see SensorTypeTag. */ - sensorId = 1; /* Sensor ID, which is defined by the sensor driver developer. The SensorTypeTag enums are recommended. */ - maxRange = 8; /* Maximum measurement range of the sensor. Set this parameter based on your business requirements. */ - precision = 0; /* Sensor accuracy, which is used together with sensor data reporting. For details, see SensorEvents. */ - power = 230; /* Power consumption of the sensor */ - } - /* Template of the bus type and configuration information used by the sensor */ - template sensorBusConfig { - busType = 0; /* 0 for the I2C bus and 1 for the SPI bus */ - busNum = 6; /* Device ID allocated to the sensor on the chip */ - busAddr = 0; /* Address allocated to the sensor on the chip */ - regWidth = 1; /* Width of the sensor register address */ - regBigEndian = 0; /* Endian mode of the sensor register */ - } - /* Sensor attribute template */ - template sensorAttr { - chipName = ""; /* Sensor chip name */ - chipIdRegister = 0xf; /* Address of the register detecting whether the sensor is in position */ - chipIdValue = 0xd1; /* Value of the register detecting whether the sensor is in position */ - } - } - } -} - -/* You can modify the template configuration based on the differences of sensor devices. If no modification is made, the default template configuration is used. */ -root { - sensorAccelConfig { - accel_bmi160_chip_config : accelChipConfig { - match_attr = "hdf_sensor_accel_driver"; /* The value must be the same as the match_attr field configured for the acceleration sensor. */ - accelInfo :: sensorInfo { - vendorName = "borsh_bmi160"; - sensorTypeId = 1; - sensorId = 1; - } - accelBusConfig :: sensorBusConfig { - busType = 0; /* I2C communication mode */ - busNum = 6; - busAddr = 0x68; - regWidth = 1; /* 1-byte bit width */ - } - accelAttr :: sensorAttr { - chipName = "bmi160"; - chipIdRegister = 0x00; - chipIdValue = 0xd1; - } - accelRegConfig { - /* regAddr: Register address - value: Register value - mask: Mask of the register value - len: Length (in bytes) of the register value - delay: Register delay (in milliseconds) - opsType: Operation type. The options can be 0 (no operation), 1 (read), 2 (write), 3 (read and check), and 4 (bit update). - calType: Calculation type. The options can be 0 (none), 1 (write), 2 (negate), 3 (XOR) 4, (left shift), and 5 (right shift). - shiftNum: Number of shifts - debug: Debugging switch. The value can be 0 (disabled) or 1 (enabled). - save: Data saving switch. The value can be 0 (not save data) or 1 (save data). - */ - /* Groups of sensor register operations. Registers can be configured in sequence based on the groups. */ - /* Register address, register value, mask of the register value, data length of the register value, register delay, operation type, calculation type, number of shifts, debugging switch, data saving switch */ - /* Initialize the register groups. */ - initSeqConfig = [ - 0x7e, 0xb6, 0xff, 1, 5, 2, 0, 0, 0, 0, - 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 - ]; - /* Enable the register groups. */ - enableSeqConfig = [ - 0x7e, 0x11, 0xff, 1, 5, 2, 0, 0, 0, 0, - 0x41, 0x03, 0xff, 1, 0, 2, 0, 0, 0, 0, - 0x40, 0x08, 0xff, 1, 0, 2, 0, 0, 0, 0 - ]; - /* Disable the register groups. */ - disableSeqConfig = [ - 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 - ]; - } - } - } -} -``` - -1. Implement APIs for acceleration sensor driver operations. - -You need to implement normalized APIs based on sensor types. - -``` -/* Leave a function empty if it is not used. */ -static int32_t SetAccelInfo(struct SensorBasicInfo *info) -{ - (void)info; - - return HDF_ERR_NOT_SUPPORT; -} -/* Deliver the configuration of enabling the register groups. */ -static int32_t SetAccelEnable(void) -{ - int32_t ret; - struct AccelDrvData *drvData = AccelGetDrvData(); - - CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); - ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_ENABLE_GROUP]); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel sensor disable config failed", __func__); - return HDF_FAILURE; - } - - drvData->threadStatus = SENSOR_THREAD_RUNNING; - - return HDF_SUCCESS; -} -/* Deliver the configuration of disabling the register groups. */ -static int32_t SetAccelDisable(void) -{ - int32_t ret; - struct AccelDrvData *drvData = AccelGetDrvData(); - - CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); - - ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_DISABLE_GROUP]); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel sensor disable config failed", __func__); - return HDF_FAILURE; - } - - drvData->threadStatus = SENSOR_THREAD_STOPPED; - - return HDF_SUCCESS; -} -/* Set the sampling interval and data reporting interval of the sensor. */ -static int32_t SetAccelBatch(int64_t samplingInterval, int64_t interval) -{ - (void)interval; - - struct AccelDrvData *drvData = AccelGetDrvData(); - drvData->interval = samplingInterval; - - return HDF_SUCCESS; -} -/* Set the data reporting mode of the sensor. Currently, the real-time mode is supported. */ -static int32_t SetAccelMode(int32_t mode) -{ - return (mode == SENSOR_WORK_MODE_REALTIME) ? HDF_SUCCESS : HDF_FAILURE; -} -/* Set the sensor options. */ -static int32_t SetAccelOption(uint32_t option) -{ - (void)option; - return HDF_ERR_NOT_SUPPORT; -} -``` - -- Differentiated processing APIs - - ``` - /* If a device is successfully detected, register the differentiated processing function to the accel driver model. */ - int32_t DetectAccelBim160Chip(struct SensorCfgData *data) - { - int32_t ret; - struct AccelOpsCall ops; - CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); - - if (strcmp(ACCEL_CHIP_NAME_BMI160, data->sensorAttr.chipName) != 0) { - return HDF_SUCCESS; - } - ret = InitAccelPreConfig(); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: init BMI160 bus mux config", __func__); - return HDF_FAILURE; - } - if (DetectSensorDevice(data) != HDF_SUCCESS) { - return HDF_FAILURE; - } - - /* Differentiated processing function */ - ops.Init = InitBmi160; - ops.ReadData = ReadBmi160Data; - ret = RegisterAccelChipOps(&ops); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: register BMI160 accel failed", __func__); - (void)ReleaseSensorBusHandle(&data->busCfg); - return HDF_FAILURE; - } - return HDF_SUCCESS; - } - /* Initialization processing function */ - static int32_t InitBmi160(struct SensorCfgData *data) - { - int32_t ret; - - CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); - ret = SetSensorRegCfgArray(&data->busCfg, data->regCfgGroup[SENSOR_INIT_GROUP]); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: bmi160 sensor init config failed", __func__); - return HDF_FAILURE; - } - return HDF_SUCCESS; - } - /* Data processing function */ - int32_t ReadBmi160Data(struct SensorCfgData *data) - { - int32_t ret; - struct AccelData rawData = { 0, 0, 0 }; - int32_t tmp[ACCEL_AXIS_NUM]; - struct SensorReportEvent event; - - (void)memset_s(&event, sizeof(event), 0, sizeof(event)); - - ret = ReadBmi160RawData(data, &rawData, &event.timestamp); - if (ret != HDF_SUCCESS) { - return HDF_FAILURE; - } - - event.sensorId = SENSOR_TAG_ACCELEROMETER; - event.option = 0; - event.mode = SENSOR_WORK_MODE_REALTIME; - - rawData.x = rawData.x * BMI160_ACC_SENSITIVITY_2G; - rawData.y = rawData.y * BMI160_ACC_SENSITIVITY_2G; - rawData.z = rawData.z * BMI160_ACC_SENSITIVITY_2G; - - tmp[ACCEL_X_AXIS] = (rawData.x * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; - tmp[ACCEL_Y_AXIS] = (rawData.y * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; - tmp[ACCEL_Z_AXIS] = (rawData.z * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; - - event.dataLen = sizeof(tmp); - event.data = (uint8_t *)&tmp; - ret = ReportSensorEvent(&event); - return ret; - } - ``` - -- Data processing function - -Create a sensor timer to periodically sample data based on the configured sampling interval and report the data to the data subscriber. - -``` -/* Scheduled working thread of the sensor */ -static int32_t ReadAccelDataThreadWorker(void *arg) -{ - (void)arg; - int64_t interval; - struct AccelDrvData *drvData = AccelGetDrvData(); - - drvData->threadStatus = SENSOR_THREAD_START; - while (true) { - if (drvData->threadStatus == SENSOR_THREAD_RUNNING) { - if (drvData->ops.ReadData != NULL) { - (void)drvData->ops.ReadData(drvData->accelCfg); - } - interval = OsalDivS64(drvData->interval, (SENSOR_CONVERT_UNIT * SENSOR_CONVERT_UNIT)); - OsalMSleep(interval); - } else if (drvData->threadStatus == SENSOR_THREAD_DESTROY) { - break; - } else { - OsalMSleep(ACC_DEFAULT_SAMPLING_200_MS / SENSOR_CONVERT_UNIT / SENSOR_CONVERT_UNIT); - } - - if ((!drvData->initStatus) || (drvData->interval < 0) || drvData->threadStatus != SENSOR_THREAD_RUNNING) { - continue; - } - } - - return HDF_SUCCESS; -} -/* Create a sensor timer and initialize the sensor device. */ -static int32_t InitAccelConfig(void) -{ - int32_t ret; - struct AccelDrvData *drvData = AccelGetDrvData(); - - if (drvData->threadStatus != SENSOR_THREAD_NONE && drvData->threadStatus != SENSOR_THREAD_DESTROY) { - HDF_LOGE("%s: accel thread have created", __func__); - return HDF_SUCCESS; - } - - ret = CreateSensorThread(&drvData->thread, ReadAccelDataThreadWorker, "hdf_sensor_accel", drvData); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel create thread failed", __func__); - drvData->threadStatus = SENSOR_THREAD_NONE; - return HDF_FAILURE; - } - - CHECK_NULL_PTR_RETURN_VALUE(drvData->ops.Init, HDF_ERR_INVALID_PARAM); - - ret = drvData->ops.Init(drvData->accelCfg); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel create thread failed", __func__); - drvData->threadStatus = SENSOR_THREAD_NONE; - return HDF_FAILURE; - } - drvData->initStatus = true; - return HDF_SUCCESS; -} -``` - -- Major data structures - -``` -/* Sensor conversion units */ -#define SENSOR_CONVERT_UNIT 1000 -#define SENSOR_1K_UNIT 1024 -/* Sensitivity conversion value of the sensor with a 2g measurement range */ -#define BMI160_ACC_SENSITIVITY_2G 61 -/* Address of the sensor data sampling register */ -#define BMI160_ACCEL_X_LSB_ADDR 0X12 -#define BMI160_ACCEL_X_MSB_ADDR 0X13 -#define BMI160_ACCEL_Y_LSB_ADDR 0X14 -#define BMI160_ACCEL_Y_MSB_ADDR 0X15 -#define BMI160_ACCEL_Z_LSB_ADDR 0X16 -#define BMI160_ACCEL_Z_MSB_ADDR 0X17 -/* Data dimension of the sensor */ -enum AccelAxisNum { - ACCEL_X_AXIS = 0, - ACCEL_Y_AXIS = 1, - ACCEL_Z_AXIS = 2, - ACCEL_AXIS_NUM = 3, -}; -/* Each dimension of the sensor */ -struct AccelData { - int32_t x; - int32_t y; - int32_t z; -}; -/* Private data structure of the sensor */ -struct AccelDrvData { - bool detectFlag; - uint8_t threadStatus; - uint8_t initStatus; - int64_t interval; - struct SensorCfgData *accelCfg; - struct OsalThread thread; - struct AccelOpsCall ops; -}; -/* Differentiation adaptation function */ -struct AccelOpsCall { - int32_t (*Init)(struct SensorCfgData *data); - int32_t (*ReadData)(struct SensorCfgData *data); -}; -``` - diff --git a/en/device-dev/driver/sensor-driver-development-guidelines.md b/en/device-dev/driver/sensor-driver-development-guidelines.md deleted file mode 100644 index afbb833cac70c19f9612461c6d2f9983f58ef544..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sensor-driver-development-guidelines.md +++ /dev/null @@ -1,16 +0,0 @@ -# Sensor Driver Development Guidelines - -- [How to Develop](#section18816105182315) - -Regardless of the OS and system on a chip \(SoC\), the sensor driver is developed based on the HDF, platform, and OSAL APIs to provide a unified driver model for sensor devices. This section uses the acceleration sensor as an example to describe how to develop a sensor driver. - -## How to Develop - -1. Register the acceleration sensor driver. The HDF provides a unified driver management model. The HDF identifies and loads the target module driver based on the configuration information of the acceleration sensor module. -2. Initialize and deinitialize the acceleration sensor driver. Using the **init** function, the HDF starts loading the sensor device driver and allocating configuration resources for sensor device data, respectively. Using the **release** function, the HDF releases the resources and configurations loaded by the driver. -3. Parse the configurations of the acceleration sensor register group. For different types of sensors, you need to configure their respective HCS configuration files in the HCS, check whether the sensor device is in position during the device driver startup, and then load the corresponding configuration file to generate the configuration structure object. -4. Implement APIs for acceleration sensor driver operations. The driver APIs for various types of sensors, such as **init**, **GetInfo**, **Enable**, **Disable**, **SetBatch**, **SetMode**, **SetOption**, and **ReadSensorData**, are normalized to deliver sensor driver configurations and report sensor data. - ->![](public_sys-resources/icon-note.gif) **NOTE:** ->The sensor driver model provides a collection of APIs to implement sensor driver capabilities, including the driver device management capabilities, abstract bus and platform operation capabilities, general configuration capabilities, and configuration parsing capabilities. For details about the APIs, see [Table 2](sensor-driver-overview.md#table1156812588320). You need to implement the following APIs: some operations to perform on sensors \([Table 3](sensor-driver-overview.md#table1083014911336)\), differentiated data configuration of the sensor HCS, and verification of basic driver functions. - diff --git a/en/device-dev/driver/sensor-driver-test-guidelines.md b/en/device-dev/driver/sensor-driver-test-guidelines.md deleted file mode 100644 index 042112036cdad78e9aa732e54c8423f8c3ed115e..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sensor-driver-test-guidelines.md +++ /dev/null @@ -1,82 +0,0 @@ -# Sensor Driver Test Guidelines - -After the driver is developed, you can develop self-test cases in the sensor unit test to verify the basic functions of the driver. The developer self-test platform is used as the test environment. - -``` -/* Specify whether to report sensor data. */ -static int32_t g_sensorDataFlag = 0; -/* Retain the address of the sensor interface instance. */ -static const struct SensorInterface *g_sensorDev = nullptr; - -/* Register the data reporting function. */ -static int SensorTestDataCallback(struct SensorEvents *event) -{ - if (event == nullptr) { - return -1; - } - float *data = (float*)event->data; - printf("time [%lld] sensor id [%d] x-[%f] y-[%f] z-[%f]\n\r", event->timestamp, - event->sensorId, (*data), *(data + 1), *(data + g_axisZ)); - if (*data > 1e-5) { - g_sensorDataFlag = 1; - } - return 0; -} -/* Initialize the sensor interface instance before executing the test cases. */ -void HdfSensorTest::SetUpTestCase() -{ - g_sensorDev = NewSensorInterfaceInstance(); - if (g_sensorDev == nullptr) { - printf("test sensorHdi get Module instace failed\n\r"); - } -} -/* Release case resources. */ -void HdfSensorTest::TearDownTestCase() -{ - if (g_sensorDev != nullptr) { - FreeSensorInterfaceInstance(); - g_sensorDev = nullptr; - } -} -/* Verify the sensor driver. */ -HWTEST_F(HdfSensorTest,TestAccelDriver_001, TestSize.Level0) -{ - int32_t sensorInterval = 1000000000; /* Data sampling interval, in nanoseconds */ - int32_t pollTime = 5; /* Data sampling duration, in seconds */ - int32_t accelSensorId = 1; /* Acceleration sensor type ID, which is 1 */ - int32_t count = 0; - int ret; - struct SensorInformation *sensorInfo = nullptr; - - ret = g_sensorDev->Register(SensorTestDataCallback) - EXPECT_EQ(SENSOR_NULL_PTR, ret); - - ret = g_sensorDev->GetAllSensors(&sensorInfo, &count); - EXPECT_EQ(0, ret); - if (sensorInfo == nullptr) { - EXPECT_NE(nullptr, sensorInfo); - return; - } - /* Print the obtained sensor list. */ - for (int i = 0; i < count; i++) { - printf("get sensoriId[%d], info name[%s]\n\r", sensorInfo[i]->sensorId, sensorInfo[i]->sensorName); - } - ret = g_sensorDev->Enable(accelSensorId); - EXPECT_EQ(0, ret); - g_sensorDataFlag = 0; - - ret = g_sensorDev->SetBatch(accelSensorId, sensorInterval, pollTime); - EXPECT_EQ(0, ret); - /* Observe the printed data within the period specified by pollTime. */ - OsalSleep(pollTime); - EXPECT_EQ(1, g_sensorDataFlag); - - ret = g_sensorDev->Disable(accelSensorId); - g_sensorDataFlag = 0; - EXPECT_EQ(0, ret); - - ret = g_sensorDev->Unregister(); - EXPECT_EQ(0, ret); -} -``` - diff --git a/en/device-dev/driver/sensor.md b/en/device-dev/driver/sensor.md deleted file mode 100644 index f9e8d552c0cbad2c430e9457122a25b1d62ee4df..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/sensor.md +++ /dev/null @@ -1,11 +0,0 @@ -# SENSOR - -- **[Sensor Driver Overview](sensor-driver-overview.md)** - -- **[Sensor Driver Development Guidelines](sensor-driver-development-guidelines.md)** - -- **[Sensor Driver Development Example](sensor-driver-development-example.md)** - -- **[Sensor Driver Test Guidelines](sensor-driver-test-guidelines.md)** - - diff --git a/en/device-dev/driver/spi.md b/en/device-dev/driver/spi.md deleted file mode 100644 index c635810c74cbb62be99562f6848983e4b7437058..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/spi.md +++ /dev/null @@ -1,9 +0,0 @@ -# SPI - -- **[SPI Overview](spioverview.md)** - -- **[SPI Usage Guidelines](spiusage-guidelines.md)** - -- **[SPI Usage Example](spiusage-example.md)** - - diff --git a/en/device-dev/driver/spioverview.md b/en/device-dev/driver/spioverview.md deleted file mode 100644 index 46303b336baaec8295a11afacc466aed62809c29..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/spioverview.md +++ /dev/null @@ -1,107 +0,0 @@ -# SPI Overview - -- [Introduction](#section9202632114011) -- [Available APIs](#section1859594134119) - -## Introduction - -- Serial Peripheral Interface \(SPI\) is a serial bus specification used for high-speed, full-duplex, and synchronous communication. -- SPI is developed by Motorola. It is commonly used for communication with flash memory, real-time clocks, sensors, and analog-to-digital \(A/D\) converters. -- SPI works in controller/device mode. Generally, there is one SPI controller that controls one or more SPI devices. They are connected via four wires: - - SCLK: clock signals output from the SPI controller - - MOSI: data output from the SPI controller and input into an SPI device - - MISO: data output from an SPI device and input into the SPI controller - - CS: signals enabled by an SPI device and controlled by the SPI controller - - -- [Figure 1](#fig15227181812587) shows the connection between one SPI controller and two SPI devices \(device A and device B\). In this figure, device A and device B share three pins \(SCLK, MISO, and MOSI\) of the controller. CS0 of device A and CS1 of device B are connected to CS0 and CS1 of the controller, respectively. - -**Figure 1** SPI controller/device connection - - -![](figures/en-us_image_0000001054142582.png) - -- SPI communication is usually initiated by the SPI controller and is operated as follows: - -1. A single SPI device is selected at a time via the CS to communicate with the SPI controller. -2. Clock signals are provided for the selected SPI device via the SCLK. -3. The SPI controller sends data to SPI devices via the MOSI, and receives data from SPI devices via the MISO. - -- SPI can work in one of the following four modes, equivalent to one of the four possible states for Clock Polarity \(CPOL\) and Clock Phase \(CPHA\): - - If both CPOL and CPHA are **0**, the clock signal level is low in the idle state and data is sampled on the first clock edge. - - If CPOL is **0** and CPHA is **1**, the clock signal level is low in the idle state and data is sampled on the second clock edge. - - If CPOL is **1** and CPHA is **0**, the clock signal level is high in the idle state and data is sampled on the first clock edge. - - If both CPOL and CPHA are **1**, the clock signal level is high in the idle state and data is sampled on the second clock edge. - - -- SPI defines a set of common functions for operating an SPI device, including those for: - - Obtaining and releasing the handle of an SPI device. - - Reading or writing data of a specified length from or into an SPI device. - - Customizing data reading or writing via **SpiMsg**. - - Obtaining and setting SPI device configuration parameters. - - ->![](public_sys-resources/icon-note.gif) **NOTE:** ->Currently, these functions are only applicable in the communication initiated by the SPI controller. - -## Available APIs - -**Table 1** APIs for the SPI driver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

SPI device handle obtaining/releasing

-

SpiOpen

-

Obtains an SPI device handle.

-

SpiClose

-

Releases an SPI device handle.

-

SPI reading/writing

-

SpiRead

-

Reads data of a specified length from an SPI device.

-

SpiWrite

-

Writes data of a specified length into an SPI device.

-

SpiTransfer

-

Transfers SPI data.

-

SPI device configuration

-

-

SpiSetCfg

-

Sets configuration parameters for an SPI device.

-

SpiGetCfg

-

Obtains configuration parameters of an SPI device.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions provided in this document can be called only in kernel space. - diff --git a/en/device-dev/driver/spiusage-example.md b/en/device-dev/driver/spiusage-example.md deleted file mode 100644 index f3d6cb2b6f667233355952efa8c7c91e780bc182..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/spiusage-example.md +++ /dev/null @@ -1,70 +0,0 @@ -# SPI Usage Example - -The following is a usage example of an SPI device, including how to obtain an SPI device handle, set the configuration parameters, and then read or write data from or into the SPI device, and finally destroy the SPI device handle. - -``` -#include "hdf_log.h" -#include "spi_if.h" - -void SpiTestSample(void) -{ - int32_t ret; - struct SpiCfg cfg; /* SPI device configuration information */ - struct SpiDevInfo spiDevinfo; /* SPI device descriptor */ - DevHandle spiHandle = NULL; /* SPI device handle */ - struct SpiMsg msg; /* Custom message to be transferred */ - uint8_t rbuff[4] = { 0 }; - uint8_t wbuff[4] = { 0x12, 0x34, 0x56, 0x78 }; - uint8_t wbuff2[4] = { 0xa1, 0xb2, 0xc3, 0xd4 }; - - spiDevinfo.busNum = 0; /* SPI device bus number */ - spiDevinfo.csNum = 0; /* SPI device CS number */ - spiHandle = SpiOpen(&spiDevinfo); /* Obtain an SPI device handle based on spiDevinfo. */ - if (spiHandle == NULL) { - HDF_LOGE("SpiOpen: failed\n"); - return; - } - /* Obtain configuration parameters of an SPI device. */ - ret = SpiGetCfg(spiHandle, &cfg); - if (ret != 0) { - HDF_LOGE("SpiGetCfg: failed, ret %d\n", ret); - goto err; - } - cfg.maxSpeedHz = 115200; /* Change the maximum clock frequency to 115200. */ - cfg.bitsPerWord = 8; /* Change the word width to 8 bits. */ - /* Set configuration parameters for an SPI device. */ - ret = SpiSetCfg(spiHandle, &cfg); - if (ret != 0) { - HDF_LOGE("SpiSetCfg: failed, ret %d\n", ret); - goto err; - } - /* Write specified length of data into an SPI device. */ - ret = SpiWrite(spiHandle, wbuff, 4); - if (ret != 0) { - HDF_LOGE("SpiWrite: failed, ret %d\n", ret); - goto err; - } - /* Read data of a specified length from an SPI device. */ - ret = SpiRead(spiHandle, rbuff, 4); - if (ret != 0) { - HDF_LOGE("SpiRead: failed, ret %d\n", ret); - goto err; - } - msg.wbuf = wbuff2; /* Pointer to the data to write */ - msg.rbuf = rbuff; /* Pointer to the data to read */ - msg.len = 4; /* The length of the data to be read or written is 4 bits. */ - msg.csChange = 1; /* Disable the CS before the next transfer. */ - msg.delayUs = 0; /* No delay before the next transfer */ - msg.speed = 115200; /* Speed of this transfer */ - /* Launch a custom transfer. The number of messages to be transferred is 1. */ - ret = SpiTransfer(spiHandle, &msg, 1); - if (ret != 0) { - HDF_LOGE("SpiTransfer: failed, ret %d\n", ret); - goto err; - } -err: - /* Destroy the SPI device handle. */ - SpiClose(spiHandle); -} -``` - diff --git a/en/device-dev/driver/touchscreen.md b/en/device-dev/driver/touchscreen.md deleted file mode 100644 index 49b35d23fb1f1ea0438f92292ae22e794a155dbb..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/touchscreen.md +++ /dev/null @@ -1,9 +0,0 @@ -# TOUCHSCREEN - -- **[Touchscreen Overview](touchscreenoverview.md)** - -- **[Touchscreen Development Guidelines](touchscreendevelopment-guidelines.md)** - -- **[Touchscreen Development Example](touchscreendevelopment-example.md)** - - diff --git a/en/device-dev/driver/touchscreendevelopment-guidelines.md b/en/device-dev/driver/touchscreendevelopment-guidelines.md deleted file mode 100644 index 9e1543c1e668c4bdc8aa62be3073a6539ff5f1de..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/touchscreendevelopment-guidelines.md +++ /dev/null @@ -1,35 +0,0 @@ -# Touchscreen Development Guidelines - -- [How to Develop](#section1255740132616) - -Regardless of the OS and system on a chip \(SoC\), the input driver is developed based on the HDF, platform, and OSAL APIs to provide a unified driver model for touchscreen devices. - -- The following uses the touchscreen driver as an example to describe the loading process of the input driver model: - - Add the touchscreen driver-related descriptions: You can add the touchscreen driver-related descriptions, such as the loading priority, board-level hardware information, and private data, by referring to the existing template. - - - Load the input device manager driver: The HDF automatically loads the input device manager driver, which then creates the device manager and initializes it. - - - Load the touchscreen common driver: The HDF automatically loads the touchscreen common driver, which then parses the board-level configuration, initializes the hardware, and provides the API for registering the touchscreen. - - - Load the touchscreen chip driver: The HDF automatically loads the touchscreen chip driver, which then instantiates the touchscreen device, parses the private data, and implements differentiated APIs provided by the platform. - - - Register the touchscreen device with the platform driver: Register the instantiated touchscreen device with the platform driver, bind this device to the platform driver, and complete touchscreen initialization such as interrupt registration and power-on and power-off. - - - Register the input device: Instantiate the input device and register it with the input manager after the touchscreen is initialized. - - -## How to Develop - -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 [How to Develop](driver-development.md#section1969312275533). - -2. Complete the board-level configuration and private data configuration of the touchscreen. - - Configure the required I/O pins. For example, configure a register for the I2C pin reserved for the touchscreen to use I2C for transmitting data. - -3. Implement differentiated adaptation APIs of the touchscreen. - - Use the platform APIs to perform operations for the reset pins, interrupt pins and power based on the communications interfaces designed for boards. For details about the GPIO-related operations, see [GPIO Usage Guidelines](gpiousage-guidelines.md). - - diff --git a/en/device-dev/driver/touchscreenoverview.md b/en/device-dev/driver/touchscreenoverview.md deleted file mode 100644 index b136894e5ade080a07e5ff457b20fd74eefd33b9..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/touchscreenoverview.md +++ /dev/null @@ -1,71 +0,0 @@ -# Touchscreen Overview - -- [Introduction](#section124332411260) -- [Available APIs](#section10542625172618) - -## Introduction - -- **Functions of the Touchscreen driver** - - The Touchscreen driver is used to power on its integrated circuit \(IC\), configure and initialize hardware pins, register interrupts, configure Inter-Integrated Circuit \(I2C\) or SPI APIs, set input-related configurations, and download and update firmware. - - -- **Layers of the Touchscreen driver** - - This section describes how to develop the touchscreen driver based on the input driver model. [Figure 1](#fig6251184817261) shows an overall architecture of the touchscreen driver. - - The input driver is developed based on the hardware driver foundation \(HDF\), platform APIs, and operating system abstraction layer \(OSAL\) APIs. It provides hardware driver capabilities through the input Hardware Driver Interfaces \(HDIs\) for upper-layer input services to control the touchscreen. - - -**Figure 1** Architecture of the input driver model -![](figures/architecture-of-the-input-driver-model.png "architecture-of-the-input-driver-model") - -- **Input driver model** - - The input driver model mainly consists of the device manager, common drivers, and chip drivers. The platform data channel provides capabilities for sending data generated by the touchscreen from the kernel to the user space. The driver model adapts to different touchscreen devices and hardware platforms via the configuration file, improving the efficiency of the touchscreen development. The description for each part of the input driver model is as follows: - - - Input device manager: provides various input device drivers with the APIs for registering or unregistering input devices and manages the input device list. - - - Input common driver: provides common abstract drivers \(such as the touchscreen common driver\) of various input devices for initializing the board-level hardware, processing hardware interrupts, and registering input devices with the input device manager. - - - Input chip driver: provides different chip drivers of each vendor. You can minimize the workload for the input chip driver development by calling differentiated APIs reserved by the input platform driver. - - - Event hub: provides a unified data reporting channel, which enables various input devices to report input events. - - - HDF input config: parses and manages the board-level configuration as well as the private configuration of input devices. - - -- **Advantages of developing drivers based on the HDF** - - The touchscreen driver is developed based on the HDF 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 - -Based on the attributes of the pins, interfaces on the touchscreens can be classified into the following types: - -- Power interfaces -- I/O control interfaces -- Communications interfaces - -**Figure 2** Common pins of the touchscreen -![](figures/common-pins-of-the-touchscreen.png "common-pins-of-the-touchscreen") - -The interfaces shown in the figure are described as follows: - -1. **Power interfaces** - - LDO\_1P8: 1.8 V digital circuits - - LDO\_3P3: 3.3 V analog circuits - - Generally, the touchscreen driver IC is separated from the LCD driver IC. In this case, the touchscreen driver IC requires both 1.8 V and 3.3 V power supplies. Nowadays, the touchscreen driver IC and LCD driver IC can be integrated. Therefore, the touchscreen, requires only the 1.8 V power supply, and the 3.3 V power required internally is supplied by the LCD VSP power \(typical value: 5.5 V\) in the driver IC. - - -2. **I/O control interfaces** - - RESET: reset pin, which is used to reset the driver IC on the host when suspending or resuming the system. - - INT: interrupt pin, which needs to be set to the input direction and pull-up status during driver initialization. After detecting an external touch signal, the driver triggers the interrupt by operating the interrupt pin. The driver reads the touch reporting data in the ISR function. - -3. **Communications interfaces** - - I2C: Since only a small amount of touch data is reported by the touchscreen, I2C is used to transmit the reported data. For details about the I2C protocol and interfaces, see [I2C Usage Guidelines](i2c-usage-guidelines.md). - - SPI: In addition to touch reporting data coordinates, some vendors need to obtain basic capacitance data. Therefore, Serial Peripheral Interface \(SPI\) is used to transmit such huge amount of data. For details about the SPI protocol and interfaces, see [SPI Usage Guidelines](spiusage-guidelines.md). - - diff --git a/en/device-dev/driver/uart.md b/en/device-dev/driver/uart.md deleted file mode 100644 index 9abd98bb4e661a01011d233577ae4109bcdd208e..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/uart.md +++ /dev/null @@ -1,9 +0,0 @@ -# UART - -- **[UART Overview](uartoverview.md)** - -- **[UART Usage Guidelines](uartusage-guidelines.md)** - -- **[UART Usage Example](uartusage-example.md)** - - diff --git a/en/device-dev/driver/uartoverview.md b/en/device-dev/driver/uartoverview.md deleted file mode 100644 index 2238f2ca5564f4f1faa35bf16590c51a6492ad07..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/uartoverview.md +++ /dev/null @@ -1,106 +0,0 @@ -# UART Overview - -- [Introduction](#section14770623164917) -- [Available APIs](#section149505462492) - -## Introduction - -- The Universal Asynchronous Receiver/Transmitter \(UART\) is a universal serial data bus used for asynchronous communication. It enables bi-directional communication between devices in full-duplex mode. -- UART is widely used to print information for debugging or to connect to various external modules such as GPS and Bluetooth. -- A UART is connected to other modules through two wires \(as shown in [Figure 1](#fig209936401896)\) or four wires \(as shown in [Figure 2](#fig1435614171015)\). - - TX: TX pin of the transmitting UART. It is connected to the RX pin of the peer UART. - - RX: RX pin of the receiving UART. It is connected to the TX pin of the peer UART. - - RTS: Request to Send signal pin. It is connected to the CTS pin of the peer UART and is used to indicate whether the local UART is ready to receive data. - - CTS: Clear to Send signal pin. It is connected to the RTS pin of the peer UART and is used to indicate whether the local UART is allowed to send data to the peer end. - - **Figure 1** 2-wire UART communication - - - ![](figures/en-us_image_0000001053926237.png) - - **Figure 2** 4-wire UART communication - - - ![](figures/en-us_image_0000001054007499.png) - - -- The transmitting and receiving UARTs must ensure that they have the same settings on particular attributes such as the baud rate and data format \(start bit, data bit, parity bit, and stop bit\) before they start to communicate. During data transmission, a UART sends data to the peer end over the TX pin and receives data from the peer end over the RX pin. When the size of the buffer used by a UART for storing received data reaches the preset threshold, the RTS signal of the UART changes to **1** \(data cannot be received\), and the peer UART stops sending data to it because its CTS signal does not allow it to send data. -- The UART interface defines a set of common functions for operating a UART port, including obtaining and releasing device handles, reading and writing data of a specified length, and obtaining and setting the baud rate, as well as the device attributes. - -## Available APIs - -**Table 1** APIs for the UART driver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

Obtaining and releasing device handles

-

-

UartOpen

-

Obtains the UART device handle.

-

UartClose

-

Releases a specified UART device handle.

-

Reading and writing data

-

-

UartRead

-

Reads data of a specified length from a UART device.

-

UartWrite

-

Writes data of a specified length into a UART device.

-

Obtaining and setting the baud rate

-

UartGetBaud

-

Obtains the UART baud rate.

-

UartSetBaud

-

Sets the UART baud rate.

-

Obtaining and setting device attributes

-

-

UartGetAttribute

-

Obtains the UART device attributes.

-

UartSetAttribute

-

Sets the UART device attributes.

-

Setting the transmission mode

-

UartSetTransMode

-

Sets the UART transmission mode.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All functions provided in this document can be called only in kernel space. - diff --git a/en/device-dev/driver/uartusage-example.md b/en/device-dev/driver/uartusage-example.md deleted file mode 100644 index 32572d405213dc537c54c2dafdd7c1902e64a048..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/uartusage-example.md +++ /dev/null @@ -1,67 +0,0 @@ -# UART Usage Example - -The following is a usage example of a UART device, including how to obtain the UART device handle, set the baud rate, device attributes, and transmission mode, read data from or write data into the UART device, and then destroy the UART device handle. - -``` -#include "hdf_log.h" -#include "uart_if.h" - -void UartTestSample(void) -{ - int32_t ret; - uint32_t port; - DevHandle handle = NULL; - uint8_t wbuff[5] = { 1, 2, 3, 4, 5 }; - uint8_t rbuff[5] = { 0 }; - struct UartAttribute attribute; - attribute.dataBits = UART_ATTR_DATABIT_7; /* Set the number of data bits to 7. */ - attribute.parity = UART_ATTR_PARITY_NONE; /* Set the parity bit to no parity. */ - attribute.stopBits = UART_ATTR_STOPBIT_1; /* Set the stop bit to 1. */ - attribute.rts = UART_ATTR_RTS_DIS; /* Disable the RTS signal. */ - attribute.cts = UART_ATTR_CTS_DIS; /* Disable the CTS signal. */ - attribute.fifoRxEn = UART_ATTR_RX_FIFO_EN; /* Enable RX FIFO. */ - attribute.fifoTxEn = UART_ATTR_TX_FIFO_EN; /* Enable TX FIFO. */ - /* Set the UART port number actually used. */ - port = 1; - /* Obtain the UART device handle. */ - handle = UartOpen(port); - if (handle == NULL) { - HDF_LOGE("UartOpen: failed!\n"); - return; - } - /* Set the UART baud rate to 9600. */ - ret = UartSetBaud(handle, 9600); - if (ret != 0) { - HDF_LOGE("UartSetBaud: failed, ret %d\n", ret); - goto _ERR; - } - /* Set the UART device attributes. */ - ret = UartSetAttribute(handle, &attribute); - if (ret != 0) { - HDF_LOGE("UartSetAttribute: failed, ret %d\n", ret); - goto _ERR; - } - /* Set the UART transmission mode to non-blocking mode. */ - ret = UartSetTransMode(handle, UART_MODE_RD_NONBLOCK); - if (ret != 0) { - HDF_LOGE("UartSetTransMode: failed, ret %d\n", ret); - goto _ERR; - } - /* Write 5-byte data into the UART device. */ - ret = UartWrite(handle, wbuff, 5); - if (ret != 0) { - HDF_LOGE("UartWrite: failed, ret %d\n", ret); - goto _ERR; - } - /* Read 5-byte data from the UART device. */ - ret = UartRead(handle, rbuff, 5); - if (ret < 0) { - HDF_LOGE("UartRead: failed, ret %d\n", ret); - goto _ERR; - } -_ERR: - /* Destroy the UART device handle. */ - UartClose(handle); -} -``` - diff --git a/en/device-dev/driver/usage-example.md b/en/device-dev/driver/usage-example.md deleted file mode 100644 index e16e8f2eeadcc12bd537fa8655692af0e88c9893..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/usage-example.md +++ /dev/null @@ -1,98 +0,0 @@ -# Usage Example - -The following is an example of using a MIPI DSI device: - -``` -#include "hdf.h" -#include "mipi_dsi_if.h" - -void PalMipiDsiTestSample(void) -{ - uint8_t chnId; - int32_t ret; - DevHandle handle = NULL; - - /* Device channel ID */ - chnId = 0; - /* Obtain the MIPI DSI device handle based on a specified channel ID. */ - handle = MipiDsiOpen(chnId); - if (handle == NULL) { - HDF_LOGE("MipiDsiOpen: failed!\n"); - return; - } - /* MIPI DSI configuration parameters */ - struct MipiCfg cfg = {0}; - cfg.lane = DSI_4_LANES; - cfg.mode = DSI_CMD_MODE; - cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; - cfg.format = FORMAT_RGB_24_BIT; - cfg.pixelClk = 174; - cfg.phyDataRate = 384; - cfg.timingInfo.hsaPixels = 50; - cfg.timingInfo.hbpPixels = 55; - cfg.timingInfo.hlinePixels = 1200; - cfg.timingInfo.yResLines = 1800; - cfg.timingInfo.vbpLines = 33; - cfg.timingInfo.vsaLines = 76; - cfg.timingInfo.vfpLines = 120; - cfg.timingInfo.xResPixels = 1342; - /* Set MIPI DSI configuration parameters. */ - ret = MipiDsiSetCfg(g_handle, &cfg); - if (ret != 0) { - HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); - return; - } - /* Send the command for initializing the PANEL register. */ - struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); - if (cmd == NULL) { - return; - } - cmd->dtype = DTYPE_DCS_WRITE; - cmd->dlen = 1; - cmd->payload = OsalMemCalloc(sizeof(uint8_t)); - if (cmd->payload == NULL) { - HdfFree(cmd); - return; - } - *(cmd->payload) = DTYPE_GEN_LWRITE; - MipiDsiSetLpMode(mipiHandle); - ret = MipiDsiTx(mipiHandle, cmd); - MipiDsiSetHsMode(mipiHandle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: MipiDsiTx fail! ret=%d\n", __func__, ret); - HdfFree(cmd->payload); - HdfFree(cmd); - return; - } - HdfFree(cmd->payload); - HdfFree(cmd); - /* Pointer to the register that reads the PANEL status */ - uint8_t readVal = 0; - struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); - if (cmdRead == NULL) { - return; - } - cmdRead->dtype = DTYPE_DCS_READ; - cmdRead->dlen = 1; - cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); - if (cmdRead->payload == NULL) { - HdfFree(cmdRead); - return; - } - *(cmdRead->payload) = DDIC_REG_STATUS; - MipiDsiSetLpMode(g_handle); - ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); - MipiDsiSetHsMode(g_handle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); - HdfFree(cmdRead->payload); - HdfFree(cmdRead); - return; - } - HdfFree(cmdRead->payload); - HdfFree(cmdRead); - /* Release the MIPI DSI device handle. */ - MipiDsiClose(handle); -} -``` - diff --git a/en/device-dev/driver/usage-guidelines.md b/en/device-dev/driver/usage-guidelines.md deleted file mode 100644 index 1934eaf6e0bb68cb83d76d0114635f10f5ec59b7..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/usage-guidelines.md +++ /dev/null @@ -1,365 +0,0 @@ -# Usage Guidelines - -- [How to Use](#section8982671284) -- [Obtaining a MIPI DSI Device Handle](#section57982569176) -- [Setting MIPI DSI Configuration Parameters](#section5935410201815) -- [Sending/Receiving the Pointer to a Command](#section611661316194) -- [Releasing the MIPI DSI Device Handle](#section217313211199) - -## How to Use - -[Figure 1](#fig99821771782) shows the process of using a MIPI DSI device. - -**Figure 1** Process of using a MIPI DSI device - - -![](figures/en-us_image_0000001072553354.png) - -## Obtaining a MIPI DSI Device Handle - -Before performing MIPI DSI communication, obtain a MIPI DSI device handle by calling **MipiDsiOpen**. This function returns a MIPI DSI device handle with a specified channel ID. - -DevHandle MipiDsiOpen\(uint8\_t id\); - -**Table 1** Description of **MipiDsiOpen** - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

id

-

MIPI DSI channel ID.

-

Return Value

-

Description

-

NULL

-

Failed to obtain the MIPI DSI channel ID.

-

Device handle

-

MIPI DSI device handle with a specified channel ID, whose data type is DevHandle.

-
- -The following example shows how to obtain a MIPI DSI device handle with the channel ID **0**: - -``` -DevHandle mipiDsiHandle = NULL; /* Device handle */ -chnId = 0; /* MIPI DSI channel ID */ - -/* Obtain the MIPI DSI device handle based on a specified channel ID. */ -mipiDsiHandle = MipiDsiOpen(chnId); -if (mipiDsiHandle == NULL) { - HDF_LOGE("MipiDsiOpen: failed\n"); - return; -} -``` - -## Setting MIPI DSI Configuration Parameters - -- Set MIPI DSI configuration parameters by calling the following function: - -int32\_t MipiDsiSetCfg\(DevHandle handle, struct MipiCfg \*cfg\); - -**Table 2** Description of **MipiDsiSetCfg** - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

MIPI DSI device handle

-

cfg

-

Pointer to MIPI DSI configuration parameters

-

Return Value

-

Description

-

0

-

Succeeded in setting MIPI DSI configuration parameters.

-

Negative value

-

Failed to set MIPI DSI configuration parameters.

-
- -``` -int32_t ret; -struct MipiCfg cfg = {0}; - -/* Configuration parameters of the connected device are as follows: */ -cfg.lane = DSI_4_LANES; -cfg.mode = DSI_CMD_MODE; -cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; -cfg.format = FORMAT_RGB_24_BIT; -cfg.pixelClk = 174; -cfg.phyDataRate = 384; -cfg.timingInfo.hsaPixels = 50; -cfg.timingInfo.hbpPixels = 55; -cfg.timingInfo.hlinePixels = 1200; -cfg.timingInfo.yResLines = 1800; -cfg.timingInfo.vbpLines = 33; -cfg.timingInfo.vsaLines = 76; -cfg.timingInfo.vfpLines = 120; -cfg.timingInfo.xResPixels = 1342; -/* Set MIPI DSI configuration parameters. */ -ret = MipiDsiSetCfg(g_handle, &cfg); -if (ret != 0) { - HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); - return -1; -} -``` - -- Obtain MIPI DSI configuration parameters by calling the following function: - -int32\_t MipiDsiGetCfg\(DevHandle handle, struct MipiCfg \*cfg\); - -**Table 3** Description of **MipiDsiGetCfg** - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

MIPI DSI device handle

-

cfg

-

Pointer to MIPI DSI configuration parameters

-

Return Value

-

Description

-

0

-

Succeeded in obtaining MIPI DSI configuration parameters.

-

Negative value

-

Failed to obtain MIPI DSI configuration parameters.

-
- -``` -int32_t ret; -struct MipiCfg cfg; -memset(&cfg, 0, sizeof(struct MipiCfg)); -ret = MipiDsiGetCfg(g_handle, &cfg); -if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: GetMipiCfg fail!\n", __func__); - return HDF_FAILURE; -} -``` - -## Sending/Receiving the Pointer to a Command - -- Send the pointer to a specified command by calling the following function: - -int32\_t MipiDsiTx\(PalHandle handle, struct DsiCmdDesc \*cmd\); - -**Table 4** Description of **MipiDsiTx** - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

MIPI DSI device handle

-

cmd

-

Pointer to the command to be sent

-

Return Value

-

Description

-

0

-

Succeeded in sending the specified command.

-

Negative value

-

Failed to send the specified command.

-
- -``` -int32_t ret; -struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); -if (cmd == NULL) { - return HDF_FAILURE; -} -cmd->dtype = DTYPE_DCS_WRITE; -cmd->dlen = 1; -cmd->payload = OsalMemCalloc(sizeof(uint8_t)); -if (cmd->payload == NULL) { - HdfFree(cmd); - return HDF_FAILURE; -} -*(cmd->payload) = DTYPE_GEN_LWRITE; -MipiDsiSetLpMode(mipiHandle); -ret = MipiDsiTx(mipiHandle, cmd); -MipiDsiSetHsMode(mipiHandle); -if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: PalMipiDsiTx fail! ret=%d\n", __func__, ret); - HdfFree(cmd->payload); - HdfFree(cmd); - return HDF_FAILURE; -} -HdfFree(cmd->payload); -HdfFree(cmd); -``` - -- Receive a specified command by calling the following function: - -int32\_t MipiDsiRx\(DevHandle handle, struct DsiCmdDesc \*cmd, uint32\_t readLen, uint8\_t \*out\); - -**Table 5** Description of **MipiDsiRx** - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

MIPI DSI device handle

-

cmd

-

Pointer to the command to be received

-

readLen

-

Length of the data to read.

-

out

-

Pointer to the read data.

-

Return Value

-

Description

-

0

-

Succeeded in receiving the specified command.

-

Negative value

-

Failed to receive the specified command.

-
- -``` -int32_t ret; -uint8_t readVal = 0; - -struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); -if (cmdRead == NULL) { - return HDF_FAILURE; -} -cmdRead->dtype = DTYPE_DCS_READ; -cmdRead->dlen = 1; -cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); -if (cmdRead->payload == NULL) { - HdfFree(cmdRead); - return HDF_FAILURE; -} -*(cmdRead->payload) = DDIC_REG_STATUS; -MipiDsiSetLpMode(g_handle); -ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); -MipiDsiSetHsMode(g_handle); -if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); - HdfFree(cmdRead->payload); - HdfFree(cmdRead); - return HDF_FAILURE; -} -HdfFree(cmdRead->payload); -HdfFree(cmdRead); -``` - -## Releasing the MIPI DSI Device Handle - -After the MIPI DSI communication, release the MIPI DSI device handle by calling the following function: - -void MipiDsiClose\(DevHandle handle\); - -This function releases the resources requested by **MipiDsiOpen**. - -**Table 6** Description of **MipiDsiClose** - - - - - - - - - - -

Parameter

-

Description

-

handle

-

MIPI DSI device handle

-
- -``` -MipiDsiClose(mipiHandle); /* Release the MIPI DSI device handle */ -``` - diff --git a/en/device-dev/driver/watchdog.md b/en/device-dev/driver/watchdog.md deleted file mode 100644 index b8f20d1dad97959da8207df5b166e177854a35a9..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/watchdog.md +++ /dev/null @@ -1,9 +0,0 @@ -# WATCHDOG - -- **[Watchdog Overview](watchdogoverview.md)** - -- **[Watchdog Usage Guidelines](watchdogusage-guidelines.md)** - -- **[Watchdog Usage Example](watchdogusage-example.md)** - - diff --git a/en/device-dev/driver/watchdogoverview.md b/en/device-dev/driver/watchdogoverview.md deleted file mode 100644 index 04b3b373d03c4773f5bc45ba9ef3ca8cabc29a85..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/watchdogoverview.md +++ /dev/null @@ -1,78 +0,0 @@ -# Watchdog Overview - -- [Introduction](#section3579126111816) -- [Available APIs](#section17429111981812) - -## Introduction - -A watchdog, also called a watchdog timer, is a hardware timing device. If an error occurs in the main program of the system and fails to reset the watchdog timer, the watchdog timer sends a reset signal to restore the system to a normal state. - -## Available APIs - -**Table 1** Watchdog APIs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

Open/Close

-

WatchdogOpen

-

Opens a watchdog.

-

WatchdogClose

-

Closes a watchdog.

-

Start/Stop

-

WatchdogStart

-

Starts a watchdog.

-

WatchdogStop

-

Stops a watchdog.

-

Timeout duration

-

WatchdogSetTimeout

-

Sets the watchdog timeout duration.

-

WatchdogGetTimeout

-

Obtains the watchdog timeout duration.

-

Status

-

WatchdogGetStatus

-

Obtains the watchdog status.

-

Feeding

-

WatchdogFeed

-

Feeds a watchdog, or resets a watchdog timer.

-
- ->![](public_sys-resources/icon-note.gif) **NOTE:** ->All watchdog functions provided in this document can be called only in kernel mode. - diff --git a/en/device-dev/driver/watchdogusage-example.md b/en/device-dev/driver/watchdogusage-example.md deleted file mode 100644 index 98f6acfa0e383b059ed257df8411ef03f3f9ee72..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/watchdogusage-example.md +++ /dev/null @@ -1,86 +0,0 @@ -# Watchdog Usage Example - -This example provides a complete process for using a watchdog. - -In this example, open a watchdog, set the timeout duration, and start the watchdog. - -- Feed the watchdog periodically to ensure that the system is not reset due to timer expiry. -- Stop feeding the watchdog and check whether the system is reset after the timer expires. - -Example: - -``` -#include "watchdog_if.h" -#include "hdf_log.h" -#include "osal_irq.h" -#include "osal_time.h" - -#define WATCHDOG_TEST_TIMEOUT 2 -#define WATCHDOG_TEST_FEED_TIME 6 - -static int32_t TestCaseWatchdog(void) -{ - int32_t i; - int32_t ret; - uint32_t timeout; - DevHandle handle = NULL; - - /* Open watchdog 0. */ - handle = WatchdogOpen(0); - if (handle == NULL) { - HDF_LOGE("Open watchdog fail!"); - return -1; - } - - /* Set the timeout duration. */ - ret = WatchdogSetTimeout(handle, WATCHDOG_TEST_TIMEOUT); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set timeout fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - - /* Obtain the configured timeout duration. */ - ret = WatchdogGetTimeout(handle, &timeout); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: get timeout fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - HDF_LOGI("%s: read timeout back:%u\n", __func__, timeout); - - /* Start the watchdog. The timer starts. */ - ret = WatchdogStart(handle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - - /* Feed the watchdog every 1s. */ - for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: feeding watchdog %d times... \n", __func__, i); - ret = WatchdogFeed(handle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: feed dog fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - OsalSleep(1); - } - /* Because the interval for feeding the watchdog is shorter than the timeout duration, the system does not reset, and logs can be printed normally. */ - HDF_LOGE("%s: no reset ... feeding test OK!!!\n", __func__); - - /* Enable the timer to expire by stopping feeding the watchdog. */ - for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); - OsalSleep(1); - } - - /* The system resets when the timer expires. If the code is correct, the log below is not displayed. */ - HDF_LOGE("%s: dog has't buck!!! \n", __func__, i); - WatchdogClose(handle); - return -1; -} -``` - diff --git a/en/device-dev/driver/wlan.md b/en/device-dev/driver/wlan.md deleted file mode 100644 index d6d1fba4014eca409dc4a0d4ef645b1dc9cdffe3..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/wlan.md +++ /dev/null @@ -1,9 +0,0 @@ -# WLAN - -- **[WLAN Overview](wlanoverview.md)** - -- **[WLAN Development Guidelines](wlandevelopment-guidelines.md)** - -- **[WLAN Development Example](wlandevelopment-example.md)** - - diff --git a/en/device-dev/driver/wlandevelopment-example.md b/en/device-dev/driver/wlandevelopment-example.md deleted file mode 100644 index 23c68799d2e8bc2c0c561ef63e4ec3c810e034d9..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/wlandevelopment-example.md +++ /dev/null @@ -1,372 +0,0 @@ -# WLAN Development Example - -This section describes how to initialize the WLAN module on a Hi3881 WLAN chip. - -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. */ -hisi :& deviceList { - device0 :: deviceInst { - 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. */ - } - 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. */ - } - } - 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 */ - } - 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 */ - } - } -} -/* Add configuration file wlan_chip_.hcs (for example, wlan_chip_hi3881.hcs) for each chip and set parameters. The following takes the Hi3881 chip as an example. */ -root { - wlan_config { - hi3881 :& chipList { - chipHi3881 :: chipInst { - match_attr = "hdf_wlan_chips_hi3881"; /* Match attribute */ - chipName = "hi3881"; /* WLAN chip name */ - sdio { - vendorId = 0x0296; /* Vendor ID */ - deviceId = [0x5347]; /* Device ID */ - } - } - } - } -} -``` - -2. Mount the **init** and **deinit** functions of the WLAN chip and WLAN chip driver. - -``` -/* WLAN module initialization and mount process */ -#include "hdf_device_desc.h" -#include "hdf_wifi_product.h" -#include "hdf_log.h" -#include "osal_mem.h" -#include "hdf_wlan_chipdriver_manager.h" -#include "securec.h" -#include "wifi_module.h" -#include "hi_wifi_api.h" -#include "hi_types_base.h" - -#define HDF_LOG_TAG Hi3881Driver - -/* Functions for initializing and deinitializing the WLAN chip */ -int32_t InitHi3881Chip(struct HdfWlanDevice *device); -int32_t DeinitHi3881Chip(struct HdfWlanDevice *device); -/* Functions for initializing and deinitializing the 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. */ -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. */ -static struct HdfChipDriver *BuildHi3881Driver(struct HdfWlanDevice *device, uint8_t ifIndex) -{ - struct HdfChipDriver *specificDriver = NULL; - if (device == NULL) { - HDF_LOGE("%s fail : channel is NULL", __func__); - return NULL; - } - (void)device; - (void)ifIndex; - specificDriver = (struct HdfChipDriver *)OsalMemCalloc(sizeof(struct HdfChipDriver)); - if (specificDriver == NULL) { - HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__); - return NULL; - } - if (memset_s(specificDriver, sizeof(struct HdfChipDriver), 0, sizeof(struct HdfChipDriver)) != EOK) { - HDF_LOGE("%s fail: memset_s fail!", __func__); - OsalMemFree(specificDriver); - return NULL; - } - - if (strcpy_s(specificDriver->name, MAX_WIFI_COMPONENT_NAME_LEN, HI3881_DRIVER_NAME) != EOK) { - HDF_LOGE("%s fail : strcpy_s fail", __func__); - OsalMemFree(specificDriver); - return NULL; - } - specificDriver->init = Hi3881Init; - specificDriver->deinit = Hi3881Deinit; - - HiMac80211Init(specificDriver); - - return specificDriver; -} - -/* Release the WLAN chip driver. */ -static void ReleaseHi3881Driver(struct HdfChipDriver *chipDriver) -{ - if (chipDriver == NULL) { - return; - } - if (strcmp(chipDriver->name, HI3881_DRIVER_NAME) != 0) { - HDF_LOGE("%s:Not my driver!", __func__); - return; - } - OsalMemFree(chipDriver); -} - -static uint8_t GetHi3881GetMaxIFCount(struct HdfChipDriverFactory *factory) { - (void)factory; - return 1; -} - -/* Register functions related to the WLAN chip. */ -static int32_t HDFWlanRegHisiDriverFactory(void) -{ - static struct HdfChipDriverFactory tmpFactory = { 0 }; - struct HdfChipDriverManager *driverMgr = NULL; - driverMgr = HdfWlanGetChipDriverMgr(); - if (driverMgr == NULL && driverMgr->RegChipDriver != NULL) { - HDF_LOGE("%s fail: driverMgr is NULL!", __func__); - return HDF_FAILURE; - } - tmpFactory.driverName = HI3881_DRIVER_NAME; - tmpFactory.GetMaxIFCount = GetHi3881GetMaxIFCount; - tmpFactory.InitChip = InitHi3881Chip; - tmpFactory.DeinitChip = DeinitHi3881Chip; - tmpFactory.Build = BuildHi3881Driver; - tmpFactory.Release = ReleaseHi3881Driver; - tmpFactory.ReleaseFactory = NULL; - if (driverMgr->RegChipDriver(&tmpFactory) != HDF_SUCCESS) { - HDF_LOGE("%s fail: driverMgr is NULL!", __func__); - return HDF_FAILURE; - } - - return HDF_SUCCESS; -} - -static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) -{ - (void)device; - return HDFWlanRegHisiDriverFactory(); -} - -struct HdfDriverEntry g_hdfHisiChipEntry = { - .moduleVersion = 1, - .Init = HdfWlanHisiChipDriverInit, - .moduleName = "HDF_WLAN_CHIPS" -}; - -HDF_INIT(g_hdfHisiChipEntry); -``` - -``` -#include "hdf_wifi_product.h" -#include "hi_wifi_api.h" -#if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) -#include "oal_thread.h" -#include "osal_time.h" -#endif -#include "wifi_mac80211_ops.h" -#include "wal_cfg80211.h" -#include "net_adpater.h" -#include "hdf_wlan_utils.h" - -#define HDF_LOG_TAG Hi3881Driver - -/* Initialize the WLAN chip. */ -int32_t InitHi3881Chip(struct HdfWlanDevice *device) -{ - uint8_t maxPortCount = 1; - int32_t ret = HI_SUCCESS; - uint8_t maxRetryCount = 2; - if (device == NULL) { - HDF_LOGE("%s:NULL ptr!", __func__); - return HI_FAIL; - } - - do { - if (ret != HI_SUCCESS) { - if (device->reset != NULL && device->reset->Reset != NULL) { - device->reset->Reset(device->reset); - } - HDF_LOGE("%s:Retry init hi3881!last ret=%d", __func__, ret); - } - ret = hi_wifi_init(maxPortCount); - } while (ret != 0 && --maxRetryCount > 0); - - if (ret != 0) { - HDF_LOGE("%s:Init hi3881 driver failed!", __func__); - return ret; - } - return HI_SUCCESS; -} - -/* Deinitialize the WLAN chip. */ -int32_t DeinitHi3881Chip(struct HdfWlanDevice *device) -{ - (void)device; - int32_t ret = hi_wifi_deinit(); - if (ret != 0) { - HDF_LOGE("%s:Deinit failed!ret=%d", __func__, ret); - } - return ret; -} - -/* Initialize the WLAN chip driver. */ -int32_t Hi3881Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) -{ - HDF_LOGI("%s: start...", __func__); - hi_u16 mode = wal_get_vap_mode(); - int32_t ret; - nl80211_iftype_uint8 type; - (void)chipDriver; - - if (mode >= WAL_WIFI_MODE_BUTT) { - oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); - return HI_FAIL; - } - - if (mode == WAL_WIFI_MODE_STA) { - type = NL80211_IFTYPE_STATION; - } else if (mode == WAL_WIFI_MODE_AP) { - type = NL80211_IFTYPE_AP; - } else { - oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); - return HI_FAIL; - } - - ret = wal_init_drv_wlan_netdev(type, WAL_PHY_MODE_11N, netDevice); - if (ret != HI_SUCCESS) { - oam_error_log2(0, OAM_SF_ANY, "wal_init_drv_netdev %s failed.l_return:%d\n", netDevice->name, ret); - } - return ret; -} - -/* Deinitialize the WLAN chip driver. */ -int32_t Hi3881Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) -{ - (void)chipDriver; - int32_t ret = wal_deinit_drv_wlan_netdev(netDevice); - if (ret != HDF_SUCCESS) { - return ret; - } - return ReleasePlatformNetDevice(netDevice); -} -``` - -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**. - -``` -hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi_char* ifname, hi_u32* len) -{ - oal_net_device_stru *netdev = HI_NULL; - - ...... - /* Initialize the network device and obtain the initialized instance. */ - netdev = NetDeviceInit(ifname, *len, LITE_OS); - oal_wireless_dev *wdev = (oal_wireless_dev *)oal_mem_alloc(OAL_MEM_POOL_ID_LOCAL, sizeof(oal_wireless_dev)); - ret = wal_init_netif(type, netdev, wdev); - - ...... - - return HI_SUCCESS; -} -/* Mount some function pointers of {@link NetDeviceInterFace}. */ -oal_net_device_ops_stru g_wal_net_dev_ops = -{ - .getStats = wal_netdev_get_stats, - .open = wal_netdev_open, - .stop = wal_netdev_stop, - .xmit = hmac_bridge_vap_xmit, - .ioctl = wal_net_device_ioctl, - .changeMtu = oal_net_device_change_mtu, - .init = oal_net_device_init, - .deInit = oal_net_free_netdev, -#if (defined(_PRE_WLAN_FEATURE_FLOWCTL) || defined(_PRE_WLAN_FEATURE_OFFLOAD_FLOWCTL)) - .selectQueue = wal_netdev_select_queue, -#endif - .setMacAddr = wal_netdev_set_mac_addr, -#if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) - .netifNotify = HI_NULL, -#endif - .specialEtherTypeProcess = SpecialEtherTypeProcess, -}; - -hi_s32 wal_init_netif(nl80211_iftype_uint8 type, oal_net_device_stru *netdev, const oal_wireless_dev *wdev) -{ - /* Add the network device to a protocol stack. */ - hi_u32 ret = NetDeviceAdd(netdev, (Protocol80211IfType)type); - - ...... - - return HI_SUCCESS; -} -``` - -4. Implement functions of **WifiMac80211Ops**. - -``` -/* Mount some function pointers of mac80211. */ - -/* MAC-layer APIs for basic capabilities that need to be implemented by the driver */ -static struct HdfMac80211BaseOps g_baseOps = { - .SetMode = WalSetMode, - .AddKey = WalAddKey, - .DelKey = WalDelKey, - .SetDefaultKey = WalSetDefaultKey, - .GetDeviceMacAddr = WalGetDeviceMacAddr, - .SetMacAddr = WalSetMacAddr, - .SetTxPower = WalSetTxPower, - .GetValidFreqsWithBand = WalGetValidFreqsWithBand, - .GetHwCapability = WalGetHwCapability -}; - -/* MAC-layer APIs for station capabilities that need to be implemented by the driver */ -static struct HdfMac80211STAOps g_staOps = { - .Connect = WalConnect, - .Disconnect = WalDisconnect, - .StartScan = WalStartScan, - .AbortScan = WalAbortScan, - .SetScanningMacAddress = WalSetScanningMacAddress, -}; - -/* MAC-layer APIs for AP capabilities that need to be implemented by the driver */ -static struct HdfMac80211APOps g_apOps = { - .ConfigAp = WalConfigAp, - .StartAp = WalStartAp, - .StopAp = WalStopAp, - .ConfigBeacon = WalChangeBeacon, - .DelStation = WalDelStation, - .SetCountryCode = WalSetCountryCode, - .GetAssociatedStasCount = WalGetAssociatedStasCount, - .GetAssociatedStasInfo = WalGetAssociatedStasInfo -}; - -/* Initialize mac80211 and mount functions of the chip. */ -hi_void HiMac80211Init(struct HdfChipDriver *chipDriver) -{ - if (chipDriver == NULL) { - oam_error_log(0, OAM_SF_ANY, "%s:input is NULL!", __func__); - return; - } - chipDriver->ops = &g_baseOps; - chipDriver->staOps = &g_staOps; - chipDriver->apOps = &g_apOps; -} -``` - diff --git a/en/device-dev/driver/wlandevelopment-guidelines.md b/en/device-dev/driver/wlandevelopment-guidelines.md deleted file mode 100644 index 4b270cadbc9666221acce5343ce1079046f12b72..0000000000000000000000000000000000000000 --- a/en/device-dev/driver/wlandevelopment-guidelines.md +++ /dev/null @@ -1,18 +0,0 @@ -# WLAN Development Guidelines - -- [How to Develop](#section96091936185820) - -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\). - -## How to Develop - -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 the third part **[WLAN Development Example](wlandevelopment-example.md)**. 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. - diff --git a/en/device-dev/get-code/Readme-EN.md b/en/device-dev/get-code/Readme-EN.md index 5431040667db64eba5ec745df12217f96780f532..5f5dacc4a6cefdf06912a3046c6350a95ff40c5c 100644 --- a/en/device-dev/get-code/Readme-EN.md +++ b/en/device-dev/get-code/Readme-EN.md @@ -1,7 +1,7 @@ # Source Code Acquisition -- [Source Code Acquisition](source-code-acquisition.md) -- [Tool Acquisition](tool-acquisition.md) - - [Docker Environment](docker-environment.md) - - [IDE](ide.md) +- [Source Code Acquisition](sourcecode-acquire.md) +- [Tool Acquisition](gettools.md) + - [Docker Environment](gettools-acquire.md) + - [IDE](gettools-ide.md) diff --git a/en/device-dev/get-code/figures/3.png b/en/device-dev/get-code/figure/3-22.png similarity index 100% rename from en/device-dev/get-code/figures/3.png rename to en/device-dev/get-code/figure/3-22.png diff --git a/en/device-dev/get-code/figures/en-us_image_0000001101413884.png b/en/device-dev/get-code/figure/en-us_image_0000001101413884.png similarity index 100% rename from en/device-dev/get-code/figures/en-us_image_0000001101413884.png rename to en/device-dev/get-code/figure/en-us_image_0000001101413884.png diff --git a/en/device-dev/get-code/figures/en-us_image_0000001119755646.png b/en/device-dev/get-code/figure/en-us_image_0000001119755646.png similarity index 100% rename from en/device-dev/get-code/figures/en-us_image_0000001119755646.png rename to en/device-dev/get-code/figure/en-us_image_0000001119755646.png diff --git a/en/device-dev/get-code/figures/en-us_image_0000001119915556.png b/en/device-dev/get-code/figure/en-us_image_0000001119915556.png similarity index 100% rename from en/device-dev/get-code/figures/en-us_image_0000001119915556.png rename to en/device-dev/get-code/figure/en-us_image_0000001119915556.png diff --git a/en/device-dev/get-code/figures/en-us_image_0000001166715379.png b/en/device-dev/get-code/figure/en-us_image_0000001166715379.png similarity index 100% rename from en/device-dev/get-code/figures/en-us_image_0000001166715379.png rename to en/device-dev/get-code/figure/en-us_image_0000001166715379.png diff --git a/en/device-dev/get-code/docker-environment.md b/en/device-dev/get-code/gettools-acquire.md similarity index 96% rename from en/device-dev/get-code/docker-environment.md rename to en/device-dev/get-code/gettools-acquire.md index a9dce7ccc7baf0628c9485dccd4013e3c25a00d7..453cce21c04f24a2a64605a38e8f5f433ffe6994 100644 --- a/en/device-dev/get-code/docker-environment.md +++ b/en/device-dev/get-code/gettools-acquire.md @@ -74,9 +74,9 @@ OpenHarmony provides the following two types of Docker environments for you to q Before using the Docker environment, perform the following operations: 1. Install Docker. For details, see [Install Docker Engine](https://docs.docker.com/engine/install/). -2. Obtain the OpenHarmony source code. For details, see [Source Code Acquisition](source-code-acquisition.md). +2. Obtain the OpenHarmony source code. For details, see [Source Code Acquisition](sourcecode-acquire.md). - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >You do not need to obtain the source code for the HPM-based Docker environment. @@ -153,9 +153,9 @@ hb set **Figure 1** Setting page -![](figures/en-us_image_0000001101413884.png) +![](figure/en-us_image_0000001101413884.png) ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The mapping between the development board and the building GUI: >- Hi3861: wifiiot\_hispark\_pegasus@hisilicon >- Hi3516: ipcamera\_hispark\_taurus@hisilicon @@ -231,12 +231,12 @@ hb set Files generated during building are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >You can exit Docker by simply running the **exit** command. ## HPM-based Docker Environment -**docker\_dist** is a template component in the [HPM](https://hpm.harmonyos.com/#/en/home) system. It helps to quickly initialize an HPM project and use the Docker image to quickly build a distribution of OpenHarmony, greatly simplifying environment configurations needed for building. After configuring the Ubuntu and [hpm-cli](https://device.harmonyos.com/en/docs/develop/bundles/oem_bundle_guide_prepare-0000001050129846) development environments, perform the following steps to access the Docker environment: +**docker\_dist** is a template component in the [HPM](https://hpm.harmonyos.com/#/en/home) system. It helps to quickly initialize an HPM project and use the Docker image to quickly build a distribution of OpenHarmony, greatly simplifying environment configurations needed for building. After configuring the Ubuntu and [hpm-cli](../bundles/bundles-guide-prepare.md) development environments, perform the following steps to access the Docker environment: ### Setting Up the Docker Environment diff --git a/en/device-dev/get-code/ide.md b/en/device-dev/get-code/gettools-ide.md similarity index 98% rename from en/device-dev/get-code/ide.md rename to en/device-dev/get-code/gettools-ide.md index f3551de3126341e207afe450d509d8d37cc0979a..ec5de1cf9a48fb2b4039f55dbd702de396b4e2c0 100644 --- a/en/device-dev/get-code/ide.md +++ b/en/device-dev/get-code/gettools-ide.md @@ -9,7 +9,7 @@ HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE The roadmap of Huawei DevEco Device Tool for supporting OpenHarmony device development is shown in the figure below. -![](figures/3.png) +![](figure/3-22.png) ## Acquiring the Application Development Tool \(HUAWEI DevEco Studio\) diff --git a/en/device-dev/get-code/tool-acquisition.md b/en/device-dev/get-code/gettools.md similarity index 43% rename from en/device-dev/get-code/tool-acquisition.md rename to en/device-dev/get-code/gettools.md index dd1797b10426918c0921386817fb51c1b9e83a3b..95366cdb4c3f08c8783e132e5489b026622d262a 100644 --- a/en/device-dev/get-code/tool-acquisition.md +++ b/en/device-dev/get-code/gettools.md @@ -1,7 +1,7 @@ # Tool Acquisition -- **[Docker Environment](docker-environment.md)** +- **[Docker Environment](gettools-acquire.md)** -- **[IDE](ide.md)** +- **[IDE](gettools-ide.md)** diff --git a/en/device-dev/get-code/public_sys-resources/icon-caution.gif b/en/device-dev/get-code/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/get-code/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/get-code/public_sys-resources/icon-danger.gif b/en/device-dev/get-code/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/get-code/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/get-code/public_sys-resources/icon-note.gif b/en/device-dev/get-code/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/get-code/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/get-code/public_sys-resources/icon-notice.gif b/en/device-dev/get-code/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/get-code/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/get-code/public_sys-resources/icon-tip.gif b/en/device-dev/get-code/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/get-code/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/get-code/public_sys-resources/icon-warning.gif b/en/device-dev/get-code/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/get-code/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/get-code/source-code-acquisition.md b/en/device-dev/get-code/sourcecode-acquire.md similarity index 93% rename from en/device-dev/get-code/source-code-acquisition.md rename to en/device-dev/get-code/sourcecode-acquire.md index a7d68fe82d7e7b64663197b7d915710410e46069..5c95dbd6a744e6986f6e0e28e7bb38ed8dd685b4 100644 --- a/en/device-dev/get-code/source-code-acquisition.md +++ b/en/device-dev/get-code/sourcecode-acquire.md @@ -21,12 +21,12 @@ OpenHarmony is an open-source project launched by the OpenAtom Foundation. The p The open-source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com). ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >At present, OpenHarmony source code can only be compiled in the Linux environment. ## Overview of Source Code Acquisition -This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony code is open to you as [bundles](../bundles/overview.md), which can be obtained in any of the following ways: +This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony code is open to you as [bundles](../bundles/bundles-standard-rules.md), which can be obtained in any of the following ways: - **Method 1**: Acquire the source code from a code repository. You can use the **repo** or **git** tool to download the latest code from the code repository. - **Method 2**: Obtain the source code from the HarmonyOS Package Manager \(HPM\). Visit the [HPM](https://hpm.harmonyos.com/#/en/home) website, search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use **hpm-cli** to download and install the bundles and compilation toolchain on your local PC. @@ -40,9 +40,9 @@ This document describes how to acquire OpenHarmony source code and provides its - You have interconnected your software with OpenHarmony and need official certification from OpenHarmony. -- You want to contribute code to the OpenHarmony community after chips, modules, and applications are certified by OpenHarmony. +- You want to contribute code to the OpenHarmony community after obtaining official OpenHarmony certification for chips, modules, and applications. -- You need to address OpenHarmony issues. +- You need to rectify OpenHarmony issues. - You want to learn OpenHarmony source code. @@ -70,9 +70,9 @@ This document describes how to acquire OpenHarmony source code and provides its ### How to Use -**Obtaining the Source Code for Mini, Small, and Standard Systems \(2.0 Canary\)** +**Obtaining the Source Code for Mini/Small/Standard Systems \(2.0 Canary\)** ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >You can obtain the latest features from the master code, and develop commercial functionalities based on the release code, which is more stable. - **Obtaining OpenHarmony master code** @@ -96,7 +96,7 @@ This document describes how to acquire OpenHarmony source code and provides its - **Obtaining Latest OpenHarmony\_1.0.1\_release code** - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >Currently, only the source code for mini and small systems can be obtained through this release. Use the **repo** tool to download the release code. @@ -109,7 +109,7 @@ This document describes how to acquire OpenHarmony source code and provides its - Obtaining the source code of other OpenHarmony releases - For details about how to obtain the source code of other releases, see the [Release Notes](https://gitee.com/openharmony/docs/blob/master/en/release-notes/OpenHarmony-Release-Notes.md). + For details about how to obtain the source code of other OpenHarmony releases, see the [Release Notes](https://gitee.com/openharmony/docs/blob/master/en/release-notes/OpenHarmony-Release-Notes.md). ## Method 2: Acquiring Source Code from HPM @@ -160,7 +160,7 @@ You must install **Node.js** and HPM on your local PC. The installation proced **Figure 1** HPM page - ![](figures/en-us_image_0000001119915556.png) + ![](figure/en-us_image_0000001119915556.png) 2. Learn more about the distribution. @@ -172,7 +172,7 @@ You must install **Node.js** and HPM on your local PC. The installation proced **Figure 2** Example distribution - ![](figures/en-us_image_0000001119755646.png) + ![](figure/en-us_image_0000001119755646.png) 3. Customize bundles. 1. Access the **Custom solution** page, as shown in the following figure. @@ -183,7 +183,7 @@ You must install **Node.js** and HPM on your local PC. The installation proced **Figure 3** Customizing bundles - ![](figures/en-us_image_0000001166715379.png) + ![](figure/en-us_image_0000001166715379.png) 4. Download and install bundles. @@ -196,8 +196,8 @@ You must install **Node.js** and HPM on your local PC. The installation proced To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below. ->![](public_sys-resources/icon-note.gif) **NOTE:** ->- The table below provides only the sites for downloading the source code of the latest OpenHarmony Master and LTS versions. For details about earlier versions and how to obtain their source code, see the [Release Notes](https://gitee.com/openharmony/docs/tree/master/en/release-notes). +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>- The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes](https://gitee.com/openharmony/docs/tree/master/en/release-notes). >- The Master 1.0 version is no longer maintained. **Table 1** Sites for acquiring source code from image sites @@ -225,7 +225,7 @@ To ensure the download performance, you are advised to download the source code

1.1.1

Site

+

Download

Download

1.1.1

Download

+

Download

-

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

Full code (for standard systems)

2.0 Canary

Download (Site 1) Download (Site 2)

+

Download (Site 1) Download (Site 2)

Download

+

Download

Full code (for mini and small systems)

@@ -324,7 +324,7 @@ To ensure the download performance, you are advised to download the source code

Version Information

Site

+

Site

SHA-256 Verification Code

-

Site

+

Download

-

Configuration parameter file

+

Configuration file

/drivers/adapter/khdf/linux/hcs/platform/i2c_config.hcs

->![](public_sys-resources/icon-caution.gif) **CAUTION:** +>![](../public_sys-resources/icon-caution.gif) **CAUTION:** >The file paths involved in this example are used for demonstration only. Determine the paths for storing the source files as required when developing your driver. -## Instantiating the Driver Entry +### Instantiating the Driver Entry -The driver entry must be a global variable of the **HdfDriverEntry** type \(which is defined in **hdf\_device\_desc.h**\), and the value of **moduleName** must be the same as that in **device\_info.hcs**. When loading the driver, the HDF calls the **Bind** function first and then the **Init** function. If an error occurred during the calling of the **Init** function, the HDF calls **Release** to release the driver resource and exit. +Instantiate an **HdfDriverEntry** object as the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type \(which is defined in **hdf\_device\_desc.h**\), and the value of **moduleName** must be the same as that in **device\_info.hcs**. When loading the driver, the HDF calls the **Bind** function first and then the **Init** function. If an error occurred during the calling of the **Init** function, the HDF calls **Release** to release the driver resource and exit. The **Bind** function is not implemented in the I2C driver because the I2C controller is managed by the I2C manager and the **Bind** function has been implemented in the manager. Therefore, services do not need to be bound in the I2C driver. @@ -95,7 +128,9 @@ struct HdfDriverEntry g_sampleI2cDriverEntry = { HDF_INIT(g_sampleI2cDriverEntry); ``` -## Setting Related Parameters +### Setting Related Parameters + +Configure the **device\_info.hcs** file and obtain and parse device configuration parameters from the HCS to ensure that the driver can be correctly loaded. 1. \(Mandatory\) Add a device service node. @@ -109,8 +144,8 @@ HDF_INIT(g_sampleI2cDriverEntry); device2 :: deviceNode { // Device node of an I2C driver policy = 0; // Policy for releasing the driver service priority = 55; // Driver startup priority - permission = 0644; // Permission for the driver to create a device node. - moduleName = "demo_i2c_driver"; // Driver name. The value of this field must be the same as the value of moduleName in the driver entry data structure. + permission = 0644; // Permission for the driver to create a device node + moduleName = "demo_i2c_driver"; // Driver name. The value of this field must be the same as that of moduleName in the driver entry data structure. serviceName = "DEMO_I2C_DRIVER"; // Name of the service released by the driver. The name must be unique. deviceMatchAttr = "demo_i2c_config"; // Keyword matching the private data of the driver. The value must be the same as that of // match_attr in the private configuration data table of the driver. @@ -118,14 +153,15 @@ HDF_INIT(g_sampleI2cDriverEntry); } } } + ``` - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The **priority** attribute \(an integer ranging from 0 to 200\) in the configuration file indicates the priority of a host or drivers. Drivers in a host with a smaller priority value have a higher loading priority than those in other hosts. The driver with a smaller priority value in a host has a higher loading priority than the other drivers in the host. The loading sequence is random for drivers with the same priority. 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/driver-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: @@ -133,7 +169,7 @@ HDF_INIT(g_sampleI2cDriverEntry); root { platform { i2c_config_demo { - match_attr = "demo_i2c_config"; // The value of this field must be the same as the value of deviceMatchAttr in device_info.hcs. + match_attr = "demo_i2c_config"; // The value of this field must be the same as that of deviceMatchAttr in device_info.hcs. template i2c_controller { // Parameter template bus = 0; @@ -165,7 +201,7 @@ HDF_INIT(g_sampleI2cDriverEntry); 3. Enable the driver to obtain configuration parameters from the HCS. - In this example, the driver needs to obtain configuration parameters, such as the physical base address of the register, register size, and bus number, through the HCS to correctly configure the controller. + In this example, the driver needs to obtain configuration parameters, such as the physical base address of the register, register size, and bus number, from the HCS to correctly configure the controller. ``` /* Obtain configuration parameters from the HCS. */ @@ -203,7 +239,9 @@ HDF_INIT(g_sampleI2cDriverEntry); ``` -## Adding a Controller +### Adding a Controller + +Initialize the controller hardware, call core-layer APIs to add or delete devices to or from the core layer, and implement a hook. 1. Define an I2C controller structure, implement a hook, and assign the hook to the function pointer. @@ -228,7 +266,7 @@ HDF_INIT(g_sampleI2cDriverEntry); int16_t index; int16_t count; }; - /* Implement the SampleI2cTransfer hook. */ + /* Hook implementation */ static int32_t SampleI2cTransfer(struct I2cCntlr *cntlr, struct I2cMsg *msgs, int16_t count) { int32_t ret = HDF_SUCCESS; @@ -262,7 +300,7 @@ HDF_INIT(g_sampleI2cDriverEntry); 2. Write a driver initialization function. - This example uses **SampleI2cInit** as the name of the driver initialization function \(you can name your own function\). This function must be assigned to the **Init** function in the driver entry structure so that the HDF can call it to initialize the driver. The driver initialization function needs to parse the configuration parameters obtained from the HCS and create a controller based on these parameters. The sample code is as follows: + This example uses **SampleI2cInit** as the name of the driver initialization function \(this function name is configurable\). This function must be assigned to the **Init** function in the driver entry structure so that the HDF can call it to initialize the driver. The driver initialization function needs to parse the configuration parameters obtained from the HCS and create a controller based on these parameters. The sample code is as follows: ``` /* Parse parameters, apply for memory, and create a controller. */ @@ -393,3 +431,23 @@ HDF_INIT(g_sampleI2cDriverEntry); ``` +## Building Source Code and Burning Images + +1. Edit the Makefile and add a source file to it, as shown in the following example: + + ``` + include drivers/hdf/khdf/platform/platform.mk + + obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_core.o \ + $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_if.o \ + ./i2c_adapter.o \ + ./i2c_sample.o + ``` + + **./i2c\_sample.o** is the source file added to the Makefile in this example. + +2. Build source code and burn images to the development board. + + For details, see the related sections in [Getting Started for Standard System](../quick-start/quickstart-standard.md). + + diff --git a/en/device-dev/guide/photographing.md b/en/device-dev/guide/device-iotcamera-control-demo-photodevguide.md similarity index 99% rename from en/device-dev/guide/photographing.md rename to en/device-dev/guide/device-iotcamera-control-demo-photodevguide.md index a1617550bfbd2352e3bb1fc4739d93ed25f8fb78..a8da63373f6c284ee608836d504e38e5ee7c1569 100644 --- a/en/device-dev/guide/photographing.md +++ b/en/device-dev/guide/device-iotcamera-control-demo-photodevguide.md @@ -385,6 +385,7 @@ None Surface *surface = Surface::CreateSurface(); if (surface == nullptr) { delete fc; + return; } surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */ fc->AddSurface(*surface); diff --git a/en/device-dev/guide/video-recording.md b/en/device-dev/guide/device-iotcamera-control-demo-videodevguide.md similarity index 100% rename from en/device-dev/guide/video-recording.md rename to en/device-dev/guide/device-iotcamera-control-demo-videodevguide.md diff --git a/en/device-dev/guide/development-guidelines.md b/en/device-dev/guide/device-iotcamera-control-demo.md similarity index 32% rename from en/device-dev/guide/development-guidelines.md rename to en/device-dev/guide/device-iotcamera-control-demo.md index fd34356bfaf087978ff851847b5339180b529037..6f187156291b9c813d199060c055e0d205e295db 100644 --- a/en/device-dev/guide/development-guidelines.md +++ b/en/device-dev/guide/device-iotcamera-control-demo.md @@ -1,7 +1,7 @@ # Development Guidelines -- **[Photographing](photographing.md)** +- **[Photographing](device-iotcamera-control-demo-photodevguide.md)** -- **[Video Recording](video-recording.md)** +- **[Video Recording](device-iotcamera-control-demo-videodevguide.md)** diff --git a/en/device-dev/guide/use-case.md b/en/device-dev/guide/device-iotcamera-control-example.md similarity index 71% rename from en/device-dev/guide/use-case.md rename to en/device-dev/guide/device-iotcamera-control-example.md index 274e2d375df15cf35285544f1c48c37f6b8e3c94..bb9875ea20896e4319e8124befa33a74a6c3f280 100644 --- a/en/device-dev/guide/use-case.md +++ b/en/device-dev/guide/device-iotcamera-control-example.md @@ -1,6 +1,6 @@ # Use Case -- For details about the development board, compilation, burning, and image running, see [Getting Started with Hi3518](../quick-start/hi3518-development-board.md). A compilation result file of sample code is stored in **out/ipcamera\_hi3518ev300/dev\_tools/bin/camera\_sample**. You can copy the file to a TF card, or modify the compilation script of **camera\_sample** to copy the result to **rootfs.img**. +- For details about the development board, compilation, burning, and image running, see [Hi3518 Development Board](../quick-start/quickstart-lite-introduction-hi3518.md#section14815247616). A compilation result file of sample code is stored in **out/ipcamera\_hi3518ev300/dev\_tools/bin/camera\_sample**. You can copy the file to a TF card, or modify the compilation script of **camera\_sample** to copy the result to **rootfs.img**. Modify **output\_dir** in **applications/sample/camera/media/BUILD.gn**. @@ -11,35 +11,35 @@ - The sample code for camera development is stored in **applications/sample/camera/media/camera\_sample.cpp**. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >You should insert a TF card \(maximum capacity: 128 GB\) for photographing and video recording functions. After the system is started, the TF card is automatically mounted to the **/sdcard** directory. If the TF card is inserted after the system is started, you have to manually mount the TF card. To view the photos and videos in the TF card, copy the content to a computer. The preview function does not require a TF card. 1. Run the **cd** command to go to the end path of the executable program and start **camera\_sample** by running the command in the following figure. **Figure 1** Starting camera\_sample - ![](figures/starting-camera_sample.png "starting-camera_sample") + ![](figure/starting-camera_sample.png "starting-camera_sample") The control commands are displayed as shown in the preceding figure. Press **S** to stop the current operation \(including video recording and preview\), and press **Q** to exit the program. 2. Press **1** to take a photo in JPG format. The photo is saved in the **/sdcard** directory and named **Capture\***. **Figure 2** Serial port logs displayed after the photographing command is executed - ![](figures/serial-port-logs-displayed-after-the-photographing-command-is-executed.png "serial-port-logs-displayed-after-the-photographing-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-photographing-command-is-executed.png "serial-port-logs-displayed-after-the-photographing-command-is-executed") To view the saved file, exit the program and enter the file system. To start the program again, return to the previous step. **Figure 3** Saved files - ![](figures/saved-files.png "saved-files") + ![](figure/saved-files.png "saved-files") 3. Press **2** to start recording. The video file is in MP4 format and saved in the **/sdcard** directory with the name **Record\***. Press **S** to stop recording. **Figure 4** Serial port logs displayed after the recording command is executed - ![](figures/serial-port-logs-displayed-after-the-recording-command-is-executed.png "serial-port-logs-displayed-after-the-recording-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-recording-command-is-executed.png "serial-port-logs-displayed-after-the-recording-command-is-executed") 4. Press **Q** to exit. **Figure 5** Serial port logs displayed after the exit command is executed - ![](figures/serial-port-logs-displayed-after-the-exit-command-is-executed.png "serial-port-logs-displayed-after-the-exit-command-is-executed") + ![](figure/serial-port-logs-displayed-after-the-exit-command-is-executed.png "serial-port-logs-displayed-after-the-exit-command-is-executed") diff --git a/en/device-dev/guide/overview-0.md b/en/device-dev/guide/device-iotcamera-control-overview.md similarity index 37% rename from en/device-dev/guide/overview-0.md rename to en/device-dev/guide/device-iotcamera-control-overview.md index 39a2eba2ffd3e70fa55b95840b2ff05f0893243c..d5a493f3a209e1fd4dc4deb2b2c195956bcac273 100644 --- a/en/device-dev/guide/overview-0.md +++ b/en/device-dev/guide/device-iotcamera-control-overview.md @@ -2,9 +2,9 @@ This document describes how to use the IoT camera development board and the built-in camera of the development kit to implement photographing and video recording. -You can perform operations provided in [Use Case](use-case.md) to learn more about development board peripheral control and then develop devices such as cameras. +You can perform operations provided in [Use Case](device-iotcamera-control-example.md) to learn more about development board peripheral control and then develop devices such as cameras. -If you want to view the sample effect first, see [Use Case](use-case.md). To customize application behavior, modify the sample code by referring to APIs described in the next section. +If you want to view the sample effect first, see [Use Case](device-iotcamera-control-example.md). To customize application behavior, modify the sample code by referring to APIs described in the next section. -For details about basic concepts for camera development, see the [camera development overview](../subsystems/overview.md). +For details about basic concepts for camera development, see the [camera development overview](../subsystems/subsys-multimedia-camera-overview.md). diff --git a/en/device-dev/guide/device-iotcamera-control.md b/en/device-dev/guide/device-iotcamera-control.md new file mode 100644 index 0000000000000000000000000000000000000000..f2720769bb74584a87e538a45093ee13bfb95869 --- /dev/null +++ b/en/device-dev/guide/device-iotcamera-control.md @@ -0,0 +1,9 @@ +# Camera Control + +- **[Overview](device-iotcamera-control-overview.md)** + +- **[Development Guidelines](device-iotcamera-control-demo.md)** + +- **[Use Case](device-iotcamera-control-example.md)** + + diff --git a/en/device-dev/guide/cameras-without-a-screen.md b/en/device-dev/guide/device-iotcamera.md similarity index 56% rename from en/device-dev/guide/cameras-without-a-screen.md rename to en/device-dev/guide/device-iotcamera.md index abb3a6616a0364c5ca1d5e19a48fa040c798c2bc..7cbb7f06d6d084d8c3876d78b30514b95cc7b948 100644 --- a/en/device-dev/guide/cameras-without-a-screen.md +++ b/en/device-dev/guide/device-iotcamera.md @@ -1,5 +1,5 @@ # Cameras Without a Screen -- **[Camera Control](camera-control.md)** +- **[Camera Control](device-iotcamera-control.md)** diff --git a/en/device-dev/guide/device-outerdriver-demo.md b/en/device-dev/guide/device-outerdriver-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..6ac02acd6475a8fd1e8ba6a7d20c421ad2b7351d --- /dev/null +++ b/en/device-dev/guide/device-outerdriver-demo.md @@ -0,0 +1,483 @@ +# Development Example for Peripheral Drivers + +- [Overview](#section86753818426) + - [Hardware Resources](#section123071189431) + - [Input Driver Model](#section53684425430) + +- [Setting Up the Environment](#section661075474418) +- [Developing a Touchscreen Driver](#section15233162984520) + - [Configuring Device Driver Descriptions](#section16761205604515) + - [Configuring the Touchscreen](#section156331030144617) + - [Adapting to the Private Drivers of the Touchscreen](#section17127331595) + +- [Building Source Code and Burning Images](#section16465031164711) +- [Debugging and Verification](#section62577313482) +- [Input Driver Model Workflow Analysis](#section1578569154917) + - [Parsing Private Configuration Data](#section1310113815495) + - [Initializing the Input Device Manager and Registering the Driver with the HDF](#section614512119500) + - [Initializing the Input Common Driver and Registering the Driver with the HDF](#section16194201755019) + - [Initializing the Input Chip Driver and Registering the Driver with the HDF](#section1090743312505) + - [Function Invocation Logic](#section81801147529) + + +## Overview + +This document describes how to develop a touchscreen driver on the Hi3516D V300 development board using the HDF input driver model, helping you quickly get started with peripheral driver development. + +### Hardware Resources + +The touchscreen integrated circuit \(IC\) provided by the Hi3516D V300 development board is GT911, which uses the standard inter-integrated circuit \(I2C\) to communicate with the development board and connects to the main board through the 6-pin flexible flat cable. The following figure shows the distribution of the 6 pins and their connection. + +![](figure/绘图1.png) + +### Input Driver Model + +The input driver model mainly consists of the device manager, common drivers, and chip drivers. + +- Input device manager: provides various input device drivers with the APIs for registering or unregistering input devices and manages the input device list. +- Input common driver: provides common drivers for initializing the board-level hardware, processing hardware interrupts, and registering input devices with the input device manager. +- Input chip driver: calls differentiated APIs reserved by the input platform driver to minimize the workload for input chip driver development. + +In addition, the input driver model implements functions for reporting input data and parsing input device configurations. + +For details about the input driver model, see [Touchscreen Overview](../driver/drive-peripherals-touch-des.md#section175431838101617). + +## Setting Up the Environment + +Follow the instructions in [Environment Setup for Standard System](../quick-start/quickstart-standard.md). + +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** +>This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment. + +## Developing a Touchscreen Driver + +Complete the following tasks to adapt a touchscreen IC based on the input driver model. + +### Configuring Device Driver Descriptions + +Configure the touchscreen driver description required for registering the driver with the HDF, for example, whether the driver is loaded and what is the loading priority. + +You can configure the device driver description in the configuration file at **./drivers/adapter/khdf/linux/hcs/device\_info/device\_info.hcs**. + +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/driver-hdf-development.md). + +``` +input :: host { + hostName = "input_host"; + priority = 100; + device_input_manager :: device { // Specify the device driver description of the input device manager. + device0 :: deviceNode { + policy = 2; // Services are released to both the kernel space and the user space. + priority = 100; // The default priority for the input device manager is 100. + preload = 0; // Load the driver. + permission = 0660; // Specify the permission for the driver to create device nodes. + moduleName = "HDF_INPUT_MANAGER"; // Match the moduleName in the driver entry structure. + serviceName = "hdf_input_host"; // Specify the device node name to be generated by the HDF. + deviceMatchAttr = ""; // Leave this field empty because private configuration data is not required by the input device manager currently. + } + } + + device_hdf_touch :: device { // Specify the device driver description of the input common driver. + device0 :: deviceNode { + policy = 2; // Services are released to both the kernel space and the user space. + priority = 120; // The default priority for the input common driver is 120. + preload = 0; // Load the driver. + permission = 0660; // Specify the permission for the driver to create device nodes. + moduleName = "HDF_TOUCH"; // Match the moduleName in the driver entry structure. + serviceName = "hdf_input_event1"; // Specify the device node name to be generated by the HDF. + deviceMatchAttr = "touch_device1"; // Keep this value the same as the match_attr value in the private configuration data. + } + } + + device_touch_chip :: device { // Specify the device description of the input chip driver. + device0 :: deviceNode { + policy = 0; // Services are not released to the kernel space or the user space. + priority = 130; // The default priority for the input chip driver is 130. + preload = 0; // Load the driver. + permission = 0660; // Specify the permission for the driver to create device nodes. + moduleName = "HDF_TOUCH_GT911"; // Match the moduleName in the driver entry structure. + serviceName = "hdf_touch_gt911_service";// Specify the device node name to be generated by the HDF. + deviceMatchAttr = "zsj_gt911_5p5"; // Keep this value the same as the match_attr value in the private configuration data. + } + } + } +``` + +Pay attention to the following fields in the configuration file: + +**priority**: specifies the driver loading priority. + +**preload**: specifies whether to load the driver. + +**moduleName**: This value must be the same as the **moduleName** value in the driver entry structure. + +**serviceName**: This value is used by the HDF to create a device node name. + +**deviceMatchAttr**: This value must be the same as the **match\_attr** value in the private configuration data. + +After the device descriptions are configured, the HDF matches the configuration with the code registered with the driver entry structure based on the **moduleName** field, ensuring that drivers can be loaded properly. If multiple drivers are configured, the **priority** field determines the loading sequence of each driver. + +### Configuring the Touchscreen + +The private data includes the power-on and power-off sequence, and the platform hardware information includes the GPIO port that connects the touchscreen to the main board. + +You can configure the touchscreen in the configuration file at **./drivers/adapter/khdf/linux/hcs/input/input\_config.hcs**. + +The **input\_config.hcs** file consists of the private configuration data of both the common driver and chip driver. Information of this file is read and parsed by the driver code. The configuration in the file includes the board-level hardware information and private configuration of the touchscreen. You can tailor the configuration during your development. + +``` +root { + input_config { + touchConfig { + touch0 { // Configure the first touchscreen. + boardConfig { // Specify the board-level hardware information. + match_attr = "touch_device1"; // Keep this value the same as the match_attr field in the private configuration data of the input common driver in the device description. + inputAttr { + /* 0:touch 1:key 2:keyboard 3:mouse 4:button 5:crown 6:encoder */ + inputType = 0; // Set the input type to touch. + solutionX = 480; // Set the resolution in the X-axis. + solutionY = 960; // Set the resolution in the Y-axis. + devName = "main_touch"; // Set the device name. + } + busConfig { + /* 0:i2c 1:spi */ + busType = 0; // GT911 uses the I2C bus for communication. + busNum = 6; // Use the sixth bus of the chip to communicate with the development board through I2C. + clkGpio = 86; // Set the SCL pin of the chip. + dataGpio = 87; // Set the SDA pin of the chip. + i2cClkIomux = [0x114f0048, 0x403]; // Configure the SCL pin information. + i2cDataIomux = [0x114f004c, 0x403]; // Configure the SDA pin information. + } + pinConfig { + rstGpio = 3; // Set the reset pin. + intGpio = 4; // Set the interrupt pin. + rstRegCfg = [0x112f0094, 0x400]; // Configure the reset pin information. + intRegCfg = [0x112f0098, 0x400]; // Configure the interrupt pin information. + } + powerConfig { + /* 0:unused 1:ldo 2:gpio 3:pmic */ + vccType = 2; // Set the VCC type. Value 2 indicates the GPIO power supply. + vccNum = 20; // gpio20 + vccValue = 1800; // Set the voltage amplitude to 1800 mV. + vciType = 1; // Set the VCI type. Value 1 indicates the LDO power supply. + vciNum = 12; // ldo12 + vciValue = 3300; // Set the voltage amplitude to 3300 mV. + } + + featureConfig { + capacitanceTest = 0; // Configure the capacitance test. + gestureMode = 0; // Configure the gesture mode. + gloverMode = 0; // Configure the gloves mode. + coverMode = 0; // Configure the cover mode. + chargerMode = 0; // Configure the charging mode. + knuckleMode = 0; // Configure the knuckle mode. + } + } + chipConfig { // Configure the private data of the touchscreen chip. + template touchChip { // Set the template. + match_attr = ""; + chipName = "gt911"; // Set the touchscreen IC model. + vendorName = "zsj"; // Set the vendor name. + chipInfo = "AAAA11222"; // The first four characters indicate the product name. The fifth and sixth characters indicate the IC model. The last three characters indicate the chip model. + busType = 0; // 0 indicates the I2C bus, and 1 indicates the SPI bus. + deviceAddr = 0x5D; // Set the IC communication address. + irqFlag = 2; // Values 1 and 2 indicate that the interrupt is triggered on the rising and falling edges, respectively. Values 4 and 8 indicate that the interrupt is triggered by the high and low levels, respectively. + maxSpeed = 400; // Set the maximum communication rate to 400 Hz. + chipVersion = 0; // Set the touchscreen IC version. + powerSequence { + /* Power-on sequence is described as follows: + [Type, status, direction, delay] + Value 0 indicates the power or pin is empty. Values 1 and 2 indicate the VCC (1.8 V) and VCI (3.3 V) power, respectively. Values 3 and 4 indicate the reset and interrupt pins, respectively. + Values 0 and 1 indicate the power-off or pull-down, and the power-on or pull-up, respectively. Value 2 indicates that no operation is performed. + Values 0 and 1 indicate the input and output directions, respectively. Value 2 indicates that no operation is performed. + Delay time, in milliseconds. + */ + powerOnSeq = [4, 0, 1, 0, // Set the output direction for the interrupt pin and pull down the pin. + 3, 0, 1, 10, // Set the output direction for the reset pin and pull down the pin, with a delay of 10 ms. + 3, 1, 2, 60, // No operation is performed on the reset pin. Pull up the pin, with a delay of 60 ms. + 4, 2, 0, 0]; // Set the input direction for the interrupt pin. + suspendSeq = [3, 0, 2, 10]; // No operation is performed on the reset pin. Pull down the pin, with a delay of 10 ms. + resumeSeq = [3, 1, 2, 10]; // No operation is performed on the reset pin. Pull up the pin, with a delay of 10 ms. + powerOffSeq = [3, 0, 2, 10, // No operation is performed on the reset pin. Pull down the pin, with a delay of 10 ms. + 1, 0, 2, 20]; // No operation is performed on the positive pin. Pull down the pin, with a delay of 20 ms. + } + } + + chip0 :: touchChip { + match_attr = "zsj_gt911_5p5"; // Keep this value the same as the match_attr field in the touchscreen private configuration data in the device description. + chipInfo = "ZIDN45100"; // The chip information is composed of the product name, module number, and chip number, used to identity the current touchscreen in user space. + chipVersion = 0; // Set the IC model version. + } + } + } + } + } +} +``` + +In the example, **touchConfig** contains the **touch0** configuration, which describes the **boardConfig** and **chipConfig** configuration information. The **boardConfig** field provides the board-level hardware information of Hi3516D V300, and the **chipConfig** field provides the private configuration data of the touchscreen. To use another touchscreen, you can change the value of the **chipConfig** field. You can also configure multiple touchscreens for your product. In this example, **touch0** represents the hardware interface and chip configuration of the default touchscreen. If you need to configure a secondary touchscreen, add a **touch1** block parallel to **touch0**. + +### Adapting to the Private Drivers of the Touchscreen + +The input driver model abstracts the development process of input devices. You only need to adapt to the input chip driver without making any modifications for the input device manager and common driver. + +The input driver model consists of three parts of drivers. To develop a brand-new touchscreen driver, you only need to adapt your code with the input chip driver and implement differentiated APIs. The sample code in this section illustrates how you will complete the adaptation. + +1. Implement differentiated APIs for the touchscreen to adapt to the input chip driver. + + You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**. + + ``` + static struct TouchChipOps g_gt911ChipOps = { // IC options of the touchscreen + .Init = ChipInit, // Initialize the chip. + .Detect = ChipDetect, // Detect the chip. + .Resume = ChipResume, // Resume the chip. + .Suspend = ChipSuspend, // Suspend the chip. + .DataHandle = ChipDataHandle, // Read the chip data. + .UpdateFirmware = UpdateFirmware, // Update the firmware. + }; + + /* The ICs may be different depending on the touchscreen vendors, and the corresponding register operations are also different. Therefore, the code for the input chip driver focuses only on the adaptation of differentiated APIs. The following sample code demonstrates the data parsing of GT911. */ + + static int32_t ChipDataHandle(ChipDevice *device) + { + ... + /* Read the status register before GT911 obtains coordinates. */ + reg[0] = (GT_BUF_STATE_ADDR >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; + reg[1] = GT_BUF_STATE_ADDR & ONE_BYTE_MASK; + ret = InputI2cRead(i2cClient, reg, GT_ADDR_LEN, &touchStatus, 1); + if (ret < 0 || touchStatus == GT_EVENT_INVALID) { + return HDF_FAILURE; + } + ... + /* Read data from the data register based on the value of the status register. */ + reg[0] = (GT_X_LOW_BYTE_BASE >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; + reg[1] = GT_X_LOW_BYTE_BASE & ONE_BYTE_MASK; + pointNum = touchStatus & GT_FINGER_NUM_MASK; + if (pointNum == 0 || pointNum > MAX_SUPPORT_POINT) { + HDF_LOGE("%s: pointNum is invalid, %u", __func__, pointNum); + (void)ChipCleanBuffer(i2cClient); + OsalMutexUnlock(&device->driver->mutex); + return HDF_FAILURE; + } + frame->realPointNum = pointNum; + frame->definedEvent = TOUCH_DOWN; + (void)InputI2cRead(i2cClient, reg, GT_ADDR_LEN, buf, GT_POINT_SIZE * pointNum); + /* Parse the obtained data. */ + ParsePointData(device, frame, buf, pointNum); + ... + } + static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, uint8_t pointNum) + { + ... + /* Each coordinate value consists of two bytes. Obtain the final coordinate value by combining the obtained single-byte data. */ + for (i = 0; i < pointNum; i++) { + frame->fingers[i].trackId = buf[GT_POINT_SIZE * i + GT_TRACK_ID]; + frame->fingers[i].y = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | + ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); + frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | + ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); + /* Print the parsed coordinate value. */ + HDF_LOGD("%s: x = %d, y = %d", __func__, frame->fingers[i].x, frame->fingers[i].y); + } + } + ``` + +2. Initialize the input chip driver and register the driver with the HDF. + + You can obtain the sample code at **./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c**. + + ``` + static int32_t HdfGoodixChipInit(struct HdfDeviceObject *device) + { + ... + /* Use the chipCfg structure to allocate memory, parse the configuration information, and mount the parsed data. */ + chipCfg = ChipConfigInstance(device); + ... + /* Instantiate the touchscreen device. */ + chipDev = ChipDeviceInstance(); + ... + /* Mount touchscreen chip configuration and private operation data. */ + chipDev->chipCfg = chipCfg; + chipDev->ops = &g_gt911ChipOps; + ... + /* Register the chip driver with the platform driver. */ + RegisterChipDevice(chipDev); + ... + } + struct HdfDriverEntry g_touchGoodixChipEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH_GT911", // The value must match the moduleName field of the chip driver in the device_info.hcs file. + .Init = HdfGoodixChipInit, // Initialize the touchscreen chip driver. + }; + HDF_INIT(g_touchGoodixChipEntry); // Register the touchscreen chip driver with the HDF. + ``` + + The private chip drivers present the major differentiations among chip vendors, such as hibernation and wakeup, data parsing, and firmware update. + + Now, you have completed the adaptation for the touchscreen driver based on the HDF and input driver model. + + +## Building Source Code and Burning Images + +1. Compile the Makefile. + + Open the file at **./drivers/adapter/khdf/linux/model/input/Makefile**. + + Add the following content: + + ``` + obj-$(CONFIG_DRIVERS_HDF_TP_5P5_GT911) += \ + $(INPUT_ROOT_DIR)/touchscreen/touch_gt911.o + ``` + + **touch\_gt911.o** is the content added in this example. + +2. Build source code and burn images. For details, see the related sections in [Getting Started for Standard System](../nottoctopics/en-us_topic_0000001135402541.md#section375234715135). + +## Debugging and Verification + +The following is part of the startup log: + +``` +[I/HDF_INPUT_DRV] HdfInputManagerInit: enter // Initialize the input device manager. +[I/HDF_INPUT_DRV] HdfInputManagerInit: exit succ // The initialization is successful. +[I/osal_cdev] add cdev hdf_input_host success +[I/HDF_LOG_TAG] HdfTouchDriverProbe: enter // Initialize the input common driver. +[I/HDF_LOG_TAG] HdfTouchDriverProbe: main_touch exit succ // The initialization is successful. +[I/osal_cdev] add cdev hdf_input_event1 success +[I/HDF_INPUT_DRV] HdfGoodixChipInit: enter // Initialize the input chip driver. +[I/HDF_INPUT_DRV] ChipDetect: IC FW version is 0x1060 +[I/HDF_INPUT_DRV] Product_ID: 911_1060, x_sol = 960, y_sol = 480 +[I/HDF_LOG_TAG] ChipDriverInit: chipDetect succ, ret = 0 +[I/HDF_LOG_TAG] InputDeviceInstance: inputDev->devName = main_touch +[I/HDF_INPUT_DRV] HdfGoodixChipInit: exit succ, chipName = gt911 // The initialization is successful. +``` + +## Input Driver Model Workflow Analysis + +To help you get familiarized with the working process of the input driver model, the following sections will describe the key code loaded by the input driver model. + +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** +>You do not need to perform development related to the input driver model. + +### Parsing Private Configuration Data + +You can obtain the sample code at **./drivers/framework/model/input/driver/input\_config\_parser.c**. + +The configuration parsing functions provided by the OSAL can parse the fields in the **hcs** file. For details, see the implementation of each function in **input\_config\_parser.c**. If the provided template cannot meet business requirements, add required information to the **hcs** file and then develop parsing functions based on the added fields. + +``` +static int32_t ParseAttr(struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode, BoardAttrCfg *attr) +{ + int32_t ret; + ret = parser->GetUint8(attrNode, "inputType", &attr->devType, 0); // Obtain the inputType field and save it in the BoardAttrCfg structure. + CHECK_PARSER_RET(ret, "GetUint8"); + ... + return HDF_SUCCESS; +} +``` + +### Initializing the Input Device Manager and Registering the Driver with the HDF + +You can obtain the sample code at **./drivers/framework/model/input/driver/hdf\_input\_device\_manager.c**. + +``` +static int32_t HdfInputManagerInit(struct HdfDeviceObject *device) +{ + /* Allocate memory to the device manager, which will store all input devices. */ + g_inputManager = InputManagerInstance(); + ... +} +struct HdfDriverEntry g_hdfInputEntry = { + .moduleVersion = 1, + .moduleName = "HDF_INPUT_MANAGER", + .Bind = HdfInputManagerBind, + .Init = HdfInputManagerInit, + .Release = HdfInputManagerRelease, +}; + +HDF_INIT(g_hdfInputEntry); // Driver input entry +``` + +### Initializing the Input Common Driver and Registering the Driver with the HDF + +You can obtain the sample code at **./drivers/framework/model/input/driver/hdf\_touch.c**. + +``` +static int32_t HdfTouchDriverProbe(struct HdfDeviceObject *device) +{ + ... + /* Use the boardCfg structure to allocate memory and parse the configuration information obtained from the HCS. */ + boardCfg = BoardConfigInstance(device); + ... + /* Allocate memory in the touchDriver structure. */ + touchDriver = TouchDriverInstance(); + ... + /* Initialize common resources based on the parsed board-level information, such as IIC initialization. */ + ret = TouchDriverInit(touchDriver, boardCfg); + if (ret == HDF_SUCCESS) { + ... + /* Add the driver to the common driver management linked list, which is used to query the driver after it is bound to the device. */ + AddTouchDriver(touchDriver); + ... + } + ... +} +struct HdfDriverEntry g_hdfTouchEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH", + .Bind = HdfTouchDriverBind, + .Init = HdfTouchDriverProbe, + .Release = HdfTouchDriverRelease, +}; + + HDF_INIT(g_hdfTouchEntry); // Driver input entry +``` + +### Initializing the Input Chip Driver and Registering the Driver with the HDF + +For details, see related content in [Adapting to the Private Drivers of the Touchscreen](#section17127331595). + +### Function Invocation Logic + +The init function of the input device manager initializes the device management linked list, and the init function of the common driver allocates memory for related structures. The **RegisterChipDevice** function passes touchscreen chip driver information to the related structures of the input common driver and initializes hardware information \(for example, interrupt registration\). The **RegisterInputDevice** function registers **inputDev** \(binding the device and the driver\) with the device manager. The **RegisterInputDevice** function adds **inputDev** to the device management linked list. The function implementation is as follows: + +``` +// Code location: ./drivers/framework/model/input/driver/hdf_touch.c +int32_t RegisterChipDevice(ChipDevice *chipDev) +{ + ... + /* Bind the device to the driver and create an inputDev instance using InputDeviceInstance. */ + DeviceBindDriver(chipDev); + ... + /* Implement the interrupt registration and interrupt handling functions. The interrupt handling function contains the channel for reporting data to the user space. */ + ChipDriverInit(chipDev); + ... + /* Allocate memory for instantiating inputDev. */ + inputDev = InputDeviceInstance(chipDev); + ... + /* Register inputDev with the input device manager. */ + RegisterInputDevice(inputDev); + ... +} + +// Code location: ./drivers/framework/model/input/driver/hdf_input_device_manager.c +int32_t RegisterInputDevice(InputDevice *inputDev) +{ + ... + /* Allocate a device ID, which is unique for each input device. */ + ret = AllocDeviceID(inputDev); + ... + /* This function contains special processing for hid devices but does nothing for the touchscreen driver. */ + CreateDeviceNode(inputDev); + /* Apply for the buffer for the IOService capability, which is required to transmit kernel-space data to the user space. */ + AllocPackageBuffer(inputDev); + /* Add the input device to the global device management linked list. */ + AddInputDevice(inputDev); + ... +} +``` + diff --git a/en/device-dev/guide/development.md b/en/device-dev/guide/device-wifi-led-outcontrol.md similarity index 61% rename from en/device-dev/guide/development.md rename to en/device-dev/guide/device-wifi-led-outcontrol.md index c02ffef834486c29a0693ab8ad4074b77f52462a..af9d86a4d2b7b3b514e02d41b2e0949fc386cc50 100644 --- a/en/device-dev/guide/development.md +++ b/en/device-dev/guide/device-wifi-led-outcontrol.md @@ -1,16 +1,26 @@ -# Development +# LED Peripheral Control -1. Complete the operations described in [Getting Started with Hi3861](../quick-start/hi3861-development-board.md). +- [Overview](#section14639174516337) +- [Development](#section13857170163412) +- [Verification](#section1949121910344) + +## Overview + +Based on the Hi3861 platform, the OpenHarmony WLAN module provides abundant peripheral operation capabilities, including the I2C, I2S, ADC, UART, SPI, SDIO, GPIO, PWM, and flash memory. This document describes how to control GPIO pins by calling the OpenHarmony native development kit \(NDK\) interface to implement LED blinking. For details about how to control other IoT peripherals, see the API guide. + +## Development + +1. Complete the operations described in [Getting Started with Hi3861](../quick-start/quickstart-lite-introduction-hi3861.md#section19352114194115). LED control examples are stored in the file **applications/sample/wifi-iot/app/iothardware/led\_example.c**. -2. Refer to the schematic diagram to understand the cable connections. The LED of Hispark Pegasus should be connected to pin 9. +2. Understand the cable connections by referring to the schematic diagram. You can learn that LED of hispark pegasus is connected to pin 9 of the chip. ``` #define LED_TEST_GPIO 9 ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >For details about the schematic diagram of the development board, contact the Hi3861 customer service personnel. 3. Initialize the GPIO pin, specify the pin usage, and create a task to turn on or off the LED periodically so that the LED blinks. @@ -89,3 +99,12 @@ ``` +## Verification + +For details about the compilation and burning processes, see [Building Source Code](../quick-start/quickstart-lite-steps-board3861-connection.md#section191121332125319) and [Burning Images](../quick-start/quickstart-lite-steps-board3861-connection.md#section19458165166) in the _Getting Started with Hi3861_. + +After the preceding two steps are complete, press the **RST** button to reset the module. If the LED blinks periodically as expected, the verification is passed. + +**Figure 1** LED blinking +![](figure/led-blinking.gif "led-blinking") + diff --git a/en/device-dev/guide/third-party-sdk-integration.md b/en/device-dev/guide/device-wifi-sdk.md similarity index 99% rename from en/device-dev/guide/third-party-sdk-integration.md rename to en/device-dev/guide/device-wifi-sdk.md index db6388833d5fc135ad5dc7dd8f9109f9c57d139b..dee530d9b864c0a98ddcde0288576294c69769f5 100644 --- a/en/device-dev/guide/third-party-sdk-integration.md +++ b/en/device-dev/guide/device-wifi-sdk.md @@ -121,7 +121,7 @@ Before building **libs**, you must perform the following steps: After the preceding operations are complete, run the **hb build -T //domains/iot/link:iot** command in the root directory of the code and then check whether the target library file is generated in the **out/hispark\_pegasus/wifiiot\_hispark\_pegasus/libs/** directory. -![](figures/en-us_image_0000001078563230.png) +![](figure/en-us_image_0000001078563230.png) Copy the library file to the **device/hisilicon/hispark\_pegasus/sdk\_liteos/3rd\_sdk/demolink/libs/** directory and delete the **.c** and **.h** files from the **domains/iot/link/libbuild/** directory. @@ -144,7 +144,7 @@ The APIs used in the platform SDK are different from the OpenHarmony APIs and ca /* * Create a thread for the IoT OS. - * Return 0 if the operation is successful; return a non-zero value otherwise. + * Returns 0 if the operation is successful; returns a non-zero value otherwise. */ int DemoSdkCreateTask(unsigned int *handle, const struct TaskPara *para); ``` diff --git a/en/device-dev/guide/wlan-connected-products.md b/en/device-dev/guide/device-wifi.md similarity index 36% rename from en/device-dev/guide/wlan-connected-products.md rename to en/device-dev/guide/device-wifi.md index 184f46eb0e144c6d086c2b35264557825fe5bb8e..73a5fc8cae7ea60dd1612b47fe8f8352688876db 100644 --- a/en/device-dev/guide/wlan-connected-products.md +++ b/en/device-dev/guide/device-wifi.md @@ -1,5 +1,7 @@ # WLAN-connected Products -- **[LED Peripheral Control](led-peripheral-control.md)** +- **[LED Peripheral Control](device-wifi-led-outcontrol.md)** + +- **[Third-Party SDK Integration](device-wifi-sdk.md)** diff --git a/en/device-dev/guide/device.md b/en/device-dev/guide/device.md new file mode 100644 index 0000000000000000000000000000000000000000..bbce9d52a9d027aed593e2dbe2e7d7ad69a95405 --- /dev/null +++ b/en/device-dev/guide/device.md @@ -0,0 +1,15 @@ +# Device Development Guidelines + +- **[WLAN-connected Products](device-wifi.md)** + +- **[Cameras Without a Screen](device-iotcamera.md)** + +- **[Cameras with a Screen](device-camera.md)** + +- **[Development Guidelines on Clock Apps](oem_device_clockapp_des.md)** + +- **[Development Example for Platform Drivers](device-driver-demo.md)** + +- **[Development Example for Peripheral Drivers](device-outerdriver-demo.md)** + + diff --git a/en/device-dev/guide/faqs-10.md b/en/device-dev/guide/faqs-10.md deleted file mode 100644 index b9828da1546f7dc0a067b0dc0a684bd33cc30e57..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/faqs-10.md +++ /dev/null @@ -1,39 +0,0 @@ -# FAQs - -- [hdc\_std Fails to Connect to a Device](#section1221016541119) -- [hdc\_std Fails to Run](#section219185710311) - -## hdc\_std Fails to Connect to a Device - -- **Symptom** - - **\[Empty\]** is displayed in the output after the **hdc\_std list targets** command is run. - -- **Possible Causes and Solutions** - 1. The device cannot be identified. - - Check whether **HDC Device** exists in the universal serial bus device of the device manager. If **HDC Device** does not exist, the device cannot be connected. In this case, remove and then insert the device or burn the latest image for the device. - - 2. hdc\_std works improperly. - - Run the **hdc kill** or **hdc start -r** command to kill or restart the hdc service, and then run the **hdc list targets** command to check whether device information is obtained. - - If no device information is obtained, check whether the adb process exists in the task manager. If the adb process exists, kill this process because it may affect the hdc service. After that, run **hdc kill** or **hdc start -r** and then **hdc list targets** again. - - 3. hdc\_std does not match the device. - - If the latest image is burnt for the device, hdc\_std must also be of the latest version. As hdc\_std is updated continuously, obtain hdc\_std of the latest version from the **developtools\_hdc\_standard** repository in the **prebuilt** directory. - - - -## hdc\_std Fails to Run - -- **Symptom** - - The **hdc\_std.exe** file does not run after being clicked. - -- **Possible Causes and Solutions** - - **hdc\_std.exe** requires no installation and can be directly used on a disk. It can also be added to environment variables. Open the cmd window and run the **hdc\_std** command to use **hdc\_std.exe**. - - diff --git a/en/device-dev/guide/figures/adding-a-page.png b/en/device-dev/guide/figure/adding-a-page.png similarity index 100% rename from en/device-dev/guide/figures/adding-a-page.png rename to en/device-dev/guide/figure/adding-a-page.png diff --git a/en/device-dev/guide/figures/clock.png b/en/device-dev/guide/figure/clock.png similarity index 100% rename from en/device-dev/guide/figures/clock.png rename to en/device-dev/guide/figure/clock.png diff --git a/en/device-dev/guide/figures/complete-project-directory.png b/en/device-dev/guide/figure/complete-project-directory.png similarity index 100% rename from en/device-dev/guide/figures/complete-project-directory.png rename to en/device-dev/guide/figure/complete-project-directory.png diff --git a/en/device-dev/guide/figures/en-us_image_0000001078563230.png b/en/device-dev/guide/figure/en-us_image_0000001078563230.png similarity index 100% rename from en/device-dev/guide/figures/en-us_image_0000001078563230.png rename to en/device-dev/guide/figure/en-us_image_0000001078563230.png diff --git a/en/device-dev/guide/figures/en-us_image_0000001082434703.png b/en/device-dev/guide/figure/en-us_image_0000001082434703.png similarity index 100% rename from en/device-dev/guide/figures/en-us_image_0000001082434703.png rename to en/device-dev/guide/figure/en-us_image_0000001082434703.png diff --git a/en/device-dev/guide/figures/en-us_image_0000001161922745.png b/en/device-dev/guide/figure/en-us_image_0000001169991055.png similarity index 100% rename from en/device-dev/guide/figures/en-us_image_0000001161922745.png rename to en/device-dev/guide/figure/en-us_image_0000001169991055.png diff --git a/en/device-dev/guide/figures/entering-the-page-name.png b/en/device-dev/guide/figure/entering-the-page-name.png similarity index 100% rename from en/device-dev/guide/figures/entering-the-page-name.png rename to en/device-dev/guide/figure/entering-the-page-name.png diff --git a/en/device-dev/guide/figures/home-screen.png b/en/device-dev/guide/figure/home-screen.png similarity index 100% rename from en/device-dev/guide/figures/home-screen.png rename to en/device-dev/guide/figure/home-screen.png diff --git a/en/device-dev/guide/figures/indicator-bar.png b/en/device-dev/guide/figure/indicator-bar.png similarity index 100% rename from en/device-dev/guide/figures/indicator-bar.png rename to en/device-dev/guide/figure/indicator-bar.png diff --git a/en/device-dev/guide/figures/led-blinking.gif b/en/device-dev/guide/figure/led-blinking.gif similarity index 100% rename from en/device-dev/guide/figures/led-blinking.gif rename to en/device-dev/guide/figure/led-blinking.gif diff --git a/en/device-dev/guide/figures/preview-effect.jpg b/en/device-dev/guide/figure/preview-effect.jpg similarity index 100% rename from en/device-dev/guide/figures/preview-effect.jpg rename to en/device-dev/guide/figure/preview-effect.jpg diff --git a/en/device-dev/guide/figures/project-directory.png b/en/device-dev/guide/figure/project-directory.png similarity index 100% rename from en/device-dev/guide/figures/project-directory.png rename to en/device-dev/guide/figure/project-directory.png diff --git a/en/device-dev/guide/figures/saved-files.png b/en/device-dev/guide/figure/saved-files.png similarity index 100% rename from en/device-dev/guide/figures/saved-files.png rename to en/device-dev/guide/figure/saved-files.png diff --git a/en/device-dev/guide/figures/serial-port-logs-displayed-after-the-exit-command-is-executed.png b/en/device-dev/guide/figure/serial-port-logs-displayed-after-the-exit-command-is-executed.png similarity index 100% rename from en/device-dev/guide/figures/serial-port-logs-displayed-after-the-exit-command-is-executed.png rename to en/device-dev/guide/figure/serial-port-logs-displayed-after-the-exit-command-is-executed.png diff --git a/en/device-dev/guide/figures/serial-port-logs-displayed-after-the-photographing-command-is-executed.png b/en/device-dev/guide/figure/serial-port-logs-displayed-after-the-photographing-command-is-executed.png similarity index 100% rename from en/device-dev/guide/figures/serial-port-logs-displayed-after-the-photographing-command-is-executed.png rename to en/device-dev/guide/figure/serial-port-logs-displayed-after-the-photographing-command-is-executed.png diff --git a/en/device-dev/guide/figures/serial-port-logs-displayed-after-the-preview-command-is-executed.png b/en/device-dev/guide/figure/serial-port-logs-displayed-after-the-preview-command-is-executed.png similarity index 100% rename from en/device-dev/guide/figures/serial-port-logs-displayed-after-the-preview-command-is-executed.png rename to en/device-dev/guide/figure/serial-port-logs-displayed-after-the-preview-command-is-executed.png diff --git a/en/device-dev/guide/figures/serial-port-logs-displayed-after-the-recording-command-is-executed.png b/en/device-dev/guide/figure/serial-port-logs-displayed-after-the-recording-command-is-executed.png similarity index 100% rename from en/device-dev/guide/figures/serial-port-logs-displayed-after-the-recording-command-is-executed.png rename to en/device-dev/guide/figure/serial-port-logs-displayed-after-the-recording-command-is-executed.png diff --git a/en/device-dev/guide/figures/starting-camera_sample.png b/en/device-dev/guide/figure/starting-camera_sample.png similarity index 100% rename from en/device-dev/guide/figures/starting-camera_sample.png rename to en/device-dev/guide/figure/starting-camera_sample.png diff --git a/en/device-dev/guide/figures/title-bar-and-information-bar.png b/en/device-dev/guide/figure/title-bar-and-information-bar.png similarity index 100% rename from en/device-dev/guide/figures/title-bar-and-information-bar.png rename to en/device-dev/guide/figure/title-bar-and-information-bar.png diff --git a/en/device-dev/guide/figures/title-bar.png b/en/device-dev/guide/figure/title-bar.png similarity index 100% rename from en/device-dev/guide/figures/title-bar.png rename to en/device-dev/guide/figure/title-bar.png diff --git a/en/device-dev/guide/figures/video_2020-07-25_173141.gif b/en/device-dev/guide/figure/video_2020-07-25_173141.gif similarity index 100% rename from en/device-dev/guide/figures/video_2020-07-25_173141.gif rename to en/device-dev/guide/figure/video_2020-07-25_173141.gif diff --git "a/en/device-dev/guide/figures/\347\273\230\345\233\2761.png" "b/en/device-dev/guide/figure/\347\273\230\345\233\2761.png" similarity index 100% rename from "en/device-dev/guide/figures/\347\273\230\345\233\2761.png" rename to "en/device-dev/guide/figure/\347\273\230\345\233\2761.png" diff --git a/en/device-dev/guide/function-invocation-logic.md b/en/device-dev/guide/function-invocation-logic.md deleted file mode 100644 index 8f633c3a85a43be32973b50af8729acfeb0ea5ba..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/function-invocation-logic.md +++ /dev/null @@ -1,40 +0,0 @@ -# Function Invocation Logic - -The init function of the input device manager initializes the device management linked list, and the init function of the common driver allocates memory for related structures. The **RegisterChipDevice** function passes touchscreen chip driver information to the related structures of the input common driver and initializes hardware information \(for example, interrupt registration\). The **RegisterInputDevice** function registers **inputDev** \(binding the device and the driver\) with the device manager. The **RegisterInputDevice** function adds **inputDev** to the device management linked list. The function implementation is as follows: - -``` -// Code location: ./drivers/framework/model/input/driver/hdf_touch.c -int32_t RegisterChipDevice(ChipDevice *chipDev) -{ - ... - /* Bind the device to the driver and create an inputDev instance using InputDeviceInstance. */ - DeviceBindDriver(chipDev); - ... - /* Implement the interrupt registration and interrupt handling functions. The interrupt handling function contains the channel for reporting data to the user space. */ - ChipDriverInit(chipDev); - ... - /* Allocate memory for instantiating inputDev. */ - inputDev = InputDeviceInstance(chipDev); - ... - /* Register inputDev with the input device manager. */ - RegisterInputDevice(inputDev); - ... -} - -// Code location: ./drivers/framework/model/input/driver/hdf_input_device_manager.c -int32_t RegisterInputDevice(InputDevice *inputDev) -{ - ... - /* Allocate a device ID, which is unique for each input device. */ - ret = AllocDeviceID(inputDev); - ... - /* This function contains special processing for hid devices but does nothing for the touchscreen driver. */ - CreateDeviceNode(inputDev); - /* Apply for the buffer for the IOService capability, which is required to transmit kernel-space data to the user space. */ - AllocPackageBuffer(inputDev); - /* Add the input device to the global device management linked list. */ - AddInputDevice(inputDev); - ... -} -``` - diff --git a/en/device-dev/guide/hardware-resources.md b/en/device-dev/guide/hardware-resources.md deleted file mode 100644 index 5e93297911c69fdcd9ebaa6cb383c4761e5715b1..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/hardware-resources.md +++ /dev/null @@ -1,6 +0,0 @@ -# Hardware Resources - -The touchscreen integrated circuit \(IC\) provided by the Hi3516D V300 development board is GT911, which uses the standard inter-integrated circuit \(I2C\) to communicate with the development board and connects to the main board through the 6-pin flexible flat cable. The following figure shows the distribution of the 6 pins and their connection. - -![](figures/绘图1.png) - diff --git a/en/device-dev/guide/initializing-the-input-chip-driver-and-registering-the-driver-with-the-hdf.md b/en/device-dev/guide/initializing-the-input-chip-driver-and-registering-the-driver-with-the-hdf.md deleted file mode 100644 index 80abf74934cd632f99e0bf8dbd87f6097158b9a0..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/initializing-the-input-chip-driver-and-registering-the-driver-with-the-hdf.md +++ /dev/null @@ -1,4 +0,0 @@ -# Initializing the Input Chip Driver and Registering the Driver with the HDF - -For details, see step [Initialize the input chip driver and register the driver with the HDF](adapting-to-the-private-drivers-of-the-touchscreen.md). - diff --git a/en/device-dev/guide/initializing-the-input-common-driver-and-registering-the-driver-with-the-hdf.md b/en/device-dev/guide/initializing-the-input-common-driver-and-registering-the-driver-with-the-hdf.md deleted file mode 100644 index cf43752893cfad241dd78633c42c2957f6122d86..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/initializing-the-input-common-driver-and-registering-the-driver-with-the-hdf.md +++ /dev/null @@ -1,35 +0,0 @@ -# Initializing the Input Common Driver and Registering the Driver with the HDF - -You can obtain the sample code at **./drivers/framework/model/input/driver/hdf\_touch.c**. - -``` -static int32_t HdfTouchDriverProbe(struct HdfDeviceObject *device) -{ - ... - /* Use the boardCfg structure to allocate memory and parse the configuration information obtained from the HCS. */ - boardCfg = BoardConfigInstance(device); - ... - /* Allocate memory in the touchDriver structure. */ - touchDriver = TouchDriverInstance(); - ... - /* Initialize common resources based on the parsed board-level information, such as IIC initialization. */ - ret = TouchDriverInit(touchDriver, boardCfg); - if (ret == HDF_SUCCESS) { - ... - /* Add the driver to the common driver management linked list, which is used to query the driver after it is bound to the device. */ - AddTouchDriver(touchDriver); - ... - } - ... -} -struct HdfDriverEntry g_hdfTouchEntry = { - .moduleVersion = 1, - .moduleName = "HDF_TOUCH", - .Bind = HdfTouchDriverBind, - .Init = HdfTouchDriverProbe, - .Release = HdfTouchDriverRelease, -}; - - HDF_INIT(g_hdfTouchEntry); // Driver registration entry -``` - diff --git a/en/device-dev/guide/initializing-the-input-device-manager-and-registering-the-driver-with-the-hdf.md b/en/device-dev/guide/initializing-the-input-device-manager-and-registering-the-driver-with-the-hdf.md deleted file mode 100644 index a8ebbf4a5de71f905ff090114d5541a7d46afbe3..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/initializing-the-input-device-manager-and-registering-the-driver-with-the-hdf.md +++ /dev/null @@ -1,22 +0,0 @@ -# Initializing the Input Device Manager and Registering the Driver with the HDF - -You can obtain the sample code at **./drivers/framework/model/input/driver/hdf\_input\_device\_manager.c**. - -``` -static int32_t HdfInputManagerInit(struct HdfDeviceObject *device) -{ - /* Allocate memory to the device manager, which will store all input devices. */ - g_inputManager = InputManagerInstance(); - ... -} -struct HdfDriverEntry g_hdfInputEntry = { - .moduleVersion = 1, - .moduleName = "HDF_INPUT_MANAGER", - .Bind = HdfInputManagerBind, - .Init = HdfInputManagerInit, - .Release = HdfInputManagerRelease, -}; - -HDF_INIT(g_hdfInputEntry); // Driver registration entry -``` - diff --git a/en/device-dev/guide/input-driver-model-workflow-analysis.md b/en/device-dev/guide/input-driver-model-workflow-analysis.md deleted file mode 100644 index c99c0617eaa8da4150494580902e215567c2dee2..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/input-driver-model-workflow-analysis.md +++ /dev/null @@ -1,18 +0,0 @@ -# Input Driver Model Workflow Analysis - -To help you get familiarized with the working process of the input driver model, the following sections will describe the key code loaded by the input driver model. - ->![](public_sys-resources/icon-notice.gif) **NOTICE:** ->You do not need to perform development related to the input driver model. - -- **[Parsing Private Configuration Data](parsing-private-configuration-data.md)** - -- **[Initializing the Input Device Manager and Registering the Driver with the HDF](initializing-the-input-device-manager-and-registering-the-driver-with-the-hdf.md)** - -- **[Initializing the Input Common Driver and Registering the Driver with the HDF](initializing-the-input-common-driver-and-registering-the-driver-with-the-hdf.md)** - -- **[Initializing the Input Chip Driver and Registering the Driver with the HDF](initializing-the-input-chip-driver-and-registering-the-driver-with-the-hdf.md)** - -- **[Function Invocation Logic](function-invocation-logic.md)** - - diff --git a/en/device-dev/guide/input-driver-model.md b/en/device-dev/guide/input-driver-model.md deleted file mode 100644 index a4f2cdb3720235bcf0fd941caf6ae05c68792bd8..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/input-driver-model.md +++ /dev/null @@ -1,12 +0,0 @@ -# Input Driver Model - -The input driver model mainly consists of the device manager, common drivers, and chip drivers. - -- Input device manager: provides various input device drivers with the APIs for registering or unregistering input devices and manages the input device list. -- Input common driver: provides common drivers for initializing the board-level hardware, processing hardware interrupts, and registering input devices with the input device manager. -- Input chip driver: calls differentiated APIs reserved by the input platform driver to minimize the workload for input chip driver development. - -In addition, the input driver model implements functions for reporting input data and parsing input device configurations. - -For details about the input driver model, see [Touchscreen Overview](https://device.harmonyos.com/en/docs/develop/drive/oem_drive_touch_des-0000001052857350)[Touchscreen Overview](../driver/touchscreenoverview.md). - diff --git a/en/device-dev/guide/led-peripheral-control.md b/en/device-dev/guide/led-peripheral-control.md deleted file mode 100644 index abe05cea370b4b7743e120ce2207aa54834de1b1..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/led-peripheral-control.md +++ /dev/null @@ -1,9 +0,0 @@ -# LED Peripheral Control - -- **[Overview](overview.md)** - -- **[Development](development.md)** - -- **[Verification](verification.md)** - - diff --git a/en/device-dev/guide/how-to-develop.md b/en/device-dev/guide/oem_device_clockapp_des.md similarity index 34% rename from en/device-dev/guide/how-to-develop.md rename to en/device-dev/guide/oem_device_clockapp_des.md index 28b0a31d6c892bf82adf85b0bc86f2312812ad4b..5a7836cea35b322fb0bc27c81d4f7b371a97482f 100644 --- a/en/device-dev/guide/how-to-develop.md +++ b/en/device-dev/guide/oem_device_clockapp_des.md @@ -1,15 +1,42 @@ -# How to Develop +# Development Guidelines on Clock Apps + +- [Overview](#section11522349121115) +- [Preparations](#section6592121861218) +- [How to Develop](#section19901741111312) +- [Signing and Packaging](#section10601181101516) +- [Running on the Real Device](#section092721731511) +- [FAQs](#section1122413460153) + - [hdc\_std Fails to Connect to a Device](#section1922725151614) + - [hdc\_std Fails to Run](#section15657547131615) + + +## Overview + +This document describes how to quickly set up a development environment \(using the Hi3516D V300 development board\) and develop a clock app running on OpenHarmony. You can click [here](https://gitee.com/openharmony/app_samples/tree/master/common/Clock) to obtain the sample code. + +The clock app displays the current time, as shown in the following figure. + +**Figure 1** Clock display effect + + +![](figure/clock.png) + +## Preparations + +Download and install DevEco Studio. For details, see the [HUAWEI DevEco Studio User Guide](../../application-dev/quick-start/deveco-studio-(openharmony)-user-guide.md). + +## How to Develop The Clock app displays the current time through a clock face and numbers. -As shown in [Figure 1 Clock display effect](overview-7.md#fig7763172132019), the page consists of two parts: +As shown in [Figure 1 Clock display effect](oem_device_clockapp_des.md#fig7763172132019), the UI consists of two parts: - Clock face area: displays a dynamic analog clock whose hands rotate accurately. - Digital time area: displays the current time in numerals. To build such an app, we can create a page that has a flexible layout with two rows vertically arranged. The development procedure is as follows: -1. Add a root **** to the **.hml** file. Note that each **.hml** file can contain only one root component. The example code is as follows: +1. Add a root component **** to the **.hml** file. Note that each **.hml** file can contain only one root component. The sample code is as follows: ```
@@ -32,14 +59,14 @@ To build such an app, we can create a page that has a flexible layout with two r 2. Implement clock hand rotation using the **** component. The **** component provides a stack container where child components are successively stacked and the latter one overwrites the previous one. - Add a stack container to the root component. The example code is as follows: + Add a stack container to the root component. The sample code is as follows: ```
+ style="transform : rotate({{ hour * 30 + minute / 2 }}deg);"> ``` - **style="transform: rotate\(\{\{ second \* 6 \}\}deg\)** sets the rotation event of a component. **transform** translates, rotates, or scales an element. **rotate** rotates an element. You can set the element to rotate around its x-axis or y-axis. + **style="transform: rotate\(\{\{ second \* 6 \}\}deg\)** sets the rotation event of a component. **transform** translates, rotates, or scales an image. **rotate** rotates an image. You can set an image to rotate around its x-axis or y-axis. - Set attributes, such as the height, width, and position, of the component in the CSS file. The example code is as follows: + Set attributes, such as the height, width, and position, of the stack component in the CSS file. The sample code is as follows: ``` .stack { @@ -62,7 +89,7 @@ To build such an app, we can create a page that has a flexible layout with two r } ``` - Set attributes, such as the height and width, of the component in the CSS file. The example code is as follows: + Set attributes, such as the height and width, of the clock-bg component in the CSS file. The sample code is as follows: ``` .clock-bg { @@ -72,7 +99,7 @@ To build such an app, we can create a page that has a flexible layout with two r } ``` - Set attributes, such as the height and width of the hour, minute, and second hands, of the component in the CSS file. The example code is as follows: + Set attributes, such as the height and width of the hour, minute, and second hands, of the clock-hand component in the CSS file. The sample code is as follows: ``` .clock-hand { @@ -82,7 +109,7 @@ To build such an app, we can create a page that has a flexible layout with two r } ``` - Add a timer in the **index.js** file to update the hour, minute, and second variables in real time so that time can be automatically updated on the app UI. The example code is as follows: + Add a timer in the **index.js** file to update the hour, minute, and second variables in real time so that the time can be automatically updated on the app UI. The sample code is as follows: ``` export default { @@ -95,7 +122,7 @@ To build such an app, we can create a page that has a flexible layout with two r }, onInit () { this.updateTime(); - this.timer = setInterval(this.updateTime, 1000)// Set the update time of the timer to 1 second. + this.timer = setInterval(this.updateTime, 1000)// Set the timer to 1 second. }, updateTime: function () { var nowTime = new Date() @@ -115,13 +142,13 @@ To build such an app, we can create a page that has a flexible layout with two r } ``` -3. Display the current time in digital form under the analog clock. Add the **** component at the end of the root layout. The following example shows the page structure: +3. Display the current time in numerals under the analog clock. Add the text component at the end of the root layout. The following example shows the UI structure: ``` {{ hour }}:{{ minute }}:{{ second }} ``` - **class="digit-clock"** sets the height, width, and font size of the component. The example code is as follows: + class=**"digit-clock"** sets the height, width, and font size of the component. The sample code is as follows: ``` .digit-clock { @@ -132,99 +159,174 @@ To build such an app, we can create a page that has a flexible layout with two r } ``` -4. Set the style, animation effect, and dynamic data binding for all components. The complete example code is as follows: - +4. Set the style, animation effect, and dynamic data binding for all components. The complete sample code is as follows: - **index.hml** - ``` -
- - - - - - - {{ hour }}:{{ minute }}:{{ second }} -
- ``` + ``` +
+ + + + + + + {{ hour }}:{{ minute }}:{{ second }} +
+ ``` - - **index.css** - ``` - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; - } - - .stack { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } + - **index.css** - .digit-clock { - font-size: 58px; - width: 100%; - margin-top: 0px; - text-align: center; - } + ``` + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + } + + .stack { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; + } + + .digit-clock { + font-size: 58px; + width: 100%; + margin-top: 0px; + text-align: center; + } + + .clock-bg { + width: 80%; + height: 80%; + object-fit: scale-down; + } + + .clock-hand { + width: 25%; + height: 65%; + object-fit: contain; + } + ``` + + + - **index.js** - .clock-bg { - width: 80%; - height: 80%; - object-fit: scale-down; - } + A **.js** file is used to implement logic interactions of the clock app. The following **.js** file implements the function of periodically obtaining the system time. - .clock-hand { - width: 25%; - height: 65%; - object-fit: contain; - } + ``` + export default { + timer: undefined, + data: { + hour: 0, + minute: 0, + second: 0 + }, + onInit() { + this.updateTime() + this.timer = setInterval(this.updateTime, 1000) + }, + updateTime: function () { + var nowTime = new Date() + this.hour = nowTime.getHours() + this.minute = nowTime.getMinutes() + this.second = nowTime.getSeconds() + if (this.hour < 10) { + this.hour = '0' + this.hour + } + if (this.minute < 10) { + this.minute = '0' + this.minute + } + if (this.second < 10) { + this.second = '0' + this.second + } + }, + onDestroy() { + clearInterval(this.timer); + } + } + ``` + + + +## Signing and Packaging + +After finishing writing the app code, you need to sign and package the app before running it on a real device. For details, see [Signing and Packaging Guide](../../application-dev/quick-start/configuring-the-openharmony-app-signature.md). + +## Running on the Real Device + +Before you install the app and run it on the development board, install the DevEco Device Tool by following operations provided in [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/tool_install-0000001050164976). Burn OpenHarmony into the development board, and run it on the board. For details about how to build, burn, and run an image, see [Getting Started with Hi3516](../quick-start/quickstart-standard.md). After the image is running normally and the system is started properly, perform the following steps to install or uninstall the app: + +1. Obtain the HDC client from the following path: + + ``` + developtools/hdc_standard/prebuilt/windows/hdc_std.exe ``` - - **index.js** + Change the HDC client name to **hdc.exe** and add the path above to the system environment variable **path**. - A **.js** file is used to implement interaction logic of your app. In the **.js** file of the page, implement the function of periodically obtaining the system time. +2. Open the **cmd** window, and run the following commands to push the HAP file to the device directory, and install it: ``` - export default { - timer: undefined, - data: { - hour: 0, - minute: 0, - second: 0 - }, - onInit() { - this.updateTime() - this.timer = setInterval(this.updateTime, 1000) - }, - updateTime: function () { - var nowTime = new Date() - this.hour = nowTime.getHours() - this.minute = nowTime.getMinutes() - this.second = nowTime.getSeconds() - if (this.hour < 10) { - this.hour = '0' + this.hour - } - if (this.minute < 10) { - this.minute = '0' + this.minute - } - if (this.second < 10) { - this.second = '0' + this.second - } - }, - onDestroy() { - clearInterval(this.timer); - } - } + hdc smode + hdc target mount + hdc file send clock.hap /data/clock.hap + hdc shell chmod 666 /data/clock.hap + hdc shell bm install -p /data/clock.hap + ``` + +3. Run the following command to start the app. **ohos.samples.clock** indicates the app package name, and **MainAbility** indicates the ability started by the app. + + ``` + hdc shell aa start -d 123 -a ohos.samples.clock.MainAbility -b ohos.samples.clock + ``` + +4. \(Optional\) Run the following command to uninstall the app. **ohos.samples.clock** indicates the app package name. + + ``` + hdc shell bm uninstall -n ohos.samples.clock ``` +## FAQs + +### hdc\_std Fails to Connect to a Device + +- **Symptom** + + **\[Empty\]** is displayed in the output after the **hdc\_std list targets** command is run. + +- **Possible Causes and Solutions** + 1. The device fails to be identified. + + Check whether **HDC Device** exists in the universal serial bus device of the device manager. If **HDC Device** does not exist, the device cannot be connected. In this case, remove and then insert the device or burn the latest image for the device. + + 2. hdc\_std works improperly. + + Run the **hdc kill** or **hdc start -r** command to kill or restart the HDC service, and then run the **hdc list targets** command to check whether device information is obtained. + + 3. hdc\_std does not match the device. + + If the latest image is burnt for the device, hdc\_std must also be of the latest version. As hdc\_std is updated continuously, obtain hdc\_std of the latest version from the **developtools\_hdc\_standard** repository in the **prebuilt** directory. + + + +### hdc\_std Fails to Run + +- **Symptom** + + The **hdc\_std.exe** file does not run after being clicked. + +- **Possible Causes and Solutions** + + **hdc\_std.exe** requires no installation and can be directly used on a disk. It can also be added to environment variables. Open the **cmd** window and run the **hdc\_std** command to use **hdc\_std.exe**. + + diff --git a/en/device-dev/guide/overview-10.md b/en/device-dev/guide/overview-10.md deleted file mode 100644 index f2936c824fa1dc1ddee20998e9501f350f205651..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/overview-10.md +++ /dev/null @@ -1,26 +0,0 @@ -# Overview - -- [When to Use](#section191543223549) - -This document uses the I2C driver as an example to describe how to develop platform drivers based on the hardware driver foundation \(HDF\). - ->![](public_sys-resources/icon-caution.gif) **CAUTION:** ->The sample code in this document is for reference only and cannot be directly used for commercial integration. - -## When to Use - -The HDF provides a standard driver framework for common peripherals. To use the APIs provided by the HDF to perform operations on peripherals, you only need to adapt the specific driver to the HDF. - -In this example, an I2C driver is used. [Figure 1](#fig148041484161) shows the sequence diagram of the I2C driver. - -**Figure 1** I2C driver sequence diagram - - -![](figures/en-us_image_0000001161922745.png) - -- User Business: business-triggered driver -- i2cManagerEntry: entry to the I2C manager, which is used to register the I2C manager with the HDF -- I2cManager: I2C manager, which manages the I2C controller -- I2cCntlr: I2C controller -- i2cDriverEntry: entry to the I2C controller, which is used to register the I2C controller with the HDF - diff --git a/en/device-dev/guide/overview-13.md b/en/device-dev/guide/overview-13.md deleted file mode 100644 index 608d2272089797a51ae741056816d32d5028c113..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/overview-13.md +++ /dev/null @@ -1,9 +0,0 @@ -# Overview - -This document describes how to develop a touchscreen driver on the Hi3516D V300 development board using the HDF input driver model, helping you quickly get started with peripheral driver development. - -- **[Hardware Resources](hardware-resources.md)** - -- **[Input Driver Model](input-driver-model.md)** - - diff --git a/en/device-dev/guide/overview-7.md b/en/device-dev/guide/overview-7.md deleted file mode 100644 index a1d94bca1274c243b4046785121ecacd56a0a93b..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/overview-7.md +++ /dev/null @@ -1,15 +0,0 @@ -# Overview - -- [Display Effect](#section3997224182313) - -This document describes how to quickly set up a development environment \(using the Hi3516D V300 development board\) and develop a clock app running on OpenHarmony. You can click [here](https://gitee.com/openharmony/app_samples/tree/master/common/Clock) to obtain the sample code. - -## Display Effect - -The Clock app displays the current time, as shown in the following figure. - -**Figure 1** Clock display effect - - -![](figures/clock.png) - diff --git a/en/device-dev/guide/overview.md b/en/device-dev/guide/overview.md deleted file mode 100644 index 598fa8d3b918f7e9f37ec53fd3ff80c81b26254f..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/overview.md +++ /dev/null @@ -1,4 +0,0 @@ -# Overview - -Based on the Hi3861 platform, the OpenHarmony WLAN module provides abundant peripheral operation capabilities, including the I2C, I2S, ADC, UART, SPI, SDIO, GPIO, PWM, and flash memory. This document describes how to control GPIO pins by calling the OpenHarmony native development kit \(NDK\) interface to implement LED blinking. For details about how to control other IoT peripherals, see the API guide. - diff --git a/en/device-dev/guide/parsing-private-configuration-data.md b/en/device-dev/guide/parsing-private-configuration-data.md deleted file mode 100644 index a66a1a0f634b3ceee01ba8ab6ad13a6a929abdaf..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/parsing-private-configuration-data.md +++ /dev/null @@ -1,17 +0,0 @@ -# Parsing Private Configuration Data - -You can obtain the sample code at **./drivers/framework/model/input/driver/input\_config\_parser.c**. - -The configuration parsing functions provided by the OSAL can parse the fields in the **hcs** file. For details, see the implementation of each function in **input\_config\_parser.c**. If the provided template cannot meet business requirements, you need to add required information to the **hcs** file and then develop parsing functions based on the added fields. - -``` -static int32_t ParseAttr(struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode, BoardAttrCfg *attr) -{ - int32_t ret; - ret = parser->GetUint8(attrNode, "inputType", &attr->devType, 0); // Obtain the inputType field and save it in the BoardAttrCfg structure. - CHECK_PARSER_RET(ret, "GetUint8"); - ... - return HDF_SUCCESS; -} -``` - diff --git a/en/device-dev/guide/preparations-11.md b/en/device-dev/guide/preparations-11.md deleted file mode 100644 index 50badfb8ff63a2f6fc2a5ee80fe58b0fa8a4221b..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/preparations-11.md +++ /dev/null @@ -1,7 +0,0 @@ -# Preparations - -Set up the environment by referring to [Setting Up a Standard OpenHarmony Environment](../quick-start/standard-system.md). - ->![](public_sys-resources/icon-notice.gif) **NOTICE:** ->This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment. - diff --git a/en/device-dev/guide/preparations-8.md b/en/device-dev/guide/preparations-8.md deleted file mode 100644 index e56d1485fdb5dfd7833cec5df4d23159168ca493..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/preparations-8.md +++ /dev/null @@ -1,8 +0,0 @@ -# Preparations - -- [Setting Up the Development Environment and Creating a Project](#section1912530122716) - -## Setting Up the Development Environment and Creating a Project - -Download and install DevEco Studio. For details, see the [HUAWEI DevEco Studio User Guide](../../application-dev/quick-start/deveco-studio-(openharmony)-user-guide.md). - diff --git a/en/device-dev/guide/public_sys-resources/icon-caution.gif b/en/device-dev/guide/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/guide/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/guide/public_sys-resources/icon-danger.gif b/en/device-dev/guide/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/guide/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/guide/public_sys-resources/icon-note.gif b/en/device-dev/guide/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/guide/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/guide/public_sys-resources/icon-notice.gif b/en/device-dev/guide/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/guide/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/guide/public_sys-resources/icon-tip.gif b/en/device-dev/guide/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/guide/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/guide/public_sys-resources/icon-warning.gif b/en/device-dev/guide/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/guide/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/guide/running-on-the-device-9.md b/en/device-dev/guide/running-on-the-device-9.md deleted file mode 100644 index 72fdad2eca6863415f1db8890939a18f49d09103..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/running-on-the-device-9.md +++ /dev/null @@ -1,35 +0,0 @@ -# Running on the Device - -Before you install the app and run it on the development board, install the DevEco Device Tool by following operations provided in [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905). Burn OpenHarmony into the development board, and run it on the board. For details about how to build, burn, and run an image, see [Getting Started with Hi3516](../quick-start/standard-system.md). After the image is running normally and the system is started properly, perform the following steps to install or uninstall the app: - -1. Obtain the HDC client from the following path: - - ``` - developtools/hdc_standard/prebuilt/windows/hdc_std.exe - ``` - - Change the HDC client name to **hdc.exe** and add the path above to the system environment variable **path**. - -2. Open the **cmd** window, and run the following commands to push the HAP file to the device directory, and install it: - - ``` - hdc smode - hdc target mount - hdc file send clock.hap /data/clock.hap - hdc shell chmod 666 /data/clock.hap - hdc shell bm install -p /data/clock.hap - ``` - -3. Run the following command to start the app. **ohos.samples.clock** indicates the app package name, and **MainAbility** indicates the ability started by the app. - - ``` - hdc shell aa start -d 123 -a ohos.samples.clock.MainAbility -b ohos.samples.clock - ``` - -4. \(Optional\) Run the following command to uninstall the app. **ohos.samples.clock** indicates the app package name. - - ``` - hdc shell bm uninstall -n ohos.samples.clock - ``` - - diff --git a/en/device-dev/guide/setting-up-the-environment.md b/en/device-dev/guide/setting-up-the-environment.md deleted file mode 100644 index 9c2593432e6ebf03654d188c35e1a1953fe3e5f0..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/setting-up-the-environment.md +++ /dev/null @@ -1,7 +0,0 @@ -# Setting Up the Environment - -Set up the environment by referring to [Setting Up a Standard OpenHarmony Environment](../quick-start/standard-system.md). - ->![](public_sys-resources/icon-notice.gif) **NOTICE:** ->This development example applies to standard, small, and mini OpenHarmony systems. The following sections use the standard system as an example. You can refer to the specific guide for your system to set up the environment. - diff --git a/en/device-dev/guide/signing-and-packaging.md b/en/device-dev/guide/signing-and-packaging.md deleted file mode 100644 index 80e390ea1a19510c5efeca200abe14e667f36b46..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/signing-and-packaging.md +++ /dev/null @@ -1,4 +0,0 @@ -# Signing and Packaging - -After finishing writing the app code, you need to sign and package the app before running it on a real device. For details, see [Signing and Packaging Guide](../../application-dev/quick-start/configuring-the-openharmony-app-signature.md). - diff --git a/en/device-dev/guide/startup-log-analysis.md b/en/device-dev/guide/startup-log-analysis.md deleted file mode 100644 index 967f333237e42aea6541c8377786360b6f9ce7c8..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/startup-log-analysis.md +++ /dev/null @@ -1,19 +0,0 @@ -# Startup Log Analysis - -The following is part of the startup log: - -``` -[I/HDF_INPUT_DRV] HdfInputManagerInit: enter // Initialize the input device manager. -[I/HDF_INPUT_DRV] HdfInputManagerInit: exit succ // The initialization is successful. -[I/osal_cdev] add cdev hdf_input_host success -[I/HDF_LOG_TAG] HdfTouchDriverProbe: enter // Initialize the input common driver. -[I/HDF_LOG_TAG] HdfTouchDriverProbe: main_touch exit succ // The initialization is successful. -[I/osal_cdev] add cdev hdf_input_event1 success -[I/HDF_INPUT_DRV] HdfGoodixChipInit: enter // Initialize the input chip driver. -[I/HDF_INPUT_DRV] ChipDetect: IC FW version is 0x1060 -[I/HDF_INPUT_DRV] Product_ID: 911_1060, x_sol = 960, y_sol = 480 -[I/HDF_LOG_TAG] ChipDriverInit: chipDetect succ, ret = 0 -[I/HDF_LOG_TAG] InputDeviceInstance: inputDev->devName = main_touch -[I/HDF_INPUT_DRV] HdfGoodixChipInit: exit succ, chipName = gt911 // The initialization is successful. -``` - diff --git a/en/device-dev/guide/verification.md b/en/device-dev/guide/verification.md deleted file mode 100644 index 55254e77cd032307a97cc73ffa3b45169789be56..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/verification.md +++ /dev/null @@ -1,9 +0,0 @@ -# Verification - -For details about the compilation and burning processes, see [Modifying Source Code](../quick-start/running-a-hello-world-program.md) and [Burning Images](../quick-start/wlan-connection.md) in _Getting Started with Hi3861_. - -After the preceding two steps are complete, press the **RST** button to reset the module. The LED blinks periodically, which meets the expectation. The verification is complete. - -**Figure 1** LED blinking -![](figures/led-blinking.gif "led-blinking") - diff --git a/en/device-dev/guide/visual-application-development.md b/en/device-dev/guide/visual-application-development.md deleted file mode 100644 index b13654cffb462ca5fa2919848035a3e8b5f9a6ac..0000000000000000000000000000000000000000 --- a/en/device-dev/guide/visual-application-development.md +++ /dev/null @@ -1,19 +0,0 @@ -# Visual Application Development - -- **[Overview](overview-6.md)** - -- **[Preparations](preparations.md)** - -- **[Adding Pages](adding-pages.md)** - -- **[Building the Home Page](building-the-home-page.md)** - -- **[Building the Details Page](building-the-details-page.md)** - -- **[Debugging and Packaging](debugging-and-packaging.md)** - -- **[Running on the Device](running-on-the-device.md)** - -- **[FAQs](faqs.md)** - - diff --git a/en/device-dev/kernel/Readme-EN.md b/en/device-dev/kernel/Readme-EN.md index 2ec9f17abde6255b6bfb7b20df50fac5357972ea..b8a0bb660407fe0500f9a7ca89d7c589d12a7852 100644 --- a/en/device-dev/kernel/Readme-EN.md +++ b/en/device-dev/kernel/Readme-EN.md @@ -1,93 +1,86 @@ -# Kernel - -- [Lite Kernel](lite-kernel.md) - - [OpenHarmony Lite Kernel Basic Functions](openharmony-lite-kernel-basic-functions.md) - - [Process](process.md) - - [Thread](thread.md) - - [Memory](memory.md) - - [Network](network.md) - - - [OpenHarmony Lite Kernel File System](openharmony-lite-kernel-file-system.md) - - [VFS](vfs.md) - - [NFS](nfs.md) - - [RAMFS](ramfs.md) - - [FAT](fat.md) - - [JFFS2](jffs2.md) - - - [Standard Library](standard-library.md) - - [Standard Library](standard-library-0.md) - - [Differences from the Linux Standard Library](differences-from-the-linux-standard-library.md) - - - [Commissioning](commissioning.md) - - [Introduction to the Shell](introduction-to-the-shell.md) - - [Shell Command Development Guidelines](shell-command-development-guidelines.md) - - [Shell Command Programming Example](shell-command-programming-example.md) - - [Shell Command Reference](shell-command-reference.md) - - [System Commands](system-commands.md) - - [cpup](cpup.md) - - [date](date.md) - - [dmesg](dmesg.md) - - [exec](exec.md) - - [free](free.md) - - [help](help.md) - - [hwi](hwi.md) - - [kill](kill.md) - - [log](log.md) - - [memcheck](memcheck.md) - - [oom](oom.md) - - [pmm](pmm.md) - - [reset](reset.md) - - [sem](sem.md) - - [stack](stack.md) - - [su](su.md) - - [swtmr](swtmr.md) - - [systeminfo](systeminfo.md) - - [task](task.md) - - [uname](uname.md) - - [vmm](vmm.md) - - [watch](watch.md) - - - [File Commands](file-commands.md) - - [cat](cat.md) - - [cd](cd.md) - - [chgrp](chgrp.md) - - [chmod](chmod.md) - - [chown](chown.md) - - [cp](cp.md) - - [format](format.md) - - [ls](ls.md) - - [lsfd](lsfd.md) - - [mkdir](mkdir.md) - - [mount](mount.md) - - [partinfo](partinfo.md) - - [partition](partition.md) - - [pwd](pwd.md) - - [rm](rm.md) - - [rmdir](rmdir.md) - - [statfs](statfs.md) - - [sync](sync.md) - - [touch](touch.md) - - [writeproc](writeproc.md) - - [umount](umount.md) - - - [Network Commands](network-commands.md) - - [arp](arp.md) - - [dhclient](dhclient.md) - - [dns](dns.md) - - [ifconfig](ifconfig.md) - - [ipdebug](ipdebug.md) - - [netstat](netstat.md) - - [ntpdate](ntpdate.md) - - [ping](ping.md) - - [ping6](ping6.md) - - [telnet](telnet.md) - - [tftp](tftp.md) - - - [Magic Key Usage](magic-key-usage.md) - - [User-Space Exception Information](user-space-exception-information.md) - -- [Linux Kernel](linux-kernel.md) - - [Linux Kernel Overview](linux-kernel-overview.md) - - [Guidelines for Using Patches on OpenHarmony Development Boards](guidelines-for-using-patches-on-openharmony-development-boards.md) - - [Guidelines for Compiling and Building the Linux Kernel](guidelines-for-compiling-and-building-the-linux-kernel.md) +# Kernel +- [Kernel for Mini and Small Systems](kernel-lite.md) + - [Kernel for Small Systems](kernel-lite-small.md) + - [Basic Kernel](kernel-lite-small-basic.md) + - [Process](kernel-lite-small-process.md) + - [Thread](kernel-lite-small-thread.md) + - [Memory](kernel-lite-small-memory.md) + - [Network](kernel-lite-small-net.md) + - [File System](kernel-lite-small-file.md) + - [VFS](kernel-lite-small-file-vfs.md) + - [NFS](kernel-lite-small-file-nfs.md) + - [RAMFS](kernel-lite-small-file-ramfs.md) + - [FAT](kernel-lite-small-file-fat.md) + - [JFFS2](kernel-lite-small-file-jffs.md) + - [Standard Library](kernel-lite-small-lib.md) + - [Standard Library](kernel-lite-small-lib-standard.md) + - [Differences from the Linux Standard Library](kernel-lite-small-lib-differ.md) + - [Commissioning](kernel-lite-small-shell.md) + - [Introduction to the Shell](kernel-lite-small-shell-des.md) + - [Shell Command Development Guidelines](kernel-lite-small-shell-guide.md) + - [Shell Command Programming Example](kernel-lite-small-shell-sample.md) + - [Shell Command Reference](kernel-lite-small-shell-cmd.md) + - [System Commands](kernel-lite-small-shell-cmd-sys.md) + - [cpup](kernel-lite-small-shell-cmd-sys-cpup.md) + - [date](kernel-lite-small-shell-cmd-sys-date.md) + - [dmesg](kernel-lite-small-shell-cmd-sys-demsg.md) + - [exec](kernel-lite-small-shell-cmd-sys-exec.md) + - [free](kernel-lite-small-shell-cmd-sys-free.md) + - [help](kernel-lite-small-shell-cmd-sys-help.md) + - [hwi](kernel-lite-small-shell-cmd-sys-hwi.md) + - [kill](kernel-lite-small-shell-cmd-sys-kill.md) + - [log](kernel-lite-small-shell-cmd-sys-log.md) + - [memcheck](kernel-lite-small-shell-cmd-sys-mem.md) + - [oom](kernel-lite-small-shell-cmd-sys-oom.md) + - [pmm](kernel-lite-small-shell-cmd-sys-pmm.md) + - [reset](kernel-lite-small-shell-cmd-sys-reset.md) + - [sem](kernel-lite-small-shell-cmd-sys-sem.md) + - [stack](kernel-lite-small-shell-cmd-sys-stack.md) + - [su](kernel-lite-small-shell-cmd-sys-su.md) + - [swtmr](kernel-lite-small-shell-cmd-sys-swymr.md) + - [systeminfo](kernel-lite-small-shell-cmd-sys-sys.md) + - [task](kernel-lite-small-shell-cmd-sys-task.md) + - [uname](kernel-lite-small-shell-cmd-sys-uname.md) + - [vmm](kernel-lite-small-shell-cmd-sys-vmm.md) + - [watch](kernel-lite-small-shell-cmd-sys-watch.md) + - [File Commands](kernel-lite-small-shell-cmd-file.md) + - [cat](kernel-lite-small-shell-cmd-file-cat.md) + - [cd](kernel-lite-small-shell-cmd-file-cd.md) + - [chgrp](kernel-lite-small-shell-cmd-file-chgrp.md) + - [chmod](kernel-lite-small-shell-cmd-file-chmod.md) + - [chown](kernel-lite-small-shell-cmd-file-chown.md) + - [cp](kernel-lite-small-shell-cmd-file-cp.md) + - [format](kernel-lite-small-shell-cmd-file-format.md) + - [ls](kernel-lite-small-shell-cmd-file-is.md) + - [lsfd](kernel-lite-small-shell-cmd-file-isfd.md) + - [mkdir](kernel-lite-small-shell-cmd-file-mkdir.md) + - [mount](kernel-lite-small-shell-cmd-file-mount.md) + - [partinfo](kernel-lite-small-shell-cmd-file-part.md) + - [partition](kernel-lite-small-shell-cmd-file-partion.md) + - [pwd](kernel-lite-small-shell-cmd-file-pwd.md) + - [rm](kernel-lite-small-shell-cmd-file-rm.md) + - [rmdir](kernel-lite-small-shell-cmd-file-rmdir.md) + - [statfs](kernel-lite-small-shell-cmd-file-sta.md) + - [sync](kernel-lite-small-shell-cmd-file-sync.md) + - [touch](kernel-lite-small-shell-cmd-file-touch.md) + - [writeproc](kernel-lite-small-shell-cmd-file-write.md) + - [umount](kernel-lite-small-shell-cmd-file-umount.md) + - [Network Commands](kernel-lite-small-shell-cmd-net.md) + - [arp](kernel-lite-small-shell-cmd-net-arp.md) + - [dhclient](kernel-lite-small-shell-cmd-net-dh.md) + - [dns](kernel-lite-small-shell-cmd-net-dns.md) + - [ifconfig](kernel-lite-small-shell-cmd-net-ipc.md) + - [ipdebug](kernel-lite-small-shell-cmd-net-ipd.md) + - [netstat](kernel-lite-small-shell-cmd-net-net.md) + - [ntpdate](kernel-lite-small-shell-cmd-net-ntp.md) + - [ping](kernel-lite-small-shell-cmd-net-ping.md) + - [ping6](kernel-lite-small-shell-cmd-net-ping6.md) + - [telnet](kernel-lite-small-shell-cmd-net-tel.md) + - [tftp](kernel-lite-small-shell-cmd-net-tftp.md) + - [Magic Key Usage](kernel-lite-small-shell-cmd-mag.md) + - [User-Space Exception Information](kernel-lite-small-shell-cmd-abn.md) +- [Kernel for Standard Systems](kernel-standard.md) + - [Linux Kernel Overview](kernel-standard-des.md) + - [Guidelines for Using Patches on OpenHarmony Development Boards](kernel-standard-patch.md) + - [Guidelines for Compiling and Building the Linux Kernel](kernel-standard-build.md) \ No newline at end of file diff --git a/en/device-dev/kernel/commissioning.md b/en/device-dev/kernel/commissioning.md deleted file mode 100644 index f7be69f45389758ac2eb5493f63b52140cb0ffcc..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/commissioning.md +++ /dev/null @@ -1,15 +0,0 @@ -# Commissioning - -- **[Introduction to the Shell](introduction-to-the-shell.md)** - -- **[Shell Command Development Guidelines](shell-command-development-guidelines.md)** - -- **[Shell Command Programming Example](shell-command-programming-example.md)** - -- **[Shell Command Reference](shell-command-reference.md)** - -- **[Magic Key Usage](magic-key-usage.md)** - -- **[User-Space Exception Information](user-space-exception-information.md)** - - diff --git a/en/device-dev/kernel/figures/changing-the-group-of-the-hello-harmony-txt-file-to-100.png b/en/device-dev/kernel/figure/changing-the-group-of-the-hello-harmony-txt-file-to-100.png similarity index 100% rename from en/device-dev/kernel/figures/changing-the-group-of-the-hello-harmony-txt-file-to-100.png rename to en/device-dev/kernel/figure/changing-the-group-of-the-hello-harmony-txt-file-to-100.png diff --git a/en/device-dev/kernel/figures/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png b/en/device-dev/kernel/figure/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png similarity index 100% rename from en/device-dev/kernel/figures/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png rename to en/device-dev/kernel/figure/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png diff --git a/en/device-dev/kernel/figures/changing-the-permission-on-the-hello-harmony-txt-file-to-666.png b/en/device-dev/kernel/figure/changing-the-permission-on-the-hello-harmony-txt-file-to-666.png similarity index 100% rename from en/device-dev/kernel/figures/changing-the-permission-on-the-hello-harmony-txt-file-to-666.png rename to en/device-dev/kernel/figure/changing-the-permission-on-the-hello-harmony-txt-file-to-666.png diff --git a/en/device-dev/kernel/figures/command-output-0.png b/en/device-dev/kernel/figure/command-output-19.png similarity index 100% rename from en/device-dev/kernel/figures/command-output-0.png rename to en/device-dev/kernel/figure/command-output-19.png diff --git a/en/device-dev/kernel/figures/command-output.png b/en/device-dev/kernel/figure/command-output.png similarity index 100% rename from en/device-dev/kernel/figures/command-output.png rename to en/device-dev/kernel/figure/command-output.png diff --git a/en/device-dev/kernel/figures/cpu-usage.png b/en/device-dev/kernel/figure/cpu-usage.png similarity index 100% rename from en/device-dev/kernel/figures/cpu-usage.png rename to en/device-dev/kernel/figure/cpu-usage.png diff --git a/en/device-dev/kernel/figures/creating-file-c.png b/en/device-dev/kernel/figure/creating-file-c.png similarity index 100% rename from en/device-dev/kernel/figures/creating-file-c.png rename to en/device-dev/kernel/figure/creating-file-c.png diff --git a/en/device-dev/kernel/figures/creating-the-share-directory.png b/en/device-dev/kernel/figure/creating-the-share-directory.png similarity index 100% rename from en/device-dev/kernel/figures/creating-the-share-directory.png rename to en/device-dev/kernel/figure/creating-the-share-directory.png diff --git a/en/device-dev/kernel/figures/deleting-directory-dir.png b/en/device-dev/kernel/figure/deleting-directory-dir.png similarity index 100% rename from en/device-dev/kernel/figures/deleting-directory-dir.png rename to en/device-dev/kernel/figure/deleting-directory-dir.png diff --git a/en/device-dev/kernel/figures/deleting-the-log1-txt-file.png b/en/device-dev/kernel/figure/deleting-the-log1-txt-file.png similarity index 100% rename from en/device-dev/kernel/figures/deleting-the-log1-txt-file.png rename to en/device-dev/kernel/figure/deleting-the-log1-txt-file.png diff --git a/en/device-dev/kernel/figures/deleting-the-sd-directory.png b/en/device-dev/kernel/figure/deleting-the-sd-directory.png similarity index 100% rename from en/device-dev/kernel/figures/deleting-the-sd-directory.png rename to en/device-dev/kernel/figure/deleting-the-sd-directory.png diff --git a/en/device-dev/kernel/figures/directory-switching-result.png b/en/device-dev/kernel/figure/directory-switching-result.png similarity index 100% rename from en/device-dev/kernel/figures/directory-switching-result.png rename to en/device-dev/kernel/figure/directory-switching-result.png diff --git a/en/device-dev/kernel/figures/displaying-the-memory-usage-in-three-units.png b/en/device-dev/kernel/figure/displaying-the-memory-usage-in-three-units.png similarity index 100% rename from en/device-dev/kernel/figures/displaying-the-memory-usage-in-three-units.png rename to en/device-dev/kernel/figure/displaying-the-memory-usage-in-three-units.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001051690323.png b/en/device-dev/kernel/figure/en-us_image_0000001051690323.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001051690323.png rename to en/device-dev/kernel/figure/en-us_image_0000001051690323.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001052370303.png b/en/device-dev/kernel/figure/en-us_image_0000001052370303.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001052370303.png rename to en/device-dev/kernel/figure/en-us_image_0000001052370303.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001052370305.png b/en/device-dev/kernel/figure/en-us_image_0000001052370305.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001052370305.png rename to en/device-dev/kernel/figure/en-us_image_0000001052370305.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001052370307.png b/en/device-dev/kernel/figure/en-us_image_0000001052370307.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001052370307.png rename to en/device-dev/kernel/figure/en-us_image_0000001052370307.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001052530298.png b/en/device-dev/kernel/figure/en-us_image_0000001052530298.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001052530298.png rename to en/device-dev/kernel/figure/en-us_image_0000001052530298.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001052810300.png b/en/device-dev/kernel/figure/en-us_image_0000001052810300.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001052810300.png rename to en/device-dev/kernel/figure/en-us_image_0000001052810300.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001052810304.png b/en/device-dev/kernel/figure/en-us_image_0000001052810304.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001052810304.png rename to en/device-dev/kernel/figure/en-us_image_0000001052810304.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001053224218.png b/en/device-dev/kernel/figure/en-us_image_0000001053224218.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001053224218.png rename to en/device-dev/kernel/figure/en-us_image_0000001053224218.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001053710680.png b/en/device-dev/kernel/figure/en-us_image_0000001053710680.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001053710680.png rename to en/device-dev/kernel/figure/en-us_image_0000001053710680.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001053826366.png b/en/device-dev/kernel/figure/en-us_image_0000001053826366.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001053826366.png rename to en/device-dev/kernel/figure/en-us_image_0000001053826366.png diff --git a/en/device-dev/kernel/figures/en-us_image_0000001054624363.png b/en/device-dev/kernel/figure/en-us_image_0000001054624363.png similarity index 100% rename from en/device-dev/kernel/figures/en-us_image_0000001054624363.png rename to en/device-dev/kernel/figure/en-us_image_0000001054624363.png diff --git a/en/device-dev/kernel/figures/file-copying-result.png b/en/device-dev/kernel/figure/file-copying-result.png similarity index 100% rename from en/device-dev/kernel/figures/file-copying-result.png rename to en/device-dev/kernel/figure/file-copying-result.png diff --git a/en/device-dev/kernel/figures/no-out-of-bounds-memory-access.png b/en/device-dev/kernel/figure/no-out-of-bounds-memory-access.png similarity index 100% rename from en/device-dev/kernel/figures/no-out-of-bounds-memory-access.png rename to en/device-dev/kernel/figure/no-out-of-bounds-memory-access.png diff --git a/en/device-dev/kernel/figures/out-of-bounds-memory-access.png b/en/device-dev/kernel/figure/out-of-bounds-memory-access.png similarity index 100% rename from en/device-dev/kernel/figures/out-of-bounds-memory-access.png rename to en/device-dev/kernel/figure/out-of-bounds-memory-access.png diff --git a/en/device-dev/kernel/figures/output-of-telnet-on.png b/en/device-dev/kernel/figure/output-of-telnet-on.png similarity index 100% rename from en/device-dev/kernel/figures/output-of-telnet-on.png rename to en/device-dev/kernel/figure/output-of-telnet-on.png diff --git a/en/device-dev/kernel/figures/output-of-the-statfs-command.png b/en/device-dev/kernel/figure/output-of-the-statfs-command.png similarity index 100% rename from en/device-dev/kernel/figures/output-of-the-statfs-command.png rename to en/device-dev/kernel/figure/output-of-the-statfs-command.png diff --git a/en/device-dev/kernel/figures/posix-framework.png b/en/device-dev/kernel/figure/posix-framework.png similarity index 100% rename from en/device-dev/kernel/figures/posix-framework.png rename to en/device-dev/kernel/figure/posix-framework.png diff --git a/en/device-dev/kernel/figures/querying-information-about-a-specified-software-timer.png b/en/device-dev/kernel/figure/querying-information-about-a-specified-software-timer.png similarity index 100% rename from en/device-dev/kernel/figures/querying-information-about-a-specified-software-timer.png rename to en/device-dev/kernel/figure/querying-information-about-a-specified-software-timer.png diff --git a/en/device-dev/kernel/figures/querying-information-about-all-semaphores-in-use.png b/en/device-dev/kernel/figure/querying-information-about-all-semaphores-in-use.png similarity index 100% rename from en/device-dev/kernel/figures/querying-information-about-all-semaphores-in-use.png rename to en/device-dev/kernel/figure/querying-information-about-all-semaphores-in-use.png diff --git a/en/device-dev/kernel/figures/querying-information-about-all-software-timers.png b/en/device-dev/kernel/figure/querying-information-about-all-software-timers.png similarity index 100% rename from en/device-dev/kernel/figures/querying-information-about-all-software-timers.png rename to en/device-dev/kernel/figure/querying-information-about-all-software-timers.png diff --git a/en/device-dev/kernel/figures/querying-partial-task-information.png b/en/device-dev/kernel/figure/querying-partial-task-information.png similarity index 100% rename from en/device-dev/kernel/figures/querying-partial-task-information.png rename to en/device-dev/kernel/figure/querying-partial-task-information.png diff --git a/en/device-dev/kernel/figures/querying-pids.png b/en/device-dev/kernel/figure/querying-pids.png similarity index 100% rename from en/device-dev/kernel/figures/querying-pids.png rename to en/device-dev/kernel/figure/querying-pids.png diff --git a/en/device-dev/kernel/figures/querying-the-current-path.png b/en/device-dev/kernel/figure/querying-the-current-path.png similarity index 100% rename from en/device-dev/kernel/figures/querying-the-current-path.png rename to en/device-dev/kernel/figure/querying-the-current-path.png diff --git a/en/device-dev/kernel/figures/relationship-between-the-vfs-and-file-systems.png b/en/device-dev/kernel/figure/relationship-between-the-vfs-and-file-systems.png similarity index 100% rename from en/device-dev/kernel/figures/relationship-between-the-vfs-and-file-systems.png rename to en/device-dev/kernel/figure/relationship-between-the-vfs-and-file-systems.png diff --git a/en/device-dev/kernel/figures/sending-a-signal-to-a-specified-process.png b/en/device-dev/kernel/figure/sending-a-signal-to-a-specified-process.png similarity index 100% rename from en/device-dev/kernel/figures/sending-a-signal-to-a-specified-process.png rename to en/device-dev/kernel/figure/sending-a-signal-to-a-specified-process.png diff --git a/en/device-dev/kernel/figures/signal-sending-failure.png b/en/device-dev/kernel/figure/signal-sending-failure.png similarity index 100% rename from en/device-dev/kernel/figures/signal-sending-failure.png rename to en/device-dev/kernel/figure/signal-sending-failure.png diff --git a/en/device-dev/kernel/figures/snipaste_2021-01-26_10-38-58-1.png b/en/device-dev/kernel/figure/snipaste_2021-01-26_10-38-58-20.png similarity index 100% rename from en/device-dev/kernel/figures/snipaste_2021-01-26_10-38-58-1.png rename to en/device-dev/kernel/figure/snipaste_2021-01-26_10-38-58-20.png diff --git a/en/device-dev/kernel/figures/snipaste_2021-01-26_10-38-58-2.png b/en/device-dev/kernel/figure/snipaste_2021-01-26_10-38-58-21.png similarity index 100% rename from en/device-dev/kernel/figures/snipaste_2021-01-26_10-38-58-2.png rename to en/device-dev/kernel/figure/snipaste_2021-01-26_10-38-58-21.png diff --git a/en/device-dev/kernel/figures/snipaste_2021-01-26_10-38-58.png b/en/device-dev/kernel/figure/snipaste_2021-01-26_10-38-58.png similarity index 100% rename from en/device-dev/kernel/figures/snipaste_2021-01-26_10-38-58.png rename to en/device-dev/kernel/figure/snipaste_2021-01-26_10-38-58.png diff --git a/en/device-dev/kernel/figures/state-transition-of-a-process.png b/en/device-dev/kernel/figure/state-transition-of-a-process.png similarity index 100% rename from en/device-dev/kernel/figures/state-transition-of-a-process.png rename to en/device-dev/kernel/figure/state-transition-of-a-process.png diff --git a/en/device-dev/kernel/figures/state-transition-of-a-thread.png b/en/device-dev/kernel/figure/state-transition-of-a-thread.png similarity index 100% rename from en/device-dev/kernel/figures/state-transition-of-a-thread.png rename to en/device-dev/kernel/figure/state-transition-of-a-thread.png diff --git a/en/device-dev/kernel/figures/switching-to-the-user-whose-uid-and-gid-are-both-1000.png b/en/device-dev/kernel/figure/switching-to-the-user-whose-uid-and-gid-are-both-1000.png similarity index 100% rename from en/device-dev/kernel/figures/switching-to-the-user-whose-uid-and-gid-are-both-1000.png rename to en/device-dev/kernel/figure/switching-to-the-user-whose-uid-and-gid-are-both-1000.png diff --git a/en/device-dev/kernel/figures/system-date-printed-based-on-the-specified-format.png b/en/device-dev/kernel/figure/system-date-printed-based-on-the-specified-format.png similarity index 100% rename from en/device-dev/kernel/figures/system-date-printed-based-on-the-specified-format.png rename to en/device-dev/kernel/figure/system-date-printed-based-on-the-specified-format.png diff --git a/en/device-dev/kernel/figures/task-command-monitoring-result.png b/en/device-dev/kernel/figure/task-command-monitoring-result.png similarity index 100% rename from en/device-dev/kernel/figures/task-command-monitoring-result.png rename to en/device-dev/kernel/figure/task-command-monitoring-result.png diff --git a/en/device-dev/kernel/figures/tree-structure-of-the-file-system.png b/en/device-dev/kernel/figure/tree-structure-of-the-file-system.png similarity index 100% rename from en/device-dev/kernel/figures/tree-structure-of-the-file-system.png rename to en/device-dev/kernel/figure/tree-structure-of-the-file-system.png diff --git a/en/device-dev/kernel/figures/unmounting-result.png b/en/device-dev/kernel/figure/unmounting-result.png similarity index 100% rename from en/device-dev/kernel/figures/unmounting-result.png rename to en/device-dev/kernel/figure/unmounting-result.png diff --git a/en/device-dev/kernel/figures/usage-of-system-resources.png b/en/device-dev/kernel/figure/usage-of-system-resources.png similarity index 100% rename from en/device-dev/kernel/figures/usage-of-system-resources.png rename to en/device-dev/kernel/figure/usage-of-system-resources.png diff --git a/en/device-dev/kernel/figures/viewing-content-of-the-current-directory.png b/en/device-dev/kernel/figure/viewing-content-of-the-current-directory.png similarity index 100% rename from en/device-dev/kernel/figures/viewing-content-of-the-current-directory.png rename to en/device-dev/kernel/figure/viewing-content-of-the-current-directory.png diff --git a/en/device-dev/kernel/figures/viewing-content-of-the-hello-harmony-txt-file.png b/en/device-dev/kernel/figure/viewing-content-of-the-hello-harmony-txt-file.png similarity index 100% rename from en/device-dev/kernel/figures/viewing-content-of-the-hello-harmony-txt-file.png rename to en/device-dev/kernel/figure/viewing-content-of-the-hello-harmony-txt-file.png diff --git a/en/device-dev/kernel/figures/viewing-the-usage-of-physical-pages.png b/en/device-dev/kernel/figure/viewing-the-usage-of-physical-pages.png similarity index 100% rename from en/device-dev/kernel/figures/viewing-the-usage-of-physical-pages.png rename to en/device-dev/kernel/figure/viewing-the-usage-of-physical-pages.png diff --git a/en/device-dev/kernel/figures/virtual-memory-usage-of-the-process-with-pid-3.png b/en/device-dev/kernel/figure/virtual-memory-usage-of-the-process-with-pid-3.png similarity index 100% rename from en/device-dev/kernel/figures/virtual-memory-usage-of-the-process-with-pid-3.png rename to en/device-dev/kernel/figure/virtual-memory-usage-of-the-process-with-pid-3.png diff --git a/en/device-dev/kernel/figures/writing-dmesg-content-to-a-file.png b/en/device-dev/kernel/figure/writing-dmesg-content-to-a-file.png similarity index 100% rename from en/device-dev/kernel/figures/writing-dmesg-content-to-a-file.png rename to en/device-dev/kernel/figure/writing-dmesg-content-to-a-file.png diff --git a/en/device-dev/kernel/file-commands.md b/en/device-dev/kernel/file-commands.md deleted file mode 100644 index b75130d6cdb08de238a18e95a0b03e811f9c0f28..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/file-commands.md +++ /dev/null @@ -1,45 +0,0 @@ -# File Commands - -- **[cat](cat.md)** - -- **[cd](cd.md)** - -- **[chgrp](chgrp.md)** - -- **[chmod](chmod.md)** - -- **[chown](chown.md)** - -- **[cp](cp.md)** - -- **[format](format.md)** - -- **[ls](ls.md)** - -- **[lsfd](lsfd.md)** - -- **[mkdir](mkdir.md)** - -- **[mount](mount.md)** - -- **[partinfo](partinfo.md)** - -- **[partition](partition.md)** - -- **[pwd](pwd.md)** - -- **[rm](rm.md)** - -- **[rmdir](rmdir.md)** - -- **[statfs](statfs.md)** - -- **[sync](sync.md)** - -- **[touch](touch.md)** - -- **[writeproc](writeproc.md)** - -- **[umount](umount.md)** - - diff --git a/en/device-dev/kernel/kernel-lite-mini.md b/en/device-dev/kernel/kernel-lite-mini.md new file mode 100644 index 0000000000000000000000000000000000000000..f87451dcc80d174191386a4112bd676fe6a9ab4b --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-mini.md @@ -0,0 +1,2 @@ +# Kernel for Mini Systems + diff --git a/en/device-dev/kernel/kernel-lite-small-basic.md b/en/device-dev/kernel/kernel-lite-small-basic.md new file mode 100644 index 0000000000000000000000000000000000000000..d373831984d8fa1e3dd10572af268edf6444f4c1 --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small-basic.md @@ -0,0 +1,11 @@ +# Basic Kernel + +- **[Process](kernel-lite-small-process.md)** + +- **[Thread](kernel-lite-small-thread.md)** + +- **[Memory](kernel-lite-small-memory.md)** + +- **[Network](kernel-lite-small-net.md)** + + diff --git a/en/device-dev/kernel/fat.md b/en/device-dev/kernel/kernel-lite-small-file-fat.md similarity index 100% rename from en/device-dev/kernel/fat.md rename to en/device-dev/kernel/kernel-lite-small-file-fat.md diff --git a/en/device-dev/kernel/jffs2.md b/en/device-dev/kernel/kernel-lite-small-file-jffs.md similarity index 100% rename from en/device-dev/kernel/jffs2.md rename to en/device-dev/kernel/kernel-lite-small-file-jffs.md diff --git a/en/device-dev/kernel/nfs.md b/en/device-dev/kernel/kernel-lite-small-file-nfs.md similarity index 99% rename from en/device-dev/kernel/nfs.md rename to en/device-dev/kernel/kernel-lite-small-file-nfs.md index 5953ad82e372bd6871d158c2ecd74c21e8efdef3..7b93df28d139c1347f291481370518c7ccb3bbb1 100644 --- a/en/device-dev/kernel/nfs.md +++ b/en/device-dev/kernel/kernel-lite-small-file-nfs.md @@ -116,7 +116,7 @@ An NFS client can mount a directory shared by a remote NFS server to the local h This command mounts the **/home/sqbin/nfs** directory on the NFS server whose IP address is 10.67.212.178 to the **/nfs** directory on the device. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >This section assumes that the NFS server is available, that is, the **/home/sqbin/nfs** directory on the NFS server 10.67.212.178 is accessible. The **mount** command format is as follows: diff --git a/en/device-dev/kernel/ramfs.md b/en/device-dev/kernel/kernel-lite-small-file-ramfs.md similarity index 100% rename from en/device-dev/kernel/ramfs.md rename to en/device-dev/kernel/kernel-lite-small-file-ramfs.md diff --git a/en/device-dev/kernel/vfs.md b/en/device-dev/kernel/kernel-lite-small-file-vfs.md similarity index 97% rename from en/device-dev/kernel/vfs.md rename to en/device-dev/kernel/kernel-lite-small-file-vfs.md index 9b3ea51a6f5eee1b4e968b72ea87052eec067249..8634d9cf6c751e8ef23ce6a2b304c36f40fe9e35 100644 --- a/en/device-dev/kernel/vfs.md +++ b/en/device-dev/kernel/kernel-lite-small-file-vfs.md @@ -17,7 +17,7 @@ In essence, VFS is not a real file system. It is an abstract layer on top of a h Different types of file systems provide different interfaces. If there are multiple types of file systems in the system, different and non-standard interfaces are required for accessing these file systems. The VFS can be introduced as an abstract layer in the system to harmonize the differences between these heterogeneous file systems. In this way, the system does not need to care about the storage medium and file system type at the bottom layer when accessing a file system. The figure below illustrates the relationship between the VFS and file systems. **Figure 1** Relationship between the VFS and file systems -![](figures/relationship-between-the-vfs-and-file-systems.png "relationship-between-the-vfs-and-file-systems") +![](figure/relationship-between-the-vfs-and-file-systems.png "relationship-between-the-vfs-and-file-systems") In the OpenHarmony kernel, the VFS framework is implemented using the tree structure in the memory. Each node in the tree is an **inode** structure. After a device is registered and a file system is mounted, the corresponding node is generated in the tree based on the path. VFS provides the following functions: @@ -35,7 +35,7 @@ There are three types of **inode** tree nodes in the VFS framework memory: - Mount point: used to mount a specific file system, for example, **/vs/sd** or **/mnt** **Figure 2** Tree structure of the file system -![](figures/tree-structure-of-the-file-system.png "tree-structure-of-the-file-system") +![](figure/tree-structure-of-the-file-system.png "tree-structure-of-the-file-system") ## Important Notes @@ -81,7 +81,7 @@ A process can have a maximum of 256 file descriptors \(including file and socket open, close, read, write, seek, ioctl, fcntl, mmap, sync, dup, dup2, truncate, opendir, closedir, readdir, rewinddir, mount, umount, statfs, unlink, remove, mkdir, rmdir, rename, stat, utime, seek64, fallocate, fallocate64, truncate64, chmod, and chown ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >- Currently, only the interfaces for modifying the attributes of JFFS2 files and VFS device nodes are provided. Each system has its own processing mode for attributes such as read-only. >- In the OpenHarmony kernel, the attributes do not conflict with each other, and they can be modified randomly. >- A read-only file or directory in the OpenHarmony kernel cannot be deleted. diff --git a/en/device-dev/kernel/openharmony-lite-kernel-file-system.md b/en/device-dev/kernel/kernel-lite-small-file.md similarity index 92% rename from en/device-dev/kernel/openharmony-lite-kernel-file-system.md rename to en/device-dev/kernel/kernel-lite-small-file.md index 443fc42c437c4eb5b001c163b4ae4b56355186d5..4a1e2be2e6b70eb7d6e18e123e6678de49b0ef30 100644 --- a/en/device-dev/kernel/openharmony-lite-kernel-file-system.md +++ b/en/device-dev/kernel/kernel-lite-small-file.md @@ -1,4 +1,4 @@ -# OpenHarmony Lite Kernel File System +# File System The OpenHarmony lite kernel supports the following file systems: Virtual File System \(VFS\), Network File System \(NFS\), RAM File System \(RAMFS\), File Allocation Table \(FAT\), and Journalling Flash File System Version 2 \(JFFS2\). @@ -41,14 +41,14 @@ The table below describes the functions of these file systems.
-- **[VFS](vfs.md)** +- **[VFS](kernel-lite-small-file-vfs.md)** -- **[NFS](nfs.md)** +- **[NFS](kernel-lite-small-file-nfs.md)** -- **[RAMFS](ramfs.md)** +- **[RAMFS](kernel-lite-small-file-ramfs.md)** -- **[FAT](fat.md)** +- **[FAT](kernel-lite-small-file-fat.md)** -- **[JFFS2](jffs2.md)** +- **[JFFS2](kernel-lite-small-file-jffs.md)** diff --git a/en/device-dev/kernel/differences-from-the-linux-standard-library.md b/en/device-dev/kernel/kernel-lite-small-lib-differ.md similarity index 100% rename from en/device-dev/kernel/differences-from-the-linux-standard-library.md rename to en/device-dev/kernel/kernel-lite-small-lib-differ.md diff --git a/en/device-dev/kernel/standard-library-0.md b/en/device-dev/kernel/kernel-lite-small-lib-standard.md similarity index 95% rename from en/device-dev/kernel/standard-library-0.md rename to en/device-dev/kernel/kernel-lite-small-lib-standard.md index 5d885291e116ea56c42f6865b32e59ab20300950..c617ebcef2bccda9d515a7e88a5a39cd1605cfac 100644 --- a/en/device-dev/kernel/standard-library-0.md +++ b/en/device-dev/kernel/kernel-lite-small-lib-standard.md @@ -4,12 +4,12 @@ - [Development Example](#section4807125622614) - [FAQs](#section1219455217277) -The OpenHarmony kernel uses the **musl libc** library that supports the Portable Operating System Interface \(POSIX\). You can develop components and applications working on the kernel based on the POSIX. +The OpenHarmony kernel uses the **musl libc** library that supports the Portable Operating System Interface \(POSIX\). You can develop components and applications working on the kernel based on the POSIX. ## Framework **Figure 1** POSIX framework -![](figures/posix-framework.png "posix-framework") +![](figure/posix-framework.png "posix-framework") When a system invokes an interface, the OpenHarmony kernel is adapted to provide the interface's external features. diff --git a/en/device-dev/kernel/kernel-lite-small-lib.md b/en/device-dev/kernel/kernel-lite-small-lib.md new file mode 100644 index 0000000000000000000000000000000000000000..7b82773508bebc7f6f2b519897411f9a26df1bc4 --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small-lib.md @@ -0,0 +1,7 @@ +# Standard Library + +- **[Standard Library](kernel-lite-small-lib-standard.md)** + +- **[Differences from the Linux Standard Library](kernel-lite-small-lib-differ.md)** + + diff --git a/en/device-dev/kernel/memory.md b/en/device-dev/kernel/kernel-lite-small-memory.md similarity index 99% rename from en/device-dev/kernel/memory.md rename to en/device-dev/kernel/kernel-lite-small-memory.md index f189a61be22662a5151caf30b45f8c8508487188..7e5191df7b4d967ad5d879522e4a9c372f2a9e2f 100644 --- a/en/device-dev/kernel/memory.md +++ b/en/device-dev/kernel/kernel-lite-small-memory.md @@ -2,7 +2,7 @@ - [Basic Concepts](#section1392116583424) - [When to Use](#section159581619194319) -- [Available APIs](#section114001032104317) +- [API Description](#section114001032104317) ## Basic Concepts @@ -14,7 +14,7 @@ Sound memory management approaches and strategies help you improve software perf For user-space development, the OpenHarmony kernel provides a set of APIs for you to perform memory-related operations, such as memory application, release, remapping, and attribute setting, in addition to standard APIs provided by the C library. -## Available APIs +## API Description **Table 1** Standard APIs in the C library @@ -217,8 +217,8 @@ Details on API differences:
- >![](public_sys-resources/icon-note.gif) **NOTE:** - >For details about the implementation differences between **mmap** and Linux function, see [Differences from the Linux Standard Library](differences-from-the-linux-standard-library.md). + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >For details about the implementation differences between **mmap** and Linux function, see [Differences from the Linux Standard Library](kernel-lite-small-lib-differ.md). **Return values:** diff --git a/en/device-dev/kernel/network.md b/en/device-dev/kernel/kernel-lite-small-net.md similarity index 99% rename from en/device-dev/kernel/network.md rename to en/device-dev/kernel/kernel-lite-small-net.md index 9899f4ae3070ec6ebb1559337782c2d99303f760..0f542fa52928ae3748dc0a6f51bb24a028dda547 100644 --- a/en/device-dev/kernel/network.md +++ b/en/device-dev/kernel/kernel-lite-small-net.md @@ -2,20 +2,20 @@ - [Basic Concepts](#section9840143083510) - [When to Use](#section1575885183516) -- [Description](#section16351198193614) +- [API Description](#section16351198193614) ## Basic Concepts The network module implements basic functions of the TCP/IP protocol stack and provides the standard POSIX socket interfaces. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Currently, the OS uses **lwIP** to provide network capabilities. ## When to Use For user-space development, the OpenHarmony kernel provides a set of APIs for you to implement network functionalities, including creating and disabling sockets, transmitting and receiving data, and setting network attributes, in addition to standard POSIX socket functions provided by the C library. -## Description +## API Description **Table 1** Standard APIs in the C library diff --git a/en/device-dev/kernel/process.md b/en/device-dev/kernel/kernel-lite-small-process.md similarity index 99% rename from en/device-dev/kernel/process.md rename to en/device-dev/kernel/kernel-lite-small-process.md index 6cb4b62be89c4981d339121017e13cf127d2ca83..4ce3abc48b9d4c97f222aa495ec7167a00974567 100644 --- a/en/device-dev/kernel/process.md +++ b/en/device-dev/kernel/kernel-lite-small-process.md @@ -2,7 +2,7 @@ - [Basic Concepts](#section29197338383) - [When to Use](#section85513272398) -- [Available APIs](#section4517119124015) +- [API Description](#section4517119124015) ## Basic Concepts @@ -34,7 +34,7 @@ The user-space root process init is started by the kernel. Then other user-space **Figure 1** State transition of a process -![](figures/state-transition-of-a-process.png "state-transition-of-a-process") +![](figure/state-transition-of-a-process.png "state-transition-of-a-process") **Description of the process state transition:** @@ -74,7 +74,7 @@ The user-space root process init is started by the kernel. Then other user-space After processes are created, you can operate the resources only in your own process space, except shared resources. In user space, processes can be suspended, restored, and delayed. In addition, you can set and obtain the scheduling priority and scheduling policy of processes. When a process is terminated, it proactively releases its resources. However, the PID resources of the process are reclaimed by the parent process via **wait**/**waitpid** or when the parent process exits. -## Available APIs +## API Description The following table describes the APIs provided by the process management module of the OpenHarmony kernel. diff --git a/en/device-dev/kernel/user-space-exception-information.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-abn.md similarity index 100% rename from en/device-dev/kernel/user-space-exception-information.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-abn.md diff --git a/en/device-dev/kernel/cat.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cat.md similarity index 95% rename from en/device-dev/kernel/cat.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cat.md index b6cbfd94caeb9d9e14769da53b3e7ae69df1f4eb..db3798fee685ae6eff096a156023177358810019 100644 --- a/en/device-dev/kernel/cat.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cat.md @@ -49,5 +49,5 @@ Enter **cat hello-harmony.txt**. ## Output **Figure 1** Viewing content of the **hello-harmony.txt** file -![](figures/viewing-content-of-the-hello-harmony-txt-file.png "viewing-content-of-the-hello-harmony-txt-file") +![](figure/viewing-content-of-the-hello-harmony-txt-file.png "viewing-content-of-the-hello-harmony-txt-file") diff --git a/en/device-dev/kernel/cd.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cd.md similarity index 97% rename from en/device-dev/kernel/cd.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cd.md index 52825654be515c883babb87db3131038d7285492..e901db1567ec14955417acda2be585f1b2ecdaf5 100644 --- a/en/device-dev/kernel/cd.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cd.md @@ -53,5 +53,5 @@ Enter **cd ..**. ## Output **Figure 1** Directory switching result -![](figures/directory-switching-result.png "directory-switching-result") +![](figure/directory-switching-result.png "directory-switching-result") diff --git a/en/device-dev/kernel/chgrp.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chgrp.md similarity index 95% rename from en/device-dev/kernel/chgrp.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chgrp.md index bca849032f2c618bf837b6a5b052edf7a1d4a384..b9fdfe09c32a883f3fdec32d4f421c0975f1b4f5 100644 --- a/en/device-dev/kernel/chgrp.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chgrp.md @@ -56,5 +56,5 @@ Enter **chgrp 100 hello-harmony.txt**. ## Output **Figure 1** Changing the group of the **hello-harmony.txt** file to **100** -![](figures/changing-the-group-of-the-hello-harmony-txt-file-to-100.png "changing-the-group-of-the-hello-harmony-txt-file-to-100") +![](figure/changing-the-group-of-the-hello-harmony-txt-file-to-100.png "changing-the-group-of-the-hello-harmony-txt-file-to-100") diff --git a/en/device-dev/kernel/chmod.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chmod.md similarity index 96% rename from en/device-dev/kernel/chmod.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chmod.md index 0645a96d31a8c52cd6c39b11213154c2bdf36025..734b648c4f321c31da9dad7fad892444a5acd8df 100644 --- a/en/device-dev/kernel/chmod.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chmod.md @@ -56,5 +56,5 @@ Enter **chmod 666 hello-harmony.txt**. ## Output **Figure 1** Changing the permission on the **hello-harmony.txt** file to **666** -![](figures/changing-the-permission-on-the-hello-harmony-txt-file-to-666.png "changing-the-permission-on-the-hello-harmony-txt-file-to-666") +![](figure/changing-the-permission-on-the-hello-harmony-txt-file-to-666.png "changing-the-permission-on-the-hello-harmony-txt-file-to-666") diff --git a/en/device-dev/kernel/chown.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chown.md similarity index 95% rename from en/device-dev/kernel/chown.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chown.md index 39b3ed6e04da7941af5a86e6023766f319e8de94..62683b53615c8e753ec9db80e00b72693ae9f96a 100644 --- a/en/device-dev/kernel/chown.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-chown.md @@ -65,5 +65,5 @@ Enter **chown 100 200 hello-harmony.txt**. ## Output **Figure 1** Changing the owner and group of the hello-harmony.txt file to 100 and 200 respectively -![](figures/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png "changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively") +![](figure/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png "changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively") diff --git a/en/device-dev/kernel/cp.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cp.md similarity index 98% rename from en/device-dev/kernel/cp.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cp.md index e5c6d12695b650a2268fa6defe5371a2a78dd7bd..d654bd86f5da5f1dad144220e3955fc67e4a7599 100644 --- a/en/device-dev/kernel/cp.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-cp.md @@ -64,5 +64,5 @@ Enter **cp hello-harmony.txt ./tmp/**. ## Output **Figure 1** File copying result -![](figures/file-copying-result.png "file-copying-result") +![](figure/file-copying-result.png "file-copying-result") diff --git a/en/device-dev/kernel/format.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-format.md similarity index 99% rename from en/device-dev/kernel/format.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-format.md index 11336955c0987b66e83d272edda4b12e36a52b30..06ff11d299af0cae40e548e8da3263cc7aaed5ed 100644 --- a/en/device-dev/kernel/format.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-format.md @@ -65,5 +65,5 @@ Enter **format /dev/mmcblk0 128 2**. Formatting result -![](figures/en-us_image_0000001052370307.png) +![](figure/en-us_image_0000001052370307.png) diff --git a/en/device-dev/kernel/ls.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-is.md similarity index 97% rename from en/device-dev/kernel/ls.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-is.md index 24912f8546337540b7037276d62b1c531156f33c..20a95c9dcf2ffd4804a13d1d2a9f7d30b1e1b962 100644 --- a/en/device-dev/kernel/ls.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-is.md @@ -54,5 +54,5 @@ Enter **ls**. ## Output **Figure 1** Viewing content of the current directory -![](figures/viewing-content-of-the-current-directory.png "viewing-content-of-the-current-directory") +![](figure/viewing-content-of-the-current-directory.png "viewing-content-of-the-current-directory") diff --git a/en/device-dev/kernel/lsfd.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-isfd.md similarity index 93% rename from en/device-dev/kernel/lsfd.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-isfd.md index 950cfda3a3dad5c6aae7292e1b23298a89d24ec0..02962165e1e8998171905ffdcc3fea368c973eb6 100644 --- a/en/device-dev/kernel/lsfd.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-isfd.md @@ -25,5 +25,5 @@ Enter **lsfd**. ## Output **Figure 1** Command output -![](figures/command-output-0.png "command-output-0") +![](figure/command-output-19.png "command-output-19") diff --git a/en/device-dev/kernel/mkdir.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-mkdir.md similarity index 97% rename from en/device-dev/kernel/mkdir.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-mkdir.md index 37e762b7f7c5f8d5bbe3e8ccaecaf863175adc73..77106a85f0ff8cea82322cafbaf3a62fd5051f1a 100644 --- a/en/device-dev/kernel/mkdir.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-mkdir.md @@ -50,5 +50,5 @@ Enter **mkdir share**. ## Output **Figure 1** Creating the share directory -![](figures/creating-the-share-directory.png "creating-the-share-directory") +![](figure/creating-the-share-directory.png "creating-the-share-directory") diff --git a/en/device-dev/kernel/mount.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-mount.md similarity index 99% rename from en/device-dev/kernel/mount.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-mount.md index 4ba01ec183a67d020cb1fd33e295f1dd104f4d20..37feb309a276cdc1d5ccb7c8c339c219141b2507 100644 --- a/en/device-dev/kernel/mount.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-mount.md @@ -74,5 +74,5 @@ Enter **mount /dev/mmcblk0p0 /bin1/vs/sd vfat**. Mounting **/dev/mmcblk0p0** to the **/bin1/vs/sd** directory -![](figures/en-us_image_0000001051690323.png) +![](figure/en-us_image_0000001051690323.png) diff --git a/en/device-dev/kernel/partinfo.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-part.md similarity index 98% rename from en/device-dev/kernel/partinfo.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-part.md index 0de22f29a1033c0187ec9a97b384cbba7b3f12b1..da5b18b5bdd5e36f0fe08c425ded9138dddb6df5 100644 --- a/en/device-dev/kernel/partinfo.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-part.md @@ -48,5 +48,5 @@ Enter **partinfo /dev/mmcblk0p0**. ## Output -![](figures/en-us_image_0000001052370303.png) +![](figure/en-us_image_0000001052370303.png) diff --git a/en/device-dev/kernel/partition.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-partion.md similarity index 98% rename from en/device-dev/kernel/partition.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-partion.md index adebf41920c2a0f957c11020848dba1feb22e93d..837e05d60891cbf73bac965aed673f4f2b341026 100644 --- a/en/device-dev/kernel/partition.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-partion.md @@ -58,5 +58,5 @@ Enter **partition spinor**. Viewing spinor flash partition information -![](figures/en-us_image_0000001052810300.png) +![](figure/en-us_image_0000001052810300.png) diff --git a/en/device-dev/kernel/pwd.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-pwd.md similarity index 93% rename from en/device-dev/kernel/pwd.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-pwd.md index f277c5391ef0a704c51ab67b29126c8868b5a09c..9f7182efd733fd05cad0f0a4c8d78f60ac50b074 100644 --- a/en/device-dev/kernel/pwd.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-pwd.md @@ -30,5 +30,5 @@ Enter **pwd**. ## Output **Figure 1** Querying the current path -![](figures/querying-the-current-path.png "querying-the-current-path") +![](figure/querying-the-current-path.png "querying-the-current-path") diff --git a/en/device-dev/kernel/rm.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-rm.md similarity index 95% rename from en/device-dev/kernel/rm.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-rm.md index b828771a11901997a0efc0dc09fcd4d9c118b507..072bb443e543c0309a97877e7f6a571387b5095f 100644 --- a/en/device-dev/kernel/rm.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-rm.md @@ -60,8 +60,8 @@ Example: ## Output **Figure 1** Deleting the **log1.txt** file -![](figures/deleting-the-log1-txt-file.png "deleting-the-log1-txt-file") +![](figure/deleting-the-log1-txt-file.png "deleting-the-log1-txt-file") **Figure 2** Deleting the **sd** directory -![](figures/deleting-the-sd-directory.png "deleting-the-sd-directory") +![](figure/deleting-the-sd-directory.png "deleting-the-sd-directory") diff --git a/en/device-dev/kernel/rmdir.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-rmdir.md similarity index 97% rename from en/device-dev/kernel/rmdir.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-rmdir.md index 9d35e2c1c866847aa54c83fc216df38bec50a791..78b7459cd91a8b17f9a7dcc2770362f6599ca5ec 100644 --- a/en/device-dev/kernel/rmdir.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-rmdir.md @@ -51,5 +51,5 @@ Enter **rmdir dir**. ## Output **Figure 1** Deleting directory **dir** -![](figures/deleting-directory-dir.png "deleting-directory-dir") +![](figure/deleting-directory-dir.png "deleting-directory-dir") diff --git a/en/device-dev/kernel/statfs.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-sta.md similarity index 97% rename from en/device-dev/kernel/statfs.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-sta.md index e823440c5929b4fc2e927264d44faf225dbdb6b6..d2dc901d2cd4c7bc8907b3a9dff3a4812ea099ea 100644 --- a/en/device-dev/kernel/statfs.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-sta.md @@ -48,5 +48,5 @@ The following uses the NFS file system as an example: Enter **statfs /nfs**. **Figure 1** Output of the statfs command -![](figures/output-of-the-statfs-command.png "output-of-the-statfs-command") +![](figure/output-of-the-statfs-command.png "output-of-the-statfs-command") diff --git a/en/device-dev/kernel/sync.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-sync.md similarity index 100% rename from en/device-dev/kernel/sync.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-sync.md diff --git a/en/device-dev/kernel/touch.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-touch.md similarity index 96% rename from en/device-dev/kernel/touch.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-touch.md index 8b7b21b93d9b80b2511074ab59eadede0855aa7d..eef1d51cfac06ed388294a2cf896960faf4510ed 100644 --- a/en/device-dev/kernel/touch.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-touch.md @@ -44,7 +44,7 @@ touch \[_filename_\] - The **touch** command creates a read-write empty file. - The **touch** command creates only one file at a time. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >If you run the **touch** command to create a file in a path storing important system resources, unexpected results such as a system breakdown may occur. For example, if you run the **touch uartdev-0** command in the **/dev** path, the system may stop responding. @@ -55,5 +55,5 @@ Enter **touch file.c**. ## Output **Figure 1** Creating **file.c** -![](figures/creating-file-c.png "creating-file-c") +![](figure/creating-file-c.png "creating-file-c") diff --git a/en/device-dev/kernel/umount.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-umount.md similarity index 97% rename from en/device-dev/kernel/umount.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-umount.md index 931ab380dfe501594c0c3a0122b98254682d61df..ad2e4575a2e6bc658144afb407ae1a27fd95e468 100644 --- a/en/device-dev/kernel/umount.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-umount.md @@ -51,5 +51,5 @@ Enter **umount /bin1/vs/sd**. Unmounting the file system from **/bin1/vs/sd** **Figure 1** Unmounting result -![](figures/unmounting-result.png "unmounting-result") +![](figure/unmounting-result.png "unmounting-result") diff --git a/en/device-dev/kernel/writeproc.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-write.md similarity index 97% rename from en/device-dev/kernel/writeproc.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-file-write.md index c7b4c69b6e8b7eac0963d68a62a85f665c5c9c37..5bffaf6a19ae64f27475d646b8982f31c8012d36 100644 --- a/en/device-dev/kernel/writeproc.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file-write.md @@ -49,7 +49,7 @@ writeproc <_data_\> \>\> /proc/<_filename_\> The proc file implements its own **write** command. After the **writeproc** command is called, the input parameter will be passed to the **write** command. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The proc file system does not support multi-thread access. ## Example @@ -64,6 +64,6 @@ OHOS \# writeproc test \>\> /proc/uptime test \>\> /proc/uptime ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The uptime proc file temporarily implements the **write** command. The **INFO** log is generated by the implemented **test** command. diff --git a/en/device-dev/kernel/kernel-lite-small-shell-cmd-file.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file.md new file mode 100644 index 0000000000000000000000000000000000000000..b47f48fbebd91c9f0edb883f48aa53b360100b46 --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-file.md @@ -0,0 +1,45 @@ +# File Commands + +- **[cat](kernel-lite-small-shell-cmd-file-cat.md)** + +- **[cd](kernel-lite-small-shell-cmd-file-cd.md)** + +- **[chgrp](kernel-lite-small-shell-cmd-file-chgrp.md)** + +- **[chmod](kernel-lite-small-shell-cmd-file-chmod.md)** + +- **[chown](kernel-lite-small-shell-cmd-file-chown.md)** + +- **[cp](kernel-lite-small-shell-cmd-file-cp.md)** + +- **[format](kernel-lite-small-shell-cmd-file-format.md)** + +- **[ls](kernel-lite-small-shell-cmd-file-is.md)** + +- **[lsfd](kernel-lite-small-shell-cmd-file-isfd.md)** + +- **[mkdir](kernel-lite-small-shell-cmd-file-mkdir.md)** + +- **[mount](kernel-lite-small-shell-cmd-file-mount.md)** + +- **[partinfo](kernel-lite-small-shell-cmd-file-part.md)** + +- **[partition](kernel-lite-small-shell-cmd-file-partion.md)** + +- **[pwd](kernel-lite-small-shell-cmd-file-pwd.md)** + +- **[rm](kernel-lite-small-shell-cmd-file-rm.md)** + +- **[rmdir](kernel-lite-small-shell-cmd-file-rmdir.md)** + +- **[statfs](kernel-lite-small-shell-cmd-file-sta.md)** + +- **[sync](kernel-lite-small-shell-cmd-file-sync.md)** + +- **[touch](kernel-lite-small-shell-cmd-file-touch.md)** + +- **[writeproc](kernel-lite-small-shell-cmd-file-write.md)** + +- **[umount](kernel-lite-small-shell-cmd-file-umount.md)** + + diff --git a/en/device-dev/kernel/magic-key-usage.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-mag.md similarity index 95% rename from en/device-dev/kernel/magic-key-usage.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-mag.md index 4beecc99310464737b92ebca1cf1d75d2ba898a4..9bcfa88de03da750fda2be03b4ef15505a27c91f 100644 --- a/en/device-dev/kernel/magic-key-usage.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-mag.md @@ -19,7 +19,7 @@ Debug ---\> Enable MAGIC KEY If this configuration item is disabled, the magic key is invalid. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >1. In **menuconfig**, you can move the cursor to **LOSCFG\_ENABLE\_MAGICKEY** and enter a question mark \(?\) to view the help information. 2. Press **Ctrl+R** to enable the magic key detection function. @@ -35,6 +35,6 @@ When the UART or USB-to-virtual serial port is connected, press **Ctrl+R** to - **Ctrl+E**: The system checks the integrity of the memory pool. If an error is detected, the system displays an error message. If no error is detected, the system displays "system memcheck over, all passed!". ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >When the magic key detection function is enabled and special characters need to be entered through the UART or USB-to-virtual serial port, ensure that the special characters are not the same as the magic key values. Otherwise, the magic key may be triggered by mistake, which may cause errors in the original design. diff --git a/en/device-dev/kernel/arp.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-arp.md similarity index 99% rename from en/device-dev/kernel/arp.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-arp.md index 0589669289c590d43958472e8a660866098dd165..b0267af58de2fbc692cabe60efe2f02ba0c367ad 100644 --- a/en/device-dev/kernel/arp.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-arp.md @@ -77,7 +77,7 @@ Example: **Figure 1** Printing the entire ARP cache table - ![](figures/snipaste_2021-01-26_10-38-58.png) + ![](figure/snipaste_2021-01-26_10-38-58.png) **Table 2** Output description diff --git a/en/device-dev/kernel/dhclient.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-dh.md similarity index 99% rename from en/device-dev/kernel/dhclient.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-dh.md index ab3f5ba9984951888a488e883d602f852d61d50c..fd93fad650c847384d2b77405089bf6c8780d450 100644 --- a/en/device-dev/kernel/dhclient.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-dh.md @@ -110,7 +110,7 @@ dhclient -sd 8.8.8.8 ## Example -![](figures/en-us_image_0000001053224218.png) +![](figure/en-us_image_0000001053224218.png) ## Output diff --git a/en/device-dev/kernel/dns.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-dns.md similarity index 100% rename from en/device-dev/kernel/dns.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-dns.md diff --git a/en/device-dev/kernel/ifconfig.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipc.md similarity index 100% rename from en/device-dev/kernel/ifconfig.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipc.md diff --git a/en/device-dev/kernel/ipdebug.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipd.md similarity index 100% rename from en/device-dev/kernel/ipdebug.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipd.md diff --git a/en/device-dev/kernel/netstat.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-net.md similarity index 97% rename from en/device-dev/kernel/netstat.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-net.md index fe85534166fe35e43d60fb59c6e160340485df9f..362fa9a4301ca48b86cab9e2732fcfdfd9a89c4e 100644 --- a/en/device-dev/kernel/netstat.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-net.md @@ -30,7 +30,7 @@ Enter **netstat**. **Figure 1** Output information -![](figures/snipaste_2021-01-26_10-38-58-1.png) +![](figure/snipaste_2021-01-26_10-38-58-20.png) ## Output @@ -78,6 +78,6 @@ Enter **netstat**.
->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The command output like "========== total sockets 32 ====== unused sockets 22 BootTime 27 s ==========" indicates that there are 32 sockets in total, 22 sockets are not used, and it has been 27 seconds since the system starts. diff --git a/en/device-dev/kernel/ntpdate.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ntp.md similarity index 100% rename from en/device-dev/kernel/ntpdate.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ntp.md diff --git a/en/device-dev/kernel/ping.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping.md similarity index 99% rename from en/device-dev/kernel/ping.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping.md index 8a829c7ee45729bd729c292bf7e52751f9a8e354..0d83722cacc365360530ae1ea7d9e141cb86155c 100644 --- a/en/device-dev/kernel/ping.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping.md @@ -94,5 +94,5 @@ Enter **ping 192.168.1.10**. **Figure 1** Output of pinging the IP address of the TFTP server -![](figures/snipaste_2021-01-26_10-38-58-2.png) +![](figure/snipaste_2021-01-26_10-38-58-21.png) diff --git a/en/device-dev/kernel/ping6.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping6.md similarity index 100% rename from en/device-dev/kernel/ping6.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping6.md diff --git a/en/device-dev/kernel/telnet.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-tel.md similarity index 96% rename from en/device-dev/kernel/telnet.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-tel.md index d58498d777835091a5e536dd4db6549daa67e0f1..30c190696e0d3b2ef1a2ead7cc8d1e25997909b3 100644 --- a/en/device-dev/kernel/telnet.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-tel.md @@ -50,7 +50,7 @@ telnet \[_on | off_\] - Before enabling Telnet, ensure that the network driver and network protocol stack have been initialized and the NIC of the board is in the **link up** state. - Currently, multiple clients \(Telnet + IP\) cannot connect to the development board at the same time. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >Telnet is under debugging and disabled by default. Do not use it in formal products. @@ -61,5 +61,5 @@ Enter **telnet on**. ## Output **Figure 1** Output of **telnet on** -![](figures/output-of-telnet-on.png "output-of-telnet-on") +![](figure/output-of-telnet-on.png "output-of-telnet-on") diff --git a/en/device-dev/kernel/tftp.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-tftp.md similarity index 98% rename from en/device-dev/kernel/tftp.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-net-tftp.md index c1bbd2eba3924c83503b38a30e0a39d5cc14d20b..3da40ac274b26ac660065256ad5d8a99c9da8468 100644 --- a/en/device-dev/kernel/tftp.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net-tftp.md @@ -68,7 +68,7 @@ The **tftp** command is used to download files from the TFTP server. 2. Use the **tftp** command to upload and download files on the OpenHarmony board. 3. The size of the file to be transferred cannot exceed 32 MB. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >TFTP is under debugging and disabled by default. Do not use it in formal products. diff --git a/en/device-dev/kernel/kernel-lite-small-shell-cmd-net.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net.md new file mode 100644 index 0000000000000000000000000000000000000000..68d76bf26eccdeef28fa67938389cdae428d81f4 --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-net.md @@ -0,0 +1,25 @@ +# Network Commands + +- **[arp](kernel-lite-small-shell-cmd-net-arp.md)** + +- **[dhclient](kernel-lite-small-shell-cmd-net-dh.md)** + +- **[dns](kernel-lite-small-shell-cmd-net-dns.md)** + +- **[ifconfig](kernel-lite-small-shell-cmd-net-ipc.md)** + +- **[ipdebug](kernel-lite-small-shell-cmd-net-ipd.md)** + +- **[netstat](kernel-lite-small-shell-cmd-net-net.md)** + +- **[ntpdate](kernel-lite-small-shell-cmd-net-ntp.md)** + +- **[ping](kernel-lite-small-shell-cmd-net-ping.md)** + +- **[ping6](kernel-lite-small-shell-cmd-net-ping6.md)** + +- **[telnet](kernel-lite-small-shell-cmd-net-tel.md)** + +- **[tftp](kernel-lite-small-shell-cmd-net-tftp.md)** + + diff --git a/en/device-dev/kernel/cpup.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-cpup.md similarity index 98% rename from en/device-dev/kernel/cpup.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-cpup.md index 0eb2985b3f8b471862be7f0a17350dce9cebf200..fc8d35798807612cd32d68d78af1735edab736fc 100644 --- a/en/device-dev/kernel/cpup.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-cpup.md @@ -59,5 +59,5 @@ Enter **cpup 1 5**. ## Output **Figure 1** CPU usage -![](figures/cpu-usage.png "cpu-usage") +![](figure/cpu-usage.png "cpu-usage") diff --git a/en/device-dev/kernel/date.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-date.md similarity index 97% rename from en/device-dev/kernel/date.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-date.md index f9e52b6c1cd360f4fd263340730bebf5c60eae56..ebd63e75d05e9f349275be20f465b3c3a15ca561 100644 --- a/en/device-dev/kernel/date.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-date.md @@ -88,5 +88,5 @@ Enter **date +%Y--%m--%d**. ## Output **Figure 1** System date printed based on the specified format -![](figures/system-date-printed-based-on-the-specified-format.png "system-date-printed-based-on-the-specified-format") +![](figure/system-date-printed-based-on-the-specified-format.png "system-date-printed-based-on-the-specified-format") diff --git a/en/device-dev/kernel/dmesg.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-demsg.md similarity index 98% rename from en/device-dev/kernel/dmesg.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-demsg.md index 4890f812707b7308504c214a5157a751b4a3d665..d122787795603df26b1d319151fa094c4cd674fa 100644 --- a/en/device-dev/kernel/dmesg.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-demsg.md @@ -107,5 +107,5 @@ Enter **dmesg \> /usr/dmesg.log**. ## Output **Figure 1** Writing dmesg content to a file -![](figures/writing-dmesg-content-to-a-file.png "writing-dmesg-content-to-a-file") +![](figure/writing-dmesg-content-to-a-file.png "writing-dmesg-content-to-a-file") diff --git a/en/device-dev/kernel/exec.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-exec.md similarity index 98% rename from en/device-dev/kernel/exec.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-exec.md index 3db30ca0a4ee351d499fea9431203c046b9f5202..e68a27f893b835538ac24e9ed38eacf4854d10ed 100644 --- a/en/device-dev/kernel/exec.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-exec.md @@ -53,6 +53,6 @@ OHOS # exec helloworld OHOS # hello world! ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >After the executable file is executed, prompt **OHOS \#** is printed first. The shell **exec** command is executed in the background, causing the prompt to be printed in advance. diff --git a/en/device-dev/kernel/free.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-free.md similarity index 98% rename from en/device-dev/kernel/free.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-free.md index 640004a9f60ae70c204fde9d9d11de93ce085aed..09e281e9f498c2673b1c71974cc80ab23cc4cce0 100644 --- a/en/device-dev/kernel/free.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-free.md @@ -63,7 +63,7 @@ Enter **free**, **free -k**, and **free -m**, respectively. ## Output **Figure 1** Displaying the memory usage in three units -![](figures/displaying-the-memory-usage-in-three-units.png "displaying-the-memory-usage-in-three-units") +![](figure/displaying-the-memory-usage-in-three-units.png "displaying-the-memory-usage-in-three-units") **Table 2** Output description diff --git a/en/device-dev/kernel/help.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-help.md similarity index 100% rename from en/device-dev/kernel/help.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-help.md diff --git a/en/device-dev/kernel/hwi.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-hwi.md similarity index 98% rename from en/device-dev/kernel/hwi.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-hwi.md index 72d7bd3f10e5f63e42cb4989259c76e187a9d4a6..90027ac456a656ca1dd41d7451491df2caba5ba7 100644 --- a/en/device-dev/kernel/hwi.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-hwi.md @@ -32,11 +32,11 @@ Enter **hwi**. 1. Interrupt information \(with **LOSCFG\_CPUP\_INCLUDE\_IRQ** disabled\) - ![](figures/en-us_image_0000001053826366.png) + ![](figure/en-us_image_0000001053826366.png) 2. Interrupt information \(with **LOSCFG\_CPUP\_INCLUDE\_IRQ** enabled\) - ![](figures/en-us_image_0000001052810304.png) + ![](figure/en-us_image_0000001052810304.png) **Table 1** Output description diff --git a/en/device-dev/kernel/kill.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-kill.md similarity index 92% rename from en/device-dev/kernel/kill.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-kill.md index 72a2a65937e17fba4e5dd277d6284126ffa04ee7..3b69b6c8da73988cfbd00566587adffc425613b7 100644 --- a/en/device-dev/kernel/kill.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-kill.md @@ -45,7 +45,7 @@ kill \[_signo_ | _-signo_\] \[_pid_\]
->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The valid range of the **signo** value is \[0, 64\], and the recommended value range is \[1, 30\]. Other values in the valid range are reserved. ## Usage @@ -59,24 +59,24 @@ The **pid** value range varies depending on the system configuration. For exam 1. Query the current process list and determine the PID \(7\) of the process to be killed. **Figure 1** Querying PIDs -![](figures/querying-pids.png "querying-pids") +![](figure/querying-pids.png "querying-pids") 2. Run **kill 14 7** to send signal 14 \(the default behavior of **SIGALRM** is to terminate the process\) to process 7 **helloworld\_d** \(user-space\). Then query the current process list. Process 7 has been terminated. The result of the **kill 14 7** command is the same as that of the **kill -14 7** command. **Figure 2** Command output -![](figures/command-output.png "command-output") +![](figure/command-output.png "command-output") ## Output The command output is as follows: **Figure 3** Sending a signal to a specified process -![](figures/sending-a-signal-to-a-specified-process.png "sending-a-signal-to-a-specified-process") +![](figure/sending-a-signal-to-a-specified-process.png "sending-a-signal-to-a-specified-process") The signal is successfully sent if no error is reported. **Figure 4** Signal sending failure -![](figures/signal-sending-failure.png "signal-sending-failure") +![](figure/signal-sending-failure.png "signal-sending-failure") The preceding figure shows a signal sending failure caused by invalid parameters. In this case, check that the signal ID and PID are valid. diff --git a/en/device-dev/kernel/log.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-log.md similarity index 98% rename from en/device-dev/kernel/log.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-log.md index 7702a920dc8d7520de4f78100dcb4b5f39474b90..ae7b0cde098849ed4a0762b59394ac75531c7fc7 100644 --- a/en/device-dev/kernel/log.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-log.md @@ -68,5 +68,5 @@ Enter **log level 4**. ## Output -![](figures/en-us_image_0000001052530298.png) +![](figure/en-us_image_0000001052530298.png) diff --git a/en/device-dev/kernel/memcheck.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-mem.md similarity index 88% rename from en/device-dev/kernel/memcheck.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-mem.md index 20e8bbccbf638aef8861aeabe4017c133aab7b1a..965a6eb17045482ecf59a9e19e0f4e8e5e7cfa77 100644 --- a/en/device-dev/kernel/memcheck.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-mem.md @@ -31,8 +31,8 @@ Enter **memcheck**. ## Output **Figure 1** No out-of-bounds memory access -![](figures/no-out-of-bounds-memory-access.png "no-out-of-bounds-memory-access") +![](figure/no-out-of-bounds-memory-access.png "no-out-of-bounds-memory-access") **Figure 2** Out-of-bounds memory access -![](figures/out-of-bounds-memory-access.png "out-of-bounds-memory-access") +![](figure/out-of-bounds-memory-access.png "out-of-bounds-memory-access") diff --git a/en/device-dev/kernel/oom.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-oom.md similarity index 99% rename from en/device-dev/kernel/oom.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-oom.md index f97c98347a567e251f5003483d9c214cb02b9351..7748844b3fc8ddc7d2a213b262481fc554aaa1be 100644 --- a/en/device-dev/kernel/oom.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-oom.md @@ -77,7 +77,7 @@ When the system memory is insufficient, the system displays a message indicating ## Output -![](figures/en-us_image_0000001053710680.png) +![](figure/en-us_image_0000001053710680.png) **Table 2** Output description diff --git a/en/device-dev/kernel/pmm.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-pmm.md similarity index 98% rename from en/device-dev/kernel/pmm.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-pmm.md index 6d44a3c6f051735afc8e97fbb3bcce8400c81526..34e2594d5d6d61d6cbb935b62986eb796334d5b5 100644 --- a/en/device-dev/kernel/pmm.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-pmm.md @@ -30,7 +30,7 @@ Enter **pmm**. ## Output **Figure 1** Viewing the usage of physical pages -![](figures/viewing-the-usage-of-physical-pages.png "viewing-the-usage-of-physical-pages") +![](figure/viewing-the-usage-of-physical-pages.png "viewing-the-usage-of-physical-pages") **Table 1** Output description diff --git a/en/device-dev/kernel/reset.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-reset.md similarity index 100% rename from en/device-dev/kernel/reset.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-reset.md diff --git a/en/device-dev/kernel/sem.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sem.md similarity index 97% rename from en/device-dev/kernel/sem.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sem.md index 08e04352c5934a4fc38310df39c7c2133558fc61..1941131dd0fcc3a410f4786a9491a2ee34d79547 100644 --- a/en/device-dev/kernel/sem.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sem.md @@ -61,7 +61,7 @@ Example 1: Enter **sem fulldata**. ## Output **Figure 1** Querying information about all semaphores in use -![](figures/querying-information-about-all-semaphores-in-use.png "querying-information-about-all-semaphores-in-use") +![](figure/querying-information-about-all-semaphores-in-use.png "querying-information-about-all-semaphores-in-use") **Table 2** Output description @@ -85,7 +85,7 @@ Example 1: Enter **sem fulldata**.
->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >- The **ID** value can be in decimal or hexadecimal format. >- When the **ID** value is within the range of \[0, 1023\], semaphore information of the specified ID is displayed. If the semaphore ID is not used, a message is displayed to inform you of this case. For other values, a message is displayed indicating that the input parameter is incorrect. diff --git a/en/device-dev/kernel/stack.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-stack.md similarity index 98% rename from en/device-dev/kernel/stack.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-stack.md index a3bf37a1c193ebe6f7c86b8bd9d2713452081a0e..e9d5ab785c3dbca69d6245083c90e6522e3fd826 100644 --- a/en/device-dev/kernel/stack.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-stack.md @@ -32,7 +32,7 @@ Enter **stack**. **Figure 1** System stack usage -![](figures/en-us_image_0000001054624363.png) +![](figure/en-us_image_0000001054624363.png) **Table 1** Output description diff --git a/en/device-dev/kernel/su.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-su.md similarity index 96% rename from en/device-dev/kernel/su.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-su.md index 77c7843aff7eae3a28492e61b375231d1ae01efb..44f370e01867c0ac061f77598d178c93d71241fb 100644 --- a/en/device-dev/kernel/su.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-su.md @@ -58,5 +58,5 @@ Enter **su 1000 1000**. ## Output **Figure 1** Switching to the user whose **uid** and **gid** are both **1000** -![](figures/switching-to-the-user-whose-uid-and-gid-are-both-1000.png "switching-to-the-user-whose-uid-and-gid-are-both-1000") +![](figure/switching-to-the-user-whose-uid-and-gid-are-both-1000.png "switching-to-the-user-whose-uid-and-gid-are-both-1000") diff --git a/en/device-dev/kernel/swtmr.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-swymr.md similarity index 95% rename from en/device-dev/kernel/swtmr.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-swymr.md index 69b4720d91e1e8a1a55141eb3350294de7e438e9..c69f0d3c071d618f595d4418f3763b05ebda77eb 100644 --- a/en/device-dev/kernel/swtmr.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-swymr.md @@ -50,10 +50,10 @@ Enter **swtmr** and **swtmr 1**. ## Output **Figure 1** Querying information about all software timers -![](figures/querying-information-about-all-software-timers.png "querying-information-about-all-software-timers") +![](figure/querying-information-about-all-software-timers.png "querying-information-about-all-software-timers") **Figure 2** Querying information about a specified software timer -![](figures/querying-information-about-a-specified-software-timer.png "querying-information-about-a-specified-software-timer") +![](figure/querying-information-about-a-specified-software-timer.png "querying-information-about-a-specified-software-timer") **Table 2** Output description @@ -104,7 +104,7 @@ Enter **swtmr** and **swtmr 1**.
->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >- The **ID** value can be in decimal or hexadecimal format. >- If the **ID** value is within the range of \[0, _Number of current software timers - 1_\], the status of the specified software timer is returned. For other values, an error message is displayed. diff --git a/en/device-dev/kernel/systeminfo.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md similarity index 98% rename from en/device-dev/kernel/systeminfo.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md index 058d899cdf7b4d1213763e531237f2c518e91a9f..8868225020ea651976928fda71a42afe12fc715c 100644 --- a/en/device-dev/kernel/systeminfo.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md @@ -30,7 +30,7 @@ Enter **systeminfo**. ## Output **Figure 1** Usage of system resources -![](figures/usage-of-system-resources.png "usage-of-system-resources") +![](figure/usage-of-system-resources.png "usage-of-system-resources") **Table 1** Output description diff --git a/en/device-dev/kernel/task.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-task.md similarity index 98% rename from en/device-dev/kernel/task.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-task.md index 4bac34f5c9b33579900118efb6267edae157999d..bcef76f8b87049ab74a81be659756f7721caf3b0 100644 --- a/en/device-dev/kernel/task.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-task.md @@ -49,7 +49,7 @@ Enter **task**. ## Output **Figure 1** Querying partial task information -![](figures/querying-partial-task-information.png "querying-partial-task-information") +![](figure/querying-partial-task-information.png "querying-partial-task-information") **Table 2** Output description diff --git a/en/device-dev/kernel/uname.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-uname.md similarity index 98% rename from en/device-dev/kernel/uname.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-uname.md index a66e69e5ca2a6c3b7f2cc700c1d89b7849beec30..7a9a79658247b8bbc3a97978aa945ed5182b4837 100644 --- a/en/device-dev/kernel/uname.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-uname.md @@ -68,5 +68,5 @@ Enter **uname -a**. Querying system information -![](figures/en-us_image_0000001052370305.png) +![](figure/en-us_image_0000001052370305.png) diff --git a/en/device-dev/kernel/vmm.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-vmm.md similarity index 98% rename from en/device-dev/kernel/vmm.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-vmm.md index c5d73aaa832540c3323e3d65516a2fb8b32d603a..920498ee8af7bb23537cd0225b4966645e35ab2f 100644 --- a/en/device-dev/kernel/vmm.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-vmm.md @@ -65,7 +65,7 @@ Enter **vmm 3**. ## Output **Figure 1** Virtual memory usage of the process with PID 3 -![](figures/virtual-memory-usage-of-the-process-with-pid-3.png "virtual-memory-usage-of-the-process-with-pid-3") +![](figure/virtual-memory-usage-of-the-process-with-pid-3.png "virtual-memory-usage-of-the-process-with-pid-3") **Table 2** Basic process information diff --git a/en/device-dev/kernel/watch.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-watch.md similarity index 97% rename from en/device-dev/kernel/watch.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-watch.md index 1e3211a4c14524d4bb972610b377caf5c21e9d8c..99eb40aabfed18d4a06fd2d9847fc2794b694607 100644 --- a/en/device-dev/kernel/watch.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys-watch.md @@ -91,8 +91,8 @@ Enter **watch -n 2 -c 6 task**. ## Output **Figure 1** **task** command monitoring result -![](figures/task-command-monitoring-result.png "task-command-monitoring-result") +![](figure/task-command-monitoring-result.png "task-command-monitoring-result") ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >In this example, the **task** command has been executed every 2 seconds for six times, and the preceding figure shows the output of the last execution. diff --git a/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys.md new file mode 100644 index 0000000000000000000000000000000000000000..5549fe5c32bd6c2660afc196b0061d88cf8f8b70 --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd-sys.md @@ -0,0 +1,47 @@ +# System Commands + +- **[cpup](kernel-lite-small-shell-cmd-sys-cpup.md)** + +- **[date](kernel-lite-small-shell-cmd-sys-date.md)** + +- **[dmesg](kernel-lite-small-shell-cmd-sys-demsg.md)** + +- **[exec](kernel-lite-small-shell-cmd-sys-exec.md)** + +- **[free](kernel-lite-small-shell-cmd-sys-free.md)** + +- **[help](kernel-lite-small-shell-cmd-sys-help.md)** + +- **[hwi](kernel-lite-small-shell-cmd-sys-hwi.md)** + +- **[kill](kernel-lite-small-shell-cmd-sys-kill.md)** + +- **[log](kernel-lite-small-shell-cmd-sys-log.md)** + +- **[memcheck](kernel-lite-small-shell-cmd-sys-mem.md)** + +- **[oom](kernel-lite-small-shell-cmd-sys-oom.md)** + +- **[pmm](kernel-lite-small-shell-cmd-sys-pmm.md)** + +- **[reset](kernel-lite-small-shell-cmd-sys-reset.md)** + +- **[sem](kernel-lite-small-shell-cmd-sys-sem.md)** + +- **[stack](kernel-lite-small-shell-cmd-sys-stack.md)** + +- **[su](kernel-lite-small-shell-cmd-sys-su.md)** + +- **[swtmr](kernel-lite-small-shell-cmd-sys-swymr.md)** + +- **[systeminfo](kernel-lite-small-shell-cmd-sys-sys.md)** + +- **[task](kernel-lite-small-shell-cmd-sys-task.md)** + +- **[uname](kernel-lite-small-shell-cmd-sys-uname.md)** + +- **[vmm](kernel-lite-small-shell-cmd-sys-vmm.md)** + +- **[watch](kernel-lite-small-shell-cmd-sys-watch.md)** + + diff --git a/en/device-dev/kernel/shell-command-reference.md b/en/device-dev/kernel/kernel-lite-small-shell-cmd.md similarity index 39% rename from en/device-dev/kernel/shell-command-reference.md rename to en/device-dev/kernel/kernel-lite-small-shell-cmd.md index 1c1df368f21fee6269b33805f9178611dfc956ed..ca4697ae096f4b8bd08daaa2de56f60b00c77a59 100644 --- a/en/device-dev/kernel/shell-command-reference.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-cmd.md @@ -2,12 +2,12 @@ This chapter describes the functions, syntax, parameter ranges, usages, and examples of key system commands. -For details about the commands that are not described in this document, see the output of the [help](help.md) command. You can also use the **-h | --help** option of a command to view the help information about the command. +For details about the commands that are not described in this document, see the output of the [help](kernel-lite-small-shell-cmd-sys-help.md) command. You can also use the **-h | --help** option of a command to view the help information about the command. -- **[System Commands](system-commands.md)** +- **[System Commands](kernel-lite-small-shell-cmd-sys.md)** -- **[File Commands](file-commands.md)** +- **[File Commands](kernel-lite-small-shell-cmd-file.md)** -- **[Network Commands](network-commands.md)** +- **[Network Commands](kernel-lite-small-shell-cmd-net.md)** diff --git a/en/device-dev/kernel/introduction-to-the-shell.md b/en/device-dev/kernel/kernel-lite-small-shell-des.md similarity index 93% rename from en/device-dev/kernel/introduction-to-the-shell.md rename to en/device-dev/kernel/kernel-lite-small-shell-des.md index 497aade9dff0b3e08f776b7f97d4ca0544b39ab3..2bbbee37a67679fd6818ef68463549b4841ac47e 100644 --- a/en/device-dev/kernel/introduction-to-the-shell.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-des.md @@ -10,7 +10,7 @@ The Shell provided by the OpenHarmony kernel supports commonly used commissionin - Network-related commands: querying the IP addresses of other devices connected to the development board, querying the IP address of the local device, testing the network connectivity, and setting the access point \(AP\) and station modes of the development board - For details about the process of adding commands, see [Shell Command Development Guidelines](shell-command-development-guidelines.md) and [Shell Command Programming Example](shell-command-programming-example.md). + For details about the process of adding commands, see [Shell Command Development Guidelines](kernel-lite-small-shell-guide.md) and [Shell Command Programming Example](kernel-lite-small-shell-sample.md). ## Important Notes @@ -30,7 +30,7 @@ Note the following when using the shell: - The shell functions do not comply with the POSIX standards and are used only for commissioning. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The shell functions are used for commissioning only and can be enabled only in the Debug version \(by enabling the **LOSCFG\_DEBUG\_VERSION** configuration item using **menuconfig**\). diff --git a/en/device-dev/kernel/shell-command-development-guidelines.md b/en/device-dev/kernel/kernel-lite-small-shell-guide.md similarity index 99% rename from en/device-dev/kernel/shell-command-development-guidelines.md rename to en/device-dev/kernel/kernel-lite-small-shell-guide.md index 766aff15ee4cfa14a45cfccd44e922d65f53f133..9c984d76ba256de8a9ff82b1f4670c168a0ac19a 100644 --- a/en/device-dev/kernel/shell-command-development-guidelines.md +++ b/en/device-dev/kernel/kernel-lite-small-shell-guide.md @@ -126,7 +126,7 @@ You can perform the following operations to add shell commands: ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >The command keyword must be unique. Specifically, two different commands cannot share the same command keyword. Otherwise, only one command is executed. >When executing user commands sharing the same keyword, the shell executes only the first command in the **help** commands. @@ -161,7 +161,7 @@ You can perform the following operations to add shell commands: 4. Enter the shell command in either of the following methods: - Enter the shell command in the serial port tool. - - Enter the shell command in the Telnet tool. For details, see [telnet](telnet.md). + - Enter the shell command in the Telnet tool. For details, see [telnet](kernel-lite-small-shell-cmd-net-tel.md). diff --git a/en/device-dev/kernel/shell-command-programming-example.md b/en/device-dev/kernel/kernel-lite-small-shell-sample.md similarity index 100% rename from en/device-dev/kernel/shell-command-programming-example.md rename to en/device-dev/kernel/kernel-lite-small-shell-sample.md diff --git a/en/device-dev/kernel/kernel-lite-small-shell.md b/en/device-dev/kernel/kernel-lite-small-shell.md new file mode 100644 index 0000000000000000000000000000000000000000..e780951cf490b49819a1bdb13d33a3753a1f10cf --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small-shell.md @@ -0,0 +1,15 @@ +# Commissioning + +- **[Introduction to the Shell](kernel-lite-small-shell-des.md)** + +- **[Shell Command Development Guidelines](kernel-lite-small-shell-guide.md)** + +- **[Shell Command Programming Example](kernel-lite-small-shell-sample.md)** + +- **[Shell Command Reference](kernel-lite-small-shell-cmd.md)** + +- **[Magic Key Usage](kernel-lite-small-shell-cmd-mag.md)** + +- **[User-Space Exception Information](kernel-lite-small-shell-cmd-abn.md)** + + diff --git a/en/device-dev/kernel/thread.md b/en/device-dev/kernel/kernel-lite-small-thread.md similarity index 99% rename from en/device-dev/kernel/thread.md rename to en/device-dev/kernel/kernel-lite-small-thread.md index 6c6f3cc1c7a37a35c44f5d0414cffbabcfd6d42d..d1d04cc376ee7a85153d5bafadc003999109e932 100644 --- a/en/device-dev/kernel/thread.md +++ b/en/device-dev/kernel/kernel-lite-small-thread.md @@ -2,7 +2,7 @@ - [Basic Concepts](#section1179311337405) - [When to Use](#section44877547404) -- [Available APIs](#section2069477134115) +- [API Description](#section2069477134115) ## Basic Concepts @@ -30,7 +30,7 @@ A high-priority thread in a process can preempt the resources of a low-priority **Figure 1** State transition of a thread -![](figures/state-transition-of-a-thread.png "state-transition-of-a-thread") +![](figure/state-transition-of-a-thread.png "state-transition-of-a-thread") **Description of the thread state transition:** @@ -67,7 +67,7 @@ A high-priority thread in a process can preempt the resources of a low-priority After a thread is created, it can be scheduled, suspended, restored, and delayed in user space. In addition, you can set and obtain the scheduling priority and scheduling policy of the thread. -## Available APIs +## API Description The following table describes the APIs provided by the thread management module of the OpenHarmony kernel. diff --git a/en/device-dev/kernel/kernel-lite-small.md b/en/device-dev/kernel/kernel-lite-small.md new file mode 100644 index 0000000000000000000000000000000000000000..7964a667d365b26721febc5fcb5e8cd169f1b73c --- /dev/null +++ b/en/device-dev/kernel/kernel-lite-small.md @@ -0,0 +1,11 @@ +# Kernel for Small Systems + +- **[Basic Kernel](kernel-lite-small-basic.md)** + +- **[File System](kernel-lite-small-file.md)** + +- **[Standard Library](kernel-lite-small-lib.md)** + +- **[Commissioning](kernel-lite-small-shell.md)** + + diff --git a/en/device-dev/kernel/kernel-lite.md b/en/device-dev/kernel/kernel-lite.md new file mode 100644 index 0000000000000000000000000000000000000000..523555a5f4ec2692c5493bcbe08624a9f545812f --- /dev/null +++ b/en/device-dev/kernel/kernel-lite.md @@ -0,0 +1,5 @@ +# Kernel for Mini and Small Systems + +- **[Kernel for Small Systems](kernel-lite-small.md)** + + diff --git a/en/device-dev/kernel/guidelines-for-compiling-and-building-the-linux-kernel.md b/en/device-dev/kernel/kernel-standard-build.md similarity index 71% rename from en/device-dev/kernel/guidelines-for-compiling-and-building-the-linux-kernel.md rename to en/device-dev/kernel/kernel-standard-build.md index a310e530bfb4368baaca86b1095c384d20f02912..5dd23ea67832db1fa75e6ec1ac6a70fdafd137fc 100644 --- a/en/device-dev/kernel/guidelines-for-compiling-and-building-the-linux-kernel.md +++ b/en/device-dev/kernel/kernel-standard-build.md @@ -1,13 +1,15 @@ # Guidelines for Compiling and Building the Linux Kernel -- [Example of Development Using the Hi3516D V300 Board and Ubuntu x86 Server](#section19369206113115) - - [Scenario 1: building the native kernel at the version level](#section1025111193220) - - [Scenario 2: building the modified kernel separately](#section17446652173211) +- [Example 1](#section19369206113115) + - [Scenario 1: Building the Native Kernel at the Version Level](#section1025111193220) + - [Scenario 2: Building the Modified Kernel Separately](#section17446652173211) -## Example of Development Using the Hi3516D V300 Board and Ubuntu x86 Server +## Example 1 -### Scenario 1: building the native kernel at the version level +The following uses the Hi3516D V300 board and Ubuntu x86 server as an example. + +### Scenario 1: Building the Native Kernel at the Version Level Perform a full build for the project to generate the **uImage** kernel image. @@ -15,11 +17,11 @@ Perform a full build for the project to generate the **uImage** kernel image. ./build.sh --product-name Hi3516DV300 # Build the uImage kernel image of the Hi3516D V300 board. ``` -### Scenario 2: building the modified kernel separately +### Scenario 2: Building the Modified Kernel Separately 1. Set up the build environment. - 1. Merge the required patch by referring to [guidelines for using patches on development boards](guidelines-for-using-patches-on-openharmony-development-boards.md). + 1. Merge the required patch by referring to [guidelines for using patches on development boards](kernel-standard-patch.md). 2. Prepare for the build environment. You can use the Arm Clang or GCC compiler. Enter the root directory of the project and configure environment variables: diff --git a/en/device-dev/kernel/linux-kernel-overview.md b/en/device-dev/kernel/kernel-standard-des.md similarity index 100% rename from en/device-dev/kernel/linux-kernel-overview.md rename to en/device-dev/kernel/kernel-standard-des.md diff --git a/en/device-dev/kernel/guidelines-for-using-patches-on-openharmony-development-boards.md b/en/device-dev/kernel/kernel-standard-patch.md similarity index 94% rename from en/device-dev/kernel/guidelines-for-using-patches-on-openharmony-development-boards.md rename to en/device-dev/kernel/kernel-standard-patch.md index 6b05e850113e75cf1f21dc6a68a3a0a836552f51..e1ecf1aad2a3ea5e004a9d55699738b2f7fade1e 100644 --- a/en/device-dev/kernel/guidelines-for-using-patches-on-openharmony-development-boards.md +++ b/en/device-dev/kernel/kernel-standard-patch.md @@ -12,6 +12,6 @@ The following uses Hi3516D V300 as an example: patch -p1 < device/hisilicon/hi3516dv300/sdk_linux/open_source/linux/hisi_linux-4.19_hos_l2.patch ``` ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >Because patches are applied after the code environment of **kernel/linux-4.19** is copied during compilation and building of the OpenHarmony project, you must retain the original code environment of **kernel/linux-4.19** before running the OpenHarmony version-level build command. diff --git a/en/device-dev/kernel/kernel-standard.md b/en/device-dev/kernel/kernel-standard.md new file mode 100644 index 0000000000000000000000000000000000000000..cdbdf659c166ba32ea9b47e15b06e57184149032 --- /dev/null +++ b/en/device-dev/kernel/kernel-standard.md @@ -0,0 +1,9 @@ +# Kernel for Standard Systems + +- **[Linux Kernel Overview](kernel-standard-des.md)** + +- **[Guidelines for Using Patches on OpenHarmony Development Boards](kernel-standard-patch.md)** + +- **[Guidelines for Compiling and Building the Linux Kernel](kernel-standard-build.md)** + + diff --git a/en/device-dev/kernel/kernel.md b/en/device-dev/kernel/kernel.md new file mode 100644 index 0000000000000000000000000000000000000000..356b5d646277ab0bd61df5175f9292b5a4982831 --- /dev/null +++ b/en/device-dev/kernel/kernel.md @@ -0,0 +1,7 @@ +# Kernel + +- **[Kernel for Mini and Small Systems](kernel-lite.md)** + +- **[Kernel for Standard Systems](kernel-standard.md)** + + diff --git a/en/device-dev/kernel/linux-kernel.md b/en/device-dev/kernel/linux-kernel.md deleted file mode 100644 index 9391b466f5f056bda10b6cff24a0142cce6fef51..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/linux-kernel.md +++ /dev/null @@ -1,9 +0,0 @@ -# Linux Kernel - -- **[Linux Kernel Overview](linux-kernel-overview.md)** - -- **[Guidelines for Using Patches on OpenHarmony Development Boards](guidelines-for-using-patches-on-openharmony-development-boards.md)** - -- **[Guidelines for Compiling and Building the Linux Kernel](guidelines-for-compiling-and-building-the-linux-kernel.md)** - - diff --git a/en/device-dev/kernel/lite-kernel.md b/en/device-dev/kernel/lite-kernel.md deleted file mode 100644 index 3927b0fb506a8a301ca2b168f58e99170365406a..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/lite-kernel.md +++ /dev/null @@ -1,11 +0,0 @@ -# Lite Kernel - -- **[OpenHarmony Lite Kernel Basic Functions](openharmony-lite-kernel-basic-functions.md)** - -- **[OpenHarmony Lite Kernel File System](openharmony-lite-kernel-file-system.md)** - -- **[Standard Library](standard-library.md)** - -- **[Commissioning](commissioning.md)** - - diff --git a/en/device-dev/kernel/network-commands.md b/en/device-dev/kernel/network-commands.md deleted file mode 100644 index 87571257010b07ad22d44be257458089c3f76b61..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/network-commands.md +++ /dev/null @@ -1,25 +0,0 @@ -# Network Commands - -- **[arp](arp.md)** - -- **[dhclient](dhclient.md)** - -- **[dns](dns.md)** - -- **[ifconfig](ifconfig.md)** - -- **[ipdebug](ipdebug.md)** - -- **[netstat](netstat.md)** - -- **[ntpdate](ntpdate.md)** - -- **[ping](ping.md)** - -- **[ping6](ping6.md)** - -- **[telnet](telnet.md)** - -- **[tftp](tftp.md)** - - diff --git a/en/device-dev/kernel/openharmony-lite-kernel-basic-functions.md b/en/device-dev/kernel/openharmony-lite-kernel-basic-functions.md deleted file mode 100644 index 8e3d07b35fb20071a4799e33f88480253820194f..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/openharmony-lite-kernel-basic-functions.md +++ /dev/null @@ -1,11 +0,0 @@ -# OpenHarmony Lite Kernel Basic Functions - -- **[Process](process.md)** - -- **[Thread](thread.md)** - -- **[Memory](memory.md)** - -- **[Network](network.md)** - - diff --git a/en/device-dev/kernel/public_sys-resources/icon-caution.gif b/en/device-dev/kernel/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/kernel/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/kernel/public_sys-resources/icon-danger.gif b/en/device-dev/kernel/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/kernel/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/kernel/public_sys-resources/icon-note.gif b/en/device-dev/kernel/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/kernel/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/kernel/public_sys-resources/icon-notice.gif b/en/device-dev/kernel/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/kernel/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/kernel/public_sys-resources/icon-tip.gif b/en/device-dev/kernel/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/kernel/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/kernel/public_sys-resources/icon-warning.gif b/en/device-dev/kernel/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/kernel/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/kernel/standard-library.md b/en/device-dev/kernel/standard-library.md deleted file mode 100644 index 558eeb7fd7862b35e585fd54f753b4a647a1947d..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/standard-library.md +++ /dev/null @@ -1,7 +0,0 @@ -# Standard Library - -- **[Standard Library](standard-library-0.md)** - -- **[Differences from the Linux Standard Library](differences-from-the-linux-standard-library.md)** - - diff --git a/en/device-dev/kernel/system-commands.md b/en/device-dev/kernel/system-commands.md deleted file mode 100644 index cb95770023d2c98f56f2a8068b38111e0c628fe6..0000000000000000000000000000000000000000 --- a/en/device-dev/kernel/system-commands.md +++ /dev/null @@ -1,47 +0,0 @@ -# System Commands - -- **[cpup](cpup.md)** - -- **[date](date.md)** - -- **[dmesg](dmesg.md)** - -- **[exec](exec.md)** - -- **[free](free.md)** - -- **[help](help.md)** - -- **[hwi](hwi.md)** - -- **[kill](kill.md)** - -- **[log](log.md)** - -- **[memcheck](memcheck.md)** - -- **[oom](oom.md)** - -- **[pmm](pmm.md)** - -- **[reset](reset.md)** - -- **[sem](sem.md)** - -- **[stack](stack.md)** - -- **[su](su.md)** - -- **[swtmr](swtmr.md)** - -- **[systeminfo](systeminfo.md)** - -- **[task](task.md)** - -- **[uname](uname.md)** - -- **[vmm](vmm.md)** - -- **[watch](watch.md)** - - diff --git a/en/device-dev/overview.md b/en/device-dev/overview.md index 4a5832db5a9e81baccd6d4cbb4bf500c0f5a06a3..d8e511406ec63d9d17428a53e7ad9e60cf1a6448 100644 --- a/en/device-dev/overview.md +++ b/en/device-dev/overview.md @@ -55,42 +55,42 @@ In addition, OpenHarmony provides a series of optional system components that ca

Preparing for your development

+

Quick start

Getting started with setup, build, burning, debugging, and running of OpenHarmony

Getting Started for Mini and Small Systems

+

Getting Started for Mini and Small Systems

Basic capabilities

Using basic capabilities of OpenHarmony

+

Advanced development

Developing smart devices based on system capabilities

+

Porting and adaptation

  • Porting and adapting the OpenHarmony to an SoC
  • Porting and adapting the OpenHarmony to a third-party library
+

Contributing components

Contributing components to OpenHarmony

+

Reference

@@ -114,9 +114,9 @@ In addition, OpenHarmony provides a series of optional system components that ca

About OpenHarmony

+

About OpenHarmony

Getting familiar with OpenHarmony

+

Getting familiar with OpenHarmony

Preparing for your development

+

Quick start

Getting started with setup, build, burning, debugging, and running of OpenHarmony

Getting Started for Standard System

+

Getting Started for Standard System

Basic capabilities

Using basic capabilities of OpenHarmony

+

Using basic capabilities of OpenHarmony

+

Advanced development

Developing smart devices based on system capabilities

+

Porting and adaptation

Porting and adapting the OpenHarmony to a third-party library

Third-Party Library Porting Guide

+

Third-Party Library Porting Guide

Contributing components

Contributing components to OpenHarmony

+

Contributing components to OpenHarmony

+

Reference

diff --git a/en/device-dev/porting/Readme-EN.md b/en/device-dev/porting/Readme-EN.md index b4f760b020e0cd05bae29470c24a27d49696bb63..abfe82c4f402c993526c03799b02f8147ef27936 100644 --- a/en/device-dev/porting/Readme-EN.md +++ b/en/device-dev/porting/Readme-EN.md @@ -1,26 +1,33 @@ # Porting Guide -- [Third-Party Library Porting Guide](third-party-library-porting-guide.md) - - [Overview](overview.md) - - [Porting a Library Built Using CMake](porting-a-library-built-using-cmake.md) - - [Porting a Library Built Using Makefile](porting-a-library-built-using-makefile.md) - -- [Third-Party SoC Porting Guide](third-party-soc-porting-guide.md) - - [Porting Preparations](porting-preparations.md) - - [Before You Start](before-you-start.md) - - [Building Adaptation Process](building-adaptation-process.md) - - - [Kernel Porting](kernel-porting.md) - - [Overview](overview-0.md) - - [Basic Kernel Adaptation](basic-kernel-adaptation.md) - - [Kernel Porting Verification](kernel-porting-verification.md) - - - [Board-Level OS Porting](board-level-os-porting.md) - - [Overview](overview-1.md) - - [Board-Level Driver Adaptation](board-level-driver-adaptation.md) - - [Implementation of APIs at the HAL](implementation-of-apis-at-the-hal.md) - - [System Modules](system-modules.md) - - [XTS](xts.md) - - - [FAQ](faq.md) - +- [Third-Party Library Porting Guide](transplant-thirdparty.md) + - [Overview](transplant-thirdparty-overview.md) + - [Porting a Library Built Using CMake](transplant-thirdparty-cmake.md) + - [Porting a Library Built Using Makefile](transplant-thirdparty-makefile.md) +- [Mini System SoC Porting Guide](transplant-minichip.md) + - [Porting Preparations](transplant-chip-prepare.md) + - [Before You Start](transplant-chip-prepare-knows.md) + - [Building Adaptation Process](transplant-chip-prepare-process.md) + - [Kernel Porting](transplant-chip-kernel.md) + - [Overview](transplant-chip-kernel-overview.md) + - [Basic Kernel Adaptation](transplant-chip-kernel-adjustment.md) + - [Kernel Porting Verification](transplant-chip-kernel-verify.md) + - [Board-Level OS Porting](transplant-chip-board.md) + - [Overview](transplant-chip-board-overview.md) + - [Board-Level Driver Adaptation](transplant-chip-board-drive.md) + - [Implementation of APIs at the HAL](transplant-chip-board-hal.md) + - [System Modules](transplant-chip-board-component.md) + - [Third-party Module Adaptation](transplant-chip-board-bundle.md) + - [XTS](transplant-chip-board-xts.md) + - [FAQ](transplant-chip-faqs.md) +- [Small System SoC Porting Guide](transplant-smallchip.md) + - [Porting Preparations](transplant-smallchip-prepare.md) + - [Before You Start](transplant-smallchip-prepare-needs.md) + - [Compilation and Building](transplant-smallchip-prepare-building.md) + - [Kernel Porting](transplant-smallchip-kernel.md) + - [LiteOS Cortex-A](transplant-smallchip-kernel-a.md) + - [Linux Kernel](transplant-smallchip-kernel-linux.md) + - [Driver Porting](transplant-smallchip-drive.md) + - [Overview](transplant-smallchip-drive-des.md) + - [Platform Driver Porting](transplant-smallchip-drive-plat.md) + - [Device Driver Porting](transplant-smallchip-drive-oom.md) \ No newline at end of file diff --git a/en/device-dev/porting/board-level-os-porting.md b/en/device-dev/porting/board-level-os-porting.md deleted file mode 100644 index e70229d4a090f88acacea19f58ff606e8395bc7b..0000000000000000000000000000000000000000 --- a/en/device-dev/porting/board-level-os-porting.md +++ /dev/null @@ -1,13 +0,0 @@ -# Board-Level OS Porting - -- **[Overview](overview-1.md)** - -- **[Board-Level Driver Adaptation](board-level-driver-adaptation.md)** - -- **[Implementation of APIs at the HAL](implementation-of-apis-at-the-hal.md)** - -- **[System Modules](system-modules.md)** - -- **[XTS](xts.md)** - - diff --git a/en/device-dev/porting/figures/en-us_image_0000001072304191.png b/en/device-dev/porting/figure/en-us_image_0000001072304191.png similarity index 100% rename from en/device-dev/porting/figures/en-us_image_0000001072304191.png rename to en/device-dev/porting/figure/en-us_image_0000001072304191.png diff --git a/en/device-dev/porting/figures/en-us_image_0000001073943511.png b/en/device-dev/porting/figure/en-us_image_0000001073943511.png similarity index 100% rename from en/device-dev/porting/figures/en-us_image_0000001073943511.png rename to en/device-dev/porting/figure/en-us_image_0000001073943511.png diff --git a/en/device-dev/porting/figure/en-us_image_0000001126198996.png b/en/device-dev/porting/figure/en-us_image_0000001126198996.png new file mode 100644 index 0000000000000000000000000000000000000000..57e7e35c2eb4d0bcafecd07c32639ca0e8b17b6e Binary files /dev/null and b/en/device-dev/porting/figure/en-us_image_0000001126198996.png differ diff --git a/en/device-dev/porting/figure/en-us_image_0000001126354076.png b/en/device-dev/porting/figure/en-us_image_0000001126354076.png new file mode 100644 index 0000000000000000000000000000000000000000..c6cae9cb23b2d1767b415ba1fa668349e329034b Binary files /dev/null and b/en/device-dev/porting/figure/en-us_image_0000001126354076.png differ diff --git a/en/device-dev/porting/figure/en-us_image_0000001126358814.png b/en/device-dev/porting/figure/en-us_image_0000001126358814.png new file mode 100644 index 0000000000000000000000000000000000000000..39c6cb96611a7ced5e17bbeee96ac77ba5c1bf58 Binary files /dev/null and b/en/device-dev/porting/figure/en-us_image_0000001126358814.png differ diff --git a/en/device-dev/porting/figure/en-us_image_0000001172273945.jpg b/en/device-dev/porting/figure/en-us_image_0000001172273945.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a1e7f8b695bebf395ea6cfa0aed55495c4896118 Binary files /dev/null and b/en/device-dev/porting/figure/en-us_image_0000001172273945.jpg differ diff --git a/en/device-dev/porting/figure/en-us_image_0000001172393865.jpg b/en/device-dev/porting/figure/en-us_image_0000001172393865.jpg new file mode 100644 index 0000000000000000000000000000000000000000..efb1e17b00d37b072a3032678144984e2e13b2d6 Binary files /dev/null and b/en/device-dev/porting/figure/en-us_image_0000001172393865.jpg differ diff --git a/en/device-dev/porting/figure/hdf_wifi.png b/en/device-dev/porting/figure/hdf_wifi.png new file mode 100644 index 0000000000000000000000000000000000000000..4a0441de4621bd558383ba1323d21c793bcf192a Binary files /dev/null and b/en/device-dev/porting/figure/hdf_wifi.png differ diff --git a/en/device-dev/porting/figure/kernel-startup-framework.jpg b/en/device-dev/porting/figure/kernel-startup-framework.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ac1271b5dcd4fc06199df236a4741a71d8040eb4 Binary files /dev/null and b/en/device-dev/porting/figure/kernel-startup-framework.jpg differ diff --git a/en/device-dev/porting/figures/key-steps-for-soc-porting.png b/en/device-dev/porting/figure/key-steps-for-soc-porting.png similarity index 100% rename from en/device-dev/porting/figures/key-steps-for-soc-porting.png rename to en/device-dev/porting/figure/key-steps-for-soc-porting.png diff --git a/en/device-dev/porting/figures/process-for-board-level-driver-adaptation.png b/en/device-dev/porting/figure/process-for-board-level-driver-adaptation.png similarity index 100% rename from en/device-dev/porting/figures/process-for-board-level-driver-adaptation.png rename to en/device-dev/porting/figure/process-for-board-level-driver-adaptation.png diff --git a/en/device-dev/porting/figures/successful-startup-of-openharmony.png b/en/device-dev/porting/figure/successful-startup-of-openharmony.png similarity index 100% rename from en/device-dev/porting/figures/successful-startup-of-openharmony.png rename to en/device-dev/porting/figure/successful-startup-of-openharmony.png diff --git "a/en/device-dev/porting/figure/\345\210\206\347\261\273.png" "b/en/device-dev/porting/figure/\345\210\206\347\261\273.png" new file mode 100644 index 0000000000000000000000000000000000000000..7edac54ec2fcd1fc93330d47acb2d44fceef2710 Binary files /dev/null and "b/en/device-dev/porting/figure/\345\210\206\347\261\273.png" differ diff --git a/en/device-dev/porting/kernel-porting.md b/en/device-dev/porting/kernel-porting.md deleted file mode 100644 index ce6f9d8c039b649b86657569141b682be86533b4..0000000000000000000000000000000000000000 --- a/en/device-dev/porting/kernel-porting.md +++ /dev/null @@ -1,9 +0,0 @@ -# Kernel Porting - -- **[Overview](overview-0.md)** - -- **[Basic Kernel Adaptation](basic-kernel-adaptation.md)** - -- **[Kernel Porting Verification](kernel-porting-verification.md)** - - diff --git a/en/device-dev/porting/public_sys-resources/icon-caution.gif b/en/device-dev/porting/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/porting/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/porting/public_sys-resources/icon-danger.gif b/en/device-dev/porting/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/porting/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/porting/public_sys-resources/icon-note.gif b/en/device-dev/porting/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/porting/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/porting/public_sys-resources/icon-notice.gif b/en/device-dev/porting/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/porting/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/porting/public_sys-resources/icon-tip.gif b/en/device-dev/porting/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/porting/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/porting/public_sys-resources/icon-warning.gif b/en/device-dev/porting/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/porting/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/porting/third-party-library-porting-guide.md b/en/device-dev/porting/third-party-library-porting-guide.md deleted file mode 100644 index 2f5cbcb9396ab5f55bf6f7ae956a5a2edfd1a833..0000000000000000000000000000000000000000 --- a/en/device-dev/porting/third-party-library-porting-guide.md +++ /dev/null @@ -1,9 +0,0 @@ -# Third-Party Library Porting Guide - -- **[Overview](overview.md)** - -- **[Porting a Library Built Using CMake](porting-a-library-built-using-cmake.md)** - -- **[Porting a Library Built Using Makefile](porting-a-library-built-using-makefile.md)** - - diff --git a/en/device-dev/porting/third-party-soc-porting-guide.md b/en/device-dev/porting/third-party-soc-porting-guide.md deleted file mode 100644 index 19cd7887dee6cc3d7002e6173d3a01b181e19cdb..0000000000000000000000000000000000000000 --- a/en/device-dev/porting/third-party-soc-porting-guide.md +++ /dev/null @@ -1,11 +0,0 @@ -# Third-Party SoC Porting Guide - -- **[Porting Preparations](porting-preparations.md)** - -- **[Kernel Porting](kernel-porting.md)** - -- **[Board-Level OS Porting](board-level-os-porting.md)** - -- **[FAQ](faq.md)** - - diff --git a/en/device-dev/porting/transplant-chip-board-bundle.md b/en/device-dev/porting/transplant-chip-board-bundle.md new file mode 100644 index 0000000000000000000000000000000000000000..1f0a46c450c150796b2c8e385981dcfea044944a --- /dev/null +++ b/en/device-dev/porting/transplant-chip-board-bundle.md @@ -0,0 +1,57 @@ +# Third-party Module Adaptation + +To use third-party modules in the **third\_party** directory, you may need to adapt the modules. This section uses mbedTLS as an example to describe how to integrate the adaptation code with the OpenHarmony compilation framework. For the principles of mbedTLS and the specific logic of the adaptation code, see the adaptation guide on the mbedTLS official website. + +1. Write the adaptation layer code. + + Write the required adaptation layer code based on the mbedTLS adaptation guide. In this example, adaptation of the hardware random number is used for illustration, and the paths are relative to **third\_party/mbedtls**: + + 1. Copy the **include/mbedtls/config.h** file to the **ports** directory, and enable **MBEDTLS\_ENTROPY\_HARDWARE\_ALT** in the file. + 2. In the **ports** directory, create the **entropy\_poll\_alt.c** file under **include** and implement the hardware random number API in **entropy\_poll.h**. + 3. Add the path of the adapted **entropy\_poll\_alt.c** file to **mbedtls\_sources** in the **BUILD.gn** file. + 4. Add the line **MBEDTLS\_CONFIG\_FILE** to **lite\_library\("mbedtls\_static"\)** in the **BUILD.gn** file to specify the path of the new configuration file. + + ``` + lite_library("mbedtks_static") { + ... + defines += ["MBEDTLS_CONFIG_FILE=<../port/config.h>"] + ... + } + ``` + + + You are advised to make the preceding modifications in a new **config.h** file or **_xxx_\_alt.c** file. Do not directly edit the code in the original file. Intrusive modifications may cause a large number of scattered conflicts during subsequent version updates, increasing the update maintenance costs. + +2. Create a patch. + + The preceding adaptation is hardware-specific. Therefore, when uploading code to the library, you cannot directly store the code in the **third\_party/mbedtls** directory. Instead, you need to integrate the preceding modifications into a patch and inject the patch into the code for a build. + + 1. Add the patch configuration file **device/<_company_\>/<_board_\>/patch.yml**. + 2. In the **device/<_company_\>/<_board_\>/patch.yml** file, add the information about the patch to apply. + + ``` + # Path of the patch to apply. This path is relative to the code root directory. + third_party/mbedtls: + # Directory in which the patch is stored. + - device///third_party/mbedtls/adapter.patch + third_party/wpa_supplicant: + # When there are multiple patches in a path, the patches are executed in sequence. + - device///third_party/wpa_supplicant/xxxxx.patch + - device///third_party/wpa_supplicant/yyyyy.patch + ... + ``` + + 3. Create a patch file as described in step [1](#li12446195633211) and save it to the corresponding directory. + +3. Start a build with the patch. + + Add **--patch** when triggering a build. The following is the command for executing a full build with a patch: + + ``` + hb build -f --patch + ``` + + >![](../public_sys-resources/icon-caution.gif) **CAUTION:** + >The information about the product to which the patch is most recently applied will be recorded. Next time the build is performed, the previous patch is rolled back \(that is, **\`patch -p1 -R < xxx\`** is executed\). If the patch fails to be rolled back or a patch fails to be added, the build process is terminated. In this case, resolve the patch conflict and try again. + + diff --git a/en/device-dev/porting/system-modules.md b/en/device-dev/porting/transplant-chip-board-component.md similarity index 87% rename from en/device-dev/porting/system-modules.md rename to en/device-dev/porting/transplant-chip-board-component.md index 686ea0751d80679d063a624cf1eceb04c415fbd0..2e29bb3150ed0a0e6de9b827f4799df05577be2c 100644 --- a/en/device-dev/porting/system-modules.md +++ b/en/device-dev/porting/transplant-chip-board-component.md @@ -11,7 +11,7 @@ System modules, such as the system ability manager \(SAMGR\) and DFX subsystem, This service-oriented framework enables you to develop services, features, and external APIs, and implement multi-service process sharing and service invocation for inter-process communication \(IPC\). ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >This module must be used during board-level system porting. Otherwise, other service modules cannot run properly. For details about how to use SAMGR, see [samgr\_lite](https://gitee.com/openharmony/distributedschedule_samgr_lite/blob/master/README.md). @@ -22,5 +22,5 @@ For details about how to use SAMGR, see [samgr\_lite](https://gitee.com/openhar The design for X \(DFX\) subsystem mainly includes design for reliability \(DFR\) and design for testability \(DFT\), providing code maintenance and testing. -For details, see [dfx](../subsystems/dfx.md). +For details about how to use the DFX subsystem, see [DFX](../subsystems/subsys-dfx-overview.md). diff --git a/en/device-dev/porting/board-level-driver-adaptation.md b/en/device-dev/porting/transplant-chip-board-drive.md similarity index 100% rename from en/device-dev/porting/board-level-driver-adaptation.md rename to en/device-dev/porting/transplant-chip-board-drive.md diff --git a/en/device-dev/porting/implementation-of-apis-at-the-hal.md b/en/device-dev/porting/transplant-chip-board-hal.md similarity index 100% rename from en/device-dev/porting/implementation-of-apis-at-the-hal.md rename to en/device-dev/porting/transplant-chip-board-hal.md diff --git a/en/device-dev/porting/overview-1.md b/en/device-dev/porting/transplant-chip-board-overview.md similarity index 90% rename from en/device-dev/porting/overview-1.md rename to en/device-dev/porting/transplant-chip-board-overview.md index a7332baa3775232b85193c40ab6984c32aa54b96..036de7066aee8df287fba20aec2d8f6c83b2a440 100644 --- a/en/device-dev/porting/overview-1.md +++ b/en/device-dev/porting/transplant-chip-board-overview.md @@ -13,11 +13,11 @@ After the minimum system is ported, you can port the board-level system by: 4. Verifying service functions **Figure 1** Process for board-level driver adaptation -![](figures/process-for-board-level-driver-adaptation.png "process-for-board-level-driver-adaptation") +![](figure/process-for-board-level-driver-adaptation.png "process-for-board-level-driver-adaptation") ## Board-Level Directory Specifications -For details about board-level system building adaptation, see [Compilation and Building Subsystem](building-adaptation-process.md). The board-related drivers, software development software kits \(SDKs\), directories, and HAL implementation are stored in the **device** directory. The directory structure and its description are as follows: +For details about board-level system building adaptation, see [Compilation and Building Subsystem](transplant-chip-prepare-process.md). The board-related drivers, software development software kits \(SDKs\), directories, and HAL implementation are stored in the **device** directory. The directory structure and its description are as follows: ``` . diff --git a/en/device-dev/porting/xts.md b/en/device-dev/porting/transplant-chip-board-xts.md similarity index 95% rename from en/device-dev/porting/xts.md rename to en/device-dev/porting/transplant-chip-board-xts.md index 95899d2212185d0bcad58051cc92371e42e41024..35c40e9dc60e204096d5f5d136350087555790d5 100644 --- a/en/device-dev/porting/xts.md +++ b/en/device-dev/porting/transplant-chip-board-xts.md @@ -12,7 +12,7 @@ X Test Suite \(XTS\) is a set of OpenHarmony certification test suites. Currentl - The **acts** directory stores the source code and configuration files of ACTS test cases. The ACTS helps device vendors detect the software incompatibility as early as possible and ensures that the software is compatible with OpenHarmony during the entire development process. - The **tools** software package stores the test case development framework related to **acts**. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The startup of the XTS depends on the SAMGR module. The XTS adaptation consists of the following steps: @@ -46,7 +46,7 @@ The following example shows how to execute ACTS cases for the IoTLink module of Obtain the image from the **out/hispark\_pegasus/wifiiot\_hispark\_pegasus/** directory. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >To check whether the ACTS is integrated into the current image, check whether the corresponding **.a** file is compiled. 2. Burn the image into the development board. diff --git a/en/device-dev/porting/transplant-chip-board.md b/en/device-dev/porting/transplant-chip-board.md new file mode 100644 index 0000000000000000000000000000000000000000..4800ddd71c39115f9e9e2b0358eb699e33454f97 --- /dev/null +++ b/en/device-dev/porting/transplant-chip-board.md @@ -0,0 +1,15 @@ +# Board-Level OS Porting + +- **[Overview](transplant-chip-board-overview.md)** + +- **[Board-Level Driver Adaptation](transplant-chip-board-drive.md)** + +- **[Implementation of APIs at the HAL](transplant-chip-board-hal.md)** + +- **[System Modules](transplant-chip-board-component.md)** + +- **[Third-party Module Adaptation](transplant-chip-board-bundle.md)** + +- **[XTS](transplant-chip-board-xts.md)** + + diff --git a/en/device-dev/porting/faq.md b/en/device-dev/porting/transplant-chip-faqs.md similarity index 100% rename from en/device-dev/porting/faq.md rename to en/device-dev/porting/transplant-chip-faqs.md diff --git a/en/device-dev/porting/basic-kernel-adaptation.md b/en/device-dev/porting/transplant-chip-kernel-adjustment.md similarity index 99% rename from en/device-dev/porting/basic-kernel-adaptation.md rename to en/device-dev/porting/transplant-chip-kernel-adjustment.md index 8713d4e6c026edc5ec6b37188011427478e5bcfd..88acd2d145496f7650d96d56b25c49af3b76462c 100644 --- a/en/device-dev/porting/basic-kernel-adaptation.md +++ b/en/device-dev/porting/transplant-chip-kernel-adjustment.md @@ -15,7 +15,7 @@ Basic adaptation consists of the following steps: **Figure 1** Startup process -![](figures/en-us_image_0000001073943511.png) +![](figure/en-us_image_0000001073943511.png) In the **startup.S** file, you must ensure that the entry function \(for example, **reset\_vector**\) of the interrupt vector table is stored in the RAM start address specified by the link configuration files. The link configuration files of IAR, Keil, and GCC projects are **xxx.icf**, **xxx.sct**, and **xxx.ld**, respectively. The startup file provided by the vendor does not need to be modified if the **startup.S** file has initialized the system clock and returned to the **main** function. Otherwise, the preceding functions need to be implemented. diff --git a/en/device-dev/porting/overview-0.md b/en/device-dev/porting/transplant-chip-kernel-overview.md similarity index 98% rename from en/device-dev/porting/overview-0.md rename to en/device-dev/porting/transplant-chip-kernel-overview.md index 46e8c9491f46f61dcce2ac50e2c627349976e12d..48634e90d7b415d3998cb1d2df615a466aaa9eb7 100644 --- a/en/device-dev/porting/overview-0.md +++ b/en/device-dev/porting/transplant-chip-kernel-overview.md @@ -21,7 +21,7 @@ The kernel used by module chips is LiteOS Cortex-M, which consists of four modul **Figure 1** Architecture of the LiteOS Cortex-M kernel -![](figures/en-us_image_0000001072304191.png) +![](figure/en-us_image_0000001072304191.png) The directory structure of the kernel is described as follows: diff --git a/en/device-dev/porting/kernel-porting-verification.md b/en/device-dev/porting/transplant-chip-kernel-verify.md similarity index 98% rename from en/device-dev/porting/kernel-porting-verification.md rename to en/device-dev/porting/transplant-chip-kernel-verify.md index b00b1cb1556201cb15da99b87cf559a9cda798f3..56aa1d19d06af1d3a2c994a64b898045e0270484 100644 --- a/en/device-dev/porting/kernel-porting-verification.md +++ b/en/device-dev/porting/transplant-chip-kernel-verify.md @@ -55,5 +55,5 @@ LITE_OS_SEC_TEXT_INIT int main(void) } ``` -If the first task is executed properly, the core process of the minimum system is valid. Due to the XTS framework's dependency on the link scripts of Utils and Bootstrap as well as the building framework, testing the kernel by executing the XTS is not supported. You can test whether the minimum system is completely ported in [XTS](xts.md). +If the first task is executed properly, the core process of the minimum system is valid. Due to the XTS framework's dependency on the link scripts of Utils and Bootstrap as well as the building framework, testing the kernel by executing the XTS is not supported. You can test whether the minimum system is completely ported in [XTS](transplant-chip-board-xts.md). diff --git a/en/device-dev/porting/transplant-chip-kernel.md b/en/device-dev/porting/transplant-chip-kernel.md new file mode 100644 index 0000000000000000000000000000000000000000..7f9366086a58c40a65915482a8891469bdc1b12c --- /dev/null +++ b/en/device-dev/porting/transplant-chip-kernel.md @@ -0,0 +1,9 @@ +# Kernel Porting + +- **[Overview](transplant-chip-kernel-overview.md)** + +- **[Basic Kernel Adaptation](transplant-chip-kernel-adjustment.md)** + +- **[Kernel Porting Verification](transplant-chip-kernel-verify.md)** + + diff --git a/en/device-dev/porting/before-you-start.md b/en/device-dev/porting/transplant-chip-prepare-knows.md similarity index 94% rename from en/device-dev/porting/before-you-start.md rename to en/device-dev/porting/transplant-chip-prepare-knows.md index 3b25588a1b4e0804d58c6e0055e8165b9384b29b..731df255c420f947b4be298bca7b9ce89b6b5215 100644 --- a/en/device-dev/porting/before-you-start.md +++ b/en/device-dev/porting/transplant-chip-prepare-knows.md @@ -33,7 +33,7 @@ The implementation of the OpenHarmony project directories and functions relies o

/device

Board-level code implementation, which is provided by third-party vendors based on the OpenHarmony specifications. For detailed structure about the device directory and porting process, see Board-Level OS Porting.

+

Board-level code implementation, which is provided by third-party vendors based on the OpenHarmony specifications. For detailed structure about the device directory and porting process, see Board-Level OS Porting.

/vendor

@@ -44,7 +44,7 @@ The implementation of the OpenHarmony project directories and functions relies o
-The **device** directory is in the internal structure of **device/\{Chip solution vendor\}/\{Development board\}**. The following uses Hisilicon **hispark\_taurus** as an example: +The **device** directory is in the internal structure of **device/\{Chip solution vendor\}/\{Development board\}**. The following uses HiSilicon **hispark\_taurus** as an example: ``` device @@ -75,10 +75,10 @@ vendor # Product solution vendor The **device** directory of OpenHarmony is the adaptation directory for the basic SoC. You can skip the porting process and directly develop system applications if complete SoC adaptation code is already available in the directory. If there is no corresponding SoC porting implementation in the directory, complete the porting process by following the instructions provided in this document. The following figure shows the process of porting OpenHarmony to a third-party SoC. **Figure 1** Key steps for SoC porting -![](figures/key-steps-for-soc-porting.png "key-steps-for-soc-porting") +![](figure/key-steps-for-soc-porting.png "key-steps-for-soc-porting") ## Porting Specifications - The porting must comply with the basic OpenHarmony principles described in [Contribution](https://gitee.com/openharmony/docs/blob/master/en/contribute/contribution.md). -- The code required for third-party SoC adaptation is stored in the **device**, **vendor**, and **arch** directories. Naming and usage of these directories must comply with specified naming and usage specifications. For details, see [Directory Specifications](overview-0.md) and [Board-Level Directory Specifications](overview-1.md#section6204129143013). +- The code required for third-party SoC adaptation is stored in the **device**, **vendor**, and **arch** directories. Naming and usage of these directories must comply with specified naming and usage specifications. For details, see [Directory Specifications](transplant-chip-kernel-overview.md) and [Board-Level Directory Specifications](transplant-chip-board-overview.md#section6204129143013). diff --git a/en/device-dev/porting/building-adaptation-process.md b/en/device-dev/porting/transplant-chip-prepare-process.md similarity index 100% rename from en/device-dev/porting/building-adaptation-process.md rename to en/device-dev/porting/transplant-chip-prepare-process.md diff --git a/en/device-dev/porting/porting-preparations.md b/en/device-dev/porting/transplant-chip-prepare.md similarity index 33% rename from en/device-dev/porting/porting-preparations.md rename to en/device-dev/porting/transplant-chip-prepare.md index 0e0f02a7044a9c634e2f101918e9c12747056bde..f981ad0f6d0e48e56db1e5673c30b86ee3e5808f 100644 --- a/en/device-dev/porting/porting-preparations.md +++ b/en/device-dev/porting/transplant-chip-prepare.md @@ -1,7 +1,7 @@ # Porting Preparations -- **[Before You Start](before-you-start.md)** +- **[Before You Start](transplant-chip-prepare-knows.md)** -- **[Building Adaptation Process](building-adaptation-process.md)** +- **[Building Adaptation Process](transplant-chip-prepare-process.md)** diff --git a/en/device-dev/porting/transplant-minichip.md b/en/device-dev/porting/transplant-minichip.md new file mode 100644 index 0000000000000000000000000000000000000000..38a8e78dc15a0880b33aa775c6b13056f4aecc7c --- /dev/null +++ b/en/device-dev/porting/transplant-minichip.md @@ -0,0 +1,11 @@ +# Mini System SoC Porting Guide + +- **[Porting Preparations](transplant-chip-prepare.md)** + +- **[Kernel Porting](transplant-chip-kernel.md)** + +- **[Board-Level OS Porting](transplant-chip-board.md)** + +- **[FAQ](transplant-chip-faqs.md)** + + diff --git a/en/device-dev/porting/transplant-smallchip-drive-des.md b/en/device-dev/porting/transplant-smallchip-drive-des.md new file mode 100644 index 0000000000000000000000000000000000000000..f0d29c993046768d62315a1818157137067e3db3 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-drive-des.md @@ -0,0 +1,11 @@ +# Overview + +Drivers can be classified as platform drivers or device drivers. The platform drivers are generally in the SoC, such as the GPIO, I2C, and SPI drivers. The device drivers are typically ouside of the SoC, such as the LCD, TP, and WLAN drivers. + +**Figure 1** OpenHarmony driver classification + + +![](figure/分类.png) + +The Hardware Driver Foundation \(HDF\) is designed to work across OSs. The HDF driver framework provides strong support for drivers to achieve this goal. During HDF driver development, you are advised to use only the APIs provided by the HDF driver framework. Otherwise, the driver cannot be used across OSs. Before driver development, familiarize yourself with the [HDF](https://gitee.com/openharmony/docs/blob/master/en/device-dev/driver/hdf.md). + diff --git a/en/device-dev/porting/transplant-smallchip-drive-oom.md b/en/device-dev/porting/transplant-smallchip-drive-oom.md new file mode 100644 index 0000000000000000000000000000000000000000..76c1b0741c29ce369584502081e4df794ce3af43 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-drive-oom.md @@ -0,0 +1,390 @@ +# Device Driver Porting + +- [LCD Driver Porting](#section1574513454119) +- [Touchscreen Driver Porting](#section20284142116422) +- [WLAN Driver Porting](#section0969448164217) + +This section describes how to port device drivers. + +## LCD Driver Porting + +To port an LCD driver, write the driver, create an instance of the corresponding model in the driver, and complete the registration. + +The LCD drivers are stored in **//drivers/framework/model/display/driver/panel**. + +1. Create a panel driver. + + Create an HDF driver and call the **RegisterPanel** method to register a model instance during driver initialization. + + ``` + int32_t LCDxxEntryInit(struct HdfDeviceObject *object) + { + struct PanelData *panel = CreateYourPanel(); + // Register a model instance. + 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 = LCDxxEntryInit, + }; + + HDF_INIT(g_xxxxDevEntry); + ``` + +2. Configure and load the panel driver. + + Modify the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Add configurations for the device named **device\_lcd** for the display host. + + >![](../public_sys-resources/icon-caution.gif) **CAUTION:** + >Make sure the value of **moduleName** is the same as that of **moduleName** in the panel driver. + + ``` + root { + ... + display :: host { + device_lcd :: device { + deviceN :: deviceNode { + policy = 0; + priority = 100; + preload = 2; + moduleName = "LCD_XXXX"; + } + } + } + } + ``` + + +## Touchscreen Driver Porting + +This section describes how to port a touchscreen driver. The touchscreen drivers are stored in the source code directory **//drivers/framework/model/input/driver/touchscreen**. To port a touchscreen driver, register a **ChipDevice** model instance with the system. + +For details about how to develop a touchscreen driver, see [Touchscreen Development Guidelines](https://gitee.com/openharmony/docs/blob/master/en/device-dev/driver/touchscreen.md). + +1. Create a touchscreen driver. + + Create the **touch\_ic\_name.c** file in the **touchscreen** directory. Write the following content: + + ``` + #include "hdf_touch.h" + + static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device) + { + ChipDevice *tpImpl = CreateXXXXTpImpl(); + if(RegisterChipDevice(tpImpl) != HDF_SUCCESS) {// Register the ChipDevice model instance. + ReleaseXXXXTpImpl(tpImpl); + return HDF_FAILURE; + } + return HDF_SUCCESS; + } + + struct HdfDriverEntry g_touchXXXXChipEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH_XXXX", // Make sure the value is the same as that in the subsequent configuration. + .Init = HdfXXXXChipInit, + }; + + HDF_INIT(g_touchXXXXChipEntry); + ``` + + The following methods need to be implemented in **ChipDevice**: + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

+

Description

+

int32_t (*Init)(ChipDevice *device)

+

Initializes the device.

+

int32_t (*Detect)(ChipDevice *device)

+

Detects the device.

+

int32_t (*Suspend)(ChipDevice *device)

+

Places the device in sleep mode.

+

int32_t (*Resume)(ChipDevice *device)

+

Wakes up the device.

+

int32_t (*DataHandle)(ChipDevice *device)

+

Reads data from the device and writes touch point data to device > driver > frameData.

+

int32_t (*UpdateFirmware)(ChipDevice *device)

+

Updates the firmware.

+
+ +2. Configure the product and load the driver. + + All device information of the product is defined in the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Modify the file and add configurations to the **device** named **device\_touch\_chip** in the **host** of the **input** command. + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >Make sure the value of **moduleName** is the same as that of **moduleName** in the touchscreen driver. + + ``` + deviceN :: deviceNode { + policy = 0; + priority = 130; + preload = 0; + permission = 0660; + moduleName = "HDF_TOUCH_XXXX"; + deviceMatchAttr = "touch_XXXX_configs"; + } + ``` + + +## WLAN Driver Porting + +The WLAN driver is divided into two parts. One of the parts manages WLAN devices, and the other part manages WLAN traffic. + +**Figure 1** OpenHarmony WLAN driver architecture + + +![](figure/hdf_wifi.png) + +As shown in [Figure 1](#fig155920160203), the part on the left manages WLAN devices, and the part on the right manages WLAN traffic. The HDF WLAN framework abstracts these two parts. The porting process of the driver can be considered as the implementation of the APIs required by the two parts. These APIs are described as follows: + + + + + + + + + + + + + + + + + + + + +

API

+

Header File

+

API Description

+

HdfChipDriverFactory

+

drivers\framework\include\wifi\hdf_wlan_chipdriver_manager.h

+

Factory of the ChipDriver, which is used to support multiple WLAN interfaces of a chip.

+

HdfChipDriver

+

drivers\framework\include\wifi\wifi_module.h

+

Manages a specific WLAN interface.

+

NetDeviceInterFace

+

drivers\framework\include\wifi\net_device.h

+

Communicates with the protocol stack, such as sending data and setting the status of network interfaces.

+
+ +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>For details about the API development, see [WLAN Development Guidelines](https://gitee.com/openharmony/docs/blob/master/en/device-dev/driver/wlan.md). + +The porting procedure is as follows: + +1. Create a WLAN chip driver. + + Create the **hdf\_wlan\_chip\_name.c** file in **/device/vendor\_name/peripheral/wifi/chip\_name/**. The sample code is as follows: + + ``` + static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) { + static struct HdfChipDriverFactory factory = CreateChipDriverFactory(); // Implement the method. + struct HdfChipDriverManager *driverMgr = HdfWlanGetChipDriverMgr(); + if (driverMgr->RegChipDriver(&factory) != HDF_SUCCESS) {// Register the driver factory. + 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" // Make sure the name is the same as the configured one. + }; + + HDF_INIT(g_hdfXXXChipEntry); + ``` + + In the **CreateChipDriverFactory** method, create an object of the **HdfChipDriverFactory** type. This object provides the following methods: + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

+

Description

+

const char *driverName

+

Indicates the driver name.

+

int32_t (*InitChip)(struct HdfWlanDevice *device)

+

Initializes the chip.

+

int32_t (*DeinitChip)(struct HdfWlanDevice *device)

+

Deinitializes the chip.

+

void (*ReleaseFactory)(struct HdfChipDriverFactory *factory)

+

Releases the HdfChipDriverFactory object.

+

struct HdfChipDriver *(*Build)(struct HdfWlanDevice *device, uint8_t ifIndex)

+

Creates an HdfChipDriver. In the input parameters, device indicates the device information, and ifIndex indicates the sequence number of this interface in the chip.

+

void (*Release)(struct HdfChipDriver *chipDriver)

+

Releases the chip driver.

+

uint8_t (*GetMaxIFCount)(struct HdfChipDriverFactory *factory)

+

Obtains the maximum number of interfaces supported by the current chip.

+
+ + The **Build** method creates an **HdfChipDriver** object that manages the specified network interface. This object needs to provide the following methods: + + + + + + + + + + + + + + + + + + + + + + +

Method

+

Description

+

int32_t (*init)(struct HdfChipDriver *chipDriver, NetDevice *netDev)

+

Initializes the current network interface. The NetDeviceInterFace needs to be provided for the netDev.

+

int32_t (*deinit)(struct HdfChipDriver *chipDriver, NetDevice *netDev)

+

Deinitializes the current network interface.

+

struct HdfMac80211BaseOps *ops

+

Provides the WLAN basic capability interface set.

+

struct HdfMac80211STAOps *staOps

+

Provides the interface set required for supporting the STA mode.

+

struct HdfMac80211APOps *apOps

+

Provides the interface set required for supporting the AP mode.

+
+ +2. Create a configuration file to describe the chips supported by the driver. + + Create a chip configuration file in the product configuration directory and save it to the source code path **//vendor/vendor\_name/product\_name/config/wifi/wlan\_chip\_chip\_name.hcs**. + + The sample code is as follows: + + ``` + root { + wlan_config { + chip_name :& chipList { + chip_name :: chipInst { + match_attr = "hdf_wlan_chips_chip_name"; /* Indicates the configuration matching attribute, which is used to provide the configuration root of the driver.*/ + driverName = "driverName"; /* Indicates the driver name, which must be the same as that of driverName in HdfChipDriverFactory.*/ + sdio { + vendorId = 0xXXXX; /* your vendor id */ + deviceId = [0xXXXX]; /*your supported devices */ + } + } + } + } + } + ``` + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >Replace the values of **vendor\_name**, **product\_name**, and **chip\_name** in the path and file with the actual names. + >Set **vendorId** and **deviceId** to the actual vendor ID and chip ID, respectively. + +3. Edit the configuration file and load the driver. + + All device information of the product is defined in the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Modify the file and add configurations to the **device** named **device\_wlan\_chips** in the **host** of the **network** command. The sample code is as follows: + + ``` + deviceN :: deviceNode { + policy = 0; + preload = 2; + moduleName = "HDF_WLAN_CHIPS"; + deviceMatchAttr = "hdf_wlan_chips_chip_name"; + serviceName = "driverName"; + } + ``` + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >Make sure the value of **moduleName** is the same as that of **moduleName** in the WLAN driver. + +4. Modify the **Kconfig** file to make the ported WLAN driver appear in the kernel configuration. + + Add configurations to **device/vendor\_name/drivers/Kconfig**. The sample code is as follows: + + ``` + config DRIVERS_HDF_WIFI_chip_name + bool "Enable chip_name Host driver" + default n + depends on DRIVERS_HDF_WLAN help + Answer Y to enable chip_name Host driver. + ``` + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >Replace **chip\_name** with the actual chip name. + +5. Modify the build script to enable the driver to participate in the kernel build. + + Add the following content to the end of the source code file **//device/vendor\_name/drivers/lite.mk**: + + ``` + ifeq ($(LOSCFG_DRIVERS_HDF_WIFI_chip_name), y) + # After the build is complete, an object named hdf_wlan_chipdriver_chip_name needs to be linked. You are advised to use this name to prevent conflicts. + LITEOS_BASELIB += -lhdf_wlan_chipdriver_chip_name + # Add the build directory gpio. + LIB_SUBDIRS += ../peripheral/wifi/chip_name + endif + ``` + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >Replace **chip\_name** with the actual chip name. + + diff --git a/en/device-dev/porting/transplant-smallchip-drive-plat.md b/en/device-dev/porting/transplant-smallchip-drive-plat.md new file mode 100644 index 0000000000000000000000000000000000000000..b6fd4a386b65c9f78d75123b48591a7d17bbaa84 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-drive-plat.md @@ -0,0 +1,165 @@ +# Platform Driver Porting + +Create a platform driver in the source code directory **//device/vendor\_name/soc\_name/drivers**. If there is no repository for the vendor of your SoC, contact the [device SIG](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md) to create one. + +The recommended directory structure is as follows: + +``` +device +├── vendor_name +│ ├── drivers +│ │ │ ├── common +│ │ │ ├── Kconfig # Entry of the vendor driver kernel menu +│ │ │ └── lite.mk # Build entry +│ ├── soc_name +│ │ ├── drivers +│ │ │ ├── dmac +│ │ │ ├── gpio +│ │ │ ├── i2c +│ │ │ ├── LICENSE +│ │ │ ├── mipi_dsi +│ │ │ ├── mmc +│ │ │ ├── pwm +│ │ │ ├── README.md # docs Add documentation information as needed. +│ │ │ ├── README_zh.md +│ │ │ ├── rtc +│ │ │ ├── spi +│ │ │ ├── uart +│ │ │ └── watchdog +│ ├── board_name +``` + +The HDF creates driver models for all platform drivers. The main task of porting platform drivers is to inject instances into the models. You can find the definitions of these models in the source code directory **//drivers/framework/support/platform/include**. + +The following uses the GPIO as an example to describe how to port the platform driver: + +1. Create a GPIO driver. + + Create the **soc\_name\_gpio.c** file in the source code directory **//device/vendor\_name/soc\_name/drivers/gpio**. The sample code is as follows: + + ``` + #include "gpio_core.h" + + // Define the GPIO structure if necessary. + struct SocNameGpioCntlr { + struct GpioCntlr cntlr; // Structure required by the HDF GPIO driver framework. + int myData; // The following information is required by the current driver. + }; + + // The Bind method is mainly used to release services in the HDF driver. As this method is not needed here, simply return a success message. + static int32_t GpioBind(struct HdfDeviceObject *device) + { + (void)device; + return HDF_SUCCESS; + } + + // Entry for initializing the driver when the Init method is used. You need to register the model instance in the Init method. + static int32_t GpioInit(struct HdfDeviceObject *device) + { + SocNameGpioCntlr *impl = CreateGpio(); // Implement the CreateGpio method. + ret = GpioCntlrAdd(&impl->cntlr); // Register a GPIO model instance. + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: err add controller:%d", __func__, ret); + return ret; + } + return HDF_SUCCESS; + } + + // The Release method is called when the driver is uninstalled to reclaim resources. + static void GpioRelease(struct HdfDeviceObject *device) + { + // The GpioCntlrFromDevice method obtains the model instance registered in the init method from the abstract device object. + struct GpioCntlr *cntlr = GpioCntlrFromDevice(device); + // Release resources. + } + + struct HdfDriverEntry g_gpioDriverEntry = { + .moduleVersion = 1, + .Bind = GpioBind, + .Init = GpioInit, + .Release = GpioRelease, + .moduleName = "SOC_NAME_gpio_driver", // Name to be used in the configuration file to load the driver. + }; + HDF_INIT(g_gpioDriverEntry); // Register a GPIO driver entry. + ``` + +2. Create a build entry for the vendor driver. + + As described above, **device/vendor\_name/drivers/lite.mk** is the entry for building vendor drivers. We need to start building from this entry. + + ``` + # File: device/vendor_name/drivers/lite.mk + + SOC_VENDOR_NAME := $(subst $/",,$(LOSCFG_DEVICE_COMPANY)) + SOC_NAME := $(subst $/",,$(LOSCFG_PLATFORM)) + BOARD_NAME := $(subst $/",,$(LOSCFG_PRODUCT_NAME)) + + # Specify the SoC for building. + LIB_SUBDIRS += $(LITEOSTOPDIR)/../../device/$(SOC_VENDOR_NAME)/$(SOC_NAME)/drivers/ + ``` + +3. Create a build entry for the SoC driver. + + ``` + # File: device/vendor_name/soc_name/drivers/lite.mk + + SOC_DRIVER_ROOT := $(LITEOSTOPDIR)/../../device/$(SOC_VENDOR_NAME)/$(SOC_NAME)/drivers/ + + # Check whether the kernel compilation switch of the GPIO is enabled. + ifeq ($(LOSCFG_DRIVERS_HDF_PLATFORM_GPIO), y) + # After the construction is complete, an object named hdf_gpio needs to be linked. + LITEOS_BASELIB += -lhdf_gpio + # Add the build directory gpio. + LIB_SUBDIRS += $(SOC_DRIVER_ROOT)/gpio + endif + + # Add other drivers here. + ``` + +4. Create a build entry for the GPIO driver. + + ``` + include $(LITEOSTOPDIR)/config.mk + include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk + + # Specify the name of the output object. Ensure that the name is the same as LITEOS_BASELIB in the SoC driver build entry. + MODULE_NAME := hdf_gpio + + # Add the INCLUDE of the HDF framework. + LOCAL_CFLAGS += $(HDF_INCLUDE) + + # Specify the file to be compiled. + LOCAL_SRCS += soc_name_gpio.c + + # Build parameters + LOCAL_CFLAGS += -fstack-protector-strong -Wextra -Wall -Werror -fsigned-char -fno-strict-aliasing -fno-common + + include $(HDF_DRIVER) + ``` + +5. Configure the product loading driver. + + All device information of the product is defined in the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. + + Add the platform driver to the host of the platform. + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >The value of **moduleName** must be the same as that defined in the driver. + + ``` + root { + ... + platform :: host { + device_gpio :: device { + device0 :: deviceNode { + policy = 0; + priority = 10; + permission = 0644; + moduleName = "SOC_NAME_gpio_driver"; + } + } + } + } + ``` + + diff --git a/en/device-dev/porting/transplant-smallchip-drive.md b/en/device-dev/porting/transplant-smallchip-drive.md new file mode 100644 index 0000000000000000000000000000000000000000..a79db8073393aeffdbaf19445f95dee3cefb9218 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-drive.md @@ -0,0 +1,9 @@ +# Driver Porting + +- **[Overview](transplant-smallchip-drive-des.md)** + +- **[Platform Driver Porting](transplant-smallchip-drive-plat.md)** + +- **[Device Driver Porting](transplant-smallchip-drive-oom.md)** + + diff --git a/en/device-dev/porting/transplant-smallchip-kernel-a.md b/en/device-dev/porting/transplant-smallchip-kernel-a.md new file mode 100644 index 0000000000000000000000000000000000000000..f64a0e832b18161a3cfd6339962f21b7776f45a8 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-kernel-a.md @@ -0,0 +1,263 @@ +# LiteOS Cortex-A + +- [Overview](#section14876256185510) + - [Porting Scenario](#section1986014410569) + - [Directory Specifications](#section10916181716564) + +- [Adaptation Process](#section814974018565) + - [Programming Example](#section10854481825) + +- [Verification](#section646410453212) + +## Overview + +### Porting Scenario + +LiteOS Cortex-A supports the ARMv7-a instruction set architecture. If you are porting the kernel to a chipset that uses ARMv7-a, you can directly perform basic adaptation. Otherwise, you need to add support for the architecture used by the chipset. This process is complex and not covered in this document. + +### Directory Specifications + +For details about the LiteOS Cortex-A directory specifications, see [LiteOS Cortex-A Overview](https://gitee.com/openharmony/kernel_liteos_a). + +## Adaptation Process + +LiteOS Cortex-A provides the system initialization process and custom configuration options required for system running. During porting, pay attention to the functions related to hardware configuration in the initialization process. + +The LiteOS Cortex-A initialization process consists of five steps: + +1. Add the **target\_config.h** file and compile the macros **DDR\_MEM\_ADDR** and **DDR\_MEM\_SIZE**, which indicate the start address and length of the board memory, respectively. The prelinker script **board.ld.S** creates the linker script **board.ld** based on the two macros. +2. The kernel creates a kernel image based on the linker script **board.ld**. +3. Operations such as initialization of the interrupt vector table and MMU page table are performed in the assembly files: **reset\_vector\_up.S** and **reset\_vector\_mp.S**, from which a single-core CPU and a multi-core CPU start, respectively. +4. The assembly code in **reset\_vector.S** jumps to the **main** function of the C programming language to initialize the hardware clock, software timer, memory, and tasks. This process depends on the feature macro configuration in **target\_config.h** . The **SystemInit** task to be implemented in the board code is then created, and **OsSchedStart\(\)** is enabled for task scheduling. +5. The **DeviceManagerStart** function is called to initialize the HDF driver. This process is implemented by calling the driver configuration file **hdf.hcs** and driver source code in the board code. + +Below is the overall initialization process. + +**Figure 1** Overall initialization process + + +![](figure/en-us_image_0000001126358814.png) + +As can be seen from preceding figure, kernel basic adaptation involves the following parts: + +- Adding the **target\_config.h** file, which contains board hardware parameters and feature parameters described in the following table: + + **Table 1** Parameters in the target\_config.h file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

OS_SYS_CLOCK

+

System cycle frequency

+

DDR_MEM_ADDR

+

Start address of the system memory

+

DDR_MEM_SIZE

+

Size of the system memory

+

PERIPH_PMM_BASE

+

Base address of the peripheral register

+

PERIPH_PMM_SIZE

+

Size of the peripheral register

+

OS_HWI_MIN

+

Minimum number of system interrupts

+

OS_HWI_MAX

+

Maximum number of system interrupts

+

NUM_HAL_INTERRUPT_UART0

+

UART0 interrupt ID

+

UART0_REG_BASE

+

UART0 register base address

+

GIC_BASE_ADDR

+

Base address of the GIC interrupt register

+

GICD_OFFSET

+

Offset address of the GICD relative to the GIC base address

+

GICC_OFFSET

+

Offset address of the GICC relative to the GIC base address

+
+ +- Implementing the **SystemInit** function to initialize services in the user space. Figure 2 shows a typical initialization scenario. + + **Figure 1** Service startup process + + + ![](figure/en-us_image_0000001126198996.png) + +- Implementing the **main** function for basic kernel initialization and initialization of services in the board kernel space. Figure 3 shows the initialization process, where the kernel startup framework takes the lead in the initialization process. The light blue part in the figure indicates the phase in which external modules can be registered and started in the startup framework. + + >![](../public_sys-resources/icon-caution.gif) **CAUTION:** + >Modules at the same layer cannot depend on each other. + + **Figure 2** Kernel startup framework + ![](figure/kernel-startup-framework.jpg "kernel-startup-framework") + + **Table 2** Startup framework layers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Level

+

Description

+

LOS_INIT_LEVEL_EARLIEST

+

Earliest initialization.

+

This layer does not depend on the architecture. The board and subsequent modules, such as the Trace module, will initialize the software-only modules on which they depend.

+

LOS_INIT_LEVEL_ARCH_EARLY

+

Early initialization of the architecture.

+

This layer depends on the architecture. Subsequent modules will initialize the modules on which they depend. It is recommended that functions not required for startup be placed at the LOS_INIT_LEVEL_ARCH layer.

+

LOS_INIT_LEVEL_PLATFORM_EARLY

+

Early initialization of the platform.

+

This layer depends on the board platform and drivers. Subsequent modules will initialize the modules on which they depend. It is recommended that functions required for startup be placed at the LOS_INIT_LEVEL_PLATFORM layer.

+

Example: UART module

+

LOS_INIT_LEVEL_KMOD_PREVM

+

Kernel module initialization before memory initialization.

+

This layer involves initialization of the modules that need to be enabled before memory initialization.

+

LOS_INIT_LEVEL_VM_COMPLETE

+

Initialization after the basic memory is ready.

+

This layer involves initialization of the modules that need to be enabled and do not depend on the inter-process communication mechanism and system processes.

+

Example: shared memory function

+

LOS_INIT_LEVEL_ARCH

+

Late initialization of the architecture.

+

This layer depends on the architecture extension function. Subsequent modules will initialize the modules on which they depend.

+

LOS_INIT_LEVEL_PLATFORM

+

Late initialization of the platform.

+

This layer depends on the board platform and drivers. Subsequent modules will initialize the modules on which they depend.

+

Example: initialization of the driver kernel abstraction layer (MMC and MTD)

+

LOS_INIT_LEVEL_KMOD_BASIC

+

Initialization of the kernel basic modules.

+

This layer is used to initialize the basic modules that can be detached from the kernel.

+

Example: VFS initialization

+

LOS_INIT_LEVEL_KMOD_EXTENDED

+

Initialization of the kernel extended modules.

+

This layer is used to initialize the extended modules that can be detached from the kernel.

+

Example: system call initialization, ProcFS initialization, Futex initialization, HiLog initialization, HiEvent initialization, and LiteIPC initialization

+

LOS_INIT_LEVEL_KMOD_TASK

+

Kernel task creation

+

This layer can be used to create kernel tasks (kernel thread and software timer tasks).

+

Example: creation of the resident resource reclaiming task, SystemInit task, and CPU usage statistics task.

+
+ + Adaptation for board porting. Focus on layers between **LOS\_INIT\_LEVEL\_ARCH** and **LOS\_INIT\_LEVEL\_KMOD\_TASK** and try to divide the initialization process into as many phases as possible for refined registration. + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >Modules at the same layer cannot depend on each other. It is recommended that a new module be split based on the preceding startup phase and be registered and started as required. + >You can view the symbol table in the **.rodata.init.kernel.\*** segment of the **OHOS\_Image.map** file generated after the build is complete, so as to learn about the initialization entry of each module that has been registered with the kernel startup framework and check whether the newly registered initialization entry takes effect. + + +### Programming Example + +In the board SDK file: + +``` +/* Header file of the kernel startup framework */ +#include "los_init.h" +...... + +/* Initialization function of the new module */ +unsigned int OsSampleModInit(void) +{ + PRINTK("OsSampleModInit SUCCESS!\n"); + ...... +} +...... +/* Register the new module at the target layer of the startup framework. */ +LOS_MODULE_INIT(OsSampleModInit, LOS_INIT_LEVEL_KMOD_EXTENDED); +``` + +## Verification + +``` +main core booting up... +OsSampleModInit SUCCESS! +releasing 1 secondary cores +cpu 1 entering scheduler +cpu 0 entering scheduler +``` + +According to the preceding information displayed during the system startup, the kernel calls the initialization function of the registered module during the startup to initialize the module. + +The system enters the kernel-space shell and the task commands can be properly executed. + +``` +OHOS # help +*******************shell commands:************************* + +arp cat cd chgrp chmod chown cp cpup +date dhclient dmesg dns format free help hwi +ifconfig ipdebug kill log ls lsfd memcheck mkdir +mount netstat oom partinfo partition ping ping6 pmm +pwd reset rm rmdir sem shm stack statfs +su swtmr sync systeminfo task telnet touch umount +uname v2p virstatfs vmm watch writeproc +``` + diff --git a/en/device-dev/porting/transplant-smallchip-kernel-linux.md b/en/device-dev/porting/transplant-smallchip-kernel-linux.md new file mode 100644 index 0000000000000000000000000000000000000000..3296d239e64311a2712ab66746be2f2e86c0fed2 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-kernel-linux.md @@ -0,0 +1,125 @@ +# Linux Kernel + +- [Overview](#section6282121355111) + - [Basic Information](#section19589322515) + - [Bootloader](#section19062510518) + +- [Adaptation, Building, Burning, and Startup](#section11112101695215) +- [Verification](#section17318153325311) + +## Overview + +Linux kernel porting involves basic kernel compilation, building, and verification after third-party chipset patches are installed based on the Linux kernel baseline. + +### Basic Information + +The current Linux kernel baseline evolves based on the Linux LTS version 4.19 and incorporates the CVE and bugfix patches. For details, see the [code library](https://gitee.com/openharmony/kernel_linux). The code path for the **repo** project is **kernel/linux-4.19**. + +### Bootloader + +You can use the Bootloader provided by the chipset vendor or open-source U-Boot to load the kernel image. For example, you can use [U-Boot](https://gitee.com/openharmony/device_hisilicon_third_party_uboot) for the Hi3516D V300 development board. + +## Adaptation, Building, Burning, and Startup + +1. Prepare the kernel configuration files, especially the chipset-related configuration files. + + Source code directory of the configuration files: **kernel/linux/config/** + + Create a **<_YOUR\_CHIP_\>\_small\_defconfig** file, such as **hi3516dv300\_small\_defconfig**, in the **linux-4.19/arch/arm/configs/** directory. The configuration file can be created by combining the general-purpose **small\_common\_defconfig** file and chipset-specific configurations. + +2. Prepare the chipset patches. + + Source code directory of the patch files: **kernel/linux/patches/linux-4.19** + + Create a **<_YOUR\_CHIP_\>\_patch** directory by referring to the existing patch directory **hi3516dv300\_small\_patch**, and place the related chipset patches, such as **hdf.patch** \(recommended\), in this directory. + +3. Build the code. + + In the project directory **kernel/linux/patches/**, after version-level build commands are passed to the **kernel\_module\_build.sh** and **kernel.mk** files, adapt the **patch** and **defconfig** configuration file paths, compiler, chipset architecture, and kernel image format. + + Adjust the patches based on build error logs. Typical error scenarios are as follows: + + \(1\) A conflict occurs in installing a patch. In this case, context adaptation is required. + + \(2\) The build fails due to kernel version mismatch. In this case, kernel adaptation is required, including function implementation adjustment. + + >![](../public_sys-resources/icon-caution.gif) **CAUTION:** + >- As in the **kernel.mk** file, patches are applied after the code environment of **kernel/linux-4.19** is copied during compilation and building of the OpenHarmony project. Retain the original code environment of **kernel/linux-4.19** before running the OpenHarmony version-level build command. + >- You can modify the patches in **out/<\*\*\*\>/kernel/linux-4.19**, to which the code environment is copied. + +4. Burn images and start the development board. + + The burning mode varies according to the development board of the chipset. Pay attention to the size of each burnt image and the configuration of the boot parameters. Below is the U-Boot parameter settings of Hi3516D V300: + + ``` + setenv bootargs 'mem=128M console=ttyAMA0,115200 root=/dev/mmcblk0p3 ro rootfstype=ext4 rootwait blkdevparts=mmcblk0:1M(boot),9M(kernel),50M(rootfs),50M(userfs)' + ``` + + +## Verification + +Debug the **init** process, start shell, and run a simple program in the user space to check whether the kernel porting is successful. Below is the OS image structure of the OpenHarmony [small system](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des-0000001105598722) and the Linux user-space program startup process. + +**Figure 1** OS image structure and user-space program startup process based on the Linux kernel + + +![](figure/en-us_image_0000001126354076.png) + +Based on the preceding process, the recommended verification procedure is as follows: + +1. Create a root file system image. + + Create a root file system image **rootfs.img** by following instructions in [Adding a Chipset Solution and a Product Solution](https://device.harmonyos.com/en/docs/develop/subsystems/oem_subsys_build_guide-0000001060378721). As shown in the preceding figure, the startup process is closely related to the product configuration. You need to complete the following configuration when creating **rootfs.img**: + + - Component configuration + + In the product component configuration file **_vendor_/\{_company_\}/\{_product_\}/config.json**, configure the **init\_lite** component of the startup subsystem and the **linux\_4\_1\_9** component of the kernel subsystem. + + - System service configuration + + Modify the system service configuration file **_vendor_/\{_company_\}/\{_product_\}/init\_configs/init\_xxx.cfg** to start the shell service. + + - File system configuration + + In the file system configuration file **_vendor_/\{_company_\}/\{_product_\}/fs.yml**, create the **/bin/sh -\> mksh** and **/lib/ld-musl-arm.so.1 -\> libc.so** soft links. These two files are the shell executable program and the c library on which the executable program depends, respectively. + + - Startup configuration + + In the **_vendor_/\{_company_\}/\{_product_\}/init\_configs/etc** directory, configure startup settings, including the **fstab**, **rsS**, and **S_xxx_** files. Configure the startup settings as needed. + + + After the build is complete, check the **rootfs** content in the product compilation output directory to determine whether the generated **rootfs.img** file meets the expectation. + +2. Debug the init process and shell. + + Burn **rootfs.img** and debug the init process and shell. The burning tools and processes vary according to the development board. Follow the instructions provided by the chipset solution vendor. Before burning **rootfs.img**, ensure that the bootloader and Linux kernel are started properly. When **rootfs.img** is properly mounted by the kernel, the **/bin/init** program is executed, indicating the start of the user space. + + The init process calls the **/etc/init.d/rcS** script. The **rcS** script runs the first command **/bin/mount -a** to load the **fstab** file. After the commands in this file are executed, **rcS** calls the **S_xxx_** scripts in sequence to create and scan for device nodes and configure file permissions. + + Then the init process reads the **init.cfg** system service configuration file and starts the shell as configured. If the preceding process is executed properly, the system enters the shell. + + If the init startup log contains the version number, the init program is started properly: + + **Figure 2** Log indicating that the init process is started properly + + + ![](figure/en-us_image_0000001172273945.jpg) + + After entering the shell, run the **ls** command. The following figure shows the information printed over the serial port. + + **Figure 3** Information printed after the ls command is executed in the shell + + + ![](figure/en-us_image_0000001172393865.jpg) + +3. Configure the NFS. + + After the init process and shell are started, run the following command in the root directory to enable the NFS service. In this example, the server IP address is 192.168.1.22 and the client IP address is 192.168.1.4. + + ``` + ifconfig eth0 192.168.1.4 netmask 255.255.255.0 + mkdir -p /storgage/nfs + mount -t nfs -o nolock,addr=192.168.1.22 192.168.1.22:/nfs /storage/nfs + ``` + + diff --git a/en/device-dev/porting/transplant-smallchip-kernel.md b/en/device-dev/porting/transplant-smallchip-kernel.md new file mode 100644 index 0000000000000000000000000000000000000000..cd252f8b951795654a29ecdc06cc83f1a9342c5b --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-kernel.md @@ -0,0 +1,7 @@ +# Kernel Porting + +- **[LiteOS Cortex-A](transplant-smallchip-kernel-a.md)** + +- **[Linux Kernel](transplant-smallchip-kernel-linux.md)** + + diff --git a/en/device-dev/porting/transplant-smallchip-prepare-building.md b/en/device-dev/porting/transplant-smallchip-prepare-building.md new file mode 100644 index 0000000000000000000000000000000000000000..b386a049feca70e65d61c8b234b6c4988b426b60 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-prepare-building.md @@ -0,0 +1,142 @@ +# Compilation and Building + +- [Compilation Environment Setup](#section3336103410314) +- [Introduction to the Compilation and Building Subsystem](#section354343816319) +- [Adding a Chipset Solution](#section18612153175011) + +## Compilation Environment Setup + +Set up the basic environment by following instructions in [Ubuntu Build Environment](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_environment_lin-0000001105407498). Both the user space and LiteOS Cortex-A kernel space are compiled using the LLVM compiler. If you choose to port the Linux kernel, run the following command to install the gcc-arm-linux-gnueabi cross compiler for compiling the Linux kernel-space image: + +``` +sudo apt-get install gcc-arm-linux-gnueabi +``` + +## Introduction to the Compilation and Building Subsystem + +To learn more about the compilation and building subsystem, including the compilation and building process, compilation scripts, and building chipset source code or single components, see [Compilation and Building](https://gitee.com/openharmony/docs/blob/master/en/device-dev/subsystems/compilation-and-building.md). + +## Adding a Chipset Solution + +After learning the compilation framework and setting up the compilation environment, perform the following steps to create a chipset solution: + +1. Create a category. + + The directory structure is as follows: device/\{_chipset solution vendor_\}/\{_development board_\}. For example, if you are using the hispark\_taurus development board from HiSilicon, create the following directory in the root directory of the code: + + ``` + mkdir -p device/hisilicon/hispark_taurus + ``` + + The chipset solution directory tree is as follows: + + ``` + device + └── company # Chipset solution vendor + └── board # Name of the development board + ├── BUILD.gn # Build script + ├── hals # Southbound APIs for OS adaptation + ├── linux # Linux kernel version (optional) + │ └── config.gni # Build options for the Linux version + └── liteos_a # LiteOS kernel version (optional) + └── config.gni # Build options for the LiteOS Cortex-A version + ``` + + For example, if you are porting the Linux kernel to the hispark\_taurus development board, the directory tree is as follows: + + ``` + device + └── hisilicon + └── hispark_tautus + ├── BUILD.gn + ├── hals + ├── ...... + └── linux + └── config.gni + ``` + + After the directory tree is created, store the source code related to the development board in the **hispark\_taurus** directory. + +2. Configure the build options of the development board. + + You can configure the build options in the **config.gni** file described in [1](#li20894101862). The compilation and building framework will then compile all OS components in the user space based on your configuration. The **config.gni** file contains the following key fields: + + ``` + kernel_type: kernel used by the development board, for example, liteos_a, liteos_m, or linux. + kernel_version: kernel version used by the development board, for example, 4.19. + board_cpu: CPU of the development board, for example, cortex-a7 or riscv32. + board_arch: chipset architecture of the development board, for example, armv7-a or rv32imac. + board_toolchain: name of the customized compiler used by the development board, for example, gcc-arm-none-eabi. If this field is not specified, ohos-clang will be used by default. + board_toolchain_prefix: prefix of the compiler, for example, gcc-arm-none-eabi. + board_toolchain_type: compiler type, for example, gcc or clang. Currently, only GCC and clang are supported. + board_cflags: build options of the .c file configured for the development board. + board_cxx_flags: build options of the .cpp file configured for the development board. + board_ld_flags: link options configured for the development board. + ``` + + For HiSilicon's hispark\_taurus development board, the content in **device/hisilicon/hispark\_taurus/config.gni** is as follows: + + ``` + # Board CPU type, e.g. "cortex-a7", "riscv32". + board_cpu = "cortex-a7" + + # Name of the compiler that is used for system building + # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. + # Note: The "ohos-clang" toolchain is used by default. You can also customize the toolchain. + board_toolchain = "mips-linux-gnu-gcc" + + # Path where the toolchain is installed, which can be left blank if the installation path has been added to ~/.bashrc. + board_toolchain_path = + rebase_path("//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin", + root_build_dir) + + # Prefix of the toolchain + board_toolchain_prefix = "arm-linux-ohoseabi-" + + # Type of the compiler, which can be gcc or clang + board_toolchain_type = "gcc" + + # Building flags related to the board + board_cflags = [ + ] + board_cxx_flags = [ + ] + board_ld_flags = [] + + # Board related headfiles search path. + board_include_dirs = [] + board_include_dirs += [ rebase_path( + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/target/usr/include", + root_build_dir) ] + + # Board adapter dir for OHOS components. + board_adapter_dir = "" + + # Sysroot path. + board_configed_sysroot = "" + + # Board storage type, it used for file system generation. + storage_type = "emmc" + ``` + +3. Edit the build script of the development board. + + In the **BUILD.gn** file described in 1, build code related to the development board, such as code for the on-device driver, on-device interface adaptation \(media and graphics\), and SDK on the development board. + + For example, edit the **device/hisilicon/hispark\_taurus/BUILD.gn** file as follows: + + ``` + # It is recommended that the group name be the same as the developer board name. + group("hispark_taurus") { + deps = [ "//kernel/linux/patches:linux_kernel" ] # Start kernel compilation. + deps += [ + ...... # Other compilation units of the development board + ] + } + ``` + +4. Start building and debugging. + + In the directory of the development board, run the **hb set** and **hb build** commands to start building the chipset solution. The compilation framework starts the building with the **BUILD.gn** file in the directory as the entry. + + diff --git a/en/device-dev/porting/transplant-smallchip-prepare-needs.md b/en/device-dev/porting/transplant-smallchip-prepare-needs.md new file mode 100644 index 0000000000000000000000000000000000000000..685a2a7a8cd49654abc2326776f3b8f276372af2 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-prepare-needs.md @@ -0,0 +1,98 @@ +# Before You Start + +This document provides guidance on how to port the Linux and LiteOS Cortex-A kernels on the OpenHarmony [small system](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des-0000001105598722) to a development board. It is intended for developers with experience in developing embedded systems. Before following instructions in this document, it is recommended that you familiarize yourself with [OpenHarmony](https://gitee.com/openharmony/docs/blob/master/en/OpenHarmony-Overview.md), including its technical architecture, directory structure, kernel subsystem, and driver subsystem. The following table lists the development boards that have been adapted to the small system. + +**Table 1** Development boards compatible with the OpenHarmony small system + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Development Board

+

Kernel

+

Architecture

+

ROM

+

RAM

+

File System

+

Flash Type

+

hispark_taurus

+

LiteOS Cortex-A and Linux 4.19

+

Arm Cortex-A7

+

8 GB

+

1 GB

+

VFAT, EXT4

+

eMMC4.5

+

hispark_aries

+

LiteOS-A

+

Arm Cortex-A7

+

16 MB

+

512 MB

+

JFFS2

+

SPI NOR

+
+ +In addition to the aforementioned development boards, LiteOS Cortex-A and Linux 4.19 can be ported to development boards that meet the requirements described in the table below. + +**Table 2** Requirements for porting OpenHarmony small system kernels + + + + + + + + + + + + + + + + + + + + + + +

Kernel

+

Supported Architecture

+

ROM

+

File System

+

Flash Type

+

LiteOS-A

+

ARMv7

+

> 2 MB

+

VFAT, JFFS2, YAFFS2

+

SPI NOR, NAND, eMMC

+

Linux 4.19

+

ARM, Arm64, MIPS, x86

+

> 5 MB

+

VFAT, JFFS2, YAFFS, EXT/2/3/4, NFS

+

NOR, NAND, eMMC

+
+ diff --git a/en/device-dev/porting/transplant-smallchip-prepare.md b/en/device-dev/porting/transplant-smallchip-prepare.md new file mode 100644 index 0000000000000000000000000000000000000000..91c9cecaa0bb12598425d416c72a58c4b0f992c7 --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip-prepare.md @@ -0,0 +1,7 @@ +# Porting Preparations + +- **[Before You Start](transplant-smallchip-prepare-needs.md)** + +- **[Compilation and Building](transplant-smallchip-prepare-building.md)** + + diff --git a/en/device-dev/porting/transplant-smallchip.md b/en/device-dev/porting/transplant-smallchip.md new file mode 100644 index 0000000000000000000000000000000000000000..818a9af1211dce6f85ee8d5c584fa0de10dfe3ad --- /dev/null +++ b/en/device-dev/porting/transplant-smallchip.md @@ -0,0 +1,9 @@ +# Small System SoC Porting Guide + +- **[Porting Preparations](transplant-smallchip-prepare.md)** + +- **[Kernel Porting](transplant-smallchip-kernel.md)** + +- **[Driver Porting](transplant-smallchip-drive.md)** + + diff --git a/en/device-dev/porting/porting-a-library-built-using-cmake.md b/en/device-dev/porting/transplant-thirdparty-cmake.md similarity index 98% rename from en/device-dev/porting/porting-a-library-built-using-cmake.md rename to en/device-dev/porting/transplant-thirdparty-cmake.md index a7d399c983a5841878aa59c6c4bd01dec39d4135..b8a9f3590019de6a82cdfcb992452b0013077d22 100644 --- a/en/device-dev/porting/porting-a-library-built-using-cmake.md +++ b/en/device-dev/porting/transplant-thirdparty-cmake.md @@ -227,12 +227,12 @@ The following steps show how to configure and modify the toolchains for cross-co 1. Set up the OpenHarmony environment. - Using Hi3518EV300 as an example, compile the OpenHarmony image and burn it to the development board. For details, see [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md). + Using Hi3518EV300 as an example, compile the OpenHarmony image and burn it to the development board. For details, see [Developing the First Example Program Running on Hi3518](../quick-start/quickstart-lite-steps-board3518-running.md). The following screen is displayed after a successful login to the OS. **Figure 1** Successful startup of OpenHarmony - ![](figures/successful-startup-of-openharmony.png "successful-startup-of-openharmony") + ![](figure/successful-startup-of-openharmony.png "successful-startup-of-openharmony") 2. Mount the **nfs** directory and put the executable file **cctest** into the **test** directory \(listed in [Table 2](#table1452412391911)\) to the **nfs** directory. 3. Perform the test cases. @@ -306,7 +306,7 @@ The following steps show how to configure and modify the toolchains for cross-co

GN file for adding the third-party library to the OpenHarmony project

openHarmony/third_party/double-conversion/build_thirdpaty.py

+

openHarmony/third_party/double-conversion/build_thirdparty.py

Script file for GN to call the shell command to convert compilation from GN to CMake.

GN file for adding the third-party library to the OpenHarmony project

openHarmony/third_party/yxml/build_thirdpaty.py

+

openHarmony/third_party/yxml/build_thirdparty.py

Script file for GN to call the shell command to convert compilation from GN to Makefile.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Topic

-

Development Scenario

-

Documents

-

About OpenHarmony

-

Getting familiar with OpenHarmony

-
-

Development resources

-

Preparing for your development

-
-

Quick start

-

Getting started with setup, build, burning, debugging, and running of OpenHarmony

-

Getting Started for Mini and Small Systems

-

Basic capabilities

-

Using basic capabilities of OpenHarmony

-
-

Advanced development

-

Developing smart devices based on system capabilities

-
-

Porting and adaptation

-
  • Porting and adapting the OpenHarmony to an SoC
  • Porting and adapting the OpenHarmony to a third-party library
-
-

Contributing components

-

Contributing components to OpenHarmony

-
-

Reference

-

Referring to development specifications

-
-
- -**Table 2** Standard system development guidelines \(reference memory ≥ 128 MB\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Topic

-

Development Scenario

-

Documents

-

About OpenHarmony

-

Getting familiar with OpenHarmony

-
-

Development resources

-

Preparing for your development

-
-

Quick start

-

Getting started with setup, build, burning, debugging, and running of OpenHarmony

-

Getting Started for Standard System

-

Basic capabilities

-

Using basic capabilities of OpenHarmony

-
-

Advanced development

-

Developing smart devices based on system capabilities

-
-

Porting and adaptation

-

Porting and adapting the OpenHarmony to a third-party library

-

Third-Party Library Porting Guide

-

Contributing components

-

Contributing components to OpenHarmony

-
-

Reference

-

Referring to development specifications

-
-
- diff --git a/en/device-dev/quick-start/public_sys-resources/icon-caution.gif b/en/device-dev/quick-start/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/quick-start/public_sys-resources/icon-danger.gif b/en/device-dev/quick-start/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/quick-start/public_sys-resources/icon-note.gif b/en/device-dev/quick-start/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/quick-start/public_sys-resources/icon-notice.gif b/en/device-dev/quick-start/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/quick-start/public_sys-resources/icon-tip.gif b/en/device-dev/quick-start/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/quick-start/public_sys-resources/icon-warning.gif b/en/device-dev/quick-start/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/quick-start/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/quick-start/overview-1.md b/en/device-dev/quick-start/quickstart-lite-env-setup-des.md similarity index 100% rename from en/device-dev/quick-start/overview-1.md rename to en/device-dev/quick-start/quickstart-lite-env-setup-des.md diff --git a/en/device-dev/quick-start/faq.md b/en/device-dev/quick-start/quickstart-lite-env-setup-faqs.md similarity index 100% rename from en/device-dev/quick-start/faq.md rename to en/device-dev/quick-start/quickstart-lite-env-setup-faqs.md diff --git a/en/device-dev/quick-start/ubuntu-build-environment.md b/en/device-dev/quick-start/quickstart-lite-env-setup-lin.md similarity index 95% rename from en/device-dev/quick-start/ubuntu-build-environment.md rename to en/device-dev/quick-start/quickstart-lite-env-setup-lin.md index 50c25fe1ea26c3f94dae8ce906c188d01e604850..a5ec9aa0dae52356baeb3ba311efe54a00742619 100644 --- a/en/device-dev/quick-start/ubuntu-build-environment.md +++ b/en/device-dev/quick-start/quickstart-lite-env-setup-lin.md @@ -26,10 +26,10 @@ Perform the following steps to set up the build environment: 5. Install LLVM. 6. Install hb. ->![](public_sys-resources/icon-notice.gif) **NOTICE:** ->- Docker is provided for the Ubuntu build environment, which encapsulates related build tools. If you use Docker to prepare the build environment, you do not need to perform the following steps in this section. Instead, refer to [Using Docker to Prepare the Build Environment](../get-code/docker-environment.md). +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** +>- Docker is provided for the Ubuntu build environment, which encapsulates related build tools. If you use Docker to prepare the build environment, you do not need to perform the following steps in this section. Instead, refer to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md). >- By default, basic software, such as Samba and Vim, is installed in the system. Adaptation on the software is required to support file sharing between the Linux server and the Windows workstation. ->- For details about the compilation and building subsystem of OpenHarmony, see the [Compilation and Building Overview](../subsystems/building-guidelines-for-mini-and-small-systems.md). +>- For details about the compilation and building subsystem of OpenHarmony, see [Compilation and Building Overview](../subsystems/subsys-build-mini-lite.md). ## Obtaining Source Code and Tools @@ -50,7 +50,7 @@ The following table describes the tools and source code required for setting up

Develops functions.

For details, see Source Code Acquisition.

+

For details, see Source Code Acquisition.

Python3.7+

@@ -107,13 +107,13 @@ The following table describes the tools and source code required for setting up
->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install compilation tools like **gn** and **ninja**. >- \(Recommended\) If you obtain the source code via the mirror site or code repository, install compilation tools such as **gn**, **ninja**, and LLVM. When installing these tools, ensure that their environment variable paths are unique. ## Obtaining Source Code -You need to acquire [source code](../get-code/source-code-acquisition.md), download it on a Linux server, and decompress it. +You need to acquire [source code](../get-code/sourcecode-acquire.md), download it on a Linux server, and decompress it. ## Installing and Configuring Python @@ -254,7 +254,7 @@ You need to acquire [source code](../get-code/source-code-acquisition.md), down 1. Start a Linux server. 2. [Download LLVM](https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz). - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >For the OpenHarmony\_v1.x branches and tags, click [here](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar) to download LLVM. 3. Decompress the LLVM installation package to **\~/llvm**. @@ -263,7 +263,7 @@ You need to acquire [source code](../get-code/source-code-acquisition.md), down tar -zxvf llvm.tar.gz -C ~/ ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >For the OpenHarmony\_v1.x branches and tags, run the following command to decompress the LLVM installation package: >``` >tar -xvf llvm-linux-9.0.0-36191.tar -C ~/ @@ -345,8 +345,8 @@ Python 3.7.4 or later has been installed. For details, see [Installing and Conf python3 -m pip uninstall ohos-build ``` ->![](public_sys-resources/icon-notice.gif) **NOTICE:** ->If you encounter any problem during the installation, resort to the [FAQ](faq.md). +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** +>If you encounter any problem during the installation, resort to the [FAQ](quickstart-lite-env-setup-faqs.md). ## Installing Other Tools @@ -355,7 +355,7 @@ python3 -m pip uninstall ohos-build 1. Use **apt-get** to install dependent tools. ``` - sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils + sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi ``` diff --git a/en/device-dev/quick-start/windows-development-environment.md b/en/device-dev/quick-start/quickstart-lite-env-setup-win.md similarity index 88% rename from en/device-dev/quick-start/windows-development-environment.md rename to en/device-dev/quick-start/quickstart-lite-env-setup-win.md index d0824ce00ea9573806c2a4c75f1df00a2de9aa0e..5cb943bfdb1881cf0384cff15036cc6cdf7aea74 100644 --- a/en/device-dev/quick-start/windows-development-environment.md +++ b/en/device-dev/quick-start/quickstart-lite-env-setup-win.md @@ -43,9 +43,9 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu

Programming tool

v3.7.4–3.8.x (64-bit)

+

V3.7.4 to V3.8.x (64-bit)

https://www.python.org/downloads/

+

Recommended: https://www.python.org/downloads/release/python-388/

Node.js

@@ -63,8 +63,7 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu

Latest version

Run the following command:

-
npm install -g @ohos/hpm-cli
+

For details, see Installing hpm.

DevEco Device Tool

@@ -82,29 +81,29 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ## Installing Visual Studio Code ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If you have installed Visual Studio Code, open the CLT and run **code --version** to check whether the version is 1.53 or later. If the version number is returned, it indicates that the environment variables are set correctly. 1. Double-click the Visual Studio Code package to install it. During the installation, select **Add to PATH \(requires shell restart\)**. - ![](figures/en-us_image_0000001174350653.png) + ![](figure/en-us_image_0000001174350653.png) 2. After the installation is complete, restart the computer for the environment variables of Visual Studio Code to take effect. 3. Open the CLT and run **code --version**. If the version number can be displayed, it indicates that the installation is successful. ## Installing Python -1. Double-click the Python software package, select **Add Python xx to PATH**, and click **Install Now**. +1. Double-click the Python software package, select **Add Python 3.8 to PATH**, and click **Install Now**. - ![](figures/en-us_image_0000001128471042.png) + ![](figure/en-us_image_0000001128470908.png) 2. After the installation is complete, click **Close**. - ![](figures/en-us_image_0000001128311104.png) + ![](figure/en-us_image_0000001128311104.png) 3. Open the CLT, and run **python --version** to check the installation result. - ![](figures/en-us_image_0000001174350781.png) + ![](figure/en-us_image_0000001174350655.png) 4. In the CLT, run the following commands to set the pip source for downloading the dependencies required for later installation: @@ -117,22 +116,22 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ## Installing Node.js ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If you have installed Node.js, open the CLT and run **node -v** to check whether the version is 12.0.0 or later. 1. Run the downloaded software package to install. Use the default settings when following the installation wizard, and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**. 2. Open the CLT and run **node -v**. If the version number of Node.js is displayed, it indicates that Node.js has been successfully installed. - ![](figures/en-us_image_0000001128311096.png) + ![](figure/en-us_image_0000001128311096.png) ## Installing hpm Before installing hpm, ensure that Node.js has been installed -and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/cn/docs/ide/user-guides/npm_proxy-0000001054491032) first. +and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/en/docs/ide/user-guides/npm_proxy-0000001054491032) first. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If hpm has been installed, run **npm update -g @ohos/hpm-cli** to update it to the latest version. 1. You are advised to set the npm source to an image in China, for example, a HUAWEI CLOUD image source. @@ -147,7 +146,7 @@ and that your network can access the Internet. If your network requires a proxy npm install -g @ohos/hpm-cli ``` - ![](figures/en-us_image_0000001128311100.png) + ![](figure/en-us_image_0000001128311100.png) 3. After the installation is complete, run the following command to obtain the installation result: @@ -155,29 +154,29 @@ and that your network can access the Internet. If your network requires a proxy hpm -V ``` - ![](figures/en-us_image_0000001174270735.png) + ![](figure/en-us_image_0000001174270735.png) ## Installing the DevEco Device Tool Plug-in To install the DevEco Device Tool plug-in, ensure that the **user name of the host cannot contain Chinese characters**; otherwise, the plug-in may fail to run. -DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144) first. +DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/en/docs/ide/user-guides/vscode_proxy-0000001074231144) first. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Before installing DevEco Device Tool, ensure that Visual Studio Code is closed. 1. Decompress the DevEco Device Tool plug-in package and double-click the installer to install. 2. During the installation, the dependency files \(such as C/C++ and CodeLLDB plug-ins\) and execution programs required by DevEco Device Tool are automatically installed. - ![](figures/en-us_image_0000001128470902.png) + ![](figure/en-us_image_0000001128470902.png) 3. After the installation is complete, the CLT is automatically closed. -4. Open Visual Studio Code, click the ![](figures/en-us_image_0000001174350651.png) button on the left, and check whether C/C++, CodeLLDB, and DevEco Device Tool are listed in **INSTALLED**. +4. Open Visual Studio Code, click the ![](figure/en-us_image_0000001174350651.png) button on the left, and check whether C/C++, CodeLLDB, and DevEco Device Tool are listed in **INSTALLED**. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846). - ![](figures/en-us_image_0000001174270727.png) + ![](figure/en-us_image_0000001174270727.png) diff --git a/en/device-dev/quick-start/quickstart-lite-env-setup.md b/en/device-dev/quick-start/quickstart-lite-env-setup.md new file mode 100644 index 0000000000000000000000000000000000000000..ae5573f8c093656b5b2dc1f91dc80ee5e9e7c4bf --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite-env-setup.md @@ -0,0 +1,11 @@ +# Environment Setup + +- **[Overview](quickstart-lite-env-setup-des.md)** + +- **[Windows Development Environment](quickstart-lite-env-setup-win.md)** + +- **[Ubuntu Build Environment](quickstart-lite-env-setup-lin.md)** + +- **[FAQ](quickstart-lite-env-setup-faqs.md)** + + diff --git a/en/device-dev/quick-start/hi3516-development-board.md b/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md similarity index 99% rename from en/device-dev/quick-start/hi3516-development-board.md rename to en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md index 53148cbe9a1fba7264055edc9fdad8eb193c00ad..69fcc82dfeba427de884a26a709551cdd50aa0b8 100644 --- a/en/device-dev/quick-start/hi3516-development-board.md +++ b/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md @@ -10,7 +10,7 @@ Hi3516D V300 is a next-generation system on chip \(SoC\) designed for the indust **Figure 1** Front view of the Hi3516D V300 board -![](figures/3516正面.png) +![](figure/3516正面.png) ## Development Board Specifications diff --git a/en/device-dev/quick-start/hi3518-development-board.md b/en/device-dev/quick-start/quickstart-lite-introduction-hi3518.md similarity index 97% rename from en/device-dev/quick-start/hi3518-development-board.md rename to en/device-dev/quick-start/quickstart-lite-introduction-hi3518.md index 262d456b50b47d8c91593999dd5a8f2d5a935d66..4e050a388c0bd04733b5b37a6849e7a1d8fbf143 100644 --- a/en/device-dev/quick-start/hi3518-development-board.md +++ b/en/device-dev/quick-start/quickstart-lite-introduction-hi3518.md @@ -8,12 +8,12 @@ Hi3518E V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and the advanced low-power process and architecture design, leading the industry in terms of low bit rate, high image quality, and low power consumption. **Figure 1** Front view of the Hi3518E V300 board -![](figures/front-view-of-the-hi3518e-v300-board.png "front-view-of-the-hi3518e-v300-board") +![](figure/front-view-of-the-hi3518e-v300-board.png "front-view-of-the-hi3518e-v300-board") **Figure 2** Rear view of the Hi3518E V300 board -![](figures/hi3518正背面.png) +![](figure/hi3518正背面.png) ## Development Board Specifications diff --git a/en/device-dev/quick-start/hi3861-development-board.md b/en/device-dev/quick-start/quickstart-lite-introduction-hi3861.md similarity index 99% rename from en/device-dev/quick-start/hi3861-development-board.md rename to en/device-dev/quick-start/quickstart-lite-introduction-hi3861.md index 6790ab0fe64db575950bef8225613438ccbad63a..3a8c051e1c78e97241c6d8407a9e7c37afe50c4b 100644 --- a/en/device-dev/quick-start/hi3861-development-board.md +++ b/en/device-dev/quick-start/quickstart-lite-introduction-hi3861.md @@ -12,14 +12,14 @@ The Hi3861 WLAN module is a development board with 2 x 5 cm form factor. It cont **Figure 1** Appearance of Hi3861 WLAN module -![](figures/3861正面.png) +![](figure/3861正面.png) The Hi3861 WLAN module can also be connected to the Hi3861 mother board to expand its peripheral capabilities. The following figure shows the Hi3861 mother board. **Figure 2** Appearance of the Hi3861 mother board -![](figures/en-us_image_0000001174350615.png) +![](figure/en-us_image_0000001174350615.png) - The RF circuit includes modules such as the power amplifier \(PA\), low noise amplifier \(LNA\), RF Balun, antenna switch, and power management. It supports a standard bandwidth of 20 MHz and a narrow bandwidth of 5 MHz or 10 MHz, and provides a maximum rate of 72.2 Mbit/s at the physical layer. - The Hi3861 WLAN baseband supports the orthogonal frequency division multiplexing \(OFDM\) technology and is backward compatible with the direct sequence spread spectrum \(DSSS\) and complementary code keying \(CCK\) technologies. In addition, the Hi3861 WLAN baseband supports various data rates specified in the IEEE 802.11 b/g/n protocol. @@ -29,7 +29,7 @@ The Hi3861 WLAN module can also be connected to the Hi3861 mother board to expan **Figure 3** Hi3861 functions - ![](figures/en-us_image_0000001128311066.png) + ![](figure/en-us_image_0000001128311066.png) ## Resources and Constraints diff --git a/en/device-dev/quick-start/quickstart-lite-introduction.md b/en/device-dev/quick-start/quickstart-lite-introduction.md new file mode 100644 index 0000000000000000000000000000000000000000..39c2b6911dc8f1b529884b5b5e457c6e01e65c62 --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite-introduction.md @@ -0,0 +1,9 @@ +# Introduction to the Development Boards + +- **[Hi3861 Development Board](quickstart-lite-introduction-hi3861.md)** + +- **[Hi3516 Development Board](quickstart-lite-introduction-hi3516.md)** + +- **[Hi3518 Development Board](quickstart-lite-introduction-hi3518.md)** + + diff --git a/en/device-dev/quick-start/overview-0.md b/en/device-dev/quick-start/quickstart-lite-overview.md similarity index 100% rename from en/device-dev/quick-start/overview-0.md rename to en/device-dev/quick-start/quickstart-lite-overview.md diff --git a/en/device-dev/quick-start/faqs-3.md b/en/device-dev/quick-start/quickstart-lite-steps-board3516-faqs.md similarity index 79% rename from en/device-dev/quick-start/faqs-3.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3516-faqs.md index 12c3a207b5cb348e0fc45f60c7985eacb886e61b..8c597eeca8ee9b47ac9e7592e9d7846111f4e5b1 100644 --- a/en/device-dev/quick-start/faqs-3.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3516-faqs.md @@ -13,7 +13,7 @@ **Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port. **Figure 1** Failed to open the serial port - ![](figures/failed-to-open-the-serial-port.png "failed-to-open-the-serial-port") + ![](figure/failed-to-open-the-serial-port.png "failed-to-open-the-serial-port") - **Possible Causes** @@ -24,19 +24,19 @@ 1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel. **Figure 2** Checking whether the serial port is used - ![](figures/checking-whether-the-serial-port-is-used.png "checking-whether-the-serial-port-is-used") + ![](figure/checking-whether-the-serial-port-is-used.png "checking-whether-the-serial-port-is-used") 2. Click the dustbin icon as shown in the following figure to disable the terminal using the serial port. **Figure 3** Disabling the terminal using the serial port - ![](figures/disabling-the-terminal-using-the-serial-port.png "disabling-the-terminal-using-the-serial-port") + ![](figure/disabling-the-terminal-using-the-serial-port.png "disabling-the-terminal-using-the-serial-port") 3. Click **Burn**, select the serial port, and start burning images again. **Figure 4** Restarting burning - ![](figures/changjian1.png) + ![](figure/changjian1.png) ## What should I do when Windows-based PC failed to be connected to the board? @@ -46,7 +46,7 @@ The file image cannot be obtained after clicking **Burn** and selecting a serial port. **Figure 5** Failed to obtain the image file due to unavailable connection - ![](figures/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection") + ![](figure/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection") - **Possible Causes** @@ -60,22 +60,22 @@ 2. Click **Windows Firewall**. **Figure 6** Network and firewall setting - ![](figures/network-and-firewall-setting.png "network-and-firewall-setting") + ![](figure/network-and-firewall-setting.png "network-and-firewall-setting") 3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**. **Figure 7** Firewall and network protection - ![](figures/firewall-and-network-protection.png "firewall-and-network-protection") + ![](figure/firewall-and-network-protection.png "firewall-and-network-protection") 4. Select the Visual Studio Code application. **Figure 8** Selecting the Visual Studio Code application - ![](figures/selecting-the-visual-studio-code-application.png "selecting-the-visual-studio-code-application") + ![](figure/selecting-the-visual-studio-code-application.png "selecting-the-visual-studio-code-application") 5. Select the **Private** and **Public** network access rights for the Visual Studio Code application. **Figure 9** Allowing the Visual Studio Code application to access the network - ![](figures/allowing-the-visual-studio-code-application-to-access-the-network.png "allowing-the-visual-studio-code-application-to-access-the-network") + ![](figure/allowing-the-visual-studio-code-application-to-access-the-network.png "allowing-the-visual-studio-code-application-to-access-the-network") ## What should I do when the image failed to be burnt? @@ -97,17 +97,17 @@ - **Symptom** - ![](figures/en-us_image_0000001174270715.png) + ![](figure/en-us_image_0000001174270715.png) - **Possible Cause 1**: Python is not installed. - **Solutions** - Install Python by referring to [Installing and Configuring Python](../quick-start/ubuntu-build-environment.md). + Install Python by referring to [Installing and Configuring Python](quickstart-lite-env-setup-lin.md). - **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory. - ![](figures/en-us_image_0000001128470880.png) + ![](figure/en-us_image_0000001128470880.png) - **Solutions** @@ -122,7 +122,7 @@ Example: - ![](figures/en-us_image_0000001174270713.png) + ![](figure/en-us_image_0000001174270713.png) ## What should I do when no command output is displayed? @@ -139,7 +139,7 @@ Change the serial port number. - Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step [1](../quick-start/running-a-hello-ohos-program.md) in the **Running an Image** section to change the serial port number. + Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step [1](#section627268185113) in the **Running an Image** section to change the serial port number. - **Possible Cause 2** @@ -155,7 +155,7 @@ 1. Obtain the U-boot file. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The U-boot file of the two boards can be obtained from the following paths, respectively. >Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin** >Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin** @@ -167,6 +167,6 @@ 3. Log in to the serial port after the burning is complete. **Figure 10** Serial port displayed after the U-boot is burnt - ![](figures/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt") + ![](figure/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt") diff --git a/en/device-dev/quick-start/developing-a-driver.md b/en/device-dev/quick-start/quickstart-lite-steps-board3516-program.md similarity index 95% rename from en/device-dev/quick-start/developing-a-driver.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3516-program.md index 46e8fc8d73366f89a16d84312e418e2c0a7d60b3..e541eb5237923c4715d3a4b16249360a1d06a9c3 100644 --- a/en/device-dev/quick-start/developing-a-driver.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3516-program.md @@ -56,7 +56,7 @@ The following operations take a HDF-based UART driver as an example to show how } ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >The configuration files are in the same path as the source code of the UART driver. You need to manually add the files to the path of the Hi3516D V300 development board. 2. Register a UART driver entry. @@ -416,34 +416,34 @@ The following operations take a HDF-based UART driver as an example to show how } ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >Preceding code snippets are for reference only. You can view the complete sample code in **vendor/huawei/hdf/sample.** >The sample code is not automatically compiled by default. You can add it to the compilation script. ## Compiling and Burning -Compile and burn images by referring to [Building](../guide/development-example-for-platform-drivers.md)and [Burning](../guide/development-example-for-platform-drivers.md). +Perform the [building](quickstart-lite-steps-board3516-running.md#section1077671315253) and [burning](quickstart-lite-steps-board3516-running.md#section1347011412201) as instructed in **Running a Hello OHOS Program**. ## Running an Image 1. Connect to a serial port. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** - >If the connection fails, rectify the fault by referring to [FAQs](../quick-start/faqs-3.md). + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** + >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-board3516-faqs.md). **Figure 1** Serial port connection - ![](figures/chuankou1.png) + ![](figure/chuankou1.png) 1. Click **Monitor** to enable the serial port. 2. Press **Enter** repeatedly until **hisilicon** displays. - 3. Go to [2](running-a-hello-ohos-program.md#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to [3](running-a-hello-ohos-program.md#ld26f18828aa44c36bfa36be150e60e49) otherwise. + 3. Go to [2](quickstart-lite-steps-board3516-running.md#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to [3](quickstart-lite-steps-board3516-running.md#ld26f18828aa44c36bfa36be150e60e49) otherwise. 2. \(Mandatory when the board is started for the first time\) Modify the **bootcmd** and **bootargs** parameters of U-Boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The default waiting time in the U-Boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisilicon" is displayed. **Table 1** Parameters of the U-Boot @@ -479,7 +479,7 @@ Compile and burn images by referring to [Building](../guide/development-example
- >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >**go 0x80000000** is optional. It indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press **Enter** in the countdown phase of the U-Boot startup to interrupt the automatic startup. 3. Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**. @@ -487,7 +487,7 @@ Compile and burn images by referring to [Building](../guide/development-example **Figure 2** System startup - ![](figures/qi1.png) + ![](figure/qi1.png) 4. In the root directory, run the **./bin/hello\_uart** command line to execute the demo program. The compilation result is shown in the following example. @@ -499,5 +499,5 @@ Compile and burn images by referring to [Building](../guide/development-example ## Follow-up Learning -Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/cameras-without-a-screen.md). +Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-camera.md). diff --git a/en/device-dev/quick-start/running-a-hello-ohos-program.md b/en/device-dev/quick-start/quickstart-lite-steps-board3516-running.md similarity index 90% rename from en/device-dev/quick-start/running-a-hello-ohos-program.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3516-running.md index 1bc2f5daad267626fea4ccda977975597197e26e..9b33afae1965ec4b0dd056280dab5eaf24deffc1 100644 --- a/en/device-dev/quick-start/running-a-hello-ohos-program.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3516-running.md @@ -129,7 +129,7 @@ This section describes how to create, compile, burn, and run the first program, ## Building -If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/docker-environment.md). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation: +If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation: ``` hb set (Set the building path.) @@ -139,28 +139,28 @@ hb build -f (Start building.) ``` **Figure 1** Settings -![](figures/settings.png "settings") +![](figure/settings.png "settings") The result files are generated in the **out/hispark\_taurus/ipcamera\_hispark\_taurus** directory. ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The U-Boot file of the Hi3516D V300 development board can be obtained from the following path: device/hisilicon/hispark\_taurus/sdk\_liteos/uboot/out/boot/u-boot-hi3516dv300.bin ## Burning The Hi3516 development board allows you to burn flash memory over the USB port, serial port, or network port. The following uses the network port burning as an example. -1. Connect the PC and the target development board through the power port, serial port, and network port. In this section, the Hi3516DV300 is used as an example. For details, please refer to [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3516-0000001152041033). +1. Connect the PC and the target development board through the power port, serial port, and network port. In this section, the Hi3516DV300 is used as an example. For details, please refer to [Introduction to the Hi3516 Development Board](quickstart-lite-introduction-hi3516.md). 2. Open Device Manager, then check and record the serial port number corresponding to the development board. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695). - ![](figures/en-us_image_0000001174350647.png) + ![](figure/en-us_image_0000001174350647.png) 3. Open DevEco Device Tool and go to **Projects** \> **Settings**. - ![](figures/2021-01-27_170334.png) + ![](figure/2021-01-27_170334.png) 4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings. 5. On the **hi3516dv300** tab page, set the programming options. @@ -169,7 +169,7 @@ The Hi3516 development board allows you to burn flash memory over the USB port, - **upload\_protocol**: Select the programming protocol **hiburn-net**. - **upload\_partitions**: Select the file to be programmed. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are programmed at the same time. - ![](figures/en-us_image_0000001128470904.png) + ![](figure/en-us_image_0000001128470904.png) 6. Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Programming on Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075). 7. Set the IP address of the network port for programming: @@ -179,33 +179,33 @@ The Hi3516 development board allows you to burn flash memory over the USB port, - **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.1. - **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.3. - ![](figures/en-us_image_0000001174270733.png) + ![](figure/en-us_image_0000001174270733.png) 8. When you finish modifying, click **Save** in the upper right corner. -9. Open the project file and click ![](figures/2021-01-27_170334-2.png). In the DevEco Device Tool window, choose **PROJECT TASKS** \> **hi3516dv300** \> **Upload** to start programming. +9. Open the project file and click ![](figure/2021-01-27_170334-2.png). In the DevEco Device Tool window, choose **PROJECT TASKS** \> **hi3516dv300** \> **Upload** to start programming. - ![](figures/en-us_image_0000001174270729.png) + ![](figure/en-us_image_0000001174270729.png) 10. When the following message is displayed, power off the development board and then power it on. - ![](figures/en-us_image_0000001128470906.png) + ![](figure/en-us_image_0000001128470906.png) 11. Start burning. When the following message is displayed, the burning is successful. - ![](figures/en-us_image_0000001128311098.png) + ![](figure/en-us_image_0000001128311098.png) ## Running an Image 1. Connect to a serial port. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** - >If the connection fails, rectify the fault by referring to [FAQs](../quick-start/faqs-3.md). + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** + >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-board3516-faqs.md). **Figure 2** Serial port connection - ![](figures/chuankou1.png) + ![](figure/chuankou1.png) 1. Click **Monitor** to enable the serial port. 2. Press **Enter** repeatedly until **hisilicon** displays. @@ -213,7 +213,7 @@ The Hi3516 development board allows you to burn flash memory over the USB port, 2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-Boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The default waiting time in the U-Boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisilicon" is displayed. **Table 1** Parameters of the U-Boot @@ -249,7 +249,7 @@ The Hi3516 development board allows you to burn flash memory over the USB port,
- >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >**go 0x80000000** \(optional\) indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press **Enter** in the countdown phase of the U-Boot startup to interrupt the automatic startup. 3. Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**. @@ -257,7 +257,7 @@ The Hi3516 development board allows you to burn flash memory over the USB port, **Figure 3** System startup - ![](figures/qi1.png) + ![](figure/qi1.png) ## Running a Program @@ -265,5 +265,5 @@ The Hi3516 development board allows you to burn flash memory over the USB port, In the root directory, run the **./bin/helloworld** command to operate the demo program. The compilation result is shown in the following example. **Figure 4** Successful system startup and program execution -![](figures/successful-system-startup-and-program-execution.png "successful-system-startup-and-program-execution") +![](figure/successful-system-startup-and-program-execution.png "successful-system-startup-and-program-execution") diff --git a/en/device-dev/quick-start/setting-up-the-environment-2.md b/en/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md similarity index 97% rename from en/device-dev/quick-start/setting-up-the-environment-2.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md index 0e8430d75a7fa0bfe54420a0fcb8638108732710..bb8595701a4f83270ac876a83f2846ce51d3e863 100644 --- a/en/device-dev/quick-start/setting-up-the-environment-2.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md @@ -22,11 +22,11 @@ The following figure shows the hardware connections. **Figure 1** Hardware connections -![](figures/矩形备份-292.png) +![](figure/矩形备份-292.png) ### Software ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and [Installing Linux Build Tools](#section182916865219). The following table describes the tools required for setting up the general environment for a Linux server of the Hi3516 development board and how to obtain these tools. @@ -75,7 +75,7 @@ The following table describes the tools required for setting up the general envi ## Installing Linux Build Tools ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install compilation tools like **LLVM** and **hc-gen**. >- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique. diff --git a/en/device-dev/quick-start/quickstart-lite-steps-board3516.md b/en/device-dev/quick-start/quickstart-lite-steps-board3516.md new file mode 100644 index 0000000000000000000000000000000000000000..97db943fc49eedc60d2a1409ed319390b0df9624 --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3516.md @@ -0,0 +1,11 @@ +# Hi3516 + +- **[Setting Up the Environment](quickstart-lite-steps-board3516-setting.md)** + +- **[Running a Hello OHOS Program](quickstart-lite-steps-board3516-running.md)** + +- **[Developing a Driver](quickstart-lite-steps-board3516-program.md)** + +- **[FAQs](quickstart-lite-steps-board3516-faqs.md)** + + diff --git a/en/device-dev/quick-start/faqs-6.md b/en/device-dev/quick-start/quickstart-lite-steps-board3518-faqs.md similarity index 80% rename from en/device-dev/quick-start/faqs-6.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3518-faqs.md index 05d53356aed9ab16ac8fe65e19da9dbe70089533..384eac7cdccbc83828ce8259efcafad4fb29cc3d 100644 --- a/en/device-dev/quick-start/faqs-6.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3518-faqs.md @@ -13,7 +13,7 @@ **Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port. **Figure 1** Failed to open the serial port - ![](figures/failed-to-open-the-serial-port-8.png "failed-to-open-the-serial-port-8") + ![](figure/failed-to-open-the-serial-port-8.png "failed-to-open-the-serial-port-8") - **Possible Causes** @@ -24,19 +24,19 @@ 1. Search for the terminal using serial-xx from the drop-down list in the **TERMINAL** panel. **Figure 2** Checking whether the serial port is used - ![](figures/checking-whether-the-serial-port-is-used-9.png "checking-whether-the-serial-port-is-used-9") + ![](figure/checking-whether-the-serial-port-is-used-9.png "checking-whether-the-serial-port-is-used-9") 2. Click the dustbin icon as shown in the following figure to disable the terminal using the serial port. **Figure 3** Disabling the terminal using the serial port - ![](figures/disabling-the-terminal-using-the-serial-port-10.png "disabling-the-terminal-using-the-serial-port-10") + ![](figure/disabling-the-terminal-using-the-serial-port-10.png "disabling-the-terminal-using-the-serial-port-10") 3. Click **Burn**, select the serial port, and start burning images again. **Figure 4** Restarting burning - ![](figures/changjian1-11.png) + ![](figure/changjian1-11.png) ## What should I do when Windows-based PC failed to be connected to the board? @@ -46,7 +46,7 @@ The file image cannot be obtained after clicking **Burn** and selecting a serial port. **Figure 5** Failed to obtain the image file due to unavailable connection - ![](figures/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png "failed-to-obtain-the-image-file-due-to-unavailable-connection-12") + ![](figure/failed-to-obtain-the-image-file-due-to-unavailable-connection-12.png "failed-to-obtain-the-image-file-due-to-unavailable-connection-12") - **Possible Causes** @@ -60,22 +60,22 @@ 2. Click **Windows Firewall**. **Figure 6** Network and firewall setting - ![](figures/network-and-firewall-setting-13.png "network-and-firewall-setting-13") + ![](figure/network-and-firewall-setting-13.png "network-and-firewall-setting-13") 3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**. **Figure 7** Firewall and network protection - ![](figures/firewall-and-network-protection-14.png "firewall-and-network-protection-14") + ![](figure/firewall-and-network-protection-14.png "firewall-and-network-protection-14") -4. Select the Visual Studio Code application +4. Select the Visual Studio Code application. **Figure 8** Selecting the Visual Studio Code application - ![](figures/selecting-the-visual-studio-code-application-15.png "selecting-the-visual-studio-code-application-15") + ![](figure/selecting-the-visual-studio-code-application-15.png "selecting-the-visual-studio-code-application-15") 5. Select the **Private** and **Public** network access rights for the Visual Studio Code application. **Figure 9** Allowing the Visual Studio Code application to access the network - ![](figures/allowing-the-visual-studio-code-application-to-access-the-network-16.png "allowing-the-visual-studio-code-application-to-access-the-network-16") + ![](figure/allowing-the-visual-studio-code-application-to-access-the-network-16.png "allowing-the-visual-studio-code-application-to-access-the-network-16") ## What should I do when the image failed to be burnt? @@ -97,7 +97,7 @@ - **Symptom** - ![](figures/en-us_image_0000001174270743.png) + ![](figure/en-us_image_0000001174270743.png) - **Possible Cause 1** @@ -106,11 +106,11 @@ - **Solutions** - Install Python by referring to [Installing and Configuring Python](../quick-start/ubuntu-build-environment.md). + Install Python by referring to [Installing and Configuring Python](quickstart-lite-env-setup-lin.md). - **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory. - ![](figures/en-us_image_0000001174270739.png) + ![](figure/en-us_image_0000001174270739.png) - **Solutions** @@ -125,7 +125,7 @@ Example: - ![](figures/en-us_image_0000001174350661.png) + ![](figure/en-us_image_0000001174350661.png) ## What should I do when no command output is displayed? @@ -142,7 +142,7 @@ Change the serial port number. - Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step [1](../quick-start/running-a-hello-ohos-program.md) in the **Running an Image** section to change the serial port number. + Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If the serial ports are different, perform step [1](quickstart-lite-steps-board3518-running.md) in the **Running an Image** section to change the serial port number. - **Possible Cause 2** @@ -158,7 +158,7 @@ 1. Obtain the U-boot file. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The U-boot file of the two boards can be obtained from the following paths, respectively. >Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin** >Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin** @@ -169,6 +169,6 @@ 3. Log in to the serial port after the burning is complete. - ![](figures/en-us_image_0000001174350659.png) + ![](figure/en-us_image_0000001174350659.png) diff --git a/en/device-dev/quick-start/running-a-hello-ohos-program-5.md b/en/device-dev/quick-start/quickstart-lite-steps-board3518-running.md similarity index 90% rename from en/device-dev/quick-start/running-a-hello-ohos-program-5.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3518-running.md index e3f5d5e2955b1b44c9999d567a171ca426f5104b..7b8ec4ecd0d6d0541dbe37430a8aa05cf02f9cd1 100644 --- a/en/device-dev/quick-start/running-a-hello-ohos-program-5.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3518-running.md @@ -128,7 +128,7 @@ This section describes how to create, compile, burn, and run the first program, ## Building -If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/docker-environment.md). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation: +If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation: ``` hb set (Set the building path.) @@ -140,26 +140,26 @@ hb build -f (Start building.) The result files are generated in the **out/hispark\_aries/ipcamera\_hispark\_aries** directory. **Figure 1** Settings -![](figures/settings-4.png "settings-4") +![](figure/settings-4.png "settings-4") ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The U-Boot file of the Hi3518E V300 development board can be obtained from the following path: device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin ## Burning The USB port is the only burning mode supported by the Hi3518 development board. -1. Connect the PC and the target development board through the serial port and USB port. In this section, the Hi3518EV300 is used as an example. For details, see [Introduction to the Hi3518 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3518-0000001105201138). +1. Connect the PC and the target development board through the serial port and USB port. In this section, the Hi3518EV300 is used as an example. For details, see [Introduction to the Hi3518 Development Board](quickstart-lite-introduction-hi3518.md). 2. Open Device Manager, then check and record the serial port number corresponding to the development board. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695). - ![](figures/en-us_image_0000001128470900.png) + ![](figure/en-us_image_0000001128470900.png) 3. Open DevEco Device Tool and go to **Projects** \> **Settings**. - ![](figures/en-us_image_0000001174350649.png) + ![](figure/en-us_image_0000001174350649.png) 4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings. 5. On the **hi3518ev300** tab page, set the programming options. @@ -168,41 +168,41 @@ The USB port is the only burning mode supported by the Hi3518 development board. - **upload\_protocol**: Select the programming protocol **hiburn-usb**. - **upload\_partitions**: Select the file to be programmed. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are programmed at the same time. - ![](figures/en-us_image_0000001128311090.png) + ![](figure/en-us_image_0000001128311090.png) 6. When you finish modifying, click **Save** in the upper right corner. -7. Open the project file and click ![](figures/2021-01-27_170334-5.png). In the DevEco Device Tool window, choose **PROJECT TASKS** \> **hi3518ev300\_fastboot** \> **Erase** to erase U-Boot. +7. Open the project file and click ![](figure/2021-01-27_170334-5.png). In the DevEco Device Tool window, choose **PROJECT TASKS** \> **hi3518ev300\_fastboot** \> **Erase** to erase U-Boot. - ![](figures/en-us_image_0000001174270731.png) + ![](figure/en-us_image_0000001174270731.png) 8. When the following message is displayed, power off the development board and then power it on. - ![](figures/en-us_image_0000001128311092.png) + ![](figure/en-us_image_0000001128311092.png) 9. If the following message is displayed, it indicates that U-Boot is erased successfully. - ![](figures/en-us_image_0000001128311094.png) + ![](figure/en-us_image_0000001128311094.png) 10. Go to **hi3518ev300** \> **Upload** to start programming. - ![](figures/en-us_image_0000001174350641.png) + ![](figure/en-us_image_0000001174350641.png) 11. If the following message is displayed, it indicates that the programming is successful. - ![](figures/en-us_image_0000001174350643.png) + ![](figure/en-us_image_0000001174350643.png) ## Running an Image 1. Connect to a serial port. - >![](public_sys-resources/icon-notice.gif) **NOTICE:** - >If the connection fails, rectify the fault by referring to [FAQs](../quick-start/faqs-6.md). + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** + >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-board3518-faqs.md). **Figure 2** Serial port connection - ![](figures/chuankou1-6.png) + ![](figure/chuankou1-6.png) 1. Click **Monitor** to enable the serial port. The **TERMINAL** window is displayed. 2. Press **Enter** repeatedly until **hisilicon** displays. @@ -247,16 +247,16 @@ The USB port is the only burning mode supported by the Hi3518 development board.
- >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >![](../public_sys-resources/icon-notice.gif) **NOTICE:** >**go 0x40000000** \(optional\) indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press **Enter** in the countdown phase of the U-Boot startup to interrupt the automatic startup. 3. If **hisilicon \#** is displayed during the startup, run the **reset** command. After the system automatically starts and **OHOS** is displayed, run the **./bin/helloworld** command and then press **Enter**. The system is started successfully if information shown in the following figure is displayed. **Figure 3** Successful system startup and program execution - ![](figures/successful-system-startup-and-program-execution-7.png "successful-system-startup-and-program-execution-7") + ![](figure/successful-system-startup-and-program-execution-7.png "successful-system-startup-and-program-execution-7") ## Follow-up Learning -Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/cameras-with-a-screen.md). +Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-iotcamera.md). diff --git a/en/device-dev/quick-start/setting-up-the-environment-4.md b/en/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md similarity index 96% rename from en/device-dev/quick-start/setting-up-the-environment-4.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md index 606871622b0805662544e092fd9c1e64e4f1cb27..9bc63015a4c5956197248d223e54de4bc1df1c1b 100644 --- a/en/device-dev/quick-start/setting-up-the-environment-4.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md @@ -21,11 +21,11 @@ **Figure 1** Hardware connections -![](figures/hardware-connections-3.png "hardware-connections-3") +![](figure/hardware-connections-3.png "hardware-connections-3") ### Software Requirements ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and [Installing Linux Build Tools](#section8831868501). The following table describes the tools required for setting up the general environment for a Linux server of the Hi3518 development board and how to obtain these tools. @@ -67,7 +67,7 @@ The following table describes the tools required for setting up the general envi ## Installing Linux Build Tools ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install **hc-gen**. >- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique. diff --git a/en/device-dev/quick-start/quickstart-lite-steps-board3518.md b/en/device-dev/quick-start/quickstart-lite-steps-board3518.md new file mode 100644 index 0000000000000000000000000000000000000000..e9f239a0ee8bcf928fe46dc35ba11fb2a48b31e1 --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3518.md @@ -0,0 +1,9 @@ +# Hi3518 + +- **[Setting Up the Environment](quickstart-lite-steps-board3518-setting.md)** + +- **[Running a Hello OHOS Program](quickstart-lite-steps-board3518-running.md)** + +- **[FAQs](quickstart-lite-steps-board3518-faqs.md)** + + diff --git a/en/device-dev/quick-start/wlan-connection.md b/en/device-dev/quick-start/quickstart-lite-steps-board3861-connection.md similarity index 87% rename from en/device-dev/quick-start/wlan-connection.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3861-connection.md index 6869012b733851e1555efbf1cce23ea5c51f7317..2ce585ea88b513619177b24358cc3f82e0442b86 100644 --- a/en/device-dev/quick-start/wlan-connection.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3861-connection.md @@ -10,42 +10,42 @@ This example shows how to connect the WLAN module to the gateway using attention This section describes how to perform the WLAN module building on a Linux server. -If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/docker-environment.md). If the Linux environment is installed using a software package, perform the following steps: +If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/sourcecode-acquire.md). If the Linux environment is installed using a software package, perform the following steps: 1. Open the HUAWEI DevEco Device Tool and choose **View** \> **Terminal**. **Figure 1** Starting the IDE terminal tool - ![](figures/1.png) + ![](figure/1.png) On the **TERMINAL** panel, run the ssh command, for example, **ssh** **_user_@_ipaddr_**, to connect to the Linux server. **Figure 2** TERMINAL panel - ![](figures/2.png) + ![](figure/2.png) 2. Go to the root directory of the code, run the **hb set** and **.** commands on the **TERMINAL** panel, and select the **wifiiot\_hispark\_pegasus** version. **Figure 3** Selecting the target build version - ![](figures/3.png) + ![](figure/3.png) 3. Run the **hb build** command to start building. **Figure 4** Running commands on the TERMINAL panel - ![](figures/4.png) + ![](figure/4.png) 4. Check whether the building is successful. If yes, **wifiiot\_hispark\_pegasus build success** will be displayed, as shown in the following figure. **Figure 5** Successful building - ![](figures/5.png) + ![](figure/5.png) 5. Check whether the following files are generated in the **./out/wifiiot/** directory. @@ -56,24 +56,24 @@ If the Linux environment is installed using Docker, perform the building by refe **Figure 6** Directory for storing the generated files - ![](figures/3-0.png) + ![](figure/3-0.png) ## Burning Images You can use the DevEco tool to perform the image burning of the Hi3861 WLAN module. For details about how to use the tool, see [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905). -1. Connect the PC and the target development board through the USB port. For details, please refer to [Introduction to the Hi3861 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3861-0000001105041324). +1. Connect the PC and the target development board through the USB port. For details, see [Introduction to the Hi3861 Development Board](quickstart-lite-introduction-hi3861.md). 2. Open Device Manager, then check and record the serial port number corresponding to the development board. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3861 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433). - ![](figures/en-us_image_0000001128311118.png) + ![](figure/en-us_image_0000001128311118.png) 3. Open DevEco Device Tool and go to **Projects** \> **Settings**. - ![](figures/en-us_image_0000001128311116.png) + ![](figure/en-us_image_0000001128311116.png) 4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings. 5. On the **hi3861** tab page, set the programming options. @@ -82,20 +82,20 @@ You can use the DevEco tool to perform the image burning of the Hi3861 WLAN modu - **upload\_protocol**: Select the burning protocol **burn-serial**. - **upload\_partitions**: Select the file to be burned. **hi3861\_app** is selected by default. - ![](figures/en-us_image_0000001128470922.png) + ![](figure/en-us_image_0000001128470922.png) 6. When you finish modifying, click **Save** in the upper right corner. 7. Open the project file. In the DevEco Device Tool window, go to **PROJECT TASKS** \> **hi3861** \> **Upload** to start programming. - ![](figures/en-us_image_0000001174270749.png) + ![](figure/en-us_image_0000001174270749.png) 8. When the following information is displayed, press the RST button on the development board to restart it. - ![](figures/en-us_image_0000001174270751.png) + ![](figure/en-us_image_0000001174270751.png) 9. Start burning. When the following message is displayed, the burning is successful. - ![](figures/en-us_image_0000001174350669.png) + ![](figure/en-us_image_0000001174350669.png) ## Connecting WLAN Module to the Internet. @@ -107,14 +107,14 @@ After completing version building and burning, do as follows to connect the WLAN **Figure 7** Opening the DevEco serial port - ![](figures/5-1.png) + ![](figure/5-1.png) 2. Reset the WLAN module. The message **ready to OS start** is displayed on the **TERMINAL** panel, indicating that the WLAN module is started successfully. **Figure 8** Successful resetting of the WLAN module - ![](figures/6.png) + ![](figure/6.png) 3. Run the following AT commands in sequence via the DevEco serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\). @@ -137,6 +137,6 @@ After completing version building and burning, do as follows to connect the WLAN **Figure 9** Successful networking of the WLAN module - ![](figures/截图.png) + ![](figure/截图.png) diff --git a/en/device-dev/quick-start/faqs.md b/en/device-dev/quick-start/quickstart-lite-steps-board3861-faqs.md similarity index 95% rename from en/device-dev/quick-start/faqs.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3861-faqs.md index 43db6c0373612483fa0cc1e752058e256bf9665e..9f4f5b1583e64ed802a7b076f008b31a89e7c2ac 100644 --- a/en/device-dev/quick-start/faqs.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3861-faqs.md @@ -73,7 +73,7 @@ Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/). - ![](figures/10.png) + ![](figure/10.png) Then run the following commands to install **zlib** offline: @@ -134,7 +134,7 @@ - Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files). - ![](figures/en-us_image_0000001128470864.png) + ![](figure/en-us_image_0000001128470864.png) - Save the source code package to the Linux server, decompress the package, and run the **python3 setup.py install** command to install **Crypto**. - Rebuild an environment. @@ -164,7 +164,7 @@ - Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files). - ![](figures/en-us_image_0000001128311072.png) + ![](figure/en-us_image_0000001128311072.png) - Save the installation package to the Linux server and run the **pip3 install ecdsa-0.15-py2.py3-none-any.whl** command to install **ecdsa**. - Rebuild an environment. @@ -194,7 +194,7 @@ - Download the installation package from [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files). - ![](figures/en-us_image_0000001174270699.png) + ![](figure/en-us_image_0000001174270699.png) - Save the source code to the Linux server and run the **pip3 install six-1.14.0-py2.py3-none-any.whl** command to install **six**. - Rebuild an environment. @@ -243,11 +243,11 @@ - **Possible Cause 1:** Python is not installed. - **Solutions** - Install Python by referring to [Installing and Configuring Python](../quick-start/ubuntu-build-environment.md). + Install Python by referring to [Installing and Configuring Python](quickstart-lite-env-setup-lin.md). - **Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory. - ![](figures/en-us_image_0000001128311070.png) + ![](figure/en-us_image_0000001128311070.png) - **Solutions** @@ -262,7 +262,7 @@ Example: - ![](figures/en-us_image_0000001174350623.png) + ![](figure/en-us_image_0000001174350623.png) ## What should I do when an error with **lsb\_release** occurs during **kconfiglib** installation? diff --git a/en/device-dev/quick-start/running-a-hello-world-program.md b/en/device-dev/quick-start/quickstart-lite-steps-board3861-running.md similarity index 98% rename from en/device-dev/quick-start/running-a-hello-world-program.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3861-running.md index 80f8aacc5a4c79efa00cfd03e4de8d07dcb43d82..d33056d84f2597bcabd5c97a8244ee4bcf3501a3 100644 --- a/en/device-dev/quick-start/running-a-hello-world-program.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3861-running.md @@ -135,7 +135,7 @@ To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is 3. Determine that an exception occurs in the **WadRecvCB** function based on the call stack information. - ![](figures/en-us_image_0000001174270737.png) + ![](figure/en-us_image_0000001174270737.png) 4. Check and modify the code. @@ -152,5 +152,5 @@ wifi init success! ## Follow-up Learning -Congratulations! You have finished all steps! You are advised to go on learning how to develop [WLAN-connected products](../guide/wlan-connected-products.md). +Congratulations! You have finished all steps! You are advised to go on learning how to develop [WLAN-connected products](../guide/device-wifi.md). diff --git a/en/device-dev/quick-start/setting-up-the-environment.md b/en/device-dev/quick-start/quickstart-lite-steps-board3861-setting.md similarity index 97% rename from en/device-dev/quick-start/setting-up-the-environment.md rename to en/device-dev/quick-start/quickstart-lite-steps-board3861-setting.md index 9eb8b040c6320fb44813778e45d0cfe647623a74..92d567cd5d954a195ccde7826cbfc997f585505f 100644 --- a/en/device-dev/quick-start/setting-up-the-environment.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3861-setting.md @@ -24,11 +24,11 @@ The following figure shows the hardware connections. **Figure 1** Hardware connections -![](figures/hardware-connections.png "hardware-connections") +![](figure/hardware-connections.png "hardware-connections") ### Software ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >The following part describes how to install tools using installation packages. If you use Docker to set up the build environment, you only need to install the Windows workstation described in [Table 1](#table6299192712513). The following table lists the tools required for the Hi3861 development board. @@ -96,7 +96,7 @@ The following table lists the tools required for the Hi3861 development board. ## Installing Linux Build Tools ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install **gcc\_riscv32**. >- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **gcc\_riscv32**. When installing the compilation tool, ensure that its environment variable path is unique. @@ -124,7 +124,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ``` **Figure 2** Successful installation \(SCons version requirement: 3.0.4 or later\) - ![](figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png "successful-installation-(scons-version-requirement-3-0-4-or-later)") + ![](figure/successful-installation-(scons-version-requirement-3-0-4-or-later).png "successful-installation-(scons-version-requirement-3-0-4-or-later)") ### Installing Python Modules @@ -227,7 +227,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ### Installing gcc\_riscv32 \(Compilation Toolchain for WLAN Module\) ->![](public_sys-resources/icon-notice.gif) **NOTICE:** +>![](../public_sys-resources/icon-notice.gif) **NOTICE:** >- The Hi3861 platform supports only the static link of the libgcc library. The dynamic link is not recommended because version 3 of the GNU General Public License \(GPLv3\) will be polluted during commercial distribution. >- Steps 2 to 15 of the following procedure are used to build the **gcc\_riscv32** image. You can simply [download the image](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz) and skip these steps. @@ -316,7 +316,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev 16. Set an environment variable. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If you use the compiled **riscv32 gcc** package, perform the following steps to set environment variables: >1. Decompress the package to the root directory. > ``` @@ -358,10 +358,10 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev Perform the following operations on the Windows station. -1. Download the USB-to-serial driver: [CH341SER USB-to-serial driver](http://www.wch-ic.com/search?t=all&q=CH340g). +1. Download the USB-to-serial driver: [CH341SER USB-to-serial driver](http://www.hihope.org/en/download/download.aspx). 2. Install the driver. 3. After the driver is installed, remove and then insert the USB cable. The serial port entry should be displayed as shown in the following figure. - ![](figures/en-us_image_0000001174350633.png) + ![](figure/en-us_image_0000001174350633.png) diff --git a/en/device-dev/quick-start/quickstart-lite-steps-board3861.md b/en/device-dev/quick-start/quickstart-lite-steps-board3861.md new file mode 100644 index 0000000000000000000000000000000000000000..a0b8821b092c2b1e524a1f027c82eede39f8627b --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite-steps-board3861.md @@ -0,0 +1,11 @@ +# Hi3861 + +- **[Setting Up the Environment](quickstart-lite-steps-board3861-setting.md)** + +- **[WLAN Connection](quickstart-lite-steps-board3861-connection.md)** + +- **[Running a Hello World Program](quickstart-lite-steps-board3861-running.md)** + +- **[FAQs](quickstart-lite-steps-board3861-faqs.md)** + + diff --git a/en/device-dev/quick-start/quickstart-lite-steps.md b/en/device-dev/quick-start/quickstart-lite-steps.md new file mode 100644 index 0000000000000000000000000000000000000000..cd4b82e4fd43c3494e6c0f16a5773b13b4c262e0 --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite-steps.md @@ -0,0 +1,9 @@ +# How to Develop + +- **[Hi3861](quickstart-lite-steps-board3861.md)** + +- **[Hi3516](quickstart-lite-steps-board3516.md)** + +- **[Hi3518](quickstart-lite-steps-board3518.md)** + + diff --git a/en/device-dev/quick-start/quickstart-lite.md b/en/device-dev/quick-start/quickstart-lite.md new file mode 100644 index 0000000000000000000000000000000000000000..064e2ef51e72d289ab48512e29e01909530a6472 --- /dev/null +++ b/en/device-dev/quick-start/quickstart-lite.md @@ -0,0 +1,11 @@ +# Mini and Small Systems + +- **[Overview](quickstart-lite-overview.md)** + +- **[Introduction to the Development Boards](quickstart-lite-introduction.md)** + +- **[Environment Setup](quickstart-lite-env-setup.md)** + +- **[How to Develop](quickstart-lite-steps.md)** + + diff --git a/en/device-dev/quick-start/burning-images.md b/en/device-dev/quick-start/quickstart-standard-burn.md similarity index 97% rename from en/device-dev/quick-start/burning-images.md rename to en/device-dev/quick-start/quickstart-standard-burn.md index b63966d94334be8ec473b7d641fb4f36c33b8866..5cfe9fccf987772fa26e2d64144c0416f7897dcc 100644 --- a/en/device-dev/quick-start/burning-images.md +++ b/en/device-dev/quick-start/quickstart-standard-burn.md @@ -11,7 +11,7 @@ The Hi3516DV300 of the Hi3516 series development boards supports programming fla Except for environment setup, the operations of programming are the same for Windows and Linux. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Currently, the Hi3516D V300 development board supports system burning over the network port, USB port, or serial port. This document uses the network port as an example. For details about system burning over other ports, see [Programming Flash Memory on the Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681). ### Prerequisites @@ -25,14 +25,14 @@ The Hi3516DV300 supports programming through the network port in Windows or Linu 1. Connect the PC and the target development board through the power port, serial port, and network port. In this section, the Hi3516DV300 is used as an example. For details, please refer to [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_camera_start_3516-0000001052670587). 2. Open Device Manager, then check and record the serial port number corresponding to the development board. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695). - ![](figures/en-us_image_0000001114129428.png) + ![](figure/en-us_image_0000001114129428.png) 3. Open DevEco Device Tool and go to **Projects** \> **Settings**. - ![](figures/2021-01-27_170334-18.png) + ![](figure/2021-01-27_170334-17.png) 4. On the **Partition Configuration** tab page, enter the information about the files to be programmed, including the following. @@ -165,7 +165,7 @@ The Hi3516DV300 supports programming through the network port in Windows or Linu
- ![](figures/en-us_image_0000001160527611.png) + ![](figure/en-us_image_0000001160527611.png) 5. On the **hi3516dv300** tab page, configure the programming options. @@ -173,7 +173,7 @@ The Hi3516DV300 supports programming through the network port in Windows or Linu - **upload\_protocol**: Select the programming protocol **hiburn-net**. - **upload\_partitions**: Select the file to be programmed, including the following: fastboot, boot, updater, misc, system, vendor, and userdata. - ![](figures/en-us_image_0000001117621400.png) + ![](figure/en-us_image_0000001117621400.png) 6. Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Programming on Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075). 7. Set the IP address of the network port for programming: @@ -183,23 +183,23 @@ The Hi3516DV300 supports programming through the network port in Windows or Linu - **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. - **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. - ![](figures/en-us_image_0000001117463460.png) + ![](figure/en-us_image_0000001117463460.png) 8. When you finish modifying, click **Save** in the upper right corner. -9. Open the project file, go to ![](figures/2021-01-27_170334-19.png) \> **PROJECT TASKS** \> **fastboot** \> **Erase** to erase U-boot. +9. Open the project file, go to ![](figure/2021-01-27_170334-18.png) \> **PROJECT TASKS** \> **fastboot** \> **Erase** to erase U-boot. - ![](figures/en-us_image_0000001163045527.png) + ![](figure/en-us_image_0000001163045527.png) 10. When the following message is displayed, power off the development board and then power it on. - ![](figures/en-us_image_0000001114129432.png) + ![](figure/en-us_image_0000001114129432.png) 11. Start programming. When the following message is displayed, it indicates that the programming is successful. - ![](figures/en-us_image_0000001113969542.png) + ![](figure/en-us_image_0000001113969542.png) ## Next -Congratulations! You have completed the quick start for the standard system. Get yourself familiar with OpenHarmony by a [Development Example for Clock App](../guide/development-example-for-clock-apps.md). +Congratulations! You have completed the quick start for the standard system. Get yourself familiar with OpenHarmony by a [Development Example for Clock App](../guide/oem_device_clockapp_des.md). diff --git a/en/device-dev/quick-start/introduction.md b/en/device-dev/quick-start/quickstart-standard-description.md similarity index 97% rename from en/device-dev/quick-start/introduction.md rename to en/device-dev/quick-start/quickstart-standard-description.md index 7209c5c0f18b55e253bca942025b9d0682e390b3..75e796ec2168131936342f92c6247a2478a8ba24 100644 --- a/en/device-dev/quick-start/introduction.md +++ b/en/device-dev/quick-start/quickstart-standard-description.md @@ -13,7 +13,7 @@ This document uses the recommended Hi3516D V300 development board as an example. The following figure shows the process of getting started for the standard system, during which, you can set up the Ubuntu development environment in Docker mode or by using the installation package. **Figure 1** Getting started for the standard system -![](figures/getting-started-for-the-standard-system.png "getting-started-for-the-standard-system") +![](figure/getting-started-for-the-standard-system.png "getting-started-for-the-standard-system") ## Introduction to the Development Board @@ -22,7 +22,7 @@ Hi3516D V300 is a next-generation system on chip \(SoC\) designed for the indust **Figure 2** Hi3516D V300 front view -![](figures/3516正面-17.png) +![](figure/3516正面.png) ## Development Board Specifications diff --git a/en/device-dev/quick-start/setting-up-ubuntu-development-environment-in-docker-mode-and-building-source-code.md b/en/device-dev/quick-start/quickstart-standard-docker-environment.md similarity index 91% rename from en/device-dev/quick-start/setting-up-ubuntu-development-environment-in-docker-mode-and-building-source-code.md rename to en/device-dev/quick-start/quickstart-standard-docker-environment.md index 0a3ca86c3294e3af31e06cd636d3c886c897ce94..c9f27fb455f3de13052fbdf2e7454ff88d280fc7 100644 --- a/en/device-dev/quick-start/setting-up-ubuntu-development-environment-in-docker-mode-and-building-source-code.md +++ b/en/device-dev/quick-start/quickstart-standard-docker-environment.md @@ -9,9 +9,9 @@ The standard OpenHarmony system provides a Docker environment which encapsulates build tools. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >- Before using Docker, install it by following instructions in [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/). ->- You can also use the [installation package](setting-up-ubuntu-development-environment-with-installation-package-and-building-source-code.md) to set up the Ubuntu development environment. +>- You can also use the [installation package](quickstart-standard-package-environment.md) to set up the Ubuntu development environment. ## Obtaining Standard-System Source Code @@ -111,8 +111,8 @@ repo forall -c 'git lfs pull' Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. -3. Burn the image. For details, see [Burning Images](burning-images.md). +3. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md). ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >You can exit Docker by simply running the **exit** command. diff --git a/en/device-dev/quick-start/faqs-7.md b/en/device-dev/quick-start/quickstart-standard-faq.md similarity index 100% rename from en/device-dev/quick-start/faqs-7.md rename to en/device-dev/quick-start/quickstart-standard-faq.md diff --git a/en/device-dev/quick-start/setting-up-ubuntu-development-environment-with-installation-package-and-building-source-code.md b/en/device-dev/quick-start/quickstart-standard-package-environment.md similarity index 91% rename from en/device-dev/quick-start/setting-up-ubuntu-development-environment-with-installation-package-and-building-source-code.md rename to en/device-dev/quick-start/quickstart-standard-package-environment.md index 0aaa9188a038d1279efdb270e4ffc2ac04ea2273..ee9049108fbefa96530e67bdc8ecb2211296cd21 100644 --- a/en/device-dev/quick-start/setting-up-ubuntu-development-environment-with-installation-package-and-building-source-code.md +++ b/en/device-dev/quick-start/quickstart-standard-package-environment.md @@ -16,7 +16,7 @@ The installation command is as follows: sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The preceding command is applicable to Ubuntu 18.04. For other Ubuntu versions, modify the preceding installation command based on the installation package name. ## Obtaining Standard-System Source Code @@ -91,8 +91,8 @@ Perform the following operations in the Linux environment: Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. - >![](public_sys-resources/icon-note.gif) **NOTE:** - >For details about module-specific build operations, see [Compilation and Building Overview](../subsystems/building-guidelines-for-the-standard-system.md). + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >For details about module-specific build operations, see [Building Guidelines](../subsystems/subsys-build-standard-large.md). -3. Burn the image. For details, see [Burning Images](burning-images.md). +3. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md). diff --git a/en/device-dev/quick-start/setting-up-windows-development-environment.md b/en/device-dev/quick-start/quickstart-standard-windows-environment.md similarity index 93% rename from en/device-dev/quick-start/setting-up-windows-development-environment.md rename to en/device-dev/quick-start/quickstart-standard-windows-environment.md index 4308389e169c415c5a502738359d0eed094fd3fc..c07334b53835411881e5373437a96974b43e175c 100644 --- a/en/device-dev/quick-start/setting-up-windows-development-environment.md +++ b/en/device-dev/quick-start/quickstart-standard-windows-environment.md @@ -82,12 +82,12 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ## Installing Visual Studio Code ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If you have installed Visual Studio Code, open the CLT and run **code --version** to check whether the version is 1.53 or later. If the version number is returned, it indicates that the environment variables are set correctly. 1. Double-click the Visual Studio Code package to install it. During the installation, select **Add to PATH \(requires shell restart\)**. - ![](figures/en-us_image_0000001057335403.png) + ![](figure/en-us_image_0000001057335403.png) 2. After the installation is complete, restart the computer for the environment variables of Visual Studio Code to take effect. 3. Open the CLT and run **code --version**. If the version number can be displayed, it indicates that the installation is successful. @@ -96,15 +96,15 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu 1. Double-click the Python software package, select **Add Python xx to PATH**, and click **Install Now**. - ![](figures/en-us_image_0000001096154076.png) + ![](figure/en-us_image_0000001096154076.png) 2. After the installation is complete, click **Close**. - ![](figures/en-us_image_0000001142794291.png) + ![](figure/en-us_image_0000001142794291.png) 3. Open the CLT, and run **python --version** to check the installation result. - ![](figures/en-us_image_0000001143154485.png) + ![](figure/en-us_image_0000001143154485.png) 4. In the CLT, run the following commands to set the pip source for downloading the dependencies required for later installation: @@ -117,13 +117,13 @@ DevEco Device Tool is a plug-in for Visual Studio Code. The installation procedu ## Installing Node.js ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If you have installed Node.js, open the CLT and run **node -v** to check whether the version is 12.0.0 or later. 1. Run the downloaded software package to install. Use the default settings when following the installation wizard, and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**. 2. Open the CLT and run **node -v**. If the version number of Node.js is displayed, it indicates that Node.js has been successfully installed. - ![](figures/en-us_image_0000001056814287.png) + ![](figure/en-us_image_0000001056814287.png) ## Installing hpm @@ -132,7 +132,7 @@ Before installing hpm, ensure that Node.js has been installed and that your network can access the Internet. If your network requires a proxy to access the Internet, [set up the npm proxy](https://device.harmonyos.com/cn/docs/ide/user-guides/npm_proxy-0000001054491032) first. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >If hpm has been installed, run **npm update -g @ohos/hpm-cli** to update it to the latest version. 1. You are advised to set the npm source to an image in China, for example, a HUAWEI CLOUD image source. @@ -147,7 +147,7 @@ and that your network can access the Internet. If your network requires a proxy npm install -g @ohos/hpm-cli ``` - ![](figures/en-us_image_0000001073840162.png) + ![](figure/en-us_image_0000001073840162.png) 3. After the installation is complete, run the following command to obtain the installation result: @@ -155,7 +155,7 @@ and that your network can access the Internet. If your network requires a proxy hpm -V ``` - ![](figures/en-us_image_0000001100641602.png) + ![](figure/en-us_image_0000001100641602.png) ## Installing the DevEco Device Tool Plug-in @@ -164,20 +164,20 @@ To install the DevEco Device Tool plug-in, ensure that the **user name of the h DevEco Device Tool will automatically download and install the C/C++ and CodeLLDB plug-ins from the Visual Studio Code Marketplace during the installation process. Therefore, make sure Visual Studio Code can access the Internet. If your network requires a proxy to access the Internet, [set up the Visual Studio Code proxy](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144) first. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Before installing DevEco Device Tool, ensure that Visual Studio Code is closed. 1. Decompress the DevEco Device Tool plug-in package and double-click the installer to install. 2. During the installation, the dependency files \(such as C/C++ and CodeLLDB plug-ins\) and execution programs required by DevEco Device Tool are automatically installed. - ![](figures/en-us_image_0000001072468991.png) + ![](figure/en-us_image_0000001072468991.png) 3. After the installation is complete, the CLT is automatically closed. -4. Open Visual Studio Code, click the ![](figures/en-us_image_0000001072757874.png) button on the left, and check whether C/C++, CodeLLDB, and DevEco Device Tool are listed in **INSTALLED**. +4. Open Visual Studio Code, click the ![](figure/en-us_image_0000001072757874.png) button on the left, and check whether C/C++, CodeLLDB, and DevEco Device Tool are listed in **INSTALLED**. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846). - ![](figures/en-us_image_0000001142802505.png) + ![](figure/en-us_image_0000001142802505.png) diff --git a/en/device-dev/quick-start/quickstart-standard.md b/en/device-dev/quick-start/quickstart-standard.md new file mode 100644 index 0000000000000000000000000000000000000000..ece9c36cc5918da7b8613e5d0ec9f68a6071b8ce --- /dev/null +++ b/en/device-dev/quick-start/quickstart-standard.md @@ -0,0 +1,15 @@ +# Standard System + +- **[Introduction](quickstart-standard-description.md)** + +- **[Setting Up Windows Development Environment](quickstart-standard-windows-environment.md)** + +- **[Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code](quickstart-standard-docker-environment.md)** + +- **[Setting Up Ubuntu Development Environment with Installation Package and Building Source Code](quickstart-standard-package-environment.md)** + +- **[Burning Images](quickstart-standard-burn.md)** + +- **[FAQs](quickstart-standard-faq.md)** + + diff --git a/en/device-dev/quick-start/quickstart.md b/en/device-dev/quick-start/quickstart.md new file mode 100644 index 0000000000000000000000000000000000000000..3f82098be9f28557fc6a223f770197f21ee07c31 --- /dev/null +++ b/en/device-dev/quick-start/quickstart.md @@ -0,0 +1,7 @@ +# Getting Started + +- **[Mini and Small Systems](quickstart-lite.md)** + +- **[Standard System](quickstart-standard.md)** + + diff --git a/en/device-dev/quick-start/standard-system.md b/en/device-dev/quick-start/standard-system.md deleted file mode 100644 index f0aa95fdac24012324baa361c8958305bcfd436f..0000000000000000000000000000000000000000 --- a/en/device-dev/quick-start/standard-system.md +++ /dev/null @@ -1,15 +0,0 @@ -# Standard System - -- **[Introduction](introduction.md)** - -- **[Setting Up Windows Development Environment](setting-up-windows-development-environment.md)** - -- **[Setting Up Ubuntu Development Environment in Docker Mode and Building Source Code](setting-up-ubuntu-development-environment-in-docker-mode-and-building-source-code.md)** - -- **[Setting Up Ubuntu Development Environment with Installation Package and Building Source Code](setting-up-ubuntu-development-environment-with-installation-package-and-building-source-code.md)** - -- **[Burning Images](burning-images.md)** - -- **[FAQs](faqs-7.md)** - - diff --git a/en/device-dev/security/Readme-EN.md b/en/device-dev/security/Readme-EN.md index 03e75d7a357e34f3974eb34839b23992d2b998d6..09b0d20c4425a17dd609cffa530aaf54d0691c01 100644 --- a/en/device-dev/security/Readme-EN.md +++ b/en/device-dev/security/Readme-EN.md @@ -1,5 +1,5 @@ # Privacy and Security -- [Privacy Protection](privacy-protection.md) -- [Security Guidelines](security-guidelines.md) +- [Privacy Protection](oem_security_privacy.md) +- [Security Guidelines](safety-safeguide-security.md) diff --git "a/en/device-dev/security/figures/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" "b/en/device-dev/security/figure/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" similarity index 100% rename from "en/device-dev/security/figures/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" rename to "en/device-dev/security/figure/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" diff --git "a/en/device-dev/security/figures/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" "b/en/device-dev/security/figure/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" similarity index 100% rename from "en/device-dev/security/figures/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" rename to "en/device-dev/security/figure/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" diff --git "a/en/device-dev/security/figures/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" "b/en/device-dev/security/figure/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" similarity index 100% rename from "en/device-dev/security/figures/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" rename to "en/device-dev/security/figure/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" diff --git "a/en/device-dev/security/figures/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" "b/en/device-dev/security/figure/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" similarity index 100% rename from "en/device-dev/security/figures/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" rename to "en/device-dev/security/figure/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" diff --git "a/en/device-dev/security/figures/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" "b/en/device-dev/security/figure/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" similarity index 100% rename from "en/device-dev/security/figures/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" rename to "en/device-dev/security/figure/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" diff --git "a/en/device-dev/security/figures/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" "b/en/device-dev/security/figure/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" similarity index 100% rename from "en/device-dev/security/figures/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" rename to "en/device-dev/security/figure/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" diff --git "a/en/device-dev/security/figures/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" "b/en/device-dev/security/figure/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" similarity index 100% rename from "en/device-dev/security/figures/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" rename to "en/device-dev/security/figure/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" diff --git a/en/device-dev/security/figures/how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship.png b/en/device-dev/security/figure/how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship.png similarity index 100% rename from en/device-dev/security/figures/how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship.png rename to en/device-dev/security/figure/how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship.png diff --git a/en/device-dev/security/figures/how-dac-works.png b/en/device-dev/security/figure/how-dac-works.png similarity index 100% rename from en/device-dev/security/figures/how-dac-works.png rename to en/device-dev/security/figure/how-dac-works.png diff --git a/en/device-dev/security/figures/huks-functions.png b/en/device-dev/security/figure/huks-functions.png similarity index 100% rename from en/device-dev/security/figures/huks-functions.png rename to en/device-dev/security/figure/huks-functions.png diff --git a/en/device-dev/security/figures/security-assurance-framework.png b/en/device-dev/security/figure/security-assurance-framework.png similarity index 100% rename from en/device-dev/security/figures/security-assurance-framework.png rename to en/device-dev/security/figure/security-assurance-framework.png diff --git a/en/device-dev/security/privacy-protection.md b/en/device-dev/security/oem_security_privacy.md similarity index 98% rename from en/device-dev/security/privacy-protection.md rename to en/device-dev/security/oem_security_privacy.md index c386470726ad799da888fd14bc371b95a9eaa82f..0a3e53c1d8258693bb07dfe0637e3ea40f6e08ae 100644 --- a/en/device-dev/security/privacy-protection.md +++ b/en/device-dev/security/oem_security_privacy.md @@ -141,26 +141,26 @@ When collecting personal data, clearly and explicitly notify users of the data t **Figure 1** Examples of a privacy notice and a privacy statement - ![](figures/2-应用启动预授权.png)![](figures/3-应用隐私声明.png) + ![](figure/2-应用启动预授权.png)![](figure/3-应用隐私声明.png) - Personal data shall be collected for specified, explicit, and legitimate purposes and not further processed in a manner that is incompatible with those purposes. If the purposes are changed or a user withdraws their consent, you shall obtain user consent again before using the data. The figures below are examples of a privacy statement update and content withdrawal, respectively. **Figure 2** Example dialog showing a privacy statement update - ![](figures/4-隐私声明变更通知.png) + ![](figure/4-隐私声明变更通知.png) **Figure 3** Example dialog showing consent withdrawal - ![](figures/6-1-隐私声明撤销.png)![](figures/6-2-隐私声明撤销.png) + ![](figure/6-1-隐私声明撤销.png)![](figure/6-2-隐私声明撤销.png) - You shall provide an entry for users to view the privacy statement. For example, you can provide an entry on the **About** page of your application to view the privacy statement, as shown in the following figure. **Figure 4** Example of About page providing an entry to the privacy statement - ![](figures/5-应用隐私声明入口.png) + ![](figure/5-应用隐私声明入口.png) **Minimization in Data Collection and Use** @@ -184,7 +184,7 @@ You shall obtain consent from users and comply with applicable laws and regulati **Figure 5** Example dialog for requesting a sensitive permission - ![](figures/1-敏感权限弹窗.png) + ![](figure/1-敏感权限弹窗.png) - Users shall have the right to modify or withdraw the permissions granted to your product. When a user does not agree to a permission or data collection, the user shall be allowed to use the functions irrelevant to the permission or data collection. For example, the user can refuse to grant the camera permission to social or communication apps on Smart TVs, when using product functions irrelevant to the camera, such as voice calls. - In scenarios where personal data is recorded, users shall be provided with the functions of adding, deleting, modifying, and viewing personal data. @@ -195,9 +195,9 @@ You shall obtain consent from users and comply with applicable laws and regulati Data processing security shall be ensured in technical terms, which include encrypted data storage and secure data transfer. Security mechanisms or measures shall be enabled by default for a system. -- A protection mechanism shall be available for personal data access, including identity authentication and access control. Identity authentication \(such as username and password\) allows only authenticated users to access data in multi-user scenarios. Access control \(for example, [permission control](security-guidelines.md#li201725506375)\) can be applied to restrict access to applications. +- A protection mechanism shall be available for personal data access, including identity authentication and access control. Identity authentication \(such as username and password\) allows only authenticated users to access data in multi-user scenarios. Access control \(for example, [permission control](security/safety-safeguide-security.md#li201725506375)\) can be applied to restrict access to applications. - Secure storage of personal data on distributed devices must meet Huawei Universal Keystore \(HUKS\) requirements, including secure storage of keys and data. -- The transfer of personal data between distributed devices must meet the trust binding relationship between devices and security requirements of data transmission channels. For details, see [Security Guidelines](security-guidelines.md#section26153183616). +- The transfer of personal data between distributed devices must meet the trust binding relationship between devices and security requirements of data transmission channels. For details, see [Security Guidelines](security/safety-safeguide-security.md#section26153183616). - Authentication data \(such as passwords and fingerprints\) shall be encrypted before being stored. **Localization** diff --git a/en/device-dev/security/public_sys-resources/icon-caution.gif b/en/device-dev/security/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/security/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/security/public_sys-resources/icon-danger.gif b/en/device-dev/security/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/security/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/security/public_sys-resources/icon-note.gif b/en/device-dev/security/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/security/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/security/public_sys-resources/icon-notice.gif b/en/device-dev/security/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/security/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/security/public_sys-resources/icon-tip.gif b/en/device-dev/security/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/security/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/security/public_sys-resources/icon-warning.gif b/en/device-dev/security/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/security/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/security/security-guidelines.md b/en/device-dev/security/safety-safeguide-security.md similarity index 96% rename from en/device-dev/security/security-guidelines.md rename to en/device-dev/security/safety-safeguide-security.md index e82aa5c28bd2b6816bc7226b14680cd45a899457..bc0933021d484d046df7d54fa1de239b99deb195 100644 --- a/en/device-dev/security/security-guidelines.md +++ b/en/device-dev/security/safety-safeguide-security.md @@ -2,18 +2,22 @@ - [Overview](#section1521410017353) - [Hardware Security](#section2558121318351) -- [Mechanism](#section1312953842210) -- [Recommended Practices](#section37901319112311) + - [Mechanism](#section1399511541896) + - [Recommended Practices](#section948519243104) + - [System Security](#section87802111361) -- [Mechanism](#section1654963052914) -- [Recommended Practices](#section45821048173613) + - [Mechanism](#section149107611118) + - [Recommended Practices](#section1364122019112) + - [Data Security](#section2468927364) -- [Mechanism](#section11192175813293) -- [Recommended Practices](#section174640713306) + - [Mechanism](#section1378993720111) + - [Recommended Practices](#section1531735481112) + - [Device Interconnection Security](#section26153183616) - [Application Security](#section852593153614) -- [Mechanism](#section12125105014377) -- [Recommended Practices](#section1641420155381) + - [Mechanism](#section55012136125) + - [Recommended Practices](#section6341102610123) + ## Overview @@ -22,11 +26,11 @@ OpenHarmony is an open OS that allows you to easily develop services and applica This environment combines chip security and system security features with upper-layer security services to secure hardware, the system, data, device interconnection, applications, and updates. **Figure 1** Security assurance framework -![](figures/security-assurance-framework.png "security-assurance-framework") +![](figure/security-assurance-framework.png "security-assurance-framework") ## Hardware Security -## Mechanism +### Mechanism - Boot root of trust @@ -53,7 +57,7 @@ This environment combines chip security and system security features with upper- OpenHarmony devices support the hardware key engine, which allows OpenHarmony to perform computing tasks such as data encryption and decryption, certificate signature verification, and hash value calculation. The hardware key engine supports popular algorithms such as Advanced Encryption Standard \(AES\) and Rivest-Shamir-Adleman \(RSA\). -## Recommended Practices +### Recommended Practices - The boot root of trust consists of a built-in code segment in the chip and the root key of the device. The root of trust is written into the chip during manufacturing and cannot be modified in the device lifecycle. It is used to verify software certificates in the device boot process. The root key is the public key matching the private key of the device certificate signature. The private key is maintained on the PKI signature server and the public key is written to the device. To prevent attackers from tampering with the public key to bypass signature authentication, you can write the public key to media such as fuses on OpenHarmony devices. Considering that the fuse space is limited, you can store only the hash value of the public key in the fuse and verify the validity of the public key using the boot code. - Generally, a trusted execution environment \(TEE\) is built based on the Arm TrustZone technology, and can also adopt other isolation mechanisms, such as TrustZone-M and independent security cores, depending on the device form. A TEE OS must be deployed in the TEE to manage resources and schedule tasks. OpenHarmony provides iTrustee as the TEE OS. You can develop and deploy security services based on iTrustee. @@ -64,7 +68,7 @@ This environment combines chip security and system security features with upper- ## System Security -## Mechanism +### Mechanism For devices with 128 KB to 128 MB of memory, the OpenHarmony lite kernel is recommended. It provides the following features: @@ -85,7 +89,7 @@ For devices with 128 KB to 128 MB of memory, the OpenHarmony lite kernel is reco The following figure shows how DAC works when a process accesses a file. The DAC first matches the process UID with the file UID, and then the process GID with the file GID. If the UID and GID both fail to match, DAC checks the **other** attribute of the file to determine whether the process is allowed to read, write, or execute the file. In addition, the system supports a privileged capability that is not subject to DAC mechanism \(read, write, and execute\) and can access files directly. Services with high permissions \(such as system services\) can manage files of applications with low permissions \(such as third-party applications\). **Figure 2** How DAC works - ![](figures/how-dac-works.png "how-dac-works") + ![](figure/how-dac-works.png "how-dac-works") - Capability mechanism @@ -98,19 +102,19 @@ For devices with 128 KB to 128 MB of memory, the OpenHarmony lite kernel is reco The chip does not need to be verified after it is powered on because the on-chip ROM code cannot be modified. The on-chip ROM verifies the bootloader based on the public key hash value which is calculated using the asymmetric algorithm in eFuse. The verification is performed based on the hardware trust root and is fully trusted. The bootloader that passes this verification is deemed to be trusted for subsequent use. This is the process of constructing a trust chain. Bootloader initializes the execution environment, including initializing the double data rate \(DDR\) and reading and writing the flash memory, to prepare for loading modules and executing more complex logic. After the bootloader is initialized, it verifies the integrity of the X.509 certificate and verifies image packages \(**kernel.bin**, **teeOS.bin**, and **rootfs.bin**\) using the public key of the X.509 certificate. -## Recommended Practices +### Recommended Practices - DAC and the capability mechanism are used to control who can access resources. It is recommended that the minimum permissions are granted. - Secure boot must be enabled, and the trusted root must be in the chip and cannot be modified. In addition, you must consider the impact of secure upgrade \(if available\) on secure boot, that is, the signature or hash value of an image file must be updated after a secure upgrade. ## Data Security -## Mechanism +### Mechanism Huawei Universal Keystore Service \(HUKS\) provides key and certificate management. For OpenHarmony, it mainly provides key management for HiChain \(the device identity authentication platform\). The following figure shows the functions of HUKS **Figure 3** HUKS functions -![](figures/huks-functions.png "huks-functions") +![](figure/huks-functions.png "huks-functions") The following algorithms are supported: @@ -126,7 +130,7 @@ HUKS has the following restrictions: - Key access security: OpenHarmony stores different data of an application separately to implement data isolation in the application, and includes the UID and process ID in the parameter structure to implement data isolation between different applications. - Concurrent access is not supported, that is, multiple applications cannot invoke HUKS simultaneously. As HUKS is a single library, resource exclusion is not a concern. If multiple applications need to use HUKS, each of them needs to connect to a HUKS library and pass a path for storing data. Data is stored in the directory of each application. -## Recommended Practices +### Recommended Practices To use the device certification function, it is recommended that you use HiChain to interconnect with HUKS. HUKS provides applications such as HiChain with key generation, import, export, encryption/decryption, storage, and destruction, certificate import and query, and secret information storage. @@ -135,7 +139,7 @@ To use the device certification function, it is recommended that you use HiChain To transmit user data securely between devices, ensure that the devices are trusted by each other. A trust relationship and a secure data transmission channel must be established between the devices. This section describes how an IoT controller and IoT device establish a trust relationship. The following figure shows how an IoT controller and an IoT device establish a trust relationship. **Figure 4** How an IoT controller and an IoT device establish a trust relationship -![](figures/how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship.png "how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship") +![](figure/how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship.png "how-an-iot-controller-and-an-iot-device-establish-a-trust-relationship") - **IoT device interconnection security** @@ -168,7 +172,7 @@ To transmit user data securely between devices, ensure that the devices are trus ## Application Security -## Mechanism +### Mechanism - Application signature management @@ -265,7 +269,7 @@ To transmit user data securely between devices, ensure that the devices are trus
-## Recommended Practices +### Recommended Practices When developing an application, determine what permissions your application needs and register the permissions in the **profile.json** file. Sign the application to ensure that the devices on which the application will be installed can verify its integrity and source. diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index 4af4610ea81173dbfb4ee9b937151a95834b5575..0b5b089be53af344a0d020fcb114ed8d829c76fd 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -1,95 +1,74 @@ -# Subsystems - -- [Compilation and Building](compilation-and-building.md) - - [Building Guidelines for Mini and Small Systems](building-guidelines-for-mini-and-small-systems.md) - - [Compilation and Building Overview](compilation-and-building-overview.md) - - [Compilation and Building Guidelines](compilation-and-building-guidelines.md) - - [Compilation and Building FAQ](compilation-and-building-faq.md) - - - [Building Guidelines for the Standard System](building-guidelines-for-the-standard-system.md) - - [Compilation and Building Overview](compilation-and-building-overview-0.md) - - [Compilation and Building Guidelines](compilation-and-building-guidelines-1.md) - -- [Distributed Remote Startup](distributed-remote-startup.md) -- [Graphics](graphics.md) - - [Graphics](graphics-2.md) - - [Development Guidelines on Container Components](development-guidelines-on-container-components.md) - - [Development Guidelines on Layout Container Components](development-guidelines-on-layout-container-components.md) - - [Development Guidelines on Common Components](development-guidelines-on-common-components.md) - - [Development Guidelines on Animators](development-guidelines-on-animators.md) - -- [Multimedia](multimedia.md) - - [Camera](camera.md) - - [Overview](overview.md) - - [Development Guidelines on Photographing](development-guidelines-on-photographing.md) - - [Development Guidelines on Video Recording](development-guidelines-on-video-recording.md) - - [Development Guidelines on Previewing](development-guidelines-on-previewing.md) - - - [Audio/Video](audio-video.md) - - [Overview](overview-3.md) - - [Development Guidelines on Media Playback](development-guidelines-on-media-playback.md) - - [Development Guidelines on Media Recording](development-guidelines-on-media-recording.md) - -- [Utils](utils.md) - - [Utils Overview](utils-overview.md) - - [Utils Development Guidelines](utils-development-guidelines.md) - - [Utils FAQ](utils-faq.md) - -- [AI Framework](ai-framework.md) - - [AI Engine Framework](ai-engine-framework.md) - - [Development Environment](development-environment.md) - - [Technical Specifications](technical-specifications.md) - - [Code Management](code-management.md) - - [Naming](naming.md) - - [API Development](api-development.md) - - - [Development Guidelines](development-guidelines.md) - - [SDK](sdk.md) - - [Plug-in](plug-in.md) - - [Configuration File](configuration-file.md) - - - [Development Examples](development-examples.md) - - [KWS SDK](kws-sdk.md) - - [KWS Plug-in](kws-plug-in.md) - - [KWS Configuration File](kws-configuration-file.md) - -- [Sensors](sensors.md) - - [Sensors Overview](sensors-overview.md) - - [Sensors Usage Guidelines](sensors-usage-guidelines.md) - - [Sensors Usage Example](sensors-usage-example.md) - -- [Application Framework](application-framework.md) - - [Overview](overview-4.md) - - [Setting Up a Development Environment](setting-up-a-development-environment.md) - - [Development Guidelines](development-guidelines-5.md) - - [Development Example](development-example.md) - -- [OTA Upgrade](ota-upgrade.md) -- [Security](security.md) - - [Overview](overview-9.md) - - [Development Guidelines on Application Signature Verification](development-guidelines-on-application-signature-verification.md) - - [Development Guidelines on Application Permission Management](development-guidelines-on-application-permission-management.md) - - [Development Guidelines on IPC Authentication](development-guidelines-on-ipc-authentication.md) - -- [Startup](startup.md) - - [Startup](startup-10.md) - - [init Module](init-module.md) - - [appspawn Module](appspawn-module.md) - - [bootstrap Module](bootstrap-module.md) - - [syspara Module](syspara-module.md) - - [FAQs](faqs.md) - - [Reference](reference.md) - -- [Testing](testing.md) -- [DFX](dfx.md) - - [DFX](dfx-11.md) - - [Development Guidelines on HiLog ](development-guidelines-on-hilog.md) - - [Development Guidelines on HiLog\_Lite](development-guidelines-on-hilog_lite.md) - - [Development Guidelines on HiSysEvent](development-guidelines-on-hisysevent.md) - -- [R&D Tools](r-d-tools.md) - - [bytrace Usage Guidelines](bytrace-usage-guidelines.md) - - [hdc\_std Usage Guidelines](hdc_std-usage-guidelines.md) - -- [XTS](xts.md) - +# Subsystems + +- [Compilation and Building](subsys-build.md) + - [Building Guidelines for Mini and Small Systems](subsys-build-mini-lite.md) + - [Building Guidelines for Standard Systems](subsys-build-standard-large.md) +- [Distributed Remote Startup](subsys-remote-start.md) +- [Graphics](subsys-graphics.md) + - [Graphics](subsys-graphics-overview.md) + - [Development Guidelines on Container Components](subsys-graphics-bundle-guide1.md) + - [Development Guidelines on Layout Container Components](subsys-graphics-bundle-guide2.md) + - [Development Guidelines on Common Components](subsys-graphics-bundle-guide3.md) + - [Development Guidelines on Animators](subsys-graphics-animation-guide.md) +- [Multimedia](subsys-multimedia.md) + - [Camera](subsys-multimedia-camera.md) + - [Overview](subsys-multimedia-camera-overview.md) + - [Development Guidelines on Photographing](subsys-multimedia-camera-photo-guide.md) + - [Development Guidelines on Video Recording](subsys-multimedia-camera-record-guide.md) + - [Development Guidelines on Previewing](subsys-multimedia-camera-preview-guide.md) + - [Audio/Video](subsys-multimedia-video.md) + - [Overview](subsys-multimedia-video-overview.md) + - [Development Guidelines on Media Playback](subsys-multimedia-video-play-guide.md) + - [Development Guidelines on Media Recording](subsys-multimedia-video-record-guide.md) +- [Utils](subsys-utils.md) + - [Utils Overview](oem_subsys_utils_des.md) + - [Utils Development Guidelines](oem_subsys_utils_guide.md) + - [Utils FAQ](oem_subsys_utils_faq.md) +- [AI Framework](subsys-aiframework.md) + - [AI Engine Framework](subsys-aiframework-guide.md) + - [Development Environment](subsys-aiframework-envbuild.md) + - [Technical Specifications](subsys-aiframework-tech.md) + - [Code Management](subsys-aiframework-tech-codemanage.md) + - [Naming](subsys-aiframework-tech-name.md) + - [API Development](subsys-aiframework-tech-interface.md) + - [Development Guidelines](subsys-aiframework-devguide.md) + - [SDK](subsys-aiframework-devguide-sdk.md) + - [Plug-in](subsys-aiframework-devguide-plugin.md) + - [Configuration File](subsys-aiframework-devguide-conf.md) + - [Development Examples](subsys-aiframework-demo.md) + - [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-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) + - [Development Guidelines](subsys-application-framework-guide.md) + - [Development Example](subsys-application-framework-demo.md) +- [OTA Upgrade](subsys-ota-guide.md) +- [Security](subsys-security.md) + - [Overview](subsys-security-overview.md) + - [Development Guidelines on Application Signature Verification](subsys-security-sigverify.md) + - [Development Guidelines on Application Permission Management](subsys-security-rightmanagement.md) + - [Development Guidelines on IPC Authentication](subsys-security-communicationverify.md) +- [Startup](subsys-boot.md) + - [Startup](subsys-boot-overview.md) + - [init Module](subsys-boot-init.md) + - [appspawn Module](subsys-boot-appspawn.md) + - [bootstrap Module](subsys-boot-bootstrap.md) + - [syspara Module](subsys-boot-syspara.md) + - [FAQs](subsys-boot-faqs.md) + - [Reference](subsys-boot-ref.md) +- [Testing](subsys-testguide-test.md) +- [DFX](subsys-dfx.md) + - [DFX](subsys-dfx-overview.md) + - [Development Guidelines on HiLog ](subsys-dfx-hilog-rich.md) + - [Development Guidelines on HiLog\_Lite](subsys-dfx-hilog-lite.md) + - [Development Guidelines on HiSysEvent](subsys-dfx-hisysevent.md) +- [R&D Tools](subsys-toolchain.md) + - [bytrace Usage Guidelines](subsys-toolchain-bytrace-guide.md) + - [hdc\_std Usage Guidelines](oem_subsys_toolchain_hdc_guide.md) +- [XTS](subsys-xts-guide.md) \ No newline at end of file diff --git a/en/device-dev/subsystems/ai-framework.md b/en/device-dev/subsystems/ai-framework.md deleted file mode 100644 index 87f4c6a5f2656a15b063933d1556c90942520fd0..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/ai-framework.md +++ /dev/null @@ -1,13 +0,0 @@ -# AI Framework - -- **[AI Engine Framework](ai-engine-framework.md)** - -- **[Development Environment](development-environment.md)** - -- **[Technical Specifications](technical-specifications.md)** - -- **[Development Guidelines](development-guidelines.md)** - -- **[Development Examples](development-examples.md)** - - diff --git a/en/device-dev/subsystems/application-framework.md b/en/device-dev/subsystems/application-framework.md deleted file mode 100644 index d58ed3003a09c0d1e1194097353e454d85afa061..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/application-framework.md +++ /dev/null @@ -1,11 +0,0 @@ -# Application Framework - -- **[Overview](overview-4.md)** - -- **[Setting Up a Development Environment](setting-up-a-development-environment.md)** - -- **[Development Guidelines](development-guidelines-5.md)** - -- **[Development Example](development-example.md)** - - diff --git a/en/device-dev/subsystems/audio-video.md b/en/device-dev/subsystems/audio-video.md deleted file mode 100644 index 16e2f5b0835dbade41d9c722ab0ff5de90d93b1f..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/audio-video.md +++ /dev/null @@ -1,9 +0,0 @@ -# Audio/Video - -- **[Overview](overview-3.md)** - -- **[Development Guidelines on Media Playback](development-guidelines-on-media-playback.md)** - -- **[Development Guidelines on Media Recording](development-guidelines-on-media-recording.md)** - - diff --git a/en/device-dev/subsystems/building-guidelines-for-mini-and-small-systems.md b/en/device-dev/subsystems/building-guidelines-for-mini-and-small-systems.md deleted file mode 100644 index d19baae14741babb44e57557e6b94a6e47401d91..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/building-guidelines-for-mini-and-small-systems.md +++ /dev/null @@ -1,9 +0,0 @@ -# Building Guidelines for Mini and Small Systems - -- **[Compilation and Building Overview](compilation-and-building-overview.md)** - -- **[Compilation and Building Guidelines](compilation-and-building-guidelines.md)** - -- **[Compilation and Building FAQ](compilation-and-building-faq.md)** - - diff --git a/en/device-dev/subsystems/building-guidelines-for-the-standard-system.md b/en/device-dev/subsystems/building-guidelines-for-the-standard-system.md deleted file mode 100644 index bbc92d83896d1912837d2d34b0791a4e47e46004..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/building-guidelines-for-the-standard-system.md +++ /dev/null @@ -1,7 +0,0 @@ -# Building Guidelines for the Standard System - -- **[Compilation and Building Overview](compilation-and-building-overview-0.md)** - -- **[Compilation and Building Guidelines](compilation-and-building-guidelines-1.md)** - - diff --git a/en/device-dev/subsystems/camera.md b/en/device-dev/subsystems/camera.md deleted file mode 100644 index 4d38a63f4b587145b7d3fd953ae217a6576393dc..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/camera.md +++ /dev/null @@ -1,11 +0,0 @@ -# Camera - -- **[Overview](overview.md)** - -- **[Development Guidelines on Photographing](development-guidelines-on-photographing.md)** - -- **[Development Guidelines on Video Recording](development-guidelines-on-video-recording.md)** - -- **[Development Guidelines on Previewing](development-guidelines-on-previewing.md)** - - diff --git a/en/device-dev/subsystems/compilation-and-building-faq.md b/en/device-dev/subsystems/compilation-and-building-faq.md deleted file mode 100644 index 7c90a77cafe15b19f2bdcfbbc9d976158b83be9c..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/compilation-and-building-faq.md +++ /dev/null @@ -1,121 +0,0 @@ -# Compilation and Building FAQ - -- [Invalid -- w option](#section1019152312222) -- [Ncurses library not found](#section21449422618) -- [Mcopy not found](#section12477184992615) -- [No riscv file or directory](#section178451337202716) -- [No Crypto](#section1241481172819) -- [Unexpected operator](#section3691222152919) - -## Invalid -- w option - -- **Problem** - - The compilation fails, and **usr/sbin/ninja: invalid option -- w** is displayed. - -- **Cause** - - The Ninja version in the compilation environment is outdated and does not support the **--w** option. - -- **Solution** - - Uninstall Ninja and GN and follow the instructions provided in [Acquiring Tools](../get-code/tool-acquisition.md) to obtain the provided compilation toolchain. - - -## Ncurses library not found - -- **Problem** - - The compilation fails, and **/usr/bin/ld: cannot find -lncurses** is displayed. - -- **Cause** - - The ncurses library is not installed. - -- **Solution** - - ``` - sudo apt-get install lib32ncurses5-dev - ``` - - -## Mcopy not found - -- **Problem** - - The compilation fails, and **line 77: mcopy: command not found** is displayed. - -- **Cause** - - Mcopy is not installed. - -- **Solution** - - ``` - ​sudo apt-get install dosfstools mtools - ``` - - -## No riscv file or directory - -- **Problem** - - The compilation fails, and the following information is displayed: **riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory**. - -- **Cause** - - Permission is required to access files in the **riscv** compiler path. - -- **Solution** - 1. Run the following command to query the directory where **gcc\_riscv32** is located: - - ``` - which riscv32-unknown-elf-gcc - ``` - - 2. Run the **chmod** command to change the directory permission to **755**. - - -## No Crypto - -- **Problem** - - The compilation fails, and **No module named'Crypto loaded** is displayed. - -- **Cause** - - Crypto is not installed in Python 3. - -- **Solution** - 1. Run the following command to query the Python version: - - ``` - python3 --version - ``` - - 2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome: - - ``` - sudo pip3 install pycryptodome - ``` - - - -## Unexpected operator - -- **Problem** - - The compilation fails, and **xx.sh \[: xx unexpected operator** is displayed. - -- **Cause** - - The compilation environment is shell instead of bash. - -- **Solution** - - ``` - sudo rm -rf /bin/sh - sudo ln -s /bin/bash /bin/sh - ``` - - diff --git a/en/device-dev/subsystems/compilation-and-building-guidelines.md b/en/device-dev/subsystems/compilation-and-building-guidelines.md deleted file mode 100644 index e89b07bebaaba173dafd27affe843b42d4e0e3f2..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/compilation-and-building-guidelines.md +++ /dev/null @@ -1,430 +0,0 @@ -# Compilation and Building Guidelines - -- [Prerequisites](#section13333171022312) -- [How to Use the hb Command Line Tool](#section477242204612) -- [Adding a Module](#section4207112818418) -- [Adding a Chipset Solution](#section2737141421917) -- [Adding a Product Solution](#section720881917199) - -## Prerequisites - -Ensure that the development environment has GN, Ninja, Python 3.7.4 or later, and hb commands. For details about installation methods, see [Basic OS Environment Setup](../quick-start/environment-setup.md). - -## How to Use the hb Command Line Tool - -hb is a command line tool for OpenHarmony to execute build commands. Common hb commands are described as follows: - -1. **hb set** - - ``` - hb set -h - usage: hb set [-h] [-root [ROOT_PATH]] [-p] - - optional arguments: - -h, --help show this help message and exit - -root [ROOT_PATH], --root_path [ROOT_PATH] - Set OHOS root path - -p, --product Set OHOS board and kernel - ``` - - - If you run **hb set** with no argument, the default setting process starts. - - You can run **hb set -root** _dir_ to set the root directory of the source code. - - **hb set -p** is used to set the product to build. - -2. **hb env** - - View the current configuration. - - ``` - hb env - [OHOS INFO] root path: xxx - [OHOS INFO] board: hispark_taurus - [OHOS INFO] kernel: liteos - [OHOS INFO] product: ipcamera - [OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera - [OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19 - ``` - -3. **hb build** - - ``` - hb build -h - usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] - [--dmverity] [-p PRODUCT] [-f] [-n] - [component [component ...]] - - positional arguments: - component name of the component - - optional arguments: - -h, --help show this help message and exit - -b BUILD_TYPE, --build_type BUILD_TYPE - release or debug version - -t [TEST [TEST ...]], --test [TEST [TEST ...]] - compile test suit - --dmverity Enable dmverity - -p PRODUCT, --product PRODUCT - build a specified product with - {product_name}@{company}, eg: ipcamera@hisilcon - -f, --full full code compilation - -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] - Compile single target - ``` - - - If you run **hb build** with no argument, the previously configured code directory, product, and options are used for the build. The **-f** option will delete all products to be built, which is equivalent to running **hb clean** and **hb build**. - - You can run **hb build** _\{module\_name\}_ to build product modules separately based on the development board and kernel set for the product, for example, **hb build kv\_store**. - - You can run **hb build -p ipcamera@hisilicon** to skip the setting step and compile the product directly. - - You can run **hb build** in **device/device\_company/board** to select the kernel and start the build based on the current development board and the selected kernel to generate an image that contains the kernel and driver only. - -4. **hb clean** - - Clear the build result of the product in the **out** directory, and retain the **args.gn** and **build.log** files only. To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean out/xxx/xxx**. - - ``` - hb clean - usage: hb clean [-h] [out_path] - - positional arguments: - out_path clean a specified path. - - optional arguments: - -h, --help show this help message and exit - ``` - - -## Adding a Module - -To add a module, determine the subsystem to which the module belongs and the module name, and then perform the following steps: - -1. Add the module build script after the source code development is complete. - - The following example adds the **BUILD.gn** script \(stored in the **applications/sample/hello\_world** directory\) to build the **hello\_world** module \(as an executable file\). - - ``` - executable("hello_world") { - include_dirs = [ - "include", - ] - sources = [ - "src/hello_world.c" - ] - } - ``` - - The added script is used to build **hello\_world** that can run on OpenHarmony. - - To build the preceding module separately, select a product via the **hb set** command and run the **-T** command. - - ``` - hb build -f -T //applications/sample/hello_world - ``` - - After the module functions are verified based on the development board, perform steps 2 to 5 to configure the module for the product. - -2. Add the module description. - - The module description is stored in the **build/lite/components** directory. New modules must be added to the JSON file of the corresponding subsystem. A module description must contain the following fields: - - - **module**: name of the module - - **description**: brief description of the module - - **optional**: whether the module is optional - - **dirs**: source code directory of the module - - **targets**: module build entry - - For example, to add the **hello\_world** module to the application subsystem, add the **hello\_world** object to the **applications.json** file. - - ``` - { - "components": [ - { - "component": "hello_world", - "description": "Hello world.", - "optional": "true", - "dirs": [ - "applications/sample/hello_world" - ], - "targets": [ - "//applications/sample/hello_world" - ] - }, - ... - ] - } - ``` - -3. Configure the module for the product. - - The **config.json** file is stored in the **vendor/company/product/** directory. The file must contain the product name, OpenHarmony version, device vendor, development board, kernel type, kernel version, and the subsystem and module to configure. The following example adds the **hello\_world** module to the **my\_product.json** configuration file: - - ``` - { - "product_name": "hello_world_test", - "ohos_version": "OpenHarmony 1.0", - "device_company": "hisilicon", - "board": "hispark_taurus", - "kernel_type": "liteos_a", - "kernel_version": "1.0.0", - "subsystems": [ - { - "subsystem": "applications", - "components": [ - { "component": "hello_world", "features":[] } - ] - }, - ... - ] - } - ``` - -4. Build the product. - - 1. Run the **hb set** command in the root code directory to select the corresponding product. - - 2. Run the **hb build** command. - - -## Adding a Chipset Solution - -The Compilation and Building subsystem allows you to add a chipset solution. Detailed operations are as follows: - -1. Create a directory for the chipset solution. - - Taking the RTL8720 development board of chipset provider Realtek for example, you need to run the following command in the root code directory to create a directory for the chipset solution based on [1-Configuration Rules for Modules, Chipset Solutions, and Product Solutions](compilation-and-building-overview.md#section1625463413327). - - ``` - mkdir -p device/realtek/rtl8720 - ``` - -2. Create a directory for kernel adaptation and build the **config.gni** file of the development board. - - The following example adapts the LiteOS Cortex-M kernel to the RTL8720 development board of Realtek. The **device/realtek/rtl8720/liteos\_a/config.gni** file is configured as follows: - - ``` - # Kernel type, e.g. "linux", "liteos_a", "liteos_m". - kernel_type = "liteos_a" - - # Kernel version. - kernel_version = "3.0.0" - - # Board CPU type, e.g. "cortex-a7", "riscv32". - board_cpu = "real-m300" - - # Board arch, e.g. "armv7-a", "rv32imac". - board_arch = "" - - # Toolchain name used for system compiling. - # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. - # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. - board_toolchain = "gcc-arm-none-eabi" - - # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. - board_toolchain_path = - rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin", - root_build_dir) - - # Compiler prefix. - board_toolchain_prefix = "gcc-arm-none-eabi-" - - # Compiler type, "gcc" or "clang". - board_toolchain_type = "gcc" - - # Board related common compile flags. - board_cflags = [] - board_cxx_flags = [] - board_ld_flags = [] - ``` - -3. Build the script. - - Create the **BUILD.gn** file in the development board directory. The target name must be the same as that of the development board. Taking the RTL8720 development board of Realtek as an example, the content in the **device/realtek/rtl8720/BUILD.gn** file is configured as follows: - - ``` - group("rtl8720") { # The target can be shared_library, static_library, or an executable file. - # Content - ...... - } - ``` - -4. Build the chipset solution. - - Run the **hb build** command in the development board directory to start the build. - - -## Adding a Product Solution - -The Compilation and Building subsystem supports flexible assembly of chipset solutions and modules to customize desired product solutions. The operation procedure is as follows: - -1. Create a product directory. - - Taking the Wi-Fi IoT module based on the RTL8720 development board as an example, you need to run the following command in the root code directory to create a product directory based on [1-Configuration Rules for Modules, Chipset Solutions, and Product Solutions](compilation-and-building-overview.md#section1625463413327). - - ``` - mkdir -p vendor/my_company/wifiiot - ``` - -2. Assemble the product. - - Create the **config.json** file in the product directory. Taking the Wi-Fi IoT module as an example, the **vendor/my\_company/wifiiot/config.json** file is as follows: - - ``` - { - "product_name": "wifiiot", # Product name - "ohos_version": "OpenHarmony 1.0", # In-use OS version - "device_company": "realtek", # Name of the chipset solution vendor - "board": "rtl8720", # Name of the development board - "kernel_type": "liteos_m", # Selected kernel type - "kernel_version": "3.0.0", # Selected kernel version - "subsystems": [ - { - "subsystem": "kernel", # Selected subsystem - "components": [ - { "component": "liteos_m", "features":[] } # Selected module and its features - ] - }, - ... - { - More subsystems and modules - } - ] - } - ``` - - Before the build, the Compilation and Building subsystem will check the validity of fields, including **device\_company**, **board**, **kernel\_type**, **kernel\_version**, **subsystem**, and **component**. The first four fields and the latter two fields must match the current chipset solution and the module description in the **build/lite/components** file, respectively. - -3. Implement adaptation of OS APIs. - - Create the **hals** directory in the product directory and store the source code as well as the build script for OS adaptation in this directory. - -4. Configure the system service. - - Create the **init\_configs** directory in the product directory and then the **init.cfg** file in the newly created directory. You can configure the system service to be started on demand. - -5. Configure the init process \(only for the Linux kernel\). - - You need to create the **etc** directory in the **init\_configs** directory, and then the **init.d** folder as well as the **fstab** file in the newly created directory. In addition, you need to create the **rcS** and **Sxxx** files in the **init.d** file and edit them based on product requirements. - -6. Configure the file system image \(required only for the development board that supports the file system\). - - Create the **fs.yml** file in the product directory and configure it as required. A typical **fs.yml** file is configured as follows: - - ``` - - - fs_dir_name: rootfs # Image name - fs_dirs: - - - # Copy the files in the out/my_board/my_product/bin directory to the rootfs/bin directory and ignore the .bin files related to testing. - source_dir: bin - target_dir: bin - ignore_files: - - Test.bin - - TestSuite.bin - - - # Copy the files in the out/my_board/my_product/libs directory to the rootfs/lib directory, ignore all .a files, and set the permissions on the files and folders to 644 and 755, respectively. - source_dir: libs - target_dir: lib - ignore_files: - - .a - dir_mode: 755 - file_mode: 644 - - - source_dir: usr/lib - target_dir: usr/lib - ignore_files: - - .a - dir_mode: 755 - file_mode: 644 - - - source_dir: config - target_dir: etc - - - source_dir: system - target_dir: system - - - source_dir: sbin - target_dir: sbin - - - source_dir: usr/bin - target_dir: usr/bin - - - source_dir: usr/sbin - target_dir: usr/sbin - - - # Create an empty proc directory. - target_dir: proc - - - target_dir: mnt - - - target_dir: opt - - - target_dir: tmp - - - target_dir: var - - - target_dir: sys - - - source_dir: etc - target_dir: etc - - - source_dir: vendor - target_dir: vendor - - - target_dir: storage - - fs_filemode: - - - file_dir: lib/ld-uClibc-0.9.33.2.so - file_mode: 555 - - - file_dir: lib/ld-2.24.so - file_mode: 555 - - - file_dir: etc/init.cfg - file_mode: 400 - fs_symlink: - - - # Create the soft link ld-musl-arm.so.1 -> libc.so in the rootfs/lib directory. - source: libc.so - link_name: ${fs_dir}/lib/ld-musl-arm.so.1 - - - source: mksh - link_name: ${fs_dir}/bin/sh - - - source: mksh - link_name: ${fs_dir}/bin/shell - fs_make_cmd: - # Create an ext4 image for the rootfs directory using the script. - - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 - - - fs_dir_name: userfs - fs_dirs: - - - source_dir: storage/etc - target_dir: etc - - - source_dir: data - target_dir: data - fs_make_cmd: - - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 - ``` - -7. Build the script. - - Create the **BUILD.gn** file in the product directory and build the script based on your requirements. Taking the Wi-Fi IoT module in step 1 as an example, the **BUILD.gn** is configured as follows: - - ``` - group("wifiiot") { # The target name must be the same as the product name. - deps = [] - # Copy the init configuration. - deps += [ "init_configs" ] - # Build the hals directory. - deps += [ "hals" ] - # Others - ...... - } - ``` - -8. Build the product. - - Run the **hb set** command in the root code directory to select the new product as prompted, and then run the **hb build** command to start the build. - - diff --git a/en/device-dev/subsystems/compilation-and-building-overview-0.md b/en/device-dev/subsystems/compilation-and-building-overview-0.md deleted file mode 100644 index de4d2beab9d8c3f91f9d1ff841af68e9311b0fb6..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/compilation-and-building-overview-0.md +++ /dev/null @@ -1,60 +0,0 @@ -# Compilation and Building Overview - -- [Basic Concepts](#section175012297491) -- [Working Principles](#section193961322175011) -- [Limitations and Constraints](#section2029921310472) - -The compilation and building subsystem provides a framework based on Generate Ninja \(GN\) and Ninja. This subsystem allows you to: - -- Build products based on different chipset platforms, for example, Hi3516D V300. - -- Package capabilities required by a product by assembling modules based on the product configuration. - -## Basic Concepts - -It is considered best practice to learn the following basic concepts before you start building: - -- **Platform** - - A platform is a combination of development boards and kernels. - - Supported subsystems and modules vary according to the platform. - -- **Subsystems** - - OpenHarmony is designed with a layered architecture, which from bottom to top consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to module. In a multi-device deployment scenario, unnecessary subsystems and modules can be excluded from the system as required. A subsystem is a logical concept and is a flexible combination of functions. - -- **Module** - - A module is a reusable software binary unit that contains source code, configuration files, resource files, and build scripts. A module can be built independently, integrated in binary mode, and then tested independently. - -- **GN** - - GN is short for Generate Ninja, which is used to generate Ninja files. - -- **Ninja** - - Ninja is a small high-speed build system. - - -## Working Principles - -The process to build OpenHarmony is as follows: - -- Parsing commands: Parse the name of the product to build and load related configurations. -- Running GN: Configure toolchains and global options based on the parsed product name and compilation type. -- Running Ninja: Start building and generate a product distribution. - -## Limitations and Constraints - -- You must download the source code using method 3 described in [Source Code Acquisition](../get-code/source-code-acquisition.md). -- The build environment must be Ubuntu 18.04 or later. -- You must install the software package required for build. - - The installation command is as follows: - - ``` - sudo apt-get install binutils git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 - ``` - - diff --git a/en/device-dev/subsystems/compilation-and-building-overview.md b/en/device-dev/subsystems/compilation-and-building-overview.md deleted file mode 100644 index 8cf7a6a1c1459288b1430f022740ef3a229663dd..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/compilation-and-building-overview.md +++ /dev/null @@ -1,132 +0,0 @@ -# Compilation and Building Overview - -- [Basic Concepts](#section175012297491) -- [Usage Guidelines](#section193961322175011) -- [Limitations and Constraints](#section2029921310472) - -The compilation and building subsystem is a building framework based on Generate Ninja \(GN\) and Ninja, which supports component-based OpenHarmony development. This subsystem can be used to: - -- Build existing products. - -- Build chipset source code independently. -- Build a single component independently. - -## Basic Concepts - -It is considered best practice to learn the following basic concepts before you start development and building: - -- **Component** - - A component is a reusable software unit that can contain source code, configuration files, resource files, and compilation scripts. - -- **GN** - - GN is short for Generate Ninja, which is used to generate Ninja files. - -- **Ninja** - - Ninja is a small high-speed building system. - - -## Usage Guidelines - -1. **Building Process** - - [Figure 1](#fig9744112715161) shows the building process. - - **Figure 1** Building process - ![](figures/building-process.jpg "building-process") - - 1. **hb set**: Set the OpenHarmony source code directory and the product to build. - 2. **hb build**: Build the product, development board, or component. The process to build the solution is as follows: - - **Reading configuration**: Read the development board configuration, which covers the toolchain, linking commands, and compilation options. - - **Running gn**: Run the **gn gen** command to read the product configuration \(related to the development board, kernel, and system components\) and generate the **out** directory and **ninja** files for the solution. - - **Running Ninja**: Run **ninja -C out/company/product** to start compilation. - - **Packaging**: Package the compilation result to create a file system image. - - -2. **Building Commands** - - 1. **hb set** - - ``` - hb set -h - usage: hb set [-h] [-root [ROOT_PATH]] [-p] - - optional arguments: - -h, --help show this help message and exit - -root [ROOT_PATH], --root_path [ROOT_PATH] - Set OHOS root path - -p, --product Set OHOS board and kernel - ``` - - - If you run **hb set** with no argument, the default setting process starts. - - You can run **hb set -root** _dir_ to set the root directory of the source code. - - **hb set -p** is used to set the product to compile. - - 2. **hb env** - - View the current configuration. - - ``` - hb env - [OHOS INFO] root path: xxx - [OHOS INFO] board: hispark_taurus - [OHOS INFO] kernel: liteos - [OHOS INFO] product: ipcamera - [OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera - [OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19 - ``` - - 3. **hb build** - - ``` - hb build -h - usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] - [--dmverity] [-p PRODUCT] [-f] [-n] - [component [component ...]] - - positional arguments: - component name of the component - - optional arguments: - -h, --help show this help message and exit - -b BUILD_TYPE, --build_type BUILD_TYPE - release or debug version - -c COMPILER, --compiler COMPILER - specify compiler - -t [TEST [TEST ...]], --test [TEST [TEST ...]] - compile test suite - --dmverity Enable dmverity - -p PRODUCT, --product PRODUCT - build a specified product with - {product_name}@{company}, eg: ipcamera@hisilcon - -f, --full full code compilation - ``` - - - If you run **hb build** with no argument, the previously configured code directory, product, and options are used for the compilation. The **-f** option will delete all products to be compiled, which is equivalent to running **hb clean** and **hb build**. - - You can run **hb build** _\{component\_name\}_ to compile product components separately based on the development board and kernel set for the product, for example, **hb build kv\_store**. - - You can run **hb build -p ipcamera@hisilicon** to skip the setting step and compile the product directly. - - You can run **hb build** in **device/device\_company/board** to select the kernel and start compilation based on the current development board and the selected kernel to generate an image that contains the kernel and driver only. - - 4. **hb clean** - - Clear the compilation result of the product in the **out** directory, and retain the **args.gn** and **build.log** files only. To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean** _xxx_**/out/**_xxx_. - - - ``` - hb clean - usage: hb clean [-h] [out_path] - - positional arguments: - out_path clean a specified path. - - optional arguments: - -h, --help show this help message and exit - ``` - - -## Limitations and Constraints - -Ensure that the development environment has GN and Ninja, Python 3.7.4 and later, and hb commands. You must download the complete code before you start. - diff --git a/en/device-dev/subsystems/compilation-and-building.md b/en/device-dev/subsystems/compilation-and-building.md deleted file mode 100644 index 54f18a521ee33440589cbeab2622d0969d1fb5a6..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/compilation-and-building.md +++ /dev/null @@ -1,7 +0,0 @@ -# Compilation and Building - -- **[Building Guidelines for Mini and Small Systems](building-guidelines-for-mini-and-small-systems.md)** - -- **[Building Guidelines for the Standard System](building-guidelines-for-the-standard-system.md)** - - diff --git a/en/device-dev/subsystems/development-guidelines-on-trusted-device-group-management.md b/en/device-dev/subsystems/development-guidelines-on-trusted-device-group-management.md deleted file mode 100644 index 91c4013935b5b3b8ce3cea7997dbeae25f7ac67d..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/development-guidelines-on-trusted-device-group-management.md +++ /dev/null @@ -1,264 +0,0 @@ -# Development Guidelines on Trusted Device Group Management - -- [When to Use](#section18502174174019) -- [Available APIs](#section1633115419401) -- [How to Develop](#section17516229192313) -- [Debugging and Verification](#section427316292411) - -## When to Use - -When a distributed service needs to exploit the secure communication channel provided by the distributed virtual bus for different devices, it can use the trusted device group management component to create groups of trusted devices. Distributed applications can establish and use secure, trusted relationships between devices based on the authentication capabilities for devices using different HUAWEI IDs, such as PIN code, QR code, and OneHop, and the capabilities for grouped devices using the same HUAWEI ID. For a device on which you have not logged in using your HUAWEI ID, you can enter the PIN code or scan the QR code to obtain the connection and PIN code information of the device. Then you can create a group of trusted devices and add this device to the group. If other applications have created and shared their groups of trusted devices, or have logged in using the same HUAWEI ID as yours, you can call APIs to query and use the groups. - -## Available APIs - -The following tables list the innerkits APIs provided by trusted device group management. These APIs are intended for system applications only. - -**Table 1** Java APIs provided by trusted device group management - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Function

-

Description

-

public static DeviceGroupManager getInstance(Abilityability, StringappID, IHichainGroupCallbackcallbackHandler)

-

Obtains a DeviceGroupManager instance and registers a listener.

-

int createGroup(String appId, String groupName, int groupType, String groupInfo)

-

Creates a group of trusted devices.

-

public int deleteGroup(String gourpId)

-

Deletes a group of trusted devices.

-

public String getLocalConnectInfo()

-

Obtains the network connection information of the local device.

-

int addMemberToGroup(String appId, long requestId, String addParams, String connectParams, int groupType)

-

Adds a member to a specified group.

-

int deleteMemberFromGroup(String appId, long requestId, String deleteParams, String connectParams)

-

Deletes a member from a specified group.

-

int cancelRequest(long requestId)

-

Cancels an ongoing request, for example, adding or deleting a member.

-

List<String> listJoinedGroups(int groupType)

-

Obtains a list of groups of a specified type to which the current device has been added.

-

List<String> listTrustedDevices(String groupId)

-

Obtains a list of devices in a specified group.

-

boolean isDeviceInGroup(String groupId, String deviceId)

-

Checks whether a specified device has been added to the given group.

-

List<String> getGroupInfo(String queryParams)

-

Obtains a list of information about the groups that match the input parameters.

-

int setFriendsList(String groupId, List<String> friendsList)

-

Adds a friend list to a specified group.

-

List<String> getFriendsList(String groupId)

-

Obtains the friend list of a specified group.

-

int registerGroupNotice(String groupId, IHichainGroupChangeListener groupChangeListener)

-

Registers a listener for changes to a specified group.

-

int revokeGroupNotice(String groupId)

-

Revokes the listener for changes to a specified group.

-
- -**Table 2** C++ APIs provided by trusted device group management for internal applications to query group information using SA - - - - - - - - - - - - - - - - - - - - - - -

Function

-

Description

-

DeviceAuthProxy()

-

Obtains a DeviceAuthProxy instance.

-

~DeviceAuthProxy()

-

A destructor used to delete the DeviceAuthProxy instance.

-

static int CheckAccessToGroup(const std::string &groupId, const std::string &pkgName);

-

Checks whether an application with a specified bundle name can access a specified group.

-

static int CheckAccessToDevice(const std::string &connDeviceId, const std::string &pkgName);

-

Checks whether an application with a specified bundle name can access the group that contains a specified device.

-

static std::vector<std::string> GetRelatedGroupInfo(const std::string &connDeviceId);

-

Obtains information about all the groups that contain both the local device and the device with a specified ID.

-
- -## How to Develop - -To develop trusted device group management, first obtain a management instance \(a callback to obtain group operation results is registered during the process\). Then you can use the instance to add or delete members, set a friend list for a group, and perform related query operations. - -**Scenario 1**: Create a group. - -``` -private HwDeviceGroupManager hwDeviceGroupManager; -... -private HichainGroupCallback groupCallbackByA = new HichainGroupCallback() { - @Override public void onFinish(long requestId, GroupOperation operationCode, String returnData) { - - } - @Override public void onError(long requestId, GroupOperation operationCode, int errorCode, String errorReturn) { - - } - @Override public String onRequest(long requestId, GroupOperation operationCode, String reqParams) { - JSONObject onRequestJson = generateConfirmation(REQUEST_ACCEPTED); - return onRequestJson.toString(); - } -}; -... -Optional context = convertAbilityToContext(mAbility); -Context ctxt = context.get(); -hwDeviceGroupManager = HwDeviceGroupManager.getInstance(ctxt, APP_ID, groupCallbackByA); -int ret = hwDeviceGroupManager.createGroup(APP_ID, GROUP_NAME, GROUP_TYPE, GROUP_INFO); -``` - -1. Declare the private member variable of the **HwDeviceGroupManager** instance. - - ``` - private HwDeviceGroupManager hwDeviceGroupManager; - ``` - -2. Create a callback for group management operations. - - ``` - private HichainGroupCallback groupCallbackByA = new HichainGroupCallback(); - ``` - -3. Obtain a **HwDeviceGroupManager** instance. \(In distributed scenarios, the same application on different devices must use the same **APP\_ID**.\) - - ``` - hwDeviceGroupManager = HwDeviceGroupManager.getInstance(ctxt, APP_ID, groupCallbackByA); - ``` - -4. Call the **createGroup** function to create a group. If **0** is returned, the creation request is submitted successfully. - - ``` - int ret = hwDeviceGroupManager.createGroup(APP_ID, GROUP_NAME, GROUP_TYPE, GROUP_INFO); - ``` - -5. After the group is created, **onFinish** is called. In this callback, the value of **operationCode** is **OperationCode.CREATE**, indicating a group creation operation. **returnData** is in JSON format and contains the **groupId** field, indicating the ID of the created group. - -**Scenario 2**: Add an authenticated device \(member\) to a group so that you can initiate trusted, encrypted connections to the device through the distributed virtual bus. - -``` -deviceGroupManager = DeviceGroupManager.getInstance(mAbility, APP_ID, hichainGroupCallback); -private static final String CONN_PARAM ="{\"DEVICE_ID\":\"11111111\",\"WIFI_IP\":\"192.168.43.149\",\"WIFI_PORT\":\"30000\",\"BLE_MAC\":\"\"}"; -private static final String ADD_PARAM ="{\"groupId\":\"344C1C8B149\",\"groupName\":\"myGroup\",\"addId\":\"11111111\",\"isAdmin\":\"false\"}"; -private static final int GROUP_TYPE = 256; -int result = deviceGroupManager.addMemberToGroup(APP_ID, reqId, ADD_PARAM, CONN_PARAM, GROUP_TYPE); -``` - -1. Obtain an **HwDeviceGroupManager** instance. - - ``` - deviceGroupManager = HwDeviceGroupManager.getInstance(mAbility, APP_ID, hichainGroupCallback); - ``` - -2. Set network connection parameters for the member to add \(in JSON format\), which are network parameters supported by the distributed virtual bus, such as **WIFI\_IP**, **WIFI\_PORT**, **BLR\_MAC**, and **DEVICE\_ID**. For details about the parameters, see the distributed virtual bus development guidelines. - - ``` - String CONN_PARAM ="{\"DEVICE_ID\":\"11111111\",\"WIFI_IP\":\"192.168.43.149\",\"WIFI_PORT\":\"30000\",\"BLE_MAC\":\"\"}"; - ``` - -3. Set parameters for the member to add \(in JSON format\), including the group ID, name, and whether the member is an administrator. If the member is invited to add a group, the value of **isAdmin** is **true**; otherwise, the value of **isAdmin** is **false**. - - ``` - String ADD_PARAM ="{\"groupId\":\"344C1C8B149\",\"groupName\":\"myGroup\",\"addId\":\"11111111\",\"isAdmin\":\"false\"}"; - ``` - -4. Set the type of the target group to **256**, indicating a P2P group. - - ``` - private static final int GROUP_TYPE = 256; - ``` - -5. Set **generateConfirmation** of the **onRequest** function in **HichainGroupCallback**. **PIN\_CODE** indicates the PIN code, which is input by users on the UI of the service. \(In a distributed communication, two devices must use the same PIN code.\) - - ``` - private JSONObject generateConfirmation(int confirmation) { - JSONObject jsonObject = new JSONObject(); - try { jsonObject.put("pinCode", PIN_CODE); - jsonObject.put("confirmation", confirmation); - } catch (JSONException e) { - LogUtil.error(TAG, "" + e.getMessage()); - } - return jsonObject; - } - ``` - -6. Call the **addMemberToGroup** function to add the member to the group. - - ``` - result = deviceGroupManager.addMemberToGroup(APP_ID, reqId, ADD_PARAM, CONN_PARAM, GROUP_TYPE); - ``` - -7. Check whether **HichainGroupCallback.onFinish** is called \(**operationCode** is **OperationCode.JOIN**\). If it is called, the member is added successfully. -8. Call APIs of the distributed virtual bus to create secure sessions between devices. - -## Debugging and Verification - -1. Develop an application with OpenHarmony. - -2. Develop an application by following the development guidelines. - -3. Create a group. If the **onFinish** callback is invoked, the group is created successfully. - -4. Deploy the same application on two devices, A and B. - -5. Transmit the connection parameters of device B to device A through a QR code. - -6. In the application on device A, create group1 and call the API to add device B to group1. If **HichainGroupCallback.onFinish** is called, device B is successfully added to group1. - diff --git a/en/device-dev/subsystems/development-guidelines.md b/en/device-dev/subsystems/development-guidelines.md deleted file mode 100644 index 6f14243a239391be4a4bce69425c6cca27844187..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/development-guidelines.md +++ /dev/null @@ -1,11 +0,0 @@ -# Development Guidelines - -To access the AI engine framework, you need to develop the SDKs and plug-ins shown in [Figure 1](ai-engine-framework.md#fig143186187187). In this way, you can call the APIs provided by the SDKs to call the algorithm capabilities of plug-ins to implement lifecycle management and on-demand deployment of AI capabilities. - -- **[SDK](sdk.md)** - -- **[Plug-in](plug-in.md)** - -- **[Configuration File](configuration-file.md)** - - diff --git a/en/device-dev/subsystems/dfx.md b/en/device-dev/subsystems/dfx.md deleted file mode 100644 index 241303cae97af3db18251e836e22ca628efba17c..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/dfx.md +++ /dev/null @@ -1,11 +0,0 @@ -# DFX - -- **[DFX](dfx-11.md)** - -- **[Development Guidelines on HiLog](development-guidelines-on-hilog.md)** - -- **[Development Guidelines on HiLog\_Lite](development-guidelines-on-hilog_lite.md)** - -- **[Development Guidelines on HiSysEvent](development-guidelines-on-hisysevent.md)** - - diff --git a/en/device-dev/subsystems/figures/20200721-223604(espace).gif b/en/device-dev/subsystems/figure/20200721-223604(espace).gif similarity index 100% rename from en/device-dev/subsystems/figures/20200721-223604(espace).gif rename to en/device-dev/subsystems/figure/20200721-223604(espace).gif diff --git a/en/device-dev/subsystems/figures/animator-effect.gif b/en/device-dev/subsystems/figure/animator-effect.gif similarity index 100% rename from en/device-dev/subsystems/figures/animator-effect.gif rename to en/device-dev/subsystems/figure/animator-effect.gif diff --git a/en/device-dev/subsystems/figures/application-startup-process.png b/en/device-dev/subsystems/figure/application-startup-process.png similarity index 100% rename from en/device-dev/subsystems/figures/application-startup-process.png rename to en/device-dev/subsystems/figure/application-startup-process.png diff --git a/en/device-dev/subsystems/figures/architecture-of-the-ability-management-framework.png b/en/device-dev/subsystems/figure/architecture-of-the-ability-management-framework.png similarity index 100% rename from en/device-dev/subsystems/figures/architecture-of-the-ability-management-framework.png rename to en/device-dev/subsystems/figure/architecture-of-the-ability-management-framework.png diff --git a/en/device-dev/subsystems/figures/architecture-of-the-bundle-management-framework.png b/en/device-dev/subsystems/figure/architecture-of-the-bundle-management-framework.png similarity index 100% rename from en/device-dev/subsystems/figures/architecture-of-the-bundle-management-framework.png rename to en/device-dev/subsystems/figure/architecture-of-the-bundle-management-framework.png diff --git a/en/device-dev/subsystems/figure/build-process.jpg b/en/device-dev/subsystems/figure/build-process.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a48ea734509526b3ed0fe85b7c4a98b0a2a9c4f0 Binary files /dev/null and b/en/device-dev/subsystems/figure/build-process.jpg differ diff --git a/en/device-dev/subsystems/figures/component-tree-structure.png b/en/device-dev/subsystems/figure/component-tree-structure.png similarity index 100% rename from en/device-dev/subsystems/figures/component-tree-structure.png rename to en/device-dev/subsystems/figure/component-tree-structure.png diff --git a/en/device-dev/subsystems/figures/effect-of-adding-view-instances-to-a-viewgroup.png b/en/device-dev/subsystems/figure/effect-of-adding-view-instances-to-a-viewgroup.png similarity index 100% rename from en/device-dev/subsystems/figures/effect-of-adding-view-instances-to-a-viewgroup.png rename to en/device-dev/subsystems/figure/effect-of-adding-view-instances-to-a-viewgroup.png diff --git a/en/device-dev/subsystems/figures/effect-of-clicking-a-uibutton.gif b/en/device-dev/subsystems/figure/effect-of-clicking-a-uibutton.gif similarity index 100% rename from en/device-dev/subsystems/figures/effect-of-clicking-a-uibutton.gif rename to en/device-dev/subsystems/figure/effect-of-clicking-a-uibutton.gif diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001051782526.png b/en/device-dev/subsystems/figure/en-us_image_0000001051782526.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001051782526.png rename to en/device-dev/subsystems/figure/en-us_image_0000001051782526.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001052582522.png b/en/device-dev/subsystems/figure/en-us_image_0000001052582522.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001052582522.png rename to en/device-dev/subsystems/figure/en-us_image_0000001052582522.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001052662559.png b/en/device-dev/subsystems/figure/en-us_image_0000001052662559.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001052662559.png rename to en/device-dev/subsystems/figure/en-us_image_0000001052662559.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001052782555.png b/en/device-dev/subsystems/figure/en-us_image_0000001052782555.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001052782555.png rename to en/device-dev/subsystems/figure/en-us_image_0000001052782555.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001052942531.png b/en/device-dev/subsystems/figure/en-us_image_0000001052942531.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001052942531.png rename to en/device-dev/subsystems/figure/en-us_image_0000001052942531.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001053207924.gif b/en/device-dev/subsystems/figure/en-us_image_0000001053207924.gif similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001053207924.gif rename to en/device-dev/subsystems/figure/en-us_image_0000001053207924.gif diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001053247975.gif b/en/device-dev/subsystems/figure/en-us_image_0000001053247975.gif similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001053247975.gif rename to en/device-dev/subsystems/figure/en-us_image_0000001053247975.gif diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001054101094.png b/en/device-dev/subsystems/figure/en-us_image_0000001054101094.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001054101094.png rename to en/device-dev/subsystems/figure/en-us_image_0000001054101094.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001054421113.png b/en/device-dev/subsystems/figure/en-us_image_0000001054421113.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001054421113.png rename to en/device-dev/subsystems/figure/en-us_image_0000001054421113.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001059334449.png b/en/device-dev/subsystems/figure/en-us_image_0000001059334449.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001059334449.png rename to en/device-dev/subsystems/figure/en-us_image_0000001059334449.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001060200050.png b/en/device-dev/subsystems/figure/en-us_image_0000001060200050.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001060200050.png rename to en/device-dev/subsystems/figure/en-us_image_0000001060200050.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001061889268.png b/en/device-dev/subsystems/figure/en-us_image_0000001061889268.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001061889268.png rename to en/device-dev/subsystems/figure/en-us_image_0000001061889268.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001062334618.png b/en/device-dev/subsystems/figure/en-us_image_0000001062334618.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001062334618.png rename to en/device-dev/subsystems/figure/en-us_image_0000001062334618.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001062476933.png b/en/device-dev/subsystems/figure/en-us_image_0000001062476933.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001062476933.png rename to en/device-dev/subsystems/figure/en-us_image_0000001062476933.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001062942690.png b/en/device-dev/subsystems/figure/en-us_image_0000001062942690.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001062942690.png rename to en/device-dev/subsystems/figure/en-us_image_0000001062942690.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001063839940.png b/en/device-dev/subsystems/figure/en-us_image_0000001063839940.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001063839940.png rename to en/device-dev/subsystems/figure/en-us_image_0000001063839940.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001077724150.png b/en/device-dev/subsystems/figure/en-us_image_0000001077724150.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001077724150.png rename to en/device-dev/subsystems/figure/en-us_image_0000001077724150.png diff --git a/en/device-dev/subsystems/figures/en-us_image_0000001077727032.png b/en/device-dev/subsystems/figure/en-us_image_0000001077727032.png similarity index 100% rename from en/device-dev/subsystems/figures/en-us_image_0000001077727032.png rename to en/device-dev/subsystems/figure/en-us_image_0000001077727032.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001119924146.gif b/en/device-dev/subsystems/figure/en-us_image_0000001119924146.gif similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001119924146.gif rename to en/device-dev/subsystems/figure/en-us_image_0000001119924146.gif diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001166643927.jpg b/en/device-dev/subsystems/figure/en-us_image_0000001166643927.jpg similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001166643927.jpg rename to en/device-dev/subsystems/figure/en-us_image_0000001166643927.jpg diff --git a/en/device-dev/subsystems/figures/image-auto-adaption-effect.png b/en/device-dev/subsystems/figure/image-auto-adaption-effect.png similarity index 100% rename from en/device-dev/subsystems/figures/image-auto-adaption-effect.png rename to en/device-dev/subsystems/figure/image-auto-adaption-effect.png diff --git a/en/device-dev/subsystems/figures/image-tile-effect.png b/en/device-dev/subsystems/figure/image-tile-effect.png similarity index 100% rename from en/device-dev/subsystems/figures/image-tile-effect.png rename to en/device-dev/subsystems/figure/image-tile-effect.png diff --git a/en/device-dev/subsystems/figures/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel.png b/en/device-dev/subsystems/figure/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel.png similarity index 100% rename from en/device-dev/subsystems/figures/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel.png rename to en/device-dev/subsystems/figure/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel.png diff --git a/en/device-dev/subsystems/figures/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel.png b/en/device-dev/subsystems/figure/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel.png similarity index 100% rename from en/device-dev/subsystems/figures/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel.png rename to en/device-dev/subsystems/figure/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel.png diff --git a/en/device-dev/subsystems/figures/platform-architecture.png b/en/device-dev/subsystems/figure/platform-architecture.png similarity index 100% rename from en/device-dev/subsystems/figures/platform-architecture.png rename to en/device-dev/subsystems/figure/platform-architecture.png diff --git a/en/device-dev/subsystems/figures/relationship-between-a-page-ability-and-its-ability-slices.png b/en/device-dev/subsystems/figure/relationship-between-a-page-ability-and-its-ability-slices.png similarity index 100% rename from en/device-dev/subsystems/figures/relationship-between-a-page-ability-and-its-ability-slices.png rename to en/device-dev/subsystems/figure/relationship-between-a-page-ability-and-its-ability-slices.png diff --git a/en/device-dev/subsystems/figures/running-sequence-of-the-test-platform.png b/en/device-dev/subsystems/figure/running-sequence-of-the-test-platform.png similarity index 100% rename from en/device-dev/subsystems/figures/running-sequence-of-the-test-platform.png rename to en/device-dev/subsystems/figure/running-sequence-of-the-test-platform.png diff --git a/en/device-dev/subsystems/figures/scrolling-effect-in-both-horizontal-and-vertical-directions.gif b/en/device-dev/subsystems/figure/scrolling-effect-in-both-horizontal-and-vertical-directions.gif similarity index 100% rename from en/device-dev/subsystems/figures/scrolling-effect-in-both-horizontal-and-vertical-directions.gif rename to en/device-dev/subsystems/figure/scrolling-effect-in-both-horizontal-and-vertical-directions.gif diff --git a/en/device-dev/subsystems/figures/setting-a-2x2-grid-and-adding-four-buttons-in-a-layout.png b/en/device-dev/subsystems/figure/setting-a-2x2-grid-and-adding-four-buttons-in-a-layout.png similarity index 100% rename from en/device-dev/subsystems/figures/setting-a-2x2-grid-and-adding-four-buttons-in-a-layout.png rename to en/device-dev/subsystems/figure/setting-a-2x2-grid-and-adding-four-buttons-in-a-layout.png diff --git a/en/device-dev/subsystems/figures/startup-of-the-ability-manager-service-and-bundle-manager-service.png b/en/device-dev/subsystems/figure/startup-of-the-ability-manager-service-and-bundle-manager-service.png similarity index 100% rename from en/device-dev/subsystems/figures/startup-of-the-ability-manager-service-and-bundle-manager-service.png rename to en/device-dev/subsystems/figure/startup-of-the-ability-manager-service-and-bundle-manager-service.png diff --git a/en/device-dev/subsystems/figures/structure-of-common-container-components.png b/en/device-dev/subsystems/figure/structure-of-common-container-components.png similarity index 100% rename from en/device-dev/subsystems/figures/structure-of-common-container-components.png rename to en/device-dev/subsystems/figure/structure-of-common-container-components.png diff --git a/en/device-dev/subsystems/figures/tree-structure-of-common-components.png b/en/device-dev/subsystems/figure/tree-structure-of-common-components.png similarity index 100% rename from en/device-dev/subsystems/figures/tree-structure-of-common-components.png rename to en/device-dev/subsystems/figure/tree-structure-of-common-components.png diff --git a/en/device-dev/subsystems/figures/unnaming.png b/en/device-dev/subsystems/figure/unnaming.png similarity index 100% rename from en/device-dev/subsystems/figures/unnaming.png rename to en/device-dev/subsystems/figure/unnaming.png diff --git "a/en/device-dev/subsystems/figures/\345\233\276\347\211\2071.png" "b/en/device-dev/subsystems/figure/\345\233\276\347\211\2071.png" similarity index 100% rename from "en/device-dev/subsystems/figures/\345\233\276\347\211\2071.png" rename to "en/device-dev/subsystems/figure/\345\233\276\347\211\2071.png" diff --git "a/en/device-dev/subsystems/figures/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" "b/en/device-dev/subsystems/figure/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" similarity index 100% rename from "en/device-dev/subsystems/figures/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" rename to "en/device-dev/subsystems/figure/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" diff --git "a/en/device-dev/subsystems/figures/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" "b/en/device-dev/subsystems/figure/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" similarity index 100% rename from "en/device-dev/subsystems/figures/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" rename to "en/device-dev/subsystems/figure/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" diff --git a/en/device-dev/subsystems/figures/build-process.jpg b/en/device-dev/subsystems/figures/build-process.jpg deleted file mode 100644 index c8d58bc3d172524c78e3c45455622d081429529c..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/figures/build-process.jpg and /dev/null differ diff --git a/en/device-dev/subsystems/figures/building-process.jpg b/en/device-dev/subsystems/figures/building-process.jpg deleted file mode 100644 index c8d58bc3d172524c78e3c45455622d081429529c..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/figures/building-process.jpg and /dev/null differ diff --git a/en/device-dev/subsystems/figures/ril-adapter.png b/en/device-dev/subsystems/figures/ril-adapter.png deleted file mode 100644 index 51d8a0668a19b26071873247a5cf1f483d9044e5..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/figures/ril-adapter.png and /dev/null differ diff --git "a/en/device-dev/subsystems/figures/\345\216\273\347\224\265.png" "b/en/device-dev/subsystems/figures/\345\216\273\347\224\265.png" deleted file mode 100644 index fd53e705cde494b3b5a7a5e2c923a9b5ac07aa4f..0000000000000000000000000000000000000000 Binary files "a/en/device-dev/subsystems/figures/\345\216\273\347\224\265.png" and /dev/null differ diff --git "a/en/device-dev/subsystems/figures/\346\235\245\347\224\265.png" "b/en/device-dev/subsystems/figures/\346\235\245\347\224\265.png" deleted file mode 100644 index 9b27f13794e395cb6b05ec588f96bc938288ec01..0000000000000000000000000000000000000000 Binary files "a/en/device-dev/subsystems/figures/\346\235\245\347\224\265.png" and /dev/null differ diff --git a/en/device-dev/subsystems/graphics.md b/en/device-dev/subsystems/graphics.md deleted file mode 100644 index 254f1e0fa0022f821ba9ecb5f8f88846a868bfe7..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/graphics.md +++ /dev/null @@ -1,13 +0,0 @@ -# Graphics - -- **[Graphics](graphics-2.md)** - -- **[Development Guidelines on Container Components](development-guidelines-on-container-components.md)** - -- **[Development Guidelines on Layout Container Components](development-guidelines-on-layout-container-components.md)** - -- **[Development Guidelines on Common Components](development-guidelines-on-common-components.md)** - -- **[Development Guidelines on Animators](development-guidelines-on-animators.md)** - - diff --git a/en/device-dev/subsystems/hdc_std-faqs.md b/en/device-dev/subsystems/hdc_std-faqs.md deleted file mode 100644 index a767f3e60aad365ce1f66252889c5ccd3eb99773..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/hdc_std-faqs.md +++ /dev/null @@ -1,39 +0,0 @@ -# hdc\_std FAQs - -- [hdc\_std Fails to Connect to a Device](#section1221016541119) -- [hdc\_std Fails to Run](#section219185710311) - -## hdc\_std Fails to Connect to a Device - -- **Symptom** - - **\[Empty\]** is displayed in the output after the **hdc\_std list targets** command is run. - -- **Possible Causes and Solutions** - 1. The device cannot be identified. - - Check whether **HDC Device** exists in the universal serial bus device of the device manager. If **HDC Device** does not exist, the device cannot be connected. In this case, remove and then insert the device or burn the latest image for the device. - - 2. hdc\_std works improperly. - - Run the **hdc kill** or **hdc start -r** command to kill or restart the hdc service, and then run the **hdc list targets** command to check whether device information is obtained. - - If no device information is obtained, check whether the adb process exists in the task manager. If the adb process exists, kill this process because it may affect the hdc service. After that, run **hdc kill** or **hdc start -r** and then **hdc list targets** again. - - 3. hdc\_std does not match the device. - - If the latest image is burnt for the device, hdc\_std must also be of the latest version. As hdc\_std is updated continuously, obtain hdc\_std of the latest version from the **developtools\_hdc\_standard** repository in the **prebuilt** directory. - - - -## hdc\_std Fails to Run - -- **Symptom** - - The **hdc\_std.exe** file does not run after being clicked. - -- **Possible Causes and Solutions** - - **hdc\_std.exe** requires no installation and can be directly used on a disk. It can also be added to environment variables. Open the cmd window and run the **hdc\_std** command to use **hdc\_std.exe**. - - diff --git a/en/device-dev/subsystems/hdc_std-usage-guidelines.md b/en/device-dev/subsystems/oem_subsys_toolchain_hdc_guide.md similarity index 84% rename from en/device-dev/subsystems/hdc_std-usage-guidelines.md rename to en/device-dev/subsystems/oem_subsys_toolchain_hdc_guide.md index 76a821114ce609f1355d03c91c7cc7df7b43433b..8116d317a2f56abdd4fcd5304d2c5076fd5fdf6b 100644 --- a/en/device-dev/subsystems/hdc_std-usage-guidelines.md +++ b/en/device-dev/subsystems/oem_subsys_toolchain_hdc_guide.md @@ -2,56 +2,72 @@ - [Preparations](#section05992022154916) - [Important Notes](#section19543134915210) -- [Global Options](#section618522925119) +- [Option-related Commands](#section618522925119) + - [-h/help -v/version](#section51533527212) + - [-t key](#section1180555115159) + - [Querying the Device List](#section174891132104218) + - [list targets\[-v\]](#section12911142313168) + - [Service Process Commands](#section680531510497) + - [target mount](#section396717571168) + - [smode \[off\]](#section179951621713) + - [kill \[-r\]](#section419144621712) + - [start \[-r\]](#section184811812183) + - [Network Commands](#section71176123212) + - [tconn host\[:port\]\[-remove\]](#section191911334206) + - [tmode usb](#section17840182562015) + - [tmode port port-number](#section101113462113) + - [File Commands](#section173133523013) + - [file send local remote](#section126223231307) + - [file recv \[-a\] remote local](#section26966541304) + - [App Commands](#section2072647133819) + - [install \[-r/-d/-g\] package](#section49615195111) + - [uninstall \[-k\] package](#section167618461814) + - [Debugging Commands](#section112861250195015) + - [hilog](#section32171612221) + - [shell \[command\]](#section524235625) + +- [Troubleshooting](#section592920255582) + - [hdc\_std Fails to Connect to a Device](#section74019384588) -hdc\_std \(OpenHarmony Device Connector\) is a command line tool provided by OpenHarmony for debugging. With hdc, you can interact with real devices or simulators from a Windows or Linux OS. +- [hdc\_std Fails to Run](#section6825095917) -This section describes how to build the hdc\_std environment, its common commands, and how to use the commands. +hdc\_std \(OpenHarmony Device Connector\) is a command line tool provided by OpenHarmony for debugging. With this tool, you can interact with real devices or simulators from a Windows or Linux OS. + +This section describes how to set up the hdc\_std environment and use its common commands. ## Preparations -**hdc\_std obtaining method:** +**Obtaining hdc\_std:** Obtain hdc\_std from the **developtools\_hdc\_standard** repository in the **prebuilt** directory. **Example:** -To obtain hdc\_std on Windows, obtain the executable file **hdc\_std.exe** from **prebuilt/windows** and place it in a specified directory on the disk. +To obtain hdc\_std on Windows, obtain the executable file **hdc\_std.exe** from **prebuilt/windows** and place it in a directory on the disk. ## Important Notes -1. If an exception occurs when you are using hdc\_std, you can run the **hdc\_std kill** command to kill the hdc\_std service or run the **hdc\_std start -r** command to restart the service process. - -2. If no device information is obtained after **hdc\_std list targets** is executed, use the task manager to check whether the **hdc.exe** process exists. If it exists, kill the process. +- If an exception occurs when you are using hdc\_std, run the **hdc\_std kill** command to kill the hdc\_std service or run the **hdc\_std start -r** command to restart the service process. +- If no device information is obtained after **hdc\_std list targets** is executed, use the task manager to check whether the **hdc.exe** process exists. If it exists, kill the process. -## Global Options +## Option-related Commands -The following options are globally available: +The following commands are available: -- **-h/help -v/version** +### -h/help -v/version -Obtains the hdc help and version information. +Obtains hdc help and version information. **Table 1** Command description - - - - - - - - - + + + + + + + + + + + + + + + + + + + +

Parameter

-

Description

-

-h/help -v/version

-

None

-

Return Value

+ @@ -70,7 +86,7 @@ hdc\_std -h / hdc\_std help hdc\_std -v / hdc\_std version -- **-t key** +### -t key Connects to a device with a specified key. @@ -96,7 +112,7 @@ Connects to a device with a specified key.

②Nothing to do...

@@ -106,20 +122,20 @@ Examples: This option must be used together with a specific operation command. The following uses the shell command as an example: -hdc\_std list targets \(for obtaining device information\) +**hdc\_std list targets** \(obtain device information\) -hdc\_std -t _key_ shell \(replace _key_ with the obtained device information\) +**hdc\_std -t _key_ shell** \(replace _key_ with the device information obtained\) ->![](public_sys-resources/icon-note.gif) **NOTE:** ->You can connect to multiple devices from the device you use for development. Each device has a unique key, which is _IP address:Port number_ for a device that can be connected through a network and the serial number for a device that can be connected through USB. +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>You can connect to multiple devices from the device you use for development. Each device has a unique key. The key can be _IP address:Port number_ for a device connected through a network or the serial number for a device connected through USB. ## Querying the Device List -The following command is available: +The following command is used to query the device list: -**list targets\[-v\]** +### list targets\[-v\] -Queries all the connected devices. +Displays all the connected devices. **Table 3** Command description @@ -143,7 +159,7 @@ Queries all the connected devices.

②[Empty]

@@ -159,9 +175,9 @@ hdc\_std list targets -v The following commands are available: -- **target mount** +### target mount -Mounts a partition such as **/system** with the read and write permissions. +Mounts a partition, such as **/system**, with the read and write permissions. **Table 4** Command description @@ -195,7 +211,7 @@ Example: hdc\_std target mount -- **smode \[off\]** +### smode \[off\] Grants the root permission to a background service process. The **off** option is used to revoke the granted permission. @@ -205,16 +221,16 @@ hdc\_std smode hdc\_std smode off -- **kill \[-r\]** +### kill \[-r\] Stops a service process. **Table 5** Command description -

Return Value

Description

1. The device does not exist.

-

2. The command does not exist.

+

2. The command appended to -t key does not exist.

1. A list of connected devices

-

1. No device information is found.

+

2. No device information is found.

Parameter

+ - - - @@ -241,14 +257,14 @@ Example: hdc\_std kill -- **start \[-r\]** +### start \[-r\] -Starts the service process. +Starts a service process. **Table 6** Command description -

Parameter

Description

+

Description

-r

@@ -222,16 +238,16 @@ Stops a service process.

Triggers the service restart.

Return Value

+

Return Value

Description

+

Description

①Kill server finish

-

1. Error information

+

2. Error information

1. Information returned when the operation is successful.

-

1. The operation fails.

+

2. The operation fails.

diff --git a/en/device-dev/subsystems/subsys-aiframework-devguide.md b/en/device-dev/subsystems/subsys-aiframework-devguide.md new file mode 100644 index 0000000000000000000000000000000000000000..b3bd0bb4e3ccfccd3d91a6b8c35fec13dd570683 --- /dev/null +++ b/en/device-dev/subsystems/subsys-aiframework-devguide.md @@ -0,0 +1,11 @@ +# Development Guidelines + +To access the AI engine framework, you need to develop the SDKs and plug-ins shown in [Figure 1](subsys-aiframework-guide.md#fig143186187187). In this way, you can call the APIs provided by the SDKs to call the algorithm capabilities of plug-ins to implement lifecycle management and on-demand deployment of AI capabilities. + +- **[SDK](subsys-aiframework-devguide-sdk.md)** + +- **[Plug-in](subsys-aiframework-devguide-plugin.md)** + +- **[Configuration File](subsys-aiframework-devguide-conf.md)** + + diff --git a/en/device-dev/subsystems/development-environment.md b/en/device-dev/subsystems/subsys-aiframework-envbuild.md similarity index 43% rename from en/device-dev/subsystems/development-environment.md rename to en/device-dev/subsystems/subsys-aiframework-envbuild.md index d8a387f47835f43689d8447fdec9a6f52d4875d3..ebfa0e83dcaf00e8123da6264df60db3ddbfa20e 100644 --- a/en/device-dev/subsystems/development-environment.md +++ b/en/device-dev/subsystems/subsys-aiframework-envbuild.md @@ -1,5 +1,5 @@ # Development Environment 1. Prepare development boards Hi3516D V300 and Hi3518E V300. -2. [Download the source code](https://device.harmonyos.com/en/docs/start/get-code/oem_sourcecode_guide-0000001050769927#EN-US_TOPIC_0000001050769927__section1186691118430). +2. [Download the source code](../get-code/sourcecode-acquire.md). diff --git a/en/device-dev/subsystems/ai-engine-framework.md b/en/device-dev/subsystems/subsys-aiframework-guide.md similarity index 96% rename from en/device-dev/subsystems/ai-engine-framework.md rename to en/device-dev/subsystems/subsys-aiframework-guide.md index e5e3a40291288b075be04cb4d88f61e3dcabfd7f..3e13aeb62273b5b51cd951aa803db6f0d02426ae 100644 --- a/en/device-dev/subsystems/ai-engine-framework.md +++ b/en/device-dev/subsystems/subsys-aiframework-guide.md @@ -5,5 +5,5 @@ The AI subsystem of OpenHarmony provides native distributed AI capabilities. At **Figure 1** AI engine framework -![](figures/en-us_image_0000001077727032.png) +![](figure/en-us_image_0000001077727032.png) diff --git a/en/device-dev/subsystems/code-management.md b/en/device-dev/subsystems/subsys-aiframework-tech-codemanage.md similarity index 98% rename from en/device-dev/subsystems/code-management.md rename to en/device-dev/subsystems/subsys-aiframework-tech-codemanage.md index 6dde40c04806b61c22c53c8192ac869fa505f094..71784ff093472cfa6658ba319b3b6d701e955d68 100644 --- a/en/device-dev/subsystems/code-management.md +++ b/en/device-dev/subsystems/subsys-aiframework-tech-codemanage.md @@ -11,7 +11,7 @@ Code of the AI engine framework consists of three parts: **client**, **server* **Figure 1** Code dependency -![](figures/插件依赖-(2).jpg) +![](figure/插件依赖-(2).jpg) ## Recommendation: Develop plug-ins and northbound SDKs in the directories specified by the AI engine. diff --git a/en/device-dev/subsystems/api-development.md b/en/device-dev/subsystems/subsys-aiframework-tech-interface.md similarity index 100% rename from en/device-dev/subsystems/api-development.md rename to en/device-dev/subsystems/subsys-aiframework-tech-interface.md diff --git a/en/device-dev/subsystems/naming.md b/en/device-dev/subsystems/subsys-aiframework-tech-name.md similarity index 100% rename from en/device-dev/subsystems/naming.md rename to en/device-dev/subsystems/subsys-aiframework-tech-name.md diff --git a/en/device-dev/subsystems/technical-specifications.md b/en/device-dev/subsystems/subsys-aiframework-tech.md similarity index 51% rename from en/device-dev/subsystems/technical-specifications.md rename to en/device-dev/subsystems/subsys-aiframework-tech.md index 6a53ac57a84e50addac49a9b002d3a3db7678e20..ed9edda03a6fabc4651e76a13271f159b4510e51 100644 --- a/en/device-dev/subsystems/technical-specifications.md +++ b/en/device-dev/subsystems/subsys-aiframework-tech.md @@ -6,10 +6,10 @@ **Recommendation**: a convention that should be considered -- **[Code Management](code-management.md)** +- **[Code Management](subsys-aiframework-tech-codemanage.md)** -- **[Naming](naming.md)** +- **[Naming](subsys-aiframework-tech-name.md)** -- **[API Development](api-development.md)** +- **[API Development](subsys-aiframework-tech-interface.md)** diff --git a/en/device-dev/subsystems/subsys-aiframework.md b/en/device-dev/subsystems/subsys-aiframework.md new file mode 100644 index 0000000000000000000000000000000000000000..bdd0b162508a053ffe7b7b9f62fffa6401d644d1 --- /dev/null +++ b/en/device-dev/subsystems/subsys-aiframework.md @@ -0,0 +1,13 @@ +# AI Framework + +- **[AI Engine Framework](subsys-aiframework-guide.md)** + +- **[Development Environment](subsys-aiframework-envbuild.md)** + +- **[Technical Specifications](subsys-aiframework-tech.md)** + +- **[Development Guidelines](subsys-aiframework-devguide.md)** + +- **[Development Examples](subsys-aiframework-demo.md)** + + diff --git a/en/device-dev/subsystems/setting-up-a-development-environment.md b/en/device-dev/subsystems/subsys-application-framework-builden.md similarity index 77% rename from en/device-dev/subsystems/setting-up-a-development-environment.md rename to en/device-dev/subsystems/subsys-application-framework-builden.md index 1fc80b0e712510b8126974d0beffabd558cc66b0..c7497eb01035c6d5c8569cfef1ca944cbf444136 100644 --- a/en/device-dev/subsystems/setting-up-a-development-environment.md +++ b/en/device-dev/subsystems/subsys-application-framework-builden.md @@ -2,6 +2,6 @@ - Development board: Hi3516D V300 -- [Download the source code](../get-code/source-code-acquisition.md). +- [Download the source code](../get-code/sourcecode-acquire.md). - [Build the application framework](https://gitee.com/openharmony/docs/blob/master/en/readme/application-framework.md). diff --git a/en/device-dev/subsystems/development-example.md b/en/device-dev/subsystems/subsys-application-framework-demo.md similarity index 100% rename from en/device-dev/subsystems/development-example.md rename to en/device-dev/subsystems/subsys-application-framework-demo.md diff --git a/en/device-dev/subsystems/development-guidelines-5.md b/en/device-dev/subsystems/subsys-application-framework-guide.md similarity index 99% rename from en/device-dev/subsystems/development-guidelines-5.md rename to en/device-dev/subsystems/subsys-application-framework-guide.md index c86bd7b452bef75e1eeac280e801d80e36ed0d7f..a4f37e5be36824b3f229c5f1b178e5a3e8d1197c 100644 --- a/en/device-dev/subsystems/development-guidelines-5.md +++ b/en/device-dev/subsystems/subsys-application-framework-guide.md @@ -693,15 +693,15 @@ The packing tool is generally integrated into the development tool or IDE, and y - Example HAP File Structure - Development view - ![](figures/en-us_image_0000001062942690.png) + ![](figure/en-us_image_0000001062942690.png) - Compilation view - ![](figures/en-us_image_0000001062334618.png) + ![](figure/en-us_image_0000001062334618.png) - Run the following commands to pack a HAP file using the packing tool. - ![](figures/en-us_image_0000001062476933.png) + ![](figure/en-us_image_0000001062476933.png) ``` $ java -jar hmos_app_packing_tool.jar --mode hap --json-path ./config.json --assets-path ./assets/ --ability-so-path ./libentry.so --index-path ./resources.index --out-path out/entry.hap --force true diff --git a/en/device-dev/subsystems/overview-4.md b/en/device-dev/subsystems/subsys-application-framework-overview.md similarity index 94% rename from en/device-dev/subsystems/overview-4.md rename to en/device-dev/subsystems/subsys-application-framework-overview.md index be32c8ebf46f3db9ab43c7a48fc0556250a04b7b..a199610651dc5f2867adf61d356371d07e70b91a 100644 --- a/en/device-dev/subsystems/overview-4.md +++ b/en/device-dev/subsystems/subsys-application-framework-overview.md @@ -17,7 +17,7 @@ This section describes some basic concepts for you to better understand the Open The ability management framework manages running status of OpenHarmony applications. **Figure 1** Architecture of the ability management framework -![](figures/architecture-of-the-ability-management-framework.png "architecture-of-the-ability-management-framework") +![](figure/architecture-of-the-ability-management-framework.png "architecture-of-the-ability-management-framework") - **Ability** is the minimum unit for the system to schedule applications. It is a component that can implement an independent functionality. An application can contain one or more **Ability** instances. There are two types of templates that you can use to create an **Ability** instance: Page and Service. - An **Ability using the Page template** \(Page ability for short\) provides a UI for interacting with users. @@ -29,14 +29,14 @@ The ability management framework manages running status of OpenHarmony applicati - An **AbilitySlice** represents a single screen and its control logic. It is specific to Page abilities. A Page ability may contain one ability slice or multiple ability slices that provide highly relevant capabilities. **Figure 2** Relationship between a Page ability and its ability slices - ![](figures/relationship-between-a-page-ability-and-its-ability-slices.png "relationship-between-a-page-ability-and-its-ability-slices") + ![](figure/relationship-between-a-page-ability-and-its-ability-slices.png "relationship-between-a-page-ability-and-its-ability-slices") - **Lifecycle** is a general term for all states of an ability, including **INITIAL**, **INACTIVE**, **ACTIVE**, and **BACKGROUND**. **Figure 3** Lifecycle state transition of a Page ability - ![](figures/图片1.png) + ![](figure/图片1.png) - **OnStart\(\)** @@ -94,7 +94,7 @@ The ability management framework manages running status of OpenHarmony applicati The bundle management framework is provided by OpenHarmony for you to manage application bundles. **Figure 4** Architecture of the bundle management framework -![](figures/architecture-of-the-bundle-management-framework.png "architecture-of-the-bundle-management-framework") +![](figure/architecture-of-the-bundle-management-framework.png "architecture-of-the-bundle-management-framework") - **BundleKit** includes external APIs provided by the Bundle Manager Service, including the APIs for application installation and uninstallation, bundle information query, and bundle state change listeners. - The **bundle scanning sub-module** parses pre-installed or installed bundles on the local device and extracts information from them for the bundle management module to manage and make the information persistent for storage. @@ -110,12 +110,12 @@ The bundle management framework is provided by OpenHarmony for you to manage app The Ability Manager Service and Bundle Manager Service are the core modules of the ability management framework and bundle management framework, respectively. The two system-level services are registered and discovered by using the system service framework SAMgr, and they are used by manage abilities and bundles for other processes. The Ability Manager Service and Bundle Manager Service are provided as open APIs in the AbilityKit and BundleKit. **Figure 5** Startup of the Ability Manager Service and Bundle Manager Service -![](figures/startup-of-the-ability-manager-service-and-bundle-manager-service.png "startup-of-the-ability-manager-service-and-bundle-manager-service") +![](figure/startup-of-the-ability-manager-service-and-bundle-manager-service.png "startup-of-the-ability-manager-service-and-bundle-manager-service") OpenHarmony applications can be installed and started after the two services are started. **Figure 6** Application startup process -![](figures/application-startup-process.png "application-startup-process") +![](figure/application-startup-process.png "application-startup-process") The home screen is the first OpenHarmony application started by the Ability Manager Service. After the home screen is started, the user can touch any installed OpenHarmony application on the home screen to start the particular application. The figure above shows the interaction process of starting an installed application from the home screen. diff --git a/en/device-dev/subsystems/subsys-application-framework.md b/en/device-dev/subsystems/subsys-application-framework.md new file mode 100644 index 0000000000000000000000000000000000000000..aeca8dc7dd6695791adc4204f1c76c88acd96568 --- /dev/null +++ b/en/device-dev/subsystems/subsys-application-framework.md @@ -0,0 +1,11 @@ +# Application Framework + +- **[Overview](subsys-application-framework-overview.md)** + +- **[Setting Up a Development Environment](subsys-application-framework-builden.md)** + +- **[Development Guidelines](subsys-application-framework-guide.md)** + +- **[Development Example](subsys-application-framework-demo.md)** + + diff --git a/en/device-dev/subsystems/appspawn-module.md b/en/device-dev/subsystems/subsys-boot-appspawn.md similarity index 100% rename from en/device-dev/subsystems/appspawn-module.md rename to en/device-dev/subsystems/subsys-boot-appspawn.md diff --git a/en/device-dev/subsystems/bootstrap-module.md b/en/device-dev/subsystems/subsys-boot-bootstrap.md similarity index 100% rename from en/device-dev/subsystems/bootstrap-module.md rename to en/device-dev/subsystems/subsys-boot-bootstrap.md diff --git a/en/device-dev/subsystems/faqs.md b/en/device-dev/subsystems/subsys-boot-faqs.md similarity index 95% rename from en/device-dev/subsystems/faqs.md rename to en/device-dev/subsystems/subsys-boot-faqs.md index f7acfe005f855c58ba12fd8bcb8cc8ae4a21e6de..25aa1270b4fb1352445d1e41a4569eb255c95cf1 100644 --- a/en/device-dev/subsystems/faqs.md +++ b/en/device-dev/subsystems/subsys-boot-faqs.md @@ -10,7 +10,7 @@ During system startup, the error message "\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format." is displayed, and the startup is interrupted, as shown in the following figure. -![](figures/en-us_image_0000001063839940.png) +![](figure/en-us_image_0000001063839940.png) **Cause** @@ -28,7 +28,7 @@ After the image burning is complete, the system keeps restarting. **Cause** -Each service started by the init process has the **importance** attribute, as described in Table 3 in [init Module](init-module.md). +Each service started by the init process has the **importance** attribute, as described in Table 3 in [init Module](subsys-boot-init.md). - If the attribute value is **0**, the init process does not need to restart the development board when the current service process exits. - If the attribute value is **1**, the init process needs to restart the development board when the current service process exits. diff --git a/en/device-dev/subsystems/init-module.md b/en/device-dev/subsystems/subsys-boot-init.md similarity index 100% rename from en/device-dev/subsystems/init-module.md rename to en/device-dev/subsystems/subsys-boot-init.md diff --git a/en/device-dev/subsystems/startup-10.md b/en/device-dev/subsystems/subsys-boot-overview.md similarity index 75% rename from en/device-dev/subsystems/startup-10.md rename to en/device-dev/subsystems/subsys-boot-overview.md index b6ef1916de1c9e9e7cdf903841ded765d0ce841a..77400377f93c5cbb3df8b79958bb6db53446ae72 100644 --- a/en/device-dev/subsystems/startup-10.md +++ b/en/device-dev/subsystems/subsys-boot-overview.md @@ -6,7 +6,7 @@ The startup subsystem provides the functions of starting key system processes af - init module - This module corresponds to the init process, which is the first user-space process started after the kernel is initialized. Upon startup, the init process reads and parses the configuration file **init.cfg**. Based on the parsing result, the init module executes the commands listed in Table 2 in [init Module](init-module.md) and starts the key system service processes in sequence with corresponding permissions granted. + This module corresponds to the init process, which is the first user-space process started after the kernel is initialized. Upon startup, the init process reads and parses the configuration file **init.cfg**. Based on the parsing result, the init module executes the commands listed in Table 2 in [init Module](subsys-boot-init.md) and starts the key system service processes in sequence with corresponding permissions granted. - appspawn module @@ -57,26 +57,6 @@ The directories of startup subsystem are applicable to different platforms.

Parameter

+ @@ -258,9 +274,9 @@ Starts the service process. - - -

Parameter

Description

Restarts the service process if it has started.

Return Value

+

Return Value

Description

+

Description

None

@@ -279,7 +295,7 @@ hdc\_std start The following commands are available: -- **tconn _host_\[:_port_\]\[-remove\]** +### tconn _host_\[:_port_\]\[-remove\] Connects to a device with a specified IP address and port number. @@ -320,7 +336,7 @@ Example: hdc\_std tconn 192.168.0.100:8710 -- **tmode usb** +### tmode usb Restarts the daemon process and connects to the device using USB. @@ -356,7 +372,7 @@ Example: hdc\_std tmode usb -- **tmode port _port-number_** +### tmode port _port-number_ Restarts the daemon process and connects to the device over TCP. @@ -392,14 +408,14 @@ Example: hdc\_std tmode port 8710 ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >After this command is executed, the remote daemon process exits and restarts, and the TCP connection is enabled by default. If you do not include **port-number** in this command, a random port will be used to connect to the device. ## File Commands The following commands are available: -- **file send _local remote_** +### file send _local remote_ Sends a file to a remote device. @@ -440,7 +456,7 @@ Example: hdc\_std file send E:\\a.txt /data/local/tmp/a.txt -- **file recv \[-a\] _remote local_** +### file recv \[-a\] _remote local_ Receives a file from a remote device. @@ -490,7 +506,7 @@ hdc\_std file recv /data/local/tmp/a.txt ./a.txt The following commands are available: -- **install \[-r/-d/-g\] _package_** +### install \[-r/-d/-g\] _package_ Installs the OpenHarmony application. @@ -519,7 +535,7 @@ Installs the OpenHarmony application.

-g

Dynamic permission granting

+

Grants permission dynamically

Return Value

@@ -537,11 +553,11 @@ Installs the OpenHarmony application.
-Examples: +Example: hdc\_std install _hwadmin.hap_ -- **uninstall \[-k\] _package_** +### uninstall \[-k\] _package_ Uninstalls the OpenHarmony application. @@ -586,7 +602,7 @@ hdc\_std uninstall _package_ The following commands are available: -- **hilog** +### hilog Obtains logs for debugging. @@ -620,7 +636,7 @@ Example: hdc\_std hilog -- **shell \[_command_\]** +### shell \[_command_\] Executes a command remotely or enters an interactive command environment. @@ -654,3 +670,37 @@ Examples: hdc\_std shell +## Troubleshooting + +### hdc\_std Fails to Connect to a Device + +- **Symptom** + + **\[Empty\]** is displayed in the output after the **hdc\_std list targets** command is executed. + +- **Solutions** + 1. The device cannot be identified. + + Check whether **HDC Device** exists in the universal serial bus device of the device manager. If **HDC Device** does not exist, the device cannot be connected. In this case, remove and then insert the device or burn the latest image for the device. + + 2. hdc\_std works improperly. + + Run the **hdc kill** or **hdc start -r** command to kill or restart the hdc service. Then, run the **hdc list targets** command to check whether device information can be obtained. + + 3. hdc\_std does not match the device. + + If the latest image is burnt on the device, the latest hdc\_std version must be used. As hdc\_std is updated continuously, obtain hdc\_std of the latest version from the **developtools\_hdc\_standard** repository in the **prebuilt** directory. + + + +## hdc\_std Fails to Run + +- **Symptom** + + The **hdc\_std.exe** file does not run after being clicked. + +- **Solutions** + + **hdc\_std.exe** requires no installation. It can be directly used on a disk or added to environment variables. Open the cmd window and run the **hdc\_std** command to use **hdc\_std.exe**. + + diff --git a/en/device-dev/subsystems/utils-overview.md b/en/device-dev/subsystems/oem_subsys_utils_des.md similarity index 100% rename from en/device-dev/subsystems/utils-overview.md rename to en/device-dev/subsystems/oem_subsys_utils_des.md diff --git a/en/device-dev/subsystems/utils-faq.md b/en/device-dev/subsystems/oem_subsys_utils_faq.md similarity index 100% rename from en/device-dev/subsystems/utils-faq.md rename to en/device-dev/subsystems/oem_subsys_utils_faq.md diff --git a/en/device-dev/subsystems/utils-development-guidelines.md b/en/device-dev/subsystems/oem_subsys_utils_guide.md similarity index 97% rename from en/device-dev/subsystems/utils-development-guidelines.md rename to en/device-dev/subsystems/oem_subsys_utils_guide.md index 3c93cc03c0e754686770e4862286f66fed3dbf31..48a566a1a921eb5f3a6fcaadbc2b47a852b0b2aa 100644 --- a/en/device-dev/subsystems/utils-development-guidelines.md +++ b/en/device-dev/subsystems/oem_subsys_utils_guide.md @@ -237,7 +237,7 @@ printf("UtilsDeleteValue delete ret = %d\n", ret); - Add resource files in the **res/drawable** directory based on the following directory structure. - ![](figures/unnaming.png) + ![](figure/unnaming.png) - Compress the **libLauncher.so**, **config.json**, and resource files into a ZIP package and change the file name extension to **.hap**, for example, **Launcher.hap**. @@ -264,7 +264,7 @@ printf("UtilsDeleteValue delete ret = %d\n", ret); ``` **Figure 1** Output of the system attribute dumping command for the LiteOS Cortex-M kernel - ![](figures/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel.png "output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel") + ![](figure/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel.png "output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-m-kernel") ### Dumping System Attributes on the Platform That Uses the LiteOS Cortex-A Kernel @@ -288,6 +288,6 @@ printf("UtilsDeleteValue delete ret = %d\n", ret); ``` **Figure 2** Output of the system attribute dumping command for the LiteOS Cortex-A kernel - ![](figures/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel.png "output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel") + ![](figure/output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel.png "output-of-the-system-attribute-dumping-command-for-the-liteos-cortex-a-kernel") diff --git a/en/device-dev/subsystems/public_sys-resources/icon-caution.gif b/en/device-dev/subsystems/public_sys-resources/icon-caution.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/en/device-dev/subsystems/public_sys-resources/icon-danger.gif b/en/device-dev/subsystems/public_sys-resources/icon-danger.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/en/device-dev/subsystems/public_sys-resources/icon-note.gif b/en/device-dev/subsystems/public_sys-resources/icon-note.gif deleted file mode 100644 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/en/device-dev/subsystems/public_sys-resources/icon-notice.gif b/en/device-dev/subsystems/public_sys-resources/icon-notice.gif deleted file mode 100644 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/en/device-dev/subsystems/public_sys-resources/icon-tip.gif b/en/device-dev/subsystems/public_sys-resources/icon-tip.gif deleted file mode 100644 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/en/device-dev/subsystems/public_sys-resources/icon-warning.gif b/en/device-dev/subsystems/public_sys-resources/icon-warning.gif deleted file mode 100644 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/en/device-dev/subsystems/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/en/device-dev/subsystems/r-d-tools.md b/en/device-dev/subsystems/r-d-tools.md deleted file mode 100644 index 03f6b950d21aabb40bae141a58f40f1c42793407..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/r-d-tools.md +++ /dev/null @@ -1,9 +0,0 @@ -# R&D Tools - -- **[bytrace Usage Guidelines](bytrace-usage-guidelines.md)** - -- **[hdc\_std Usage Guidelines](hdc_std-usage-guidelines.md)** - -- **[hdc\_std FAQs](hdc_std-faqs.md)** - - diff --git a/en/device-dev/subsystems/sensors.md b/en/device-dev/subsystems/sensors.md deleted file mode 100644 index 1cb5c1ea4ccc7754bf186c31d6d7e1e1fae063ad..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/sensors.md +++ /dev/null @@ -1,9 +0,0 @@ -# Sensors - -- **[Sensors Overview](sensors-overview.md)** - -- **[Sensors Usage Guidelines](sensors-usage-guidelines.md)** - -- **[Sensors Usage Example](sensors-usage-example.md)** - - diff --git a/en/device-dev/subsystems/startup.md b/en/device-dev/subsystems/startup.md deleted file mode 100644 index 5a2025350a8b09b4a2afd74af17e2dc4894efa53..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/startup.md +++ /dev/null @@ -1,17 +0,0 @@ -# Startup - -- **[Startup](startup-10.md)** - -- **[init Module](init-module.md)** - -- **[appspawn Module](appspawn-module.md)** - -- **[bootstrap Module](bootstrap-module.md)** - -- **[syspara Module](syspara-module.md)** - -- **[FAQs](faqs.md)** - -- **[Reference](reference.md)** - - diff --git a/en/device-dev/subsystems/kws-configuration-file.md b/en/device-dev/subsystems/subsys-aiframework-demo-conf.md similarity index 100% rename from en/device-dev/subsystems/kws-configuration-file.md rename to en/device-dev/subsystems/subsys-aiframework-demo-conf.md diff --git a/en/device-dev/subsystems/kws-plug-in.md b/en/device-dev/subsystems/subsys-aiframework-demo-plugin.md similarity index 100% rename from en/device-dev/subsystems/kws-plug-in.md rename to en/device-dev/subsystems/subsys-aiframework-demo-plugin.md diff --git a/en/device-dev/subsystems/kws-sdk.md b/en/device-dev/subsystems/subsys-aiframework-demo-sdk.md similarity index 98% rename from en/device-dev/subsystems/kws-sdk.md rename to en/device-dev/subsystems/subsys-aiframework-demo-sdk.md index 50cbbfb0fbf499e95455d7bda54292094b864a4b..969d35269f74b0a7efe86fd387d4fe066409d2b2 100644 --- a/en/device-dev/subsystems/kws-sdk.md +++ b/en/device-dev/subsystems/subsys-aiframework-demo-sdk.md @@ -75,7 +75,7 @@ The preceding code is the specific API implementation. The **create** function in the API of the KWS SDK calls the open **AieClientInit** and **AieClientPrepare** APIs provided by the client to connect to the server and load the algorithm model. For details, see the implementation of the **create** method in following sections. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >The sequence for the SDK to call client APIs: **AieClientInit** -\> **AieClientPrepare** -\> **AieClientSyncProcess** or **AieClientAsyncProcess** -\> **AieClientRelease** -\> **AieClientDestroy**. An exception will be thrown if the call sequence is violated. diff --git a/en/device-dev/subsystems/development-examples.md b/en/device-dev/subsystems/subsys-aiframework-demo.md similarity index 82% rename from en/device-dev/subsystems/development-examples.md rename to en/device-dev/subsystems/subsys-aiframework-demo.md index 8c5964da0133ad046694a091a19e95eaad409ed8..0dd54a375edf3ec101a6999dfd25d3f424c5cca4 100644 --- a/en/device-dev/subsystems/development-examples.md +++ b/en/device-dev/subsystems/subsys-aiframework-demo.md @@ -4,10 +4,10 @@ For your better understanding, a KWS application is used as an example to walk y This example uses a fixed keyword **Hi, xiaowen** for illustration. If the input audio contains **Hi, xiaowen**, the application prints **\[Hi, xiaowen\]**; otherwise, the application prints **\[UNKNOWN\]**. -- **[KWS SDK](kws-sdk.md)** +- **[KWS SDK](subsys-aiframework-demo-sdk.md)** -- **[KWS Plug-in](kws-plug-in.md)** +- **[KWS Plug-in](subsys-aiframework-demo-plugin.md)** -- **[KWS Configuration File](kws-configuration-file.md)** +- **[KWS Configuration File](subsys-aiframework-demo-conf.md)** diff --git a/en/device-dev/subsystems/configuration-file.md b/en/device-dev/subsystems/subsys-aiframework-devguide-conf.md similarity index 100% rename from en/device-dev/subsystems/configuration-file.md rename to en/device-dev/subsystems/subsys-aiframework-devguide-conf.md diff --git a/en/device-dev/subsystems/plug-in.md b/en/device-dev/subsystems/subsys-aiframework-devguide-plugin.md similarity index 100% rename from en/device-dev/subsystems/plug-in.md rename to en/device-dev/subsystems/subsys-aiframework-devguide-plugin.md diff --git a/en/device-dev/subsystems/sdk.md b/en/device-dev/subsystems/subsys-aiframework-devguide-sdk.md similarity index 98% rename from en/device-dev/subsystems/sdk.md rename to en/device-dev/subsystems/subsys-aiframework-devguide-sdk.md index 5cc0b855635d383e046ae6c117a8d28428406da3..f185750d0f6ffa1d1027b717e6b67acc9e1fd666 100644 --- a/en/device-dev/subsystems/sdk.md +++ b/en/device-dev/subsystems/subsys-aiframework-devguide-sdk.md @@ -126,8 +126,8 @@ The function of the SDK header file is implemented by mapping SDK API calls to c

long long clientVersion: Indicates client version number. This parameter is not used currently.

int clientId: Indicates the client ID.

int sessionId: Indicates the session ID.

-

uid_t serverUid: Indicates the server UID.

-

uid_t clientUid: Indicates the client UID.

+

uid_t serverUid: Indicates the UID of the server.

+

uid_t clientUid: Indicates the UID of the client.

int extendLen: Indicates the length of the extended information (extendMsg).

unsigned char *extendMsg: Indicates the body of the extended information.

- - - - - - - - - - - - -

Directory

-

Applicable Platform

-

base/startup/startup

-

Large-system devices (reference memory ≥ 1 GB)

-

base/startup/systemrestore

-

Large-system devices (reference memory ≥ 1 GB)

-
- - init module - After being burnt to the development board, the configuration file **init.cfg** changes to read-only. If you want to modify the file, you must repack and burn the rootfs image again. - The configuration file **init.cfg** must be in JSON format. diff --git a/en/device-dev/subsystems/reference.md b/en/device-dev/subsystems/subsys-boot-ref.md similarity index 100% rename from en/device-dev/subsystems/reference.md rename to en/device-dev/subsystems/subsys-boot-ref.md diff --git a/en/device-dev/subsystems/syspara-module.md b/en/device-dev/subsystems/subsys-boot-syspara.md similarity index 100% rename from en/device-dev/subsystems/syspara-module.md rename to en/device-dev/subsystems/subsys-boot-syspara.md diff --git a/en/device-dev/subsystems/subsys-boot.md b/en/device-dev/subsystems/subsys-boot.md new file mode 100644 index 0000000000000000000000000000000000000000..b8f465d360614689758d2a538638e51da9f70007 --- /dev/null +++ b/en/device-dev/subsystems/subsys-boot.md @@ -0,0 +1,17 @@ +# Startup + +- **[Startup](subsys-boot-overview.md)** + +- **[init Module](subsys-boot-init.md)** + +- **[appspawn Module](subsys-boot-appspawn.md)** + +- **[bootstrap Module](subsys-boot-bootstrap.md)** + +- **[syspara Module](subsys-boot-syspara.md)** + +- **[FAQs](subsys-boot-faqs.md)** + +- **[Reference](subsys-boot-ref.md)** + + diff --git a/en/device-dev/subsystems/subsys-build-mini-lite.md b/en/device-dev/subsystems/subsys-build-mini-lite.md new file mode 100644 index 0000000000000000000000000000000000000000..5d95a69ed431174a90a4c3c5451b845e349809f2 --- /dev/null +++ b/en/device-dev/subsystems/subsys-build-mini-lite.md @@ -0,0 +1,998 @@ +# Building Guidelines for Mini and Small Systems + +- [Overview](#section10958256161119) + - [Basic Concepts](#section1732301411128) + - [Directory Structure](#section1588744014121) + - [Build Process](#section15761735134) + +- [Configuration Rules](#section2345183962710) + - [Module](#section142532518308) + - [Chipset](#section121501451143710) + - [Product](#section134549283435) + +- [Usage Guidelines](#section13754457192211) + - [Prerequisites](#section31651120233) + - [Using hb](#section1133304172313) + - [Adding a Module](#section167110415315) + - [Adding a Chipset Solution](#section1474718565412) + - [Adding a Product Solution](#section1097623294220) + +- [Troubleshooting](#section19909721104319) + - [Invalid -- w Option](#section138233464318) + - [Library ncurses Not Found](#section151033911442) + - [mcopy not Found](#section19811838104418) + - [No riscv File or Directory](#section03111118451) + - [No Crypto](#section69981127125013) + - [Unexpected Operator](#section967617530505) + + +## Overview + +The Compilation and Building subsystem is a build framework that supports module-based OpenHarmony development using Generate Ninja \(GN\) and Ninja. You can use this subsystem to: + +- Assemble modules for a product and build the product. + +- Build chipset source code independently. +- Build a single module independently. + +### Basic Concepts + +Learn the following concepts before you start compilation and building: + +- Subsystem + + A subsystem is a logical concept. It consists of one or more modules. OpenHarmony is designed with a layered architecture, which consists of the kernel layer, system service layer, framework layer, and application layer from bottom to top. System functions are developed by the level of system, subsystem, and module. In a multi-device deployment scenario, you can customize subsystems and modules as required. + + +- Module + + A module is a reusable, configurable, and tailorable function unit. Each module has an independent directory, and multiple modules can be developed concurrently and built and tested independently. + +- **GN** + + Generate Ninja \(GN\) is used to generate Ninja files. + +- **Ninja** + + Ninja is a small high-speed build system. + +- **hb** + + hb is a command line tool for OpenHarmony to execute build commands. + + +### Directory Structure + +``` +build/lite +├── components # Module description file +├── figures # Figures in the readme file +├── hb # hb pip installation package +├── make_rootfs # Script used to create the file system image +├── config # Build configuration +│ ├── component # Module-related template definition +│ ├── kernel # Kernel-related build configuration +│ └── subsystem # Subsystem build configuration +├── platform # ld script +├── testfwk # Test build framework +└── toolchain # Build toolchain configuration, which contains the compiler directories, build options, and linking options +``` + +### **Build Process** + +[Figure 1](#fig9744112715161) shows the build process. + +**Figure 1** Build process +![](figure/build-process.jpg "build-process") + +1. Use **hb set **to set the OpenHarmony source code directory and the product to build. +2. Use **hb build** to build the product, development board, or module. The procedure is as follows: + - Read the **config.gni** file of the development board selected. The file contains the build toolchain, linking commands, and build options. + - Run the **gn gen** command to read the product configuration and generate the **out** directory and **ninja** files for the solution. + - Run **ninja -C out/board/product** to start the build. + - Package the build result, set the file attributes and permissions, and create a file system image. + + +## Configuration Rules + +To ensure that the chipset and product solutions are pluggable and decoupled from OpenHarmony, the paths, directory trees, and configuration of modules, chipset solutions, and product solutions must comply with the following rules: + +### **Module** + +The source code directory for a module is named in the _\{Domain\}/\{Subsystem\}/\{Module\}_ format. The module directory tree is as follows: + +>![](../public_sys-resources/icon-caution.gif) **CAUTION:** +>Define module attributes, such as the name, source code directory, function description, mandatory or not, build targets, RAM, ROM, build outputs, adapted kernels, configurable features, and dependencies, in the JSON file of the subsystem in the **build/lite/components** directory. When adding a module, add its definition to the JSON file of the corresponding subsystem. The module configured for a product must have been defined in a subsystem. Otherwise, the verification will fail. + +``` +component +├── interfaces +│ ├── innerkits # APIs exposed internally among modules +│ └── kits # App APIs provided for app developers +├── frameworks # Framework implementation +├── services # Service implementation +└── BUILD.gn # Build script +``` + +The following example shows how to define attributes of the sensor module of the pan-sensor subsystem: + +``` +{ + "components": [ + { + "component": "sensor_lite", # Module name + "description": "Sensor services", # Brief description of the module + "optional": "true", # Whether the module is mandatory for the system + "dirs": [ # Source code directory of the module + "base/sensors/sensor_lite" + ], + "targets": [ # Build entry of the module + "//base/sensors/sensor_lite/services:sensor_service" + ], + "rom": "92KB", # Module ROM + "ram": "~200KB", # Module RAM (estimated) + "output": [ "libsensor_frameworks.so" ], # Module build outputs + "adapted_kernel": [ "liteos_a" ], # Adapted kernel for the module + "features": [], # Configurable features of the module + "deps": { + "components": [ # Other modules on which the module depends + "samgr_lite", + "ipc_lite" + + ], + "third_party": [ # Open-source third-party software on which the module depends + "bounds_checking_function" + ] + } + } + ] +} +``` + +Observe the following rules when building the **BUILD.gn** module: + +- The build target name must be the same as the module name. +- Define the configurable features in the **BUILD.gn** file of the module. Name the configurable features in the **ohos\_**\{_subsystem_\}**\_**\{_module_\}**\_**\{_feature_\} format. Define the features in module description and configure them in the **config.json** file. +- Define macros in the **OHOS\_**\{_SUBSYSTEM_\}**\_**\{_MODULE_\}**\_**\{_FEATURE_\} format. + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >GN is used as the build script language for modules. For details about how to use GN, see the [GN Quick Start Guide](https://gn.googlesource.com/gn/+/master/docs/quick_start.md). In GN, a module is a build target, which can be a static library, a dynamic library, an executable file, or a group. + + +The following example shows how to build the **foundation/graphic/ui/BUILD.gn** file for a graphics UI module: + +``` + # Declare the configurable features of the module + declare_args() { + enable_ohos_graphic_ui_animator = false # Animation switch + ohos_ohos_graphic_ui_font = "vector" # Configurable font type, which can be vector or bitmap + } + + # Basic module functions + shared_library("base") { + sources = [ + ...... + ] + include_dirs = [ + ...... + ] + } + + # Build only when the animator is enabled + if(enable_ohos_graphic_ui_animator ) { + shared_library("animator") { + sources = [ + ...... + ] + include_dirs = [ + ...... + ] + deps = [ :base ] + } + } + ...... + # It is recommended that the target name be the same as the module name, which can be an executable .bin file, shared_library (.so file), static_library (.a file), or a group. + executable("ui") { + deps = [ + ":base" + ] + + # The animator feature is configured by the product. + if(enable_ohos_graphic_ui_animator ) { + deps += [ + "animator" + ] + } + } +``` + +### **Chipset** + +- The chipset solution is a complete solution based on a development board. The solution includes the drivers, API adaptation, and SDK. +- The chipset solution is a special module, whose source code directory is named in the _**device**/\{Chipset solution vendor\}/\{Development board\}_ format. +- The chipset solution module is built by default based on the development board selected by the product. + +The chipset solution directory tree is as follows: + +``` +device +└── company # Chipset solution vendor + └── board # Name of the development board + ├── BUILD.gn # Build script + ├── hals # Southbound APIs for OS adaptation + ├── linux # Linux kernel version (optional) + │ └── config.gni # Build options for the Linux version + └── liteos_a # LiteOS kernel version (optional) + └── config.gni # Build options for the LiteOS Cortex-A version +``` + +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>The **config.gni** file contains build-related configurations of the development board. The parameters in the file are globally visible to the system and can be used to build all OS modules during the build process. + +The **config.gni** file contains the following key parameters: + +``` +kernel_type: kernel used by the development board, for example, liteos_a, liteos_m, or linux. +kernel_version: kernel version used by the development board, for example, 4.19. +board_cpu: CPU of the development board, for example, cortex-a7 or riscv32. +board_arch: chipset architecture of the development board, for example, armv7-a or rv32imac. +board_toolchain: name of the customized build toolchain used by the development board, for example, gcc-arm-none-eabi. If this field is not specified, ohos-clang will be used by default. +board_toolchain_prefix: prefix of the build toolchain, for example, gcc-arm-none-eabi. +board_toolchain_type: build toolchain type, for example, gcc or clang. Currently, only GCC and clang are supported. +board_cflags: build options of the .c file configured for the development board. +board_cxx_flags: build options of the .cpp file configured for the development board. +board_ld_flags: link options configured for the development board. +``` + +### **Product** + +The product solution is a complete product based on a development board. It includes the OS adaptation, module assembly configuration, startup configuration, and file system configuration. The source code directory of a product solution is named in the **vendor**/\{_Product solution vendor_\}/\{_Product name_\} format. A product solution is also a special module. + +The product solution directory tree is as follows: + +``` +vendor +└── company # Product solution vendor + ├── product # Product name + │ ├── init_configs + │ │ ├── etc # Startup configuration of the init process (only required for the Linux kernel) + │ │ └── init.cfg # System service startup configuration + │ ├── hals # OS adaptation + │ ├── BUILD.gn # Product build script + │ └── config.json # Product configuration file + │ └── fs.yml # File system packaging configuration + └── ...... +``` + +>![](../public_sys-resources/icon-caution.gif) **CAUTION:** +>Create directories and files based on the preceding rules for new products. The Compilation and Building subsystem scans the configured products based on the rules. + +The key directories and files are described as follows: + +1. **vendor/company/product/init\_configs/etc** + + This folder contains the **rcS**, **S**_xxx_, and **fstab** scripts. The **init** process runs the **rcS**, **fstab**, and **S**_00_-_xxx_ scripts in sequence before starting system services. The **S**_xxx_ script contains content related to the development board and product. It is used to create device nodes and directories, scan device nodes, and change file permissions. These scripts are copied from the **BUILD.gn** file to the **out** directory of the product as required and packaged into the **rootfs** image. + +2. **vendor/company/product/init\_configs/init.cfg** + + This file is the configuration file for the **init** process to start services. Currently, the following commands are supported: + + - **start**: starts a service. + - **mkdir**: creates a folder. + - **chmod**: changes the permission on a specified directory or file. + - **chown**: changes the owner group of a specified directory or file. + - **mount**: mounts a device. + + The fields in the file are described as follows: + + ``` + { + "jobs" : [{ # Job array. A job corresponds to a command set. Jobs are executed in the following sequence: pre-init > init > post-init. + "name" : "pre-init", + "cmds" : [ + "mkdir /storage/data", # Create a directory. + "chmod 0755 /storage/data", # Change the permission, which is in 0xxx format, for example, 0755. + "mkdir /storage/data/log", + "chmod 0755 /storage/data/log", + "chown 4 4 /storage/data/log", # Change the owner group. The first number indicates the UID, and the second indicates the GID. + ...... + "mount vfat /dev/mmcblock0 /sdcard rw, umask=000" # The command is in the mount [File system type][source] [target] [flags] [data] format. + # Currently, flags can only be nodev, noexec, nosuid, or rdonly. + ] + }, { + "name" : "init", + "cmds" : [ # Start services based on the sequence of the cmds array. + "start shell", # Note that there is only one space between start and the service name. + ...... + "start service1" + ] + }, { + "name" : "post-init", # Job that is finally executed. Operations performed after the init process is started, for example, mounting a device after the driver initialization. + "cmds" : [] + } + ], + "services" : [{ # Service array. A service corresponds to a process. + "name" : "shell", # Service name + "path" : ["/sbin/getty", "-n", "-l", "/bin/sh", "-L", "115200", "ttyS000", "vt100"], # Full path of the executable file. It must start with "path". + "uid" : 0, # Process UID, which must be the same as that in the binary file. + "gid" : 0, # Process GID, which must be the same as that in the binary file. + "once" : 0, # Whether the process is a one-off process. 1: The proces is a one-off process. The init process does not restart it after the process exits. 0: The process is not a one-off process. The init process restarts it if the process exits. + "importance" : 0, # Whether the process is a key process. 1: The process is a key process. If it exits, the init process restarts the board. 0: The process is not a key process. If it exits, the init process does not restart the board. + "caps" : [4294967295] + }, + ...... + ] + } + ``` + +3. **vendor/company/product/init\_configs/hals** + + This file stores the content related to OS adaptation of the product. For details about APIs for implementing OS adaptation, see the readme file of each module. + +4. **vendor/company/product/config.json** + + The **config.json** file is the main entry for the build and contains configurations of the development board, OS modules, and kernel. + + The following example shows the **config.json** file of the IP camera developed based on the hispark\_taurus development board: + + ``` + { + "product_name": "ipcamera", # Product name + "ohos_version": "OpenHarmony 1.0", # OS version + "device_company": "hisilicon", # Chipset vendor + "board": "hispark_taurus", # Name of the development board + "kernel_type": "liteos_a", # Kernel type + "kernel_version": "3.0.0", # Kernel version + "subsystems": [ + { + "subsystem": "aafwk", # Subsystem + "components": [ + { "component": "ability", "features":[ "enable_ohos_appexecfwk_feature_ability = true" ] } # Module and its features + ] + }, + { + ...... + } + ...... + More subsystems and modules + } + } + ``` + +5. **vendor/company/product/fs.yml** + + This file packages the build result to create a configuration file system image, for example, **rootfs.img** \(user-space root file system\) and **userfs.img** \(readable and writable file\). It consists of multiple lists, and each list corresponds to a file system. The fields are described as follows: + + ``` + fs_dir_name: (Mandatory) declares the name of the file system, for example, rootfs or userfs. + fs_dirs: (Optional) configures the mapping between the file directory in the out directory and the system file directory. Each file directory corresponds to a list. + source_dir: (Optional) specifies the target file directory in the out directory. If this field is missing, an empty directory will be created in the file system based on target_dir. + target_dir: (Mandatory) specifies the corresponding file directory in the file system. + ignore_files: (Optional) declares ignored files during the copy operation. + dir_mode: (Optional) specifies the file directory permission, which is set to 755 by default. + file_mode: (Optional) declares permissions of all files in the directory, which is set to 555 by default. + fs_filemode: (Optional) configures files that require special permissions. Each file corresponds to a list. + file_dir: (Mandatory) specifies the detailed file path in the file system. + file_mode: (Mandatory) declares file permissions. + fs_symlink: (Optional) configures the soft link of the file system. + fs_make_cmd: (Mandatory) creates the file system script. The script provided by the OS is stored in the build/lite/make_rootfs directory. Linux, LiteOS, ext4, jffs2, and vfat are supported. Chipset vendors can also customize the script as required. + fs_attr: (Optional) dynamically adjusts the file system based on configuration items. + ``` + + The **fs\_symlink** and **fs\_make\_cmd** fields support the following variables: + + - $\{root\_path\} + + Code root directory, which corresponds to **$\{ohos\_root\_path\}** of GN + + - $\{out\_path\} + + **out** directory of the product, which corresponds to **$\{root\_out\_dir\}** of GN + + - $\{fs\_dir\} + + File system directory, which consists of the following variables + + - $\{root\_path\} + - $\{fs\_dir\_name\} + + + >![](../public_sys-resources/icon-note.gif) **NOTE:** + >**fs.yml** is optional and does not need to be configured for devices without a file system. + +6. **vendor/company/product/BUILD.gn** + + This file is the entry for building the source code of the solution vendor and copying the startup configuration file. The **BUILD.gn** file in the corresponding product directory will be built by default if a product is selected. The following example shows how to build the **BUILD.gn** file of a product: + + ``` + group("product") { # The target name must be the same as the product name (level-3 directory name under the product directory). + deps = [] + # Copy the init configuration. + deps += [ "init_configs" ] + # Others + ...... + } + ``` + + +## Usage Guidelines + +### Prerequisites + +The development environment has GN, Ninja, Python 3.7.4 or later, and hb available. For details about installation methods, see [Environment Setup](../quick-start/quickstart-lite-env-setup.md). + +### Using hb + +**hb** is a command line tool for OpenHarmony to execute build commands. Common hb commands are described as follows: + +**hb set** + +``` +hb set -h +usage: hb set [-h] [-root [ROOT_PATH]] [-p] + +optional arguments: + -h, --help show this help message and exit + -root [ROOT_PATH], --root_path [ROOT_PATH] + Set OHOS root path + -p, --product Set OHOS board and kernel +``` + +- **hb set** \(without argument\): starts the default setting process. +- **hb set -root** _dir_: sets the root directory of the code. +- **hb set -p**: sets the product to build. + +**hb env** + +Displays the current configuration. + +``` +hb env +[OHOS INFO] root path: xxx +[OHOS INFO] board: hispark_taurus +[OHOS INFO] kernel: liteos +[OHOS INFO] product: ipcamera +[OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera +[OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19 +``` + +**hb build** + +``` +hb build -h +usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] + [--dmverity] [--tee] [-p PRODUCT] [-f] [-n] + [-T [TARGET [TARGET ...]]] [-v] [-shs] [--patch] + [component [component ...]] + +positional arguments: + component name of the component + +optional arguments: + -h, --help show this help message and exit + -b BUILD_TYPE, --build_type BUILD_TYPE + release or debug version + -c COMPILER, --compiler COMPILER + specify compiler + -t [TEST [TEST ...]], --test [TEST [TEST ...]] + compile test suit + --dmverity Enable dmverity + --tee Enable tee + -p PRODUCT, --product PRODUCT + build a specified product with + {product_name}@{company}, eg: camera@huawei + -f, --full full code compilation + -n, --ndk compile ndk + -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] + Compile single target + -v, --verbose show all command lines while building + -shs, --sign_haps_by_server + sign haps by server + --patch apply product patch before compiling + + --dmverity Enable dmverity + -p PRODUCT, --product PRODUCT + build a specified product with + {product_name}@{company}, eg: ipcamera@hisilcon + -f, --full full code compilation + -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] + Compile single target +``` + +- **hb build** \(without argument\): builds the code based on the configured code directory, product, and options. The **-f** option deletes all products to be built, which is equivalent to running **hb clean** and **hb build**. +- **hb build** _\{module\_name\}_: builds a product module separately based on the development board and kernel set for the product, for example, **hb build kv\_store**. +- **hb build -p ipcamera@hisilicon**: skips the **set** step and builds the product directly. +- You can run **hb build** in **device/device\_company/board** to select the kernel and start the build based on the current development board and the selected kernel to generate an image that contains the kernel and driver only. + +**hb clean** + +You can run **hb clean** to clear the build result of the product in the **out** directory and retain the **args.gn** and **build.log** files only. To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean out/xxx/xxx**. + +``` +hb clean +usage: hb clean [-h] [out_path] + +positional arguments: + out_path clean a specified path. + +optional arguments: + -h, --help show this help message and exit +``` + +### Adding a Module + +To add a module, determine the subsystem to which the module belongs and the module name, and then perform the following steps: + +1. Add the module build script after the source code development is complete. + + The following example adds the **BUILD.gn** script \(stored in the **applications/sample/hello\_world** directory\) to build the **hello\_world** module \(as an executable file\). + + ``` + executable("hello_world") { + include_dirs = [ + "include", + ] + sources = [ + "src/hello_world.c" + ] + } + ``` + + The above script is used to build **hello\_world** that can run on OpenHarmony. + + To build the preceding module separately, select a product via the **hb set** command and run the **-T** command. + + ``` + hb build -f -T //applications/sample/hello_world + ``` + + After the module functions are verified on the development board, perform steps [2 to 4](#li11471037297) to configure the module to the product. + +2. Add module description. + + The module description is stored in the **build/lite/components** directory. New modules must be added to the JSON file of the corresponding subsystem. The module description must contain the following fields: + + - **module**: name of the module + - **description**: brief description of the module + - **optional**: whether the module is optional + - **dirs**: source code directory of the module + - **targets**: module build entry + + For example, to add the **hello\_world** module to the application subsystem, add the **hello\_world** object to the **applications.json** file. + + ``` + { + "components": [ + { + "component": "hello_world", + "description": "Hello world.", + "optional": "true", + "dirs": [ + "applications/sample/hello_world" + ], + "targets": [ + "//applications/sample/hello_world" + ] + }, + ... + ] + } + ``` + +3. Configure the module for the product. + + The **config.json** file is stored in the **vendor/company/product/** directory. The file must contain the product name, OpenHarmony version, device vendor, development board, kernel type, kernel version, and the subsystem and module to configure. The following example adds the **hello\_world** module to the **my\_product.json** configuration file: + + ``` + { + "product_name": "hello_world_test", + "ohos_version": "OpenHarmony 1.0", + "device_company": "hisilicon", + "board": "hispark_taurus", + "kernel_type": "liteos_a", + "kernel_version": "1.0.0", + "subsystems": [ + { + "subsystem": "applications", + "components": [ + { "component": "hello_world", "features":[] } + ] + }, + ... + ] + } + ``` + +4. Build the product. + + 1. Run the **hb set** command in the root code directory and select the product. + + 2. Run the **hb build** command. + + +### Adding a Chipset Solution + +The following uses the RTL8720 development board provided by Realtek as an example. To a chipset solution, perform the following steps: + +1. Create a directory for the chipset solution. + + To create a directory based on [1-Configuration Rules for Modules, Chipset Solutions, and Product Solutions](#section1625463413327), run the following command in the root code directory: + + ``` + mkdir -p device/realtek/rtl8720 + ``` + +2. Create a directory for kernel adaptation and build the **config.gni** file of the development board. + + For example, to adapt the LiteOS Cortex-M kernel to the RTL8720 development board, configure the **device/realtek/rtl8720/liteos\_a/config.gni** file as follows: + + ``` + # Kernel type, e.g. "linux", "liteos_a", "liteos_m". + kernel_type = "liteos_a" + + # Kernel version. + kernel_version = "3.0.0" + + # Board CPU type, e.g. "cortex-a7", "riscv32". + board_cpu = "real-m300" + + # Board arch, e.g. "armv7-a", "rv32imac". + board_arch = "" + + # Toolchain name used for system compiling. + # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. + # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. + board_toolchain = "gcc-arm-none-eabi" + + # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. + board_toolchain_path = + rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin", + root_build_dir) + + # Compiler prefix. + board_toolchain_prefix = "gcc-arm-none-eabi-" + + # Compiler type, "gcc" or "clang". + board_toolchain_type = "gcc" + + # Board related common compile flags. + board_cflags = [] + board_cxx_flags = [] + board_ld_flags = [] + ``` + +3. Build the script. + + Create the **BUILD.gn** file in the development board directory. The target name must be the same as that of the development board. The content in the **device/realtek/rtl8720/BUILD.gn** file is configured as follows: + + ``` + group("rtl8720") { # The target can be shared_library, static_library, or an executable file. + # Content + ...... + } + ``` + +4. Build the chipset solution. + + Run the **hb build** command in the development board directory to start the build. + + +### Adding a Product Solution + +You can use the Compilation and Building subsystem to customize product solutions by assembling chipset solutions and modules. The procedure is as follows: + +1. Create a product directory. + + The following uses the Wi-Fi IoT module on the RTL8720 development board as an example. Run the following command in the root code directory to create a product directory based on [1-Configuration Rules for Modules, Chipset Solutions, and Product Solutions](#section1625463413327): + + ``` + mkdir -p vendor/my_company/wifiiot + ``` + +2. Assemble the product. + + Create the **config.json** file in the product directory. The **vendor/my\_company/wifiiot/config.json** file is as follows: + + ``` + { + "product_name": "wifiiot", # Product name + "ohos_version": "OpenHarmony 1.0", # OS version + "device_company": "realtek", # Name of the chipset solution vendor + "board": "rtl8720", # Name of the development board + "kernel_type": "liteos_m", # Kernel type + "kernel_version": "3.0.0", # Kernel version + "subsystems": [ + { + "subsystem": "kernel", # Subsystem + "components": [ + { "component": "liteos_m", "features":[] } # Module and its features + ] + }, + ... + { + More subsystems and modules + } + ] + } + ``` + + Before the build, the Compilation and Building subsystem checks the validity of fields, including **device\_company**, **board**, **kernel\_type**, **kernel\_version**, **subsystem**, and **component**. The **device\_company**, **board**, **kernel\_type**, and **kernel\_version** fields must match the current chipset solution, and **subsystem** and **component** must match the module description in the **build/lite/components** file. + +3. Implement adaptation to OS APIs. + + Create the **hals** directory in the product directory and store the source code as well as the build script for OS adaptation in this directory. + +4. Configure the system service. + + Create the **init\_configs** directory in the product directory and then the **init.cfg** file in the newly created directory. Configure the system service to be started. + +5. \(Optional\) Configure the init process only for the Linux kernel. + + Create the **etc** directory in the **init\_configs** directory, and then the **init.d** folder and the **fstab** file in the newly created directory. Then, create the **rcS** and **S**_xxx_ files in the **init.d** file and edit them based on product requirements. + +6. \(Optional\) Configure the file system image only for the development board that supports the file system. + + Create the **fs.yml** file in the product directory and configure it as required. A typical **fs.yml** file is as follows: + + ``` + - + fs_dir_name: rootfs # Image name + fs_dirs: + - + # Copy the files in the out/my_board/my_product/bin directory to the rootfs/bin directory and ignore the .bin files related to testing. + source_dir: bin + target_dir: bin + ignore_files: + - Test.bin + - TestSuite.bin + - + # Copy the files in the out/my_board/my_product/libs directory to the rootfs/lib directory, ignore all .a files, and set the file permissions to 644 and folder permissions 755. + source_dir: libs + target_dir: lib + ignore_files: + - .a + dir_mode: 755 + file_mode: 644 + - + source_dir: usr/lib + target_dir: usr/lib + ignore_files: + - .a + dir_mode: 755 + file_mode: 644 + - + source_dir: config + target_dir: etc + - + source_dir: system + target_dir: system + - + source_dir: sbin + target_dir: sbin + - + source_dir: usr/bin + target_dir: usr/bin + - + source_dir: usr/sbin + target_dir: usr/sbin + - + # Create an empty proc directory. + target_dir: proc + - + target_dir: mnt + - + target_dir: opt + - + target_dir: tmp + - + target_dir: var + - + target_dir: sys + - + source_dir: etc + target_dir: etc + - + source_dir: vendor + target_dir: vendor + - + target_dir: storage + + fs_filemode: + - + file_dir: lib/ld-uClibc-0.9.33.2.so + file_mode: 555 + - + file_dir: lib/ld-2.24.so + file_mode: 555 + - + file_dir: etc/init.cfg + file_mode: 400 + fs_symlink: + - + # Create the soft link ld-musl-arm.so.1 -> libc.so in the rootfs/lib directory. + source: libc.so + link_name: ${fs_dir}/lib/ld-musl-arm.so.1 + - + source: mksh + link_name: ${fs_dir}/bin/sh + - + source: mksh + link_name: ${fs_dir}/bin/shell + fs_make_cmd: + # Create an ext4 image for the rootfs directory using the script. + - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 + - + fs_dir_name: userfs + fs_dirs: + - + source_dir: storage/etc + target_dir: etc + - + source_dir: data + target_dir: data + fs_make_cmd: + - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 + + ``` + +7. \(Optional\) Configure patches if the product and modules need to be patched. + + Create the **patch.yml** file in the product directory and configure it as required. A typical **patch.yml** file is as follows: + + ``` + # Directory in which the patch is to be installed + foundation/communication/dsoftbus: + # Directory in which the patch is stored + - foundation/communication/dsoftbus/1.patch + - foundation/communication/dsoftbus/2.patch + third_party/wpa_supplicant: + - third_party/wpa_supplicant/1.patch + - third_party/wpa_supplicant/2.patch + - third_party/wpa_supplicant/3.patch + ... + ``` + + If you add **--patch** when running the **hb build** command, the patch file can be added to the specified directory before the build. + + ``` + hb build -f --patch + ``` + +8. Build the script. + + Create the **BUILD.gn** file in the product directory and write the script. The following **BUILD.gn** file uses the Wi-Fi IoT module in [1](#li1970321162111) as an example: + + ``` + group("wifiiot") { # The target name must be the same as the product name. + deps = [] + # Copy the init configuration. + deps += [ "init_configs" ] + # Build the hals directory. + deps += [ "hals" ] + # Others + ...... + } + ``` + +9. Build the product. + + Run the **hb set** command in the code root directory, select the new product as prompted, and run the **hb build** command. + + +## Troubleshooting + +### Invalid -- w Option + +- **Symptom** + + The build fails, and "usr/sbin/ninja: invalid option -- w" is displayed. + +- **Cause** + + The Ninja version in the build environment is outdated and does not support the **--w** option. + +- **Solution** + + Uninstall Ninja and GN and follow the instructions provided in [IDE](../get-code/gettools-ide.md) to install Ninja and GN of the required version. + + +### Library ncurses Not Found + +- **Symptom** + + The build fails, and "/usr/bin/ld: cannot find -lncurses" is displayed. + +- **Cause** + + The ncurses library is not installed. + +- **Solution** + + ``` + sudo apt-get install lib32ncurses5-dev + ``` + + +### mcopy not Found + +- **Symptom** + + The build fails, and "line 77: mcopy: command not found" is displayed. + +- **Cause** + + mcopy is not installed. + +- **Solution** + + ``` + ​sudo apt-get install dosfstools mtools + ``` + + +### No riscv File or Directory + +- **Symptom** + + The build fails, and the following information is displayed: + + riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory. + +- **Cause** + + Permission is required to access files in the **riscv** compiler directory. + +- **Solution** + + Run the following command to query the directory where **gcc\_riscv32** is located: + + ``` + which riscv32-unknown-elf-gcc + ``` + + Run the **chmod** command to change the directory permission to **755**. + + +### No Crypto + +- **Symptom** + + The build fails, and "No module named 'Crypto'" is displayed. + +- **Cause** + + Crypto is not installed in Python 3. + +- **Solution** + 1. Run the following command to query the Python version: + + ``` + python3 --version + ``` + + 2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome: + + ``` + sudo pip3 install pycryptodome + ``` + + + +### Unexpected Operator + +- **Symptom** + + The build fails, and "xx.sh \[: xx unexpected operator" is displayed. + +- **Cause** + + The build environment is shell, not bash. + +- **Solution** + + ``` + sudo rm -rf /bin/sh + sudo ln -s /bin/bash /bin/sh + ``` + + diff --git a/en/device-dev/subsystems/compilation-and-building-guidelines-1.md b/en/device-dev/subsystems/subsys-build-standard-large.md similarity index 58% rename from en/device-dev/subsystems/compilation-and-building-guidelines-1.md rename to en/device-dev/subsystems/subsys-build-standard-large.md index eddc2c96aaefe399e0c46c7d47eb3810ab59f67a..e1a47c1b1329e7efcf2947b9018ae202e3dd50f1 100644 --- a/en/device-dev/subsystems/compilation-and-building-guidelines-1.md +++ b/en/device-dev/subsystems/subsys-build-standard-large.md @@ -1,18 +1,81 @@ -# Compilation and Building Guidelines +# Building Guidelines for Standard Systems -- [Directory Structure](#section56731811102915) -- [Building](#section1069873833818) - - [Build Command](#section2740182614395) +- [Overview](#section17466112012244) + - [Basic Concepts](#section445513507246) + - [Working Principles](#section12541217142510) + - [Limitations and Constraints](#section886933762513) -- [How to Develop](#section4207112818418) +- [Compilation and Building Guidelines](#section16901215262) + - [Directory Structure](#section109065332264) + - [Build Command](#section123265539266) + - [How to Develop](#section591084422719) -## Directory Structure + +## Overview + +The compilation and building subsystem provides a framework based on Generate Ninja \(GN\) and Ninja. This subsystem allows you to: + +- Build products based on different chipset platforms, for example, Hi3516D V300. + +- Package capabilities required by a product by assembling modules based on the product configuration. + +### Basic Concepts + +It is considered best practice to learn the following basic concepts before you start building: + +- **Platform** + + A platform is a combination of development boards and kernels. + + Supported subsystems and modules vary according to the platform. + +- **Subsystems** + + OpenHarmony is designed with a layered architecture, which from bottom to top consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to module. In a multi-device deployment scenario, unnecessary subsystems and modules can be excluded from the system as required. A subsystem is a logical concept and is a flexible combination of functions. + +- **Module** + + A module is a reusable software binary unit that contains source code, configuration files, resource files, and build scripts. A module can be built independently, integrated in binary mode, and then tested independently. + +- **GN** + + GN is short for Generate Ninja, which is used to generate Ninja files. + +- **Ninja** + + Ninja is a small high-speed build system. + + +### Working Principles + +The process to build OpenHarmony is as follows: + +- Parsing commands: Parse the name of the product to build and load related configurations. +- Running GN: Configure toolchains and global options based on the parsed product name and compilation type. +- Running Ninja: Start building and generate a product distribution. + +### Limitations and Constraints + +- You must download the source code using method 3 described in [Source Code Acquisition](../get-code/sourcecode-acquire.md). +- The build environment must be Ubuntu 18.04 or later. +- You must install the software package required for build. + + The installation command is as follows: + + ``` + sudo apt-get install binutils git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 + ``` + + +## Compilation and Building Guidelines + +### Directory Structure ``` /build # Primary directory ├── config # Build configuration items ├── core -│ └── gn # Build entry configuration +│ └── gn # Build entry BUILD.gn configuration ├── loader # Loader of module configuration, which also generates a template for the module ├── ohos # Configuration of the process for building and packaging OpenHarmony │ ├── kits # Build and packaging templates and processing flow for kits @@ -27,9 +90,7 @@ └── toolchain # Toolchain configuration ``` -## Building - -### Build Command +### Build Command - Run the following command in the root directory of the source code to build the full distribution: @@ -51,13 +112,13 @@ ``` -## How to Develop +### How to Develop 1. Add a module. The following steps use a custom module as an example to describe how to build the module, including build a library, an executable file, and a configuration file. - The example module **partA** consists of **feature1**, **feature2**, and **feature3**. The target of **feature1** is a dynamic library, that of **feature2** is an executable file, and that of **feature3** is an etc configuration file. + The example module **partA** consists of **feature1**, **feature2**, and **feature3**. The target is a dynamic library for **feature1**, an executable file for **feature2**, and an etc configuration file for **feature3**. Add **partA** to a subsystem, for example, **subsystem\_examples** \(defined in the **test/examples/** directory\). @@ -127,7 +188,7 @@ } ``` - Example 4: Adding the module configuration file **test/examples/ohos.build** to the **ohos.build** file of this subsystem. Each subsystem has an **ohos.build** file in its root directory. + Example 4: Adding the module configuration file **test/examples/ohos.build** to the **ohos.build** file of this subsystem. Each subsystem has an **ohos.build** file in its root directory. Example: ``` "partA": { @@ -157,9 +218,11 @@ 2. Add the module to the product configuration file. - Add **"subsystem\_examples:partA"** to the configuration file **productdefine/common/products/\{product-name\}.json** to build and package **partA** into the distribution. + Add the module to the product configuration file **productdefine/common/products/\{product-name\}.json**. + + Add "subsystem\_examples:partA" to the product configuration file. **partA** will be built and packaged into the distribution. -3. Build the module, including the library, executable file, and etc configuration file. +3. Build the module. For example, run the following command to build Hi3516D V300: @@ -169,6 +232,6 @@ 4. Obtain the build result. - Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. + Files generated during the build process are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. diff --git a/en/device-dev/subsystems/subsys-build.md b/en/device-dev/subsystems/subsys-build.md new file mode 100644 index 0000000000000000000000000000000000000000..8af635290fe343c07c8da6e6d902a1218ed5207f --- /dev/null +++ b/en/device-dev/subsystems/subsys-build.md @@ -0,0 +1,7 @@ +# Compilation and Building + +- **[Building Guidelines for Mini and Small Systems](subsys-build-mini-lite.md)** + +- **[Building Guidelines for Standard Systems](subsys-build-standard-large.md)** + + diff --git a/en/device-dev/subsystems/development-guidelines-on-hilog_lite.md b/en/device-dev/subsystems/subsys-dfx-hilog-lite.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-hilog_lite.md rename to en/device-dev/subsystems/subsys-dfx-hilog-lite.md diff --git a/en/device-dev/subsystems/development-guidelines-on-hilog.md b/en/device-dev/subsystems/subsys-dfx-hilog-rich.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-hilog.md rename to en/device-dev/subsystems/subsys-dfx-hilog-rich.md diff --git a/en/device-dev/subsystems/development-guidelines-on-hisysevent.md b/en/device-dev/subsystems/subsys-dfx-hisysevent.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-hisysevent.md rename to en/device-dev/subsystems/subsys-dfx-hisysevent.md diff --git a/en/device-dev/subsystems/subsys-dfx-hisyseventread.md b/en/device-dev/subsystems/subsys-dfx-hisyseventread.md new file mode 100644 index 0000000000000000000000000000000000000000..bd59a05b8727eb3b84857d700c04bdf98cb46bbe --- /dev/null +++ b/en/device-dev/subsystems/subsys-dfx-hisyseventread.md @@ -0,0 +1,103 @@ +# HiSysEvent订阅指导 + +- [概述](#section315316685112) +- [接口说明](#section0342191810519) +- [开发实例](#section123181432175110) + +## 概述 + +The HiSysEvent provides the cross-process subscription mechanism. You can register the subscription interface. + +## 接口说明 + +**Table 1** HiSysEvent订阅接口 + + + + + + + + + + + + + +

接口名

+

描述

+

int ISysEventService::AddListener(in SysEventRule[] rules, in ISysEventCallback callback)

+

接口功能:订阅HiSysEvent事件。

+

输入参数:

+
  • rules:事件订阅规则
  • callback:订阅回调对象
+

返回值:

+
  • 0:订阅成功,重复订阅
  • 1:订阅成功,初次订阅
  • 其他返回值:订阅失败
+

void ISysEventCallback::Handle(in String domain, in String eventName, in int eventType, in String eventDetail)

+

接口功能:订阅事件的回调接口。

+

输入参数:

+
  • domain:事件所属领域
  • eventName:事件的名称
  • eventType:事件类型
  • eventDetail:包含事件相关信息的字符串,以json的形式体现
+

返回值:无。

+
+ +**Table 2** SysEventRule订阅规则对象 + + + + + + + + + + + + + + + + +

属性名称

+

描述

+

uint32_t ruleType

+

规则类型(匹配范围包括domain以及eventName):

+
  • 1:全字符匹配
  • 2:前缀匹配
  • 3:正则表达式匹配
  • 其他值:无效的匹配方式
+

std::string domain;

+
  • domain:事件所属领域,如果传入的是空字符串,则默认事件领域字段匹配成功
+

std::string eventName

+
  • eventName:事件的名称,如果传入的是空字符串,则默认事件名称字段匹配成功
+
+ +## 开发实例 + +1. 源代码开发: + + 引入对应的aidl文件,包括:ISysEventService.aidl、SysEventRule.aidl、ISysEventCallback.aidl。 + + 在相应的业务逻辑里面调用ISysEventService::AddListener\(in SysEventRule\[\] rules, in ISysEventCallback callback\)接口。 + + 实现对应的回调对象: + + ISysEventCallback::Handle\(in String domain, in String eventName, in int eventType, in String eventDetail\) + + +1. 源代码开发: + + 引入对应的aidl文件,包括:ISysEventService.aidl、SysEventRule.aidl、ISysEventCallback.aidl。 + + 在相应的业务逻辑里面调用ISysEventService::AddListener\(in SysEventRule\[\] rules, in ISysEventCallback callback\)接口。 + + 实现对应的回调对象: + + ISysEventCallback::Handle\(in String domain, in String eventName, in int eventType, in String eventDetail\) + +2. 编译设置: + +在编译子系统里面,需要依赖libbinder模块 + +aosp\_deps = \[ "shared\_library:libbinder", \] + +- **[bytrace Usage Guidelines](subsys-toolchain-bytrace-guide.md)** + +- **[hdc\_std Usage Guidelines](oem_subsys_toolchain_hdc_guide.md)** + + diff --git a/en/device-dev/subsystems/dfx-11.md b/en/device-dev/subsystems/subsys-dfx-overview.md similarity index 92% rename from en/device-dev/subsystems/dfx-11.md rename to en/device-dev/subsystems/subsys-dfx-overview.md index faf8b0d8fa8e4c39a1548d7a7e77b6eb6906bd95..b7bfac023a5bf84628ceb40723a9ed2e62dbb892 100644 --- a/en/device-dev/subsystems/dfx-11.md +++ b/en/device-dev/subsystems/subsys-dfx-overview.md @@ -6,7 +6,7 @@ The DFX subsystem provides the following functions: -- HiLog: Implements the logging function. It is applicable to Mini-System Devices \(reference memory ≥ 128 KB\), Small-System Devices \(reference memory ≥ 1 MB\), and Standard-System Devices \(reference memory ≥ 128 MB\). +- HiLog: Implements the logging function. It is applicable to Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\) as well as Standard-System Devices \(reference memory ≥ 128 MB\). - HiSysEvent: Implements system event logging. It is applicable to Standard-System Devices \(reference memory ≥ 128 MB\). diff --git a/en/device-dev/subsystems/subsys-dfx.md b/en/device-dev/subsystems/subsys-dfx.md new file mode 100644 index 0000000000000000000000000000000000000000..88a1a79938cf22e2d9c343ebedb42897934a1b64 --- /dev/null +++ b/en/device-dev/subsystems/subsys-dfx.md @@ -0,0 +1,11 @@ +# DFX + +- **[DFX](subsys-dfx-overview.md)** + +- **[Development Guidelines on HiLog](subsys-dfx-hilog-rich.md)** + +- **[Development Guidelines on HiLog\_Lite](subsys-dfx-hilog-lite.md)** + +- **[Development Guidelines on HiSysEvent](subsys-dfx-hisysevent.md)** + + diff --git a/en/device-dev/subsystems/development-guidelines-on-animators.md b/en/device-dev/subsystems/subsys-graphics-animation-guide.md similarity index 99% rename from en/device-dev/subsystems/development-guidelines-on-animators.md rename to en/device-dev/subsystems/subsys-graphics-animation-guide.md index 0065d820ba5bfe7bd36471475366e9a335908c26..4bb1a33190f3c76e78c9d4b4d83c25690b943937 100644 --- a/en/device-dev/subsystems/development-guidelines-on-animators.md +++ b/en/device-dev/subsystems/subsys-graphics-animation-guide.md @@ -185,6 +185,6 @@ A UI animator is implemented by calling the callback function you set for each t 4. Click the buttons in the lower part of the following figure to verify that the animation effects are as expected. **Figure 1** Animator effect - ![](figures/animator-effect.gif "animator-effect") + ![](figure/animator-effect.gif "animator-effect") diff --git a/en/device-dev/subsystems/development-guidelines-on-container-components.md b/en/device-dev/subsystems/subsys-graphics-bundle-guide1.md similarity index 97% rename from en/device-dev/subsystems/development-guidelines-on-container-components.md rename to en/device-dev/subsystems/subsys-graphics-bundle-guide1.md index 7f4c52c933edc39a8fe283ded70d22d63c514d42..cc2f751868597158a0473bf52324e0ed708bef89 100644 --- a/en/device-dev/subsystems/development-guidelines-on-container-components.md +++ b/en/device-dev/subsystems/subsys-graphics-bundle-guide1.md @@ -12,7 +12,7 @@ Container components are capable of containing UI components and inherit from **UIViewGroup**. Components that are commonly used and need to contain child components are placed in the container class inheritance structure. For example, you need to call the **Add** function to add information such as time statistics and icons to **UIAnalogClock**. **Figure 1** Structure of common container components -![](figures/structure-of-common-container-components.png "structure-of-common-container-components") +![](figure/structure-of-common-container-components.png "structure-of-common-container-components") The **RootView**, **UIAbstractScroll**, and **UIPicker** components inherit from **UIViewGroup**, and the **UIList**, **UIScrollView**, and **UISwipeView** components inherit from **UIAbstractScroll**. @@ -23,7 +23,7 @@ The **RootView**, **UIAbstractScroll**, and **UIPicker** components inherit **UIViewGroup** is a base class for container components. For example, you can call the functions in this class to add, remove, and insert container components. Also, you can call the **Add** function to add child components for a container component. You need to set the position information for child components in a common container component. The position information is the coordinates relative to those of their parent component. The following figure shows the tree structure of components. **Figure 2** Component tree structure -![](figures/component-tree-structure.png "component-tree-structure") +![](figure/component-tree-structure.png "component-tree-structure") As shown in the figure, the container component **ViewGroup1** and the component **View1** are added to **RootView**, the component **View2** and the container component **ViewGroup2** are added to **ViewGroup1**, and then the component **View3** \(as a sibling of **View1**\) is also added to **ViewGroup1**. @@ -126,7 +126,7 @@ As shown in the figure, the container component **ViewGroup1** and the compone 4. The following figure shows the effect of adding view instances to a **ViewGroup**. **Figure 3** Effect of adding view instances to a ViewGroup - ![](figures/effect-of-adding-view-instances-to-a-viewgroup.png "effect-of-adding-view-instances-to-a-viewgroup") + ![](figure/effect-of-adding-view-instances-to-a-viewgroup.png "effect-of-adding-view-instances-to-a-viewgroup") ## UIScrollView @@ -240,5 +240,5 @@ scroll->Add(button2); ``` **Figure 4** Scrolling effect in both horizontal and vertical directions -![](figures/scrolling-effect-in-both-horizontal-and-vertical-directions.gif "scrolling-effect-in-both-horizontal-and-vertical-directions") +![](figure/scrolling-effect-in-both-horizontal-and-vertical-directions.gif "scrolling-effect-in-both-horizontal-and-vertical-directions") diff --git a/en/device-dev/subsystems/development-guidelines-on-layout-container-components.md b/en/device-dev/subsystems/subsys-graphics-bundle-guide2.md similarity index 97% rename from en/device-dev/subsystems/development-guidelines-on-layout-container-components.md rename to en/device-dev/subsystems/subsys-graphics-bundle-guide2.md index b90467d679cb0819acba97d6454315bfdffeeacf..95e8e154a98157305fcded6bec0d44526399740d 100644 --- a/en/device-dev/subsystems/development-guidelines-on-layout-container-components.md +++ b/en/device-dev/subsystems/subsys-graphics-bundle-guide2.md @@ -97,7 +97,7 @@ Layout container components consist of basic view classes. You can set the view **Figure 1** Horizontal swiping effect of **UISwipeView** - ![](figures/en-us_image_0000001053247975.gif) + ![](figure/en-us_image_0000001053247975.gif) ## Development Procedure \(Cyclic Horizontal Swiping\) @@ -131,7 +131,7 @@ Layout container components consist of basic view classes. You can set the view **Figure 2** Cyclic horizontal swiping effect of **UISwipeView** - ![](figures/en-us_image_0000001053207924.gif) + ![](figure/en-us_image_0000001053207924.gif) ## GridLayout @@ -211,6 +211,6 @@ Layout container components consist of basic view classes. You can set the view 4. Verify the layout of buttons, as shown in the following figure. **Figure 3** Setting a 2x2 grid and adding four buttons in a layout - ![](figures/setting-a-2x2-grid-and-adding-four-buttons-in-a-layout.png "setting-a-2x2-grid-and-adding-four-buttons-in-a-layout") + ![](figure/setting-a-2x2-grid-and-adding-four-buttons-in-a-layout.png "setting-a-2x2-grid-and-adding-four-buttons-in-a-layout") diff --git a/en/device-dev/subsystems/development-guidelines-on-common-components.md b/en/device-dev/subsystems/subsys-graphics-bundle-guide3.md similarity index 97% rename from en/device-dev/subsystems/development-guidelines-on-common-components.md rename to en/device-dev/subsystems/subsys-graphics-bundle-guide3.md index 556f8ee94d54b0a738d66544522f3ee30424075e..fc7c79ec29f35df2218ea4d5d74ef3da7c5a6783 100644 --- a/en/device-dev/subsystems/development-guidelines-on-common-components.md +++ b/en/device-dev/subsystems/subsys-graphics-bundle-guide3.md @@ -22,7 +22,7 @@ Common components inherit from the base class **UIView**. Child components cannot be added to common components, such as buttons, images, and labels. **Figure 1** Tree structure of common components -![](figures/tree-structure-of-common-components.png "tree-structure-of-common-components") +![](figure/tree-structure-of-common-components.png "tree-structure-of-common-components") **UIView** is a base class of the following components: **UIAbstractProgress**, **UIArcLabel**, **UIButton**, **UICanvas**, **UILabel**, and **UIImageView**. **UIBoxProgress** and **UICircleProgress** inherit from **UIAbstractProgress**. **UILabelButton** and **UIRepeatButton** inherit from **UIButton**. **UIImageAnimatorView** and **UITextureMapper** inherit from **UIImageView**. @@ -126,7 +126,7 @@ Common components inherit from the base class **UIView**. Child components cann 4. Verify that the button is clicked and its size increases gradually, as shown in the following figure. **Figure 2** Effect of clicking a **UIButton** - ![](figures/effect-of-clicking-a-uibutton.gif "effect-of-clicking-a-uibutton") + ![](figure/effect-of-clicking-a-uibutton.gif "effect-of-clicking-a-uibutton") ## UIImageView @@ -212,7 +212,7 @@ Common components inherit from the base class **UIView**. Child components cann 3. Verify that the **UIImageView** component is adaptive to the image. **Figure 3** Image auto-adaption effect - ![](figures/image-auto-adaption-effect.png "image-auto-adaption-effect") + ![](figure/image-auto-adaption-effect.png "image-auto-adaption-effect") ## How to Develop \(Tile Mode\) @@ -240,7 +240,7 @@ Common components inherit from the base class **UIView**. Child components cann 4. Verify that the tile mode has been enabled for the **UIImageView**. **Figure 4** Image tile effect - ![](figures/image-tile-effect.png "image-tile-effect") + ![](figure/image-tile-effect.png "image-tile-effect") ## UILabel @@ -398,7 +398,7 @@ Common components inherit from the base class **UIView**. Child components cann 4. Verify the label size and display effect, as shown in the following figure. - ![](figures/en-us_image_0000001051782526.png) + ![](figure/en-us_image_0000001051782526.png) ## How to Develop \(Background Color and Opacity\) @@ -427,7 +427,7 @@ Common components inherit from the base class **UIView**. Child components cann 4. Verify that the background color of the label is **Gray**, as shown in the following figure. - ![](figures/en-us_image_0000001052582522.png) + ![](figure/en-us_image_0000001052582522.png) ## How to Develop \(Letter Spacing\) @@ -456,7 +456,7 @@ Common components inherit from the base class **UIView**. Child components cann 4. Verify that the letter spacing is **5** pixels on the label, as shown in the following figure. - ![](figures/en-us_image_0000001052942531.png) + ![](figure/en-us_image_0000001052942531.png) ## How to Develop \(Size-Adaptive Mode\) @@ -487,7 +487,7 @@ Regarding too long text, the size of a label can be automatically adjusted based 4. Verify that the label size adapts to the text, as shown in the following figure. - ![](figures/en-us_image_0000001052782555.png) + ![](figure/en-us_image_0000001052782555.png) ## How to Develop \(Ellipsis Mode\) @@ -518,7 +518,7 @@ In ellipsis mode, an ellipsis \(...\) is displayed at the end of the label if 4. Verify that the ellipsis mode has taken effect on the label, as shown in the following figure. - ![](figures/en-us_image_0000001052662559.png) + ![](figure/en-us_image_0000001052662559.png) ## How to Develop \(Scrolling Mode\) @@ -550,6 +550,6 @@ In scrolling mode, long text is kept scrolling on a screen to bring the entire t 4. Verify that the text is scrolling on the label, as shown in the following figure. - ![](figures/20200721-223604(espace).gif) + ![](figure/20200721-223604(espace).gif) diff --git a/en/device-dev/subsystems/graphics-2.md b/en/device-dev/subsystems/subsys-graphics-overview.md similarity index 100% rename from en/device-dev/subsystems/graphics-2.md rename to en/device-dev/subsystems/subsys-graphics-overview.md diff --git a/en/device-dev/subsystems/subsys-graphics.md b/en/device-dev/subsystems/subsys-graphics.md new file mode 100644 index 0000000000000000000000000000000000000000..bf96041837411ebf1c96ea894d70fdae2846b2ca --- /dev/null +++ b/en/device-dev/subsystems/subsys-graphics.md @@ -0,0 +1,13 @@ +# Graphics + +- **[Graphics](subsys-graphics-overview.md)** + +- **[Development Guidelines on Container Components](subsys-graphics-bundle-guide1.md)** + +- **[Development Guidelines on Layout Container Components](subsys-graphics-bundle-guide2.md)** + +- **[Development Guidelines on Common Components](subsys-graphics-bundle-guide3.md)** + +- **[Development Guidelines on Animators](subsys-graphics-animation-guide.md)** + + diff --git a/en/device-dev/subsystems/overview.md b/en/device-dev/subsystems/subsys-multimedia-camera-overview.md similarity index 98% rename from en/device-dev/subsystems/overview.md rename to en/device-dev/subsystems/subsys-multimedia-camera-overview.md index af871180f3042797494129e8a9a80e36e62a1ca7..363f36457acbce8ac0ea1a8046c08920bde4807c 100644 --- a/en/device-dev/subsystems/overview.md +++ b/en/device-dev/subsystems/subsys-multimedia-camera-overview.md @@ -90,7 +90,7 @@ It is considered good practice that you understand the following concepts before Similarly, you can create a surface, implement consumer logic for it, and transfer it to the **Camera** instance. For example, transmit video streams over the network or save captured frame data as an image file. - The graphics module also obtains stream resources from the camera module through surfaces. For details, see development guidelines on [Graphic](graphics-2.md). + The graphics module also obtains stream resources from the camera module through surfaces. For details, see development guidelines on [Graphic](subsys-graphics-overview.md). - Camera running process 1. Creating a camera @@ -100,7 +100,7 @@ It is considered good practice that you understand the following concepts before **Figure 1** Sequence diagram for creating a camera - ![](figures/en-us_image_0000001054101094.png) + ![](figure/en-us_image_0000001054101094.png) 1. Taking a video/Previewing @@ -110,7 +110,7 @@ It is considered good practice that you understand the following concepts before **Figure 2** Sequence diagram for recording/previewing - ![](figures/en-us_image_0000001054421113.png) + ![](figure/en-us_image_0000001054421113.png) diff --git a/en/device-dev/subsystems/development-guidelines-on-photographing.md b/en/device-dev/subsystems/subsys-multimedia-camera-photo-guide.md similarity index 99% rename from en/device-dev/subsystems/development-guidelines-on-photographing.md rename to en/device-dev/subsystems/subsys-multimedia-camera-photo-guide.md index 23f92734097a2c318c8701f8c30983b88100b7bc..d35bed7457c70bc19d6c66cdbca1267b7da37aec 100644 --- a/en/device-dev/subsystems/development-guidelines-on-photographing.md +++ b/en/device-dev/subsystems/subsys-multimedia-camera-photo-guide.md @@ -385,6 +385,7 @@ None Surface *surface = Surface::CreateSurface(); if (surface == nullptr) { delete fc; + return; } surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */ fc->AddSurface(*surface); diff --git a/en/device-dev/subsystems/development-guidelines-on-previewing.md b/en/device-dev/subsystems/subsys-multimedia-camera-preview-guide.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-previewing.md rename to en/device-dev/subsystems/subsys-multimedia-camera-preview-guide.md diff --git a/en/device-dev/subsystems/development-guidelines-on-video-recording.md b/en/device-dev/subsystems/subsys-multimedia-camera-record-guide.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-video-recording.md rename to en/device-dev/subsystems/subsys-multimedia-camera-record-guide.md diff --git a/en/device-dev/subsystems/subsys-multimedia-camera.md b/en/device-dev/subsystems/subsys-multimedia-camera.md new file mode 100644 index 0000000000000000000000000000000000000000..a4fac683ab17078ed5dd196da525256463c77df1 --- /dev/null +++ b/en/device-dev/subsystems/subsys-multimedia-camera.md @@ -0,0 +1,11 @@ +# Camera + +- **[Overview](subsys-multimedia-camera-overview.md)** + +- **[Development Guidelines on Photographing](subsys-multimedia-camera-photo-guide.md)** + +- **[Development Guidelines on Video Recording](subsys-multimedia-camera-record-guide.md)** + +- **[Development Guidelines on Previewing](subsys-multimedia-camera-preview-guide.md)** + + diff --git a/en/device-dev/subsystems/overview-3.md b/en/device-dev/subsystems/subsys-multimedia-video-overview.md similarity index 100% rename from en/device-dev/subsystems/overview-3.md rename to en/device-dev/subsystems/subsys-multimedia-video-overview.md diff --git a/en/device-dev/subsystems/development-guidelines-on-media-playback.md b/en/device-dev/subsystems/subsys-multimedia-video-play-guide.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-media-playback.md rename to en/device-dev/subsystems/subsys-multimedia-video-play-guide.md diff --git a/en/device-dev/subsystems/development-guidelines-on-media-recording.md b/en/device-dev/subsystems/subsys-multimedia-video-record-guide.md similarity index 99% rename from en/device-dev/subsystems/development-guidelines-on-media-recording.md rename to en/device-dev/subsystems/subsys-multimedia-video-record-guide.md index 407bfa9e5ad89a15c251d5ad5c1907812989992a..e4258a87ca4b14f39f43046146ef066eab6c557b 100644 --- a/en/device-dev/subsystems/development-guidelines-on-media-recording.md +++ b/en/device-dev/subsystems/subsys-multimedia-video-record-guide.md @@ -13,7 +13,7 @@ To record audios and videos, use APIs described in this section to set the encod The following table describes APIs available for audio and video recording. -**Table 1** APIs available for media recording +**Table 1** APIs available for media recording

API

diff --git a/en/device-dev/subsystems/subsys-multimedia-video.md b/en/device-dev/subsystems/subsys-multimedia-video.md new file mode 100644 index 0000000000000000000000000000000000000000..9d075f20b5a9a5ec0570bc6610b7bab093f230fe --- /dev/null +++ b/en/device-dev/subsystems/subsys-multimedia-video.md @@ -0,0 +1,9 @@ +# Audio/Video + +- **[Overview](subsys-multimedia-video-overview.md)** + +- **[Development Guidelines on Media Playback](subsys-multimedia-video-play-guide.md)** + +- **[Development Guidelines on Media Recording](subsys-multimedia-video-record-guide.md)** + + diff --git a/en/device-dev/subsystems/multimedia.md b/en/device-dev/subsystems/subsys-multimedia.md similarity index 37% rename from en/device-dev/subsystems/multimedia.md rename to en/device-dev/subsystems/subsys-multimedia.md index 47ec966c82b0b54452feb625537d36538ca9c14e..c4b8f72b08f658c27e999c81452c400e0403018b 100644 --- a/en/device-dev/subsystems/multimedia.md +++ b/en/device-dev/subsystems/subsys-multimedia.md @@ -1,7 +1,7 @@ # Multimedia -- **[Camera](camera.md)** +- **[Camera](subsys-multimedia-camera.md)** -- **[Audio/Video](audio-video.md)** +- **[Audio/Video](subsys-multimedia-video.md)** diff --git a/en/device-dev/subsystems/ota-upgrade.md b/en/device-dev/subsystems/subsys-ota-guide.md similarity index 98% rename from en/device-dev/subsystems/ota-upgrade.md rename to en/device-dev/subsystems/subsys-ota-guide.md index 6e6a648ba8aa60a29d3263ceb53401e4cfc5802f..a249a319bae47c068ae9051865429d0e7f74bc27 100644 --- a/en/device-dev/subsystems/ota-upgrade.md +++ b/en/device-dev/subsystems/subsys-ota-guide.md @@ -35,7 +35,7 @@ Over the Air \(OTA\) is a technology that makes it easier for you to remotely up **Figure 1** Generating a Public/Private Key Pair - ![](figures/en-us_image_0000001060200050.png) + ![](figure/en-us_image_0000001060200050.png) 4. Use the array written in **public\_arr.txt** as a substitute for **g\_pubKeyBuf** in **base\\update\\ota\_lite\\frameworks\\source\\verify\\hota\_verify.c** of the OTA module. @@ -87,7 +87,7 @@ Over the Air \(OTA\) is a technology that makes it easier for you to remotely up **Figure 2** Location of original image files - ![](figures/en-us_image_0000001061889268.png) + ![](figure/en-us_image_0000001061889268.png) **Table 1** Files to be upgraded @@ -158,7 +158,7 @@ Over the Air \(OTA\) is a technology that makes it easier for you to remotely up set FILE_PRODUCT_NAME=Hisi @rem Set the software version number to a string of no more than 16 characters. - set SOFTWARE_VER=OHOS_1.1 + set SOFTWARE_VER=OpenHarmony 1.1 ``` 5. Run **Make\_Harmony\_PKG.bat** in the **ota\_tools** directory to generate the **Hisi\_OpenHarmony 1.1.bin** upgrade package. The upgrade package is signed using **SHA-256** and **RSA 2048** to ensure its integrity and validity. @@ -166,7 +166,7 @@ Over the Air \(OTA\) is a technology that makes it easier for you to remotely up **Figure 3** Upgrade package making tool - ![](figures/en-us_image_0000001059334449.png) + ![](figure/en-us_image_0000001059334449.png) ## Uploading the Upgrade Package diff --git a/en/device-dev/subsystems/distributed-remote-startup.md b/en/device-dev/subsystems/subsys-remote-start.md similarity index 100% rename from en/device-dev/subsystems/distributed-remote-startup.md rename to en/device-dev/subsystems/subsys-remote-start.md diff --git a/en/device-dev/subsystems/development-guidelines-on-ipc-authentication.md b/en/device-dev/subsystems/subsys-security-communicationverify.md similarity index 100% rename from en/device-dev/subsystems/development-guidelines-on-ipc-authentication.md rename to en/device-dev/subsystems/subsys-security-communicationverify.md diff --git a/en/device-dev/subsystems/overview-9.md b/en/device-dev/subsystems/subsys-security-overview.md similarity index 100% rename from en/device-dev/subsystems/overview-9.md rename to en/device-dev/subsystems/subsys-security-overview.md diff --git a/en/device-dev/subsystems/development-guidelines-on-application-permission-management.md b/en/device-dev/subsystems/subsys-security-rightmanagement.md similarity index 99% rename from en/device-dev/subsystems/development-guidelines-on-application-permission-management.md rename to en/device-dev/subsystems/subsys-security-rightmanagement.md index a72a6f889379575bf8b00bf351a3b0a6e539dd9b..747ecce03eb0dfdeeda525206f398330dbd6f6c4 100644 --- a/en/device-dev/subsystems/development-guidelines-on-application-permission-management.md +++ b/en/device-dev/subsystems/subsys-security-rightmanagement.md @@ -93,7 +93,7 @@ OpenHarmony allows users to install third-party applications and controls calls
->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Static permission: a permission granted by the system during application installation. The sensitivity level of this type of permission is **system\_grant**. >Dynamic permission: a permission granted by users during application running. The sensitivity level of this type of permission is **user\_grant**. diff --git a/en/device-dev/subsystems/development-guidelines-on-application-signature-verification.md b/en/device-dev/subsystems/subsys-security-sigverify.md similarity index 99% rename from en/device-dev/subsystems/development-guidelines-on-application-signature-verification.md rename to en/device-dev/subsystems/subsys-security-sigverify.md index 8c477a78d351c4f2622dd27dc6b065bcbdfad98a..8436c859d8d7708e4fd34d08f786dc53a359db4f 100644 --- a/en/device-dev/subsystems/development-guidelines-on-application-signature-verification.md +++ b/en/device-dev/subsystems/subsys-security-sigverify.md @@ -27,7 +27,7 @@ After the HAP is signed, a signature block is added between the file block and t **Figure 1** Structure of a signed HAP -![](figures/安全子系统.png) +![](figure/安全子系统.png) The signature verification process consists of three steps: HAP signature verification, signature verification for the profile signature block, and profile content verification. diff --git a/en/device-dev/subsystems/security.md b/en/device-dev/subsystems/subsys-security.md similarity index 30% rename from en/device-dev/subsystems/security.md rename to en/device-dev/subsystems/subsys-security.md index e69ec0072cf44c6314e688ce37d3a25bbe8df412..b4ac9422314e3dcc450be62ed8ad0a2b1328bff5 100644 --- a/en/device-dev/subsystems/security.md +++ b/en/device-dev/subsystems/subsys-security.md @@ -1,13 +1,11 @@ # Security -- **[Overview](overview-9.md)** +- **[Overview](subsys-security-overview.md)** -- **[Development Guidelines on Application Signature Verification](development-guidelines-on-application-signature-verification.md)** +- **[Development Guidelines on Application Signature Verification](subsys-security-sigverify.md)** -- **[Development Guidelines on Application Permission Management](development-guidelines-on-application-permission-management.md)** +- **[Development Guidelines on Application Permission Management](subsys-security-rightmanagement.md)** -- **[Development Guidelines on IPC Authentication](development-guidelines-on-ipc-authentication.md)** - -- **[Development Guidelines on Trusted Device Group Management](development-guidelines-on-trusted-device-group-management.md)** +- **[Development Guidelines on IPC Authentication](subsys-security-communicationverify.md)** diff --git a/en/device-dev/subsystems/sensors-usage-example.md b/en/device-dev/subsystems/subsys-sensor-demo.md similarity index 100% rename from en/device-dev/subsystems/sensors-usage-example.md rename to en/device-dev/subsystems/subsys-sensor-demo.md diff --git a/en/device-dev/subsystems/sensors-usage-guidelines.md b/en/device-dev/subsystems/subsys-sensor-guide.md similarity index 92% rename from en/device-dev/subsystems/sensors-usage-guidelines.md rename to en/device-dev/subsystems/subsys-sensor-guide.md index f3e692948c004bc721cf862b2ac4a47a01f574f6..74a27dfd84c880908bb950bb9ddacef86230ddb2 100644 --- a/en/device-dev/subsystems/sensors-usage-guidelines.md +++ b/en/device-dev/subsystems/subsys-sensor-guide.md @@ -25,7 +25,7 @@ void SensorDataCallbackImpl(SensorEvent *event) } ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >The callback must be of the RecordSensorCallback type. 1. Obtain the list of sensors supported by the device. @@ -55,7 +55,7 @@ int32_t ret = ActivateSensor(0, &sensorUser); int32_t ret = SubscribeSensor(0, &sensorUser); ``` ->![](public_sys-resources/icon-note.gif) **NOTE:** +>![](../public_sys-resources/icon-note.gif) **NOTE:** >Till now, you can obtain the sensor data via the callback. 1. Unsubscribe from the sensor data. diff --git a/en/device-dev/subsystems/sensors-overview.md b/en/device-dev/subsystems/subsys-sensor-overview.md similarity index 99% rename from en/device-dev/subsystems/sensors-overview.md rename to en/device-dev/subsystems/subsys-sensor-overview.md index df576eafc34eefed1cb2740def706a469e72273f..89b943330352cb8c3e65927a25fb847f5a69e2fd 100644 --- a/en/device-dev/subsystems/sensors-overview.md +++ b/en/device-dev/subsystems/subsys-sensor-overview.md @@ -9,7 +9,7 @@ The pan-sensor service subsystem provides a lightweight sensor service framework **Figure 1** Sensor service framework -![](figures/en-us_image_0000001077724150.png) +![](figure/en-us_image_0000001077724150.png) - Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler. - Sensor Framework: manages sensor data subscription, creates and destroys data channels, and implements communication with the Sensor Service module. diff --git a/en/device-dev/subsystems/subsys-sensor.md b/en/device-dev/subsystems/subsys-sensor.md new file mode 100644 index 0000000000000000000000000000000000000000..937d03221f56bff810edbf42b2697710d1df131f --- /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/testing.md b/en/device-dev/subsystems/subsys-testguide-test.md similarity index 98% rename from en/device-dev/subsystems/testing.md rename to en/device-dev/subsystems/subsys-testguide-test.md index 6b84a0b1cd8b9ca8a1f149396299679e24d07edc..215b683bd1ccb771b45c32a5256989b67af595ae 100644 --- a/en/device-dev/subsystems/testing.md +++ b/en/device-dev/subsystems/subsys-testguide-test.md @@ -61,12 +61,12 @@ Before development using the testing subsystem, you need to understand the follo - The following figure shows the architecture of the test platform. **Figure 1** Platform architecture -![](figures/platform-architecture.png "platform-architecture") +![](figure/platform-architecture.png "platform-architecture") - The following figure shows the running sequence diagram of the test platform. **Figure 2** Running sequence of the test platform -![](figures/running-sequence-of-the-test-platform.png "running-sequence-of-the-test-platform") +![](figure/running-sequence-of-the-test-platform.png "running-sequence-of-the-test-platform") - Working principle of the test platform @@ -303,7 +303,7 @@ The testing framework integrates the open-source unit testing framework and expa }; ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >You must write test cases by observing the following specifications: >- Naming > The source file name of a test case must be consistent with the test suite content. Each test suite has multiple test cases and a test source file that is globally unique and named in \[Feature\]\_\[Function\]\_\[Subfunction 1\]\_\[Subfunction 1.1\] format \(subfunctions can be further divided\). @@ -311,7 +311,7 @@ The testing framework integrates the open-source unit testing framework and expa >- Coding > The test cases must comply with the coding specifications for feature code. In addition, case descriptions are required for further clarification. For details, see [Test case template](#li2069415903917). >- Compilation and configuration - > The test cases must be compiled using GN, and the configurations must comply with the compilation guide of this open-source project. For details, see [Compilation and Building Guidelines](https://device.harmonyos.com/en/docs/develop/subsystems/oem_subsys_build_des-0000001060646620). + > The test cases must be compiled using GN, and the configurations must comply with the compilation guide of this open-source project. For details, see [Compilation and Building Subsystem - Lightweight and Small-Scale Systems](subsys-build-mini-lite.md). >- Test case template > For details, see the example test case **developertest/examples/lite/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp**. @@ -354,7 +354,7 @@ The testing framework integrates the open-source unit testing framework and expa } ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >- **@tc.name**: test case name, which briefly describes the test purpose >- **@tc.desc**: detailed description of the test case, including the test purpose, test procedure, and expected result >- **@tc.type**: test type, which can be **FUNC**, **PERF**, **SECU**, or **RELI**. @@ -486,13 +486,13 @@ The testing framework integrates the open-source unit testing framework and expa 5. Define **resource\_config\_file** in the compilation configuration file of the test case to specify the resource file **ohos\_test.xml**. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >The resource file is used to push the **test.txt** file in the **resource** directory to the **/data/test/resource** directory of the device to test. To do so, run the **hdc push** command. 7. Execute the test case after it is compiled \(the preceding steps are complete\). - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >- For devices that support connection to the hdc, test cases can be compiled separately. >- For devices that support serial ports only, to compile the test case, run the commands in the root directory for compiling the debug code. > For details about how to execute a test case, see [How to Use the Test Platform](#section76401945124810). @@ -567,7 +567,7 @@ The code repository of the testing subsystem provides complete demo cases, which ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >**example**: whether to build the test case example. The default value is **false**. >**version**: whether to build the test version. The default value is **false**. >**testcase**: whether to build the test case. The default value is **true**. @@ -597,7 +597,7 @@ The code repository of the testing subsystem provides complete demo cases, which ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >**board\_series**: development board series. The default value is **hispark**. >**board\_type**: development board type. The default value is **taurus**. >**board\_product**: target product. The default value is **ipcamera**. @@ -663,12 +663,12 @@ The code repository of the testing subsystem provides complete demo cases, which - Select a device type. - + Configure the device type based on the development board in the configuration file, for example, **developertest/config/framework\_config.xml**. - + - Run test commands. 1. To query the subsystems, modules, product form, and test types supported by test cases, run the **show** commands. - + ``` Usage: show productlist Query supported product forms @@ -676,15 +676,15 @@ The code repository of the testing subsystem provides complete demo cases, which show subsystemlist Query supported subsystems show modulelist Query supported modules ``` - + 2. Run test commands. **-t** is mandatory, and **-ss** and **-tm** are optional. The following is an example: - + ``` run -t ut -ss subsystem_examples -tm calculator ``` - + 3. Specify the arguments to execute the test suite for a specific feature or module. - + ``` usage: run [-h] [-p PRODUCTFORM] [-t [TESTTYPE [TESTTYPE ...]]] [-ss SUBSYSTEM] [-tm TESTMODULE] [-ts TESTSUIT] @@ -704,17 +704,17 @@ The code repository of the testing subsystem provides complete demo cases, which - View the test framework help if needed. - + Run the following command query test commands that are supported by the test platform: - + ``` help ``` - + - Exit the test platform. - + Run the following command to exit the test platform: - + ``` quit ``` @@ -753,7 +753,7 @@ The code repository of the testing subsystem provides complete demo cases, which - The log directory of the test platform is as follows: - + ``` reports/platform_log_xxxx-xx-xx-xx-xx-xx.log ``` diff --git a/en/device-dev/subsystems/bytrace-usage-guidelines.md b/en/device-dev/subsystems/subsys-toolchain-bytrace-guide.md similarity index 96% rename from en/device-dev/subsystems/bytrace-usage-guidelines.md rename to en/device-dev/subsystems/subsys-toolchain-bytrace-guide.md index 8219a014385d8d29fc7eecc7c5fbb6ac9671f6c3..e6ddd00929d2f6b6bd378701f31ea1b756de3a9e 100644 --- a/en/device-dev/subsystems/bytrace-usage-guidelines.md +++ b/en/device-dev/subsystems/subsys-toolchain-bytrace-guide.md @@ -1,18 +1,14 @@ # bytrace Usage Guidelines - [Overview](#section11388623181619) -- [Development Guidelines](#section1595564317164) - - [bytrace Commands](#section2344125731617) - - [Example Commands](#section5402591174) - +- [How to Develop](#section1595564317164) +- [Usage Example](#section667273201818) ## Overview bytrace is a tool for you to trace processes and analyze performance. It encapsulates and extends the kernel ftrace and supports event tracking in the user space. With bytrace, you can open a user-space or kernel-space label you want to view \(run the **bytrace -l** command to query all the supported labels\) and run the **--trace\_begin** and **-o filename** \(or **--output filename**\) commands to capture traces and dump them to a specified file. -## Development Guidelines - -### bytrace Commands +## How to Develop bytrace supports the following commands: @@ -83,7 +79,7 @@ bytrace supports the following commands:
-### Example Commands +## Usage Example The following are some examples of bytrace commands: diff --git a/en/device-dev/subsystems/subsys-toolchain.md b/en/device-dev/subsystems/subsys-toolchain.md new file mode 100644 index 0000000000000000000000000000000000000000..29f4d588550d44b6260b133f5df92fb29be79db2 --- /dev/null +++ b/en/device-dev/subsystems/subsys-toolchain.md @@ -0,0 +1,6 @@ +# R&D Tools + +- [bytrace Usage Guidelines](subsys-toolchain-bytrace-guide.md) +- [hdc\_std Usage Guidelines](oem_subsys_toolchain_hdc_guide.md) + + diff --git a/en/device-dev/subsystems/subsys-utils.md b/en/device-dev/subsystems/subsys-utils.md new file mode 100644 index 0000000000000000000000000000000000000000..53ee39995f7021e3f563ee7cc6ceb08a2353f247 --- /dev/null +++ b/en/device-dev/subsystems/subsys-utils.md @@ -0,0 +1,9 @@ +# Utils + +- **[Utils Overview](oem_subsys_utils_des.md)** + +- **[Utils Development Guidelines](oem_subsys_utils_guide.md)** + +- **[Utils FAQ](oem_subsys_utils_faq.md)** + + diff --git a/en/device-dev/subsystems/xts.md b/en/device-dev/subsystems/subsys-xts-guide.md similarity index 93% rename from en/device-dev/subsystems/xts.md rename to en/device-dev/subsystems/subsys-xts-guide.md index 24396f880e05a6ed78dfcb41c8a78660ad469317..8c39f59591f073526f2b2f269e93e5a724fa48cc 100644 --- a/en/device-dev/subsystems/xts.md +++ b/en/device-dev/subsystems/subsys-xts-guide.md @@ -12,7 +12,10 @@ - [C++-based Test Case Execution \(for Standard and Small Systems\)](#section128222336544) - [JavaScript-based Test Case Development \(for the Standard System\)](#section159801435165220) - [JavaScript-based Test Case Packaging \(for the Standard System\)](#section445519106559) + - [\#EN-US\_TOPIC\_0000001126156429/section191521423950](#section191521423950) +- [Full Compilation Guide \(for the Standard System\)](#section1519992743415) +- [Full Test Case Execution Guide \(for Small and Standard Systems\)](#section118149111426) ## Introduction @@ -269,7 +272,7 @@ The HCTest framework is used to support test cases developed with the C language 2. Write the test case in the **src** directory. - 1 Import the test framework header file. + 1. Import the test framework header file. ``` #include "hctest.h" @@ -346,7 +349,7 @@ The HCTest framework is used to support test cases developed with the C language Test suites are built along with version build. The ACTS is built together with the debug version. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >The ACTS build middleware is a static library, which will be linked to the image. @@ -456,6 +459,7 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor ] cflags = [ "-Wno-error" ] } + ``` 4. Add build options to the **BUILD.gn** file in the **acts** directory. @@ -478,7 +482,7 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor Test suites are built along with the version build. The ACTS is built together with the debug version. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](../public_sys-resources/icon-note.gif) **NOTE:** >The ACTS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\acts** directory of the build result. @@ -646,3 +650,67 @@ Use the standard syntax of Jasmine to write test cases. The ES6 specification is For details about how to build a HAP, see the JS application development guide of the standard system [Building and Creating HAPs](https://developer.harmonyos.com/en/docs/documentation/doc-guides/build_overview-0000001055075201). +## Full Compilation Guide \(for the Standard System\) + +1. Perform full building. + + Command: + + ``` + ./build.sh suite=acts system_size=standard + ``` + + Test case output directory: **out/release/suites/acts/testcases** + + Test framework and case output directory: **out/release/suites/acts** \(The test suite execution framework is compiled during case compilation.\) + + +## Full Test Case Execution Guide \(for Small and Standard Systems\) + +**Setting up a test environment** + +Install Python 3.7 or a later version on a Windows environment and ensure that the Windows environment is properly connected to the test device. + +**Test execution directory** \(corresponding to the **out/release/suites/acts** directory generated during compilation\) + +``` +├── testcase # Directory for storing test suite files +│ └──xxx.hap # HAP file executed by the test suite +│ └──xxx.json # Execution configuration file of the test suite +├── tools # Test framework tool directory +├── run.bat # File for starting the test suite on the Windows platform +├── report # Directory for storing the test reports +``` + +**Executing test cases** + +1. On the Windows environment, locate the directory in which the test cases are stored \(**out/release/suites/acts**, copied from the Linux server\), go to the directory in the Windows command window, and run **acts\\run.bat**. + +1. Enter the command for executing the test case. + + - Execute all test cases. + + ``` + run acts + ``` + + ![](figure/en-us_image_0000001119924146.gif) + + + - Execute the test cases of a module \(view specific module information in **\\acts\\testcases\\**\). + + ``` + run –l ActsSamgrTest + ``` + + ![](figure/en-us_image_0000001166643927.jpg) + + + Wait until the test case is complete. + + +1. View test reports. + + Go to **acts\\reports\\**, obtain the current execution record, and open **summary\_report.html** to view the test report. + + diff --git a/en/device-dev/subsystems/subsys.md b/en/device-dev/subsystems/subsys.md new file mode 100644 index 0000000000000000000000000000000000000000..9d1d0bdfb4c6b26ee49e9c93cec6e649f02940f7 --- /dev/null +++ b/en/device-dev/subsystems/subsys.md @@ -0,0 +1,33 @@ +# Subsystem Development Guidelines + +- **[Compilation and Building](subsys-build.md)** + +- **[Distributed Remote Startup](subsys-remote-start.md)** + +- **[Graphics](subsys-graphics.md)** + +- **[Multimedia](subsys-multimedia.md)** + +- **[Utils](subsys-utils.md)** + +- **[AI Framework](subsys-aiframework.md)** + +- **[Sensors](subsys-sensor.md)** + +- **[Application Framework](subsys-application-framework.md)** + +- **[OTA Upgrade](subsys-ota-guide.md)** + +- **[Security](subsys-security.md)** + +- **[Startup](subsys-boot.md)** + +- **[Testing](subsys-testguide-test.md)** + +- **[DFX](subsys-dfx.md)** + +- **[HiSysEvent订阅指导](subsys-dfx-hisyseventread.md)** + +- **[XTS](subsys-xts-guide.md)** + + diff --git a/en/device-dev/subsystems/utils.md b/en/device-dev/subsystems/utils.md deleted file mode 100644 index 3b50567c41f81e03d3d937266cd6cb635f15ca4e..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/utils.md +++ /dev/null @@ -1,9 +0,0 @@ -# Utils - -- **[Utils Overview](utils-overview.md)** - -- **[Utils Development Guidelines](utils-development-guidelines.md)** - -- **[Utils FAQ](utils-faq.md)** - - diff --git a/en/readme.md b/en/readme.md index 6f5507767fb638dc4a82b16d8c40da15bc4bf0af..4931059a15b9ae98cadd621128623ef81acd0fed 100644 --- a/en/readme.md +++ b/en/readme.md @@ -1,77 +1,82 @@ # WELCOME TO OPENHARMONY + This project stores OpenHarmony documentation, including the quick start guide, development guides, and API reference. We appreciate your contribution to the OpenHarmony documentation. -## Motivation -Traditional OSs are limited to a specific type of device, while OpenHarmony provides distributed features that are compatible with a wide range of different devices. The first version supports devices with 128 KB to 128 MB of memory. Join us as we keep updating OpenHarmony versions. -For device developers, OpenHarmony utilizes a component-based design to tailor its features to better suit specific devices, based on each device's capabilities and service characteristics. OpenHarmony can run on devices with limited resources and wearables with hundreds of KB of memory, as well as more powerful devices, such as smart home cameras and dashcams with hundreds of MB of memory. - -[中文版本](../zh-cn/readme.md) - -## Device Development - Documentation Directory Structure -- [Overview](device-dev/quick-start/overview.md) -- [Getting Started](device-dev/quick-start/Readme-EN.md) -- [Source Code Acquisition/Tool Acquisition](device-dev/get-code/Readme-EN.md) -- [Kernel Usage Guidelines](device-dev/kernel/Readme-EN.md) -- [Driver Usage Guidelines](device-dev/driver/Readme-EN.md) -- [Subsystem Development Guidelines](device-dev/subsystems/Readme-EN.md) - - [Compilation and Building](device-dev/subsystems/compilation-and-building.md) - - [Distributed Remote Startup](device-dev/subsystems/distributed-remote-startup.md) - - [Graphics](device-dev/subsystems/graphics.md) - - [Multimedia](device-dev/subsystems/multimedia.md) - - [Utils](device-dev/subsystems/utils.md) - - [AI Framework](device-dev/subsystems/ai-framework.md) - - [Sensors](device-dev/subsystems/sensors.md) - - [Application Framework](device-dev/subsystems/application-framework.md) - - [OTA Upgrade](device-dev/subsystems/ota-upgrade.md) - - [Security](device-dev/subsystems/security.md) - - [Startup](device-dev/subsystems/startup.md) - - [Testing](device-dev/subsystems/testing.md) - - [DFX](device-dev/subsystems/dfx.md) - - [R&D Tools](device-dev/subsystems/r-d-tools.md) - - [X Test Suite](device-dev/subsystems/xts.md) -- [Bundle Development Guidelines](device-dev/bundles/Readme-EN.md) -- [Third-Party Library Porting Guide](device-dev/porting/Readme-EN.md) -- [Device Development Guidelines](device-dev/guide/Readme-EN.md) - - [WLAN-connected Products](device-dev/guide/wlan-connected-products.md) - - [Cameras Without a Screen](device-dev/guide/cameras-without-a-screen.md) - - [Cameras with a Screen](device-dev/guide/cameras-with-a-screen.md) - - [Visual Application Development](device-dev/guide/visual-application-development.md) - - [Development Example for Clock Apps](device-dev/guide/development-example-for-clock-apps.md) - - [Development Example for Platform Drivers](device-dev/guide/development-example-for-platform-drivers.md) - - [Development Example for Peripheral Drivers](device-dev/guide/development-example-for-peripheral-drivers.md) -- [Privacy and Security](device-dev/security/Readme-EN.md) -- [Glossary](device-dev/glossary/glossary.md) - -# Application Development - Documentation Directory Structure - -- [Getting Started](application-dev/quick-start/getting-started.md) -- [UI](application-dev/ui/Readme-EN.md) -- [Media](application-dev/media/Readme-EN.md) -- [Connectivity](application-dev/connectivity/Readme-EN.md) -- [JS Reference](application-dev/js-reference/Readme-EN.md) - -## Start Contributing - -OpenHarmony is an open-source community and encourages everyone in the community to submit patches directly to the project. You can contribute either to the code or documentation. -- [Contributing to the Code](contribute/contributing-code.md) -- [Contributing to the Documentation](contribute/documentation-contribution.md) - -For more details on how to contribute, see [Contributing Documents](contribute). -## Get Source Code and Tools -To download the source code and tools required for the project, click the following links: -- [Source Code Acquisition](device-dev/get-code/source-code-acquisition.md) -- [Tool Acquisition](device-dev/get-code/tool-acquisition.md) - -## Where to Turn for Help -You can subscribe to the mailing list to get constant updates on new features, released road maps, and community activities. For how to subscribe to the mailing list or get any other support, see [Communication in Community](https://gitee.com/openharmony/docs/tree/master/contribute/communication-in-community.md). - -## Code of Conduct -OpenHarmony is committed to providing a welcoming and inspiring community for all. In order to maintain a collaborative environment, we recommend you read and follow the community [Code of Conduct](https://gitee.com/openharmony/docs/blob/master/contribute/code-of-conduct.md). - -## Contributors & Acknowledgements -A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to participate in this exciting journey, and we're grateful for your time, passion, and efforts! - -## Release -In order to provide new features and bug fixes, the community constantly updates code and provides new releases. - -See [OpenHarmony Release Notes](release-notes/OpenHarmony-Release-Notes.md). \ No newline at end of file +## Contents + +- [OpenHarmony Overview](OpenHarmony-Overview.md) +- Mini and Small System Development Guidelines \(Reference Memory < 128 MB\) + - Device development + - **overview**: [device development overview](device-dev/overview.md) + - **quick-start**: [quick start guide](device-dev/quick-start/Readme-EN.md) \(covering environment setup, source code acquisition, build, and burning\) + - Basic development capabilities + - **Kernel**: [lite kernel](device-dev/kernel/kernel-lite.md) + - **Drivers**: [drivers](device-dev/driver/Readme-EN.md) + - **Subsystems**: [subsystems](device-dev/subsystems/Readme-EN.md) \(such as compilation and building, graphics, DFX, and XTS\) + - **Security**: [privacy and security](device-dev/security/Readme-EN.md) + + - **guide**: + - [WLAN-connected products](device-dev/guide/device-wifi.md) \(LED peripheral control and third-party SDK integration\) + - [Screenless cameras](device-dev/guide/device-iotcamera.md) \(camera control\) + - [Cameras with a screen](device-dev/guide/device-camera.md) \(screen and camera control, visual application development\) + + - **porting**: + - [Mini System SoC Porting Guide](device-dev/porting/transplant-minichip.md) + - [Small System SoC Porting Guide](device-dev/porting/transplant-smallchip.md) + - [Third-Party Library Porting Guide](device-dev/porting/transplant-thirdparty.md) + + - **bundles**: + - [Development Specifications](device-dev/bundles/bundles-standard-rules.md) + - [Development Guidelines](device-dev/bundles/bundles-guide.md) + - [HPM User Guide](device-dev/bundles/bundles-demo.md) + +- Standard System Development Guidelines \(Reference Memory ≥ 128 MB\) + - Device development + - **overview**: [device development overview](device-dev/overview.md) + - **quick-start**: [quick start guide](device-dev/quick-start/quickstart-standard.md) \(covering environment setup, source code acquisition, build, and burning\) + - Basic development capabilities + - **Kernel**: [Linux kernel](device-dev/kernel/kernel-standard.md) + - **Drivers**: [drivers](device-dev/driver/Readme-EN.md) + - **Subsystems**: [subsystems](device-dev/subsystems/Readme-EN.md) \(such as compilation and building, graphics, DFX, and XTS\) + - **Security**: [privacy and security](device-dev/security/Readme-EN.md) + + - **guide**: + - [Clock apps](device-dev/guide/oem_device_clockapp_des.md) + - [Platform drivers](device-dev/guide/device-driver-demo.md) + - [Peripheral drivers](device-dev/guide/device-outerdriver-demo.md) + + - **porting**: + + [Third-Party Library Porting Guide](device-dev/porting/transplant-thirdparty.md) + + - **bundles**: + - [Development Specifications](device-dev/bundles/bundles-standard-rules.md) + - [Development Guidelines](device-dev/bundles/bundles-guide.md) + - [HPM User Guide](device-dev/bundles/bundles-demo.md) + + +- App development + - **Overview**: [app development overview](application-dev/application-dev-guide.md) + - **quick-start**: [quick start guide](application-dev/quick-start/Readme-EN.md) + - **ui**: [UI](application-dev/ui/Readme-EN.md) + - **media**: [media](application-dev/media/Readme-EN.md) + - **connectivity**: [networks and connectivity](application-dev/connectivity/Readme-EN.md) + - **js-reference**: [JS reference](application-dev/js-reference/Readme-EN.md) +- **glossary**: [glossary](device-dev/glossary/glossary.md) + +## Version Change History + +For details, see [Release Notes](release-notes/OpenHarmony-Release-Notes.md). + +## Third-Party Open-Source Software and License Notice + +None. + +## How to Contribute + +A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to [participate](contribute/contribution.md) in this exciting journey, and we're grateful for your time, passion, and efforts! + +You can evaluate available documents, make simple modifications, provide feedback on document quality, and contribute your original content. For details, see [Documentation Contribution](contribute/documentation-contribution.md). + +Excellent contributors will be awarded and the contributions will be publicized in the developer community. + diff --git a/zh-cn/device-dev/bundles/Readme-CN.md b/zh-cn/device-dev/bundles/Readme-CN.md index 6b1ae76002fff938ab4b3098621a85736b7756c9..7233ea64d4297bef0816b08f413009882a6e3a64 100755 --- a/zh-cn/device-dev/bundles/Readme-CN.md +++ b/zh-cn/device-dev/bundles/Readme-CN.md @@ -1,20 +1,12 @@ -# 组件开发 - -- [组件开发规范](组件开发规范.md) - - [概述](概述.md) - - [组件构成](组件构成.md) - - [组件管理](组件管理.md) - - [组件版本](组件版本.md) - - [发行版](发行版.md) - - [环境变量说明](环境变量说明.md) - -- [组件开发指南](组件开发指南.md) - - [概述](概述-0.md) - - [准备工作](准备工作.md) - - [组件开发](组件开发.md) - -- [组件开发示例](组件开发示例.md) - - [HPM介绍](HPM介绍.md) - - [环境准备](环境准备.md) - - [操作实例](操作实例.md) +# 组件开发指南 + +- [组件开发规范](bundles-standard-rules.md) +- [组件开发指南](bundles-guide.md) + - [组件开发指南](bundles-guide-overview.md) + - [准备工作](bundles-guide-prepare.md) + - [组件开发](bundles-guide-develop.md) +- [组件开发示例](bundles-demo.md) + - [HPM介绍](bundles-demo-hpmdescription.md) + - [环境准备](bundles-demo-environment.md) + - [操作实例](bundles-demo-devsample.md) diff --git "a/zh-cn/device-dev/bundles/\346\223\215\344\275\234\345\256\236\344\276\213.md" b/zh-cn/device-dev/bundles/bundles-demo-devsample.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/bundles/\346\223\215\344\275\234\345\256\236\344\276\213.md" rename to zh-cn/device-dev/bundles/bundles-demo-devsample.md index d49c4267cc6a997708e0018a61fded11f6bdb2bd..1de6091e00561003efb769708a6dd5af62bd3f24 --- "a/zh-cn/device-dev/bundles/\346\223\215\344\275\234\345\256\236\344\276\213.md" +++ b/zh-cn/device-dev/bundles/bundles-demo-devsample.md @@ -28,7 +28,7 @@ Installed. ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >Hi3516平台采用下述命令: >``` >hpm install @ohos/ip_camera_hi3516dv300 diff --git "a/zh-cn/device-dev/bundles/\347\216\257\345\242\203\345\207\206\345\244\207.md" b/zh-cn/device-dev/bundles/bundles-demo-environment.md old mode 100755 new mode 100644 similarity index 89% rename from "zh-cn/device-dev/bundles/\347\216\257\345\242\203\345\207\206\345\244\207.md" rename to zh-cn/device-dev/bundles/bundles-demo-environment.md index d4d5662f297230dcd45cd8706b239be7fada4e65..1a05b2a302aa04390d4b294e784f30f07ebc0e72 --- "a/zh-cn/device-dev/bundles/\347\216\257\345\242\203\345\207\206\345\244\207.md" +++ b/zh-cn/device-dev/bundles/bundles-demo-environment.md @@ -25,7 +25,7 @@ ln -s bash /bin/sh ## 安装Node.js ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果配置的源的nodejs版本太低,可以执行以下语句后再执行apt-get install: >``` >curl -L https://deb.nodesource.com/setup_12.x | bash @@ -68,7 +68,7 @@ http_proxy = http://your-proxy-server:port # 配置HTTP代理 https_proxy = http://your-proxy-server:port # 配置HTTPS代理 ``` -hpm-cli的命令介绍可以参考:[hpm操作命令](组件管理.md) +hpm-cli的命令介绍可以参考:[hpm操作命令](bundles-standard-rules.md) ## 安装python环境 @@ -81,7 +81,7 @@ sudo pip3 install setuptools sudo pip3 install kconfiglib # 建议安装kconfiglib 13.2.0+版本 ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >上述方式适用Hi3518和Hi3516两种平台,针对Hi3861平台采用以下方式安装python环境: >``` >sudo apt-get install python3.8 @@ -112,7 +112,7 @@ which mcopy # 如果没找到,执行以下命令安装 sudo apt-get install mtools ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >Hi3518和Hi3516两种平台需要安装打包工具,Hi3861平台不需要。 ## 安装SCons @@ -131,9 +131,9 @@ sudo apt-get install mtools ``` **图 1** SCons安装成功界面,版本要求3.0.4以上 - ![](figures/SCons安装成功界面-版本要求3-0-4以上.png "SCons安装成功界面-版本要求3-0-4以上") + ![](figure/SCons安装成功界面-版本要求3-0-4以上-21.png "SCons安装成功界面-版本要求3-0-4以上-21") ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >Hi3861平台需要安装SCons,Hi3518和Hi3516两种平台不需要。 diff --git "a/zh-cn/device-dev/bundles/HPM\344\273\213\347\273\215.md" b/zh-cn/device-dev/bundles/bundles-demo-hpmdescription.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/bundles/HPM\344\273\213\347\273\215.md" rename to zh-cn/device-dev/bundles/bundles-demo-hpmdescription.md diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\347\244\272\344\276\213.md" b/zh-cn/device-dev/bundles/bundles-demo.md old mode 100755 new mode 100644 similarity index 30% rename from "zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\347\244\272\344\276\213.md" rename to zh-cn/device-dev/bundles/bundles-demo.md index d3e13752118de3f3e106ab01950b786e0ed3e757..bcdc877e6dd00f49a3195ff4443a08de52917a1c --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ b/zh-cn/device-dev/bundles/bundles-demo.md @@ -1,9 +1,9 @@ # 组件开发示例 -- **[HPM介绍](HPM介绍.md)** +- **[HPM介绍](bundles-demo-hpmdescription.md)** -- **[环境准备](环境准备.md)** +- **[环境准备](bundles-demo-environment.md)** -- **[操作实例](操作实例.md)** +- **[操作实例](bundles-demo-devsample.md)** diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221.md" b/zh-cn/device-dev/bundles/bundles-guide-develop.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221.md" rename to zh-cn/device-dev/bundles/bundles-guide-develop.md index 292c88d6d2cc329d255c12fe1d118009d84ee82d..bc462fd12dceefd0cb04dcfbdccf97a8412c6027 --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221.md" +++ b/zh-cn/device-dev/bundles/bundles-guide-develop.md @@ -19,7 +19,6 @@ - 从头开发一个全新的组件。 - 将一个现有的非组件的代码改造成组件。 - - hpm提供了一些组件模板方便快速创建组件。 ## 新建组件 @@ -109,7 +108,7 @@ hpm 除了提供了默认模板 default和simple两个简单的模板之外, 可以使用命令hpm search -t template 从服务器端搜索模板。 -![](figures/zh-cn_image_0000001051452177.png) +![](figure/zh-cn_image_0000001051452177.png) 根据description简要中的描述,找到适合的模板,基于模板可以快速创建一个组件的脚手架,执行如下初始化命令(指定-t -d 参数)。 @@ -159,7 +158,7 @@ executable("hello_world") { } ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- “executable”是gn内置模板,可以用“gn help executable ”查看使用方法。 >- “sources ”是源码路径,“include\_dirs ”是头文件路径。 @@ -173,7 +172,7 @@ hpm build 在完成一系列的编译动作后,显示build succeed。检查编译的输出结果: -![](figures/zh-cn_image_0000001051770876.png) +![](figure/zh-cn_image_0000001051770876.png) ## 定义发行版 diff --git "a/zh-cn/device-dev/bundles/\346\246\202\350\277\260-0.md" b/zh-cn/device-dev/bundles/bundles-guide-overview.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/bundles/\346\246\202\350\277\260-0.md" rename to zh-cn/device-dev/bundles/bundles-guide-overview.md index 758ec2fb9fd0d18aa4df95bfc0355d7c307429ef..332a8fc00782f0ca9db5bbe4668e3ad6d68f38ef --- "a/zh-cn/device-dev/bundles/\346\246\202\350\277\260-0.md" +++ b/zh-cn/device-dev/bundles/bundles-guide-overview.md @@ -50,5 +50,5 @@ **图 1** 组件和发行版的构成 -![](figures/组件0924.png) +![](figure/组件0924.png) diff --git "a/zh-cn/device-dev/bundles/\345\207\206\345\244\207\345\267\245\344\275\234.md" b/zh-cn/device-dev/bundles/bundles-guide-prepare.md old mode 100755 new mode 100644 similarity index 93% rename from "zh-cn/device-dev/bundles/\345\207\206\345\244\207\345\267\245\344\275\234.md" rename to zh-cn/device-dev/bundles/bundles-guide-prepare.md index 981e7e299a86af578bde9dfdb0e7807acfad0aa8..4068e7d7bee57afd03cd3098b97e923dc16edb66 --- "a/zh-cn/device-dev/bundles/\345\207\206\345\244\207\345\267\245\344\275\234.md" +++ b/zh-cn/device-dev/bundles/bundles-guide-prepare.md @@ -13,7 +13,7 @@ - Linux服务器 **图 1** 硬件环境连接关系 -![](figures/硬件环境连接关系.png "硬件环境连接关系") +![](figure/硬件环境连接关系.png "硬件环境连接关系") ## 安装Node.js和hpm命令行工具 @@ -62,11 +62,11 @@ http_proxy = http://your-proxy-server:port # 配置HTTP https_proxy = http://your-proxy-server:port # 配置HTTPS代理 ``` -hpm-cli的命令介绍可以参考:[hpm操作命令](组件管理.md) +hpm-cli的命令介绍可以参考:[hpm操作命令](bundles-guide-overview.md) ## 下载OpenHarmony代码 -参考[《源码获取》](../get-code/源码获取.md) +参考[《源码获取》](../get-code/sourcecode-acquire.md)。 ## 安装开发依赖的组件 diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\215\227.md" b/zh-cn/device-dev/bundles/bundles-guide.md old mode 100755 new mode 100644 similarity index 31% rename from "zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\215\227.md" rename to zh-cn/device-dev/bundles/bundles-guide.md index cb1868b0b4463c569d8e022005d52487f9e05f29..ca5ee5824bee855bc41e9c5d0bf758fee2e29041 --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\215\227.md" +++ b/zh-cn/device-dev/bundles/bundles-guide.md @@ -1,9 +1,9 @@ # 组件开发指南 -- **[概述](概述-0.md)** +- **[概述](bundles-guide-overview.md)** -- **[准备工作](准备工作.md)** +- **[准备工作](bundles-guide-prepare.md)** -- **[组件开发](组件开发.md)** +- **[组件开发](bundles-guide-develop.md)** diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\347\256\241\347\220\206.md" b/zh-cn/device-dev/bundles/bundles-standard-rules.md old mode 100755 new mode 100644 similarity index 51% rename from "zh-cn/device-dev/bundles/\347\273\204\344\273\266\347\256\241\347\220\206.md" rename to zh-cn/device-dev/bundles/bundles-standard-rules.md index 852d9929b0961be9d557c496806167e5301f0ec2..350c2f80db60eba6fe7f2a4b1adf5b304ff5e8b8 --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\347\256\241\347\220\206.md" +++ b/zh-cn/device-dev/bundles/bundles-standard-rules.md @@ -1,9 +1,162 @@ -# 组件管理 +# 组件开发规范 -- [依赖关系](#section12657593129) -- [hpm操作命令参考](#section1258849181312) +- [概述](#section1725818533344) + - [定义](#section4821219183514) + - [组件划分原则](#section1089794263513) + - [组件依赖](#section25701647163710) -## 依赖关系 +- [组件构成](#section185538333914) + - [代码文件](#section8431268393) + - [说明文件](#section168121548173914) + - [元数据描述文件](#section7107181819406) + +- [组件管理](#section32061634104110) + - [依赖关系](#section791115242423) + - [hpm操作命令参考](#section1183205411429) + +- [组件版本](#section12612142864316) + - [版本号命名规范](#section1487612416432) + - [版本发布](#section1548171014440) + +- [发行版](#section1264139114413) +- [环境变量说明](#section15352105174512) + +## 概述 + +本文档将介绍组件的基本概念以及如何按照规范定义组件。 + +### 定义 + +OpenHarmony软件以组件\(bundle\)作为基本单元,从系统角度看,凡是运行在OpenHarmony上的软件都可以定义为组件;一般来讲,根据组件的应用范围,可以分为: + +- 板级组件:如board、arch、mcu这些与设备硬件相关的组件。 +- 系统组件:一组独立功能的集合,如内核、文件系统、框架等。 +- 应用组件:直接面向用户提供服务的应用\(如wifi\_iot,ip\_camera\)。 + +从形式上看,组件是为复用而生,一切可以复用的模块都可以定义为组件,可以分为: + +- 源代码 +- 二进制 +- 代码片段 +- 发行版 + +### 组件划分原则 + +原则上应尽可能划分为细颗粒度的组件,以满足最大限度的复用。主要考虑以下几点: + +- 独立性:组件的功能应该相对独立,支持独立编译,可以单独对外提供接口和服务; +- 耦合性:如果组件必须依赖其他的组件,才能对外提供服务,应考虑和被依赖的组件合并为一个组件。 +- 相关性:如果一组组件共同完成一项功能,且没有被其他组件依赖,未来也没有被依赖的可能,则可以考虑合并为一个组件。 + +### 组件依赖 + +组件的依赖关系分为两种:必选依赖和可选依赖。 + +- 必选依赖:是指组件A在完成某个功能时,必须引入组件B,调用B的接口或服务配合才能完成。称B为A的必选依赖。 +- 可选依赖:是在组件A在完成某个功能时,可以引入组件C,也可以引入组件D。C和D可以相互替换,称C和D为A的可选依赖。 + +## 组件构成 + +一个组件包一般包含如下内容: + +- 组件包的代码或库(src目录下的代码文件) +- ohos\_bundles文件夹(存放依赖的组件,安装组件时自动生成,无需提交到代码库) +- 组件包的说明文件\(README.md\) +- 组件包元数据声明文件\(bundle.json\) +- 开源许可文件\(LICENSE\) + + ``` + my-bundle + |_ohos_bundles + |_src + |_bundle.json + |_README.md + |_LICENSE + ``` + + +### 代码文件 + +组件的代码文件和普通的代码目录没有差异。但要注意的是,组件中对外暴露的接口(头文件),会被其他组件所引用,需要单独在bundle.json的dirs中声明。 + +### 说明文件 + +README.md,为markdown格式的描述关于组件自述说明文件。([语法参考](https://www.markdownguide.org/getting-started/)\) + +为了帮助他人在hpm上找到该组件,并更方便的使用它,在组件的根目录中包含一个README文件。 + +README文件可能包括如何安装,配置和使用组件包中的实例代码说明,以及可能会对用户有所帮助的任何其他信息。 + +每个组件的自述文件将显示在hpm系统的组件详情页面的描述中。 + +### 元数据描述文件 + +bundle.json文件是对当前组件的元数据描述,每个组件中必须包含一个bundle.json文件。 + +``` +{ + "name": "@myorg/demo-bundle", + "version": "1.0.0", + "license": "MIT", + "description": "bundle description", + "keywords": ["hos"], + "tags": ["applications", "drivers"], + "author": {"name":"","email":"","url":""}, + "contributors":[{"name":"","email":"","url":""},{"name":"","email":"","url":""}], + "homepage": "http://www.foo.bar.com", + "repository": "https://git@gitee.com:foo/bar.git", + "publishAs": "code-segment", + "segment":{ + "destPath":"/the/dest/path" + }, + "dirs": { + "src": ["src/**/*.c"], + "headers": ["headers/**/*.h"], + "bin": ["bin/**/*.o"] + }, + "scripts": { + "build": "make" + }, + "envs": {}, + "ohos": { + "os": "2.0.0", + "board": "hi3516", + "kernel": "liteos-a" + }, + "rom": "10240", + "ram": "1024", + "dependencies": { + "@myorg/net":"1.0.0" + } +} +``` + +bundle.json文件具有如下功能: + +- name:定义组件的名称,放到组织下, 以@开头,/分割,如:@myorg/mybundle + +- version:定义组件版本号,如1.0.0,需满足semver的标准。 + +- description:一句话对组件进行简要的描述。 +- dependencies:定义组件的依赖组件。 + +- envs: 定义组件编译时所需要的参数,包括全局参数以及依赖所需的参数。 + +- scripts:定义在当前组件下能够执行的命令(如编译,构建,测试,烧录等)。 + +- publishAs:定义组件的发布类型(source:源码,binary:二进制,distribution:发行版,code-segment:代码片段)。 + +- segment: 仅针对code-segment类型的组件,定义组件的目标路径(即安装后,组件包中包含的文件复制到的目标路径) +- dirs:定义发布时打包的目录结构(如头文件)。 + +- ram&rom:统计相关信息:预计占用ROM和RAM信息。 +- ohos:描述OpenHarmony系统版本、开发板及内核的匹配关系(多个请用英文逗号的“,”分割)。 +- 定义其他扩展信息:作者,主页,代码仓库,许可协议,标签,关键字。 +- 对于发行版类型,还有个base,可以定义继承自的发行版。 + +## 组件管理 + +### 依赖关系 生成基础bundle.json以后,需要继续添加组件依赖来实现更复杂的功能。此时需要知道所依赖组件的名称和版本号,并且把它们定义在bundle.json里面的dependencies字段中。 @@ -41,20 +194,20 @@ $ hpm list | | +--@demo/dist_tools@4.0.0 ``` -还可以使用图的形式,来查看当前组件的依赖关系,执行如下命令: +还可以使用可视化的形式,来查看当前组件的依赖关系,执行如下命令: ``` -hpm dependencies +hpm ui ``` -在当前目录下会生成deps\_visual文件夹,里面包含两个文件,deps.html 和 deps-data.js。在浏览器中打开 deps.html 文件,就可以看到依赖关系的图形化展示\(如下图\)。 - -根据不同的依赖类型,图形结点呈现出不同的颜色。鼠标悬浮在结点上,可以查看当前结点的状态。 +会在本地启动一个web服务(默认会打开浏览器并进入项目页),点击侧边栏的项目依赖图标,打开页面,可以看到项目的依赖组件列表,点击右侧按钮切换到树状视图,就可以看到依赖关系的图形化展示\(如下图\)。 **图 1** 组件包依赖关系图 -![](figures/组件包依赖关系图.png "组件包依赖关系图") -## hpm操作命令参考 + +![](figure/zh-cn_image_0000001173313501.png) + +### hpm操作命令参考 组件的全生命周期管理,可以通过hpm命令工具进行操作,hpm的操作命令如下(详细帮助可以执行 hpm -h学习): @@ -137,7 +290,7 @@ hpm dependencies

hpm dependencies

生成当前组件/发行版依赖关系图(html格式)。

+

生成当前组件/发行版依赖关系数据(在hpm ui也集成了该命令的调用,可以图形化的展示)

搜索

@@ -182,7 +335,7 @@ hpm dependencies

hpm dist

发行版打包(依赖bundle.json的scripts中的dist脚本)。

+

针对发行版(distribution),发行版编译构建(依赖bundle.json的scripts中的dist脚本)。

打包

@@ -213,6 +366,41 @@ hpm dependencies

执行bundle.json文件中定义的scripts脚本命令,支持多个命令可用 && 连接。

解压包

+

hpm extract

+

解压文件. 支持格式'zip','tar','tgz' 和'.tar.gz'

+

启动图形化界面

+

hpm ui

+

本地启动HPM UI,可通过-p参数指定端口,Windows平台下会启动默认的浏览器打开

+

多语言切换

+

hpm lang

+

切换中英文操作界面(同时支持命令行和UI)

+

转换为hpm包格式

+

hpm x2h

+

将一个maven格式或npm格式包转换成hpm的包格式,并发布到HPM

+

代码段还原或清理

+

hpm code clean|restore

+

针对依赖的代码段(code-segment)组件,执行清理或还原操作(即根据segment.destPath执行拷贝/删除操作)

+

生成秘钥

hpm gen-keys

@@ -230,8 +418,132 @@ hpm dependencies
- - - -
+## 组件版本 + +### 版本号命名规范 + +名称需要为全小写字母,中间可以使用中划线或者下划线分隔。比如 "bundle", "my\_bundle"。 + +版本号的格式为 "主版本号.次版本号.修订号" 或 "主版本号.次版本号.修订号-先行版本号",比如 "1.0.0", "1.0.0-beta",详细规格可以参考 [https://semver.org](https://semver.org/)。 + +### 版本发布 + +为了使组件能被其他开发者使用,组件需要上传到远端仓库。组件上传使用如下命令: + +``` +hpm publish +``` + +命令执行以后,系统会对的整个依赖关系进行检查,下载缺失依赖组件。依赖检查完成后,如果发布类型为binary,系统会对整个组件进行编译,生成二进制文件,然后打包上传。如果使其他上传类型,则直接根据定义的打包规则进行打包,然后上传。 + +注意:发布组件需要用户账号登录,需要先拥有hpm的系统账号后,并注册组织,申请组织认证通过后,才拥有发布的权限。 + +## 发行版 + +发行版通常是将一系列组件组合起来,成为编译可以运行的OpenHarmony解决方案镜像,里面包含了多个依赖的组件,以及脚本,用于描述如何完整编译、链接这些组件。 + +发行版本身通常不需要包含功能实现代码,仅包含bundle.json描述(设置publishAs为distribution)和一些编译脚本组成。 + +因为发行版编译的过程需要系统提供环境变量,所以发行版使用scripts脚本中内置的dist命令: + +``` +{ + "publishAs":"distribution", + "scripts": { + "dist": "script compile command" + } +} +``` + +编译执行使用如下命令: + +``` +hpm dist +``` + +重新定义一个发行版所具有的功能是一个复杂的过程,所以系统允许对发行版进行继承,从而在现有功能的基础上进行定制。继承发行版需要在bundle.json中定义base字段。 + +``` +{ + "base": { + "name": "dist_wifi_iot", + "version": "1.0.0" + } +} +``` + +上述定义表明当前组件继承自发行版组件dist-wifi-iot 1.0.0。 + +发行版由很多的依赖组件组成,通过bundle.json中的dependencies段来描述,有些依赖是必须的,有些依赖则是根据可以需求增加或删除的。bundle.json中名称前带有?的依赖表示可选依赖,继承它的发行版,可以移除掉该可选组件,再增加别的组件进行替换。 + +``` +{ + "dependencies": { + "?my_bundle": "1.0.0" + } +} +``` + +上述声明表示my\_bundle依赖可以被移除。如果想要移除my\_bundle,在上层依赖方需要使用excludes关键字来进行定义 + +``` +{ + "excludes": [ "my_bundle" ] +} +``` + +依赖被移除后,就不会参入组件的构建过程。只有标记为可选的依赖才能够被移除,强行移除未被标记的依赖会出现错误提示。 + +## 环境变量说明 + +组件在编译的过程中需要依赖系统提供的环境变量来自定义输出,链接所需二进制文件等等。这里提出的环境变量均指根据需求把所需变量注入脚本执行的上下文中。所以在脚本中可以直接获取到变量的值。下面介绍当前系统存在的几种环境变量。 + +全局变量由bundle.json中的envs属性来定义。整个组件中的依赖都可以获取到全局变量定义的值。 + +``` +{ + "envs": { + "compileEnv": "arm" + } +} +``` + +不同组件在引入依赖的过程中可以传入不同的参数,从而使依赖的编译可以满足当前组件的需求。依赖中定义的参数可以在对应依赖脚本执行的上下文中获取到。 + +``` +{ + "dependencies": { + "my-bundle": { + "version": "1.0.0", + "mode": "debug" + } + } +} +``` + +组件在链接二进制文件的时候,需要知道二进制文件在依赖中的路径,所以依赖的路径会作为环境变量传入编译组件中。 + +传入的环境变量的格式为DEP\_BundleName,BundleName为依赖的名称,例如 DEP\_first\_bundle。 + +依赖中可以定义标签,对引入的依赖进行分组。在脚本中可以根据标签,获得这一组依赖的路径。定义的标签以\#开头,具体定义的方式为: + +``` +{ + "dependencies": { + "#tool": { + "first-bundle": "1.0.0", + "second-bundle": "1.0.0" + }, + "#drivers": { + "xx-bundle": "1.0.0", + "yy-bundle": "1.0.0" + } + } +} +``` + +系统中存在两个固定环境变量: + +- DEP\_OHOS\_BUNDLES:表示ohos\_bundles文件夹所在的路径。 +- DEP\_BUNDLE\_BASE:表示最外层组件的路径。 diff --git a/zh-cn/device-dev/bundles/bundles.md b/zh-cn/device-dev/bundles/bundles.md new file mode 100644 index 0000000000000000000000000000000000000000..9c560fca9d5b6ac9381ebc8dbc3a11de2eaba84b --- /dev/null +++ b/zh-cn/device-dev/bundles/bundles.md @@ -0,0 +1,9 @@ +# 组件开发指南 + +- **[组件开发规范](bundles-standard-rules.md)** + +- **[组件开发指南](bundles-guide.md)** + +- **[组件开发示例](bundles-demo.md)** + + diff --git "a/zh-cn/device-dev/bundles/figures/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212.png" "b/zh-cn/device-dev/bundles/figure/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212-21.png" similarity index 100% rename from "zh-cn/device-dev/bundles/figures/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212.png" rename to "zh-cn/device-dev/bundles/figure/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212-21.png" diff --git a/zh-cn/device-dev/bundles/figures/zh-cn_image_0000001051452177.png b/zh-cn/device-dev/bundles/figure/zh-cn_image_0000001051452177.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/bundles/figures/zh-cn_image_0000001051452177.png rename to zh-cn/device-dev/bundles/figure/zh-cn_image_0000001051452177.png diff --git a/zh-cn/device-dev/bundles/figures/zh-cn_image_0000001051770876.png b/zh-cn/device-dev/bundles/figure/zh-cn_image_0000001051770876.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/bundles/figures/zh-cn_image_0000001051770876.png rename to zh-cn/device-dev/bundles/figure/zh-cn_image_0000001051770876.png diff --git a/zh-cn/device-dev/bundles/figure/zh-cn_image_0000001173313501.png b/zh-cn/device-dev/bundles/figure/zh-cn_image_0000001173313501.png new file mode 100644 index 0000000000000000000000000000000000000000..bc682a3dbd7e3de6a83a7292d9c6942c43909c98 Binary files /dev/null and b/zh-cn/device-dev/bundles/figure/zh-cn_image_0000001173313501.png differ diff --git "a/zh-cn/device-dev/bundles/figure/\347\241\254\344\273\266\347\216\257\345\242\203\350\277\236\346\216\245\345\205\263\347\263\273.png" "b/zh-cn/device-dev/bundles/figure/\347\241\254\344\273\266\347\216\257\345\242\203\350\277\236\346\216\245\345\205\263\347\263\273.png" new file mode 100644 index 0000000000000000000000000000000000000000..c4636401a20e37794d8ec28dc173e9308b2b72db Binary files /dev/null and "b/zh-cn/device-dev/bundles/figure/\347\241\254\344\273\266\347\216\257\345\242\203\350\277\236\346\216\245\345\205\263\347\263\273.png" differ diff --git "a/zh-cn/device-dev/bundles/figures/\347\273\204\344\273\2660924.png" "b/zh-cn/device-dev/bundles/figure/\347\273\204\344\273\2660924.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/bundles/figures/\347\273\204\344\273\2660924.png" rename to "zh-cn/device-dev/bundles/figure/\347\273\204\344\273\2660924.png" diff --git "a/zh-cn/device-dev/bundles/figures/\347\273\204\344\273\266\345\214\205\344\276\235\350\265\226\345\205\263\347\263\273\345\233\276.png" "b/zh-cn/device-dev/bundles/figures/\347\273\204\344\273\266\345\214\205\344\276\235\350\265\226\345\205\263\347\263\273\345\233\276.png" deleted file mode 100755 index 1b936a2cbc95d3f9d7ddab0187305c3d0c486b0a..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/bundles/figures/\347\273\204\344\273\266\345\214\205\344\276\235\350\265\226\345\205\263\347\263\273\345\233\276.png" and /dev/null differ diff --git a/zh-cn/device-dev/bundles/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/bundles/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/bundles/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/bundles/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/bundles/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/bundles/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/bundles/public_sys-resources/icon-note.gif b/zh-cn/device-dev/bundles/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/bundles/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/bundles/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/bundles/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/bundles/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/bundles/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/bundles/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/bundles/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/bundles/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/bundles/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/bundles/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/bundles/\345\217\221\350\241\214\347\211\210.md" "b/zh-cn/device-dev/bundles/\345\217\221\350\241\214\347\211\210.md" deleted file mode 100755 index 00640e559945546ce8b17badb65e388934290751..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/bundles/\345\217\221\350\241\214\347\211\210.md" +++ /dev/null @@ -1,56 +0,0 @@ -# 发行版 - -发行版通常是将一系列组件组合起来,成为编译可以运行的OpenHarmony解决方案镜像,里面包含了多个依赖的组件,以及脚本,用于描述如何完整编译、链接这些组件。 - -发行版本身通常不需要包含功能实现代码,仅包含bundle.json描述(设置publishAs为distribution)和一些编译脚本组成。 - -因为发行版编译的过程需要系统提供环境变量,所以发行版使用scripts脚本中内置的dist命令: - -``` -{ - "publishAs":"distribution", - "scripts": { - "dist": "script compile command" - } -} -``` - -编译执行使用如下命令: - -``` -hpm dist -``` - -重新定义一个发行版所具有的功能是一个复杂的过程,所以系统允许对发行版进行继承,从而在现有功能的基础上进行定制。继承发行版需要在bundle.json中定义base字段。 - -``` -{ - "base": { - "name": "dist_wifi_iot", - "version": "1.0.0" - } -} -``` - -上述定义表明当前组件继承自发行版组件dist-wifi-iot 1.0.0。 - -发行版由很多的依赖组件组成,通过bundle.json中的dependencies段来描述,有些依赖是必须的,有些依赖则是根据可以需求增加或删除的。bundle.json中名称前带有?的依赖表示可选依赖,继承它的发行版,可以移除掉该可选组件,再增加别的组件进行替换。 - -``` -{ - "dependencies": { - "?my_bundle": "1.0.0" - } -} -``` - -上述声明表示my\_bundle依赖可以被移除。如果想要移除my\_bundle,在上层依赖方需要使用excludes关键字来进行定义 - -``` -{ - "excludes": [ "my_bundle" ] -} -``` - -依赖被移除后,就不会参入组件的构建过程。只有标记为可选的依赖才能够被移除,强行移除未被标记的依赖会出现错误提示。 - diff --git "a/zh-cn/device-dev/bundles/\346\246\202\350\277\260.md" "b/zh-cn/device-dev/bundles/\346\246\202\350\277\260.md" deleted file mode 100755 index 2eea128f92a994c5b63625ee824d4bf4abc14fc1..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/bundles/\346\246\202\350\277\260.md" +++ /dev/null @@ -1,38 +0,0 @@ -# 概述 - -- [定义](#section177563344911) -- [组件划分原则](#section2487162541016) -- [组件依赖](#section185955409107) - -本文档将介绍组件的基本概念以及如何按照规范定义组件。 - -## 定义 - -OpenHarmony软件以组件\(bundle\)作为基本单元,从系统角度看,凡是运行在OpenHarmony上的软件都可以定义为组件;一般来讲,根据组件的应用范围,可以分为: - -- 板级组件:如board、arch、mcu这些与设备硬件相关的组件。 -- 系统组件:一组独立功能的集合,如内核、文件系统、框架等。 -- 应用组件:直接面向用户提供服务的应用\(如wifi\_iot,ip\_camera\)。 - -从形式上看,组件是为复用而生,一切可以复用的模块都可以定义为组件,可以分为: - -- 源代码 -- 二进制 -- 代码片段 -- 发行版 - -## 组件划分原则 - -原则上应尽可能划分为细颗粒度的组件,以满足最大限度的复用。主要考虑以下几点: - -- 独立性:组件的功能应该相对独立,支持独立编译,可以单独对外提供接口和服务; -- 耦合性:如果组件必须依赖其他的组件,才能对外提供服务,应考虑和被依赖的组件合并为一个组件。 -- 相关性:如果一组组件共同完成一项功能,且没有被其他组件依赖,未来也没有被依赖的可能,则可以考虑合并为一个组件。 - -## 组件依赖 - -组件的依赖关系分为两种:必选依赖和可选依赖。 - -- 必选依赖:是指组件A在完成某个功能时,必须引入组件B,调用B的接口或服务配合才能完成。称B为A的必选依赖。 -- 可选依赖:是在组件A在完成某个功能时,可以引入组件C,也可以引入组件D。C和D可以相互替换,称C和D为A的可选依赖。 - diff --git "a/zh-cn/device-dev/bundles/\347\216\257\345\242\203\345\217\230\351\207\217\350\257\264\346\230\216.md" "b/zh-cn/device-dev/bundles/\347\216\257\345\242\203\345\217\230\351\207\217\350\257\264\346\230\216.md" deleted file mode 100755 index 1ebf8fb99e32dc1c0394271881de47afba0d47a4..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/bundles/\347\216\257\345\242\203\345\217\230\351\207\217\350\257\264\346\230\216.md" +++ /dev/null @@ -1,53 +0,0 @@ -# 环境变量说明 - -组件在编译的过程中需要依赖系统提供的环境变量来自定义输出,链接所需二进制文件等等。这里提出的环境变量均指根据需求把所需变量注入脚本执行的上下文中。所以在脚本中可以直接获取到变量的值。下面介绍当前系统存在的几种环境变量。全局变量 - -全局变量由bundle.json中的envs属性来定义。整个组件中的依赖都可以获取到全局变量定义的值。 - -``` -{ - "envs": { - "compileEnv": "arm" - } -} -``` - -不同组件在引入依赖的过程中可以传入不同的参数,从而使依赖的编译可以满足当前组件的需求。依赖中定义的参数可以在对应依赖脚本执行的上下文中获取到。 - -``` -{ - "dependencies": { - "my-bundle": { - "version": "1.0.0", - "mode": "debug" - } - } -} -``` - -组件在链接二进制文件的时候,需要知道二进制文件在依赖中的路径,所以依赖的路径会作为环境变量传入编译组件中。 - -传入的环境变量的格式为DEP\_BundleName,BundleName为依赖的名称,例如 DEP\_first\_bundle。 - -依赖中可以定义标签,对引入的依赖进行分组。在脚本中可以根据标签,获得这一组依赖的路径。定义的标签以\#开头,具体定义的方式为: - -``` -{ - "dependencies": { - "#tool": { - "first-bundle": "1.0.0", - "second-bundle": "1.0.0" - }, - "#drivers": { - "xx-bundle": "1.0.0", - "yy-bundle": "1.0.0" - } - } -} -``` - -系统中存在两个固定环境变量: - -- DEP\_OHOS\_BUNDLES:表示ohos\_bundles文件夹所在的路径。 -- DEP\_BUNDLE\_BASE:表示最外层组件的路径。 - diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\350\247\204\350\214\203.md" "b/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\350\247\204\350\214\203.md" deleted file mode 100755 index 4205b8d5383cd8baea3a4ce99710e0715682190d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\345\274\200\345\217\221\350\247\204\350\214\203.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 组件开发规范 - -- **[概述](概述.md)** - -- **[组件构成](组件构成.md)** - -- **[组件管理](组件管理.md)** - -- **[组件版本](组件版本.md)** - -- **[发行版](发行版.md)** - -- **[环境变量说明](环境变量说明.md)** - - diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\346\236\204\346\210\220.md" "b/zh-cn/device-dev/bundles/\347\273\204\344\273\266\346\236\204\346\210\220.md" deleted file mode 100755 index 98e4e2dd608c2fb78374ae2c9b8ce57748499723..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\346\236\204\346\210\220.md" +++ /dev/null @@ -1,99 +0,0 @@ -# 组件构成 - -- [代码文件](#section101483489110) -- [说明文件](#section10519101221211) -- [元数据描述文件](#section45511827111211) - -一个组件包一般包含如下内容: - -- 组件包的代码或库(src目录下的代码文件) -- ohos\_bundles文件夹(存放依赖的组件,安装组件时自动生成,无需提交到代码库) -- 组件包的说明文件\(README.md\) -- 组件包元数据声明文件\(bundle.json\) -- 开源许可文件\(LICENSE\) - - ``` - my-bundle - |_ohos_bundles - |_src - |_bundle.json - |_README.md - |_LICENSE - ``` - - -## 代码文件 - -组件的代码文件和普通的代码目录没有差异。但要注意的是,组件中对外暴露的接口(头文件),会被其他组件所引用,需要单独在bundle.json的dirs中声明。 - -## 说明文件 - -README.md,为markdown格式的描述关于组件自述说明文件。([语法参考](https://www.markdownguide.org/getting-started/)\) - -为了帮助他人在hpm上找到该组件,并更方便的使用它,在组件的根目录中包含一个README文件。 - -README文件可能包括如何安装,配置和使用组件包中的实例代码说明,以及可能会对用户有所帮助的任何其他信息。 - -每个组件的自述文件将显示在hpm系统的组件详情页面的描述中。 - -## 元数据描述文件 - -bundle.json文件是对当前组件的元数据描述,每个组件中必须包含一个bundle.json文件。 - -``` -{ - "name": "@myorg/demo-bundle", - "version": "1.0.0", - "license": "MIT", - "description": "bundle description", - "keywords": ["hos"], - "tags": ["applications", "drivers"], - "author": {"name":"","email":"","url":""}, - "contributors":[{"name":"","email":"","url":""},{"name":"","email":"","url":""}], - "homepage": "http://www.foo.bar.com", - "repository": "https://git@gitee.com:foo/bar.git", - "publishAs": "source", - "dirs": { - "src": ["src/**/*.c"], - "headers": ["headers/**/*.h"], - "bin": ["bin/**/*.o"] - }, - "scripts": { - "build": "make" - }, - "envs": {}, - "ohos": { - "os": "2.0.0", - "board": "hi3516", - "kernel": "liteos-a" - }, - "rom": "10240", - "ram": "1024", - "dependencies": { - "@myorg/net":"1.0.0" - } -} -``` - -bundle.json文件具有如下功能: - -- name:定义组件的名称,放到组织下, 以@开头,/分割,如:@myorg/mybundle - -- version:定义组件版本号,如1.0.0,需满足semver的标准。 - -- description:一句话对组件进行简要的描述。 -- dependencies:定义组件的依赖组件。 - -- envs: 定义组件编译时所需要的参数,包括全局参数以及依赖所需的参数。 - -- scripts:定义在当前组件下能够执行的命令(如编译,构建,测试,烧录等)。 - -- publishAs:定义组件的发布类型(source:源码,binary:二进制,distribution:发行版,code-segment:代码片段)。 - -- dirs:定义发布时打包的目录结构(如头文件)。 - -- ram&rom:统计相关信息:预计占用ROM和RAM信息。 -- ohos:描述OpenHarmony系统版本、开发板及内核的匹配关系(多个请用英文逗号的“,”分割)。 -- 定义其他扩展信息:作者,主页,代码仓库,许可协议,标签,关键字。 -- 对于发行版类型,还有个base,可以定义继承自的发行版。 - diff --git "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\347\211\210\346\234\254.md" "b/zh-cn/device-dev/bundles/\347\273\204\344\273\266\347\211\210\346\234\254.md" deleted file mode 100755 index 55647fdcb7093589938272e874379867ef00ffea..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/bundles/\347\273\204\344\273\266\347\211\210\346\234\254.md" +++ /dev/null @@ -1,23 +0,0 @@ -# 组件版本 - -- [版本号命名规范](#section16893854141310) -- [版本发布](#section43401320171420) - -## 版本号命名规范 - -名称需要为全小写字母,中间可以使用中划线或者下划线分隔。比如 "bundle", "my\_bundle"。 - -版本号的格式为 "主版本号.次版本号.修订号" 或 "主版本号.次版本号.修订号-先行版本号",比如 "1.0.0", "1.0.0-beta",详细规格可以参考 [https://semver.org](https://semver.org/)。 - -## 版本发布 - -为了使组件能被其他开发者使用,组件需要上传到远端仓库。组件上传使用如下命令: - -``` -hpm publish -``` - -命令执行以后,系统会对的整个依赖关系进行检查,下载缺失依赖组件。依赖检查完成后,如果发布类型为binary,系统会对整个组件进行编译,生成二进制文件,然后打包上传。如果使其他上传类型,则直接根据定义的打包规则进行打包,然后上传。 - -注意:发布组件需要用户账号登录,需要先拥有hpm的系统账号后,并注册组织,申请组织认证通过后,才拥有发布的权限。 - diff --git a/zh-cn/device-dev/driver/GPIO.md b/zh-cn/device-dev/driver/GPIO.md deleted file mode 100755 index afffef57ab689bd2220b0cc24b3323089b0e2d52..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/GPIO.md +++ /dev/null @@ -1,9 +0,0 @@ -# GPIO - -- **[GPIO概述](GPIO概述.md)** - -- **[GPIO使用指导](GPIO使用指导.md)** - -- **[GPIO使用实例](GPIO使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/GPIO\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/GPIO\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index 86231b7af28d913333f5ee3c7440ce6c7551d4a7..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/GPIO\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,79 +0,0 @@ -# GPIO使用实例 - -本实例程序中,我们将测试一个GPIO管脚的中断触发:为管脚设置中断服务函数,触发方式为边沿触发,然后通过交替写高低电平到管脚,产生电平波动,制造触发条件,观察中断服务函数的执行。 - -首先需要选取一个空闲的GPIO管脚,本例程基于Hi3516DV300某开发板,GPIO管脚选择GPIO10\_3,换算成GPIO号为83。 - -读者可以根据自己使用的开发板,参考其原理图,选择一个空闲的GPIO管脚即可。 - -``` -#include "gpio_if.h" -#include "hdf_log.h" -#include "osal_irq.h" -#include "osal_time.h" - -static uint32_t g_irqCnt; - -/* 中断服务函数*/ -static int32_t TestCaseGpioIrqHandler(uint16_t gpio, void *data) -{ - HDF_LOGE("%s: irq triggered! on gpio:%u, data=%p", __func__, gpio, data); - g_irqCnt++; /* 如果中断服务函数触发执行,则将全局中断计数加1 */ - return GpioDisableIrq(gpio); -} - -/* 测试用例函数 */ -static int32_t TestCaseGpioIrqEdge(void) -{ - int32_t ret; - uint16_t valRead; - uint16_t mode; - uint16_t gpio = 83; /* 待测试的GPIO管脚号 */ - uint32_t timeout; - - /* 将管脚方向设置为输出 */ - ret = GpioSetDir(gpio, GPIO_DIR_OUT); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set dir fail! ret:%d\n", __func__, ret); - return ret; - } - - /* 先禁止该管脚中断 */ - ret = GpioDisableIrq(gpio); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: disable irq fail! ret:%d\n", __func__, ret); - return ret; - } - - /* 为管脚设置中断服务函数,触发模式为上升沿和下降沿共同触发 */ - mode = OSAL_IRQF_TRIGGER_RISING | OSAL_IRQF_TRIGGER_FALLING; - HDF_LOGE("%s: mode:%0x\n", __func__, mode); - ret = GpioSetIrq(gpio, mode, TestCaseGpioIrqHandler, NULL); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set irq fail! ret:%d\n", __func__, ret); - return ret; - } - - /* 使能此管脚中断 */ - ret = GpioEnableIrq(gpio); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: enable irq fail! ret:%d\n", __func__, ret); - (void)GpioUnSetIrq(gpio); - return ret; - } - - g_irqCnt = 0; /* 清除全局计数器 */ - timeout = 0; /* 等待时间清零 */ - /* 等待此管脚中断服务函数触发,等待超时时间为1000毫秒 */ - while (g_irqCnt <= 0 && timeout < 1000) { - (void)GpioRead(gpio, &valRead); - (void)GpioWrite(gpio, (valRead == GPIO_VAL_LOW) ? GPIO_VAL_HIGH : GPIO_VAL_LOW); - HDF_LOGE("%s: wait irq timeout:%u\n", __func__, timeout); - OsalMDelay(200); /* wait for irq trigger */ - timeout += 200; - } - (void)GpioUnSetIrq(gpio); - return (g_irqCnt > 0) ? HDF_SUCCESS : HDF_FAILURE; -} -``` - diff --git "a/zh-cn/device-dev/driver/GPIO\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/GPIO\346\246\202\350\277\260.md" deleted file mode 100755 index 1c4bcfc9c060718e31a5dd7bf267513fdb3afb0d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/GPIO\346\246\202\350\277\260.md" +++ /dev/null @@ -1,82 +0,0 @@ -# GPIO概述 - -- [简介](#section15318165672215) -- [接口说明](#section18977142162418) - -## 简介 - -GPIO(General-purpose input/output)即通用型输入输出。通常,GPIO控制器通过分组的方式管理所有GPIO管脚,每组GPIO有一个或多个寄存器与之关联,通过读写寄存器完成对GPIO管脚的操作。 - -GPIO接口定义了操作GPIO管脚的标准方法集合,包括: - -- 设置管脚方向: 方向可以是输入或者输出\(暂不支持高阻态\) - -- 读写管脚电平值: 电平值可以是低电平或高电平 -- 设置管脚中断服务函数:设置一个管脚的中断响应函数,以及中断触发方式 -- 使能和禁止管脚中断:禁止或使能管脚中断 - -## 接口说明 - -**表 1** GPIO驱动API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

GPIO读写

-

GpioRead

-

读管脚电平值

-

GpioWrite

-

写管脚电平值

-

GPIO配置

-

GpioSetDir

-

设置管脚方向

-

GpioGetDir

-

获取管脚方向

-

GPIO中断设置

-

GpioSetIrq

-

设置管脚对应的中断服务函数

-

GpioUnSetIrq

-

取消管脚对应的中断服务函数

-

GpioEnableIrq

-

使能管脚中断

-

GpioDisableIrq

-

禁止管脚中断

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 - diff --git "a/zh-cn/device-dev/driver/HDF\351\251\261\345\212\250\346\241\206\346\236\266.md" "b/zh-cn/device-dev/driver/HDF\351\251\261\345\212\250\346\241\206\346\236\266.md" deleted file mode 100755 index fb6f985a6e5516f1520061a7923ee782a26fc9a0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/HDF\351\251\261\345\212\250\346\241\206\346\236\266.md" +++ /dev/null @@ -1,15 +0,0 @@ -# HDF驱动框架 - -- **[HDF开发概述](HDF开发概述.md)** - -- **[驱动开发](驱动开发.md)** - -- **[驱动服务管理](驱动服务管理.md)** - -- **[驱动消息机制管理](驱动消息机制管理.md)** - -- **[配置管理](配置管理.md)** - -- **[HDF开发实例](HDF开发实例.md)** - - diff --git a/zh-cn/device-dev/driver/I2C.md b/zh-cn/device-dev/driver/I2C.md deleted file mode 100755 index 5bc8c5bf3ce065ab72f19260fe0ab8ca622c0cd8..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/I2C.md +++ /dev/null @@ -1,9 +0,0 @@ -# I2C - -- **[I2C概述](I2C概述.md)** - -- **[I2C使用指导](I2C使用指导.md)** - -- **[I2C使用实例](I2C使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/I2C\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/I2C\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index a75da59b1b8b225230df1091d4335afbd8240b1d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/I2C\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,192 +0,0 @@ -# I2C使用实例 - -本例程以操作开发板上的I2C设备为例,详细展示I2C接口的完整使用流程。 - -本例拟对Hi3516DV300某开发板上TouchPad设备进行简单的寄存器读写访问,基本硬件信息如下: - -- SOC:hi3516dv300。 - -- Touch IC:I2C地址为0x38, IC内部寄存器位宽为1字节。 - -- 原理图信息:TouchPad设备挂接在3号I2C控制器下;IC的复位管脚为3号GPIO。 - -本例程首先对Touch IC进行复位操作(开发板上电默认会给TouchIC供电,本例程不考虑供电),然后对其内部寄存器进行随机读写,测试I2C通路是否正常。 - ->![](public_sys-resources/icon-note.gif) **说明:** ->本例程重点在于展示I2C设备访问流程,并验证I2C通路,所以对于设备寄存器读写值不做关注,读写寄存器导致的行为由设备自身决定。 - -示例如下: - -``` -#include "i2c_if.h" /* I2C标准接口头文件 */ -#include "gpio_if.h" /* GPIO标准接口头文件 */ -#include "hdf_log.h" /* 标准日志打印头文件 */ -#include "osal_io.h" /* 标准IO读写接口头文件 */ -#include "osal_time.h" /* 标准延迟&睡眠接口头文件 */ - -/* 定义一个表示TP设备的结构体,存储i2c及gpio相关硬件信息 */ -struct TpI2cDevice { - uint16_t rstGpio; /* 复位管脚 */ - uint16_t busId; /* I2C总线号 */ - uint16_t addr; /* I2C设备地址 */ - uint16_t regLen; /* 寄存器字节宽度 */ - DevHandle i2cHandle; /* I2C控制器句柄 */ -}; - -/* I2C管脚io配置,需要查阅SOC寄存器手册 */ -#define I2C3_DATA_REG_ADDR 0x112f008c /* 3号I2C控制器SDA管脚配置寄存器地址 */ -#define I2C3_CLK_REG_ADDR 0x112f0090 /* 3号I2C控制器SCL管脚配置寄存器地址 */ -#define I2C_REG_CFG 0x5f1 /* 3号I2C控制器SDA及SCL管脚配置值 */ - -static void TpSocIoCfg(void) -{ - /* 将3号I2C控制器对应两个管脚的IO功能设置为I2C */ - OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_DATA_REG_ADDR)); - OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_CLK_REG_ADDR)); -} - -/* 对TP的复位管脚进行初始化, 拉高维持20ms, 再拉底维持50ms,最后再拉高维持20ms, 完成复位动作 */ -static int32_t TestCaseGpioInit(struct TpI2cDevice *tpDevice) -{ - int32_t ret; - - /* 设置复位管脚方向为输出 */ - ret = GpioSetDir(tpDevice->rstGpio, GPIO_DIR_OUT); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst dir fail!:%d", __func__, ret); - return ret; - } - - ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst hight fail!:%d", __func__, ret); - return ret; - } - OsalMSleep(20); - - ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_LOW); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst low fail!:%d", __func__, ret); - return ret; - } - OsalMSleep(50); - - ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set rst high fail!:%d", __func__, ret); - return ret; - } - OsalMSleep(20); - - return HDF_SUCCESS; -} - -/* 基于I2cTransfer方法封装一个寄存器读写的辅助函数, 通过flag表示读或写 */ -static int TpI2cReadWrite(struct TpI2cDevice *tpDevice, unsigned int regAddr, - unsigned char *regData, unsigned int dataLen, uint8_t flag) -{ - int index = 0; - unsigned char regBuf[4] = {0}; - struct I2cMsg msgs[2] = {0}; - - /* 单双字节寄存器长度适配 */ - if (tpDevice->regLen == 1) { - regBuf[index++] = regAddr & 0xFF; - } else { - regBuf[index++] = (regAddr >> 8) & 0xFF; - regBuf[index++] = regAddr & 0xFF; - } - - /* 填充I2cMsg消息结构 */ - msgs[0].addr = tpDevice->addr; - msgs[0].flags = 0; /* 标记为0,表示写入 */ - msgs[0].len = tpDevice->regLen; - msgs[0].buf = regBuf; - - msgs[1].addr = tpDevice->addr; - msgs[1].flags = (flag == 1) ? I2C_FLAG_READ : 0; /* 添加读标记位,表示读取 */ - msgs[1].len = dataLen; - msgs[1].buf = regData; - - if (I2cTransfer(tpDevice->i2cHandle, msgs, 2) != 2) { - HDF_LOGE("%s: i2c read err", __func__); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -/* TP寄存器读函数 */ -static inline int TpI2cReadReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, - unsigned char *regData, unsigned int dataLen) -{ - return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 1); -} - -/* TP寄存器写函数 */ -static inline int TpI2cWriteReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, - unsigned char *regData, unsigned int dataLen) -{ - return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 0); -} - -/* I2C例程总入口 */ -static int32_t TestCaseI2c(void) -{ - int32_t i; - int32_t ret; - unsigned char bufWrite[7] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xA, 0xB, 0xC }; - unsigned char bufRead[7] = {0}; - static struct TpI2cDevice tpDevice; - - /* IO管脚功能配置 */ - TpSocIoCfg(); - - /* TP设备信息初始化 */ - tpDevice.rstGpio = 3; - tpDevice.busId = 3; - tpDevice.addr = 0x38; - tpDevice.regLen = 1; - tpDevice.i2cHandle = NULL; - - /* GPIO管脚初始化 */ - ret = TestCaseGpioInit(&tpDevice); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: gpio init fail!:%d", __func__, ret); - return ret; - } - - /* 打开I2C控制器 */ - tpDevice.i2cHandle = I2cOpen(tpDevice.busId); - if (tpDevice.i2cHandle == NULL) { - HDF_LOGE("%s: Open I2c:%u fail!", __func__, tpDevice.busId); - return -1; - } - - /* 向TP-IC的0xD5寄存器连续写7字节数据 */ - ret = TpI2cWriteReg(&tpDevice, 0xD5, bufWrite, 7); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: tp i2c write reg fail!:%d", __func__, ret); - I2cClose(tpDevice.i2cHandle); - return -1; - } - OsalMSleep(10); - - /* 从TP-IC的0xDO寄存器连续读7字节数据 */ - ret = TpI2cReadReg(&tpDevice, 0xD5, bufRead, 7); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: tp i2c read reg fail!:%d", __func__, ret); - I2cClose(tpDevice.i2cHandle); - return -1; - } - - HDF_LOGE("%s: tp i2c write&read reg success!", __func__); - for (i = 0; i < 7; i++) { - HDF_LOGE("%s: bufRead[%d] = 0x%x", __func__, i, bufRead[i]); - } - - /* 访问完毕关闭I2C控制器 */ - I2cClose(tpDevice.i2cHandle); - return ret; -} -``` - diff --git "a/zh-cn/device-dev/driver/I2C\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/I2C\346\246\202\350\277\260.md" deleted file mode 100755 index 7961b58a8284049766dc470b862e377d79f1c696..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/I2C\346\246\202\350\277\260.md" +++ /dev/null @@ -1,60 +0,0 @@ -# I2C概述 - -- [简介](#section5361140416) -- [接口说明](#section7606310210) - -## 简介 - -- I2C\(Inter Integrated Circuit\)总线是由Philips公司开发的一种简单、双向二线制同步串行总线。 -- I2C以主从方式工作,通常有一个主设备和一个或者多个从设备,主从设备通过SDA\(SerialData\)串行数据线以及SCL\(SerialClock\)串行时钟线两根线相连,如[图1 ](#fig1135561232714)所示。 - -- I2C数据的传输必须以一个起始信号作为开始条件,以一个结束信号作为传输的停止条件。数据传输以字节为单位,高位在前,逐个bit进行传输。 -- I2C总线上的每一个设备都可以作为主设备或者从设备,而且每一个设备都会对应一个唯一的地址,当主设备需要和某一个从设备通信时,通过广播的方式,将从设备地址写到总线上,如果某个从设备符合此地址,将会发出应答信号,建立传输。 - -- I2C接口定义了完成I2C传输的通用方法集合,包括: - - - I2C控制器管理: 打开或关闭I2C控制器 - - I2C消息传输:通过消息传输结构体数组进行自定义传输 - - **图 1** I2C物理连线示意图 - ![](figures/I2C物理连线示意图.png "I2C物理连线示意图") - - -## 接口说明 - -**表 1** I2C驱动API接口功能介绍 - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

I2C控制器管理接口

-

I2cOpen

-

打开I2C控制器

-

I2cClose

-

关闭I2C控制器

-

I2c消息传输接口

-

I2cTransfer

-

自定义传输

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 - diff --git a/zh-cn/device-dev/driver/LCD.md b/zh-cn/device-dev/driver/LCD.md deleted file mode 100755 index b6352ca83310a7c0f1d6af1d09f47a8450e626db..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/LCD.md +++ /dev/null @@ -1,9 +0,0 @@ -# LCD - -- **[LCD开发概述](LCD开发概述.md)** - -- **[LCD开发指导](LCD开发指导.md)** - -- **[LCD开发实例](LCD开发实例.md)** - - diff --git "a/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\346\214\207\345\257\274.md" deleted file mode 100755 index 12161e4cef9752fb16db59f597560828f5af8085..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ /dev/null @@ -1,23 +0,0 @@ -# LCD开发指导 - -- [开发步骤](#section3904154911218) - -Display驱动模型基于HDF驱动框架、Platform接口及OSAL接口开发,可以做到不区分OS(LiteOS、Linux)和芯片平台(Hi35xx、Hi38xx、V3S等),为LCD器件提供统一的驱动模型。 - -## 开发步骤 - -1. 添加LCD驱动相关的设备描述配置。 -2. 在SOC平台驱动适配层中适配对应的芯片平台驱动。 -3. 添加器件驱动,并在驱动入口函数Init中注册Panel驱动数据,驱动数据接口主要包括如下接口: - - LCD上下电 - - 根据LCD硬件连接,使用Platform接口层提供的GPIO操作接口操作对应LCD管脚,例如复位管脚、IOVCC管脚,上电时序参考LCD供应商提供的SPEC。 - - - 发送初始化序列 - - 根据LCD硬件接口,使用Platform接口层提供的I2C、SPI、MIPI等接口,下载LCD初始化序列,初始化参数序列可以参考LCD供应商提供的SPEC。 - - -4. 根据需求实现HDF框架其他接口,比如Release接口。 -5. 根据需求使用HDF框架可创建其他设备节点,用于业务逻辑或者调试功能。 - diff --git "a/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\346\246\202\350\277\260.md" deleted file mode 100755 index ab5e824934e96eedd766288dbeb33f93d7b38ab2..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\346\246\202\350\277\260.md" +++ /dev/null @@ -1,46 +0,0 @@ -# LCD开发概述 - -- [简介](#section3781515122118) -- [接口说明](#section20280192712120) - -## 简介 - -LCD(Liquid Crystal Display)液晶显示驱动,对LCD进行上电,并通过接口初始化LCD内部寄存器,使LCD正常工作。Display驱动模型基于HDF( Hardware Driver Foundation)[驱动框架](HDF开发概述.md)开发,实现跨OS、跨平台,为LCD硬件提供上下电功能、发送初始化序列功能,使LCD进入正常的工作模式,显示芯片平台侧的图像数据,基于HDF驱动框架的Display驱动模型如[图1](#fig69138814229)。 - -**图 1** 基于HDF驱动框架的Display驱动模型 -![](figures/基于HDF驱动框架的Display驱动模型.png "基于HDF驱动框架的Display驱动模型") - -- **Display驱动模型介绍** - - Display驱动模型主要由平台驱动层、芯片平台适配层、LCD器件驱动层三部分组成。驱动模型基于HDF驱动框架开发,通过Platform层和OSAL层提供的接口,屏蔽内核形态的差异,使得器件驱动可以便利的迁移到不同OS及芯片平台。模型向上对接Display公共hal层,支撑HDI接口的实现,通过Display-HDI(Hardware Display Interface)对图形服务提供各类驱动能力接口。 - - (1)Display平台驱动层:通过HDF提供的IOService数据通道,与公共Hal层对接,集中接收并处理各类上层调用指令; - - (2)SOC平台驱动适配层:借助此SOC适配层,实现Display驱动和SOC侧驱动解耦,主要完成芯片平台相关的参数配置,并传递平台驱动层的调用到器件驱动层; - - (3)LCD器件驱动层:在器件驱动层中,主要实现和器件自身强相关的驱动适配接口,例如发送初始化序列、上下电、背光设置等。 - - 基于Display驱动模型开发LCD驱动,可以借助平台提供的各种能力及接口,较大程度的降低器件驱动的开发周期和难度,提升开发效率。 - - -## 接口说明 - -LCD接口通常可分为MIPI DSI接口、TTL接口和LVDS接口,常用的是MIPI DSI接口和TTL接口,下面对常用的MIPI DSI接口和TTL接口作简要介绍。 - -- MIPI DSI接口 - - **图 2** MIPI DSI接口 - ![](figures/MIPI-DSI接口.png "MIPI-DSI接口") - - MIPI DSI接口是MIPI(移动行业处理器接口)联盟定义的显示接口,主要用于移动终端显示屏接口,接口数据传输遵循MIPI协议,MIPI DSI接口为数据接口,传输图像数据,通常情况下MIPI DSI接口的控制信息以MIPI包形式通过MIPI DSI接口发送到对端IC,不需要额外的外设接口。 - -- TTL接口 - - **图 3** TTL接口 - ![](figures/TTL接口.png "TTL接口") - - TTL(Transistor Transistor Logic)即晶体管-晶体管逻辑,TTL电平信号由TTL器件产生,TTL器件是数字集成电路的一大门类,它采用双极型工艺制造,具有高速度、低功耗和品种多等特点。 - - TTL接口是并行方式传输数据的接口,有数据信号、时钟信号和控制信号(行同步、帧同步、数据有效信号等),在控制信号控制下完成数据传输。通常TTL接口的LCD,内部寄存器读写需要额外的外设接口,比如SPI接口、I2C接口等。 - - diff --git a/zh-cn/device-dev/driver/MIPI-DSI.md b/zh-cn/device-dev/driver/MIPI-DSI.md deleted file mode 100755 index 2dcbddcdd053fdc85e2b8478b690d79dfe41909d..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/MIPI-DSI.md +++ /dev/null @@ -1,9 +0,0 @@ -# MIPI DSI - -- **[MIPI DSI概述](MIPI-DSI概述.md)** - -- **[MIPI DSI使用指导](MIPI-DSI使用指导.md)** - -- **[MIPI DSI使用实例](MIPI-DSI使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/MIPI-DSI\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/MIPI-DSI\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index 77e9242f30b175fee1f855d9516d3e407aa2a8fa..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/MIPI-DSI\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,98 +0,0 @@ -# MIPI DSI使用实例 - -MIPI-DSI完整的使用示例如下所示: - -``` -#include "hdf.h" -#include "mipi_dsi_if.h" - -void PalMipiDsiTestSample(void) -{ - uint8_t chnId; - int32_t ret; - DevHandle handle = NULL; - - /* 设备通道编号 */ - chnId = 0; - /* 获取操作句柄 */ - handle = MipiDsiOpen(chnId); - if (handle == NULL) { - HDF_LOGE("MipiDsiOpen: failed!\n"); - return; - } - /* 配置相应参数 */ - struct MipiCfg cfg = {0}; - cfg.lane = DSI_4_LANES; - cfg.mode = DSI_CMD_MODE; - cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; - cfg.format = FORMAT_RGB_24_BIT; - cfg.pixelClk = 174; - cfg.phyDataRate = 384; - cfg.timingInfo.hsaPixels = 50; - cfg.timingInfo.hbpPixels = 55; - cfg.timingInfo.hlinePixels = 1200; - cfg.timingInfo.yResLines = 1800; - cfg.timingInfo.vbpLines = 33; - cfg.timingInfo.vsaLines = 76; - cfg.timingInfo.vfpLines = 120; - cfg.timingInfo.xResPixels = 1342; - /* 写入配置数据 */ - ret = MipiDsiSetCfg(g_handle, &cfg); - if (ret != 0) { - HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); - return; - } - /* 发送PANEL初始化指令 */ - struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); - if (cmd == NULL) { - return; - } - cmd->dtype = DTYPE_DCS_WRITE; - cmd->dlen = 1; - cmd->payload = OsalMemCalloc(sizeof(uint8_t)); - if (cmd->payload == NULL) { - HdfFree(cmd); - return; - } - *(cmd->payload) = DTYPE_GEN_LWRITE; - MipiDsiSetLpMode(mipiHandle); - ret = MipiDsiTx(mipiHandle, cmd); - MipiDsiSetHsMode(mipiHandle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: MipiDsiTx fail! ret=%d\n", __func__, ret); - HdfFree(cmd->payload); - HdfFree(cmd); - return; - } - HdfFree(cmd->payload); - HdfFree(cmd); - /* 回读panel状态寄存器 */ - uint8_t readVal = 0; - struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); - if (cmdRead == NULL) { - return; - } - cmdRead->dtype = DTYPE_DCS_READ; - cmdRead->dlen = 1; - cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); - if (cmdRead->payload == NULL) { - HdfFree(cmdRead); - return; - } - *(cmdRead->payload) = DDIC_REG_STATUS; - MipiDsiSetLpMode(g_handle); - ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); - MipiDsiSetHsMode(g_handle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); - HdfFree(cmdRead->payload); - HdfFree(cmdRead); - return; - } - HdfFree(cmdRead->payload); - HdfFree(cmdRead); - /* 释放MIPI DSI设备句柄 */ - MipiDsiClose(handle); -} -``` - diff --git "a/zh-cn/device-dev/driver/MIPI-DSI\344\275\277\347\224\250\346\214\207\345\257\274.md" "b/zh-cn/device-dev/driver/MIPI-DSI\344\275\277\347\224\250\346\214\207\345\257\274.md" deleted file mode 100755 index 58603da99a1536aebce4f61f049e5bc960d0114f..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/MIPI-DSI\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ /dev/null @@ -1,365 +0,0 @@ -# MIPI DSI使用指导 - -- [使用流程](#section8982671284) -- [获取MIPI-DSI操作句柄](#section57982569176) -- [MIPI-DSI相应配置](#section5935410201815) -- [发送/回读控制指令](#section611661316194) -- [释放MIPI-DSI操作句柄](#section217313211199) - -## 使用流程 - -使用MIPI-DSI的一般流程如[图1](#fig99821771782)所示。 - -**图 1** MIPI-DSI使用流程图 - - -![](figures/zh-cn_image_0000001072553354.png) - -## 获取MIPI-DSI操作句柄 - -在进行MIPI-DSI进行通信前,首先要调用MipiDsiOpen获取操作句柄,该函数会返回指定通道ID的操作句柄。 - -DevHandle MipiDsiOpen\(uint8\_t id\); - -**表 1** MipiDsiOpen的参数和返回值描述 - - - - - - - - - - - - - - - - - - -

参数

-

参数描述

-

id

-

MIPI DSI通道ID

-

返回值

-

返回值描述

-

NULL

-

获取失败

-

设备句柄

-

获取到指令通道的操作句柄, 类型为DevHandle

-
- -假设系统中的MIPI-DSI通道为0,获取该通道操作句柄的示例如下: - -``` -DevHandle mipiDsiHandle = NULL; /* 设备句柄 */ -chnId = 0; /* MIPI-DSI通道ID */ - -/* 获取操作句柄 */ -mipiDsiHandle = MipiDsiOpen(chnId); -if (mipiDsiHandle == NULL) { - HDF_LOGE("MipiDsiOpen: failed\n"); - return; -} -``` - -## MIPI-DSI相应配置 - -- 写入MIPI-DSI配置 - -int32\_t MipiDsiSetCfg\(DevHandle handle, struct MipiCfg \*cfg\); - -**表 2** MipiDsiSetCfg的参数和返回值描述 - - - - - - - - - - - - - - - - - - - - - -

参数

-

参数描述

-

handle

-

操作句柄

-

cfg

-

MIPI-DSI相应配置buf 指针

-

返回值

-

返回值描述

-

0

-

设置成功

-

负数

-

设置失败

-
- -``` -int32_t ret; -struct MipiCfg cfg = {0}; - -/* 当前对接的屏幕配置如下 */ -cfg.lane = DSI_4_LANES; -cfg.mode = DSI_CMD_MODE; -cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; -cfg.format = FORMAT_RGB_24_BIT; -cfg.pixelClk = 174; -cfg.phyDataRate = 384; -cfg.timingInfo.hsaPixels = 50; -cfg.timingInfo.hbpPixels = 55; -cfg.timingInfo.hlinePixels = 1200; -cfg.timingInfo.yResLines = 1800; -cfg.timingInfo.vbpLines = 33; -cfg.timingInfo.vsaLines = 76; -cfg.timingInfo.vfpLines = 120; -cfg.timingInfo.xResPixels = 1342; -/* 写入配置数据 */ -ret = MipiDsiSetCfg(g_handle, &cfg); -if (ret != 0) { - HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); - return -1; -} -``` - -- 获取当前MIPI-DSI的配置 - -int32\_t MipiDsiGetCfg\(DevHandle handle, struct MipiCfg \*cfg\); - -**表 3** MipiDsiGetCfg的参数和返回值描述 - - - - - - - - - - - - - - - - - - - - - -

参数

-

参数描述

-

handle

-

操作句柄

-

cfg

-

MIPI-DSI相应配置buf 指针

-

返回值

-

返回值描述

-

0

-

获取成功

-

负数

-

获取失败

-
- -``` -int32_t ret; -struct MipiCfg cfg; -memset(&cfg, 0, sizeof(struct MipiCfg)); -ret = MipiDsiGetCfg(g_handle, &cfg); -if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: GetMipiCfg fail!\n", __func__); - return HDF_FAILURE; -} -``` - -## 发送/回读控制指令 - -- 发送指令 - -int32\_t MipiDsiTx\(PalHandle handle, struct DsiCmdDesc \*cmd\); - -**表 4** MipiDsiTx的参数和返回值描述 - - - - - - - - - - - - - - - - - - - - - -

参数

-

参数描述

-

handle

-

操作句柄

-

cmd

-

需要发送的指令数据指针

-

返回值

-

返回值描述

-

0

-

发送成功

-

负数

-

发送失败

-
- -``` -int32_t ret; -struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); -if (cmd == NULL) { - return HDF_FAILURE; -} -cmd->dtype = DTYPE_DCS_WRITE; -cmd->dlen = 1; -cmd->payload = OsalMemCalloc(sizeof(uint8_t)); -if (cmd->payload == NULL) { - HdfFree(cmd); - return HDF_FAILURE; -} -*(cmd->payload) = DTYPE_GEN_LWRITE; -MipiDsiSetLpMode(mipiHandle); -ret = MipiDsiTx(mipiHandle, cmd); -MipiDsiSetHsMode(mipiHandle); -if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: PalMipiDsiTx fail! ret=%d\n", __func__, ret); - HdfFree(cmd->payload); - HdfFree(cmd); - return HDF_FAILURE; -} -HdfFree(cmd->payload); -HdfFree(cmd); -``` - -- 回读指令 - -int32\_t MipiDsiRx\(DevHandle handle, struct DsiCmdDesc \*cmd, uint32\_t readLen, uint8\_t \*out\); - -**表 5** MipiDsiRx的参数和返回值描述 - - - - - - - - - - - - - - - - - - - - - - - - - - - -

参数

-

参数描述

-

handle

-

操作句柄

-

cmd

-

需要回读的指令数据指针

-

readLen

-

期望回读的数据长度

-

out

-

回读的数据buf指针

-

返回值

-

返回值描述

-

0

-

获取成功

-

负数

-

获取失败

-
- -``` -int32_t ret; -uint8_t readVal = 0; - -struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); -if (cmdRead == NULL) { - return HDF_FAILURE; -} -cmdRead->dtype = DTYPE_DCS_READ; -cmdRead->dlen = 1; -cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); -if (cmdRead->payload == NULL) { - HdfFree(cmdRead); - return HDF_FAILURE; -} -*(cmdRead->payload) = DDIC_REG_STATUS; -MipiDsiSetLpMode(g_handle); -ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); -MipiDsiSetHsMode(g_handle); -if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); - HdfFree(cmdRead->payload); - HdfFree(cmdRead); - return HDF_FAILURE; -} -HdfFree(cmdRead->payload); -HdfFree(cmdRead); -``` - -## 释放MIPI-DSI操作句柄 - -MIPI-DSI使用完成之后,需要释放操作句柄,释放句柄的函数如下所示: - -void MipiDsiClose\(DevHandle handle\); - -该函数会释放掉由MipiDsiOpen申请的资源。 - -**表 6** MipiDsiClose的参数和返回值描述 - - - - - - - - - - -

参数

-

参数描述

-

handle

-

MIPI-DSI操作句柄

-
- -``` -MipiDsiClose(mipiHandle); /* 释放掉MIPI-DSI操作句柄 */ -``` - diff --git "a/zh-cn/device-dev/driver/MIPI-DSI\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/MIPI-DSI\346\246\202\350\277\260.md" deleted file mode 100755 index 5af73287eb9f6d46a3ec9f7fb5ca2e3d0668ce1b..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/MIPI-DSI\346\246\202\350\277\260.md" +++ /dev/null @@ -1,84 +0,0 @@ -# MIPI DSI概述 - -- [简介](#section1369320102013) -- [接口说明](#section6577545192317) - -## 简介 - -- DSI(Display Serial Interface)是由移动行业处理器接口联盟(Mobile Industry Processor Interface \(MIPI\) Alliance)制定的规范,旨在降低移动设备中显示控制器的成本。它以串行的方式发送像素数据或指令给外设\(通常是LCD或者类似的显示设备\),或从外设中读取状态信息或像素信息;它定义了主机、图像数据源和目标设备之间的串行总线和通信协议。 - -- MIPI-DSI具备高速模式和低速模式两种工作模式,全部数据通道都可以用于单向的高速传输,但只有第一个数据通道才可用于低速双向传输,从属端的状态信息、像素等是通过该数据通道返回。时钟通道专用于在高速传输数据的过程中传输同步时钟信号。 - - 图1显示了简化的DSI接口。从概念上看,符合DSI的接口与基于DBI-2和DPI-2标准的接口具有相同的功能。它向外围设备传输像素或命令数据,并且可以从外围设备读取状态或像素信息。主要区别在于,DSI对所有像素数据、命令和事件进行序列化,而在传统接口中,这些像素数据、命令和事件通常需要附加控制信号才能在并行数据总线上传输。 - - **图 1** DSI发送、接收接口 - ![](figures/DSI发送-接收接口.png "DSI发送-接收接口") - - - -## 接口说明 - -**表 1** MIPI-DSI API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

设置/获取当前MIPI-DSI相关配置

-

MipiDsiSetCfg

-

设置MIPI-DSI相关配置

-

MipiDsiGetCfg

-

获取当前MIPI-DSI相关配置

-

获取/释放MIPI-DSI操作句柄

-

MipiDsiOpen

-

获取MIPI-DSI操作句柄

-

MipiDsiClose

-

释放MIPI-DSI操作句柄

-

设置MIPI-DSI进入Low power模式/High speed模式

-

MipiDsiSetLpMode

-

设置MIPI-DSI进入Low power模式

-

MipiDsiSetHsMode

-

设置MIPI-DSI进入High speed模式

-

MIPI-DSI发送/回读指令

-

MipiDsiTx

-

MIPI-DSI发送相应指令的接口

-

MipiDsiRx

-

MIPI-DSI按期望长度回读的接口

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,仅限内核态使用,不支持在用户态使用 - diff --git a/zh-cn/device-dev/driver/RTC.md b/zh-cn/device-dev/driver/RTC.md deleted file mode 100755 index de745a39f9bbe657f60ac09e4dcfac7bd225b829..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/RTC.md +++ /dev/null @@ -1,9 +0,0 @@ -# RTC - -- **[RTC概述](RTC概述.md)** - -- **[RTC使用指导](RTC使用指导.md)** - -- **[RTC使用实例](RTC使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/RTC\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/RTC\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index d413efda41b8fbc48a7f5c6b8837dbc8aef2c480..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/RTC\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,97 +0,0 @@ -# RTC使用实例 - -本实例提供RTC接口的完整使用流程: - -1. 系统启动,驱动管理模块会识别系统当前的RTC器件; -2. 驱动管理模块完成RTC设备的初始化和设备创建; -3. 用户通过不同API,对该RTC设备进行对应的操作; -4. 关闭RTC设备,释放设备资源。 - -示例如下: - -``` -#include "rtc_if.h" -int32_t RtcAlarmACallback(enum RtcAlarmIndex alarmIndex) -{ - if (alarmIndex == RTC_ALARM_INDEX_A) { - /* 报警A的处理 */ - printf("RTC Alarm A callback function\n\r"); - } else if (alarmIndex == RTC_ALARM_INDEX_B) { - /* 报警B的处理 */ - printf("RTC Alarm B callback function\n\r"); - } else { - /* 错误处理 */ - } - return 0; -} - -void RtcTestSample(void) -{ - int32_t ret; - struct RtcTime tm; - struct RtcTime alarmTime; - uint32_t freq; - DevHandle handle = NULL; - - /* 获取RTC设备句柄 */ - handle = RtcOpen(); - if (handle == NULL) { - /* 错误处理 */ - } - /* 注册报警A的定时回调函数 */ - ret = RtcRegisterAlarmCallback(handle, RTC_ALARM_INDEX_A, RtcAlarmACallback); - if (ret != 0) { - /* 错误处理 */ - } - /* 设置RTC外接晶体振荡频率,注意按照器件手册要求配置RTC外频 */ - freq = 32768; /* 32768 Hz */ - ret = RtcSetFreq(handle, freq); - if (ret != 0) { - /* 错误处理 */ - } - /* 设置RTC报警中断使能 */ - ret = RtcAlarmInterruptEnable(handle, RTC_ALARM_INDEX_A, 1); - if (ret != 0) { - /* 错误处理 */ - } - /* 设置RTC时间为2020/01/01 00:00:10 .990 */ - tm.year = 2020; - tm.month = 01; - tm.day = 01; - tm.hour= 0; - tm.minute = 0; - tm.second = 10; - tm.millisecond = 990; - /* 写RTC时间信息 */ - ret = RtcWriteTime(handle, &tm); - if (ret != 0) { - /* 错误处理 */ - } - /* 设置RTC报警时间为2020/01/01 00:00:30 .100 */ - alarmTime.year = 2020; - alarmTime.month = 01; - alarmTime.day = 01; - alarmTime.hour = 0; - alarmTime.minute = 0; - alarmTime.second = 30; - alarmTime.millisecond = 100; - /* 设置RTC_ALARM_INDEX_A索引定时报警时间信息, 定时时间到后会打印"RTC Alarm A callback function" */ - ret = RtcWriteAlarm(handle, RTC_ALARM_INDEX_A, &alarmTime); - if (ret != 0) { - /* 错误处理 */ - } - - /* 读取RTC实时时间 */ - ret = RtcReadTime(handle, &tm); - if (ret != 0) { - /* 错误处理 */ - } - sleep(5) - printf("RTC read time:\n\r"); - printf("year-month-date-weekday hour:minute:second .millisecond %04u-%02u-%02u-%u %02u:%02u:%02u .%03u", - tm.year, tm.month, tm.day, tm.weekday, tm.hour, tm.minute, tm.second, tm.millisecond); - /* 销毁RTC设备句柄 */ - RtcClose(handle); -} -``` - diff --git "a/zh-cn/device-dev/driver/RTC\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/RTC\346\246\202\350\277\260.md" deleted file mode 100755 index 19b903394cd28f79241b90a90db46a81f1d82529..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/RTC\346\246\202\350\277\260.md" +++ /dev/null @@ -1,103 +0,0 @@ -# RTC概述 - -- [简介](#section104842041574) -- [接口说明](#section16892932155715) - -## 简介 - -RTC\(real-time clock\)为操作系统中的实时时钟设备,为操作系统提供精准的实时时间和定时报警功能。当设备下电后,通过外置电池供电,RTC继续记录操作系统时间;设备上电后,RTC提供实时时钟给操作系统,确保断电后系统时间的连续性。 - -## 接口说明 - -**表 1** RTC设备API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

RTC句柄操作

-

RtcOpen

-

获取RTC设备驱动句柄

-

RtcClose

-

释放RTC设备驱动句柄

-

RTC时间操作接口

-

RtcReadTime

-

读RTC时间信息,包括年、月、星期、日、时、分、秒、毫秒

-

RtcWriteTime

-

写RTC时间信息,包括年、月、星期、日、时、分、秒、毫秒

-

RTC报警操作接口

-

RtcReadAlarm

-

读RTC报警时间信息

-

RtcWriteAlarm

-

写RTC报警时间信息

-

RtcRegisterAlarmCallback

-

注册报警超时回调函数

-

RtcAlarmInterruptEnable

-

使能/去使能RTC报警中断

-

RTC配置操作

-

RtcGetFreq

-

读RTC外接晶振频率

-

RtcSetFreq

-

配置RTC外接晶振频率

-

RtcReset

-

RTC复位

-

读写用户定义寄存器

-

RtcReadReg

-

读用户自定义寄存器

-

RtcWriteReg

-

写用户自定义寄存器

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 - diff --git a/zh-cn/device-dev/driver/Readme-CN.md b/zh-cn/device-dev/driver/Readme-CN.md index f86ff0362ebca8304d36ae274a125ce7bd8e22bc..6651085f3517295a31202d656c994a57540fa765 100755 --- a/zh-cn/device-dev/driver/Readme-CN.md +++ b/zh-cn/device-dev/driver/Readme-CN.md @@ -1,73 +1,24 @@ -# 驱动 - -- [HDF驱动框架](HDF驱动框架.md) - - [HDF开发概述](HDF开发概述.md) - - [驱动开发](驱动开发.md) - - [驱动服务管理](驱动服务管理.md) - - [驱动消息机制管理](驱动消息机制管理.md) - - [配置管理](配置管理.md) - - [HDF开发实例](HDF开发实例.md) - -- [驱动平台](驱动平台.md) - - [GPIO](GPIO.md) - - [GPIO概述](GPIO概述.md) - - [GPIO使用指导](GPIO使用指导.md) - - [GPIO使用实例](GPIO使用实例.md) - - - [I2C](I2C.md) - - [I2C概述](I2C概述.md) - - [I2C使用指导](I2C使用指导.md) - - [I2C使用实例](I2C使用实例.md) - - - [RTC](RTC.md) - - [RTC概述](RTC概述.md) - - [RTC使用指导](RTC使用指导.md) - - [RTC使用实例](RTC使用实例.md) - - - [SDIO](SDIO.md) - - [SDIO概述](SDIO概述.md) - - [SDIO使用指导](SDIO使用指导.md) - - [SDIO使用实例](SDIO使用实例.md) - - - [SPI](SPI.md) - - [SPI概述](SPI概述.md) - - [SPI使用指导](SPI使用指导.md) - - [SPI使用实例](SPI使用实例.md) - - - [UART](UART.md) - - [UART概述](UART概述.md) - - [UART使用指导](UART使用指导.md) - - [UART使用实例](UART使用实例.md) - - - [WATCHDOG](WATCHDOG.md) - - [看门狗概述](看门狗概述.md) - - [看门狗使用指导](看门狗使用指导.md) - - [看门狗使用实例](看门狗使用实例.md) - - - [MIPI DSI](MIPI-DSI.md) - - [MIPI DSI概述](MIPI-DSI概述.md) - - [MIPI DSI使用指导](MIPI-DSI使用指导.md) - - [MIPI DSI使用实例](MIPI-DSI使用实例.md) - -- [外设](外设.md) - - [LCD](LCD.md) - - [LCD开发概述](LCD开发概述.md) - - [LCD开发指导](LCD开发指导.md) - - [LCD开发实例](LCD开发实例.md) - - - [TOUCHSCREEN](TOUCHSCREEN.md) - - [Touchscreen开发概述](Touchscreen开发概述.md) - - [Touchscreen开发指导](Touchscreen开发指导.md) - - [Touchscreen开发实例](Touchscreen开发实例.md) - - - [SENSOR](SENSOR.md) - - [传感器驱动开发概述](传感器驱动开发概述.md) - - [传感器驱动开发指导](传感器驱动开发指导.md) - - [传感器驱动开发实例](传感器驱动开发实例.md) - - [传感器驱动测试指导](传感器驱动测试指导.md) - - - [WLAN](WLAN.md) - - [WLAN开发概述](WLAN开发概述.md) - - [WLAN开发指导](WLAN开发指导.md) - - [WLAN开发实例](WLAN开发实例.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/SDIO.md b/zh-cn/device-dev/driver/SDIO.md deleted file mode 100755 index 192dd216b5df44ef51ede3e7ac9dab09eaca828a..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/SDIO.md +++ /dev/null @@ -1,9 +0,0 @@ -# SDIO - -- **[SDIO概述](SDIO概述.md)** - -- **[SDIO使用指导](SDIO使用指导.md)** - -- **[SDIO使用实例](SDIO使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/SDIO\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/SDIO\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index 18ddb74593b5ea69a427ecd03e8a41394daae174..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/SDIO\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,129 +0,0 @@ -# SDIO使用实例 - -SDIO设备完整的使用示例如下所示,首先打开总线号为1的SDIO控制器,然后独占HOST、使能设备、注册中断,接着进行SDIO通信(读写等),通信完成之后,释放中断、去使能设备、释放HOST,最后关闭SDIO控制器。 - -``` -#include "hdf_log.h" -#include "sdio_if.h" - -#define TEST_FUNC_NUM 1 /* 本测试用例中,使用编号为1的I/O function */ -#define TEST_FBR_BASE_ADDR 0x100 /* 编号为1的I/O function的FBR基地址 */ -#define TEST_ADDR_OFFSET 9 /* 本测试用例中,需要读写的寄存器的地址偏移 */ -#define TEST_DATA_LEN 3 /* 本测试用例中,读写数据的长度 */ -#define TEST_BLOCKSIZE 2 /* 本测试用例中,数据块的大小,单位字节 */ - -/* 中断服务函数,需要根据各自平台的情况去实现 */ -static void SdioIrqFunc(void *data) -{ - if (data == NULL) { - HDF_LOGE("SdioIrqFunc: data is NULL.\n"); - return; - } - /* 需要开发者自行添加具体的实现 */ -} - -void SdioTestSample(void) -{ - int32_t ret; - DevHandle handle = NULL; - uint8_t data[TEST_DATA_LEN] = {0}; - struct SdioFunctionConfig config = {1, 0x123, 0x456}; - uint8_t val; - uint32_t addr; - - /* 打开总线号为1的SDIO设备 */ - handle = SdioOpen(1, &config); - if (handle == NULL) { - HDF_LOGE("SdioOpen: failed!\n"); - return; - } - /* 独占HOST */ - SdioClaimHost(handle); - /* 使能SDIO设备 */ - ret = SdioEnableFunc(handle); - if (ret != 0) { - HDF_LOGE("SdioEnableFunc: failed, ret %d\n", ret); - goto ENABLE_ERR; - } - /* 注册中断 */ - ret = SdioClaimIrq(handle, SdioIrqFunc); - if (ret != 0) { - HDF_LOGE("SdioClaimIrq: failed, ret %d\n", ret); - goto CLAIM_IRQ_ERR; - } - /* 设置块大小为2字节 */ - ret = SdioSetBlockSize(handle, TEST_BLOCKSIZE); - if (ret != 0) { - HDF_LOGE("SdioSetBlockSize: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 从SDIO设备增量地址读取3字节的数据 */ - addr = TEST_FBR_BASE_ADDR * TEST_FUNC_NUM + TEST_ADDR_OFFSET; - ret = SdioReadBytes(handle, data, addr, TEST_DATA_LEN); - if (ret != 0) { - HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 向SDIO设备增量地址写入3字节的数据 */ - ret = SdioWriteBytes(handle, data, addr, TEST_DATA_LEN); - if (ret != 0) { - HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 从SDIO设备读取1字节的数据 */ - ret = SdioReadBytes(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 向SDIO设备写入1字节的数据 */ - ret = SdioWriteBytes(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 从SDIO设备固定地址读取3字节的数据 */ - ret = SdioReadBytesFromFixedAddr(handle, data, addr, TEST_DATA_LEN, 0); - if (ret != 0) { - HDF_LOGE("SdioReadBytesFromFixedAddr: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 向SDIO设备固定地址写入1字节的数据 */ - ret = SdioWriteBytesToFixedAddr(handle, data, addr, 1, 0); - if (ret != 0) { - HDF_LOGE("SdioWriteBytesToFixedAddr: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 从SDIO function 0读取1字节的数据 */ - addr = 0x02; - ret = SdioReadBytesFromFunc0(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioReadBytesFromFunc0: failed, ret %d\n", ret); - goto COMM_ERR; - } - /* 向SDIO function 0写入1字节的数据 */ - ret = SdioWriteBytesToFunc0(handle, &val, addr, 1); - if (ret != 0) { - HDF_LOGE("SdioWriteBytesToFunc0: failed, ret %d\n", ret); - goto COMM_ERR; - } -COMM_ERR: - /* 释放中断 */ - ret = SdioReleaseIrq(handle); - if (ret != 0) { - HDF_LOGE("SdioReleaseIrq: failed, ret %d\n", ret); - } -CLAIM_IRQ_ERR: - /* 去使能SDIO设备 */ - ret = SdioDisableFunc(handle); - if (ret != 0) { - HDF_LOGE("SdioDisableFunc: failed, ret %d\n", ret); - } -ENABLE_ERR: - /* 释放HOST */ - SdioReleaseHost(handle); - /* 关闭SDIO设备 */ - SdioClose(handle); -} -``` - diff --git "a/zh-cn/device-dev/driver/SDIO\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/SDIO\346\246\202\350\277\260.md" deleted file mode 100755 index 69b74874472f27c6f3d737e8383f80708ae654a7..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/SDIO\346\246\202\350\277\260.md" +++ /dev/null @@ -1,149 +0,0 @@ -# SDIO概述 - -- [简介](#section1155271783811) -- [接口说明](#section10204143763819) - -## 简介 - -- SDIO是安全数字输入输出接口(Secure Digital Input and Output)的缩写,是从SD内存卡接口的基础上演化出来的一种外设接口。SDIO接口兼容以前的SD内存卡,并且可以连接支持SDIO接口的设备。 -- SDIO的应用比较广泛,目前,有许多手机都支持SDIO功能,并且很多SDIO外设也被开发出来,使得手机外接外设更加容易。常见的SDIO外设有WLAN、GPS、CAMERA、蓝牙等。 -- SDIO总线有两端,其中一端是主机端(HOST),另一端是设备端(DEVICE)。所有的通信都是由HOST端发出命令开始的,在DEVICE端只要能解析HOST的命令,就可以同HOST进行通信了。SDIO的HOST可以连接多个DEVICE,如下图所示: - - - CLK信号:HOST给DEVICE的时钟信号。 - - VDD信号:电源信号。 - - VSS信号:Ground信号。 - - D0-3信号:4条数据线,其中,DAT1信号线复用为中断线,在1BIT模式下DAT0用来传输数据,在4BIT模式下DAT0-DAT3用来传输数据。 - - CMD信号:用于HOST发送命令和DEVICE回复响应。 - - **图 1** SDIO的HOST-DEVICE连接示意图 - - - ![](figures/zh-cn_image_0000001054280608.png) - -- SDIO接口定义了操作SDIO的通用方法集合,包括打开/关闭SDIO控制器、独占/释放HOST、使能/去使能设备、申请/释放中断、读写、获取/设置公共信息等。 - -## 接口说明 - -**表 1** SDIO驱动API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

SDIO设备打开/关闭接口

-

SdioOpen

-

打开指定总线号的SDIO控制器

-

SdioClose

-

关闭SDIO控制器

-

SDIO读写接口

-

SdioReadBytes

-

从指定地址开始,增量读取指定长度的数据

-

SdioWriteBytes

-

从指定地址开始,增量写入指定长度的数据

-

SdioReadBytesFromFixedAddr

-

从固定地址读取指定长度的数据

-

SdioWriteBytesToFixedAddr

-

向固定地址写入指定长度的数据

-

SdioReadBytesFromFunc0

-

从SDIO function 0的指定地址空间读取指定长度的数据

-

SdioWriteBytesToFunc0

-

向SDIO function 0的指定地址空间写入指定长度的数据

-

SDIO设置块大小接口

-

SdioSetBlockSize

-

设置块的大小

-

SDIO获取/设置公共信息接口

-

SdioGetCommonInfo

-

获取公共信息

-

SdioSetCommonInfo

-

设置公共信息

-

SDIO刷新数据接口

-

SdioFlushData

-

刷新数据

-

SDIO独占/释放HOST接口

-

SdioClaimHost

-

独占Host

-

SdioReleaseHost

-

释放Host

-

SDIO使能/去使能功能设备接口

-

SdioEnableFunc

-

使能SDIO功能设备

-

SdioDisableFunc

-

去使能SDIO功能设备

-

SDIO申请/释放中断接口

-

SdioClaimIrq

-

申请中断

-

SdioReleaseIrq

-

释放中断

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,目前只支持在内核态使用,不支持在用户态使用。 - diff --git a/zh-cn/device-dev/driver/SENSOR.md b/zh-cn/device-dev/driver/SENSOR.md deleted file mode 100755 index 5907809028cf4b2f14cf484c96adbd8c25a57db2..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/SENSOR.md +++ /dev/null @@ -1,11 +0,0 @@ -# SENSOR - -- **[传感器驱动开发概述](传感器驱动开发概述.md)** - -- **[传感器驱动开发指导](传感器驱动开发指导.md)** - -- **[传感器驱动开发实例](传感器驱动开发实例.md)** - -- **[传感器驱动测试指导](传感器驱动测试指导.md)** - - diff --git a/zh-cn/device-dev/driver/SPI.md b/zh-cn/device-dev/driver/SPI.md deleted file mode 100755 index 394692a78397c81a270b1cc0e5e944c4837336ab..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/SPI.md +++ /dev/null @@ -1,9 +0,0 @@ -# SPI - -- **[SPI概述](SPI概述.md)** - -- **[SPI使用指导](SPI使用指导.md)** - -- **[SPI使用实例](SPI使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/SPI\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/SPI\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index 4c3a6280301b448fad37b861d0028fd737ef2f82..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/SPI\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,70 +0,0 @@ -# SPI使用实例 - -SPI设备完整的使用示例如下所示,首先获取SPI设备句柄,然后配置SPI设备属性,接着调用读写接口进行数据传输,最后销毁SPI设备句柄。 - -``` -#include "hdf_log.h" -#include "spi_if.h" - -void SpiTestSample(void) -{ - int32_t ret; - struct SpiCfg cfg; /* SPI配置信息 */ - struct SpiDevInfo spiDevinfo; /* SPI设备描述符 */ - DevHandle spiHandle = NULL; /* SPI设备句柄 */ - struct SpiMsg msg; /* 自定义传输的消息 */ - uint8_t rbuff[4] = { 0 }; - uint8_t wbuff[4] = { 0x12, 0x34, 0x56, 0x78 }; - uint8_t wbuff2[4] = { 0xa1, 0xb2, 0xc3, 0xd4 }; - - spiDevinfo.busNum = 0; /* SPI设备总线号 */ - spiDevinfo.csNum = 0; /* SPI设备片选号 */ - spiHandle = SpiOpen(&spiDevinfo); /* 根据spiDevinfo获取SPI设备句柄 */ - if (spiHandle == NULL) { - HDF_LOGE("SpiOpen: failed\n"); - return; - } - /* 获取SPI设备属性 */ - ret = SpiGetCfg(spiHandle, &cfg); - if (ret != 0) { - HDF_LOGE("SpiGetCfg: failed, ret %d\n", ret); - goto err; - } - cfg.maxSpeedHz = 115200; /* 将最大时钟频率改为115200 */ - cfg.bitsPerWord = 8; /* 传输位宽改为8比特 */ - /* 配置SPI设备属性 */ - ret = SpiSetCfg(spiHandle, &cfg); - if (ret != 0) { - HDF_LOGE("SpiSetCfg: failed, ret %d\n", ret); - goto err; - } - /* 向SPI设备写入指定长度的数据 */ - ret = SpiWrite(spiHandle, wbuff, 4); - if (ret != 0) { - HDF_LOGE("SpiWrite: failed, ret %d\n", ret); - goto err; - } - /* 从SPI设备读取指定长度的数据 */ - ret = SpiRead(spiHandle, rbuff, 4); - if (ret != 0) { - HDF_LOGE("SpiRead: failed, ret %d\n", ret); - goto err; - } - msg.wbuf = wbuff2; /* 写入的数据 */ - msg.rbuf = rbuff; /* 读取的数据 */ - msg.len = 4; /* 读取写入数据的长度为4 */ - msg.csChange = 1; /* 进行下一次传输前关闭片选 */ - msg.delayUs = 0; /* 进行下一次传输前不进行延时 */ - msg.speed = 115200; /* 本次传输的速度 */ - /* 进行一次自定义传输,传输的msg个数为1 */ - ret = SpiTransfer(spiHandle, &msg, 1); - if (ret != 0) { - HDF_LOGE("SpiTransfer: failed, ret %d\n", ret); - goto err; - } -err: - /* 销毁SPI设备句柄 */ - SpiClose(spiHandle); -} -``` - diff --git "a/zh-cn/device-dev/driver/SPI\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/SPI\346\246\202\350\277\260.md" deleted file mode 100755 index 3d3567489af059b7a5f56b8e072bdab95e190eab..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/SPI\346\246\202\350\277\260.md" +++ /dev/null @@ -1,107 +0,0 @@ -# SPI概述 - -- [简介](#section9202632114011) -- [接口说明](#section1859594134119) - -## 简介 - -- SPI是串行外设接口(Serial Peripheral Interface)的缩写,是一种高速的,全双工,同步的通信总线。 -- SPI是由Motorola公司开发,用于在主设备和从设备之间进行通信,常用于与闪存、实时时钟、传感器以及模数转换器等进行通信。 -- SPI以主从方式工作,通常有一个主设备和一个或者多个从设备。主设备和从设备之间一般用4根线相连,它们分别是: - - SCLK – 时钟信号,由主设备产生; - - MOSI – 主设备数据输出,从设备数据输入; - - MISO – 主设备数据输入,从设备数据输出; - - CS – 片选,从设备使能信号,由主设备控制。 - - -- 一个主设备和两个从设备的连接示意图如[图1](#fig15227181812587)所示,Device A和Device B共享主设备的SCLK、MISO和MOSI三根引脚,Device A的片选CS0连接主设备的CS0,Device B的片选CS1连接主设备的CS1。 - -**图 1** SPI主从设备连接示意图。 - - -![](figures/zh-cn_image_0000001054142582.png) - -- SPI通信通常由主设备发起,通过以下步骤完成一次通信: - -1. 通过CS选中要通信的从设备,在任意时刻,一个主设备上最多只能有一个从设备被选中。 -2. 通过SCLK给选中的从设备提供时钟信号。 -3. 基于SCLK时钟信号,主设备数据通过MOSI发送给从设备,同时通过MISO接收从设备发送的数据,完成通信。 - -- 根据SCLK时钟信号的CPOL(Clock Polarity,时钟极性)和CPHA(Clock Phase,时钟相位)的不同组合,SPI有以下四种工作模式: - - CPOL=0,CPHA=0 时钟信号idle状态为低电平,第一个时钟边沿采样数据。 - - CPOL=0,CPHA=1 时钟信号idle状态为低电平,第二个时钟边沿采样数据。 - - CPOL=1,CPHA=0 时钟信号idle状态为高电平,第一个时钟边沿采样数据。 - - CPOL=1,CPHA=1 时钟信号idle状态为高电平,第二个时钟边沿采样数据。 - - -- SPI接口定义了操作SPI设备的通用方法集合,包括: - - SPI设备句柄获取和释放。 - - SPI读写: 从SPI设备读取或写入指定长度数据。 - - SPI自定义传输:通过消息传输结构体执行任意读写组合过程。 - - SPI设备配置:获取和设置SPI设备属性。 - - ->![](public_sys-resources/icon-note.gif) **说明:** ->当前只支持主机模式,不支持从机模式。 - -## 接口说明 - -**表 1** SPI驱动API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

SPI设备句柄获取释放接口

-

SpiOpen

-

获取SPI设备句柄

-

SpiClose

-

释放SPI设备句柄

-

SPI读写接口

-

SpiRead

-

读取指定长度的数据

-

SpiWrite

-

写入指定长度的数据

-

SpiTransfer

-

SPI数据传输接口

-

SPI设备配置接口

-

-

SpiSetCfg

-

根据指定参数,配置SPI设备

-

SpiGetCfg

-

获取SPI设备配置参数

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 - diff --git a/zh-cn/device-dev/driver/TOUCHSCREEN.md b/zh-cn/device-dev/driver/TOUCHSCREEN.md deleted file mode 100755 index ce5156c848cb3b1ae5403caeb17ae4d9714baadb..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/TOUCHSCREEN.md +++ /dev/null @@ -1,9 +0,0 @@ -# TOUCHSCREEN - -- **[Touchscreen开发概述](Touchscreen开发概述.md)** - -- **[Touchscreen开发指导](Touchscreen开发指导.md)** - -- **[Touchscreen开发实例](Touchscreen开发实例.md)** - - diff --git "a/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\346\214\207\345\257\274.md" deleted file mode 100755 index 09dc518533e0397fd75711d33a582a7520c5af39..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ /dev/null @@ -1,36 +0,0 @@ -# Touchscreen开发指导 - -- [开发步骤](#section1255740132616) - -Input驱动模型是基于HDF框架、Platform接口和OSAL接口开发,不区分操作系统和芯片平台,为touchscreen等输入器件提供统一的驱动开发架构。 - -- 如下以touchscreen器件驱动为例,说明input驱动模型的完整加载流程: - - (1)设备描述配置:由开发者参考已有模板进行设备描述配置,包括驱动加载顺序、板级硬件信息、器件私有数据信息等。 - - (2)加载input设备管理驱动:input设备管理驱动由HDF驱动加载,完成设备manager的创建并对其初始化。 - - (3)加载平台驱动:平台驱动由HDF框架加载,主要完成板级配置解析及硬件初始化,并提供器件注册接口。 - - (4)加载器件驱动:器件驱动也由HDF框架加载,完成器件设备的实例化,包括器件私有配置解析和平台预留的差异化接口适配。 - - (5)器件设备向平台驱动注册:将实例化的器件设备向平台驱动注册,实现设备和驱动的绑定,并完成中断注册、上下电等器件初始化工作。 - - (6)input设备注册:在器件初始化完成后,实例化input设备,并将其注册到input manager进行管理。 - - -## 开发步骤 - -1. 设备描述配置 - - 目前Input驱动基于HDF驱动框架编写,驱动的加载启动由HDF驱动管理框架统一处理。首先需要在对应的配置文件中,将驱动信息注册进去,如是否加载、加载优先级,此后HDF驱动框架会逐一启动注册过的驱动模块。驱动的相关配置请参考[HDF驱动框架配置指导](驱动开发.md#section1969312275533)。 - -2. 板级配置及Touchscreen器件私有配置 - - 配置对应的IO管脚功能,例如对单板上为touchscreen设计预留的I2C Pin脚,需设置对应的寄存器,使其选择I2C的通信功能。 - -3. 实现器件差异化适配接口 - - 根据硬件单板设计的通信接口,使用Platform接口层提供的管脚操作接口配置对应的复位管脚、中断管脚以及电源操作,对于GPIO的操作,可参考[GPIO操作接口指导](GPIO使用指导.md) - - diff --git "a/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\346\246\202\350\277\260.md" deleted file mode 100755 index b6456936b0195199ef6f29d12e690492892bbda0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\346\246\202\350\277\260.md" +++ /dev/null @@ -1,71 +0,0 @@ -# Touchscreen开发概述 - -- [简介](#section124332411260) -- [接口说明](#section10542625172618) - -## 简介 - -- **Touchscreen驱动主要任务** - - Touchscreen驱动用于驱动触摸屏使其正常工作,该驱动主要完成如下工作:对触摸屏驱动IC进行上电、配置硬件管脚并初始化其状态、注册中断、配置通信接口(I2C或SPI)、设定input相关配置、下载及更新固件等操作。 - - -- **Touchscreen驱动层次说明** - - 本节主要介绍基于input驱动模型开发touchscreen器件驱动,其整体的框架模型如[图1](#fig6251184817261)。 - - Input驱动模型基于HDF驱动框架、PLATFORM接口、OSAL接口进行开发,向上对接规范化的驱动接口HDI(Hardware Driver Interface)层,通过Input-HDI层对外提供硬件能力,即上层input service可以通过HDI接口层获取相应的驱动能力,进而操控touchscreen等输入设备。 - - -**图 1** 基于HDF驱动框架的input驱动模型 -![](figures/基于HDF驱动框架的input驱动模型.png "基于HDF驱动框架的input驱动模型") - -- **Input驱动模型介绍** - - Input驱动模型核心部分由设备管理层、公共驱动层、器件驱动层组成。器件产生的数据借助平台数据通道能力从内核传递到用户态,驱动模型通过配置文件适配不同器件及硬件平台,提高开发者的器件驱动开发效率。如下部分为模型各部分的说明: - - (1)input设备管理:为各类输入设备驱动提供input设备的注册、注销接口,同时统一管理input设备列表; - - (2)input平台驱动:指各类input设备的公共抽象驱动(例如触摸屏的公共驱动),负责对板级硬件进行初始化、硬件中断处理、向manager注册input设备等; - - (3)input器件驱动:指各器件厂家的差异化驱动,通过适配平台驱动预留的差异化接口,实现器件驱动开发量最小化; - - (4)input数据通道:提供一套通用的数据上报通道,各类别的input设备驱动均可用此通道上报input事件; - - (5)input配置解析:负责对input设备的板级配置及器件私有配置进行解析及管理。 - - -- **基于HDF驱动框架开发器件驱动的优势** - - 在HDF(Hardware Driver Foundation)[驱动管理框架](驱动开发.md)的基础上,input驱动模型调用OSAL接口层和Platfom接口层提供的基础接口进行开发,包括bus通信接口、操作系统原生接口(memory、lock、thread、timer等)。由于OSAL接口和Platform接口屏蔽了芯片平台差异,所以基于input驱动模型实现的touchscreen驱动可以进行跨平台、跨OS迁移,以便逐步实现驱动的一次开发,多端部署。 - - -## 接口说明 - -Touchscreen器件的硬件接口相对简单,根据PIN脚的属性,可以简单分为如下三类: - -- 电源接口 -- IO控制接口 -- 通信接口 - -**图 2** Touchscreen器件常用管脚 -![](figures/Touchscreen器件常用管脚.png "Touchscreen器件常用管脚") - -如上图所示的三类接口,分别做简要说明如下: - -1. **电源接口** - - LDO\_1P8:1.8v数字电路 - - LDO\_3P3:3.3v模拟电路 - - 通常情况下,touchscreen驱动IC和LCD驱动IC是相互分离的,这种情况下,touchscreen驱动IC一般同时需要1.8v和3.3v两路供电。随着芯片演进,业内已有touchscreen驱动IC和LCD驱动IC集成在一颗IC中的芯片案例,对touchscreen而言,只需要关注1.8v供电即可,其内部需要的3.3v电源,会在驱动IC内部从LCD的VSP电源(典型值5.5V)中分出来。 - - -2. **IO控制接口** - - Reset:reset管脚,用于在系统休眠、唤醒时,由主机侧对驱动IC进行复位操作。 - - INT:中断管脚,需要在驱动初始化时,配置为输入上拉状态。在驱动IC检测到外部触摸信号后,通过操作中断管脚来触发中断,器件驱动则会在中断处理函数中进行报点数据读取等操作。 - -3. **通信接口** - - I2C:由于touchscreen的报点数据量相对较少,所以一般选用I2C方式传输数据。I2C的具体协议及对应操作接口,可以参考Platform接口层中的[“I2C”使用指南](I2C使用指导.md)。 - - SPI:部分厂商,由于需要传递的数据不止报点坐标,而是需要获取基础容值,数据量较大,所以会选用SPI通信方式。SPI的具体协议及对应操作接口,可以参考Platform接口层中的[“SPI” 使用指南](SPI使用指导.md)。 - - diff --git a/zh-cn/device-dev/driver/UART.md b/zh-cn/device-dev/driver/UART.md deleted file mode 100755 index 5d81f12e15f43bdf7e3302bc33cf1dddd524b4e9..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/UART.md +++ /dev/null @@ -1,9 +0,0 @@ -# UART - -- **[UART概述](UART概述.md)** - -- **[UART使用指导](UART使用指导.md)** - -- **[UART使用实例](UART使用实例.md)** - - diff --git "a/zh-cn/device-dev/driver/UART\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/UART\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index d049e3d021843a422c3e11b1fde5a10b57393070..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/UART\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,67 +0,0 @@ -# UART使用实例 - -UART设备完整的使用示例如下所示,首先获取UART设备句柄,接着设置波特率、设备属性和传输模式,之后进行UART通信,最后销毁UART设备句柄。 - -``` -#include "hdf_log.h" -#include "uart_if.h" - -void UartTestSample(void) -{ - int32_t ret; - uint32_t port; - DevHandle handle = NULL; - uint8_t wbuff[5] = { 1, 2, 3, 4, 5 }; - uint8_t rbuff[5] = { 0 }; - struct UartAttribute attribute; - attribute.dataBits = UART_ATTR_DATABIT_7; /* UART传输数据位宽,一次传输7个bit */ - attribute.parity = UART_ATTR_PARITY_NONE; /* UART传输数据无校检 */ - attribute.stopBits = UART_ATTR_STOPBIT_1; /* UART传输数据停止位为1位 */ - attribute.rts = UART_ATTR_RTS_DIS; /* UART禁用RTS */ - attribute.cts = UART_ATTR_CTS_DIS; /* UART禁用CTS */ - attribute.fifoRxEn = UART_ATTR_RX_FIFO_EN; /* UART使能RX FIFO */ - attribute.fifoTxEn = UART_ATTR_TX_FIFO_EN; /* UART使能TX FIFO */ - /* UART设备端口号,要填写实际平台上的端口号 */ - port = 1; - /* 获取UART设备句柄 */ - handle = UartOpen(port); - if (handle == NULL) { - HDF_LOGE("UartOpen: failed!\n"); - return; - } - /* 设置UART波特率为9600 */ - ret = UartSetBaud(handle, 9600); - if (ret != 0) { - HDF_LOGE("UartSetBaud: failed, ret %d\n", ret); - goto _ERR; - } - /* 设置UART设备属性 */ - ret = UartSetAttribute(handle, &attribute); - if (ret != 0) { - HDF_LOGE("UartSetAttribute: failed, ret %d\n", ret); - goto _ERR; - } - /* 设置UART传输模式为非阻塞模式 */ - ret = UartSetTransMode(handle, UART_MODE_RD_NONBLOCK); - if (ret != 0) { - HDF_LOGE("UartSetTransMode: failed, ret %d\n", ret); - goto _ERR; - } - /* 向UART设备写入5字节的数据 */ - ret = UartWrite(handle, wbuff, 5); - if (ret != 0) { - HDF_LOGE("UartWrite: failed, ret %d\n", ret); - goto _ERR; - } - /* 从UART设备读取5字节的数据 */ - ret = UartRead(handle, rbuff, 5); - if (ret < 0) { - HDF_LOGE("UartRead: failed, ret %d\n", ret); - goto _ERR; - } -_ERR: - /* 销毁UART设备句柄 */ - UartClose(handle); -} -``` - diff --git "a/zh-cn/device-dev/driver/UART\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/UART\346\246\202\350\277\260.md" deleted file mode 100755 index 2f295bddd98e43a9ff8670b0b5b44943243e6574..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/UART\346\246\202\350\277\260.md" +++ /dev/null @@ -1,106 +0,0 @@ -# UART概述 - -- [简介](#section14770623164917) -- [接口说明](#section149505462492) - -## 简介 - -- UART是通用异步收发传输器(Universal Asynchronous Receiver/Transmitter)的缩写,是通用串行数据总线,用于异步通信。该总线双向通信,可以实现全双工传输。 -- UART应用比较广泛,常用于输出打印信息,也可以外接各种模块,如GPS、蓝牙等。 -- 两个UART设备的连接示意图如下,UART与其他模块一般用2线(图1)或4线(图2)相连,它们分别是: - - TX:发送数据端,和对端的RX相连; - - RX:接收数据端,和对端的TX相连; - - RTS:发送请求信号,用于指示本设备是否准备好,可接受数据,和对端CTS相连; - - CTS:允许发送信号,用于判断是否可以向对端发送数据,和对端RTS相连; - - **图 1** 2线UART设备连接示意图 - - - ![](figures/zh-cn_image_0000001053926237.png) - - **图 2** 4线UART设备连接示意图 - - - ![](figures/zh-cn_image_0000001054007499.png) - - -- UART通信之前,收发双方需要约定好一些参数:波特率、数据格式(起始位、数据位、校验位、停止位)等。通信过程中,UART通过TX发送给对端数据,通过RX接收对端发送的数据。当UART接收缓存达到预定的门限值时,RTS变为不可发送数据,对端的CTS检测到不可发送数据,则停止发送数据。 -- UART接口定义了操作UART端口的通用方法集合,包括获取、释放设备句柄、读写数据、获取和设置波特率、获取和设置设备属性。 - -## 接口说明 - -**表 1** UART驱动API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

UART获取/释放设备句柄

-

-

UartOpen

-

UART获取设备句柄

-

UartClose

-

UART释放设备句柄

-

UART读写接口

-

-

UartRead

-

从UART设备中读取指定长度的数据

-

UartWrite

-

向UART设备中写入指定长度的数据

-

UART获取/设置波特率接口

-

UartGetBaud

-

UART获取波特率

-

UartSetBaud

-

UART设置波特率

-

UART获取/设置设备属性

-

-

UartGetAttribute

-

UART获取设备属性

-

UartSetAttribute

-

UART设置设备属性

-

UART设置传输模式

-

UartSetTransMode

-

UART设置传输模式

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 - diff --git a/zh-cn/device-dev/driver/WATCHDOG.md b/zh-cn/device-dev/driver/WATCHDOG.md deleted file mode 100755 index 0d7afef9e34e797337223f629833ac288a532914..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/WATCHDOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# WATCHDOG - -- **[看门狗概述](看门狗概述.md)** - -- **[看门狗使用指导](看门狗使用指导.md)** - -- **[看门狗使用实例](看门狗使用实例.md)** - - diff --git a/zh-cn/device-dev/driver/WLAN.md b/zh-cn/device-dev/driver/WLAN.md deleted file mode 100755 index af39a0d3a2bed463178b7cc278c21373c91ef9f1..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/driver/WLAN.md +++ /dev/null @@ -1,9 +0,0 @@ -# WLAN - -- **[WLAN开发概述](WLAN开发概述.md)** - -- **[WLAN开发指导](WLAN开发指导.md)** - -- **[WLAN开发实例](WLAN开发实例.md)** - - diff --git "a/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\345\256\236\344\276\213.md" deleted file mode 100755 index bc558cb653344f4a82333d7c4ccdcc73815db838..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\345\256\236\344\276\213.md" +++ /dev/null @@ -1,372 +0,0 @@ -# WLAN开发实例 - -本例程提供WLAN模块初始化过程的完整使用流程。示例如下(以hi3881WLAN芯片为例): - -1、根据硬件,修改配置参数 - -``` -/* 根据硬件参数,通过wlan_platform.hcs配置相关参数,以下是WLAN平台配置的示例 */ -hisi :& deviceList { - device0 :: deviceInst { - deviceInstId = 0; - powers { - power0 { - powerSeqDelay = 0; /* 电源序列延时 */ - powerType = 1; /* 电源类型:0--总是打开;1--GPIO */ - gpioId = 1; /* GPIO管脚号 */ - activeLevel=1; /* 有效电平:0--低;1--高 */ - } - power1 { - powerSeqDelay = 0; /* 电源序列延时 */ - powerType = 0; /* 电源类型:0--总是打开;1--GPIO */ - } - } - reset { - resetType = 0; /* 复位类型:0--不管理;1--GPIO */ - gpioId = 2; /* GPIO管脚号 */ - activeLevel=1; /* 有效电平:0--低;1--高 */ - resetHoldTime = 30; /* 复位配置后的等待时间(ms) */ - } - bootUpTimeout = 30; /* 启动超时时间(ms) */ - bus { - busType = 0; /* 总线类型:0-sdio */ - busId = 2; /* 总线号 */ - funcNum = [1]; /* SDIO功能号 */ - timeout = 1000; /* 读/写数据的超时时间 */ - blockSize = 512; /* 读/写数据的块大小 */ - } - } -} -/* 每一块芯片添加配置文件wlan_chip_<芯片名>.hcs(如:wlan_chip_hi3881.hcs),配置相关参数。以下是hi3881的配置示例 */ -root { - wlan_config { - hi3881 :& chipList { - chipHi3881 :: chipInst { - match_attr = "hdf_wlan_chips_hi3881"; /* 配置匹配标识 */ - chipName = "hi3881"; /* WLAN芯片的名称 */ - sdio { - vendorId = 0x0296; /* 厂商Id */ - deviceId = [0x5347]; /* 设备Id */ - } - } - } - } -} -``` - -2、适配挂接WLAN芯片的初始化和去初始化、WLAN芯片驱动的初始化和去初始化 - -``` -/* WLAN初始化挂接流程 */ -#include "hdf_device_desc.h" -#include "hdf_wifi_product.h" -#include "hdf_log.h" -#include "osal_mem.h" -#include "hdf_wlan_chipdriver_manager.h" -#include "securec.h" -#include "wifi_module.h" -#include "hi_wifi_api.h" -#include "hi_types_base.h" - -#define HDF_LOG_TAG Hi3881Driver - -/* WLAN芯片的初始化和去初始化函数 */ -int32_t InitHi3881Chip(struct HdfWlanDevice *device); -int32_t DeinitHi3881Chip(struct HdfWlanDevice *device); -/* WLAN芯片驱动的初始化和去初始化函数 */ -int32_t Hi3881Deinit(struct HdfChipDriver* chipDriver, struct NetDevice *netDevice); -int32_t Hi3881Init(struct HdfChipDriver* chipDriver, struct NetDevice *netDevice); - -/* 初始化mac80211与芯片侧的函数挂接 */ -hi_void HiMac80211Init(struct HdfChipDriver *chipDriver); - -static const char* const HI3881_DRIVER_NAME = "hisi"; - -/* WLAN芯片驱动挂接以及mac80211与芯片侧的函数挂接 */ -static struct HdfChipDriver *BuildHi3881Driver(struct HdfWlanDevice *device, uint8_t ifIndex) -{ - struct HdfChipDriver *specificDriver = NULL; - if (device == NULL) { - HDF_LOGE("%s fail : channel is NULL", __func__); - return NULL; - } - (void)device; - (void)ifIndex; - specificDriver = (struct HdfChipDriver *)OsalMemCalloc(sizeof(struct HdfChipDriver)); - if (specificDriver == NULL) { - HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__); - return NULL; - } - if (memset_s(specificDriver, sizeof(struct HdfChipDriver), 0, sizeof(struct HdfChipDriver)) != EOK) { - HDF_LOGE("%s fail: memset_s fail!", __func__); - OsalMemFree(specificDriver); - return NULL; - } - - if (strcpy_s(specificDriver->name, MAX_WIFI_COMPONENT_NAME_LEN, HI3881_DRIVER_NAME) != EOK) { - HDF_LOGE("%s fail : strcpy_s fail", __func__); - OsalMemFree(specificDriver); - return NULL; - } - specificDriver->init = Hi3881Init; - specificDriver->deinit = Hi3881Deinit; - - HiMac80211Init(specificDriver); - - return specificDriver; -} - -/* 释放WLAN芯片驱动 */ -static void ReleaseHi3881Driver(struct HdfChipDriver *chipDriver) -{ - if (chipDriver == NULL) { - return; - } - if (strcmp(chipDriver->name, HI3881_DRIVER_NAME) != 0) { - HDF_LOGE("%s:Not my driver!", __func__); - return; - } - OsalMemFree(chipDriver); -} - -static uint8_t GetHi3881GetMaxIFCount(struct HdfChipDriverFactory *factory) { - (void)factory; - return 1; -} - -/* WLAN芯片相关函数的注册 */ -static int32_t HDFWlanRegHisiDriverFactory(void) -{ - static struct HdfChipDriverFactory tmpFactory = { 0 }; - struct HdfChipDriverManager *driverMgr = NULL; - driverMgr = HdfWlanGetChipDriverMgr(); - if (driverMgr == NULL && driverMgr->RegChipDriver != NULL) { - HDF_LOGE("%s fail: driverMgr is NULL!", __func__); - return HDF_FAILURE; - } - tmpFactory.driverName = HI3881_DRIVER_NAME; - tmpFactory.GetMaxIFCount = GetHi3881GetMaxIFCount; - tmpFactory.InitChip = InitHi3881Chip; - tmpFactory.DeinitChip = DeinitHi3881Chip; - tmpFactory.Build = BuildHi3881Driver; - tmpFactory.Release = ReleaseHi3881Driver; - tmpFactory.ReleaseFactory = NULL; - if (driverMgr->RegChipDriver(&tmpFactory) != HDF_SUCCESS) { - HDF_LOGE("%s fail: driverMgr is NULL!", __func__); - return HDF_FAILURE; - } - - return HDF_SUCCESS; -} - -static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) -{ - (void)device; - return HDFWlanRegHisiDriverFactory(); -} - -struct HdfDriverEntry g_hdfHisiChipEntry = { - .moduleVersion = 1, - .Init = HdfWlanHisiChipDriverInit, - .moduleName = "HDF_WLAN_CHIPS" -}; - -HDF_INIT(g_hdfHisiChipEntry); -``` - -``` -#include "hdf_wifi_product.h" -#include "hi_wifi_api.h" -#if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) -#include "oal_thread.h" -#include "osal_time.h" -#endif -#include "wifi_mac80211_ops.h" -#include "wal_cfg80211.h" -#include "net_adpater.h" -#include "hdf_wlan_utils.h" - -#define HDF_LOG_TAG Hi3881Driver - -/* WLAN芯片的初始化函数 */ -int32_t InitHi3881Chip(struct HdfWlanDevice *device) -{ - uint8_t maxPortCount = 1; - int32_t ret = HI_SUCCESS; - uint8_t maxRetryCount = 2; - if (device == NULL) { - HDF_LOGE("%s:NULL ptr!", __func__); - return HI_FAIL; - } - - do { - if (ret != HI_SUCCESS) { - if (device->reset != NULL && device->reset->Reset != NULL) { - device->reset->Reset(device->reset); - } - HDF_LOGE("%s:Retry init hi3881!last ret=%d", __func__, ret); - } - ret = hi_wifi_init(maxPortCount); - } while (ret != 0 && --maxRetryCount > 0); - - if (ret != 0) { - HDF_LOGE("%s:Init hi3881 driver failed!", __func__); - return ret; - } - return HI_SUCCESS; -} - -/* WLAN芯片的去初始化函数 */ -int32_t DeinitHi3881Chip(struct HdfWlanDevice *device) -{ - (void)device; - int32_t ret = hi_wifi_deinit(); - if (ret != 0) { - HDF_LOGE("%s:Deinit failed!ret=%d", __func__, ret); - } - return ret; -} - -/* WLAN芯片驱动的初始化函数 */ -int32_t Hi3881Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) -{ - HDF_LOGI("%s: start...", __func__); - hi_u16 mode = wal_get_vap_mode(); - int32_t ret; - nl80211_iftype_uint8 type; - (void)chipDriver; - - if (mode >= WAL_WIFI_MODE_BUTT) { - oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); - return HI_FAIL; - } - - if (mode == WAL_WIFI_MODE_STA) { - type = NL80211_IFTYPE_STATION; - } else if (mode == WAL_WIFI_MODE_AP) { - type = NL80211_IFTYPE_AP; - } else { - oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); - return HI_FAIL; - } - - ret = wal_init_drv_wlan_netdev(type, WAL_PHY_MODE_11N, netDevice); - if (ret != HI_SUCCESS) { - oam_error_log2(0, OAM_SF_ANY, "wal_init_drv_netdev %s failed.l_return:%d\n", netDevice->name, ret); - } - return ret; -} - -/* WLAN芯片驱动的去初始化函数 */ -int32_t Hi3881Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) -{ - (void)chipDriver; - int32_t ret = wal_deinit_drv_wlan_netdev(netDevice); - if (ret != HDF_SUCCESS) { - return ret; - } - return ReleasePlatformNetDevice(netDevice); -} -``` - -3、在芯片侧初始化过程中调用netdev的init和add接口进行初始化netdev,并挂接netdev的一些函数指针 - -``` -hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi_char* ifname, hi_u32* len) -{ - oal_net_device_stru *netdev = HI_NULL; - - ...... - /* 初始化网络设备,获取对应的实例。*/ - netdev = NetDeviceInit(ifname, *len, LITE_OS); - oal_wireless_dev *wdev = (oal_wireless_dev *)oal_mem_alloc(OAL_MEM_POOL_ID_LOCAL, sizeof(oal_wireless_dev)); - ret = wal_init_netif(type, netdev, wdev); - - ...... - - return HI_SUCCESS; -} -/* 挂接netdev的一些函数指针,详细挂接函数{@link NetDeviceInterFace} */ -oal_net_device_ops_stru g_wal_net_dev_ops = -{ - .getStats = wal_netdev_get_stats, - .open = wal_netdev_open, - .stop = wal_netdev_stop, - .xmit = hmac_bridge_vap_xmit, - .ioctl = wal_net_device_ioctl, - .changeMtu = oal_net_device_change_mtu, - .init = oal_net_device_init, - .deInit = oal_net_free_netdev, -#if (defined(_PRE_WLAN_FEATURE_FLOWCTL) || defined(_PRE_WLAN_FEATURE_OFFLOAD_FLOWCTL)) - .selectQueue = wal_netdev_select_queue, -#endif - .setMacAddr = wal_netdev_set_mac_addr, -#if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) - .netifNotify = HI_NULL, -#endif - .specialEtherTypeProcess = SpecialEtherTypeProcess, -}; - -hi_s32 wal_init_netif(nl80211_iftype_uint8 type, oal_net_device_stru *netdev, const oal_wireless_dev *wdev) -{ - /* 添加网络设备到协议栈 */ - hi_u32 ret = NetDeviceAdd(netdev, (Protocol80211IfType)type); - - ...... - - return HI_SUCCESS; -} -``` - -4、WifiMac80211Ops中的函数挂接实现 - -``` -/* 挂接mac80211的一些函数指针 */ - -/* 驱动需要实现的MAC层基本能力的控制接口 */ -static struct HdfMac80211BaseOps g_baseOps = { - .SetMode = WalSetMode, - .AddKey = WalAddKey, - .DelKey = WalDelKey, - .SetDefaultKey = WalSetDefaultKey, - .GetDeviceMacAddr = WalGetDeviceMacAddr, - .SetMacAddr = WalSetMacAddr, - .SetTxPower = WalSetTxPower, - .GetValidFreqsWithBand = WalGetValidFreqsWithBand, - .GetHwCapability = WalGetHwCapability -}; - -/* 驱动需要实现的MAC层STA能力的控制接口 */ -static struct HdfMac80211STAOps g_staOps = { - .Connect = WalConnect, - .Disconnect = WalDisconnect, - .StartScan = WalStartScan, - .AbortScan = WalAbortScan, - .SetScanningMacAddress = WalSetScanningMacAddress, -}; - -/* 驱动需要实现的MAC层AP能力的控制接口 */ -static struct HdfMac80211APOps g_apOps = { - .ConfigAp = WalConfigAp, - .StartAp = WalStartAp, - .StopAp = WalStopAp, - .ConfigBeacon = WalChangeBeacon, - .DelStation = WalDelStation, - .SetCountryCode = WalSetCountryCode, - .GetAssociatedStasCount = WalGetAssociatedStasCount, - .GetAssociatedStasInfo = WalGetAssociatedStasInfo -}; - -/* 初始化mac80211与芯片侧的函数挂接 */ -hi_void HiMac80211Init(struct HdfChipDriver *chipDriver) -{ - if (chipDriver == NULL) { - oam_error_log(0, OAM_SF_ANY, "%s:input is NULL!", __func__); - return; - } - chipDriver->ops = &g_baseOps; - chipDriver->staOps = &g_staOps; - chipDriver->apOps = &g_apOps; -} -``` - diff --git "a/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\346\214\207\345\257\274.md" deleted file mode 100755 index 1a5d63663ab7c28d50b8ddd19db7d339b1248472..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ /dev/null @@ -1,18 +0,0 @@ -# WLAN开发指导 - -- [开发步骤](#section96091936185820) - -WLAN驱动基于HDF框架和PLATFORM框架开发,不区分OS和芯片平台,为不同厂商的WLAN模组提供统一的驱动模型,各WLAN模组厂商根据如下指导适配WLAN驱动框架。 - -## 开发步骤 - -1. 通过wifi\_config.hcs文件,配置硬件参数:module\(不同feature\),芯片等。 -2. 解析配置文件, 生成全量配置的结构体对象。 -3. Module初始化,创建Module。 -4. 挂接chip,初始化chip。 -5. 总线初始化。 -6. 上层wpa业务挂接。 - ->![](public_sys-resources/icon-note.gif) **说明:** ->以上驱动框架适配步骤一部分已经提供(详细见开发实例),待开发人员实现的部分有:1、根据硬件,修改配置参数;2、适配挂接chip;3、测试自验证。 - diff --git "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\345\274\200\345\217\221.md" b/zh-cn/device-dev/driver/driver-hdf-development.md old mode 100755 new mode 100644 similarity index 95% rename from "zh-cn/device-dev/driver/\351\251\261\345\212\250\345\274\200\345\217\221.md" rename to zh-cn/device-dev/driver/driver-hdf-development.md index e35139db59ca7df253ee0134e5afb379d596e300..492abc6c66f47310c998d216acf5409cad6ee775 --- "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\345\274\200\345\217\221.md" +++ b/zh-cn/device-dev/driver/driver-hdf-development.md @@ -5,12 +5,12 @@ ## 驱动模型介绍 -HDF框架以组件化的驱动模型作为核心设计思路,为开发者提供更精细化的驱动管理,让驱动开发和部署更加规范。HDF框架将一类设备驱动放在同一个host里面,开发者也可以将驱动功能分层独立开发和部署,支持一个驱动多个node,HDF框架管理驱动模型如下图所示: +HDF框架以组件化的驱动模型作为核心设计思路,为开发者提供更精细化的驱动管理,让驱动开发和部署更加规范。HDF框架将一类设备驱动放在同一个host里面,开发者也可以将驱动功能分层独立开发和部署,支持一个驱动多个node,HDF驱动模型如下图所示: -**图 1** HDF框架管理驱动模型 +**图 1** HDF驱动模型 -![](figures/zh-cn_image_0000001054564784.png) +![](figure/zh-cn_image_0000001054564784.png) ## 驱动开发步骤 @@ -89,7 +89,7 @@ HDF框架以组件化的驱动模型作为核心设计思路,为开发者提 3. 驱动配置 - HDF使用HCS作为配置描述源码,HCS详细介绍参考[配置管理](配置管理.md)介绍。 + HDF使用HCS作为配置描述源码,HCS详细介绍参考[配置管理](driver-hdf-manage.md)介绍。 驱动配置包含两部分,HDF框架定义的驱动设备描述和驱动的私有配置信息,具体写法如下: @@ -158,7 +158,7 @@ HDF框架以组件化的驱动模型作为核心设计思路,为开发者提 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >驱动加载方式支持按需加载和按序加载两种方式,具体使用方法如下: >- 按需加载 > ``` @@ -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),则系统启动过程中默认不加载,支持后续动态加载,当用户态获取驱动服务(参考[消息机制](驱动消息机制管理.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/\351\205\215\347\275\256\347\256\241\347\220\206.md" b/zh-cn/device-dev/driver/driver-hdf-manage.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/driver/\351\205\215\347\275\256\347\256\241\347\220\206.md" rename to zh-cn/device-dev/driver/driver-hdf-manage.md index 3fd2a0701a9c5e9f734021d7520e773f8c5e136e..86cc85d8c7d56c8d5fbe544187e191cb48243a56 --- "a/zh-cn/device-dev/driver/\351\205\215\347\275\256\347\256\241\347\220\206.md" +++ b/zh-cn/device-dev/driver/driver-hdf-manage.md @@ -29,7 +29,7 @@ HC-GEN**\(H**DF **C**onfiguration **G**enerator**\)**是HCS配置转换工具 **图 1** 配置使用流程图 -![](figures/zh-cn_image_0000001053405727.png) +![](figure/zh-cn_image_0000001053405727.png) HCS经过HC-GEN编译生成HCB文件,HDF驱动框架中的HCS Parser模块会从HCB文件中重建配置树,HDF驱动模块使用HCS Parser提供的配置读取接口获取配置内容。 @@ -202,7 +202,7 @@ bool类型中**true**表示真,**false**表示假。 */ ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >多行注释不支持嵌套。 @@ -330,7 +330,7 @@ root { } ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >在同一个HCS文件中不允许使用delete,建议直接删除不需要的属性。 ## 属性引用 diff --git "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\346\266\210\346\201\257\346\234\272\345\210\266\347\256\241\347\220\206.md" b/zh-cn/device-dev/driver/driver-hdf-news.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/driver/\351\251\261\345\212\250\346\266\210\346\201\257\346\234\272\345\210\266\347\256\241\347\220\206.md" rename to zh-cn/device-dev/driver/driver-hdf-news.md index ac271c2f1e520c0d8d1c31cf4ab5ab79ef498727..a956303a57cca0d1528d5664b4c6798800479f9b --- "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\346\266\210\346\201\257\346\234\272\345\210\266\347\256\241\347\220\206.md" +++ b/zh-cn/device-dev/driver/driver-hdf-news.md @@ -49,7 +49,7 @@ ## 开发步骤 -1. 将驱动配置信息中服务策略policy字段设置为2(SERVICE\_POLICY\_CAPACITY,参考[policy定义](驱动服务管理.md))。 +1. 将驱动配置信息中服务策略policy字段设置为2(SERVICE\_POLICY\_CAPACITY,参考[policy定义](driver-hdf-servicemanage.md))。 ``` device_sample :: Device { diff --git "a/zh-cn/device-dev/driver/HDF\345\274\200\345\217\221\346\246\202\350\277\260.md" b/zh-cn/device-dev/driver/driver-hdf-overview.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/HDF\345\274\200\345\217\221\346\246\202\350\277\260.md" rename to zh-cn/device-dev/driver/driver-hdf-overview.md diff --git "a/zh-cn/device-dev/driver/HDF\345\274\200\345\217\221\345\256\236\344\276\213.md" b/zh-cn/device-dev/driver/driver-hdf-sample.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/driver/HDF\345\274\200\345\217\221\345\256\236\344\276\213.md" rename to zh-cn/device-dev/driver/driver-hdf-sample.md index f9b3ca1aca4612cba98dd4d788645e0704f59850..0cc2f0686ff32618900012839c2800fdb8724962 --- "a/zh-cn/device-dev/driver/HDF\345\274\200\345\217\221\345\256\236\344\276\213.md" +++ b/zh-cn/device-dev/driver/driver-hdf-sample.md @@ -229,7 +229,7 @@ int main() } ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >用户态应用程序使用了HDF框架中的消息发送接口,因此在编译用户态程序的过程中需要依赖HDF框架对外提供的hdf\_core和osal的动态库,在gn编译文件中添加如下依赖项: >deps = \[ >"//drivers/adapter/lite/uhdf/manager:hdf\_core", diff --git "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\346\234\215\345\212\241\347\256\241\347\220\206.md" b/zh-cn/device-dev/driver/driver-hdf-servicemanage.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/\351\251\261\345\212\250\346\234\215\345\212\241\347\256\241\347\220\206.md" rename to zh-cn/device-dev/driver/driver-hdf-servicemanage.md diff --git "a/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\346\246\202\350\277\260.md" b/zh-cn/device-dev/driver/driver-peripherals-external-des.md old mode 100755 new mode 100644 similarity index 55% rename from "zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\346\246\202\350\277\260.md" rename to zh-cn/device-dev/driver/driver-peripherals-external-des.md index 869ee1da51d3e2ac53a46eaebef489ab55428c7e..282d5ed4542e43a142e8262b5f3bbefb87510d36 --- "a/zh-cn/device-dev/driver/WLAN\345\274\200\345\217\221\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/driver/driver-peripherals-external-des.md @@ -1,19 +1,24 @@ -# WLAN开发概述 +# WLAN -- [简介](#section23087361515) -- [WLAN驱动接口架构](#section1533192516212) -- [接口说明](#section87491484213) +- [概述](#section729758162218) + - [WLAN驱动接口架构](#section178022416377) + - [接口说明](#section149681312202415) -## 简介 +- [开发指导](#section15957746172412) + - [开发步骤](#section11776186132513) + +- [开发实例](#section1395253612512) + +## 概述 WLAN是基于HDF(Hardware Driver Foundation)驱动框架开发的模块,该模块可实现跨操作系统迁移,自适应器件差异,模块化拼装编译等功能。各WLAN厂商驱动开发人员可根据WLAN模块提供的向下统一接口适配各自的驱动代码,实现如下能力:建立/关闭WLAN热点、扫描、关联WLAN热点等;对HDI层向上提供能力如下:设置MAC地址、设置发射功率、获取设备的MAC地址等。[WLAN模块框架图](#fig967034316227)如下: **图 1** WLAN框架 -![](figures/zh-cn_image_0000001055299108.png) +![](figure/zh-cn_image_0000001170383063.png) -## WLAN驱动接口架构 +### WLAN驱动接口架构 WLAN模块有三部分对外开放的API接口,如[下图2](#fig15016395217)所示: @@ -26,9 +31,9 @@ WLAN模块有三部分对外开放的API接口,如[下图2](#fig15016395217) **图 2** WLAN模块开放能力分布图 -![](figures/接口分布图4.png) +![](figure/接口分布图4.png) -## 接口说明 +### 接口说明 WLAN驱动模块提供给驱动开发人员可直接调用的能力接口,主要功能有:创建/释放WifiModule、关联/取消关联、申请/释放NetBuf、lwip的pbuf和NetBuf的相互转换等。提供的部分接口说明如[表1](#table1521573319472)所示: @@ -227,3 +232,391 @@ WLAN驱动模块对HDI层提供的能力接口,主要功能有:创建/销毁
+## 开发指导 + +WLAN驱动基于HDF框架和PLATFORM框架开发,不区分OS和芯片平台,为不同厂商的WLAN模组提供统一的驱动模型,各WLAN模组厂商根据如下指导适配WLAN驱动框架。 + +### 开发步骤 + +1. 通过wifi\_config.hcs文件,配置硬件参数:module\(不同feature\),芯片等。 +2. 解析配置文件, 生成全量配置的结构体对象。 +3. Module初始化,创建Module。 +4. 挂接chip,初始化chip。 +5. 总线初始化。 +6. 上层wpa业务挂接。 + +>![](../public_sys-resources/icon-note.gif) **说明:** +>以上驱动框架适配步骤一部分已经提供(详细见开发实例),待开发人员实现的部分有:1、根据硬件,修改配置参数;2、适配挂接chip;3、测试自验证。 + +## 开发实例 + +本例程提供WLAN模块初始化过程的完整使用流程。示例如下(以hi3881WLAN芯片为例): + +1、根据硬件,修改配置参数。 + +``` +/* 根据硬件参数,通过wlan_platform.hcs配置相关参数,以下是WLAN平台配置的示例 */ +hisi :& deviceList { + device0 :: deviceInst { + deviceInstId = 0; + powers { + power0 { + powerSeqDelay = 0; /* 电源序列延时 */ + powerType = 1; /* 电源类型:0--总是打开;1--GPIO */ + gpioId = 1; /* GPIO管脚号 */ + activeLevel=1; /* 有效电平:0--低;1--高 */ + } + power1 { + powerSeqDelay = 0; /* 电源序列延时 */ + powerType = 0; /* 电源类型:0--总是打开;1--GPIO */ + } + } + reset { + resetType = 0; /* 复位类型:0--不管理;1--GPIO */ + gpioId = 2; /* GPIO管脚号 */ + activeLevel=1; /* 有效电平:0--低;1--高 */ + resetHoldTime = 30; /* 复位配置后的等待时间(ms) */ + } + bootUpTimeout = 30; /* 启动超时时间(ms) */ + bus { + busType = 0; /* 总线类型:0-sdio */ + busId = 2; /* 总线号 */ + funcNum = [1]; /* SDIO功能号 */ + timeout = 1000; /* 读/写数据的超时时间 */ + blockSize = 512; /* 读/写数据的块大小 */ + } + } +} +/* 每一块芯片添加配置文件wlan_chip_<芯片名>.hcs(如:wlan_chip_hi3881.hcs),配置相关参数。以下是hi3881的配置示例 */ +root { + wlan_config { + hi3881 :& chipList { + chipHi3881 :: chipInst { + match_attr = "hdf_wlan_chips_hi3881"; /* 配置匹配标识 */ + chipName = "hi3881"; /* WLAN芯片的名称 */ + sdio { + vendorId = 0x0296; /* 厂商Id */ + deviceId = [0x5347]; /* 设备Id */ + } + } + } + } +} +``` + +2、适配挂接WLAN芯片的初始化和去初始化、WLAN芯片驱动的初始化和去初始化 + +``` +/* WLAN初始化挂接流程 */ +#include "hdf_device_desc.h" +#include "hdf_wifi_product.h" +#include "hdf_log.h" +#include "osal_mem.h" +#include "hdf_wlan_chipdriver_manager.h" +#include "securec.h" +#include "wifi_module.h" +#include "hi_wifi_api.h" +#include "hi_types_base.h" + +#define HDF_LOG_TAG Hi3881Driver + +/* WLAN芯片的初始化和去初始化函数 */ +int32_t InitHi3881Chip(struct HdfWlanDevice *device); +int32_t DeinitHi3881Chip(struct HdfWlanDevice *device); +/* WLAN芯片驱动的初始化和去初始化函数 */ +int32_t Hi3881Deinit(struct HdfChipDriver* chipDriver, struct NetDevice *netDevice); +int32_t Hi3881Init(struct HdfChipDriver* chipDriver, struct NetDevice *netDevice); + +/* 初始化mac80211与芯片侧的函数挂接 */ +hi_void HiMac80211Init(struct HdfChipDriver *chipDriver); + +static const char* const HI3881_DRIVER_NAME = "hisi"; + +/* WLAN芯片驱动挂接以及mac80211与芯片侧的函数挂接 */ +static struct HdfChipDriver *BuildHi3881Driver(struct HdfWlanDevice *device, uint8_t ifIndex) +{ + struct HdfChipDriver *specificDriver = NULL; + if (device == NULL) { + HDF_LOGE("%s fail : channel is NULL", __func__); + return NULL; + } + (void)device; + (void)ifIndex; + specificDriver = (struct HdfChipDriver *)OsalMemCalloc(sizeof(struct HdfChipDriver)); + if (specificDriver == NULL) { + HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__); + return NULL; + } + if (memset_s(specificDriver, sizeof(struct HdfChipDriver), 0, sizeof(struct HdfChipDriver)) != EOK) { + HDF_LOGE("%s fail: memset_s fail!", __func__); + OsalMemFree(specificDriver); + return NULL; + } + + if (strcpy_s(specificDriver->name, MAX_WIFI_COMPONENT_NAME_LEN, HI3881_DRIVER_NAME) != EOK) { + HDF_LOGE("%s fail : strcpy_s fail", __func__); + OsalMemFree(specificDriver); + return NULL; + } + specificDriver->init = Hi3881Init; + specificDriver->deinit = Hi3881Deinit; + + HiMac80211Init(specificDriver); + + return specificDriver; +} + +/* 释放WLAN芯片驱动 */ +static void ReleaseHi3881Driver(struct HdfChipDriver *chipDriver) +{ + if (chipDriver == NULL) { + return; + } + if (strcmp(chipDriver->name, HI3881_DRIVER_NAME) != 0) { + HDF_LOGE("%s:Not my driver!", __func__); + return; + } + OsalMemFree(chipDriver); +} + +static uint8_t GetHi3881GetMaxIFCount(struct HdfChipDriverFactory *factory) { + (void)factory; + return 1; +} + +/* WLAN芯片相关函数的注册 */ +static int32_t HDFWlanRegHisiDriverFactory(void) +{ + static struct HdfChipDriverFactory tmpFactory = { 0 }; + struct HdfChipDriverManager *driverMgr = NULL; + driverMgr = HdfWlanGetChipDriverMgr(); + if (driverMgr == NULL && driverMgr->RegChipDriver != NULL) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + tmpFactory.driverName = HI3881_DRIVER_NAME; + tmpFactory.GetMaxIFCount = GetHi3881GetMaxIFCount; + tmpFactory.InitChip = InitHi3881Chip; + tmpFactory.DeinitChip = DeinitHi3881Chip; + tmpFactory.Build = BuildHi3881Driver; + tmpFactory.Release = ReleaseHi3881Driver; + tmpFactory.ReleaseFactory = NULL; + if (driverMgr->RegChipDriver(&tmpFactory) != HDF_SUCCESS) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) +{ + (void)device; + return HDFWlanRegHisiDriverFactory(); +} + +struct HdfDriverEntry g_hdfHisiChipEntry = { + .moduleVersion = 1, + .Init = HdfWlanHisiChipDriverInit, + .moduleName = "HDF_WLAN_CHIPS" +}; + +HDF_INIT(g_hdfHisiChipEntry); +``` + +``` +#include "hdf_wifi_product.h" +#include "hi_wifi_api.h" +#if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) +#include "oal_thread.h" +#include "osal_time.h" +#endif +#include "wifi_mac80211_ops.h" +#include "wal_cfg80211.h" +#include "net_adpater.h" +#include "hdf_wlan_utils.h" + +#define HDF_LOG_TAG Hi3881Driver + +/* WLAN芯片的初始化函数 */ +int32_t InitHi3881Chip(struct HdfWlanDevice *device) +{ + uint8_t maxPortCount = 1; + int32_t ret = HI_SUCCESS; + uint8_t maxRetryCount = 2; + if (device == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HI_FAIL; + } + + do { + if (ret != HI_SUCCESS) { + if (device->reset != NULL && device->reset->Reset != NULL) { + device->reset->Reset(device->reset); + } + HDF_LOGE("%s:Retry init hi3881!last ret=%d", __func__, ret); + } + ret = hi_wifi_init(maxPortCount); + } while (ret != 0 && --maxRetryCount > 0); + + if (ret != 0) { + HDF_LOGE("%s:Init hi3881 driver failed!", __func__); + return ret; + } + return HI_SUCCESS; +} + +/* WLAN芯片的去初始化函数 */ +int32_t DeinitHi3881Chip(struct HdfWlanDevice *device) +{ + (void)device; + int32_t ret = hi_wifi_deinit(); + if (ret != 0) { + HDF_LOGE("%s:Deinit failed!ret=%d", __func__, ret); + } + return ret; +} + +/* WLAN芯片驱动的初始化函数 */ +int32_t Hi3881Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) +{ + HDF_LOGI("%s: start...", __func__); + hi_u16 mode = wal_get_vap_mode(); + int32_t ret; + nl80211_iftype_uint8 type; + (void)chipDriver; + + if (mode >= WAL_WIFI_MODE_BUTT) { + oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); + return HI_FAIL; + } + + if (mode == WAL_WIFI_MODE_STA) { + type = NL80211_IFTYPE_STATION; + } else if (mode == WAL_WIFI_MODE_AP) { + type = NL80211_IFTYPE_AP; + } else { + oam_error_log1(0, 0, "wal_init_drv_netdev:: invalid mode[%d]", mode); + return HI_FAIL; + } + + ret = wal_init_drv_wlan_netdev(type, WAL_PHY_MODE_11N, netDevice); + if (ret != HI_SUCCESS) { + oam_error_log2(0, OAM_SF_ANY, "wal_init_drv_netdev %s failed.l_return:%d\n", netDevice->name, ret); + } + return ret; +} + +/* WLAN芯片驱动的去初始化函数 */ +int32_t Hi3881Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) +{ + (void)chipDriver; + int32_t ret = wal_deinit_drv_wlan_netdev(netDevice); + if (ret != HDF_SUCCESS) { + return ret; + } + return ReleasePlatformNetDevice(netDevice); +} +``` + +3、在芯片侧初始化过程中调用netdev的init和add接口进行初始化netdev,并挂接netdev的一些函数指针 + +``` +hi_s32 wal_init_drv_wlan_netdev(nl80211_iftype_uint8 type, wal_phy_mode mode, hi_char* ifname, hi_u32* len) +{ + oal_net_device_stru *netdev = HI_NULL; + + ...... + /* 初始化网络设备,获取对应的实例。*/ + netdev = NetDeviceInit(ifname, *len, LITE_OS); + oal_wireless_dev *wdev = (oal_wireless_dev *)oal_mem_alloc(OAL_MEM_POOL_ID_LOCAL, sizeof(oal_wireless_dev)); + ret = wal_init_netif(type, netdev, wdev); + + ...... + + return HI_SUCCESS; +} +/* 挂接netdev的一些函数指针,详细挂接函数{@link NetDeviceInterFace} */ +oal_net_device_ops_stru g_wal_net_dev_ops = +{ + .getStats = wal_netdev_get_stats, + .open = wal_netdev_open, + .stop = wal_netdev_stop, + .xmit = hmac_bridge_vap_xmit, + .ioctl = wal_net_device_ioctl, + .changeMtu = oal_net_device_change_mtu, + .init = oal_net_device_init, + .deInit = oal_net_free_netdev, +#if (defined(_PRE_WLAN_FEATURE_FLOWCTL) || defined(_PRE_WLAN_FEATURE_OFFLOAD_FLOWCTL)) + .selectQueue = wal_netdev_select_queue, +#endif + .setMacAddr = wal_netdev_set_mac_addr, +#if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) + .netifNotify = HI_NULL, +#endif + .specialEtherTypeProcess = SpecialEtherTypeProcess, +}; + +hi_s32 wal_init_netif(nl80211_iftype_uint8 type, oal_net_device_stru *netdev, const oal_wireless_dev *wdev) +{ + /* 添加网络设备到协议栈 */ + hi_u32 ret = NetDeviceAdd(netdev, (Protocol80211IfType)type); + + ...... + + return HI_SUCCESS; +} +``` + +4、WifiMac80211Ops中的函数挂接实现。 + +``` +/* 挂接mac80211的一些函数指针 */ + +/* 驱动需要实现的MAC层基本能力的控制接口 */ +static struct HdfMac80211BaseOps g_baseOps = { + .SetMode = WalSetMode, + .AddKey = WalAddKey, + .DelKey = WalDelKey, + .SetDefaultKey = WalSetDefaultKey, + .GetDeviceMacAddr = WalGetDeviceMacAddr, + .SetMacAddr = WalSetMacAddr, + .SetTxPower = WalSetTxPower, + .GetValidFreqsWithBand = WalGetValidFreqsWithBand, + .GetHwCapability = WalGetHwCapability +}; + +/* 驱动需要实现的MAC层STA能力的控制接口 */ +static struct HdfMac80211STAOps g_staOps = { + .Connect = WalConnect, + .Disconnect = WalDisconnect, + .StartScan = WalStartScan, + .AbortScan = WalAbortScan, + .SetScanningMacAddress = WalSetScanningMacAddress, +}; + +/* 驱动需要实现的MAC层AP能力的控制接口 */ +static struct HdfMac80211APOps g_apOps = { + .ConfigAp = WalConfigAp, + .StartAp = WalStartAp, + .StopAp = WalStopAp, + .ConfigBeacon = WalChangeBeacon, + .DelStation = WalDelStation, + .SetCountryCode = WalSetCountryCode, + .GetAssociatedStasCount = WalGetAssociatedStasCount, + .GetAssociatedStasInfo = WalGetAssociatedStasInfo +}; + +/* 初始化mac80211与芯片侧的函数挂接 */ +hi_void HiMac80211Init(struct HdfChipDriver *chipDriver) +{ + if (chipDriver == NULL) { + oam_error_log(0, OAM_SF_ANY, "%s:input is NULL!", __func__); + return; + } + chipDriver->ops = &g_baseOps; + chipDriver->staOps = &g_staOps; + chipDriver->apOps = &g_apOps; +} +``` + diff --git "a/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\345\256\236\344\276\213.md" b/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md old mode 100755 new mode 100644 similarity index 66% rename from "zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\345\256\236\344\276\213.md" rename to zh-cn/device-dev/driver/driver-peripherals-lcd-des.md index 6de19704008c9850cec3a9f79baeddeef0c24401..90f54e12fbaa67eab88e46ecb651c4f7fb4bb7d1 --- "a/zh-cn/device-dev/driver/LCD\345\274\200\345\217\221\345\256\236\344\276\213.md" +++ b/zh-cn/device-dev/driver/driver-peripherals-lcd-des.md @@ -1,4 +1,76 @@ -# LCD开发实例 +# LCD + +- [概述](#section141575391542) + - [接口说明](#section14711163785519) + +- [开发指导](#section12394223125615) + - [开发步骤](#section515923045814) + +- [开发实例](#section7441155155813) + +## 概述 + +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驱动模型") + +- **Display驱动模型介绍** + + Display驱动模型主要由平台驱动层、芯片平台适配层、LCD器件驱动层三部分组成。驱动模型基于HDF驱动框架开发,通过Platform层和OSAL层提供的接口,屏蔽内核形态的差异,使得器件驱动可以便利的迁移到不同OS及芯片平台。模型向上对接Display公共hal层,支撑HDI接口的实现,通过Display-HDI(Hardware Display Interface)对图形服务提供各类驱动能力接口。 + + (1)Display平台驱动层:通过HDF提供的IOService数据通道,与公共Hal层对接,集中接收并处理各类上层调用指令; + + (2)SOC平台驱动适配层:借助此SOC适配层,实现Display驱动和SOC侧驱动解耦,主要完成芯片平台相关的参数配置,并传递平台驱动层的调用到器件驱动层; + + (3)LCD器件驱动层:在器件驱动层中,主要实现和器件自身强相关的驱动适配接口,例如发送初始化序列、上下电、背光设置等。 + + 基于Display驱动模型开发LCD驱动,可以借助平台提供的各种能力及接口,较大程度的降低器件驱动的开发周期和难度,提升开发效率。 + + +### 接口说明 + +LCD接口通常可分为MIPI DSI接口、TTL接口和LVDS接口,常用的是MIPI DSI接口和TTL接口,下面对常用的MIPI DSI接口和TTL接口作简要介绍。 + +- MIPI DSI接口 + + **图 2** MIPI DSI接口 + ![](figure/MIPI-DSI接口.png "MIPI-DSI接口") + + MIPI DSI接口是MIPI(移动行业处理器接口)联盟定义的显示接口,主要用于移动终端显示屏接口,接口数据传输遵循MIPI协议,MIPI DSI接口为数据接口,传输图像数据,通常情况下MIPI DSI接口的控制信息以MIPI包形式通过MIPI DSI接口发送到对端IC,不需要额外的外设接口。 + +- TTL接口 + + **图 3** TTL接口 + ![](figure/TTL接口.png "TTL接口") + + TTL(Transistor Transistor Logic)即晶体管-晶体管逻辑,TTL电平信号由TTL器件产生,TTL器件是数字集成电路的一大门类,它采用双极型工艺制造,具有高速度、低功耗和品种多等特点。 + + TTL接口是并行方式传输数据的接口,有数据信号、时钟信号和控制信号(行同步、帧同步、数据有效信号等),在控制信号控制下完成数据传输。通常TTL接口的LCD,内部寄存器读写需要额外的外设接口,比如SPI接口、I2C接口等。 + + +## 开发指导 + +Display驱动模型基于HDF驱动框架、Platform接口及OSAL接口开发,可以做到不区分OS(LiteOS、Linux)和芯片平台(Hi35xx、Hi38xx、V3S等),为LCD器件提供统一的驱动模型。 + +### 开发步骤 + +1. 添加LCD驱动相关的设备描述配置。 +2. 在SOC平台驱动适配层中适配对应的芯片平台驱动。 +3. 添加器件驱动,并在驱动入口函数Init中注册Panel驱动数据,驱动数据接口主要包括如下接口: + - LCD上下电 + + 根据LCD硬件连接,使用Platform接口层提供的GPIO操作接口操作对应LCD管脚,例如复位管脚、IOVCC管脚,上电时序参考LCD供应商提供的SPEC。 + + - 发送初始化序列 + + 根据LCD硬件接口,使用Platform接口层提供的I2C、SPI、MIPI等接口,下载LCD初始化序列,初始化参数序列可以参考LCD供应商提供的SPEC。 + + +4. 根据需求实现HDF框架其他接口,比如Release接口。 +5. 根据需求使用HDF框架可创建其他设备节点,用于业务逻辑或者调试功能。 + +## 开发实例 添加设备描述配置: diff --git "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\346\246\202\350\277\260.md" b/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md old mode 100755 new mode 100644 similarity index 46% rename from "zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\346\246\202\350\277\260.md" rename to zh-cn/device-dev/driver/driver-peripherals-sensor-des.md index 6319a9086c6c8754c6a8d36cf9abc7827d24e20b..a548abe552a26190c342b9f758a681f83861d271 --- "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/driver/driver-peripherals-sensor-des.md @@ -1,14 +1,20 @@ -# 传感器驱动开发概述 +# SENSOR -- [简介](#section667413271505) -- [接口说明](#section7255104114110) +- [概述](#section3634112111) + - [接口说明](#section188213414114) -## 简介 +- [开发指导](#section1140943382) + - [开发步骤](#section7893102915819) + +- [开发实例](#section257750691) +- [测试指导](#section106021256121219) + +## 概述 Sensor(传感器)驱动模块为上层Sensor服务系统提供稳定的Sensor基础能力API,包括Sensor列表查询、Sensor启停、Sensor订阅及去订阅,Sensor参数配置等功能;基于HDF(**H**ardware **D**river **F**oundation)驱动框架开发的Sensor驱动模型,实现跨操作系统迁移,器件差异配置等功能。Sensor驱动模型如下图1所示: **图 1** Sensor驱动模型图 -![](figures/Sensor驱动模型图.png "Sensor驱动模型图") +![](figure/Sensor驱动模型图.png "Sensor驱动模型图") Sensor驱动模型对外开放的API接口能力如下: @@ -16,7 +22,7 @@ Sensor驱动模型对外开放的API接口能力如下: - 提供Sensor驱动模型能力接口:依赖HDF驱动框架实现Sensor器件驱动的注册,加载,去注册,器件探测等能力,提供同一类型Sensor器件驱动归一接口, 寄存器配置解析操作接口,总线访问抽象接口,平台抽象接口。 - 提供开发者实现的能力接口:依赖HDF驱动框架的HCS\(**H**DF **C**onfiguration **S**ource\)配置管理,根据同类型Sensor差异化配置,实现Sensor器件参数序列化配置和器件部分操作接口,简化Sensor器件驱动开发。 -## 接口说明 +### 接口说明 Sensor驱动模型对HDI开放的API接口功能,参考表1。 @@ -240,5 +246,684 @@ Sensor驱动模型要求驱动开发者实现的接口功能,参考表3
-接口实现参考[SENSOR](传感器驱动开发实例.md)章节。 +接口实现参考[SENSOR](#section257750691)章节。 + +## 开发指导 + +Sensor驱动是基于HDF框架、PLATFORM和OSAL基础接口进行开发,不区分操作系统和芯片平台,为不同Sensor器件提供统一的驱动模型。本篇开发指导以加速度计传感器为例,介绍传感器驱动开发。 + +### 开发步骤 + +1. 加速度计传感器驱动注册。HDF驱动框架会提供统一的驱动管理模型,通过加速计传感器模块配置信息,识别并加载对应模块驱动。 +2. 加速度计传感器驱动初始化和去初始化。HDF驱动框架通过init入口函数,依次启动传感器设备驱动加载和分配传感器设备数据配置资源。HDF驱动框架通过release函数,释放驱动加载的资源和配置。 +3. 加速度计传感器寄存器组配置解析。不同类型传感器需要在hcs里配置器件对应的HCS配置文件,然后再设备驱动启动过程中探测器件是否在位,然后加载对应的配置文件,生成配置的结构体对象。 +4. 加速度计传感器驱动操作接口实现。实现各个类型传感器归一化驱动接口,如init,GetInfo,Enable,Disable,SetBatch,SetMode,SetOption,ReadSensorData等函数,完成传感器驱动配置下发和数据上报功能。 + +>![](../public_sys-resources/icon-note.gif) **说明:** +>传感器驱动模型已经提供一部分能力集,包括驱动设备管理能力,抽象总线和平台操作接口能力,通用配置操作接口能力,配置解析操作接口能力,接口参考[表2](#table1156812588320)。需要开发人员实现部分有:1、传感器部分操作接口([表3](#table1083014911336));2、传感器HCS差异化数据配置;3、驱动基本功能验证。 + +## 开发实例 + +基于HDF驱动模型,加载启动加速度计传感器驱动,代码形式如下,具体原理可参考[HDF驱动开发指南](driver-hdf-development.md)。加速度传感器选择通讯接口方式为I2C,厂家选择博世BMI160加速度传感器。 + +1. 加速度计传感器驱动入口注册 + +- 加速度计传感器驱动入口函数实现 + +``` +/* 注册加速度计传感器入口数据结构体对象 */ +struct HdfDriverEntry g_sensorAccelDevEntry = { + .moduleVersion = 1, /* 加速度计传感器模块版本号 */ + .moduleName = "HDF_SENSOR_ACCEL", /* 加速度计传感器模块名,要与device_info.hcs文件里的加速度计moduleName字段值一样*/ + .Bind = BindAccelDriver, /* 加速度计传感器绑定函数 */ + .Init = InitAccelDriver, /* 加速度计传感器初始化函数 */ + .Release = ReleaseAccelDriver, /* 加速度计传感器资源释放函数 */ +}; + +/* 调用HDF_INIT将驱动入口注册到HDF框架中,在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动,当Init调用异常时,HDF框架会调用Release释放驱动资源并退出 */ +HDF_INIT(g_sensorAccelDevEntry); +``` + +- 加速度计传感器设备配置描述 + +加速度传感器模型使用HCS作为配置描述源码,HCS配置字段详细介绍参考[配置管理](driver-hdf-manage.md)介绍。 + +``` +/* 加速度计传感器设备HCS配置 */ +device_sensor_accel :: device { + device0 :: deviceNode { + policy = 1; /* policy字段是驱动服务发布的策略 */ + priority = 105; /* 驱动启动优先级(0-200),值越大优先级越低,建议默认配100,优先级相同则不保证device的加载顺序 */ + preload = 2; /* 驱动按需加载字段,0表示加载,2表示不加载 */ + permission = 0664; /* 驱动创建设备节点权限 */ + moduleName = "HDF_SENSOR_ACCEL"; /* 驱动名称,该字段的值必须和驱动入口结构的moduleName值一致 */ + serviceName = "sensor_accel"; /* 驱动对外发布服务的名称,必须唯一 */ + deviceMatchAttr = "hdf_sensor_accel_driver"; /* 驱动私有数据匹配的关键字,必须和驱动私有数据配置表中的match_attr值相等 */ + } +} +``` + +1. 加速度计传感器驱动初始化和去初始化 + +- 初始化入口函数init + +``` +/* 加速度计传感器驱动对外提供的服务绑定到HDF框架 */ +int32_t BindAccelDriver(struct HdfDeviceObject *device) +{ + CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); + + static struct IDeviceIoService service = { + .object = {0}, + .Dispatch = DispatchAccel, + }; + device->service = &service; + + return HDF_SUCCESS; +} +/*在探测到器件在位后,需要调用RegisterAccelChipOps注册差异化适配函数*/ +int32_t RegisterAccelChipOps(struct AccelOpsCall *ops) +{ + struct AccelDrvData *drvData = NULL; + + CHECK_NULL_PTR_RETURN_VALUE(ops, HDF_ERR_INVALID_PARAM); + + drvData = AccelGetDrvData(); + drvData->ops.Init = ops->Init; + drvData->ops.ReadData = ops->ReadData; + return HDF_SUCCESS; +} +/* 挂载加速度计传感器驱动归一化的接口函数 */ +static int32_t InitAccelOps(struct SensorDeviceInfo *deviceInfo) +{ + struct AccelDrvData *drvData = AccelGetDrvData(); + + (void)memset_s((void *)deviceInfo, sizeof(*deviceInfo), 0, sizeof(*deviceInfo)); + deviceInfo->ops.GetInfo = SetAccelInfo; + deviceInfo->ops.Enable = SetAccelEnable; + deviceInfo->ops.Disable = SetAccelDisable; + deviceInfo->ops.SetBatch = SetAccelBatch; + deviceInfo->ops.SetMode = SetAccelMode; + deviceInfo->ops.SetOption = SetAccelOption; + + if (memcpy_s(&deviceInfo->sensorInfo, sizeof(deviceInfo->sensorInfo), + &drvData->accelCfg->sensorInfo, sizeof(drvData->accelCfg->sensorInfo)) != EOK) { + HDF_LOGE("%s: copy sensor info failed", __func__); + return HDF_FAILURE; + } + /* 传感器类型标识可以在数据HCS配置文件里面配置,也可以在此处 */ + drvData->accelCfg->sensorInfo.sensorTypeId = SENSOR_TAG_ACCELEROMETER; + drvData->accelCfg->sensorInfo.sensorId = SENSOR_TAG_ACCELEROMETER; + + return HDF_SUCCESS; +} +/* 传感器寄存器初始化操作 */ +static int32_t InitAccelAfterConfig(void) +{ + struct SensorDeviceInfo deviceInfo; + + if (InitAccelConfig() != HDF_SUCCESS) { + HDF_LOGE("%s: init accel config failed", __func__); + return HDF_FAILURE; + } + + if (InitAccelOps(&deviceInfo) != HDF_SUCCESS) { + HDF_LOGE("%s: init accel ops failed", __func__); + return HDF_FAILURE; + } + + if (AddSensorDevice(&deviceInfo) != HDF_SUCCESS) { + HDF_LOGE("%s: add accel device failed", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} +/*通过器件探测函数,挂载器件差异化函数接口*/ +static int32_t DetectAccelChip(void) +{ + int32_t num; + int32_t ret; + int32_t loop; + struct AccelDrvData *drvData = AccelGetDrvData(); + CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); + + num = sizeof(g_accelDetectIfList) / sizeof(g_accelDetectIfList[0]); + for (loop = 0; loop < num; ++loop) { + if (g_accelDetectIfList[loop].DetectChip != NULL) { + ret = g_accelDetectIfList[loop].DetectChip(drvData->accelCfg); + if (ret == HDF_SUCCESS) { + drvData->detectFlag = true; + break; + } + } + } + + if (loop == num) { + HDF_LOGE("%s: detect accel device failed", __func__); + drvData->detectFlag = false; + return HDF_FAILURE; + } + return HDF_SUCCESS; +} +/* 加速度计传感器驱动初始化入口函数,主要功能为对传感器私有数据的结构体对象进行初始化,传感器HCS数据配置对象空间分配,传感器HCS数据配置初始化入口函数调用,传感器设备探测是否在位功能,传感器数据上报定时器创建,传感器归一化接口挂载,传感器设备注册功能 */ +int32_t InitAccelDriver(struct HdfDeviceObject *device) +{ + /* 获取传感器私有数据结构体对象 */ + struct AccelDrvData *drvData = AccelGetDrvData(); + + /* 同类型传感器不同厂家设备探测时,判断此类型传感器是否已经在位,若已经在位,无需再继续探测,直接返回 */ + if (drvData->detectFlag) { + HDF_LOGE("%s: accel sensor have detected", __func__); + return HDF_SUCCESS; + } + + CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); + /* 分配存放传感器数据配置的私有结构体数据对象,需要在驱动释放时释放分配的资源空间 */ + drvData->accelCfg = (struct SensorCfgData *)OsalMemCalloc(sizeof(*cfg)); + if (drvData->accelCfg == NULL) { + HDF_LOGE("%s: malloc sensor config data failed", __func__); + return HDF_FAILURE; + } + + drvData->accelCfg->regCfgGroup = &g_regCfgGroup[0]; + /* 初始化传感器配置数据主要是解析传感器通讯总线配置类型信息,传感器基本信息,传感器属性信息,传感器是否在位信息,寄存器分组信息 */ + if (GetSensorBaseConfigData(device->property, drvData->accelCfg) != HDF_SUCCESS) { + HDF_LOGE("%s: get sensor base config failed", __func__); + goto Base_CONFIG_EXIT; + } + + if (DetectAccelChip() != HDF_SUCCESS) { + HDF_LOGE("%s: accel sensor detect device no exist", __func__); + goto DETECT_CHIP_EXIT; + } + drvData->detectFlag = true; + if (ParseSensorRegConfig(drvData->accelCfg) != HDF_SUCCESS) { + HDF_LOGE("%s: detect sensor device failed", __func__); + goto REG_CONFIG_EXIT; + } + + if (InitAccelAfterConfig() != HDF_SUCCESS) { + HDF_LOGE("%s: init accel after config failed", __func__); + goto INIT_EXIT; + } + + HDF_LOGI("%s: init accel driver success", __func__); + return HDF_SUCCESS; + +INIT_EXIT: + DestroySensorThread(&drvData->thread, &drvData->threadStatus); + (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); +REG_CONFIG_EXIT: + ReleaseSensorAllRegConfig(drvData->accelCfg); + (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); +DETECT_CHIP_EXIT: + drvData->detectFlag = false; +BASE_CONFIG_EXIT: + drvData->accelCfg->root = NULL; + drvData->accelCfg->regCfgGroup = NULL; + OsalMemFree(drvData->accelCfg); + drvData->accelCfg = NULL; + return HDF_FAILURE; +} + +/* 释放驱动初始化时分配的资源 */ +void ReleaseAccelDriver(struct HdfDeviceObject *device) +{ + (void)device; + struct AccelDrvData *drvData = NULL; + + drvData = AccelGetDrvData(); + (void)DestroySensorThread(&drvData->thread, &drvData->threadStatus); + (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); + drvData->detectFlag = false; + + if (drvData->accelCfg != NULL) { + drvData->accelCfg->root = NULL; + drvData->accelCfg->regCfgGroup = NULL; + ReleaseSensorAllRegConfig(drvData->accelCfg); + (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); + OsalMemFree(drvData->accelCfg); + drvData->accelCfg = NULL; + } + + drvData->initStatus = false; +} +``` + +1. 加速度计传感器寄存器组配置信息 + +加速度计传感器数据配置只需要按照模板配置即可,基于模板配置的解析功能已经在**InitSensorConfigData**函数完成,只需初始化时调用即可。如果有新增配置项,需要同步修改此函数。 + +``` +加速度传感器数据配置模板(accel_config.hcs) +root { + sensorAccelConfig { + accelChipConfig { + /* 传感器设备信息模板 */ + template sensorInfo { + sensorName = "accelerometer"; /* 加速度计名字,字符最大长度16字节 */ + vendorName = "borsh_bmi160"; /* 传感器设备厂商,字符最大长度16字节 */ + firmwareVersion = "1.0"; /* 传感器固件版本号,默认1.0,字符最大长度16字节 */ + hardwareVersion = "1.0"; /* 传感器硬件版本号,默认1.0,字符最大长度16字节 */ + sensorTypeId = 1; /* 传感器类型编号,详见{@link SensorTypeTag} */ + sensorId = 1; /* 传感器的标识号,有传感器驱动开发者定义,推荐用{@link SensorTypeTag}枚举 */ + maxRange = 8; /* 传感器的最大量程,根据开发者需要配置 */ + precision = 0; /* 传感器的精度,与上报数据配合使用,上报数据结构体{@link SensorEvents } */ + power = 230; /* 传感器的功耗 */ + } + /* 传感器使用的总线类型和配置信息模板 */ + template sensorBusConfig { + busType = 0; /* 0:i2c 1:spi */ + busNum = 6; /* 芯片上分配给传感器的器件号 */ + busAddr = 0; /* 芯片上分配给传感器的地址 */ + regWidth = 1; /* 传感器寄存器地址宽度 */ + regBigEndian = 0; /* 传感器寄存器大小端 */ + } + /* 传感器设备属性模板 */ + template sensorAttr { + chipName = ""; /* 传感器芯片名字 */ + chipIdRegister = 0xf; /* 传感器在位检测寄存器地址 */ + chipIdValue = 0xd1; /* 校验传感器在位检测寄存器值 */ + } + } + } +} + +/* 根据不同器件硬件差异,修改模板配置,不修改的就会默认采用模板配置 */ +root { + sensorAccelConfig { + accel_bmi160_chip_config : accelChipConfig { + match_attr = "hdf_sensor_accel_driver"; /* 需要和加速度传感器设备配置match_attr字段保持一致 */ + accelInfo :: sensorInfo { + vendorName = "borsh_bmi160"; + sensorTypeId = 1; + sensorId = 1; + } + accelBusConfig :: sensorBusConfig { + busType = 0; /* i2c通讯方式 */ + busNum = 6; + busAddr = 0x68; + regWidth = 1; /* 1字节位宽 */ + } + accelAttr :: sensorAttr { + chipName = "bmi160"; + chipIdRegister = 0x00; + chipIdValue = 0xd1; + } + accelRegConfig { + /* regAddr: 寄存器地址 + value: 寄存器值 + mask: 寄存器值的掩码 + len: 寄存器值的数据长度(字节) + delay: 配置寄存器延时(ms) + opsType:操作类型 0-无 1-读 2-写 3-读并检查 4-位更新 + calType: 计算类型 0-无 1-写 2-取反 3-异或 4-左移 5-右移 + shiftNum: 移动位数 + debug: 调试开关,0-调试关闭 1-调试打开 + save: 保存数据开关,0-不保存数据 1-保存数据 + */ + /* 传感器寄存器操作分组,按照分组进行有序配置 */ + /* 寄存器地址, 寄存器值, 寄存器值的掩码, 寄存器值的数据长度, 配置寄存器延时, 操作类型, 计算类型, 移动位数, 调试开关, 保存开关 */ + /* 初始化寄存器组 */ + initSeqConfig = [ + 0x7e, 0xb6, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + /* 使能寄存器组 */ + enableSeqConfig = [ + 0x7e, 0x11, 0xff, 1, 5, 2, 0, 0, 0, 0, + 0x41, 0x03, 0xff, 1, 0, 2, 0, 0, 0, 0, + 0x40, 0x08, 0xff, 1, 0, 2, 0, 0, 0, 0 + ]; + /* 去使能寄存器组 */ + disableSeqConfig = [ + 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 + ]; + } + } + } +} +``` + +1. 加速度计传感器驱动操作接口实现 + +开发者需要根据每种类型的传感器实现归一化接口。 + +``` +/* 不使用函数暂时置空 */ +static int32_t SetAccelInfo(struct SensorBasicInfo *info) +{ + (void)info; + + return HDF_ERR_NOT_SUPPORT; +} +/* 下发使能寄存器组的配置 */ +static int32_t SetAccelEnable(void) +{ + int32_t ret; + struct AccelDrvData *drvData = AccelGetDrvData(); + + CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); + ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_ENABLE_GROUP]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel sensor disable config failed", __func__); + return HDF_FAILURE; + } + + drvData->threadStatus = SENSOR_THREAD_RUNNING; + + return HDF_SUCCESS; +} +/* 下发去使能寄存器组的配置 */ +static int32_t SetAccelDisable(void) +{ + int32_t ret; + struct AccelDrvData *drvData = AccelGetDrvData(); + + CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); + + ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_DISABLE_GROUP]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel sensor disable config failed", __func__); + return HDF_FAILURE; + } + + drvData->threadStatus = SENSOR_THREAD_STOPPED; + + return HDF_SUCCESS; +} +/* 配置传感器采样率和数据上报间隔 */ +static int32_t SetAccelBatch(int64_t samplingInterval, int64_t interval) +{ + (void)interval; + + struct AccelDrvData *drvData = AccelGetDrvData(); + drvData->interval = samplingInterval; + + return HDF_SUCCESS; +} +/* 设置传感器工作模式,当前支持实时模式 */ +static int32_t SetAccelMode(int32_t mode) +{ + return (mode == SENSOR_WORK_MODE_REALTIME) ? HDF_SUCCESS : HDF_FAILURE; +} +/* 设置传感器可选配置 */ +static int32_t SetAccelOption(uint32_t option) +{ + (void)option; + return HDF_ERR_NOT_SUPPORT; +} +``` + +- 差异化处理接口 + + ``` + /* 器件探测时,如果探测成功,则注册差异化处理函数到accel驱动模型里 */ + int32_t DetectAccelBim160Chip(struct SensorCfgData *data) + { + int32_t ret; + struct AccelOpsCall ops; + CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); + + if (strcmp(ACCEL_CHIP_NAME_BMI160, data->sensorAttr.chipName) != 0) { + return HDF_SUCCESS; + } + ret = InitAccelPreConfig(); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: init BMI160 bus mux config", __func__); + return HDF_FAILURE; + } + if (DetectSensorDevice(data) != HDF_SUCCESS) { + return HDF_FAILURE; + } + + /* 差异化处理函数 */ + ops.Init = InitBmi160; + ops.ReadData = ReadBmi160Data; + ret = RegisterAccelChipOps(&ops); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: register BMI160 accel failed", __func__); + (void)ReleaseSensorBusHandle(&data->busCfg); + return HDF_FAILURE; + } + return HDF_SUCCESS; + } + /* 初始化处理函数 */ + static int32_t InitBmi160(struct SensorCfgData *data) + { + int32_t ret; + + CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); + ret = SetSensorRegCfgArray(&data->busCfg, data->regCfgGroup[SENSOR_INIT_GROUP]); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: bmi160 sensor init config failed", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; + } + /* 数据处理函数 */ + int32_t ReadBmi160Data(struct SensorCfgData *data) + { + int32_t ret; + struct AccelData rawData = { 0, 0, 0 }; + int32_t tmp[ACCEL_AXIS_NUM]; + struct SensorReportEvent event; + + (void)memset_s(&event, sizeof(event), 0, sizeof(event)); + + ret = ReadBmi160RawData(data, &rawData, &event.timestamp); + if (ret != HDF_SUCCESS) { + return HDF_FAILURE; + } + + event.sensorId = SENSOR_TAG_ACCELEROMETER; + event.option = 0; + event.mode = SENSOR_WORK_MODE_REALTIME; + + rawData.x = rawData.x * BMI160_ACC_SENSITIVITY_2G; + rawData.y = rawData.y * BMI160_ACC_SENSITIVITY_2G; + rawData.z = rawData.z * BMI160_ACC_SENSITIVITY_2G; + + tmp[ACCEL_X_AXIS] = (rawData.x * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; + tmp[ACCEL_Y_AXIS] = (rawData.y * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; + tmp[ACCEL_Z_AXIS] = (rawData.z * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; + + event.dataLen = sizeof(tmp); + event.data = (uint8_t *)&tmp; + ret = ReportSensorEvent(&event); + return ret; + } + ``` + +- 数据处理函数 + +创建传感器定时器,按照配置的采样率定时采样,并上报给数据订阅者。 + +``` +/* 传感器定时工作线程 */ +static int32_t ReadAccelDataThreadWorker(void *arg) +{ + (void)arg; + int64_t interval; + struct AccelDrvData *drvData = AccelGetDrvData(); + + drvData->threadStatus = SENSOR_THREAD_START; + while (true) { + if (drvData->threadStatus == SENSOR_THREAD_RUNNING) { + if (drvData->ops.ReadData != NULL) { + (void)drvData->ops.ReadData(drvData->accelCfg); + } + interval = OsalDivS64(drvData->interval, (SENSOR_CONVERT_UNIT * SENSOR_CONVERT_UNIT)); + OsalMSleep(interval); + } else if (drvData->threadStatus == SENSOR_THREAD_DESTROY) { + break; + } else { + OsalMSleep(ACC_DEFAULT_SAMPLING_200_MS / SENSOR_CONVERT_UNIT / SENSOR_CONVERT_UNIT); + } + + if ((!drvData->initStatus) || (drvData->interval < 0) || drvData->threadStatus != SENSOR_THREAD_RUNNING) { + continue; + } + } + + return HDF_SUCCESS; +} +/* 创建传感器定时器和器件初始化 */ +static int32_t InitAccelConfig(void) +{ + int32_t ret; + struct AccelDrvData *drvData = AccelGetDrvData(); + + if (drvData->threadStatus != SENSOR_THREAD_NONE && drvData->threadStatus != SENSOR_THREAD_DESTROY) { + HDF_LOGE("%s: accel thread have created", __func__); + return HDF_SUCCESS; + } + + ret = CreateSensorThread(&drvData->thread, ReadAccelDataThreadWorker, "hdf_sensor_accel", drvData); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel create thread failed", __func__); + drvData->threadStatus = SENSOR_THREAD_NONE; + return HDF_FAILURE; + } + + CHECK_NULL_PTR_RETURN_VALUE(drvData->ops.Init, HDF_ERR_INVALID_PARAM); + + ret = drvData->ops.Init(drvData->accelCfg); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: accel create thread failed", __func__); + drvData->threadStatus = SENSOR_THREAD_NONE; + return HDF_FAILURE; + } + drvData->initStatus = true; + return HDF_SUCCESS; +} +``` + +- 主要的数据结构 + +``` +/* 传感器转换单位*/ +#define SENSOR_CONVERT_UNIT 1000 +#define SENSOR_1K_UNIT 1024 +/* 传感器2g对应灵敏度转换值 */ +#define BMI160_ACC_SENSITIVITY_2G 61 +/* 传感器数据采样寄存器地址 */ +#define BMI160_ACCEL_X_LSB_ADDR 0X12 +#define BMI160_ACCEL_X_MSB_ADDR 0X13 +#define BMI160_ACCEL_Y_LSB_ADDR 0X14 +#define BMI160_ACCEL_Y_MSB_ADDR 0X15 +#define BMI160_ACCEL_Z_LSB_ADDR 0X16 +#define BMI160_ACCEL_Z_MSB_ADDR 0X17 +/* 传感器数据维度 */ +enum AccelAxisNum { + ACCEL_X_AXIS = 0, + ACCEL_Y_AXIS = 1, + ACCEL_Z_AXIS = 2, + ACCEL_AXIS_NUM = 3, +}; +/* 传感器每个维度值 */ +struct AccelData { + int32_t x; + int32_t y; + int32_t z; +}; +/* 传感器私有数据结构体 */ +struct AccelDrvData { + bool detectFlag; + uint8_t threadStatus; + uint8_t initStatus; + int64_t interval; + struct SensorCfgData *accelCfg; + struct OsalThread thread; + struct AccelOpsCall ops; +}; +/* 差异化适配函数 */ +struct AccelOpsCall { + int32_t (*Init)(struct SensorCfgData *data); + int32_t (*ReadData)(struct SensorCfgData *data); +}; +``` + +## 测试指导 + +驱动开发完成后,在传感器单元测试里面开发自测试用例,验证驱动基本功能。测试环境采用开发者自测试平台。 + +``` +/* 标识是否上报传感器数据 */ +static int32_t g_sensorDataFlag = 0; +/* 保持获取的传感器接口实例地址 */ +static const struct SensorInterface *g_sensorDev = nullptr; + +/* 订阅者注册数据上报函数 */ +static int SensorTestDataCallback(struct SensorEvents *event) +{ + if (event == nullptr) { + return -1; + } + float *data = (float*)event->data; + printf("time [%lld] sensor id [%d] x-[%f] y-[%f] z-[%f]\n\r", event->timestamp, + event->sensorId, (*data), *(data + 1), *(data + g_axisZ)); + if (*data > 1e-5) { + g_sensorDataFlag = 1; + } + return 0; +} +/* 用例执行前,初始化传感器接口实例 */ +void HdfSensorTest::SetUpTestCase() +{ + g_sensorDev = NewSensorInterfaceInstance(); + if (g_sensorDev == nullptr) { + printf("test sensorHdi get Module instace failed\n\r"); + } +} +/* 用例资源释放 */ +void HdfSensorTest::TearDownTestCase() +{ + if (g_sensorDev != nullptr) { + FreeSensorInterfaceInstance(); + g_sensorDev = nullptr; + } +} +/* 传感器驱动测试验证 */ +HWTEST_F(HdfSensorTest,TestAccelDriver_001, TestSize.Level0) +{ + int32_t sensorInterval = 1000000000; /* 数据采样率单位纳秒 */ + int32_t pollTime = 5; /* 数据采样时间单位秒 */ + int32_t accelSensorId = 1; /* 加速度传感器类型标识为1 */ + int32_t count = 0; + int ret; + struct SensorInformation *sensorInfo = nullptr; + + ret = g_sensorDev->Register(SensorTestDataCallback) + EXPECT_EQ(SENSOR_NULL_PTR, ret); + + ret = g_sensorDev->GetAllSensors(&sensorInfo, &count); + EXPECT_EQ(0, ret); + if (sensorInfo == nullptr) { + EXPECT_NE(nullptr, sensorInfo); + return; + } + /* 打印获取的传感器列表 */ + for (int i = 0; i < count; i++) { + printf("get sensoriId[%d], info name[%s]\n\r", sensorInfo[i]->sensorId, sensorInfo[i]->sensorName); + } + ret = g_sensorDev->Enable(accelSensorId); + EXPECT_EQ(0, ret); + g_sensorDataFlag = 0; + + ret = g_sensorDev->SetBatch(accelSensorId, sensorInterval, pollTime); + EXPECT_EQ(0, ret); + /* 在时间pollTime内,观察输出打印数据 */ + OsalSleep(pollTime); + EXPECT_EQ(1, g_sensorDataFlag); + + ret = g_sensorDev->Disable(accelSensorId); + g_sensorDataFlag = 0; + EXPECT_EQ(0, ret); + + ret = g_sensorDev->Unregister(); + EXPECT_EQ(0, ret); +} +``` diff --git "a/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\345\256\236\344\276\213.md" b/zh-cn/device-dev/driver/driver-peripherals-touch-des.md old mode 100755 new mode 100644 similarity index 58% rename from "zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\345\256\236\344\276\213.md" rename to zh-cn/device-dev/driver/driver-peripherals-touch-des.md index a298d618c1547f7c66c6213a42563b3896ac80b2..5f4c46ba8ba7880cc11846b81f618167626bc455 --- "a/zh-cn/device-dev/driver/Touchscreen\345\274\200\345\217\221\345\256\236\344\276\213.md" +++ b/zh-cn/device-dev/driver/driver-peripherals-touch-des.md @@ -1,14 +1,124 @@ -# Touchscreen开发实例 +# TOUCHSCREEN -- [设备描述配置](#section85281142102317) -- [板级配置及器件私有配置](#section189081946192410) -- [添加器件驱动](#section19856687253) +- [概述](#section175431838101617) + - [接口说明](#section17667171301711) + +- [开发指导](#section65745222184) + - [开发步骤](#section865734181916) + +- [开发实例](#section263714411191) + - [设备描述配置](#section18249155619195) + - [板级配置及器件私有配置](#section3571192072014) + - [添加器件驱动](#section6356758162015) + + +## 概述 + +- **Touchscreen驱动主要任务** + + Touchscreen驱动用于驱动触摸屏使其正常工作,该驱动主要完成如下工作:对触摸屏驱动IC进行上电、配置硬件管脚并初始化其状态、注册中断、配置通信接口(I2C或SPI)、设定input相关配置、下载及更新固件等操作。 + + +- **Touchscreen驱动层次说明** + + 本节主要介绍基于input驱动模型开发touchscreen器件驱动,其整体的框架模型如[图1](#fig6251184817261)。 + + Input驱动模型基于HDF驱动框架、PLATFORM接口、OSAL接口进行开发,向上对接规范化的驱动接口HDI(Hardware Driver Interface)层,通过Input-HDI层对外提供硬件能力,即上层input service可以通过HDI接口层获取相应的驱动能力,进而操控touchscreen等输入设备。 + + +**图 1** 基于HDF驱动框架的input驱动模型 +![](figure/基于HDF驱动框架的input驱动模型.png "基于HDF驱动框架的input驱动模型") + +- **Input驱动模型介绍** + + Input驱动模型核心部分由设备管理层、公共驱动层、器件驱动层组成。器件产生的数据借助平台数据通道能力从内核传递到用户态,驱动模型通过配置文件适配不同器件及硬件平台,提高开发者的器件驱动开发效率。如下部分为模型各部分的说明: + + (1)input设备管理:为各类输入设备驱动提供input设备的注册、注销接口,同时统一管理input设备列表; + + (2)input平台驱动:指各类input设备的公共抽象驱动(例如触摸屏的公共驱动),负责对板级硬件进行初始化、硬件中断处理、向manager注册input设备等; + + (3)input器件驱动:指各器件厂家的差异化驱动,通过适配平台驱动预留的差异化接口,实现器件驱动开发量最小化; + + (4)input数据通道:提供一套通用的数据上报通道,各类别的input设备驱动均可用此通道上报input事件; + + (5)input配置解析:负责对input设备的板级配置及器件私有配置进行解析及管理。 + + +- **基于HDF驱动框架开发器件驱动的优势** + + 在HDF(Hardware Driver Foundation)[驱动管理框架](driver-hdf-development.md)的基础上,input驱动模型调用OSAL接口层和Platfom接口层提供的基础接口进行开发,包括bus通信接口、操作系统原生接口(memory、lock、thread、timer等)。由于OSAL接口和Platform接口屏蔽了芯片平台差异,所以基于input驱动模型实现的touchscreen驱动可以进行跨平台、跨OS迁移,以便逐步实现驱动的一次开发,多端部署。 + + +### 接口说明 + +Touchscreen器件的硬件接口相对简单,根据PIN脚的属性,可以简单分为如下三类: + +- 电源接口 +- IO控制接口 +- 通信接口 + +**图 2** Touchscreen器件常用管脚 +![](figure/Touchscreen器件常用管脚.png "Touchscreen器件常用管脚") + +如上图所示的三类接口,分别做简要说明如下: + +1. **电源接口** + - LDO\_1P8:1.8v数字电路 + - LDO\_3P3:3.3v模拟电路 + + 通常情况下,touchscreen驱动IC和LCD驱动IC是相互分离的,这种情况下,touchscreen驱动IC一般同时需要1.8v和3.3v两路供电。随着芯片演进,业内已有touchscreen驱动IC和LCD驱动IC集成在一颗IC中的芯片案例,对touchscreen而言,只需要关注1.8v供电即可,其内部需要的3.3v电源,会在驱动IC内部从LCD的VSP电源(典型值5.5V)中分出来。 + + +2. **IO控制接口** + - Reset:reset管脚,用于在系统休眠、唤醒时,由主机侧对驱动IC进行复位操作。 + - INT:中断管脚,需要在驱动初始化时,配置为输入上拉状态。在驱动IC检测到外部触摸信号后,通过操作中断管脚来触发中断,器件驱动则会在中断处理函数中进行报点数据读取等操作。 + +3. **通信接口** + - I2C:由于touchscreen的报点数据量相对较少,所以一般选用I2C方式传输数据。I2C的具体协议及对应操作接口,可以参考Platform接口层中的[“I2C”使用指南](drive-platform-i2c-des.md#section1695201514281)。 + - SPI:部分厂商,由于需要传递的数据不止报点坐标,而是需要获取基础容值,数据量较大,所以会选用SPI通信方式。SPI的具体协议及对应操作接口,可以参考Platform接口层中的[“SPI” 使用指南](drive-platform-spi-des.md#section71363452477)。 + + +## 开发指导 + +Input驱动模型是基于HDF框架、Platform接口和OSAL接口开发,不区分操作系统和芯片平台,为touchscreen等输入器件提供统一的驱动开发架构。 + +- 如下以touchscreen器件驱动为例,说明input驱动模型的完整加载流程: + + (1)设备描述配置:由开发者参考已有模板进行设备描述配置,包括驱动加载顺序、板级硬件信息、器件私有数据信息等。 + + (2)加载input设备管理驱动:input设备管理驱动由HDF驱动加载,完成设备manager的创建并对其初始化。 + + (3)加载平台驱动:平台驱动由HDF框架加载,主要完成板级配置解析及硬件初始化,并提供器件注册接口。 + + (4)加载器件驱动:器件驱动也由HDF框架加载,完成器件设备的实例化,包括器件私有配置解析和平台预留的差异化接口适配。 + + (5)器件设备向平台驱动注册:将实例化的器件设备向平台驱动注册,实现设备和驱动的绑定,并完成中断注册、上下电等器件初始化工作。 + + (6)input设备注册:在器件初始化完成后,实例化input设备,并将其注册到input manager进行管理。 + + +### 开发步骤 + +1. 设备描述配置 + + 目前Input驱动基于HDF驱动框架编写,驱动的加载启动由HDF驱动管理框架统一处理。首先需要在对应的配置文件中,将驱动信息注册进去,如是否加载、加载优先级,此后HDF驱动框架会逐一启动注册过的驱动模块。驱动的相关配置请参考[HDF驱动框架配置指导](driver-hdf-development.md#section1969312275533)。 + +2. 板级配置及Touchscreen器件私有配置 + + 配置对应的IO管脚功能,例如对单板上为touchscreen设计预留的I2C Pin脚,需设置对应的寄存器,使其选择I2C的通信功能。 + +3. 实现器件差异化适配接口 + + 根据硬件单板设计的通信接口,使用Platform接口层提供的管脚操作接口配置对应的复位管脚、中断管脚以及电源操作,对于GPIO的操作,可参考[GPIO操作接口指导](drive-platform-gpio-des.md#section259614242196) + + +## 开发实例 本实例提供touchscreen驱动开发示例,并简要对具体关键点进行开发说明。 -## 设备描述配置 +### 设备描述配置 -如下配置主要包含input驱动模型各模块层级信息,具体原理可参考[HDF驱动开发指南](驱动开发.md),HDF框架依据该配置信息实现对Input模型各模块的依次加载等。 +如下配置主要包含input驱动模型各模块层级信息,具体原理可参考[HDF驱动开发指南](driver-hdf-development.md),HDF框架依据该配置信息实现对Input模型各模块的依次加载等。 ``` input :: host { @@ -51,7 +161,7 @@ input :: host { } ``` -## 板级配置及器件私有配置 +### 板级配置及器件私有配置 如下配置包含板级硬件配置及器件私有数据配置,实际业务开发时,可根据具体需求增删及修改如下配置文件信息。 @@ -140,7 +250,7 @@ root { } ``` -## 添加器件驱动 +### 添加器件驱动 在器件驱动中,主要实现了平台预留的差异化接口,以器件数据获取及解析进行示例说明。具体开发过程,需要根据实际使用的单板及器件进行适配。 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 0000000000000000000000000000000000000000..12db978ab608630c7934c53e4c9cff9e613f8e43 --- /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/GPIO\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-gpio-des.md old mode 100755 new mode 100644 similarity index 70% rename from "zh-cn/device-dev/driver/GPIO\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-gpio-des.md index 1bc136ee21147a7eca55b507cd96dfa8ab5fe583..d4e67c7a5167857f6a3091f277b3da9a98c26490 --- "a/zh-cn/device-dev/driver/GPIO\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-gpio-des.md @@ -1,19 +1,104 @@ -# GPIO使用指导 - -- [使用流程](#section1583613406410) -- [确定GPIO管脚号](#section135943361443) -- [使用API操作GPIO管脚](#section69151114115315) - -## 使用流程 +# GPIO + +- [概述](#section1635911016188) + - [接口说明](#section17715915181611) + +- [使用指导](#section259614242196) + - [使用流程](#section103477714216) + - [确定GPIO管脚号](#section370083272117) + - [使用API操作GPIO管脚](#section13604050132118) + +- [使用实例](#section25941262111) + +## 概述 + +GPIO(General-purpose input/output)即通用型输入输出。通常,GPIO控制器通过分组的方式管理所有GPIO管脚,每组GPIO有一个或多个寄存器与之关联,通过读写寄存器完成对GPIO管脚的操作。 + +GPIO接口定义了操作GPIO管脚的标准方法集合,包括: + +- 设置管脚方向: 方向可以是输入或者输出\(暂不支持高阻态\) + +- 读写管脚电平值: 电平值可以是低电平或高电平 +- 设置管脚中断服务函数:设置一个管脚的中断响应函数,以及中断触发方式 +- 使能和禁止管脚中断:禁止或使能管脚中断 + +### 接口说明 + +**表 1** GPIO驱动API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

GPIO读写

+

GpioRead

+

读管脚电平值

+

GpioWrite

+

写管脚电平值

+

GPIO配置

+

GpioSetDir

+

设置管脚方向

+

GpioGetDir

+

获取管脚方向

+

GPIO中断设置

+

GpioSetIrq

+

设置管脚对应的中断服务函数

+

GpioUnSetIrq

+

取消管脚对应的中断服务函数

+

GpioEnableIrq

+

使能管脚中断

+

GpioDisableIrq

+

禁止管脚中断

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流程如[图1](#fig1399416053717)所示。 **图 1** GPIO使用流程图 -![](figures/zh-cn_image_0000001057342245.png) +![](figure/zh-cn_image_0000001170187071.png) -## 确定GPIO管脚号 +### 确定GPIO管脚号 不同SOC芯片由于其GPIO控制器型号、参数、以及控制器驱动的不同,GPIO管脚号的换算方式不一样。 @@ -34,7 +119,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 举例:GPIO7\_3的GPIO管脚号 = 7 \* 10 + 3 = 73 -## 使用API操作GPIO管脚 +### 使用API操作GPIO管脚 - 设置GPIO管脚方向 @@ -42,7 +127,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 int32\_t GpioSetDir\(uint16\_t gpio, uint16\_t dir\); - **表 1** GpioSetDir参数和返回值描述 + **表 2** GpioSetDir参数和返回值描述

参数

@@ -78,13 +163,14 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
+ - 读写GPIO管脚 如果要读取一个GPIO管脚电平,通过以下函数完成: int32\_t GpioRead\(uint16\_t gpio, uint16\_t \*val\); - **表 2** GpioRead参数和返回值描述 + **表 3** GpioRead参数和返回值描述

参数

@@ -124,7 +210,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 int32\_t GpioWrite\(uint16\_t gpio, uint16\_t val\); - **表 3** GpioWrite参数和返回值描述 + **表 4** GpioWrite参数和返回值描述

参数

@@ -194,7 +280,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 int32\_t GpioSetIrq\(uint16\_t gpio, uint16\_t mode, GpioIrqFunc func, void \*arg\); - **表 4** GpioSetIrq参数和返回值描述 + **表 5** GpioSetIrq参数和返回值描述

参数

@@ -240,14 +326,14 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
- >![](public_sys-resources/icon-caution.gif) **注意:** + >![](../public_sys-resources/icon-caution.gif) **注意:** >同一时间,只能为某个GPIO管脚设置一个中断服务函数,如果重复调用GpioSetIrq函数,则之前设置的中断服务函数会被取代。 当不再需要响应中断服务函数时,使用如下函数取消中断设置: int32\_t GpioUnSetIrq\(uint16\_t gpio\); - **表 5** GpioUnSetIrq参数和返回值描述 + **表 6** GpioUnSetIrq参数和返回值描述

参数

@@ -282,7 +368,7 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 int32\_t GpioEnableIrq\(uint16\_t gpio\); - **表 6** GpioEnableIrq参数和返回值描述 + **表 7** GpioEnableIrq参数和返回值描述

参数

@@ -313,14 +399,14 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流
- >![](public_sys-resources/icon-caution.gif) **注意:** + >![](../public_sys-resources/icon-caution.gif) **注意:** >必须通过此函数使能管脚中断,之前设置的中断服务函数才能被正确响应。 如果要临时屏蔽此中断,可以通过如下函数禁止GPIO管脚中断: int32\_t GpioDisableIrq\(uint16\_t gpio\); - **表 7** GpioDisableIrq参数和返回值描述 + **表 8** GpioDisableIrq参数和返回值描述

参数

@@ -393,3 +479,82 @@ GPIO标准API通过GPIO管脚号来操作指定管脚,使用GPIO的一般流 ``` +## 使用实例 + +本实例程序中,我们将测试一个GPIO管脚的中断触发:为管脚设置中断服务函数,触发方式为边沿触发,然后通过交替写高低电平到管脚,产生电平波动,制造触发条件,观察中断服务函数的执行。 + +首先需要选取一个空闲的GPIO管脚,本例程基于Hi3516DV300某开发板,GPIO管脚选择GPIO10\_3,换算成GPIO号为83。 + +读者可以根据自己使用的开发板,参考其原理图,选择一个空闲的GPIO管脚即可。 + +``` +#include "gpio_if.h" +#include "hdf_log.h" +#include "osal_irq.h" +#include "osal_time.h" + +static uint32_t g_irqCnt; + +/* 中断服务函数*/ +static int32_t TestCaseGpioIrqHandler(uint16_t gpio, void *data) +{ + HDF_LOGE("%s: irq triggered! on gpio:%u, data=%p", __func__, gpio, data); + g_irqCnt++; /* 如果中断服务函数触发执行,则将全局中断计数加1 */ + return GpioDisableIrq(gpio); +} + +/* 测试用例函数 */ +static int32_t TestCaseGpioIrqEdge(void) +{ + int32_t ret; + uint16_t valRead; + uint16_t mode; + uint16_t gpio = 83; /* 待测试的GPIO管脚号 */ + uint32_t timeout; + + /* 将管脚方向设置为输出 */ + ret = GpioSetDir(gpio, GPIO_DIR_OUT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set dir fail! ret:%d\n", __func__, ret); + return ret; + } + + /* 先禁止该管脚中断 */ + ret = GpioDisableIrq(gpio); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: disable irq fail! ret:%d\n", __func__, ret); + return ret; + } + + /* 为管脚设置中断服务函数,触发模式为上升沿和下降沿共同触发 */ + mode = OSAL_IRQF_TRIGGER_RISING | OSAL_IRQF_TRIGGER_FALLING; + HDF_LOGE("%s: mode:%0x\n", __func__, mode); + ret = GpioSetIrq(gpio, mode, TestCaseGpioIrqHandler, NULL); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set irq fail! ret:%d\n", __func__, ret); + return ret; + } + + /* 使能此管脚中断 */ + ret = GpioEnableIrq(gpio); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: enable irq fail! ret:%d\n", __func__, ret); + (void)GpioUnSetIrq(gpio); + return ret; + } + + g_irqCnt = 0; /* 清除全局计数器 */ + timeout = 0; /* 等待时间清零 */ + /* 等待此管脚中断服务函数触发,等待超时时间为1000毫秒 */ + while (g_irqCnt <= 0 && timeout < 1000) { + (void)GpioRead(gpio, &valRead); + (void)GpioWrite(gpio, (valRead == GPIO_VAL_LOW) ? GPIO_VAL_HIGH : GPIO_VAL_LOW); + HDF_LOGE("%s: wait irq timeout:%u\n", __func__, timeout); + OsalMDelay(200); /* wait for irq trigger */ + timeout += 200; + } + (void)GpioUnSetIrq(gpio); + return (g_irqCnt > 0) ? HDF_SUCCESS : HDF_FAILURE; +} +``` + diff --git "a/zh-cn/device-dev/driver/I2C\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-i2c-des.md old mode 100755 new mode 100644 similarity index 42% rename from "zh-cn/device-dev/driver/I2C\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-i2c-des.md index 38341ca1d40f1c2572078f2f449e8a37065a9281..915c5f440eeb70bb1ebff2640306885b272c33e9 --- "a/zh-cn/device-dev/driver/I2C\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-i2c-des.md @@ -1,26 +1,89 @@ -# I2C使用指导 +# I2C -- [使用流程](#section333203315215) -- [打开I2C控制器](#section123631358135713) -- [进行I2C通信](#section11091522125812) -- [关闭I2C控制器](#section13519505589) +- [概述](#section5361140416) + - [接口说明](#section459052019177) -## 使用流程 +- [使用指导](#section1695201514281) + - [使用流程](#section1338373417288) + - [打开I2C控制器](#section13751110132914) + - [进行I2C通信](#section9202183372916) + - [关闭I2C控制器](#section19481164133018) -使用I2C设备的一般流程如[图1](#fig166181128151112)所示。 +- [使用实例](#section5302202015300) -**图 1** I2C设备使用流程图 +## 概述 +- I2C\(Inter Integrated Circuit\)总线是由Philips公司开发的一种简单、双向二线制同步串行总线。 +- I2C以主从方式工作,通常有一个主设备和一个或者多个从设备,主从设备通过SDA\(SerialData\)串行数据线以及SCL\(SerialClock\)串行时钟线两根线相连,如[图1 ](#fig1135561232714)所示。 -![](figures/zh-cn_image_0000001057902344.png) +- I2C数据的传输必须以一个起始信号作为开始条件,以一个结束信号作为传输的停止条件。数据传输以字节为单位,高位在前,逐个bit进行传输。 +- I2C总线上的每一个设备都可以作为主设备或者从设备,而且每一个设备都会对应一个唯一的地址,当主设备需要和某一个从设备通信时,通过广播的方式,将从设备地址写到总线上,如果某个从设备符合此地址,将会发出应答信号,建立传输。 -## 打开I2C控制器 +- I2C接口定义了完成I2C传输的通用方法集合,包括: + + - I2C控制器管理: 打开或关闭I2C控制器 + - I2C消息传输:通过消息传输结构体数组进行自定义传输 + + **图 1** I2C物理连线示意图 + ![](figure/I2C物理连线示意图.png "I2C物理连线示意图") + + +### 接口说明 + +**表 1** I2C驱动API接口功能介绍 + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

I2C控制器管理接口

+

I2cOpen

+

打开I2C控制器

+

I2cClose

+

关闭I2C控制器

+

I2c消息传输接口

+

I2cTransfer

+

自定义传输

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 + +使用I2C设备的一般流程如[图2](#fig166181128151112)所示。 + +**图 2** I2C设备使用流程图 + + +![](figure/zh-cn_image_0000001123509750.png) + +### 打开I2C控制器 在进行I2C通信前,首先要调用I2cOpen打开I2C控制器。 DevHandle I2cOpen\(int16\_t number\); -**表 1** I2cOpen参数和返回值描述 +**表 2** I2cOpen参数和返回值描述

参数

@@ -65,13 +128,13 @@ if (i2cHandle == NULL) { } ``` -## 进行I2C通信 +### 进行I2C通信 消息传输 int32\_t I2cTransfer\(DevHandle handle, struct I2cMsg \*msgs, int16\_t count\); -**表 2** I2cTransfer参数和返回值描述 +**表 3** I2cTransfer参数和返回值描述

参数

@@ -136,19 +199,19 @@ if (ret != 2) { } ``` ->![](public_sys-resources/icon-caution.gif) **注意:** +>![](../public_sys-resources/icon-caution.gif) **注意:** >- I2cMsg结构体中的设备地址不包含读写标志位,读写信息由flags成员变量的读写控制位传递。 >- 本函数不对消息结构体个数count做限制,其最大个数度由具体I2C控制器决定。 >- 本函数也不对每个消息结构体中的数据长度做限制,同样由具体I2C控制器决定。 >- 本函数可能会引起系统休眠,不允许在中断上下文调用 -## 关闭I2C控制器 +### 关闭I2C控制器 -I2C通信完成之后,需要关闭2C控制器,关闭函数如下所示: +I2C通信完成之后,需要关闭I2C控制器,关闭函数如下所示: void I2cClose\(DevHandle handle\); -**表 3** I2cClose参数和返回值描述 +**表 4** I2cClose参数和返回值描述

参数

@@ -169,3 +232,195 @@ void I2cClose\(DevHandle handle\); I2cClose(i2cHandle); /* 关闭I2C控制器 */ ``` +## 使用实例 + +本例程以操作开发板上的I2C设备为例,详细展示I2C接口的完整使用流程。 + +本例拟对Hi3516DV300某开发板上TouchPad设备进行简单的寄存器读写访问,基本硬件信息如下: + +- SOC:hi3516dv300。 + +- Touch IC:I2C地址为0x38, IC内部寄存器位宽为1字节。 + +- 原理图信息:TouchPad设备挂接在3号I2C控制器下;IC的复位管脚为3号GPIO。 + +本例程首先对Touch IC进行复位操作(开发板上电默认会给TouchIC供电,本例程不考虑供电),然后对其内部寄存器进行随机读写,测试I2C通路是否正常。 + +>![](../public_sys-resources/icon-note.gif) **说明:** +>本例程重点在于展示I2C设备访问流程,并验证I2C通路,所以对于设备寄存器读写值不做关注,读写寄存器导致的行为由设备自身决定。 + +示例如下: + +``` +#include "i2c_if.h" /* I2C标准接口头文件 */ +#include "gpio_if.h" /* GPIO标准接口头文件 */ +#include "hdf_log.h" /* 标准日志打印头文件 */ +#include "osal_io.h" /* 标准IO读写接口头文件 */ +#include "osal_time.h" /* 标准延迟&睡眠接口头文件 */ + +/* 定义一个表示TP设备的结构体,存储i2c及gpio相关硬件信息 */ +struct TpI2cDevice { + uint16_t rstGpio; /* 复位管脚 */ + uint16_t busId; /* I2C总线号 */ + uint16_t addr; /* I2C设备地址 */ + uint16_t regLen; /* 寄存器字节宽度 */ + DevHandle i2cHandle; /* I2C控制器句柄 */ +}; + +/* I2C管脚io配置,需要查阅SOC寄存器手册 */ +#define I2C3_DATA_REG_ADDR 0x112f008c /* 3号I2C控制器SDA管脚配置寄存器地址 */ +#define I2C3_CLK_REG_ADDR 0x112f0090 /* 3号I2C控制器SCL管脚配置寄存器地址 */ +#define I2C_REG_CFG 0x5f1 /* 3号I2C控制器SDA及SCL管脚配置值 */ + +static void TpSocIoCfg(void) +{ + /* 将3号I2C控制器对应两个管脚的IO功能设置为I2C */ + OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_DATA_REG_ADDR)); + OSAL_WRITEL(I2C_REG_CFG, IO_DEVICE_ADDR(I2C3_CLK_REG_ADDR)); +} + +/* 对TP的复位管脚进行初始化, 拉高维持20ms, 再拉底维持50ms,最后再拉高维持20ms, 完成复位动作 */ +static int32_t TestCaseGpioInit(struct TpI2cDevice *tpDevice) +{ + int32_t ret; + + /* 设置复位管脚方向为输出 */ + ret = GpioSetDir(tpDevice->rstGpio, GPIO_DIR_OUT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst dir fail!:%d", __func__, ret); + return ret; + } + + ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst hight fail!:%d", __func__, ret); + return ret; + } + OsalMSleep(20); + + ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_LOW); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst low fail!:%d", __func__, ret); + return ret; + } + OsalMSleep(50); + + ret = GpioWrite(tpDevice->rstGpio, GPIO_VAL_HIGH); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set rst high fail!:%d", __func__, ret); + return ret; + } + OsalMSleep(20); + + return HDF_SUCCESS; +} + +/* 基于I2cTransfer方法封装一个寄存器读写的辅助函数, 通过flag表示读或写 */ +static int TpI2cReadWrite(struct TpI2cDevice *tpDevice, unsigned int regAddr, + unsigned char *regData, unsigned int dataLen, uint8_t flag) +{ + int index = 0; + unsigned char regBuf[4] = {0}; + struct I2cMsg msgs[2] = {0}; + + /* 单双字节寄存器长度适配 */ + if (tpDevice->regLen == 1) { + regBuf[index++] = regAddr & 0xFF; + } else { + regBuf[index++] = (regAddr >> 8) & 0xFF; + regBuf[index++] = regAddr & 0xFF; + } + + /* 填充I2cMsg消息结构 */ + msgs[0].addr = tpDevice->addr; + msgs[0].flags = 0; /* 标记为0,表示写入 */ + msgs[0].len = tpDevice->regLen; + msgs[0].buf = regBuf; + + msgs[1].addr = tpDevice->addr; + msgs[1].flags = (flag == 1) ? I2C_FLAG_READ : 0; /* 添加读标记位,表示读取 */ + msgs[1].len = dataLen; + msgs[1].buf = regData; + + if (I2cTransfer(tpDevice->i2cHandle, msgs, 2) != 2) { + HDF_LOGE("%s: i2c read err", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +/* TP寄存器读函数 */ +static inline int TpI2cReadReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, + unsigned char *regData, unsigned int dataLen) +{ + return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 1); +} + +/* TP寄存器写函数 */ +static inline int TpI2cWriteReg(struct TpI2cDevice *tpDevice, unsigned int regAddr, + unsigned char *regData, unsigned int dataLen) +{ + return TpI2cReadWrite(tpDevice, regAddr, regData, dataLen, 0); +} + +/* I2C例程总入口 */ +static int32_t TestCaseI2c(void) +{ + int32_t i; + int32_t ret; + unsigned char bufWrite[7] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xA, 0xB, 0xC }; + unsigned char bufRead[7] = {0}; + static struct TpI2cDevice tpDevice; + + /* IO管脚功能配置 */ + TpSocIoCfg(); + + /* TP设备信息初始化 */ + tpDevice.rstGpio = 3; + tpDevice.busId = 3; + tpDevice.addr = 0x38; + tpDevice.regLen = 1; + tpDevice.i2cHandle = NULL; + + /* GPIO管脚初始化 */ + ret = TestCaseGpioInit(&tpDevice); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: gpio init fail!:%d", __func__, ret); + return ret; + } + + /* 打开I2C控制器 */ + tpDevice.i2cHandle = I2cOpen(tpDevice.busId); + if (tpDevice.i2cHandle == NULL) { + HDF_LOGE("%s: Open I2c:%u fail!", __func__, tpDevice.busId); + return -1; + } + + /* 向TP-IC的0xD5寄存器连续写7字节数据 */ + ret = TpI2cWriteReg(&tpDevice, 0xD5, bufWrite, 7); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: tp i2c write reg fail!:%d", __func__, ret); + I2cClose(tpDevice.i2cHandle); + return -1; + } + OsalMSleep(10); + + /* 从TP-IC的0xDO寄存器连续读7字节数据 */ + ret = TpI2cReadReg(&tpDevice, 0xD5, bufRead, 7); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: tp i2c read reg fail!:%d", __func__, ret); + I2cClose(tpDevice.i2cHandle); + return -1; + } + + HDF_LOGE("%s: tp i2c write&read reg success!", __func__); + for (i = 0; i < 7; i++) { + HDF_LOGE("%s: bufRead[%d] = 0x%x", __func__, i, bufRead[i]); + } + + /* 访问完毕关闭I2C控制器 */ + I2cClose(tpDevice.i2cHandle); + return ret; +} +``` + diff --git a/zh-cn/device-dev/driver/driver-platform-mipidsi-des.md b/zh-cn/device-dev/driver/driver-platform-mipidsi-des.md new file mode 100644 index 0000000000000000000000000000000000000000..c7cf01ca02d5c96f9c97447abf11a0d7bdb79ee7 --- /dev/null +++ b/zh-cn/device-dev/driver/driver-platform-mipidsi-des.md @@ -0,0 +1,554 @@ +# MIPI DSI + +- [概述](#section16806142183217) + - [接口说明](#section129611916132011) + +- [使用指导](#section037231715335) + - [使用流程](#section49299119344) + - [获取MIPI-DSI操作句柄](#section5126155683811) + - [MIPI-DSI相应配置](#section201164274344) + - [发送/回读控制指令](#section199401342173415) + - [释放MIPI-DSI操作句柄](#section161011610357) + +- [使用实例](#section17470126123520) + +## 概述 + +- DSI(Display Serial Interface)是由移动行业处理器接口联盟(Mobile Industry Processor Interface \(MIPI\) Alliance)制定的规范,旨在降低移动设备中显示控制器的成本。它以串行的方式发送像素数据或指令给外设\(通常是LCD或者类似的显示设备\),或从外设中读取状态信息或像素信息;它定义了主机、图像数据源和目标设备之间的串行总线和通信协议。 + +- MIPI-DSI具备高速模式和低速模式两种工作模式,全部数据通道都可以用于单向的高速传输,但只有第一个数据通道才可用于低速双向传输,从属端的状态信息、像素等是通过该数据通道返回。时钟通道专用于在高速传输数据的过程中传输同步时钟信号。 +- 图1显示了简化的DSI接口。从概念上看,符合DSI的接口与基于DBI-2和DPI-2标准的接口具有相同的功能。它向外围设备传输像素或命令数据,并且可以从外围设备读取状态或像素信息。主要区别在于,DSI对所有像素数据、命令和事件进行序列化,而在传统接口中,这些像素数据、命令和事件通常需要附加控制信号才能在并行数据总线上传输。 + + **图 1** DSI发送、接收接口 + ![](figure/DSI发送-接收接口.png "DSI发送-接收接口") + + +### 接口说明 + +**表 1** MIPI-DSI API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

设置/获取当前MIPI-DSI相关配置

+

MipiDsiSetCfg

+

设置MIPI-DSI相关配置

+

MipiDsiGetCfg

+

获取当前MIPI-DSI相关配置

+

获取/释放MIPI-DSI操作句柄

+

MipiDsiOpen

+

获取MIPI-DSI操作句柄

+

MipiDsiClose

+

释放MIPI-DSI操作句柄

+

设置MIPI-DSI进入Low power模式/High speed模式

+

MipiDsiSetLpMode

+

设置MIPI-DSI进入Low power模式

+

MipiDsiSetHsMode

+

设置MIPI-DSI进入High speed模式

+

MIPI-DSI发送/回读指令

+

MipiDsiTx

+

MIPI-DSI发送相应指令的接口

+

MipiDsiRx

+

MIPI-DSI按期望长度回读的接口

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,仅限内核态使用,不支持在用户态使用 + +## 使用指导 + +### 使用流程 + +使用MIPI-DSI的一般流程如[图2](#fig99821771782)所示。 + +**图 2** MIPI-DSI使用流程图 + + +![](figure/zh-cn_image_0000001123514210.png) + +### 获取MIPI-DSI操作句柄 + +在进行MIPI-DSI进行通信前,首先要调用MipiDsiOpen获取操作句柄,该函数会返回指定通道ID的操作句柄。 + +DevHandle MipiDsiOpen\(uint8\_t id\); + +**表 2** MipiDsiOpen的参数和返回值描述 + + + + + + + + + + + + + + + + + + + +

参数

+

参数描述

+

id

+

MIPI DSI通道ID

+

返回值

+

返回值描述

+

NULL

+

获取失败

+

设备句柄

+

获取到指令通道的操作句柄, 类型为DevHandle

+
+ +假设系统中的MIPI-DSI通道为0,获取该通道操作句柄的示例如下: + +``` +DevHandle mipiDsiHandle = NULL; /* 设备句柄 */ +chnId = 0; /* MIPI-DSI通道ID */ + +/* 获取操作句柄 */ +mipiDsiHandle = MipiDsiOpen(chnId); +if (mipiDsiHandle == NULL) { + HDF_LOGE("MipiDsiOpen: failed\n"); + return; +} +``` + +### MIPI-DSI相应配置 + +- 写入MIPI-DSI配置 + +int32\_t MipiDsiSetCfg\(DevHandle handle, struct MipiCfg \*cfg\); + +**表 3** MipiDsiSetCfg的参数和返回值描述 + + + + + + + + + + + + + + + + + + + + + + +

参数

+

参数描述

+

handle

+

操作句柄

+

cfg

+

MIPI-DSI相应配置buf 指针

+

返回值

+

返回值描述

+

0

+

设置成功

+

负数

+

设置失败

+
+ +``` +int32_t ret; +struct MipiCfg cfg = {0}; + +/* 当前对接的屏幕配置如下 */ +cfg.lane = DSI_4_LANES; +cfg.mode = DSI_CMD_MODE; +cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; +cfg.format = FORMAT_RGB_24_BIT; +cfg.pixelClk = 174; +cfg.phyDataRate = 384; +cfg.timingInfo.hsaPixels = 50; +cfg.timingInfo.hbpPixels = 55; +cfg.timingInfo.hlinePixels = 1200; +cfg.timingInfo.yResLines = 1800; +cfg.timingInfo.vbpLines = 33; +cfg.timingInfo.vsaLines = 76; +cfg.timingInfo.vfpLines = 120; +cfg.timingInfo.xResPixels = 1342; +/* 写入配置数据 */ +ret = MipiDsiSetCfg(g_handle, &cfg); +if (ret != 0) { + HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); + return -1; +} +``` + +- 获取当前MIPI-DSI的配置 + +int32\_t MipiDsiGetCfg\(DevHandle handle, struct MipiCfg \*cfg\); + +**表 4** MipiDsiGetCfg的参数和返回值描述 + + + + + + + + + + + + + + + + + + + + + + +

参数

+

参数描述

+

handle

+

操作句柄

+

cfg

+

MIPI-DSI相应配置buf 指针

+

返回值

+

返回值描述

+

0

+

获取成功

+

负数

+

获取失败

+
+ +``` +int32_t ret; +struct MipiCfg cfg; +memset(&cfg, 0, sizeof(struct MipiCfg)); +ret = MipiDsiGetCfg(g_handle, &cfg); +if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: GetMipiCfg fail!\n", __func__); + return HDF_FAILURE; +} +``` + +### 发送/回读控制指令 + +- 发送指令 + +int32\_t MipiDsiTx\(PalHandle handle, struct DsiCmdDesc \*cmd\); + +**表 5** MipiDsiTx的参数和返回值描述 + + + + + + + + + + + + + + + + + + + + + + +

参数

+

参数描述

+

handle

+

操作句柄

+

cmd

+

需要发送的指令数据指针

+

返回值

+

返回值描述

+

0

+

发送成功

+

负数

+

发送失败

+
+ +``` +int32_t ret; +struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); +if (cmd == NULL) { + return HDF_FAILURE; +} +cmd->dtype = DTYPE_DCS_WRITE; +cmd->dlen = 1; +cmd->payload = OsalMemCalloc(sizeof(uint8_t)); +if (cmd->payload == NULL) { + HdfFree(cmd); + return HDF_FAILURE; +} +*(cmd->payload) = DTYPE_GEN_LWRITE; +MipiDsiSetLpMode(mipiHandle); +ret = MipiDsiTx(mipiHandle, cmd); +MipiDsiSetHsMode(mipiHandle); +if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: PalMipiDsiTx fail! ret=%d\n", __func__, ret); + HdfFree(cmd->payload); + HdfFree(cmd); + return HDF_FAILURE; +} +HdfFree(cmd->payload); +HdfFree(cmd); +``` + +- 回读指令 + +int32\_t MipiDsiRx\(DevHandle handle, struct DsiCmdDesc \*cmd, uint32\_t readLen, uint8\_t \*out\); + +**表 6** MipiDsiRx的参数和返回值描述 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

参数

+

参数描述

+

handle

+

操作句柄

+

cmd

+

需要回读的指令数据指针

+

readLen

+

期望回读的数据长度

+

out

+

回读的数据buf指针

+

返回值

+

返回值描述

+

0

+

获取成功

+

负数

+

获取失败

+
+ +``` +int32_t ret; +uint8_t readVal = 0; + +struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); +if (cmdRead == NULL) { + return HDF_FAILURE; +} +cmdRead->dtype = DTYPE_DCS_READ; +cmdRead->dlen = 1; +cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); +if (cmdRead->payload == NULL) { + HdfFree(cmdRead); + return HDF_FAILURE; +} +*(cmdRead->payload) = DDIC_REG_STATUS; +MipiDsiSetLpMode(g_handle); +ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); +MipiDsiSetHsMode(g_handle); +if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); + HdfFree(cmdRead->payload); + HdfFree(cmdRead); + return HDF_FAILURE; +} +HdfFree(cmdRead->payload); +HdfFree(cmdRead); +``` + +### 释放MIPI-DSI操作句柄 + +MIPI-DSI使用完成之后,需要释放操作句柄,释放句柄的函数如下所示: + +void MipiDsiClose\(DevHandle handle\); + +该函数会释放掉由MipiDsiOpen申请的资源。 + +**表 7** MipiDsiClose的参数和返回值描述 + + + + + + + + + + +

参数

+

参数描述

+

handle

+

MIPI-DSI操作句柄

+
+ +``` +MipiDsiClose(mipiHandle); /* 释放掉MIPI-DSI操作句柄 */ +``` + +## 使用实例 + +MIPI-DSI完整的使用示例如下所示: + +``` +#include "hdf.h" +#include "mipi_dsi_if.h" + +void PalMipiDsiTestSample(void) +{ + uint8_t chnId; + int32_t ret; + DevHandle handle = NULL; + + /* 设备通道编号 */ + chnId = 0; + /* 获取操作句柄 */ + handle = MipiDsiOpen(chnId); + if (handle == NULL) { + HDF_LOGE("MipiDsiOpen: failed!\n"); + return; + } + /* 配置相应参数 */ + struct MipiCfg cfg = {0}; + cfg.lane = DSI_4_LANES; + cfg.mode = DSI_CMD_MODE; + cfg.burstMode = VIDEO_NON_BURST_MODE_SYNC_EVENTS; + cfg.format = FORMAT_RGB_24_BIT; + cfg.pixelClk = 174; + cfg.phyDataRate = 384; + cfg.timingInfo.hsaPixels = 50; + cfg.timingInfo.hbpPixels = 55; + cfg.timingInfo.hlinePixels = 1200; + cfg.timingInfo.yResLines = 1800; + cfg.timingInfo.vbpLines = 33; + cfg.timingInfo.vsaLines = 76; + cfg.timingInfo.vfpLines = 120; + cfg.timingInfo.xResPixels = 1342; + /* 写入配置数据 */ + ret = MipiDsiSetCfg(g_handle, &cfg); + if (ret != 0) { + HDF_LOGE("%s: SetMipiCfg fail! ret=%d\n", __func__, ret); + return; + } + /* 发送PANEL初始化指令 */ + struct DsiCmdDesc *cmd = OsalMemCalloc(sizeof(struct DsiCmdDesc)); + if (cmd == NULL) { + return; + } + cmd->dtype = DTYPE_DCS_WRITE; + cmd->dlen = 1; + cmd->payload = OsalMemCalloc(sizeof(uint8_t)); + if (cmd->payload == NULL) { + HdfFree(cmd); + return; + } + *(cmd->payload) = DTYPE_GEN_LWRITE; + MipiDsiSetLpMode(mipiHandle); + ret = MipiDsiTx(mipiHandle, cmd); + MipiDsiSetHsMode(mipiHandle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: MipiDsiTx fail! ret=%d\n", __func__, ret); + HdfFree(cmd->payload); + HdfFree(cmd); + return; + } + HdfFree(cmd->payload); + HdfFree(cmd); + /* 回读panel状态寄存器 */ + uint8_t readVal = 0; + struct DsiCmdDesc *cmdRead = OsalMemCalloc(sizeof(struct DsiCmdDesc)); + if (cmdRead == NULL) { + return; + } + cmdRead->dtype = DTYPE_DCS_READ; + cmdRead->dlen = 1; + cmdRead->payload = OsalMemCalloc(sizeof(uint8_t)); + if (cmdRead->payload == NULL) { + HdfFree(cmdRead); + return; + } + *(cmdRead->payload) = DDIC_REG_STATUS; + MipiDsiSetLpMode(g_handle); + ret = MipiDsiRx(g_handle, cmdRead, sizeof(readVal), &readVal); + MipiDsiSetHsMode(g_handle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: MipiDsiRx fail! ret=%d\n", __func__, ret); + HdfFree(cmdRead->payload); + HdfFree(cmdRead); + return; + } + HdfFree(cmdRead->payload); + HdfFree(cmdRead); + /* 释放MIPI DSI设备句柄 */ + MipiDsiClose(handle); +} +``` + diff --git "a/zh-cn/device-dev/driver/RTC\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-rtc-des.md old mode 100755 new mode 100644 similarity index 76% rename from "zh-cn/device-dev/driver/RTC\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-rtc-des.md index 45065165bd233fa2a09b4f8843b40c2325786823..fb55001feb78e4e003f25a829f51539e4893d310 --- "a/zh-cn/device-dev/driver/RTC\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-rtc-des.md @@ -1,12 +1,118 @@ -# RTC使用指导 +# RTC -- [使用流程](#section620515765714) -- [创建RTC设备句柄](#section0702183665711) -- [销毁RTC设备句柄](#section639962619542) -- [注册RTC定时报警回调函数](#section123631358135713) -- [操作RTC](#section11091522125812) +- [概述](#section104842041574) + - [接口说明](#section3373340142215) -## 使用流程 +- [使用指导](#section20636145604113) + - [使用流程](#section16919828134215) + - [创建RTC设备句柄](#section1131212144310) + - [销毁RTC设备句柄](#section10744117144314) + - [注册RTC定时报警回调函数](#section14839440184320) + - [操作RTC](#section161927578433) + +- [使用实例](#section1186111020456) + +## 概述 + +RTC\(real-time clock\)为操作系统中的实时时钟设备,为操作系统提供精准的实时时间和定时报警功能。当设备下电后,通过外置电池供电,RTC继续记录操作系统时间;设备上电后,RTC提供实时时钟给操作系统,确保断电后系统时间的连续性。 + +### 接口说明 + +**表 1** RTC设备API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

RTC句柄操作

+

RtcOpen

+

获取RTC设备驱动句柄

+

RtcClose

+

释放RTC设备驱动句柄

+

RTC时间操作接口

+

RtcReadTime

+

读RTC时间信息,包括年、月、星期、日、时、分、秒、毫秒

+

RtcWriteTime

+

写RTC时间信息,包括年、月、星期、日、时、分、秒、毫秒

+

RTC报警操作接口

+

RtcReadAlarm

+

读RTC报警时间信息

+

RtcWriteAlarm

+

写RTC报警时间信息

+

RtcRegisterAlarmCallback

+

注册报警超时回调函数

+

RtcAlarmInterruptEnable

+

使能/去使能RTC报警中断

+

RTC配置操作

+

RtcGetFreq

+

读RTC外接晶振频率

+

RtcSetFreq

+

配置RTC外接晶振频率

+

RtcReset

+

RTC复位

+

读写用户定义寄存器

+

RtcReadReg

+

读用户自定义寄存器

+

RtcWriteReg

+

写用户自定义寄存器

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 在操作系统启动过程中,驱动管理模块根据配置文件加载RTC驱动,RTC驱动会检测RTC器件并初始化驱动。 @@ -15,18 +121,18 @@ **图 1** RTC设备使用流程图 -![](figures/zh-cn_image_0000001054728498.png) +![](figure/zh-cn_image_0000001123675706.png) -## 创建RTC设备句柄 +### 创建RTC设备句柄 RTC驱动加载成功后,驱动开发者使用驱动框架提供的查询接口并调用RTC设备驱动接口。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >当前操作系统支持一个RTC设备。 DevHandle RtcOpen\(void\); -**表 1** RtcOpen参数和返回值描述 +**表 2** RtcOpen参数和返回值描述

参数

@@ -67,13 +173,13 @@ if (handle == NULL) { } ``` -## 销毁RTC设备句柄 +### 销毁RTC设备句柄 销毁RTC设备句柄,系统释放对应的资源。 void RtcClose\(DevHandle handle\); -**表 2** RtcClose参数描述 +**表 3** RtcClose参数描述

参数

@@ -94,13 +200,13 @@ void RtcClose\(DevHandle handle\); RtcClose(handle); ``` -## 注册RTC定时报警回调函数 +### 注册RTC定时报警回调函数 系统启动后需要注册RTC定时报警回调函数,报警超时后触发回调函数。 int32\_t RtcRegisterAlarmCallback\(DevHandle handle, enum RtcAlarmIndex alarmIndex, RtcAlarmCallback cb\); -**表 3** RtcRegisterAlarmCallback参数和返回值描述 +**表 4** RtcRegisterAlarmCallback参数和返回值描述

参数

@@ -165,7 +271,7 @@ if (ret != 0) { } ``` -## 操作RTC +### 操作RTC - 读取RTC时间。 @@ -173,7 +279,7 @@ if (ret != 0) { int32\_t RtcReadTime\(DevHandle handle, struct RtcTime \*time\); -**表 4** RtcReadTime参数和返回值描述 +**表 5** RtcReadTime参数和返回值描述

参数

@@ -226,7 +332,7 @@ if (ret != 0) { int32\_t RtcWriteTime\(DevHandle handle, struct RtcTime \*time\); -**表 5** RtcWriteTime参数和返回值描述 +**表 6** RtcWriteTime参数和返回值描述

参数

@@ -262,7 +368,7 @@ int32\_t RtcWriteTime\(DevHandle handle, struct RtcTime \*time\);
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >RTC起始时间为UTC 1970/01/01 Thursday 00:00:00,年的最大取值按照用户器件手册要求计算配置,星期不用配置。 ``` @@ -290,7 +396,7 @@ if (ret != 0) { int32\_t RtcReadAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct RtcTime \*time\); -**表 6** RtcReadAlarm参数和返回值描述 +**表 7** RtcReadAlarm参数和返回值描述

参数

@@ -348,7 +454,7 @@ if (ret != 0) { int32\_t RtcWriteAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct RtcTime \*time\); -**表 7** RtcWriteAlarm参数和返回值描述 +**表 8** RtcWriteAlarm参数和返回值描述

参数

@@ -389,7 +495,7 @@ int32\_t RtcWriteAlarm\(DevHandle handle, enum RtcAlarmIndex alarmIndex, struct
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >RTC起始时间为UTC 1970/01/01 Thursday 00:00:00,年的最大取值按照用户器件手册要求计算配置,星期不用配置。 ``` @@ -417,7 +523,7 @@ if (ret != 0) { int32\_t RtcAlarmInterruptEnable\(DevHandle handle, enum RtcAlarmIndex alarmIndex, uint8\_t enable\); -**表 8** RtcAlarmInterruptEnable参数和返回值描述 +**表 9** RtcAlarmInterruptEnable参数和返回值描述

参数

@@ -474,7 +580,7 @@ if (ret != 0) { int32\_t RtcGetFreq\(DevHandle handle, uint32\_t \*freq\); -**表 9** RtcGetFreq参数和返回值描述 +**表 10** RtcGetFreq参数和返回值描述

参数

@@ -527,7 +633,7 @@ if (ret != 0) { int32\_t RtcSetFreq\(DevHandle handle, uint32\_t freq\); -**表 10** RtcSetFreq参数和返回值描述 +**表 11** RtcSetFreq参数和返回值描述

参数

@@ -580,7 +686,7 @@ if (ret != 0) { int32\_t RtcReset\(DevHandle handle\); -**表 11** RtcReset参数和返回值描述 +**表 12** RtcReset参数和返回值描述

参数

@@ -627,7 +733,7 @@ if (ret != 0) { int32\_t RtcReadReg\(DevHandle handle, uint8\_t usrDefIndex, uint8\_t \*value\); -**表 12** RtcReadReg参数和返回值描述 +**表 13** RtcReadReg参数和返回值描述

参数

@@ -686,7 +792,7 @@ if (ret != 0) { int32\_t RtcWriteReg\(DevHandle handle, uint8\_t usrDefIndex, uint8\_t value\); -**表 13** RtcWriteReg参数和返回值描述 +**表 14** RtcWriteReg参数和返回值描述

参数

@@ -739,3 +845,100 @@ if (ret != 0) { } ``` +## 使用实例 + +本实例提供RTC接口的完整使用流程: + +1. 系统启动,驱动管理模块会识别系统当前的RTC器件; +2. 驱动管理模块完成RTC设备的初始化和设备创建; +3. 用户通过不同API,对该RTC设备进行对应的操作; +4. 关闭RTC设备,释放设备资源。 + +示例如下: + +``` +#include "rtc_if.h" +int32_t RtcAlarmACallback(enum RtcAlarmIndex alarmIndex) +{ + if (alarmIndex == RTC_ALARM_INDEX_A) { + /* 报警A的处理 */ + printf("RTC Alarm A callback function\n\r"); + } else if (alarmIndex == RTC_ALARM_INDEX_B) { + /* 报警B的处理 */ + printf("RTC Alarm B callback function\n\r"); + } else { + /* 错误处理 */ + } + return 0; +} + +void RtcTestSample(void) +{ + int32_t ret; + struct RtcTime tm; + struct RtcTime alarmTime; + uint32_t freq; + DevHandle handle = NULL; + + /* 获取RTC设备句柄 */ + handle = RtcOpen(); + if (handle == NULL) { + /* 错误处理 */ + } + /* 注册报警A的定时回调函数 */ + ret = RtcRegisterAlarmCallback(handle, RTC_ALARM_INDEX_A, RtcAlarmACallback); + if (ret != 0) { + /* 错误处理 */ + } + /* 设置RTC外接晶体振荡频率,注意按照器件手册要求配置RTC外频 */ + freq = 32768; /* 32768 Hz */ + ret = RtcSetFreq(handle, freq); + if (ret != 0) { + /* 错误处理 */ + } + /* 设置RTC报警中断使能 */ + ret = RtcAlarmInterruptEnable(handle, RTC_ALARM_INDEX_A, 1); + if (ret != 0) { + /* 错误处理 */ + } + /* 设置RTC时间为2020/01/01 00:00:10 .990 */ + tm.year = 2020; + tm.month = 01; + tm.day = 01; + tm.hour= 0; + tm.minute = 0; + tm.second = 10; + tm.millisecond = 990; + /* 写RTC时间信息 */ + ret = RtcWriteTime(handle, &tm); + if (ret != 0) { + /* 错误处理 */ + } + /* 设置RTC报警时间为2020/01/01 00:00:30 .100 */ + alarmTime.year = 2020; + alarmTime.month = 01; + alarmTime.day = 01; + alarmTime.hour = 0; + alarmTime.minute = 0; + alarmTime.second = 30; + alarmTime.millisecond = 100; + /* 设置RTC_ALARM_INDEX_A索引定时报警时间信息, 定时时间到后会打印"RTC Alarm A callback function" */ + ret = RtcWriteAlarm(handle, RTC_ALARM_INDEX_A, &alarmTime); + if (ret != 0) { + /* 错误处理 */ + } + + /* 读取RTC实时时间 */ + ret = RtcReadTime(handle, &tm); + if (ret != 0) { + /* 错误处理 */ + } + sleep(5) + printf("RTC read time:\n\r"); + printf("year-month-date-weekday hour:minute:second .millisecond %04u-%02u-%02u-%u %02u:%02u:%02u .%03u", + tm.year, tm.month, tm.day, tm.weekday, tm.hour, tm.minute, tm.second, tm.millisecond); + /* 销毁RTC设备句柄 */ + RtcClose(handle); +} +``` + diff --git "a/zh-cn/device-dev/driver/SDIO\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-sdio-des.md old mode 100755 new mode 100644 similarity index 66% rename from "zh-cn/device-dev/driver/SDIO\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-sdio-des.md index fd65e6de6adcef6ef307018c850ca1cb513d3b1f..1d85e6496ea6abc547afcdc1536b5068eb1acdbc --- "a/zh-cn/device-dev/driver/SDIO\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-sdio-des.md @@ -1,63 +1,215 @@ -# SDIO使用指导 +# SDIO -- [使用流程](#section1962415610383) -- [打开SDIO控制器](#section814751015461) -- [独占HOST](#section49274582455) -- [使能SDIO设备](#section1431520410489) -- [注册SDIO中断](#section3662781537) -- [进行SDIO通信](#section391941913484) -- [释放SDIO中断](#section56205204481) -- [去使能SDIO设备](#section181181621124815) -- [释放HOST](#section657117215486) -- [关闭SDIO控制器](#section1898172114818) +- [概述](#section1155271783811) + - [接口说明](#section08064247248) -## 使用流程 +- [使用指导](#section1878939192515) + - [使用流程](#section1490685512255) + - [打开SDIO控制器](#section10782428132616) + - [独占HOST](#section11263172312715) + - [使能SDIO设备](#section17861486271) + - [注册SDIO中断](#section521213262286) + - [进行SDIO通信](#section85661522153420) + - [释放SDIO中断](#section1683449352) + - [去使能SDIO设备](#section15379324143611) + - [释放HOST](#section536018263713) + - [关闭SDIO控制器](#section4752739183716) -使用SDIO的一般流程如[图1](SPI使用指导.md#fig23885455594)所示。 +- [使用实例](#section376910122382) -**图 1** SDIO使用流程图 +## 概述 +- SDIO是安全数字输入输出接口(Secure Digital Input and Output)的缩写,是从SD内存卡接口的基础上演化出来的一种外设接口。SDIO接口兼容以前的SD内存卡,并且可以连接支持SDIO接口的设备。 +- SDIO的应用比较广泛,目前,有许多手机都支持SDIO功能,并且很多SDIO外设也被开发出来,使得手机外接外设更加容易。常见的SDIO外设有WLAN、GPS、CAMERA、蓝牙等。 +- SDIO总线有两端,其中一端是主机端(HOST),另一端是设备端(DEVICE)。所有的通信都是由HOST端发出命令开始的,在DEVICE端只要能解析HOST的命令,就可以同HOST进行通信了。SDIO的HOST可以连接多个DEVICE,如下图所示: -![](figures/zh-cn_image_0000001054440624.png) + - CLK信号:HOST给DEVICE的时钟信号。 + - VDD信号:电源信号。 + - VSS信号:Ground信号。 + - D0-3信号:4条数据线,其中,DAT1信号线复用为中断线,在1BIT模式下DAT0用来传输数据,在4BIT模式下DAT0-DAT3用来传输数据。 + - CMD信号:用于HOST发送命令和DEVICE回复响应。 -## 打开SDIO控制器 + **图 1** SDIO的HOST-DEVICE连接示意图 + + + ![](figure/zh-cn_image_0000001054280608.png) + +- SDIO接口定义了操作SDIO的通用方法集合,包括打开/关闭SDIO控制器、独占/释放HOST、使能/去使能设备、申请/释放中断、读写、获取/设置公共信息等。 + +### 接口说明 + +**表 1** SDIO驱动API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

SDIO设备打开/关闭接口

+

SdioOpen

+

打开指定总线号的SDIO控制器

+

SdioClose

+

关闭SDIO控制器

+

SDIO读写接口

+

SdioReadBytes

+

从指定地址开始,增量读取指定长度的数据

+

SdioWriteBytes

+

从指定地址开始,增量写入指定长度的数据

+

SdioReadBytesFromFixedAddr

+

从固定地址读取指定长度的数据

+

SdioWriteBytesToFixedAddr

+

向固定地址写入指定长度的数据

+

SdioReadBytesFromFunc0

+

从SDIO function 0的指定地址空间读取指定长度的数据

+

SdioWriteBytesToFunc0

+

向SDIO function 0的指定地址空间写入指定长度的数据

+

SDIO设置块大小接口

+

SdioSetBlockSize

+

设置块的大小

+

SDIO获取/设置公共信息接口

+

SdioGetCommonInfo

+

获取公共信息

+

SdioSetCommonInfo

+

设置公共信息

+

SDIO刷新数据接口

+

SdioFlushData

+

刷新数据

+

SDIO独占/释放HOST接口

+

SdioClaimHost

+

独占Host

+

SdioReleaseHost

+

释放Host

+

SDIO使能/去使能功能设备接口

+

SdioEnableFunc

+

使能SDIO功能设备

+

SdioDisableFunc

+

去使能SDIO功能设备

+

SDIO申请/释放中断接口

+

SdioClaimIrq

+

申请中断

+

SdioReleaseIrq

+

释放中断

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,目前只支持在内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 + +使用SDIO的一般流程如[图2](#fig1343742311264)所示。 + +**图 2** SDIO使用流程图 + + +![](figure/zh-cn_image_0000001123540984.png) + +### 打开SDIO控制器 在使用SDIO进行通信前,首先要调用SdioOpen获取SDIO控制器的设备句柄,该函数会返回指定总线号的SDIO控制器的设备句柄。 DevHandle SdioOpen\(int16\_t mmcBusNum, struct SdioFunctionConfig \*config\); -**表 1** SdioOpen函数的参数和返回值描述 +**表 2** SdioOpen函数的参数和返回值描述 - -

参数

+ + - - - - - - - - - - - @@ -78,24 +230,24 @@ if (handle == NULL) { } ``` -## 独占HOST +### 独占HOST 获取到SDIO控制器的设备句柄之后,需要先独占HOST才能进行SDIO后续的一系列操作,独占HOST函数如下所示: void SdioClaimHost\(DevHandle handle\); -**表 2** SdioClaimHost函数的参数描述 +**表 3** SdioClaimHost函数的参数描述 - -

参数

参数描述

+

参数描述

mmcBusNum

+

mmcBusNum

总线号

+

总线号

config

+

config

SDIO功能配置信息

+

SDIO功能配置信息

返回值

+

返回值

返回值描述

+

返回值描述

NULL

+

NULL

获取SDIO控制器的设备句柄失败

+

获取SDIO控制器的设备句柄失败

设备句柄

+

设备句柄

SDIO控制器的设备句柄

+

SDIO控制器的设备句柄

参数

+ + - - - @@ -107,13 +259,13 @@ void SdioClaimHost\(DevHandle handle\); SdioClaimHost(handle); /* 独占HOST */ ``` -## 使能SDIO设备 +### 使能SDIO设备 在访问寄存器之前,需要先使能SDIO设备,使能SDIO设备的函数如下所示: int32\_t SdioEnableFunc\(DevHandle handle\); -**表 3** SdioEnableFunc函数的参数和返回值描述 +**表 4** SdioEnableFunc函数的参数和返回值描述

参数

参数描述

+

参数描述

handle

+

handle

SDIO控制器的设备句柄

+

SDIO控制器的设备句柄

参数

@@ -156,13 +308,13 @@ if (ret != 0) { } ``` -## 注册SDIO中断 +### 注册SDIO中断 在通信之前,还需要注册SDIO中断,注册SDIO中断函数如下图所示: int32\_t SdioClaimIrq\(DevHandle handle, SdioIrqHandler \*handler\); -**表 4** SdioClaimIrq函数的参数和返回值描述 +**表 5** SdioClaimIrq函数的参数和返回值描述

参数

@@ -220,7 +372,7 @@ if (ret != 0) { } ``` -## 进行SDIO通信 +### 进行SDIO通信 - 向SDIO设备增量写入指定长度的数据 @@ -228,7 +380,7 @@ if (ret != 0) { int32\_t SdioWriteBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**表 5** SdioWriteBytes函数的参数和返回值描述 +**表 6** SdioWriteBytes函数的参数和返回值描述

参数

@@ -294,7 +446,7 @@ if (ret != 0) { int32\_t SdioReadBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**表 6** SdioReadBytes函数的参数和返回值描述 +**表 7** SdioReadBytes函数的参数和返回值描述

参数

@@ -360,7 +512,7 @@ if (ret != 0) { int32\_t SdioWriteBytesToFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\); - **表 7** SdioWriteBytesToFixedAddr函数的参数和返回值描述 + **表 8** SdioWriteBytesToFixedAddr函数的参数和返回值描述

参数

@@ -431,7 +583,7 @@ if (ret != 0) { int32\_t SdioReadBytesFromFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\); - **表 8** SdioReadBytesFromFixedAddr函数的参数和返回值描述 + **表 9** SdioReadBytesFromFixedAddr函数的参数和返回值描述

参数

@@ -503,7 +655,7 @@ if (ret != 0) { int32\_t SdioWriteBytesToFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**表 9** SdioWriteBytesToFunc0函数的参数和返回值描述 +**表 10** SdioWriteBytesToFunc0函数的参数和返回值描述

参数

@@ -568,7 +720,7 @@ if (ret != 0) { int32\_t SdioReadBytesFromFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\); -**表 10** SdioReadBytesFromFunc0函数的参数和返回值描述 +**表 11** SdioReadBytesFromFunc0函数的参数和返回值描述

参数

@@ -627,13 +779,13 @@ if (ret != 0) { } ``` -## 释放SDIO中断 +### 释放SDIO中断 通信完成之后,需要释放SDIO中断,函数如下所示: int32\_t SdioReleaseIrq\(DevHandle handle\); -**表 11** SdioReleaseIrq函数的参数和返回值描述 +**表 12** SdioReleaseIrq函数的参数和返回值描述

参数

@@ -676,13 +828,13 @@ if (ret != 0) { } ``` -## 去使能SDIO设备 +### 去使能SDIO设备 通信完成之后,还需要去使能SDIO设备,函数如下所示: int32\_t SdioDisableFunc\(DevHandle handle\); -**表 12** SdioDisableFunc函数的参数和返回值描述 +**表 13** SdioDisableFunc函数的参数和返回值描述

参数

@@ -725,13 +877,13 @@ if (ret != 0) { } ``` -## 释放HOST +### 释放HOST 通信完成之后,还需要释放去HOST,函数如下所示: void SdioReleaseHost\(DevHandle handle\); -**表 13** SdioReleaseHost函数的参数描述 +**表 14** SdioReleaseHost函数的参数描述

参数

@@ -754,7 +906,7 @@ void SdioReleaseHost\(DevHandle handle\); SdioReleaseHost(handle); /* 释放HOST */ ``` -## 关闭SDIO控制器 +### 关闭SDIO控制器 SDIO通信完成之后,最后需要关闭SDIO控制器,函数如下所示: @@ -762,7 +914,7 @@ void SdioClose\(DevHandle handle\); 该函数会释放掉申请的资源。 -**表 14** SdioClose函数的参数描述 +**表 15** SdioClose函数的参数描述

参数

@@ -785,3 +937,132 @@ void SdioClose\(DevHandle handle\); SdioClose(handle); /* 关闭SDIO控制器 */ ``` +## 使用实例 + +SDIO设备完整的使用示例如下所示,首先打开总线号为1的SDIO控制器,然后独占HOST、使能设备、注册中断,接着进行SDIO通信(读写等),通信完成之后,释放中断、去使能设备、释放HOST,最后关闭SDIO控制器。 + +``` +#include "hdf_log.h" +#include "sdio_if.h" + +#define TEST_FUNC_NUM 1 /* 本测试用例中,使用编号为1的I/O function */ +#define TEST_FBR_BASE_ADDR 0x100 /* 编号为1的I/O function的FBR基地址 */ +#define TEST_ADDR_OFFSET 9 /* 本测试用例中,需要读写的寄存器的地址偏移 */ +#define TEST_DATA_LEN 3 /* 本测试用例中,读写数据的长度 */ +#define TEST_BLOCKSIZE 2 /* 本测试用例中,数据块的大小,单位字节 */ + +/* 中断服务函数,需要根据各自平台的情况去实现 */ +static void SdioIrqFunc(void *data) +{ + if (data == NULL) { + HDF_LOGE("SdioIrqFunc: data is NULL.\n"); + return; + } + /* 需要开发者自行添加具体的实现 */ +} + +void SdioTestSample(void) +{ + int32_t ret; + DevHandle handle = NULL; + uint8_t data[TEST_DATA_LEN] = {0}; + struct SdioFunctionConfig config = {1, 0x123, 0x456}; + uint8_t val; + uint32_t addr; + + /* 打开总线号为1的SDIO设备 */ + handle = SdioOpen(1, &config); + if (handle == NULL) { + HDF_LOGE("SdioOpen: failed!\n"); + return; + } + /* 独占HOST */ + SdioClaimHost(handle); + /* 使能SDIO设备 */ + ret = SdioEnableFunc(handle); + if (ret != 0) { + HDF_LOGE("SdioEnableFunc: failed, ret %d\n", ret); + goto ENABLE_ERR; + } + /* 注册中断 */ + ret = SdioClaimIrq(handle, SdioIrqFunc); + if (ret != 0) { + HDF_LOGE("SdioClaimIrq: failed, ret %d\n", ret); + goto CLAIM_IRQ_ERR; + } + /* 设置块大小为2字节 */ + ret = SdioSetBlockSize(handle, TEST_BLOCKSIZE); + if (ret != 0) { + HDF_LOGE("SdioSetBlockSize: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 从SDIO设备增量地址读取3字节的数据 */ + addr = TEST_FBR_BASE_ADDR * TEST_FUNC_NUM + TEST_ADDR_OFFSET; + ret = SdioReadBytes(handle, data, addr, TEST_DATA_LEN); + if (ret != 0) { + HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 向SDIO设备增量地址写入3字节的数据 */ + ret = SdioWriteBytes(handle, data, addr, TEST_DATA_LEN); + if (ret != 0) { + HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 从SDIO设备读取1字节的数据 */ + ret = SdioReadBytes(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 向SDIO设备写入1字节的数据 */ + ret = SdioWriteBytes(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 从SDIO设备固定地址读取3字节的数据 */ + ret = SdioReadBytesFromFixedAddr(handle, data, addr, TEST_DATA_LEN, 0); + if (ret != 0) { + HDF_LOGE("SdioReadBytesFromFixedAddr: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 向SDIO设备固定地址写入1字节的数据 */ + ret = SdioWriteBytesToFixedAddr(handle, data, addr, 1, 0); + if (ret != 0) { + HDF_LOGE("SdioWriteBytesToFixedAddr: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 从SDIO function 0读取1字节的数据 */ + addr = 0x02; + ret = SdioReadBytesFromFunc0(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioReadBytesFromFunc0: failed, ret %d\n", ret); + goto COMM_ERR; + } + /* 向SDIO function 0写入1字节的数据 */ + ret = SdioWriteBytesToFunc0(handle, &val, addr, 1); + if (ret != 0) { + HDF_LOGE("SdioWriteBytesToFunc0: failed, ret %d\n", ret); + goto COMM_ERR; + } +COMM_ERR: + /* 释放中断 */ + ret = SdioReleaseIrq(handle); + if (ret != 0) { + HDF_LOGE("SdioReleaseIrq: failed, ret %d\n", ret); + } +CLAIM_IRQ_ERR: + /* 去使能SDIO设备 */ + ret = SdioDisableFunc(handle); + if (ret != 0) { + HDF_LOGE("SdioDisableFunc: failed, ret %d\n", ret); + } +ENABLE_ERR: + /* 释放HOST */ + SdioReleaseHost(handle); + /* 关闭SDIO设备 */ + SdioClose(handle); +} +``` + diff --git "a/zh-cn/device-dev/driver/SPI\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-spi-des.md old mode 100755 new mode 100644 similarity index 64% rename from "zh-cn/device-dev/driver/SPI\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-spi-des.md index 58698a9460cefc157fd27f41bfb3978a1547fdfc..47581f9a40529bf796a1b544cb059d6e8032ff54 --- "a/zh-cn/device-dev/driver/SPI\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-spi-des.md @@ -1,28 +1,138 @@ -# SPI使用指导 +# SPI -- [使用流程](#section691514116412) -- [获取SPI设备句柄](#section12372204616215) -- [获取SPI设备属性](#section17121446171311) -- [配置SPI设备属性](#section97691946634) -- [进行SPI通信](#section197116254416) -- [销毁SPI设备句柄](#section117661819108) +- [概述](#section193356154511) + - [接口说明](#section232141411476) -## 使用流程 +- [使用指导](#section71363452477) + - [使用流程](#section32846814820) + - [获取SPI设备句柄](#section1927265711481) + - [获取SPI设备属性](#section541133418493) + - [配置SPI设备属性](#section7870106145010) + - [进行SPI通信](#section13324155195013) + - [销毁SPI设备句柄](#section19661632135117) -使用SPI的一般流程如[图1](#fig23885455594)所示。 +- [使用实例](#section06541058155120) -**图 1** SPI使用流程图 +## 概述 +- SPI是串行外设接口(Serial Peripheral Interface)的缩写,是一种高速的,全双工,同步的通信总线。 +- SPI是由Motorola公司开发,用于在主设备和从设备之间进行通信,常用于与闪存、实时时钟、传感器以及模数转换器等进行通信。 +- SPI以主从方式工作,通常有一个主设备和一个或者多个从设备。主设备和从设备之间一般用4根线相连,它们分别是: + - SCLK – 时钟信号,由主设备产生; + - MOSI – 主设备数据输出,从设备数据输入; + - MISO – 主设备数据输入,从设备数据输出; + - CS – 片选,从设备使能信号,由主设备控制。 -![](figures/zh-cn_image_0000001054726248.png) -## 获取SPI设备句柄 +- 一个主设备和两个从设备的连接示意图如[图1](#fig15227181812587)所示,Device A和Device B共享主设备的SCLK、MISO和MOSI三根引脚,Device A的片选CS0连接主设备的CS0,Device B的片选CS1连接主设备的CS1。 + +**图 1** SPI主从设备连接示意图。 + + +![](figure/zh-cn_image_0000001123742254.png) + +- SPI通信通常由主设备发起,通过以下步骤完成一次通信: + +1. 通过CS选中要通信的从设备,在任意时刻,一个主设备上最多只能有一个从设备被选中。 +2. 通过SCLK给选中的从设备提供时钟信号。 +3. 基于SCLK时钟信号,主设备数据通过MOSI发送给从设备,同时通过MISO接收从设备发送的数据,完成通信。 + +- 根据SCLK时钟信号的CPOL(Clock Polarity,时钟极性)和CPHA(Clock Phase,时钟相位)的不同组合,SPI有以下四种工作模式: + - CPOL=0,CPHA=0 时钟信号idle状态为低电平,第一个时钟边沿采样数据。 + - CPOL=0,CPHA=1 时钟信号idle状态为低电平,第二个时钟边沿采样数据。 + - CPOL=1,CPHA=0 时钟信号idle状态为高电平,第一个时钟边沿采样数据。 + - CPOL=1,CPHA=1 时钟信号idle状态为高电平,第二个时钟边沿采样数据。 + + +- SPI接口定义了操作SPI设备的通用方法集合,包括: + - SPI设备句柄获取和释放。 + - SPI读写: 从SPI设备读取或写入指定长度数据。 + - SPI自定义传输:通过消息传输结构体执行任意读写组合过程。 + - SPI设备配置:获取和设置SPI设备属性。 + + +>![](../public_sys-resources/icon-note.gif) **说明:** +>当前只支持主机模式,不支持从机模式。 + +### 接口说明 + +**表 1** SPI驱动API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

SPI设备句柄获取释放接口

+

SpiOpen

+

获取SPI设备句柄

+

SpiClose

+

释放SPI设备句柄

+

SPI读写接口

+

SpiRead

+

读取指定长度的数据

+

SpiWrite

+

写入指定长度的数据

+

SpiTransfer

+

SPI数据传输接口

+

SPI设备配置接口

+

+

SpiSetCfg

+

根据指定参数,配置SPI设备

+

SpiGetCfg

+

获取SPI设备配置参数

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 + +使用SPI的一般流程如[图2](#fig23885455594)所示。 + +**图 2** SPI使用流程图 + + +![](figure/zh-cn_image_0000001123703482.png) + +### 获取SPI设备句柄 在使用SPI进行通信时,首先要调用SpiOpen获取SPI设备句柄,该函数会返回指定总线号和片选号的SPI设备句柄。 DevHandle SpiOpen\(const struct SpiDevInfo \*info\); -**表 1** SpiOpen参数和返回值描述 +**表 2** SpiOpen参数和返回值描述

参数

@@ -69,13 +179,13 @@ if (spiHandle == NULL) { } ``` -## 获取SPI设备属性 +### 获取SPI设备属性 在获取到SPI设备句柄之后,需要配置SPI设备属性。配置SPI设备属性之前,可以先获取SPI设备属性,获取SPI设备属性的函数如下所示: int32\_t SpiGetCfg\(DevHandle handle, struct SpiCfg \*cfg\); -**表 2** SpiGetCfg参数和返回值描述 +**表 3** SpiGetCfg参数和返回值描述

参数

@@ -120,13 +230,13 @@ if (ret != 0) { } ``` -## 配置SPI设备属性 +### 配置SPI设备属性 在获取到SPI设备句柄之后,需要配置SPI设备属性,配置SPI设备属性的函数如下所示: int32\_t SpiSetCfg\(DevHandle handle, struct SpiCfg \*cfg\); -**表 3** SpiSetCfg参数和返回值描述 +**表 4** SpiSetCfg参数和返回值描述

参数

@@ -175,7 +285,7 @@ if (ret != 0) { } ``` -## 进行SPI通信 +### 进行SPI通信 - 向SPI设备写入指定长度的数据 @@ -183,7 +293,7 @@ if (ret != 0) { int32\_t SpiWrite\(DevHandle handle, uint8\_t \*buf, uint32\_t len\); -**表 4** SpiWrite参数和返回值描述 +**表 5** SpiWrite参数和返回值描述

参数

@@ -240,7 +350,7 @@ if (ret != 0) { int32\_t SpiRead\(DevHandle handle, uint8\_t \*buf, uint32\_t len\); -**表 5** SpiRead参数和返回值描述 +**表 6** SpiRead参数和返回值描述

参数

@@ -297,7 +407,7 @@ if (ret != 0) { int32\_t SpiTransfer\(DevHandle handle, struct SpiMsg \*msgs, uint32\_t count\); -**表 6** SpiTransfer参数和返回值描述 +**表 7** SpiTransfer参数和返回值描述

参数

@@ -356,7 +466,7 @@ if (ret != 0) { } ``` -## 销毁SPI设备句柄 +### 销毁SPI设备句柄 SPI通信完成之后,需要销毁SPI设备句柄,销毁SPI设备句柄的函数如下所示: @@ -364,7 +474,7 @@ void SpiClose\(DevHandle handle\); 该函数会释放掉申请的资源。 -**表 7** SpiClose参数描述 +**表 8** SpiClose参数描述 diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-devguide.md b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide.md new file mode 100644 index 0000000000000000000000000000000000000000..5de9fe721cbe94bd784c2b09bd70f3258a6af68e --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide.md @@ -0,0 +1,11 @@ +# 开发指导 + +为实现AI 引擎框架的接入,开发者需开发上述[图1](subsys-aiframework-guide.md#fig143186187187)中的SDK模块和Plugin模块,通过调用sdk提供的接口,基于AI引擎框架实现调用plugin中算法的能力,从而实现AI能力的生命周期管理和按需部署功能。 + +- **[SDK开发过程](subsys-aiframework-devguide-sdk.md)** + +- **[插件的开发过程](subsys-aiframework-devguide-plugin.md)** + +- **[配置文件的开发过程](subsys-aiframework-devguide-conf.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\346\220\255\345\273\272\347\216\257\345\242\203.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-envbuild.md old mode 100755 new mode 100644 similarity index 40% rename from "zh-cn/device-dev/subsystems/\346\220\255\345\273\272\347\216\257\345\242\203.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-envbuild.md index 47fefd53336be6b712b10a85c4ba32aec3e63d6f..50cd9a3f9c3e5bf420863c30218379a631400f26 --- "a/zh-cn/device-dev/subsystems/\346\220\255\345\273\272\347\216\257\345\242\203.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-envbuild.md @@ -1,5 +1,5 @@ # 搭建环境 1. 准备开发板:Hi3516DV300,Hi3518EV300 -2. [下载源码](https://device.harmonyos.com/cn/docs/start/get-code/oem_sourcecode_guide-0000001050769927#ZH-CN_TOPIC_0000001050769927__section1186691118430) +2. [下载源码](../get-code/sourcecode-acquire.md) diff --git "a/zh-cn/device-dev/subsystems/AI\345\274\225\346\223\216\346\241\206\346\236\266\345\274\200\345\217\221\346\214\207\345\215\227.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-guide.md old mode 100755 new mode 100644 similarity index 95% rename from "zh-cn/device-dev/subsystems/AI\345\274\225\346\223\216\346\241\206\346\236\266\345\274\200\345\217\221\346\214\207\345\215\227.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-guide.md index b0e0db564441d0635b30ef90c3369a163823e0f3..c725c6de1d82b1efa4670cedb9654b8f044d25f3 --- "a/zh-cn/device-dev/subsystems/AI\345\274\225\346\223\216\346\241\206\346\236\266\345\274\200\345\217\221\346\214\207\345\215\227.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-guide.md @@ -5,5 +5,5 @@ AI业务子系统是OpenHarmony提供原生的分布式AI能力的子系统。AI **图 1** AI引擎框架 -![](figures/zh-cn_image_0000001077727032.png) +![](figure/zh-cn_image_0000001077727032.png) diff --git "a/zh-cn/device-dev/subsystems/\344\273\243\347\240\201\347\256\241\347\220\206\350\247\204\350\214\203.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-codemanage.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/subsystems/\344\273\243\347\240\201\347\256\241\347\220\206\350\247\204\350\214\203.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-tech-codemanage.md index 25dde0bbc86164b4d7a0e2bec0e5b06b87d175dd..f93fcf62bb5cb58aa6873e0191ac86627acd5532 --- "a/zh-cn/device-dev/subsystems/\344\273\243\347\240\201\347\256\241\347\220\206\350\247\204\350\214\203.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-codemanage.md @@ -11,7 +11,7 @@ AI引擎框架各模块之间的代码依赖关系如下[图1](#fig171811112818) **图 1** ****AI引擎代码依赖关系 -![](figures/插件依赖-(2).jpg) +![](figure/插件依赖-(2).jpg) ## 建议:插件与北向SDK在AI引擎指定的路径下进行代码开发 diff --git "a/zh-cn/device-dev/subsystems/\346\216\245\345\217\243\345\274\200\345\217\221\350\247\204\350\214\203.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\346\216\245\345\217\243\345\274\200\345\217\221\350\247\204\350\214\203.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md diff --git "a/zh-cn/device-dev/subsystems/\345\221\275\345\220\215\350\247\204\350\214\203.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\221\275\345\220\215\350\247\204\350\214\203.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md diff --git "a/zh-cn/device-dev/subsystems/\346\212\200\346\234\257\350\247\204\350\214\203.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-tech.md old mode 100755 new mode 100644 similarity index 45% rename from "zh-cn/device-dev/subsystems/\346\212\200\346\234\257\350\247\204\350\214\203.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-tech.md index e2497a9e3850d12fc57e61924b8f6b0b2451d7d9..486878e0b4123418899c58c037ed24b3227e4ad6 --- "a/zh-cn/device-dev/subsystems/\346\212\200\346\234\257\350\247\204\350\214\203.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-tech.md @@ -6,10 +6,10 @@ **建议:**需要加以考虑的约定 -- **[代码管理规范](代码管理规范.md)** +- **[代码管理规范](subsys-aiframework-tech-codemanage.md)** -- **[命名规范](命名规范.md)** +- **[命名规范](subsys-aiframework-tech-name.md)** -- **[接口开发规范](接口开发规范.md)** +- **[接口开发规范](subsys-aiframework-tech-interface.md)** diff --git "a/zh-cn/device-dev/subsystems/AI\346\241\206\346\236\266.md" b/zh-cn/device-dev/subsystems/subsys-aiframework.md old mode 100755 new mode 100644 similarity index 32% rename from "zh-cn/device-dev/subsystems/AI\346\241\206\346\236\266.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework.md index c4310aa764280d27ea890292596524653beb731e..77fa018ec4592e10ced77cbec30a0a7a9f003481 --- "a/zh-cn/device-dev/subsystems/AI\346\241\206\346\236\266.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework.md @@ -1,13 +1,13 @@ # AI框架 -- **[AI引擎框架开发指南](AI引擎框架开发指南.md)** +- **[AI引擎框架开发指南](subsys-aiframework-guide.md)** -- **[搭建环境](搭建环境.md)** +- **[搭建环境](subsys-aiframework-envbuild.md)** -- **[技术规范](技术规范.md)** +- **[技术规范](subsys-aiframework-tech.md)** -- **[开发指导](开发指导.md)** +- **[开发指导](subsys-aiframework-devguide.md)** -- **[开发示例](开发示例.md)** +- **[开发示例](subsys-aiframework-demo.md)** diff --git "a/zh-cn/device-dev/subsystems/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" b/zh-cn/device-dev/subsystems/subsys-application-framework-builden.md old mode 100755 new mode 100644 similarity index 83% rename from "zh-cn/device-dev/subsystems/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" rename to zh-cn/device-dev/subsystems/subsys-application-framework-builden.md index 272f0279421d4978f9630781b67300a5888ef970..182aea265b994e46add0b4ab22ad8bab8bbf8153 --- "a/zh-cn/device-dev/subsystems/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" +++ b/zh-cn/device-dev/subsystems/subsys-application-framework-builden.md @@ -2,6 +2,6 @@ - 开发板:Hi3516DV300 -- [下载源码](../get-code/源码获取.md) +- [下载源码](../get-code/sourcecode-acquire.md) - [编译用户程序框架](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E7%94%A8%E6%88%B7%E7%A8%8B%E5%BA%8F%E6%A1%86%E6%9E%B6%E5%AD%90%E7%B3%BB%E7%BB%9F.md) diff --git "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\345\256\236\344\276\213.md" b/zh-cn/device-dev/subsystems/subsys-application-framework-demo.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\274\200\345\217\221\345\256\236\344\276\213.md" rename to zh-cn/device-dev/subsystems/subsys-application-framework-demo.md diff --git "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\346\214\207\345\257\274-3.md" b/zh-cn/device-dev/subsystems/subsys-application-framework-guide.md similarity index 99% rename from "zh-cn/device-dev/subsystems/\345\274\200\345\217\221\346\214\207\345\257\274-3.md" rename to zh-cn/device-dev/subsystems/subsys-application-framework-guide.md index 6a68dfe23f9f81c975fab1807c63bc9fbe6a15f4..b132c23b9381bc71ac04a83359bad84395061fc8 100644 --- "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\346\214\207\345\257\274-3.md" +++ b/zh-cn/device-dev/subsystems/subsys-application-framework-guide.md @@ -693,15 +693,15 @@ - 打包示例 - 开发视图 - ![](figures/zh-cn_image_0000001062942690.png) + ![](figure/zh-cn_image_0000001062942690.png) - 编译视图 - ![](figures/zh-cn_image_0000001062334618.png) + ![](figure/zh-cn_image_0000001062334618.png) - 使用打包工具执行以下命令打包: - ![](figures/zh-cn_image_0000001062476933.png) + ![](figure/zh-cn_image_0000001062476933.png) ``` $ java -jar hmos_app_packing_tool.jar --mode hap --json-path ./config.json --assets-path ./assets/ --ability-so-path ./libentry.so --index-path ./resources.index --out-path out/entry.hap --force true diff --git "a/zh-cn/device-dev/subsystems/\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-application-framework-overview.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/subsystems/\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-application-framework-overview.md index 63ee16f94ce7de540c47dae8ab52a5aef504889b..a0ab8c2d1bbeb2118c32fee4eda946747445c5eb --- "a/zh-cn/device-dev/subsystems/\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/subsystems/subsys-application-framework-overview.md @@ -17,7 +17,7 @@ Ability子系统是管理OpenHarmony应用运行状态的开发框架。 **图 1** Ability子系统框架图 -![](figures/Ability子系统框架图.png "Ability子系统框架图") +![](figure/Ability子系统框架图.png "Ability子系统框架图") - **Ability**:系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。Ability分为两种类型:Page类型的Ability和Service类型的Ability。 - **Page类型的Ability**:带有界面,为用户提供人机交互的能力。 @@ -29,14 +29,14 @@ Ability子系统是管理OpenHarmony应用运行状态的开发框架。 - **AbilitySlice**:单个页面及其控制逻辑的总和,是Page类型Ability特有的组件,一个Page类型的Ability可以包含多个AbilitySlice,此时,这些页面提供的业务能力应当是高度相关的。 **图 2** Ability与AbilitySlice的关系图 - ![](figures/Ability与AbilitySlice的关系图.png "Ability与AbilitySlice的关系图") + ![](figure/Ability与AbilitySlice的关系图.png "Ability与AbilitySlice的关系图") - **生命周期**:Ability被调度到启动、激活、隐藏和退出等各个状态的统称。 **图 3** Ability生命周期流转 - ![](figures/图片1.png) + ![](figure/图片1.png) - **OnStart\(\)** @@ -73,7 +73,7 @@ Ability子系统是管理OpenHarmony应用运行状态的开发框架。 - **AbilityKit**:Ability框架提供给开发者的开发包,开发者基于该开发包可以开发出基于Ability组件的应用。基于Ability组件开发的应用有两种类型:基于Javascript语言开发的Ability(JS Ability)和基于C/C++语言开发的Ability(Native Ability)。JS应用开发框架是开发者开发JS Ability所用到框架,是在AbilityKit基础封装的包含js UI组件的一套方便开发者能够迅速开发Ability应用的框架。 - **AbilityLoader**:负责注册和加载开发者Ability的模块。开发者开发的Ability先要调用AbilityLoader的注册接口注册到框架中,接着Ability启动时会被实例化。 -- **AbilityManager**:负责AbilityKit和Ability管理服务进行IPC的通信。 +- **AbilityManager:**负责AbilityKit和Ability管理服务进行IPC的通信。 - **EventHandler**:AbilityKit提供给开发者的用于在Ability中实现线程间通信的一个模块。 @@ -87,7 +87,7 @@ Ability子系统是管理OpenHarmony应用运行状态的开发框架。 包管理子系统是OpenHarmony为开发者提供的安装包管理框架。 **图 4** 包管理子系统框架图 -![](figures/包管理子系统框架图.png "包管理子系统框架图") +![](figure/包管理子系统框架图.png "包管理子系统框架图") - **BundleKit**:是包管理服务对外提供的接口,有安装/卸载接口、包信息查询接口、包状态变化listen接口。 - **包扫描器**:用来解析本地预制或者安装的安装包,提取里面的各种信息,供管理子模块进行管理,持久化。 @@ -103,12 +103,12 @@ Ability子系统是管理OpenHarmony应用运行状态的开发框架。 Ability子系统的核心模块是Ability管理服务、包管理子系统的核心模块是包管理服务,这两个服务是系统级服务,借助系统服务框架Samgr实现服务的注册与发现,并对其他进程提供Ability管理服务和包管理服务。Ability管理服务和包管理服务通过AbilityKit和BundleKit以接口的形式向外提供服务。 **图 5** Ability管理服务和包管理服务启动 -![](figures/Ability管理服务和包管理服务启动.png "Ability管理服务和包管理服务启动") +![](figure/Ability管理服务和包管理服务启动.png "Ability管理服务和包管理服务启动") Ability管理服务和包管理服务启动后,就可以安装OpenHarmony应用和启动运行OpenHarmony应用。 **图 6** 应用启动流程 -![](figures/应用启动流程.png "应用启动流程") +![](figure/应用启动流程.png "应用启动流程") 桌面为Ability管理服务启动的第一个OpenHarmony应用。桌面启动后,用户可以在桌面上点击安装的OpenHarmony应用并启动该应用。上图6为从桌面启动一个已安装应用的交互流程。 diff --git a/zh-cn/device-dev/subsystems/subsys-application-framework.md b/zh-cn/device-dev/subsystems/subsys-application-framework.md new file mode 100644 index 0000000000000000000000000000000000000000..99997047ffcf4648b1b4e7fe5eb8ce2db5c6d66c --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-application-framework.md @@ -0,0 +1,11 @@ +# 用户程序框架 + +- **[概述](subsys-application-framework-overview.md)** + +- **[搭建环境](subsys-application-framework-builden.md)** + +- **[开发指导](subsys-application-framework-guide.md)** + +- **[开发实例](subsys-application-framework-demo.md)** + + diff --git "a/zh-cn/device-dev/subsystems/appspawn\345\272\224\347\224\250\345\255\265\345\214\226\347\273\204\344\273\266.md" b/zh-cn/device-dev/subsystems/subsys-boot-appspawn.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/appspawn\345\272\224\347\224\250\345\255\265\345\214\226\347\273\204\344\273\266.md" rename to zh-cn/device-dev/subsystems/subsys-boot-appspawn.md diff --git "a/zh-cn/device-dev/subsystems/bootstrap\346\234\215\345\212\241\345\220\257\345\212\250\347\273\204\344\273\266.md" b/zh-cn/device-dev/subsystems/subsys-boot-bootstrap.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/bootstrap\346\234\215\345\212\241\345\220\257\345\212\250\347\273\204\344\273\266.md" rename to zh-cn/device-dev/subsystems/subsys-boot-bootstrap.md diff --git "a/zh-cn/device-dev/subsystems/\345\270\270\350\247\201\351\227\256\351\242\230.md" b/zh-cn/device-dev/subsystems/subsys-boot-faqs.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/subsystems/\345\270\270\350\247\201\351\227\256\351\242\230.md" rename to zh-cn/device-dev/subsystems/subsys-boot-faqs.md index c81824514aa2b6660e73433a089e82faca04fa13..196a586630627ef713e6acedf249952fbe63ae5d --- "a/zh-cn/device-dev/subsystems/\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ b/zh-cn/device-dev/subsystems/subsys-boot-faqs.md @@ -10,7 +10,7 @@ 系统启动过程中,打印“\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format.”错误,启动过程停止,如下图所示: -![](figures/zh-cn_image_0000001063839940.png) +![](figure/zh-cn_image_0000001063839940.png) **可能原因** @@ -28,7 +28,7 @@ **可能原因** -被init启动的服务都有一个叫做“importance”的属性(详见[第2章表3](init启动引导组件.md#table14737791471)描述)。 +被init启动的服务都有一个叫做“importance”的属性(详见[第2章表3](subsys-boot-init.md#table14737791471)描述)。 - 当该属性为0时,表示若当前服务进程退出,init不需要重启单板。 - 当该属性为1时,表示若当前服务进程退出,init需要重启单板。 diff --git "a/zh-cn/device-dev/subsystems/init\345\220\257\345\212\250\345\274\225\345\257\274\347\273\204\344\273\266.md" b/zh-cn/device-dev/subsystems/subsys-boot-init.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/init\345\220\257\345\212\250\345\274\225\345\257\274\347\273\204\344\273\266.md" rename to zh-cn/device-dev/subsystems/subsys-boot-init.md diff --git "a/zh-cn/device-dev/subsystems/\345\220\257\345\212\250\346\201\242\345\244\215\345\255\220\347\263\273\347\273\237\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-boot-overview.md old mode 100755 new mode 100644 similarity index 95% rename from "zh-cn/device-dev/subsystems/\345\220\257\345\212\250\346\201\242\345\244\215\345\255\220\347\263\273\347\273\237\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-boot-overview.md index 1287b4212dbaf8470686796086bdcd06c0faa20b..ee24488c41a99af1472600ecfabe775a0e18e4c3 --- "a/zh-cn/device-dev/subsystems/\345\220\257\345\212\250\346\201\242\345\244\215\345\255\220\347\263\273\347\273\237\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/subsystems/subsys-boot-overview.md @@ -6,7 +6,7 @@ - init启动引导组件 - init启动引导组件对应的进程为init进程,是内核完成初始化后启动的第一个用户态进程。init进程启动之后,读取init.cfg配置文件,根据解析结果,执行相应命令(见[第2章表2](init启动引导组件.md#table122681439144112)描述)并依次启动各关键系统服务进程,在启动系统服务进程的同时设置其对应权限。 + init启动引导组件对应的进程为init进程,是内核完成初始化后启动的第一个用户态进程。init进程启动之后,读取init.cfg配置文件,根据解析结果,执行相应命令(见[第2章表2](subsys-boot-init.md#table122681439144112)描述)并依次启动各关键系统服务进程,在启动系统服务进程的同时设置其对应权限。 - appspawn应用孵化组件 diff --git "a/zh-cn/device-dev/subsystems/\345\217\202\350\200\203.md" b/zh-cn/device-dev/subsystems/subsys-boot-ref.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\217\202\350\200\203.md" rename to zh-cn/device-dev/subsystems/subsys-boot-ref.md diff --git "a/zh-cn/device-dev/subsystems/syspara\347\263\273\347\273\237\345\261\236\346\200\247\347\273\204\344\273\266.md" b/zh-cn/device-dev/subsystems/subsys-boot-syspara.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/syspara\347\263\273\347\273\237\345\261\236\346\200\247\347\273\204\344\273\266.md" rename to zh-cn/device-dev/subsystems/subsys-boot-syspara.md diff --git a/zh-cn/device-dev/subsystems/subsys-boot.md b/zh-cn/device-dev/subsystems/subsys-boot.md new file mode 100644 index 0000000000000000000000000000000000000000..a71c6ab86284f1d1dca602c5e7fffd2aae961f7f --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-boot.md @@ -0,0 +1,17 @@ +# 启动恢复 + +- **[启动恢复子系统概述](subsys-boot-overview.md)** + +- **[init启动引导组件](subsys-boot-init.md)** + +- **[appspawn应用孵化组件](subsys-boot-appspawn.md)** + +- **[bootstrap服务启动组件](subsys-boot-bootstrap.md)** + +- **[syspara系统属性组件](subsys-boot-syspara.md)** + +- **[常见问题](subsys-boot-faqs.md)** + +- **[参考](subsys-boot-ref.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-build-mini-lite.md old mode 100755 new mode 100644 similarity index 39% rename from "zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-build-mini-lite.md index 83423cbe1c9b0d7f4bfd6bae3124b490c43cd6c8..dc07da91d5c8c7967965ba91ae1ed276279eb8f7 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/subsystems/subsys-build-mini-lite.md @@ -1,9 +1,32 @@ -# 编译构建概述 +# 轻量和小型系统编译构建指导 -- [基本概念](#section175012297491) -- [目录结构](#section3267040205617) -- [构建流程](#section193961322175011) -- [组件、芯片解决方案和产品解决方案配置规则](#section1625463413327) +- [概述](#section10958256161119) + - [基本概念](#section1732301411128) + - [目录结构](#section1588744014121) + - [构建流程](#section15761735134) + +- [配置规则](#section2345183962710) + - [组件](#section142532518308) + - [芯片解决方案](#section121501451143710) + - [产品解决方案](#section134549283435) + +- [使用指导](#section13754457192211) + - [前提条件](#section31651120233) + - [hb工具使用说明](#section1133304172313) + - [新增组件](#section167110415315) + - [新增芯片解决方案](#section1474718565412) + - [新增产品解决方案](#section1097623294220) + +- [常见问题](#section19909721104319) + - [ninja版本问题导致编译失败](#section138233464318) + - [ncurses库缺失导致编译失败](#section151033911442) + - [未安装mcopy导致编译失败](#section19811838104418) + - [权限问题导致编译失败](#section03111118451) + - [未安装Crypto导致编译失败](#section69981127125013) + - [编译环境为shell导致编译失败](#section967617530505) + + +## 概述 一个基于gn和ninja的构建系统,以支持OpenHarmony组件化开发为目标,提供以下基本功能: @@ -12,7 +35,7 @@ - 独立构建芯片解决方案厂商源码。 - 独立构建单个组件。 -## 基本概念 +### 基本概念 在使用编译构建子系统前,应了解如下基本概念: @@ -38,7 +61,7 @@ OpenHarmony的命令行工具,用来执行编译命令。 -## 目录结构 +### 目录结构 ``` build/lite @@ -55,12 +78,12 @@ build/lite └── toolchain # 编译工具链配置,包括:编译器路径、编译选项、链接选项等 ``` -## 构建流程 +### 构建流程 编译构建流程如[图1 ](#fig9744112715161)所示,主要分设置和编译两步: **图 1** 编译构建流程 -![](figures/编译构建流程.jpg "编译构建流程") +![](figure/编译构建流程.jpg "编译构建流程") 1. hb set: 设置OpenHarmony源码目录和要编译的产品。 2. hb build: 编译产品、开发板或者组件。编译主要过程如下: @@ -70,13 +93,16 @@ build/lite - 系统镜像打包:将组件编译产物打包,设置文件属性和权限,制作文件系统镜像。 -## 组件、芯片解决方案和产品解决方案配置规则 +## 配置规则 为了实现芯片解决方案、产品解决方案与OpenHarmony是解耦的、可插拔的,组件、芯片解决方案和产品解决方案的路径、目录树和配置需遵循一定的规则,具体如下: -- **组件** +### **组件** + +组件源码路径命名规则为:**\{领域\}/\{子系统\}/\{组件\}**,组件目录树规则如下: -组件源码路径命名规则为:_\{领域\}/\{子系统\}/\{组件\}_,组件目录树规则如下: +>![](../public_sys-resources/icon-caution.gif) **注意:** +>组件的名称、源码路径、功能简介、是否必选、编译目标、RAM、ROM、编译输出、已适配的内核、可配置的特性和依赖等属性定义在build/lite/components目录下对应子系统的json文件中,新增组件时需要在对应子系统json文件中添加相应的组件定义。产品所配置的组件必须在某个子系统中被定义过,否则会校验失败。 ``` component @@ -88,8 +114,6 @@ component └── BUILD.gn # 组件编译脚本 ``` -组件的名称、源码路径、功能简介、是否必选、编译目标、RAM、ROM、编译输出、已适配的内核、可配置的特性和依赖等属性定义在build/lite/components目录下对应子系统的json文件中,新增组件时需要在对应子系统json文件中添加相应的组件定义。产品所配置的组件必须在某个子系统中被定义过,否则会校验失败。 - 以泛sensor子系统的sensor服务组件为例,组件属性定义描述文件字段说明如下: ``` @@ -125,13 +149,15 @@ component } ``` -组件的编译脚本语言为gn,gn的基本用法请见[gn快速入门](https://gn.googlesource.com/gn/+/master/docs/quick_start.md)。组件即为gn定义的编译目标,可以为静态库、动态库、可执行文件或group。组件BUILD.gn的编写建议如下: +组件BUILD.gn的编写建议如下: -1)编译目标名称与组件一致。 +- 编译目标名称与组件一致。 +- 组件对外可配置的特性变量需声明在该组件BUILD.gn中,特性变量命名规则:ohos\_\{subsystem\}\_\{component\}\_\{feature\}。特性在组件描述中也需要同步定义,在产品配置文件config.json中按需配置。 +- 宏定义规则:OHOS\_\{SUBSYSTEM\}\_\{COMPONENT\}\_\{FEATURE\} -2)组件对外可配置的特性变量需声明在该组件BUILD.gn中,特性变量命名规则:ohos\_\{subsystem\}\_\{component\}\_\{feature\}。特性在组件描述中也需要同步定义,在产品配置文件config.json中按需配置。 + >![](../public_sys-resources/icon-note.gif) **说明:** + >组件的编译脚本语言为gn,gn的基本用法请见[gn快速入门](https://gn.googlesource.com/gn/+/master/docs/quick_start.md)。组件即为gn定义的编译目标,可以为静态库、动态库、可执行文件或group。 -3)宏定义规则:OHOS\_\{SUBSYSTEM\}\_\{COMPONENT\}\_\{FEATURE\} 以图形的UI组件为例,foundation/graphic/ui/BUILD.gn文件如下: @@ -180,9 +206,13 @@ component } ``` -- **芯片解决方案** +### **芯片解决方案** -芯片解决方案是指基于某款开发板的完整解决方案,包含驱动、设备侧接口适配、开发板sdk等。芯片解决方案是一个特殊的组件,源码路径规则为:_device/\{芯片解决方案厂商\}/\{开发板\}_。芯片解决方案组件会随产品选择的开发板默认编译。芯片解决方案目录树规则如下: +- 芯片解决方案是指基于某款开发板的完整解决方案,包含驱动、设备侧接口适配、开发板sdk等。 +- 芯片解决方案是一个特殊的组件,源码路径规则为:**device/\{芯片解决方案厂商\}/\{开发板\}**。 +- 芯片解决方案组件会随产品选择的开发板默认编译。 + +芯片解决方案目录树规则如下: ``` device @@ -196,7 +226,10 @@ device └── config.gni # liteos_a版本编译配置 ``` -config.gni为开发板编译相关的配置。编译时会采用该配置文件中的参数选择编译相应的OS组件,编译阶段系统全局可见。关键字段介绍如下: +>![](../public_sys-resources/icon-note.gif) **说明:** +>config.gni为开发板编译相关的配置,编译时会采用该配置文件中的参数编译所有OS组件,编译阶段系统全局可见。 + +config.gni的关键字段介绍如下: ``` kernel_type: 开发板使用的内核类型,例如:“liteos_a”, “liteos_m”, “linux”。 @@ -211,9 +244,11 @@ board_cxx_flags: 开发板配置的cpp文件编译选项。 board_ld_flags: 开发板配置的链接选项。 ``` -- **产品解决方案** +### **产品解决方案** -产品解决方案为基于开发板的完整产品,主要包含产品对OS的适配、组件拼装配置、启动配置和文件系统配置等。源码路径规则为:_vendor/\{产品解决方案厂商\}/\{产品名称\}。_产品解决方案也是一个特殊的组件,目录树规则如下: +产品解决方案为基于开发板的完整产品,主要包含产品对OS的适配、组件拼装配置、启动配置和文件系统配置等。产品解决方案的源码路径规则为:**vendor/\{产品解决方案厂商\}/\{产品名称\}**_。_产品解决方案也是一个特殊的组件。 + +产品解决方案的目录树规则如下: ``` vendor @@ -229,25 +264,24 @@ vendor └── ...... ``` -新增产品须按如上的规则创建目录和文件,编译构建系统将按该规则扫描已配置的产品。关键的目录和文件详细介绍如下: - -1. vendor/company/product/init\_configs/etc +>![](../public_sys-resources/icon-caution.gif) **注意:** +>**新增产品须按如上的规则创建目录和文件,编译构建系统将按该规则扫描已配置的产品。** - 该文件夹中包含rcS脚本,Sxxx脚本和fstab脚本,init进程在启动系统服务之前执行这些脚本。执行的流程为“rcS-\>fstab-\>S00-xxx“,Sxxx脚本中的内容与开发板和产品需要有关,主要包括设备节点的创建、创建目录、扫描设备节点、修改文件权限等等。这些文件在产品编译的BUILD.gn中按需拷贝到产品out目录中,最终打包到rootfs镜像中。 - -2. vendor/company/product/init\_configs/init.cfg - - init进程启动服务的配置文件,当前支持解析的命令有: +关键的目录和文件详细介绍如下: - 1\) start: 启动某个服务 +1. **vendor/company/product/init\_configs/etc** - 2\) mkdir: 创建文件夹 + 该文件夹中包含rcS脚本,Sxxx脚本和fstab脚本。init进程在启动系统服务之前执行这些脚本。执行的流程为“rcS-\>fstab-\>S00-xxx“。Sxxx脚本中的内容与开发板和产品需要有关,主要包括设备节点的创建、创建目录、扫描设备节点、修改文件权限等等。这些文件在产品编译的BUILD.gn中按需拷贝到产品out目录中,最终打包到rootfs镜像中。 - 3)chmod: 修改指定路径/文件的权限 +2. **vendor/company/product/init\_configs/init.cfg** - 4\) chown: 修改指定路径/文件的属组 + init进程启动服务的配置文件,当前支持解析的命令有: - 5\) mount: 挂载命令 + - start: 启动某个服务 + - mkdir: 创建文件夹 + - chmod: 修改指定路径/文件的权限 + - chown: 修改指定路径/文件的属组 + - mount: 挂载命令 该文件中的各个字段的解释如下: @@ -273,7 +307,7 @@ vendor "start service1" ] }, { - "name" : "post-init", # 最后别执行的job, init进程启动完成后的处理(如驱动初始化后再mount设备) + "name" : "post-init", # 最后执行的job, init进程启动完成后的处理(如驱动初始化后再mount设备) "cmds" : [] } ], @@ -291,13 +325,15 @@ vendor } ``` -3. vendor/company/product/init\_configs/hals +3. **vendor/company/product/init\_configs/hals** 解决方案厂商对OS的适配,需要实现的接口请见各个组件的readme说明文档。 -4. vendor/company/product/config.json +4. **vendor/company/product/config.json** + + config.json为编译构建的主入口,包含了开发板、OS组件和内核等配置信息。 - config.json为编译构建的主入口,包含了开发板、OS组件和内核等配置信息。以基于hispark\_taurus开发板的ipcamera产品为例,配置文件如下: + 以基于hispark\_taurus开发板的ipcamera产品为例,配置文件如下: ``` { @@ -323,7 +359,7 @@ vendor } ``` -5. vendor/company/product/fs.yml +5. **vendor/company/product/fs.yml** 该文件用于配置文件系统镜像制作过程,将编译产物打包成文件系统镜像,比如用户态根文件系统rootfs.img和可读写的userfs.img。它由多个列表组成,每个列表对应一个文件系统。字段说明如下: @@ -361,10 +397,10 @@ vendor - $\{fs\_dir\_name\} - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >fs.yml是可选的,对于没有文件系统的设备可不配置。 -6. vendor/company/product/BUILD.gn +6. **vendor/company/product/BUILD.gn** 产品编译的入口,主要用于编译解决方案厂商源码和拷贝启动配置文件。如果某个产品被选择为要编译的产品,那么对应产品目录下的BUILD.gn会默认编译。一个典型的产品编译BUILD.gn应该如下: @@ -379,3 +415,582 @@ vendor ``` +## 使用指导 + +### 前提条件 + +开发环境需安装gn、ninja构建工具、python 3.7.4及以上和hb。安装方法请见[搭建系统基础环境](../quick-start/quickstart-lite-env-setup.md)。 + +### hb工具使用说明 + +hb是OpenHarmony的命令行工具,用来执行编译命令。以下对hb的常用命令进行说明。 + +**hb set** + +``` +hb set -h +usage: hb set [-h] [-root [ROOT_PATH]] [-p] + +optional arguments: + -h, --help show this help message and exit + -root [ROOT_PATH], --root_path [ROOT_PATH] + Set OHOS root path + -p, --product Set OHOS board and kernel +``` + +- hb set 后无参数,进入默认设置流程 +- hb set -root dir可直接设置代码根目录 +- hb set -p设置要编译的产品 + +**hb env** + +查看当前设置信息 + +``` +hb env +[OHOS INFO] root path: xxx +[OHOS INFO] board: hispark_taurus +[OHOS INFO] kernel: liteos +[OHOS INFO] product: ipcamera +[OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera +[OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19 +``` + +**hb build** + +``` +hb build -h +usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] + [--dmverity] [--tee] [-p PRODUCT] [-f] [-n] + [-T [TARGET [TARGET ...]]] [-v] [-shs] [--patch] + [component [component ...]] + +positional arguments: + component name of the component + +optional arguments: + -h, --help show this help message and exit + -b BUILD_TYPE, --build_type BUILD_TYPE + release or debug version + -c COMPILER, --compiler COMPILER + specify compiler + -t [TEST [TEST ...]], --test [TEST [TEST ...]] + compile test suit + --dmverity Enable dmverity + --tee Enable tee + -p PRODUCT, --product PRODUCT + build a specified product with + {product_name}@{company}, eg: camera@huawei + -f, --full full code compilation + -n, --ndk compile ndk + -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] + Compile single target + -v, --verbose show all command lines while building + -shs, --sign_haps_by_server + sign haps by server + --patch apply product patch before compiling + + --dmverity Enable dmverity + -p PRODUCT, --product PRODUCT + build a specified product with + {product_name}@{company}, eg: ipcamera@hisilcon + -f, --full full code compilation + -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] + Compile single target +``` + +- hb build后无参数,会按照设置好的代码路径、产品进行编译,编译选项使用与之前保持一致。-f 选项将删除当前产品所有编译产品,等同于hb clean + hb build. +- hb build \{component\_name\}:基于设置好的产品对应的单板、内核,单独编译组件(e.g.:hb build kv\_store\)。 +- hb build -p ipcamera@hisilicon:免set编译产品,该命令可以跳过set步骤,直接编译产品。 +- 在device/device\_company/board下单独执行hb build会进入内核选择界面,选择完成后会根据当前路径的单板、选择的内核编译出仅包含内核、驱动的镜像。 + +**hb clean** + +清除out目录对应产品的编译产物,仅保留args.gn、build.log。清除指定路径可输入路径参数:hb clean out/board/product,默认将清除当前hb set的产品对应out路径。 + +``` +hb clean +usage: hb clean [-h] [out_path] + +positional arguments: + out_path clean a specified path. + +optional arguments: + -h, --help show this help message and exit +``` + +### 新增组件 + +本小节介绍如何新增一个组件,首先确定组件归属的子系统和组件名称,然后按如下步骤新增: + +1. 源码开发完成后,添加组件编译脚本。 + + 以编译组件hello\_world可执行文件为例,applications/sample/hello\_world/BUILD.gn可以写为: + + ``` + executable("hello_world") { + include_dirs = [ + "include", + ] + sources = [ + "src/hello_world.c" + ] + } + ``` + + 如上编译脚本,可编译出一个可在OpenHarmony上运行的名为hello\_world的可执行文件。 + + 单独编译该组件,hb set任意选择一款产品,然后使用-T选项单独编译组件: + + ``` + hb build -f -T //applications/sample/hello_world + ``` + + 组件在开发板上功能验证完成后,可按[步骤2\~4](#li11471037297)将组件配置到产品中。 + +2. 添加组件描述。 + + 组件描述位于build/lite/components下,新增的组件需加入对应子系统的json文件中。一个组件描述必选的字段有: + + - component:组件名称。 + - description:组件的一句话功能描述。 + - optional:组件是否为系统可选。 + - dirs:组件源码路径。 + - targets:组件编译入口。 + + 以将hello\_world组件加入应用子系统为例,在applications.json中添加hello\_world对象: + + ``` + { + "components": [ + { + "component": "hello_world", + "description": "Hello world.", + "optional": "true", + "dirs": [ + "applications/sample/hello_world" + ], + "targets": [ + "//applications/sample/hello_world" + ] + }, + ... + ] + } + ``` + +3. 将组件配置到产品。 + + 产品的配置文件config.json位于位于vendor/company/product/下,产品配置文件需包含产品名称、OpenHarmony版本号、device厂商、开发板、内核类型、内核版本号,以及配置的子系统和组件。以将hello\_world组件加入产品配置文件my\_product.json中为例,加入hello\_wolrd对象: + + ``` + { + "product_name": "hello_world_test", + "ohos_version": "OpenHarmony 1.0", + "device_company": "hisilicon", + "board": "hispark_taurus", + "kernel_type": "liteos_a", + "kernel_version": "1.0.0", + "subsystems": [ + { + "subsystem": "applications", + "components": [ + { "component": "hello_world", "features":[] } + ] + }, + ... + ] + } + ``` + +4. 编译产品。 + + 1. 代码根目录输入hb set选择对应产品。 + + 2. 执行hb build。 + + +### 新增芯片解决方案 + +编译构建支持添加新的芯片解决方案厂商,具体步骤如下: + +1. 创建芯片解决方案目录。 + + 按照[芯片解决方案配置规则](#section1625463413327)创建目录,以芯片厂商realtek的“rtl8720“开发板为例, 在代码根目录执行: + + ``` + mkdir -p device/realtek/rtl8720 + ``` + +2. 创建内核适配目录,并编写开发板编译配置config.gni文件。 + + 以realtek的“rtl8720“开发板的liteos\_m适配为例,device/realtek/rtl8720/liteos\_a/config.gni的内容如下: + + ``` + # Kernel type, e.g. "linux", "liteos_a", "liteos_m". + kernel_type = "liteos_a" + + # Kernel version. + kernel_version = "3.0.0" + + # Board CPU type, e.g. "cortex-a7", "riscv32". + board_cpu = "real-m300" + + # Board arch, e.g. "armv7-a", "rv32imac". + board_arch = "" + + # Toolchain name used for system compiling. + # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. + # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. + board_toolchain = "gcc-arm-none-eabi" + + # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. + board_toolchain_path = + rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin", + root_build_dir) + + # Compiler prefix. + board_toolchain_prefix = "gcc-arm-none-eabi-" + + # Compiler type, "gcc" or "clang". + board_toolchain_type = "gcc" + + # Board related common compile flags. + board_cflags = [] + board_cxx_flags = [] + board_ld_flags = [] + ``` + +3. 编写编译脚本。 + + 在开发板目录下创建BUILD.gn,target名称应与开发板名称一致。以realtek的rtl8720开发板为例,device/realtek/rtl8720/BUILD.gn内容可以是: + + ``` + group("rtl8720") { # target类型也可以shared_library, static_library, executable + # 具体内容 + ...... + } + ``` + +4. 编译芯片解决方案。 + + 在开发板目录下执行hb build,即可启动芯片解决方案的编译。 + + +### 新增产品解决方案 + +编译构建支持芯片解决方案和组件的灵活拼装,形成定制化的产品解决方案。具体步骤如下: + +1. 创建产品目录 + + 按照[产品解决方案配置规则](#section1625463413327)创建产品目录,以基于“rtl8720“开发板的wifiiot模组为例,在代码根目录执行: + + ``` + mkdir -p vendor/my_company/wifiiot + ``` + +2. 拼装产品 + + 在新建的产品目录下新建config.json文件,以步骤1中的wifiiot为例,vendor/my\_company/wifiiot/config.json可以是: + + ``` + { + "product_name": "wifiiot", # 产品名称 + "ohos_version": "OpenHarmony 1.0", # 使用的OS版本 + "device_company": "realtek", # 芯片解决方案厂商名称 + "board": "rtl8720", # 开发板名称 + "kernel_type": "liteos_m", # 选择的内核类型 + "kernel_version": "3.0.0", # 选择的内核版本 + "subsystems": [ + { + "subsystem": "kernel", # 选择的子系统 + "components": [ + { "component": "liteos_m", "features":[] } # 选择的组件和组件特性 + ] + }, + ... + { + 更多子系统和组件 + } + ] + } + ``` + + 注意:编译构建系统编译前会对device\_company,board,kernel\_type,kernel\_version、subsystem、component字段进行有效性检查,其中device\_company,board,kernel\_type,kernel\_version应与已知的芯片解决方案匹配,subsystem、component应与build/lite/components下的组件描述匹配。 + +3. 适配OS接口 + + 在产品目录下创建hals目录,并将产品解决方案对OS适配的源码和编译脚本放入该目录下。 + +4. 配置系统服务 + + 在产品目录下创建init\_configs目录,并在init\_configs目录下创建init.cfg文件,按需配置要启动的系统服务。 + +5. 配置init进程(仅linux内核需要) + + 在init\_configs目录下创建etc目录,然后在etc下创建init.d文件夹和fstab文件。最后按产品需求在init.d文件下创建并编辑rcS文件和Sxxx文件。 + +6. 配置文件系统镜像(可选,仅支持文件系统的开发板需要) + + 在产品目录下创建fs.yml文件。fs.yml需按产品实际情况配置,一个典型的fs.yml文件如下: + + ``` + - + fs_dir_name: rootfs # 镜像的名称 + fs_dirs: + - + # 将编译生成的out/my_board/my_product/bin目录下的文件拷贝到rootfs/bin中,并忽略测试bin + source_dir: bin + target_dir: bin + ignore_files: + - Test.bin + - TestSuite.bin + - + # 将编译生成的out/my_board/my_product/libs目录下的文件拷贝到rootfs/lib中,忽略所有.a文件,并设置文件和文件夹的权限为644和755 + source_dir: libs + target_dir: lib + ignore_files: + - .a + dir_mode: 755 + file_mode: 644 + - + source_dir: usr/lib + target_dir: usr/lib + ignore_files: + - .a + dir_mode: 755 + file_mode: 644 + - + source_dir: config + target_dir: etc + - + source_dir: system + target_dir: system + - + source_dir: sbin + target_dir: sbin + - + source_dir: usr/bin + target_dir: usr/bin + - + source_dir: usr/sbin + target_dir: usr/sbin + - + # 创建一个proc空目录 + target_dir: proc + - + target_dir: mnt + - + target_dir: opt + - + target_dir: tmp + - + target_dir: var + - + target_dir: sys + - + source_dir: etc + target_dir: etc + - + source_dir: vendor + target_dir: vendor + - + target_dir: storage + + fs_filemode: + - + file_dir: lib/ld-uClibc-0.9.33.2.so + file_mode: 555 + - + file_dir: lib/ld-2.24.so + file_mode: 555 + - + file_dir: etc/init.cfg + file_mode: 400 + fs_symlink: + - + # 在rootfs/lib下创建软连接ld-musl-arm.so.1 -> libc.so + source: libc.so + link_name: ${fs_dir}/lib/ld-musl-arm.so.1 + - + source: mksh + link_name: ${fs_dir}/bin/sh + - + source: mksh + link_name: ${fs_dir}/bin/shell + fs_make_cmd: + # 使用脚本将rootfs制作为ext4格式的image + - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 + - + fs_dir_name: userfs + fs_dirs: + - + source_dir: storage/etc + target_dir: etc + - + source_dir: data + target_dir: data + fs_make_cmd: + - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 + + ``` + +7. 配置产品Patch(可选,视产品涉及组件是否需要打补丁而定) + + 在产品目录下创建patch.yml文件。patch.yml需按产品实际情况配置,一个典型的patch.yml文件如下: + + ``` + # 需要打patch的路径 + foundation/communication/dsoftbus: + # 该路径下需要打的patch存放路径 + - foundation/communication/dsoftbus/1.patch + - foundation/communication/dsoftbus/2.patch + third_party/wpa_supplicant: + - third_party/wpa_supplicant/1.patch + - third_party/wpa_supplicant/2.patch + - third_party/wpa_supplicant/3.patch + ... + ``` + + 配置完成后,编译时增加--patch参数,即可在产品编译前将配置的Patch文件打到对应目录中,再进行编译: + + ``` + hb build -f --patch + ``` + +8. 编写编译脚本 + + 在产品目录下创建BUILD.gn文件,按产品实际情况编写脚本。以步骤1中的wifiiot为例,BUILD.gn示例如下: + + ``` + group("wifiiot") { # target名称与产品名一致 + deps = [] + # 拷贝init配置 + deps += [ "init_configs" ] + # 将hals加入编译 + deps += [ "hals" ] + # 其他 + ...... + } + ``` + +9. 编译产品。 + + 在代码根目录执行hb set按提示选择新增的产品,然后执行hb build即可启动编译。 + + +## 常见问题 + +### ninja版本问题导致编译失败 + +- **现象描述:** + + 编译失败,提示“usr/sbin/ninja: invalid option -- w”。 + +- **可能原因:** + + 编译环境中ninja版本太低,不支持--w选项。 + +- **解决办法:** + + 卸载环境中ninja和gn,按照HarmonyOS官网[获取工具](../get-code/gettools-ide.md)。 + + +### ncurses库缺失导致编译失败 + +- **现象描述:** + + 编译失败,提示“/usr/bin/ld: cannot find -lncurses”。 + +- **可能原因:** + + 编译环境ncurses库缺失。 + +- **解决办法:** + + ``` + sudo apt-get install lib32ncurses5-dev + ``` + + +### 未安装mcopy导致编译失败 + +- **现象描述:** + + ​编译失败,提示“line 77: mcopy: command not found”。 + +- **可能原因:** + + 编译环境未安装mcopy。 + +- **解决办法:** + + ``` + ​sudo apt-get install dosfstools mtools + ``` + + +### 权限问题导致编译失败 + +- **现象描述:** + + 编译失败,提示“riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory”。 + +- ​**可能原因:** + + 当前用户对riscv编译器路径下的文件访问权限不够。 + +- ​**解决办法:** + + 查询gcc\_riscv32所在目录。 + + ``` + which riscv32-unknown-elf-gcc + ``` + + 使用chmod命令修改目录权限为755。 + + +### 未安装Crypto导致编译失败 + +- **现象描述:** + + 编译失败,提示“No module named 'Crypto'”。 + +- **可能原因:** + + python3未安装Crypto。 + +- **解决办法:** + 1. 查询Python版本号。 + + ``` + python3 --version + ``` + + 2. 需使用python3.7以上版本,然后安装pycryptodome。 + + ``` + sudo pip3 install pycryptodome + ``` + + + +### 编译环境为shell导致编译失败 + +- **现象描述:** + + 编译失败:“xx.sh \[: xx unexpected operator”。 + +- **可能原因:** + + 编译环境shell不是bash。 + +- **解决办法:** + + ``` + sudo rm -rf /bin/sh + sudo ln -s /bin/bash /bin/sh + ``` + + diff --git "a/zh-cn/device-dev/subsystems/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\347\274\226\350\257\221\346\236\204\345\273\272\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-build-mini.md old mode 100755 new mode 100644 similarity index 31% rename from "zh-cn/device-dev/subsystems/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\347\274\226\350\257\221\346\236\204\345\273\272\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-build-mini.md index e85c33895c2a4348209433745b10487457589a5d..df6e2e0c54c21c72fbecedb3c1c6dbf7132c87ed --- "a/zh-cn/device-dev/subsystems/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\347\274\226\350\257\221\346\236\204\345\273\272\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-build-mini.md @@ -1,9 +1,5 @@ # 轻量和小型系统编译构建指导 -- **[编译构建概述](编译构建概述.md)** - -- **[编译构建使用指导](编译构建使用指导.md)** - -- **[编译构建常见问题](编译构建常见问题.md)** +- **[编译构建子系统—轻量和小型系统](subsys-build-mini-lite.md)** diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274-1.md" b/zh-cn/device-dev/subsystems/subsys-build-standard-large.md old mode 100755 new mode 100644 similarity index 66% rename from "zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274-1.md" rename to zh-cn/device-dev/subsystems/subsys-build-standard-large.md index 661ff10cf6bdcb8d16510560214c53e124813a6d..9259a8073d9ae1a35c3fc17d4757bee73d72dab9 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274-1.md" +++ b/zh-cn/device-dev/subsystems/subsys-build-standard-large.md @@ -1,12 +1,73 @@ -# 编译构建使用指导 +# 标准系统编译构建指导 -- [目录结构](#section56731811102915) -- [编译](#section1069873833818) - - [编译命令](#section2740182614395) +- [概述](#section17466112012244) + - [基本概念](#section445513507246) + - [运作机制](#section12541217142510) + - [约束与限制](#section886933762513) -- [开发步骤](#section4207112818418) +- [编译构建使用指导](#section16901215262) + - [目录结构](#section109065332264) + - [编译命令](#section123265539266) + - [开发步骤](#section591084422719) -## 目录结构 + +## 概述 + +编译构建子系统提供了一个基于gn和ninja的编译构建框架。主要提供以下功能: + +- 构建不同芯片平台的产品。如:Hi3516DV300平台。 + +- 根据产品配置可以按照组件组装打包产品需要的能力。 + +### 基本概念 + +在了解编译构建子系统的能力前,应了解如下基本概念: + +- 平台 + + 开发板和内核的组合,不同平台支持的子系统和组件不同。 + +- 子系统 + + OpenHarmony整体遵从分层设计,从下向上依次为:内核层、系统服务层、框架层和应用层。系统功能按照“系统 \> 子系统 \> 组件”逐级展开,在多设备部署场景下,支持根据实际需求裁剪某些非必要的子系统或组件。子系统是一个逻辑概念,它具体由对应的组件构成。 + +- 组件 + + 对子系统的进一步拆分,可复用的软件单元,它包含源码、配置文件、资源文件和编译脚本;能独立构建,以二进制方式集成,具备独立验证能力的二进制单元。 + +- gn + + Generate ninja的缩写,用于产生ninja文件。 + +- ninja + + ninja是一个专注于速度的小型构建系统。 + + +### 运作机制 + +OpenHarmony侧的编译构建流程主要包括编译命令行解析,调用gn,执行ninja: + +- 命令行解析:解析待编译的产品名称,加载相关配置。 +- 调用gn: 根据命令行解析的产品名称和编译类型,配置编译工具链和全局的编译选项。 +- 执行ninja:启动编译并生成对应的产品版本。 + +### 约束与限制 + +- 需按照[源码获取](../get-code/sourcecode-acquire.md)指导下载全量源码(采用方式三获取)。 +- 编译环境需要Ubuntu18.04及以上版本。 +- 安装编译所需的程序包。 + + 安装命令: + + ``` + sudo apt-get install binutils git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 + ``` + + +## 编译构建使用指导 + +### 目录结构 ``` /build # 编译构建主目录 @@ -27,9 +88,7 @@ └── toolchain # 编译工具链配置 ``` -## 编译 - -### 编译命令 +### 编译命令 - 代码根目录下执行全量版本的编译命令: @@ -51,7 +110,7 @@ ``` -## 开发步骤 +### 开发步骤 1. 添加组件。 diff --git "a/zh-cn/device-dev/subsystems/\346\240\207\345\207\206\347\263\273\347\273\237\347\274\226\350\257\221\346\236\204\345\273\272\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-build-standard.md similarity index 38% rename from "zh-cn/device-dev/subsystems/\346\240\207\345\207\206\347\263\273\347\273\237\347\274\226\350\257\221\346\236\204\345\273\272\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-build-standard.md index 6c6cf033328d93b995af036b0607bb9c31bb37ef..d5d5ce6278bf65d44db5da6b8b7734e22463b486 100644 --- "a/zh-cn/device-dev/subsystems/\346\240\207\345\207\206\347\263\273\347\273\237\347\274\226\350\257\221\346\236\204\345\273\272\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-build-standard.md @@ -1,7 +1,5 @@ # 标准系统编译构建指导 -- **[编译构建概述](编译构建概述-0.md)** - -- **[编译构建使用指导](编译构建使用指导-1.md)** +- **[编译构建子系统—标准系统](subsys-build-standard-large.md)** diff --git a/zh-cn/device-dev/subsystems/subsys-build.md b/zh-cn/device-dev/subsystems/subsys-build.md new file mode 100644 index 0000000000000000000000000000000000000000..487b7bf7b22db66cf401cda724f9236f343e0a8a --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-build.md @@ -0,0 +1,7 @@ +# 编译构建 + +- **[轻量和小型系统编译构建指导](subsys-build-mini-lite.md)** + +- **[标准系统编译构建指导](subsys-build-standard-large.md)** + + diff --git "a/zh-cn/device-dev/subsystems/HiLog_Lite\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-dfx-hilog-lite.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/HiLog_Lite\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-dfx-hilog-lite.md diff --git "a/zh-cn/device-dev/subsystems/HiLog\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-dfx-hilog-rich.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/HiLog\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-dfx-hilog-rich.md diff --git "a/zh-cn/device-dev/subsystems/HiSysEvent\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/HiSysEvent\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-dfx-hisysevent.md diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisyseventread.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisyseventread.md new file mode 100644 index 0000000000000000000000000000000000000000..333dd112b45fe83e91673798d6fd125db71747e3 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisyseventread.md @@ -0,0 +1,103 @@ +# HiSysEvent订阅指导 + +- [概述](#section315316685112) +- [接口说明](#section0342191810519) +- [开发实例](#section123181432175110) + +## 概述 + +HiSysEvent提供了跨进程订阅机制,用户可以通过注册订阅接口。 + +## 接口说明 + +**表 1** HiSysEvent订阅接口 + + +

参数

@@ -384,3 +494,73 @@ void SpiClose\(DevHandle handle\); SpiClose(spiHandle); /* 销毁SPI设备句柄 */ ``` +## 使用实例 + +SPI设备完整的使用示例如下所示,首先获取SPI设备句柄,然后配置SPI设备属性,接着调用读写接口进行数据传输,最后销毁SPI设备句柄。 + +``` +#include "hdf_log.h" +#include "spi_if.h" + +void SpiTestSample(void) +{ + int32_t ret; + struct SpiCfg cfg; /* SPI配置信息 */ + struct SpiDevInfo spiDevinfo; /* SPI设备描述符 */ + DevHandle spiHandle = NULL; /* SPI设备句柄 */ + struct SpiMsg msg; /* 自定义传输的消息 */ + uint8_t rbuff[4] = { 0 }; + uint8_t wbuff[4] = { 0x12, 0x34, 0x56, 0x78 }; + uint8_t wbuff2[4] = { 0xa1, 0xb2, 0xc3, 0xd4 }; + + spiDevinfo.busNum = 0; /* SPI设备总线号 */ + spiDevinfo.csNum = 0; /* SPI设备片选号 */ + spiHandle = SpiOpen(&spiDevinfo); /* 根据spiDevinfo获取SPI设备句柄 */ + if (spiHandle == NULL) { + HDF_LOGE("SpiOpen: failed\n"); + return; + } + /* 获取SPI设备属性 */ + ret = SpiGetCfg(spiHandle, &cfg); + if (ret != 0) { + HDF_LOGE("SpiGetCfg: failed, ret %d\n", ret); + goto err; + } + cfg.maxSpeedHz = 115200; /* 将最大时钟频率改为115200 */ + cfg.bitsPerWord = 8; /* 传输位宽改为8比特 */ + /* 配置SPI设备属性 */ + ret = SpiSetCfg(spiHandle, &cfg); + if (ret != 0) { + HDF_LOGE("SpiSetCfg: failed, ret %d\n", ret); + goto err; + } + /* 向SPI设备写入指定长度的数据 */ + ret = SpiWrite(spiHandle, wbuff, 4); + if (ret != 0) { + HDF_LOGE("SpiWrite: failed, ret %d\n", ret); + goto err; + } + /* 从SPI设备读取指定长度的数据 */ + ret = SpiRead(spiHandle, rbuff, 4); + if (ret != 0) { + HDF_LOGE("SpiRead: failed, ret %d\n", ret); + goto err; + } + msg.wbuf = wbuff2; /* 写入的数据 */ + msg.rbuf = rbuff; /* 读取的数据 */ + msg.len = 4; /* 读取写入数据的长度为4 */ + msg.csChange = 1; /* 进行下一次传输前关闭片选 */ + msg.delayUs = 0; /* 进行下一次传输前不进行延时 */ + msg.speed = 115200; /* 本次传输的速度 */ + /* 进行一次自定义传输,传输的msg个数为1 */ + ret = SpiTransfer(spiHandle, &msg, 1); + if (ret != 0) { + HDF_LOGE("SpiTransfer: failed, ret %d\n", ret); + goto err; + } +err: + /* 销毁SPI设备句柄 */ + SpiClose(spiHandle); +} +``` + diff --git "a/zh-cn/device-dev/driver/UART\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-uart-des.md old mode 100755 new mode 100644 similarity index 69% rename from "zh-cn/device-dev/driver/UART\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-uart-des.md index 1d1ee50a8c13e37c506350820c71a5a7b4893d7f..182cad984a49051847129210d7cce9e9db7bbcdd --- "a/zh-cn/device-dev/driver/UART\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-uart-des.md @@ -1,32 +1,141 @@ -# UART使用指导 +# UART -- [使用流程](#section47784125013) -- [获取UART设备句柄](#section146445153110) -- [UART设置波特率](#section1862705516339) -- [UART获取波特率](#section1263651563414) -- [UART设置设备属性](#section1770091483814) -- [UART获取设备属性](#section117543316384) -- [设置UART传输模式](#section187233112369) -- [向UART设备写入指定长度的数据](#section82416423368) -- [从UART设备中读取指定长度的数据](#section192177171373) -- [销毁UART设备句柄](#section63131236354) +- [概述](#section833012453535) + - [接口说明](#section1680292311549) -## 使用流程 +- [使用指导](#section12779050105412) + - [使用流程](#section1858116395510) + - [获取UART设备句柄](#section124512065617) + - [UART设置波特率](#section86881004579) + - [UART获取波特率](#section897032965712) + - [UART设置设备属性](#section129141884588) + - [UART获取设备属性](#section18689637165812) + - [设置UART传输模式](#section72713435918) + - [向UART设备写入指定长度的数据](#section128001736155919) + - [从UART设备中读取指定长度的数据](#section92851601604) + - [销毁UART设备句柄](#section1477410521406) -使用UART的一般流程如[图1](#p58686354483)所示。 +- [使用实例](#section35404241311) -**图 1** UART使用流程图 +## 概述 +- UART是通用异步收发传输器(Universal Asynchronous Receiver/Transmitter)的缩写,是通用串行数据总线,用于异步通信。该总线双向通信,可以实现全双工传输。 +- UART应用比较广泛,常用于输出打印信息,也可以外接各种模块,如GPS、蓝牙等。 +- 两个UART设备的连接示意图如下,UART与其他模块一般用2线(图1)或4线(图2)相连,它们分别是: + - TX:发送数据端,和对端的RX相连; + - RX:接收数据端,和对端的TX相连; + - RTS:发送请求信号,用于指示本设备是否准备好,可接受数据,和对端CTS相连; + - CTS:允许发送信号,用于判断是否可以向对端发送数据,和对端RTS相连; -![](figures/zh-cn_image_0000001054006983.png) + **图 1** 2线UART设备连接示意图 + -## 获取UART设备句柄 + ![](figure/zh-cn_image_0000001170262141.png) + + **图 2** 4线UART设备连接示意图 + + + ![](figure/zh-cn_image_0000001123582482.png) + + +- UART通信之前,收发双方需要约定好一些参数:波特率、数据格式(起始位、数据位、校验位、停止位)等。通信过程中,UART通过TX发送给对端数据,通过RX接收对端发送的数据。当UART接收缓存达到预定的门限值时,RTS变为不可发送数据,对端的CTS检测到不可发送数据,则停止发送数据。 +- UART接口定义了操作UART端口的通用方法集合,包括获取、释放设备句柄、读写数据、获取和设置波特率、获取和设置设备属性。 + +### 接口说明 + +**表 1** UART驱动API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

UART获取/释放设备句柄

+

+

UartOpen

+

UART获取设备句柄

+

UartClose

+

UART释放设备句柄

+

UART读写接口

+

+

UartRead

+

从UART设备中读取指定长度的数据

+

UartWrite

+

向UART设备中写入指定长度的数据

+

UART获取/设置波特率接口

+

UartGetBaud

+

UART获取波特率

+

UartSetBaud

+

UART设置波特率

+

UART获取/设置设备属性

+

+

UartGetAttribute

+

UART获取设备属性

+

UartSetAttribute

+

UART设置设备属性

+

UART设置传输模式

+

UartSetTransMode

+

UART设置传输模式

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 + +使用UART的一般流程如[图3](#fig1852173020185)所示。 + +**图 3** UART使用流程图 + + +![](figure/zh-cn_image_0000001170227689.png) + +### 获取UART设备句柄 在使用UART进行通信时,首先要调用UartOpen获取UART设备句柄,该函数会返回指定端口号的UART设备句柄。 DevHandle UartOpen\(uint32\_t port\); -**表 1** UartOpen参数和返回值描述 +**表 2** UartOpen参数和返回值描述

参数

@@ -70,13 +179,13 @@ if (handle == NULL) { } ``` -## UART设置波特率 +### UART设置波特率 在通信之前,需要设置UART的波特率,设置波特率的函数如下所示: int32\_t UartSetBaud\(DevHandle handle, uint32\_t baudRate\); -**表 2** UartSetBaud参数和返回值描述 +**表 3** UartSetBaud参数和返回值描述

参数

@@ -124,13 +233,13 @@ if (ret != 0) { } ``` -## UART获取波特率 +### UART获取波特率 设置UART的波特率后,可以通过获取波特率接口来查看UART当前的波特率,获取波特率的函数如下所示: int32\_t UartGetBaud\(DevHandle handle, uint32\_t \*baudRate\); -**表 3** UartGetBaud参数和返回值描述 +**表 4** UartGetBaud参数和返回值描述

参数

@@ -179,13 +288,13 @@ if (ret != 0) { } ``` -## UART设置设备属性 +### UART设置设备属性 在通信之前,需要设置UART的设备属性,设置设备属性的函数如下图所示: int32\_t UartSetAttribute\(DevHandle handle, struct UartAttribute \*attribute\); -**表 4** UartSetAttribute参数和返回值描述 +**表 5** UartSetAttribute参数和返回值描述

参数

@@ -241,13 +350,13 @@ if (ret != 0) { } ``` -## UART获取设备属性 +### UART获取设备属性 设置UART的设备属性后,可以通过获取设备属性接口来查看UART当前的设备属性,获取设备属性的函数如下图所示: int32\_t UartGetAttribute\(DevHandle handle, struct UartAttribute \*attribute\); -**表 5** UartGetAttribute参数和返回值描述 +**表 6** UartGetAttribute参数和返回值描述

参数

@@ -296,13 +405,13 @@ if (ret != 0) { } ``` -## 设置UART传输模式 +### 设置UART传输模式 在通信之前,需要设置UART的传输模式,设置传输模式的函数如下图所示: int32\_t UartSetTransMode\(DevHandle handle, enum UartTransMode mode\); -**表 6** UartSetTransMode参数和返回值描述 +**表 7** UartSetTransMode参数和返回值描述 - - diff --git "a/zh-cn/device-dev/porting/Makefile\346\226\271\345\274\217\347\273\204\347\273\207\347\274\226\350\257\221\347\232\204\345\272\223\347\247\273\346\244\215.md" b/zh-cn/device-dev/porting/transplant-thirdparty-makefile.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/porting/Makefile\346\226\271\345\274\217\347\273\204\347\273\207\347\274\226\350\257\221\347\232\204\345\272\223\347\247\273\346\244\215.md" rename to zh-cn/device-dev/porting/transplant-thirdparty-makefile.md index a2a6a92ee5a1723f8e5981139bc642a67e7ab9e0..ddabc1ef30ae29930bea14394ced65ec43e227a2 --- "a/zh-cn/device-dev/porting/Makefile\346\226\271\345\274\217\347\273\204\347\273\207\347\274\226\350\257\221\347\232\204\345\272\223\347\247\273\346\244\215.md" +++ b/zh-cn/device-dev/porting/transplant-thirdparty-makefile.md @@ -148,7 +148,7 @@ ## 测试 -yxml库测试步骤与double-conversion库基本一致,可参考[CMake方式组织编译的库移植](CMake方式组织编译的库移植.md#section6686144293611)的测试过程,以下内容介绍yxml库测试用例的使用方法: +yxml库测试步骤与double-conversion库基本一致,可参考[CMake方式组织编译的库移植](transplant-thirdparty-cmake.md#section6686144293611)的测试过程,以下内容介绍yxml库测试用例的使用方法: **表 3** 生成的test目录结构示意 @@ -236,7 +236,7 @@ echo "All tests completed successfully." ## 将该库编译添加到OpenHarmony工程中 -yxml库添加的过程除了适配文件build.gn和config.gni有些许变化外,其他和double-conversion库完全一致,参考[CMake方式组织编译的库移植](CMake方式组织编译的库移植.md#section1651053153715)的配置过程。要修改的适配文件及添加后的目录结构如下: +yxml库添加的过程除了适配文件build.gn和config.gni有些许变化外,其他和double-conversion库完全一致,参考[CMake方式组织编译的库移植](transplant-thirdparty-cmake.md#section1651053153715)的配置过程。要修改的适配文件及添加后的目录结构如下: - yxml库新增的BUILD.gn实现如下: @@ -289,7 +289,7 @@ if (TEST_ENABLE == "YES") { - diff --git "a/zh-cn/device-dev/porting/\346\246\202\350\277\260.md" b/zh-cn/device-dev/porting/transplant-thirdparty-overview.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/\346\246\202\350\277\260.md" rename to zh-cn/device-dev/porting/transplant-thirdparty-overview.md diff --git a/zh-cn/device-dev/porting/transplant-thirdparty.md b/zh-cn/device-dev/porting/transplant-thirdparty.md new file mode 100644 index 0000000000000000000000000000000000000000..ca27b2d33989ef22f963d59881cc0d317a337b35 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-thirdparty.md @@ -0,0 +1,9 @@ +# 三方库移植指导 + +- **[概述](transplant-thirdparty-overview.md)** + +- **[CMake方式组织编译的库移植](transplant-thirdparty-cmake.md)** + +- **[Makefile方式组织编译的库移植](transplant-thirdparty-makefile.md)** + + diff --git a/zh-cn/device-dev/porting/transplant.md b/zh-cn/device-dev/porting/transplant.md new file mode 100644 index 0000000000000000000000000000000000000000..bc8d8a3ad12bef77aaf9e3f74738efe311ecb464 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant.md @@ -0,0 +1,9 @@ +# 移植 + +- **[三方库移植指导](transplant-thirdparty.md)** + +- **[轻量系统芯片移植指导](transplant-minichip.md)** + +- **[小型系统芯片移植指导](transplant-smallchip.md)** + + diff --git "a/zh-cn/device-dev/porting/\344\270\211\346\226\271\345\272\223\347\247\273\346\244\215\346\214\207\345\257\274.md" "b/zh-cn/device-dev/porting/\344\270\211\346\226\271\345\272\223\347\247\273\346\244\215\346\214\207\345\257\274.md" deleted file mode 100755 index e54970ed8fef38469f2388b352fa7df719eea4b9..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/porting/\344\270\211\346\226\271\345\272\223\347\247\273\346\244\215\346\214\207\345\257\274.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 三方库移植指导 - -- **[概述](概述.md)** - -- **[CMake方式组织编译的库移植](CMake方式组织编译的库移植.md)** - -- **[Makefile方式组织编译的库移植](Makefile方式组织编译的库移植.md)** - - diff --git "a/zh-cn/device-dev/porting/\344\270\211\346\226\271\350\212\257\347\211\207\347\247\273\346\244\215\346\214\207\345\257\274.md" "b/zh-cn/device-dev/porting/\344\270\211\346\226\271\350\212\257\347\211\207\347\247\273\346\244\215\346\214\207\345\257\274.md" deleted file mode 100755 index c6c7b4103e7cd7eb49b8945cebf7f247a0866662..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/porting/\344\270\211\346\226\271\350\212\257\347\211\207\347\247\273\346\244\215\346\214\207\345\257\274.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 三方芯片移植指导 - -- **[移植准备](移植准备.md)** - -- **[内核移植](内核移植.md)** - -- **[板级系统移植](板级系统移植.md)** - -- **[常见问题](常见问题.md)** - - diff --git "a/zh-cn/device-dev/porting/\345\206\205\346\240\270\347\247\273\346\244\215.md" "b/zh-cn/device-dev/porting/\345\206\205\346\240\270\347\247\273\346\244\215.md" deleted file mode 100755 index 1dfe36434a1c3eca30a3dc75f0016a61730ef9e0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/porting/\345\206\205\346\240\270\347\247\273\346\244\215.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 内核移植 - -- **[移植概述](移植概述.md)** - -- **[内核基础适配](内核基础适配.md)** - -- **[内核移植验证](内核移植验证.md)** - - diff --git "a/zh-cn/device-dev/porting/\346\235\277\347\272\247\347\263\273\347\273\237\347\247\273\346\244\215.md" "b/zh-cn/device-dev/porting/\346\235\277\347\272\247\347\263\273\347\273\237\347\247\273\346\244\215.md" deleted file mode 100755 index 3029464912dea8f0226d3636d6d1a3652832dbca..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/porting/\346\235\277\347\272\247\347\263\273\347\273\237\347\247\273\346\244\215.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 板级系统移植 - -- **[移植概述](移植概述-0.md)** - -- **[板级驱动适配](板级驱动适配.md)** - -- **[HAL层实现](HAL层实现.md)** - -- **[系统组件调用](系统组件调用.md)** - -- **[三方组件适配](三方组件适配.md)** - -- **[XTS认证](XTS认证.md)** - - diff --git a/en/device-dev/driver/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/public_sys-resources/icon-caution.gif similarity index 100% rename from en/device-dev/driver/public_sys-resources/icon-caution.gif rename to zh-cn/device-dev/public_sys-resources/icon-caution.gif diff --git a/en/device-dev/driver/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/public_sys-resources/icon-danger.gif similarity index 100% rename from en/device-dev/driver/public_sys-resources/icon-danger.gif rename to zh-cn/device-dev/public_sys-resources/icon-danger.gif diff --git a/en/device-dev/driver/public_sys-resources/icon-note.gif b/zh-cn/device-dev/public_sys-resources/icon-note.gif similarity index 100% rename from en/device-dev/driver/public_sys-resources/icon-note.gif rename to zh-cn/device-dev/public_sys-resources/icon-note.gif diff --git a/en/device-dev/driver/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/public_sys-resources/icon-notice.gif similarity index 100% rename from en/device-dev/driver/public_sys-resources/icon-notice.gif rename to zh-cn/device-dev/public_sys-resources/icon-notice.gif diff --git a/en/device-dev/driver/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/public_sys-resources/icon-tip.gif similarity index 100% rename from en/device-dev/driver/public_sys-resources/icon-tip.gif rename to zh-cn/device-dev/public_sys-resources/icon-tip.gif diff --git a/en/device-dev/driver/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/public_sys-resources/icon-warning.gif similarity index 100% rename from en/device-dev/driver/public_sys-resources/icon-warning.gif rename to zh-cn/device-dev/public_sys-resources/icon-warning.gif diff --git "a/zh-cn/device-dev/quick-start/Hi3516\345\274\200\345\217\221\346\235\277.md" "b/zh-cn/device-dev/quick-start/Hi3516\345\274\200\345\217\221\346\235\277.md" deleted file mode 100755 index 1a6f14d262b1474576a3974dff7c57b205f48aaf..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/Hi3516\345\274\200\345\217\221\346\235\277.md" +++ /dev/null @@ -1,11 +0,0 @@ -# Hi3516开发板 - -- **[安装开发板环境](安装开发板环境-2.md)** - -- **[运行Hello OHOS](运行Hello-OHOS.md)** - -- **[驱动开发示例](驱动开发示例.md)** - -- **[常见问题](常见问题-3.md)** - - diff --git "a/zh-cn/device-dev/quick-start/Hi3518\345\274\200\345\217\221\346\235\277.md" "b/zh-cn/device-dev/quick-start/Hi3518\345\274\200\345\217\221\346\235\277.md" deleted file mode 100755 index 61807ea64d579d2364ff6c327864f20d8d6aaa6a..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/Hi3518\345\274\200\345\217\221\346\235\277.md" +++ /dev/null @@ -1,9 +0,0 @@ -# Hi3518开发板 - -- **[安装开发板环境](安装开发板环境-4.md)** - -- **[运行Hello OHOS](运行Hello-OHOS-5.md)** - -- **[常见问题](常见问题-6.md)** - - diff --git "a/zh-cn/device-dev/quick-start/Hi3861\345\274\200\345\217\221\346\235\277.md" "b/zh-cn/device-dev/quick-start/Hi3861\345\274\200\345\217\221\346\235\277.md" deleted file mode 100755 index f6c5f5833f16ede72614678ebc0483389d9120f8..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/Hi3861\345\274\200\345\217\221\346\235\277.md" +++ /dev/null @@ -1,11 +0,0 @@ -# Hi3861开发板 - -- **[安装开发板环境](安装开发板环境.md)** - -- **[WLAN联网](WLAN联网.md)** - -- **[运行Hello World](运行Hello-World.md)** - -- **[常见问题](常见问题-1.md)** - - diff --git a/zh-cn/device-dev/quick-start/Readme-CN.md b/zh-cn/device-dev/quick-start/Readme-CN.md index 69991d66becb3cfef2d8980b923dc38cdd43f790..f85dd9b4ea17a9cb1764e9f54b7459e41c40868e 100644 --- a/zh-cn/device-dev/quick-start/Readme-CN.md +++ b/zh-cn/device-dev/quick-start/Readme-CN.md @@ -1,41 +1,41 @@ # 快速入门 -- [轻量和小型系统入门](轻量和小型系统入门.md) - - [概述](概述.md) - - [了解开发板](了解开发板.md) - - [Hi3861开发板介绍](Hi3861开发板介绍.md) - - [Hi3516开发板介绍](Hi3516开发板介绍.md) - - [Hi3518开发板介绍](Hi3518开发板介绍.md) +- [轻量和小型系统入门](quickstart-lite.md) + - [概述](quickstart-lite-overview.md) + - [了解开发板](quickstart-lite-introduction.md) + - [Hi3861开发板介绍](quickstart-lite-introduction-hi3861.md) + - [Hi3516开发板介绍](quickstart-lite-introduction-hi3516.md) + - [Hi3518开发板介绍](quickstart-lite-introduction-hi3518.md) - - [搭建系统环境](搭建系统环境.md) - - [概述](概述-0.md) - - [Windows开发环境准备](Windows开发环境准备.md) - - [Ubuntu编译环境准备](Ubuntu编译环境准备.md) - - [常见问题](常见问题.md) + - [搭建系统环境](quickstart-lite-env-setup.md) + - [概述](quickstart-lite-env-setup-des.md) + - [Windows开发环境准备](quickstart-lite-env-setup-win.md) + - [Ubuntu编译环境准备](quickstart-lite-env-setup-lin.md) + - [常见问题](quickstart-lite-env-setup-faqs.md) - - [开发步骤](开发步骤.md) - - [Hi3861开发板](Hi3861开发板.md) - - [安装开发板环境](安装开发板环境.md) - - [WLAN联网](WLAN联网.md) - - [运行Hello World](运行Hello-World.md) - - [常见问题](常见问题-1.md) + - [开发步骤](quickstart-lite-steps.md) + - [Hi3861开发板](quickstart-lite-steps-board3861.md) + - [安装开发板环境](quickstart-lite-steps-board3861-setting.md) + - [WLAN联网](quickstart-lite-steps-board3861-connection.md) + - [运行Hello World](quickstart-lite-steps-board3861-running.md) + - [常见问题](quickstart-lite-steps-board3861-faqs.md) - - [Hi3516开发板](Hi3516开发板.md) - - [安装开发板环境](安装开发板环境-2.md) - - [运行Hello OHOS](运行Hello-OHOS.md) - - [驱动开发示例](驱动开发示例.md) - - [常见问题](常见问题-3.md) + - [Hi3516开发板](quickstart-lite-steps-board3516.md) + - [安装开发板环境](quickstart-lite-steps-board3516-setting.md) + - [运行Hello OHOS](quickstart-lite-steps-board3516-running.md) + - [驱动开发示例](quickstart-lite-steps-board3516-program.md) + - [常见问题](quickstart-lite-steps-board3516-faqs.md) - - [Hi3518开发板](Hi3518开发板.md) - - [安装开发板环境](安装开发板环境-4.md) - - [运行Hello OHOS](运行Hello-OHOS-5.md) - - [常见问题](常见问题-6.md) + - [Hi3518开发板](quickstart-lite-steps-board3518.md) + - [安装开发板环境](quickstart-lite-steps-board3518-setting.md) + - [运行Hello OHOS](quickstart-lite-steps-board3518-running.md) + - [常见问题](quickstart-lite-steps-board3518-faqs.md) -- [标准系统入门](标准系统入门.md) - - [入门介绍](入门介绍.md) - - [Windows开发环境准备](Windows开发环境准备-7.md) - - [搭建Ubuntu环境及编译(Docker方式)](搭建Ubuntu环境及编译(Docker方式).md) - - [搭建Ubuntu环境及编译(安装包方式)](搭建Ubuntu环境及编译(安装包方式).md) - - [镜像烧录](镜像烧录.md) - - [常见问题](常见问题-8.md) +- [标准系统入门](quickstart-standard.md) + - [入门介绍](quickstart-standard-description.md) + - [Windows开发环境准备](quickstart-standard-windows-environment.md) + - [搭建Ubuntu环境及编译(Docker方式)](quickstart-standard-docker-environment.md) + - [搭建Ubuntu环境及编译(安装包方式)](quickstart-standard-package-environment.md) + - [镜像烧录](quickstart-standard-burn.md) + - [常见问题](quickstart-standard-faq.md) diff --git a/zh-cn/device-dev/quick-start/figures/1.png b/zh-cn/device-dev/quick-start/figure/1.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/1.png rename to zh-cn/device-dev/quick-start/figure/1.png diff --git a/zh-cn/device-dev/quick-start/figures/10.png b/zh-cn/device-dev/quick-start/figure/10.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/10.png rename to zh-cn/device-dev/quick-start/figure/10.png diff --git a/zh-cn/device-dev/quick-start/figures/2.png b/zh-cn/device-dev/quick-start/figure/2.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/2.png rename to zh-cn/device-dev/quick-start/figure/2.png diff --git a/en/device-dev/quick-start/figures/2021-01-27_170334-18.png b/zh-cn/device-dev/quick-start/figure/2021-01-27_170334-16.png similarity index 100% rename from en/device-dev/quick-start/figures/2021-01-27_170334-18.png rename to zh-cn/device-dev/quick-start/figure/2021-01-27_170334-16.png diff --git a/zh-cn/device-dev/quick-start/figures/2021-01-27_170334-2.png b/zh-cn/device-dev/quick-start/figure/2021-01-27_170334-2.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/2021-01-27_170334-2.png rename to zh-cn/device-dev/quick-start/figure/2021-01-27_170334-2.png diff --git a/zh-cn/device-dev/quick-start/figures/2021-01-27_170334-5.png b/zh-cn/device-dev/quick-start/figure/2021-01-27_170334-5.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/2021-01-27_170334-5.png rename to zh-cn/device-dev/quick-start/figure/2021-01-27_170334-5.png diff --git a/zh-cn/device-dev/quick-start/figures/2021-01-27_170334.png b/zh-cn/device-dev/quick-start/figure/2021-01-27_170334.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/2021-01-27_170334.png rename to zh-cn/device-dev/quick-start/figure/2021-01-27_170334.png diff --git a/zh-cn/device-dev/quick-start/figures/3-0.png b/zh-cn/device-dev/quick-start/figure/3-0.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/3-0.png rename to zh-cn/device-dev/quick-start/figure/3-0.png diff --git a/zh-cn/device-dev/quick-start/figures/3.png b/zh-cn/device-dev/quick-start/figure/3.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/3.png rename to zh-cn/device-dev/quick-start/figure/3.png diff --git "a/zh-cn/device-dev/quick-start/figures/3516\346\255\243\351\235\242.png" "b/zh-cn/device-dev/quick-start/figure/3516\346\255\243\351\235\242.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/3516\346\255\243\351\235\242.png" rename to "zh-cn/device-dev/quick-start/figure/3516\346\255\243\351\235\242.png" diff --git "a/zh-cn/device-dev/quick-start/figures/3861\346\255\243\351\235\242.png" "b/zh-cn/device-dev/quick-start/figure/3861\346\255\243\351\235\242.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/3861\346\255\243\351\235\242.png" rename to "zh-cn/device-dev/quick-start/figure/3861\346\255\243\351\235\242.png" diff --git a/zh-cn/device-dev/quick-start/figures/4.png b/zh-cn/device-dev/quick-start/figure/4.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/4.png rename to zh-cn/device-dev/quick-start/figure/4.png diff --git a/zh-cn/device-dev/quick-start/figures/5-1.png b/zh-cn/device-dev/quick-start/figure/5-1.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/5-1.png rename to zh-cn/device-dev/quick-start/figure/5-1.png diff --git a/zh-cn/device-dev/quick-start/figures/5.png b/zh-cn/device-dev/quick-start/figure/5.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/5.png rename to zh-cn/device-dev/quick-start/figure/5.png diff --git a/zh-cn/device-dev/quick-start/figures/6.png b/zh-cn/device-dev/quick-start/figure/6.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/6.png rename to zh-cn/device-dev/quick-start/figure/6.png diff --git "a/zh-cn/device-dev/quick-start/figures/Hi3518EV300\345\215\225\346\235\277\346\255\243\351\235\242\345\244\226\350\247\202\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/Hi3518EV300\345\215\225\346\235\277\346\255\243\351\235\242\345\244\226\350\247\202\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/Hi3518EV300\345\215\225\346\235\277\346\255\243\351\235\242\345\244\226\350\247\202\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/Hi3518EV300\345\215\225\346\235\277\346\255\243\351\235\242\345\244\226\350\247\202\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/Hi3518\346\255\243\350\203\214\351\235\242.png" "b/zh-cn/device-dev/quick-start/figure/Hi3518\346\255\243\350\203\214\351\235\242.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/Hi3518\346\255\243\350\203\214\351\235\242.png" rename to "zh-cn/device-dev/quick-start/figure/Hi3518\346\255\243\350\203\214\351\235\242.png" diff --git "a/zh-cn/device-dev/quick-start/figures/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212.png" "b/zh-cn/device-dev/quick-start/figure/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212.png" rename to "zh-cn/device-dev/quick-start/figure/SCons\345\256\211\350\243\205\346\210\220\345\212\237\347\225\214\351\235\242-\347\211\210\346\234\254\350\246\201\346\261\2023-0-4\344\273\245\344\270\212.png" diff --git "a/zh-cn/device-dev/quick-start/figures/U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272\345\233\276.png" diff --git a/zh-cn/device-dev/quick-start/figures/changjian1-10.png b/zh-cn/device-dev/quick-start/figure/changjian1-10.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/changjian1-10.png rename to zh-cn/device-dev/quick-start/figure/changjian1-10.png diff --git a/zh-cn/device-dev/quick-start/figures/changjian1.png b/zh-cn/device-dev/quick-start/figure/changjian1.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/changjian1.png rename to zh-cn/device-dev/quick-start/figure/changjian1.png diff --git a/zh-cn/device-dev/quick-start/figures/chuankou1-6.png b/zh-cn/device-dev/quick-start/figure/chuankou1-6.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/chuankou1-6.png rename to zh-cn/device-dev/quick-start/figure/chuankou1-6.png diff --git a/zh-cn/device-dev/quick-start/figures/chuankou1.png b/zh-cn/device-dev/quick-start/figure/chuankou1.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/chuankou1.png rename to zh-cn/device-dev/quick-start/figure/chuankou1.png diff --git a/zh-cn/device-dev/quick-start/figures/qi1.png b/zh-cn/device-dev/quick-start/figure/qi1.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/qi1.png rename to zh-cn/device-dev/quick-start/figure/qi1.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001057335403.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001057335403.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001057335403.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001057335403.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001072468991.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001072468991.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001072468991.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001072468991.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001072757874.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001072757874.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001072757874.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001072757874.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001073840162.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001073840162.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001073840162.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001073840162.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001113969542.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001113969542.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001113969542.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001113969542.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001114129428.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001114129428.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001114129428.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001114129428.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001114129432.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001114129432.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001114129432.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001114129432.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001117463460.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001117463460.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001117463460.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001117463460.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001117621400.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001117621400.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001117621400.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001117621400.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311066.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311066.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311066.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311066.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311070.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311070.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311070.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311070.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311072.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311072.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311072.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311072.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311090.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311090.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311090.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311090.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311092.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311092.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311092.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311092.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311094.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311094.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311094.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311094.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311096.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311096.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311096.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311096.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311098.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311098.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311098.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311098.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311100.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311100.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311100.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311100.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311104.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311104.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311104.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311104.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311116.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311116.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311116.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311116.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311118.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311118.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128311118.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128311118.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470864.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470864.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470864.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470864.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470880.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470880.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470880.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470880.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470900.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470900.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470900.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470900.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470902.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470902.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470902.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470902.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470904.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470904.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470904.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470904.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470906.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470906.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470906.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470906.png diff --git a/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470908.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470908.png new file mode 100644 index 0000000000000000000000000000000000000000..8aa65e82be8db2e7de62fca8980d00ae42215d96 Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470908.png differ diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470922.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470922.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001128470922.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001128470922.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001130278040.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001130278040.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001130278040.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001130278040.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001130584312.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001130584312.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001130584312.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001130584312.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001142794291.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001142794291.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001142794291.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001142794291.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001142802505.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001142802505.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001142802505.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001142802505.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270699.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270699.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270699.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270699.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270713.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270713.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270713.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270713.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270715.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270715.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270715.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270715.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270727.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270727.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270727.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270727.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270729.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270729.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270729.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270729.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270731.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270731.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270731.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270731.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270733.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270733.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270733.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270733.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270735.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270735.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270735.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270735.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270737.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270737.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270737.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270737.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270739.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270739.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270739.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270739.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270743.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270743.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270743.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270743.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270749.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270749.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270749.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270749.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270751.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270751.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174270751.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174270751.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350615.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350615.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350615.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350615.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350623.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350623.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350623.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350623.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350633.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350633.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350633.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350633.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350641.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350641.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350641.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350641.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350643.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350643.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350643.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350643.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350647.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350647.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350647.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350647.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350649.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350649.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350649.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350649.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350651.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350651.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350651.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350651.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350653.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350653.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350653.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350653.png diff --git a/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350655.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350655.png new file mode 100644 index 0000000000000000000000000000000000000000..2f6e93e40bf4abee3c83aebf0c5f3299e51dc630 Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350655.png differ diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350659.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350659.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350659.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350659.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350661.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350661.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350661.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350661.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350669.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350669.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001174350669.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001174350669.png diff --git a/zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001176317561.png b/zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001176317561.png similarity index 100% rename from zh-cn/device-dev/quick-start/figures/zh-cn_image_0000001176317561.png rename to zh-cn/device-dev/quick-start/figure/zh-cn_image_0000001176317561.png diff --git "a/zh-cn/device-dev/quick-start/figures/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234-15.png" "b/zh-cn/device-dev/quick-start/figure/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234-15.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234-15.png" rename to "zh-cn/device-dev/quick-start/figure/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234-15.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234.png" "b/zh-cn/device-dev/quick-start/figure/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234.png" rename to "zh-cn/device-dev/quick-start/figure/\345\205\201\350\256\270Visual-Studio-Code\345\272\224\347\224\250\350\256\277\351\227\256\347\275\221\347\273\234.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257-9.png" "b/zh-cn/device-dev/quick-start/figure/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257-9.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257-9.png" rename to "zh-cn/device-dev/quick-start/figure/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257-9.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257.png" "b/zh-cn/device-dev/quick-start/figure/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257.png" rename to "zh-cn/device-dev/quick-start/figure/\345\205\263\351\227\255\344\270\262\345\217\243\347\273\210\347\253\257.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\345\220\257\345\212\250\345\271\266\346\210\220\345\212\237\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\345\220\257\345\212\250\345\271\266\346\210\220\345\212\237\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\345\220\257\345\212\250\345\271\266\346\210\220\345\212\237\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\345\220\257\345\212\250\345\271\266\346\210\220\345\212\237\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\345\220\257\345\212\250\346\210\220\345\212\237\345\271\266\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\345\220\257\345\212\250\346\210\220\345\212\237\345\271\266\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\345\220\257\345\212\250\346\210\220\345\212\237\345\271\266\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\345\220\257\345\212\250\346\210\220\345\212\237\345\271\266\346\211\247\350\241\214\345\272\224\347\224\250\347\250\213\345\272\217\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\210\252\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\346\210\252\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\210\252\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\346\210\252\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276-7.png" "b/zh-cn/device-dev/quick-start/figure/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276-7.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276-7.png" rename to "zh-cn/device-dev/quick-start/figure/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276-7.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\346\211\223\345\274\200\344\270\262\345\217\243\345\244\261\350\264\245\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276-14.png" "b/zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276-14.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276-14.png" rename to "zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276-14.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276Visual-Studio-Code\345\272\224\347\224\250\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257-8.png" "b/zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257-8.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257-8.png" rename to "zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257-8.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257.png" "b/zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257.png" rename to "zh-cn/device-dev/quick-start/figure/\346\237\245\346\211\276\346\230\257\345\220\246\345\255\230\345\234\250\345\215\240\347\224\250\344\270\262\345\217\243\347\232\204\347\273\210\347\253\257.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\346\240\207\345\207\206\347\216\257\345\242\203\345\277\253\351\200\237\345\205\245\351\227\250\346\265\201\347\250\213.png" "b/zh-cn/device-dev/quick-start/figure/\346\240\207\345\207\206\347\216\257\345\242\203\345\277\253\351\200\237\345\205\245\351\227\250\346\265\201\347\250\213.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\346\240\207\345\207\206\347\216\257\345\242\203\345\277\253\351\200\237\345\205\245\351\227\250\346\265\201\347\250\213.png" rename to "zh-cn/device-dev/quick-start/figure/\346\240\207\345\207\206\347\216\257\345\242\203\345\277\253\351\200\237\345\205\245\351\227\250\346\265\201\347\250\213.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" "b/zh-cn/device-dev/quick-start/figure/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" rename to "zh-cn/device-dev/quick-start/figure/\347\237\251\345\275\242\345\244\207\344\273\275-292.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276-3.png" "b/zh-cn/device-dev/quick-start/figure/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276-3.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276-3.png" rename to "zh-cn/device-dev/quick-start/figure/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276-3.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\347\241\254\344\273\266\350\277\236\347\272\277\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276-11.png" "b/zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276-11.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276-11.png" rename to "zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276-11.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\344\270\215\351\200\232-\345\215\225\346\235\277\346\227\240\346\263\225\350\216\267\345\217\226\346\226\207\344\273\266\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276-12.png" "b/zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276-12.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276-12.png" rename to "zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276-12.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\347\275\221\347\273\234\351\230\262\347\201\253\345\242\231\350\256\276\347\275\256\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\350\256\276\347\275\256\345\233\276\344\276\213-4.png" "b/zh-cn/device-dev/quick-start/figure/\350\256\276\347\275\256\345\233\276\344\276\213-4.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\350\256\276\347\275\256\345\233\276\344\276\213-4.png" rename to "zh-cn/device-dev/quick-start/figure/\350\256\276\347\275\256\345\233\276\344\276\213-4.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\350\256\276\347\275\256\345\233\276\344\276\213.png" "b/zh-cn/device-dev/quick-start/figure/\350\256\276\347\275\256\345\233\276\344\276\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\350\256\276\347\275\256\345\233\276\344\276\213.png" rename to "zh-cn/device-dev/quick-start/figure/\350\256\276\347\275\256\345\233\276\344\276\213.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276-13.png" "b/zh-cn/device-dev/quick-start/figure/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276-13.png" similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276-13.png" rename to "zh-cn/device-dev/quick-start/figure/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276-13.png" diff --git "a/zh-cn/device-dev/quick-start/figures/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276.png" "b/zh-cn/device-dev/quick-start/figure/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/figures/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276.png" rename to "zh-cn/device-dev/quick-start/figure/\351\230\262\347\201\253\345\242\231\345\222\214\347\275\221\347\273\234\344\277\235\346\212\244\347\225\214\351\235\242\345\233\276.png" diff --git "a/zh-cn/device-dev/quick-start/figures/3516\346\255\243\351\235\242-16.png" "b/zh-cn/device-dev/quick-start/figures/3516\346\255\243\351\235\242-16.png" deleted file mode 100644 index 6975fb5fef92e35dec2de84b7e7035a39794bdf4..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/quick-start/figures/3516\346\255\243\351\235\242-16.png" and /dev/null differ diff --git a/zh-cn/device-dev/quick-start/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/quick-start/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/quick-start/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/quick-start/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/quick-start/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/quick-start/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/quick-start/public_sys-resources/icon-note.gif b/zh-cn/device-dev/quick-start/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/quick-start/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/quick-start/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/quick-start/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/quick-start/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/quick-start/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/quick-start/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/quick-start/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/quick-start/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/quick-start/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/quick-start/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/quick-start/\346\246\202\350\277\260-0.md" b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-des.md similarity index 100% rename from "zh-cn/device-dev/quick-start/\346\246\202\350\277\260-0.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-env-setup-des.md diff --git "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230.md" b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-faqs.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-env-setup-faqs.md diff --git "a/zh-cn/device-dev/quick-start/Ubuntu\347\274\226\350\257\221\347\216\257\345\242\203\345\207\206\345\244\207.md" b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-lin.md old mode 100755 new mode 100644 similarity index 95% rename from "zh-cn/device-dev/quick-start/Ubuntu\347\274\226\350\257\221\347\216\257\345\242\203\345\207\206\345\244\207.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-env-setup-lin.md index 168c6184821b7c892def48d2f4c3ad5b6f055218..ddd8fd5f4fb8249098c4bf7d00ecb4d697e9cbaf --- "a/zh-cn/device-dev/quick-start/Ubuntu\347\274\226\350\257\221\347\216\257\345\242\203\345\207\206\345\244\207.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-lin.md @@ -26,10 +26,10 @@ 5. 安装LLVM 6. 安装hb ->![](public_sys-resources/icon-notice.gif) **须知:** ->- 针对Ubuntu编译环境我们提供了对应的Docker,该Docker封装了相关编译工具,选择使用Docker的开发者可跳过此章节。Docker使用可参考[Docker方式获取编译环境](../get-code/Docker编译环境.md)。 +>![](../public_sys-resources/icon-notice.gif) **须知:** +>- 针对Ubuntu编译环境我们提供了对应的Docker,该Docker封装了相关编译工具,选择使用Docker的开发者可跳过此章节。Docker使用可参考[Docker方式获取编译环境](../get-code/gettools-acquire.md)。 >- 通常系统默认安装samba、vim等常用软件,需要做适当适配以支持Linux服务器与Windows工作台之间的文件共享。 ->- 想要详细了解OpenHarmony编译构建模块功能的开发者可参考[编译构建使用指南](../subsystems/编译构建.md)。 +>- 想要详细了解OpenHarmony编译构建模块功能的开发者可参考[编译构建使用指南](../subsystems/subsys-build-mini-lite.md)。 ## 获取软件 @@ -50,7 +50,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 -

参数

@@ -350,13 +459,13 @@ if (ret != 0) { } ``` -## 向UART设备写入指定长度的数据 +### 向UART设备写入指定长度的数据 对应的接口函数如下所示: int32\_t UartWrite\(DevHandle handle, uint8\_t \*data, uint32\_t size\); -**表 7** UartWrite参数和返回值描述 +**表 8** UartWrite参数和返回值描述

参数

@@ -410,13 +519,13 @@ if (ret != 0) { } ``` -## 从UART设备中读取指定长度的数据 +### 从UART设备中读取指定长度的数据 对应的接口函数如下所示: int32\_t UartRead\(DevHandle handle, uint8\_t \*data, uint32\_t size\); -**表 8** UartRead参数和返回值描述 +**表 9** UartRead参数和返回值描述

参数

@@ -470,10 +579,10 @@ if (ret < 0) { } ``` ->![](public_sys-resources/icon-caution.gif) **注意:** +>![](../public_sys-resources/icon-caution.gif) **注意:** >UART返回值为非负值,表示UART读取成功。若返回值等于0,表示UART无有效数据可以读取。若返回值大于0,表示实际读取到的数据长度,该长度小于或等于传入的参数size的大小,并且不超过当前正在使用的UART控制器规定的最大单次读取数据长度的值。 -## 销毁UART设备句柄 +### 销毁UART设备句柄 UART通信完成之后,需要销毁UART设备句柄,函数如下所示: @@ -481,7 +590,7 @@ void UartClose\(DevHandle handle\); 该函数会释放申请的资源。 -**表 9** UartClose参数和返回值描述 +**表 10** UartClose参数和返回值描述

参数

@@ -504,3 +613,70 @@ void UartClose\(DevHandle handle\); UartClose(handle); /* 销毁UART设备句柄 * ``` +## 使用实例 + +UART设备完整的使用示例如下所示,首先获取UART设备句柄,接着设置波特率、设备属性和传输模式,之后进行UART通信,最后销毁UART设备句柄。 + +``` +#include "hdf_log.h" +#include "uart_if.h" + +void UartTestSample(void) +{ + int32_t ret; + uint32_t port; + DevHandle handle = NULL; + uint8_t wbuff[5] = { 1, 2, 3, 4, 5 }; + uint8_t rbuff[5] = { 0 }; + struct UartAttribute attribute; + attribute.dataBits = UART_ATTR_DATABIT_7; /* UART传输数据位宽,一次传输7个bit */ + attribute.parity = UART_ATTR_PARITY_NONE; /* UART传输数据无校检 */ + attribute.stopBits = UART_ATTR_STOPBIT_1; /* UART传输数据停止位为1位 */ + attribute.rts = UART_ATTR_RTS_DIS; /* UART禁用RTS */ + attribute.cts = UART_ATTR_CTS_DIS; /* UART禁用CTS */ + attribute.fifoRxEn = UART_ATTR_RX_FIFO_EN; /* UART使能RX FIFO */ + attribute.fifoTxEn = UART_ATTR_TX_FIFO_EN; /* UART使能TX FIFO */ + /* UART设备端口号,要填写实际平台上的端口号 */ + port = 1; + /* 获取UART设备句柄 */ + handle = UartOpen(port); + if (handle == NULL) { + HDF_LOGE("UartOpen: failed!\n"); + return; + } + /* 设置UART波特率为9600 */ + ret = UartSetBaud(handle, 9600); + if (ret != 0) { + HDF_LOGE("UartSetBaud: failed, ret %d\n", ret); + goto _ERR; + } + /* 设置UART设备属性 */ + ret = UartSetAttribute(handle, &attribute); + if (ret != 0) { + HDF_LOGE("UartSetAttribute: failed, ret %d\n", ret); + goto _ERR; + } + /* 设置UART传输模式为非阻塞模式 */ + ret = UartSetTransMode(handle, UART_MODE_RD_NONBLOCK); + if (ret != 0) { + HDF_LOGE("UartSetTransMode: failed, ret %d\n", ret); + goto _ERR; + } + /* 向UART设备写入5字节的数据 */ + ret = UartWrite(handle, wbuff, 5); + if (ret != 0) { + HDF_LOGE("UartWrite: failed, ret %d\n", ret); + goto _ERR; + } + /* 从UART设备读取5字节的数据 */ + ret = UartRead(handle, rbuff, 5); + if (ret < 0) { + HDF_LOGE("UartRead: failed, ret %d\n", ret); + goto _ERR; + } +_ERR: + /* 销毁UART设备句柄 */ + UartClose(handle); +} +``` + diff --git "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/driver/driver-platform-watchdog-des.md old mode 100755 new mode 100644 similarity index 68% rename from "zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/driver/driver-platform-watchdog-des.md index b8fd5753d462e8fd80df1f64d6d757d385d3998f..b6eba28de3581722b16b58ed7a4e31e6b7054362 --- "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/driver/driver-platform-watchdog-des.md @@ -1,31 +1,112 @@ -# 看门狗使用指导 +# WATCHDOG -- [使用流程](#section0719414187) -- [打开看门狗设备](#section198171379261) -- [获取看门狗状态](#section206592910275) -- [设置超时时间](#section19605128182714) -- [获取超时时间](#section11111516208) -- [启动看门狗](#section141174192814) -- [喂狗](#section179101435113910) -- [停止看门狗](#section15282123192816) -- [关闭看门狗设备](#section7857850173411) +- [概述](#section14918241977) + - [接口说明](#section20177131219818) -## 使用流程 +- [使用指导](#section10103184312813) + - [使用流程](#section10181195910815) + - [打开看门狗设备](#section66089201107) + - [获取看门狗状态](#section786624341011) + - [设置超时时间](#section182386137111) + - [获取超时时间](#section1883310371114) + - [启动看门狗](#section82501405123) + - [喂狗](#section3547530101211) + - [停止看门狗](#section944595841217) + - [关闭看门狗设备](#section96561824121311) + +- [使用实例](#section1724514523135) + +## 概述 + +看门狗(watchdog),又叫看门狗计时器(watchdog timer),是一种硬件的计时设备,当系统的主程序发生某些错误时,导致未及时清除看门狗计时器的计时值,这时看门狗计时器就会对系统发出复位信号,使系统从悬停状态恢复到正常运作状态。 + +### 接口说明 + +**表 1** 看门狗 API接口功能介绍 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

功能分类

+

接口名

+

描述

+

打开/关闭看门狗

+

WatchdogOpen

+

打开看门狗设备

+

WatchdogClose

+

关闭看门狗设备

+

启动/停止看门狗

+

WatchdogStart

+

启动看门狗

+

WatchdogStop

+

停止看门狗

+

设置/获取超时时间

+

WatchdogSetTimeout

+

设置看门狗超时时间

+

WatchdogGetTimeout

+

获取看门狗超时时间

+

获取看门狗状态

+

WatchdogGetStatus

+

获取看门狗状态

+

清除看门狗定时器

+

WatchdogFeed

+

清除看门狗定时器(喂狗)

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>本文涉及看门狗的所有接口,仅限内核态使用,不支持在用户态使用。 + +## 使用指导 + +### 使用流程 使用看门狗的一般流程如[图1](#fig19134125410189)所示。 **图 1** 看门狗使用流程图 -![](figures/zh-cn_image_0000001057622716.png) +![](figure/zh-cn_image_0000001170229891.png) -## 打开看门狗设备 +### 打开看门狗设备 在操作看门狗之前,需要使用WatchdogOpen打开一个看门狗设备,一个系统可能有多个看门狗,通过ID号来打开指定的看门狗设备: int32\_t WatchdogOpen\(int16\_t wdtId\); -**表 1** WatchdogOpen参数和返回值描述 +**表 2** WatchdogOpen参数和返回值描述

参数

@@ -66,11 +147,11 @@ if (handle == NULL) { } ``` -## 获取看门狗状态 +### 获取看门狗状态 int32\_t WatchdogGetStatus\(DevHandle handle, int32\_t \*status\); -**表 2** WatchdogGetStatus参数和返回值描述 +**表 3** WatchdogGetStatus参数和返回值描述

参数

@@ -118,11 +199,11 @@ if (ret != 0) { } ``` -## 设置超时时间 +### 设置超时时间 int32\_t WatchdogSetTimeout\(PalHandle \*handle, uint32\_t seconds\); -**表 3** WatchdogSetTimeout参数和返回值描述 +**表 4** WatchdogSetTimeout参数和返回值描述

参数

@@ -170,11 +251,11 @@ if (ret != 0) { } ``` -## 获取超时时间 +### 获取超时时间 int32\_t WatchdogGetTimeout\(PalHandle \*handle, uint32\_t \*seconds\); -**表 4** WatchdogGetTimeout参数和返回值描述 +**表 5** WatchdogGetTimeout参数和返回值描述

参数

@@ -222,11 +303,11 @@ if (ret != 0) { } ``` -## 启动看门狗 +### 启动看门狗 int32\_t WatchdogStart\(DevHandle handle\); -**表 5** WatchdogStart参数和返回值描述 +**表 6** WatchdogStart参数和返回值描述

参数

@@ -268,11 +349,11 @@ if (ret != 0) { } ``` -## 喂狗 +### 喂狗 int32\_t WatchdogFeed\(DevHandle handle\); -**表 6** WatchdogFeed参数和返回值描述 +**表 7** WatchdogFeed参数和返回值描述

参数

@@ -314,11 +395,11 @@ if (ret != 0) { } ``` -## 停止看门狗 +### 停止看门狗 int32\_t WatchdogStop\(DevHandle handle\); -**表 7** WatchdogStop参数和返回值描述 +**表 8** WatchdogStop参数和返回值描述

参数

@@ -358,16 +439,15 @@ if (ret != 0) { HDF_LOGE("WatchdogStop: failed, ret %d\n", ret); return; } - ``` -## 关闭看门狗设备 +### 关闭看门狗设备 当操作完毕时,使用WatchdogClose关闭打开的设备句柄: void WatchdogClose\(DevHandle handle\); -**表 8** WatchdogClose参数和返回值描述 +**表 9** WatchdogClose参数和返回值描述

参数

@@ -389,3 +469,89 @@ void WatchdogClose\(DevHandle handle\); ret = WatchdogClose(handle); ``` +## 使用实例 + +本例程提供看门狗的完整使用流程。 + +在本例程中,我们打开一个看门狗设备,设置超时时间并启动计时: + +- 首先定期喂狗,即按时清除看门狗定时器,确保系统不会因定时器超时而复位。 +- 接着再停止喂狗,观察定时器到期后系统是否发生复位行为。 + +示例如下: + +``` +#include "watchdog_if.h" +#include "hdf_log.h" +#include "osal_irq.h" +#include "osal_time.h" + +#define WATCHDOG_TEST_TIMEOUT 2 +#define WATCHDOG_TEST_FEED_TIME 6 + +static int32_t TestCaseWatchdog(void) +{ + int32_t i; + int32_t ret; + uint32_t timeout; + DevHandle handle = NULL; + + /* 打开0号看门狗设备 */ + handle = WatchdogOpen(0); + if (handle == NULL) { + HDF_LOGE("Open watchdog fail!"); + return -1; + } + + /* 设置超时时间 */ + ret = WatchdogSetTimeout(handle, WATCHDOG_TEST_TIMEOUT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: set timeout fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + + /* 回读设置的超时时间值 */ + ret = WatchdogGetTimeout(handle, &timeout); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: get timeout fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + HDF_LOGI("%s: read timeout back:%u\n", __func__, timeout); + + /* 启动看门狗,开始计时 */ + ret = WatchdogStart(handle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + + /* 每隔1S喂狗一次 */ + for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { + HDF_LOGE("%s: feeding watchdog %d times... \n", __func__, i); + ret = WatchdogFeed(handle); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: feed dog fail! ret:%d\n", __func__, ret); + WatchdogClose(handle); + return ret; + } + OsalSleep(1); + } + /* 由于喂狗间隔小于超时时间,系统不会发生复位,此日志可以正常打印 */ + HDF_LOGE("%s: no reset ... feeding test OK!!!\n", __func__); + + /* 接下来持续不喂狗,使得看门狗计时器超时 */ + for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { + HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); + OsalSleep(1); + } + + /* 当不喂狗时间到达之前设定的超时时间的时候,系统会发生复位,理论上观察不到此日志的打印 */ + HDF_LOGE("%s: dog has't buck!!! \n", __func__, i); + WatchdogClose(handle); + return -1; +} +``` + 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 0000000000000000000000000000000000000000..a05dec17675ce06876d0550e383413fd53d07a71 --- /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 0000000000000000000000000000000000000000..a0825c12d1ed8456318aca70316eaf6500251dab --- /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/driver/figures/DSI\345\217\221\351\200\201-\346\216\245\346\224\266\346\216\245\345\217\243.png" "b/zh-cn/device-dev/driver/figure/DSI\345\217\221\351\200\201-\346\216\245\346\224\266\346\216\245\345\217\243.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/DSI\345\217\221\351\200\201-\346\216\245\346\224\266\346\216\245\345\217\243.png" rename to "zh-cn/device-dev/driver/figure/DSI\345\217\221\351\200\201-\346\216\245\346\224\266\346\216\245\345\217\243.png" diff --git "a/zh-cn/device-dev/driver/figures/I2C\347\211\251\347\220\206\350\277\236\347\272\277\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/driver/figure/I2C\347\211\251\347\220\206\350\277\236\347\272\277\347\244\272\346\204\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/I2C\347\211\251\347\220\206\350\277\236\347\272\277\347\244\272\346\204\217\345\233\276.png" rename to "zh-cn/device-dev/driver/figure/I2C\347\211\251\347\220\206\350\277\236\347\272\277\347\244\272\346\204\217\345\233\276.png" diff --git "a/zh-cn/device-dev/driver/figures/MIPI-DSI\346\216\245\345\217\243.png" "b/zh-cn/device-dev/driver/figure/MIPI-DSI\346\216\245\345\217\243.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/MIPI-DSI\346\216\245\345\217\243.png" rename to "zh-cn/device-dev/driver/figure/MIPI-DSI\346\216\245\345\217\243.png" diff --git "a/zh-cn/device-dev/driver/figures/Sensor\351\251\261\345\212\250\346\250\241\345\236\213\345\233\276.png" "b/zh-cn/device-dev/driver/figure/Sensor\351\251\261\345\212\250\346\250\241\345\236\213\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/Sensor\351\251\261\345\212\250\346\250\241\345\236\213\345\233\276.png" rename to "zh-cn/device-dev/driver/figure/Sensor\351\251\261\345\212\250\346\250\241\345\236\213\345\233\276.png" diff --git "a/zh-cn/device-dev/driver/figures/TTL\346\216\245\345\217\243.png" "b/zh-cn/device-dev/driver/figure/TTL\346\216\245\345\217\243.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/TTL\346\216\245\345\217\243.png" rename to "zh-cn/device-dev/driver/figure/TTL\346\216\245\345\217\243.png" diff --git "a/zh-cn/device-dev/driver/figures/Touchscreen\345\231\250\344\273\266\345\270\270\347\224\250\347\256\241\350\204\232.png" "b/zh-cn/device-dev/driver/figure/Touchscreen\345\231\250\344\273\266\345\270\270\347\224\250\347\256\241\350\204\232.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/Touchscreen\345\231\250\344\273\266\345\270\270\347\224\250\347\256\241\350\204\232.png" rename to "zh-cn/device-dev/driver/figure/Touchscreen\345\231\250\344\273\266\345\270\270\347\224\250\347\256\241\350\204\232.png" diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001053405727.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001053405727.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001053405727.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001053405727.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054280608.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001054280608.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054280608.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001054280608.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054564784.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001054564784.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054564784.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001054564784.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001057902344.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123509750.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001057902344.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123509750.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001072553354.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123514210.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001072553354.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123514210.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054440624.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123540984.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054440624.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123540984.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054007499.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123582482.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054007499.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123582482.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054728498.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123675706.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054728498.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123675706.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054726248.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123703482.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054726248.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123703482.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054142582.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001123742254.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054142582.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001123742254.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001057342245.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001170187071.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001057342245.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001170187071.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001054006983.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001170227689.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001054006983.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001170227689.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001057622716.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001170229891.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001057622716.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001170229891.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001053926237.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001170262141.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001053926237.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001170262141.png diff --git a/zh-cn/device-dev/driver/figures/zh-cn_image_0000001055299108.png b/zh-cn/device-dev/driver/figure/zh-cn_image_0000001170383063.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/driver/figures/zh-cn_image_0000001055299108.png rename to zh-cn/device-dev/driver/figure/zh-cn_image_0000001170383063.png diff --git "a/zh-cn/device-dev/driver/figures/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204Display\351\251\261\345\212\250\346\250\241\345\236\213.png" "b/zh-cn/device-dev/driver/figure/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204Display\351\251\261\345\212\250\346\250\241\345\236\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204Display\351\251\261\345\212\250\346\250\241\345\236\213.png" rename to "zh-cn/device-dev/driver/figure/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204Display\351\251\261\345\212\250\346\250\241\345\236\213.png" diff --git "a/zh-cn/device-dev/driver/figures/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204input\351\251\261\345\212\250\346\250\241\345\236\213.png" "b/zh-cn/device-dev/driver/figure/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204input\351\251\261\345\212\250\346\250\241\345\236\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204input\351\251\261\345\212\250\346\250\241\345\236\213.png" rename to "zh-cn/device-dev/driver/figure/\345\237\272\344\272\216HDF\351\251\261\345\212\250\346\241\206\346\236\266\347\232\204input\351\251\261\345\212\250\346\250\241\345\236\213.png" diff --git "a/zh-cn/device-dev/driver/figures/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" "b/zh-cn/device-dev/driver/figure/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/driver/figures/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" rename to "zh-cn/device-dev/driver/figure/\346\216\245\345\217\243\345\210\206\345\270\203\345\233\2764.png" diff --git a/zh-cn/device-dev/driver/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/driver/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/driver/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/driver/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/driver/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/driver/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/driver/public_sys-resources/icon-note.gif b/zh-cn/device-dev/driver/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/driver/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/driver/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/driver/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/driver/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/driver/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/driver/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/driver/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/driver/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/driver/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/driver/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\345\256\236\344\276\213.md" deleted file mode 100755 index 2222c0fde7eae0be2288c10291da6172cf688401..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\345\256\236\344\276\213.md" +++ /dev/null @@ -1,583 +0,0 @@ -# 传感器驱动开发实例 - -基于HDF驱动模型,加载启动加速度计传感器驱动,代码形式如下,具体原理可参考[HDF驱动开发指南](驱动开发.md)。加速度传感器选择通讯接口方式为I2C,厂家选择博世BMI160加速度传感器。 - -1. 加速度计传感器驱动入口注册 - -- 加速度计传感器驱动入口函数实现 - -``` -/* 注册加速度计传感器入口数据结构体对象 */ -struct HdfDriverEntry g_sensorAccelDevEntry = { - .moduleVersion = 1, /* 加速度计传感器模块版本号 */ - .moduleName = "HDF_SENSOR_ACCEL", /* 加速度计传感器模块名,要与device_info.hcs文件里的加速度计moduleName字段值一样*/ - .Bind = BindAccelDriver, /* 加速度计传感器绑定函数 */ - .Init = InitAccelDriver, /* 加速度计传感器初始化函数 */ - .Release = ReleaseAccelDriver, /* 加速度计传感器资源释放函数 */ -}; - -/* 调用HDF_INIT将驱动入口注册到HDF框架中,在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动,当Init调用异常时,HDF框架会调用Release释放驱动资源并退出 */ -HDF_INIT(g_sensorAccelDevEntry); -``` - -- 加速度计传感器设备配置描述 - -加速度传感器模型使用HCS作为配置描述源码,HCS配置字段详细介绍参考[配置管理](配置管理.md)介绍。 - -``` -/* 加速度计传感器设备HCS配置 */ -device_sensor_accel :: device { - device0 :: deviceNode { - policy = 1; /* policy字段是驱动服务发布的策略 */ - priority = 105; /* 驱动启动优先级(0-200),值越大优先级越低,建议默认配100,优先级相同则不保证device的加载顺序 */ - preload = 2; /* 驱动按需加载字段,0表示加载,2表示不加载 */ - permission = 0664; /* 驱动创建设备节点权限 */ - moduleName = "HDF_SENSOR_ACCEL"; /* 驱动名称,该字段的值必须和驱动入口结构的moduleName值一致 */ - serviceName = "sensor_accel"; /* 驱动对外发布服务的名称,必须唯一 */ - deviceMatchAttr = "hdf_sensor_accel_driver"; /* 驱动私有数据匹配的关键字,必须和驱动私有数据配置表中的match_attr值相等 */ - } -} -``` - -1. 加速度计传感器驱动初始化和去初始化 - -- 初始化入口函数init - -``` -/* 加速度计传感器驱动对外提供的服务绑定到HDF框架 */ -int32_t BindAccelDriver(struct HdfDeviceObject *device) -{ - CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); - - static struct IDeviceIoService service = { - .object = {0}, - .Dispatch = DispatchAccel, - }; - device->service = &service; - - return HDF_SUCCESS; -} -/*在探测到器件在位后,需要调用RegisterAccelChipOps注册差异化适配函数*/ -int32_t RegisterAccelChipOps(struct AccelOpsCall *ops) -{ - struct AccelDrvData *drvData = NULL; - - CHECK_NULL_PTR_RETURN_VALUE(ops, HDF_ERR_INVALID_PARAM); - - drvData = AccelGetDrvData(); - drvData->ops.Init = ops->Init; - drvData->ops.ReadData = ops->ReadData; - return HDF_SUCCESS; -} -/* 挂载加速度计传感器驱动归一化的接口函数 */ -static int32_t InitAccelOps(struct SensorDeviceInfo *deviceInfo) -{ - struct AccelDrvData *drvData = AccelGetDrvData(); - - (void)memset_s((void *)deviceInfo, sizeof(*deviceInfo), 0, sizeof(*deviceInfo)); - deviceInfo->ops.GetInfo = SetAccelInfo; - deviceInfo->ops.Enable = SetAccelEnable; - deviceInfo->ops.Disable = SetAccelDisable; - deviceInfo->ops.SetBatch = SetAccelBatch; - deviceInfo->ops.SetMode = SetAccelMode; - deviceInfo->ops.SetOption = SetAccelOption; - - if (memcpy_s(&deviceInfo->sensorInfo, sizeof(deviceInfo->sensorInfo), - &drvData->accelCfg->sensorInfo, sizeof(drvData->accelCfg->sensorInfo)) != EOK) { - HDF_LOGE("%s: copy sensor info failed", __func__); - return HDF_FAILURE; - } - /* 传感器类型标识可以在数据HCS配置文件里面配置,也可以在此处 */ - drvData->accelCfg->sensorInfo.sensorTypeId = SENSOR_TAG_ACCELEROMETER; - drvData->accelCfg->sensorInfo.sensorId = SENSOR_TAG_ACCELEROMETER; - - return HDF_SUCCESS; -} -/* 传感器寄存器初始化操作 */ -static int32_t InitAccelAfterConfig(void) -{ - struct SensorDeviceInfo deviceInfo; - - if (InitAccelConfig() != HDF_SUCCESS) { - HDF_LOGE("%s: init accel config failed", __func__); - return HDF_FAILURE; - } - - if (InitAccelOps(&deviceInfo) != HDF_SUCCESS) { - HDF_LOGE("%s: init accel ops failed", __func__); - return HDF_FAILURE; - } - - if (AddSensorDevice(&deviceInfo) != HDF_SUCCESS) { - HDF_LOGE("%s: add accel device failed", __func__); - return HDF_FAILURE; - } - - return HDF_SUCCESS; -} -/*通过器件探测函数,挂载器件差异化函数接口*/ -static int32_t DetectAccelChip(void) -{ - int32_t num; - int32_t ret; - int32_t loop; - struct AccelDrvData *drvData = AccelGetDrvData(); - CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); - - num = sizeof(g_accelDetectIfList) / sizeof(g_accelDetectIfList[0]); - for (loop = 0; loop < num; ++loop) { - if (g_accelDetectIfList[loop].DetectChip != NULL) { - ret = g_accelDetectIfList[loop].DetectChip(drvData->accelCfg); - if (ret == HDF_SUCCESS) { - drvData->detectFlag = true; - break; - } - } - } - - if (loop == num) { - HDF_LOGE("%s: detect accel device failed", __func__); - drvData->detectFlag = false; - return HDF_FAILURE; - } - return HDF_SUCCESS; -} -/* 加速度计传感器驱动初始化入口函数,主要功能为对传感器私有数据的结构体对象进行初始化,传感器HCS数据配置对象空间分配,传感器HCS数据配置初始化入口函数调用,传感器设备探测是否在位功能,传感器数据上报定时器创建,传感器归一化接口挂载,传感器设备注册功能 */ -int32_t InitAccelDriver(struct HdfDeviceObject *device) -{ - /* 获取传感器私有数据结构体对象 */ - struct AccelDrvData *drvData = AccelGetDrvData(); - - /* 同类型传感器不同厂家设备探测时,判断此类型传感器是否已经在位,若已经在位,无需再继续探测,直接返回 */ - if (drvData->detectFlag) { - HDF_LOGE("%s: accel sensor have detected", __func__); - return HDF_SUCCESS; - } - - CHECK_NULL_PTR_RETURN_VALUE(device, HDF_ERR_INVALID_PARAM); - /* 分配存放传感器数据配置的私有结构体数据对象,需要在驱动释放时释放分配的资源空间 */ - drvData->accelCfg = (struct SensorCfgData *)OsalMemCalloc(sizeof(*cfg)); - if (drvData->accelCfg == NULL) { - HDF_LOGE("%s: malloc sensor config data failed", __func__); - return HDF_FAILURE; - } - - drvData->accelCfg->regCfgGroup = &g_regCfgGroup[0]; - /* 初始化传感器配置数据主要是解析传感器通讯总线配置类型信息,传感器基本信息,传感器属性信息,传感器是否在位信息,寄存器分组信息 */ - if (GetSensorBaseConfigData(device->property, drvData->accelCfg) != HDF_SUCCESS) { - HDF_LOGE("%s: get sensor base config failed", __func__); - goto Base_CONFIG_EXIT; - } - - if (DetectAccelChip() != HDF_SUCCESS) { - HDF_LOGE("%s: accel sensor detect device no exist", __func__); - goto DETECT_CHIP_EXIT; - } - drvData->detectFlag = true; - if (ParseSensorRegConfig(drvData->accelCfg) != HDF_SUCCESS) { - HDF_LOGE("%s: detect sensor device failed", __func__); - goto REG_CONFIG_EXIT; - } - - if (InitAccelAfterConfig() != HDF_SUCCESS) { - HDF_LOGE("%s: init accel after config failed", __func__); - goto INIT_EXIT; - } - - HDF_LOGI("%s: init accel driver success", __func__); - return HDF_SUCCESS; - -INIT_EXIT: - DestroySensorThread(&drvData->thread, &drvData->threadStatus); - (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); -REG_CONFIG_EXIT: - ReleaseSensorAllRegConfig(drvData->accelCfg); - (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); -DETECT_CHIP_EXIT: - drvData->detectFlag = false; -BASE_CONFIG_EXIT: - drvData->accelCfg->root = NULL; - drvData->accelCfg->regCfgGroup = NULL; - OsalMemFree(drvData->accelCfg); - drvData->accelCfg = NULL; - return HDF_FAILURE; -} - -/* 释放驱动初始化时分配的资源 */ -void ReleaseAccelDriver(struct HdfDeviceObject *device) -{ - (void)device; - struct AccelDrvData *drvData = NULL; - - drvData = AccelGetDrvData(); - (void)DestroySensorThread(&drvData->thread, &drvData->threadStatus); - (void)DeleteSensorDevice(SENSOR_TAG_ACCELEROMETER); - drvData->detectFlag = false; - - if (drvData->accelCfg != NULL) { - drvData->accelCfg->root = NULL; - drvData->accelCfg->regCfgGroup = NULL; - ReleaseSensorAllRegConfig(drvData->accelCfg); - (void)ReleaseSensorBusHandle(&drvData->accelCfg->busCfg); - OsalMemFree(drvData->accelCfg); - drvData->accelCfg = NULL; - } - - drvData->initStatus = false; -} -``` - -1. 加速度计传感器寄存器组配置信息 - -加速度计传感器数据配置只需要按照模板配置即可,基于模板配置的解析功能已经在**InitSensorConfigData**函数完成,只需初始化时调用即可。如果有新增配置项,需要同步修改此函数。 - -``` -加速度传感器数据配置模板(accel_config.hcs) -root { - sensorAccelConfig { - accelChipConfig { - /* 传感器设备信息模板 */ - template sensorInfo { - sensorName = "accelerometer"; /* 加速度计名字,字符最大长度16字节 */ - vendorName = "borsh_bmi160"; /* 传感器设备厂商,字符最大长度16字节 */ - firmwareVersion = "1.0"; /* 传感器固件版本号,默认1.0,字符最大长度16字节 */ - hardwareVersion = "1.0"; /* 传感器硬件版本号,默认1.0,字符最大长度16字节 */ - sensorTypeId = 1; /* 传感器类型编号,详见{@link SensorTypeTag} */ - sensorId = 1; /* 传感器的标识号,有传感器驱动开发者定义,推荐用{@link SensorTypeTag}枚举 */ - maxRange = 8; /* 传感器的最大量程,根据开发者需要配置 */ - precision = 0; /* 传感器的精度,与上报数据配合使用,上报数据结构体{@link SensorEvents } */ - power = 230; /* 传感器的功耗 */ - } - /* 传感器使用的总线类型和配置信息模板 */ - template sensorBusConfig { - busType = 0; /* 0:i2c 1:spi */ - busNum = 6; /* 芯片上分配给传感器的器件号 */ - busAddr = 0; /* 芯片上分配给传感器的地址 */ - regWidth = 1; /* 传感器寄存器地址宽度 */ - regBigEndian = 0; /* 传感器寄存器大小端 */ - } - /* 传感器设备属性模板 */ - template sensorAttr { - chipName = ""; /* 传感器芯片名字 */ - chipIdRegister = 0xf; /* 传感器在位检测寄存器地址 */ - chipIdValue = 0xd1; /* 校验传感器在位检测寄存器值 */ - } - } - } -} - -/* 根据不同器件硬件差异,修改模板配置,不修改的就会默认采用模板配置 */ -root { - sensorAccelConfig { - accel_bmi160_chip_config : accelChipConfig { - match_attr = "hdf_sensor_accel_driver"; /* 需要和加速度传感器设备配置match_attr字段保持一致 */ - accelInfo :: sensorInfo { - vendorName = "borsh_bmi160"; - sensorTypeId = 1; - sensorId = 1; - } - accelBusConfig :: sensorBusConfig { - busType = 0; /* i2c通讯方式 */ - busNum = 6; - busAddr = 0x68; - regWidth = 1; /* 1字节位宽 */ - } - accelAttr :: sensorAttr { - chipName = "bmi160"; - chipIdRegister = 0x00; - chipIdValue = 0xd1; - } - accelRegConfig { - /* regAddr: 寄存器地址 - value: 寄存器值 - mask: 寄存器值的掩码 - len: 寄存器值的数据长度(字节) - delay: 配置寄存器延时(ms) - opsType:操作类型 0-无 1-读 2-写 3-读并检查 4-位更新 - calType: 计算类型 0-无 1-写 2-取反 3-异或 4-左移 5-右移 - shiftNum: 移动位数 - debug: 调试开关,0-调试关闭 1-调试打开 - save: 保存数据开关,0-不保存数据 1-保存数据 - */ - /* 传感器寄存器操作分组,按照分组进行有序配置 */ - /* 寄存器地址, 寄存器值, 寄存器值的掩码, 寄存器值的数据长度, 配置寄存器延时, 操作类型, 计算类型, 移动位数, 调试开关, 保存开关 */ - /* 初始化寄存器组 */ - initSeqConfig = [ - 0x7e, 0xb6, 0xff, 1, 5, 2, 0, 0, 0, 0, - 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 - ]; - /* 使能寄存器组 */ - enableSeqConfig = [ - 0x7e, 0x11, 0xff, 1, 5, 2, 0, 0, 0, 0, - 0x41, 0x03, 0xff, 1, 0, 2, 0, 0, 0, 0, - 0x40, 0x08, 0xff, 1, 0, 2, 0, 0, 0, 0 - ]; - /* 去使能寄存器组 */ - disableSeqConfig = [ - 0x7e, 0x10, 0xff, 1, 5, 2, 0, 0, 0, 0 - ]; - } - } - } -} -``` - -1. 加速度计传感器驱动操作接口实现 - -开发者需要根据每种类型的传感器实现归一化接口。 - -``` -/* 不使用函数暂时置空 */ -static int32_t SetAccelInfo(struct SensorBasicInfo *info) -{ - (void)info; - - return HDF_ERR_NOT_SUPPORT; -} -/* 下发使能寄存器组的配置 */ -static int32_t SetAccelEnable(void) -{ - int32_t ret; - struct AccelDrvData *drvData = AccelGetDrvData(); - - CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); - ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_ENABLE_GROUP]); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel sensor disable config failed", __func__); - return HDF_FAILURE; - } - - drvData->threadStatus = SENSOR_THREAD_RUNNING; - - return HDF_SUCCESS; -} -/* 下发去使能寄存器组的配置 */ -static int32_t SetAccelDisable(void) -{ - int32_t ret; - struct AccelDrvData *drvData = AccelGetDrvData(); - - CHECK_NULL_PTR_RETURN_VALUE(drvData->accelCfg, HDF_ERR_INVALID_PARAM); - - ret = SetSensorRegCfgArray(&drvData->accelCfg->busCfg, drvData->accelCfg->regCfgGroup[SENSOR_DISABLE_GROUP]); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel sensor disable config failed", __func__); - return HDF_FAILURE; - } - - drvData->threadStatus = SENSOR_THREAD_STOPPED; - - return HDF_SUCCESS; -} -/* 配置传感器采样率和数据上报间隔 */ -static int32_t SetAccelBatch(int64_t samplingInterval, int64_t interval) -{ - (void)interval; - - struct AccelDrvData *drvData = AccelGetDrvData(); - drvData->interval = samplingInterval; - - return HDF_SUCCESS; -} -/* 设置传感器工作模式,当前支持实时模式 */ -static int32_t SetAccelMode(int32_t mode) -{ - return (mode == SENSOR_WORK_MODE_REALTIME) ? HDF_SUCCESS : HDF_FAILURE; -} -/* 设置传感器可选配置 */ -static int32_t SetAccelOption(uint32_t option) -{ - (void)option; - return HDF_ERR_NOT_SUPPORT; -} -``` - -- 差异化处理接口 - - ``` - /* 器件探测时,如果探测成功,则注册差异化处理函数到accel驱动模型里 */ - int32_t DetectAccelBim160Chip(struct SensorCfgData *data) - { - int32_t ret; - struct AccelOpsCall ops; - CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); - - if (strcmp(ACCEL_CHIP_NAME_BMI160, data->sensorAttr.chipName) != 0) { - return HDF_SUCCESS; - } - ret = InitAccelPreConfig(); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: init BMI160 bus mux config", __func__); - return HDF_FAILURE; - } - if (DetectSensorDevice(data) != HDF_SUCCESS) { - return HDF_FAILURE; - } - - /* 差异化处理函数 */ - ops.Init = InitBmi160; - ops.ReadData = ReadBmi160Data; - ret = RegisterAccelChipOps(&ops); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: register BMI160 accel failed", __func__); - (void)ReleaseSensorBusHandle(&data->busCfg); - return HDF_FAILURE; - } - return HDF_SUCCESS; - } - /* 初始化处理函数 */ - static int32_t InitBmi160(struct SensorCfgData *data) - { - int32_t ret; - - CHECK_NULL_PTR_RETURN_VALUE(data, HDF_ERR_INVALID_PARAM); - ret = SetSensorRegCfgArray(&data->busCfg, data->regCfgGroup[SENSOR_INIT_GROUP]); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: bmi160 sensor init config failed", __func__); - return HDF_FAILURE; - } - return HDF_SUCCESS; - } - /* 数据处理函数 */ - int32_t ReadBmi160Data(struct SensorCfgData *data) - { - int32_t ret; - struct AccelData rawData = { 0, 0, 0 }; - int32_t tmp[ACCEL_AXIS_NUM]; - struct SensorReportEvent event; - - (void)memset_s(&event, sizeof(event), 0, sizeof(event)); - - ret = ReadBmi160RawData(data, &rawData, &event.timestamp); - if (ret != HDF_SUCCESS) { - return HDF_FAILURE; - } - - event.sensorId = SENSOR_TAG_ACCELEROMETER; - event.option = 0; - event.mode = SENSOR_WORK_MODE_REALTIME; - - rawData.x = rawData.x * BMI160_ACC_SENSITIVITY_2G; - rawData.y = rawData.y * BMI160_ACC_SENSITIVITY_2G; - rawData.z = rawData.z * BMI160_ACC_SENSITIVITY_2G; - - tmp[ACCEL_X_AXIS] = (rawData.x * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; - tmp[ACCEL_Y_AXIS] = (rawData.y * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; - tmp[ACCEL_Z_AXIS] = (rawData.z * SENSOR_1K_UNIT) / SENSOR_CONVERT_UNIT; - - event.dataLen = sizeof(tmp); - event.data = (uint8_t *)&tmp; - ret = ReportSensorEvent(&event); - return ret; - } - ``` - -- 数据处理函数 - -创建传感器定时器,按照配置的采样率定时采样,并上报给数据订阅者。 - -``` -/* 传感器定时工作线程 */ -static int32_t ReadAccelDataThreadWorker(void *arg) -{ - (void)arg; - int64_t interval; - struct AccelDrvData *drvData = AccelGetDrvData(); - - drvData->threadStatus = SENSOR_THREAD_START; - while (true) { - if (drvData->threadStatus == SENSOR_THREAD_RUNNING) { - if (drvData->ops.ReadData != NULL) { - (void)drvData->ops.ReadData(drvData->accelCfg); - } - interval = OsalDivS64(drvData->interval, (SENSOR_CONVERT_UNIT * SENSOR_CONVERT_UNIT)); - OsalMSleep(interval); - } else if (drvData->threadStatus == SENSOR_THREAD_DESTROY) { - break; - } else { - OsalMSleep(ACC_DEFAULT_SAMPLING_200_MS / SENSOR_CONVERT_UNIT / SENSOR_CONVERT_UNIT); - } - - if ((!drvData->initStatus) || (drvData->interval < 0) || drvData->threadStatus != SENSOR_THREAD_RUNNING) { - continue; - } - } - - return HDF_SUCCESS; -} -/* 创建传感器定时器和器件初始化 */ -static int32_t InitAccelConfig(void) -{ - int32_t ret; - struct AccelDrvData *drvData = AccelGetDrvData(); - - if (drvData->threadStatus != SENSOR_THREAD_NONE && drvData->threadStatus != SENSOR_THREAD_DESTROY) { - HDF_LOGE("%s: accel thread have created", __func__); - return HDF_SUCCESS; - } - - ret = CreateSensorThread(&drvData->thread, ReadAccelDataThreadWorker, "hdf_sensor_accel", drvData); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel create thread failed", __func__); - drvData->threadStatus = SENSOR_THREAD_NONE; - return HDF_FAILURE; - } - - CHECK_NULL_PTR_RETURN_VALUE(drvData->ops.Init, HDF_ERR_INVALID_PARAM); - - ret = drvData->ops.Init(drvData->accelCfg); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: accel create thread failed", __func__); - drvData->threadStatus = SENSOR_THREAD_NONE; - return HDF_FAILURE; - } - drvData->initStatus = true; - return HDF_SUCCESS; -} -``` - -- 主要的数据结构 - -``` -/* 传感器转换单位*/ -#define SENSOR_CONVERT_UNIT 1000 -#define SENSOR_1K_UNIT 1024 -/* 传感器2g对应灵敏度转换值 */ -#define BMI160_ACC_SENSITIVITY_2G 61 -/* 传感器数据采样寄存器地址 */ -#define BMI160_ACCEL_X_LSB_ADDR 0X12 -#define BMI160_ACCEL_X_MSB_ADDR 0X13 -#define BMI160_ACCEL_Y_LSB_ADDR 0X14 -#define BMI160_ACCEL_Y_MSB_ADDR 0X15 -#define BMI160_ACCEL_Z_LSB_ADDR 0X16 -#define BMI160_ACCEL_Z_MSB_ADDR 0X17 -/* 传感器数据维度 */ -enum AccelAxisNum { - ACCEL_X_AXIS = 0, - ACCEL_Y_AXIS = 1, - ACCEL_Z_AXIS = 2, - ACCEL_AXIS_NUM = 3, -}; -/* 传感器每个维度值 */ -struct AccelData { - int32_t x; - int32_t y; - int32_t z; -}; -/* 传感器私有数据结构体 */ -struct AccelDrvData { - bool detectFlag; - uint8_t threadStatus; - uint8_t initStatus; - int64_t interval; - struct SensorCfgData *accelCfg; - struct OsalThread thread; - struct AccelOpsCall ops; -}; -/* 差异化适配函数 */ -struct AccelOpsCall { - int32_t (*Init)(struct SensorCfgData *data); - int32_t (*ReadData)(struct SensorCfgData *data); -}; -``` - diff --git "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\346\214\207\345\257\274.md" deleted file mode 100755 index a544f96506316543a7c9444cc156b80d2f366e7c..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ /dev/null @@ -1,16 +0,0 @@ -# 传感器驱动开发指导 - -- [开发步骤](#section18816105182315) - -Sensor驱动是基于HDF框架、PLATFORM和OSAL基础接口进行开发,不区分操作系统和芯片平台,为不同Sensor器件提供统一的驱动模型。本篇开发指导以加速度计传感器为例,介绍传感器驱动开发。 - -## 开发步骤 - -1. 加速度计传感器驱动注册。HDF驱动框架会提供统一的驱动管理模型,通过加速计传感器模块配置信息,识别并加载对应模块驱动。 -2. 加速度计传感器驱动初始化和去初始化。HDF驱动框架通过init入口函数,依次启动传感器设备驱动加载和分配传感器设备数据配置资源。HDF驱动框架通过release函数,释放驱动加载的资源和配置。 -3. 加速度计传感器寄存器组配置解析。不同类型传感器需要在hcs里配置器件对应的HCS配置文件,然后再设备驱动启动过程中探测器件是否在位,然后加载对应的配置文件,生成配置的结构体对象。 -4. 加速度计传感器驱动操作接口实现。实现各个类型传感器归一化驱动接口,如init,GetInfo,Enable,Disable,SetBatch,SetMode,SetOption,ReadSensorData等函数,完成传感器驱动配置下发和数据上报功能。 - ->![](public_sys-resources/icon-note.gif) **说明:** ->传感器驱动模型已经提供一部分能力集,包括驱动设备管理能力,抽象总线和平台操作接口能力,通用配置操作接口能力,配置解析操作接口能力,接口参考[表2](传感器驱动开发概述.md#table1156812588320)。需要开发人员实现部分有:1、传感器部分操作接口([表3](传感器驱动开发概述.md#table1083014911336));2、传感器HCS差异化数据配置;3、驱动基本功能验证。 - diff --git "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\346\265\213\350\257\225\346\214\207\345\257\274.md" "b/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\346\265\213\350\257\225\346\214\207\345\257\274.md" deleted file mode 100755 index 7bf51251601d13df14cc81398af44c826228f2d9..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\344\274\240\346\204\237\345\231\250\351\251\261\345\212\250\346\265\213\350\257\225\346\214\207\345\257\274.md" +++ /dev/null @@ -1,82 +0,0 @@ -# 传感器驱动测试指导 - -驱动开发完成后,在传感器单元测试里面开发自测试用例,验证驱动基本功能。测试环境采用开发者自测试平台。 - -``` -/* 标识是否上报传感器数据 */ -static int32_t g_sensorDataFlag = 0; -/* 保持获取的传感器接口实例地址 */ -static const struct SensorInterface *g_sensorDev = nullptr; - -/* 订阅者注册数据上报函数 */ -static int SensorTestDataCallback(struct SensorEvents *event) -{ - if (event == nullptr) { - return -1; - } - float *data = (float*)event->data; - printf("time [%lld] sensor id [%d] x-[%f] y-[%f] z-[%f]\n\r", event->timestamp, - event->sensorId, (*data), *(data + 1), *(data + g_axisZ)); - if (*data > 1e-5) { - g_sensorDataFlag = 1; - } - return 0; -} -/* 用例执行前,初始化传感器接口实例 */ -void HdfSensorTest::SetUpTestCase() -{ - g_sensorDev = NewSensorInterfaceInstance(); - if (g_sensorDev == nullptr) { - printf("test sensorHdi get Module instace failed\n\r"); - } -} -/* 用例资源释放 */ -void HdfSensorTest::TearDownTestCase() -{ - if (g_sensorDev != nullptr) { - FreeSensorInterfaceInstance(); - g_sensorDev = nullptr; - } -} -/* 传感器驱动测试验证 */ -HWTEST_F(HdfSensorTest,TestAccelDriver_001, TestSize.Level0) -{ - int32_t sensorInterval = 1000000000; /* 数据采样率单位纳秒 */ - int32_t pollTime = 5; /* 数据采样时间单位秒 */ - int32_t accelSensorId = 1; /* 加速度传感器类型标识为1 */ - int32_t count = 0; - int ret; - struct SensorInformation *sensorInfo = nullptr; - - ret = g_sensorDev->Register(SensorTestDataCallback) - EXPECT_EQ(SENSOR_NULL_PTR, ret); - - ret = g_sensorDev->GetAllSensors(&sensorInfo, &count); - EXPECT_EQ(0, ret); - if (sensorInfo == nullptr) { - EXPECT_NE(nullptr, sensorInfo); - return; - } - /* 打印获取的传感器列表 */ - for (int i = 0; i < count; i++) { - printf("get sensoriId[%d], info name[%s]\n\r", sensorInfo[i]->sensorId, sensorInfo[i]->sensorName); - } - ret = g_sensorDev->Enable(accelSensorId); - EXPECT_EQ(0, ret); - g_sensorDataFlag = 0; - - ret = g_sensorDev->SetBatch(accelSensorId, sensorInterval, pollTime); - EXPECT_EQ(0, ret); - /* 在时间pollTime内,观察输出打印数据 */ - OsalSleep(pollTime); - EXPECT_EQ(1, g_sensorDataFlag); - - ret = g_sensorDev->Disable(accelSensorId); - g_sensorDataFlag = 0; - EXPECT_EQ(0, ret); - - ret = g_sensorDev->Unregister(); - EXPECT_EQ(0, ret); -} -``` - diff --git "a/zh-cn/device-dev/driver/\345\244\226\350\256\276.md" "b/zh-cn/device-dev/driver/\345\244\226\350\256\276.md" deleted file mode 100755 index 26824613db5c020fc05e256f6b6aca62f34cbc47..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\345\244\226\350\256\276.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 外设 - -- **[LCD](LCD.md)** - -- **[TOUCHSCREEN](TOUCHSCREEN.md)** - -- **[SENSOR](SENSOR.md)** - -- **[WLAN](WLAN.md)** - - diff --git "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" "b/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" deleted file mode 100755 index b8d64e53b754037b4ec6335e683f32bfbd1b6a34..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\344\275\277\347\224\250\345\256\236\344\276\213.md" +++ /dev/null @@ -1,86 +0,0 @@ -# 看门狗使用实例 - -本例程提供看门狗的完整使用流程。 - -在本例程中,我们打开一个看门狗设备,设置超时时间并启动计时: - -- 首先定期喂狗,即按时清除看门狗定时器,确保系统不会因定时器超时而复位。 -- 接着再停止喂狗,观察定时器到期后系统是否发生复位行为。 - -示例如下: - -``` -#include "watchdog_if.h" -#include "hdf_log.h" -#include "osal_irq.h" -#include "osal_time.h" - -#define WATCHDOG_TEST_TIMEOUT 2 -#define WATCHDOG_TEST_FEED_TIME 6 - -static int32_t TestCaseWatchdog(void) -{ - int32_t i; - int32_t ret; - uint32_t timeout; - DevHandle handle = NULL; - - /* 打开0号看门狗设备 */ - handle = WatchdogOpen(0); - if (handle == NULL) { - HDF_LOGE("Open watchdog fail!"); - return -1; - } - - /* 设置超时时间 */ - ret = WatchdogSetTimeout(handle, WATCHDOG_TEST_TIMEOUT); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: set timeout fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - - /* 回读设置的超时时间值 */ - ret = WatchdogGetTimeout(handle, &timeout); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: get timeout fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - HDF_LOGI("%s: read timeout back:%u\n", __func__, timeout); - - /* 启动看门狗,开始计时 */ - ret = WatchdogStart(handle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - - /* 每隔1S喂狗一次 */ - for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: feeding watchdog %d times... \n", __func__, i); - ret = WatchdogFeed(handle); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: feed dog fail! ret:%d\n", __func__, ret); - WatchdogClose(handle); - return ret; - } - OsalSleep(1); - } - /* 由于喂狗间隔小于超时时间,系统不会发生复位,此日志可以正常打印 */ - HDF_LOGE("%s: no reset ... feeding test OK!!!\n", __func__); - - /* 接下来持续不喂狗,使得看门狗计时器超时 */ - for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); - OsalSleep(1); - } - - /* 当不喂狗时间到达之前设定的超时时间的时候,系统会发生复位,理论上观察不到此日志的打印 */ - HDF_LOGE("%s: dog has't buck!!! \n", __func__, i); - WatchdogClose(handle); - return -1; -} -``` - diff --git "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\346\246\202\350\277\260.md" "b/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\346\246\202\350\277\260.md" deleted file mode 100755 index 467e21ba08ef672247327cd100b8c2db7e4f9a01..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\347\234\213\351\227\250\347\213\227\346\246\202\350\277\260.md" +++ /dev/null @@ -1,78 +0,0 @@ -# 看门狗概述 - -- [简介](#section3579126111816) -- [接口说明](#section17429111981812) - -## 简介 - -看门狗(watchdog),又叫看门狗计时器(watchdog timer),是一种硬件的计时设备,当系统的主程序发生某些错误时,导致未及时清除看门狗计时器的计时值,这时看门狗计时器就会对系统发出复位信号,使系统从悬停状态恢复到正常运作状态。 - -## 接口说明 - -**表 1** 看门狗 API接口功能介绍 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

功能分类

-

接口名

-

描述

-

打开/关闭看门狗

-

WatchdogOpen

-

打开看门狗设备

-

WatchdogClose

-

关闭看门狗设备

-

启动/停止看门狗

-

WatchdogStart

-

启动看门狗

-

WatchdogStop

-

停止看门狗

-

设置/获取超时时间

-

WatchdogSetTimeout

-

设置看门狗超时时间

-

WatchdogGetTimeout

-

获取看门狗超时时间

-

获取看门狗状态

-

WatchdogGetStatus

-

获取看门狗状态

-

清除看门狗定时器

-

WatchdogFeed

-

清除看门狗定时器(喂狗)

-
- ->![](public_sys-resources/icon-note.gif) **说明:** ->本文涉及看门狗的所有接口,仅限内核态使用,不支持在用户态使用。 - diff --git "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\345\271\263\345\217\260.md" "b/zh-cn/device-dev/driver/\351\251\261\345\212\250\345\271\263\345\217\260.md" deleted file mode 100755 index 7d5a5437f750b6c60b8b249c40c5ae1c6ab0d30b..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/driver/\351\251\261\345\212\250\345\271\263\345\217\260.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 驱动平台 - -- **[GPIO](GPIO.md)** - -- **[I2C](I2C.md)** - -- **[RTC](RTC.md)** - -- **[SDIO](SDIO.md)** - -- **[SPI](SPI.md)** - -- **[UART](UART.md)** - -- **[WATCHDOG](WATCHDOG.md)** - -- **[MIPI DSI](MIPI-DSI.md)** - - diff --git a/zh-cn/device-dev/get-code/Readme-CN.md b/zh-cn/device-dev/get-code/Readme-CN.md index a2dbbc91bbebb45f6609d07ca87191ed509e3ab4..82da2d561e3ade5ee95dbe4c1411c4114ad6ad2b 100755 --- a/zh-cn/device-dev/get-code/Readme-CN.md +++ b/zh-cn/device-dev/get-code/Readme-CN.md @@ -1,7 +1,9 @@ # 获取源码 -- [源码获取](源码获取.md) -- [获取工具](获取工具.md) - - [Docker编译环境](Docker编译环境.md) - - [IDE](IDE.md) +- [获取源码](sourcecode.md) + - [源码获取](sourcecode-acquire.md) + +- [获取工具](gettools.md) + - [Docker编译环境](gettools-acquire.md) + - [IDE](gettools-ide.md) diff --git a/zh-cn/device-dev/get-code/figures/3.png b/zh-cn/device-dev/get-code/figure/3-20.png similarity index 100% rename from zh-cn/device-dev/get-code/figures/3.png rename to zh-cn/device-dev/get-code/figure/3-20.png diff --git a/zh-cn/device-dev/get-code/figures/zh-cn_image_0000001101413884.png b/zh-cn/device-dev/get-code/figure/zh-cn_image_0000001101413884.png similarity index 100% rename from zh-cn/device-dev/get-code/figures/zh-cn_image_0000001101413884.png rename to zh-cn/device-dev/get-code/figure/zh-cn_image_0000001101413884.png diff --git a/zh-cn/device-dev/get-code/figures/zh-cn_image_0000001119755646.png b/zh-cn/device-dev/get-code/figure/zh-cn_image_0000001119755646.png similarity index 100% rename from zh-cn/device-dev/get-code/figures/zh-cn_image_0000001119755646.png rename to zh-cn/device-dev/get-code/figure/zh-cn_image_0000001119755646.png diff --git a/zh-cn/device-dev/get-code/figures/zh-cn_image_0000001119915556.png b/zh-cn/device-dev/get-code/figure/zh-cn_image_0000001119915556.png similarity index 100% rename from zh-cn/device-dev/get-code/figures/zh-cn_image_0000001119915556.png rename to zh-cn/device-dev/get-code/figure/zh-cn_image_0000001119915556.png diff --git a/zh-cn/device-dev/get-code/figures/zh-cn_image_0000001166715379.png b/zh-cn/device-dev/get-code/figure/zh-cn_image_0000001166715379.png similarity index 100% rename from zh-cn/device-dev/get-code/figures/zh-cn_image_0000001166715379.png rename to zh-cn/device-dev/get-code/figure/zh-cn_image_0000001166715379.png diff --git "a/zh-cn/device-dev/get-code/Docker\347\274\226\350\257\221\347\216\257\345\242\203.md" b/zh-cn/device-dev/get-code/gettools-acquire.md similarity index 96% rename from "zh-cn/device-dev/get-code/Docker\347\274\226\350\257\221\347\216\257\345\242\203.md" rename to zh-cn/device-dev/get-code/gettools-acquire.md index c15f1861f152e8616fc86c629472fdef6a0df991..942635e189a91797d3624a574a4d2892d52e6a7d 100644 --- "a/zh-cn/device-dev/get-code/Docker\347\274\226\350\257\221\347\216\257\345\242\203.md" +++ b/zh-cn/device-dev/get-code/gettools-acquire.md @@ -74,9 +74,9 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完 在使用docker环境前需要先完成以下操作: 1. 安装Docker,Docker安装请参考[官方指导](https://docs.docker.com/engine/install/)。 -2. 获取OpenHarmony源码,请参考[获取源码](源码获取.md)。 +2. 获取OpenHarmony源码,请参考[获取源码](sourcecode-acquire.md)。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >HPM Docker环境无需单独获取源码。 @@ -153,9 +153,9 @@ hb set **图 1** 设置编译界面 -![](figures/zh-cn_image_0000001101413884.png) +![](figure/zh-cn_image_0000001101413884.png) ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >当前开发板平台和编译界面的对应关系如下: >- Hi3861:wifiiot\_hispark\_pegasus@hisilicon >- Hi3516:ipcamera\_hispark\_taurus@hisilicon @@ -231,12 +231,12 @@ hb set 编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >退出Docker执行exit命令即可。 ## 基于HPM的Docker环境 -docker\_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件,能够帮助用户快速初始化HPM工程,利用docker镜像来快速编译OpenHarmony发行版,在很大程度上简化了编译前的环境配置。开发者在配置好Ubuntu和[hpm-cli](https://device.harmonyos.com/cn/docs/develop/bundles/oem_bundle_guide_prepare-0000001050129846)开发环境后,可以通过以下步骤来使用我们提供的Docker环境。 +docker\_dist是一个[HPM](https://hpm.harmonyos.com/)系统中的模板组件,能够帮助用户快速初始化HPM工程,利用docker镜像来快速编译OpenHarmony发行版,在很大程度上简化了编译前的环境配置。开发者在配置好Ubuntu和[hpm-cli](../bundles/bundles-guide-prepare.md)开发环境后,可以通过以下步骤来使用我们提供的Docker环境。 ### 搭建Docker环境 diff --git a/zh-cn/device-dev/get-code/IDE.md b/zh-cn/device-dev/get-code/gettools-ide.md similarity index 98% rename from zh-cn/device-dev/get-code/IDE.md rename to zh-cn/device-dev/get-code/gettools-ide.md index 144b67418be2f44e4a5854bdb799be24b4142b7a..8217ddc1222045e4633d5cd05289e20169ce90e4 100644 --- a/zh-cn/device-dev/get-code/IDE.md +++ b/zh-cn/device-dev/get-code/gettools-ide.md @@ -9,7 +9,7 @@ HUAWEI DevEco Device Tool是OpenHarmony面向智能设备开发者提供的一 Huawei DevEco Device Tool支持 OpenHarmony设备开发的演进路标如下: -![](figures/3.png) +![](figure/3-20.png) ## 获取应用开发工具(HUAWEI DevEco Studio) diff --git "a/zh-cn/device-dev/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" b/zh-cn/device-dev/get-code/gettools.md old mode 100755 new mode 100644 similarity index 42% rename from "zh-cn/device-dev/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" rename to zh-cn/device-dev/get-code/gettools.md index eeb55c7156473c57f088d2bce54464b13fd8ca92..4e35772567489dde5083791a9ac2596331588446 --- "a/zh-cn/device-dev/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" +++ b/zh-cn/device-dev/get-code/gettools.md @@ -1,7 +1,7 @@ # 获取工具 -- **[Docker编译环境](Docker编译环境.md)** +- **[Docker编译环境](gettools-acquire.md)** -- **[IDE](IDE.md)** +- **[IDE](gettools-ide.md)** diff --git a/zh-cn/device-dev/get-code/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/get-code/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/get-code/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/get-code/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/get-code/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/get-code/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/get-code/public_sys-resources/icon-note.gif b/zh-cn/device-dev/get-code/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/get-code/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/get-code/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/get-code/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/get-code/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/get-code/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/get-code/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/get-code/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/get-code/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/get-code/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/get-code/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" b/zh-cn/device-dev/get-code/sourcecode-acquire.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" rename to zh-cn/device-dev/get-code/sourcecode-acquire.md index 3b2c0526b4ee8ef6ef2e967f4b5d8a011011906c..622d4cd83b108673913067f2dea6ff3b883403dc --- "a/zh-cn/device-dev/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" +++ b/zh-cn/device-dev/get-code/sourcecode-acquire.md @@ -1,426 +1,426 @@ -# 源码获取 - -- [OpenHarmony介绍](#section6370143622110) -- [源码获取概述](#section12763342204) -- [获取方式1:从代码仓库获取](#section537312010229) - - [适用场景](#section10881513459) - - [前提条件](#section102871547153314) - - [操作步骤](#section429012478331) - -- [获取方式2:从HPM获取](#section463013147412) - - [适用场景](#section26661067443) - - [前提条件](#section17544943123315) - - [操作步骤](#section954619433333) - -- [获取方式3:从镜像站点获取](#section1186691118430) -- [源码目录简介](#section1072115612811) - -## OpenHarmony介绍 - -OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及运营的开源项目,目标是面向全场景、全连接、全智能时代,搭建一个智能终端设备操作系统的框架和平台,促进万物互联产业的繁荣发展。 - -开源代码仓库地址:[https://openharmony.gitee.com](https://openharmony.gitee.com) - ->![](public_sys-resources/icon-note.gif) **说明:** ->当前的OpenHarmony源代码仅支持在Linux环境下编译。 - -## 源码获取概述 - -本文档将介绍如何获取OpenHarmony源码并说明OpenHarmony的源码目录结构。OpenHarmony的代码以[组件](../bundles/概述.md)的形式开放,开发者可以通过如下其中一种方式获取: - -- **获取方式1**:从代码仓库获取。通过repo或git工具从代码仓库中下载,此方式可获取最新代码。 -- **获取方式2**:通过HPM包管理器获取。在[HPM](https://hpm.harmonyos.com)网站,查找满足需求的开源发行版,直接下载(或者定制后下载),再通过hpm-cli命令工具将所需的组件及工具链下载、安装到本地。 -- **获取方式3**:从镜像站点下载归档后的发行版压缩文件。如果要获取旧版本的源码,也可通过此方式获取,此方式下载速度较快。 - -## 获取方式1:从代码仓库获取 - -### 适用场景 - -- 基于OpenHarmony的稳定分支建立自己的基线,分发下游客户。 - -- 已经完成自身软件与OpenHarmony的对接,需要进行OpenHarmony官方认证。 - -- 芯片/模组/app通过OpenHarmony官方认证后,贡献代码到OpenHarmony社区。 - -- 修复OpenHarmony的问题。 - -- 学习OpenHarmony的源码。 - - -### 前提条件 - -1. 注册码云gitee账号。 -2. 注册码云SSH公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191)。 -3. 安装[git客户端](http://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git)和[git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading)并配置用户信息。 - - ``` - git config --global user.name "yourname" - git config --global user.email "your-email-address" - git config --global credential.helper store - ``` - -4. 安装码云repo工具,可以执行如下命令。 - - ``` - curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中 - chmod a+x /usr/local/bin/repo - pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests - ``` - - -### 操作步骤 - -**获取轻量/小型/标准系统(2.0 Canary)源码** - ->![](public_sys-resources/icon-note.gif) **说明:** ->主干代码为开发分支,开发者可通过主干代码获取最新特性。release分支代码相对比较稳定,开发者可基于release分支代码进行商用功能开发。 - -- **OpenHarmony主干代码获取** - - 方式一(推荐):通过repo + ssh 下载(需注册公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191))。 - - ``` - repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify - repo sync -c - repo forall -c 'git lfs pull' - ``` - - 方式二:通过repo + https 下载。 - - ``` - repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify - repo sync -c - repo forall -c 'git lfs pull' - ``` - - -- **OpenHarmony release 分支最新代码获取** - - >![](public_sys-resources/icon-note.gif) **说明:** - >当前通过release分支只能获取轻量和小型系统源码。 - - 通过repo下载。 - - ``` - repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify - repo sync -c - repo forall -c 'git lfs pull' - ``` - -- **OpenHarmony** 其他版本源码获取方式请参考版本[Release-Notes](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-Release-Notes.md)。 - -## 获取方式2:从HPM获取 - -### 适用场景 - -对于刚接触OpenHarmony的新用户,希望能够参考一些示例解决方案从而进行快速开发。可以在[HPM](https://hpm.harmonyos.com)网站获取下载开源发行版,也可以在开源发行版的基础上定制(添加或删除组件)。然后通过包管理器命令行工具(hpm-cli)将需要的组件及相关的编译工具链全部下载、安装到本地。 - -### 前提条件 - -先要在本地安装Node.js和hpm命令行工具,安装步骤如下: - -1. 安装Node.js。 - - 官网下载并在本地安装Node.js. - - 推荐安装 [Node.js](https://nodejs.org/) 12.x \(包含 npm 6.14.4\)或更高版本 \(推荐 12.13.0+\)。 - -2. 通过Node.js自带的npm安装hpm命令行工具。 - - 打开CMD,执行以下命令: - - ``` - npm install -g @ohos/hpm-cli - ``` - -3. 安装完成后执行如下命令,显示hpm版本,即安装成功。 - - ``` - hpm -V 或 hpm --version - ``` - -4. 如果升级hpm的版本,请执行如下命令: - - ``` - npm update -g @ohos/hpm-cli - ``` - - -### 操作步骤 - -1. 查找发行版。 - 1. 打开包管理页面[HPM](https://hpm.harmonyOS.com),设定搜索的对象为“发行版“,如下图所示。 - 2. 在搜索框输入关键字搜索,如“摄像头”。 - 3. 结果中显示与关键字匹配的发行版,可以进一步根据组件类别等过滤条件(如:适配的开发板,内核)精确筛选。 - 4. 查找合适的发行版,点击查看发行版的详情介绍。 - - **图 1** 包管理 - - - ![](figures/zh-cn_image_0000001119915556.png) - - -2. 了解发行版详情。 - - 1. 仔细阅读发行版的说明信息,以了解使用场景、特性、组件构成、使用方法以及如何进行定制化,如下图所示。 - 2. 点击「直接下载」,将发行版下载到本地。 - 3. 点击「定制组件」,将对发行版包含的组件进行定制(添加/删除)。 - - **图 2** 发行版示例 - - - ![](figures/zh-cn_image_0000001119755646.png) - -3. 定制组件。 - 1. 进入发行版的定制页面,如下图所示。 - 2. 通过关闭开关移除可选组件,或者通过“添加组件”增加新的组件。 - 3. 在右边填写您的项目基本信息,包括名称、版本、描述等信息。 - 4. 点击“下载“,系统会根据您的选择,生成相应的OpenHarmony代码结构文件\(如my\_cust\_dist.zip\),保存至本地文件。 - - **图 3** 组件定制 - - - ![](figures/zh-cn_image_0000001166715379.png) - - -4. 下载安装组件。 - 1. 解压下载的压缩文件,用命令行工具CMD(Linux下的Shell终端) - 2. 在解压后的文件目录下执行hpm install指令 - 3. 下载的组件存在工程目录下的ohos\_bundles文件夹中(部分组件安装后会将源码复制到指定目录下)。 - - -## 获取方式3:从镜像站点获取 - -为了获得更好的下载性能,您可以选择从以下站点的镜像库获取源码或者对应的解决方案。 - ->![](public_sys-resources/icon-note.gif) **说明:** ->- 本部分只提供**OpenHarmony** Master最新版本和LTS最新版本的源码获取方式, 其他版本源码获取方式以及具体版本信息请参考[Release-Notes](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-Release-Notes.md) ->- 当前Master 1.0版本已经不再维护。 - -**表 1** 源码获取路径 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

LTS版本源码

-

版本信息

-

下载站点

-

SHA256校验码

-

全量代码(轻量和小型系统)

-

1.1.1

-

站点

-

SHA256 校验码

-

Hi3861解决方案(二进制)

-

1.1.1

-

站点

-

SHA256 校验码

-

Hi3518解决方案(二进制)

-

1.1.1

-

站点

-

SHA256 校验码

-

Hi3516解决方案(二进制)

-

1.1.1

-

站点

-

SHA256 校验码

-

RELEASE-NOTES

-

1.1.1

-

站点

-

-

-

Master版本源码

-

版本信息

-

下载站点

-

SHA256校验码

-

全量代码(标准系统)

-

2.0 Canary

-

站点1站点2

-

SHA256校验码

-

全量代码(轻量和小型系统)

-

1.0(不再维护)

-

站点

-

SHA256 校验码

-

Hi3861解决方案(二进制)

-

1.0(不再维护)

-

站点

-

SHA256 校验码

-

Hi3518解决方案(二进制)

-

1.0(不再维护)

-

站点

-

SHA256 校验码

-

Hi3516解决方案(二进制)

-

1.0(不再维护)

-

站点

-

SHA256 校验码

-

RELEASE-NOTES

-

1.0(不再维护)

-

站点

-

-

-

编译工具链

-

版本信息

-

下载站点

-

SHA256校验码

-

编译工具链获取清单

-

-

-

站点

-

-

-
- -## 源码目录简介 - -下表是OpenHarmony源码的目录及简单说明: - -**表 2** 源码目录 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

目录名

-

描述

-

applications

-

应用程序样例,包括camera等

-

base

-

基础软件服务子系统集&硬件服务子系统集

-

build

-

组件化编译、构建和配置脚本

-

docs

-

说明文档

-

domains

-

增强软件服务子系统集

-

drivers

-

驱动子系统

-

foundation

-

系统基础能力子系统集

-

kernel

-

内核子系统

-

prebuilts

-

编译器及工具链子系统

-

test

-

测试子系统

-

third_party

-

开源第三方组件

-

utils

-

常用的工具集

-

vendor

-

厂商提供的软件

-

build.py

-

编译脚本文件

-
- +# 源码获取 + +- [OpenHarmony介绍](#section6370143622110) +- [源码获取概述](#section12763342204) +- [获取方式1:从代码仓库获取](#section537312010229) + - [适用场景](#section10881513459) + - [前提条件](#section102871547153314) + - [操作步骤](#section429012478331) + +- [获取方式2:从HPM获取](#section463013147412) + - [适用场景](#section26661067443) + - [前提条件](#section17544943123315) + - [操作步骤](#section954619433333) + +- [获取方式3:从镜像站点获取](#section1186691118430) +- [源码目录简介](#section1072115612811) + +## OpenHarmony介绍 + +OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及运营的开源项目,目标是面向全场景、全连接、全智能时代,搭建一个智能终端设备操作系统的框架和平台,促进万物互联产业的繁荣发展。 + +开源代码仓库地址:[https://openharmony.gitee.com](https://openharmony.gitee.com) + +>![](../public_sys-resources/icon-note.gif) **说明:** +>当前的OpenHarmony源代码仅支持在Linux环境下编译。 + +## 源码获取概述 + +本文档将介绍如何获取OpenHarmony源码并说明OpenHarmony的源码目录结构。OpenHarmony的代码以[组件](../bundles/bundles-standard-rules.md)的形式开放,开发者可以通过如下其中一种方式获取: + +- **获取方式1**:从代码仓库获取。通过repo或git工具从代码仓库中下载,此方式可获取最新代码。 +- **获取方式2**:通过HPM包管理器获取。在[HPM](https://hpm.harmonyos.com)网站,查找满足需求的开源发行版,直接下载(或者定制后下载),再通过hpm-cli命令工具将所需的组件及工具链下载、安装到本地。 +- **获取方式3**:从镜像站点下载归档后的发行版压缩文件。如果要获取旧版本的源码,也可通过此方式获取,此方式下载速度较快。 + +## 获取方式1:从代码仓库获取 + +### 适用场景 + +- 基于OpenHarmony的稳定分支建立自己的基线,分发下游客户。 + +- 已经完成自身软件与OpenHarmony的对接,需要进行OpenHarmony官方认证。 + +- 芯片/模组/app通过OpenHarmony官方认证后,贡献代码到OpenHarmony社区。 + +- 修复OpenHarmony的问题。 + +- 学习OpenHarmony的源码。 + + +### 前提条件 + +1. 注册码云gitee账号。 +2. 注册码云SSH公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191)。 +3. 安装[git客户端](http://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git)和[git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading)并配置用户信息。 + + ``` + git config --global user.name "yourname" + git config --global user.email "your-email-address" + git config --global credential.helper store + ``` + +4. 安装码云repo工具,可以执行如下命令。 + + ``` + curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中 + chmod a+x /usr/local/bin/repo + pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests + ``` + + +### 操作步骤 + +**获取轻量/小型/标准系统(2.0 Canary)源码** + +>![](../public_sys-resources/icon-note.gif) **说明:** +>主干代码为开发分支,开发者可通过主干代码获取最新特性。release分支代码相对比较稳定,开发者可基于release分支代码进行商用功能开发。 + +- **OpenHarmony主干代码获取** + + 方式一(推荐):通过repo + ssh 下载(需注册公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191))。 + + ``` + repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + + 方式二:通过repo + https 下载。 + + ``` + repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + + +- **OpenHarmony release 分支最新代码获取** + + >![](../public_sys-resources/icon-note.gif) **说明:** + >当前通过release分支只能获取轻量和小型系统源码。 + + 通过repo下载。 + + ``` + repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- OpenHarmony其他版本源码获取方式请参考版本[Release-Notes](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-Release-Notes.md)。 + +## 获取方式2:从HPM获取 + +### 适用场景 + +对于刚接触OpenHarmony的新用户,希望能够参考一些示例解决方案从而进行快速开发。可以在[HPM](https://hpm.harmonyos.com)网站获取下载开源发行版,也可以在开源发行版的基础上定制(添加或删除组件)。然后通过包管理器命令行工具(hpm-cli)将需要的组件及相关的编译工具链全部下载、安装到本地。 + +### 前提条件 + +先要在本地安装Node.js和hpm命令行工具,安装步骤如下: + +1. 安装Node.js。 + + 官网下载并在本地安装Node.js. + + 推荐安装 [Node.js](https://nodejs.org/) 12.x \(包含 npm 6.14.4\)或更高版本 \(推荐 12.13.0+\)。 + +2. 通过Node.js自带的npm安装hpm命令行工具。 + + 打开CMD,执行以下命令: + + ``` + npm install -g @ohos/hpm-cli + ``` + +3. 安装完成后执行如下命令,显示hpm版本,即安装成功。 + + ``` + hpm -V 或 hpm --version + ``` + +4. 如果升级hpm的版本,请执行如下命令: + + ``` + npm update -g @ohos/hpm-cli + ``` + + +### 操作步骤 + +1. 查找发行版。 + 1. 打开包管理页面[HPM](https://hpm.harmonyOS.com),设定搜索的对象为“发行版“,如下图所示。 + 2. 在搜索框输入关键字搜索,如“摄像头”。 + 3. 结果中显示与关键字匹配的发行版,可以进一步根据组件类别等过滤条件(如:适配的开发板,内核)精确筛选。 + 4. 查找合适的发行版,点击查看发行版的详情介绍。 + + **图 1** 包管理 + + + ![](figure/zh-cn_image_0000001119915556.png) + + +2. 了解发行版详情。 + + 1. 仔细阅读发行版的说明信息,以了解使用场景、特性、组件构成、使用方法以及如何进行定制化,如下图所示。 + 2. 点击「直接下载」,将发行版下载到本地。 + 3. 点击「定制组件」,将对发行版包含的组件进行定制(添加/删除)。 + + **图 2** 发行版示例 + + + ![](figure/zh-cn_image_0000001119755646.png) + +3. 定制组件。 + 1. 进入发行版的定制页面,如下图所示。 + 2. 通过关闭开关移除可选组件,或者通过“添加组件”增加新的组件。 + 3. 在右边填写您的项目基本信息,包括名称、版本、描述等信息。 + 4. 点击“下载“,系统会根据您的选择,生成相应的OpenHarmony代码结构文件\(如my\_cust\_dist.zip\),保存至本地文件。 + + **图 3** 组件定制 + + + ![](figure/zh-cn_image_0000001166715379.png) + + +4. 下载安装组件。 + 1. 解压下载的压缩文件,用命令行工具CMD(Linux下的Shell终端) + 2. 在解压后的文件目录下执行hpm install指令 + 3. 下载的组件存在工程目录下的ohos\_bundles文件夹中(部分组件安装后会将源码复制到指定目录下)。 + + +## 获取方式3:从镜像站点获取 + +为了获得更好的下载性能,您可以选择从以下站点的镜像库获取源码或者对应的解决方案。 + +>![](../public_sys-resources/icon-note.gif) **说明:** +>- 本部分只提供OpenHarmony Master最新版本和LTS最新版本的源码获取方式, 其他版本源码获取方式以及具体版本信息请参考[Release-Notes](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-Release-Notes.md) +>- 当前Master 1.0版本已经不再维护。 + +**表 1** 源码获取路径 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

LTS版本源码

+

版本信息

+

下载站点

+

SHA256校验码

+

全量代码(轻量和小型系统)

+

1.1.1

+

站点

+

SHA256 校验码

+

Hi3861解决方案(二进制)

+

1.1.1

+

站点

+

SHA256 校验码

+

Hi3518解决方案(二进制)

+

1.1.1

+

站点

+

SHA256 校验码

+

Hi3516解决方案(二进制)

+

1.1.1

+

站点

+

SHA256 校验码

+

RELEASE-NOTES

+

1.1.1

+

站点

+

-

+

Master版本源码

+

版本信息

+

下载站点

+

SHA256校验码

+

全量代码(标准系统)

+

2.0 Canary

+

站点1站点2

+

SHA256校验码

+

全量代码(轻量和小型系统)

+

1.0(不再维护)

+

站点

+

SHA256 校验码

+

Hi3861解决方案(二进制)

+

1.0(不再维护)

+

站点

+

SHA256 校验码

+

Hi3518解决方案(二进制)

+

1.0(不再维护)

+

站点

+

SHA256 校验码

+

Hi3516解决方案(二进制)

+

1.0(不再维护)

+

站点

+

SHA256 校验码

+

RELEASE-NOTES

+

1.0(不再维护)

+

站点

+

-

+

编译工具链

+

版本信息

+

下载站点

+

SHA256校验码

+

编译工具链获取清单

+

-

+

站点

+

-

+
+ +## 源码目录简介 + +下表是OpenHarmony源码的目录及简单说明: + +**表 2** 源码目录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

目录名

+

描述

+

applications

+

应用程序样例,包括camera等

+

base

+

基础软件服务子系统集&硬件服务子系统集

+

build

+

组件化编译、构建和配置脚本

+

docs

+

说明文档

+

domains

+

增强软件服务子系统集

+

drivers

+

驱动子系统

+

foundation

+

系统基础能力子系统集

+

kernel

+

内核子系统

+

prebuilts

+

编译器及工具链子系统

+

test

+

测试子系统

+

third_party

+

开源第三方组件

+

utils

+

常用的工具集

+

vendor

+

厂商提供的软件

+

build.py

+

编译脚本文件

+
+ diff --git a/zh-cn/device-dev/get-code/sourcecode.md b/zh-cn/device-dev/get-code/sourcecode.md new file mode 100644 index 0000000000000000000000000000000000000000..c5803f640fa69090e16fb33f1bd504282c61b207 --- /dev/null +++ b/zh-cn/device-dev/get-code/sourcecode.md @@ -0,0 +1,5 @@ +# 获取源码 + +- **[源码获取](sourcecode-acquire.md)** + + diff --git a/zh-cn/device-dev/glossary/Readme-CN.md b/zh-cn/device-dev/glossary/Readme-CN.md index 1e55e64c536877c21128a54e333b2802f36fa1da..e69d48c93789ee931046637f2f6262f867c7a4ef 100755 --- a/zh-cn/device-dev/glossary/Readme-CN.md +++ b/zh-cn/device-dev/glossary/Readme-CN.md @@ -1,4 +1,4 @@ -# glossary +# 术语 -- [术语](术语.md) +- [术语](glossary.md) diff --git "a/zh-cn/device-dev/glossary/\346\234\257\350\257\255.md" b/zh-cn/device-dev/glossary/glossary.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/glossary/\346\234\257\350\257\255.md" rename to zh-cn/device-dev/glossary/glossary.md diff --git a/zh-cn/device-dev/glossary/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/glossary/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/glossary/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/glossary/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/glossary/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/glossary/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/glossary/public_sys-resources/icon-note.gif b/zh-cn/device-dev/glossary/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/glossary/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/glossary/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/glossary/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/glossary/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/glossary/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/glossary/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/glossary/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/glossary/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/glossary/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/glossary/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/guide/Input\346\250\241\345\236\213\345\267\245\344\275\234\346\265\201\347\250\213\350\247\243\346\236\220.md" "b/zh-cn/device-dev/guide/Input\346\250\241\345\236\213\345\267\245\344\275\234\346\265\201\347\250\213\350\247\243\346\236\220.md" deleted file mode 100644 index 90604006df166670190abe945a505eb3e81408b2..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/Input\346\250\241\345\236\213\345\267\245\344\275\234\346\265\201\347\250\213\350\247\243\346\236\220.md" +++ /dev/null @@ -1,18 +0,0 @@ -# Input模型工作流程解析 - -为了让开发者更清晰的了解Input模型工作流程,本节将对input模型加载的关键流程代码进行说明。 - ->![](public_sys-resources/icon-notice.gif) **须知:** ->本章节为Input模型工作流程说明,开发者无需进行开发。 - -- **[私有配置信息解析](私有配置信息解析.md)** - -- **[管理驱动层初始化及注册驱动至HDF框架](管理驱动层初始化及注册驱动至HDF框架.md)** - -- **[公共驱动层初始化及注册驱动至HDF框架](公共驱动层初始化及注册驱动至HDF框架.md)** - -- **[器件驱动层初始化及注册驱动至HDF框架](器件驱动层初始化及注册驱动至HDF框架.md)** - -- **[具体调用逻辑串联函数](具体调用逻辑串联函数.md)** - - diff --git "a/zh-cn/device-dev/guide/Input\346\250\241\345\236\213\347\256\200\344\273\213.md" "b/zh-cn/device-dev/guide/Input\346\250\241\345\236\213\347\256\200\344\273\213.md" deleted file mode 100644 index 2ad3264215219982f95f0ebd29fd39bc2b480e71..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/Input\346\250\241\345\236\213\347\256\200\344\273\213.md" +++ /dev/null @@ -1,12 +0,0 @@ -# Input模型简介 - -Input驱动模型核心部分由设备管理层、公共驱动层、器件驱动层组成。其中: - -- 设备管理层:主要为各类输入设备驱动提供input设备的注册、注销接口,同时统一管理input设备列表; -- 公共驱动层:负责对板级硬件进行初始化、硬件中断处理、向manager注册input设备等; -- 器件驱动层:通过适配平台驱动预留的差异化接口,实现器件驱动开发量最小化; - -此外,Input模型预先实现了数据通道以及设备配置信息解析等函数。 - -关于Input模型的详细介绍请参考《[Touchscreen开发概述](../driver/Touchscreen开发概述.md)》。 - diff --git "a/zh-cn/device-dev/guide/LED\345\244\226\350\256\276\346\216\247\345\210\266.md" "b/zh-cn/device-dev/guide/LED\345\244\226\350\256\276\346\216\247\345\210\266.md" deleted file mode 100755 index fc94423bf4b226c2284c93a126c88618ba864537..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/LED\345\244\226\350\256\276\346\216\247\345\210\266.md" +++ /dev/null @@ -1,9 +0,0 @@ -# LED外设控制 - -- **[概述](概述.md)** - -- **[开发](开发.md)** - -- **[验证](验证.md)** - - diff --git a/zh-cn/device-dev/guide/Readme-CN.md b/zh-cn/device-dev/guide/Readme-CN.md index 6afa218aca591d6e446fe35e60821022c6a5459b..aa2470b29a038a4c9b924c787a6cb564b5c97abb 100755 --- a/zh-cn/device-dev/guide/Readme-CN.md +++ b/zh-cn/device-dev/guide/Readme-CN.md @@ -1,74 +1,39 @@ -# 开发示例 +# 设备开发指南 + +- [WLAN连接类产品](device-wifi.md) + - [LED外设控制](device-wifi-led-outcontrol.md) + - [集成三方SDK](device-wifi-sdk.md) + +- [无屏摄像头类产品](device-iotcamera.md) + - [概述](device-iotcamera-control-overview.md) + - [示例开发](device-iotcamera-control-demo.md) + - [拍照开发指导](device-iotcamera-control-demo-photodevguide.md) + - [录像开发指导](device-iotcamera-control-demo-videodevguide.md) + + - [应用实例](device-iotcamera-control-example.md) + +- [带屏摄像头类产品](device-camera.md) + - [屏幕和摄像头控制](device-camera-control.md) + - [概述](device-camera-control-overview.md) + - [示例开发](device-camera-control-demo.md) + - [拍照开发指导](device-camera-control-demo-photoguide.md) + - [录像开发指导](device-camera-control-demo-videoguide.md) + - [预览开发指导](device-camera-control-demo-previewguide.md) + + - [应用实例](device-camera-control-example.md) + + - [视觉应用开发](device-camera-visual.md) + - [概述](device-camera-visual-overview.md) + - [开发准备](device-camera-visual-prepare.md) + - [添加页面](device-camera-visual-addpage.md) + - [开发首页](device-camera-visual-first-page.md) + - [开发详情页](device-camera-visual-details.md) + - [调试打包](device-camera-visual-debug.md) + - [真机运行](device-camera-visual-run.md) + - [常见问题](device-camera-visual-faqs.md) + +- [时钟应用开发指导](device-clock-guide.md) +- [平台驱动开发示例](device-driver-demo.md) +- [外设驱动开发示例](device-outerdriver-demo.md) -- [WLAN连接类产品](WLAN连接类产品.md) - - [LED外设控制](LED外设控制.md) - - [概述](概述.md) - - [开发](开发.md) - - [验证](验证.md) - - - [集成三方SDK](集成三方SDK.md) - -- [无屏摄像头类产品](无屏摄像头类产品.md) - - [摄像头控制](摄像头控制.md) - - [概述](概述-0.md) - - [示例开发](示例开发.md) - - [拍照开发指导](拍照开发指导.md) - - [录像开发指导](录像开发指导.md) - - - [应用实例](应用实例.md) - -- [带屏摄像头类产品](带屏摄像头类产品.md) - - [屏幕和摄像头控制](屏幕和摄像头控制.md) - - [概述](概述-1.md) - - [示例开发](示例开发-2.md) - - [拍照开发指导](拍照开发指导-3.md) - - [录像开发指导](录像开发指导-4.md) - - [预览开发指导](预览开发指导.md) - - - [应用实例](应用实例-5.md) - - - [视觉应用开发](视觉应用开发.md) - - [概述](概述-6.md) - - [开发准备](开发准备.md) - - [添加页面](添加页面.md) - - [开发首页](开发首页.md) - - [开发详情页](开发详情页.md) - - [调试打包](调试打包.md) - - [真机运行](真机运行.md) - - [常见问题](常见问题.md) - -- [时钟应用开发示例](时钟应用开发示例.md) - - [概述](概述-7.md) - - [开发准备](开发准备-8.md) - - [开发步骤](开发步骤.md) - - [签名打包](签名打包.md) - - [真机运行](真机运行-9.md) - -- [平台驱动开发示例](平台驱动开发示例.md) - - [概述](概述-10.md) - - [环境准备](环境准备.md) - - [开发](开发-11.md) - - [编译及烧录](编译及烧录.md) - -- [外设驱动开发示例](外设驱动开发示例.md) - - [概述](概述-12.md) - - [硬件资源介绍](硬件资源介绍.md) - - [Input模型简介](Input模型简介.md) - - - [环境搭建](环境搭建.md) - - [TouchScreen器件驱动开发](TouchScreen器件驱动开发.md) - - [配置设备描述信息](配置设备描述信息.md) - - [配置Touchscreen器件信息](配置Touchscreen器件信息.md) - - [适配器件私有驱动](适配器件私有驱动.md) - - - [编译及烧录](编译及烧录-13.md) - - [调试验证](调试验证.md) - - [开机日志分析](开机日志分析.md) - - - [Input模型工作流程解析](Input模型工作流程解析.md) - - [私有配置信息解析](私有配置信息解析.md) - - [管理驱动层初始化及注册驱动至HDF框架](管理驱动层初始化及注册驱动至HDF框架.md) - - [公共驱动层初始化及注册驱动至HDF框架](公共驱动层初始化及注册驱动至HDF框架.md) - - [器件驱动层初始化及注册驱动至HDF框架](器件驱动层初始化及注册驱动至HDF框架.md) - - [具体调用逻辑串联函数](具体调用逻辑串联函数.md) diff --git "a/zh-cn/device-dev/guide/TouchScreen\345\231\250\344\273\266\351\251\261\345\212\250\345\274\200\345\217\221.md" "b/zh-cn/device-dev/guide/TouchScreen\345\231\250\344\273\266\351\251\261\345\212\250\345\274\200\345\217\221.md" deleted file mode 100644 index ef2d3835fa3e16bf4f94ec4d40017dba3cafd5b0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/TouchScreen\345\231\250\344\273\266\351\251\261\345\212\250\345\274\200\345\217\221.md" +++ /dev/null @@ -1,17 +0,0 @@ -# TouchScreen器件驱动开发 - -基于Input模型适配一款触摸屏IC需要完成的工作有: - -1.配置设备描述信息。驱动注册到HDF框架所需要的设备驱动描述信息,如驱动是否加载以及加载次序等; - -2.配置器件私有信息、平台硬件信息。器件私有信息包括上下电时序等,平台硬件信息包括器件连接主板的GPIO端口信息等。 - -3.适配器件私有驱动。 Input模型对Input设备开发流程进行了抽象,开发者只需要适配器件驱动层,无需改动管理驱动层以及公共驱动层。 - -- **[配置设备描述信息](配置设备描述信息.md)** - -- **[配置Touchscreen器件信息](配置Touchscreen器件信息.md)** - -- **[适配器件私有驱动](适配器件私有驱动.md)** - - diff --git "a/zh-cn/device-dev/guide/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274-3.md" b/zh-cn/device-dev/guide/device-camera-control-demo-photoguide.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/guide/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274-3.md" rename to zh-cn/device-dev/guide/device-camera-control-demo-photoguide.md index 83e445c0ed119ba040d2544e9793831a2cd2b05b..0cae9c359bf6c5b036a4f947635d7c2ca289b65a --- "a/zh-cn/device-dev/guide/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274-3.md" +++ b/zh-cn/device-dev/guide/device-camera-control-demo-photoguide.md @@ -385,6 +385,7 @@ Surface *surface = Surface::CreateSurface(); if (surface == nullptr) { delete fc; + return; } surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */ fc->AddSurface(*surface); diff --git "a/zh-cn/device-dev/guide/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/guide/device-camera-control-demo-previewguide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/guide/device-camera-control-demo-previewguide.md diff --git "a/zh-cn/device-dev/guide/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274-4.md" b/zh-cn/device-dev/guide/device-camera-control-demo-videoguide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274-4.md" rename to zh-cn/device-dev/guide/device-camera-control-demo-videoguide.md diff --git a/zh-cn/device-dev/guide/device-camera-control-demo.md b/zh-cn/device-dev/guide/device-camera-control-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..3d42880861d0a17d7ab59f6bead3d0b312d65f3e --- /dev/null +++ b/zh-cn/device-dev/guide/device-camera-control-demo.md @@ -0,0 +1,9 @@ +# 示例开发 + +- **[拍照开发指导](device-camera-control-demo-photoguide.md)** + +- **[录像开发指导](device-camera-control-demo-videoguide.md)** + +- **[预览开发指导](device-camera-control-demo-previewguide.md)** + + diff --git "a/zh-cn/device-dev/guide/\345\272\224\347\224\250\345\256\236\344\276\213-5.md" b/zh-cn/device-dev/guide/device-camera-control-example.md old mode 100755 new mode 100644 similarity index 79% rename from "zh-cn/device-dev/guide/\345\272\224\347\224\250\345\256\236\344\276\213-5.md" rename to zh-cn/device-dev/guide/device-camera-control-example.md index a5da7138f9cbb55e51201fe4f6da8df0c9de54d5..a092908acd9e92234b09634c4cdef1cf1a3d3c94 --- "a/zh-cn/device-dev/guide/\345\272\224\347\224\250\345\256\236\344\276\213-5.md" +++ b/zh-cn/device-dev/guide/device-camera-control-example.md @@ -3,9 +3,9 @@ 本示例将运行源码中的camera示例代码,通过本示例可以实现对开发板拍照、录像及预览功能的控制。 - 本示例源码路径为“applications/sample/camera/media/camera\_sample.cpp”。 -- 在运行本示例前需先完成编译烧录、运行镜像等步骤,相关操作请参考[Hi3516快速入门](../quick-start/Hi3516开发板介绍.md) +- 在运行本示例前需先完成编译烧录、运行镜像等步骤,相关操作请参考[Hi3516快速入门](../quick-start/quickstart-lite-introduction-hi3516.md#section26131214194212)。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >开发板启动后默认会加载launcher应用,应用的图形界面默认显示在媒体图层上方,会影响camera\_sample的演示结果,因此需要在编译或是打包时去掉launcher应用。 >**修改方法:**将“build/lite/components/applications.json”中camera\_sample\_app组件的targets中"//applications/sample/camera/launcher:launcher\_hap"整行注释或删除。 @@ -18,7 +18,7 @@ 重新执行源码仓编译并烧写入单板后,可在单板bin目录下找到camera\_sample文件。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >实例运行拍照和录像功能需要插入TF卡\(最大容量支持128GB\),系统启动后自动将TF卡挂载至/sdcard目录,如果在启动后插入则需要手动挂载。查看拍照和录像内容可将TF卡中内容复制到电脑中进行查看,预览功能无需TF卡。 - 接下来可通过以下步骤运行示例: @@ -26,38 +26,38 @@ 1. 通过cd命令进入可执行程序的末端路径,启动camera\_sample,执行命令如下图。 **图 1** 启动示例 - ![](figures/启动示例.png "启动示例") + ![](figure/启动示例.png "启动示例") 运行后的控制命令如串口打印所示,按s键停止当前操作(包括录像和预览),按q键退出示例程序。 2. 按1进行拍照,拍照的文件格式为jpg,存储在/sdcard,文件名Capture\* **图 2** 输入拍照指令后串口打印日志 - ![](figures/输入拍照指令后串口打印日志.png "输入拍照指令后串口打印日志") + ![](figure/输入拍照指令后串口打印日志.png "输入拍照指令后串口打印日志") 若想查看保存文件,可在退出程序后进入文件系统查看,退出后重新进入请回到步骤1。 **图 3** 查看文件图 - ![](figures/查看文件图.png "查看文件图") + ![](figure/查看文件图.png "查看文件图") 3. 按2进行录像,录像的文件格式为mp4,存储在/sdcard,文件名Record\*,按s键停止 **图 4** 输入录像指令后串口打印日志 - ![](figures/输入录像指令后串口打印日志.png "输入录像指令后串口打印日志") + ![](figure/输入录像指令后串口打印日志.png "输入录像指令后串口打印日志") 4. 按3进行预览,预览图像直接送至显示屏,按s键停止。 **图 5** 输入预览指令后串口打印日志 - ![](figures/输入预览指令后串口打印日志.png "输入预览指令后串口打印日志") + ![](figure/输入预览指令后串口打印日志.png "输入预览指令后串口打印日志") 预览效果如下 **图 6** 预览效果 - ![](figures/预览效果.jpg "预览效果") + ![](figure/预览效果.jpg "预览效果") 5. 按q键退出 **图 7** 输出退出指令后串口打印日志 - ![](figures/输出退出指令后串口打印日志.png "输出退出指令后串口打印日志") + ![](figure/输出退出指令后串口打印日志.png "输出退出指令后串口打印日志") diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-1.md" b/zh-cn/device-dev/guide/device-camera-control-overview.md old mode 100755 new mode 100644 similarity index 65% rename from "zh-cn/device-dev/guide/\346\246\202\350\277\260-1.md" rename to zh-cn/device-dev/guide/device-camera-control-overview.md index f265cdb276c1d92bf06280ad54ba3fb5f210f46d..0bf698b5356079826b7ad124648f76965a4b5770 --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-1.md" +++ b/zh-cn/device-dev/guide/device-camera-control-overview.md @@ -4,7 +4,7 @@ 通过本文档,开发者能够对OpenHarmony的摄像控制有更深入的了解,可参照本例尝试完成“智能猫眼”、“智能后视镜”、“智能带屏音箱”等设备的开发。 -若开发者想先查看示例效果,请进入[应用实例](应用实例-5.md)。如需自定义应用行为,可参考下节“示例开发”对示例代码进行修改。 +若开发者想先查看示例效果,请进入[应用实例](device-camera-control-example.md)。如需自定义应用行为,可参考下节“示例开发”对示例代码进行修改。 -相机应用开发的基本概念请参考:[相机开发概述](../subsystems/相机开发概述.md)。 +相机应用开发的基本概念请参考:[相机开发概述](../subsystems/subsys-multimedia-camera-overview.md)。 diff --git "a/zh-cn/device-dev/guide/\345\261\217\345\271\225\345\222\214\346\221\204\345\203\217\345\244\264\346\216\247\345\210\266.md" b/zh-cn/device-dev/guide/device-camera-control.md old mode 100755 new mode 100644 similarity index 30% rename from "zh-cn/device-dev/guide/\345\261\217\345\271\225\345\222\214\346\221\204\345\203\217\345\244\264\346\216\247\345\210\266.md" rename to zh-cn/device-dev/guide/device-camera-control.md index 7fed33d8a7778766da71be14c1704a1ebb08b0b6..a3e406a2e3c71d213ec842dc8d0722c366570022 --- "a/zh-cn/device-dev/guide/\345\261\217\345\271\225\345\222\214\346\221\204\345\203\217\345\244\264\346\216\247\345\210\266.md" +++ b/zh-cn/device-dev/guide/device-camera-control.md @@ -1,9 +1,9 @@ # 屏幕和摄像头控制 -- **[概述](概述-1.md)** +- **[概述](device-camera-control-overview.md)** -- **[示例开发](示例开发-2.md)** +- **[示例开发](device-camera-control-demo.md)** -- **[应用实例](应用实例-5.md)** +- **[应用实例](device-camera-control-example.md)** diff --git "a/zh-cn/device-dev/guide/\346\267\273\345\212\240\351\241\265\351\235\242.md" b/zh-cn/device-dev/guide/device-camera-visual-addpage.md old mode 100755 new mode 100644 similarity index 82% rename from "zh-cn/device-dev/guide/\346\267\273\345\212\240\351\241\265\351\235\242.md" rename to zh-cn/device-dev/guide/device-camera-visual-addpage.md index 8733bfb1e6d4795483ae7e763c0e6fed857fdc64..3929ffbf6aee8d1ecf8ff07da1e3ceeadfa7b2db --- "a/zh-cn/device-dev/guide/\346\267\273\345\212\240\351\241\265\351\235\242.md" +++ b/zh-cn/device-dev/guide/device-camera-visual-addpage.md @@ -8,7 +8,7 @@ 空气质量监测App包含两个界面(Page),工程创建完成后会生成一个名为index的Page,可以作为首页。工程目录如下图所示: **图 1** 工程目录 -![](figures/工程目录.png "工程目录") +![](figure/工程目录.png "工程目录") ## 创建详情页 @@ -17,18 +17,18 @@ 1. pages目录右键 ,弹出的菜单中选择New、JS Page。 **图 2** 添加页面 - ![](figures/添加页面.png "添加页面") + ![](figure/添加页面.png "添加页面") 2. 输入Page名称。 **图 3** 输入页面名称 - ![](figures/输入页面名称.png "输入页面名称") + ![](figure/输入页面名称.png "输入页面名称") 3. 确认创建结果。 详情页创建完成后应用工程目录如下图所示,每个Page包括三个文件:布局文件hml、样式文件css、业务逻辑代码js。 **图 4** 完整工程目录 - ![](figures/完整工程目录.png "完整工程目录") + ![](figure/完整工程目录.png "完整工程目录") diff --git "a/zh-cn/device-dev/guide/\350\260\203\350\257\225\346\211\223\345\214\205.md" b/zh-cn/device-dev/guide/device-camera-visual-debug.md old mode 100755 new mode 100644 similarity index 50% rename from "zh-cn/device-dev/guide/\350\260\203\350\257\225\346\211\223\345\214\205.md" rename to zh-cn/device-dev/guide/device-camera-visual-debug.md index 5015bd5755d4a5750aeeac6e699c6d8070dc9827..30505bcb3ebf9e4daf0bb1d6adb2b544f19209be --- "a/zh-cn/device-dev/guide/\350\260\203\350\257\225\346\211\223\345\214\205.md" +++ b/zh-cn/device-dev/guide/device-camera-visual-debug.md @@ -1,4 +1,4 @@ # 调试打包 -代码编写完成后,可以进行调试和打包;应用调试及打包方法可以参考[《DevEco Studio使用指南》](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)的[应用调测](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/debug_overview-0000001053822404)和[编译构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/build_overview-0000001055075201)章节。IPCamera应用暂时不支持签名模式,所以需要将应用发布为未签名的应用安装包。 +代码编写完成后,可以进行调试和打包;应用调试及打包方法可以参考[《DevEco Studio使用指南》](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)的[应用调测](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404)和[编译构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/build_overview-0000001055075201)章节。IPCamera应用暂时不支持签名模式,所以需要将应用发布为未签名的应用安装包。 diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\350\257\246\346\203\205\351\241\265.md" b/zh-cn/device-dev/guide/device-camera-visual-details.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/\345\274\200\345\217\221\350\257\246\346\203\205\351\241\265.md" rename to zh-cn/device-dev/guide/device-camera-visual-details.md diff --git "a/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" b/zh-cn/device-dev/guide/device-camera-visual-faqs.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" rename to zh-cn/device-dev/guide/device-camera-visual-faqs.md diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\351\246\226\351\241\265.md" b/zh-cn/device-dev/guide/device-camera-visual-first-page.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/guide/\345\274\200\345\217\221\351\246\226\351\241\265.md" rename to zh-cn/device-dev/guide/device-camera-visual-first-page.md index c80d70f94f323a6a705bb2b1dd1c5823eb490b7d..354097ab25c36055562f5c6469393e8f73fba01d --- "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\351\246\226\351\241\265.md" +++ b/zh-cn/device-dev/guide/device-camera-visual-first-page.md @@ -2,7 +2,7 @@ 应用首页主要展示城市的空气质量概况。首页总共有两屏(可以根据需求设置多屏),每屏显示一个城市的空气质量信息:主要包括AQI指数、城市名称、污染物指数、更新时间和信息来源等数据。 -从第一章节中的[显示效果图](概述-6.md#fig18250512195914)分析可知,首页由三部分组成: +从第一章节中的[显示效果图](device-camera-visual-overview.md#fig18250512195914)分析可知,首页由三部分组成: - 标题栏:位于页面正上方,位置固定,包括应用退出按钮和页面标题。 - 信息栏:主要展示城市的空气信息指标等内容;该页面根据用户需求可设置多屏,且能循环滑动。 @@ -83,7 +83,7 @@ 代码编写完成后,在模拟器中运行项目,显示效果如下图所示: **图 1** 标题栏效果 - ![](figures/标题栏效果.png "标题栏效果") + ![](figure/标题栏效果.png "标题栏效果") 3. 实现城市空气质量信息的多屏左右滑动,需要使用“swiper”组件。 @@ -177,7 +177,7 @@ 代码编写完成后,模拟器运行效果如下: **图 2** 标题栏和信息栏效果 - ![](figures/标题栏和信息栏效果.png "标题栏和信息栏效果") + ![](figure/标题栏和信息栏效果.png "标题栏和信息栏效果") 5. 添加页面位置指示器:由于当前swiper不支持设置indicator,需要开发者自己来实现该效果。在根节点中添加一个子组件div,并设置相应样式;然后在该div中添加两个子组件div,设置两个div的border-radius,并在swiper滑动事件中动态改变对应div的背景色来实现该效果。 @@ -189,7 +189,7 @@ ``` **图 3** 页面位置指示器效果图 - ![](figures/页面位置指示器效果图.png "页面位置指示器效果图") + ![](figure/页面位置指示器效果图.png "页面位置指示器效果图") 6. 所有组件设置样式、动画效果和数据动态绑定,完整代码如下所示: diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-6.md" b/zh-cn/device-dev/guide/device-camera-visual-overview.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/guide/\346\246\202\350\277\260-6.md" rename to zh-cn/device-dev/guide/device-camera-visual-overview.md index 7f8de10aa751682d4f464e131f414fd2f1c920ce..a7e9895e2dceb1911879973ef697791cc59e649d --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-6.md" +++ b/zh-cn/device-dev/guide/device-camera-visual-overview.md @@ -11,5 +11,5 @@ **图 1** 空气质量监测 App显示效果图 -![](figures/Video_2020-07-25_173141.gif) +![](figure/Video_2020-07-25_173141.gif) diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\345\207\206\345\244\207.md" b/zh-cn/device-dev/guide/device-camera-visual-prepare.md old mode 100755 new mode 100644 similarity index 96% rename from "zh-cn/device-dev/guide/\345\274\200\345\217\221\345\207\206\345\244\207.md" rename to zh-cn/device-dev/guide/device-camera-visual-prepare.md index f24d68a539b1f575c5cec0da870f718138055562..55ed7451c0ecdf7d2ab9fd9f896374287a1c5efb --- "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\345\207\206\345\244\207.md" +++ b/zh-cn/device-dev/guide/device-camera-visual-prepare.md @@ -15,7 +15,7 @@ 2. 选择“Smart Vision”下的“Empty Feature Ability”模板。 - ![](figures/zh-cn_image_0000001082434703.png) + ![](figure/zh-cn_image_0000001082434703.png) 3. 点击**Next**,进入到工程配置阶段,需要根据向导配置工程的基本信息。 - **Project Name**:工程的名称,可以自定义。 diff --git "a/zh-cn/device-dev/guide/\347\234\237\346\234\272\350\277\220\350\241\214.md" b/zh-cn/device-dev/guide/device-camera-visual-run.md old mode 100755 new mode 100644 similarity index 70% rename from "zh-cn/device-dev/guide/\347\234\237\346\234\272\350\277\220\350\241\214.md" rename to zh-cn/device-dev/guide/device-camera-visual-run.md index 973019fcce8af2d9c0fde13a096d5c4067df3e6d..3e7c3f1d165781cccae6694ca9327357317a6e40 --- "a/zh-cn/device-dev/guide/\347\234\237\346\234\272\350\277\220\350\241\214.md" +++ b/zh-cn/device-dev/guide/device-camera-visual-run.md @@ -1,6 +1,6 @@ # 真机运行 -应用编译打包后即可安装到开发板。安装应用前需要先完成[DevEco Device Tool的安装配置](https://device.harmonyos.com/cn/docs/ide/user-guides/tool_install-0000001050164976),然后将OpenHarmony烧录到开发板并运行。编译烧录、运行镜像的基本操作请参考快速入门手册:[Hi3516快速入门](../quick-start/Hi3516开发板介绍.md)。完成镜像运行,系统正常启动后,执行如下步骤安装或卸载三方应用。 +应用编译打包后即可安装到开发板。安装应用前需要先完成[DevEco Device Tool的安装配置](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),然后将OpenHarmony烧录到开发板并运行。编译烧录、运行镜像的基本操作请参考快速入门手册:[Hi3516快速入门](../quick-start/quickstart-lite-introduction-hi3516.md#section26131214194212)。完成镜像运行,系统正常启动后,执行如下步骤安装或卸载三方应用。 1. 将IDE编译的未签名应用安装包和安装工具(镜像文件生成目录中的dev\_tools)放在sdcard中,将sdcard插入开发板卡槽。 2. 应用安装默认要校验签名,需要执行以下命令,关闭签名校验。 @@ -20,7 +20,7 @@ 4. 应用安装完成后,可点击桌面应用图标启动应用,进行操作。 **图 1** 桌面 - ![](figures/桌面.png "桌面") + ![](figure/桌面.png "桌面") 5. 卸载应用(可选)。 diff --git a/zh-cn/device-dev/guide/device-camera-visual.md b/zh-cn/device-dev/guide/device-camera-visual.md new file mode 100644 index 0000000000000000000000000000000000000000..ca4e46538b7894fdc3ce840b2b67f185d6e47d29 --- /dev/null +++ b/zh-cn/device-dev/guide/device-camera-visual.md @@ -0,0 +1,19 @@ +# 视觉应用开发 + +- **[概述](device-camera-visual-overview.md)** + +- **[开发准备](device-camera-visual-prepare.md)** + +- **[添加页面](device-camera-visual-addpage.md)** + +- **[开发首页](device-camera-visual-first-page.md)** + +- **[开发详情页](device-camera-visual-details.md)** + +- **[调试打包](device-camera-visual-debug.md)** + +- **[真机运行](device-camera-visual-run.md)** + +- **[常见问题](device-camera-visual-faqs.md)** + + diff --git "a/zh-cn/device-dev/guide/\345\270\246\345\261\217\346\221\204\345\203\217\345\244\264\347\261\273\344\272\247\345\223\201.md" b/zh-cn/device-dev/guide/device-camera.md old mode 100755 new mode 100644 similarity index 38% rename from "zh-cn/device-dev/guide/\345\270\246\345\261\217\346\221\204\345\203\217\345\244\264\347\261\273\344\272\247\345\223\201.md" rename to zh-cn/device-dev/guide/device-camera.md index 0dacd47e009d1b132a2d52dda4d6c6aaa59e10cb..7239a00d3a42e683c3c015e5e22a3a2dc5a12cec --- "a/zh-cn/device-dev/guide/\345\270\246\345\261\217\346\221\204\345\203\217\345\244\264\347\261\273\344\272\247\345\223\201.md" +++ b/zh-cn/device-dev/guide/device-camera.md @@ -1,7 +1,7 @@ # 带屏摄像头类产品 -- **[屏幕和摄像头控制](屏幕和摄像头控制.md)** +- **[屏幕和摄像头控制](device-camera-control.md)** -- **[视觉应用开发](视觉应用开发.md)** +- **[视觉应用开发](device-camera-visual.md)** diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\346\255\245\351\252\244.md" b/zh-cn/device-dev/guide/device-clock-guide.md similarity index 42% rename from "zh-cn/device-dev/guide/\345\274\200\345\217\221\346\255\245\351\252\244.md" rename to zh-cn/device-dev/guide/device-clock-guide.md index ae738663fd4e90e5df3427c9a46dcb6755054fba..a615280a6e27bcf8c37efb75c72ac494e638ad11 100644 --- "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\346\255\245\351\252\244.md" +++ b/zh-cn/device-dev/guide/device-clock-guide.md @@ -1,8 +1,35 @@ -# 开发步骤 +# 时钟应用开发指导 + +- [概述](#section11522349121115) +- [开发准备](#section6592121861218) +- [开发步骤](#section19901741111312) +- [签名打包](#section10601181101516) +- [真机运行](#section092721731511) +- [常见问题](#section1122413460153) + - [hdc\_std连接不到设备](#section1922725151614) + - [hdc\_std运行不了](#section15657547131615) + + +## 概述 + +本文将介绍如何快速搭建基于OpenHarmony标准系统(Hi3516DV300开发板)的应用开发环境,并基于一个时钟APP示例逐步展示应用的创建、开发、调试和安装等流程。示例代码可以通过[本链接](https://gitee.com/openharmony/app_samples/tree/master/common/Clock)获取。 + +时钟App是一款显示实时时间的应用,显示效果如下图所示: + +**图 1** 时钟应用显示效果图 + + +![](figure/Clock.png) + +## 开发准备 + +首先需要下载和配置DevEco Studio,具体操作请参考[DevEco Studio 使用指南](../../application-dev/quick-start/DevEco-Studio(OpenHarmony)使用指南.md)。 + +## 开发步骤 应用的功能是通过表盘和数字显示实时时间。 -从第一章节中的[显示效果图](概述-7.md#fig7763172132019)分析可知,页面由两个部分组成: +从[显示效果图](device-clock-guide.md#fig7763172132019)分析可知,页面由两个部分组成: - 表盘栏:主要展示一个动态的钟表,且钟表指针能准确转动。 - 数字时间栏:主要以数字形式显示当前时间。 @@ -133,98 +160,173 @@ ``` 4. 所有组件设置样式、动画效果和数据动态绑定,完整代码如下所示: - - **index.hml文件** + ``` +
+ + + + + + + {{ hour }}:{{ minute }}:{{ second }} +
+ ``` + + + - **index.css文件** + + ``` + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + } + + .stack { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; + } + + .digit-clock { + font-size: 58px; + width: 100%; + margin-top: 0px; + text-align: center; + } + + .clock-bg { + width: 80%; + height: 80%; + object-fit: scale-down; + } + + .clock-hand { + width: 25%; + height: 65%; + object-fit: contain; + } + ``` + + + - **index.js:** + + js文件主要用于实现App应用的逻辑交互。在本页面js文件中,需要实现如下功能:定时获取系统时间。 + + ``` + export default { + timer: undefined, + data: { + hour: 0, + minute: 0, + second: 0 + }, + onInit() { + this.updateTime() + this.timer = setInterval(this.updateTime, 1000) + }, + updateTime: function () { + var nowTime = new Date() + this.hour = nowTime.getHours() + this.minute = nowTime.getMinutes() + this.second = nowTime.getSeconds() + if (this.hour < 10) { + this.hour = '0' + this.hour + } + if (this.minute < 10) { + this.minute = '0' + this.minute + } + if (this.second < 10) { + this.second = '0' + this.second + } + }, + onDestroy() { + clearInterval(this.timer); + } + } + ``` + + + +## 签名打包 + +代码编写完成后,在真机设备上运行应用,需要先对应用进行签名,然后再进行打包,具体操作请参考[签名打包指导](../../application-dev/quick-start/配置OpenHarmony应用签名信息.md)。 + +## 真机运行 + +应用签名打包后即可安装到开发板。安装应用前需要先完成[DevEco Device Tool的安装配置](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),然后将OpenHarmony系统烧录到开发板并运行。编译烧录、运行镜像的基本操作请参考快速入门手册:[标准系统Hi3516快速入门](../quick-start/quickstart-standard.md)。完成镜像运行,系统正常启动后,执行如下步骤安装或卸载应用。 + +1. 从开发者工具代码仓路径中获取hdc客户端。 + ``` -
- - - - - - - {{ hour }}:{{ minute }}:{{ second }} -
+ developtools/hdc_standard/prebuilt/windows/hdc_std.exe ``` - - **index.css文件** + 修改名称为hdc.exe,并将工具路径加入系统环境path变量中。 + +2. 启动cmd命令窗口,执行以下命令,推送hap应用包到设备目录下并安装。 ``` - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; - } - - .stack { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } - - .digit-clock { - font-size: 58px; - width: 100%; - margin-top: 0px; - text-align: center; - } - - .clock-bg { - width: 80%; - height: 80%; - object-fit: scale-down; - } - - .clock-hand { - width: 25%; - height: 65%; - object-fit: contain; - } + hdc smode + hdc target mount + hdc file send clock.hap /data/clock.hap + hdc shell chmod 666 /data/clock.hap + hdc shell bm install -p /data/clock.hap ``` - - **index.js:** +3. 启动应用。执行以下命令,其中ohos.samples.clock为应用包名,MainAbility为应用启动的Ability。 - js文件主要用于实现App应用的逻辑交互。在本页面js文件中,需要实现如下功能:定时获取系统时间。 + ``` + hdc shell aa start -d 123 -a ohos.samples.clock.MainAbility -b ohos.samples.clock + ``` + +4. 卸载应用(可选)。执行以下命令,其中ohos.samples.clock为应用包名。 ``` - export default { - timer: undefined, - data: { - hour: 0, - minute: 0, - second: 0 - }, - onInit() { - this.updateTime() - this.timer = setInterval(this.updateTime, 1000) - }, - updateTime: function () { - var nowTime = new Date() - this.hour = nowTime.getHours() - this.minute = nowTime.getMinutes() - this.second = nowTime.getSeconds() - if (this.hour < 10) { - this.hour = '0' + this.hour - } - if (this.minute < 10) { - this.minute = '0' + this.minute - } - if (this.second < 10) { - this.second = '0' + this.second - } - }, - onDestroy() { - clearInterval(this.timer); - } - } + hdc shell bm uninstall -n ohos.samples.clock ``` +## 常见问题 + +### hdc\_std连接不到设备 + +- **现象描述** + + 执行 "hdc\_std list targets"命令后结果为:\[Empty\] + +- **可能原因和解决方法** + 1. 设备没有被识别: + + 在设备管理器中查看是否有hdc设备,在通用串行总线设备中会有“HDC Device”信息。如果没有,hdc无法连接。此时需要插拔设备,或者烧写最新的镜像。 + + 2. hdc\_std工作异常: + + 可以执行"hdc kill"或者"hdc start -r"杀掉hdc服务或者重启hdc服务,然后再执行hdc list targets查看是否已经可以获取设备信息。 + + 3. hdc\_std与设备不匹配: + + 如果设备烧写的是最新镜像,hdc\_std也需要使用最新版本。由于hdc\_std会持续更新,请从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录。 + + + +### hdc\_std运行不了 + +- **现象描述** + + 点击hdc\_std.exe文件无法运行。 + +- **可能原因和解决方法** + + hdc\_std.exe不需要安装,直接放到磁盘上就能使用,也可以添加到环境变量中。通过打开cmd执行hdc\_std命令直接使用。 + + diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221-11.md" b/zh-cn/device-dev/guide/device-driver-demo.md similarity index 83% rename from "zh-cn/device-dev/guide/\345\274\200\345\217\221-11.md" rename to zh-cn/device-dev/guide/device-driver-demo.md index a7dedada78968ebaaf7e6f721e9ec4d7cf41994c..73e75ffda88df9a190e7e818a90852cb29c26734 100644 --- "a/zh-cn/device-dev/guide/\345\274\200\345\217\221-11.md" +++ b/zh-cn/device-dev/guide/device-driver-demo.md @@ -1,14 +1,47 @@ -# 开发 +# 平台驱动开发示例 -- [实例化驱动入口](#section6586911816) -- [设置相关参数](#section114323217503) -- [添加控制器](#section115187812516) +- [概述](#section194201316174215) +- [环境准备](#section6926133918422) +- [开发](#section65801539470) + - [文件说明](#section0708184454414) + - [实例化驱动入口](#section85325864412) + - [设置相关参数](#section8155172019453) + - [添加控制器](#section1335374114452) -平台驱动开发包含以下几步: +- [编译及烧录](#section164824754712) -1. 实例化驱动入口: 实例化一个HdfDriverEntry 对象作为驱动入口。 -2. 设置相关参数:通过配置device\_info.hcs,并从HCS获取并解析设备的配置参数以确保驱动能够正确加载。 -3. 添加控制器:初始化控制器硬件,并调用核心层接口完成向核心层添加、删除设备,以及钩子函数的实现等。 +## 概述 + +本文档将以I2C驱动为例,介绍如何基于HDF驱动框架完成平台驱动开发。 + +>![](../public_sys-resources/icon-caution.gif) **注意:** +>本例仅作为平台驱动开发示例参考,开发者不可直接用于商用集成。 + +HDF驱动框架为常用外围设备提供了标准的驱动框架,驱动开发者只需将驱动适配至HDF驱动框架,即可通过HDF驱动框架提供的接口操作外围设备。 + +本文以I2C为例。其时序流程如[图1](#fig148041484161)所示。 + +**图 1** I2C时序流程图 + + +![](figure/zh-cn_image_0000001169991055.png) + +- User Business:用户业务驱动。 +- i2cManagerEntry:I2C管理器入口,注册I2cManager到HDF驱动框架。 +- I2cManager:I2C管理器,管理I2C控制器。 +- I2cCntlr:I2C控制器。 +- i2cDriverEntry:I2C控制器入口,注册I2cCntlr到HDF驱动框架。 + +## 环境准备 + +环境准备具体操作请参考[标准系统基础环境搭建](../quick-start/quickstart-standard.md)。 + +>![](../public_sys-resources/icon-notice.gif) **须知:** +>本示例针对OpenHarmony轻量系统、小型系统、标准系统都适用,本文以标准系统为例。其他系统的开发者可参考对应系统的指导文档进行环境搭建。 + +## 开发 + +### 文件说明 本例中涉及的文件及路径如下表: @@ -72,12 +105,12 @@
->![](public_sys-resources/icon-caution.gif) **注意:** +>![](../public_sys-resources/icon-caution.gif) **注意:** >本例程涉及的文件路径均作为演示,驱动开发者应根据实际情况确定具体的源文件存放位置。 -## 实例化驱动入口 +### 实例化驱动入口 -驱动入口必须为HdfDriverEntry(在hdf\_device\_desc.h中定义)类型的全局变量,且moduleName要和device\_info.hcs中保持一致。在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动,当Init调用异常时,HDF框架会调用Release释放驱动资源并退出。 +实例化一个HdfDriverEntry 对象作为驱动入口。驱动入口必须为HdfDriverEntry(在hdf\_device\_desc.h中定义)类型的全局变量,且moduleName要和device\_info.hcs中保持一致。在加载驱动时HDF框架会先调用Bind函数,再调用Init函数加载该驱动,当Init调用异常时,HDF框架会调用Release释放驱动资源并退出。 I2C驱动中没有实现Bind方法,因为I2C控制器由manager管理,而在manager中已经实现了Bind方法,因此I2C驱动中无需再绑定服务。 @@ -95,7 +128,9 @@ struct HdfDriverEntry g_sampleI2cDriverEntry = { HDF_INIT(g_sampleI2cDriverEntry); ``` -## 设置相关参数 +### 设置相关参数 + +通过配置device\_info.hcs,并从HCS获取并解析设备的配置参数以确保驱动能够正确加载。 1. 添加设备服务节点(必选)。 @@ -121,12 +156,12 @@ HDF_INIT(g_sampleI2cDriverEntry); ``` - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >配置文件中的priority(取值范围为整数0到200)是用来表示host和驱动的优先级,不同的host内的驱动,host的priority值越小,驱动加载优先级越高;同一个host内驱动的priority值越小,加载优先级越高,驱动的priority值相同则不保证加载顺序。 2. 添加配置参数(可选)。 - 有时驱动可能会需要私有配置信息,以确保寄存器的配置可以满足不同产品的需求。如需要私有配置信息,则可以添加一个驱动的配置文件,用来存放一些驱动的默认配置信息,HDF框架在加载驱动的时候,会将对应的配置信息获取并保存在HdfDeviceObject 中的property里面,通过Bind和Init(参考[驱动开发](../driver/驱动开发.md))传递给驱动。驱动开发者可新建配置文件,并在板级驱动hdf.hcs中引用新建的配置文件,本例中直接在原有的配置文件i2c\_config.hcs内添加配置参数。 + 有时驱动可能会需要私有配置信息,以确保寄存器的配置可以满足不同产品的需求。如需要私有配置信息,则可以添加一个驱动的配置文件,用来存放一些驱动的默认配置信息,HDF框架在加载驱动的时候,会将对应的配置信息获取并保存在HdfDeviceObject 中的property里面,通过Bind和Init(参考[驱动开发](../driver/driver-hdf-development.md))传递给驱动。驱动开发者可新建配置文件,并在板级驱动hdf.hcs中引用新建的配置文件,本例中直接在原有的配置文件i2c\_config.hcs内添加配置参数。 本例中编辑i2c\_config.hcs,添加配置参数: @@ -204,7 +239,9 @@ HDF_INIT(g_sampleI2cDriverEntry); ``` -## 添加控制器 +### 添加控制器 + +初始化控制器硬件,并调用核心层接口完成向核心层添加、删除设备,以及钩子函数的实现等。 1. 定义结构体,实现钩子函数并赋值至函数指针。 @@ -394,3 +431,23 @@ HDF_INIT(g_sampleI2cDriverEntry); ``` +## 编译及烧录 + +1. 编辑Makefile,添加源文件: + + ``` + include drivers/hdf/khdf/platform/platform.mk + + obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_core.o \ + $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_if.o \ + ./i2c_adapter.o \ + ./i2c_sample.o + ``` + + "./i2c\_sample.o"为本示例中在Makefile中追加的内容。 + +2. 编译及烧录。 + + 具体操作请参考[标准系统快速入门编译及烧录章节](../quick-start/quickstart-standard.md)。 + + diff --git "a/zh-cn/device-dev/guide/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/guide/device-iotcamera-control-demo-photodevguide.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/guide/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/guide/device-iotcamera-control-demo-photodevguide.md index e59c365a5c6fe2e58a8333157758418d1508175c..31edc27814baddb754614c87ca0225979ef408ff --- "a/zh-cn/device-dev/guide/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/guide/device-iotcamera-control-demo-photodevguide.md @@ -385,6 +385,7 @@ Surface *surface = Surface::CreateSurface(); if (surface == nullptr) { delete fc; + return; } surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */ fc->AddSurface(*surface); diff --git "a/zh-cn/device-dev/guide/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/guide/device-iotcamera-control-demo-videodevguide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/guide/device-iotcamera-control-demo-videodevguide.md diff --git a/zh-cn/device-dev/guide/device-iotcamera-control-demo.md b/zh-cn/device-dev/guide/device-iotcamera-control-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..26be96c626e2e70310352f98858114ba071b1bae --- /dev/null +++ b/zh-cn/device-dev/guide/device-iotcamera-control-demo.md @@ -0,0 +1,7 @@ +# 示例开发 + +- **[拍照开发指导](device-iotcamera-control-demo-photodevguide.md)** + +- **[录像开发指导](device-iotcamera-control-demo-videodevguide.md)** + + diff --git "a/zh-cn/device-dev/guide/\345\272\224\347\224\250\345\256\236\344\276\213.md" b/zh-cn/device-dev/guide/device-iotcamera-control-example.md old mode 100755 new mode 100644 similarity index 68% rename from "zh-cn/device-dev/guide/\345\272\224\347\224\250\345\256\236\344\276\213.md" rename to zh-cn/device-dev/guide/device-iotcamera-control-example.md index 21cb165165fec20314a38415096eb0959a94869d..8f7e480ded6a00d4f830b0bde6413d9412cf7e2d --- "a/zh-cn/device-dev/guide/\345\272\224\347\224\250\345\256\236\344\276\213.md" +++ b/zh-cn/device-dev/guide/device-iotcamera-control-example.md @@ -1,45 +1,45 @@ # 应用实例 -- 开发板介绍、编译烧录、运行镜像等操作请参考[Hi3518快速入门](../quick-start/Hi3518开发板介绍.md),编译结果包含示例,结果文件为out/ipcamera\_hi3518ev300/dev\_tools/bin/camera\_sample,可将文件通过读卡器复制至TF卡中,或者修改camera\_sample的编译脚本将结果文件复制至rootfs.img中。 +- 开发板介绍、编译烧录、运行镜像等操作请参考[Hi3518快速入门](../quick-start/quickstart-lite-introduction-hi3518.md#section14815247616),编译结果包含示例,结果文件为out/ipcamera\_hi3518ev300/dev\_tools/bin/camera\_sample,可将文件通过读卡器复制至TF卡中,或者修改camera\_sample的编译脚本将结果文件复制至rootfs.img中。 修改applications/sample/camera/media/BUILD.gn中的output\_dir。 - 修改前:output\_dir = "$root\_out\_dir/dev\_tools" - - 修改后:output\_dir = "$root\_out\_d_i_r/" + - 修改后:output\_dir = "$root\_out\_dir/" 重新执行源码仓编译并烧写入单板后,可在单板bin目录下找到camera\_sample文件。 - 相机示例代码为applications/sample/camera/media/camera\_sample.cpp。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >实例运行拍照和录像功能需要插入TF卡\(最大容量支持128GB\),系统启动后时自动将TF卡挂载至/sdcard目录,如果在启动后插入则需要手动挂载。查看拍照和录像内容可将TF卡中内容复制到电脑中进行查看,预览功能无需TF卡。 1. 通过cd命令进入可执行程序的末端路径,启动camera\_sample,执行命令如下图。 **图 1** 启动示例 - ![](figures/启动示例.png "启动示例") + ![](figure/启动示例.png "启动示例") 运行后的控制命令如串口打印所示,按s键停止当前操作(包括录像和预览),按q键退出示例程序。 2. 按1进行拍照,拍照的文件格式为jpg,存储在/sdcard,文件名Capture\* **图 2** 输入拍照指令后串口打印日志 - ![](figures/输入拍照指令后串口打印日志.png "输入拍照指令后串口打印日志") + ![](figure/输入拍照指令后串口打印日志.png "输入拍照指令后串口打印日志") 若想查看保存文件,可在退出程序后进入文件系统查看,退出后重新进入请回到步骤1。 **图 3** 查看文件图 - ![](figures/查看文件图.png "查看文件图") + ![](figure/查看文件图.png "查看文件图") 3. 按2进行录像,录像的文件格式为mp4,存储在/sdcard,文件名Record\*,按s键停止 **图 4** 输入录像指令后串口打印日志 - ![](figures/输入录像指令后串口打印日志.png "输入录像指令后串口打印日志") + ![](figure/输入录像指令后串口打印日志.png "输入录像指令后串口打印日志") 4. 按q键退出 **图 5** 输出退出指令后串口打印日志 - ![](figures/输出退出指令后串口打印日志.png "输出退出指令后串口打印日志") + ![](figure/输出退出指令后串口打印日志.png "输出退出指令后串口打印日志") diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-0.md" b/zh-cn/device-dev/guide/device-iotcamera-control-overview.md old mode 100755 new mode 100644 similarity index 61% rename from "zh-cn/device-dev/guide/\346\246\202\350\277\260-0.md" rename to zh-cn/device-dev/guide/device-iotcamera-control-overview.md index e3d5da250e043ac86136b0d8ad5a220f946fefc2..03fef3f55e4efd17bb96166a158e592c0f1316f5 --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-0.md" +++ b/zh-cn/device-dev/guide/device-iotcamera-control-overview.md @@ -4,7 +4,7 @@ 开发者可通过执行示例应用,对开发板的外设控制有了更深入了解后,可使用开发板完成摄像头等设备。 -若开发者想先查看示例效果,请进入[应用实例](应用实例.md)。如需自定义应用行为,可参考下节“示例开发”对示例代码进行修改。 +若开发者想先查看示例效果,请进入[应用实例](device-iotcamera-control-example.md)。如需自定义应用行为,可参考下节“示例开发”对示例代码进行修改。 -相机开发基本概念可参考:[相机开发概述](../subsystems/相机开发概述.md)。 +相机开发基本概念可参考:[相机开发概述](../subsystems/subsys-multimedia-camera-overview.md)。 diff --git a/zh-cn/device-dev/guide/device-iotcamera-control.md b/zh-cn/device-dev/guide/device-iotcamera-control.md new file mode 100644 index 0000000000000000000000000000000000000000..776d324bf5be97b63ce546443cc3cf5ebdd08a71 --- /dev/null +++ b/zh-cn/device-dev/guide/device-iotcamera-control.md @@ -0,0 +1,9 @@ +# 摄像头控制 + +- **[概述](device-iotcamera-control-overview.md)** + +- **[示例开发](device-iotcamera-control-demo.md)** + +- **[应用实例](device-iotcamera-control-example.md)** + + diff --git "a/zh-cn/device-dev/guide/\346\227\240\345\261\217\346\221\204\345\203\217\345\244\264\347\261\273\344\272\247\345\223\201.md" b/zh-cn/device-dev/guide/device-iotcamera.md old mode 100755 new mode 100644 similarity index 56% rename from "zh-cn/device-dev/guide/\346\227\240\345\261\217\346\221\204\345\203\217\345\244\264\347\261\273\344\272\247\345\223\201.md" rename to zh-cn/device-dev/guide/device-iotcamera.md index 7d723b1bfd0ea849891a1cc8faade79f4802c0d2..4823d578306a683d5db28277ac38be5410051e8e --- "a/zh-cn/device-dev/guide/\346\227\240\345\261\217\346\221\204\345\203\217\345\244\264\347\261\273\344\272\247\345\223\201.md" +++ b/zh-cn/device-dev/guide/device-iotcamera.md @@ -1,5 +1,5 @@ # 无屏摄像头类产品 -- **[摄像头控制](摄像头控制.md)** +- **[摄像头控制](device-iotcamera-control.md)** diff --git a/zh-cn/device-dev/guide/device-outerdriver-demo.md b/zh-cn/device-dev/guide/device-outerdriver-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..9526546a58e1da063e682b36e30a6a5f887ea6e7 --- /dev/null +++ b/zh-cn/device-dev/guide/device-outerdriver-demo.md @@ -0,0 +1,483 @@ +# 外设驱动开发示例 + +- [概述](#section86753818426) + - [硬件资源简介](#section123071189431) + - [Input模型简介](#section53684425430) + +- [环境搭建](#section661075474418) +- [TouchScreen器件驱动开发](#section15233162984520) + - [配置设备描述信息](#section16761205604515) + - [配置Touchscreen器件信息](#section156331030144617) + - [适配器件私有驱动](#section17127331595) + +- [编译及烧录](#section16465031164711) +- [调试验证](#section62577313482) +- [Input模型工作流程解析](#section1578569154917) + - [私有配置信息解析](#section1310113815495) + - [管理驱动层初始化及注册驱动至HDF框架](#section614512119500) + - [公共驱动层初始化及注册驱动至HDF框架](#section16194201755019) + - [器件驱动层初始化及注册驱动至HDF框架](#section1090743312505) + - [具体调用逻辑串联函数](#section81801147529) + + +## 概述 + +本文档将介绍如何基于Hi3516DV300开发板完成基于HDF\_Input模型的触摸屏器件驱动开发,从而使开发者快速入门,进行基于的外设驱动开发。 + +### 硬件资源简介 + +Hi3516DV300开发板套件所提供的触摸屏器件IC为GT911,该器件采用标准I2C与主机通信,通过6pin软排线与主板连接。6pin分布以及实物连接图如下图所示: + +![](figure/绘图1.png) + +### Input模型简介 + +Input驱动模型核心部分由设备管理层、公共驱动层、器件驱动层组成。其中: + +- 设备管理层:主要为各类输入设备驱动提供input设备的注册、注销接口,同时统一管理input设备列表; +- 公共驱动层:负责对板级硬件进行初始化、硬件中断处理、向manager注册input设备等; +- 器件驱动层:通过适配平台驱动预留的差异化接口,实现器件驱动开发量最小化; + +此外,Input模型预先实现了数据通道以及设备配置信息解析等函数。 + +关于Input模型的详细介绍请参考《[Touchscreen开发概述](../driver/driver-peripherals-touch-des.md#section175431838101617)》。 + +## 环境搭建 + +环境准备具体操作请参考[标准系统基础环境搭建](../quick-start/quickstart-standard.md)。 + +>![](../public_sys-resources/icon-notice.gif) **须知:** +>本示例针对OpenHarmony轻量系统、小型系统、标准系统都适用,本文以标准系统为例。其他系统的开发者可参考对应系统的指导文档进行环境搭建。 + +## TouchScreen器件驱动开发 + +基于Input模型适配一款触摸屏IC需要完成的具体工作见下。 + +### 配置设备描述信息 + +驱动注册到HDF框架所需要的设备驱动描述信息,如驱动是否加载以及加载次序等。 + +配置文件路径:./drivers/adapter/khdf/linux/hcs/device\_info/device\_info.hcs + +device\_info.hcs中的信息主要提供给HDF框架使用,包含了Input模型各层驱动注册到HDF框架所必需的信息,开发者无特殊场景需求无需改动。各驱动层私有配置信息通过“deviceMatchAttr”字段与input\_config.hcs中的“match\_attr”相关内容进行匹配。 + +配置文件中与input模块相关的内容如下所示,相关字段的详细含义可以参考《[驱动配置](../driver/driver-hdf-development.md)》: + +``` +input :: host { + hostName = "input_host"; + priority = 100; + device_input_manager :: device { // Input管理层设备描述信息 + device0 :: deviceNode { + policy = 2; // 向内核用户态均发布服务 + priority = 100; // input管理层驱动优先级默认为100 + preload = 0; // 加载该驱动 + permission = 0660; // 驱动创建设备节点权限 + moduleName = "HDF_INPUT_MANAGER"; // 与驱动入口的moduleName匹配 + serviceName = "hdf_input_host"; // HDF框架生成的节点名 + deviceMatchAttr = ""; // manager目前不需要私有配置,因此为空 + } + } + + device_hdf_touch :: device { // Input公共驱动层设备描述信息 + device0 :: deviceNode { + policy = 2; // 向内核用户态均发布服务 + priority = 120; // input公共驱动优先级默认为120 + preload = 0; // 加载该驱动 + permission = 0660; // 驱动创建设备节点权限 + moduleName = "HDF_TOUCH"; // 与驱动入口的moduleName匹配 + serviceName = "hdf_input_event1"; // HDF框架生成的节点名 + deviceMatchAttr = "touch_device1"; // 与私有配置信息中的“match_attr”字段保持一致 + } + } + + device_touch_chip :: device { // Input器件驱动层信息 + device0 :: deviceNode { + policy = 0; // 向内核用户态均不发布服务 + priority = 130; // input器件驱动优先级默认为130 + preload = 0; // 加载该驱动 + permission = 0660; // 驱动创建设备节点权限 + moduleName = "HDF_TOUCH_GT911"; // 与驱动入口的moduleName匹配 + serviceName = "hdf_touch_gt911_service";// HDF框架生成的节点名 + deviceMatchAttr = "zsj_gt911_5p5"; //与私有配置信息中的“match_attr”字段保持一致 + } + } + } +``` + +该配置文件中需要重点关注的字段有: + +“priority”决定驱动加载顺序; + +“preload”决定驱动是否加载; + +“moduleName ”需要与驱动注册入口处的“moduleName ”字段保持一致; + +“serviceName ”HDF框架依据该字段创建节点名; + +“deviceMatchAttr ”需要与私有配置信息中的“match\_attr”字段保持一致。 + +通过配置设备描述信息,使得HDF框架通过moduleName与注册至驱动入口的代码相匹配,保证了驱动的正常加载,通过priority字段保证了各驱动的加载顺序。 + +### 配置Touchscreen器件信息 + +器件私有信息包括上下电时序等,平台硬件信息包括器件连接主板的GPIO端口信息等。 + +配置文件路径:./drivers/adapter/khdf/linux/hcs/input/input\_config.hcs + +input\_config.hcs中的信息由驱动代码进行读取解析,主要由公共驱动层的私有配置信息及器件驱动层的私有配置信息组成。文件中的配置包含板级硬件信息及器件私有配置信息,实际业务开发时,可根据具体需求增删及修改对应内容。 + +``` +root { + input_config { + touchConfig { + touch0 { // 第一款触摸屏 + boardConfig { // 板级硬件信息 + match_attr = "touch_device1"; // 与设备描述配置信息中公共驱动层私有配置信息的“match_attr”字段保持一致 + inputAttr { + /* 0:touch 1:key 2:keyboard 3:mouse 4:button 5:crown 6:encoder */ + inputType = 0; // input类型为touch + solutionX = 480; // 分辨率X信息 + solutionY = 960; // 分辨率Y信息 + devName = "main_touch"; // 设备名称 + } + busConfig { + /* 0:i2c 1:spi */ + busType = 0; // GT911采用I2C通信 + busNum = 6; // 与主机芯片第6路I2C通信 + clkGpio = 86; // 主机芯片SCL管脚 + dataGpio = 87; // 主机芯片SDA管脚 + i2cClkIomux = [0x114f0048, 0x403]; // SCL管脚配置信息 + i2cDataIomux = [0x114f004c, 0x403]; // SDA管脚配置信息 + } + pinConfig { + rstGpio = 3; // 复位管脚连接主机芯片的3号管脚 + intGpio = 4; // 中断管脚连接主机芯片的4号管脚 + rstRegCfg = [0x112f0094, 0x400]; // 复位管脚配置信息 + intRegCfg = [0x112f0098, 0x400]; // 中断管脚配置信息 + } + powerConfig { + /* 0:unused 1:ldo 2:gpio 3:pmic */ + vccType = 2; // GPIO供电 + vccNum = 20; // gpio20 + vccValue = 1800; // 电压幅值为1800mV + vciType = 1; // LDO供电 + vciNum = 12; // ldo12 + vciValue = 3300; // 电压幅值为3300mV + } + + featureConfig { + capacitanceTest = 0; // 容值测试 + gestureMode = 0; // 手势模式 + gloverMode = 0; // 手套模式 + coverMode = 0; // 皮套模式 + chargerMode = 0; // 充电模式 + knuckleMode = 0; // 指关节模式 + } + } + chipConfig { // 器件私有信息配置 + template touchChip { // 模板 + match_attr = ""; + chipName = "gt911"; // 触摸屏IC型号 + vendorName = "zsj"; // 供应商 + chipInfo = "AAAA11222"; // 1~4字符代表产品名,5~6字符代表IC型号,7~9字符代表模型型号 + busType = 0; // 0代表I2C,1代表SPI + deviceAddr = 0x5D; // 器件IC通信地址 + irqFlag = 2; // 1代表上升沿触发,2代表下降沿触发,4代表高电平触发,8代表低电平触发 + maxSpeed = 400; // 最大通信速率为400Hz + chipVersion = 0; // 触摸屏IC版本号 + powerSequence { + /* 上电时序的配置含义说明: + [类型, 状态, 方向 , 延时] + 0代表空,1代表vcc电源(1.8V),2代表VCI电源(3.3V),3代表复位管脚,4代表中断管脚 + 0代表下电或拉低,1代表上电或拉高,2代表无操作 + 0代表输入方向,1代表输出方向,2代表无操作 + 代表延时多少毫秒, 例如20代表延时20ms + */ + powerOnSeq = [4, 0, 1, 0, // 中断管脚配置为输出,且进行拉低 + 3, 0, 1, 10, // 复位管脚配置为输出,且进行拉低,延时10ms + 3, 1, 2, 60, // 复位管脚无操作,且进行拉高,延时60ms + 4, 2, 0, 0]; // 中断管脚配置为输入 + suspendSeq = [3, 0, 2, 10]; // 复位管脚无操作,且进行拉低,延时10ms + resumeSeq = [3, 1, 2, 10]; // 复位管脚无操作,且进行拉高,延时10ms + powerOffSeq = [3, 0, 2, 10, // 复位管脚无操作,且进行拉低,延时10ms + 1, 0, 2, 20]; // 电源正极管脚无操作,且进行拉低,延时20ms + } + } + + chip0 :: touchChip { + match_attr = "zsj_gt911_5p5"; // 与设备描述配置信息中器件私有配置信息的“match_attr”字段保持一致 + chipInfo = "ZIDN45100"; // 产品名+模组编号+芯片编号的组合信息 用于给用户态区分当前器件 + chipVersion = 0; // IC型号的版本 + } + } + } + } + } +} +``` + +示例中“touchConfig”包含了“touch0”,"touch0"包含了“boardConfig”与“chipConfig”;“boardConfig”字段包含了Hi3516DV300板级硬件信息,“chipConfig”包含了触摸屏器件的私有信息,如果需要替换触摸屏器件,重新配置“chipConfig”对应的字段信息即可。同时产品可以配置多款触摸屏,示例中用“touch0”代表了套件中默认的触摸屏的硬件接口以及器件的配置信息,如产品需要配置副屏,可在与“touch0”并列的位置配置“touch1”的信息。 + +### 适配器件私有驱动 + +Input模型对Input设备开发流程进行了抽象,开发者只需要适配器件驱动层,无需改动管理驱动层以及公共驱动层。 + +Input模型由三层驱动组成,开发者适配一款全新触摸屏驱动只需要适配器件驱动层即可,重点实现差异化接口,本小节以代码示例的形式展示开发者需要重点完成的工作。 + +1. 触摸屏器件差异化接口适配 + + 示例代码路径:./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c + + ``` + static struct TouchChipOps g_gt911ChipOps = { // 器件IC接口 + .Init = ChipInit, // 初始化 + .Detect = ChipDetect, // 器件检测 + .Resume = ChipResume, // 唤醒 + .Suspend = ChipSuspend, // 休眠 + .DataHandle = ChipDataHandle, // 器件数据读取 + .UpdateFirmware = UpdateFirmware, // 固件升级 + }; + + /* 不同触摸屏厂家使用的IC不一样,对应的寄存器操作也不一样,因此器件驱动层代码重点适配差异化接口部分,如下示例代码展示了GT911的数据解析*/ + + static int32_t ChipDataHandle(ChipDevice *device) + { + ... + /* GT911获取坐标之前需先读取状态寄存器 */ + reg[0] = (GT_BUF_STATE_ADDR >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; + reg[1] = GT_BUF_STATE_ADDR & ONE_BYTE_MASK; + ret = InputI2cRead(i2cClient, reg, GT_ADDR_LEN, &touchStatus, 1); + if (ret < 0 || touchStatus == GT_EVENT_INVALID) { + return HDF_FAILURE; + } + ... + /* 根据状态寄存器的值读取数据寄存器数据 */ + reg[0] = (GT_X_LOW_BYTE_BASE >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; + reg[1] = GT_X_LOW_BYTE_BASE & ONE_BYTE_MASK; + pointNum = touchStatus & GT_FINGER_NUM_MASK; + if (pointNum == 0 || pointNum > MAX_SUPPORT_POINT) { + HDF_LOGE("%s: pointNum is invalid, %u", __func__, pointNum); + (void)ChipCleanBuffer(i2cClient); + OsalMutexUnlock(&device->driver->mutex); + return HDF_FAILURE; + } + frame->realPointNum = pointNum; + frame->definedEvent = TOUCH_DOWN; + (void)InputI2cRead(i2cClient, reg, GT_ADDR_LEN, buf, GT_POINT_SIZE * pointNum); + /* 对获取的数据进行解析 */ + ParsePointData(device, frame, buf, pointNum); + ... + } + static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, uint8_t pointNum) + { + ... + /* 每个坐标值由两个字节组成,对获取的单字节数据进行拼接得到最终的坐标值 */ + for (i = 0; i < pointNum; i++) { + frame->fingers[i].trackId = buf[GT_POINT_SIZE * i + GT_TRACK_ID]; + frame->fingers[i].y = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | + ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); + frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | + ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); + /* 对解析出来的坐标值进行打印 */ + HDF_LOGD("%s: x = %d, y = %d", __func__, frame->fingers[i].x, frame->fingers[i].y); + } + } + ``` + +2. 器件层驱动初始化及注册驱动至HDF框架 + + 示例代码路径:./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c + + ``` + static int32_t HdfGoodixChipInit(struct HdfDeviceObject *device) + { + ... + /* 器件配置结构体内存申请、配置信息解析及挂载 */ + chipCfg = ChipConfigInstance(device); + ... + /* 器件实例化 */ + chipDev = ChipDeviceInstance(); + ... + /* 器件信息挂载及器件私有操作挂载 */ + chipDev->chipCfg = chipCfg; + chipDev->ops = &g_gt911ChipOps; + ... + /* 注册器件驱动至平台驱动 */ + RegisterChipDevice(chipDev); + ... + } + struct HdfDriverEntry g_touchGoodixChipEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH_GT911", // 该moduleName与device_info.hcs文件中器件驱动层的moduleName信息相匹配 + .Init = HdfGoodixChipInit, // 器件驱动初始化函数 + }; + HDF_INIT(g_touchGoodixChipEntry); // 注册器件驱动至HDF框架 + ``` + + 器件私有驱动层主要实现了各器件厂商差异较大的部分,如器件休眠唤醒、数据解析以及固件升级等。 + + 至此,基于HDF框架及Input模型的触摸屏驱动适配完成。 + + +## 编译及烧录 + +1. 编辑Makefile文件,添加本示例中的内容: + + 文件路径:./drivers/adapter/khdf/linux/model/input/Makefile + + 添加内容如下: + + ``` + obj-$(CONFIG_DRIVERS_HDF_TP_5P5_GT911) += \ + $(INPUT_ROOT_DIR)/touchscreen/touch_gt911.o + ``` + + 其中touch\_gt911.o为本示例中追加的内容。 + +2. 具体编译及烧录操作请参考[标准系统快速入门编译及烧录章节](../nottoctopics/zh-cn_topic_0000001135402541.md#section375234715135)。 + +## 调试验证 + +如下所示为开机启动日志部分截取 + +``` +[I/HDF_INPUT_DRV] HdfInputManagerInit: enter // 管理驱动层初始化 +[I/HDF_INPUT_DRV] HdfInputManagerInit: exit succ // 初始化成功 +[I/osal_cdev] add cdev hdf_input_host success +[I/HDF_LOG_TAG] HdfTouchDriverProbe: enter // 公共驱动层初始化 +[I/HDF_LOG_TAG] HdfTouchDriverProbe: main_touch exit succ // 初始化成功 +[I/osal_cdev] add cdev hdf_input_event1 success +[I/HDF_INPUT_DRV] HdfGoodixChipInit: enter // 器件驱动层初始化 +[I/HDF_INPUT_DRV] ChipDetect: IC FW version is 0x1060 +[I/HDF_INPUT_DRV] Product_ID: 911_1060, x_sol = 960, y_sol = 480 +[I/HDF_LOG_TAG] ChipDriverInit: chipDetect succ, ret = 0 +[I/HDF_LOG_TAG] InputDeviceInstance: inputDev->devName = main_touch +[I/HDF_INPUT_DRV] HdfGoodixChipInit: exit succ, chipName = gt911 // 初始化成功 +``` + +## Input模型工作流程解析 + +为了让开发者更清晰的了解Input模型工作流程,本节将对input模型加载的关键流程代码进行说明。 + +>![](../public_sys-resources/icon-notice.gif) **须知:** +>本章节为Input模型工作流程说明,开发者无需进行开发。 + +### 私有配置信息解析 + +示例代码路径:./drivers/framework/model/input/driver/input\_config\_parser.c + +根据OSAL提供的配置解析函数,可以将hcs文件中各字段含义进行解析,具体请参考input\_config\_parser.c中各函数的实现。如果提供的模板不能满足需求,在hcs文件中添加相应信息后,需要根据添加的字段开发相应的解析函数。 + +``` +static int32_t ParseAttr(struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode, BoardAttrCfg *attr) +{ + int32_t ret; + ret = parser->GetUint8(attrNode, "inputType", &attr->devType, 0); // 获取inputType字段信息,保存在BoardAttrCfg结构体中 + CHECK_PARSER_RET(ret, "GetUint8"); + ... + return HDF_SUCCESS; +} +``` + +### 管理驱动层初始化及注册驱动至HDF框架 + +示例代码路径:./drivers/framework/model/input/driver/hdf\_input\_device\_manager.c + +``` +static int32_t HdfInputManagerInit(struct HdfDeviceObject *device) +{ + /* 分配内存给manager,manager中将存放所有input设备 */ + g_inputManager = InputManagerInstance(); + ... +} +struct HdfDriverEntry g_hdfInputEntry = { + .moduleVersion = 1, + .moduleName = "HDF_INPUT_MANAGER", + .Bind = HdfInputManagerBind, + .Init = HdfInputManagerInit, + .Release = HdfInputManagerRelease, +}; + +HDF_INIT(g_hdfInputEntry); //驱动注册入口 +``` + +### 公共驱动层初始化及注册驱动至HDF框架 + +示例代码路径:./drivers/framework/model/input/driver/hdf\_touch.c + +``` +static int32_t HdfTouchDriverProbe(struct HdfDeviceObject *device) +{ + ... + /* 板级信息结构体内存申请及hcs配置信息解析 */ + boardCfg = BoardConfigInstance(device); + ... + /* 公共驱动结构体内存申请 */ + touchDriver = TouchDriverInstance(); + ... + /* 依据解析出的板级信息进行公共资源初始化,如IIC初始化 */ + ret = TouchDriverInit(touchDriver, boardCfg); + if (ret == HDF_SUCCESS) { + ... + /* 添加驱动至公共驱动层驱动管理链表,当设备与驱动进行绑定时使用该链表进行查询 */ + AddTouchDriver(touchDriver); + ... + } + ... +} +struct HdfDriverEntry g_hdfTouchEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH", + .Bind = HdfTouchDriverBind, + .Init = HdfTouchDriverProbe, + .Release = HdfTouchDriverRelease, +}; + +HDF_INIT(g_hdfTouchEntry); //驱动注册入口 +``` + +### 器件驱动层初始化及注册驱动至HDF框架 + +具体请参考[适配器件私有驱动](#section17127331595)器件层驱动初始化及注册驱动至HDF框架部分。 + +### 具体调用逻辑串联函数 + +Input模型管理层驱动init函数初始化了设备管理链表,公共驱动层初始化函数完成了相关结构体的内存申请。器件驱动相关信息通过RegisterChipDevice函数对公共驱动层相关结构体进行信息填充,同时完成了相关硬件信息的初始化(如中断注册等),绑定设备与驱动组成inputDev通过RegisterInputDevice函数向驱动管理层进行注册,在RegisterInputDevice函数中主要实现了将inputDev向设备管理链表的添加等功能。如下所示为两个函数的实现部分: + +``` +//函数具体实现代码位置 :./drivers/framework/model/input/driver/hdf_touch.c +int32_t RegisterChipDevice(ChipDevice *chipDev) +{ + ... + /* 绑定设备与驱动,从而通过InputDeviceInstance函数创建inputDev */ + DeviceBindDriver(chipDev); + ... + /* 主要包含器件中断注册及中断处理函数,中断处理函数中有数据上报用户态的数据通道 */ + ChipDriverInit(chipDev); + ... + /* 申请内存实例化InputDev */ + inputDev = InputDeviceInstance(chipDev); + ... + /* 将InputDev设备注册至input驱动管理层 */ + RegisterInputDevice(inputDev); + ... +} + +//函数具体实现代码位置 :./drivers/framework/model/input/driver/hdf_input_device_manager.c +int32_t RegisterInputDevice(InputDevice *inputDev) +{ + ... + /* 申请ID,该ID对于不同input设备唯一 */ + ret = AllocDeviceID(inputDev); + ... + /* 该函数包含了对hid类设备的特殊处理,对于触摸屏驱动,该函数无实质操作; */ + CreateDeviceNode(inputDev); + /* 内核态数据传送至用户态需使用IOService能力,需要申请buffer */ + AllocPackageBuffer(inputDev); + /* 将input设备添加进设备全局管理链表 */ + AddInputDevice(inputDev); + ... +} +``` + diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221.md" b/zh-cn/device-dev/guide/device-wifi-led-outcontrol.md old mode 100755 new mode 100644 similarity index 64% rename from "zh-cn/device-dev/guide/\345\274\200\345\217\221.md" rename to zh-cn/device-dev/guide/device-wifi-led-outcontrol.md index 18b3247aefef1bb7d1c24a961900349325110ad6..2d4970fa19c09b4fc4140751446e32bbed4e7ee3 --- "a/zh-cn/device-dev/guide/\345\274\200\345\217\221.md" +++ b/zh-cn/device-dev/guide/device-wifi-led-outcontrol.md @@ -1,6 +1,16 @@ -# 开发 +# LED外设控制 -1. 请先完成[《Hi3861快速入门》](../quick-start/Hi3861开发板介绍.md)。 +- [概述](#section14639174516337) +- [开发](#section13857170163412) +- [验证](#section1949121910344) + +## 概述 + +OpenHarmony WLAN模组基于Hi3861平台提供了丰富的外设操作能力,包含I2C、I2S、ADC、UART、SPI、SDIO、GPIO、PWM、FLASH等。本文介绍如何通过调用OpenHarmony的NDK接口,实现对GPIO控制,达到LED闪烁的效果。其他的IOT外设控制,开发者可根据API指导文档完成,此处不逐一介绍。 + +## 开发 + +1. 请先完成[《Hi3861快速入门》](../quick-start/quickstart-lite-introduction-hi3861.md#section19352114194115)。 LED控制参考示例存放于applications/sample/wifi-iot/app/iothardware/led\_example.c文件中。 @@ -10,7 +20,7 @@ #define LED_TEST_GPIO 9 ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >开发板原理图,请开发者联系Hi3861购买渠道客服获取。 3. 使用GPIO前,需要完成GPIO管脚初始化,明确管脚用途,并创建任务,使LED周期性亮灭,达到闪烁的效果。 @@ -35,7 +45,7 @@ /* 启动任务 */ if (osThreadNew((osThreadFunc_t)LedTask, NULL, &attr) == NULL) { - printf("[LedExample] Falied to create LedTask!\n"); + printf("[LedExample] Failed to create LedTask!\n"); } } ``` @@ -89,3 +99,12 @@ ``` +## 验证 + +编译过程请参考《[Hi3861快速入门-源码编译](../quick-start/quickstart-lite-steps-board3861-connection.md#section191121332125319)》,烧录过程请参考《[Hi3861快速入门-镜像烧录](../quick-start/quickstart-lite-steps-board3861-connection.md#section19458165166)》。 + +完成以上两步后,按下RST键复位模组,可发现LED在周期性闪烁,与预期相符,验证完毕。 + +**图 1** LED闪烁图 +![](figure/LED闪烁图.gif "LED闪烁图") + diff --git "a/zh-cn/device-dev/guide/\351\233\206\346\210\220\344\270\211\346\226\271SDK.md" b/zh-cn/device-dev/guide/device-wifi-sdk.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/guide/\351\233\206\346\210\220\344\270\211\346\226\271SDK.md" rename to zh-cn/device-dev/guide/device-wifi-sdk.md index 355c2b275b3e532be944d3b46dee2cc073060f73..8106f68cd6202a165547b6db59ae734fe01e6e6b --- "a/zh-cn/device-dev/guide/\351\233\206\346\210\220\344\270\211\346\226\271SDK.md" +++ b/zh-cn/device-dev/guide/device-wifi-sdk.md @@ -121,7 +121,7 @@ OpenHarmony已规划用于编译业务libs的目录domains/iot/link/libbuild/ 完成以上3点后,需在代码根目录下执行命令“hb build -T //domains/iot/link:iot”,等待执行完成,检查out/hispark\_pegasus/wifiiot\_hispark\_pegasus/libs/目录下是否生成了目标库文件。 -![](figures/zh-cn_image_0000001078563230.png) +![](figure/zh-cn_image_0000001078563230.png) 将库文件拷贝到device/hisilicon/hispark\_pegasus/sdk\_liteos/3rd\_sdk/demolink/libs/ 目录下,并将domains/iot/link/libbuild/ 目录中的.c和.h文件清除。 diff --git "a/zh-cn/device-dev/guide/WLAN\350\277\236\346\216\245\347\261\273\344\272\247\345\223\201.md" b/zh-cn/device-dev/guide/device-wifi.md old mode 100755 new mode 100644 similarity index 39% rename from "zh-cn/device-dev/guide/WLAN\350\277\236\346\216\245\347\261\273\344\272\247\345\223\201.md" rename to zh-cn/device-dev/guide/device-wifi.md index 08afdfcafc40033c66ba69f0f0580ab2e73d13ae..3f85bc6f6c8626e1314093b28146dc989ee55167 --- "a/zh-cn/device-dev/guide/WLAN\350\277\236\346\216\245\347\261\273\344\272\247\345\223\201.md" +++ b/zh-cn/device-dev/guide/device-wifi.md @@ -1,7 +1,7 @@ # WLAN连接类产品 -- **[LED外设控制](LED外设控制.md)** +- **[LED外设控制](device-wifi-led-outcontrol.md)** -- **[集成三方SDK](集成三方SDK.md)** +- **[集成三方SDK](device-wifi-sdk.md)** diff --git a/zh-cn/device-dev/guide/device.md b/zh-cn/device-dev/guide/device.md new file mode 100644 index 0000000000000000000000000000000000000000..1cb2d60315d1a1a78b6b1452c4a4167bbc48ab8a --- /dev/null +++ b/zh-cn/device-dev/guide/device.md @@ -0,0 +1,15 @@ +# 设备开发指南 + +- **[WLAN连接类产品](device-wifi.md)** + +- **[无屏摄像头类产品](device-iotcamera.md)** + +- **[带屏摄像头类产品](device-camera.md)** + +- **[时钟应用开发指导](device-clock-guide.md)** + +- **[平台驱动开发示例](device-driver-demo.md)** + +- **[外设驱动开发示例](device-outerdriver-demo.md)** + + diff --git a/zh-cn/device-dev/guide/figures/Clock.png b/zh-cn/device-dev/guide/figure/Clock.png similarity index 100% rename from zh-cn/device-dev/guide/figures/Clock.png rename to zh-cn/device-dev/guide/figure/Clock.png diff --git "a/zh-cn/device-dev/guide/figures/LED\351\227\252\347\203\201\345\233\276.gif" "b/zh-cn/device-dev/guide/figure/LED\351\227\252\347\203\201\345\233\276.gif" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/LED\351\227\252\347\203\201\345\233\276.gif" rename to "zh-cn/device-dev/guide/figure/LED\351\227\252\347\203\201\345\233\276.gif" diff --git a/zh-cn/device-dev/guide/figures/Video_2020-07-25_173141.gif b/zh-cn/device-dev/guide/figure/Video_2020-07-25_173141.gif old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/guide/figures/Video_2020-07-25_173141.gif rename to zh-cn/device-dev/guide/figure/Video_2020-07-25_173141.gif diff --git a/zh-cn/device-dev/guide/figures/zh-cn_image_0000001078563230.png b/zh-cn/device-dev/guide/figure/zh-cn_image_0000001078563230.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/guide/figures/zh-cn_image_0000001078563230.png rename to zh-cn/device-dev/guide/figure/zh-cn_image_0000001078563230.png diff --git a/zh-cn/device-dev/guide/figures/zh-cn_image_0000001082434703.png b/zh-cn/device-dev/guide/figure/zh-cn_image_0000001082434703.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/guide/figures/zh-cn_image_0000001082434703.png rename to zh-cn/device-dev/guide/figure/zh-cn_image_0000001082434703.png diff --git a/zh-cn/device-dev/guide/figures/zh-cn_image_0000001161922745.png b/zh-cn/device-dev/guide/figure/zh-cn_image_0000001169991055.png similarity index 100% rename from zh-cn/device-dev/guide/figures/zh-cn_image_0000001161922745.png rename to zh-cn/device-dev/guide/figure/zh-cn_image_0000001169991055.png diff --git "a/zh-cn/device-dev/guide/figures/\345\220\257\345\212\250\347\244\272\344\276\213.png" "b/zh-cn/device-dev/guide/figure/\345\220\257\345\212\250\347\244\272\344\276\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\345\220\257\345\212\250\347\244\272\344\276\213.png" rename to "zh-cn/device-dev/guide/figure/\345\220\257\345\212\250\347\244\272\344\276\213.png" diff --git "a/zh-cn/device-dev/guide/figures/\345\256\214\346\225\264\345\267\245\347\250\213\347\233\256\345\275\225.png" "b/zh-cn/device-dev/guide/figure/\345\256\214\346\225\264\345\267\245\347\250\213\347\233\256\345\275\225.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\345\256\214\346\225\264\345\267\245\347\250\213\347\233\256\345\275\225.png" rename to "zh-cn/device-dev/guide/figure/\345\256\214\346\225\264\345\267\245\347\250\213\347\233\256\345\275\225.png" diff --git "a/zh-cn/device-dev/guide/figures/\345\267\245\347\250\213\347\233\256\345\275\225.png" "b/zh-cn/device-dev/guide/figure/\345\267\245\347\250\213\347\233\256\345\275\225.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\345\267\245\347\250\213\347\233\256\345\275\225.png" rename to "zh-cn/device-dev/guide/figure/\345\267\245\347\250\213\347\233\256\345\275\225.png" diff --git "a/zh-cn/device-dev/guide/figures/\346\237\245\347\234\213\346\226\207\344\273\266\345\233\276.png" "b/zh-cn/device-dev/guide/figure/\346\237\245\347\234\213\346\226\207\344\273\266\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\346\237\245\347\234\213\346\226\207\344\273\266\345\233\276.png" rename to "zh-cn/device-dev/guide/figure/\346\237\245\347\234\213\346\226\207\344\273\266\345\233\276.png" diff --git "a/zh-cn/device-dev/guide/figures/\346\240\207\351\242\230\346\240\217\345\222\214\344\277\241\346\201\257\346\240\217\346\225\210\346\236\234.png" "b/zh-cn/device-dev/guide/figure/\346\240\207\351\242\230\346\240\217\345\222\214\344\277\241\346\201\257\346\240\217\346\225\210\346\236\234.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\346\240\207\351\242\230\346\240\217\345\222\214\344\277\241\346\201\257\346\240\217\346\225\210\346\236\234.png" rename to "zh-cn/device-dev/guide/figure/\346\240\207\351\242\230\346\240\217\345\222\214\344\277\241\346\201\257\346\240\217\346\225\210\346\236\234.png" diff --git "a/zh-cn/device-dev/guide/figures/\346\240\207\351\242\230\346\240\217\346\225\210\346\236\234.png" "b/zh-cn/device-dev/guide/figure/\346\240\207\351\242\230\346\240\217\346\225\210\346\236\234.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\346\240\207\351\242\230\346\240\217\346\225\210\346\236\234.png" rename to "zh-cn/device-dev/guide/figure/\346\240\207\351\242\230\346\240\217\346\225\210\346\236\234.png" diff --git "a/zh-cn/device-dev/guide/figures/\346\241\214\351\235\242.png" "b/zh-cn/device-dev/guide/figure/\346\241\214\351\235\242.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\346\241\214\351\235\242.png" rename to "zh-cn/device-dev/guide/figure/\346\241\214\351\235\242.png" diff --git "a/zh-cn/device-dev/guide/figures/\346\267\273\345\212\240\351\241\265\351\235\242.png" "b/zh-cn/device-dev/guide/figure/\346\267\273\345\212\240\351\241\265\351\235\242.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\346\267\273\345\212\240\351\241\265\351\235\242.png" rename to "zh-cn/device-dev/guide/figure/\346\267\273\345\212\240\351\241\265\351\235\242.png" diff --git "a/zh-cn/device-dev/guide/figures/\347\273\230\345\233\2761.png" "b/zh-cn/device-dev/guide/figure/\347\273\230\345\233\2761.png" similarity index 100% rename from "zh-cn/device-dev/guide/figures/\347\273\230\345\233\2761.png" rename to "zh-cn/device-dev/guide/figure/\347\273\230\345\233\2761.png" diff --git "a/zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\345\275\225\345\203\217\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" "b/zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\345\275\225\345\203\217\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\345\275\225\345\203\217\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" rename to "zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\345\275\225\345\203\217\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" diff --git "a/zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\346\213\215\347\205\247\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" "b/zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\346\213\215\347\205\247\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\346\213\215\347\205\247\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" rename to "zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\346\213\215\347\205\247\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" diff --git "a/zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\351\241\265\351\235\242\345\220\215\347\247\260.png" "b/zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\351\241\265\351\235\242\345\220\215\347\247\260.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\351\241\265\351\235\242\345\220\215\347\247\260.png" rename to "zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\351\241\265\351\235\242\345\220\215\347\247\260.png" diff --git "a/zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\351\242\204\350\247\210\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" "b/zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\351\242\204\350\247\210\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\350\276\223\345\205\245\351\242\204\350\247\210\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" rename to "zh-cn/device-dev/guide/figure/\350\276\223\345\205\245\351\242\204\350\247\210\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" diff --git "a/zh-cn/device-dev/guide/figures/\350\276\223\345\207\272\351\200\200\345\207\272\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" "b/zh-cn/device-dev/guide/figure/\350\276\223\345\207\272\351\200\200\345\207\272\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\350\276\223\345\207\272\351\200\200\345\207\272\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" rename to "zh-cn/device-dev/guide/figure/\350\276\223\345\207\272\351\200\200\345\207\272\346\214\207\344\273\244\345\220\216\344\270\262\345\217\243\346\211\223\345\215\260\346\227\245\345\277\227.png" diff --git "a/zh-cn/device-dev/guide/figures/\351\241\265\351\235\242\344\275\215\347\275\256\346\214\207\347\244\272\345\231\250\346\225\210\346\236\234\345\233\276.png" "b/zh-cn/device-dev/guide/figure/\351\241\265\351\235\242\344\275\215\347\275\256\346\214\207\347\244\272\345\231\250\346\225\210\346\236\234\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\351\241\265\351\235\242\344\275\215\347\275\256\346\214\207\347\244\272\345\231\250\346\225\210\346\236\234\345\233\276.png" rename to "zh-cn/device-dev/guide/figure/\351\241\265\351\235\242\344\275\215\347\275\256\346\214\207\347\244\272\345\231\250\346\225\210\346\236\234\345\233\276.png" diff --git "a/zh-cn/device-dev/guide/figures/\351\242\204\350\247\210\346\225\210\346\236\234.jpg" "b/zh-cn/device-dev/guide/figure/\351\242\204\350\247\210\346\225\210\346\236\234.jpg" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/guide/figures/\351\242\204\350\247\210\346\225\210\346\236\234.jpg" rename to "zh-cn/device-dev/guide/figure/\351\242\204\350\247\210\346\225\210\346\236\234.jpg" diff --git a/zh-cn/device-dev/guide/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/guide/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/guide/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/guide/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/guide/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/guide/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/guide/public_sys-resources/icon-note.gif b/zh-cn/device-dev/guide/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/guide/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/guide/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/guide/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/guide/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/guide/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/guide/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/guide/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/guide/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/guide/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/guide/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/guide/\345\205\254\345\205\261\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" "b/zh-cn/device-dev/guide/\345\205\254\345\205\261\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" deleted file mode 100644 index 31de19a1b135135ed4b6481331284bdb35200aee..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\205\254\345\205\261\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" +++ /dev/null @@ -1,35 +0,0 @@ -# 公共驱动层初始化及注册驱动至HDF框架 - -示例代码路径:./drivers/framework/model/input/driver/hdf\_touch.c - -``` -static int32_t HdfTouchDriverProbe(struct HdfDeviceObject *device) -{ - ... - /* 板级信息结构体内存申请及hcs配置信息解析 */ - boardCfg = BoardConfigInstance(device); - ... - /* 公共驱动结构体内存申请 */ - touchDriver = TouchDriverInstance(); - ... - /* 依据解析出的板级信息进行公共资源初始化,如IIC初始化 */ - ret = TouchDriverInit(touchDriver, boardCfg); - if (ret == HDF_SUCCESS) { - ... - /* 添加驱动至公共驱动层驱动管理链表,当设备与驱动进行绑定时使用该链表进行查询 */ - AddTouchDriver(touchDriver); - ... - } - ... -} -struct HdfDriverEntry g_hdfTouchEntry = { - .moduleVersion = 1, - .moduleName = "HDF_TOUCH", - .Bind = HdfTouchDriverBind, - .Init = HdfTouchDriverProbe, - .Release = HdfTouchDriverRelease, -}; - -HDF_INIT(g_hdfTouchEntry); //驱动注册入口 -``` - diff --git "a/zh-cn/device-dev/guide/\345\205\267\344\275\223\350\260\203\347\224\250\351\200\273\350\276\221\344\270\262\350\201\224\345\207\275\346\225\260.md" "b/zh-cn/device-dev/guide/\345\205\267\344\275\223\350\260\203\347\224\250\351\200\273\350\276\221\344\270\262\350\201\224\345\207\275\346\225\260.md" deleted file mode 100644 index 9fc526d2109ecffd5cec6f672a85e5f8f6b173f0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\205\267\344\275\223\350\260\203\347\224\250\351\200\273\350\276\221\344\270\262\350\201\224\345\207\275\346\225\260.md" +++ /dev/null @@ -1,40 +0,0 @@ -# 具体调用逻辑串联函数 - -Input模型管理层驱动init函数初始化了设备管理链表,公共驱动层初始化函数完成了相关结构体的内存申请。器件驱动相关信息通过RegisterChipDevice函数对公共驱动层相关结构体进行信息填充,同时完成了相关硬件信息的初始化(如中断注册等),绑定设备与驱动组成inputDev通过RegisterInputDevice函数向驱动管理层进行注册,在RegisterInputDevice函数中主要实现了将inputDev向设备管理链表的添加等功能。如下所示为两个函数的实现部分: - -``` -//函数具体实现代码位置 :./drivers/framework/model/input/driver/hdf_touch.c -int32_t RegisterChipDevice(ChipDevice *chipDev) -{ - ... - /* 绑定设备与驱动,从而通过InputDeviceInstance函数创建inputDev */ - DeviceBindDriver(chipDev); - ... - /* 主要包含器件中断注册及中断处理函数,中断处理函数中有数据上报用户态的数据通道 */ - ChipDriverInit(chipDev); - ... - /* 申请内存实例化InputDev */ - inputDev = InputDeviceInstance(chipDev); - ... - /* 将InputDev设备注册至input驱动管理层 */ - RegisterInputDevice(inputDev); - ... -} - -//函数具体实现代码位置 :./drivers/framework/model/input/driver/hdf_input_device_manager.c -int32_t RegisterInputDevice(InputDevice *inputDev) -{ - ... - /* 申请ID,该ID对于不同input设备唯一 */ - ret = AllocDeviceID(inputDev); - ... - /* 该函数包含了对hid类设备的特殊处理,对于触摸屏驱动,该函数无实质操作; */ - CreateDeviceNode(inputDev); - /* 内核态数据传送至用户态需使用IOService能力,需要申请buffer */ - AllocPackageBuffer(inputDev); - /* 将input设备添加进设备全局管理链表 */ - AddInputDevice(inputDev); - ... -} -``` - diff --git "a/zh-cn/device-dev/guide/\345\231\250\344\273\266\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" "b/zh-cn/device-dev/guide/\345\231\250\344\273\266\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" deleted file mode 100644 index 4cfddfa469ff7d5812667549270c01baf14befe0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\231\250\344\273\266\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" +++ /dev/null @@ -1,4 +0,0 @@ -# 器件驱动层初始化及注册驱动至HDF框架 - -具体请参考[3.3章节](适配器件私有驱动.md)器件层驱动初始化及注册驱动至HDF框架部分。 - diff --git "a/zh-cn/device-dev/guide/\345\244\226\350\256\276\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" "b/zh-cn/device-dev/guide/\345\244\226\350\256\276\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" deleted file mode 100644 index 8b083827126708b7db7f7d283ed2f34fa392a9ae..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\244\226\350\256\276\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 外设驱动开发示例 - -- **[概述](概述-12.md)** - -- **[环境搭建](环境搭建.md)** - -- **[TouchScreen器件驱动开发](TouchScreen器件驱动开发.md)** - -- **[编译及烧录](编译及烧录-13.md)** - -- **[调试验证](调试验证.md)** - -- **[Input模型工作流程解析](Input模型工作流程解析.md)** - - diff --git "a/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230-10.md" "b/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230-10.md" deleted file mode 100644 index 24be5472457cc6266e3a7f55040bdc377de2639d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\270\270\350\247\201\351\227\256\351\242\230-10.md" +++ /dev/null @@ -1,39 +0,0 @@ -# 常见问题 - -- [hdc\_std连接不到设备](#section1221016541119) -- [hdc\_std运行不了](#section219185710311) - -## hdc\_std连接不到设备 - -- **现象描述** - - 执行 "hdc\_std list targets"命令后结果为:\[Empty\] - -- **可能原因和解决方法** - 1. 设备没有被识别: - - 在设备管理器中查看是否有hdc设备,在通用串行总线设备中会有“HDC Device”信息。如果没有,hdc无法连接。此时需要插拔设备,或者烧写最新的镜像。 - - 2. hdc\_std工作异常: - - 可以执行"hdc kill"或者"hdc start -r"杀掉hdc服务或者重启hdc服务,然后再执行hdc list targets查看是否已经可以获取设备信息。 - - 如果一直获取不到设备信息,请在任务管理器中查询是否有adb进程,该进程可能会对hdc产生干扰,可以将其杀掉后重复执行上面的步骤。 - - 3. hdc\_std与设备不匹配: - - 如果设备烧写的是最新镜像,hdc\_std也需要使用最新版本。由于hdc\_std会持续更新,请从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录。 - - - -## hdc\_std运行不了 - -- **现象描述** - - 点击hdc\_std.exe文件无法运行。 - -- **可能原因和解决方法** - - hdc\_std.exe不需要安装,直接放到磁盘上就能使用,也可以添加到环境变量中。通过打开cmd执行hdc\_std命令直接使用。 - - diff --git "a/zh-cn/device-dev/guide/\345\271\263\345\217\260\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" "b/zh-cn/device-dev/guide/\345\271\263\345\217\260\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" deleted file mode 100644 index 5dc1dd07b55fff2f60df94e5d132d3f02dc1db71..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\271\263\345\217\260\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 平台驱动开发示例 - -- **[概述](概述-10.md)** - -- **[环境准备](环境准备.md)** - -- **[开发](开发-11.md)** - -- **[编译及烧录](编译及烧录.md)** - - diff --git "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\345\207\206\345\244\207-8.md" "b/zh-cn/device-dev/guide/\345\274\200\345\217\221\345\207\206\345\244\207-8.md" deleted file mode 100755 index 52eed11deb14636b5a5cf069cf7fc7dbc62196e1..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\274\200\345\217\221\345\207\206\345\244\207-8.md" +++ /dev/null @@ -1,8 +0,0 @@ -# 开发准备 - -- [准备开发环境和创建工程](#section1912530122716) - -## 准备开发环境和创建工程 - -首先需要下载和配置DevEco Studio,具体操作请参考[DevEco Studio 使用指南](../../application-dev/quick-start/DevEco-Studio(OpenHarmony)使用指南.md)。 - diff --git "a/zh-cn/device-dev/guide/\345\274\200\346\234\272\346\227\245\345\277\227\345\210\206\346\236\220.md" "b/zh-cn/device-dev/guide/\345\274\200\346\234\272\346\227\245\345\277\227\345\210\206\346\236\220.md" deleted file mode 100644 index 469d6a3566fe136c2bb59993abde4b12551e4c03..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\345\274\200\346\234\272\346\227\245\345\277\227\345\210\206\346\236\220.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 开机日志分析 - -如下所示为开机启动日志部分截取 - -``` -[I/HDF_INPUT_DRV] HdfInputManagerInit: enter // 管理驱动层初始化 -[I/HDF_INPUT_DRV] HdfInputManagerInit: exit succ // 初始化成功 -[I/osal_cdev] add cdev hdf_input_host success -[I/HDF_LOG_TAG] HdfTouchDriverProbe: enter // 公共驱动层初始化 -[I/HDF_LOG_TAG] HdfTouchDriverProbe: main_touch exit succ // 初始化成功 -[I/osal_cdev] add cdev hdf_input_event1 success -[I/HDF_INPUT_DRV] HdfGoodixChipInit: enter // 器件驱动层初始化 -[I/HDF_INPUT_DRV] ChipDetect: IC FW version is 0x1060 -[I/HDF_INPUT_DRV] Product_ID: 911_1060, x_sol = 960, y_sol = 480 -[I/HDF_LOG_TAG] ChipDriverInit: chipDetect succ, ret = 0 -[I/HDF_LOG_TAG] InputDeviceInstance: inputDev->devName = main_touch -[I/HDF_INPUT_DRV] HdfGoodixChipInit: exit succ, chipName = gt911 // 初始化成功 -``` - diff --git "a/zh-cn/device-dev/guide/\346\221\204\345\203\217\345\244\264\346\216\247\345\210\266.md" "b/zh-cn/device-dev/guide/\346\221\204\345\203\217\345\244\264\346\216\247\345\210\266.md" deleted file mode 100755 index 65f7df79807efc4e7fb9d33879b707e1d6ec1ce3..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\346\221\204\345\203\217\345\244\264\346\216\247\345\210\266.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 摄像头控制 - -- **[概述](概述-0.md)** - -- **[示例开发](示例开发.md)** - -- **[应用实例](应用实例.md)** - - diff --git "a/zh-cn/device-dev/guide/\346\227\266\351\222\237\345\272\224\347\224\250\345\274\200\345\217\221\347\244\272\344\276\213.md" "b/zh-cn/device-dev/guide/\346\227\266\351\222\237\345\272\224\347\224\250\345\274\200\345\217\221\347\244\272\344\276\213.md" deleted file mode 100644 index 3cbff6960f629645fc6f4cca541d7e0dcbee0722..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\346\227\266\351\222\237\345\272\224\347\224\250\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 时钟应用开发示例 - -- **[概述](概述-7.md)** - -- **[开发准备](开发准备-8.md)** - -- **[开发步骤](开发步骤.md)** - -- **[签名打包](签名打包.md)** - -- **[真机运行](真机运行-9.md)** - -- **[常见问题](常见问题-10.md)** - - diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-10.md" "b/zh-cn/device-dev/guide/\346\246\202\350\277\260-10.md" deleted file mode 100644 index 16734e3f17205895f57f82921da60c53d475f77a..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-10.md" +++ /dev/null @@ -1,26 +0,0 @@ -# 概述 - -- [场景介绍](#section191543223549) - -本文档将以I2C驱动为例,介绍如何基于HDF驱动框架完成平台驱动开发。 - ->![](public_sys-resources/icon-caution.gif) **注意:** ->本例仅作为平台驱动开发示例参考,开发者不可直接用于商用集成。 - -## 场景介绍 - -HDF驱动框架为常用外围设备提供了标准的驱动框架,驱动开发者只需将驱动适配至HDF驱动框架,即可通过HDF驱动框架提供的接口操作外围设备。 - -本文以I2C为例。其时序流程如[图1](#fig148041484161)所示。 - -**图 1** I2C时序流程图 - - -![](figures/zh-cn_image_0000001161922745.png) - -- User Business:用户业务驱动。 -- i2cManagerEntry:I2C管理器入口,注册I2cManager到HDF驱动框架。 -- I2cManager:I2C管理器,管理I2C控制器。 -- I2cCntlr:I2C控制器。 -- i2cDriverEntry:I2C控制器入口,注册I2cCntlr到HDF驱动框架。 - diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-12.md" "b/zh-cn/device-dev/guide/\346\246\202\350\277\260-12.md" deleted file mode 100644 index 0606b801b5eb33741f1c9cb78d67edf52318712a..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-12.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 概述 - -本文档将介绍如何基于Hi3516DV300开发板完成基于HDF\_Input模型的触摸屏器件驱动开发,从而使开发者快速入门,进行基于的外设驱动开发。 - -- **[硬件资源介绍](硬件资源介绍.md)** - -- **[Input模型简介](Input模型简介.md)** - - diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-7.md" "b/zh-cn/device-dev/guide/\346\246\202\350\277\260-7.md" deleted file mode 100755 index e032aa00bcccc4972464e760e165742db5ffdf61..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260-7.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 概述 - -- [效果展示](#section3997224182313) - -本文将介绍如何快速搭建基于OpenHarmony标准系统(Hi3516DV300开发板)的应用开发环境,并基于一个时钟APP示例逐步展示应用的创建、开发、调试和安装等流程。示例代码可以通过[本链接](https://gitee.com/openharmony/app_samples/tree/master/common/Clock)获取。 - -## 效果展示 - -时钟App是一款显示实时时间的应用,显示效果如下图所示: - -**图 1** 时钟应用显示效果图 - - -![](figures/Clock.png) - diff --git "a/zh-cn/device-dev/guide/\346\246\202\350\277\260.md" "b/zh-cn/device-dev/guide/\346\246\202\350\277\260.md" deleted file mode 100755 index 875da92ed1dd39a87faab8a658718423a7ce9d1f..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\346\246\202\350\277\260.md" +++ /dev/null @@ -1,4 +0,0 @@ -# 概述 - -OpenHarmony WLAN模组基于Hi3861平台提供了丰富的外设操作能力,包含I2C、I2S、ADC、UART、SPI、SDIO、GPIO、PWM、FLASH等。本文介绍如何通过调用OpenHarmony的NDK接口,实现对GPIO控制,达到LED闪烁的效果。其他的IOT外设控制,开发者可根据API指导文档完成,此处不逐一介绍。 - diff --git "a/zh-cn/device-dev/guide/\347\216\257\345\242\203\345\207\206\345\244\207.md" "b/zh-cn/device-dev/guide/\347\216\257\345\242\203\345\207\206\345\244\207.md" deleted file mode 100644 index c6ae1a18427ed3bdec92f853ac9d49905d4901a5..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\216\257\345\242\203\345\207\206\345\244\207.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 环境准备 - -环境准备具体操作请参考[标准系统基础环境搭建](../quick-start/标准系统入门.md)。 - ->![](public_sys-resources/icon-notice.gif) **须知:** ->本示例针对OpenHarmony轻量系统、小型系统、标准系统都适用,本文以标准系统为例。其他系统的开发者可参考对应系统的指导文档进行环境搭建。 - diff --git "a/zh-cn/device-dev/guide/\347\216\257\345\242\203\346\220\255\345\273\272.md" "b/zh-cn/device-dev/guide/\347\216\257\345\242\203\346\220\255\345\273\272.md" deleted file mode 100644 index 381ddaa88c0c7136b378691ceae0f1594d54aec7..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\216\257\345\242\203\346\220\255\345\273\272.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 环境搭建 - -环境准备具体操作请参考[标准系统基础环境搭建](../quick-start/标准系统入门.md)。 - ->![](public_sys-resources/icon-notice.gif) **须知:** ->本示例针对OpenHarmony轻量系统、小型系统、标准系统都适用,本文以标准系统为例。其他系统的开发者可参考对应系统的指导文档进行环境搭建。 - diff --git "a/zh-cn/device-dev/guide/\347\234\237\346\234\272\350\277\220\350\241\214-9.md" "b/zh-cn/device-dev/guide/\347\234\237\346\234\272\350\277\220\350\241\214-9.md" deleted file mode 100644 index 30bb3b0801d1ea859f8e3a64d956fbeb91f0e381..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\234\237\346\234\272\350\277\220\350\241\214-9.md" +++ /dev/null @@ -1,35 +0,0 @@ -# 真机运行 - -应用签名打包后即可安装到开发板。安装应用前需要先完成[DevEco Device Tool的安装配置](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),然后将OpenHarmony系统烧录到开发板并运行。编译烧录、运行镜像的基本操作请参考快速入门手册:[标准系统Hi3516快速入门](../quick-start/标准系统入门.md)。完成镜像运行,系统正常启动后,执行如下步骤安装或卸载应用。 - -1. 从开发者工具代码仓路径中获取hdc客户端。 - - ``` - developtools/hdc_standard/prebuilt/windows/hdc_std.exe - ``` - - 修改名称为hdc.exe,并将工具路径加入系统环境path变量中。 - -2. 启动cmd命令窗口,执行以下命令,推送hap应用包到设备目录下并安装。 - - ``` - hdc smode - hdc target mount - hdc file send clock.hap /data/clock.hap - hdc shell chmod 666 /data/clock.hap - hdc shell bm install -p /data/clock.hap - ``` - -3. 启动应用。执行以下命令,其中ohos.samples.clock为应用包名,MainAbility为应用启动的Ability。 - - ``` - hdc shell aa start -d 123 -a ohos.samples.clock.MainAbility -b ohos.samples.clock - ``` - -4. 卸载应用(可选)。执行以下命令,其中ohos.samples.clock为应用包名。 - - ``` - hdc shell bm uninstall -n ohos.samples.clock - ``` - - diff --git "a/zh-cn/device-dev/guide/\347\241\254\344\273\266\350\265\204\346\272\220\344\273\213\347\273\215.md" "b/zh-cn/device-dev/guide/\347\241\254\344\273\266\350\265\204\346\272\220\344\273\213\347\273\215.md" deleted file mode 100644 index 18b33bd5af0271b644fe30b8585e3f6be22a3b55..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\241\254\344\273\266\350\265\204\346\272\220\344\273\213\347\273\215.md" +++ /dev/null @@ -1,6 +0,0 @@ -# 硬件资源介绍 - -Hi3516DV300开发板套件所提供的触摸屏器件IC为GT911,该器件采用标准I2C与主机通信,通过6pin软排线与主板连接。6pin分布以及实物连接图如下图所示: - -![](figures/绘图1.png) - diff --git "a/zh-cn/device-dev/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" "b/zh-cn/device-dev/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" deleted file mode 100755 index eb01bec406aeb05019daeeb14148eaf702bfc598..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 示例开发 - -- **[拍照开发指导](拍照开发指导-3.md)** - -- **[录像开发指导](录像开发指导-4.md)** - -- **[预览开发指导](预览开发指导.md)** - - diff --git "a/zh-cn/device-dev/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" "b/zh-cn/device-dev/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" deleted file mode 100755 index e8128ecaaca0f0b5311d51b7e8f1cd8dc01c00a0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 示例开发 - -- **[拍照开发指导](拍照开发指导.md)** - -- **[录像开发指导](录像开发指导.md)** - - diff --git "a/zh-cn/device-dev/guide/\347\247\201\346\234\211\351\205\215\347\275\256\344\277\241\346\201\257\350\247\243\346\236\220.md" "b/zh-cn/device-dev/guide/\347\247\201\346\234\211\351\205\215\347\275\256\344\277\241\346\201\257\350\247\243\346\236\220.md" deleted file mode 100644 index a472a6dfdfba6d50c291b37dcc1718f56dabaaed..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\247\201\346\234\211\351\205\215\347\275\256\344\277\241\346\201\257\350\247\243\346\236\220.md" +++ /dev/null @@ -1,17 +0,0 @@ -# 私有配置信息解析 - -示例代码路径:./drivers/framework/model/input/driver/input\_config\_parser.c - -根据OSAL提供的配置解析函数,可以将hcs文件中各字段含义进行解析,具体请参考input\_config\_parser.c中各函数的实现。如果提供的模板不能满足需求,在hcs文件中添加相应信息后,需要根据添加的字段开发相应的解析函数。 - -``` -static int32_t ParseAttr(struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode, BoardAttrCfg *attr) -{ - int32_t ret; - ret = parser->GetUint8(attrNode, "inputType", &attr->devType, 0); // 获取inputType字段信息,保存在BoardAttrCfg结构体中 - CHECK_PARSER_RET(ret, "GetUint8"); - ... - return HDF_SUCCESS; -} -``` - diff --git "a/zh-cn/device-dev/guide/\347\255\276\345\220\215\346\211\223\345\214\205.md" "b/zh-cn/device-dev/guide/\347\255\276\345\220\215\346\211\223\345\214\205.md" deleted file mode 100644 index a6fd6f965525ad87ae4b3be7b1987a97ddc0fa39..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\255\276\345\220\215\346\211\223\345\214\205.md" +++ /dev/null @@ -1,4 +0,0 @@ -# 签名打包 - -代码编写完成后,在真机设备上运行应用,需要先对应用进行签名,然后再进行打包,具体操作请参考[签名打包指导](../../application-dev/quick-start/配置OpenHarmony应用签名信息.md)。 - diff --git "a/zh-cn/device-dev/guide/\347\256\241\347\220\206\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" "b/zh-cn/device-dev/guide/\347\256\241\347\220\206\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" deleted file mode 100644 index 73b05bf0b039741952505f3c30c5440a28c1e25b..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\256\241\347\220\206\351\251\261\345\212\250\345\261\202\345\210\235\345\247\213\345\214\226\345\217\212\346\263\250\345\206\214\351\251\261\345\212\250\350\207\263HDF\346\241\206\346\236\266.md" +++ /dev/null @@ -1,22 +0,0 @@ -# 管理驱动层初始化及注册驱动至HDF框架 - -示例代码路径:./drivers/framework/model/input/driver/hdf\_input\_device\_manager.c - -``` -static int32_t HdfInputManagerInit(struct HdfDeviceObject *device) -{ - /* 分配内存给manager,manager中将存放所有input设备 */ - g_inputManager = InputManagerInstance(); - ... -} -struct HdfDriverEntry g_hdfInputEntry = { - .moduleVersion = 1, - .moduleName = "HDF_INPUT_MANAGER", - .Bind = HdfInputManagerBind, - .Init = HdfInputManagerInit, - .Release = HdfInputManagerRelease, -}; - -HDF_INIT(g_hdfInputEntry); //驱动注册入口 -``` - diff --git "a/zh-cn/device-dev/guide/\347\274\226\350\257\221\345\217\212\347\203\247\345\275\225-13.md" "b/zh-cn/device-dev/guide/\347\274\226\350\257\221\345\217\212\347\203\247\345\275\225-13.md" deleted file mode 100644 index 587404009f050d03eeb8b95d221ea1beb2f3e062..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\274\226\350\257\221\345\217\212\347\203\247\345\275\225-13.md" +++ /dev/null @@ -1,17 +0,0 @@ -# 编译及烧录 - -1. 编辑Makefile文件,添加本示例中的内容: - - 文件路径:./drivers/adapter/khdf/linux/model/input/Makefile - - 添加内容如下: - - ``` - obj-$(CONFIG_DRIVERS_HDF_TP_5P5_GT911) += \ - $(INPUT_ROOT_DIR)/touchscreen/touch_gt911.o - ``` - - 其中touch\_gt911.o为本示例中追加的内容。 - -2. 具体编译及烧录操作请参考[标准系统快速入门编译及烧录章节](../quick-start/标准系统入门.md)。 - diff --git "a/zh-cn/device-dev/guide/\347\274\226\350\257\221\345\217\212\347\203\247\345\275\225.md" "b/zh-cn/device-dev/guide/\347\274\226\350\257\221\345\217\212\347\203\247\345\275\225.md" deleted file mode 100644 index 92d839390d5dcacac6fdc98cb576d3e6312a0c69..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\347\274\226\350\257\221\345\217\212\347\203\247\345\275\225.md" +++ /dev/null @@ -1,20 +0,0 @@ -# 编译及烧录 - -1. 编辑Makefile,添加源文件: - - ``` - include drivers/hdf/khdf/platform/platform.mk - - obj-y += $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_core.o \ - $(HDF_PLATFORM_FRAMEWORKS_ROOT)/src/i2c_if.o \ - ./i2c_adapter.o \ - ./i2c_sample.o - ``` - - "./i2c\_sample.o"为本示例中在Makefile中追加的内容。 - -2. 编译及烧录。 - - 具体操作请参考[标准系统快速入门编译及烧录章节](../quick-start/标准系统入门.md)。 - - diff --git "a/zh-cn/device-dev/guide/\350\247\206\350\247\211\345\272\224\347\224\250\345\274\200\345\217\221.md" "b/zh-cn/device-dev/guide/\350\247\206\350\247\211\345\272\224\347\224\250\345\274\200\345\217\221.md" deleted file mode 100755 index b4a8975ab2b1883c7e69e324500c9fc516bb9b7e..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\350\247\206\350\247\211\345\272\224\347\224\250\345\274\200\345\217\221.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 视觉应用开发 - -- **[概述](概述-6.md)** - -- **[开发准备](开发准备.md)** - -- **[添加页面](添加页面.md)** - -- **[开发首页](开发首页.md)** - -- **[开发详情页](开发详情页.md)** - -- **[调试打包](调试打包.md)** - -- **[真机运行](真机运行.md)** - -- **[常见问题](常见问题.md)** - - diff --git "a/zh-cn/device-dev/guide/\350\260\203\350\257\225\351\252\214\350\257\201.md" "b/zh-cn/device-dev/guide/\350\260\203\350\257\225\351\252\214\350\257\201.md" deleted file mode 100644 index f339b20a630cc498481d71394a3f46225e537dfa..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\350\260\203\350\257\225\351\252\214\350\257\201.md" +++ /dev/null @@ -1,5 +0,0 @@ -# 调试验证 - -- **[开机日志分析](开机日志分析.md)** - - diff --git "a/zh-cn/device-dev/guide/\351\200\202\351\205\215\345\231\250\344\273\266\347\247\201\346\234\211\351\251\261\345\212\250.md" "b/zh-cn/device-dev/guide/\351\200\202\351\205\215\345\231\250\344\273\266\347\247\201\346\234\211\351\251\261\345\212\250.md" deleted file mode 100644 index b719de9bacbb19722563054b8aafa6584550bf1c..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\351\200\202\351\205\215\345\231\250\344\273\266\347\247\201\346\234\211\351\251\261\345\212\250.md" +++ /dev/null @@ -1,99 +0,0 @@ -# 适配器件私有驱动 - -Input模型由三层驱动组成,开发者适配一款全新触摸屏驱动只需要适配器件驱动层即可,重点实现差异化接口,本小节以代码示例的形式展示开发者需要重点完成的工作。 - -1. 触摸屏器件差异化接口适配 - - 示例代码路径:./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c - - ``` - static struct TouchChipOps g_gt911ChipOps = { // 器件IC接口 - .Init = ChipInit, // 初始化 - .Detect = ChipDetect, // 器件检测 - .Resume = ChipResume, // 唤醒 - .Suspend = ChipSuspend, // 休眠 - .DataHandle = ChipDataHandle, // 器件数据读取 - .UpdateFirmware = UpdateFirmware, // 固件升级 - }; - - /* 不同触摸屏厂家使用的IC不一样,对应的寄存器操作也不一样,因此器件驱动层代码重点适配差异化接口部分,如下示例代码展示了GT911的数据解析*/ - - static int32_t ChipDataHandle(ChipDevice *device) - { - ... - /* GT911获取坐标之前需先读取状态寄存器 */ - reg[0] = (GT_BUF_STATE_ADDR >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; - reg[1] = GT_BUF_STATE_ADDR & ONE_BYTE_MASK; - ret = InputI2cRead(i2cClient, reg, GT_ADDR_LEN, &touchStatus, 1); - if (ret < 0 || touchStatus == GT_EVENT_INVALID) { - return HDF_FAILURE; - } - ... - /* 根据状态寄存器的值读取数据寄存器数据 */ - reg[0] = (GT_X_LOW_BYTE_BASE >> ONE_BYTE_OFFSET) & ONE_BYTE_MASK; - reg[1] = GT_X_LOW_BYTE_BASE & ONE_BYTE_MASK; - pointNum = touchStatus & GT_FINGER_NUM_MASK; - if (pointNum == 0 || pointNum > MAX_SUPPORT_POINT) { - HDF_LOGE("%s: pointNum is invalid, %u", __func__, pointNum); - (void)ChipCleanBuffer(i2cClient); - OsalMutexUnlock(&device->driver->mutex); - return HDF_FAILURE; - } - frame->realPointNum = pointNum; - frame->definedEvent = TOUCH_DOWN; - (void)InputI2cRead(i2cClient, reg, GT_ADDR_LEN, buf, GT_POINT_SIZE * pointNum); - /* 对获取的数据进行解析 */ - ParsePointData(device, frame, buf, pointNum); - ... - } - static void ParsePointData(ChipDevice *device, FrameData *frame, uint8_t *buf, uint8_t pointNum) - { - ... - /* 每个坐标值由两个字节组成,对获取的单字节数据进行拼接得到最终的坐标值 */ - for (i = 0; i < pointNum; i++) { - frame->fingers[i].trackId = buf[GT_POINT_SIZE * i + GT_TRACK_ID]; - frame->fingers[i].y = (buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | - ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); - frame->fingers[i].x = (buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | - ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET); - /* 对解析出来的坐标值进行打印 */ - HDF_LOGD("%s: x = %d, y = %d", __func__, frame->fingers[i].x, frame->fingers[i].y); - } - } - ``` - -2. 器件层驱动初始化及注册驱动至HDF框架 - - 示例代码路径:./drivers/framework/model/input/driver/touchscreen/touch\_gt911.c - - ``` - static int32_t HdfGoodixChipInit(struct HdfDeviceObject *device) - { - ... - /* 器件配置结构体内存申请、配置信息解析及挂载 */ - chipCfg = ChipConfigInstance(device); - ... - /* 器件实例化 */ - chipDev = ChipDeviceInstance(); - ... - /* 器件信息挂载及器件私有操作挂载 */ - chipDev->chipCfg = chipCfg; - chipDev->ops = &g_gt911ChipOps; - ... - /* 注册器件驱动至平台驱动 */ - RegisterChipDevice(chipDev); - ... - } - struct HdfDriverEntry g_touchGoodixChipEntry = { - .moduleVersion = 1, - .moduleName = "HDF_TOUCH_GT911", // 该moduleName与device_info.hcs文件中器件驱动层的moduleName信息相匹配 - .Init = HdfGoodixChipInit, // 器件驱动初始化函数 - }; - HDF_INIT(g_touchGoodixChipEntry); // 注册器件驱动至HDF框架 - ``` - - 器件私有驱动层主要实现了各器件厂商差异较大的部分,如器件休眠唤醒、数据解析以及固件升级等。 - - 至此,基于HDF框架及Input模型的触摸屏驱动适配完成。 - - diff --git "a/zh-cn/device-dev/guide/\351\205\215\347\275\256Touchscreen\345\231\250\344\273\266\344\277\241\346\201\257.md" "b/zh-cn/device-dev/guide/\351\205\215\347\275\256Touchscreen\345\231\250\344\273\266\344\277\241\346\201\257.md" deleted file mode 100644 index a56381458292b83a64324abba06a4a7301d7a25f..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\351\205\215\347\275\256Touchscreen\345\231\250\344\273\266\344\277\241\346\201\257.md" +++ /dev/null @@ -1,98 +0,0 @@ -# 配置Touchscreen器件信息 - -配置文件路径:./drivers/adapter/khdf/linux/hcs/input/input\_config.hcs - -input\_config.hcs中的信息由驱动代码进行读取解析,主要由公共驱动层的私有配置信息及器件驱动层的私有配置信息组成。文件中的配置包含板级硬件信息及器件私有配置信息,实际业务开发时,可根据具体需求增删及修改对应内容。 - -``` -root { - input_config { - touchConfig { - touch0 { // 第一款触摸屏 - boardConfig { // 板级硬件信息 - match_attr = "touch_device1"; // 与设备描述配置信息中公共驱动层私有配置信息的“match_attr”字段保持一致 - inputAttr { - /* 0:touch 1:key 2:keyboard 3:mouse 4:button 5:crown 6:encoder */ - inputType = 0; // input类型为touch - solutionX = 480; // 分辨率X信息 - solutionY = 960; // 分辨率Y信息 - devName = "main_touch"; // 设备名称 - } - busConfig { - /* 0:i2c 1:spi */ - busType = 0; // GT911采用I2C通信 - busNum = 6; // 与主机芯片第6路I2C通信 - clkGpio = 86; // 主机芯片SCL管脚 - dataGpio = 87; // 主机芯片SDA管脚 - i2cClkIomux = [0x114f0048, 0x403]; // SCL管脚配置信息 - i2cDataIomux = [0x114f004c, 0x403]; // SDA管脚配置信息 - } - pinConfig { - rstGpio = 3; // 复位管脚连接主机芯片的3号管脚 - intGpio = 4; // 中断管脚连接主机芯片的4号管脚 - rstRegCfg = [0x112f0094, 0x400]; // 复位管脚配置信息 - intRegCfg = [0x112f0098, 0x400]; // 中断管脚配置信息 - } - powerConfig { - /* 0:unused 1:ldo 2:gpio 3:pmic */ - vccType = 2; // GPIO供电 - vccNum = 20; // gpio20 - vccValue = 1800; // 电压幅值为1800mV - vciType = 1; // LDO供电 - vciNum = 12; // ldo12 - vciValue = 3300; // 电压幅值为3300mV - } - - featureConfig { - capacitanceTest = 0; // 容值测试 - gestureMode = 0; // 手势模式 - gloverMode = 0; // 手套模式 - coverMode = 0; // 皮套模式 - chargerMode = 0; // 充电模式 - knuckleMode = 0; // 指关节模式 - } - } - chipConfig { // 器件私有信息配置 - template touchChip { // 模板 - match_attr = ""; - chipName = "gt911"; // 触摸屏IC型号 - vendorName = "zsj"; // 供应商 - chipInfo = "AAAA11222"; // 1~4字符代表产品名,5~6字符代表IC型号,7~9字符代表模型型号 - busType = 0; // 0代表I2C,1代表SPI - deviceAddr = 0x5D; // 器件IC通信地址 - irqFlag = 2; // 1代表上升沿触发,2代表下降沿触发,4代表高电平触发,8代表低电平触发 - maxSpeed = 400; // 最大通信速率为400Hz - chipVersion = 0; // 触摸屏IC版本号 - powerSequence { - /* 上电时序的配置含义说明: - [类型, 状态, 方向 , 延时] - 0代表空,1代表vcc电源(1.8V),2代表VCI电源(3.3V),3代表复位管脚,4代表中断管脚 - 0代表下电或拉低,1代表上电或拉高,2代表无操作 - 0代表输入方向,1代表输出方向,2代表无操作 - 代表延时多少毫秒, 例如20代表延时20ms - */ - powerOnSeq = [4, 0, 1, 0, // 中断管脚配置为输出,且进行拉低 - 3, 0, 1, 10, // 复位管脚配置为输出,且进行拉低,延时10ms - 3, 1, 2, 60, // 复位管脚无操作,且进行拉高,延时60ms - 4, 2, 0, 0]; // 中断管脚配置为输入 - suspendSeq = [3, 0, 2, 10]; // 复位管脚无操作,且进行拉低,延时10ms - resumeSeq = [3, 1, 2, 10]; // 复位管脚无操作,且进行拉高,延时10ms - powerOffSeq = [3, 0, 2, 10, // 复位管脚无操作,且进行拉低,延时10ms - 1, 0, 2, 20]; // 电源正极管脚无操作,且进行拉低,延时20ms - } - } - - chip0 :: touchChip { - match_attr = "zsj_gt911_5p5"; // 与设备描述配置信息中器件私有配置信息的“match_attr”字段保持一致 - chipInfo = "ZIDN45100"; // 产品名+模组编号+芯片编号的组合信息 用于给用户态区分当前器件 - chipVersion = 0; // IC型号的版本 - } - } - } - } - } -} -``` - -示例中“touchConfig”包含了“touch0”,"touch0"包含了“boardConfig”与“chipConfig”;“boardConfig”字段包含了Hi3516DV300板级硬件信息,“chipConfig”包含了触摸屏器件的私有信息,如果需要替换触摸屏器件,重新配置“chipConfig”对应的字段信息即可。同时产品可以配置多款触摸屏,示例中用“touch0”代表了套件中默认的触摸屏的硬件接口以及器件的配置信息,如产品需要配置副屏,可在与“touch0”并列的位置配置“touch1”的信息。 - diff --git "a/zh-cn/device-dev/guide/\351\205\215\347\275\256\350\256\276\345\244\207\346\217\217\350\277\260\344\277\241\346\201\257.md" "b/zh-cn/device-dev/guide/\351\205\215\347\275\256\350\256\276\345\244\207\346\217\217\350\277\260\344\277\241\346\201\257.md" deleted file mode 100644 index 4183826a4fa9d0afa0ce01ff2ead4d3c1a0dac70..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\351\205\215\347\275\256\350\256\276\345\244\207\346\217\217\350\277\260\344\277\241\346\201\257.md" +++ /dev/null @@ -1,64 +0,0 @@ -# 配置设备描述信息 - -配置文件路径:./drivers/adapter/khdf/linux/hcs/device\_info/device\_info.hcs - -device\_info.hcs中的信息主要提供给HDF框架使用,包含了Input模型各层驱动注册到HDF框架所必需的信息,开发者无特殊场景需求无需改动。各驱动层私有配置信息通过“deviceMatchAttr”字段与input\_config.hcs中的“match\_attr”相关内容进行匹配。 - -配置文件中与input模块相关的内容如下所示,相关字段的详细含义可以参考《[驱动配置](../driver/驱动开发.md)》: - -``` -input :: host { - hostName = "input_host"; - priority = 100; - device_input_manager :: device { // Input管理层设备描述信息 - device0 :: deviceNode { - policy = 2; // 向内核用户态均发布服务 - priority = 100; // input管理层驱动优先级默认为100 - preload = 0; // 加载该驱动 - permission = 0660; // 驱动创建设备节点权限 - moduleName = "HDF_INPUT_MANAGER"; // 与驱动入口的moduleName匹配 - serviceName = "hdf_input_host"; // HDF框架生成的节点名 - deviceMatchAttr = ""; // manager目前不需要私有配置,因此为空 - } - } - - device_hdf_touch :: device { // Input公共驱动层设备描述信息 - device0 :: deviceNode { - policy = 2; // 向内核用户态均发布服务 - priority = 120; // input公共驱动优先级默认为120 - preload = 0; // 加载该驱动 - permission = 0660; // 驱动创建设备节点权限 - moduleName = "HDF_TOUCH"; // 与驱动入口的moduleName匹配 - serviceName = "hdf_input_event1"; // HDF框架生成的节点名 - deviceMatchAttr = "touch_device1"; // 与私有配置信息中的“match_attr”字段保持一致 - } - } - - device_touch_chip :: device { // Input器件驱动层信息 - device0 :: deviceNode { - policy = 0; // 向内核用户态均不发布服务 - priority = 130; // input器件驱动优先级默认为130 - preload = 0; // 加载该驱动 - permission = 0660; // 驱动创建设备节点权限 - moduleName = "HDF_TOUCH_GT911"; // 与驱动入口的moduleName匹配 - serviceName = "hdf_touch_gt911_service";// HDF框架生成的节点名 - deviceMatchAttr = "zsj_gt911_5p5"; //与私有配置信息中的“match_attr”字段保持一致 - } - } - } -``` - -该配置文件中需要重点关注的字段有: - -“priority”决定驱动加载顺序; - -“preload”决定驱动是否加载; - -“moduleName ”需要与驱动注册入口处的“moduleName ”字段保持一致; - -“serviceName ”HDF框架依据该字段创建节点名; - -“deviceMatchAttr ”需要与私有配置信息中的“match\_attr”字段保持一致。 - -通过配置设备描述信息,使得HDF框架通过moduleName与注册至驱动入口的代码相匹配,保证了驱动的正常加载,通过priority字段保证了各驱动的加载顺序。 - diff --git "a/zh-cn/device-dev/guide/\351\252\214\350\257\201.md" "b/zh-cn/device-dev/guide/\351\252\214\350\257\201.md" deleted file mode 100755 index e9be36acdfb301de6902f16081f4e792cdebe00d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/guide/\351\252\214\350\257\201.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 验证 - -编译过程请参考《[Hi3861快速入门-源码编译](../quick-start/运行Hello-World.md)》,烧录过程请参考《[Hi3861快速入门-镜像烧录](../quick-start/WLAN联网.md)》。 - -完成以上两步后,按下RST键复位模组,可发现LED在周期性闪烁,与预期相符,验证完毕。 - -**图 1** LED闪烁图 -![](figures/LED闪烁图.gif "LED闪烁图") - diff --git "a/zh-cn/device-dev/kernel-contribution/OpenHarmony\345\206\205\346\240\270\346\226\207\346\241\243\345\205\261\345\273\272ToDo-List.md" "b/zh-cn/device-dev/kernel-contribution/OpenHarmony\345\206\205\346\240\270\346\226\207\346\241\243\345\205\261\345\273\272ToDo-List.md" deleted file mode 100644 index ce1082a69f28edf6313a5883728bf45c2b6b3389..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel-contribution/OpenHarmony\345\206\205\346\240\270\346\226\207\346\241\243\345\205\261\345\273\272ToDo-List.md" +++ /dev/null @@ -1,245 +0,0 @@ -# OpenHarmony文档共建计划--内核文档共建 - - - -| 2021-06-28-2021-07-30 | 2021-07-05 | 2021-07-05-2021-07-30 | 2021-08-01-2021-08-31 | -| --------------------------------- | -------------------------------- | -------------------------- | --------------------- | -| **任务招募** | **线上会议** | **文档共建** | **结项发布** | -| ToDo List、文档模板、共建手册大纲 | 文档共建介绍、写作规范、常见操作 | 小组周进展跟踪、导师辅导制 | 发布共建后内核文档 | - -- [如何参与](#section_register) -- [文档共建范围](#section_outline_summary) -- [文档大纲及认领明细](section_outline_detail) - -## 共建活动ToDoList - -OpenHarmony文档共建活动是由OpenHarmony社区举办,旨在进一步丰富和完善现有文档,提升文档体验**,**更好地服务于广大开发者。本次文档共建活动有共建移植文档、内核文档、Qemu仿真文档。详情请参考共建手册大纲:《基于Qemu运行OpenHarmony》、 《小型系统三方芯片移植指南》、《OpenHarmony内核开发指南》。 - -即日起开发者可自主选择并认领感兴趣的任务,获得社区资深**技术导师**和**文档导师**的指导。根据项目的难易程度和完成情况,参与者还将获得"**OpenHarmony 文档共建贡献者** " 荣誉及周边纪念品。 - -1. **活动时间:** 2021-06-28~2021-07-30 - -2. **招募对象:** - - - 技术写作者 - - - 文档验证/审核者 - - - 小组组织人员 - -3. **招募要求:** -- 熟悉嵌入式、物联网等OS开发相关知识 - -- 有扎实的C语言编程经验 - -- 有较强的文字写作能力、逻辑思维能力 - -4. **参与方式:** - - - Gitee社区内认领任务反馈 - - 开发者加入内核文档共建招募活动微信群 -5. 共建激励规则 - -**卓越贡献奖** - -- **奖励对象:**审核通过&内容被采纳的contributor。 - -- **奖励礼品:**OpenHarmonyT恤、帽子等周边纪念品。 - - - -## 如何参与 -- 方式1 [Issue回帖](https://gitee.com/openharmony/docs/issues/I3Y9MU?from=project-issue) -- 方式2 微信交流群报名 -- 方式3 邮件反馈 @neeen @rtos_yuan ,邮件主题:OpenHarmony轻内核文档共建报名 -3种方式均可报名,建议同时提供邮箱,方便后续发送线上会议交流通知。 - - -## 文档共建范围 - -### 1、基于Qemu运行OpenHarmony---招募内容写作 - -- 背景 - - - 对于想体验OpenHarmony的开发者,手头不一定有现成的开发板,基于Qemu可以降低入门体验门槛。 - - - 已经支持Qemu,但是没有对应的文档, 快速入门只有3861、3516、3518等板子。 - -- 文档计划 - - LiteOS-A、LiteOS-M Qemu使用教程第一时间上社区,社区化运作文档,降低社区开发者体验OpenHarmony开发的门槛。 - -- **访问[《基于Qemu运行OpenHarmony 文档大纲》](#section_qemu_outline_detail)。** - -### 2、小型系统三方芯片移植指南---招募内容体验&验证 - -社区支持的开发板有限,三方芯片、开发板移植需要更丰富的开发板场景案例。 -- 文档计划 - - - 鼓励开发者完善移植文档,支持社区开发者移植支持更多的开发板、支持手头的开发板能运行起来。 - - 鼓励移植经验文档回馈社区。 - -- **访问[《小型系统三方芯片移植指南 文档大纲》](#porting_tutorial_outline_detail)。** - -### 3、小型系统内核开发指南(LiteOS-A核)---招募内容体验&验证 - -- 文档计划 - - - 优化后内核文档初稿完成,鼓励开发者体验新内容,验证内容。 - - 社区化文档运作,鼓励社区开发者参与文档的优化编写,文档问题反馈。 - -- **访问[《OpenHarmony 内核开发指南(LiteOS-A核) 文档大纲》](#kernel_a_tutorial_outline_detail)。** - - - - -## 文档大纲及认领明细 - -✨**文档大纲用于维护文档的组成章节、章节意图,编写责任人,及PR合入状态**。 - -✨**使用对号[✔]表示文档的完成状态,第一个对号表示文档开发完成,第二个对号表示文档开发完成**。 - -### 一、基于Qemu运行OpenHarmony 文档大纲 - -#### 1 Qemu简介 [@rtos_yuan](https://gitee.com/rtos_yuan) [✔] [@mgy917](https://gitee.com/mgy917) [✔] - - - -#### 2 开发环境准备 [@mgy917](https://gitee.com/mgy917) [✔] [@rtos_yuan](https://gitee.com/rtos_yuan) [✔] - -- 2.1 OpenHarmony开发环境准备 - - - 环境搭建 - - 获取OpenHarmony源码 - -- 2.2 Qemu软件安装 - - 开发者根据需求,选择运行LiteOS-A、LiteOS-M的Qemu软件。 - - - Qemu软件编译安装 - - Qemu-Virt软件 - - Qemu-Riscv32软件 [@zhushengle](https://gitee.com/zhushengle) [✔] - - - -#### 3 Qemu工程源码介绍 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - -* 3.1 Qemu工程源码介绍 - -#### 4 编译运行LiteOS-A Qemu Virt工程 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - -- 4.1 编译构建LiteOS-A -- 4.2 运行镜像 - - 准备Flash镜像 - - 配置主机网桥 - - 运行程序 - -#### 5 编译运行LiteOS-M Qemu Riscv工程 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - -- 4.1 编译构建LiteOS-M -- 4.2 运行程序 - -### 二、小型系统三方芯片移植指南 ---招募内容体验&验证 - -#### 1 移植准备 [@arvinzzz](https://gitee.com/arvinzzz) [✔] [@rtos_yuan](https://gitee.com/rtos_yuan) [✔] - - - -##### 1.1 移植须知 - -##### 1.2 编译构建 - -#### 2 内核移植 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - -- 2.1 LiteOS-A内核 - - - - - 2.1.1 移植概述 - - 2.1.2 内核基础适配 - - 2.1.3 内核移植验证 - -- 2.2 Linux内核 - - - -#### 3 板级移植 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - - - -### 三、小型系统内核开发指南(LiteOS-A核)---招募内容体验&验证 - -#### 1 认识LiteOS-A内核 [@kkup180](https://gitee.com/kkup180) [✔] [@mgy917](https://gitee.com/mgy917) [✔] - - - -- 1.1 简介 -- 1.2 内核架构 -- 1.3 CPU体系架构支持 - -#### 2 基础内核 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - - - -- 2.1 中断及异常处理 -- 2.2 进程管理 -- 2.3 线程管理 -- 2.4 调度 -- 2.5 内存管理 - - 2.5.1 堆内存管理 - - 2.5.2 虚拟内存管理 - - 2.5.3 物理内存管理 - - 2.5.4 虚实映射 -- 2.6 IPC - - 2.6.1 事件 - - 2.6.2 信号量 - - 2.6.3 互斥锁 - - 2.6.4 消息队列 - - 2.6.5 读写锁 - - 2.6.6 futex - - 2.6.7 信号 -- 2.7 系统调用 -- 2.8 时间管理 -- 2.9 软件定时器 -- 2.10 原子操作 -#### 3 扩展组件 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - - - -- 3.1 ELF内核加载器 -- 3.2 VDSO -- 3.3 LiteIPC -- 3.4 CPUP -- 3.5 C++支持 -#### 4 文件系统 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - - - -- 4.1 vfs - -- 4.2 支持的文件系统 - - 4.2.1 FAT - - 4.2.2 jffs2 - - 4.2.3 nfs - - 4.2.4 ramfs - - 4.2.5 procfs -- 4.3 适配新的文件系统 -#### 5 内核启动 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] -- 5.1 运行机制 -#### 6 用户态启动 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] -- 6.1 用户态根进程启动 -- 6.2 用户态程序运行 -#### 7 调测 [@waitForContributor](https://gitee.com/openharmony/docs/issues)[ ?] - - - -- 7.1 内存调测 -- 7.2 Trace -- 7.3 魔法键 -- 7.4 Dying gasp -- 7.5 常见问题定位方法 -#### 8 附录 [@rtos_yuan](https://gitee.com/rtos_yuan) [✔] [@harylee](https://gitee.com/harylee)[✔] -- 8.1 基本数据结构 - - 8.1.1 双向链表 - - 8.1.2 位操作 - diff --git "a/zh-cn/device-dev/kernel-contribution/template/\345\270\270\350\247\201\351\227\256\351\242\230.md" "b/zh-cn/device-dev/kernel-contribution/template/\345\270\270\350\247\201\351\227\256\351\242\230.md" deleted file mode 100644 index 976524f98b7145daf34642bd563c4d442de35cd6..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel-contribution/template/\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ /dev/null @@ -1,51 +0,0 @@ -# 常见问题 - -** *【写作要求】*** - - -*可选。描述开发过程遇到的各类问题以及解决方案,以提高开发效率。* - - -- * 如果无常见问题,删除此章节。* - -- * 如果有常见问题,建议单独章节,后续具备扩展性。* - -- * 如果有常见问题,问题少于1屏且未来扩充可能性不大,可放在“开发指导”。* - - -*具体写作要求见下,完成写作后,请逐项自检下。* - - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| **N1** | **整体要求** | | -| N1.1 | 问题是否对外呈现(考虑重要性、出现概率等),请在部门内部CCB达成一致。 | | -| N1.2 | 每个问题描述里一般只问一个问题,避免多个问题合在一个问题描述。 | | -| N1.3 | 如果问题比较多,可以对问题进行分类。 | | -| **N2** | **单个问题要求** | | -| N2.1 | 标题:1句话描述问题场景、现象。 | | -| N2.2 | 现象描述:以用户视角黑盒描述问题出现的场景、现象、条件、概率等。描述问题现象清晰,没有歧义。 | | -| N2.3 | 可能原因:明确问题根本的原因。 | | -| N2.4 | 处理步骤-1:明确处理问题的步骤,step by step操作,具体要求同“开发步骤”部分。 | | -| N2.5 | 处理步骤-2:答复必须是严谨、明确的解决方法,口径与产品宣传一致,不能是参考建议这类含糊的回答。 | | -| N2.6 | 处理步骤-3:如果问题与能力版本有关联性的,需要明确。 | | - - -## 1.XX问题(简单问题) - -XXX - - -## 2.XX问题(复杂问题) - -**现象描述** - -XXX - -**可能原因** - -XXX - -**解决办法** - -XXX diff --git "a/zh-cn/device-dev/kernel-contribution/template/\345\274\200\345\217\221\345\256\236\344\276\213.md" "b/zh-cn/device-dev/kernel-contribution/template/\345\274\200\345\217\221\345\256\236\344\276\213.md" deleted file mode 100644 index 54133ebda8d12e93b00dfd1c9be5f062874cbe77..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel-contribution/template/\345\274\200\345\217\221\345\256\236\344\276\213.md" +++ /dev/null @@ -1,49 +0,0 @@ -# 开发实例 - -** *【写作要求】*** - - -*必选。描述开发完成后,基于一个任务整体做代码段的描述。* - - -- * 标题名称不变。如果“开发指导”是多场景,标题名称可以调整为拍照开发实例、预览开发指导等。* - -- * 标题可合并。如果产品链接到示例代码或内容少于1屏,可合并到“开发指导”,整本统一。* - - -*具体写作要求见下,完成写作后,请逐项自检下。* - - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| M1.1 | 有任务的场景介绍,且和代码端内容呼应。 | | -| M1.2 | 代码段顺利指导完成操作,无缺失。 | | -| M1.3 | 代码涉及开发者拷贝的命令,必须用可编辑的报文呈现,避免截图(DOCS插入Screen)。 | | -| M1.4 | 代码中关键段用蓝色(RGB:0.0.255)突出显示,关键步骤要有注释说明。 | | -| M1.5 | 代码显示符合代码缩进要求。 | | - - -**【写作样例---节选】** - - -SDIO设备完整的使用示例如下所示,首先打开总线号为1的SDIO控制器,然后独占HOST、使能设备、注册中断,接着进行SDIO通信(读写等),通信完成之后,释放中断、去使能设备、释放HOST,最后关闭SDIO控制器。 -``` -#include "hdf_log.h" -#include "sdio_if.h" - -#define TEST_FUNC_NUM 1 /* 本测试用例中,使用编号为1的I/O function */ -#define TEST_FBR_BASE_ADDR 0x100 /* 编号为1的I/O function的FBR基地址 */ -#define TEST_ADDR_OFFSET 9 /* 本测试用例中,需要读写的寄存器的地址偏移 */ -#define TEST_DATA_LEN 3 /* 本测试用例中,读写数据的长度 */ -#define TEST_BLOCKSIZE 2 /* 本测试用例中,数据块的大小,单位字节 */ - -/* 中断服务函数,需要根据各自平台的情况去实现 */ -static void SdioIrqFunc(void *data) -{ - if (data == NULL) { - HDF_LOGE("SdioIrqFunc: data is NULL.\n"); - return; - } - /* 需要开发者自行添加具体的实现 */ -} -``` diff --git "a/zh-cn/device-dev/kernel-contribution/template/\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/device-dev/kernel-contribution/template/\345\274\200\345\217\221\346\214\207\345\257\274.md" deleted file mode 100644 index 2b4b6a3a9381255de70fbcd23281176f0e38560b..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel-contribution/template/\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ /dev/null @@ -1,128 +0,0 @@ -# 开发指导 - -** *【写作要求】*** - - -*必选。* *描述各个场景下,开发者如何完成开发任务。* *可根据多场景任务增加章节。写作要求见下,完成写作后,请逐项自检。* - - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| H.1.1 | 如果有多个场景,请写起多个“开发指导”章节,如音频播放开发指导、音量管理开发指导、短音播放开发指导。 | | -| H.1.2 | 标题尽量使用“动词+名词”的句式表述任务操作。 | | - - -## 场景介绍 - -** *【写作要求】*** - -*必选。* *描述在什么情景下解决什么问题,最终达到什么样的效果。*应用SCQA描述方法: - -- S:situation(情景),由大家都熟悉的的情景,事实引入。 - -- C:complication(冲突),但是实际情况往往和我们的要求有冲突。 - -- Q:question(疑问),怎么办? - -- A:answer(回答),我们的解决方案是 … - -*写作要求见下,完成写作后,请逐项自检。* - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| I.1.1 | 背景原因、什么时候在哪、做了什么操作、最终解决什么问题或操作效果都明确。 | | - -**【写作样例】** - -音频播放的主要工作是将音频数据转码为可听见的音频模拟信号并通过输出设备进行播放,同时对播放任务进行管理。 - - -## 接口说明 - -** *【写作要求】*** - -*必选。* *描述本开发指导相关的接口有哪些,旨在要开发者在开发前有大体了解,提升开发效率。* *写作要求见下,完成写作后,请逐项自检。* - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| J.1.1 | 不在本开发任务的接口无需提供。 | | -| J.1.2 | 如果接口太多,超过10个,可以提供主要的接口 | | - -**【写作样例】** - -音频播放开放能力如下:AudioRenderer类,具体的API详见接口文档。 - -**表1** 音频播放API接口功能介绍 - -| 接口名 | 描述 | -| -------- | -------- | -| AudioRenderer(AudioRendererInfo audioRendererInfo, PlayMode pm) throws IllegalArgumentException | 构造函数,设置播放相关音频参数和播放模式,使用默认播放设备 | -| AudioRenderer(AudioRendererInfo audioRendererInfo, PlayMode pm, AudioDeviceDescriptor outputDevice) throws IllegalArgumentException | 构造函数,设置播放相关音频参数、播放模式和播放设备 | -| boolean play() | 播放音频流 | -| boolean write(byte[] data, int offset, int size) | 将音频数据以byte流写入音频接收器以进行播放 | - - -## 开发步骤 - -** *【写作要求】*** - - * 必选。描述* *开发的整体过程,便于开发者快速完成开发。* * 具体 写作要求见下,完成写作后,请逐项自检下。* -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| **K.1** | **如何写好步骤** | | -| K.1.1 | 步骤完整:提供必须的步骤,顺利指导完成操作,无缺失。 | | -| K.1.2 | 脉络清楚:文档逻辑清晰、合理。文档前面的概述、准备、操作围绕一条线描述,不能章节断裂或前后矛盾的现象。 | | -| K.1.3 | 任务句式:标题或句子尽量使用“动词+名词”的句式表述动作。 | | -| K.1.4 | 预防提前:操作过程中的限制、易错的、有潜在风险的,要提前描述,使用DOCS平台的“插入> 说明 > 须知”描述。 | | -| K.1.5 | 步骤清晰-1:无论步骤简单或复杂,都需要写步骤目的,即为什么做。 | | -| K.1.6 | 步骤清晰-2:明确在什么环境下,使用什么工具,做什么操作,怎么做该操作。 | | -| K.1.7 | 步骤具体:如果操作可选,要明确可选条件。 | | -| K.1.8 | 在开发步骤执行完成后,及时明确操作正确的标准。 | | -| **K.2** | **如何写好代码段** | | -| K.2.1 | 代码涉及开发者拷贝的命令,必须用可编辑的报文呈现,避免截图(DOCS插入Screen)。 | | -| K.2.2 | 代码中关键段用蓝色(RGB:0.0.255)突出显示,关键步骤要有注释说明。 | | -| K.2.3 | 代码显示符合代码缩进要求。 | | -| K.2.4 | 步骤涉及接口调用,清晰给出接口及其使用说明或示例代码,代码来源于具体实例。 | | - -**【写作样例】** - -1. 构造音频流参数的数据结构AudioStreamInfo,推荐使用AudioStreamInfo.Builder类来构造,模板如下,模板中设置的均为AudioStreamInfo.Builder类的默认值,根据音频流的具体规格来设置具体参数。 - ``` - AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder().sampleRate( AudioStreamInfo.SAMPLE_RATE_UNSPECIFIED) .audioStreamFlag(AudioStreamInfo.AudioStreamFlag.AUDIO_STREAM_FLAG_NONE) .encodingFormat(AudioStreamInfo.EncodingFormat.ENCODING_INVALID) .channelMask(AudioStreamInfo.ChannelMask.CHANNEL_INVALID) .streamUsage(AudioStreamInfo.StreamUsage.STREAM_USAGE_UNKNOWN) .build(); - ``` - - 以真实的播放pcm流为例: - ``` - AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder().sampleRate(44100)//44.1kHz .audioStreamFlag(AudioStreamInfo.AudioStreamFlag.AUDIO_STREAM_FLAG_MAY_DUCK)//混音 .encodingFormat(AudioStreamInfo.EncodingFormat.ENCODING_PCM_16BIT)//16-bit PCM .channelMask(AudioStreamInfo.ChannelMask.CHANNEL_OUT_STEREO)//双声道 .streamUsage(AudioStreamInfo.StreamUsage.STREAM_USAGE_MEDIA)//媒体类音频 .build(); - ``` - -2. 使用步骤1创建的音频流构建音频播放的参数结构AudioRendererInfo,推荐使用AudioRendererInfo.Builder类来构造,模板如下,模板中设置的均为AudioRendererInfo.Builder类的默认值,根据音频播放的具体规格来设置具体参数。 - ``` - AudioRendererInfo audioRendererInfo = new AudioRendererInfo.Builder().audioStreamInfo(audioStreamInfo) .audioStreamOutputFlag(AudioRendererInfo.AudioStreamOutputFlag.AUDIO_STREAM_OUTPUT_FLAG_NONE) .bufferSizeInBytes(0) .distributedDeviceId("") .isOffload(false) .sessionID(AudioRendererInfo.SESSION_ID_UNSPECIFIED) .build(); - ``` - - 以真实的播放pcm流为例: - ``` - AudioRendererInfo audioRendererInfo = new AudioRendererInfo.Builder().audioStreamInfo(audioStreamInfo) .audioStreamOutputFlag(AudioRendererInfo.AudioStreamOutputFlag.AUDIO_STREAM_OUTPUT_FLAG_DIRECT_PCM)//pcm格式的输出流 .bufferSizeInBytes(100) .distributedDeviceId("E54***5E8")//使用分布式设备E54***5E8播放 .isOffload(false)//false表示分段传输buffer并播放,true表示整个音频流一次性传输到HAL层播放 .build(); - ``` - -3. 根据要播放音频流指定PlayMode,不同的PlayMode在写数据时存在差异,详情见步骤7,其余播放流程是无区别的。并通过构造函数获取AudioRenderer类的实例化对象。 - .... - -4. 播放任务结束后,调用AudioRenderer实例化对象的release()释放资源。 - - -## 调测验证(可选) - -** *【写作要求】*** - -*可选。* *描述开发完成后,进行调测验证,确保最终操作成功。* *操作步骤要求同“开发指导”,其他具体写作要求见下,完成写作后,请逐项自检下。* - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| L1.1 | 仅进行最后的业务调测,每个小任务的操作结果,在开发步骤执行完成后,及时验证操作结果。 | | -| L1.2 | 明确开发成功标准。 | | - -**【写作样例---节选】** - -![1624266401415](C:\Users\LWX104~1\AppData\Local\Temp\1624266401415.png) diff --git "a/zh-cn/device-dev/kernel-contribution/template/\346\220\255\345\273\272\347\216\257\345\242\203.md" "b/zh-cn/device-dev/kernel-contribution/template/\346\220\255\345\273\272\347\216\257\345\242\203.md" deleted file mode 100644 index 743adf6abcf01ab23d2112c2cffd2fb99d3db197..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel-contribution/template/\346\220\255\345\273\272\347\216\257\345\242\203.md" +++ /dev/null @@ -1,82 +0,0 @@ -# 搭建环境 - -** *【写作要求】*** - - -*条件必选。* *如果在快速入门里已提供此部分,此章节可以不提供。明确如何搭建开发环境(如开发工具、编译工具)*。 - - -## 环境要求 - -** *【写作要求】*** - -*必选。* *明确开发环境所需要的软硬件配置,* *旨在要用户提前准备环境。*如果软硬件内容比较多,可以再增加子标题。写作要求见下,完成写作后,请逐项自检。 - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| E.1.1 | 分别明确开发的软硬环境和手机的开发环境,下载路径。 | | -| E1.2 | 明确具体的版本号。 | | - - -**【写作样例】** - - -**表1** 环境要求 - -| 项目 | PC | 手机 | -| -------- | -------- | -------- | -| 硬件 | - 内存:8G及以上
- 硬盘:100G及以上
- 分辨率:1280\*800 | 处理器不低于kirin 980的华为手机 | -| 软件 | 操作系统:Windows10 64位  或 Mac 10。 | 系统软件版本不低于EMUI_10.0.0 | - - -## 安装环境 - -** *【写作要求】*** - -必选。描述安装环境的具体步骤,如果内容比较多,可以区分安装环境章节,如:安装编译基础环境、安装编译工具环境、安装gcc_riscv32(WLAN模组类编译工具链)。 - -写作要求见下,完成写作后,请逐项自检。 - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| **F.1** | **如何写好步骤** | | -| F.1.1 | 步骤完整:提供必须的步骤,顺利指导完成操作,无缺失。 | | -| F.1.2 | 脉络清楚:文档逻辑清晰、合理。文档前面的概述、准备、操作围绕一条线描述,不能章节断裂或前后矛盾的现象。 | | -| F.1.3 | 任务句式:标题或句子尽量使用“动词+名词”的句式表述动作。 | | -| F.1.4 | 预防提前:操作过程中的限制、易错的、有潜在风险的,要提前描述,使用DOCS平台的“插入> 说明 > 须知”描述。 | | -| F.1.5 | 步骤清晰-1:无论步骤简单或复杂,都需要写步骤目的,即为什么做。 | | -| F.1.6 | 步骤清晰-2:明确在什么环境下,使用什么工具,做什么操作,怎么做该操作。 | | -| F.1.7 | 步骤具体:如果操作可选,要明确可选条件。 | | -| F.1.8 | 在开发步骤执行完成后,及时明确操作正确的标准。 | | -| **F.2** | **如何写好代码段** | | -| F.2.1 | 代码涉及开发者拷贝的命令,必须用可编辑的报文呈现,避免截图(DOCS插入Screen)。 | | -| F.2.2 | 代码中关键段用蓝色(RGB:0.0.255)突出显示,关键步骤要有注释说明。 | | -| F.2.3 | 代码显示符合代码缩进要求。 | | -| F.2.4 | 步骤涉及接口调用,清晰给出接口及其使用说明或示例代码,代码来源于具体实例。 | | - -**【写作样例】** - -1. 双击下载的exe文件,进入DevEco Studio安装向导。 - -2. 配置DevEco Studio安装路径,点击Next。 - -3. 配置DevEco Studio安装选项,点击Next。 - - Create Desktop Shortcut:配置是否创建桌面快捷方式,根据操作系统位数进行选择。 - - Update PATH variable:配置是否将启动器路径添加到环境变量PATH中,需要从命令行启动DevEco Studio时,需要勾选Add launchers dir to the PATH。 - - Update context menu:配置是否将DevEco Studio功能添加至上下文菜单。勾选后,右键上下文菜单将出现“Open Folder as Project”选项。 - -4. 配置桌面快捷方式的开始菜单文件夹,点击Install。 - -5. 等待DevEco Studio安装完成后,点击Finish。 - - -## 检验环境是否搭建成功 - -** *【写作要求】*** - -*必选。* *环境搭建完成后,需要明确给出环境搭建是否成功的检验标准*。 - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| G.1.1 | 仅进行最后的结果验证,每个小任务的操作结果,在开发步骤执行完成后,及时验证操作结果。 | | -| G1.2 | 明确搭建成功的标准。 | | diff --git "a/zh-cn/device-dev/kernel-contribution/template/\346\246\202\350\277\260.md" "b/zh-cn/device-dev/kernel-contribution/template/\346\246\202\350\277\260.md" deleted file mode 100644 index c3ab6dfa23f8ee7ea737e10d460553c498632a77..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel-contribution/template/\346\246\202\350\277\260.md" +++ /dev/null @@ -1,169 +0,0 @@ -# 概述 - -* **【开发指南总体** **写作要求】*** - - -* 适用于鸿蒙南北向子系统开发、应用侧的设备开发、南向开发指南。* - - -* 章节调整:本模板知识点内容结构可以根据产品内容多少微调,具体操作方式见下。* - - -| 章节 | 可选/必选说明 | 备注 | -| -------- | -------- | -------- | -| 概述 | 必选,标题名称不变 | - | -| 搭建环境 | 可选,如果快速入门已有,可不用提供,否则需提供。 | - | -| 开发指导 | 必选,可根据多场景任务增加章节。 | 拍照开发指导
预览开发指导
录像开发指导 | -| 开发实例 | 必选。
- 标题名称可自定义。如果“开发指导”是多场景,标题名称可以调整为拍照开发实例、预览开发实例等。
- 标题可合并。如果产品链接到示例代码或内容少于1屏,可合并到“开发指导”,整本统一。 | - | -| 常见问题 | 可选,标题不变。
- 如果无常见问题,删除此章节。
- 如果有常见问题,建议单独章节,后续具备扩展性。
- 如果有常见问题,问题少于1屏,未来扩充可能行不大,可放在“开发指导”。 | - | -| 参考 | 可选,根据实际需要补充。 | - | - - - * 整体写作要求见下,完成写作后,请逐项自检。* -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| **A.1** | **用语要求** | | -| A.1.1 | 行文风格:文档在官方网站发布,用语正式,避免口语化。 | | -| A.1.2 | 合规要求:不能使用Android特有概念等存在合规和法务风险的词汇。敏感词汇包含但不限于:Android、Google、EMUI、Activity、AOSP、provider、binder、APK、Dalvik、AVD、ADT、DDMS、adb、AAPT、AndroidManifest、NDK、ART、dex、ANR、Cursor、Blacklist、Whitelist、Master、Slave、L0、L1、轻鸿蒙、富鸿蒙等。 | | -| A.1.3 | 内容简洁:内容采用信息必备、最小化原则,旨在指导开发者在尽量短的时间完成操作。 | | -| A.1.4 | 内容正确:文档的代码、需要设置的参数等需要跟产品实际情况实时保持一致。 | | -| A.1.5 | 用语准确:应当确切,不能出现多义性的描述。 | | -| A.1.6 | 用语一致:同一叫法,全文保持一致,术语与术语库保持一致,正文中缩略语首次出现要给出全称。 | | -| A.1.7 | 用语具体:如表示数量或程度时,避免用笼统的“多”“少”“大”,建议用具体数字表示。 | | -| **A.2** | **格式要求** | | -| A.2.1 | 标点符号正确、句尾有符号结尾。 | | -| A.2.2 | 内容尽量用项目列表或分类的方式清晰呈现。不要有单个项目列表;不要有多余空行。 | | -| A.2.3 | 英文字母和中文字之间不要有空格。 | | -| A.2.4 | 链接必须有效,具体,可直接跳转或下载。 | | -| A.2.5 | 如果是内容的辅助说明,请使用“说明”式样;如果提前申明事项,,请使用“须知”式样。To D的资料不用“注意”格式。 | | -| **A.3** | **表格** | | -| A.3.1 | 表格有表注,表头风格一致,采用名词或名词词组形式。 | | -| A.3.2 | 表格有表头,至少为2行2列,避免出现单行或单列表。 | | -| A.3.3 | 表格无内容用“_”,不出现空白的单元格。 | | -| **A.4** | **图形** | | -| A.4.2 | 符合华为调性,避免互联网化,避免涉及宗教信仰类截图。 | | -| A.4.3 | 图文并茂,行文应力求简明,如有可能,配以适当的图,表。 | | -| A.4.4 | 图形有图注(不可直接粘贴图形),图注风格一致,采用名词或名词词组形式。 | | -| A.4.5 | 图形应清晰可辩识,信息表达完整,易于阅读。如流程图不可缺少“开始”和“结束”。 | | -| A.4.6 | 图形逻辑清晰,图文配合使用,切忌图文分离。 | | -| A.4.7 | 图片的高度建议在640px左右,宽度不超过820px,一般为.png格式,图片的大小建议不超过150k。 | | -| A.4.8 | 图形建议尽量不要用文字,中文图用中文,英文图用英文。 | | - - -## 基本概念 - -*【 **写作要求】*** - -*必选,描述本开发任务相关的基本概念,帮助开发者更好的理解开发任务。* *写作要求见下,完成写作后,请逐项自检。* - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| B.1.1 | 业界通用的概念不用再此赘述。 | | -| B.1.2 | 注意使用业界通用术语来表达,不用华为研发内部语言。 | | -| B.1.3 | 基本概念要黑盒描述,不用体现具体细节。 | | - - -【写作样例】 - - -鸿蒙系统音频模块支持音频业务的开发,提供音频相关的功能,主要包括音频播放、音频采集、音量管理和短音播放等。 - - -在进行应用的开发前,开发者应了解以下基本概念: - - -- 采样 - 采样就是把模拟信号数字化的过程,所有的模拟信号都需要通过采样转换为可以用0101来表示的数字信号。 - -- 采样率 - 采样率为每秒从连续信号中提取并组成离散信号的采样次数,单位用赫兹(Hz)来表示。通常人耳能听到频率范围大约在20Hz~20kHz之间的声音。常用的音频采样频率有:8kHz、11.025kHz、22.05kHz、16kHz、37.8kHz、44.1kHz、48kHz、96kHz、192kHz等。 - -- 声道 - 声道是指声音在录制或播放时在不同空间位置采集或回放的相互独立的音频信号,所以声道数也就是声音录制时的音源数量或回放时相应的扬声器数量。 - -- 音频帧 - 音频数据是流式的,本身没有明确的一帧帧的概念,在实际的应用中,为了音频算法处理/传输的方便,一般约定俗成取2.5ms~60ms为单位的数据量为一帧音频。这个时间被称之为“采样时间”,其长度没有特别的标准,它是根据编解码器和具体应用的需求来决定的。 - - -## 运作机制 - -*【 **写作要求】*** - -*可选。如果机制比较简单,通过前面基本概念就可以说清楚,此章节可以不用提供,删除标题即可。* - -*描述实现原理介绍机制,如关键步骤相关接口调用时机和触发时机,帮助开发者了解该功能的基本运作原理,以便更好的理解开发任务和定位问题。* - -* 写作要求见下,完成写作后,请逐项自检。* - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| C.1.1 | 仅描述开发任务相关的原理。 | | -| C.1.2 | 尽量图文配合,一般使用时序图、流程图等形式。文字描述与图形描述匹配。 | | -| C.1.3 | 原理要黑盒描述,注意不要泄密。 | | - -【写作样例-1】 - -- 信号量初始化,为配置的N个信号量申请内存(N值可以由用户自行配置,受内存限制),并把所有的信号量初始化成未使用,并加入到未使用链表中供系统使用。 - -- 信号量创建,从未使用的信号量链表中获取一个信号量资源,并设定初值。 - -- 信号量申请,若其计数器值大于0,则直接减1返回成功。否则任务阻塞,等待其它任务释放该信号量,等待的超时时间可设定。当任务被一个信号量阻塞时,将该任务挂到信号量等待任务队列的队尾。 - -- 信号量释放,若没有任务等待该信号量,则直接将计数器加1返回。否则唤醒该信号量等待任务队列上的第一个任务。 - -- 信号量删除,将正在使用的信号量置为未使用信号量,并挂回到未使用链表。 - -- 信号量允许多个任务在同一时刻访问同一资源,但会限制同一时刻访问此资源的最大任务数目。访问同一资源的任务数达到该资源的最大数量时,会阻塞其他试图获取该资源的任务,直到有任务释放该信号量。 - ![1624266502700](C:\Users\LWX104~1\AppData\Local\Temp\1624266502700.png) - - 【写作样例-2】 - - **互斥锁运作原理** - - 多任务环境下会存在多个任务访问同一公共资源的场景,而有些公共资源是非共享的,需要任务进行独占式处理。互斥锁怎样来避免这种冲突呢? - - 用互斥锁处理非共享资源的同步访问时,如果有任务访问该资源,则互斥锁为加锁状态。此时其他任务如果想访问这个公共资源则会被阻塞,直到互斥锁被持有该锁的任务释放后,其他任务才能重新访问该公共资源,此时互斥锁再次上锁,如此确保同一时刻只有一个任务正在访问这个公共资源,保证了公共资源操作的完整性。 - - **图2** 互斥锁运作示意图 - ![1624266485662](C:\Users\LWX104~1\AppData\Local\Temp\1624266485662.png) - - -## 约束与限制 - -* **【写作要求】*** - -*必选。* *描述本开发任务过程中* *的约束条件,以及此操作约束带来相应的负面影响,包括但不限于如下几方面:* - -* **功能限制:*** - -- * 功能使用范围(明确不支持的场景)。* - -- *规格限制。* - -* **操作限制** **:*** - -- * 已知问题的操作。* - -- * 潜在风险的操作(如引起性能降低)。* - -- * 引起性能降低的操作*。 - -* 写作要求见下,完成写作后,请逐项自检。* - -| 要求项 | 内容要求 | 是否满足 | -| -------- | -------- | -------- | -| D.1.1 | 明确功能限制或操作限制。 | | -| D.1.2 | 约束对指导任务开发有影响或体验有感知,否则不用体现。 | | -| D.1.3 | 容易出错的操作在步骤里描述,不在此体现。 | | - -**【写作样例】** - -**互斥锁的约束与限制:** - -- 两个任务不能对同一把互斥锁加锁。如果某任务对已被持有的互斥锁加锁,则该任务会被挂起,直到持有该锁的任务对互斥锁解锁,才能执行对这把互斥锁的加锁操作。 - -- 互斥锁不能在中断服务程序中使用。 - -- Huawei LiteOS作为实时操作系统需要保证任务调度的实时性,尽量避免任务的长时间阻塞,因此在获得互斥锁之后,应该尽快释放互斥锁。 - -- 持有互斥锁的过程中,不得再调用LOS_TaskPriSet等接口更改持有互斥锁任务的优先级。 diff --git a/zh-cn/device-dev/kernel/IPC.md b/zh-cn/device-dev/kernel/IPC.md deleted file mode 100644 index 14c3d35d893aa9d29c15274d40231c9393ee0fa0..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/kernel/IPC.md +++ /dev/null @@ -1,11 +0,0 @@ -# IPC - -- **[事件](事件.md)** - -- **[互斥锁](互斥锁.md)** - -- **[消息队列](消息队列.md)** - -- **[信号量](信号量.md)** - - diff --git a/zh-cn/device-dev/kernel/LittleFS.md b/zh-cn/device-dev/kernel/LittleFS.md deleted file mode 100644 index 1f8ad2cec85fe0c0b5c45076a705e5f12045fa8c..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/kernel/LittleFS.md +++ /dev/null @@ -1,7 +0,0 @@ -# LittleFS - -- **[基本概念](基本概念-21.md)** - -- **[开发指导](开发指导-22.md)** - - diff --git a/zh-cn/device-dev/kernel/Readme-CN.md b/zh-cn/device-dev/kernel/Readme-CN.md index 8b5a59ad1b9f2ddb7beb2c0424b72dd5bc53d432..3149ba1128ab511901f59a3614f077695b183cf0 100755 --- a/zh-cn/device-dev/kernel/Readme-CN.md +++ b/zh-cn/device-dev/kernel/Readme-CN.md @@ -1,166 +1,152 @@ # 内核使用指南 -- [轻量和小型系统内核](轻量和小型系统内核.md) - - [轻量系统内核](轻量系统内核.md) - - [基础内核](基础内核.md) - - [进程](进程.md) - - [线程](线程.md) - - [内存](内存.md) - - [网络](网络.md) - - - [文件系统](文件系统.md) - - [VFS](VFS.md) - - [NFS](NFS.md) - - [RAMFS](RAMFS.md) - - [FAT](FAT.md) - - [JFFS2](JFFS2.md) - - - [标准库](标准库.md) - - [标准库](标准库-0.md) - - [与Linux标准库的差异](与Linux标准库的差异.md) - - - [调测](调测.md) - - [Shell介绍](Shell介绍.md) - - [Shell命令开发指导](Shell命令开发指导.md) - - [Shell命令编程实例](Shell命令编程实例.md) - - [Shell命令使用详解](Shell命令使用详解.md) - - [系统命令](系统命令.md) - - [cpup](cpup.md) - - [date](date.md) - - [dmesg](dmesg.md) - - [exec](exec.md) - - [free](free.md) - - [help](help.md) - - [hwi](hwi.md) - - [kill](kill.md) - - [log](log.md) - - [memcheck](memcheck.md) - - [oom](oom.md) - - [pmm](pmm.md) - - [reset](reset.md) - - [sem](sem.md) - - [stack](stack.md) - - [su](su.md) - - [swtmr](swtmr.md) - - [systeminfo](systeminfo.md) - - [task](task.md) - - [uname](uname.md) - - [vmm](vmm.md) - - [watch](watch.md) - - - [文件命令](文件命令.md) - - [cat](cat.md) - - [cd](cd.md) - - [chgrp](chgrp.md) - - [chmod](chmod.md) - - [chown](chown.md) - - [cp](cp.md) - - [format](format.md) - - [ls](ls.md) - - [lsfd](lsfd.md) - - [mkdir](mkdir.md) - - [mount](mount.md) - - [partinfo](partinfo.md) - - [partition](partition.md) - - [pwd](pwd.md) - - [rm](rm.md) - - [rmdir](rmdir.md) - - [statfs](statfs.md) - - [sync](sync.md) - - [touch](touch.md) - - [writeproc](writeproc.md) - - [umount](umount.md) - - - [网络命令](网络命令.md) - - [arp](arp.md) - - [dhclient](dhclient.md) - - [dns](dns.md) - - [ifconfig](ifconfig.md) - - [ipdebug](ipdebug.md) - - [netstat](netstat.md) - - [ntpdate](ntpdate.md) - - [ping](ping.md) - - [ping6](ping6.md) - - [telnet](telnet.md) - - [tftp](tftp.md) - - - [魔法键使用方法](魔法键使用方法.md) - - [用户态异常信息说明](用户态异常信息说明.md) - - - [小型系统内核](小型系统内核.md) - - [认识LiteOS-M内核](认识LiteOS-M内核.md) - - [快速入门](快速入门.md) - - [基础内核](基础内核-1.md) - - [中断管理](中断管理.md) - - [基本概念](基本概念.md) - - [开发指导](开发指导.md) - - - [任务管理](任务管理.md) - - [基本概念](基本概念-2.md) - - [开发指导](开发指导-3.md) - - - [内存管理](内存管理.md) - - [基本概念](基本概念-4.md) - - [静态内存](静态内存.md) - - [动态内存](动态内存.md) - - - [IPC](IPC.md) - - [事件](事件.md) - - [基本概念](基本概念-5.md) - - [开发指导](开发指导-6.md) - - - [互斥锁](互斥锁.md) - - [基本概念](基本概念-7.md) - - [开发指导](开发指导-8.md) - - - [消息队列](消息队列.md) - - [基本概念](基本概念-9.md) - - [开发指导](开发指导-10.md) - - - [信号量](信号量.md) - - [基本概念](基本概念-11.md) - - [开发指导](开发指导-12.md) - - - [时间管理](时间管理.md) - - [基本概念](基本概念-13.md) - - [开发指导](开发指导-14.md) - - - [软件定时器](软件定时器.md) - - [基本概念](基本概念-15.md) - - [开发指导](开发指导-16.md) - - - [扩展组件](扩展组件.md) - - [C++支持](C++支持.md) - - [CPUP](CPUP.md) - - [基本概念](基本概念-17.md) - - [开发指导](开发指导-18.md) - - - [文件系统](文件系统-19.md) - - [FAT](FAT-20.md) - - [LittleFS](LittleFS.md) - - [基本概念](基本概念-21.md) - - [开发指导](开发指导-22.md) - - - [内核调测](内核调测.md) - - [内存调测](内存调测.md) - - [内存信息统计](内存信息统计.md) - - [内存泄漏检测](内存泄漏检测.md) - - [踩内存检测](踩内存检测.md) - - - [异常调测](异常调测.md) - - [Trace调测](Trace调测.md) - - - [附录](附录.md) - - [内核编码规范](内核编码规范.md) - - [基本数据结构](基本数据结构.md) - - [双向链表](双向链表.md) - - - [标准库支持](标准库支持.md) - - [CMSIS支持](CMSIS支持.md) - - [POSIX支持](POSIX支持.md) - -- [标准系统内核](标准系统内核.md) - - [Linux内核概述](Linux内核概述.md) - - [OpenHarmony开发板Patch使用指导](OpenHarmony开发板Patch使用指导.md) - - [Linux内核编译与构建指导](Linux内核编译与构建指导.md) +- [轻量和小型系统内核](kernel-lite.md) + + - [轻量系统内核](kernel-lite-mini.md) + - [内核概述](kernel-lite-mini-m.md) + - [基础内核](kernel-lite-mini-basic.md) + - [中断管理](kernel-lite-mini-basic-interrupt.md) + - [基本概念](kernel-lite-mini-basic-interrupt-concept.md) + - [开发指导](kernel-lite-mini-basic-interrupt-guide.md) + - [任务管理](kernel-lite-mini-basic-task.md) + - [基本概念](kernel-lite-mini-basic-task-basic.md) + - [开发指导](kernel-lite-mini-basic-task-guide.md) + - [内存管理](kernel-lite-mini-basic-memory.md) + - [基本概念](kernel-lite-mini-basic-memory-basic.md) + - [静态内存](kernel-lite-mini-basic-memory-static.md) + - [动态内存](kernel-lite-mini-basic-memory-dynamic.md) + - [内核通信机制](kernel-lite-mini-basic-ipc.md) + - [事件](kernel-lite-mini-basic-ipc-event.md) + - [基本概念](kernel-lite-mini-basic-ipc-event-guide.md) + - [开发指导](kernel-lite-mini-basic-ipc-event-basic.md) + - [互斥锁](kernel-lite-mini-basic-ipc-mutex.md) + - [基本概念](kernel-lite-mini-basic-ipc-mutex-basic.md) + - [开发指导](kernel-lite-mini-basic-ipc-mutex-guide.md) + - [消息队列](kernel-lite-mini-basic-ipc-queue.md) + - [基本概念](kernel-lite-mini-basic-ipc-queue-basic.md) + - [开发指导](kernel-lite-mini-basic-ipc-queue-guide.md) + - [信号量](kernel-lite-mini-basic-ipc-sem.md) + - [基本概念](kernel-lite-mini-basic-ipc-sem-basic.md) + - [开发指导](kernel-lite-mini-basic-ipc-sem-guide.md) + - [时间管理](kernel-lite-basic-mini-time.md) + - [基本概念](kernel-lite-mini-basic-time-basic.md) + - [开发指导](kernel-lite-mini-basic-time-guide.md) + - [软件定时器](kernel-lite-mini-basic-soft.md) + - [基本概念](kernel-lite-mini-basic-soft-basic.md) + - [开发指导](kernel-lite-mini-basic-soft-guide.md) + - [扩展组件](kernel-lite-mini-extend.md) + - [C++支持](kernel-lite-mini-extend-support.md) + - [CPU占用率](kernel-lite-mini-extend-cpup.md) + - [基本概念](kernel-lite-mini-extend-cpup-basic.md) + - [开发指导](kernel-lite-mini-extend-cpup-guide.md) + - [文件系统](kernel-lite-mini-extend-file.md) + - [FAT](kernel-lite-mini-extend-file-fat.md) + - [LittleFS](kernel-lite-mini-extend-file-lit.md) + - [基本概念](kernel-lite-mini-extend-file-lit-basic.md) + - [开发指导](kernel-lite-mini-extend-file-lit-guide.md) + - [内核调测](kernel-lite-mini-inner.md) + - [内存调测](kernel-lite-mini-inner-debug.md) + - [内存信息统计](kernel-lite-mini-inner-debug-mes.md) + - [内存泄漏检测](kernel-lite-mini-inner-debug-det.md) + - [踩内存检测](kernel-lite-mini-inner-debug-cet.md) + - [异常调测](kernel-lite-mini-inner-exception.md) + - [Trace调测](kernel-lite-mini-inner-trace.md) + - [附录](kernel-lite-mini-app.md) + - [内核编码规范](kernel-lite-mini-app-code.md) + - [基本数据结构](kernel-lite-mini-app-data.md) + - [双向链表](kernel-lite-mini-app-data-list.md) + - [标准库支持](kernel-lite-mini-app-lib.md) + - [CMSIS支持](kernel-lite-mini-app-lib-cmsis.md) + - [POSIX支持](kernel-lite-mini-app-lib-posix.md) + + - [小型系统内核](kernel-lite-small.md) + - [基础内核](kernel-lite-small-basic.md) + - [进程](kernel-lite-small-process.md) + - [线程](kernel-lite-small-thread.md) + - [内存](kernel-lite-small-memory.md) + - [网络](kernel-lite-small-net.md) + + - [文件系统](kernel-lite-small-file.md) + - [VFS](kernel-lite-small-file-vfs.md) + - [NFS](kernel-lite-small-file-nfs.md) + - [RAMFS](kernel-lite-small-file-ramfs.md) + - [FAT](kernel-lite-small-file-fat.md) + - [JFFS2](kernel-lite-small-file-jffs.md) + + - [标准库](kernel-lite-small-lib.md) + - [标准库](kernel-lite-small-lib-standard.md) + - [与Linux标准库的差异](kernel-lite-small-lib-differ.md) + + - [调测](kernel-lite-small-shell.md) + - [Shell介绍](kernel-lite-small-shell-des.md) + - [Shell命令开发指导](kernel-lite-small-shell-guide.md) + - [Shell命令编程实例](kernel-lite-small-shell-sample.md) + - [Shell命令使用详解](kernel-lite-small-shell-cmd.md) + - [系统命令](kernel-lite-small-shell-cmd-sys.md) + - [cpup](kernel-lite-small-shell-cmd-sys-cpup.md) + - [date](kernel-lite-small-shell-cmd-sys-date.md) + - [dmesg](kernel-lite-small-shell-cmd-sys-demsg.md) + - [exec](kernel-lite-small-shell-cmd-sys-exec.md) + - [free](kernel-lite-small-shell-cmd-sys-free.md) + - [help](kernel-lite-small-shell-cmd-sys-help.md) + - [hwi](kernel-lite-small-shell-cmd-sys-hwi.md) + - [kill](kernel-lite-small-shell-cmd-sys-kill.md) + - [log](kernel-lite-small-shell-cmd-sys-log.md) + - [memcheck](kernel-lite-small-shell-cmd-sys-mem.md) + - [oom](kernel-lite-small-shell-cmd-sys-oom.md) + - [pmm](kernel-lite-small-shell-cmd-sys-pmm.md) + - [reset](kernel-lite-small-shell-cmd-sys-reset.md) + - [sem](kernel-lite-small-shell-cmd-sys-sem.md) + - [stack](kernel-lite-small-shell-cmd-sys-stack.md) + - [su](kernel-lite-small-shell-cmd-sys-su.md) + - [swtmr](kernel-lite-small-shell-cmd-sys-swymr.md) + - [systeminfo](kernel-lite-small-shell-cmd-sys-sys.md) + - [task](kernel-lite-small-shell-cmd-sys-task.md) + - [uname](kernel-lite-small-shell-cmd-sys-uname.md) + - [vmm](kernel-lite-small-shell-cmd-sys-vmm.md) + - [watch](kernel-lite-small-shell-cmd-sys-watch.md) + + - [文件命令](kernel-lite-small-shell-cmd-file.md) + - [cat](kernel-lite-small-shell-cmd-file-cat.md) + - [cd](kernel-lite-small-shell-cmd-file-cd.md) + - [chgrp](kernel-lite-small-shell-cmd-file-chgrp.md) + - [chmod](kernel-lite-small-shell-cmd-file-chmod.md) + - [chown](kernel-lite-small-shell-cmd-file-chown.md) + - [cp](kernel-lite-small-shell-cmd-file-cp.md) + - [format](kernel-lite-small-shell-cmd-file-format.md) + - [ls](kernel-lite-small-shell-cmd-file-is.md) + - [lsfd](kernel-lite-small-shell-cmd-file-isfd.md) + - [mkdir](kernel-lite-small-shell-cmd-file-mkdir.md) + - [mount](kernel-lite-small-shell-cmd-file-mount.md) + - [partinfo](kernel-lite-small-shell-cmd-file-part.md) + - [partition](kernel-lite-small-shell-cmd-file-partion.md) + - [pwd](kernel-lite-small-shell-cmd-file-pwd.md) + - [rm](kernel-lite-small-shell-cmd-file-rm.md) + - [rmdir](kernel-lite-small-shell-cmd-file-rmdir.md) + - [statfs](kernel-lite-small-shell-cmd-file-sta.md) + - [sync](kernel-lite-small-shell-cmd-file-sync.md) + - [touch](kernel-lite-small-shell-cmd-file-touch.md) + - [writeproc](kernel-lite-small-shell-cmd-file-write.md) + - [umount](kernel-lite-small-shell-cmd-file-umount.md) + + - [网络命令](kernel-lite-small-shell-cmd-net.md) + - [arp](kernel-lite-small-shell-cmd-net-arp.md) + - [dhclient](kernel-lite-small-shell-cmd-net-dh.md) + - [dns](kernel-lite-small-shell-cmd-net-dns.md) + - [ifconfig](kernel-lite-small-shell-cmd-net-ipc.md) + - [ipdebug](kernel-lite-small-shell-cmd-net-ipd.md) + - [netstat](kernel-lite-small-shell-cmd-net-net.md) + - [ntpdate](kernel-lite-small-shell-cmd-net-ntp.md) + - [ping](kernel-lite-small-shell-cmd-net-ping.md) + - [ping6](kernel-lite-small-shell-cmd-net-ping6.md) + - [telnet](kernel-lite-small-shell-cmd-net-tel.md) + - [tftp](kernel-lite-small-shell-cmd-net-tftp.md) + + - [魔法键使用方法](kernel-lite-small-shell-cmd-mag.md) + - [用户态异常信息说明](kernel-lite-small-shell-cmd-abn.md) + +- [标准系统内核](kernel-standard.md) + - [Linux内核概述](kernel-standard-des.md) + - [OpenHarmony开发板Patch使用指导](kernel-standard-patch.md) + - [Linux内核编译与构建指导](kernel-standard-build.md) diff --git "a/zh-cn/device-dev/kernel/figure/Cow\346\234\272\345\210\266\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/Cow\346\234\272\345\210\266\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..bee6020f58b7127c24d0adc1da77fe1761b386de Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/Cow\346\234\272\345\210\266\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/PID\344\270\2723\347\232\204\350\277\233\347\250\213\350\231\232\346\213\237\345\206\205\345\255\230\344\275\277\347\224\250\344\277\241\346\201\257.png" "b/zh-cn/device-dev/kernel/figure/PID\344\270\2723\347\232\204\350\277\233\347\250\213\350\231\232\346\213\237\345\206\205\345\255\230\344\275\277\347\224\250\344\277\241\346\201\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/PID\344\270\2723\347\232\204\350\277\233\347\250\213\350\231\232\346\213\237\345\206\205\345\255\230\344\275\277\347\224\250\344\277\241\346\201\257.png" rename to "zh-cn/device-dev/kernel/figure/PID\344\270\2723\347\232\204\350\277\233\347\250\213\350\231\232\346\213\237\345\206\205\345\255\230\344\275\277\347\224\250\344\277\241\346\201\257.png" diff --git "a/zh-cn/device-dev/kernel/figures/POSIX\346\216\245\345\217\243\346\241\206\346\236\266.png" "b/zh-cn/device-dev/kernel/figure/POSIX\346\216\245\345\217\243\346\241\206\346\236\266.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/POSIX\346\216\245\345\217\243\346\241\206\346\236\266.png" rename to "zh-cn/device-dev/kernel/figure/POSIX\346\216\245\345\217\243\346\241\206\346\236\266.png" diff --git a/zh-cn/device-dev/kernel/figures/Snipaste_2021-01-26_10-38-58-1.png b/zh-cn/device-dev/kernel/figure/Snipaste_2021-01-26_10-38-58-18.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/Snipaste_2021-01-26_10-38-58-1.png rename to zh-cn/device-dev/kernel/figure/Snipaste_2021-01-26_10-38-58-18.png diff --git a/zh-cn/device-dev/kernel/figures/Snipaste_2021-01-26_10-38-58-2.png b/zh-cn/device-dev/kernel/figure/Snipaste_2021-01-26_10-38-58-19.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/Snipaste_2021-01-26_10-38-58-2.png rename to zh-cn/device-dev/kernel/figure/Snipaste_2021-01-26_10-38-58-19.png diff --git a/zh-cn/device-dev/kernel/figures/Snipaste_2021-01-26_10-38-58.png b/zh-cn/device-dev/kernel/figure/Snipaste_2021-01-26_10-38-58.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/Snipaste_2021-01-26_10-38-58.png rename to zh-cn/device-dev/kernel/figure/Snipaste_2021-01-26_10-38-58.png diff --git "a/zh-cn/device-dev/kernel/figures/VFS\345\222\214\345\220\204\344\270\252\346\226\207\344\273\266\347\263\273\347\273\237\347\232\204\345\205\263\347\263\273.png" "b/zh-cn/device-dev/kernel/figure/VFS\345\222\214\345\220\204\344\270\252\346\226\207\344\273\266\347\263\273\347\273\237\347\232\204\345\205\263\347\263\273.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/VFS\345\222\214\345\220\204\344\270\252\346\226\207\344\273\266\347\263\273\347\273\237\347\232\204\345\205\263\347\263\273.png" rename to "zh-cn/device-dev/kernel/figure/VFS\345\222\214\345\220\204\344\270\252\346\226\207\344\273\266\347\263\273\347\273\237\347\232\204\345\205\263\347\263\273.png" diff --git "a/zh-cn/device-dev/kernel/figures/dmesg\351\207\215\345\256\232\345\220\221\345\210\260\346\226\207\344\273\266.png" "b/zh-cn/device-dev/kernel/figure/dmesg\351\207\215\345\256\232\345\220\221\345\210\260\346\226\207\344\273\266.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/dmesg\351\207\215\345\256\232\345\220\221\345\210\260\346\226\207\344\273\266.png" rename to "zh-cn/device-dev/kernel/figure/dmesg\351\207\215\345\256\232\345\220\221\345\210\260\346\226\207\344\273\266.png" diff --git "a/zh-cn/device-dev/kernel/figures/lsfd\350\276\223\345\207\272\350\257\264\346\230\216.png" "b/zh-cn/device-dev/kernel/figure/lsfd\350\276\223\345\207\272\350\257\264\346\230\216.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/lsfd\350\276\223\345\207\272\350\257\264\346\230\216.png" rename to "zh-cn/device-dev/kernel/figure/lsfd\350\276\223\345\207\272\350\257\264\346\230\216.png" diff --git "a/zh-cn/device-dev/kernel/figures/statfs\350\276\223\345\207\272\350\257\264\346\230\216.png" "b/zh-cn/device-dev/kernel/figure/statfs\350\276\223\345\207\272\350\257\264\346\230\216.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/statfs\350\276\223\345\207\272\350\257\264\346\230\216.png" rename to "zh-cn/device-dev/kernel/figure/statfs\350\276\223\345\207\272\350\257\264\346\230\216.png" diff --git "a/zh-cn/device-dev/kernel/figures/umount\350\276\223\345\207\272\347\244\272\344\276\213.png" "b/zh-cn/device-dev/kernel/figure/umount\350\276\223\345\207\272\347\244\272\344\276\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/umount\350\276\223\345\207\272\347\244\272\344\276\213.png" rename to "zh-cn/device-dev/kernel/figure/umount\350\276\223\345\207\272\347\244\272\344\276\213.png" diff --git "a/zh-cn/device-dev/kernel/figures/watch-task-\347\273\223\346\236\234.png" "b/zh-cn/device-dev/kernel/figure/watch-task-\347\273\223\346\236\234.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/watch-task-\347\273\223\346\236\234.png" rename to "zh-cn/device-dev/kernel/figure/watch-task-\347\273\223\346\236\234.png" diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001051690323.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001051690323.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001051690323.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001051690323.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052370303.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052370303.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052370303.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052370303.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052370305.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052370305.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052370305.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052370305.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052370307.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052370307.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052370307.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052370307.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052530298.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052530298.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052530298.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052530298.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052810300.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052810300.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052810300.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052810300.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052810304.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052810304.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001052810304.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001052810304.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001053224218.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001053224218.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001053224218.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001053224218.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001053710680.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001053710680.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001053710680.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001053710680.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001053826366.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001053826366.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001053826366.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001053826366.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001054624363.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001054624363.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001054624363.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001054624363.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001121429646.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001121429646.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001121429646.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001121429646.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124146302.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124146302.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124146302.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124146302.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124147160.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124147160.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124147160.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124147160.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124306828.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124306828.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124306828.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124306828.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124307264.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124307264.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124307264.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124307264.png diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124310992.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124310992.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001124310992.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001124310992.png diff --git a/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132085260.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132085260.png new file mode 100644 index 0000000000000000000000000000000000000000..4bc250489d5cfba6848f63abd9a1ea12502fd9df Binary files /dev/null and b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132085260.png differ diff --git a/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132778524.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132778524.png new file mode 100644 index 0000000000000000000000000000000000000000..7836a009e5e3cb6351c807daf9b927c7d3b71a86 Binary files /dev/null and b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132778524.png differ diff --git a/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132935054.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132935054.png new file mode 100644 index 0000000000000000000000000000000000000000..238a15fa82b6095a13ee54bd3014ed3c08c21b4e Binary files /dev/null and b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001132935054.png differ diff --git a/zh-cn/device-dev/kernel/figures/zh-cn_image_0000001170790681.png b/zh-cn/device-dev/kernel/figure/zh-cn_image_0000001170790681.png similarity index 100% rename from zh-cn/device-dev/kernel/figures/zh-cn_image_0000001170790681.png rename to zh-cn/device-dev/kernel/figure/zh-cn_image_0000001170790681.png diff --git "a/zh-cn/device-dev/kernel/figures/\344\272\213\344\273\266\350\277\220\344\275\234\345\216\237\347\220\206\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\344\272\213\344\273\266\350\277\220\344\275\234\345\216\237\347\220\206\345\233\276.png" similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\272\213\344\273\266\350\277\220\344\275\234\345\216\237\347\220\206\345\233\276.png" rename to "zh-cn/device-dev/kernel/figure/\344\272\213\344\273\266\350\277\220\344\275\234\345\216\237\347\220\206\345\233\276.png" diff --git "a/zh-cn/device-dev/kernel/figure/\344\272\222\346\226\245\351\224\201\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\344\272\222\346\226\245\351\224\201\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..37559a2a230b4d0a17fa07aaac2ea5ed3923b4df Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\344\272\222\346\226\245\351\224\201\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\344\273\245\344\270\211\347\247\215\346\226\271\345\274\217\346\230\276\347\244\272\345\206\205\345\255\230\344\275\277\347\224\250\346\203\205\345\206\265.png" "b/zh-cn/device-dev/kernel/figure/\344\273\245\344\270\211\347\247\215\346\226\271\345\274\217\346\230\276\347\244\272\345\206\205\345\255\230\344\275\277\347\224\250\346\203\205\345\206\265.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\273\245\344\270\211\347\247\215\346\226\271\345\274\217\346\230\276\347\244\272\345\206\205\345\255\230\344\275\277\347\224\250\346\203\205\345\206\265.png" rename to "zh-cn/device-dev/kernel/figure/\344\273\245\344\270\211\347\247\215\346\226\271\345\274\217\346\230\276\347\244\272\345\206\205\345\255\230\344\275\277\347\224\250\346\203\205\345\206\265.png" diff --git "a/zh-cn/device-dev/kernel/figure/\344\273\273\345\212\241\347\212\266\346\200\201\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\344\273\273\345\212\241\347\212\266\346\200\201\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..75c79e501c27a2c41ff011133197eb646981b0f3 Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\344\273\273\345\212\241\347\212\266\346\200\201\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\345\217\221\351\200\201\345\244\261\350\264\245.png" "b/zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\345\217\221\351\200\201\345\244\261\350\264\245.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\345\217\221\351\200\201\345\244\261\350\264\245.png" rename to "zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\345\217\221\351\200\201\345\244\261\350\264\245.png" diff --git "a/zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\345\217\221\351\200\201\347\273\223\346\236\234\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\345\217\221\351\200\201\347\273\223\346\236\234\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\345\217\221\351\200\201\347\273\223\346\236\234\345\233\276.png" rename to "zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\345\217\221\351\200\201\347\273\223\346\236\234\345\233\276.png" diff --git "a/zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\351\207\217\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\351\207\217\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..02437a72c3de38cbddf5233282ef9354220002bf Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\344\277\241\345\217\267\351\207\217\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204uid\344\270\272100-gid\344\270\272200.png" "b/zh-cn/device-dev/kernel/figure/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204uid\344\270\272100-gid\344\270\272200.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204uid\344\270\272100-gid\344\270\272200.png" rename to "zh-cn/device-dev/kernel/figure/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204uid\344\270\272100-gid\344\270\272200.png" diff --git "a/zh-cn/device-dev/kernel/figures/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\346\235\203\351\231\220\344\270\272666.png" "b/zh-cn/device-dev/kernel/figure/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\346\235\203\351\231\220\344\270\272666.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\346\235\203\351\231\220\344\270\272666.png" rename to "zh-cn/device-dev/kernel/figure/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\346\235\203\351\231\220\344\270\272666.png" diff --git "a/zh-cn/device-dev/kernel/figures/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\347\276\244\347\273\204\344\270\272100.png" "b/zh-cn/device-dev/kernel/figure/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\347\276\244\347\273\204\344\270\272100.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\347\276\244\347\273\204\344\270\272100.png" rename to "zh-cn/device-dev/kernel/figure/\344\277\256\346\224\271-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\347\276\244\347\273\204\344\270\272100.png" diff --git "a/zh-cn/device-dev/kernel/figure/\345\205\203\346\225\260\346\215\256\345\255\230\345\202\250\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\345\205\203\346\225\260\346\215\256\345\255\230\345\202\250\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..8566e16dbc675362366f07cf9497c2d9073d6f56 Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\345\205\203\346\225\260\346\215\256\345\255\230\345\202\250\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figure/\345\206\205\346\240\270\345\220\257\345\212\250\346\265\201\347\250\213.png" "b/zh-cn/device-dev/kernel/figure/\345\206\205\346\240\270\345\220\257\345\212\250\346\265\201\347\250\213.png" new file mode 100644 index 0000000000000000000000000000000000000000..6c211cb88534ae6a28e6dbdaed8bd1b2717d7366 Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\345\206\205\346\240\270\345\220\257\345\212\250\346\265\201\347\250\213.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" rename to "zh-cn/device-dev/kernel/figure/\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" diff --git "a/zh-cn/device-dev/kernel/figures/\345\207\272\347\216\260\345\206\205\345\255\230\350\266\212\347\225\214.png" "b/zh-cn/device-dev/kernel/figure/\345\207\272\347\216\260\345\206\205\345\255\230\350\266\212\347\225\214.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\207\272\347\216\260\345\206\205\345\255\230\350\266\212\347\225\214.png" rename to "zh-cn/device-dev/kernel/figure/\345\207\272\347\216\260\345\206\205\345\255\230\350\266\212\347\225\214.png" diff --git "a/zh-cn/device-dev/kernel/figures/\345\210\207\346\215\242\345\210\260\344\270\272uid\344\270\2721000-gid\344\270\2721000\347\232\204\347\224\250\346\210\267.png" "b/zh-cn/device-dev/kernel/figure/\345\210\207\346\215\242\345\210\260\344\270\272uid\344\270\2721000-gid\344\270\2721000\347\232\204\347\224\250\346\210\267.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\210\207\346\215\242\345\210\260\344\270\272uid\344\270\2721000-gid\344\270\2721000\347\232\204\347\224\250\346\210\267.png" rename to "zh-cn/device-dev/kernel/figure/\345\210\207\346\215\242\345\210\260\344\270\272uid\344\270\2721000-gid\344\270\2721000\347\232\204\347\224\250\346\210\267.png" diff --git "a/zh-cn/device-dev/kernel/figures/\345\210\233\345\273\272-share-\347\233\256\345\275\225.png" "b/zh-cn/device-dev/kernel/figure/\345\210\233\345\273\272-share-\347\233\256\345\275\225.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\210\233\345\273\272-share-\347\233\256\345\275\225.png" rename to "zh-cn/device-dev/kernel/figure/\345\210\233\345\273\272-share-\347\233\256\345\275\225.png" diff --git "a/zh-cn/device-dev/kernel/figures/\345\210\233\345\273\272\344\270\200\344\270\252\345\220\215\344\270\272-file-c-\347\232\204\346\226\207\344\273\266.png" "b/zh-cn/device-dev/kernel/figure/\345\210\233\345\273\272\344\270\200\344\270\252\345\220\215\344\270\272-file-c-\347\232\204\346\226\207\344\273\266.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\210\233\345\273\272\344\270\200\344\270\252\345\220\215\344\270\272-file-c-\347\232\204\346\226\207\344\273\266.png" rename to "zh-cn/device-dev/kernel/figure/\345\210\233\345\273\272\344\270\200\344\270\252\345\220\215\344\270\272-file-c-\347\232\204\346\226\207\344\273\266.png" diff --git "a/zh-cn/device-dev/kernel/figures/\345\210\240\351\231\244\344\270\200\344\270\252\345\220\215\344\270\272-dir-\347\232\204\347\233\256\345\275\225.png" "b/zh-cn/device-dev/kernel/figure/\345\210\240\351\231\244\344\270\200\344\270\252\345\220\215\344\270\272-dir-\347\232\204\347\233\256\345\275\225.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\210\240\351\231\244\344\270\200\344\270\252\345\220\215\344\270\272-dir-\347\232\204\347\233\256\345\275\225.png" rename to "zh-cn/device-dev/kernel/figure/\345\210\240\351\231\244\344\270\200\344\270\252\345\220\215\344\270\272-dir-\347\232\204\347\233\256\345\275\225.png" diff --git "a/zh-cn/device-dev/kernel/figure/\345\212\250\346\200\201\345\206\205\345\255\230\346\240\270\345\277\203\347\256\227\346\263\225.png" "b/zh-cn/device-dev/kernel/figure/\345\212\250\346\200\201\345\206\205\345\255\230\346\240\270\345\277\203\347\256\227\346\263\225.png" new file mode 100644 index 0000000000000000000000000000000000000000..955aff65c1c8365cc6c932a5e89ef944384bb489 Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\345\212\250\346\200\201\345\206\205\345\255\230\346\240\270\345\277\203\347\256\227\346\263\225.png" differ diff --git "a/zh-cn/device-dev/kernel/figure/\345\212\250\346\200\201\345\206\205\345\255\230\347\256\241\347\220\206\347\273\223\346\236\204\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\345\212\250\346\200\201\345\206\205\345\255\230\347\256\241\347\220\206\347\273\223\346\236\204\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..e67cd13c295d19b6ce45c4749644eea42ada7f05 Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\345\212\250\346\200\201\345\206\205\345\255\230\347\256\241\347\220\206\347\273\223\346\236\204\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\217\221\351\200\201\344\277\241\345\217\267\347\273\231\346\214\207\345\256\232\350\277\233\347\250\213.png" "b/zh-cn/device-dev/kernel/figure/\345\217\221\351\200\201\344\277\241\345\217\267\347\273\231\346\214\207\345\256\232\350\277\233\347\250\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\217\221\351\200\201\344\277\241\345\217\267\347\273\231\346\214\207\345\256\232\350\277\233\347\250\213.png" rename to "zh-cn/device-dev/kernel/figure/\345\217\221\351\200\201\344\277\241\345\217\267\347\273\231\346\214\207\345\256\232\350\277\233\347\250\213.png" diff --git "a/zh-cn/device-dev/kernel/figure/\345\240\206\346\240\210\345\210\206\346\236\220\345\216\237\347\220\206\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\345\240\206\346\240\210\345\210\206\346\236\220\345\216\237\347\220\206\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..6ac9200e867f2c87d14ef89ca8c15102e83d4c10 Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\345\240\206\346\240\210\345\210\206\346\236\220\345\216\237\347\220\206\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\275\223\345\211\215\346\262\241\346\234\211\345\206\205\345\255\230\350\266\212\347\225\214.png" "b/zh-cn/device-dev/kernel/figure/\345\275\223\345\211\215\346\262\241\346\234\211\345\206\205\345\255\230\350\266\212\347\225\214.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\345\275\223\345\211\215\346\262\241\346\234\211\345\206\205\345\255\230\350\266\212\347\225\214.png" rename to "zh-cn/device-dev/kernel/figure/\345\275\223\345\211\215\346\262\241\346\234\211\345\206\205\345\255\230\350\266\212\347\225\214.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\214\207\344\273\244\350\276\223\345\207\272\347\273\223\346\236\234.png" "b/zh-cn/device-dev/kernel/figure/\346\214\207\344\273\244\350\276\223\345\207\272\347\273\223\346\236\234.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\214\207\344\273\244\350\276\223\345\207\272\347\273\223\346\236\234.png" rename to "zh-cn/device-dev/kernel/figure/\346\214\207\344\273\244\350\276\223\345\207\272\347\273\223\346\236\234.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\214\211\346\214\207\345\256\232\346\240\274\345\274\217\346\211\223\345\215\260\347\263\273\347\273\237\346\227\245\346\234\237.png" "b/zh-cn/device-dev/kernel/figure/\346\214\211\346\214\207\345\256\232\346\240\274\345\274\217\346\211\223\345\215\260\347\263\273\347\273\237\346\227\245\346\234\237.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\214\211\346\214\207\345\256\232\346\240\274\345\274\217\346\211\223\345\215\260\347\263\273\347\273\237\346\227\245\346\234\237.png" rename to "zh-cn/device-dev/kernel/figure/\346\214\211\346\214\207\345\256\232\346\240\274\345\274\217\346\211\223\345\215\260\347\263\273\347\273\237\346\227\245\346\234\237.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\226\207\344\273\266\347\263\273\347\273\237\346\240\221\345\275\242\347\273\223\346\236\204.png" "b/zh-cn/device-dev/kernel/figure/\346\226\207\344\273\266\347\263\273\347\273\237\346\240\221\345\275\242\347\273\223\346\236\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\226\207\344\273\266\347\263\273\347\273\237\346\240\221\345\275\242\347\273\223\346\236\204.png" rename to "zh-cn/device-dev/kernel/figure/\346\226\207\344\273\266\347\263\273\347\273\237\346\240\221\345\275\242\347\273\223\346\236\204.png" diff --git "a/zh-cn/device-dev/kernel/figure/\346\227\245\345\277\227\346\226\271\345\274\217\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\346\227\245\345\277\227\346\226\271\345\274\217\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..caf4127a296227a121ef155f9354d1f3ef3837dd Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\346\227\245\345\277\227\346\226\271\345\274\217\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213-0.png" "b/zh-cn/device-dev/kernel/figure/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213-17.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213-0.png" rename to "zh-cn/device-dev/kernel/figure/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213-17.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213.png" "b/zh-cn/device-dev/kernel/figure/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213.png" rename to "zh-cn/device-dev/kernel/figure/\346\230\276\347\244\272\347\273\223\346\236\234\345\246\202\344\270\213.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\344\277\241\346\201\257.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\344\277\241\346\201\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\344\277\241\346\201\257.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213-hello-harmony-txt-\346\226\207\344\273\266\347\232\204\344\277\241\346\201\257.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\345\275\223\345\211\215\347\263\273\347\273\237\350\267\257\345\276\204\344\270\213\347\232\204\347\233\256\345\275\225-\346\230\276\347\244\272\347\232\204\345\206\205\345\256\271\345\246\202\344\270\213.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\345\275\223\345\211\215\347\263\273\347\273\237\350\267\257\345\276\204\344\270\213\347\232\204\347\233\256\345\275\225-\346\230\276\347\244\272\347\232\204\345\206\205\345\256\271\345\246\202\344\270\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\345\275\223\345\211\215\347\263\273\347\273\237\350\267\257\345\276\204\344\270\213\347\232\204\347\233\256\345\275\225-\346\230\276\347\244\272\347\232\204\345\206\205\345\256\271\345\246\202\344\270\213.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\345\275\223\345\211\215\347\263\273\347\273\237\350\267\257\345\276\204\344\270\213\347\232\204\347\233\256\345\275\225-\346\230\276\347\244\272\347\232\204\345\206\205\345\256\271\345\246\202\344\270\213.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\345\275\223\345\211\215\350\267\257\345\276\204.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\345\275\223\345\211\215\350\267\257\345\276\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\345\275\223\345\211\215\350\267\257\345\276\204.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\345\275\223\345\211\215\350\267\257\345\276\204.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\347\211\251\347\220\206\351\241\265\344\275\277\347\224\250\346\203\205\345\206\265.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\347\211\251\347\220\206\351\241\265\344\275\277\347\224\250\346\203\205\345\206\265.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\347\211\251\347\220\206\351\241\265\344\275\277\347\224\250\346\203\205\345\206\265.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\347\211\251\347\220\206\351\241\265\344\275\277\347\224\250\346\203\205\345\206\265.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\347\263\273\347\273\237\350\265\204\346\272\220\344\275\277\347\224\250\346\203\205\345\206\265.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\347\263\273\347\273\237\350\265\204\346\272\220\344\275\277\347\224\250\346\203\205\345\206\265.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\347\263\273\347\273\237\350\265\204\346\272\220\344\275\277\347\224\250\346\203\205\345\206\265.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\347\263\273\347\273\237\350\265\204\346\272\220\344\275\277\347\224\250\346\203\205\345\206\265.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\350\277\233\347\250\213PID.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\350\277\233\347\250\213PID.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\347\234\213\350\277\233\347\250\213PID.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\347\234\213\350\277\233\347\250\213PID.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\344\273\273\345\212\241\351\203\250\345\210\206\344\277\241\346\201\257.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\344\273\273\345\212\241\351\203\250\345\210\206\344\277\241\346\201\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\344\273\273\345\212\241\351\203\250\345\210\206\344\277\241\346\201\257.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\344\273\273\345\212\241\351\203\250\345\210\206\344\277\241\346\201\257.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\345\257\271\345\272\224-ID-\347\232\204\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\344\277\241\346\201\257.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\345\257\271\345\272\224-ID-\347\232\204\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\344\277\241\346\201\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\345\257\271\345\272\224-ID-\347\232\204\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\344\277\241\346\201\257.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\345\257\271\345\272\224-ID-\347\232\204\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\344\277\241\346\201\257.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\346\211\200\346\234\211\345\234\250\347\224\250\347\232\204\344\277\241\345\217\267\351\207\217\344\277\241\346\201\257.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\346\211\200\346\234\211\345\234\250\347\224\250\347\232\204\344\277\241\345\217\267\351\207\217\344\277\241\346\201\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\346\211\200\346\234\211\345\234\250\347\224\250\347\232\204\344\277\241\345\217\267\351\207\217\344\277\241\346\201\257.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\346\211\200\346\234\211\345\234\250\347\224\250\347\232\204\344\277\241\345\217\267\351\207\217\344\277\241\346\201\257.png" diff --git "a/zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\346\211\200\346\234\211\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\347\233\270\345\205\263\344\277\241\346\201\257.png" "b/zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\346\211\200\346\234\211\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\347\233\270\345\205\263\344\277\241\346\201\257.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\346\237\245\350\257\242\346\211\200\346\234\211\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\347\233\270\345\205\263\344\277\241\346\201\257.png" rename to "zh-cn/device-dev/kernel/figure/\346\237\245\350\257\242\346\211\200\346\234\211\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250\347\233\270\345\205\263\344\277\241\346\201\257.png" diff --git "a/zh-cn/device-dev/kernel/figures/\347\224\250-rm--r-\345\210\240\351\231\244\347\233\256\345\275\225-sd.png" "b/zh-cn/device-dev/kernel/figure/\347\224\250-rm--r-\345\210\240\351\231\244\347\233\256\345\275\225-sd.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\347\224\250-rm--r-\345\210\240\351\231\244\347\233\256\345\275\225-sd.png" rename to "zh-cn/device-dev/kernel/figure/\347\224\250-rm--r-\345\210\240\351\231\244\347\233\256\345\275\225-sd.png" diff --git "a/zh-cn/device-dev/kernel/figures/\347\224\250-rm-\345\221\275\344\273\244\345\210\240\351\231\244\346\226\207\344\273\266-log1-txt.png" "b/zh-cn/device-dev/kernel/figure/\347\224\250-rm-\345\221\275\344\273\244\345\210\240\351\231\244\346\226\207\344\273\266-log1-txt.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\347\224\250-rm-\345\221\275\344\273\244\345\210\240\351\231\244\346\226\207\344\273\266-log1-txt.png" rename to "zh-cn/device-dev/kernel/figure/\347\224\250-rm-\345\221\275\344\273\244\345\210\240\351\231\244\346\226\207\344\273\266-log1-txt.png" diff --git "a/zh-cn/device-dev/kernel/figures/\347\272\277\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\347\272\277\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\347\272\277\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" rename to "zh-cn/device-dev/kernel/figure/\347\272\277\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" diff --git "a/zh-cn/device-dev/kernel/figures/\350\276\223\345\205\245-telnet-on.png" "b/zh-cn/device-dev/kernel/figure/\350\276\223\345\205\245-telnet-on.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\350\276\223\345\205\245-telnet-on.png" rename to "zh-cn/device-dev/kernel/figure/\350\276\223\345\205\245-telnet-on.png" diff --git "a/zh-cn/device-dev/kernel/figures/\350\277\233\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\350\277\233\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/figures/\350\277\233\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" rename to "zh-cn/device-dev/kernel/figure/\350\277\233\347\250\213\347\212\266\346\200\201\350\277\201\347\247\273\347\244\272\346\204\217\345\233\276.png" diff --git "a/zh-cn/device-dev/kernel/figure/\351\235\231\346\200\201\345\206\205\345\255\230\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figure/\351\235\231\346\200\201\345\206\205\345\255\230\347\244\272\346\204\217\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..f7ffdd153fcfffcc4fdf97a51b66c11c502c6a9c Binary files /dev/null and "b/zh-cn/device-dev/kernel/figure/\351\235\231\346\200\201\345\206\205\345\255\230\347\244\272\346\204\217\345\233\276.png" differ diff --git "a/zh-cn/device-dev/kernel/figures/\344\272\222\346\226\245\351\224\201\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figures/\344\272\222\346\226\245\351\224\201\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" deleted file mode 100644 index 7cc6c5fa458d60bdf1ad1d7494ab3982adc8d1f0..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\344\272\222\346\226\245\351\224\201\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\344\273\273\345\212\241\347\212\266\346\200\201\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figures/\344\273\273\345\212\241\347\212\266\346\200\201\347\244\272\346\204\217\345\233\276.png" deleted file mode 100644 index cf0684595b4e7b07dfebf6c55c867a97e1e71663..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\344\273\273\345\212\241\347\212\266\346\200\201\347\244\272\346\204\217\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\351\207\217\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\351\207\217\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" deleted file mode 100644 index fc4591567b7f1643e1c065df5860af3e7aff2a3b..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\344\277\241\345\217\267\351\207\217\350\277\220\344\275\234\347\244\272\346\204\217\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\206\205\346\240\270\345\220\257\345\212\250\346\265\201\347\250\213.png" "b/zh-cn/device-dev/kernel/figures/\345\206\205\346\240\270\345\220\257\345\212\250\346\265\201\347\250\213.png" deleted file mode 100644 index cb86acd9c05059302f21ac10a3d8604b6e742652..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\345\206\205\346\240\270\345\220\257\345\212\250\346\265\201\347\250\213.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\212\250\346\200\201\345\206\205\345\255\230\346\240\270\345\277\203\347\256\227\346\263\225.png" "b/zh-cn/device-dev/kernel/figures/\345\212\250\346\200\201\345\206\205\345\255\230\346\240\270\345\277\203\347\256\227\346\263\225.png" deleted file mode 100644 index c32b7cf60be9ed557f5c3139aed303b105a4e2d9..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\345\212\250\346\200\201\345\206\205\345\255\230\346\240\270\345\277\203\347\256\227\346\263\225.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\212\250\346\200\201\345\206\205\345\255\230\347\256\241\347\220\206\347\273\223\346\236\204\345\233\276.png" "b/zh-cn/device-dev/kernel/figures/\345\212\250\346\200\201\345\206\205\345\255\230\347\256\241\347\220\206\347\273\223\346\236\204\345\233\276.png" deleted file mode 100644 index 96a1c33d124ad5cd67afa331154840ad7b59c9ab..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\345\212\250\346\200\201\345\206\205\345\255\230\347\256\241\347\220\206\347\273\223\346\236\204\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\345\240\206\346\240\210\345\210\206\346\236\220\345\216\237\347\220\206\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figures/\345\240\206\346\240\210\345\210\206\346\236\220\345\216\237\347\220\206\347\244\272\346\204\217\345\233\276.png" deleted file mode 100644 index ce4103b3f82838d3593e7d04523b402b4283effa..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\345\240\206\346\240\210\345\210\206\346\236\220\345\216\237\347\220\206\347\244\272\346\204\217\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/figures/\351\235\231\346\200\201\345\206\205\345\255\230\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/kernel/figures/\351\235\231\346\200\201\345\206\205\345\255\230\347\244\272\346\204\217\345\233\276.png" deleted file mode 100644 index b21c09ee49ceda81474ce085aae1f67feea17f3a..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/kernel/figures/\351\235\231\346\200\201\345\206\205\345\255\230\347\244\272\346\204\217\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/\346\227\266\351\227\264\347\256\241\347\220\206.md" b/zh-cn/device-dev/kernel/kernel-lite-basic-mini-time.md similarity index 32% rename from "zh-cn/device-dev/kernel/\346\227\266\351\227\264\347\256\241\347\220\206.md" rename to zh-cn/device-dev/kernel/kernel-lite-basic-mini-time.md index 967a229499e4473b06fadcc91807e5a91cab2e66..1cded0a67f9982198d4b112d092b821657d51b1b 100644 --- "a/zh-cn/device-dev/kernel/\346\227\266\351\227\264\347\256\241\347\220\206.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-basic-mini-time.md @@ -1,7 +1,7 @@ # 时间管理 -- **[基本概念](基本概念-13.md)** +- **[基本概念](kernel-lite-mini-basic-time-basic.md)** -- **[开发指导](开发指导-14.md)** +- **[开发指导](kernel-lite-mini-basic-time-guide.md)** diff --git "a/zh-cn/device-dev/kernel/\345\206\205\346\240\270\347\274\226\347\240\201\350\247\204\350\214\203.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-app-code.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\206\205\346\240\270\347\274\226\347\240\201\350\247\204\350\214\203.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-app-code.md diff --git "a/zh-cn/device-dev/kernel/\345\217\214\345\220\221\351\223\276\350\241\250.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-app-data-list.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\217\214\345\220\221\351\223\276\350\241\250.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-app-data-list.md index 8b9323d6187bdca8b70e5da46a3e718326d6f937..d219cc86b000959550b333309dcacc0aca028c30 100644 --- "a/zh-cn/device-dev/kernel/\345\217\214\345\220\221\351\223\276\350\241\250.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-app-data-list.md @@ -120,7 +120,7 @@ 5. 调用LOS\_ListEmpty判断链表是否为空。 6. 调用LOS\_ListDelInit删除指定节点并以此节点初始化链表。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 需要注意节点指针前后方向的操作。 >- 链表操作接口,为底层接口,不对入参进行判空,需要使用者确保传参合法。 >- 如果链表节点的内存是动态申请的,删除节点时,要注意释放内存。 diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\225\260\346\215\256\347\273\223\346\236\204.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-app-data.md similarity index 52% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\225\260\346\215\256\347\273\223\346\236\204.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-app-data.md index 5464ca3ceec7232da4ed7051b1c38258e7c4a7c3..78fda11861f02826b54e3ba8f97ef0f9308d413f 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\225\260\346\215\256\347\273\223\346\236\204.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-app-data.md @@ -1,5 +1,5 @@ # 基本数据结构 -- **[双向链表](双向链表.md)** +- **[双向链表](kernel-lite-mini-app-data-list.md)** diff --git "a/zh-cn/device-dev/kernel/CMSIS\346\224\257\346\214\201.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-app-lib-cmsis.md similarity index 99% rename from "zh-cn/device-dev/kernel/CMSIS\346\224\257\346\214\201.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-app-lib-cmsis.md index 4f64bc6b8ca9b68a2f5b19dd23c7548555cb71b6..fb77b086298240bc85ad0755df727f0b3a844b3c 100644 --- "a/zh-cn/device-dev/kernel/CMSIS\346\224\257\346\214\201.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-app-lib-cmsis.md @@ -457,7 +457,7 @@ CMSIS-RTOS2组件可以作为库或源代码提供(下图显示了库)。通 静态对象分配需要访问RTOS对象控制块定义。特定于实现的头文件(下图中的os\_xx .h)提供对此类控制块定义的访问。对于OpenHarmony LiteOS-M内核,由文件名以los\_开头的头文件提供,这些文件包含OpenHarmony LiteOS-M内核的这些定义。 -![](figures/zh-cn_image_0000001121429646.png) +![](figure/zh-cn_image_0000001132778524.png) ### 编程实例 diff --git "a/zh-cn/device-dev/kernel/POSIX\346\224\257\346\214\201.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-app-lib-posix.md similarity index 100% rename from "zh-cn/device-dev/kernel/POSIX\346\224\257\346\214\201.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-app-lib-posix.md diff --git "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223\346\224\257\346\214\201.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-app-lib.md similarity index 35% rename from "zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223\346\224\257\346\214\201.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-app-lib.md index 7522c305c5e44955578700d055f5320dd744d90c..b2f157ae194d8a266d79477623dd40191882f753 100644 --- "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223\346\224\257\346\214\201.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-app-lib.md @@ -1,7 +1,7 @@ # 标准库支持 -- **[CMSIS支持](CMSIS支持.md)** +- **[CMSIS支持](kernel-lite-mini-app-lib-cmsis.md)** -- **[POSIX支持](POSIX支持.md)** +- **[POSIX支持](kernel-lite-mini-app-lib-posix.md)** diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-app.md b/zh-cn/device-dev/kernel/kernel-lite-mini-app.md new file mode 100644 index 0000000000000000000000000000000000000000..1d46fa1186b838599b3ec26dbc154a99ff20a111 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-app.md @@ -0,0 +1,9 @@ +# 附录 + +- **[内核编码规范](kernel-lite-mini-app-code.md)** + +- **[基本数据结构](kernel-lite-mini-app-data.md)** + +- **[标准库支持](kernel-lite-mini-app-lib.md)** + + diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt-concept.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt-concept.md diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt-guide.md index c97dfdd3f24126cbb537d98f53e59a4786fdbc13..346332358b3a116c07f195a0b5013617d500ef57 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt-guide.md @@ -61,7 +61,7 @@ OpenHarmony LiteOS-M内核的中断模块提供下面几种功能,接口详细 2. 调用TestHwiTrigger接口触发指定中断(该接口在测试套中定义,通过写中断控制器的相关寄存器模拟外部中断,一般的外设设备,不需要执行这一步)。 3. 调用HalHwiDelete接口删除指定中断,此接口根据实际情况使用,判断是否需要删除中断。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 根据具体硬件,配置支持的最大中断数及可设置的中断优先级个数。 >- 中断处理程序耗时不能过长,否则会影响CPU对中断的及时响应。 >- 中断响应过程中不能直接、间接执行引起调度的LOS\_Schedule等函数。 diff --git "a/zh-cn/device-dev/kernel/\344\270\255\346\226\255\347\256\241\347\220\206.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt.md similarity index 31% rename from "zh-cn/device-dev/kernel/\344\270\255\346\226\255\347\256\241\347\220\206.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt.md index 29edaf0e1e6affff1fd4c5ff00687023434c6651..3b10c0482f68e943142f978ef11aac6d5c536b4e 100644 --- "a/zh-cn/device-dev/kernel/\344\270\255\346\226\255\347\256\241\347\220\206.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-interrupt.md @@ -1,7 +1,7 @@ # 中断管理 -- **[基本概念](基本概念.md)** +- **[基本概念](kernel-lite-mini-basic-interrupt-concept.md)** -- **[开发指导](开发指导.md)** +- **[开发指导](kernel-lite-mini-basic-interrupt-guide.md)** diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-6.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event-basic.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-6.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event-basic.md index 6869a792fd853689071ea77ccce8691aa24b9c8e..91a6c20c0e1a5260d405a66966c859bc36cb290c 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-6.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event-basic.md @@ -80,7 +80,7 @@ 5. 处理事件控制块 6. 事件控制块销毁 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 进行事件读写操作时,事件的第25位为保留位,不可以进行位设置。 >- 对同一事件反复写入,算作一次写入。 diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-5.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event-guide.md similarity index 97% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-5.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event-guide.md index a96f943c8d815c0e4274c22744ae6ca33b5d9bb1..47befc62231ddb127477e813a4d104f0b9d2f1be 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-5.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event-guide.md @@ -48,5 +48,5 @@ LOS\_WAITMODE\_CLR:事件读取成功后,对应读取到的事件会被清 **事件销毁:**销毁指定的事件控制块。 **图 1** 事件运作原理图 -![](figures/事件运作原理图.png "事件运作原理图") +![](figure/事件运作原理图.png "事件运作原理图") diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event.md b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event.md new file mode 100644 index 0000000000000000000000000000000000000000..4f18b0192293cbdfa74b9107939fbe332b9999ce --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-event.md @@ -0,0 +1,7 @@ +# 事件 + +- **[基本概念](kernel-lite-mini-basic-ipc-event-guide.md)** + +- **[开发指导](kernel-lite-mini-basic-ipc-event-basic.md)** + + diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-7.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex-basic.md similarity index 95% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-7.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex-basic.md index 4989a0b93edfc85ad0f1a4b5fb50b7f5eaa89019..1d2973462485dce46a4a02e8a25396b0670a020f 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-7.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex-basic.md @@ -15,5 +15,5 @@ 用互斥锁处理非共享资源的同步访问时,如果有任务访问该资源,则互斥锁为加锁状态。此时其他任务如果想访问这个公共资源则会被阻塞,直到互斥锁被持有该锁的任务释放后,其他任务才能重新访问该公共资源,此时互斥锁再次上锁,如此确保同一时刻只有一个任务正在访问这个公共资源,保证了公共资源操作的完整性。 **图 1** 互斥锁运作示意图 -![](figures/互斥锁运作示意图.png "互斥锁运作示意图") +![](figure/互斥锁运作示意图.png "互斥锁运作示意图") diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-8.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-8.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex-guide.md index a194bc9e585299c70eae4256ca0e0877f4e226c5..053174daa324f172faeab2d5d47ea6651163c8e7 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-8.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex-guide.md @@ -67,7 +67,7 @@ 4. 删除互斥锁LOS\_MuxDelete。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 两个任务不能对同一把互斥锁加锁。如果某任务对已被持有的互斥锁加锁,则该任务会被挂起,直到持有该锁的任务对互斥锁解锁,才能执行对这把互斥锁的加锁操作。 >- 互斥锁不能在中断服务程序中使用。 >- LiteOS-M内核作为实时操作系统需要保证任务调度的实时性,尽量避免任务的长时间阻塞,因此在获得互斥锁之后,应该尽快释放互斥锁。 diff --git "a/zh-cn/device-dev/kernel/\344\272\222\346\226\245\351\224\201.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex.md similarity index 30% rename from "zh-cn/device-dev/kernel/\344\272\222\346\226\245\351\224\201.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex.md index ce0ea2949c4c1e9fa1973457e88e40a411b2069d..e081c4154426c896c2f722f49d9e62e7a526dcdf 100644 --- "a/zh-cn/device-dev/kernel/\344\272\222\346\226\245\351\224\201.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-mutex.md @@ -1,7 +1,7 @@ # 互斥锁 -- **[基本概念](基本概念-7.md)** +- **[基本概念](kernel-lite-mini-basic-ipc-mutex-basic.md)** -- **[开发指导](开发指导-8.md)** +- **[开发指导](kernel-lite-mini-basic-ipc-mutex-guide.md)** diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-9.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue-basic.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-9.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue-basic.md index 90541dda60a684efadf642baf6e01e6c01460b79..06f38749defa69e8e6fc678643d342e07675f90d 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-9.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue-basic.md @@ -61,7 +61,7 @@ typedef struct 图 1 队列读写数据操作示意图 -![](figures/zh-cn_image_0000001124146302.png) +![](figure/zh-cn_image_0000001132935054.png) 上图对读写队列做了示意,图中只画了尾节点写入方式,没有画头节点写入,但是两者是类似的。 diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-10.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-10.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue-guide.md index c521fd755d1194a135d4a538535a5ec81172ad4f..6c161853b669ecdd896c3a11cd01deb5d6bdf624 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-10.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue-guide.md @@ -83,7 +83,7 @@ 4. 通过LOS\_QueueInfoGet获取队列信息。 5. 通过LOS\_QueueDelete删除队列。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 系统支持的最大队列数是指:整个系统的队列资源总个数,而非用户能使用的个数。例如:系统软件定时器多占用一个队列资源,那么用户能使用的队列资源就会减少一个。 >- 创建队列时传入的队列名和flags暂时未使用,作为以后的预留参数。 >- 队列接口函数中的入参timeOut是相对时间。 diff --git "a/zh-cn/device-dev/kernel/\346\266\210\346\201\257\351\230\237\345\210\227.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue.md similarity index 31% rename from "zh-cn/device-dev/kernel/\346\266\210\346\201\257\351\230\237\345\210\227.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue.md index 3a5640015631e761cd32d7ed3b6564cbb056e5a4..a278033961591f72c9adc5629729eb06f922b266 100644 --- "a/zh-cn/device-dev/kernel/\346\266\210\346\201\257\351\230\237\345\210\227.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-queue.md @@ -1,7 +1,7 @@ # 消息队列 -- **[基本概念](基本概念-9.md)** +- **[基本概念](kernel-lite-mini-basic-ipc-queue-basic.md)** -- **[开发指导](开发指导-10.md)** +- **[开发指导](kernel-lite-mini-basic-ipc-queue-guide.md)** diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-11.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem-basic.md similarity index 97% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-11.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem-basic.md index dd72ce5e104fdf75ce5dcb71967eae9b0aaf7fab..79c4d7e6f5765673641968df9142a9db722fd0c2 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-11.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem-basic.md @@ -49,5 +49,5 @@ typedef struct { 信号量允许多个任务在同一时刻访问共享资源,但会限制同一时刻访问此资源的最大任务数目。当访问资源的任务数达到该资源允许的最大数量时,会阻塞其他试图获取该资源的任务,直到有任务释放该信号量。 **图 1** 信号量运作示意图 -![](figures/信号量运作示意图.png "信号量运作示意图") +![](figure/信号量运作示意图.png "信号量运作示意图") diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-12.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-12.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem-guide.md index 4a483b339176b6f58c5e4059fb13bd28b3eea629..81715063b36a075044c4b1e2b98c14b7a2c67c15 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-12.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem-guide.md @@ -58,7 +58,7 @@ 3. 释放信号量LOS\_SemPost。 4. 删除信号量LOS\_SemDelete。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >由于中断不能被阻塞,因此不能在中断中使用阻塞模式申请信号量。 ## 编程实例 diff --git "a/zh-cn/device-dev/kernel/\344\277\241\345\217\267\351\207\217.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem.md similarity index 30% rename from "zh-cn/device-dev/kernel/\344\277\241\345\217\267\351\207\217.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem.md index 6eb88eb04b6e7a3335c5c84f9932d018134cbeb3..1b1afc6945e99589fb8185863fe4ce76b968a38d 100644 --- "a/zh-cn/device-dev/kernel/\344\277\241\345\217\267\351\207\217.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc-sem.md @@ -1,7 +1,7 @@ # 信号量 -- **[基本概念](基本概念-11.md)** +- **[基本概念](kernel-lite-mini-basic-ipc-sem-basic.md)** -- **[开发指导](开发指导-12.md)** +- **[开发指导](kernel-lite-mini-basic-ipc-sem-guide.md)** diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc.md b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc.md new file mode 100644 index 0000000000000000000000000000000000000000..2acba70e2f90c17310c5ce4a77c8d12a9658afc7 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-ipc.md @@ -0,0 +1,11 @@ +# 内核通信机制 + +- **[事件](kernel-lite-mini-basic-ipc-event.md)** + +- **[互斥锁](kernel-lite-mini-basic-ipc-mutex.md)** + +- **[消息队列](kernel-lite-mini-basic-ipc-queue.md)** + +- **[信号量](kernel-lite-mini-basic-ipc-sem.md)** + + diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-4.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-basic.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-4.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-basic.md diff --git "a/zh-cn/device-dev/kernel/\345\212\250\346\200\201\345\206\205\345\255\230.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-dynamic.md similarity index 98% rename from "zh-cn/device-dev/kernel/\345\212\250\346\200\201\345\206\205\345\255\230.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-dynamic.md index 05922df9f795ac26bfa94d71858bab47dda9a8de..c9f32f97ad19a097af45e8d43620c068241e3991 100644 --- "a/zh-cn/device-dev/kernel/\345\212\250\346\200\201\345\206\205\345\255\230.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-dynamic.md @@ -16,7 +16,7 @@ OpenHarmony LiteOS-M动态内存在TLSF算法的基础上,对区间的划分进行了优化,获得更优的性能,降低了碎片率。动态内存核心算法框图如下: **图 1** 动态内存核心算法 -![](figures/动态内存核心算法.png "动态内存核心算法") +![](figure/动态内存核心算法.png "动态内存核心算法") 根据空闲内存块的大小,使用多个空闲链表来管理。根据内存空闲块大小分为两个部分:\[4, 127\]和\[27, 231\],如上图size class所示: @@ -28,7 +28,7 @@ OpenHarmony LiteOS-M动态内存在TLSF算法的基础上,对区间的划分 内存管理结构如下图所示: **图 2** 动态内存管理结构图 -![](figures/动态内存管理结构图.png "动态内存管理结构图") +![](figure/动态内存管理结构图.png "动态内存管理结构图") - 内存池池头部分 @@ -138,7 +138,7 @@ OpenHarmony LiteOS-M的动态内存管理主要为用户提供以下功能,接
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 由于动态内存管理需要管理控制块数据结构来管理内存,这些数据结构会额外消耗内存,故实际用户可使用内存总量小于配置项OS\_SYS\_MEM\_SIZE的大小。 >- 对齐分配内存接口LOS\_MemAllocAlign/LOS\_MemMallocAlign因为要进行地址对齐,可能会额外消耗部分内存,故存在一些遗失内存,当系统释放该对齐内存时,同时回收由于对齐导致的遗失内存。 diff --git "a/zh-cn/device-dev/kernel/\351\235\231\346\200\201\345\206\205\345\255\230.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-static.md similarity index 98% rename from "zh-cn/device-dev/kernel/\351\235\231\346\200\201\345\206\205\345\255\230.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-static.md index 090cea4a0d0b7ec7188f2836b0014de6b5e0bdab..b52510e80b57ef577efaa7babfebc808d6041ca5 100644 --- "a/zh-cn/device-dev/kernel/\351\235\231\346\200\201\345\206\205\345\255\230.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory-static.md @@ -16,7 +16,7 @@ 静态内存池由一个控制块LOS\_MEMBOX\_INFO和若干相同大小的内存块LOS\_MEMBOX\_NODE构成。控制块位于内存池头部,用于内存块管理,包含内存块大小uwBlkSize,内存块数量uwBlkNum,已分配使用的内存块数量uwBlkCnt和空闲内存块链表stFreeList。内存块的申请和释放以块大小为粒度,每个内存块包含指向下一个内存块的指针pstNext。 **图 1** 静态内存示意图 -![](figures/静态内存示意图.png "静态内存示意图") +![](figure/静态内存示意图.png "静态内存示意图") ## 开发指导 @@ -80,7 +80,7 @@ OpenHarmony LiteOS-M的静态内存管理主要为用户提供以下功能,接
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >初始化后的内存池的内存块数量,不等于总大小除于内存块大小,因为内存池的控制块和每个内存块的控制头,都存在内存开销,设置总大小时,需要将这些因素考虑进去。 ### 开发流程 diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory.md b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory.md new file mode 100644 index 0000000000000000000000000000000000000000..e0f1da7e35707537406eccc8b425c8697e5e06e0 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-memory.md @@ -0,0 +1,9 @@ +# 内存管理 + +- **[基本概念](kernel-lite-mini-basic-memory-basic.md)** + +- **[静态内存](kernel-lite-mini-basic-memory-static.md)** + +- **[动态内存](kernel-lite-mini-basic-memory-dynamic.md)** + + diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-15.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft-basic.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-15.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft-basic.md diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-16.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-16.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft-guide.md index 37753d3a43aad040cae343376b2a57aa48ff7e20..0e9f963c0c631b7b8b8284dfa4f16e54d1de273d 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-16.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft-guide.md @@ -75,7 +75,7 @@ OpenHarmony LiteOS-M内核的软件定时器模块提供下面几种功能,接 5. 停止定时器LOS\_SwtmrStop。 6. 删除定时器LOS\_SwtmrDelete。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 软件定时器的回调函数中不要做过多操作,不要使用可能引起任务挂起或者阻塞的接口或操作。 >- 软件定时器使用了系统的一个队列和一个任务资源,软件定时器任务的优先级设定为0,且不允许修改 。 >- 系统可配置的软件定时器资源个数是指:整个系统可使用的软件定时器资源总个数,而并非是用户可使用的软件定时器资源个数。例如:系统软件定时器多占用一个软件定时器资源数,那么用户能使用的软件定时器资源就会减少一个。 diff --git "a/zh-cn/device-dev/kernel/\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft.md similarity index 34% rename from "zh-cn/device-dev/kernel/\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft.md index 903970bdd61bd096a10c842a567cdcfa25d9ba13..0aef7971458b34cc5b9b903ca9317026ee5c7a62 100644 --- "a/zh-cn/device-dev/kernel/\350\275\257\344\273\266\345\256\232\346\227\266\345\231\250.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-soft.md @@ -1,7 +1,7 @@ # 软件定时器 -- **[基本概念](基本概念-15.md)** +- **[基本概念](kernel-lite-mini-basic-soft-basic.md)** -- **[开发指导](开发指导-16.md)** +- **[开发指导](kernel-lite-mini-basic-soft-guide.md)** diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-2.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-task-basic.md similarity index 98% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-2.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-task-basic.md index db5ae0ccd5e29fe476b391b83bd3c4ff13199e53..074596f401185126a3ea5701b115aba2887cebcf 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-2.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-task-basic.md @@ -29,7 +29,7 @@ OpenHarmony LiteOS-M的任务模块可以给用户提供多个任务,实现任 **任务状态迁移** **图 1** 任务状态示意图 -![](figures/任务状态示意图.png "任务状态示意图") +![](figure/任务状态示意图.png "任务状态示意图") **任务状态迁移说明:** diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-3.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-task-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-3.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-task-guide.md index ee4e2944bc774a1dd9cc59822734b6de9a1c723b..6b42cf5b4a99c1316d0388e23795ba3794b73d86 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-3.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-task-guide.md @@ -164,7 +164,7 @@ OpenHarmony LiteOS-M内核的任务管理模块提供下面几种功能,接口 5. 挂起指定的任务LOS\_TaskSuspend,任务挂起等待恢复操作。 6. 恢复挂起的任务LOS\_TaskResume。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 执行Idle任务时,会对待回收链表中的任务控制块和任务栈进行回收。 >- 任务名是指针,并没有分配空间,在设置任务名时,禁止将局部变量的地址赋值给任务名指针。 >- 任务栈的大小按8字节大小对齐。确定任务栈大小的原则是,够用就行,多了浪费,少了任务栈溢出。 diff --git "a/zh-cn/device-dev/kernel/\344\273\273\345\212\241\347\256\241\347\220\206.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-task.md similarity index 32% rename from "zh-cn/device-dev/kernel/\344\273\273\345\212\241\347\256\241\347\220\206.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-task.md index 22165d0c36e05cd78b42f6c18f233ccef9eb2269..8ca91b1f10c4e6e638621cde1fc9338c0667bdb5 100644 --- "a/zh-cn/device-dev/kernel/\344\273\273\345\212\241\347\256\241\347\220\206.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-task.md @@ -1,7 +1,7 @@ # 任务管理 -- **[基本概念](基本概念-2.md)** +- **[基本概念](kernel-lite-mini-basic-task-basic.md)** -- **[开发指导](开发指导-3.md)** +- **[开发指导](kernel-lite-mini-basic-task-guide.md)** diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-13.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-time-basic.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-13.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-time-basic.md diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-14.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-time-guide.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-14.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-basic-time-guide.md index 46c7d87b7cbbfa961feb34f316b94c73475277b3..a0328b1c7ddea9644fa8c861fa9ac72453b72ae8 100644 --- "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-14.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic-time-guide.md @@ -76,7 +76,7 @@ OpenHarmony LiteOS-M内核的时间管理提供下面几种功能,接口详细 1. 根据实际需求,完成板级配置适配,并配置系统主时钟频率OS\_SYS\_CLOCK(单位Hz)和LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND。OS\_SYS\_CLOCK的默认值基于硬件平台配置。 2. 调用时钟转换/统计接口。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 时间管理不是单独的功能模块,依赖于OS\_SYS\_CLOCK和LOSCFG\_BASE\_CORE\_TICK\_PER\_SECOND两个配置选项。 >- 系统的Tick数在关中断的情况下不进行计数,故系统Tick数不能作为准确时间使用。 >- 配置选项维护在开发板工程的文件target\_config.h。 diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-basic.md b/zh-cn/device-dev/kernel/kernel-lite-mini-basic.md new file mode 100644 index 0000000000000000000000000000000000000000..fd6774bee47339f547587c7461b536ac5b8373e1 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-basic.md @@ -0,0 +1,15 @@ +# 基础内核 + +- **[中断管理](kernel-lite-mini-basic-interrupt.md)** + +- **[任务管理](kernel-lite-mini-basic-task.md)** + +- **[内存管理](kernel-lite-mini-basic-memory.md)** + +- **[内核通信机制](kernel-lite-mini-basic-ipc.md)** + +- **[时间管理](kernel-lite-basic-mini-time.md)** + +- **[软件定时器](kernel-lite-mini-basic-soft.md)** + + diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-17.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup-basic.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-17.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup-basic.md diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-18.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup-guide.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-18.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup-guide.md diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup.md b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup.md new file mode 100644 index 0000000000000000000000000000000000000000..e49d8a7175b407625353d87a11996a65bf990992 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-cpup.md @@ -0,0 +1,7 @@ +# CPU占用率 + +- **[基本概念](kernel-lite-mini-extend-cpup-basic.md)** + +- **[开发指导](kernel-lite-mini-extend-cpup-guide.md)** + + diff --git a/zh-cn/device-dev/kernel/FAT-20.md b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-fat.md similarity index 99% rename from zh-cn/device-dev/kernel/FAT-20.md rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-fat.md index 7b8620cb01f87d0e84a8f72b5b253536ac440ed9..d96f14f3435c61968447f9b3cbfb62ccd0fce5c7 100644 --- a/zh-cn/device-dev/kernel/FAT-20.md +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-fat.md @@ -34,7 +34,7 @@ FAT文件系统的使用需要底层MMC相关驱动的支持。在一个带MMC ### 开发流程 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- FATFS文件与目录操作: > - 单个文件大小不超过4G。 > - 支持同时打开的文件数最大为FAT\_MAX\_OPEN\_FILES,文件夹数最大为FAT\_MAX\_OPEN\_DIRS。 diff --git "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-21.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit-basic.md similarity index 60% rename from "zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-21.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit-basic.md index 310f6014ea284196a44041b9ae68651d14d58555..17423ee5c40ff14e3d771ae1459055e49c1b52f8 100644 --- "a/zh-cn/device-dev/kernel/\345\237\272\346\234\254\346\246\202\345\277\265-21.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit-basic.md @@ -3,31 +3,19 @@ - [运行机制](#section10284121317365) - [日志方式](#section13804114513361) - [Cow机制](#section172771130193610) - - [lfs掉电保护](#section42941021173614) + - [LittleFS掉电保护](#section42941021173614) -LittleFS主要用在微控制器和flash上,是一种嵌入式文件系统,具有如下3个特点: - -1. 掉电恢复 - - 在写入时即使复位或者掉电也可以恢复到上一个正确的状态。 - -2. 擦写均衡 - - 有效延长flash的使用寿命。 - -3. 有限的RAM/ROM - - 节省ROM和RAM空间。 - +LittleFS主要用在微控制器和Flash上,是一种嵌入式文件系统,具有掉电恢复、擦写均衡、节省ROM/RAM空间等特点。 ## 运行机制 -最经典的掉电保护方法有两种,一种是使用日志,一种是通过COW方式。lfs结合了两种方法,并优化了两种方案的缺点,提供了一套掉电保护策略 +最经典的掉电保护方法有两种,一种是使用日志,一种是通过COW方式。LittleFS结合了两种方法,并优化了两种方案的缺点,提供了一套掉电保护策略 ### 日志方式 -![](figures/zh-cn_image_0000001124310992.png) +**图 1** 日志方式示意图 +![](figure/日志方式示意图.png "日志方式示意图") 具体步骤为: @@ -44,7 +32,8 @@ LittleFS主要用在微控制器和flash上,是一种嵌入式文件系统, ### Cow机制 -![](figures/zh-cn_image_0000001170790681.png) +**图 2** Cow机制示意图 +![](figure/Cow机制示意图.png "Cow机制示意图") 具体步骤为: @@ -55,27 +44,28 @@ LittleFS主要用在微控制器和flash上,是一种嵌入式文件系统, 步骤1完成了,步骤2没有完成,则使用旧的数据,新的节点变成孤儿节点。 -### lfs掉电保护 +### LittleFS掉电保护 -fs结合了日志方式和COW机制两种方式进行掉电保护,并且优化了两种方案。 +LittleFS结合了日志方式和COW机制两种方式进行掉电保护,并且优化了两种方案。 -前面谈过文件系统三要素,超级块,inode,以及数据。对应lfs来说,他把超级块以及inode通过日志的方式存储,两种采用统一的存储结构,后文称两者为元数据;普通数据则采用cow的方式存储,采用czt逆序链表的方式。 +文件系统有三要素,超级块,inode,以及数据,对应LittleFS来说,它把超级块以及inode通过日志的方式存储,两种采用统一的存储结构,后文称两者为元数据;普通数据则采用cow的方式存储,采用czt逆序链表的方式。 -![](figures/zh-cn_image_0000001124307264.png) +![](figure/zh-cn_image_0000001124307264.png) **元数据的存储** -![](figures/zh-cn_image_0000001124147160.png) - 元数据(对应root,dir)采用双block的方式存储,互为备份,每个block都有一个revision序号,值越大,表示block的数据越新,每个block默认可以存储最多0xff个文件的数据,如果超过这个值,则需要compact(压缩)。 -Compact是干什么呢? 即当数据的大小大于某个值的时候,把数据整合,剔除同一个id的旧的数据,然后写入到备份block里面。 +Compact是干什么呢? 即当数据的大小大于某个值的时候,把数据整合,剔除同一个id的旧的数据,然后写入到备份block里面。如图所示: + +**图 3** 元数据存储示意图 +![](figure/元数据存储示意图.png "元数据存储示意图") **普通数据的存储** -Lfs的数据采用链表的方式逆向管理。 +LittleFS的数据采用链表的方式逆向管理。 -![](figures/zh-cn_image_0000001124306828.png) +![](figure/zh-cn_image_0000001132085260.png) 1. 采用逆向的指针,这样常规的追加数据,不需要额外的开销来重新建立所有的索引; 2. 每个偶数block有多个指针,指向更远的数据,这样可以在检索的时候加快速度。 diff --git "a/zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-22.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit-guide.md similarity index 100% rename from "zh-cn/device-dev/kernel/\345\274\200\345\217\221\346\214\207\345\257\274-22.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit-guide.md diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit.md b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit.md new file mode 100644 index 0000000000000000000000000000000000000000..b0ffac3d6795718298342eb939196b45636ad6d0 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file-lit.md @@ -0,0 +1,7 @@ +# LittleFS + +- **[基本概念](kernel-lite-mini-extend-file-lit-basic.md)** + +- **[开发指导](kernel-lite-mini-extend-file-lit-guide.md)** + + diff --git "a/zh-cn/device-dev/kernel/\346\226\207\344\273\266\347\263\273\347\273\237-19.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file.md similarity index 99% rename from "zh-cn/device-dev/kernel/\346\226\207\344\273\266\347\263\273\347\273\237-19.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-file.md index ba10ab39c51ce9917ccc7a664e4b13c3e7842824..c7ee5fabfdca2b92b4cba55758bf298edb554a72 100644 --- "a/zh-cn/device-dev/kernel/\346\226\207\344\273\266\347\263\273\347\273\237-19.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-file.md @@ -197,8 +197,8 @@
-- **[FAT](FAT-20.md)** +- **[FAT](kernel-lite-mini-extend-file-fat.md)** -- **[LittleFS](LittleFS.md)** +- **[LittleFS](kernel-lite-mini-extend-file-lit.md)** diff --git "a/zh-cn/device-dev/kernel/C++\346\224\257\346\214\201.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-support.md similarity index 98% rename from "zh-cn/device-dev/kernel/C++\346\224\257\346\214\201.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-extend-support.md index 86080372577209de5d8bdb01955b3e6834525b1c..c0b1ed529142bba08729d4cc769f47554b4136ec 100644 --- "a/zh-cn/device-dev/kernel/C++\346\224\257\346\214\201.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend-support.md @@ -68,7 +68,7 @@ C++代码的识别主要由编译器支持,系统主要对全局对象进行
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >调用该函数时,一定要在c++业务前。另外部分与系统资源强相关的类或接口,如std::thread,std::mutex等,在三方编译器使用的c库非musl c时,存在兼容性问题,不建议使用。 ### 编程实例 diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-extend.md b/zh-cn/device-dev/kernel/kernel-lite-mini-extend.md new file mode 100644 index 0000000000000000000000000000000000000000..1d413abe902d5f6d590db74545381a6349dc1c23 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-extend.md @@ -0,0 +1,9 @@ +# 扩展组件 + +- **[C++支持](kernel-lite-mini-extend-support.md)** + +- **[CPU占用率](kernel-lite-mini-extend-cpup.md)** + +- **[文件系统](kernel-lite-mini-extend-file.md)** + + diff --git "a/zh-cn/device-dev/kernel/\350\270\251\345\206\205\345\255\230\346\243\200\346\265\213.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-cet.md similarity index 98% rename from "zh-cn/device-dev/kernel/\350\270\251\345\206\205\345\255\230\346\243\200\346\265\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-cet.md index ab5d4101a001ddd96502f65b446ba27511f254ab..20a2b532d3a54324a02c9dd10fb8f3fdfed7487e 100644 --- "a/zh-cn/device-dev/kernel/\350\270\251\345\206\205\345\255\230\346\243\200\346\265\213.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-cet.md @@ -22,7 +22,7 @@ LOSCFG\_BASE\_MEM\_NODE\_INTEGRITY\_CHECK:开关宏,默认关闭;若打开 由于该功能只会检测出哪个内存节点被破坏了,并给出前节点信息(因为内存分布是连续的,当前节点最有可能被前节点破坏)。如果要进一步确认前节点在哪里申请的,需开启内存泄漏检测功能,通过LR记录,辅助定位。 ->![](public_sys-resources/icon-caution.gif) **注意:** +>![](../public_sys-resources/icon-caution.gif) **注意:** >开启该功能,节点头多了魔鬼数字字段,会增大节点头大小。由于实时检测完整性,故性能影响较大;若性能敏感的场景,可以不开启该功能,使用LOS\_MemIntegrityCheck接口检测。 ## 开发指导 diff --git "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\346\263\204\346\274\217\346\243\200\346\265\213.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-det.md similarity index 98% rename from "zh-cn/device-dev/kernel/\345\206\205\345\255\230\346\263\204\346\274\217\346\243\200\346\265\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-det.md index 5c57178e5077c4aff25a482ad5b6c4a5ed9f6cb5..7f49df4fc87257c46fbfdcdaa9dad954d1962484 100644 --- "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\346\263\204\346\274\217\346\243\200\346\265\213.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-det.md @@ -43,7 +43,7 @@ node size LR[0] LR[1] LR[2] 0x100179cc: 0x5c 0x9b02c24e 0x9b02c246 0x9b008ef0 ``` ->![](public_sys-resources/icon-caution.gif) **注意:** +>![](../public_sys-resources/icon-caution.gif) **注意:** >开启内存检测会影响内存申请的性能,且每个内存节点都会记录LR地址,内存开销也加大。 ### 编程实例 diff --git "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\344\277\241\346\201\257\347\273\237\350\256\241.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-mes.md similarity index 95% rename from "zh-cn/device-dev/kernel/\345\206\205\345\255\230\344\277\241\346\201\257\347\273\237\350\256\241.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-mes.md index f0dce32252a444dc8b0d715477e2aeb2e0740bda..0dd4f930425a171933e8dafe2f690804111ff257 100644 --- "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\344\277\241\346\201\257\347\273\237\350\256\241.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug-mes.md @@ -17,7 +17,7 @@ - 碎片率:衡量内存池的碎片化程度,碎片率高表现为内存池剩余内存很多,但是最大空闲内存块很小,可以用公式(fragment=100-最大空闲内存块大小/剩余内存大小)来度量; -- 其他参数:通过调用接口(详见[内存管理](内存管理.md)章节接口说明),扫描内存池的节点信息,统计出相关信息。 +- 其他参数:通过调用接口(详见[内存管理](kernel-lite-mini-basic-memory.md)章节接口说明),扫描内存池的节点信息,统计出相关信息。 ## 功能配置 diff --git "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\350\260\203\346\265\213.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug.md similarity index 70% rename from "zh-cn/device-dev/kernel/\345\206\205\345\255\230\350\260\203\346\265\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug.md index 82555bc86205532b29ab368edfe3adc72ba10287..0c4474cd15eb7b42235cdcc139be9a8f6dccb6b7 100644 --- "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\350\260\203\346\265\213.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-debug.md @@ -2,10 +2,10 @@ 内存调测方法旨在辅助定位动态内存相关问题,提供了基础的动态内存池信息统计手段,向用户呈现内存池水线、碎片率等信息;提供了内存泄漏检测手段,方便用户准确定位存在内存泄漏的代码行,也可以辅助分析系统各个模块内存的使用情况;提供了踩内存检测手段,可以辅助定位越界踩内存的场景。 -- **[内存信息统计](内存信息统计.md)** +- **[内存信息统计](kernel-lite-mini-inner-debug-mes.md)** -- **[内存泄漏检测](内存泄漏检测.md)** +- **[内存泄漏检测](kernel-lite-mini-inner-debug-det.md)** -- **[踩内存检测](踩内存检测.md)** +- **[踩内存检测](kernel-lite-mini-inner-debug-cet.md)** diff --git "a/zh-cn/device-dev/kernel/\345\274\202\345\270\270\350\260\203\346\265\213.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-exception.md similarity index 99% rename from "zh-cn/device-dev/kernel/\345\274\202\345\270\270\350\260\203\346\265\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-inner-exception.md index 8e9a050102de2a7721f962338b3d4420498c3d4b..5828d645f139907f9d8763226b3f4dbb269b2965 100644 --- "a/zh-cn/device-dev/kernel/\345\274\202\345\270\270\350\260\203\346\265\213.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-exception.md @@ -21,7 +21,7 @@ OpenHarmony LiteOS-M提供异常接管调测手段,帮助开发者定位分析 堆栈分析原理如下图所示,实际堆栈信息根据不同CPU架构有所差异,此处仅做示意。 **图 1** 堆栈分析原理示意图 -![](figures/堆栈分析原理示意图.png "堆栈分析原理示意图") +![](figure/堆栈分析原理示意图.png "堆栈分析原理示意图") 图中不同颜色的寄存器表示不同的函数。可以看到函数调用过程中,寄存器的保存。通过FP寄存器,栈回溯到异常函数的父函数,继续按照规律对栈进行解析,推出函数调用关系,方便用户定位问题。 diff --git "a/zh-cn/device-dev/kernel/Trace\350\260\203\346\265\213.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-inner-trace.md similarity index 100% rename from "zh-cn/device-dev/kernel/Trace\350\260\203\346\265\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-inner-trace.md diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini-inner.md b/zh-cn/device-dev/kernel/kernel-lite-mini-inner.md new file mode 100644 index 0000000000000000000000000000000000000000..63cd8f58de79e139b236f5ce8c56b2ca5df8c260 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-inner.md @@ -0,0 +1,9 @@ +# 内核调测 + +- **[内存调测](kernel-lite-mini-inner-debug.md)** + +- **[异常调测](kernel-lite-mini-inner-exception.md)** + +- **[Trace调测](kernel-lite-mini-inner-trace.md)** + + diff --git "a/zh-cn/device-dev/kernel/\350\256\244\350\257\206LiteOS-M\345\206\205\346\240\270.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-m.md similarity index 96% rename from "zh-cn/device-dev/kernel/\350\256\244\350\257\206LiteOS-M\345\206\205\346\240\270.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-m.md index 7984b0843bb602a8962a0c40915c143803202041..3548ae04b61c2ea2c20c5f024694568f9099ea74 100644 --- "a/zh-cn/device-dev/kernel/\350\256\244\350\257\206LiteOS-M\345\206\205\346\240\270.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-m.md @@ -1,4 +1,4 @@ -# 认识LiteOS-M内核 +# 内核概述 - [内核简介](#section1429342661510) - [cpu体系架构支持](#section48891456112819) @@ -10,7 +10,7 @@ OpenHarmony LiteOS-M内核是面向IoT领域构建的轻量级物联网操作系统内核,具有小体积、低功耗、高性能的特点。其代码结构简单,主要包括内核最小功能集、内核抽象层、可选组件以及工程目录等。OpenHarmony LiteOS-M内核架构包含硬件相关层以及硬件无关层,如下图所示,其中Kernel Arch模块属于硬件相关层,该模块按不同编译工具链、芯片架构分类,提供统一的HAL(Hardware Abstraction Layer)接口,提升了硬件易适配性,满足AIoT类型丰富的硬件和编译工具链的拓展;Components等其他模块属于硬件无关层,其中Kernel Task等内核模块提供基础能力,Components模块提供网络、文件系统等组件能力,Utils模块提供错误处理、调测等能力,KAL(Kernel Abstraction Layer)模块提供统一的标准接口。 **图 1** 内核架构图 -![](figures/内核架构图.png "内核架构图") +![](figure/内核架构图.png "内核架构图") ### cpu体系架构支持 @@ -58,5 +58,5 @@ LiteOS-M已经支持ARM Cortex-M3、ARM Cortex-M4、ARM Cortex-M7、ARM Cortex-M 在开发板配置文件target\_config.h配置系统时钟、每秒Tick数,可以对任务、内存、IPC、异常处理模块进行裁剪配置。系统启动时,根据配置进行指定模块的初始化。内核启动流程包含外设初始化、系统时钟配置、内核初始化、操作系统启动等,详见内核启动流程图。 **图 2** 内核启动流程 -![](figures/内核启动流程.png "内核启动流程") +![](figure/内核启动流程.png "内核启动流程") diff --git "a/zh-cn/device-dev/kernel/\345\277\253\351\200\237\345\205\245\351\227\250.md" b/zh-cn/device-dev/kernel/kernel-lite-mini-start.md similarity index 77% rename from "zh-cn/device-dev/kernel/\345\277\253\351\200\237\345\205\245\351\227\250.md" rename to zh-cn/device-dev/kernel/kernel-lite-mini-start.md index 53ddc75318ff70d0ffed93acc947c9c1eccd6723..13cd49841e858d07c4d6d15e197d2902b9183b51 100644 --- "a/zh-cn/device-dev/kernel/\345\277\253\351\200\237\345\205\245\351\227\250.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-mini-start.md @@ -5,15 +5,15 @@ - [获取示例工程源码](#section204717216181) - [编译运行](#section9772514181917) -OpenHarmony LiteOS-M内核的编译构建系统是一个基于gn和ninja的组件化构建系统,支持按组件配置、裁剪和拼装,按需构建出定制化的产品。编译构建系统的详细信息可以参考[编译构建概述](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/%E7%BC%96%E8%AF%91%E6%9E%84%E5%BB%BA%E6%A6%82%E8%BF%B0.md)。本文主要介绍如何基于gn和ninja编译LiteOS-M工程。 +OpenHarmony LiteOS-M内核的编译构建系统是一个基于gn和ninja的组件化构建系统,支持按组件配置、裁剪和拼装,按需构建出定制化的产品。编译构建系统的详细信息可以参考[考编译构建概](../subsystems/subsys-build-mini-lite.md#section10958256161119)。本文主要介绍如何基于gn和ninja编译LiteOS-M工程。 ## 搭建开发环境 -在搭建各个开发板环境前,需要完成OpenHarmony系统基础环境搭建。系统基础环境主要是指OpenHarmony的编译环境和开发环境,详细介绍请参考官方站点[搭建系统基础环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/%E6%90%AD%E5%BB%BA%E7%B3%BB%E7%BB%9F%E7%8E%AF%E5%A2%83.md)。开发者需要根据环境搭建文档,完成下述软件的安装:Python3.7+、gn、ninja、hb。对于LiteOS-M内核,还需要安装ARM GCC编译工具链。 +在搭建各个开发板环境前,需要完成OpenHarmony系统基础环境搭建。系统基础环境主要是指OpenHarmony的编译环境和开发环境,详细介绍请参考官方站点[搭建系统基础环境](../quick-start/quickstart-lite-env-setup-des.md)。开发者需要根据环境搭建文档,完成下述软件的安装:Python3.7+、gn、ninja、hb。对于LiteOS-M内核,还需要安装ARM GCC编译工具链。 ## 获取OpenHarmony源码 -开发者需要在Linux服务器上通过Git克隆获取OpenHarmony最新源码,详细的源码获取方式,请见[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。获取OpenHarmony完整仓代码后,假设克隆目录为\~/openHarmony。 +开发者需要在Linux服务器上通过Git克隆获取OpenHarmony最新源码,详细的源码获取方式,请见[源码获取](../get-code/sourcecode-acquire.md)。获取OpenHarmony完整仓代码后,假设克隆目录为\~/openHarmony。 ## 获取示例工程源码 diff --git a/zh-cn/device-dev/kernel/kernel-lite-mini.md b/zh-cn/device-dev/kernel/kernel-lite-mini.md new file mode 100644 index 0000000000000000000000000000000000000000..f531579ddb9a8bb0962474d074255d56cd3f9958 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-mini.md @@ -0,0 +1,13 @@ +# 轻量系统内核 + +- **[内核概述](kernel-lite-mini-m.md)** + +- **[基础内核](kernel-lite-mini-basic.md)** + +- **[扩展组件](kernel-lite-mini-extend.md)** + +- **[内核调测](kernel-lite-mini-inner.md)** + +- **[附录](kernel-lite-mini-app.md)** + + diff --git a/zh-cn/device-dev/kernel/kernel-lite-small-basic.md b/zh-cn/device-dev/kernel/kernel-lite-small-basic.md new file mode 100644 index 0000000000000000000000000000000000000000..d9cac957f9948081206b93faba73c481d99474e9 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-small-basic.md @@ -0,0 +1,11 @@ +# 基础内核 + +- **[进程](kernel-lite-small-process.md)** + +- **[线程](kernel-lite-small-thread.md)** + +- **[内存](kernel-lite-small-memory.md)** + +- **[网络](kernel-lite-small-net.md)** + + diff --git a/zh-cn/device-dev/kernel/FAT.md b/zh-cn/device-dev/kernel/kernel-lite-small-file-fat.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/FAT.md rename to zh-cn/device-dev/kernel/kernel-lite-small-file-fat.md diff --git a/zh-cn/device-dev/kernel/JFFS2.md b/zh-cn/device-dev/kernel/kernel-lite-small-file-jffs.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/JFFS2.md rename to zh-cn/device-dev/kernel/kernel-lite-small-file-jffs.md diff --git a/zh-cn/device-dev/kernel/NFS.md b/zh-cn/device-dev/kernel/kernel-lite-small-file-nfs.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/NFS.md rename to zh-cn/device-dev/kernel/kernel-lite-small-file-nfs.md index d319329c44d3c54e4597a68ce64465886143c7b2..dec5a7023b1d9dcb34d1367fa7446129bfd76ee9 --- a/zh-cn/device-dev/kernel/NFS.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-file-nfs.md @@ -116,7 +116,7 @@ NFS客户端用户,能够将网络远程的NFS服务端分享的目录挂载 该命令将服务器10.67.212.178上的/home/sqbin/nfs目录mount在OpenHarmony内核设备上的/nfs上。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >本例默认nfs server已经配置可用,即示例中服务器10.67.212.178上的/home/sqbin/nfs已配置可访问。 mount命令的格式为: diff --git a/zh-cn/device-dev/kernel/RAMFS.md b/zh-cn/device-dev/kernel/kernel-lite-small-file-ramfs.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/RAMFS.md rename to zh-cn/device-dev/kernel/kernel-lite-small-file-ramfs.md diff --git a/zh-cn/device-dev/kernel/VFS.md b/zh-cn/device-dev/kernel/kernel-lite-small-file-vfs.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/VFS.md rename to zh-cn/device-dev/kernel/kernel-lite-small-file-vfs.md index 0a16319ccd1b2bc85ec7f546416d13a925806124..c7d197be36132aa914eaa399d9e16945e6f11ccd --- a/zh-cn/device-dev/kernel/VFS.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-file-vfs.md @@ -17,7 +17,7 @@ VFS是Virtual File System(虚拟文件系统)的缩写,它不是一个实 由于不同类型的文件系统接口不统一,若系统中有多个文件系统类型,访问不同的文件系统就需要使用不同的非标准接口。而通过在系统中添加VFS层,提供统一的抽象接口,屏蔽了底层异构类型的文件系统的差异,使得访问文件系统的系统调用不用关心底层的存储介质和文件系统类型,提高开发效率。VFS和各个具体文件系统的关系如下: **图 1** VFS和各个文件系统的关系 -![](figures/VFS和各个文件系统的关系.png "VFS和各个文件系统的关系") +![](figure/VFS和各个文件系统的关系.png "VFS和各个文件系统的关系") OpenHarmony内核中,VFS框架是通过在内存中的树结构来实现的,树的每个结点都是一个inode结构体。设备注册和文件系统挂载后会根据路径在树中生成相应的结点。VFS最主要是两个功能: @@ -35,7 +35,7 @@ VFS框架内存中的inode树结点有三种类型: - 挂载点:挂载具体文件系统,如/vs/sd、/mnt。 **图 2** 文件系统树形结构 -![](figures/文件系统树形结构.png "文件系统树形结构") +![](figure/文件系统树形结构.png "文件系统树形结构") ## 注意事项 @@ -81,7 +81,7 @@ VFS框架内存中的inode树结点有三种类型: open, close, read, write, seek, ioctl, fcntl, mmap, sync, dup, dup2, truncate, opendir, closedir, readdir, rewinddir, mount, umount, statfs, unlink, remove, mkdir, rmdir, rename, stat, utime, seek64, fallocate, fallocate64, truncate64, chmod, chown。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 当前只提供修改jffs2文件以及vfs设备节点属性的接口,各个系统对只读等属性有各自的处理方式。 >- 在OpenHarmony内核中属性并不冲突(可以任意修改)。 >- 在OpenHarmony内核中只读属性文件/目录不允许被删除。 diff --git "a/zh-cn/device-dev/kernel/\346\226\207\344\273\266\347\263\273\347\273\237.md" b/zh-cn/device-dev/kernel/kernel-lite-small-file.md similarity index 94% rename from "zh-cn/device-dev/kernel/\346\226\207\344\273\266\347\263\273\347\273\237.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-file.md index b17821e62df9a268e8b4328bafafe90bba795d3b..e88e5dd77b3a3a41c0d9fc63e0c52cf09d75205b 100644 --- "a/zh-cn/device-dev/kernel/\346\226\207\344\273\266\347\263\273\347\273\237.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-file.md @@ -41,14 +41,14 @@ OpenHarmony轻内核支持的文件系统有:VFS(虚拟文件系统)、NFS
-- **[VFS](VFS.md)** +- **[VFS](kernel-lite-small-file-vfs.md)** -- **[NFS](NFS.md)** +- **[NFS](kernel-lite-small-file-nfs.md)** -- **[RAMFS](RAMFS.md)** +- **[RAMFS](kernel-lite-small-file-ramfs.md)** -- **[FAT](FAT.md)** +- **[FAT](kernel-lite-small-file-fat.md)** -- **[JFFS2](JFFS2.md)** +- **[JFFS2](kernel-lite-small-file-jffs.md)** diff --git "a/zh-cn/device-dev/kernel/\344\270\216Linux\346\240\207\345\207\206\345\272\223\347\232\204\345\267\256\345\274\202.md" b/zh-cn/device-dev/kernel/kernel-lite-small-lib-differ.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/\344\270\216Linux\346\240\207\345\207\206\345\272\223\347\232\204\345\267\256\345\274\202.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-lib-differ.md diff --git "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223-0.md" b/zh-cn/device-dev/kernel/kernel-lite-small-lib-standard.md old mode 100755 new mode 100644 similarity index 96% rename from "zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223-0.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-lib-standard.md index a365148450986901a04ff48891283a2ab4b8ded8..9af746232e7fec8dc578856a3d16335453b22dfd --- "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223-0.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-lib-standard.md @@ -4,12 +4,12 @@ - [操作实例](#section4807125622614) - [常见问题](#section1219455217277) -OpenHarmony内核OpenHarmony使用**musl libc**库,支持标准POSIX接口,开发者可基于POSIX标准接口开发内核之上的组件及应用。 +OpenHarmony内核使用**musl libc**库,支持标准POSIX接口,开发者可基于POSIX标准接口开发内核之上的组件及应用。 ## 框架流程 **图 1** POSIX接口框架 -![](figures/POSIX接口框架.png "POSIX接口框架") +![](figure/POSIX接口框架.png "POSIX接口框架") **musl libc**库支持POSIX标准,涉及的系统调用相关接口由OpenHarmony内核适配支持 ,以满足接口对外描述的功能要求。 diff --git "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223.md" b/zh-cn/device-dev/kernel/kernel-lite-small-lib.md old mode 100755 new mode 100644 similarity index 31% rename from "zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-lib.md index 56f2c7aa1b5ffa7d292a929f310373364a55d09c..849c9823bb4d63fab462824146e779ab635cbd4e --- "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\345\272\223.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-lib.md @@ -1,7 +1,7 @@ # 标准库 -- **[标准库](标准库-0.md)** +- **[标准库](kernel-lite-small-lib-standard.md)** -- **[与Linux标准库的差异](与Linux标准库的差异.md)** +- **[与Linux标准库的差异](kernel-lite-small-lib-differ.md)** diff --git "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230.md" b/zh-cn/device-dev/kernel/kernel-lite-small-memory.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/kernel/\345\206\205\345\255\230.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-memory.md index 871a1c5ac807e07ef3a6d220cefd6bef3044e91b..5f97c5705ac4715be205c81f29469ebf13d750c8 --- "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-memory.md @@ -217,8 +217,8 @@
- >![](public_sys-resources/icon-note.gif) **说明:** - >mmap与Linux实现差异详见[与Linux标准库的差异](与Linux标准库的差异.md)章节。 + >![](../public_sys-resources/icon-note.gif) **说明:** + >mmap与Linux实现差异详见[与Linux标准库的差异](kernel-lite-small-lib-differ.md)章节。 **返回值:** diff --git "a/zh-cn/device-dev/kernel/\347\275\221\347\273\234.md" b/zh-cn/device-dev/kernel/kernel-lite-small-net.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/kernel/\347\275\221\347\273\234.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-net.md index 17eafd2f164bce1274e6f33838e60f7ef7a255f2..8aa33611c312c90c33556691ff5460883c51f3d8 --- "a/zh-cn/device-dev/kernel/\347\275\221\347\273\234.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-net.md @@ -8,7 +8,7 @@ 网络模块实现了TCP/IP协议栈基本功能,提供标准的POSIX socket接口。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >当前系统使用**lwIP**提供网络能力。 ## 使用场景 diff --git "a/zh-cn/device-dev/kernel/\350\277\233\347\250\213.md" b/zh-cn/device-dev/kernel/kernel-lite-small-process.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/kernel/\350\277\233\347\250\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-process.md index c425b175ae513cd01fbb8a5c4cbf17dca6351e1d..d6b9ca0377b4a57c3e6663468ddfba4f7a6d930c --- "a/zh-cn/device-dev/kernel/\350\277\233\347\250\213.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-process.md @@ -34,7 +34,7 @@ OpenHarmony内核的进程一共有32个优先级\(0-31\),用户进程可配 **图 1** 进程状态迁移示意图 -![](figures/进程状态迁移示意图.png "进程状态迁移示意图") +![](figure/进程状态迁移示意图.png "进程状态迁移示意图") **进程状态迁移说明:** diff --git "a/zh-cn/device-dev/kernel/\347\224\250\346\210\267\346\200\201\345\274\202\345\270\270\344\277\241\346\201\257\350\257\264\346\230\216.md" b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-abn.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/\347\224\250\346\210\267\346\200\201\345\274\202\345\270\270\344\277\241\346\201\257\350\257\264\346\230\216.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-abn.md diff --git a/zh-cn/device-dev/kernel/cat.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cat.md old mode 100755 new mode 100644 similarity index 95% rename from zh-cn/device-dev/kernel/cat.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cat.md index ef609b4dc074a005ff49eb4718b5b8bc069867d8..89f4a35b9f4980a853899a6db9cb91fe205291ed --- a/zh-cn/device-dev/kernel/cat.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cat.md @@ -49,5 +49,5 @@ cat用于显示文本文件的内容。 ## 输出说明 **图 1** 查看 hello-harmony.txt 文件的信息 -![](figures/查看-hello-harmony-txt-文件的信息.png "查看-hello-harmony-txt-文件的信息") +![](figure/查看-hello-harmony-txt-文件的信息.png "查看-hello-harmony-txt-文件的信息") diff --git a/zh-cn/device-dev/kernel/cd.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cd.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/cd.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cd.md index 8acd5da837df72b9755ac1e90032c26ece690a6b..61247bfba2e28f771398d9a561063eea382984c8 --- a/zh-cn/device-dev/kernel/cd.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cd.md @@ -53,5 +53,5 @@ cd \[_path_\] ## 输出说明 **图 1** 显示结果如下 -![](figures/显示结果如下.png "显示结果如下") +![](figure/显示结果如下.png "显示结果如下") diff --git a/zh-cn/device-dev/kernel/chgrp.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chgrp.md old mode 100755 new mode 100644 similarity index 95% rename from zh-cn/device-dev/kernel/chgrp.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chgrp.md index dc292bf35fdd9f18d169039d5f8c7cc10fffe446..efeccc336faaf14bcab8c01256026cd5e437722c --- a/zh-cn/device-dev/kernel/chgrp.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chgrp.md @@ -56,5 +56,5 @@ chgrp \[_group_\] \[_pathname_\] ## 输出说明 **图 1** 修改 hello-harmony.txt 文件的群组为100 -![](figures/修改-hello-harmony-txt-文件的群组为100.png "修改-hello-harmony-txt-文件的群组为100") +![](figure/修改-hello-harmony-txt-文件的群组为100.png "修改-hello-harmony-txt-文件的群组为100") diff --git a/zh-cn/device-dev/kernel/chmod.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chmod.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/chmod.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chmod.md index a77659fcddfc8998b2f1d62b32b06cbbba2be19f..296ab1e3d3890571360162d88a0b139c6c3d00e4 --- a/zh-cn/device-dev/kernel/chmod.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chmod.md @@ -56,5 +56,5 @@ chmod \[_mode_\] \[_pathname_\] ## 输出说明 **图 1** 修改 hello-harmony.txt 文件的权限为666 -![](figures/修改-hello-harmony-txt-文件的权限为666.png "修改-hello-harmony-txt-文件的权限为666") +![](figure/修改-hello-harmony-txt-文件的权限为666.png "修改-hello-harmony-txt-文件的权限为666") diff --git a/zh-cn/device-dev/kernel/chown.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chown.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/chown.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chown.md index 467da9d89cedc0b704a913bd20cd84fa1f95654d..4e63051ec9c9aa6e4e6fea52278e0b9905c08f45 --- a/zh-cn/device-dev/kernel/chown.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-chown.md @@ -66,5 +66,5 @@ chown \[_owner_\] \[_group_\] \[_pathname_\] ## 输出说明 **图 1** 修改 hello-harmony.txt 文件的uid为100,gid为200 -![](figures/修改-hello-harmony-txt-文件的uid为100-gid为200.png "修改-hello-harmony-txt-文件的uid为100-gid为200") +![](figure/修改-hello-harmony-txt-文件的uid为100-gid为200.png "修改-hello-harmony-txt-文件的uid为100-gid为200") diff --git a/zh-cn/device-dev/kernel/cp.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cp.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/cp.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cp.md index eab217ee504586612e96af7bd6f3ac9869a6f435..299beb065c72efb62c4d54ae5a675b6e0ae7ec20 --- a/zh-cn/device-dev/kernel/cp.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-cp.md @@ -64,5 +64,5 @@ cp \[_SOURCEFILE_\] \[_DESTFILE_\] ## 输出说明 **图 1** 显示结果如下 -![](figures/显示结果如下-0.png "显示结果如下-0") +![](figure/显示结果如下-17.png "显示结果如下-17") diff --git a/zh-cn/device-dev/kernel/format.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-format.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/format.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-format.md index ecddf4e03134b2a3a3503bd30d1c7f3a26989ad7..200ddb4fe65b114791341707ba5bea5649f85255 --- a/zh-cn/device-dev/kernel/format.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-format.md @@ -65,5 +65,5 @@ format <_dev\_inodename_\> <_sectors_\> <_option_\> \[_label_\] 结果如下 -![](figures/zh-cn_image_0000001052370307.png) +![](figure/zh-cn_image_0000001052370307.png) diff --git a/zh-cn/device-dev/kernel/ls.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-is.md old mode 100755 new mode 100644 similarity index 95% rename from zh-cn/device-dev/kernel/ls.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-is.md index fa17ee74660b045d3f3c0d4da8f78a21d517e2f1..0a1823804e0adc769a94d7dbe961d129310da288 --- a/zh-cn/device-dev/kernel/ls.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-is.md @@ -55,5 +55,5 @@ ls \[_path_\] ## 输出说明 **图 1** 查看当前系统路径下的目录,显示的内容如下 -![](figures/查看当前系统路径下的目录-显示的内容如下.png "查看当前系统路径下的目录-显示的内容如下") +![](figure/查看当前系统路径下的目录-显示的内容如下.png "查看当前系统路径下的目录-显示的内容如下") diff --git a/zh-cn/device-dev/kernel/lsfd.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-isfd.md old mode 100755 new mode 100644 similarity index 93% rename from zh-cn/device-dev/kernel/lsfd.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-isfd.md index fe0ac75118286010d5496421fa463d2afc845794..e1fb8007c539895e4551e5ef6a8d229beba38e93 --- a/zh-cn/device-dev/kernel/lsfd.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-isfd.md @@ -25,5 +25,5 @@ lsfd命令显示当前已经打开文件的fd号以及文件的名字。 ## 输出说明 **图 1** lsfd输出说明 -![](figures/lsfd输出说明.png "lsfd输出说明") +![](figure/lsfd输出说明.png "lsfd输出说明") diff --git a/zh-cn/device-dev/kernel/mkdir.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-mkdir.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/mkdir.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-mkdir.md index 444d6a246b92fbc3b82dac6f190ad87ad883af46..c261ebdca3e37218fb3646c90c3e3a78c854e337 --- a/zh-cn/device-dev/kernel/mkdir.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-mkdir.md @@ -50,5 +50,5 @@ mkdir \[_directory_\] ## 输出说明 **图 1** 创建 share 目录 -![](figures/创建-share-目录.png "创建-share-目录") +![](figure/创建-share-目录.png "创建-share-目录") diff --git a/zh-cn/device-dev/kernel/mount.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-mount.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/mount.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-mount.md index 5924e0ca5acaa6dc2d1379d3bfa9651175eff320..103a5d29c4ed79b4ffc4b5b812e07c3ce414e87d --- a/zh-cn/device-dev/kernel/mount.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-mount.md @@ -74,5 +74,5 @@ mount后加需要挂载的设备信息、指定目录以及设备文件格式, 将/dev/mmcblk0p0 挂载到/bin1/vs/sd目录 -![](figures/zh-cn_image_0000001051690323.png) +![](figure/zh-cn_image_0000001051690323.png) diff --git a/zh-cn/device-dev/kernel/partinfo.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-part.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/partinfo.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-part.md index b8dc652e97d0bbf411bd53345e0c2aaf5bba72ab..52ba25e101848e6463d1da65c5b0131059584496 --- a/zh-cn/device-dev/kernel/partinfo.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-part.md @@ -48,5 +48,5 @@ partinfo /dev/mmcblk0p0 ## 输出说明 -![](figures/zh-cn_image_0000001052370303.png) +![](figure/zh-cn_image_0000001052370303.png) diff --git a/zh-cn/device-dev/kernel/partition.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-partion.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/partition.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-partion.md index 9a4b15684996b320979efc79eb34924b19cb8440..458f7f05ef470e91f3813b8bcf8a532aa71b0e99 --- a/zh-cn/device-dev/kernel/partition.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-partion.md @@ -58,5 +58,5 @@ partition \[_nand / spinor_\] 查看spinor flash分区信息 -![](figures/zh-cn_image_0000001052810300.png) +![](figure/zh-cn_image_0000001052810300.png) diff --git a/zh-cn/device-dev/kernel/pwd.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-pwd.md old mode 100755 new mode 100644 similarity index 94% rename from zh-cn/device-dev/kernel/pwd.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-pwd.md index bff68160cecb23771496dd419583ba4c084c241e..c9d526fc07d50b00ec756a43ebc42a59cd55e531 --- a/zh-cn/device-dev/kernel/pwd.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-pwd.md @@ -30,5 +30,5 @@ pwd 命令将当前目录的全路径名称(从根目录)写入标准输出 ## 输出说明 **图 1** 查看当前路径 -![](figures/查看当前路径.png "查看当前路径") +![](figure/查看当前路径.png "查看当前路径") diff --git a/zh-cn/device-dev/kernel/rm.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-rm.md old mode 100755 new mode 100644 similarity index 94% rename from zh-cn/device-dev/kernel/rm.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-rm.md index 2815b287a1d8bc385b9879727254d4726b8d266b..b9eb4d90a0a88fc19697f3a7a006b2c957bba948 --- a/zh-cn/device-dev/kernel/rm.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-rm.md @@ -60,8 +60,8 @@ rm \[_-r_\] \[_dirname / filename_\] ## 输出说明 **图 1** 用 rm 命令删除文件 log1.txt -![](figures/用-rm-命令删除文件-log1-txt.png "用-rm-命令删除文件-log1-txt") +![](figure/用-rm-命令删除文件-log1-txt.png "用-rm-命令删除文件-log1-txt") **图 2** 用 rm -r 删除目录 sd -![](figures/用-rm--r-删除目录-sd.png "用-rm--r-删除目录-sd") +![](figure/用-rm--r-删除目录-sd.png "用-rm--r-删除目录-sd") diff --git a/zh-cn/device-dev/kernel/rmdir.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-rmdir.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/rmdir.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-rmdir.md index 6a1e52eee3b2f6b21f802a4a144ee5fad3d554ab..c37bbea17c0fd6264888cc1272511434198e54a5 --- a/zh-cn/device-dev/kernel/rmdir.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-rmdir.md @@ -51,5 +51,5 @@ rmdir \[_dir_\] ## 输出说明 **图 1** 删除一个名为 dir 的目录 -![](figures/删除一个名为-dir-的目录.png "删除一个名为-dir-的目录") +![](figure/删除一个名为-dir-的目录.png "删除一个名为-dir-的目录") diff --git a/zh-cn/device-dev/kernel/statfs.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-sta.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/statfs.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-sta.md index bc428c78b253e7c7dff60543c2f942db43756b0f..2373311252bb249b17dba03132d8c6fdaf234cc2 --- a/zh-cn/device-dev/kernel/statfs.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-sta.md @@ -48,5 +48,5 @@ statfs \[_directory_\] statfs /nfs **图 1** statfs输出说明 -![](figures/statfs输出说明.png "statfs输出说明") +![](figure/statfs输出说明.png "statfs输出说明") diff --git a/zh-cn/device-dev/kernel/sync.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-sync.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/sync.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-sync.md diff --git a/zh-cn/device-dev/kernel/touch.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-touch.md old mode 100755 new mode 100644 similarity index 94% rename from zh-cn/device-dev/kernel/touch.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-touch.md index dc40b522af4032be79f096f674800feba6292a2f..1ec96315b5f0fcd4ae5b92f8b9dc2951dc729128 --- a/zh-cn/device-dev/kernel/touch.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-touch.md @@ -44,7 +44,7 @@ touch \[_filename_\] - touch命令用来创建一个空文件,该文件可读写。 - 使用touch命令一次只能创建一个文件。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >在系统重要资源路径下使用touch命令创建文件,会对系统造成死机等未知影响,如在/dev路径下执行touch uartdev-0,会产生系统卡死现象。 @@ -55,5 +55,5 @@ touch \[_filename_\] ## 输出说明 **图 1** 创建一个名为 file.c 的文件 -![](figures/创建一个名为-file-c-的文件.png "创建一个名为-file-c-的文件") +![](figure/创建一个名为-file-c-的文件.png "创建一个名为-file-c-的文件") diff --git a/zh-cn/device-dev/kernel/umount.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-umount.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/umount.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-umount.md index 7cb41d53ef02df0549885092610bb7c5eb156eee..def6e2f84bd6f1c8b214ecbfa88ea3dfc4289c56 --- a/zh-cn/device-dev/kernel/umount.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-umount.md @@ -51,5 +51,5 @@ umount后加上需要卸载的指定文件系统的目录,即将指定文件 将已在/bin1/vs/sd挂载的文件系统卸载 **图 1** umount输出示例 -![](figures/umount输出示例.png "umount输出示例") +![](figure/umount输出示例.png "umount输出示例") diff --git a/zh-cn/device-dev/kernel/writeproc.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-write.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/writeproc.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-write.md index 7e0306ff60c5def1793041f59306a7d17118594b..c94ac15b6a2074c51948a04bfe0e53181359c7a1 --- a/zh-cn/device-dev/kernel/writeproc.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file-write.md @@ -49,7 +49,7 @@ writeproc <_data_\> \>\> /proc/<_filename_\> proc文件实现自身的write函数,调用writeproc命令后会将入参传入write函数。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >procfs不支持多线程访问。 ## 使用实例 @@ -64,6 +64,6 @@ OHOS \# writeproc test \>\> /proc/uptime test \>\> /proc/uptime ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >uptime proc文件临时实现write函数,INFO日志为实现的测试函数打印的日志。 diff --git a/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file.md new file mode 100644 index 0000000000000000000000000000000000000000..f2d8302ca40447c34683eec77ec1d78c9275fcc6 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-file.md @@ -0,0 +1,45 @@ +# 文件命令 + +- **[cat](kernel-lite-small-shell-cmd-file-cat.md)** + +- **[cd](kernel-lite-small-shell-cmd-file-cd.md)** + +- **[chgrp](kernel-lite-small-shell-cmd-file-chgrp.md)** + +- **[chmod](kernel-lite-small-shell-cmd-file-chmod.md)** + +- **[chown](kernel-lite-small-shell-cmd-file-chown.md)** + +- **[cp](kernel-lite-small-shell-cmd-file-cp.md)** + +- **[format](kernel-lite-small-shell-cmd-file-format.md)** + +- **[ls](kernel-lite-small-shell-cmd-file-is.md)** + +- **[lsfd](kernel-lite-small-shell-cmd-file-isfd.md)** + +- **[mkdir](kernel-lite-small-shell-cmd-file-mkdir.md)** + +- **[mount](kernel-lite-small-shell-cmd-file-mount.md)** + +- **[partinfo](kernel-lite-small-shell-cmd-file-part.md)** + +- **[partition](kernel-lite-small-shell-cmd-file-partion.md)** + +- **[pwd](kernel-lite-small-shell-cmd-file-pwd.md)** + +- **[rm](kernel-lite-small-shell-cmd-file-rm.md)** + +- **[rmdir](kernel-lite-small-shell-cmd-file-rmdir.md)** + +- **[statfs](kernel-lite-small-shell-cmd-file-sta.md)** + +- **[sync](kernel-lite-small-shell-cmd-file-sync.md)** + +- **[touch](kernel-lite-small-shell-cmd-file-touch.md)** + +- **[writeproc](kernel-lite-small-shell-cmd-file-write.md)** + +- **[umount](kernel-lite-small-shell-cmd-file-umount.md)** + + diff --git "a/zh-cn/device-dev/kernel/\351\255\224\346\263\225\351\224\256\344\275\277\347\224\250\346\226\271\346\263\225.md" b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-mag.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/kernel/\351\255\224\346\263\225\351\224\256\344\275\277\347\224\250\346\226\271\346\263\225.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-mag.md index 9bd18a8340d5f63817550f51f09b9cbae5dc6caf..bc083f86ce0e71e81429707cec8f586d39243d92 --- "a/zh-cn/device-dev/kernel/\351\255\224\346\263\225\351\224\256\344\275\277\347\224\250\346\226\271\346\263\225.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-mag.md @@ -17,7 +17,7 @@ Debug ---\> Enable MAGIC KEY;若关闭该选项,则魔法键失效。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >1. 可以在menuconfig中,将光标移动到LOSCFG\_ENABLE\_MAGICKEY上,输入“?”,查看帮助信息。 2. 输入“ctrl + r”键,打开魔法键检测功能。 @@ -33,6 +33,6 @@ Debug ---\> Enable MAGIC KEY;若关闭该选项,则魔法键失效。 - ctrl + e:系统进行简单完整性内存池检查,检查出错会输出相关错误信息,检查正常会输出“system memcheck over, all passed!”。 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >魔法键检测功能打开情况下,如果需要通过UART或者USB转虚拟串口输入特殊字符需避免与魔法键值重复,否则魔法键会被误触发,而原有设计功能可能出现错误。 diff --git a/zh-cn/device-dev/kernel/arp.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-arp.md old mode 100755 new mode 100644 similarity index 99% rename from zh-cn/device-dev/kernel/arp.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-arp.md index 2cf3628efa4968b0e5ba3d9ee4cd520a97392441..7ff926b41044eafc1ce54354c4c1dabefd753468 --- a/zh-cn/device-dev/kernel/arp.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-arp.md @@ -77,7 +77,7 @@ arp \[_-i IF_\] -d _IPADDR_ **图 1** 打印整个 ARP 缓存表 - ![](figures/Snipaste_2021-01-26_10-38-58.png) + ![](figure/Snipaste_2021-01-26_10-38-58.png) **表 2** 参数说明 diff --git a/zh-cn/device-dev/kernel/dhclient.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-dh.md old mode 100755 new mode 100644 similarity index 99% rename from zh-cn/device-dev/kernel/dhclient.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-dh.md index 360efdc8085aa1f4c0585e1bc926eaa0fceba7aa..05d883c72b22b3a4500af3b13cb9cae3bb5a3f47 --- a/zh-cn/device-dev/kernel/dhclient.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-dh.md @@ -110,7 +110,7 @@ dhclient -sd 8.8.8.8 ## 使用实例 -![](figures/zh-cn_image_0000001053224218.png) +![](figure/zh-cn_image_0000001053224218.png) ## 输出说明 diff --git a/zh-cn/device-dev/kernel/dns.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-dns.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/dns.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-dns.md diff --git a/zh-cn/device-dev/kernel/ifconfig.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipc.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/ifconfig.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipc.md diff --git a/zh-cn/device-dev/kernel/ipdebug.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipd.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/ipdebug.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ipd.md diff --git a/zh-cn/device-dev/kernel/netstat.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-net.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/netstat.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-net.md index cca0b0dc9ae8fd60e21db1f7901804d5d33d330a..b35a6494a18a56fe021cab3206b146565794c382 --- a/zh-cn/device-dev/kernel/netstat.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-net.md @@ -30,7 +30,7 @@ netstat **图 1** netstat 打印信息 -![](figures/Snipaste_2021-01-26_10-38-58-1.png) +![](figure/Snipaste_2021-01-26_10-38-58-18.png) ## 输出说明 @@ -78,6 +78,6 @@ netstat
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >形如“========== total sockets 32 ====== unused sockets 22 BootTime 27 s ========== ”,表示一共32个套接字,未使用套接字22个,距系统启动已经过27秒。 diff --git a/zh-cn/device-dev/kernel/ntpdate.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ntp.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/ntpdate.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ntp.md diff --git a/zh-cn/device-dev/kernel/ping.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping.md old mode 100755 new mode 100644 similarity index 99% rename from zh-cn/device-dev/kernel/ping.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping.md index c995f3c5ebd497b1876bb079e4c93b824dcd5ca4..e1792bc92dd3871588ca67e12a7b56fdc6434230 --- a/zh-cn/device-dev/kernel/ping.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping.md @@ -95,5 +95,5 @@ ping _-k_ **图 1** ping tftp 服务器地址 -![](figures/Snipaste_2021-01-26_10-38-58-2.png) +![](figure/Snipaste_2021-01-26_10-38-58-19.png) diff --git a/zh-cn/device-dev/kernel/ping6.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping6.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/ping6.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-ping6.md diff --git a/zh-cn/device-dev/kernel/telnet.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-tel.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/telnet.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-tel.md index e68f22de468d07eb1f954a87be4a30add268a3e0..95e8083c8022da0e67f3e192e8e1fbcb1655c4ce --- a/zh-cn/device-dev/kernel/telnet.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-tel.md @@ -50,7 +50,7 @@ telnet \[_on | off_\] - telnet启动要确保网络驱动及网络协议栈已经初始化完成,且板子的网卡是link up状态。 - 暂时无法支持多个客户端(telnet + IP)同时连接开发板。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >telnet属于调测功能,默认配置为关闭,正式产品中禁止使用该功能。 @@ -61,5 +61,5 @@ telnet \[_on | off_\] ## 输出说明 **图 1** 输入 telnet on -![](figures/输入-telnet-on.png "输入-telnet-on") +![](figure/输入-telnet-on.png "输入-telnet-on") diff --git a/zh-cn/device-dev/kernel/tftp.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-tftp.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/tftp.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-tftp.md index a82fdf93898b2f2825c4ae510477f85ea6e3846e..d0a864992ff0d8fe6fb95c5b408eaf9e0b17fc4b --- a/zh-cn/device-dev/kernel/tftp.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net-tftp.md @@ -68,7 +68,7 @@ tftp命令可以从TFTP服务器上下载文件。 2. OpenHarmony单板使用tftp命令上传、下载文件。 3. 传输的文件大小是有限制的不能大于32M。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >tftp属于调测功能,默认配置为关闭,正式产品中禁止使用该功能。 diff --git a/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net.md new file mode 100644 index 0000000000000000000000000000000000000000..6695d35058d5c51b722eeb73330d33d312861002 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-net.md @@ -0,0 +1,25 @@ +# 网络命令 + +- **[arp](kernel-lite-small-shell-cmd-net-arp.md)** + +- **[dhclient](kernel-lite-small-shell-cmd-net-dh.md)** + +- **[dns](kernel-lite-small-shell-cmd-net-dns.md)** + +- **[ifconfig](kernel-lite-small-shell-cmd-net-ipc.md)** + +- **[ipdebug](kernel-lite-small-shell-cmd-net-ipd.md)** + +- **[netstat](kernel-lite-small-shell-cmd-net-net.md)** + +- **[ntpdate](kernel-lite-small-shell-cmd-net-ntp.md)** + +- **[ping](kernel-lite-small-shell-cmd-net-ping.md)** + +- **[ping6](kernel-lite-small-shell-cmd-net-ping6.md)** + +- **[telnet](kernel-lite-small-shell-cmd-net-tel.md)** + +- **[tftp](kernel-lite-small-shell-cmd-net-tftp.md)** + + diff --git a/zh-cn/device-dev/kernel/cpup.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-cpup.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/cpup.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-cpup.md index c2bf2bba4636e7a8c5ec0d36b281fc49c1ad5d15..5d9bf1de8a7e21bf2e07681ba275a02ff007c638 --- a/zh-cn/device-dev/kernel/cpup.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-cpup.md @@ -61,5 +61,5 @@ cpup \[_mode_\] \[_taskID_\] ## 输出说明 **图 1** 指令输出结果 -![](figures/指令输出结果.png "指令输出结果") +![](figure/指令输出结果.png "指令输出结果") diff --git a/zh-cn/device-dev/kernel/date.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-date.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/date.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-date.md index d359856e2043798eae4396e86919a098171ddce4..0ee6698e2fc9e1960b5a7a45474570e80633eb9d --- a/zh-cn/device-dev/kernel/date.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-date.md @@ -90,5 +90,5 @@ date -r \[_Filename_\] ## 输出说明 **图 1** 按指定格式打印系统日期 -![](figures/按指定格式打印系统日期.png "按指定格式打印系统日期") +![](figure/按指定格式打印系统日期.png "按指定格式打印系统日期") diff --git a/zh-cn/device-dev/kernel/dmesg.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-demsg.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/dmesg.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-demsg.md index 197e38fdfffb35ce283113c49a392b50799f9d67..b4e1bbd9eea0c4955f75c2d309474e0ee5a9accf --- a/zh-cn/device-dev/kernel/dmesg.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-demsg.md @@ -109,5 +109,5 @@ dmesg \> \[_fileA_\] ## 输出说明 **图 1** dmesg重定向到文件。 -![](figures/dmesg重定向到文件.png "dmesg重定向到文件") +![](figure/dmesg重定向到文件.png "dmesg重定向到文件") diff --git a/zh-cn/device-dev/kernel/exec.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-exec.md old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device-dev/kernel/exec.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-exec.md index a3b0933672ad5f5347812edf8ed4844bcd2e0621..c5e437ad7ce79baac800f459b108e50f1c5e9fc2 --- a/zh-cn/device-dev/kernel/exec.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-exec.md @@ -55,6 +55,6 @@ OHOS # exec helloworld OHOS # hello world! ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >可执行文件执行后,先打印“OHOS \#”提示符原因:目前Shell “exec”命令执行均为后台执行,结果可能导致提示符提前打印。 diff --git a/zh-cn/device-dev/kernel/free.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-free.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/free.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-free.md index 56734efb792eaa38e825d4cfd42edcd6baf12b0f..dcfdc363829fad59170e29da6a16c06a523d86c1 --- a/zh-cn/device-dev/kernel/free.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-free.md @@ -63,7 +63,7 @@ free \[_-k | -m_\] ## 输出说明 **图 1** 以三种方式显示内存使用情况 -![](figures/以三种方式显示内存使用情况.png "以三种方式显示内存使用情况") +![](figure/以三种方式显示内存使用情况.png "以三种方式显示内存使用情况") **表 2** 输出说明 diff --git a/zh-cn/device-dev/kernel/help.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-help.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/help.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-help.md diff --git a/zh-cn/device-dev/kernel/hwi.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-hwi.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/hwi.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-hwi.md index d2ab70ddb335746aaba995bc090b946b4217d45b..9414e1f74464147595229f46315a108d4b531eb5 --- a/zh-cn/device-dev/kernel/hwi.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-hwi.md @@ -32,11 +32,11 @@ hwi 1. 显示中断信息(LOSCFG\_CPUP\_INCLUDE\_IRQ关闭) - ![](figures/zh-cn_image_0000001053826366.png) + ![](figure/zh-cn_image_0000001053826366.png) 2. 显示中断信息(LOSCFG\_CPUP\_INCLUDE\_IRQ打开) - ![](figures/zh-cn_image_0000001052810304.png) + ![](figure/zh-cn_image_0000001052810304.png) **表 1** 输出说明 diff --git a/zh-cn/device-dev/kernel/kill.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-kill.md old mode 100755 new mode 100644 similarity index 92% rename from zh-cn/device-dev/kernel/kill.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-kill.md index c88e6abc63e0eba88eaa6881366b88de3ab290f6..6f1447fbdaa40653977a87780e2d690f953945b5 --- a/zh-cn/device-dev/kernel/kill.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-kill.md @@ -45,7 +45,7 @@ kill \[_signo_ | _-signo_\] \[_pid_\]
->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >signo有效范围为\[0,64\],建议取值范围为\[1,30\],其余为保留内容。 ## 使用指南 @@ -59,24 +59,24 @@ kill \[_signo_ | _-signo_\] \[_pid_\] 1. 查看当前进程列表,查看需要杀死的进程PID(7)。 **图 1** 查看进程PID -![](figures/查看进程PID.png "查看进程PID") +![](figure/查看进程PID.png "查看进程PID") 2. 发送信号14(SIGALRM默认行为为进程终止)给7号进程**helloworld\_d**(用户态进程):**kill 14 7**(kill -14 7效果相同),并查看当前进程列表,7号进程已终止。 **图 2** 信号发送结果图 -![](figures/信号发送结果图.png "信号发送结果图") +![](figure/信号发送结果图.png "信号发送结果图") ## 输出说明 发送成功或失败输出结果如下。 **图 3** 发送信号给指定进程 -![](figures/发送信号给指定进程.png "发送信号给指定进程") +![](figure/发送信号给指定进程.png "发送信号给指定进程") 信号发送会显示发送记录,未报错表示信号发送成功。 **图 4** 信号发送失败 -![](figures/信号发送失败.png "信号发送失败") +![](figure/信号发送失败.png "信号发送失败") 信号发送失败,上图所示原因为信号发送命令参数无效,请排查信号编号及进程编号是否无效。 diff --git a/zh-cn/device-dev/kernel/log.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-log.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/log.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-log.md index d6972d55512d7cddf07d2791e586fbe4b00494a8..cdadf9859311d2840f490852045b69d409458ad7 --- a/zh-cn/device-dev/kernel/log.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-log.md @@ -70,5 +70,5 @@ log level \[_levelNum_\] ## 输出说明 -![](figures/zh-cn_image_0000001052530298.png) +![](figure/zh-cn_image_0000001052530298.png) diff --git a/zh-cn/device-dev/kernel/memcheck.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-mem.md old mode 100755 new mode 100644 similarity index 89% rename from zh-cn/device-dev/kernel/memcheck.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-mem.md index 5e6058dcf6025e9f6adaa0a2e04938763ba2eb1c..8ff0289bcde30ca0918de0c07ef25194ec5db461 --- a/zh-cn/device-dev/kernel/memcheck.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-mem.md @@ -31,8 +31,8 @@ memcheck ## 输出说明 **图 1** 当前没有内存越界 -![](figures/当前没有内存越界.png "当前没有内存越界") +![](figure/当前没有内存越界.png "当前没有内存越界") **图 2** 出现内存越界 -![](figures/出现内存越界.png "出现内存越界") +![](figure/出现内存越界.png "出现内存越界") diff --git a/zh-cn/device-dev/kernel/oom.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-oom.md old mode 100755 new mode 100644 similarity index 99% rename from zh-cn/device-dev/kernel/oom.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-oom.md index 4590f61fedd7ff85e6596ca1bd5d711509d1bd6e..e21772b94ea31d1251aa05fcf421ae668bcd6643 --- a/zh-cn/device-dev/kernel/oom.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-oom.md @@ -77,7 +77,7 @@ oom -h | --help ## 输出说明 -![](figures/zh-cn_image_0000001053710680.png) +![](figure/zh-cn_image_0000001053710680.png) **表 2** 输出说明 diff --git a/zh-cn/device-dev/kernel/pmm.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-pmm.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/pmm.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-pmm.md index 9ed393dfdd95811a140333837905c65263a65bd2..067433a0b8361351014f52bbe6cb02c523cc1489 --- a/zh-cn/device-dev/kernel/pmm.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-pmm.md @@ -30,7 +30,7 @@ Debug版本才具备的命令。 ## 输出说明 **图 1** 查看物理页使用情况 -![](figures/查看物理页使用情况.png "查看物理页使用情况") +![](figure/查看物理页使用情况.png "查看物理页使用情况") **表 1** 输出说明 diff --git a/zh-cn/device-dev/kernel/reset.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-reset.md old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/kernel/reset.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-reset.md diff --git a/zh-cn/device-dev/kernel/sem.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sem.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/sem.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sem.md index 14342e7531992cd0965a2b33eed6d840eaa0738c..4a27c8d10ba557d0821195e56b5d1c930fe1c627 --- a/zh-cn/device-dev/kernel/sem.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sem.md @@ -61,7 +61,7 @@ sem \[_ID__ / fulldata_\] ## 输出说明 **图 1** 查询所有在用的信号量信息 -![](figures/查询所有在用的信号量信息.png "查询所有在用的信号量信息") +![](figure/查询所有在用的信号量信息.png "查询所有在用的信号量信息") **表 2** 输出说明 @@ -85,7 +85,7 @@ sem \[_ID__ / fulldata_\]
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >● sem命令的ID参数输入形式以十进制形式表示或十六进制形式表示皆可。 >● sem命令的ID参数在\[0, 1023\]范围内时,返回对应ID的信号量的状态(如果对应ID的信号量未被使用则进行提示);其他取值时返回参数错误的提示。 diff --git a/zh-cn/device-dev/kernel/stack.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-stack.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/stack.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-stack.md index 526ed83f4d872388224244d27aee8011f345f766..8f2904a4b88d28fed4d39423b8ed85de468fb5be --- a/zh-cn/device-dev/kernel/stack.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-stack.md @@ -32,7 +32,7 @@ stack **图 1** 系统堆栈使用情况 -![](figures/zh-cn_image_0000001054624363.png) +![](figure/zh-cn_image_0000001054624363.png) **表 1** 输出说明 diff --git a/zh-cn/device-dev/kernel/su.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-su.md old mode 100755 new mode 100644 similarity index 96% rename from zh-cn/device-dev/kernel/su.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-su.md index a23b14445d1eabb3fc71242ebff588b937fe2c02..a8536a0e4d713453a9cb71b85ad1adb692bfd0b2 --- a/zh-cn/device-dev/kernel/su.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-su.md @@ -58,5 +58,5 @@ su \[_uid_\] \[_gid_\] ## 输出说明 **图 1** **切换到**为uid为1000,gid为1000的用户 -![](figures/切换到为uid为1000-gid为1000的用户.png "切换到为uid为1000-gid为1000的用户") +![](figure/切换到为uid为1000-gid为1000的用户.png "切换到为uid为1000-gid为1000的用户") diff --git a/zh-cn/device-dev/kernel/swtmr.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-swymr.md old mode 100755 new mode 100644 similarity index 95% rename from zh-cn/device-dev/kernel/swtmr.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-swymr.md index 7ab65604883876668fbc61ea7efc4c7fc6f1ed89..07b2b1b04293f87baa0cb9d47448d2913b594b12 --- a/zh-cn/device-dev/kernel/swtmr.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-swymr.md @@ -50,10 +50,10 @@ swtmr \[_ID_\] ## 输出说明 **图 1** 查询所有软件定时器相关信息 -![](figures/查询所有软件定时器相关信息.png "查询所有软件定时器相关信息") +![](figure/查询所有软件定时器相关信息.png "查询所有软件定时器相关信息") **图 2** 查询对应 ID 的软件定时器信息 -![](figures/查询对应-ID-的软件定时器信息.png "查询对应-ID-的软件定时器信息") +![](figure/查询对应-ID-的软件定时器信息.png "查询对应-ID-的软件定时器信息") **表 2** 输出说明 @@ -104,7 +104,7 @@ swtmr \[_ID_\]
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- swtmr命令的ID参数输入形式以十进制形式表示或十六进制形式表示皆可。 >- swtmr命令的ID参数在\[0, 当前软件定时器个数 - 1\]范围内时,返回对应ID的软件定时器的状态;其他取值时返回错误提示。 diff --git a/zh-cn/device-dev/kernel/systeminfo.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/systeminfo.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md index 16fbd841d383b8513254885c9c2cf19916186e67..8b59757af0093680a9f16f986e0f3bd864aa6fba --- a/zh-cn/device-dev/kernel/systeminfo.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-sys.md @@ -30,7 +30,7 @@ systeminfo ## 输出说明 **图 1** 查看系统资源使用情况 -![](figures/查看系统资源使用情况.png "查看系统资源使用情况") +![](figure/查看系统资源使用情况.png "查看系统资源使用情况") **表 1** 输出说明 diff --git a/zh-cn/device-dev/kernel/task.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-task.md old mode 100755 new mode 100644 similarity index 99% rename from zh-cn/device-dev/kernel/task.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-task.md index 673ed06ae2a24eaa5140dab866d6a71551d14a85..4fb2b3e3f8fcd34a9f102e4a2c75b00ff018445b --- a/zh-cn/device-dev/kernel/task.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-task.md @@ -49,7 +49,7 @@ task/task -a ## 输出说明 **图 1** 查询任务部分信息 -![](figures/查询任务部分信息.png "查询任务部分信息") +![](figure/查询任务部分信息.png "查询任务部分信息") **表 2** 输出说明 diff --git a/zh-cn/device-dev/kernel/uname.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-uname.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/uname.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-uname.md index 71a06837cc26f1ae62bc2eb0a240c47f3422f6b7..ff2c1b7a3db2ee050c384be9216102e3d8d30eeb --- a/zh-cn/device-dev/kernel/uname.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-uname.md @@ -68,5 +68,5 @@ uname用于显示当前操作系统名称。语法uname -a | -t| -s| -v 描述un 查看系统信息 -![](figures/zh-cn_image_0000001052370305.png) +![](figure/zh-cn_image_0000001052370305.png) diff --git a/zh-cn/device-dev/kernel/vmm.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-vmm.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/vmm.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-vmm.md index 0d38eadc7e36fabed43abe813d992640bad42206..35f4ada41e1f7043ea60d584065662facf59f88a --- a/zh-cn/device-dev/kernel/vmm.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-vmm.md @@ -65,7 +65,7 @@ vmm \[_pid_\] ## 输出说明 **图 1** PID为3的进程虚拟内存使用信息 -![](figures/PID为3的进程虚拟内存使用信息.png "PID为3的进程虚拟内存使用信息") +![](figure/PID为3的进程虚拟内存使用信息.png "PID为3的进程虚拟内存使用信息") **表 2** 进程基本信息 diff --git a/zh-cn/device-dev/kernel/watch.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-watch.md old mode 100755 new mode 100644 similarity index 98% rename from zh-cn/device-dev/kernel/watch.md rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-watch.md index 0586d287df85decf88bc96708c892b19ab23dc4c..c3adf787bbca3f7deb8165ed2c1d8e15204dd168 --- a/zh-cn/device-dev/kernel/watch.md +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys-watch.md @@ -93,8 +93,8 @@ watch -n 2 -c 6 task ## 输出说明 **图 1** watch task 结果 -![](figures/watch-task-结果.png "watch-task-结果") +![](figure/watch-task-结果.png "watch-task-结果") ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >示例中,总共有6次task命令打印,每次间隔2秒,截图为最后一次打印详情。 diff --git a/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys.md new file mode 100644 index 0000000000000000000000000000000000000000..8bccc06e167edac3be5d99cf37d1aeb81427c730 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd-sys.md @@ -0,0 +1,47 @@ +# 系统命令 + +- **[cpup](kernel-lite-small-shell-cmd-sys-cpup.md)** + +- **[date](kernel-lite-small-shell-cmd-sys-date.md)** + +- **[dmesg](kernel-lite-small-shell-cmd-sys-demsg.md)** + +- **[exec](kernel-lite-small-shell-cmd-sys-exec.md)** + +- **[free](kernel-lite-small-shell-cmd-sys-free.md)** + +- **[help](kernel-lite-small-shell-cmd-sys-help.md)** + +- **[hwi](kernel-lite-small-shell-cmd-sys-hwi.md)** + +- **[kill](kernel-lite-small-shell-cmd-sys-kill.md)** + +- **[log](kernel-lite-small-shell-cmd-sys-log.md)** + +- **[memcheck](kernel-lite-small-shell-cmd-sys-mem.md)** + +- **[oom](kernel-lite-small-shell-cmd-sys-oom.md)** + +- **[pmm](kernel-lite-small-shell-cmd-sys-pmm.md)** + +- **[reset](kernel-lite-small-shell-cmd-sys-reset.md)** + +- **[sem](kernel-lite-small-shell-cmd-sys-sem.md)** + +- **[stack](kernel-lite-small-shell-cmd-sys-stack.md)** + +- **[su](kernel-lite-small-shell-cmd-sys-su.md)** + +- **[swtmr](kernel-lite-small-shell-cmd-sys-swymr.md)** + +- **[systeminfo](kernel-lite-small-shell-cmd-sys-sys.md)** + +- **[task](kernel-lite-small-shell-cmd-sys-task.md)** + +- **[uname](kernel-lite-small-shell-cmd-sys-uname.md)** + +- **[vmm](kernel-lite-small-shell-cmd-sys-vmm.md)** + +- **[watch](kernel-lite-small-shell-cmd-sys-watch.md)** + + diff --git "a/zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\344\275\277\347\224\250\350\257\246\350\247\243.md" b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd.md old mode 100755 new mode 100644 similarity index 31% rename from "zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\344\275\277\347\224\250\350\257\246\350\247\243.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd.md index 2faa37c7405c336830f2cb2270275d44766497a6..95d4b92cffc8d087d40831a981d3f3f7828399a9 --- "a/zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\344\275\277\347\224\250\350\257\246\350\247\243.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-cmd.md @@ -2,12 +2,12 @@ 本章节介绍了系统关键命令的功能、格式、参数范围、使用指南和使用实例。 -不在本文档范围内的命令,详见[help](help.md)命令的输出内容,也可以通过命令的“-h | --help”选项,查看该命令的使用帮助。 +不在本文档范围内的命令,详见[help](kernel-lite-small-shell-cmd-sys-help.md)命令的输出内容,也可以通过命令的“-h | --help”选项,查看该命令的使用帮助。 -- **[系统命令](系统命令.md)** +- **[系统命令](kernel-lite-small-shell-cmd-sys.md)** -- **[文件命令](文件命令.md)** +- **[文件命令](kernel-lite-small-shell-cmd-file.md)** -- **[网络命令](网络命令.md)** +- **[网络命令](kernel-lite-small-shell-cmd-net.md)** diff --git "a/zh-cn/device-dev/kernel/Shell\344\273\213\347\273\215.md" b/zh-cn/device-dev/kernel/kernel-lite-small-shell-des.md old mode 100755 new mode 100644 similarity index 92% rename from "zh-cn/device-dev/kernel/Shell\344\273\213\347\273\215.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-des.md index f72e4f67cbb241de5b34b5fff11df56ef70ae2ef..8b7909db2079b4225c6253fee4318d83c3afa16d --- "a/zh-cn/device-dev/kernel/Shell\344\273\213\347\273\215.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-des.md @@ -10,7 +10,7 @@ OpenHarmony内核提供的Shell支持调试常用的基本功能,包含系统 - 网络相关命令:支持查询接到开发板的其他设备的IP、查询本机IP、测试网络连接、设置开发板的AP和station模式等相关功能。 - 新增命令的详细流程可参见[开发指导](Shell命令开发指导.md)和[编程实例](Shell命令编程实例.md)。 + 新增命令的详细流程可参见[开发指导](kernel-lite-small-shell-guide.md)和[编程实例](kernel-lite-small-shell-sample.md)。 ## 注意事项 @@ -30,7 +30,7 @@ OpenHarmony内核提供的Shell支持调试常用的基本功能,包含系统 - Shell功能不符合POSIX标准,仅供调试使用。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >Shell功能仅供调试使用,在Debug版本中开启(使用时通过menuconfig在配置项中开启"LOSCFG\_DEBUG\_VERSION"编译开关进行相关控制),商用产品中禁止包含该功能。 diff --git "a/zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/kernel/kernel-lite-small-shell-guide.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-guide.md index b8d1e6d8861489d99b76f84a56b9b0d2d09aecee..7f7327f6b2899440de2152975b099e6127d3d134 --- "a/zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell-guide.md @@ -126,7 +126,7 @@ ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >命令关键字必须是唯一的,也即两个不同的命令项不能拥有相同的命令关键字,否则只会执行其中一个。 >Shell在执行用户命令时,如果存在多个命令关键字相同的命令,只会执行其中在"help"命令中排序在最前面的一个。 @@ -161,7 +161,7 @@ 4. 输入Shell命令,有两种输入方式: - 在串口工具中直接输入Shell命令。 - - 在telnet工具中输入Shell命令(telnet使用方式详见[telnet](telnet.md))。 + - 在telnet工具中输入Shell命令(telnet使用方式详见[telnet](kernel-lite-small-shell-cmd-net-tel.md))。 diff --git "a/zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\347\274\226\347\250\213\345\256\236\344\276\213.md" b/zh-cn/device-dev/kernel/kernel-lite-small-shell-sample.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/Shell\345\221\275\344\273\244\347\274\226\347\250\213\345\256\236\344\276\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-shell-sample.md diff --git a/zh-cn/device-dev/kernel/kernel-lite-small-shell.md b/zh-cn/device-dev/kernel/kernel-lite-small-shell.md new file mode 100644 index 0000000000000000000000000000000000000000..edc56c8c73e6e879e3dac5813fc5e4d502b940e6 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-small-shell.md @@ -0,0 +1,15 @@ +# 调测 + +- **[Shell介绍](kernel-lite-small-shell-des.md)** + +- **[Shell命令开发指导](kernel-lite-small-shell-guide.md)** + +- **[Shell命令编程实例](kernel-lite-small-shell-sample.md)** + +- **[Shell命令使用详解](kernel-lite-small-shell-cmd.md)** + +- **[魔法键使用方法](kernel-lite-small-shell-cmd-mag.md)** + +- **[用户态异常信息说明](kernel-lite-small-shell-cmd-abn.md)** + + diff --git "a/zh-cn/device-dev/kernel/\347\272\277\347\250\213.md" b/zh-cn/device-dev/kernel/kernel-lite-small-thread.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/kernel/\347\272\277\347\250\213.md" rename to zh-cn/device-dev/kernel/kernel-lite-small-thread.md index 7add0e4dc775da92317ccd9a6bb4edb6f6dff2e9..b758c77877f7f426c10d031f9c68d6b3c310cb8f --- "a/zh-cn/device-dev/kernel/\347\272\277\347\250\213.md" +++ b/zh-cn/device-dev/kernel/kernel-lite-small-thread.md @@ -30,7 +30,7 @@ OpenHarmony内核的线程一共有32个优先级\(0-31\),最高优先级为0 **图 1** 线程状态迁移示意图 -![](figures/线程状态迁移示意图.png "线程状态迁移示意图") +![](figure/线程状态迁移示意图.png "线程状态迁移示意图") **线程状态迁移说明:** diff --git a/zh-cn/device-dev/kernel/kernel-lite-small.md b/zh-cn/device-dev/kernel/kernel-lite-small.md new file mode 100644 index 0000000000000000000000000000000000000000..a435da97d4b79e35ab0c7e8526a5df706569f215 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-lite-small.md @@ -0,0 +1,11 @@ +# 小型系统内核 + +- **[基础内核](kernel-lite-small-basic.md)** + +- **[文件系统](kernel-lite-small-file.md)** + +- **[标准库](kernel-lite-small-lib.md)** + +- **[调测](kernel-lite-small-shell.md)** + + diff --git "a/zh-cn/device-dev/kernel/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\345\206\205\346\240\270.md" b/zh-cn/device-dev/kernel/kernel-lite.md similarity index 41% rename from "zh-cn/device-dev/kernel/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\345\206\205\346\240\270.md" rename to zh-cn/device-dev/kernel/kernel-lite.md index 0ae605881ae93ccbe37bda0971479cb69a6be0e8..f6fcf22c8ec9b834dde5bf84d5b6a13b26c477be 100644 --- "a/zh-cn/device-dev/kernel/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\345\206\205\346\240\270.md" +++ b/zh-cn/device-dev/kernel/kernel-lite.md @@ -1,7 +1,7 @@ # 轻量和小型系统内核 -- **[轻量系统内核](轻量系统内核.md)** +- **[轻量系统内核](kernel-lite-mini.md)** -- **[小型系统内核](小型系统内核.md)** +- **[小型系统内核](kernel-lite-small.md)** diff --git "a/zh-cn/device-dev/kernel/Linux\345\206\205\346\240\270\347\274\226\350\257\221\344\270\216\346\236\204\345\273\272\346\214\207\345\257\274.md" b/zh-cn/device-dev/kernel/kernel-standard-build.md old mode 100755 new mode 100644 similarity index 93% rename from "zh-cn/device-dev/kernel/Linux\345\206\205\346\240\270\347\274\226\350\257\221\344\270\216\346\236\204\345\273\272\346\214\207\345\257\274.md" rename to zh-cn/device-dev/kernel/kernel-standard-build.md index 1dec4cb1447cc02fce0739300e12aeef80e135c7..1b52ac7b1f6ef75cb9c1e29e611e54ab24831d79 --- "a/zh-cn/device-dev/kernel/Linux\345\206\205\346\240\270\347\274\226\350\257\221\344\270\216\346\236\204\345\273\272\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/kernel/kernel-standard-build.md @@ -21,7 +21,7 @@ 1. 准备工作 - 1. 按[开发板Patch使用指导](OpenHarmony开发板Patch使用指导.md)打入所需补丁。 + 1. 按[开发板Patch使用指导](kernel-standard-patch.md)打入所需补丁。 2. 准备编译环境,可以使用开源arm clang/gcc编译器。 进入工程主目录配置环境变量: diff --git "a/zh-cn/device-dev/kernel/Linux\345\206\205\346\240\270\346\246\202\350\277\260.md" b/zh-cn/device-dev/kernel/kernel-standard-des.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/kernel/Linux\345\206\205\346\240\270\346\246\202\350\277\260.md" rename to zh-cn/device-dev/kernel/kernel-standard-des.md diff --git "a/zh-cn/device-dev/kernel/OpenHarmony\345\274\200\345\217\221\346\235\277Patch\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/kernel/kernel-standard-patch.md old mode 100755 new mode 100644 similarity index 92% rename from "zh-cn/device-dev/kernel/OpenHarmony\345\274\200\345\217\221\346\235\277Patch\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/kernel/kernel-standard-patch.md index 25eadc954a75a4ec4e0f5855b95e9d2e527d31a7..87b3fea376cbb44d0f082ffdc2bc87c59fbda1d3 --- "a/zh-cn/device-dev/kernel/OpenHarmony\345\274\200\345\217\221\346\235\277Patch\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/kernel/kernel-standard-patch.md @@ -12,6 +12,6 @@ Patch文件位于工程项目源码路径:kernel/linux/patches/linux-4.19, patch -p1 < device/hisilicon/hi3516dv300/sdk_linux/open_source/linux/hisi_linux-4.19_hos_l2.patch ``` ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >由于OpenHarmony的编译构建流程中会拷贝kernel/linux-4.19的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux-4.19保持原代码环境。 diff --git a/zh-cn/device-dev/kernel/kernel-standard.md b/zh-cn/device-dev/kernel/kernel-standard.md new file mode 100644 index 0000000000000000000000000000000000000000..67af7b81d0828a100373e0ab9de0d5b4dee9cd92 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-standard.md @@ -0,0 +1,9 @@ +# 标准系统内核 + +- **[Linux内核概述](kernel-standard-des.md)** + +- **[OpenHarmony开发板Patch使用指导](kernel-standard-patch.md)** + +- **[Linux内核编译与构建指导](kernel-standard-build.md)** + + diff --git a/zh-cn/device-dev/kernel/kernel.md b/zh-cn/device-dev/kernel/kernel.md new file mode 100644 index 0000000000000000000000000000000000000000..05e683e74b37a2999709a58946b4377b4175feb4 --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel.md @@ -0,0 +1,7 @@ +# 内核 + +- **[轻量和小型系统内核](kernel-lite.md)** + +- **[标准系统内核](kernel-standard.md)** + + diff --git a/zh-cn/device-dev/kernel/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/kernel/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/kernel/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/kernel/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/kernel/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/kernel/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/kernel/public_sys-resources/icon-note.gif b/zh-cn/device-dev/kernel/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/kernel/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/kernel/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/kernel/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/kernel/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/kernel/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/kernel/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/kernel/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/kernel/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/kernel/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/kernel/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/kernel/\344\272\213\344\273\266.md" "b/zh-cn/device-dev/kernel/\344\272\213\344\273\266.md" deleted file mode 100644 index e998fce8eb5759370f6a3e6b053cd26baed727f2..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\344\272\213\344\273\266.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 事件 - -- **[基本概念](基本概念-5.md)** - -- **[开发指导](开发指导-6.md)** - - diff --git "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\347\256\241\347\220\206.md" "b/zh-cn/device-dev/kernel/\345\206\205\345\255\230\347\256\241\347\220\206.md" deleted file mode 100644 index fb44d9bd13bde98aa1ac6c90c8b45856b63b8ed2..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\345\206\205\345\255\230\347\256\241\347\220\206.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 内存管理 - -- **[基本概念](基本概念-4.md)** - -- **[静态内存](静态内存.md)** - -- **[动态内存](动态内存.md)** - - diff --git "a/zh-cn/device-dev/kernel/\345\206\205\346\240\270\350\260\203\346\265\213.md" "b/zh-cn/device-dev/kernel/\345\206\205\346\240\270\350\260\203\346\265\213.md" deleted file mode 100644 index 6b7080f2bcbb60138e4f258cf3a20b1f35be9618..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\345\206\205\346\240\270\350\260\203\346\265\213.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 内核调测 - -- **[内存调测](内存调测.md)** - -- **[异常调测](异常调测.md)** - -- **[Trace调测](Trace调测.md)** - - diff --git "a/zh-cn/device-dev/kernel/\345\237\272\347\241\200\345\206\205\346\240\270-1.md" "b/zh-cn/device-dev/kernel/\345\237\272\347\241\200\345\206\205\346\240\270-1.md" deleted file mode 100644 index df2416afdc86ecb4952f852342ae640cb0d88d79..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\345\237\272\347\241\200\345\206\205\346\240\270-1.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 基础内核 - -- **[中断管理](中断管理.md)** - -- **[任务管理](任务管理.md)** - -- **[内存管理](内存管理.md)** - -- **[IPC](IPC.md)** - -- **[时间管理](时间管理.md)** - -- **[软件定时器](软件定时器.md)** - - diff --git "a/zh-cn/device-dev/kernel/\345\237\272\347\241\200\345\206\205\346\240\270.md" "b/zh-cn/device-dev/kernel/\345\237\272\347\241\200\345\206\205\346\240\270.md" deleted file mode 100644 index 94b43451a99a3d3e6b85388a828c0110bd2cc209..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\345\237\272\347\241\200\345\206\205\346\240\270.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 基础内核 - -- **[进程](进程.md)** - -- **[线程](线程.md)** - -- **[内存](内存.md)** - -- **[网络](网络.md)** - - diff --git "a/zh-cn/device-dev/kernel/\345\260\217\345\236\213\347\263\273\347\273\237\345\206\205\346\240\270.md" "b/zh-cn/device-dev/kernel/\345\260\217\345\236\213\347\263\273\347\273\237\345\206\205\346\240\270.md" deleted file mode 100644 index d24843996311d64f63f2873e2f53b784ee55dd73..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\345\260\217\345\236\213\347\263\273\347\273\237\345\206\205\346\240\270.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 小型系统内核 - -- **[认识LiteOS-M内核](认识LiteOS-M内核.md)** - -- **[快速入门](快速入门.md)** - -- **[基础内核](基础内核-1.md)** - -- **[扩展组件](扩展组件.md)** - -- **[内核调测](内核调测.md)** - -- **[附录](附录.md)** - - diff --git "a/zh-cn/device-dev/kernel/\346\211\251\345\261\225\347\273\204\344\273\266.md" "b/zh-cn/device-dev/kernel/\346\211\251\345\261\225\347\273\204\344\273\266.md" deleted file mode 100644 index dcfc826616e437211372c13a415dcc6b3657ae63..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\346\211\251\345\261\225\347\273\204\344\273\266.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 扩展组件 - -- **[C++支持](C++支持.md)** - -- **[CPUP](CPUP.md)** - -- **[文件系统](文件系统-19.md)** - - diff --git "a/zh-cn/device-dev/kernel/\346\226\207\344\273\266\345\221\275\344\273\244.md" "b/zh-cn/device-dev/kernel/\346\226\207\344\273\266\345\221\275\344\273\244.md" deleted file mode 100755 index c1735a0278573df6d279873637fc764342e644e8..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\346\226\207\344\273\266\345\221\275\344\273\244.md" +++ /dev/null @@ -1,45 +0,0 @@ -# 文件命令 - -- **[cat](cat.md)** - -- **[cd](cd.md)** - -- **[chgrp](chgrp.md)** - -- **[chmod](chmod.md)** - -- **[chown](chown.md)** - -- **[cp](cp.md)** - -- **[format](format.md)** - -- **[ls](ls.md)** - -- **[lsfd](lsfd.md)** - -- **[mkdir](mkdir.md)** - -- **[mount](mount.md)** - -- **[partinfo](partinfo.md)** - -- **[partition](partition.md)** - -- **[pwd](pwd.md)** - -- **[rm](rm.md)** - -- **[rmdir](rmdir.md)** - -- **[statfs](statfs.md)** - -- **[sync](sync.md)** - -- **[touch](touch.md)** - -- **[writeproc](writeproc.md)** - -- **[umount](umount.md)** - - diff --git "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\347\263\273\347\273\237\345\206\205\346\240\270.md" "b/zh-cn/device-dev/kernel/\346\240\207\345\207\206\347\263\273\347\273\237\345\206\205\346\240\270.md" deleted file mode 100644 index 5911c5e037af1c64615d90c915a8d4a5defe1761..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\346\240\207\345\207\206\347\263\273\347\273\237\345\206\205\346\240\270.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 标准系统内核 - -- **[Linux内核概述](Linux内核概述.md)** - -- **[OpenHarmony开发板Patch使用指导](OpenHarmony开发板Patch使用指导.md)** - -- **[Linux内核编译与构建指导](Linux内核编译与构建指导.md)** - - diff --git "a/zh-cn/device-dev/kernel/\347\263\273\347\273\237\345\221\275\344\273\244.md" "b/zh-cn/device-dev/kernel/\347\263\273\347\273\237\345\221\275\344\273\244.md" deleted file mode 100755 index 6d10fdb0221d7d2aaf211f32ca45b1c37b1bb884..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\347\263\273\347\273\237\345\221\275\344\273\244.md" +++ /dev/null @@ -1,47 +0,0 @@ -# 系统命令 - -- **[cpup](cpup.md)** - -- **[date](date.md)** - -- **[dmesg](dmesg.md)** - -- **[exec](exec.md)** - -- **[free](free.md)** - -- **[help](help.md)** - -- **[hwi](hwi.md)** - -- **[kill](kill.md)** - -- **[log](log.md)** - -- **[memcheck](memcheck.md)** - -- **[oom](oom.md)** - -- **[pmm](pmm.md)** - -- **[reset](reset.md)** - -- **[sem](sem.md)** - -- **[stack](stack.md)** - -- **[su](su.md)** - -- **[swtmr](swtmr.md)** - -- **[systeminfo](systeminfo.md)** - -- **[task](task.md)** - -- **[uname](uname.md)** - -- **[vmm](vmm.md)** - -- **[watch](watch.md)** - - diff --git "a/zh-cn/device-dev/kernel/\347\275\221\347\273\234\345\221\275\344\273\244.md" "b/zh-cn/device-dev/kernel/\347\275\221\347\273\234\345\221\275\344\273\244.md" deleted file mode 100755 index 2a1245c1579a6c54b19f60a348de42461a2cce77..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\347\275\221\347\273\234\345\221\275\344\273\244.md" +++ /dev/null @@ -1,25 +0,0 @@ -# 网络命令 - -- **[arp](arp.md)** - -- **[dhclient](dhclient.md)** - -- **[dns](dns.md)** - -- **[ifconfig](ifconfig.md)** - -- **[ipdebug](ipdebug.md)** - -- **[netstat](netstat.md)** - -- **[ntpdate](ntpdate.md)** - -- **[ping](ping.md)** - -- **[ping6](ping6.md)** - -- **[telnet](telnet.md)** - -- **[tftp](tftp.md)** - - diff --git "a/zh-cn/device-dev/kernel/\350\260\203\346\265\213.md" "b/zh-cn/device-dev/kernel/\350\260\203\346\265\213.md" deleted file mode 100755 index 2327e141234e6cce885f500c2297d1de5f9061cd..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\350\260\203\346\265\213.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 调测 - -- **[Shell介绍](Shell介绍.md)** - -- **[Shell命令开发指导](Shell命令开发指导.md)** - -- **[Shell命令编程实例](Shell命令编程实例.md)** - -- **[Shell命令使用详解](Shell命令使用详解.md)** - -- **[魔法键使用方法](魔法键使用方法.md)** - -- **[用户态异常信息说明](用户态异常信息说明.md)** - - diff --git "a/zh-cn/device-dev/kernel/\350\275\273\351\207\217\347\263\273\347\273\237\345\206\205\346\240\270.md" "b/zh-cn/device-dev/kernel/\350\275\273\351\207\217\347\263\273\347\273\237\345\206\205\346\240\270.md" deleted file mode 100644 index 290c4915bf94adb34bc2804d40268adcfe38fd87..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\350\275\273\351\207\217\347\263\273\347\273\237\345\206\205\346\240\270.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 轻量系统内核 - -- **[基础内核](基础内核.md)** - -- **[文件系统](文件系统.md)** - -- **[标准库](标准库.md)** - -- **[调测](调测.md)** - - diff --git "a/zh-cn/device-dev/kernel/\351\231\204\345\275\225.md" "b/zh-cn/device-dev/kernel/\351\231\204\345\275\225.md" deleted file mode 100644 index 73adc5ca617dfb9d657241bd0ba43d4afd5c5cbc..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/kernel/\351\231\204\345\275\225.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 附录 - -- **[内核编码规范](内核编码规范.md)** - -- **[基本数据结构](基本数据结构.md)** - -- **[标准库支持](标准库支持.md)** - - diff --git a/zh-cn/device-dev/porting/Readme-CN.md b/zh-cn/device-dev/porting/Readme-CN.md old mode 100644 new mode 100755 index af1fd320a6ac113c4c7761679697ed1f86d5ea21..dd73e8cbbfa711e39de3570a368efbf81b1b4fa3 --- a/zh-cn/device-dev/porting/Readme-CN.md +++ b/zh-cn/device-dev/porting/Readme-CN.md @@ -1,28 +1,28 @@ - -# 开发板移植 -目前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. 开始移植你的开发板 - -- [轻量级系统](lite_system_port_guide.md) -- 小型系统(待发布) -- [标准系统](standard_system_porting_guide.md) - + +# 开发板移植 +目前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/figures/HDF_WIFI.png b/zh-cn/device-dev/porting/figure/HDF_WIFI.png similarity index 100% rename from zh-cn/device-dev/porting/figures/HDF_WIFI.png rename to zh-cn/device-dev/porting/figure/HDF_WIFI.png diff --git "a/zh-cn/device-dev/porting/figures/OpenHarmony\345\220\257\345\212\250\346\210\220\345\212\237\347\225\214\351\235\242.png" "b/zh-cn/device-dev/porting/figure/OpenHarmony\345\220\257\345\212\250\346\210\220\345\212\237\347\225\214\351\235\242.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/figures/OpenHarmony\345\220\257\345\212\250\346\210\220\345\212\237\347\225\214\351\235\242.png" rename to "zh-cn/device-dev/porting/figure/OpenHarmony\345\220\257\345\212\250\346\210\220\345\212\237\347\225\214\351\235\242.png" diff --git a/zh-cn/device-dev/porting/figure/init.jpg b/zh-cn/device-dev/porting/figure/init.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a1e7f8b695bebf395ea6cfa0aed55495c4896118 Binary files /dev/null and b/zh-cn/device-dev/porting/figure/init.jpg differ diff --git a/zh-cn/device-dev/porting/figure/shell.jpg b/zh-cn/device-dev/porting/figure/shell.jpg new file mode 100644 index 0000000000000000000000000000000000000000..efb1e17b00d37b072a3032678144984e2e13b2d6 Binary files /dev/null and b/zh-cn/device-dev/porting/figure/shell.jpg differ diff --git a/zh-cn/device-dev/porting/figures/zh-cn_image_0000001072304191.png b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001072304191.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/porting/figures/zh-cn_image_0000001072304191.png rename to zh-cn/device-dev/porting/figure/zh-cn_image_0000001072304191.png diff --git a/zh-cn/device-dev/porting/figures/zh-cn_image_0000001073943511.png b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001073943511.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/porting/figures/zh-cn_image_0000001073943511.png rename to zh-cn/device-dev/porting/figure/zh-cn_image_0000001073943511.png diff --git a/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126198996.png b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126198996.png new file mode 100644 index 0000000000000000000000000000000000000000..cbc70a899f77382e9e052c30f2a69b61764d2643 Binary files /dev/null and b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126198996.png differ diff --git a/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126354076.png b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126354076.png new file mode 100644 index 0000000000000000000000000000000000000000..b241920b30fea1b2a432f6ba01045bbfbae7fb58 Binary files /dev/null and b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126354076.png differ diff --git a/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126358814.png b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126358814.png new file mode 100644 index 0000000000000000000000000000000000000000..39c6cb96611a7ced5e17bbeee96ac77ba5c1bf58 Binary files /dev/null and b/zh-cn/device-dev/porting/figure/zh-cn_image_0000001126358814.png differ diff --git "a/zh-cn/device-dev/porting/figure/\345\206\205\346\240\270\345\220\257\345\212\250\346\241\206\346\236\266.jpg" "b/zh-cn/device-dev/porting/figure/\345\206\205\346\240\270\345\220\257\345\212\250\346\241\206\346\236\266.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..dd8e1c235633c3e42fcd1360b66b3ce3452db02d Binary files /dev/null and "b/zh-cn/device-dev/porting/figure/\345\206\205\346\240\270\345\220\257\345\212\250\346\241\206\346\236\266.jpg" differ diff --git "a/zh-cn/device-dev/porting/figure/\345\210\206\347\261\273.png" "b/zh-cn/device-dev/porting/figure/\345\210\206\347\261\273.png" new file mode 100644 index 0000000000000000000000000000000000000000..7edac54ec2fcd1fc93330d47acb2d44fceef2710 Binary files /dev/null and "b/zh-cn/device-dev/porting/figure/\345\210\206\347\261\273.png" differ diff --git "a/zh-cn/device-dev/porting/figures/\345\215\225\346\235\277\351\251\261\345\212\250\351\200\202\351\205\215\346\265\201\347\250\213.png" "b/zh-cn/device-dev/porting/figure/\345\215\225\346\235\277\351\251\261\345\212\250\351\200\202\351\205\215\346\265\201\347\250\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/figures/\345\215\225\346\235\277\351\251\261\345\212\250\351\200\202\351\205\215\346\265\201\347\250\213.png" rename to "zh-cn/device-dev/porting/figure/\345\215\225\346\235\277\351\251\261\345\212\250\351\200\202\351\205\215\346\265\201\347\250\213.png" diff --git "a/zh-cn/device-dev/porting/figures/\350\212\257\347\211\207\347\247\273\346\244\215\345\205\263\351\224\256\346\255\245\351\252\244.png" "b/zh-cn/device-dev/porting/figure/\350\212\257\347\211\207\347\247\273\346\244\215\345\205\263\351\224\256\346\255\245\351\252\244.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/figures/\350\212\257\347\211\207\347\247\273\346\244\215\345\205\263\351\224\256\346\255\245\351\252\244.png" rename to "zh-cn/device-dev/porting/figure/\350\212\257\347\211\207\347\247\273\346\244\215\345\205\263\351\224\256\346\255\245\351\252\244.png" diff --git a/zh-cn/device-dev/porting/lite_system_port_guide.md b/zh-cn/device-dev/porting/lite_system_port_guide.md deleted file mode 100755 index 0dca00c895f6172ce990465be705745d7b8965db..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/porting/lite_system_port_guide.md +++ /dev/null @@ -1,27 +0,0 @@ -# 移植指南 - -- [三方库移植指导](三方库移植指导.md) - - [概述](概述.md) - - [CMake方式组织编译的库移植](CMake方式组织编译的库移植.md) - - [Makefile方式组织编译的库移植](Makefile方式组织编译的库移植.md) - -- [三方芯片移植指导](三方芯片移植指导.md) - - [移植准备](移植准备.md) - - [移植须知](移植须知.md) - - [编译构建适配流程](编译构建适配流程.md) - - - [内核移植](内核移植.md) - - [移植概述](移植概述.md) - - [内核基础适配](内核基础适配.md) - - [内核移植验证](内核移植验证.md) - - - [板级系统移植](板级系统移植.md) - - [移植概述](移植概述-0.md) - - [板级驱动适配](板级驱动适配.md) - - [HAL层实现](HAL层实现.md) - - [系统组件调用](系统组件调用.md) - - [三方组件适配](三方组件适配.md) - - [XTS认证](XTS认证.md) - - - [常见问题](常见问题.md) - diff --git a/zh-cn/device-dev/porting/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/porting/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/porting/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/porting/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/porting/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/porting/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/porting/public_sys-resources/icon-note.gif b/zh-cn/device-dev/porting/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/porting/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/porting/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/porting/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/porting/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/porting/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/porting/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/porting/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/porting/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/porting/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/porting/public_sys-resources/icon-warning.gif and /dev/null differ diff --git a/zh-cn/device-dev/porting/standard_system_porting_guide.md b/zh-cn/device-dev/porting/standard_system_porting_guide.md index 2d14e44025dccd860729fa3c421dd9fe75e160cc..f0676596ab2d106af3652e44a2f8e5876d9ec777 100644 --- a/zh-cn/device-dev/porting/standard_system_porting_guide.md +++ b/zh-cn/device-dev/porting/standard_system_porting_guide.md @@ -1,374 +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) +# 标准系统移植指南 + + + + + +- [定义开发板](#定义开发板) + - [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/porting/\344\270\211\346\226\271\347\273\204\344\273\266\351\200\202\351\205\215.md" b/zh-cn/device-dev/porting/transplant-chip-board-bundle.md similarity index 97% rename from "zh-cn/device-dev/porting/\344\270\211\346\226\271\347\273\204\344\273\266\351\200\202\351\205\215.md" rename to zh-cn/device-dev/porting/transplant-chip-board-bundle.md index 0999f32a530ac987759134af1fd23344c25eeb86..8e235f7c54dd67da05510aa4f0e80a4e71e2c183 100644 --- "a/zh-cn/device-dev/porting/\344\270\211\346\226\271\347\273\204\344\273\266\351\200\202\351\205\215.md" +++ b/zh-cn/device-dev/porting/transplant-chip-board-bundle.md @@ -51,7 +51,7 @@ hb build -f --patch ``` - >![](public_sys-resources/icon-caution.gif) **注意:** + >![](../public_sys-resources/icon-caution.gif) **注意:** >最后一次打patch的产品信息会被记录,在进行下一次编译操作时,会对上一次的patch进行回退(即执行\`patch -p1 -R < xxx\`),回退patch失败或新增patch失败均会终止编译过程,请解决patch冲突后再次尝试编译。 diff --git "a/zh-cn/device-dev/porting/\347\263\273\347\273\237\347\273\204\344\273\266\350\260\203\347\224\250.md" b/zh-cn/device-dev/porting/transplant-chip-board-component.md old mode 100755 new mode 100644 similarity index 91% rename from "zh-cn/device-dev/porting/\347\263\273\347\273\237\347\273\204\344\273\266\350\260\203\347\224\250.md" rename to zh-cn/device-dev/porting/transplant-chip-board-component.md index 5f2a6f6f6a37ddcbaa7da689cef786fe45346751..618fc8acfa8f796b8582551e5756c9b40d1eb934 --- "a/zh-cn/device-dev/porting/\347\263\273\347\273\237\347\273\204\344\273\266\350\260\203\347\224\250.md" +++ b/zh-cn/device-dev/porting/transplant-chip-board-component.md @@ -11,7 +11,7 @@ 系统服务框架基于面向服务的架构,提供了服务开发、服务的子功能开发、对外接口的开发、以及多服务共进程、进程间服务调用等开发能力。 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >本组件在板级系统移植中必须要使用,否则其他服务组件无法运行。 **SAMGR使用说明,请参考:[SAMGR 使用指导](https://gitee.com/openharmony/distributedschedule_samgr_lite/blob/master/README_zh.md)** @@ -22,5 +22,5 @@ DFX子系统主要包含DFR(Design for Reliability,可靠性)和DFT(Design for Testability,可测试性)特性,为开发者提供代码维测信息。 -**DFX子系统使用说明,请参考:[DFX子系统使用指导](../subsystems/DFX.md)** +**DFX子系统使用说明,请参考:[DFX子系统使用指导](../subsystems/subsys-dfx-overview.md)** diff --git "a/zh-cn/device-dev/porting/\346\235\277\347\272\247\351\251\261\345\212\250\351\200\202\351\205\215.md" b/zh-cn/device-dev/porting/transplant-chip-board-drive.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/\346\235\277\347\272\247\351\251\261\345\212\250\351\200\202\351\205\215.md" rename to zh-cn/device-dev/porting/transplant-chip-board-drive.md diff --git "a/zh-cn/device-dev/porting/HAL\345\261\202\345\256\236\347\216\260.md" b/zh-cn/device-dev/porting/transplant-chip-board-hal.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/HAL\345\261\202\345\256\236\347\216\260.md" rename to zh-cn/device-dev/porting/transplant-chip-board-hal.md diff --git "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\346\246\202\350\277\260-0.md" b/zh-cn/device-dev/porting/transplant-chip-board-overview.md old mode 100755 new mode 100644 similarity index 92% rename from "zh-cn/device-dev/porting/\347\247\273\346\244\215\346\246\202\350\277\260-0.md" rename to zh-cn/device-dev/porting/transplant-chip-board-overview.md index a5d18d9bd490592858e9dcd933265965d0d04187..732872af5b5e2558bf8b298f918872b2eec030b5 --- "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\346\246\202\350\277\260-0.md" +++ b/zh-cn/device-dev/porting/transplant-chip-board-overview.md @@ -13,11 +13,11 @@ 4. 业务功能验证。 **图 1** 单板驱动适配流程 -![](figures/单板驱动适配流程.png "单板驱动适配流程") +![](figure/单板驱动适配流程.png "单板驱动适配流程") ## 板级目录规范 -板级系统编译适配参考[编译系统介绍](编译构建适配流程.md),板级相关的驱动、SDK、目录、HAL实现存放在device目录,目录结构和具体描述如下: +板级系统编译适配参考[编译系统介绍](transplant-chip-prepare-process.md),板级相关的驱动、SDK、目录、HAL实现存放在device目录,目录结构和具体描述如下: ``` . diff --git "a/zh-cn/device-dev/porting/XTS\350\256\244\350\257\201.md" b/zh-cn/device-dev/porting/transplant-chip-board-xts.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/porting/XTS\350\256\244\350\257\201.md" rename to zh-cn/device-dev/porting/transplant-chip-board-xts.md index 44b37d014423043bd25028ce5739076d44ac2e72..00253685f7583381c9a5d89bd24a57bf2a7d3dcc --- "a/zh-cn/device-dev/porting/XTS\350\256\244\350\257\201.md" +++ b/zh-cn/device-dev/porting/transplant-chip-board-xts.md @@ -12,7 +12,7 @@ XTS是OpenHarmony生态认证测试套件的集合,当前包括acts(applicat - acts,存放acts相关测试用例源码与配置文件,其目的是帮助终端设备厂商尽早发现软件与OpenHarmony的不兼容性,确保软件在整个开发过程中满足OpenHarmony的兼容性要求。 - tools,存放acts相关测试用例开发框架。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >XTS的启动依赖SAMGR系统服务。 适配分为两步,包括: @@ -46,7 +46,7 @@ XTS是OpenHarmony生态认证测试套件的集合,当前包括acts(applicat 请在如下目录获取版本镜像:out/hispark\_pegasus/wifiiot\_hispark\_pegasus/。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >判断当前版本镜像是否集成acts测试套件方法:在map文件中查看对应.a是否被编译即可。 2. 版本镜像烧录进开发板。 diff --git a/zh-cn/device-dev/porting/transplant-chip-board.md b/zh-cn/device-dev/porting/transplant-chip-board.md new file mode 100644 index 0000000000000000000000000000000000000000..f5d7b754b53786192eec6ce7572833fa12329c8e --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-chip-board.md @@ -0,0 +1,15 @@ +# 板级系统移植 + +- **[移植概述](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)** + + diff --git "a/zh-cn/device-dev/porting/\345\270\270\350\247\201\351\227\256\351\242\230.md" b/zh-cn/device-dev/porting/transplant-chip-faqs.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/\345\270\270\350\247\201\351\227\256\351\242\230.md" rename to zh-cn/device-dev/porting/transplant-chip-faqs.md diff --git "a/zh-cn/device-dev/porting/\345\206\205\346\240\270\345\237\272\347\241\200\351\200\202\351\205\215.md" b/zh-cn/device-dev/porting/transplant-chip-kernel-adjustment.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/porting/\345\206\205\346\240\270\345\237\272\347\241\200\351\200\202\351\205\215.md" rename to zh-cn/device-dev/porting/transplant-chip-kernel-adjustment.md index a4eaf54ec519a7bccaedea0c0295abf7029f0dd9..40f82e0cd778cc360d659cba3363f5c94e560745 --- "a/zh-cn/device-dev/porting/\345\206\205\346\240\270\345\237\272\347\241\200\351\200\202\351\205\215.md" +++ b/zh-cn/device-dev/porting/transplant-chip-kernel-adjustment.md @@ -15,7 +15,7 @@ **图 1** 启动流程 -![](figures/zh-cn_image_0000001073943511.png) +![](figure/zh-cn_image_0000001073943511.png) 启动文件startup.S需要确保中断向量表的入口函数(例如reset\_vector)放在RAM的首地址,它由链接配置文件来指定。其中iar、keil和gcc工程的链接配置文件分别为xxx.icf、xxx.sct和xxx.ld,如果startup.S已经完成系统时钟初始化,并且能够引导到main函数,则启动文件不需要进行修改,采用厂商自带的startup.S即可,否则需要实现以上功能。 diff --git "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\346\246\202\350\277\260.md" b/zh-cn/device-dev/porting/transplant-chip-kernel-overview.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/porting/\347\247\273\346\244\215\346\246\202\350\277\260.md" rename to zh-cn/device-dev/porting/transplant-chip-kernel-overview.md index 6f6b421748893228a5a296f4219d21a61380666c..34095a2318d181be7604f6c4ac4ce9bd4d614db2 --- "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/porting/transplant-chip-kernel-overview.md @@ -21,7 +21,7 @@ **图 1** liteos-m内核模块图 -![](figures/zh-cn_image_0000001072304191.png) +![](figure/zh-cn_image_0000001072304191.png) 内核的目录结构和说明如下: diff --git "a/zh-cn/device-dev/porting/\345\206\205\346\240\270\347\247\273\346\244\215\351\252\214\350\257\201.md" b/zh-cn/device-dev/porting/transplant-chip-kernel-verify.md old mode 100755 new mode 100644 similarity index 95% rename from "zh-cn/device-dev/porting/\345\206\205\346\240\270\347\247\273\346\244\215\351\252\214\350\257\201.md" rename to zh-cn/device-dev/porting/transplant-chip-kernel-verify.md index 4604f13ad9b270efb67c33f186b469222f343f78..fc16eeb224f18814ed2c114a8fe3f4a07fea59b3 --- "a/zh-cn/device-dev/porting/\345\206\205\346\240\270\347\247\273\346\244\215\351\252\214\350\257\201.md" +++ b/zh-cn/device-dev/porting/transplant-chip-kernel-verify.md @@ -55,5 +55,5 @@ LITE_OS_SEC_TEXT_INIT int main(void) } ``` -第一个任务运行正常后,说明最小系统的核心流程基本OK;由于xts用例框架对外依赖较多,主要是utils、bootstrap的链接脚本和编译框架,暂时无法支撑内核单独跑xts;此处略过内核测试套的测试,可以通过[XTS测试套](XTS认证.md)来覆盖最小系统是否完整移植成功。 +第一个任务运行正常后,说明最小系统的核心流程基本OK;由于xts用例框架对外依赖较多,主要是utils、bootstrap的链接脚本和编译框架,暂时无法支撑内核单独跑xts;此处略过内核测试套的测试,可以通过[XTS测试套](transplant-chip-board-xts.md)来覆盖最小系统是否完整移植成功。 diff --git a/zh-cn/device-dev/porting/transplant-chip-kernel.md b/zh-cn/device-dev/porting/transplant-chip-kernel.md new file mode 100644 index 0000000000000000000000000000000000000000..e27fea3d596d06af478a4b24eb46ddc8a6b81187 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-chip-kernel.md @@ -0,0 +1,9 @@ +# 内核移植 + +- **[移植概述](transplant-chip-kernel-overview.md)** + +- **[内核基础适配](transplant-chip-kernel-adjustment.md)** + +- **[内核移植验证](transplant-chip-kernel-verify.md)** + + diff --git "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\351\241\273\347\237\245.md" b/zh-cn/device-dev/porting/transplant-chip-prepare-knows.md old mode 100755 new mode 100644 similarity index 93% rename from "zh-cn/device-dev/porting/\347\247\273\346\244\215\351\241\273\347\237\245.md" rename to zh-cn/device-dev/porting/transplant-chip-prepare-knows.md index b28e2b5d0ff4686dcb9b31e033dc9ce1b390475b..6c0282c492baf353133e15ad5fb6c24da7a2e8d9 --- "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\351\241\273\347\237\245.md" +++ b/zh-cn/device-dev/porting/transplant-chip-prepare-knows.md @@ -33,7 +33,7 @@ OpenHarmony整体工程较为复杂,目录及实现为系统本身功能,如

/device

板级相关实现,各个三方厂商按照OpenHarmony规范适配实现,device下具体目录结构及移植过程参见板级系统移植

+

板级相关实现,各个三方厂商按照OpenHarmony规范适配实现,device下具体目录结构及移植过程参见板级系统移植

/vendor

@@ -75,10 +75,10 @@ vendor # 产品解决方案厂商 OpenHarmony的device目录是基础芯片的适配目录,如果在三方芯片应用过程中发现此目录下已经有完整的芯片适配,则不需要再额外移植,直接跳过移植过程进行系统应用开发即可,如果该目录下无对应的芯片移植实现,则根据本文完成移植过程。OpenHarmony三方芯片移植主要过程如下: **图 1** 芯片移植关键步骤 -![](figures/芯片移植关键步骤.png "芯片移植关键步骤") +![](figure/芯片移植关键步骤.png "芯片移植关键步骤") ## 移植规范 - 满足OpenHarmony[开源贡献基本规范和准则](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)。 -- 三方芯片适配所需要贡献的代码主要在device、vendor和arch三个目录,参照[内核目录规范](移植概述.md)和[板级目录规范](移植概述-0.md#section6204129143013)满足基本目录命名和使用规范。 +- 三方芯片适配所需要贡献的代码主要在device、vendor和arch三个目录,参照[内核目录规范](transplant-chip-kernel-overview.md)和[板级目录规范](transplant-chip-board-overview.md#section6204129143013)满足基本目录命名和使用规范。 diff --git "a/zh-cn/device-dev/porting/\347\274\226\350\257\221\346\236\204\345\273\272\351\200\202\351\205\215\346\265\201\347\250\213.md" b/zh-cn/device-dev/porting/transplant-chip-prepare-process.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/porting/\347\274\226\350\257\221\346\236\204\345\273\272\351\200\202\351\205\215\346\265\201\347\250\213.md" rename to zh-cn/device-dev/porting/transplant-chip-prepare-process.md diff --git "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\345\207\206\345\244\207.md" b/zh-cn/device-dev/porting/transplant-chip-prepare.md old mode 100755 new mode 100644 similarity index 31% rename from "zh-cn/device-dev/porting/\347\247\273\346\244\215\345\207\206\345\244\207.md" rename to zh-cn/device-dev/porting/transplant-chip-prepare.md index 1637d5d8932e73b08d50f1060df841f64cd11698..358da845b74ef9ce278a3bff22ee09be59501cb2 --- "a/zh-cn/device-dev/porting/\347\247\273\346\244\215\345\207\206\345\244\207.md" +++ b/zh-cn/device-dev/porting/transplant-chip-prepare.md @@ -1,7 +1,7 @@ # 移植准备 -- **[移植须知](移植须知.md)** +- **[移植须知](transplant-chip-prepare-knows.md)** -- **[编译构建适配流程](编译构建适配流程.md)** +- **[编译构建适配流程](transplant-chip-prepare-process.md)** diff --git a/zh-cn/device-dev/porting/transplant-chip.md b/zh-cn/device-dev/porting/transplant-chip.md new file mode 100644 index 0000000000000000000000000000000000000000..d0fbee119dd00fe8fb475196714a9a253e676f2b --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-chip.md @@ -0,0 +1,11 @@ +# 三方芯片移植指导 + +- **[移植准备](transplant-chip-prepare.md)** + +- **[内核移植](transplant-chip-kernel.md)** + +- **[板级系统移植](transplant-chip-board.md)** + +- **[常见问题](transplant-chip-faqs.md)** + + diff --git a/zh-cn/device-dev/porting/transplant-minichip.md b/zh-cn/device-dev/porting/transplant-minichip.md new file mode 100644 index 0000000000000000000000000000000000000000..58bebe026e881c23d1d2aa1cd173cc6bc86ea777 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-minichip.md @@ -0,0 +1,11 @@ +# 轻量系统芯片移植指导 + +- **[移植准备](transplant-chip-prepare.md)** + +- **[内核移植](transplant-chip-kernel.md)** + +- **[板级系统移植](transplant-chip-board.md)** + +- **[常见问题](transplant-chip-faqs.md)** + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-drive-des.md b/zh-cn/device-dev/porting/transplant-smallchip-drive-des.md new file mode 100644 index 0000000000000000000000000000000000000000..bba3736632bc974821981b0e4839f629ab4d1551 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-drive-des.md @@ -0,0 +1,11 @@ +# 移植概述 + +驱动主要包含两部分,平台驱动和器件驱动。平台驱动主要包括通常在SOC内的GPIO、I2C、SPI等;器件驱动则主要包含通常在SOC外的器件,如 LCD、TP、WLAN等。 + +**图 1** OpenHarmony 驱动分类 + + +![](figure/分类.png) + +HDF驱动被设计为可以跨OS使用的驱动程序,HDF驱动框架会为驱动达成这个目标提供有力的支撑。开发HDF驱动中,请尽可能只使用HDF驱动框架提供的接口,否则会导致驱动丧失跨OS使用的特性。在开始驱动开发前,建议先了解[HDF驱动框架](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/HDF%E9%A9%B1%E5%8A%A8%E6%A1%86%E6%9E%B6.md)。 + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-drive-oom.md b/zh-cn/device-dev/porting/transplant-smallchip-drive-oom.md new file mode 100644 index 0000000000000000000000000000000000000000..353aa15d2a8b5b84c66b3192fc30ccc8c6975694 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-drive-oom.md @@ -0,0 +1,390 @@ +# 器件驱动移植 + +- [LCD驱动移植](#section1574513454119) +- [TP驱动移植](#section20284142116422) +- [WLAN驱动移植](#section0969448164217) + +本章节讲解如何移植各类器件驱动。 + +## LCD驱动移植 + +移植LCD驱动的主要工作是编写一个驱动,在驱动中生成模型的实例,并完成注册。 + +这些LCD的驱动被放置在源码目录//drivers/framework/model/display/driver/panel中。 + +1. 创建Panel驱动 + + 创建HDF驱动,在驱动初始化中调用RegisterPanel接口注册模型实例。如: + + ``` + int32_t LCDxxEntryInit(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 = LCDxxEntryInit, + }; + + HDF_INIT(g_xxxxDevEntry); + ``` + +2. 配置加载panel驱动 + + 产品的所有设备信息被定义在源码文件//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs中。修改该文件,在display的host中,名为device\_lcd的device中增加配置。 + + >![](../public_sys-resources/icon-caution.gif) **注意:** + >moduleName 要与panel驱动中的moduleName相同。 + + ``` + root { + ... + display :: host { + device_lcd :: device { + deviceN :: deviceNode { + policy = 0; + priority = 100; + preload = 2; + moduleName = "LCD_XXXX"; + } + } + } + } + ``` + + +## TP驱动移植 + +本节描述如何移植触摸屏驱动。触摸屏的器件驱动被放置在源码目录//drivers/framework/model/input/driver/touchscreen中。 移植触摸屏驱动主要工作是向系统注册ChipDevice模型实例。 + +详细的驱动开发指导,请参考 [TOUCHSCREEN开发指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/TOUCHSCREEN.md)。 + +1. 创建触摸屏器件驱动 + + 在上述touchscreen目录中创建名为touch\_ic\_name.c的文件。编写如下内容 + + ``` + #include "hdf_touch.h" + + static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device) + { + ChipDevice *tpImpl = CreateXXXXTpImpl(); + if(RegisterChipDevice(tpImpl) != HDF_SUCCESS) { // 注册ChipDevice模型 + ReleaseXXXXTpImpl(tpImpl); + return HDF_FAILURE; + } + return HDF_SUCCESS; + } + + struct HdfDriverEntry g_touchXXXXChipEntry = { + .moduleVersion = 1, + .moduleName = "HDF_TOUCH_XXXX", // 注意这里的moduleName要与后续的配置完全一致 + .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)

+

实现固件升级

+
+ +2. 配置产品,加载器件驱动 + + 产品的所有设备信息被定义在源码文件//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs中。修改该文件,在名为input的host中,名为device\_touch\_chip的device中增加配置。 + + >![](../public_sys-resources/icon-note.gif) **说明:** + >moduleName 要与触摸屏驱动中的moduleName相同。 + + ``` + deviceN :: deviceNode { + policy = 0; + priority = 130; + preload = 0; + permission = 0660; + moduleName = "HDF_TOUCH_XXXX"; + deviceMatchAttr = "touch_XXXX_configs"; + } + ``` + + +## WLAN驱动移植 + +WLAN驱动分为两部分,一部分负责管理WLAN设备,另一个部分负责处理WLAN流量。 + +**图 1** OpenHarmony WLAN结构示意图 + + +![](figure/HDF_WIFI.png) + +如图1,左半部分负责管理WLAN设备,右半部分负责WLAN流量。HDF WLAN分别为这两部分做了抽象,驱动的移植过程可以看做分别实现这两部分所需接口。这些接口有: + + + + + + + + + + + + + + + + + + + + +

接口

+

定义头文件

+

接口说明

+

HdfChipDriverFactory

+

drivers\framework\include\wifi\hdf_wlan_chipdriver_manager.h

+

ChipDriver的Factory,用于支持一个芯片多个WLAN端口

+

HdfChipDriver

+

drivers\framework\include\wifi\wifi_module.h

+

每个WLAN端口对应一个HdfChipDriver,用来管理一个特定端口

+

NetDeviceInterFace

+

drivers\framework\include\wifi\net_device.h

+

与协议栈之间的接口,如发送数据、设置网络接口状态等

+
+ +>![](../public_sys-resources/icon-note.gif) **说明:** +>详细的接口开发指导,请参考[WLAN开发](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/driver/WLAN.md)。 + +具体的移植步骤如下: + +1. 创建HDF WLAN 芯片驱动 + + 在目录/device/vendor\_name/peripheral/wifi/chip\_name/ 创建文件 hdf\_wlan\_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)

+

获取当前芯片支持的最大接口数

+
+ + 其中Build方法负责创建一个管理指定网络接口的对象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/vendor\_name/product\_name/config/wifi/wlan\_chip\_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 = 0xXXXX; /* your vendor id */ + deviceId = [0xXXXX]; /*your supported devices */ + } + } + } + } + } + ``` + + >![](../public_sys-resources/icon-note.gif) **说明:** + >路径和文件中的vendor\_name、product\_name、chip\_name请替换成实际名称 + >vendorId 和 deviceId需要根据实际芯片的识别码进行填写。 + +3. 编写配置文件,加载驱动 + + 产品的所有设备信息被定义在源码文件//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs中。修改该文件,在名为network的host中,名为device\_wlan\_chips的device中增加配置。模板如下: + + ``` + deviceN :: deviceNode { + policy = 0; + preload = 2; + moduleName = "HDF_WLAN_CHIPS"; + deviceMatchAttr = "hdf_wlan_chips_chip_name"; + serviceName = "driverName"; + } + ``` + + >![](../public_sys-resources/icon-note.gif) **说明:** + >moduleName 要与HDF WLAN 芯片驱动中的moduleName相同。 + +4. 修改Kconfig文件,让移植的WLAN模组出现再内核配置中 + + 在device/vendor\_name/drivers/Kconfig中增加配置菜单,模板如下 + + ``` + config DRIVERS_HDF_WIFI_chip_name + bool "Enable chip_name Host driver" + default n + depends on DRIVERS_HDF_WLAN help + Answer Y to enable chip_name Host driver. + ``` + + >![](../public_sys-resources/icon-note.gif) **说明:** + >请替换模板中的chip\_name为实际的芯片名称 + +5. 修改构建脚本,让驱动参与内核构建 + + 在源码文件//device/vendor\_name/drivers/lite.mk末尾追加如下内容 + + ``` + ifeq ($(LOSCFG_DRIVERS_HDF_WIFI_chip_name), y) + # 构建完成要链接一个叫hdf_wlan_chipdriver_chip_name的对象,建议按这个命名,防止冲突 + LITEOS_BASELIB += -lhdf_wlan_chipdriver_chip_name + # 增加构建目录gpio + LIB_SUBDIRS += ../peripheral/wifi/chip_name + endif + ``` + + >![](../public_sys-resources/icon-note.gif) **说明:** + >请替换模板中的chip\_name为实际的芯片名称 + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-drive-plat.md b/zh-cn/device-dev/porting/transplant-smallchip-drive-plat.md new file mode 100644 index 0000000000000000000000000000000000000000..a28bc2faf3fae4cb54a85094e10a185d20b34041 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-drive-plat.md @@ -0,0 +1,165 @@ +# 平台驱动移植 + +在这一步,我们会在源码目录//device/vendor\_name/soc\_name/drivers 目录下创建平台驱动,如果你要移植的SOC的厂商还没有创建仓库的话,请联系[sig-devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)创建。 + +建议的目录结构: + +``` +device +├── vendor_name +│ ├── drivers +│ │ │ ├── common +│ │ │ ├── Kconfig # 厂商驱动内核菜单入口 +│ │ │ └── lite.mk # 构建的入口 +│ ├── soc_name +│ │ ├── drivers +│ │ │ ├── dmac +│ │ │ ├── gpio +│ │ │ ├── i2c +│ │ │ ├── LICENSE +│ │ │ ├── mipi_dsi +│ │ │ ├── mmc +│ │ │ ├── pwm +│ │ │ ├── README.md # docs 如果需要的话 +│ │ │ ├── README_zh.md +│ │ │ ├── rtc +│ │ │ ├── spi +│ │ │ ├── uart +│ │ │ └── watchdog +│ ├── board_name +``` + +HDF为所有的平台驱动都创建了驱动模型,移植平台驱动的主要工作是向模型注入实例。 这些模型你可以在源码目录//drivers/framework/support/platform/include中找到定义。 + +本节我们会以GPIO为例,讲解如何移植平台驱动,移植过程包含以下步骤: + +1. 创建GPIO驱动 + + 在源码目录//device/vendor\_name/soc\_name/drivers/gpio中创建文件soc\_name\_gpio.c 内容模板如下: + + ``` + #include "gpio_core.h" + + // 定义GPIO结构体,如果需要的话 + struct SocNameGpioCntlr { + struct GpioCntlr cntlr; // 这是HDF GPIO驱动框架需要的结构体 + int myData; // 以下是当前驱动自身需要的 + }; + + // Bind 方法在HDF驱动中主要用户对外发布服务,这里我们不需要,直接返回成功即可 + static int32_t GpioBind(struct HdfDeviceObject *device) + { + (void)device; + return HDF_SUCCESS; + } + + // Init方法时驱动初始化的入口,我们需要在Init方法中完成模型实例的注册 + static int32_t GpioInit(struct HdfDeviceObject *device) + { + SocNameGpioCntlr *impl = CreateGpio(); // 你的创建代码 + ret = GpioCntlrAdd(&impl->cntlr); // 注册GPIO模型实例 + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: err add controller:%d", __func__, ret); + return ret; + } + return HDF_SUCCESS; + } + + // Release方法会在驱动卸载时被调用,这里主要完成资源回收 + static void GpioRelease(struct HdfDeviceObject *device) + { + // GpioCntlrFromDevice 方法能从抽象的设备对象中获得init方法注册进去的模型实例。 + struct GpioCntlr *cntlr = GpioCntlrFromDevice(device); + //资源释放... + } + + struct HdfDriverEntry g_gpioDriverEntry = { + .moduleVersion = 1, + .Bind = GpioBind, + .Init = GpioInit, + .Release = GpioRelease, + .moduleName = "SOC_NAME_gpio_driver", // 这个名字我们稍后会在配置文件中用到,用来加载驱动。 + }; + HDF_INIT(g_gpioDriverEntry); // 注册一个GPIO的驱动入口 + ``` + +2. 创建厂商驱动构建入口 + + 如前所述device/vendor\_name/drivers/lite.mk是厂商驱动的构建的入口。我们需要从这个入口开始,进行构建 + + ``` + #文件device/vendor_name/drivers/lite.mk + + SOC_VENDOR_NAME := $(subst $/",,$(LOSCFG_DEVICE_COMPANY)) + SOC_NAME := $(subst $/",,$(LOSCFG_PLATFORM)) + BOARD_NAME := $(subst $/",,$(LOSCFG_PRODUCT_NAME)) + + # 指定SOC进行构建 + LIB_SUBDIRS += $(LITEOSTOPDIR)/../../device/$(SOC_VENDOR_NAME)/$(SOC_NAME)/drivers/ + ``` + +3. 创建SOC驱动构建入口 + + ``` + #文件device/vendor_name/soc_name/drivers/lite.mk + + SOC_DRIVER_ROOT := $(LITEOSTOPDIR)/../../device/$(SOC_VENDOR_NAME)/$(SOC_NAME)/drivers/ + + # 判断如果打开了GPIO的内核编译开关 + ifeq ($(LOSCFG_DRIVERS_HDF_PLATFORM_GPIO), y) + # 构建完成要链接一个叫hdf_gpio的对象 + LITEOS_BASELIB += -lhdf_gpio + # 增加构建目录gpio + LIB_SUBDIRS += $(SOC_DRIVER_ROOT)/gpio + endif + + # 后续其他驱动在此基础上追加 + ``` + +4. 创建GPIO构建入口 + + ``` + include $(LITEOSTOPDIR)/config.mk + include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk + + # 指定输出对象的名称,注意要与SOC驱动构建入口里的LITEOS_BASELIB 保持一致 + MODULE_NAME := hdf_gpio + + # 增加HDF框架的INCLUDE + LOCAL_CFLAGS += $(HDF_INCLUDE) + + # 要编译的文件 + LOCAL_SRCS += soc_name_gpio.c + + # 编译参数 + LOCAL_CFLAGS += -fstack-protector-strong -Wextra -Wall -Werror -fsigned-char -fno-strict-aliasing -fno-common + + include $(HDF_DRIVER) + ``` + +5. 配置产品加载驱动 + + 产品的所有设备信息被定义在源码文件//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs中。 + + 平台驱动请添加到platform的host中。 + + >![](../public_sys-resources/icon-note.gif) **说明:** + >moduleName要与驱动定义中的相同。 + + ``` + root { + ... + platform :: host { + device_gpio :: device { + device0 :: deviceNode { + policy = 0; + priority = 10; + permission = 0644; + moduleName = "SOC_NAME_gpio_driver"; + } + } + } + } + ``` + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-drive.md b/zh-cn/device-dev/porting/transplant-smallchip-drive.md new file mode 100644 index 0000000000000000000000000000000000000000..8d265ae4d089593010d0ddd7ef6bcbc0ab327f99 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-drive.md @@ -0,0 +1,9 @@ +# 驱动移植 + +- **[移植概述](transplant-smallchip-drive-des.md)** + +- **[平台驱动移植](transplant-smallchip-drive-plat.md)** + +- **[器件驱动移植](transplant-smallchip-drive-oom.md)** + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-kernel-a.md b/zh-cn/device-dev/porting/transplant-smallchip-kernel-a.md new file mode 100644 index 0000000000000000000000000000000000000000..f4de2f397dbc53de27f711e7bfa1e909a35b222c --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-kernel-a.md @@ -0,0 +1,265 @@ +# LiteOS-A内核 + +- [移植概述](#section14876256185510) + - [移植场景](#section1986014410569) + - [目录规范](#section10916181716564) + +- [基础适配](#section814974018565) + - [编程样例](#section10854481825) + +- [验证](#section646410453212) + +## 移植概述 + +### 移植场景 + +LiteOS-A当前支持ARMv7-a指令集架构,如果三方芯片为ARMv7-a架构,可以进行内核基础适配;否则还需要先根据芯片的架构来新增内核对该芯片架构的支持,这个工作较为复杂,不在这篇文章范围内。 + +### 目录规范 + +LiteOS-A目录规范参考[LiteOS-A 简介](https://gitee.com/openharmony/kernel_liteos_a)。 + +## 基础适配 + +LiteOS-A提供系统运行所需的系统初始化流程和定制化配置选项。移植过程中,需要关注初始化流程中跟硬件配置相关的函数。 + +如下图所示,LiteOS-A的初始化流程主要包含以下五步: + +1. 新增target\_config.h文件,并且编写单板内存相关的配置宏DDR\_MEM\_ADDR和DDR\_MEM\_SIZE,分别表示内存起始地址和内存的长度,预链接脚本board.ld.S会根据这两个宏进行展开生成链接脚本board.ld。 +2. 链接阶段根据链接脚本board.ld生成内核镜像。 +3. 单核CPU镜像运行入口为汇编文件reset\_vector\_up.S,多核CPU的入口为reset\_vector\_mp.S,在汇编文件中进行中断向量表初始化、MMU页表初始化等操作。 +4. reset\_vector.S汇编代码最终会跳转到C语言的main函数,进行硬件时钟、软件定时器、内存和任务等初始化,这个过程会依赖target\_config.h的特性宏配置,最后会创建SystemInit任务,并且开启任务调度OsSchedStart\(\)。 +5. SystemInit任务在单板代码中实现,其中调用DeviceManagerStart函数进行HDF驱动初始化,这个过程会调用单板代码中的驱动配置文件hdf.hcs以及drivers源码实现。 + +整体启动流程如下图所示: + +**图 1** 整体启动流程 + + +![](figure/zh-cn_image_0000001126358814.png) + +从图1中可以看到,内核基础适配需要单板进行适配的代码包含三部分: + +- 新增target\_config.h文件,其中新增单板硬件配置参数和特性开关的配置参数,具体说明如下: + + **表 1** target\_config.h配置项说明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

配置项

+

说明

+

OS_SYS_CLOCK

+

系统cycle的频率

+

DDR_MEM_ADDR

+

系统内存的起始地址

+

DDR_MEM_SIZE

+

系统内存的大小

+

PERIPH_PMM_BASE

+

外设寄存器的起始地址

+

PERIPH_PMM_SIZE

+

外设寄存器的长度大小

+

OS_HWI_MIN

+

系统中断最小值

+

OS_HWI_MAX

+

系统中断最大值

+

NUM_HAL_INTERRUPT_UART0

+

UART0中断号

+

UART0_REG_BASE

+

UART0寄存器基址

+

GIC_BASE_ADDR

+

GIC中断寄存器基址

+

GICD_OFFSET

+

GICD相对GIC基址的偏移地址

+

GICC_OFFSET

+

GICC相对GIC基址的偏移地址

+
+ +- SystemInit函数用于单板用户态业务初始化,典型的初始化场景如图2所示: + + **图 1** 业务启动流程 + + + ![](figure/zh-cn_image_0000001126198996.png) + +- main函数用于内核基础初始化和单板内核态业务初始化,流程如下图3所示,整体由内核启动框架主导初始化流程,图中浅蓝色部分为启动框架中可接受外部模块注册启动的阶段。 + + >![](../public_sys-resources/icon-caution.gif) **注意:** + >同一层级内的模块不能有依赖关系。 + + **图 2** 内核启动框架 + ![](figure/内核启动框架.jpg "内核启动框架") + + **表 2** 启动框架层级 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

层级

+

说明

+

LOS_INIT_LEVEL_EARLIEST

+

最早期初始化

+

说明:不依赖架构,单板以及后续模块会对其有依赖的纯软件模块初始化

+

例如:Trace模块

+

LOS_INIT_LEVEL_ARCH_EARLY

+

架构早期初始化

+

说明:架构相关,后续模块会对其有依赖的模块初始化,如启动过程中非必需的功能,建议放到LOS_INIT_LEVEL_ARCH层

+

LOS_INIT_LEVEL_PLATFORM_EARLY

+

平台早期初始化

+

说明:单板平台、驱动相关,后续模块会对其有依赖的模块初始化,如启动过程中必需的功能,建议放到LOS_INIT_LEVEL_PLATFORM层

+

例如:uart模块

+

LOS_INIT_LEVEL_KMOD_PREVM

+

内存初始化前的内核模块初始化

+

说明:在内存初始化之前需要使能的模块初始化

+

LOS_INIT_LEVEL_VM_COMPLETE

+

基础内存就绪后的初始化

+

说明:此时内存初始化完毕,需要进行使能且不依赖进程间通讯机制与系统进程的模块初始化

+

例如:共享内存功能

+

LOS_INIT_LEVEL_ARCH

+

架构后期初始化

+

说明:架构拓展功能相关,后续模块会对其有依赖的模块初始化

+

LOS_INIT_LEVEL_PLATFORM

+

平台后期初始化

+

说明:单板平台、驱动相关,后续模块会对其有依赖的模块初始化

+

例如:驱动内核抽象层初始化(mmc、mtd)

+

LOS_INIT_LEVEL_KMOD_BASIC

+

内核基础模块初始化

+

说明:内核可拆卸的基础模块初始化

+

例如:VFS初始化

+

LOS_INIT_LEVEL_KMOD_EXTENDED

+

内核扩展模块初始化

+

说明:内核可拆卸的扩展模块初始化

+

例如:系统调用初始化、ProcFS初始化、Futex初始化、HiLog初始化、HiEvent初始化、LiteIPC初始化

+

LOS_INIT_LEVEL_KMOD_TASK

+

内核任务创建

+

说明:进行内核任务的创建(内核线程,软件定时器任务)

+

例如:资源回收系统常驻任务的创建、SystemInit任务创建、CPU占用率统计任务创建

+
+ + 进行单板移植适配,推荐关注LOS\_INIT\_LEVEL\_ARCH至LOS\_INIT\_LEVEL\_KMOD\_TASK之间的层级,且尽可能拆分初始化行为进行细化阶段注册。 + + >![](../public_sys-resources/icon-note.gif) **说明:** + >启动框架中同一层级内的注册模块不能有依赖关系,建议新增模块按照上述启动阶段进行模块初始化的拆分,按需注册启动。 + >可通过查看系统编译生成文件OHOS\_Image.map中.rodata.init.kernel.\*段内的符号表来了解当前已注册进内核启动框架中的各个模块初始化入口,以及检查新注册的模块初始化入口是否生效。 + + +### 编程样例 + +在单板SDK文件中 + +``` +/* 内核启动框架头文件 */ +#include "los_init.h" +...... + +/* 新增模块的初始化函数 */ +unsigned int OsSampleModInit(void) +{ + PRINTK("OsSampleModInit SUCCESS!\n"); + ...... +} +...... +/* 在启动框架的目标层级中注册新增模块 */ +LOS_MODULE_INIT(OsSampleModInit, LOS_INIT_LEVEL_KMOD_EXTENDED); +``` + +## 验证 + +``` +main core booting up... +OsSampleModInit SUCCESS! +releasing 1 secondary cores +cpu 1 entering scheduler +cpu 0 entering scheduler +``` + +根据上述系统启动阶段的打印可知,内核在启动时进行了该注册模块的初始化函数调用,完成该模块的初始化操作。 + +系统启动完毕后进入内核态shell,能够运行task命令能够正常显示即可。 + +``` +OHOS # help +*******************shell commands:************************* + +arp cat cd chgrp chmod chown cp cpup +date dhclient dmesg dns format free help hwi +ifconfig ipdebug kill log ls lsfd memcheck mkdir +mount netstat oom partinfo partition ping ping6 pmm +pwd reset rm rmdir sem shm stack statfs +su swtmr sync systeminfo task telnet touch umount +uname v2p virstatfs vmm watch writeproc + +``` + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-kernel-linux.md b/zh-cn/device-dev/porting/transplant-smallchip-kernel-linux.md new file mode 100644 index 0000000000000000000000000000000000000000..911329dbd1b9971e422b9242171c031102a137b0 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-kernel-linux.md @@ -0,0 +1,125 @@ +# Linux内核 + +- [移植概述](#section6282121355111) + - [基本信息](#section19589322515) + - [Bootloader](#section19062510518) + +- [适配编译和烧录启动](#section11112101695215) +- [验证](#section17318153325311) + +## 移植概述 + +Linux内核移植主要涉及基于linux内核基线合入三方芯片补丁后,进行基础的内核编译构建及验证。 + +### 基本信息 + +当前Linux内核基线是基于Linux社区 4.19 LTS版本演进,合入CVE及bugfix补丁。具体信息参考[代码库](https://gitee.com/openharmony/kernel_linux),对应repo工程代码路径为kernel/linux-4.19。 + +### Bootloader + +可以使用芯片厂商自带的Bootloader,或者是开源Uboot等加载内核镜像。比如为支持Hi3516DV300开发板,OpenHarmony引入的开源[Uboot](https://gitee.com/openharmony/device_hisilicon_third_party_uboot)。 + +## 适配编译和烧录启动 + +1. 准备内核config(特别是芯片相关的config)。 + + config文件所在源码目录:kernel/linux/config/ + + 以hi3516dv300芯片为例,可在对应的linux-4.19/arch/arm/configs/目录下新建\_small\_defconfig,如hi3516dv300\_small\_defconfig表示针对hi3516dv300小型系统的defconfig。该config文件可以由基础defconfig文件small\_common\_defconfig与该芯片相关的config组合生成。 + +2. 准备芯片补丁。 + + 补丁文件所在源码目录:kernel/linux/patches/linux-4.19 + + 以hi3516dv300芯片为例,参考已有的patch目录hi3516dv300\_small\_patch目录,新建\_patch目录,放置相关芯片补丁,注意hdf.patch等驱动补丁。 + +3. 编译。 + + 具体内核编译入口脚本位于工程目录kernel/linux/patches/下面,版本级整编命令会通过BUILD.gn进入kernel\_module\_build.sh和kernel.mk,需要在这2个文件中针对性进行patch及defconfig文件路径、编译器、芯片架构、内核Image格式等的适配。 + + 通过编译错误日志调整补丁,典型错误场景: + + (1)补丁合入失败,出现冲突,需要进行上下文适配修改。 + + (2)编译失败,内核版本差异(函数实现调整等)需要针对性进行内核适配。 + + >![](../public_sys-resources/icon-caution.gif) **注意:** + >- 参考kernel.mk,在OpenHarmony工程的编译构建流程中会拷贝kernel/linux-4.19的代码环境后进行打补丁动作,在使用版本级编译命令前,需要kernel/linux-4.19保持原代码环境。 + >- 对应拷贝后的目录位于: out/<\*\*\*\>/kernel/linux-4.19,可以在该目录下进行补丁的修改适配。 + +4. 烧录启动。 + + 由于不同芯片的开发板的烧录方式不一样,此处不表述具体的烧录方式。需要注意烧录的各镜像的大小及启动参数的配置,参考hi3516dv300采用uboot启动参数: + + ``` + setenv bootargs 'mem=128M console=ttyAMA0,115200 root=/dev/mmcblk0p3 ro rootfstype=ext4 rootwait blkdevparts=mmcblk0:1M(boot),9M(kernel),50M(rootfs),50M(userfs)' + ``` + + +## 验证 + +调试init进程、启动shell和运行简单的用户态程序,验证内核移植是否成功。OpenHarmony[小型系统](https://device.harmonyos.com/cn/docs/start/introduce/oem_start_guide-0000001054913231)的OS镜像结构以及linux用户态的启动流程如下图1所示: + +**图 1** 基于linux内核的OS镜像结构和用户态程序启动流程 + + +![](figure/zh-cn_image_0000001126354076.png) + +基于上述流程,推荐按以下步骤完成验证: + +1. 制作根文件系统镜像。 + + 请参考[新建芯片解决方案和产品解决方案](https://device.harmonyos.com/cn/docs/develop/subsystems/oem_subsys_build_guide-0000001060378721)生成根文件系统镜像rootfs.img。从上图可以看到启动过程与产品配置强相关,在制作rootfs.img过程中请完成如下四种配置: + + - 组件配置 + + 产品组件配置文件vendor/\{company\}/\{product\}/config.json需配置启动恢复子系统\(startup\)的init\_lite组件和内核子系统的linux\_4\_1\_9组件。 + + - 系统服务配置 + + 系统服务配置文件vendor/\{company\}/\{product\}/init\_configs/init\_xxx.cfg需要启动shell服务。 + + - 文件系统配置 + + 文件系统配置vendor/\{company\}/\{product\}/fs.yml中需要创建“/bin/sh -\> mksh“和“/lib/ld-musl-arm.so.1 -\> libc.so“软连接,这两个文件分别是shell可执行程序和可执行程序依赖的c库。 + + - 启动配置 + + 启动配置在vendor/\{company\}/\{product\}/init\_configs/etc目录下,包括fstab、rsS和Sxxx文件,请按开发板实际情况配置。 + + + 编译完成后,可通过检查产品编译输出目录下的rootfs内容,确认rootfs.img文件生成是否符合预期。 + +2. 调试init进程和shell。 + + 烧录rootfs.img并调试init进程和shell,不同厂商的开发板的烧录工具和流程可能不同,请按芯片解决方案提供的流程进行烧录。烧录rootfs.img前请确认bootloader和linux内核启动正常。如果rootfs.img被内核正常挂载,接着将运行/bin/init程序,init进程为用户态的第一个应用程序,它的运行意味着用户态的开始。 + + init程序首先会调用/etc/init.d/rcS脚本,rcS脚本执行第一条命令为"/bin/mount -a”,该命令会加载fstab文件,在fstab中的命令执行完后rcS将顺序调用Sxxx脚本完成设备节点创建和扫描、文件权限配置等操作。 + + 最后,init程序会读取init.cfg系统服务配置文件。根据步骤1中的设置,init程序将会启动shell。如果上述流程运行正常,系统则会进入shell。 + + 若串口有如下版本号日志打印,则表示init程序启动正常: + + **图 2** init启动正常日志 + + + ![](figure/init.jpg) + + 正常进入shell后执行ls命令,串口打印信息如下图: + + **图 3** 正常进入shell后输入ls命令串口打印 + + + ![](figure/shell.jpg) + +3. 配置NFS。 + + init进程和shell正常启动后,以服务端IP为192.168.1.22、客户端IP为192.168.1.4为例,可在根目录执行如下命令开启NFS: + + ``` + ifconfig eth0 192.168.1.4 netmask 255.255.255.0 + mkdir -p /storgage/nfs + mount -t nfs -o nolock,addr=192.168.1.22 192.168.1.22:/nfs /storage/nfs + ``` + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-kernel.md b/zh-cn/device-dev/porting/transplant-smallchip-kernel.md new file mode 100644 index 0000000000000000000000000000000000000000..a1adc2dde7e4c576f8fc9137c42217474a15311e --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-kernel.md @@ -0,0 +1,7 @@ +# 移植内核 + +- **[LiteOS-A内核](transplant-smallchip-kernel-a.md)** + +- **[Linux内核](transplant-smallchip-kernel-linux.md)** + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-prepare-building.md b/zh-cn/device-dev/porting/transplant-smallchip-prepare-building.md new file mode 100644 index 0000000000000000000000000000000000000000..6ca5022e46a9574c8856578edc48294feffee89c --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-prepare-building.md @@ -0,0 +1,142 @@ +# 编译构建 + +- [编译环境搭建](#section3336103410314) +- [编译构建系统介绍](#section354343816319) +- [新建芯片解决方案](#section18612153175011) + +## 编译环境搭建 + +首先请搭建OpenHarmony基础环境,步骤请参考轻量和小型系统入门[linux环境搭建](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_environment_lin-0000001105407498)。用户态和LiteOS-A的内核态编译均使用llvm编译器编译,安装方法在搭建基础环境中已提供。若选择移植linux内核,请执行如下命令安装gcc-arm-linux-gnueabi交叉编译工具链,用于编译linux内核态镜像: + +``` +sudo apt-get install gcc-arm-linux-gnueabi +``` + +## 编译构建系统介绍 + +编译构建流程、编译脚本编写、目录规则、独立编译单个组件、独立编译芯片解决方案等介绍请见[编译构建子系统介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/%E7%BC%96%E8%AF%91%E6%9E%84%E5%BB%BA.md)。 + +## 新建芯片解决方案 + +了解编译框架和搭建完编译环境后,请参考如下步骤新建芯片解决方案: + +1. 新建目录 + + 芯片解决方案的目录规则为:device/\{芯片解决方案厂商\}/\{开发板\}。以海思的hispark\_taurus开发板为例,在代码根目录执行如下命令建立目录: + + ``` + mkdir -p device/hisilicon/hispark_taurus + ``` + + 芯片解决方案目录树的规则如下: + + ``` + device + └── company # 芯片解决方案厂商 + └── board # 开发板名称 + ├── BUILD.gn # 编译脚本 + ├── hals # OS南向接口适配 + ├── linux # 可选,linux内核版本 + │ └── config.gni # linux版本编译配置 + └── liteos_a # 可选,liteos内核版本 + └── config.gni # liteos_a版本编译配置 + ``` + + 以hispark\_taurus移植linux内核为例,目录树应该如下: + + ``` + device + └── hisilicon + └── hispark_tautus + ├── BUILD.gn + ├── hals + ├── ...... + └── linux + └── config.gni + ``` + + 目录树建立后开发板相关的源码放到hispark\_taurus目录下。 + +2. 配置开发板编译选项 + + [步骤1](#li20894101862)中的config.gni可配置开发板相关的编译选项,编译构建框架将会遵照该配置文件中的参数编译所有用户态OS组件。其中关键的字段说明如下: + + ``` + kernel_type: 开发板使用的内核类型,例如:“liteos_a”, “liteos_m”, “linux”。 + kernel_version: 开发板使用的内核版本,例如:“4.19”。 + board_cpu: 开发板CPU类型,例如:“cortex-a7”, “riscv32”。 + board_arch: 开发板芯片arch, 例如: “armv7-a”, “rv32imac”。 + board_toolchain: 开发板自定义的编译工具链名称,例如:“gcc-arm-none-eabi”。若为空,则使用默认为ohos-clang。 + board_toolchain_prefix:编译工具链前缀,例如:“gcc-arm-none-eabi”。 + board_toolchain_type: 编译工具链类型,目前支持gcc和clang。例如:“gcc” ,“clang”。 + board_cflags: 开发板配置的c文件编译选项。 + board_cxx_flags: 开发板配置的cpp文件编译选项。 + board_ld_flags: 开发板配置的链接选项。 + ``` + + 还以海思的hispark\_taurus开发板为例,对应的device/hisilicon/hispark\_taurus/config.gni内容如下: + + ``` + # Board CPU type, e.g. "cortex-a7", "riscv32". + board_cpu = "cortex-a7" + + # Toolchain name used for system compiling. + # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. + # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. + board_toolchain = "mips-linux-gnu-gcc" + + # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. + board_toolchain_path = + rebase_path("//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin", + root_build_dir) + + # Compiler prefix. + board_toolchain_prefix = "arm-linux-ohoseabi-" + + # Compiler type, "gcc" or "clang". + board_toolchain_type = "gcc" + + # Board related common compile flags. + board_cflags = [ + ] + board_cxx_flags = [ + ] + board_ld_flags = [] + + # Board related headfiles search path. + board_include_dirs = [] + board_include_dirs += [ rebase_path( + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/target/usr/include", + root_build_dir) ] + + # Board adapter dir for OHOS components. + board_adapter_dir = "" + + # Sysroot path. + board_configed_sysroot = "" + + # Board storage type, it used for file system generation. + storage_type = "emmc" + ``` + +3. 编写开发板编译脚本 + + 步骤1中的BUILD.gn为新增的开发板的编译入口,主要用于编译开发板相关的代码,主要为设备侧驱动、设备侧接口适配\(媒体,图形等\)和开发板的SDK等等。 + + 海思的hispark\_taurus开发板的device/hisilicon/hispark\_taurus/BUILD.gn可写成: + + ``` + # group名称建议与开发板名称一致 + group("hispark_taurus") { + deps = [ "//kernel/linux/patches:linux_kernel" ] # 拉起内核编译 + deps += [ + ...... # 开发板其他编译单元 + ] + } + ``` + +4. 编译调试 + + 在开发板目录下执行hb set和hb build即可启动芯片解决方案的编译,编译框架会以开发板下的BUILD.gn为入口启动编译。 + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip-prepare-needs.md b/zh-cn/device-dev/porting/transplant-smallchip-prepare-needs.md new file mode 100644 index 0000000000000000000000000000000000000000..afe392369f2eb34c0c5a8dcf5a6204850347dd11 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-prepare-needs.md @@ -0,0 +1,98 @@ +# 移植须知 + +本文详细介绍如何将OpenHarmony[小型系统](https://device.harmonyos.com/cn/docs/start/introduce/oem_start_guide-0000001054913231)的linux和LiteOS-A内核移植到新的开发板上,要求读者具有一定的嵌入式系统开发经验。建议先查看[入门指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/OpenHarmony-Overview_zh.md),以了解OpenHarmony软件架构、目录结构、内核子系统和驱动子系统相关知识。当前小型系统已适配的开发板如下表所示: + +**表 1** OpenHarmony小型系统已适配的开发板 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

开发板

+

内核

+

arch

+

ROM

+

RAM

+

文件系统

+

Flash 类型

+

hispark_taurus

+

LiteOS-A和linux-4.19

+

ARM cortex-a7

+

8G

+

1GB

+

VFAT、EXT4

+

eMMC4.5

+

hispark_aries

+

LiteOS-A

+

ARM cortex-a7

+

16M

+

512M

+

JFFS2

+

SPI NOR

+
+ +表1中的开发板可作为待移植开发板的参考,当前LiteOS-A和linux-4.19支持的arch、ROM占用、支持的文件系统和支持的Flash类型如下表所示: + +**表 2** OpenHarmony小型系统内核移植信息表 + + + + + + + + + + + + + + + + + + + + + + +

内核

+

支持的arch

+

ROM

+

文件系统

+

Flash类型

+

LiteOS-A

+

ARMv7

+

> 2M

+

VFAT、JFFS2、YAFFS2

+

SPI NOR、NAND、EMMC

+

linux-4.19

+

ARM, ARM64、 MIPS、 X86等

+

> 5M

+

VFAT、JFFS2、YAFFS、EXT/2/3/4、NFS等等

+

NOR、NAND、EMMC等

+
+ diff --git a/zh-cn/device-dev/porting/transplant-smallchip-prepare.md b/zh-cn/device-dev/porting/transplant-smallchip-prepare.md new file mode 100644 index 0000000000000000000000000000000000000000..6ec4b45dff790140fe40830288b5c0bb961ceddb --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip-prepare.md @@ -0,0 +1,7 @@ +# 移植准备 + +- **[移植须知](transplant-smallchip-prepare-needs.md)** + +- **[编译构建](transplant-smallchip-prepare-building.md)** + + diff --git a/zh-cn/device-dev/porting/transplant-smallchip.md b/zh-cn/device-dev/porting/transplant-smallchip.md new file mode 100644 index 0000000000000000000000000000000000000000..4ba38ff4484d56d07681a0dce923d1839b80df87 --- /dev/null +++ b/zh-cn/device-dev/porting/transplant-smallchip.md @@ -0,0 +1,9 @@ +# 小型系统芯片移植指导 + +- **[移植准备](../porting/transplant-smallchip-prepare.md)** + +- **[移植内核](../porting/transplant-smallchip-kernel.md)** + +- **[驱动移植](../porting/transplant-smallchip-drive.md)** + + diff --git "a/zh-cn/device-dev/porting/CMake\346\226\271\345\274\217\347\273\204\347\273\207\347\274\226\350\257\221\347\232\204\345\272\223\347\247\273\346\244\215.md" b/zh-cn/device-dev/porting/transplant-thirdparty-cmake.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/porting/CMake\346\226\271\345\274\217\347\273\204\347\273\207\347\274\226\350\257\221\347\232\204\345\272\223\347\247\273\346\244\215.md" rename to zh-cn/device-dev/porting/transplant-thirdparty-cmake.md index bb7404eca3e670115c48f40f4f219347162c5064..fb23041d28a62d9768390ecdf41c6cc3acd4c4e2 --- "a/zh-cn/device-dev/porting/CMake\346\226\271\345\274\217\347\273\204\347\273\207\347\274\226\350\257\221\347\232\204\345\272\223\347\247\273\346\244\215.md" +++ b/zh-cn/device-dev/porting/transplant-thirdparty-cmake.md @@ -227,12 +227,12 @@ CMake方式可通过指定工具链进行交叉编译,修改并编译该库, 1. 搭建OpenHarmony环境 - 以hi3518ev300为例,编译出OpenHarmony镜像,烧写到开发板,参考[开发Hi3518第一个示例程序](https://device.harmonyos.com/cn/docs/start/introduce/oem_camera_start_example-0000001051610926)。 + 以hi3518ev300为例,编译出OpenHarmony镜像,烧写到开发板,参考[开发Hi3518第一个示例程序](../quick-start/quickstart-lite-steps-board3518-running.md)。 进入系统如下所示: **图 1** OpenHarmony启动成功界面 - ![](figures/OpenHarmony启动成功界面.png "OpenHarmony启动成功界面") + ![](figure/OpenHarmony启动成功界面.png "OpenHarmony启动成功界面") 2. 挂载nfs目录,将[表2](#table1452412391911)中test目录下cctest可执行文件放入nfs目录 3. 执行用例 @@ -306,7 +306,7 @@ CMake方式可通过指定工具链进行交叉编译,修改并编译该库,

将三方库加入工程的gn适配文件

openHarmony/third_party/double-conversion/build_thirdpaty.py

+

openHarmony/third_party/double-conversion/build_thirdparty.py

GN调用shell命令脚本文件,由上面GN文件将相关命令传入,实现GN转CMake

将三方库加入工程的gn适配文件

openHarmony/third_party/yxml/build_thirdpaty.py

+

openHarmony/third_party/yxml/build_thirdparty.py

GN调用shell命令脚本文件,由上面GN文件将相关命令传入,实现GN转Makefile

功能开发

参考源码获取

+

参考源码获取

Python3.7+

@@ -107,13 +107,13 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示
->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >- 如果后续通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装gn、ninja编译工具。 >- (推荐)如果后续通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装gn、ninja、LLVM编译工具。安装gn、ninja、LLVM编译工具时,请确保编译工具的环境变量路径唯一。 ## 获取源码 -开发者需要在Linux服务器上下载并解压一套源代码,请参见[源码获取](../get-code/源码获取.md)。 +开发者需要在Linux服务器上下载并解压一套源代码,请参见[源码获取](../get-code/sourcecode-acquire.md)。 ## 安装和配置Python @@ -254,7 +254,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 1. 打开Linux编译服务器终端。 2. [下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz)。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >针对OpenHarmony\_v1.x分支/标签,使用此链接[下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar)。 3. 解压LLVM安装包至\~/llvm路径下。 @@ -263,7 +263,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 tar -zxvf llvm.tar.gz -C ~/ ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >针对OpenHarmony\_v1.x分支/标签,使用如下命令解压: >``` >tar -xvf llvm-linux-9.0.0-36191.tar -C ~/ @@ -345,8 +345,8 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 python3 -m pip uninstall ohos-build ``` ->![](public_sys-resources/icon-notice.gif) **须知:** ->如果安装hb的过程中遇到问题,请参见下文[常见问题](常见问题.md)进行解决。 +>![](../public_sys-resources/icon-notice.gif) **须知:** +>如果安装hb的过程中遇到问题,请参见下文[常见问题](quickstart-lite-env-setup-faqs.md)进行解决。 ## 安装其他工具 @@ -355,7 +355,7 @@ python3 -m pip uninstall ohos-build 1. apt安装全部依赖的工具 ``` - sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils + sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi ``` diff --git "a/zh-cn/device-dev/quick-start/Windows\345\274\200\345\217\221\347\216\257\345\242\203\345\207\206\345\244\207.md" b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-win.md old mode 100755 new mode 100644 similarity index 93% rename from "zh-cn/device-dev/quick-start/Windows\345\274\200\345\217\221\347\216\257\345\242\203\345\207\206\345\244\207.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-env-setup-win.md index cffea83cad92e78f19cdb4222117b2c8c75902f0..7f51e21e0b4a80f2d6044c50c05f83b4885fa31f --- "a/zh-cn/device-dev/quick-start/Windows\345\274\200\345\217\221\347\216\257\345\242\203\345\207\206\345\244\207.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-win.md @@ -81,12 +81,12 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ## 安装Visual Studio Code ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果已安装Visual Studio Code,打开命令行工具,输入**code --version**命令,检查版本号是否为1.53及以上版本;可以正常返回版本号,说明环境变量设置也正确。 1. 双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。 - ![](figures/zh-cn_image_0000001174350653.png) + ![](figure/zh-cn_image_0000001174350653.png) 2. 安装完成后,重启计算机,使Visual Studio Code的环境变量生效。 3. 打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。 @@ -95,15 +95,15 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 1. 双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。 - ![](figures/zh-cn_image_0000001128470908.png) + ![](figure/zh-cn_image_0000001128470908.png) 2. 等待安装完成后,点击**Close**。 - ![](figures/zh-cn_image_0000001128311104.png) + ![](figure/zh-cn_image_0000001128311104.png) 3. 打开命令行工具,输入python --version,检查安装结果。 - ![](figures/zh-cn_image_0000001174350655.png) + ![](figure/zh-cn_image_0000001174350655.png) 4. 在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。 @@ -116,13 +116,13 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ## 安装Node.js ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果已安装Node.js,打开命令行工具,输入**node -v**命令,检查版本号是否为12.0.0及以上版本。 1. 点击下载后的软件包进行安装,全部按照默认设置点击**Next**,直至**Finish**。安装过程中,Node.js会自动在系统的path环境变量中配置node.exe的目录路径。 2. 重新打开命令行工具,输入“node -v“命令,能正常查询Node.js的版本号,说明Node.js安装成功。 - ![](figures/zh-cn_image_0000001128311096.png) + ![](figure/zh-cn_image_0000001128311096.png) ## 安装hpm @@ -131,7 +131,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 在安装hpm前,请检查网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问。这种情况下,需要先[设置npm代理](https://device.harmonyos.com/cn/docs/ide/user-guides/npm_proxy-0000001054491032),才能安装hpm。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果已安装hpm,可以执行**npm update -g @ohos/hpm-cli**命令升级hpm至最新版本。 1. 建议将npm源配置为国内镜像,例如设置为华为云镜像源。 @@ -146,7 +146,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 npm install -g @ohos/hpm-cli ``` - ![](figures/zh-cn_image_0000001128311100.png) + ![](figure/zh-cn_image_0000001128311100.png) 3. 安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。 @@ -154,7 +154,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 hpm -V ``` - ![](figures/zh-cn_image_0000001174270735.png) + ![](figure/zh-cn_image_0000001174270735.png) ## 安装DevEco Device Tool插件 @@ -163,20 +163,20 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144)。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >安装DevEco Device Tool时,请先关闭Visual Studio Code。 1. 解压DevEco Device Tool插件压缩包,双击安装包程序进行安装。 2. 安装过程中,会自动安装DevEco Device Tool所需的依赖文件(如C/C++和CodeLLDB插件)和执行程序。 - ![](figures/zh-cn_image_0000001128470902.png) + ![](figure/zh-cn_image_0000001128470902.png) 3. 安装完成后,会自动关闭命令行工具窗口。 -4. 启动Visual Studio Code,点击左侧的![](figures/zh-cn_image_0000001174350651.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。 +4. 启动Visual Studio Code,点击左侧的![](figure/zh-cn_image_0000001174350651.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)。 - ![](figures/zh-cn_image_0000001174270727.png) + ![](figure/zh-cn_image_0000001174270727.png) diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md new file mode 100644 index 0000000000000000000000000000000000000000..f5782f2a9f8bfcd10518821f6e700751928e9491 --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md @@ -0,0 +1,11 @@ +# 搭建系统环境 + +- **[概述](quickstart-lite-env-setup-des.md)** + +- **[Windows开发环境准备](quickstart-lite-env-setup-win.md)** + +- **[Ubuntu编译环境准备](quickstart-lite-env-setup-lin.md)** + +- **[常见问题](quickstart-lite-env-setup-faqs.md)** + + diff --git "a/zh-cn/device-dev/quick-start/Hi3516\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/quick-start/Hi3516\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md index 3e24c43eb01be574c4a48c1d9a6e10d82beeca4e..1224e4f34641a9e46d69354db9acf0a7d5cf06a3 --- "a/zh-cn/device-dev/quick-start/Hi3516\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md @@ -10,7 +10,7 @@ Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代I **图 1** Hi3516单板正面外观图 -![](figures/3516正面.png) +![](figure/3516正面.png) ## 开发板规格 diff --git "a/zh-cn/device-dev/quick-start/Hi3518\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3518.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/quick-start/Hi3518\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3518.md index 1f77aeac075607531fb98955ef218dfd00e3c6ae..211dffba8a9df92bdec701f63e94a84e98fc1a90 --- "a/zh-cn/device-dev/quick-start/Hi3518\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3518.md @@ -8,12 +8,12 @@ Hi3518EV300作为新一代智慧视觉处理SOC,集成新一代ISP\(Image Signal Processor\)以及H.265视频压缩编码器,同时采用先进低功耗工艺和低功耗架构设计,使其在低码率、高画质、低功耗等方面引领行业水平。 **图 1** Hi3518EV300单板正面外观图 -![](figures/Hi3518EV300单板正面外观图.png "Hi3518EV300单板正面外观图") +![](figure/Hi3518EV300单板正面外观图.png "Hi3518EV300单板正面外观图") **图 2** Hi3518EV300单板背面外观图 -![](figures/Hi3518正背面.png) +![](figure/Hi3518正背面.png) ## 开发板规格 diff --git "a/zh-cn/device-dev/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md index ac6a21df22f9865ab77ad461ab1805404c595d0b..84549ecc121b4df54275fb870af729d55ae2010b --- "a/zh-cn/device-dev/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md @@ -12,14 +12,14 @@ Hi3861 WLAN模组是一片大约2cm\*5cm大小的开发板,是一款高度集 **图 1** Hi3861 WLAN模组外观图 -![](figures/3861正面.png) +![](figure/3861正面.png) 另外,Hi3861 WLAN模组还可以通过与Hi3861底板连接,扩充自身的外设能力,底板如下图所示。 **图 2** Hi3861底板外观图 -![](figures/zh-cn_image_0000001174350615.png) +![](figure/zh-cn_image_0000001174350615.png) - RF电路包括功率放大器PA(Power Amplifier)、低噪声放大器LNA(Low Noise Amplifier)、RF Balun、天线开关以及电源管理等模块;支持20MHz标准带宽和5MHz/10MHz窄带宽,提供最大72.2Mbit/s物理层速率。 - Hi3861 WLAN基带支持正交频分复用(OFDM)技术,并向下兼容直接序列扩频(DSSS)和补码键控(CCK)技术,支持IEEE 802.11 b/g/n协议的各种数据速率。 @@ -29,7 +29,7 @@ Hi3861 WLAN模组是一片大约2cm\*5cm大小的开发板,是一款高度集 **图 3** Hi3861功能框图 - ![](figures/zh-cn_image_0000001128311066.png) + ![](figure/zh-cn_image_0000001128311066.png) ## 资源和约束 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-introduction.md b/zh-cn/device-dev/quick-start/quickstart-lite-introduction.md new file mode 100644 index 0000000000000000000000000000000000000000..65e4fde55ca286b55fb1980a6cd7b67929cb9544 --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite-introduction.md @@ -0,0 +1,9 @@ +# 了解开发板 + +- **[Hi3861开发板介绍](quickstart-lite-introduction-hi3861.md)** + +- **[Hi3516开发板介绍](quickstart-lite-introduction-hi3516.md)** + +- **[Hi3518开发板介绍](quickstart-lite-introduction-hi3518.md)** + + diff --git "a/zh-cn/device-dev/quick-start/\346\246\202\350\277\260.md" b/zh-cn/device-dev/quick-start/quickstart-lite-overview.md similarity index 100% rename from "zh-cn/device-dev/quick-start/\346\246\202\350\277\260.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-overview.md diff --git "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-faqs.md similarity index 77% rename from "zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-faqs.md index ece72f03517ecd60ca587fcba3c3fab1a5974a47..ff748404f05d31f54d19fcd4744fa76fdc7febfe 100644 --- "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-faqs.md @@ -13,7 +13,7 @@ 点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。 **图 1** 打开串口失败图 - ![](figures/打开串口失败图.png "打开串口失败图") + ![](figure/打开串口失败图.png "打开串口失败图") - **可能原因** @@ -24,19 +24,19 @@ 1. 按图依次选择下拉框,查找带有serial-xx的终端 **图 2** 查找是否存在占用串口的终端 - ![](figures/查找是否存在占用串口的终端.png "查找是否存在占用串口的终端") + ![](figure/查找是否存在占用串口的终端.png "查找是否存在占用串口的终端") 2. 点击标号中的垃圾桶图标,关闭串口。 **图 3** 关闭串口终端 - ![](figures/关闭串口终端.png "关闭串口终端") + ![](figure/关闭串口终端.png "关闭串口终端") 3. 重新点击烧写,选择串口并开始烧写程序 **图 4** 重新启动烧写任务 - ![](figures/changjian1.png) + ![](figure/changjian1.png) ## Windows电脑与单板网络连接失败 @@ -46,7 +46,7 @@ 点击烧写并选择串口后,无法获取文件。 **图 5** 网络不通,单板无法获取文件图 - ![](figures/网络不通-单板无法获取文件图.png "网络不通-单板无法获取文件图") + ![](figure/网络不通-单板无法获取文件图.png "网络不通-单板无法获取文件图") - **可能原因** @@ -60,22 +60,22 @@ 2. 点击Windows防火墙。 **图 6** 网络防火墙设置图 - ![](figures/网络防火墙设置图.png "网络防火墙设置图") + ![](figure/网络防火墙设置图.png "网络防火墙设置图") 3. 点击“允许应用通过防火墙”。 **图 7** 防火墙和网络保护界面图 - ![](figures/防火墙和网络保护界面图.png "防火墙和网络保护界面图") + ![](figure/防火墙和网络保护界面图.png "防火墙和网络保护界面图") 4. 查找Visual Studio Code应用。 **图 8** 查找Visual Studio Code应用图 - ![](figures/查找Visual-Studio-Code应用图.png "查找Visual-Studio-Code应用图") + ![](figure/查找Visual-Studio-Code应用图.png "查找Visual-Studio-Code应用图") 5. 勾选Visual Studio Code的专用和公用网络的访问权限。 **图 9** 允许Visual Studio Code应用访问网络 - ![](figures/允许Visual-Studio-Code应用访问网络.png "允许Visual-Studio-Code应用访问网络") + ![](figure/允许Visual-Studio-Code应用访问网络.png "允许Visual-Studio-Code应用访问网络") ## 烧写失败 @@ -97,7 +97,7 @@ - **现象描述** - ![](figures/zh-cn_image_0000001174270715.png) + ![](figure/zh-cn_image_0000001174270715.png) - **可能原因1** @@ -106,11 +106,11 @@ - **解决办法** - 请按照[安装python](../quick-start/Ubuntu编译环境准备.md)。 + 请按照[安装python](quickstart-lite-env-setup-lin.md)。 - **可能原因2** - ![](figures/zh-cn_image_0000001128470880.png) + ![](figure/zh-cn_image_0000001128470880.png) - **解决办法** @@ -125,7 +125,7 @@ 例: - ![](figures/zh-cn_image_0000001174270713.png) + ![](figure/zh-cn_image_0000001174270713.png) ## 串口无回显 @@ -142,7 +142,7 @@ 修改串口号。 - 请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按镜像运行内[步骤1](../quick-start/运行Hello-OHOS.md)修改串口号。 + 请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按镜像运行内[步骤1](#section627268185113)修改串口号。 - **可能原因2** @@ -158,7 +158,7 @@ 1. 获取引导文件U-boot。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >单板的U-boot文件请在开源包中获取: >Hi3516DV300:device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin >Hi3518EV300:device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin @@ -170,6 +170,6 @@ 3. 烧写完成后,登录串口如下图所示。 **图 10** U-boot烧写完成串口显示图 - ![](figures/U-boot烧写完成串口显示图.png "U-boot烧写完成串口显示图") + ![](figure/U-boot烧写完成串口显示图.png "U-boot烧写完成串口显示图") diff --git "a/zh-cn/device-dev/quick-start/\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-program.md old mode 100755 new mode 100644 similarity index 95% rename from "zh-cn/device-dev/quick-start/\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-program.md index f9eb065a5d8f0b372e670919a8ed6b89681dbb90..7b43c52c82cf9e8f6c80568f1404af8521106edf --- "a/zh-cn/device-dev/quick-start/\351\251\261\345\212\250\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-program.md @@ -56,7 +56,7 @@ } ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >配置文件与UART驱动示例的源码在同一个路径,需要手动添加到Hi3516DV300单板路径下。 2. 注册UART驱动入口。 @@ -416,34 +416,34 @@ } ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如上代码均为示例代码,完整代码可以在vendor/huawei/hdf/sample查看。 >示例代码默认不参与编译,需要手动添加到编译脚本中。 ## 编译和烧写 -参考示例1进行编译和烧写:[编译](../quick-start/驱动开发示例.md)、[烧录](../quick-start/驱动开发示例.md) +参考《运行Hello OHOS》进行编译和烧写:[编译](quickstart-lite-steps-board3516-running.md#section1077671315253)、[烧录](quickstart-lite-steps-board3516-running.md#section1347011412201) ## 镜像运行 1. 连接串口。 - >![](public_sys-resources/icon-notice.gif) **须知:** - >若无法连接串口,请参考[常见问题](../quick-start/常见问题-3.md)进行排查。 + >![](../public_sys-resources/icon-notice.gif) **须知:** + >若无法连接串口,请参考[常见问题](quickstart-lite-steps-board3516-faqs.md)进行排查。 **图 1** 连接串口图 - ![](figures/chuankou1.png) + ![](figure/chuankou1.png) 1. 单击**Monitor**打开串口。 2. 连续输入回车直到串口显示"hisilicon"。 - 3. 单板初次启动或修改启动参数,请进入[步骤2](运行Hello-OHOS.md#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](运行Hello-OHOS.md#ld26f18828aa44c36bfa36be150e60e49)。 + 3. 单板初次启动或修改启动参数,请进入[步骤2](quickstart-lite-steps-board3516-running.md#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](quickstart-lite-steps-board3516-running.md#ld26f18828aa44c36bfa36be150e60e49)。 2. (单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisilicon",通过**reset**命令可再次启动系统。 **表 1** U-boot修改命令 @@ -479,7 +479,7 @@
- >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >**“go 0x80000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。 3. 输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。 @@ -487,7 +487,7 @@ **图 2** 系统启动图 - ![](figures/qi1.png) + ![](figure/qi1.png) 4. 根目录下,在命令行输入指令“**./bin/hello\_uart**”执行写入的demo程序,显示成功结果如下所示。 @@ -499,5 +499,5 @@ ## 下一步学习 -恭喜,您已完成Hi3516 快速上手!建议您下一步进入[带屏摄像头产品开发](../guide/屏幕和摄像头控制.md)的学习 。 +恭喜,您已完成Hi3516 快速上手!建议您下一步进入[带屏摄像头产品开发](../guide/device-camera.md)的学习 。 diff --git "a/zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-OHOS.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-running.md old mode 100755 new mode 100644 similarity index 89% rename from "zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-OHOS.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-running.md index d5f775c64f385feec6cdc67c211ee5978397aca7..336d979c20d2b4413af4c0f562bcb3621e337e6e --- "a/zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-OHOS.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-running.md @@ -129,7 +129,7 @@ ## 编译 -如果Linux编译环境通过Docker方式安装,具体编译过程请参见[Docker方式获取编译环境](../get-code/Docker编译环境.md)的编译操作。如果Linux编译环境通过软件包方式安装,请进入源码根目录,执行如下命令进行编译: +如果Linux编译环境通过Docker方式安装,具体编译过程请参见[Docker方式获取编译环境](../get-code/gettools-acquire.md)的编译操作。如果Linux编译环境通过软件包方式安装,请进入源码根目录,执行如下命令进行编译: ``` hb set(设置编译路径) @@ -139,28 +139,28 @@ hb build -f(执行编译) ``` **图 1** 设置图例 -![](figures/设置图例.png "设置图例") +![](figure/设置图例.png "设置图例") 结果文件生成在out/hispark\_taurus/ipcamera\_hispark\_taurus目录下。 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >Hi3516DV300单板的U-boot文件获取路径:device/hisilicon/hispark\_taurus/sdk\_liteos/uboot/out/boot/u-boot-hi3516dv300.bin ## 烧录 Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三种方式。此处仅以网口烧录为例进行说明。 -1. 请连接好电脑和待烧录开发板,以Hi3516DV300为例,需要同时连接串口、网口和电源,具体可参考[Hi3516开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3516-0000001152041033)。 +1. 请连接好电脑和待烧录开发板,以Hi3516DV300为例,需要同时连接串口、网口和电源,具体可参考[Hi3516开发板介绍](quickstart-lite-introduction-hi3516.md)。 2. 打开电脑的设备管理器,查看并记录对应的串口号。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果对应的串口异常,请根据[Hi3516/Hi3518系列开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - ![](figures/zh-cn_image_0000001174350647.png) + ![](figure/zh-cn_image_0000001174350647.png) 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 - ![](figures/2021-01-27_170334.png) + ![](figure/2021-01-27_170334.png) 4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3516系列开发板进行适配,无需单独修改。 5. 在“hi3516dv300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 @@ -169,7 +169,7 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 - upload\_protocol:选择烧录协议,固定选择“hiburn-net”。 - upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - ![](figures/zh-cn_image_0000001128470904.png) + ![](figure/zh-cn_image_0000001128470904.png) 6. 检查和设置连接开发板后的网络适配器的IP地址信息,设置方法请参考[设置Hi3516网口烧录的IP地址信息](https://device.harmonyos.com/cn/docs/ide/user-guides/set_ipaddress-0000001141825075)。 7. 设置网口烧录的IP地址信息,设置如下选项: @@ -179,33 +179,33 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 - upload\_net\_client\_gw:设置开发板的网关,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.1 - upload\_net\_client\_ip:设置开发板的IP地址,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.3 - ![](figures/zh-cn_image_0000001174270733.png) + ![](figure/zh-cn_image_0000001174270733.png) 8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -9. 打开工程文件,点击![](figures/2021-01-27_170334-2.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3516dv300下的**Upload**按钮,启动烧录。 +9. 打开工程文件,点击![](figure/2021-01-27_170334-2.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3516dv300下的**Upload**按钮,启动烧录。 - ![](figures/zh-cn_image_0000001174270729.png) + ![](figure/zh-cn_image_0000001174270729.png) 10. 启动烧录后,显示如下提示信息时,请重启开发板(下电再上电)。 - ![](figures/zh-cn_image_0000001128470906.png) + ![](figure/zh-cn_image_0000001128470906.png) 11. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。 - ![](figures/zh-cn_image_0000001128311098.png) + ![](figure/zh-cn_image_0000001128311098.png) ## 镜像运行 1. 连接串口。 - >![](public_sys-resources/icon-notice.gif) **须知:** - >若无法连接串口,请参考[常见问题](../quick-start/常见问题-3.md)进行排查。 + >![](../public_sys-resources/icon-notice.gif) **须知:** + >若无法连接串口,请参考[常见问题](quickstart-lite-steps-board3516-faqs.md)进行排查。 **图 2** 连接串口图 - ![](figures/chuankou1.png) + ![](figure/chuankou1.png) 1. 单击**Monitor**打开串口。 2. 连续输入回车直到串口显示"hisilicon"。 @@ -213,7 +213,7 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 2. (单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisilicon",通过**reset**命令可再次启动系统。 **表 1** U-boot修改命令 @@ -249,7 +249,7 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三
- >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >**“go 0x80000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。 3. 输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。 @@ -257,7 +257,7 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 **图 3** 系统启动图 - ![](figures/qi1.png) + ![](figure/qi1.png) ## 执行应用程序 @@ -265,5 +265,5 @@ Hi3516开发板的代码烧录支持USB烧录、网口烧录和串口烧录三 根目录下,在命令行输入指令“**./bin/helloworld**”执行写入的demo程序,显示成功结果如下图所示。 **图 4** 启动并成功执行应用程序图 -![](figures/启动并成功执行应用程序图.png "启动并成功执行应用程序图") +![](figure/启动并成功执行应用程序图.png "启动并成功执行应用程序图") diff --git "a/zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203-2.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md similarity index 97% rename from "zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203-2.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md index 3f827074bfd5e4c7c19251d467dece8dedeb4fe2..1b5e88ef8f4b11ec873afdb7c4c3116d5a6fbcb4 100644 --- "a/zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203-2.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md @@ -22,11 +22,11 @@ **图 1** 硬件连线图 -![](figures/矩形备份-292.png) +![](figure/矩形备份-292.png) ### 软件要求 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >本节描述安装包方式搭建编译环境的操作步骤。如果是Docker方式安装编译环境,请跳过此章节以及下述[安装Linux服务器工具](#section182916865219)章节。 Hi3516开发板对Linux服务器通用环境配置需要的工具及其获取途径如下表所示。 @@ -75,7 +75,7 @@ Hi3516开发板对Linux服务器通用环境配置需要的工具及其获取途 ## 安装Linux服务器工具 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >- 如果通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装LLVM、hc-gen编译工具。 >- (推荐)如果通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装hc-gen编译工具。安装hc-gen编译工具时,请确保编译工具的环境变量路径唯一。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516.md new file mode 100644 index 0000000000000000000000000000000000000000..397255079763931a2d53c5f10f472a2afd7a350b --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3516.md @@ -0,0 +1,11 @@ +# Hi3516开发板 + +- **[安装开发板环境](quickstart-lite-steps-board3516-setting.md)** + +- **[运行Hello OHOS](quickstart-lite-steps-board3516-running.md)** + +- **[驱动开发示例](quickstart-lite-steps-board3516-program.md)** + +- **[常见问题](quickstart-lite-steps-board3516-faqs.md)** + + diff --git "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-6.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-faqs.md similarity index 78% rename from "zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-6.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-faqs.md index b2dc3ad51268d608a8767e7eaf9256fbc9adfe11..dc71a35fb6a0e5fdac8d3f976d58066a474f2a97 100644 --- "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-6.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-faqs.md @@ -13,7 +13,7 @@ 点击烧写并选择串口后,出现Error: Opening COMxx: Access denied。 **图 1** 打开串口失败图 - ![](figures/打开串口失败图-7.png "打开串口失败图-7") + ![](figure/打开串口失败图-7.png "打开串口失败图-7") - **可能原因** @@ -24,19 +24,19 @@ 1. 按图依次选择下拉框,查找带有serial-xx的终端 **图 2** 查找是否存在占用串口的终端 - ![](figures/查找是否存在占用串口的终端-8.png "查找是否存在占用串口的终端-8") + ![](figure/查找是否存在占用串口的终端-8.png "查找是否存在占用串口的终端-8") 2. 点击标号中的垃圾桶图标,关闭串口。 **图 3** 关闭串口终端 - ![](figures/关闭串口终端-9.png "关闭串口终端-9") + ![](figure/关闭串口终端-9.png "关闭串口终端-9") 3. 重新点击烧写,选择串口并开始烧写程序 **图 4** 重新启动烧写任务 - ![](figures/changjian1-10.png) + ![](figure/changjian1-10.png) ## Windows电脑与单板网络连接失败 @@ -46,7 +46,7 @@ 点击烧写并选择串口后,无法获取文件。 **图 5** 网络不通,单板无法获取文件图 - ![](figures/网络不通-单板无法获取文件图-11.png "网络不通-单板无法获取文件图-11") + ![](figure/网络不通-单板无法获取文件图-11.png "网络不通-单板无法获取文件图-11") - **可能原因** @@ -60,22 +60,22 @@ 2. 点击Windows防火墙。 **图 6** 网络防火墙设置图 - ![](figures/网络防火墙设置图-12.png "网络防火墙设置图-12") + ![](figure/网络防火墙设置图-12.png "网络防火墙设置图-12") 3. 点击“允许应用通过防火墙”。 **图 7** 防火墙和网络保护界面图 - ![](figures/防火墙和网络保护界面图-13.png "防火墙和网络保护界面图-13") + ![](figure/防火墙和网络保护界面图-13.png "防火墙和网络保护界面图-13") 4. 查找Visual Studio Code应用。 **图 8** 查找Visual Studio Code应用图 - ![](figures/查找Visual-Studio-Code应用图-14.png "查找Visual-Studio-Code应用图-14") + ![](figure/查找Visual-Studio-Code应用图-14.png "查找Visual-Studio-Code应用图-14") 5. 勾选Visual Studio Code的专用和公用网络的访问权限。 **图 9** 允许Visual Studio Code应用访问网络 - ![](figures/允许Visual-Studio-Code应用访问网络-15.png "允许Visual-Studio-Code应用访问网络-15") + ![](figure/允许Visual-Studio-Code应用访问网络-15.png "允许Visual-Studio-Code应用访问网络-15") ## 烧写失败 @@ -97,7 +97,7 @@ - **现象描述** - ![](figures/zh-cn_image_0000001174270743.png) + ![](figure/zh-cn_image_0000001174270743.png) - **可能原因1** @@ -106,11 +106,11 @@ - **解决办法** - 请按照[安装python](../quick-start/Ubuntu编译环境准备.md)。 + 请按照[安装python](quickstart-lite-env-setup-lin.md)。 - **可能原因2** - ![](figures/zh-cn_image_0000001174270739.png) + ![](figure/zh-cn_image_0000001174270739.png) - **解决办法** @@ -125,7 +125,7 @@ 例: - ![](figures/zh-cn_image_0000001174350661.png) + ![](figure/zh-cn_image_0000001174350661.png) ## 串口无回显 @@ -142,7 +142,7 @@ 修改串口号。 - 请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按镜像运行内[步骤1](../quick-start/运行Hello-OHOS.md)修改串口号。 + 请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按镜像运行内[步骤1](quickstart-lite-steps-board3518-running.md)修改串口号。 - **可能原因2** @@ -158,7 +158,7 @@ 1. 获取引导文件U-boot。 - >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >单板的U-boot文件请在开源包中获取: >Hi3516DV300:device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin >Hi3518EV300:device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin @@ -169,6 +169,6 @@ 3. 烧写完成后,登录串口如下图所示。 - ![](figures/zh-cn_image_0000001174350659.png) + ![](figure/zh-cn_image_0000001174350659.png) diff --git "a/zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-OHOS-5.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-running.md similarity index 87% rename from "zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-OHOS-5.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-running.md index 51873c97ac3662e15356d6350e6da77ed10fc7c0..2b5a833cfc380fb2762fda0d333c8a20c8cb4239 100644 --- "a/zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-OHOS-5.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-running.md @@ -128,7 +128,7 @@ ## 编译 -如果Linux编译环境通过Docker方式安装,具体编译过程请参见[Docker方式获取编译环境](../get-code/Docker编译环境.md)的编译操作。如果Linux编译环境通过软件包方式安装,进入源码根目录,执行如下命令进行编译: +如果Linux编译环境通过Docker方式安装,具体编译过程请参见[Docker方式获取编译环境](../get-code/gettools-acquire.md)的编译操作。如果Linux编译环境通过软件包方式安装,进入源码根目录,执行如下命令进行编译: ``` hb set(设置编译路径) @@ -140,26 +140,26 @@ hb build -f(执行编译) 结果文件生成在out/hispark\_aries/ipcamera\_hispark\_aries目录下。 **图 1** 设置图例 -![](figures/设置图例-4.png "设置图例-4") +![](figure/设置图例-4.png "设置图例-4") ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >Hi3518EV300单板的U-boot文件获取路径:device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin ## 烧录 Hi3518开发板的代码烧录仅支持USB烧录方式。 -1. 请连接好电脑和待烧录开发板,以Hi3518EV300为例,需要同时连接串口和USB口,具体可参考[Hi3518开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3518-0000001105201138)。 +1. 请连接好电脑和待烧录开发板,以Hi3518EV300为例,需要同时连接串口和USB口,具体可参考[Hi3518开发板介绍](quickstart-lite-introduction-hi3518.md)。 2. 打开电脑的设备管理器,查看并记录对应的串口号。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果对应的串口异常,请根据[Hi3516/Hi3518系列开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - ![](figures/zh-cn_image_0000001128470900.png) + ![](figure/zh-cn_image_0000001128470900.png) 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 - ![](figures/zh-cn_image_0000001174350649.png) + ![](figure/zh-cn_image_0000001174350649.png) 4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3518系列开发板进行适配,无需单独修改。 5. 在“hi3518ev300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 @@ -168,41 +168,41 @@ Hi3518开发板的代码烧录仅支持USB烧录方式。 - upload\_protocol:选择烧录协议,固定选择“hiburn-usb”。 - upload\_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - ![](figures/zh-cn_image_0000001128311090.png) + ![](figure/zh-cn_image_0000001128311090.png) 6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -7. 打开工程文件,点击![](figures/2021-01-27_170334-5.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3518ev300\_fastboot下的**Erase**按钮,擦除U-Boot。 +7. 打开工程文件,点击![](figure/2021-01-27_170334-5.png)图标,打开DevEco Device Tool界面,在“PROJECT TASKS”中,点击hi3518ev300\_fastboot下的**Erase**按钮,擦除U-Boot。 - ![](figures/zh-cn_image_0000001174270731.png) + ![](figure/zh-cn_image_0000001174270731.png) 8. 执行**Erase**擦除操作后,显示如下提示信息时,请重启开发板(下电再上电)。 - ![](figures/zh-cn_image_0000001128311092.png) + ![](figure/zh-cn_image_0000001128311092.png) 9. 重新上电后,显示如下信息时,表示擦除U-Boot成功。 - ![](figures/zh-cn_image_0000001128311094.png) + ![](figure/zh-cn_image_0000001128311094.png) 10. 擦除完成后,点击hi3518ev300下的**Upload**按钮,启动烧录。 - ![](figures/zh-cn_image_0000001174350641.png) + ![](figure/zh-cn_image_0000001174350641.png) 11. 启动烧录后,界面提示如下信息时,表示烧录成功。 - ![](figures/zh-cn_image_0000001174350643.png) + ![](figure/zh-cn_image_0000001174350643.png) ## 镜像运行 1. 连接串口。 - >![](public_sys-resources/icon-notice.gif) **须知:** - >若无法连接串口,请参考[常见问题](../quick-start/常见问题-6.md)进行排查。 + >![](../public_sys-resources/icon-notice.gif) **须知:** + >若无法连接串口,请参考[常见问题](quickstart-lite-steps-board3518-faqs.md)进行排查。 **图 2** 连接串口图 - ![](figures/chuankou1-6.png) + ![](figure/chuankou1-6.png) 1. 单击**Monitor**打开串口。 2. 连续输入回车直到串口显示"hisilicon"。 @@ -247,16 +247,16 @@ Hi3518开发板的代码烧录仅支持USB烧录方式。
- >![](public_sys-resources/icon-notice.gif) **须知:** + >![](../public_sys-resources/icon-notice.gif) **须知:** >**“go 0x40000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。 3. 若启动时显示**"hisilicon \#**字样,请输入**“reset”**指令,等待系统自启动进入系统,系统启动后,显示**“OHOS”**字样,输入**”./bin/helloworld”**并回车,显示成功结果如下图所示。 **图 3** 启动成功并执行应用程序图 - ![](figures/启动成功并执行应用程序图.png "启动成功并执行应用程序图") + ![](figure/启动成功并执行应用程序图.png "启动成功并执行应用程序图") ## 下一步学习 -恭喜您,已完成Hi3518的快速上手!建议您下一步进入[无屏摄像头产品开发](../guide/摄像头控制.md)的学习 。 +恭喜您,已完成Hi3518的快速上手!建议您下一步进入[无屏摄像头产品开发](../guide/device-iotcamera.md)的学习 。 diff --git "a/zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203-4.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md similarity index 96% rename from "zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203-4.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md index b2bbd778809bfdb9aa3ac3e5104e070cce42eae4..b4a3556e11ce25bd050ca3d4be84ae5897f9142c 100644 --- "a/zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203-4.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md @@ -21,11 +21,11 @@ **图 1** 硬件连线图 -![](figures/硬件连线图-3.png "硬件连线图-3") +![](figure/硬件连线图-3.png "硬件连线图-3") ### 软件要求 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >本节描述安装包方式搭建编译环境的操作步骤。如果是Docker方式安装编译环境,请跳过此章节以及下述[安装Linux服务器工具](#section8831868501)章节。 Hi3518开发板对Linux服务器通用环境配置需要的工具及其获取途径如下表所示。 @@ -67,7 +67,7 @@ Hi3518开发板对Linux服务器通用环境配置需要的工具及其获取途 ## 安装Linux服务器工具 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >- 如果通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装hc-gen编译工具。 >- (推荐)如果通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装hc-gen编译工具。安装hc-gen编译工具时,请确保编译工具的环境变量路径唯一。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518.md new file mode 100644 index 0000000000000000000000000000000000000000..d0f3f9a5873ef8da0b02460a5f6b9acdaa2247a1 --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3518.md @@ -0,0 +1,9 @@ +# Hi3518开发板 + +- **[安装开发板环境](quickstart-lite-steps-board3518-setting.md)** + +- **[运行Hello OHOS](quickstart-lite-steps-board3518-running.md)** + +- **[常见问题](quickstart-lite-steps-board3518-faqs.md)** + + diff --git "a/zh-cn/device-dev/quick-start/WLAN\350\201\224\347\275\221.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-connection.md old mode 100755 new mode 100644 similarity index 85% rename from "zh-cn/device-dev/quick-start/WLAN\350\201\224\347\275\221.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-connection.md index ab20f083f914b8a49bf99109750a3f6dd9cb1e0e..fe69412c06e34eae1058d50523d5dd37c2956063 --- "a/zh-cn/device-dev/quick-start/WLAN\350\201\224\347\275\221.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-connection.md @@ -10,42 +10,42 @@ 本节描述如何在Linux服务器上进行WLAN模组版本的编译。 -如果Linux编译环境通过Docker方式安装,具体编译过程请参见[Docker方式获取编译环境](../get-code/Docker编译环境.md)的编译操作。如果Linux编译环境通过软件包方式安装,请参考如下步骤。 +如果Linux编译环境通过Docker方式安装,具体编译过程请参见[Docker方式获取编译环境](../get-code/sourcecode-acquire.md)的编译操作。如果Linux编译环境通过软件包方式安装,请参考如下步骤。 1. 打开DevEco Device Tool工具,点击“View \> Terminal”,进入终端界面。 **图 1** IDE终端工具打开方法 - ![](figures/1.png) + ![](figure/1.png) 在终端界面使用ssh命令连接linux服务器,如“ssh user@ipaddr”。 **图 2** 终端界面示意图 - ![](figures/2.png) + ![](figure/2.png) 2. 进入代码根路径,并在终端窗口,执行脚本命令“hb set”、“.”,选择需要编译的版本“wifiiot\_hispark\_pegasus”。 **图 3** 在终端界面选择目标构建版本示意图 - ![](figures/3.png) + ![](figure/3.png) 3. 执行“hb build”启动版本构建。 **图 4** 在终端界面执行编译命令示意图 - ![](figures/4.png) + ![](figure/4.png) 4. 编译结束后,如果出现“wifiiot\_hispark\_pegasus build success”字样,则证明构建成功,如下图所示。 **图 5** 编译成功示意图 - ![](figures/5.png) + ![](figure/5.png) 5. 构建成功后,会在./out/wifiiot/路径中生成以下文件,使用如下命令可以查看,至此编译构建流程结束。 @@ -56,24 +56,24 @@ **图 6** 编译文件存放目录示意图 - ![](figures/3-0.png) + ![](figure/3-0.png) ## 镜像烧录 Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成,工具的基本使用请参考[DevEco Device Tool使用指南](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905),烧录过程包含如下步骤。 -1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3861-0000001105041324)。 +1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861开发板介绍](quickstart-lite-introduction-hi3861.md)。 2. 打开电脑的设备管理器,查看并记录对应的串口号。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果对应的串口异常,请根据[Hi3861系列开发板串口驱动安装](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。 - ![](figures/zh-cn_image_0000001128311118.png) + ![](figure/zh-cn_image_0000001128311118.png) 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 - ![](figures/zh-cn_image_0000001128311116.png) + ![](figure/zh-cn_image_0000001128311116.png) 4. 在“Partition Configuration”页签,设置待烧录文件信息,默认情况下,DevEco Device Tool已针对Hi3861系列开发板进行适配,无需单独修改。 5. 在“hi3861”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 @@ -82,20 +82,20 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, - upload\_protocol:选择烧录协议,固定选择“burn-serial”。 - upload\_partitions:选择待烧录的文件,默认选择hi3861\_app。 - ![](figures/zh-cn_image_0000001128470922.png) + ![](figure/zh-cn_image_0000001128470922.png) 6. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 7. 打开工程文件,在DevEco Device Tool界面的“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。 - ![](figures/zh-cn_image_0000001174270749.png) + ![](figure/zh-cn_image_0000001174270749.png) 8. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。 - ![](figures/zh-cn_image_0000001174270751.png) + ![](figure/zh-cn_image_0000001174270751.png) 9. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。 - ![](figures/zh-cn_image_0000001174350669.png) + ![](figure/zh-cn_image_0000001174350669.png) ## WLAN模组联网 @@ -107,14 +107,14 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, **图 7** 打开DevEco串口终端示意图 - ![](figures/5-1.png) + ![](figure/5-1.png) 2. 复位WLAN模组,终端界面显示“ready to OS start”,则启动成功。 **图 8** WLAN复位成功示意图 - ![](figures/6.png) + ![](figure/6.png) 3. 在DevEco的串口终端中,依次执行如下AT命令,启动STA模式,连接指定AP热点,并开启DHCP功能。 @@ -137,6 +137,6 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, **图 9** WLAN模组联网成功示意图 - ![](figures/截图.png) + ![](figure/截图.png) diff --git "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-faqs.md similarity index 95% rename from "zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-faqs.md index f8e0b7384e225685a08fa51e0cf97264bfe3851e..b0dbbae1b366bc12e6e97c8d365476b2168a5217 100644 --- "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-faqs.md @@ -73,7 +73,7 @@ 方法2:如果软件源中没有该软件,请从“www.zlib.net”下载版本代码,并离线安装。 - ![](figures/10.png) + ![](figure/10.png) 完成下载后,通过以下命令安装: @@ -134,7 +134,7 @@ 通过网页[https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files),下载源码。 - ![](figures/zh-cn_image_0000001128470864.png) + ![](figure/zh-cn_image_0000001128470864.png) 将源码放置在Linux服务器中,解压,并安装“python3 setup.py install”。 @@ -165,7 +165,7 @@ 通过网页[https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files),下载安装包。 - ![](figures/zh-cn_image_0000001128311072.png) + ![](figure/zh-cn_image_0000001128311072.png) 将安装包放置Linux服务器中,并安装“pip3 install ecdsa-0.15-py2.py3-none-any.whl”。 @@ -196,7 +196,7 @@ 通过网页[https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files),下载安装包。 - ![](figures/zh-cn_image_0000001174270699.png) + ![](figure/zh-cn_image_0000001174270699.png) 将源码放置在Linux服务器中,并安装“pip3 install six-1.14.0-py2.py3-none-any.whl”。 @@ -249,11 +249,11 @@ - **解决办法** - 请按照 [安装Python环境](../quick-start/Ubuntu编译环境准备.md) + 请按照 [安装Python环境](quickstart-lite-env-setup-lin.md) - **可能原因2** - ![](figures/zh-cn_image_0000001128311070.png) + ![](figure/zh-cn_image_0000001128311070.png) - **解决办法** @@ -268,7 +268,7 @@ 例: - ![](figures/zh-cn_image_0000001174350623.png) + ![](figure/zh-cn_image_0000001174350623.png) ## 安装 kconfiglib时,遇到lsb\_release错误 diff --git "a/zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-World.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-running.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-World.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-running.md index f428ec411ee4fc51d1be00be263867d1f8f8dc74..547aa5affc7e6d2081e39bc482a1d2168043840d --- "a/zh-cn/device-dev/quick-start/\350\277\220\350\241\214Hello-World.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-running.md @@ -137,7 +137,7 @@ Call Stack 6 -- 3f5e24 addr:f78fc 3. 根据以上调用栈信息,可以定位WadRecvCB函数中出现了异常。 - ![](figures/zh-cn_image_0000001174270737.png) + ![](figure/zh-cn_image_0000001174270737.png) 4. 完成代码排查及修改。 @@ -154,5 +154,5 @@ wifi init success! ## 下一步学习 -恭喜,您已完成Hi3861 WLAN模组快速上手!建议您下一步进入[WLAN产品开发](../guide/概述.md)的学习 。 +恭喜,您已完成Hi3861 WLAN模组快速上手!建议您下一步进入[WLAN产品开发](../guide/device-wifi.md)的学习 。 diff --git "a/zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203.md" b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-setting.md similarity index 97% rename from "zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203.md" rename to zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-setting.md index 2bf84d7aab300883ba5e0b44f2c0acb5ad043917..90998c5acf0e5b6ee722fdcb6030a34e8a83b5fb 100644 --- "a/zh-cn/device-dev/quick-start/\345\256\211\350\243\205\345\274\200\345\217\221\346\235\277\347\216\257\345\242\203.md" +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861-setting.md @@ -24,11 +24,11 @@ 各硬件连接关系如下图所示。 **图 1** 硬件连线图 -![](figures/硬件连线图.png "硬件连线图") +![](figure/硬件连线图.png "硬件连线图") ### 软件要求 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >本节描述采用安装包方式安装相关工具的操作步骤。如果是Docker方式安装,无需安装[表1](#table6299192712513)中的Linux服务器相关工具,只需安装Windows工作台工具即可。 Hi3861开发板需要的工具如下表所示。 @@ -96,7 +96,7 @@ Hi3861开发板需要的工具如下表所示。 ## 安装Linux编译工具 ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >- 如果通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装gcc\_riscv32编译工具。 >- (推荐)如果通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装gcc\_riscv32编译工具。安装gcc\_riscv32编译工具时,请确保编译工具的环境变量路径唯一。 @@ -124,7 +124,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ``` **图 2** SCons安装成功界面,版本要求3.0.4以上 - ![](figures/SCons安装成功界面-版本要求3-0-4以上.png "SCons安装成功界面-版本要求3-0-4以上") + ![](figure/SCons安装成功界面-版本要求3-0-4以上.png "SCons安装成功界面-版本要求3-0-4以上") ### 安装python模块 @@ -227,7 +227,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev ### 安装gcc\_riscv32(WLAN模组类编译工具链) ->![](public_sys-resources/icon-notice.gif) **须知:** +>![](../public_sys-resources/icon-notice.gif) **须知:** >- Hi3861平台仅支持使用libgcc运行时库的静态链接,不建议开发者使用libgcc运行时库的动态链接,会导致商业分发时被GPL V3污染。 >- 通过下述步骤2-15,我们编译好了gcc\_riscv32 镜像,提供给开发者[直接下载](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)使用。直接下载 gcc\_riscv32 镜像的开发者可省略下述2-15步。 @@ -316,7 +316,7 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev 16. 设置环境变量。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果直接采用编译好的riscv32 gcc包,请参照如下步骤设置环境变量: >1. 将压缩包解压到根目录 > ``` @@ -362,6 +362,6 @@ sudo apt-get install build-essential gcc g++ make zlib* libffi-dev 2. 点击安装包,安装驱动程序。 3. 驱动安装完成后,重新插拔USB接口,串口信息显示如下图所示。 - ![](figures/zh-cn_image_0000001174350633.png) + ![](figure/zh-cn_image_0000001174350633.png) diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861.md new file mode 100644 index 0000000000000000000000000000000000000000..8aca8589071142415783b378a6f932e3213722fa --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-board3861.md @@ -0,0 +1,11 @@ +# Hi3861开发板 + +- **[安装开发板环境](quickstart-lite-steps-board3861-setting.md)** + +- **[WLAN联网](quickstart-lite-steps-board3861-connection.md)** + +- **[运行Hello World](quickstart-lite-steps-board3861-running.md)** + +- **[常见问题](quickstart-lite-steps-board3861-faqs.md)** + + diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps.md new file mode 100644 index 0000000000000000000000000000000000000000..49545483c62cc3790af97196c58f3e29ce9c00b5 --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps.md @@ -0,0 +1,9 @@ +# 开发步骤 + +- **[Hi3861开发板](quickstart-lite-steps-board3861.md)** + +- **[Hi3516开发板](quickstart-lite-steps-board3516.md)** + +- **[Hi3518开发板](quickstart-lite-steps-board3518.md)** + + diff --git a/zh-cn/device-dev/quick-start/quickstart-lite.md b/zh-cn/device-dev/quick-start/quickstart-lite.md new file mode 100644 index 0000000000000000000000000000000000000000..47a4ec111d5d343ef0f1abe4321730c8a201249a --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-lite.md @@ -0,0 +1,11 @@ +# 轻量和小型系统入门 + +- **[概述](quickstart-lite-overview.md)** + +- **[了解开发板](quickstart-lite-introduction.md)** + +- **[搭建系统环境](quickstart-lite-env-setup.md)** + +- **[开发步骤](quickstart-lite-steps.md)** + + diff --git "a/zh-cn/device-dev/quick-start/\351\225\234\345\203\217\347\203\247\345\275\225.md" b/zh-cn/device-dev/quick-start/quickstart-standard-burn.md similarity index 97% rename from "zh-cn/device-dev/quick-start/\351\225\234\345\203\217\347\203\247\345\275\225.md" rename to zh-cn/device-dev/quick-start/quickstart-standard-burn.md index 3fca75cfcd0691990f88acac3e1f32ac98528a08..be86e001d66decb04ed2382d2b8158351437b267 100644 --- "a/zh-cn/device-dev/quick-start/\351\225\234\345\203\217\347\203\247\345\275\225.md" +++ b/zh-cn/device-dev/quick-start/quickstart-standard-burn.md @@ -11,7 +11,7 @@ Hi3516DV300支持烧录标准系统,其烧录方式包括网口烧录和串口 同一种烧录方式(如网口烧录),在Windows和Linux环境下的烧录操作完全一致,区别仅在于DevEco Device Tool环境搭建不同。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >当前Hi3516DV300开发板支持通过网口、USB、串口三种方式烧录OpenHarmony标准系统。本文以网口方式为例讲解烧录操作,其他两种烧录方式请参照[Hi3516DV300烧录指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_upload-0000001052148681)。 ### 前提条件 @@ -25,14 +25,14 @@ Hi3516DV300开发板使用网口录方式,支持Windows和Linux系统。 1. 请连接好电脑和待烧录开发板,需要同时连接串口、网口和电源,具体可参考[Hi3516DV300开发板介绍](https://device.harmonyos.com/cn/docs/start/introduce/oem_minitinier_des_3516-0000001152041033)。 2. 打开电脑的设备管理器,查看并记录对应的串口号。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - ![](figures/zh-cn_image_0000001114129428.png) + ![](figure/zh-cn_image_0000001114129428.png) 3. 打开DevEco Device Tool,在Projects中,点击**Settings**打开工程配置界面。 - ![](figures/2021-01-27_170334-17.png) + ![](figure/2021-01-27_170334-16.png) 4. 在**Partition Configuration**页签中,按照下表内容填写烧录文件信息,包括: @@ -165,7 +165,7 @@ Hi3516DV300开发板使用网口录方式,支持Windows和Linux系统。
- ![](figures/zh-cn_image_0000001130584312.png) + ![](figure/zh-cn_image_0000001130584312.png) 5. 在“hi3516dv300”页签,设置烧录选项,包括upload\_port、upload\_partitions和upload\_protocol。 @@ -173,7 +173,7 @@ Hi3516DV300开发板使用网口录方式,支持Windows和Linux系统。 - upload\_protocol:选择烧录协议,固定选择“hiburn-net”。 - upload\_partitions:选择待烧录的文件,包括fastboot、boot、updater、misc、system、vendor和userdata。 - ![](figures/zh-cn_image_0000001117621400.png) + ![](figure/zh-cn_image_0000001117621400.png) 6. 检查和设置连接开发板后的网络适配器的IP地址信息,设置方法请参考[设置Hi3516DV300网口烧录的IP地址信息](https://device.harmonyos.com/cn/docs/ide/user-guides/set_ipaddress-0000001141825075)。 7. 设置网口烧录的IP地址信息,设置如下选项: @@ -183,19 +183,19 @@ Hi3516DV300开发板使用网口录方式,支持Windows和Linux系统。 - upload\_net\_client\_gw:设置开发板的网关,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.1 - upload\_net\_client\_ip:设置开发板的IP地址,工具会自动根据选择的upload\_net\_server\_ip进行设置。例如192.168.1.3 - ![](figures/zh-cn_image_0000001117463460.png) + ![](figure/zh-cn_image_0000001117463460.png) 8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 9. 启动烧录后,显示如下提示信息时,请重启开发板(下电再上电)。 - ![](figures/zh-cn_image_0000001114129432.png) + ![](figure/zh-cn_image_0000001114129432.png) 10. 重新上电后,启动烧录,界面提示如下信息时,表示烧录成功。 - ![](figures/zh-cn_image_0000001113969542.png) + ![](figure/zh-cn_image_0000001113969542.png) ## 下一步 -恭喜!您已经完成了OpenHarmony标准系统的快速入门,接下来可[开发一个小示例](../guide/时钟应用开发示例.md),进一步熟悉OpenHarmony的开发。 +恭喜!您已经完成了OpenHarmony标准系统的快速入门,接下来可[开发一个小示例](../guide/device-clock-guide.md),进一步熟悉OpenHarmony的开发。 diff --git "a/zh-cn/device-dev/quick-start/\345\205\245\351\227\250\344\273\213\347\273\215.md" b/zh-cn/device-dev/quick-start/quickstart-standard-description.md similarity index 97% rename from "zh-cn/device-dev/quick-start/\345\205\245\351\227\250\344\273\213\347\273\215.md" rename to zh-cn/device-dev/quick-start/quickstart-standard-description.md index 3e0807591c3e4ae71f160c45a6da9dc6cbf3dbca..20f133bca4fc7cbace60eca8d9a6de8b79e7965a 100644 --- "a/zh-cn/device-dev/quick-start/\345\205\245\351\227\250\344\273\213\347\273\215.md" +++ b/zh-cn/device-dev/quick-start/quickstart-standard-description.md @@ -13,7 +13,7 @@ 标准系统快速入门流程如下图所示,其中“搭建Ubuntu环境及编译”环节可根据实际情况选择docker方式或工具包方式其中一种即可。 **图 1** 标准环境快速入门流程 -![](figures/标准环境快速入门流程.png "标准环境快速入门流程") +![](figure/标准环境快速入门流程.png "标准环境快速入门流程") ## 开发板简介 @@ -22,7 +22,7 @@ Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代I **图 2** Hi3516单板正面外观图 -![](figures/3516正面-16.png) +![](figure/3516正面.png) ## 开发板规格 diff --git "a/zh-cn/device-dev/quick-start/\346\220\255\345\273\272Ubuntu\347\216\257\345\242\203\345\217\212\347\274\226\350\257\221\357\274\210Docker\346\226\271\345\274\217\357\274\211.md" b/zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md similarity index 93% rename from "zh-cn/device-dev/quick-start/\346\220\255\345\273\272Ubuntu\347\216\257\345\242\203\345\217\212\347\274\226\350\257\221\357\274\210Docker\346\226\271\345\274\217\357\274\211.md" rename to zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md index 2f4c97aa4a72f1a42454c7662ccfc17eab7e17d4..6f3ed7f03f02d6cb9e59dadbe00d463d7734d319 100644 --- "a/zh-cn/device-dev/quick-start/\346\220\255\345\273\272Ubuntu\347\216\257\345\242\203\345\217\212\347\274\226\350\257\221\357\274\210Docker\346\226\271\345\274\217\357\274\211.md" +++ b/zh-cn/device-dev/quick-start/quickstart-standard-docker-environment.md @@ -9,9 +9,9 @@ OpenHarmony标准系统为开发者提供的Docker环境已经将对应的编译工具链进行了封装,开发者可省略对应工具的安装。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >- 在使用Docker前需要先安装Docker,Docker安装请参考[官方指导](https://docs.docker.com/engine/install/ubuntu/)。 ->- Docker方式和安装包方式二选一即可。选择Docker方式的开发者可跳过[安装包方式](搭建Ubuntu环境及编译(安装包方式).md)的内容。 +>- Docker方式和安装包方式二选一即可。选择Docker方式的开发者可跳过[安装包方式](quickstart-standard-package-environment.md)的内容。 ## 获取标准系统源码 @@ -111,8 +111,8 @@ repo forall -c 'git lfs pull' 编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 -3. 编译源码完成,请进行镜像烧录,具体请参见[镜像烧录](镜像烧录.md)。 +3. 编译源码完成,请进行镜像烧录,具体请参见[镜像烧录](quickstart-standard-burn.md)。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >退出Docker执行exit命令即可。 diff --git "a/zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-8.md" b/zh-cn/device-dev/quick-start/quickstart-standard-faq.md similarity index 100% rename from "zh-cn/device-dev/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-8.md" rename to zh-cn/device-dev/quick-start/quickstart-standard-faq.md diff --git "a/zh-cn/device-dev/quick-start/\346\220\255\345\273\272Ubuntu\347\216\257\345\242\203\345\217\212\347\274\226\350\257\221\357\274\210\345\256\211\350\243\205\345\214\205\346\226\271\345\274\217\357\274\211.md" b/zh-cn/device-dev/quick-start/quickstart-standard-package-environment.md similarity index 93% rename from "zh-cn/device-dev/quick-start/\346\220\255\345\273\272Ubuntu\347\216\257\345\242\203\345\217\212\347\274\226\350\257\221\357\274\210\345\256\211\350\243\205\345\214\205\346\226\271\345\274\217\357\274\211.md" rename to zh-cn/device-dev/quick-start/quickstart-standard-package-environment.md index 92eb461fe7ace1d62022113eabdd655b4d1f6788..d35cc274995107ccc178c03fd48a41641dcc8ea2 100644 --- "a/zh-cn/device-dev/quick-start/\346\220\255\345\273\272Ubuntu\347\216\257\345\242\203\345\217\212\347\274\226\350\257\221\357\274\210\345\256\211\350\243\205\345\214\205\346\226\271\345\274\217\357\274\211.md" +++ b/zh-cn/device-dev/quick-start/quickstart-standard-package-environment.md @@ -16,7 +16,7 @@ sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >以上安装命令适用于Ubuntu18.04,其他版本请根据安装包名称采用对应的安装命令。 ## 获取标准系统源码 @@ -91,8 +91,8 @@ bash build/prebuilts_download.sh 编译所生成的文件都归档在out/ohos-arm-release/目录下,结果镜像输出在 out/ohos-arm-release/packages/phone/images/ 目录下。 - >![](public_sys-resources/icon-note.gif) **说明:** - >其他模块化编译操作,可参见[编译构建指导](../subsystems/标准系统编译构建指导.md)。 + >![](../public_sys-resources/icon-note.gif) **说明:** + >其他模块化编译操作,可参见[编译构建指导](../subsystems/subsys-build-standard-large.md)。 -3. 编译源码完成,请进行镜像烧录,具体请参见[镜像烧录](镜像烧录.md)。 +3. 编译源码完成,请进行镜像烧录,具体请参见[镜像烧录](quickstart-standard-burn.md)。 diff --git "a/zh-cn/device-dev/quick-start/Windows\345\274\200\345\217\221\347\216\257\345\242\203\345\207\206\345\244\207-7.md" b/zh-cn/device-dev/quick-start/quickstart-standard-windows-environment.md similarity index 93% rename from "zh-cn/device-dev/quick-start/Windows\345\274\200\345\217\221\347\216\257\345\242\203\345\207\206\345\244\207-7.md" rename to zh-cn/device-dev/quick-start/quickstart-standard-windows-environment.md index bb7588a5ce8be87185e5d16a0a815ba8c342c87c..bf45ab1684dce5b497d0685d1cc05e3f20e43ac3 100644 --- "a/zh-cn/device-dev/quick-start/Windows\345\274\200\345\217\221\347\216\257\345\242\203\345\207\206\345\244\207-7.md" +++ b/zh-cn/device-dev/quick-start/quickstart-standard-windows-environment.md @@ -81,28 +81,31 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ## 安装Visual Studio Code ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果已安装Visual Studio Code,打开命令行工具,输入**code --version**命令,检查版本号是否为1.53及以上版本;可以正常返回版本号,说明环境变量设置也正确。 1. 双击Visual Studio Code软件包进行安装。安装过程中,请勾选“添加到PATH(重启后生效)”。 - ![](figures/zh-cn_image_0000001057335403.png) + ![](figure/zh-cn_image_0000001057335403.png) 2. 安装完成后,打开命令行工具,输入**code --version**命令,可以正常显示版本号说明安装成功。 ## 安装Python +>![](../public_sys-resources/icon-note.gif) **说明:** +>请注意,Python版本要求为V3.7.4\~V3.8.x 64位版本。 + 1. 双击Python安装包进行安装,勾选“**Add Python 3.8 to PATH**”,然后点击**Install Now**开始安装。 - ![](figures/zh-cn_image_0000001176317561.png) + ![](figure/zh-cn_image_0000001176317561.png) 2. 等待安装完成后,点击**Close**。 - ![](figures/zh-cn_image_0000001142794291.png) + ![](figure/zh-cn_image_0000001142794291.png) 3. 打开命令行工具,输入python --version,检查安装结果。 - ![](figures/zh-cn_image_0000001130278040.png) + ![](figure/zh-cn_image_0000001130278040.png) 4. 在命令行工具中,分别执行如下命令设置pip源,用于后续安装DevEco Device Tool过程中下载依赖的组件包。 @@ -115,7 +118,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 ## 安装Node.js ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果已安装Node.js,打开命令行工具,输入**node -v**命令,检查版本号是否为12.0.0及以上版本。 1. 点击下载后的软件包进行安装,全部按照默认设置点击**Next**,直至**Finish**。安装过程中,Node.js会自动在系统的path环境变量中配置node.exe的目录路径。 @@ -127,7 +130,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 在安装hpm前,请检查网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问。这种情况下,需要先[设置npm代理](https://device.harmonyos.com/cn/docs/ide/user-guides/npm_proxy-0000001054491032),才能安装hpm。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >如果已安装hpm,可以执行**npm update -g @ohos/hpm-cli**命令升级hpm至最新版本。 1. 建议将npm源配置为国内镜像,例如设置为华为云镜像源。 @@ -142,7 +145,7 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 npm install -g @ohos/hpm-cli ``` - ![](figures/zh-cn_image_0000001073840162.png) + ![](figure/zh-cn_image_0000001073840162.png) 3. 安装完成后,执行如下命令(V为大写字母)检查hpm安装结果。 @@ -157,20 +160,20 @@ DevEco Device Tool以插件方式提供,基于Visual Studio Code进行扩展 DevEco Device Tool正常运行需要依赖于C/C++和CodeLLDB插件,在安装完DevEco Device Tool后,会自动从Visual Studio Code的插件市场安装C/C++和CodeLLDB插件。因此,在安装DevEco Device Tool前,请检查Visual Studio Code的网络连接状态,如果网络不能直接访问Internet,则需要通过代理服务器才可以访问,请先[Visual Studio Code代理设置](https://device.harmonyos.com/cn/docs/ide/user-guides/vscode_proxy-0000001074231144)。 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >安装DevEco Device Tool时,请先关闭Visual Studio Code。 1. 解压DevEco Device Tool插件压缩包,双击安装包程序进行安装。 2. 安装过程中,会自动安装DevEco Device Tool所需的依赖文件(如C/C++和CodeLLDB插件)和执行程序。 - ![](figures/zh-cn_image_0000001072468991.png) + ![](figure/zh-cn_image_0000001072468991.png) 3. 安装完成后,会自动关闭命令行工具窗口。 -4. 启动Visual Studio Code,点击左侧的![](figures/zh-cn_image_0000001072757874.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。 +4. 启动Visual Studio Code,点击左侧的![](figure/zh-cn_image_0000001072757874.png)按钮,检查INSTALLED中,是否已成功安装C/C++、CodeLLDB和DevEco Device Tool。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如果C/C++和CodeLLDB插件安装不成功,则DevEco Device Tool不能正常运行,解决方法,详细请参考:[离线安装C/C++和CodeLLDB插件](https://device.harmonyos.com/cn/docs/ide/user-guides/offline_plugin_install-0000001074376846)。 - ![](figures/zh-cn_image_0000001142802505.png) + ![](figure/zh-cn_image_0000001142802505.png) diff --git a/zh-cn/device-dev/quick-start/quickstart-standard.md b/zh-cn/device-dev/quick-start/quickstart-standard.md new file mode 100644 index 0000000000000000000000000000000000000000..8d2bc8cb313e357a743b62556b44b97c927bb0f2 --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart-standard.md @@ -0,0 +1,15 @@ +# 标准系统入门 + +- **[入门介绍](quickstart-standard-description.md)** + +- **[Windows开发环境准备](quickstart-standard-windows-environment.md)** + +- **[搭建Ubuntu环境及编译(Docker方式)](quickstart-standard-docker-environment.md)** + +- **[搭建Ubuntu环境及编译(安装包方式)](quickstart-standard-package-environment.md)** + +- **[镜像烧录](quickstart-standard-burn.md)** + +- **[常见问题](quickstart-standard-faq.md)** + + diff --git a/zh-cn/device-dev/quick-start/quickstart.md b/zh-cn/device-dev/quick-start/quickstart.md new file mode 100644 index 0000000000000000000000000000000000000000..5ab9867ff455695acd09b4325c016a46cae44dc8 --- /dev/null +++ b/zh-cn/device-dev/quick-start/quickstart.md @@ -0,0 +1,7 @@ +# 快速入门 + +- **[轻量和小型系统入门](quickstart-lite.md)** + +- **[标准系统入门](quickstart-standard.md)** + + diff --git "a/zh-cn/device-dev/quick-start/\344\272\206\350\247\243\345\274\200\345\217\221\346\235\277.md" "b/zh-cn/device-dev/quick-start/\344\272\206\350\247\243\345\274\200\345\217\221\346\235\277.md" deleted file mode 100755 index fae4d8bb46425aee84df037e4e126c480c18bd9d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/\344\272\206\350\247\243\345\274\200\345\217\221\346\235\277.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 了解开发板 - -- **[Hi3861开发板介绍](Hi3861开发板介绍.md)** - -- **[Hi3516开发板介绍](Hi3516开发板介绍.md)** - -- **[Hi3518开发板介绍](Hi3518开发板介绍.md)** - - diff --git "a/zh-cn/device-dev/quick-start/\345\274\200\345\217\221\346\255\245\351\252\244.md" "b/zh-cn/device-dev/quick-start/\345\274\200\345\217\221\346\255\245\351\252\244.md" deleted file mode 100644 index 70e795860fbfacc0dc0c4d9c38c453e7a5a99519..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/\345\274\200\345\217\221\346\255\245\351\252\244.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 开发步骤 - -- **[Hi3861开发板](Hi3861开发板.md)** - -- **[Hi3516开发板](Hi3516开发板.md)** - -- **[Hi3518开发板](Hi3518开发板.md)** - - diff --git "a/zh-cn/device-dev/quick-start/\346\220\255\345\273\272\347\263\273\347\273\237\347\216\257\345\242\203.md" "b/zh-cn/device-dev/quick-start/\346\220\255\345\273\272\347\263\273\347\273\237\347\216\257\345\242\203.md" deleted file mode 100755 index 73a9d50f87e5de08c775137b9864e6f02656872e..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/\346\220\255\345\273\272\347\263\273\347\273\237\347\216\257\345\242\203.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 搭建系统环境 - -- **[概述](概述-0.md)** - -- **[Windows开发环境准备](Windows开发环境准备.md)** - -- **[Ubuntu编译环境准备](Ubuntu编译环境准备.md)** - -- **[常见问题](常见问题.md)** - - diff --git "a/zh-cn/device-dev/quick-start/\346\240\207\345\207\206\347\263\273\347\273\237\345\205\245\351\227\250.md" "b/zh-cn/device-dev/quick-start/\346\240\207\345\207\206\347\263\273\347\273\237\345\205\245\351\227\250.md" deleted file mode 100755 index 0281a27a47be0f03dcb2595968a0377c5e65f554..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/\346\240\207\345\207\206\347\263\273\347\273\237\345\205\245\351\227\250.md" +++ /dev/null @@ -1,15 +0,0 @@ -# 标准系统入门 - -- **[入门介绍](入门介绍.md)** - -- **[Windows开发环境准备](Windows开发环境准备-7.md)** - -- **[搭建Ubuntu环境及编译(Docker方式)](搭建Ubuntu环境及编译(Docker方式).md)** - -- **[搭建Ubuntu环境及编译(安装包方式)](搭建Ubuntu环境及编译(安装包方式).md)** - -- **[镜像烧录](镜像烧录.md)** - -- **[常见问题](常见问题-8.md)** - - diff --git "a/zh-cn/device-dev/quick-start/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\345\205\245\351\227\250.md" "b/zh-cn/device-dev/quick-start/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\345\205\245\351\227\250.md" deleted file mode 100644 index a5446960eb35cd7ad18fa426da226ea89ac6d2bf..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/quick-start/\350\275\273\351\207\217\345\222\214\345\260\217\345\236\213\347\263\273\347\273\237\345\205\245\351\227\250.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 轻量和小型系统入门 - -- **[概述](概述.md)** - -- **[了解开发板](了解开发板.md)** - -- **[搭建系统环境](搭建系统环境.md)** - -- **[开发步骤](开发步骤.md)** - - diff --git a/zh-cn/device-dev/security/Readme-CN.md b/zh-cn/device-dev/security/Readme-CN.md index 3eb2062d716d8d4d3765ae11edcfd8bb3d8bad27..9a8e221f7fe6561d044900efa29dfec7d0d82af0 100755 --- a/zh-cn/device-dev/security/Readme-CN.md +++ b/zh-cn/device-dev/security/Readme-CN.md @@ -1,5 +1,5 @@ # 隐私与安全 -- [隐私保护](隐私保护.md) -- [安全指南](安全指南.md) +- [隐私保护](safety-protection-privacyguide.md) +- [安全指南](safety-safeguide-security.md) diff --git "a/zh-cn/device-dev/security/figures/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" "b/zh-cn/device-dev/security/figure/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" rename to "zh-cn/device-dev/security/figure/1-\346\225\217\346\204\237\346\235\203\351\231\220\345\274\271\347\252\227.png" diff --git "a/zh-cn/device-dev/security/figures/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" "b/zh-cn/device-dev/security/figure/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" rename to "zh-cn/device-dev/security/figure/2-\345\272\224\347\224\250\345\220\257\345\212\250\351\242\204\346\216\210\346\235\203.png" diff --git "a/zh-cn/device-dev/security/figures/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" "b/zh-cn/device-dev/security/figure/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" rename to "zh-cn/device-dev/security/figure/3-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216.png" diff --git "a/zh-cn/device-dev/security/figures/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" "b/zh-cn/device-dev/security/figure/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" rename to "zh-cn/device-dev/security/figure/4-\351\232\220\347\247\201\345\243\260\346\230\216\345\217\230\346\233\264\351\200\232\347\237\245.png" diff --git "a/zh-cn/device-dev/security/figures/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" "b/zh-cn/device-dev/security/figure/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" rename to "zh-cn/device-dev/security/figure/5-\345\272\224\347\224\250\351\232\220\347\247\201\345\243\260\346\230\216\345\205\245\345\217\243.png" diff --git "a/zh-cn/device-dev/security/figures/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" "b/zh-cn/device-dev/security/figure/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" rename to "zh-cn/device-dev/security/figure/6-1-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" diff --git "a/zh-cn/device-dev/security/figures/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" "b/zh-cn/device-dev/security/figure/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" rename to "zh-cn/device-dev/security/figure/6-2-\351\232\220\347\247\201\345\243\260\346\230\216\346\222\244\351\224\200.png" diff --git "a/zh-cn/device-dev/security/figures/DAC\346\265\201\347\250\213\345\233\276.png" "b/zh-cn/device-dev/security/figure/DAC\346\265\201\347\250\213\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/DAC\346\265\201\347\250\213\345\233\276.png" rename to "zh-cn/device-dev/security/figure/DAC\346\265\201\347\250\213\345\233\276.png" diff --git "a/zh-cn/device-dev/security/figures/HUKS\345\212\237\350\203\275\347\273\223\346\236\204\345\233\276.png" "b/zh-cn/device-dev/security/figure/HUKS\345\212\237\350\203\275\347\273\223\346\236\204\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/HUKS\345\212\237\350\203\275\347\273\223\346\236\204\345\233\276.png" rename to "zh-cn/device-dev/security/figure/HUKS\345\212\237\350\203\275\347\273\223\346\236\204\345\233\276.png" diff --git "a/zh-cn/device-dev/security/figures/\345\256\211\345\205\250\344\277\235\351\232\234\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/security/figure/\345\256\211\345\205\250\344\277\235\351\232\234\347\244\272\346\204\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/\345\256\211\345\205\250\344\277\235\351\232\234\347\244\272\346\204\217\345\233\276.png" rename to "zh-cn/device-dev/security/figure/\345\256\211\345\205\250\344\277\235\351\232\234\347\244\272\346\204\217\345\233\276.png" diff --git "a/zh-cn/device-dev/security/figures/\350\256\276\345\244\207\351\227\264\345\273\272\347\253\213\345\217\257\344\277\241\345\205\263\347\263\273\346\265\201\347\250\213\345\233\276.png" "b/zh-cn/device-dev/security/figure/\350\256\276\345\244\207\351\227\264\345\273\272\347\253\213\345\217\257\344\277\241\345\205\263\347\263\273\346\265\201\347\250\213\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/security/figures/\350\256\276\345\244\207\351\227\264\345\273\272\347\253\213\345\217\257\344\277\241\345\205\263\347\263\273\346\265\201\347\250\213\345\233\276.png" rename to "zh-cn/device-dev/security/figure/\350\256\276\345\244\207\351\227\264\345\273\272\347\253\213\345\217\257\344\277\241\345\205\263\347\263\273\346\265\201\347\250\213\345\233\276.png" diff --git a/zh-cn/device-dev/security/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/security/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/security/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/security/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/security/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/security/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/security/public_sys-resources/icon-note.gif b/zh-cn/device-dev/security/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/security/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/security/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/security/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/security/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/security/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/security/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/security/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/security/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/security/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/security/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" b/zh-cn/device-dev/security/safety-protection-privacyguide.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" rename to zh-cn/device-dev/security/safety-protection-privacyguide.md index 3777685f3ff4a8e3cdd3e43aad55008b8d02fa27..95e5eccca8ac113c4ac92f908bb5701109b0e842 --- "a/zh-cn/device-dev/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" +++ b/zh-cn/device-dev/security/safety-protection-privacyguide.md @@ -141,26 +141,26 @@ **图 1** 隐私通知/声明示例图 - ![](figures/2-应用启动预授权.png) ![](figures/3-应用隐私声明.png) + ![](figure/2-应用启动预授权.png) ![](figure/3-应用隐私声明.png) - 个人数据应当基于具体、明确、合法的目的收集,不应与此目的不相符的方式作进一步处理。对于收集目的变更和用户撤销同意后再次重新使用的场景都需要用户重新同意。隐私声明变更和撤销的示例如下图: **图 2** 隐私通知/声明变更示例图 - ![](figures/4-隐私声明变更通知.png) + ![](figure/4-隐私声明变更通知.png) **图 3** 撤销同意示例图 - ![](figures/6-1-隐私声明撤销.png) ![](figures/6-2-隐私声明撤销.png) + ![](figure/6-1-隐私声明撤销.png) ![](figure/6-2-隐私声明撤销.png) - 需要提供用户查看隐私声明的入口。例如,可以在应用的“关于”界面提供查看隐私声明的入口,如示例图所示: **图 4** 隐私声明查看界面示例图 - ![](figures/5-应用隐私声明入口.png) + ![](figure/5-应用隐私声明入口.png) **数据收集及使用最小化** @@ -184,7 +184,7 @@ **图 5** 敏感权限提示框示例图 - ![](figures/1-敏感权限弹窗.png) + ![](figure/1-敏感权限弹窗.png) - 用户可以修改、取消授予的权限:当用户不同意某一权限或者数据收集时,应当允许用户使用与这部分权限和数据收集不相关的功能。如智慧屏产品上通信社交应用,用户可以拒绝授予相机权限,不应该影响与相机无关的功能操作,如语音通话。 - 用户在产品使用过程中,针对录入个人数据的场景,需要给用户提供对个人数据的增加、删除、修改、查看的操作。 @@ -195,9 +195,9 @@ 从技术上保证数据处理活动的安全性,包括个人数据的加密存储、安全传输等安全机制,系统应默认开启或采取安全保护措施。 -- 对于个人数据的访问需要有保护机制,主要包括身份认证和访问控制。身份认证(如用户名、密码)限定只有经过认证的用户才能访问数据,可应用于多用户场景;访问控制(如[权限控制](安全指南.md#li201725506375))可应用于对应用程序的限制。 +- 对于个人数据的访问需要有保护机制,主要包括身份认证和访问控制。身份认证(如用户名、密码)限定只有经过认证的用户才能访问数据,可应用于多用户场景;访问控制(如[权限控制](safety-safeguide-security.md#li201725506375))可应用于对应用程序的限制。 - 分布式设备个人数据安全存储要满足密钥管理和存储服务(HUKS:Huawei Universal Keystore)的要求,包括:密钥安全存储、数据安全存储。 -- 个人数据在分布式设备间传输要满足设备间的信任绑定关系和数据传输通道的安全性要求。详细信息可以参考[设备互联安全](安全指南.md#section26153183616)。 +- 个人数据在分布式设备间传输要满足设备间的信任绑定关系和数据传输通道的安全性要求。详细信息可以参考[设备互联安全](safety-safeguide-security.md#section26153183616)。 - 认证凭证数据(密码、口令、指纹等)须加密存储。 **本地化处理** diff --git "a/zh-cn/device-dev/security/\345\256\211\345\205\250\346\214\207\345\215\227.md" b/zh-cn/device-dev/security/safety-safeguide-security.md old mode 100755 new mode 100644 similarity index 96% rename from "zh-cn/device-dev/security/\345\256\211\345\205\250\346\214\207\345\215\227.md" rename to zh-cn/device-dev/security/safety-safeguide-security.md index c387b9a68e6fd35a272c442f521842e8410c009a..63804f366b4110c67b0b87ced8b24aea03dbf220 --- "a/zh-cn/device-dev/security/\345\256\211\345\205\250\346\214\207\345\215\227.md" +++ b/zh-cn/device-dev/security/safety-safeguide-security.md @@ -2,18 +2,22 @@ - [安全概述](#section1521410017353) - [硬件安全](#section2558121318351) -- [安全机制](#section1312953842210) -- [推荐做法](#section37901319112311) + - [安全机制](#section1399511541896) + - [推荐做法](#section948519243104) + - [系统安全](#section87802111361) -- [安全机制](#section1654963052914) -- [推荐做法](#section45821048173613) + - [安全机制](#section149107611118) + - [推荐做法](#section1364122019112) + - [数据安全](#section2468927364) -- [安全机制](#section11192175813293) -- [推荐做法](#section174640713306) + - [安全机制](#section1378993720111) + - [推荐做法](#section1531735481112) + - [设备互联安全](#section26153183616) - [应用安全](#section852593153614) -- [安全机制](#section12125105014377) -- [推荐做法](#section1641420155381) + - [安全机制](#section55012136125) + - [推荐做法](#section6341102610123) + ## 安全概述 @@ -22,11 +26,11 @@ OpenHarmony操作系统是一个开放的系统,开发者可以通过OpenHarmo 在这个执行环境中,芯片的安全能力、系统的安全能力、以及上层的安全服务一起协作,从硬件安全、系统安全、数据安全、设备互联安全、应用安全、安全更新多个维度提供安全保障。 **图 1** 安全保障示意图 -![](figures/安全保障示意图.png "安全保障示意图") +![](figure/安全保障示意图.png "安全保障示意图") ## 硬件安全 -## 安全机制 +### 安全机制 - 启动可信根 @@ -53,7 +57,7 @@ OpenHarmony操作系统是一个开放的系统,开发者可以通过OpenHarmo OpenHarmony设备支持硬件密钥引擎,支撑OpenHarmony系统进行数据加解密、证书验签、哈希计算等计算任务,可支持AES/RSA等主流的密码学算法。 -## 推荐做法 +### 推荐做法 - 启动可信根可由一段固化在芯片中的代码和设备根密钥组成,前者一般在芯片制造阶段写入,设备生命周期内不可更改,负责在启动阶段校验设备软件证书;后者则是用于设备证书签名的私钥相对应的公钥,证书签名私钥不出PKI签名服务器,而公钥则需写入设备。为防止攻击者篡改公钥从而达到绕过签名认证的目的,写入OpenHarmony设备的公钥须确保不可篡改,可将公钥信息写入如熔丝等介质;考虑到熔丝空间有限,可仅存储公钥的哈希值,并由启动代码校验公钥的合法性。 - 可信执行环境较为通用的做法是基于ARM TrustZone技术构建,也可根据设备的实际形态选择其他隔离机制,如TrustZone-M、独立安全核等;可信执行环境中须部署TEE OS,用于管理可信执行环境的资源及任务调度。OpenHarmony系统提供iTrustee作为TEE OS的解决方案,开发者及设备商可基于iTrustee开发并部署安全业务。 @@ -64,7 +68,7 @@ OpenHarmony操作系统是一个开放的系统,开发者可以通过OpenHarmo ## 系统安全 -## 安全机制 +### 安全机制 对于128KB\~128MB内存的设备,推荐使用OpenHarmony轻内核组件,在该内核下: @@ -85,7 +89,7 @@ OpenHarmony操作系统是一个开放的系统,开发者可以通过OpenHarmo 下图描述了DAC在文件访问时的鉴权过程,首先匹配进程uid和文件uid属性,其次匹配进程gid和文件gid属性,最后都匹配失败的情况,判断文件other属性是否支持进程的读、写、执行操作。同时支持忽略DAC检测机制(读、写、执行)作为一组系统特权(Capability),支持高权限(如系统服务)对低权限(三方APP)的文件管理。 **图 2** DAC流程图 - ![](figures/DAC流程图.png "DAC流程图") + ![](figure/DAC流程图.png "DAC流程图") - Capability机制 @@ -98,19 +102,19 @@ OpenHarmony操作系统是一个开放的系统,开发者可以通过OpenHarmo 在芯片上电后,由于片上ROM代码本身不可更改,因此无需校验;片上ROM基于eFuse中的非对称算法公钥hash对bootloader进行校验。这些过程都基于硬件信任根来进行,是完全可信的。经过此过程校验通过的bootloader模块可以作为后续的信任基础,此过程就是启动信任链的构造过程。Bootloader通常首先对执行环境进行一定的初始化,主要是初始化DDR以及flash读写,为进一步加载后续模块以及执行更为复杂的逻辑进行准备。Bootloader完成初始化动作后,首先完成x509证书的完整性校验,然后利用x509证书的公钥对需要校验的镜像包(kernel.bin、teeOS.bin、rootfs.bin)进行校验。 -## 推荐做法 +### 推荐做法 - 自主访问控制和Capability机制是控制资源被谁可以访问的机制,建议所有权限设置都采用最小权限原则。 - 安全启动必须要开启,信任根必须是基于芯片的不可更改的形式存在,并且在有安全升级的情况下,必须考虑安全升级后对于安全启动的影响,也就是安全升级后必须要更新对应镜像文件的签名信息或者hash值。 ## 数据安全 -## 安全机制 +### 安全机制 HUKS(Huawei Universal Keystore Service),提供了密钥管理、证书管理服务,当前在OpenHarmony上主要提供密钥管理服务,用于支撑HiChain\(设备身份认证平台\)的基础设备认证。如下是HUKS的功能结构图: **图 3** HUKS功能结构图 -![](figures/HUKS功能结构图.png "HUKS功能结构图") +![](figure/HUKS功能结构图.png "HUKS功能结构图") 支持算法包括: @@ -126,7 +130,7 @@ HUKS在使用中有如下约束: - 密钥访问安全:OpenHarmony通过将不同应用数据保存在不同的位置,来实现应用间数据的隔离。通过参数结构体中包含UID和进程ID,来实现不同应用间的数据隔离。 - 不支持并发访问:HUKS本身不考虑多个应用同时调用的情况,因为HUKS只是一个lib库,也不考虑资源的互斥。如果有多个应用都会用到HUKS服务,那么应该由每个应用各自链接一份HUKS库,并由业务传入持久化数据存储的路径,以实现应用间的数据存储分开。数据存储在各应用各自存储目录下。 -## 推荐做法 +### 推荐做法 对于设备认证功能,建议使用HiChain来对接HUKS,HUKS可以向HiChain等应用提供密钥的产生、导入、导出、加密/解密、存储、销毁,证书的导入和查询,秘密信息的存储等能力。 @@ -135,7 +139,7 @@ HUKS在使用中有如下约束: 为了实现用户数据在设备互联场景下在各个设备之间的安全流转,需要保证设备之间相互正确可信,即设备和设备之间建立信任关系,并能够在验证信任关系后,搭建安全的连接通道,实现用户数据的安全传输。设备之间的信任关系在本文档中涉及IoT主控设备和IoT设备之间建立的可信关系。设备间可信关系建立的流程如下图所示: **图 4** 设备间建立可信关系流程图 -![](figures/设备间建立可信关系流程图.png "设备间建立可信关系流程图") +![](figure/设备间建立可信关系流程图.png "设备间建立可信关系流程图") - **IoT设备互联安全** @@ -168,7 +172,7 @@ HUKS在使用中有如下约束: ## 应用安全 -## 安全机制 +### 安全机制 - 应用签名管控 @@ -265,7 +269,7 @@ HUKS在使用中有如下约束:
-## 推荐做法 +### 推荐做法 开发者在开发过程中需明确后续应用在运行时需要运行哪些权限,并在profile.json中进行注册,然后需要对应用进行签名,确保设备在安装这些应用时能对应用的完整性和来源进行校验。 diff --git a/zh-cn/device-dev/security/safety.md b/zh-cn/device-dev/security/safety.md new file mode 100644 index 0000000000000000000000000000000000000000..72bbe83ac0cf5052a2b1b53ce27b380ef390b963 --- /dev/null +++ b/zh-cn/device-dev/security/safety.md @@ -0,0 +1,7 @@ +# 隐私与安全 + +- **[隐私保护](safety-protection-privacyguide.md)** + +- **[安全指南](safety-safeguide-security.md)** + + diff --git a/zh-cn/device-dev/subsystems/DFX.md b/zh-cn/device-dev/subsystems/DFX.md deleted file mode 100755 index e5f00a7203adb883c359ee2b11eb1b56c60d7173..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/DFX.md +++ /dev/null @@ -1,11 +0,0 @@ -# DFX - -- **[DFX概述](DFX概述.md)** - -- **[HiLog开发指导](HiLog开发指导.md)** - -- **[HiLog\_Lite开发指导](HiLog_Lite开发指导.md)** - -- **[HiSysEvent开发指导](HiSysEvent开发指导.md)** - - diff --git a/zh-cn/device-dev/subsystems/Readme-CN.md b/zh-cn/device-dev/subsystems/Readme-CN.md index 3032d57b57d4c11908aae5e450f92382b11bd886..843563ec81e16ad3c87a21e020cc28bca5b3a5fb 100755 --- a/zh-cn/device-dev/subsystems/Readme-CN.md +++ b/zh-cn/device-dev/subsystems/Readme-CN.md @@ -1,96 +1,78 @@ -# 子系统 - -- [编译构建](编译构建.md) - - [轻量和小型系统编译构建指导](轻量和小型系统编译构建指导.md) - - [编译构建概述](编译构建概述.md) - - [编译构建使用指导](编译构建使用指导.md) - - [编译构建常见问题](编译构建常见问题.md) - - - [标准系统编译构建指导](标准系统编译构建指导.md) - - [编译构建概述](编译构建概述-0.md) - - [编译构建使用指导](编译构建使用指导-1.md) - -- [分布式远程启动](分布式远程启动.md) -- [图形图像](图形图像.md) - - [图形图像概述](图形图像概述.md) - - [容器类组件开发指导](容器类组件开发指导.md) - - [布局容器类组件开发指导](布局容器类组件开发指导.md) - - [普通组件开发指导](普通组件开发指导.md) - - [动画开发指导](动画开发指导.md) - -- [媒体](媒体.md) - - [相机](相机.md) - - [相机开发概述](相机开发概述.md) - - [拍照开发指导](拍照开发指导.md) - - [录像开发指导](录像开发指导.md) - - [预览开发指导](预览开发指导.md) - - - [音视频](音视频.md) - - [音视频开发概述](音视频开发概述.md) - - [音视频播放开发指导](音视频播放开发指导.md) - - [音视频录制开发指导](音视频录制开发指导.md) - -- [公共基础](公共基础.md) - - [公共基础库概述](公共基础库概述.md) - - [公共基础库开发指导](公共基础库开发指导.md) - - [公共基础库常见问题](公共基础库常见问题.md) - -- [AI框架](AI框架.md) - - [AI引擎框架开发指南](AI引擎框架开发指南.md) - - [搭建环境](搭建环境.md) - - [技术规范](技术规范.md) - - [代码管理规范](代码管理规范.md) - - [命名规范](命名规范.md) - - [接口开发规范](接口开发规范.md) - - - [开发指导](开发指导.md) - - [SDK开发过程](SDK开发过程.md) - - [插件的开发过程](插件的开发过程.md) - - [配置文件的开发过程](配置文件的开发过程.md) - - - [开发示例](开发示例.md) - - [唤醒词识别SDK的开发示例](唤醒词识别SDK的开发示例.md) - - [唤醒词识别插件的开发示例](唤醒词识别插件的开发示例.md) - - [唤醒词识别配置文件的开发示例](唤醒词识别配置文件的开发示例.md) - -- [Sensor服务](Sensor服务.md) - - [Sensor服务子系概述](Sensor服务子系概述.md) - - [Sensor服务子系使用指导](Sensor服务子系使用指导.md) - - [Sensor服务子系使用实例](Sensor服务子系使用实例.md) - -- [用户程序框架](用户程序框架.md) - - [概述](概述.md) - - [搭建环境](搭建环境-2.md) - - [开发指导](开发指导-3.md) - - [开发实例](开发实例.md) - -- [OTA升级](OTA升级.md) - -- [安全](安全.md) - - [概述](概述-7.md) - - [应用验签开发指导](应用验签开发指导.md) - - [应用权限管理开发指导](应用权限管理开发指导.md) - - [IPC通信鉴权开发指导](IPC通信鉴权开发指导.md) - -- [启动恢复](启动恢复.md) - - [启动恢复子系统概述](启动恢复子系统概述.md) - - [init启动引导组件](init启动引导组件.md) - - [appspawn应用孵化组件](appspawn应用孵化组件.md) - - [bootstrap服务启动组件](bootstrap服务启动组件.md) - - [syspara系统属性组件](syspara系统属性组件.md) - - [常见问题](常见问题.md) - - [参考](参考.md) - -- [测试](测试.md) -- [DFX](DFX.md) - - [DFX概述](DFX概述.md) - - [HiLog开发指导](HiLog开发指导.md) - - [HiLog\_Lite开发指导](HiLog_Lite开发指导.md) - - [HiSysEvent开发指导](HiSysEvent开发指导.md) - -- [研发工具链](研发工具链.md) - - [bytrace使用指导](bytrace使用指导.md) - - [hdc\_std 使用指导](hdc_std-使用指导.md) - -- [XTS认证子系统开发指南](XTS认证子系统开发指南.md) +# 子系统开发指南 + +- [编译构建](subsys-build.md) + - [轻量和小型系统编译构建指导](subsys-build-mini-lite.md) + - [标准系统编译构建指导](subsys-build-standard-large.md) +- [分布式远程启动](subsys-remote-start.md) +- [图形图像](subsys-graphics.md) + - [图形图像概述](subsys-graphics-overview.md) + - [容器类组件开发指导](subsys-graphics-bundle-guide1.md) + - [布局容器类组件开发指导](subsys-graphics-bundle-guide2.md) + - [普通组件开发指导](subsys-graphics-bundle-guide3.md) + - [动画开发指导](subsys-graphics-animation-guide.md) +- [媒体](subsys-multimedia.md) + - [相机](subsys-multimedia-camera.md) + - [相机开发概述](subsys-multimedia-camera-overview.md) + - [拍照开发指导](subsys-multimedia-camera-photo-guide.md) + - [录像开发指导](subsys-multimedia-camera-record-guide.md) + - [预览开发指导](subsys-multimedia-camera-preview-guide.md) + + - [音视频](subsys-multimedia-video.md) + - [音视频开发概述](subsys-multimedia-video-overview.md) + - [音视频播放开发指导](subsys-multimedia-video-play-guide.md) + - [音视频录制开发指导](subsys-multimedia-video-record-guide.md) +- [公共基础](subsys-utils.md) + - [公共基础库概述](subsys-utils-overview.md) + - [公共基础库开发指导](subsys-utils-guide.md) + - [公共基础库常见问题](subsys-utils-faqs.md) +- [AI框架](subsys-aiframework.md) + - [AI引擎框架开发指南](subsys-aiframework-guide.md) + - [搭建环境](subsys-aiframework-envbuild.md) + - [技术规范](subsys-aiframework-tech.md) + - [代码管理规范](subsys-aiframework-tech-codemanage.md) + - [命名规范](subsys-aiframework-tech-name.md) + - [接口开发规范](subsys-aiframework-tech-interface.md) + + - [开发指导](subsys-aiframework-devguide.md) + - [SDK开发过程](subsys-aiframework-devguide-sdk.md) + - [插件的开发过程](subsys-aiframework-devguide-plugin.md) + - [配置文件的开发过程](subsys-aiframework-devguide-conf.md) + + - [开发示例](subsys-aiframework-demo.md) + - [唤醒词识别SDK的开发示例](subsys-aiframework-demo-sdk.md) + - [唤醒词识别插件的开发示例](subsys-aiframework-demo-plugin.md) + - [唤醒词识别配置文件的开发示例](subsys-aiframework-demo-conf.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) + - [开发指导](subsys-application-framework-guide.md) + - [开发实例](subsys-application-framework-demo.md) +- [OTA升级](subsys-ota-guide.md) +- [安全](subsys-security.md) + - [概述](subsys-security-overview.md) + - [应用验签开发指导](subsys-security-sigverify.md) + - [应用权限管理开发指导](subsys-security-rightmanagement.md) + - [IPC通信鉴权开发指导](subsys-security-communicationverify.md) +- [启动恢复](subsys-boot.md) + - [启动恢复子系统概述](subsys-boot-overview.md) + - [init启动引导组件](subsys-boot-init.md) + - [appspawn应用孵化组件](subsys-boot-appspawn.md) + - [bootstrap服务启动组件](subsys-boot-bootstrap.md) + - [syspara系统属性组件](subsys-boot-syspara.md) + - [常见问题](subsys-boot-faqs.md) + - [参考](subsys-boot-ref.md) +- [测试](subsys-testguide-test.md) +- [DFX](subsys-dfx.md) + - [DFX概述](subsys-dfx-overview.md) + - [HiLog开发指导](subsys-dfx-hilog-rich.md) + - [HiLog\_Lite开发指导](subsys-dfx-hilog-lite.md) + - [HiSysEvent开发指导](subsys-dfx-hisysevent.md) +- [研发工具链](subsys-toolchain.md) + - [bytrace使用指导](subsys-toolchain-bytrace-guide.md) + - [hdc\_std 使用指导](subsys-toolchain-hdc-guide.md) +- [XTS认证子系统开发指南](subsys-xts-guide.md) diff --git "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241.md" "b/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241.md" deleted file mode 100755 index 35dd6eab91788b22712d1b005b27b182a8333da0..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241.md" +++ /dev/null @@ -1,9 +0,0 @@ -# Sensor服务 - -- **[Sensor服务子系概述](Sensor服务子系概述.md)** - -- **[Sensor服务子系使用指导](Sensor服务子系使用指导.md)** - -- **[Sensor服务子系使用实例](Sensor服务子系使用实例.md)** - - diff --git a/zh-cn/device-dev/subsystems/figures/20200721-223604(eSpace).gif b/zh-cn/device-dev/subsystems/figure/20200721-223604(eSpace).gif old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/20200721-223604(eSpace).gif rename to zh-cn/device-dev/subsystems/figure/20200721-223604(eSpace).gif diff --git "a/zh-cn/device-dev/subsystems/figures/Ability\344\270\216AbilitySlice\347\232\204\345\205\263\347\263\273\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/Ability\344\270\216AbilitySlice\347\232\204\345\205\263\347\263\273\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/Ability\344\270\216AbilitySlice\347\232\204\345\205\263\347\263\273\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/Ability\344\270\216AbilitySlice\347\232\204\345\205\263\347\263\273\345\233\276.png" diff --git "a/zh-cn/device-dev/subsystems/figures/Ability\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/Ability\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/Ability\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/Ability\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" diff --git "a/zh-cn/device-dev/subsystems/figures/Ability\347\256\241\347\220\206\346\234\215\345\212\241\345\222\214\345\214\205\347\256\241\347\220\206\346\234\215\345\212\241\345\220\257\345\212\250.png" "b/zh-cn/device-dev/subsystems/figure/Ability\347\256\241\347\220\206\346\234\215\345\212\241\345\222\214\345\214\205\347\256\241\347\220\206\346\234\215\345\212\241\345\220\257\345\212\250.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/Ability\347\256\241\347\220\206\346\234\215\345\212\241\345\222\214\345\214\205\347\256\241\347\220\206\346\234\215\345\212\241\345\220\257\345\212\250.png" rename to "zh-cn/device-dev/subsystems/figure/Ability\347\256\241\347\220\206\346\234\215\345\212\241\345\222\214\345\214\205\347\256\241\347\220\206\346\234\215\345\212\241\345\220\257\345\212\250.png" diff --git "a/zh-cn/device-dev/subsystems/figures/LiteOS-A\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" "b/zh-cn/device-dev/subsystems/figure/LiteOS-A\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/LiteOS-A\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" rename to "zh-cn/device-dev/subsystems/figure/LiteOS-A\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" diff --git "a/zh-cn/device-dev/subsystems/figures/LiteOS-M\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" "b/zh-cn/device-dev/subsystems/figure/LiteOS-M\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/LiteOS-M\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" rename to "zh-cn/device-dev/subsystems/figure/LiteOS-M\345\271\263\345\217\260dump\347\263\273\347\273\237\345\261\236\346\200\247\350\276\223\345\207\272.png" diff --git "a/zh-cn/device-dev/subsystems/figures/UIButton\347\202\271\345\207\273\346\225\210\346\236\234.gif" "b/zh-cn/device-dev/subsystems/figure/UIButton\347\202\271\345\207\273\346\225\210\346\236\234.gif" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/UIButton\347\202\271\345\207\273\346\225\210\346\236\234.gif" rename to "zh-cn/device-dev/subsystems/figure/UIButton\347\202\271\345\207\273\346\225\210\346\236\234.gif" diff --git "a/zh-cn/device-dev/subsystems/figures/ViewGroup\346\267\273\345\212\240view\345\256\236\344\276\213\346\225\210\346\236\234\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/ViewGroup\346\267\273\345\212\240view\345\256\236\344\276\213\346\225\210\346\236\234\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/ViewGroup\346\267\273\345\212\240view\345\256\236\344\276\213\346\225\210\346\236\234\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/ViewGroup\346\267\273\345\212\240view\345\256\236\344\276\213\346\225\210\346\236\234\345\233\276.png" diff --git a/zh-cn/device-dev/subsystems/figures/unnaming.png b/zh-cn/device-dev/subsystems/figure/unnaming.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/unnaming.png rename to zh-cn/device-dev/subsystems/figure/unnaming.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001051782526.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001051782526.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001051782526.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001051782526.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052582522.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052582522.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052582522.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052582522.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052662559.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052662559.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052662559.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052662559.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052782555.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052782555.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052782555.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052782555.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052942531.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052942531.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001052942531.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001052942531.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001053207924.gif b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001053207924.gif old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001053207924.gif rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001053207924.gif diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001053247975.gif b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001053247975.gif old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001053247975.gif rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001053247975.gif diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001054101094.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001054101094.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001054101094.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001054101094.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001054421113.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001054421113.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001054421113.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001054421113.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001059334449.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001059334449.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001059334449.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001059334449.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001060200050.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001060200050.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001060200050.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001060200050.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001061889268.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001061889268.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001061889268.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001061889268.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001062334618.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001062334618.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001062334618.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001062334618.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001062476933.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001062476933.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001062476933.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001062476933.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001062942690.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001062942690.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001062942690.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001062942690.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001063839940.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001063839940.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001063839940.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001063839940.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001077724150.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001077724150.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001077724150.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001077724150.png diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001077727032.png b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001077727032.png old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001077727032.png rename to zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001077727032.png diff --git a/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001119924146.gif b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001119924146.gif new file mode 100644 index 0000000000000000000000000000000000000000..9cd37267672d3bea422b98d95c413e26df330de8 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001119924146.gif differ diff --git a/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001166643927.jpg b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001166643927.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ace4cefd36637675f235df3cd596eca3ed218e6c Binary files /dev/null and b/zh-cn/device-dev/subsystems/figure/zh-cn_image_0000001166643927.jpg differ diff --git "a/zh-cn/device-dev/subsystems/figures/\345\212\250\347\224\273\345\256\236\347\216\260\346\225\210\346\236\234\345\233\276.gif" "b/zh-cn/device-dev/subsystems/figure/\345\212\250\347\224\273\345\256\236\347\216\260\346\225\210\346\236\234\345\233\276.gif" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\345\212\250\347\224\273\345\256\236\347\216\260\346\225\210\346\236\234\345\233\276.gif" rename to "zh-cn/device-dev/subsystems/figure/\345\212\250\347\224\273\345\256\236\347\216\260\346\225\210\346\236\234\345\233\276.gif" diff --git "a/zh-cn/device-dev/subsystems/figures/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\345\233\276\347\211\2071.png" "b/zh-cn/device-dev/subsystems/figure/\345\233\276\347\211\2071.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\345\233\276\347\211\2071.png" rename to "zh-cn/device-dev/subsystems/figure/\345\233\276\347\211\2071.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" "b/zh-cn/device-dev/subsystems/figure/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" rename to "zh-cn/device-dev/subsystems/figure/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\345\271\263\351\223\272\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/\345\271\263\351\223\272\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\345\271\263\351\223\272\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/\345\271\263\351\223\272\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\345\272\224\347\224\250\345\220\257\345\212\250\346\265\201\347\250\213.png" "b/zh-cn/device-dev/subsystems/figure/\345\272\224\347\224\250\345\220\257\345\212\250\346\265\201\347\250\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\345\272\224\347\224\250\345\220\257\345\212\250\346\265\201\347\250\213.png" rename to "zh-cn/device-dev/subsystems/figure/\345\272\224\347\224\250\345\220\257\345\212\250\346\265\201\347\250\213.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" "b/zh-cn/device-dev/subsystems/figure/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" rename to "zh-cn/device-dev/subsystems/figure/\346\217\222\344\273\266\344\276\235\350\265\226-(2).jpg" diff --git "a/zh-cn/device-dev/subsystems/figures/\346\231\256\351\200\232\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\347\273\223\346\236\204.png" "b/zh-cn/device-dev/subsystems/figure/\346\231\256\351\200\232\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\347\273\223\346\236\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\346\231\256\351\200\232\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\347\273\223\346\236\204.png" rename to "zh-cn/device-dev/subsystems/figure/\346\231\256\351\200\232\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\347\273\223\346\236\204.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\346\231\256\351\200\232\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204.png" "b/zh-cn/device-dev/subsystems/figure/\346\231\256\351\200\232\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\346\231\256\351\200\232\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204.png" rename to "zh-cn/device-dev/subsystems/figure/\346\231\256\351\200\232\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\346\260\264\345\271\263-\345\236\202\347\233\264\346\226\271\345\220\221\345\217\257\346\273\221\345\212\250\346\225\210\346\236\234\345\233\276.gif" "b/zh-cn/device-dev/subsystems/figure/\346\260\264\345\271\263-\345\236\202\347\233\264\346\226\271\345\220\221\345\217\257\346\273\221\345\212\250\346\225\210\346\236\234\345\233\276.gif" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\346\260\264\345\271\263-\345\236\202\347\233\264\346\226\271\345\220\221\345\217\257\346\273\221\345\212\250\346\225\210\346\236\234\345\233\276.gif" rename to "zh-cn/device-dev/subsystems/figure/\346\260\264\345\271\263-\345\236\202\347\233\264\346\226\271\345\220\221\345\217\257\346\273\221\345\212\250\346\225\210\346\236\234\345\233\276.gif" diff --git "a/zh-cn/device-dev/subsystems/figures/\346\265\213\350\257\225\345\271\263\345\217\260\346\236\266\346\236\204.png" "b/zh-cn/device-dev/subsystems/figure/\346\265\213\350\257\225\345\271\263\345\217\260\346\236\266\346\236\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\346\265\213\350\257\225\345\271\263\345\217\260\346\236\266\346\236\204.png" rename to "zh-cn/device-dev/subsystems/figure/\346\265\213\350\257\225\345\271\263\345\217\260\346\236\266\346\236\204.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\346\265\213\350\257\225\345\271\263\345\217\260\350\277\220\350\241\214\346\227\266\345\272\217.png" "b/zh-cn/device-dev/subsystems/figure/\346\265\213\350\257\225\345\271\263\345\217\260\350\277\220\350\241\214\346\227\266\345\272\217.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\346\265\213\350\257\225\345\271\263\345\217\260\350\277\220\350\241\214\346\227\266\345\272\217.png" rename to "zh-cn/device-dev/subsystems/figure/\346\265\213\350\257\225\345\271\263\345\217\260\350\277\220\350\241\214\346\227\266\345\272\217.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204\347\244\272\346\204\217\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204\347\244\272\346\204\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204\347\244\272\346\204\217\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/\347\273\204\344\273\266\346\240\221\347\273\223\346\236\204\347\244\272\346\204\217\345\233\276.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\347\274\226\350\257\221\346\236\204\345\273\272\346\265\201\347\250\213.jpg" "b/zh-cn/device-dev/subsystems/figure/\347\274\226\350\257\221\346\236\204\345\273\272\346\265\201\347\250\213.jpg" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\347\274\226\350\257\221\346\236\204\345\273\272\346\265\201\347\250\213.jpg" rename to "zh-cn/device-dev/subsystems/figure/\347\274\226\350\257\221\346\236\204\345\273\272\346\265\201\347\250\213.jpg" diff --git "a/zh-cn/device-dev/subsystems/figures/\350\207\252\351\200\202\345\272\224\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/\350\207\252\351\200\202\345\272\224\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\350\207\252\351\200\202\345\272\224\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" rename to "zh-cn/device-dev/subsystems/figure/\350\207\252\351\200\202\345\272\224\346\250\241\345\274\217\345\233\276\347\211\207\346\225\210\346\236\234\345\233\276.png" diff --git "a/zh-cn/device-dev/subsystems/figures/\350\256\276\347\275\2562-2\347\275\221\346\240\274\345\271\266\346\267\273\345\212\2404\344\270\252button\347\273\204\344\273\266\350\277\233\350\241\214\345\270\203\345\261\200.png" "b/zh-cn/device-dev/subsystems/figure/\350\256\276\347\275\2562-2\347\275\221\346\240\274\345\271\266\346\267\273\345\212\2404\344\270\252button\347\273\204\344\273\266\350\277\233\350\241\214\345\270\203\345\261\200.png" old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/figures/\350\256\276\347\275\2562-2\347\275\221\346\240\274\345\271\266\346\267\273\345\212\2404\344\270\252button\347\273\204\344\273\266\350\277\233\350\241\214\345\270\203\345\261\200.png" rename to "zh-cn/device-dev/subsystems/figure/\350\256\276\347\275\2562-2\347\275\221\346\240\274\345\271\266\346\267\273\345\212\2404\344\270\252button\347\273\204\344\273\266\350\277\233\350\241\214\345\270\203\345\261\200.png" diff --git a/zh-cn/device-dev/subsystems/figures/RIL-Adapter.png b/zh-cn/device-dev/subsystems/figures/RIL-Adapter.png deleted file mode 100644 index eb3a5f511cb246a0c250a0dc76150b8816f4394b..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/figures/RIL-Adapter.png and /dev/null differ diff --git "a/zh-cn/device-dev/subsystems/figures/\345\216\273\347\224\265.png" "b/zh-cn/device-dev/subsystems/figures/\345\216\273\347\224\265.png" deleted file mode 100755 index 6d8841ed7cd427e5f3d091f8d3261bc38c297bbf..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/subsystems/figures/\345\216\273\347\224\265.png" and /dev/null differ diff --git "a/zh-cn/device-dev/subsystems/figures/\346\235\245\347\224\265.png" "b/zh-cn/device-dev/subsystems/figures/\346\235\245\347\224\265.png" deleted file mode 100644 index f666f21d1575a00e928c99afb29a7aca8c26e641..0000000000000000000000000000000000000000 Binary files "a/zh-cn/device-dev/subsystems/figures/\346\235\245\347\224\265.png" and /dev/null differ diff --git "a/zh-cn/device-dev/subsystems/hdc_std\345\270\270\350\247\201\351\227\256\351\242\230.md" "b/zh-cn/device-dev/subsystems/hdc_std\345\270\270\350\247\201\351\227\256\351\242\230.md" deleted file mode 100644 index 3f83fba3e9943bb252fec4fc273a197c3fcd9ec7..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/hdc_std\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ /dev/null @@ -1,39 +0,0 @@ -# hdc\_std常见问题 - -- [hdc\_std连接不到设备](#section1221016541119) -- [hdc\_std运行不了](#section219185710311) - -## hdc\_std连接不到设备 - -- **现象描述** - - 执行 "hdc\_std list targets"命令后结果为:\[Empty\] - -- **可能原因和解决方法** - 1. 设备没有被识别: - - 在设备管理器中查看是否有hdc设备,在通用串行总线设备中会有“HDC Device”信息。如果没有,hdc无法连接。此时需要插拔设备,或者烧写最新的镜像。 - - 2. hdc\_std工作异常: - - 可以执行"hdc kill"或者"hdc start -r"杀掉hdc服务或者重启hdc服务,然后再执行hdc list targets查看是否已经可以获取设备信息。 - - 如果一直获取不到设备信息,请在任务管理器中查询是否有adb进程,该进程可能会对hdc产生干扰,可以将其杀掉后重复执行上面的步骤。 - - 3. hdc\_std与设备不匹配: - - 如果设备烧写的是最新镜像,hdc\_std也需要使用最新版本。由于hdc\_std会持续更新,请从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录。 - - - -## hdc\_std运行不了 - -- **现象描述** - - 点击hdc\_std.exe文件无法运行。 - -- **可能原因和解决方法** - - hdc\_std.exe不需要安装,直接放到磁盘上就能使用,也可以添加到环境变量中。通过打开cmd执行hdc\_std命令直接使用。 - - diff --git a/zh-cn/device-dev/subsystems/public_sys-resources/icon-caution.gif b/zh-cn/device-dev/subsystems/public_sys-resources/icon-caution.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/public_sys-resources/icon-caution.gif and /dev/null differ diff --git a/zh-cn/device-dev/subsystems/public_sys-resources/icon-danger.gif b/zh-cn/device-dev/subsystems/public_sys-resources/icon-danger.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/public_sys-resources/icon-danger.gif and /dev/null differ diff --git a/zh-cn/device-dev/subsystems/public_sys-resources/icon-note.gif b/zh-cn/device-dev/subsystems/public_sys-resources/icon-note.gif deleted file mode 100755 index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/public_sys-resources/icon-note.gif and /dev/null differ diff --git a/zh-cn/device-dev/subsystems/public_sys-resources/icon-notice.gif b/zh-cn/device-dev/subsystems/public_sys-resources/icon-notice.gif deleted file mode 100755 index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/public_sys-resources/icon-notice.gif and /dev/null differ diff --git a/zh-cn/device-dev/subsystems/public_sys-resources/icon-tip.gif b/zh-cn/device-dev/subsystems/public_sys-resources/icon-tip.gif deleted file mode 100755 index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/public_sys-resources/icon-tip.gif and /dev/null differ diff --git a/zh-cn/device-dev/subsystems/public_sys-resources/icon-warning.gif b/zh-cn/device-dev/subsystems/public_sys-resources/icon-warning.gif deleted file mode 100755 index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/public_sys-resources/icon-warning.gif and /dev/null differ diff --git "a/zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253\351\205\215\347\275\256\346\226\207\344\273\266\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-conf.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253\351\205\215\347\275\256\346\226\207\344\273\266\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-demo-conf.md diff --git "a/zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253\346\217\222\344\273\266\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-plugin.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253\346\217\222\344\273\266\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-demo-plugin.md diff --git "a/zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253SDK\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253SDK\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md index c8f592b80cfa7aa2254c26bfbe1fcda8a14da699..795599d87226dbe1e7150574143f4b739c042c0f --- "a/zh-cn/device-dev/subsystems/\345\224\244\351\206\222\350\257\215\350\257\206\345\210\253SDK\347\232\204\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md @@ -75,7 +75,7 @@ 上述代码为API接口的具体实现,从上述示例的代码中,SDK中create接口的具体实现即为下述示例代码中create方法,该方法调用了AI引擎框架client端开放接口AieClientInit,AieClientPrepare,从而实现与server端建立连接及加载算法模型的能力。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >SDK调用AI引擎client端接口顺序应遵循AieClientInit-\>AieClientPrepare-\>AieClientSyncProcess/AieClientAsyncProcess-\>AieClientRelease-\>AieClientDestroy,否则调用接口会返回错误码。 diff --git "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\347\244\272\344\276\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-demo.md old mode 100755 new mode 100644 similarity index 72% rename from "zh-cn/device-dev/subsystems/\345\274\200\345\217\221\347\244\272\344\276\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-demo.md index 346b8a084afbb9645ee0436d39b12456a2b28625..054336dafd8be39390dfed958dc9d1576a3d297a --- "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\347\244\272\344\276\213.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-demo.md @@ -4,10 +4,10 @@ 本示例中唤醒词识别的场景中唤醒词是固定的,当开发者传入的音频包含”Hi,小问“,启动的应用就会打印"\[Hi, xiaowen\]",当不包含时,会打印'\[UNKNOWN\]"。 -- **[唤醒词识别SDK的开发示例](唤醒词识别SDK的开发示例.md)** +- **[唤醒词识别SDK的开发示例](subsys-aiframework-demo-sdk.md)** -- **[唤醒词识别插件的开发示例](唤醒词识别插件的开发示例.md)** +- **[唤醒词识别插件的开发示例](subsys-aiframework-demo-plugin.md)** -- **[唤醒词识别配置文件的开发示例](唤醒词识别配置文件的开发示例.md)** +- **[唤醒词识别配置文件的开发示例](subsys-aiframework-demo-conf.md)** diff --git "a/zh-cn/device-dev/subsystems/\351\205\215\347\275\256\346\226\207\344\273\266\347\232\204\345\274\200\345\217\221\350\277\207\347\250\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-conf.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\351\205\215\347\275\256\346\226\207\344\273\266\347\232\204\345\274\200\345\217\221\350\277\207\347\250\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-devguide-conf.md diff --git "a/zh-cn/device-dev/subsystems/\346\217\222\344\273\266\347\232\204\345\274\200\345\217\221\350\277\207\347\250\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-plugin.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\346\217\222\344\273\266\347\232\204\345\274\200\345\217\221\350\277\207\347\250\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-devguide-plugin.md diff --git "a/zh-cn/device-dev/subsystems/SDK\345\274\200\345\217\221\350\277\207\347\250\213.md" b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-sdk.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/subsystems/SDK\345\274\200\345\217\221\350\277\207\347\250\213.md" rename to zh-cn/device-dev/subsystems/subsys-aiframework-devguide-sdk.md index 83d933cdb5df36058c1726de5d289c88a9fb2fbb..ed8f624d68c07f4791327fc7b161a793a07e54a8 --- "a/zh-cn/device-dev/subsystems/SDK\345\274\200\345\217\221\350\277\207\347\250\213.md" +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-sdk.md @@ -126,8 +126,8 @@ SDK头文件的功能实现是基于对SDK的调用映射到对client的调用

long long clientVersion:客户端设备版本号(当前还未启用);

int clientId:客户端ID;

int sessionId:会话ID;

-

uid_t serverUid:server端UID;

-

uid_t clientUid:client端UID;

+

uid_t serverUid:server端UID;

+

uid_t clientUid:client端UID;

int extendLen:拓展信息(extendMsg)长度;

unsigned char *extendMsg:拓展信息主体;

+ + + + + + + + + + +

接口名

+

描述

+

int ISysEventService::AddListener(in SysEventRule[] rules, in ISysEventCallback callback)

+

接口功能:订阅HiSysEvent事件。

+

输入参数:

+
  • rules:事件订阅规则
  • callback:订阅回调对象
+

返回值:

+
  • 0:订阅成功,重复订阅
  • 1:订阅成功,初次订阅
  • 其他返回值:订阅失败
+

void ISysEventCallback::Handle(in String domain, in String eventName, in int eventType, in String eventDetail)

+

接口功能:订阅事件的回调接口。

+

输入参数:

+
  • domain:事件所属领域
  • eventName:事件的名称
  • eventType:事件类型
  • eventDetail:包含事件相关信息的字符串,以json的形式体现
+

返回值:无。

+
+ +**表 2** SysEventRule订阅规则对象 + + + + + + + + + + + + + + + + +

属性名称

+

描述

+

uint32_t ruleType

+

规则类型(匹配范围包括domain以及eventName):

+
  • 1:全字符匹配
  • 2:前缀匹配
  • 3:正则表达式匹配
  • 其他值:无效的匹配方式
+

std::string domain;

+
  • domain:事件所属领域,如果传入的是空字符串,则默认事件领域字段匹配成功
+

std::string eventName

+
  • eventName:事件的名称,如果传入的是空字符串,则默认事件名称字段匹配成功
+
+ +## 开发实例 + +1. 源代码开发: + + 引入对应的aidl文件,包括:ISysEventService.aidl、SysEventRule.aidl、ISysEventCallback.aidl。 + + 在相应的业务逻辑里面调用ISysEventService::AddListener\(in SysEventRule\[\] rules, in ISysEventCallback callback\)接口。 + + 实现对应的回调对象: + + ISysEventCallback::Handle\(in String domain, in String eventName, in int eventType, in String eventDetail\) + + +1. 源代码开发: + + 引入对应的aidl文件,包括:ISysEventService.aidl、SysEventRule.aidl、ISysEventCallback.aidl。 + + 在相应的业务逻辑里面调用ISysEventService::AddListener\(in SysEventRule\[\] rules, in ISysEventCallback callback\)接口。 + + 实现对应的回调对象: + + ISysEventCallback::Handle\(in String domain, in String eventName, in int eventType, in String eventDetail\) + +2. 编译设置: + +在编译子系统里面,需要依赖libbinder模块 + +aosp\_deps = \[ "shared\_library:libbinder", \] + +- **[bytrace使用指导](subsys-toolchain-bytrace-guide.md)** + +- **[hdc\_std 使用指导](subsys-toolchain-hdc-guide.md)** + + diff --git "a/zh-cn/device-dev/subsystems/DFX\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-dfx-overview.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/DFX\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-dfx-overview.md diff --git a/zh-cn/device-dev/subsystems/subsys-dfx.md b/zh-cn/device-dev/subsystems/subsys-dfx.md new file mode 100644 index 0000000000000000000000000000000000000000..e4538aa73f4121b6ffcae48694a247fe2b84ef31 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-dfx.md @@ -0,0 +1,11 @@ +# DFX + +- **[DFX概述](subsys-dfx-overview.md)** + +- **[HiLog开发指导](subsys-dfx-hilog-rich.md)** + +- **[HiLog\_Lite开发指导](subsys-dfx-hilog-lite.md)** + +- **[HiSysEvent开发指导](subsys-dfx-hisysevent.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-graphics-animation-guide.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-graphics-animation-guide.md index e58aed68c06c7bda4fa8491a80f6ff68f0b720ce..8332aa22bd87afd1e6d8e6dff632b189cc0c19ea --- "a/zh-cn/device-dev/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-graphics-animation-guide.md @@ -185,6 +185,6 @@ UI动画通过task处理机制每个tick调用一下用户设置的callback函 4. 点击下图下方的按钮,检查对应的动画运行效果。 **图 1** 动画实现效果图 - ![](figures/动画实现效果图.gif "动画实现效果图") + ![](figure/动画实现效果图.gif "动画实现效果图") diff --git "a/zh-cn/device-dev/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide1.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide1.md index 507ad3b1186829744ad660c5cd49f52eee5b9415..52da564931e3f8ff58c2e0379c98dbcbc993aa58 --- "a/zh-cn/device-dev/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide1.md @@ -12,7 +12,7 @@ 容器类组件,指能包含其它UI组件的组件,容器类组件继承于UIViewGroup(带Add方法),基于实际组件的使用场景,将需要增加其他子组件的组件,放置到容器类继承结构下。如UIAnalogClock内,通常会Add需要的计步信息,时分秒图标等。 **图 1** 普通容器类组件结构 -![](figures/普通容器类组件结构.png "普通容器类组件结构") +![](figure/普通容器类组件结构.png "普通容器类组件结构") RootView、UIAbstractScroll、UIPicker组件从UIViewGroup继承,UIList、UIScrollView、UISwipeView组件从UIAbstractScroll继承。 @@ -23,7 +23,7 @@ RootView、UIAbstractScroll、UIPicker组件从UIViewGroup继承,UIList、UISc UIViewGroup是容器类组件基类,实现增加、删除、插入等操作,通过增加方法可以添加子组件。普通容器类组件子组件需要设置位置信息,位置信息为相对父组件的相对坐标。组件树结构如下图: **图 2** 组件树结构示意图 -![](figures/组件树结构示意图.png "组件树结构示意图") +![](figure/组件树结构示意图.png "组件树结构示意图") 往根节点rootView里添加ViewGroup1容器组件和View1组件,往ViewGroup1容器组件里再添加View2组件和ViewGroup2容器组件,在View1之后添加View3组件。 @@ -126,7 +126,7 @@ UIViewGroup是容器类组件基类,实现增加、删除、插入等操作, 4. 检查ViewGroup效果如下图所示。 **图 3** ViewGroup添加view实例效果图 - ![](figures/ViewGroup添加view实例效果图.png "ViewGroup添加view实例效果图") + ![](figure/ViewGroup添加view实例效果图.png "ViewGroup添加view实例效果图") ## UIScrollView @@ -240,5 +240,5 @@ scroll->Add(button2); ``` **图 4** 水平、垂直方向可滑动效果图 -![](figures/水平-垂直方向可滑动效果图.gif "水平-垂直方向可滑动效果图") +![](figure/水平-垂直方向可滑动效果图.gif "水平-垂直方向可滑动效果图") diff --git "a/zh-cn/device-dev/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide2.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide2.md index 4f8653aad5a60dd337d7ff873ee22d005474cad3..f03df38642b7f5892957eedc54a9648b0168e3be --- "a/zh-cn/device-dev/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide2.md @@ -97,7 +97,7 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 **图 1** UISwipeView水平滑动效果图 - ![](figures/zh-cn_image_0000001053247975.gif) + ![](figure/zh-cn_image_0000001053247975.gif) ## 开发步骤(水平滑动,可循环) @@ -131,7 +131,7 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 **图 2** UISwipeView水平滑动循环效果图 - ![](figures/zh-cn_image_0000001053207924.gif) + ![](figure/zh-cn_image_0000001053207924.gif) ## GridLayout @@ -211,6 +211,6 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 4. 检查button组件布局效果如下图所示。 **图 3** 设置2\*2网格并添加4个button组件进行布局 - ![](figures/设置2-2网格并添加4个button组件进行布局.png "设置2-2网格并添加4个button组件进行布局") + ![](figure/设置2-2网格并添加4个button组件进行布局.png "设置2-2网格并添加4个button组件进行布局") diff --git "a/zh-cn/device-dev/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide3.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide3.md index 2c417f20a485aa9f6e6bbb303048baacbc30809b..d9b0d48c87587588b3bbd4b39c83e636001dcbd6 --- "a/zh-cn/device-dev/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-graphics-bundle-guide3.md @@ -22,7 +22,7 @@ 普通组件均继承于基类UIView,不可以添加子组件,常用的普通组件有button、image、label等。 **图 1** 普通组件树结构 -![](figures/普通组件树结构.png "普通组件树结构") +![](figure/普通组件树结构.png "普通组件树结构") UIView为基础类,UIAbstractProgress、UIArcLabel(旋转字体)、UIButton(按键)、UICanvas(画布)、UILabel(字体)、UIImageView(图片)从UIView继承。UIBoxProgress、UICircleProgress从UIAbstractProgress继承,UILabelButton和UIRepeatButton从UIButton继承,UIImageAnimatorView和UITextureMapper从UIImageView继承。 @@ -126,7 +126,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查Button点击效果如下图所示,Button逐渐变大。 **图 2** UIButton点击效果 - ![](figures/UIButton点击效果.gif "UIButton点击效果") + ![](figure/UIButton点击效果.gif "UIButton点击效果") ## UIImageView @@ -212,7 +212,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 3. 检查UIImageView控件大小与图片相同。 **图 3** 自适应模式图片效果图 - ![](figures/自适应模式图片效果图.png "自适应模式图片效果图") + ![](figure/自适应模式图片效果图.png "自适应模式图片效果图") ## 开发步骤(平铺模式) @@ -240,7 +240,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查UIImageView控件显示为平铺效果。 **图 4** 平铺模式图片效果图 - ![](figures/平铺模式图片效果图.png "平铺模式图片效果图") + ![](figure/平铺模式图片效果图.png "平铺模式图片效果图") ## UILabel @@ -398,7 +398,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查label大小和显示效果正常,如下图所示。 - ![](figures/zh-cn_image_0000001051782526.png) + ![](figure/zh-cn_image_0000001051782526.png) ## 开发步骤(背景色和透明度) @@ -427,7 +427,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查label背景色为Gray,如下图所示。 - ![](figures/zh-cn_image_0000001052582522.png) + ![](figure/zh-cn_image_0000001052582522.png) ## 开发步骤(字符间距) @@ -456,7 +456,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查label字符间距为5,如下图所示。 - ![](figures/zh-cn_image_0000001052942531.png) + ![](figure/zh-cn_image_0000001052942531.png) ## 开发步骤(大小自适应) @@ -487,7 +487,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查label大小自适应文本内容,如下图所示。 - ![](figures/zh-cn_image_0000001052782555.png) + ![](figure/zh-cn_image_0000001052782555.png) ## 开发步骤(省略号模式) @@ -518,7 +518,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查label DOT模式效果,如下图所示,末尾显示省略号。 - ![](figures/zh-cn_image_0000001052662559.png) + ![](figure/zh-cn_image_0000001052662559.png) ## 开发步骤(滚动模式) @@ -550,6 +550,6 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 4. 检查label滚动模式效果,如下图所示。 - ![](figures/20200721-223604(eSpace).gif) + ![](figure/20200721-223604(eSpace).gif) diff --git "a/zh-cn/device-dev/subsystems/\345\233\276\345\275\242\345\233\276\345\203\217\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-graphics-overview.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\233\276\345\275\242\345\233\276\345\203\217\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-graphics-overview.md diff --git a/zh-cn/device-dev/subsystems/subsys-graphics.md b/zh-cn/device-dev/subsystems/subsys-graphics.md new file mode 100644 index 0000000000000000000000000000000000000000..bb255fa159a9823a6ddbfc724ba7b9ba4c5ac9cd --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-graphics.md @@ -0,0 +1,13 @@ +# 图形图像 + +- **[图形图像概述](subsys-graphics-overview.md)** + +- **[容器类组件开发指导](subsys-graphics-bundle-guide1.md)** + +- **[布局容器类组件开发指导](subsys-graphics-bundle-guide2.md)** + +- **[普通组件开发指导](subsys-graphics-bundle-guide3.md)** + +- **[动画开发指导](subsys-graphics-animation-guide.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-camera-overview.md old mode 100755 new mode 100644 similarity index 97% rename from "zh-cn/device-dev/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-camera-overview.md index 65801b39bcc9ab160e7ad0d0133f46f330a67145..75b2033e9c72cb5541ed32a6d7a8e098e748a526 --- "a/zh-cn/device-dev/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/subsystems/subsys-multimedia-camera-overview.md @@ -90,7 +90,7 @@ 类似的,用户也可以自行创建Surface传递给Camera实例,并实现消费者逻辑(例如通过网络传输视频流,或是将拍照的帧数据保存成图片文件)。 - 图形图像模块也通过Surface从Camera获取流资源,具体步骤详见[图形图像开发指导](图形图像概述.md)。 + 图形图像模块也通过Surface从Camera获取流资源,具体步骤详见[图形图像开发指导](subsys-graphics-overview.md)。 - 相机运行流程 1. Camera创建流程 @@ -100,7 +100,7 @@ **图 1** Camera创建时序图 - ![](figures/zh-cn_image_0000001054101094.png) + ![](figure/zh-cn_image_0000001054101094.png) 1. Camera录像/预览流程 @@ -110,7 +110,7 @@ **图 2** Camera录像/预览时序图 - ![](figures/zh-cn_image_0000001054421113.png) + ![](figure/zh-cn_image_0000001054421113.png) diff --git "a/zh-cn/device-dev/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-camera-photo-guide.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-camera-photo-guide.md index 2b37619913040891523cba68ded948d628a273f5..0e1ebbfecfc56b1d4eecf483c07c4c646cb85e0b --- "a/zh-cn/device-dev/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-multimedia-camera-photo-guide.md @@ -385,6 +385,7 @@ Surface *surface = Surface::CreateSurface(); if (surface == nullptr) { delete fc; + return; } surface->SetWidthAndHeight(1920, 1080); /* 1920:width,1080:height */ fc->AddSurface(*surface); diff --git "a/zh-cn/device-dev/subsystems/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-camera-preview-guide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-camera-preview-guide.md diff --git "a/zh-cn/device-dev/subsystems/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-camera-record-guide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-camera-record-guide.md diff --git a/zh-cn/device-dev/subsystems/subsys-multimedia-camera.md b/zh-cn/device-dev/subsystems/subsys-multimedia-camera.md new file mode 100644 index 0000000000000000000000000000000000000000..ad7796b6926b7f89505b6508cda2e796fd961e64 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-multimedia-camera.md @@ -0,0 +1,11 @@ +# 相机 + +- **[相机开发概述](subsys-multimedia-camera-overview.md)** + +- **[拍照开发指导](subsys-multimedia-camera-photo-guide.md)** + +- **[录像开发指导](subsys-multimedia-camera-record-guide.md)** + +- **[预览开发指导](subsys-multimedia-camera-preview-guide.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221\345\274\200\345\217\221\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-video-overview.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221\345\274\200\345\217\221\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-video-overview.md diff --git "a/zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-video-play-guide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-video-play-guide.md diff --git "a/zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221\345\275\225\345\210\266\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-multimedia-video-record-guide.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221\345\275\225\345\210\266\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia-video-record-guide.md diff --git a/zh-cn/device-dev/subsystems/subsys-multimedia-video.md b/zh-cn/device-dev/subsystems/subsys-multimedia-video.md new file mode 100644 index 0000000000000000000000000000000000000000..2a59765280656395693afc362f32fac0bc6c1447 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-multimedia-video.md @@ -0,0 +1,9 @@ +# 音视频 + +- **[音视频开发概述](subsys-multimedia-video-overview.md)** + +- **[音视频播放开发指导](subsys-multimedia-video-play-guide.md)** + +- **[音视频录制开发指导](subsys-multimedia-video-record-guide.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\345\252\222\344\275\223.md" b/zh-cn/device-dev/subsystems/subsys-multimedia.md old mode 100755 new mode 100644 similarity index 36% rename from "zh-cn/device-dev/subsystems/\345\252\222\344\275\223.md" rename to zh-cn/device-dev/subsystems/subsys-multimedia.md index c76c3a1f71afffffd608dd2db0ed33072b8bff54..50fb9b91f2f47741ba7aa0efe8fa2935e52fd1de --- "a/zh-cn/device-dev/subsystems/\345\252\222\344\275\223.md" +++ b/zh-cn/device-dev/subsystems/subsys-multimedia.md @@ -1,7 +1,7 @@ # 媒体 -- **[相机](相机.md)** +- **[相机](subsys-multimedia-camera.md)** -- **[音视频](音视频.md)** +- **[音视频](subsys-multimedia-video.md)** diff --git "a/zh-cn/device-dev/subsystems/OTA\345\215\207\347\272\247.md" b/zh-cn/device-dev/subsystems/subsys-ota-guide.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/subsystems/OTA\345\215\207\347\272\247.md" rename to zh-cn/device-dev/subsystems/subsys-ota-guide.md index 0423c0b61223ca02bac79eeb499b659bc03b1b36..8b7978468325b860b0c8f02a5fdb3d1ce4d6a650 --- "a/zh-cn/device-dev/subsystems/OTA\345\215\207\347\272\247.md" +++ b/zh-cn/device-dev/subsystems/subsys-ota-guide.md @@ -35,7 +35,7 @@ OTA(Over the Air)提供对设备远程升级的能力,可以让您的设 **图 1** 生成公私钥对 - ![](figures/zh-cn_image_0000001060200050.png) + ![](figure/zh-cn_image_0000001060200050.png) 4. 用public\_arr.txt里面的全部内容替换OTA模块base\\update\\ota\_lite\\frameworks\\source\\verify\\hota\_verify.c中的g\_pubKeyBuf 。 @@ -87,7 +87,7 @@ OTA(Over the Air)提供对设备远程升级的能力,可以让您的设 **图 2** 原始镜像归放位置 - ![](figures/zh-cn_image_0000001061889268.png) + ![](figure/zh-cn_image_0000001061889268.png) **表 1** 升级包内的文件 @@ -166,7 +166,7 @@ OTA(Over the Air)提供对设备远程升级的能力,可以让您的设 **图 3** 升级包制作工具 - ![](figures/zh-cn_image_0000001059334449.png) + ![](figure/zh-cn_image_0000001059334449.png) ## 上传升级包 diff --git "a/zh-cn/device-dev/subsystems/\345\210\206\345\270\203\345\274\217\350\277\234\347\250\213\345\220\257\345\212\250.md" b/zh-cn/device-dev/subsystems/subsys-remote-start.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\210\206\345\270\203\345\274\217\350\277\234\347\250\213\345\220\257\345\212\250.md" rename to zh-cn/device-dev/subsystems/subsys-remote-start.md diff --git "a/zh-cn/device-dev/subsystems/IPC\351\200\232\344\277\241\351\211\264\346\235\203\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-security-communicationverify.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/IPC\351\200\232\344\277\241\351\211\264\346\235\203\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-security-communicationverify.md diff --git "a/zh-cn/device-dev/subsystems/\346\246\202\350\277\260-7.md" b/zh-cn/device-dev/subsystems/subsys-security-overview.md similarity index 95% rename from "zh-cn/device-dev/subsystems/\346\246\202\350\277\260-7.md" rename to zh-cn/device-dev/subsystems/subsys-security-overview.md index 45d0d3267613ee990ad09557a99fb18a311c5efe..5c47b308081819cc88c581f359cca3b4dc8cdd8f 100644 --- "a/zh-cn/device-dev/subsystems/\346\246\202\350\277\260-7.md" +++ b/zh-cn/device-dev/subsystems/subsys-security-overview.md @@ -28,7 +28,7 @@ OpenHarmony安全子系统目前提供给开发者的安全能力主要包含应 - Samgr - Samgr\(System Ability M2anager\)系统能力管理,在OpenHarmony上作为一个管理系统能力的模块,详见系统服务框架子系统。 + Samgr\(System Ability Manager\)系统能力管理,在OpenHarmony上作为一个管理系统能力的模块,详见系统服务框架子系统。 - BMS diff --git "a/zh-cn/device-dev/subsystems/\345\272\224\347\224\250\346\235\203\351\231\220\347\256\241\347\220\206\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-security-rightmanagement.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/subsystems/\345\272\224\347\224\250\346\235\203\351\231\220\347\256\241\347\220\206\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-security-rightmanagement.md index 127a7f175667a950f8cd2f4e43e3bc738d825519..37f3cdbbf7c82ceb3489f67358c7ac0f1b07e2bf --- "a/zh-cn/device-dev/subsystems/\345\272\224\347\224\250\346\235\203\351\231\220\347\256\241\347\220\206\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-security-rightmanagement.md @@ -93,7 +93,7 @@
->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >静态权限:应用安装时由系统授予的权限,对应于权限敏感级别的system\_grant >动态权限:应用在运行过程中需要用户授权的权限,对应于权限敏感级别的user\_grant diff --git "a/zh-cn/device-dev/subsystems/\345\272\224\347\224\250\351\252\214\347\255\276\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-security-sigverify.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/subsystems/\345\272\224\347\224\250\351\252\214\347\255\276\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-security-sigverify.md index 8c5e78070f8c6b457d28fa149bcc528bad8a910b..a7e2f85b64ec50c09ad516a117b157d71907c11f --- "a/zh-cn/device-dev/subsystems/\345\272\224\347\224\250\351\252\214\347\255\276\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-security-sigverify.md @@ -27,7 +27,7 @@ **图 1** 经过签名的Hap包结构 -![](figures/安全子系统.png) +![](figure/安全子系统.png) 整个验签流程,主要分为三部分:整包验签、描述文件签名块验签,以及描述文件内容校验。 diff --git a/zh-cn/device-dev/subsystems/subsys-security.md b/zh-cn/device-dev/subsystems/subsys-security.md new file mode 100644 index 0000000000000000000000000000000000000000..1a0b0eb10140d07891972385e3ba30d5018d0f63 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-security.md @@ -0,0 +1,11 @@ +# 安全 + +- **[概述](subsys-security-overview.md)** + +- **[应用验签开发指导](subsys-security-sigverify.md)** + +- **[应用权限管理开发指导](subsys-security-rightmanagement.md)** + +- **[IPC通信鉴权开发指导](subsys-security-communicationverify.md)** + + diff --git "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\344\275\277\347\224\250\345\256\236\344\276\213.md" b/zh-cn/device-dev/subsystems/subsys-sensor-demo.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\344\275\277\347\224\250\345\256\236\344\276\213.md" rename to zh-cn/device-dev/subsystems/subsys-sensor-demo.md diff --git "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-sensor-guide.md old mode 100755 new mode 100644 similarity index 91% rename from "zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-sensor-guide.md index 99c79334499f61522bd731bc8f9bf2650480f2fd..b8d7fa3101e40fe532be50aadfe065bdbd5dca9b --- "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-sensor-guide.md @@ -25,7 +25,7 @@ void SensorDataCallbackImpl(SensorEvent *event) } ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >回调函数的格式为RecordSensorCallback类型。 1. 获取设备支持sensor列表 @@ -55,7 +55,7 @@ int32_t ret = ActivateSensor(0, &sensorUser); int32_t ret = SubscribeSensor(0, &sensorUser); ``` ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >到这步就可以在实现的回调方法中获取到传感器数据。 1. 取消传感器数据订阅 diff --git "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-sensor-overview.md old mode 100755 new mode 100644 similarity index 99% rename from "zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-sensor-overview.md index fa1d50d515bbc5e957204aae010019f5629a7767..caee5f57cad7a17eef842b59aba1eec3de56a1a0 --- "a/zh-cn/device-dev/subsystems/Sensor\346\234\215\345\212\241\345\255\220\347\263\273\346\246\202\350\277\260.md" +++ b/zh-cn/device-dev/subsystems/subsys-sensor-overview.md @@ -9,7 +9,7 @@ Sensor服务子系统提供了轻量级传感器服务基础框架,您可以 **图1** Sensor服务框架图 -![](figures/zh-cn_image_0000001077724150.png) +![](figure/zh-cn_image_0000001077724150.png) - Sensor API:提供传感器的基础API,主要包含查询传感器的列表、订阅/取消传感器数据、执行控制命令等,简化应用开发。 - Sensor Framework:主要实现传感器的订阅管理、数据通道的创建、销毁等,实现与传感器服务层的通信。 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 0000000000000000000000000000000000000000..415eec2bde7a96ccb8ee88e7c27d41872654b843 --- /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/\346\265\213\350\257\225.md" b/zh-cn/device-dev/subsystems/subsys-testguide-test.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/subsystems/\346\265\213\350\257\225.md" rename to zh-cn/device-dev/subsystems/subsys-testguide-test.md index ee62074e9be367efea0a74fa180c801d6381ef42..2403929934b2c2860c3e2dd2200e9a9046930e64 --- "a/zh-cn/device-dev/subsystems/\346\265\213\350\257\225.md" +++ b/zh-cn/device-dev/subsystems/subsys-testguide-test.md @@ -61,12 +61,12 @@ - 测试平台架构图如下: **图 1** 测试平台架构 -![](figures/测试平台架构.png "测试平台架构") +![](figure/测试平台架构.png "测试平台架构") - 测试平台运行时序图如下: **图 2** 测试平台运行时序 -![](figures/测试平台运行时序.png "测试平台运行时序") +![](figure/测试平台运行时序.png "测试平台运行时序") - 测试平台运行原理 @@ -303,7 +303,7 @@ }; ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >测试用例规范 >- 命名规范 > 测试用例源文件名称和测试套内容保持一致,测试套与用例之间关系1:N,测试套与测试源文件之间关系1:1,每个源文件全局唯一,格式:\[特性\]\_\[功能\]\_\[子功能1\]\_\[子功能1.1\],子功能支持向下细分。 @@ -311,7 +311,7 @@ >- 测试用例编码规范 > 开发者测试用例原则上与特性代码编码规范保持一致,另外需要添加必要的用例描述信息,详见[•自测试用例模板](#li2069415903917)。 >- 测试用例编译配置规范 - > 测试用例采用GN方式编译,配置遵循本开源项目的[编译指导](../quick-start/概述.md)。 + > 测试用例采用GN方式编译,配置遵循本开源项目的[编译指导](subsys-build-mini-lite.md)。 >- 测试用例模板 > 详见测试demo用例:developertest/examples/lite/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp @@ -354,7 +354,7 @@ } ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >- @tc.name:用例名称,对测试目的简要描述。 >- @tc.desc:描述用例详细描述,包括测试目的、测试步骤、期望结果等。 >- @tc.type:测试属性分类(FUNC、PERF、SECU、RELI)。 @@ -486,13 +486,13 @@ 5. 在测试用例的编译配置文件中定义resource\_config\_file,用来指定对应的资源文件ohos\_test.xml。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >如上资源文件功能:将resource目录下的test.txt文件通过hdc push命令推送到被测设备的/data/test/resource目录下。 7. 以上步骤完成即完成测试用例编写,即可执行测试用例。 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >- 支持hdc连接的设备,测试用例支持单独编译。 >- 仅支持串口连接的设备,在代码根路径下执行编译debug版本的命令,即可编译测试用例。 > 测试用例用例的执行详见[测试平台使用](#section76401945124810)。 @@ -567,7 +567,7 @@ ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >测试用例的编译参数说明如下: >example:是否编译测试用例示例,默认false。 >version:是否编译测试版本,默认false。 @@ -598,7 +598,7 @@ ``` - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >开发板配置信息如下: >board\_series:开发板系列,默认hispark。 >board\_type:开发板类型,默认taurus。 diff --git "a/zh-cn/device-dev/subsystems/bytrace\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-toolchain-bytrace-guide.md similarity index 95% rename from "zh-cn/device-dev/subsystems/bytrace\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-toolchain-bytrace-guide.md index 3933aebf5e5206f7b3c2aaa1f1a8e3d587e43d33..2c443396aca58e31aa099a8de06db028781c7fdd 100644 --- "a/zh-cn/device-dev/subsystems/bytrace\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-toolchain-bytrace-guide.md @@ -1,18 +1,14 @@ # bytrace使用指导 - [简介](#section11388623181619) -- [命令行开发指导](#section1595564317164) - - [bytrace命令](#section2344125731617) - - [bytrace命令使用举例](#section5402591174) - +- [开发指导](#section1595564317164) +- [使用实例](#section667273201818) ## 简介 bytrace是开发人员用于追踪进程轨迹、分析性能的一种工具,主要对内核ftrace进行了封装和扩展,来支持用户态的打点。通过该工具可以打开想要查看的用户态和内核label(通过下面命令行bytrace -l,查看支持的所有label),然后通过命令行进行抓取trace信息到指定文件中。 -## 命令行开发指导 - -### bytrace命令 +## 开发指导 bytrace当前支持以下命令: @@ -83,7 +79,7 @@ bytrace当前支持以下命令:
-### bytrace命令使用举例 +## 使用实例 以下是常用bytrace命令示例,供开发者参考: diff --git "a/zh-cn/device-dev/subsystems/hdc_std-\344\275\277\347\224\250\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-toolchain-hdc-guide.md similarity index 93% rename from "zh-cn/device-dev/subsystems/hdc_std-\344\275\277\347\224\250\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-toolchain-hdc-guide.md index d4993fb7b51791ca8bbd5af2aff43cf011ade64a..93b765389398c04173ff43ab84aa32cf4eff038c 100644 --- "a/zh-cn/device-dev/subsystems/hdc_std-\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-toolchain-hdc-guide.md @@ -2,13 +2,17 @@ - [环境准备](#section05992022154916) - [注意事项](#section19543134915210) -- [全局option](#section618522925119) -- [查询设备列表](#section174891132104218) +- [option相关的命令](#section618522925119) +- [查询设备列表的命令](#section174891132104218) - [服务进程相关命令](#section680531510497) - [网络相关的命令](#section71176123212) - [文件相关的命令](#section173133523013) - [应用相关的命令](#section2072647133819) - [调试相关的命令](#section112861250195015) +- [常见问题](#section592920255582) + - [hdc\_std连接不到设备](#section74019384588) + - [hdc\_std运行不了](#section63291491267) + hdc\_std(OpenHarmony Device Connector)是OpenHarmony为开发人员提供的用于调试的命令行工具,通过该工具可以在Windows/Linux等系统上与开发机或者模拟器进行交互。 @@ -28,32 +32,21 @@ hdc\_std(OpenHarmony Device Connector)是OpenHarmony为开发人员提供的 ## 注意事项 -1、使用hdc\_std,如果出现异常,可以尝试通过hdc\_std kill命令杀掉hdc\_std服务,或者通过hdc\_std start -r命令重启服务进程进行解决。 - -2、如果出现hdc\_std list targets获取不到设备信息,通过任务管理器查看是否有hdc.exe进程存在,如果进程存在,可以通过杀掉该进程进行解决。 +- 使用hdc\_std,如果出现异常,可以尝试通过hdc\_std kill命令杀掉hdc\_std服务,或者通过hdc\_std start -r命令重启服务进程进行解决。 +- 如果出现hdc\_std list targets获取不到设备信息,通过任务管理器查看是否有hdc.exe进程存在,如果进程存在,可以通过杀掉该进程进行解决。 -## 全局option +## option相关的命令 -全局option涉及以下命令: +option涉及以下命令: -- **-h/help -v/version** +**-h/help -v/version** 用于显示hdc相关的帮助、版本信息。 **表 1** 命令说明 - - - - - - -

参数

-

参数说明

-

-h/help -v/version

-

-

返回值

+ @@ -72,7 +65,7 @@ hdc\_std -h / hdc\_std help hdc\_std -v / hdc\_std version -- **-t key** +**-t key** 用于连接指定设备标识为key的设备。 @@ -112,10 +105,10 @@ hdc\_std list targets (获取设备信息) hdc\_std -t _key_ shell (-t后面添加的_key_ 需要替换为上面查询的设备信息) ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >一台开发机可支持多个设备连接,每个设备有其唯一的设备标识,如果通过网络与设备连接,其标识为tcp:port格式,如果通过usb连接则标识为设备sn号。该命令需要跟随具体操作命令。 -## 查询设备列表 +## 查询设备列表的命令 查询设备列表涉及以下命令: @@ -161,7 +154,7 @@ hdc\_std list targets -v 服务进程涉及以下命令: -- **target mount** +**target mount** 以读写模式挂载/system等分区。 @@ -197,7 +190,7 @@ hdc\_std list targets -v hdc\_std target mount -- **smode \[off\]** +**smode \[off\]** 授予后台服务进程root权限, 使用off参数取消授权。 @@ -207,7 +200,7 @@ hdc\_std smode hdc\_std smode off -- **kill \[-r\]** +**kill \[-r\]** 终止服务进程。 @@ -243,7 +236,7 @@ hdc\_std smode off hdc\_std kill -- **start \[-r\]** +**start \[-r\]** 启动服务进程。 @@ -281,7 +274,7 @@ hdc\_std start 网络部分涉及以下命令: -- **tconn _host_\[:_port_\]\[-remove\]** +**tconn host\[:port\]\[-remove\]** 通过【ip地址:端口号】来指定连接的设备 @@ -322,7 +315,7 @@ hdc\_std start hdc\_std tconn 192.168.0.100:8710 -- **tmode usb** +**tmode usb** 执行后设备端对应daemon进程重启,并首先选用usb连接方式。 @@ -358,7 +351,7 @@ hdc\_std tconn 192.168.0.100:8710 hdc\_std tmode usb -- **tmode port _port-number_** +**tmode port port-number** 执行后设备端对应daemon进程重启,并优先使用网络方式连接设备,如果连接设备再选择usb连接。 @@ -394,14 +387,14 @@ hdc\_std tmode usb hdc\_std tmode port 8710 ->![](public_sys-resources/icon-note.gif) **说明:** +>![](../public_sys-resources/icon-note.gif) **说明:** >执行完毕后,远端daemon将会退出并重启,默认启用TCP连接,如果不加上listen端口则listen随机端口。 ## 文件相关的命令 文件部分涉及以下命令: -- **file send _local remote_** +**file send local remote** 发送文件至远端设备。 @@ -442,7 +435,7 @@ hdc\_std tmode port 8710 hdc\_std file send E:\\a.txt /data/local/tmp/a.txt -- **file recv \[-a\] _remote local_** +**file recv \[-a\] remote local** 从远端设备接收文件至本地。 @@ -492,7 +485,7 @@ hdc\_std file recv /data/local/tmp/a.txt ./a.txt 应用部分涉及以下命令: -- **install \[-r/-d/-g\] _package_** +**install \[-r/-d/-g\] _package_** 安装OpenHarmony package。 @@ -543,7 +536,7 @@ hdc\_std file recv /data/local/tmp/a.txt ./a.txt hdc\_std install _hwadmin.hap_ -- **uninstall \[-k\] _package_** +**uninstall \[-k\] package** 卸载OpenHarmony应用。 @@ -588,7 +581,7 @@ hdc\_std uninstall _package_ 调试涉及以下命令: -- **hilog** +**hilog** 支持抓取log信息。 @@ -622,7 +615,7 @@ hdc\_std uninstall _package_ hdc\_std hilog -- **shell \[_command_\]** +**shell \[_command_\]** 远程执行命令或进入交互命令环境。 @@ -656,3 +649,37 @@ hdc\_std hilog hdc\_std shell +## 常见问题 + +### hdc\_std连接不到设备 + +- **现象描述** + + 执行 "hdc\_std list targets"命令后结果为:\[Empty\] + +- **解决方法** + 1. 设备没有被识别: + + 在设备管理器中查看是否有hdc设备,在通用串行总线设备中会有“HDC Device”信息。如果没有,hdc无法连接。此时需要插拔设备,或者烧写最新的镜像。 + + 2. hdc\_std工作异常: + + 可以执行"hdc kill"或者"hdc start -r"杀掉hdc服务或者重启hdc服务,然后再执行hdc list targets查看是否已经可以获取设备信息。 + + 3. hdc\_std与设备不匹配: + + 如果设备烧写的是最新镜像,hdc\_std也需要使用最新版本。由于hdc\_std会持续更新,请从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录。 + + + +### hdc\_std运行不了 + +- **现象描述** + + 点击hdc\_std.exe文件无法运行。 + +- **解决方法** + + hdc\_std.exe不需要安装,直接放到磁盘上就能使用,也可以添加到环境变量中。通过打开cmd执行hdc\_std命令直接使用。 + + diff --git a/zh-cn/device-dev/subsystems/subsys-toolchain.md b/zh-cn/device-dev/subsystems/subsys-toolchain.md new file mode 100644 index 0000000000000000000000000000000000000000..fcf4e3ed14c0ce6975b04b70d0e9a0bd9c21f06e --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-toolchain.md @@ -0,0 +1,6 @@ +# 研发工具链 + +- [bytrace使用指导](subsys-toolchain-bytrace-guide.md) +- [hdc\_std 使用指导](subsys-toolchain-hdc-guide.md) + + diff --git "a/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\345\270\270\350\247\201\351\227\256\351\242\230.md" b/zh-cn/device-dev/subsystems/subsys-utils-faqs.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\345\270\270\350\247\201\351\227\256\351\242\230.md" rename to zh-cn/device-dev/subsystems/subsys-utils-faqs.md diff --git "a/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\345\274\200\345\217\221\346\214\207\345\257\274.md" b/zh-cn/device-dev/subsystems/subsys-utils-guide.md old mode 100755 new mode 100644 similarity index 98% rename from "zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\345\274\200\345\217\221\346\214\207\345\257\274.md" rename to zh-cn/device-dev/subsystems/subsys-utils-guide.md index 38a64bb9ebb5b0e5fc669019b436fd68d03c4fce..1cabae57341e29c31a2ebf0b47e670e438f27444 --- "a/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ b/zh-cn/device-dev/subsystems/subsys-utils-guide.md @@ -242,7 +242,7 @@ printf("UtilsDeleteValue delete ret = %d\n", ret); - 按照如下目录结构存放文件,res/drawable下面放置资源文件: - ![](figures/unnaming.png) + ![](figure/unnaming.png) - 将上述文件打包生成zip包,修改后缀为.hap,例如Launcher.hap @@ -269,7 +269,7 @@ printf("UtilsDeleteValue delete ret = %d\n", ret); ``` **图 1** LiteOS-M平台dump系统属性输出 - ![](figures/LiteOS-M平台dump系统属性输出.png "LiteOS-M平台dump系统属性输出") + ![](figure/LiteOS-M平台dump系统属性输出.png "LiteOS-M平台dump系统属性输出") ### Dump系统属性在LiteOS-A内核平台使用指南: @@ -293,6 +293,6 @@ printf("UtilsDeleteValue delete ret = %d\n", ret); ``` **图 2** LiteOS-A平台dump系统属性输出 - ![](figures/LiteOS-A平台dump系统属性输出.png "LiteOS-A平台dump系统属性输出") + ![](figure/LiteOS-A平台dump系统属性输出.png "LiteOS-A平台dump系统属性输出") diff --git "a/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\346\246\202\350\277\260.md" b/zh-cn/device-dev/subsystems/subsys-utils-overview.md old mode 100755 new mode 100644 similarity index 100% rename from "zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200\345\272\223\346\246\202\350\277\260.md" rename to zh-cn/device-dev/subsystems/subsys-utils-overview.md diff --git a/zh-cn/device-dev/subsystems/subsys-utils.md b/zh-cn/device-dev/subsystems/subsys-utils.md new file mode 100644 index 0000000000000000000000000000000000000000..28a5d910c2862796d71aba1463dda945b1a5e64f --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-utils.md @@ -0,0 +1,9 @@ +# 公共基础 + +- **[公共基础库概述](subsys-utils-overview.md)** + +- **[公共基础库开发指导](subsys-utils-guide.md)** + +- **[公共基础库常见问题](subsys-utils-faqs.md)** + + diff --git "a/zh-cn/device-dev/subsystems/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237\345\274\200\345\217\221\346\214\207\345\215\227.md" b/zh-cn/device-dev/subsystems/subsys-xts-guide.md old mode 100755 new mode 100644 similarity index 94% rename from "zh-cn/device-dev/subsystems/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237\345\274\200\345\217\221\346\214\207\345\215\227.md" rename to zh-cn/device-dev/subsystems/subsys-xts-guide.md index b5e511362a0ef107beff73f3fb82f98c8a590487..1240c60b9d64b230d4415ddf74c37477f57b27ed --- "a/zh-cn/device-dev/subsystems/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237\345\274\200\345\217\221\346\214\207\345\215\227.md" +++ b/zh-cn/device-dev/subsystems/subsys-xts-guide.md @@ -12,7 +12,10 @@ - [C++语言用例执行指导(适用于小型系统、标准系统用例开发)](#section128222336544) - [JS语言用例开发指导(适用于标准系统)](#section159801435165220) - [JS语言用例编译打包指导(适用于标准系统)](#section445519106559) + - [\#ZH-CN\_TOPIC\_0000001126156429/section191521423950](#section191521423950) +- [全量编译指导(适用于标准系统)](#section1519992743415) +- [全量用例执行指导(适用于小型系统、标准系统)](#section118149111426) ## 简介 @@ -346,7 +349,7 @@ OpenHarmony支持如下几种系统类型: 随版本编译,debug版本编译时会同步编译acts测试套件 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >acts测试套件编译中间件为静态库,最终链接到版本镜像中 。 @@ -479,7 +482,7 @@ OpenHarmony支持如下几种系统类型: 随版本编译,debug版本编译时会同步编译acts测试套件 - >![](public_sys-resources/icon-note.gif) **说明:** + >![](../public_sys-resources/icon-note.gif) **说明:** >小型系统acts独立编译成可执行文件(bin格式), 在编译产物的suites\\acts目录下归档。 @@ -646,3 +649,67 @@ OpenHarmony支持如下几种系统类型: hap包编译请参考[标准系统js应用开发指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/build_overview-0000001055075201)。 +## 全量编译指导(适用于标准系统) + +1. 全量编译 + + **命令**: + + ``` + ./build.sh suite=acts system_size=standard + ``` + + **测试用例输出目录**:out/release/suites/acts/testcases + + **测试框架&用例整体输出目录:**out/release/suites/acts(编译用例时会同步编译测试套执行框架) + + +## 全量用例执行指导(适用于小型系统、标准系统) + +**搭建测试环境** + +Windows工作台下安装python3.7及以上版本,确保工作台和测试设备正常连接。 + +**测试执行目录**(对应编译生成的out/release/suites/acts目录) + +``` +├── testcase # 测试套文件存放目录 +│ └──xxx.hap # 测试套可执行hap文件 +│ └──xxx.json # 测试套对应执行配置文件 +├── tools # 测试框架工具目录 +├── run.bat # window平台测试套启动执行文件 +├── report # 测试报告生成目录 +``` + +**用例执行** + +1. 在Windows工作台上,找到从Linux服务器上拷贝下来的测试套件用例目录\(对应编译生成的out/release/suites/acts目录\),在Windows命令窗口进入对应目录,直接执行acts\\run.bat。 + +1. 界面启动后,输入用例执行指令。 + + - 全量执行 + + ``` + run acts + ``` + + ![](figure/zh-cn_image_0000001119924146.gif) + + + - 模块执行\(具体模块可以查看\\acts\\testcases\\\) + + ``` + run –l ActsSamgrTest + ``` + + ![](figure/zh-cn_image_0000001166643927.jpg) + + + 等待执行完成。 + + +1. 查看测试报告。 + + 进入acts\\reports\\,获取当前的执行记录,打开“summary\_report.html”可以获取到测试报告。 + + diff --git a/zh-cn/device-dev/subsystems/subsys.md b/zh-cn/device-dev/subsystems/subsys.md new file mode 100644 index 0000000000000000000000000000000000000000..b301414e122da41764db79ca418a5d7a84c838a8 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys.md @@ -0,0 +1,33 @@ +# 子系统开发指南 + +- **[编译构建](subsys-build.md)** + +- **[分布式远程启动](subsys-remote-start.md)** + +- **[图形图像](subsys-graphics.md)** + +- **[媒体](subsys-multimedia.md)** + +- **[公共基础](subsys-utils.md)** + +- **[AI框架](subsys-aiframework.md)** + +- **[Sensor服务](subsys-sensor.md)** + +- **[用户程序框架](subsys-application-framework.md)** + +- **[OTA升级](subsys-ota-guide.md)** + +- **[安全](subsys-security.md)** + +- **[启动恢复](subsys-boot.md)** + +- **[测试](subsys-testguide-test.md)** + +- **[DFX](subsys-dfx.md)** + +- **[HiSysEvent订阅指导](subsys-dfx-hisyseventread.md)** + +- **[XTS认证子系统开发指南](subsys-xts-guide.md)** + + diff --git "a/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200.md" "b/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200.md" deleted file mode 100755 index 5a9dc698745f0ec1dc3c6dc9fa361f75740a940d..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\345\205\254\345\205\261\345\237\272\347\241\200.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 公共基础 - -- **[公共基础库概述](公共基础库概述.md)** - -- **[公共基础库开发指导](公共基础库开发指导.md)** - -- **[公共基础库常见问题](公共基础库常见问题.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\345\220\257\345\212\250\346\201\242\345\244\215.md" "b/zh-cn/device-dev/subsystems/\345\220\257\345\212\250\346\201\242\345\244\215.md" deleted file mode 100755 index 0514d4bd500c9a0de7dd78af98f690b09fd16cc1..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\345\220\257\345\212\250\346\201\242\345\244\215.md" +++ /dev/null @@ -1,17 +0,0 @@ -# 启动恢复 - -- **[启动恢复子系统概述](启动恢复子系统概述.md)** - -- **[init启动引导组件](init启动引导组件.md)** - -- **[appspawn应用孵化组件](appspawn应用孵化组件.md)** - -- **[bootstrap服务启动组件](bootstrap服务启动组件.md)** - -- **[syspara系统属性组件](syspara系统属性组件.md)** - -- **[常见问题](常见问题.md)** - -- **[参考](参考.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\345\233\276\345\275\242\345\233\276\345\203\217.md" "b/zh-cn/device-dev/subsystems/\345\233\276\345\275\242\345\233\276\345\203\217.md" deleted file mode 100755 index 08422282d6c645d6451f0f930689f79fc73c4ad9..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\345\233\276\345\275\242\345\233\276\345\203\217.md" +++ /dev/null @@ -1,13 +0,0 @@ -# 图形图像 - -- **[图形图像概述](图形图像概述.md)** - -- **[容器类组件开发指导](容器类组件开发指导.md)** - -- **[布局容器类组件开发指导](布局容器类组件开发指导.md)** - -- **[普通组件开发指导](普通组件开发指导.md)** - -- **[动画开发指导](动画开发指导.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\345\256\211\345\205\250.md" "b/zh-cn/device-dev/subsystems/\345\256\211\345\205\250.md" deleted file mode 100755 index 88ce479aa01d95df97297fd45bd3ac17d0d16ff1..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\345\256\211\345\205\250.md" +++ /dev/null @@ -1,13 +0,0 @@ -# 安全 - -- **[概述](概述-7.md)** - -- **[应用验签开发指导](应用验签开发指导.md)** - -- **[应用权限管理开发指导](应用权限管理开发指导.md)** - -- **[IPC通信鉴权开发指导](IPC通信鉴权开发指导.md)** - -- **[可信设备群组管理开发指导](可信设备群组管理开发指导.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\345\256\236\344\276\213-6.md" "b/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\345\256\236\344\276\213-6.md" deleted file mode 100755 index 39c2377cd403b1b3aaed2c97947c6cea63b4e6dc..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\345\256\236\344\276\213-6.md" +++ /dev/null @@ -1,112 +0,0 @@ -# 开发实例 - -- [去电开发实例](#section286643718507) -- [来电开发实例](#section3205350105014) - -## 去电开发实例 - -去电的调用流程示例如下图所示: - -**图 1** 去电调用流程图 - - -![](figures/去电.png) - -当应用触发去电动作时,RIL Adapter会接收到拨打电话的请求,OnRequest\(\)会根据拨打电话请求ID调用拨打电话的接口。在该接口里会把电话服务传过来的数据封装为对应的AT指令发送到Modem,Modem执行完拨号命令后通过OnRequestResponse\(\)接口把响应结果上报给RIL Adapter。 - -``` -#include -#include -#include -#include -#include "atchannel.h" -#include "at_tok.h" -#include "hdf_log.h" -#include "ril.h" - -static void OnRequest(int request, void *data, size_t datalen, RIL_Token token) -{ - HDF_LOGI("OnRequest request = %{public}d start \n", request); - switch (request) { - case HREQ_CALL_DIAL: - SendDialRequest(data, datalen, token); - break; - …… - default: - break; - } -} - -// 将去电ID和参数转换成对应的AT命令,通过send_at_request发送给Modem -static void SendDialRequest(void *data, size_t datalen __unused, RIL_Token token) -{ - char *atCmd; - const char *clir; - int ret; - DialInfo *pDial; - pDial = (DialInfo *) data; - - if (!strncmp(pDial->address, "*31#", 4)) { - HDF_LOGI("clir suppression"); - clir = "i"; - num = (char *)&(pDial->address[4]); - } else if (!strncmp(pDial->address, "#31#", 4)) { - HDF_LOGI("clir invocation"); - clir = "I"; - num = (char *)&(pDial->address[4]); - } else { - HDF_LOGI("set clir state to default"); - clir = ""; - num = (char *)pDial->number; - } - - asprintf(&atCmd, "ATD%s%s;", pDial->address, clir); - ret = send_at_request(atCmd, NULL); - free(atCmd); - // 命令执行完成后调用该接口,将Modem执行的结果反馈给RIL Adapter - OnRequestResponse(t, RIL_RESULT_SUCCESS, NULL, 0); -} -``` - -## 来电开发实例 - -来电的调用流程示例如下图所示: - -**图 2** 来电调用流程图 - - -![](figures/来电.png) - -Modem设备节点读取线程s\_tid\_read会循环读取Modem上报的消息,当Modem接收到来电时会主动上报来电相关的信息; - -当该线程通过调用OnNotificationResponse\(\)解析到Modem上报的数据是以"+CRING"、"RING"等字符开头时,表示有来电事件,然后通过OnRadioEventNotify\(HNOTI\_CALL\_STATUS, NULL, 0\)上报给RIL Adapter完成来电事件上报。 - -``` -#include -#include "atchannel.h" -#include "at_tok.h" -#include "hdf_log.h" -#include "ril.h" - -bool IsCallStatusUpdated(const char *s) -{ - return (StrBeginWith(s, "+CRING:") - || StrBeginWith(s, "RING") - || StrBeginWith(s, "NO CARRIER") - || StrBeginWith(s, "+CCWA")); -} - -// 将Modem上报数据解析为对应的Modem事件 -static void OnNotificationResponse(const char *s, const char *sms_pdu) -{ - char *line = NULL, *p; - HDF_LOGI("OnNotificationResponse = %{public}s sState = %{public}d", s, sState); - // 解析到以"+CRING:"等字符开头的数据时,转换为来电事件 - if (IsCallStatusUpdated(s)) { - // 通知RIL Adapter有来电事件 - OnRadioEventNotify(HNOTI_CALL_STATUS, NULL, 0); - } - …… -} -``` - diff --git "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\346\214\207\345\257\274.md" deleted file mode 100755 index 4ef866ea112a9d162a86e22d4a5badacfbfb1b0b..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 开发指导 - -为实现AI 引擎框架的接入,开发者需开发上述[图1](AI引擎框架开发指南.md#fig143186187187)中的SDK模块和Plugin模块,通过调用sdk提供的接口,基于AI引擎框架实现调用plugin中算法的能力,从而实现AI能力的生命周期管理和按需部署功能。 - -- **[SDK开发过程](SDK开发过程.md)** - -- **[插件的开发过程](插件的开发过程.md)** - -- **[配置文件的开发过程](配置文件的开发过程.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266.md" "b/zh-cn/device-dev/subsystems/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266.md" deleted file mode 100755 index 14552d89af7b37c90cd9edbbc22f1d2d6c2b0bcb..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 用户程序框架 - -- **[概述](概述.md)** - -- **[搭建环境](搭建环境-2.md)** - -- **[开发指导](开发指导-3.md)** - -- **[开发实例](开发实例.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\347\233\270\346\234\272.md" "b/zh-cn/device-dev/subsystems/\347\233\270\346\234\272.md" deleted file mode 100755 index 3b86f53b9bc45e06e5cd20e684af73db06c88e77..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\233\270\346\234\272.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 相机 - -- **[相机开发概述](相机开发概述.md)** - -- **[拍照开发指导](拍照开发指导.md)** - -- **[录像开发指导](录像开发指导.md)** - -- **[预览开发指导](预览开发指导.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\347\240\224\345\217\221\345\267\245\345\205\267\351\223\276.md" "b/zh-cn/device-dev/subsystems/\347\240\224\345\217\221\345\267\245\345\205\267\351\223\276.md" deleted file mode 100644 index 5c490a8cfbdc0458b160ce6b284ecd2582f2faad..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\240\224\345\217\221\345\267\245\345\205\267\351\223\276.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 研发工具链 - -- **[bytrace使用指导](bytrace使用指导.md)** - -- **[hdc\_std 使用指导](hdc_std-使用指导.md)** - -- **[hdc\_std常见问题](hdc_std常见问题.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272.md" "b/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272.md" deleted file mode 100755 index b59e4b2a18f9ef3c093e85b47b97126043b59744..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 编译构建 - -- **[轻量和小型系统编译构建指导](轻量和小型系统编译构建指导.md)** - -- **[标准系统编译构建指导](标准系统编译构建指导.md)** - - diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" "b/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" deleted file mode 100755 index 8d5f276817760d9b28e9bee264507fc2e6c6b533..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ /dev/null @@ -1,431 +0,0 @@ -# 编译构建使用指导 - -- [前提条件](#section13333171022312) -- [hb命令行工具使用](#section477242204612) -- [新增组件](#section4207112818418) -- [新增芯片解决方案](#section2737141421917) -- [新增产品解决方案](#section720881917199) - -## 前提条件 - -开发环境需安装gn、ninja构建工具、python 3.7.4及以上和hb。安装方法请见[搭建系统基础环境](../quick-start/搭建系统环境.md)。 - -## hb命令行工具使用 - -hb是OpenHarmony的命令行工具,用来执行编译命令。以下对hb的常用命令进行说明。 - -1. **hb set** - - ``` - hb set -h - usage: hb set [-h] [-root [ROOT_PATH]] [-p] - - optional arguments: - -h, --help show this help message and exit - -root [ROOT_PATH], --root_path [ROOT_PATH] - Set OHOS root path - -p, --product Set OHOS board and kernel - ``` - - - hb set 后无参数,进入默认设置流程 - - hb set -root dir可直接设置代码根目录 - - hb set -p设置要编译的产品 - -2. **hb env** - - 查看当前设置信息 - - ``` - hb env - [OHOS INFO] root path: xxx - [OHOS INFO] board: hispark_taurus - [OHOS INFO] kernel: liteos - [OHOS INFO] product: ipcamera - [OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera - [OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19 - ``` - -3. **hb build** - - ``` - hb build -h - usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] - [--dmverity] [-p PRODUCT] [-f] [-n] - [component [component ...]] - - positional arguments: - component name of the component - - optional arguments: - -h, --help show this help message and exit - -b BUILD_TYPE, --build_type BUILD_TYPE - release or debug version - -t [TEST [TEST ...]], --test [TEST [TEST ...]] - compile test suit - --dmverity Enable dmverity - -p PRODUCT, --product PRODUCT - build a specified product with - {product_name}@{company}, eg: ipcamera@hisilcon - -f, --full full code compilation - -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] - Compile single target - ``` - - - hb build后无参数,会按照设置好的代码路径、产品进行编译,编译选项使用与之前保持一致。-f 选项将删除当前产品所有编译产品,等同于hb clean + hb build. - - hb build \{component\_name\}:基于设置好的产品对应的单板、内核,单独编译组件(e.g.:hb build kv\_store\)。 - - hb build -p ipcamera@hisilicon:免set编译产品,该命令可以跳过set步骤,直接编译产品。 - - 在device/device\_company/board下单独执行hb build会进入内核选择界面,选择完成后会根据当前路径的单板、选择的内核编译出仅包含内核、驱动的镜像。 - -4. **hb clean** - - 清除out目录对应产品的编译产物,仅保留args.gn、build.log。清除指定路径可输入路径参数:hb clean out/board/product,默认将清除当前hb set的产品对应out路径。 - - ``` - hb clean - usage: hb clean [-h] [out_path] - - positional arguments: - out_path clean a specified path. - - optional arguments: - -h, --help show this help message and exit - ``` - - -## 新增组件 - -本小节介绍如何新增一个组件,首先确定组件归属的子系统和组件名称,然后按如下步骤新增: - -1. 源码开发完成后,添加组件编译脚本。 - - 以编译组件hello\_world可执行文件为例,applications/sample/hello\_world/BUILD.gn可以写为: - - ``` - executable("hello_world") { - include_dirs = [ - "include", - ] - sources = [ - "src/hello_world.c" - ] - } - ``` - - 如上编译脚本,可编译出一个可在OpenHarmony上运行的名为hello\_world的可执行文件。 - - 单独编译该组件,hb set任意选择一款产品,然后使用-T选项单独编译组件: - - ``` - hb build -f -T //applications/sample/hello_world - ``` - - 组件在开发板上功能验证完成后,可按步骤2\~5将组件配置到产品中。 - -2. 添加组件描述。 - - 组件描述位于build/lite/components下,新增的组件需加入对应子系统的json文件中。一个组件描述必选的字段有: - - - component:组件名称。 - - description:组件的一句话功能描述。 - - optional:组件是否为系统可选。 - - dirs:组件源码路径。 - - targets:组件编译入口。 - - 以将hello\_world组件加入应用子系统为例,在applications.json中添加hello\_world对象: - - ``` - { - "components": [ - { - "component": "hello_world", - "description": "Hello world.", - "optional": "true", - "dirs": [ - "applications/sample/hello_world" - ], - "targets": [ - "//applications/sample/hello_world" - ] - }, - ... - ] - } - ``` - -3. 将组件配置到产品。 - - 产品的配置文件config.json位于位于vendor/company/product/下,产品配置文件需包含产品名称、OpenHarmony版本号、device厂商、开发板、内核类型、内核版本号,以及配置的子系统和组件。以将hello\_world组件加入产品配置文件my\_product.json中为例,加入hello\_wolrd对象: - - ``` - { - "product_name": "hello_world_test", - "ohos_version": "OpenHarmony 1.0", - "device_company": "hisilicon", - "board": "hispark_taurus", - "kernel_type": "liteos_a", - "kernel_version": "1.0.0", - "subsystems": [ - { - "subsystem": "applications", - "components": [ - { "component": "hello_world", "features":[] } - ] - }, - ... - ] - } - ``` - -4. 编译产品。 - - 1. 代码根目录输入hb set选择对应产品。 - - 2. 执行hb build。 - - -## 新增芯片解决方案 - -编译构建支持添加新的芯片解决方案厂商,具体步骤如下: - -1. 创建芯片解决方案目录。 - - 按照[芯片解决方案配置规则](编译构建概述.md#section1625463413327)创建目录,以芯片厂商realtek的“rtl8720“开发板为例, 在代码根目录执行: - - ``` - mkdir -p device/realtek/rtl8720 - ``` - -2. 创建内核适配目录,并编写开发板编译配置config.gni文件。 - - 以realtek的“rtl8720“开发板的liteos\_m适配为例,device/realtek/rtl8720/liteos\_a/config.gni的内容如下: - - ``` - # Kernel type, e.g. "linux", "liteos_a", "liteos_m". - kernel_type = "liteos_a" - - # Kernel version. - kernel_version = "3.0.0" - - # Board CPU type, e.g. "cortex-a7", "riscv32". - board_cpu = "real-m300" - - # Board arch, e.g. "armv7-a", "rv32imac". - board_arch = "" - - # Toolchain name used for system compiling. - # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf. - # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain. - board_toolchain = "gcc-arm-none-eabi" - - # The toolchain path instatlled, it's not mandatory if you have added toolchian path to your ~/.bashrc. - board_toolchain_path = - rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin", - root_build_dir) - - # Compiler prefix. - board_toolchain_prefix = "gcc-arm-none-eabi-" - - # Compiler type, "gcc" or "clang". - board_toolchain_type = "gcc" - - # Board related common compile flags. - board_cflags = [] - board_cxx_flags = [] - board_ld_flags = [] - ``` - -3. 编写编译脚本。 - - 在开发板目录下创建BUILD.gn,target名称应与开发板名称一致。以realtek的rtl8720开发板为例,device/realtek/rtl8720/BUILD.gn内容可以是: - - ``` - group("rtl8720") { # target类型也可以shared_library, static_library, executable - # 具体内容 - ...... - } - ``` - -4. 编译芯片解决方案。 - - 在开发板目录下执行hb build,即可启动芯片解决方案的编译。 - - -## 新增产品解决方案 - -编译构建支持芯片解决方案和组件的灵活拼装,形成定制化的产品解决方案。具体步骤如下: - -1. 创建产品目录 - - 按照[产品解决方案配置规则](编译构建概述.md#section1625463413327)创建产品目录,以基于“rtl8720“开发板的wifiiot模组为例,在代码根目录执行: - - ``` - mkdir -p vendor/my_company/wifiiot - ``` - -2. 拼装产品 - - 在新建的产品目录下新建config.json文件,以步骤1中的wifiiot为例,vendor/my\_company/wifiiot/config.json可以是: - - ``` - { - "product_name": "wifiiot", # 产品名称 - "ohos_version": "OpenHarmony 1.0", # 使用的OS版本 - "device_company": "realtek", # 芯片解决方案厂商名称 - "board": "rtl8720", # 开发板名称 - "kernel_type": "liteos_m", # 选择的内核类型 - "kernel_version": "3.0.0", # 选择的内核版本 - "subsystems": [ - { - "subsystem": "kernel", # 选择的子系统 - "components": [ - { "component": "liteos_m", "features":[] } # 选择的组件和组件特性 - ] - }, - ... - { - 更多子系统和组件 - } - ] - } - ``` - - 注意:编译构建系统编译前会对device\_company,board,kernel\_type,kernel\_version、subsystem、component字段进行有效性检查,其中device\_company,board,kernel\_type,kernel\_version应与已知的芯片解决方案匹配,subsystem、component应与build/lite/components下的组件描述匹配。 - -3. 适配OS接口 - - 在产品目录下创建hals目录,并将产品解决方案对OS适配的源码和编译脚本放入该目录下。 - -4. 配置系统服务 - - 在产品目录下创建init\_configs目录,并在init\_configs目录下创建init.cfg文件,按需配置要启动的系统服务。 - -5. 配置init进程(仅linux内核需要) - - 在init\_configs目录下创建etc目录,然后在etc下创建init.d文件夹和fstab文件。最后按产品需求在init.d文件下创建并编辑rcS文件和Sxxx文件。 - -6. 配置文件系统镜像(可选,仅支持文件系统的开发板需要) - - 在产品目录下创建fs.yml文件。fs.yml需按产品实际情况配置,一个典型的fs.yml文件如下: - - ``` - - - fs_dir_name: rootfs # 镜像的名称 - fs_dirs: - - - # 将编译生成的out/my_board/my_product/bin目录下的文件拷贝到rootfs/bin中,并忽略测试bin - source_dir: bin - target_dir: bin - ignore_files: - - Test.bin - - TestSuite.bin - - - # 将编译生成的out/my_board/my_product/libs目录下的文件拷贝到rootfs/lib中,忽略所有.a文件,并设置文件和文件夹的权限为644和755 - source_dir: libs - target_dir: lib - ignore_files: - - .a - dir_mode: 755 - file_mode: 644 - - - source_dir: usr/lib - target_dir: usr/lib - ignore_files: - - .a - dir_mode: 755 - file_mode: 644 - - - source_dir: config - target_dir: etc - - - source_dir: system - target_dir: system - - - source_dir: sbin - target_dir: sbin - - - source_dir: usr/bin - target_dir: usr/bin - - - source_dir: usr/sbin - target_dir: usr/sbin - - - # 创建一个proc空目录 - target_dir: proc - - - target_dir: mnt - - - target_dir: opt - - - target_dir: tmp - - - target_dir: var - - - target_dir: sys - - - source_dir: etc - target_dir: etc - - - source_dir: vendor - target_dir: vendor - - - target_dir: storage - - fs_filemode: - - - file_dir: lib/ld-uClibc-0.9.33.2.so - file_mode: 555 - - - file_dir: lib/ld-2.24.so - file_mode: 555 - - - file_dir: etc/init.cfg - file_mode: 400 - fs_symlink: - - - # 在rootfs/lib下创建软连接ld-musl-arm.so.1 -> libc.so - source: libc.so - link_name: ${fs_dir}/lib/ld-musl-arm.so.1 - - - source: mksh - link_name: ${fs_dir}/bin/sh - - - source: mksh - link_name: ${fs_dir}/bin/shell - fs_make_cmd: - # 使用脚本将rootfs制作为ext4格式的image - - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 - - - fs_dir_name: userfs - fs_dirs: - - - source_dir: storage/etc - target_dir: etc - - - source_dir: data - target_dir: data - fs_make_cmd: - - ${root_path}/build/lite/make_rootfs/rootfsimg_linux.sh ${fs_dir} ext4 - - ``` - -7. 编写编译脚本 - - 在产品目录下创建BUILD.gn文件,按产品实际情况编写脚本。以步骤1中的wifiiot为例,BUILD.gn示例如下: - - ``` - group("wifiiot") { # target名称与产品名一致 - deps = [] - # 拷贝init配置 - deps += [ "init_configs" ] - # 将hals加入编译 - deps += [ "hals" ] - # 其他 - ...... - } - ``` - -8. 编译产品。 - - 在代码根目录执行hb set按提示选择新增的产品,然后执行hb build即可启动编译。 - - diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\345\270\270\350\247\201\351\227\256\351\242\230.md" "b/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\345\270\270\350\247\201\351\227\256\351\242\230.md" deleted file mode 100755 index ca00b2428542c6024ff6fa79649c5814646cfd28..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ /dev/null @@ -1,121 +0,0 @@ -# 编译构建常见问题 - -- [由于ninja版本问题导致编译失败](#section1019152312222) -- [由于ncurses库缺失导致编译失败](#section21449422618) -- [由于未安装mcopy导致编译失败](#section12477184992615) -- [由于权限问题导致编译失败](#section178451337202716) -- [由于未安装Crypto导致编译失败](#section1241481172819) -- [由于编译环境为shell导致编译失败](#section3691222152919) - -## 由于ninja版本问题导致编译失败 - -- **现象描述:** - - 编译失败,提示“usr/sbin/ninja: invalid option -- w”。 - -- **可能原因:** - - 编译环境中ninja版本太低,不支持--w选项。 - -- **解决办法:** - - 卸载环境中ninja和gn,按照HarmonyOS官网[获取工具](../get-code/获取工具.md)。 - - -## 由于ncurses库缺失导致编译失败 - -- **现象描述:** - - 编译失败,提示“/usr/bin/ld: cannot find -lncurses”。 - -- **可能原因:** - - 编译环境ncurses库缺失。 - -- **解决办法:** - - ``` - sudo apt-get install lib32ncurses5-dev - ``` - - -## 由于未安装mcopy导致编译失败 - -- **现象描述:** - - ​编译失败,提示“line 77: mcopy: command not found”。 - -- **可能原因:** - - 编译环境未安装mcopy。 - -- **解决办法:** - - ``` - ​sudo apt-get install dosfstools mtools - ``` - - -## 由于权限问题导致编译失败 - -- **现象描述:** - - 编译失败,提示“riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory”。 - -- ​**可能原因:** - - 当前用户对riscv编译器路径下的文件访问权限不够。 - -- ​**解决办法:** - 1. 查询gcc\_riscv32所在目录。 - - ``` - which riscv32-unknown-elf-gcc - ``` - - 2. 使用chmod命令修改目录权限为755。 - - -## 由于未安装Crypto导致编译失败 - -- **现象描述:** - - 编译失败,提示“No module named 'Crypto'”。 - -- **可能原因:** - - python3未安装Crypto。 - -- **解决办法:** - 1. 查询Python版本号。 - - ``` - python3 --version - ``` - - 2. 需使用python3.7以上版本,然后安装pycryptodome。 - - ``` - sudo pip3 install pycryptodome - ``` - - - -## 由于编译环境为shell导致编译失败 - -- **现象描述:** - - 编译失败:“xx.sh \[: xx unexpected operator”。 - -- **可能原因:** - - 编译环境shell不是bash。 - -- **解决办法:** - - ``` - sudo rm -rf /bin/sh - sudo ln -s /bin/bash /bin/sh - ``` - - diff --git "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\346\246\202\350\277\260-0.md" "b/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\346\246\202\350\277\260-0.md" deleted file mode 100755 index 1bd7dd28d93785765d46a6c7585280e1fe6d390a..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\347\274\226\350\257\221\346\236\204\345\273\272\346\246\202\350\277\260-0.md" +++ /dev/null @@ -1,58 +0,0 @@ -# 编译构建概述 - -- [基本概念](#section175012297491) -- [运作机制](#section193961322175011) -- [约束与限制](#section2029921310472) - -编译构建子系统提供了一个基于gn和ninja的编译构建框架。主要提供以下功能: - -- 构建不同芯片平台的产品。如:Hi3516DV300平台。 - -- 根据产品配置可以按照组件组装打包产品需要的能力。 - -## 基本概念 - -在了解编译构建子系统的能力前,应了解如下基本概念: - -- 平台 - - 开发板和内核的组合,不同平台支持的子系统和组件不同。 - -- 子系统 - - OpenHarmony整体遵从分层设计,从下向上依次为:内核层、系统服务层、框架层和应用层。系统功能按照“系统 \> 子系统 \> 组件”逐级展开,在多设备部署场景下,支持根据实际需求裁剪某些非必要的子系统或组件。子系统是一个逻辑概念,它具体由对应的组件构成。 - -- 组件 - - 对子系统的进一步拆分,可复用的软件单元,它包含源码、配置文件、资源文件和编译脚本;能独立构建,以二进制方式集成,具备独立验证能力的二进制单元。 - -- gn - - Generate ninja的缩写,用于产生ninja文件。 - -- ninja - - ninja是一个专注于速度的小型构建系统。 - - -## 运作机制 - -OpenHarmony侧的编译构建流程主要包括编译命令行解析,调用gn,执行ninja: - -- 命令行解析:解析待编译的产品名称,加载相关配置。 -- 调用gn: 根据命令行解析的产品名称和编译类型,配置编译工具链和全局的编译选项。 -- 执行ninja:启动编译并生成对应的产品版本。 - -## 约束与限制 - -- 需按照[源码获取](../get-code/源码获取.md)指导下载全量源码(采用方式三获取)。 -- 编译环境需要Ubuntu18.04及以上版本。 -- 安装编译所需的程序包。 - - 安装命令: - - ``` - sudo apt-get install binutils git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 - ``` - - diff --git "a/zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221.md" "b/zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221.md" deleted file mode 100755 index 5f32b5fe5013f986e38b1363270abfa4d02668d2..0000000000000000000000000000000000000000 --- "a/zh-cn/device-dev/subsystems/\351\237\263\350\247\206\351\242\221.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 音视频 - -- **[音视频开发概述](音视频开发概述.md)** - -- **[音视频播放开发指导](音视频播放开发指导.md)** - -- **[音视频录制开发指导](音视频录制开发指导.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 c49e621b918d86e3a96969515fed4605ed142761..99b56c52bd104d6d5a11aa98e6a78ad07bd27714 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" @@ -48,49 +48,49 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按 - - - - - - - - - - - - - -

返回值

返回值说明

整体认知OpenHarmony

+

获取开发资源

准备开发前相关资源

+

快速入门

快速熟悉OpenHarmony环境搭建、编译、烧录、调测、运行。

轻量和小型系统入门

+

轻量和小型系统快速入门

基础能力使用

使用OpenHarmony提供的基础能力

+

进阶开发

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

+

移植适配

  • 针对特定芯片做移植适配
  • 对三方库进行移植适配
+

贡献组件

OpenHarmony贡献功能组件

+

参考

@@ -118,49 +118,49 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按

整体认知OpenHarmony

+

获取开发资源

准备开发前相关资源

+

快速入门

快速熟悉OpenHarmony环境搭建、编译、烧录、调测、运行。

标准系统入门

+

标准系统快速入门

基础能力使用

使用OpenHarmony提供的基础能力

+

进阶开发

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

+

移植适配

对三方库进行移植适配

三方库移植指导

+

三方库移植指导

贡献组件

OpenHarmony贡献功能组件

+

参考

diff --git a/zh-cn/readme.md b/zh-cn/readme.md index d69fd1bcdd4fe9050e0e39a239752d889651b985..2f28456dc8dcf343af489552b5aa83affa7e61ad 100644 --- a/zh-cn/readme.md +++ b/zh-cn/readme.md @@ -4,51 +4,56 @@ ## 文档目录结构 -- [Openharmony概述](OpenHarmony-Overview_zh.md) -- 轻量和小型系统开发指导(参考内存<128MB) +- [Openharmony概述](OpenHarmony-Overview_zh.md) +- 轻量和小型系统开发指导(参考内存<128MB) - 设备开发 - overview:[设备开发导读](device-dev/导读.md) - quick-start:[快速入门](device-dev/quick-start/Readme-CN.md)(搭建环境、获取源码、编译、烧录等) - - 开发基础能力 - - Kernel:[轻量和小型系统内核](device-dev/kernel/轻量和小型系统内核.md) + - Basic Capability:开发基础能力 + - Kernel:[轻量和小型系统内核](device-dev/kernel/kernel-lite.md) - Drivers:[驱动](device-dev/driver/Readme-CN.md) - Subsystems:[子系统](device-dev/subsystems/Readme-CN.md)(编译构建、图形图像、DFX、XTS等子系统) - Security:[隐私与安全](device-dev/security/Readme-CN.md) - - guide:[开发示例](device-dev/guide/Readme-CN.md) - - [WLAN连接类产品](device-dev/guide/WLAN连接类产品.md)(LED外设控制、集成三方SDK) - - [无屏摄像头类产品](device-dev/guide/无屏摄像头类产品.md)(摄像头控制) - - [带屏摄像头类产品](device-dev/guide/带屏摄像头类产品.md)(屏幕和摄像头控制、视觉应用开发) + - guide:开发示例 + - [WLAN连接类产品](device-dev/guide/device-wifi.md)(LED外设控制、集成三方SDK) + - [无屏摄像头类产品](device-dev/guide/device-iotcamera-control.md)(摄像头控制) + - [带屏摄像头类产品](device-dev/guide/device-camera.md)(屏幕和摄像头控制、视觉应用开发) - - porting:[移植适配](device-dev/porting/Readme-CN.md) - - [三方芯片移植指导](device-dev/porting/三方芯片移植指导.md) - - [三方库移植指导](device-dev/porting/三方库移植指导.md) + - porting:移植适配 + - [三方库移植指导](device-dev/porting/transplant-thirdparty.md) + - [轻量系统芯片移植指导](device-dev/porting/transplant-minichip.md) + - [小型系统芯片移植指导](device-dev/porting/transplant-smallchip.md) - - bundles:[组件开发](device-dev/bundles/Readme-CN.md) - - [组件开发规范](device-dev/bundles/组件开发规范.md) - - [组件开发指南](device-dev/bundles/组件开发指南.md) - - [组件开发示例](device-dev/bundles/组件开发示例.md) + - bundles:组件开发 + - [组件开发规范](device-dev/bundles/bundles-standard-rules.md) + - [组件开发指南](device-dev/bundles/bundles-guide.md) + - [组件开发示例](device-dev/bundles/bundles-demo.md) -- 标准系统开发指导(参考内存≥128MB) +- 标准系统开发指导(参考内存≥128MB) - 设备开发 - overview:[设备开发导读](device-dev/导读.md) - - quick-start:[快速入门](device-dev/quick-start/Readme-CN.md)(搭建环境、获取源码、编译、烧录等) - - 开发基础能力 - - Kernel:[标准系统内核](device-dev/kernel/标准系统内核.md) + - quick-start:[快速入门](device-dev/quick-start/quickstart-standard.md)(搭建环境、获取源码、编译、烧录等) + - Basic Capability:开发基础能力 + - Kernel:[标准系统内核](device-dev/kernel/kernel-standard.md) - Drivers:[驱动](device-dev/driver/Readme-CN.md) - Subsystems:[子系统](device-dev/subsystems/Readme-CN.md)(编译构建、图形图像、DFX、XTS等子系统) - Security:[隐私与安全](device-dev/security/Readme-CN.md) - - guide:[开发示例](device-dev/guide/Readme-CN.md) - - [时钟应用](device-dev/guide/时钟应用开发示例.md) - - [平台驱动](device-dev/guide/平台驱动开发示例.md) - - [外设驱动](device-dev/guide/外设驱动开发示例.md) + - guide:开发示例 + - [时钟应用](device-dev/guide/device-clock-guide.md) + - [平台驱动](device-dev/guide/device-driver-demo.md) + - [外设驱动](device-dev/guide/device-outerdriver-demo.md) + + - porting:移植适配 + + - [三方库移植指导](device-dev/porting/transplant-thirdparty.md) + - [标准系统芯片移植指导](device-dev/porting/standard_system_porting_guide.md) - - porting:[移植适配](device-dev/porting/Readme-CN.md) - - bundles:[组件开发](device-dev/bundles/Readme-CN.md) - - [组件开发规范](device-dev/bundles/组件开发规范.md) - - [组件开发指南](device-dev/bundles/组件开发指南.md) - - [组件开发示例](device-dev/bundles/组件开发示例.md) + - bundles:组件开发 + - [组件开发规范](device-dev/bundles/bundles-standard-rules.md) + - [组件开发指南](device-dev/bundles/bundles-guide.md) + - [组件开发示例](device-dev/bundles/bundles-demo.md) - 应用开发 @@ -58,7 +63,8 @@ - media:[媒体](application-dev/media/Readme-CN.md) - connectivity:[网络与连接](application-dev/connectivity/Readme-CN.md) - js-reference:[JS参考规范](application-dev/js-reference/Readme-CN.md) -- glossary:[术语](device-dev/glossary/术语.md) +- 许可证及版权信息检查工具:[开源合规审查工具](https://gitee.com/openharmony-sig/tools_oat) +- glossary:[术语](device-dev/glossary/glossary.md) ## 版本更新