未验证 提交 2431e6f7 编写于 作者: O openharmony_ci 提交者: Gitee

!1396 Deleted unnecessary links in docs

Merge pull request !1396 from wusongqing/OpenHarmony-3.1-Beta
# OpenHarmony<a name="EN-US_TOPIC_0000001158661243"></a>
- [Introduction](#section1270210396435)
- [Technical Architecture](#section2502124574318)
- [Technical Features](#section12212842173518)
- [OS Types](#section145241459142416)
- [Subsystems](#section25831825174419)
- [Getting Started](#section44681652104210)
- [Code Repository Addresses](#section107651249181914)
- [OpenHarmony Documentation](#section21031470109)
- [Source Code Downloading](#section39011923144212)
- [How to Participate](#section19611528174215)
- [License Agreement](#section1245517472115)
- [Contact Info](#section61728335424)
## Introduction<a name="section1270210396435"></a>
OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. It is an open-source operating system with a framework and platform applicable to smart devices in all scenarios of a fully-connected world. It aims to promote the development of the Internet of Everything (IoE).
......
......@@ -2,9 +2,10 @@
- [Audio](audio.md)
- [Audio Overview](audio-overview.md)
- [Development Guidelines on Audio Playback](audio-playback.md)
- [Development Guidelines on Audio Management](audio-management.md)
- [Audio Playback Development](audio-playback.md)
- [Development Guidelines on Audio Recording](audio-recorder.md)
- [Audio Management Development](audio-management.md)
- [Audio Recording Development](audio-recorder.md)
# Development Guidelines on Audio Management<a name="EN-US_TOPIC_0000001147178551"></a>
# Audio Management Development<a name="EN-US_TOPIC_0000001147178551"></a>
## When to Use<a name="section1269212236329"></a>
......
# Development Guidelines on Audio Playback
# Audio Playback Development
- [When to Use](#When-to-Use)
- [Available APIs](#Available-APIs)
......
# Development Guidelines on Audio Recording<a name="EN-US_TOPIC_0000001163844398"></a>
# Audio Recording Development<a name="EN-US_TOPIC_0000001163844398"></a>
## When to Use<a name="section910413166166"></a>
......
# Audio<a name="EN-US_TOPIC_0000001110946022"></a>
- **[Audio Overview](audio-overview.md)**
- **[Development Guidelines on Audio Playback](audio-playback.md)**
- **[Development Guidelines on Audio Management](audio-management.md)**
- **[Development Guidelines on Audio Recording](audio-recorder.md)**
# Contribution Process<a name="EN-US_TOPIC_0000001052970939"></a>
- [Preparations](#section124971410183614)
- [Downloading Code](#section6125202333611)
- [Committing Code](#section338918220422)
- [Creating a Pull Request](#section28261522124316)
- [Building Access Control](#section981124754415)
- [Reviewing Code](#section17823849145014)
## Preparations<a name="section124971410183614"></a>
- Install, configure, and use Git. For details, visit [https://gitee.com/help/categories/43](https://gitee.com/help/categories/43).
......
# FAQs<a name="EN-US_TOPIC_0000001053622377"></a>
[How Do I Create PRs at the Same Time If Multiple Code Repositories Have Compilation Dependencies?](#section169732563435)
[Sign-off-by Operations](#section-sign-off)
[Handling Exceptions of DCO Verification](#section-dco)
[Rollback](#section479422315253)
[Resolving Merge Conflicts](#section94417232274)
## How Do I Create PRs at the Same Time If Multiple Code Repositories Have Compilation Dependencies?<a name="section169732563435"></a>
During the development of the operating system \(OS\), it is common that multiple code repositories have compilation dependencies. Therefore, the PRs need to be created and merged at the same time. For this reason, Gitee uses issues as the association identifiers for code repositories with dependency dependencies to commit the PRs. Follow the operations below:
......
# Title \(Briefly Describe the Key Information of the Issue.\)<a name="EN-US_TOPIC_0000001051065413"></a>
This topic describes the issues encountered during development and their solutions, helping developers quickly address the issues.
## Template for Writing Minor Issues<a name="section1211416018447"></a>
Briefly describe the operations, issues, and solutions.
## Template for Writing Complex Issues<a name="section13861135611514"></a>
**Description**
- System software and version in use
- Problem description and trigger conditions
- Error messages
- Screenshots if available
**Possible Causes**
Analyze the causes of the problem. If there are multiple possible causes, list them one by one.
1. XXX
2. XXX
**Solutions**
- If there are multiple solutions, arrange them in order from least complex to most complex, and provide their respective scenarios.
- If possible, provide screenshots to help understand the steps.
- If the code has print output, provide the output content separately to help understand the solution procedure.
1. XXX
2. XXX
# Tutorial: Title \(Task Name\)<a name="EN-US_TOPIC_0000001050785644"></a>
A tutorial describes how to develop a complex task, feature, and application. Usually, the development process is divided into several sections, each with a series of steps. In addition, code examples are provided to help developers understand the specific feature implementation.
You should explain basic concepts mentioned in the tutorial, and suggest developers refer to specific corresponding topics in developer-oriented documents for in-depth concepts.
When you write the tutorial page, create a **MarkDown** file in the **others** directory.
## Overview<a name="section187784618017"></a>
Content: Describe the tasks that developers will do and the features and effects that developers will achieve after learning this tutorial. If multiple goals can be achieved, it is recommended that you use a bulleted list.
If possible, provide pictures or short videos to demonstrate the effect.
## Preparations<a name="section14914182112"></a>
- Provide the information about the required software, hardware, tools, and their version information.
- Describe required permissions.
## _XXX_ \(Key Task 1\)<a name="section1439712384145"></a>
Break down the tutorial into several sequential critical tasks or parallel scenario-specific tasks.
1. XXXX
```
// Sample code
```
2. XXXX
Comply with the following writing instructions on how to describe operations:
1. Specify the operation scenario and purpose for each step, and clarify the actor of each action.
2. Provide API descriptions and related sample codes if needed.
3. Provide screenshots of GUI-based steps for better understanding.
4. Ensure that code logic and syntax are correct.
5. Provides comments for key steps in the code.
6. Provide the output content if any.
## XXX \(Key Task 2\)<a name="section1228811105115"></a>
1. XXXX
## Next<a name="section096591885116"></a>
Describe the subsequent development tasks that may be associated with this tutorial. If there are no associated tasks, skip this topic.
# Configuring the Compilation Environment<a name="EN-US_TOPIC_0000001071315859"></a>
- [Linux Server](#section20979554791)
- [Node.js](#section9954105413153)
- [Installing hpm-cli Tool](#section15937194904819)
- [Python Environment](#section1621819180417)
- [File Packaging Tool](#section77617165913)
- [SCons](#section20558439191516)
![](figure/3516dv300.png)
## Linux Server<a name="section20979554791"></a>
......
# Developing Bundles<a name="EN-US_TOPIC_0000001051690861"></a>
- [Creating a Bundle](#section717481119145)
- [Defining an Existing Project as a Bundle](#section102861955201410)
- [Releasing the Bundle on the HPM Platform](#section1318574233211)
- [Referencing a Bundle](#section19311124115315)
- [Installing a Bundle Globally](#section165131927192120)
- [Compiling a Bundle](#section136732148541)
- [Defining the Build Script](#section10274147111610)
- [Executing the Build Script](#section879301916172)
- [Defining a Distribution](#section413216495619)
- [Defining Scripts](#section11503171219190)
- [Building a Distribution](#section4694125521912)
You can use any of the following methods to develop OpenHarmony bundles:
- Create a new bundle from scratch.
......
# Overview<a name="EN-US_TOPIC_0000001051452100"></a>
- [Bundle](#section196713235514)
- [Distribution](#section155387501033)
This section describes the bundle-specific concepts in HarmonyOS. It uses an example to step you through how to create, develop, build, release, and install a bundle using the **hpm-cli** tool.
## Bundle<a name="section196713235514"></a>
......@@ -37,5 +34,5 @@ A distribution is a complete HarmonyOS release that integrates various bundles,
**Figure 1** Relationship between bundles and a distribution<a name="fig85033524124"></a>
![](figure/组件和发行版的构成-英文.png)
![](figure/bundle-distribution.png)
# Installing hpm-cli Tool<a name="EN-US_TOPIC_0000001051770836"></a>
- [Installing Node.js and hpm](#section106591616205311)
- [\(Optional\) Configuring hpm](#section71821165412)
- [Downloading OpenHarmony Code](#section102338221707)
To develop a bundle, you first need to install the HarmonyOS Package Manager \(hpm\), a cross-platform command line tool developed based on Node.js. To run the hpm, you need to install Node.js, and then install the hpm using the Node Package Manager \(npm\).
## Installing Node.js and hpm<a name="section106591616205311"></a>
......
# Bundle Development Specifications<a name="EN-US_TOPIC_0000001051452141"></a>
- [Overview](#section1725818533344)
- [Definition](#section4821219183514)
- [Bundle Division Rules](#section1089794263513)
- [Bundle Dependency](#section25701647163710)
- [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<a name="section1725818533344"></a>
This document describes the basic concepts of a bundle and how to define it in compliance with specifications.
### Definition<a name="section4821219183514"></a>
......
# Driver Development<a name="EN-US_TOPIC_0000001051930361"></a>
- [Introduction](#section157425168112)
- [How to Develop](#section1969312275533)
## Introduction<a name="section157425168112"></a>
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](#fig3580184214210) shows the HDF driver model.
......
# Driver Configuration Management<a name="EN-US_TOPIC_0000001053493462"></a>
- [HDF Configuration Overview](#section59914284576)
- [Configuration Syntax](#section533713333580)
- [Keywords](#section4522107333)
- [Basic Structures](#section853042911312)
- [Data Types](#section177001259134)
- [Pre-Processing](#section14867121641)
- [Comments](#section1323412417)
- [Reference Modifications](#section193708571145)
- [Node Replication](#section1487792020513)
- [Delete](#section1096515391155)
- [Attribute References](#section20271317611)
- [Template](#section958819191063)
- [Configuration Generation](#section106152531919)
- [Introduction to hc-gen](#section359734416616)
## HDF Configuration Overview<a name="section59914284576"></a>
HCS is the source code that describes the configuration of the HDF using key-value pairs. It decouples the configuration code from driver code, thereby facilitating configuration management.
......
# Driver Message Mechanism Management<a name="EN-US_TOPIC_0000001052657065"></a>
- [When to Use](#section33014541954)
- [Available APIs](#section538852311616)
- [How to Develop](#section946912121153)
## When to Use<a name="section33014541954"></a>
When user-level applications need to interact with kernel-level drivers, the driver message mechanism of the HDF can be used.
......
# HDF Overview<a name="EN-US_TOPIC_0000001051611604"></a>
- [Introduction](#section0649162112376)
- [Driver Loading](#section68701942154319)
- [Driver Service Management](#section12453133414412)
- [Driver Message Mechanism](#section129410710451)
## Introduction<a name="section0649162112376"></a>
The Hardware Driver Foundation \(HDF\) provides the following driver framework capabilities: driver loading, driver service management, and driver message mechanism. This unified driver architecture platform is designed to provide a more precise and efficient development environment, where you can perform one-time development and multi-system deployment.
......
# HDF Development Example<a name="EN-US_TOPIC_0000001052451677"></a>
- [Adding Configuration](#section27261067111)
- [Compiling the Driver Code](#section177988005)
- [Compiling the Code for Interaction](#section6205173816412)
The following example shows how to add driver configuration, compile the driver code, and implement interaction between the user-state applications and the driver.
## Adding Configuration<a name="section27261067111"></a>
......
# Driver Service Management<a name="EN-US_TOPIC_0000001052777057"></a>
- [When to Use](#section14244270117)
- [Available APIs](#section1432412561722)
- [How to Develop](#section393515164416)
Driver services are objects of open capabilities provided by the HDF and are managed by the HDF in a unified manner. Using driver service management, you can release and obtain driver services.
The HDF uses the **policy** field in the configuration file to define policies for drivers to release services externally. The values and meanings of this field are as follows:
......
# WLAN<a name="EN-US_TOPIC_0000001051643558"></a>
- [Overview](#section729758162218)
- [WLAN Driver API Architecture](#section178022416377)
- [Available APIs](#section7331102018815)
- [How to Develop](#section15957746172412)
- [Development Example](#section1395253612512)
## Overview<a name="section729758162218"></a>
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:
......
# LCD<a name="EN-US_TOPIC_0000001052857284"></a>
- [Overview](#section141575391542)
- [API Description](#section53793327396)
- [How to Develop](#section12394223125615)
- [Development Example](#section7441155155813)
## Overview<a name="section141575391542"></a>
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](driver-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).
......
# Sensor<a name="EN-US_TOPIC_0000001078401780"></a>
- [Overview](#section3634112111)
- [Available APIs](#section20930112117478)
- [How to Develop](#section1140943382)
- [Development Example](#section257750691)
- [Test Guidelines](#section106021256121219)
## Overview<a name="section3634112111"></a>
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.
......
# TOUCHSCREEN<a name="EN-US_TOPIC_0000001052857350"></a>
- [Overview](#section175431838101617)
- [Available APIs](#section105459441659)
- [How to Develop](#section65745222184)
- [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<a name="section175431838101617"></a>
- **Functions of the Touchscreen driver**
......
# USB<a name="EN-US_TOPIC_0000001052857350"></a>
- [Overview](#section175431838101617)
- [Available APIs](#section17667171301711)
- [Development Guidelines](#section65745222184)
- [Developing Driver Using Host DDK APIs](#section865734181916)
- [Developing Driver Using Host Raw APIs](#section865734181916)
- [Developing Driver Using Device DDK APIs](#section865734181916)
- [Development Examples](#section263714411191)
- [Developing Driver Using Host DDK APIs](#section18249155619195)
- [Developing Driver Using Host Raw APIs](#section3571192072014)
- [Developing Driver Using Device DDK APIs](#section6356758162015)
## Overview <a name="section175431838101617"></a>
USB host development aims to provide host-related functions, including protocol encapsulation, device management, and driver installation and uninstall.
......
# ADC<a name="EN-US_TOPIC_0000001153677754"></a>
- [Overview](#section268031773165048)
- [How to Develop](#section100579767165048)
- [AdcMethod](#section1618135285210)
- [Development Example](#section1745221471165048)
## Overview<a name="section268031773165048"></a>
The analog-to-digital converter \(ADC\) is a device that converts analog signals into digital signals. In the Hardware Driver Foundation \(HDF\) framework, the ADC module uses the unified service mode for API adaptation. In this mode, a device service is used as the ADC manager to handle external access requests in a unified manner, which is reflected in the configuration file. The unified service mode applies to the scenario where there are many device objects of the same type, for example, when the ADC has more than 10 controllers. If the independent service mode is used, more device nodes need to be configured and memory resources will be consumed by services.
......
# GPIO<a name="EN-US_TOPIC_0000001206171135"></a>
- [Overview](#section1635911016188)
- [Available APIs](#section589913442203)
- [Usage Guidelines](#section259614242196)
- [How to Use](#section103477714216)
- [Determining a GPIO Pin Number](#section370083272117)
- [Using APIs to Operate GPIO Pins](#section13604050132118)
- [Usage Example](#section25941262111)
## Overview<a name="section1635911016188"></a>
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.
......
# GPIO<a name="EN-US_TOPIC_0000001153555758"></a>
- [Overview](#section1826197354103451)
- [How to Develop](#section731175315103451)
- [GpioMethod](#section20369125172319)
- [Development Example](#section800425816103451)
- [\#section83834353114](#section83834353114)
## Overview<a name="section1826197354103451"></a>
In the Hardware Driver Foundation \(HDF\) framework, the general-purpose input/output \(GPIO\) module uses the service-free mode for API adaptation. The service-free mode applies to the devices that do not provide user-mode APIs or the OS system that does not distinguish the user mode and the kernel mode. In the service-free mode, **DevHandle** \(a void pointer\) directly points to the kernel-mode address of the device object.
......
# I2C<a name="EN-US_TOPIC_0000001206171515"></a>
- [Overview](#section5361140416)
- [Available APIs](#section545869122317)
- [Usage Guidelines](#section1695201514281)
- [How to Use](#section1338373417288)
- [Opening an I2C Controller](#section13751110132914)
- [Performing I2C Communication](#section9202183372916)
- [Closing an I2C Controller](#section19481164133018)
- [Usage Example](#section5302202015300)
## Overview<a name="section5361140416"></a>
- The Inter-Integrated Circuit \(I2C\) is a simple, bidirectional, and synchronous serial bus that uses merely two wires.
......
# I2C<a name="EN-US_TOPIC_0000001153579420"></a>
- [Overview](#section2040078630114257)
- [How to Develop](#section1085786591114257)
- [I2cMethod and I2cLockMethod](#section1683458184518)
- [Development Example](#section1773332551114257)
## Overview<a name="section2040078630114257"></a>
The Inter-Integrated Circuit \(I2C\) bus is a simple and bidirectional two-wire synchronous serial bus developed by Philips. In the Hardware Driver Foundation (HDF) framework, the I2C module uses the unified service mode for API adaptation. In this mode, a device service is used as the I2C manager to handle external access requests in a unified manner, which is reflected in the configuration file. The unified service mode applies to the scenario where there are many device objects of the same type, for example, when the I2C module has more than 10 controllers. If the independent service mode is used, more device nodes need to be configured and memory resources will be consumed by services.
......
# MIPI DSI<a name="EN-US_TOPIC_0000001160971534"></a>
- [Overview](#section16806142183217)
- [Available APIs](#section12720125432316)
- [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<a name="section16806142183217"></a>
- 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<a name="EN-US_TOPIC_0000001199825369"></a>
- [Overview](#section1266787503161538)
- [How to Develop](#section545182932161538)
- [MipiDsiCntlrMethod](#section10711202141617)
- [Development Example](#section1167576616161538)
## Overview<a name="section1266787503161538"></a>
The Display Serial Interface \(DSI\) is a specification developed by the Mobile Industry Processor Interface \(MIPI\) Alliance to reduce the cost of display controllers in mobile devices. In the Hardware Driver Foundation (HDF) framework, the MIPI-DSI module uses the service-free mode for API adaptation. The service-free mode applies to the devices that do not provide user-mode APIs or the OS system that does not distinguish the user mode and the kernel mode. In the service-free mode, **DevHandle** \(a void pointer\) directly points to the kernel-mode address of the device object.
......
# MMC<a name="EN-US_TOPIC_0000001153669000"></a>
- [Overview](#section1846388309162704)
- [How to Develop](#section1617495117162704)
- [MmcCntlrOps](#section6203107192915)
- [Development Example](#section1220893490162704)
## Overview<a name="section1846388309162704"></a>
In the Hardware Driver Foundation \(HDF\) framework, the MultiMedia Card \(MMC\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# PWM<a name="EN-US_TOPIC_0000001160812684"></a>
- [Overview](#section1043395117296)
- [Available APIs](#section3939192652418)
- [Usage Guidelines](#section435718267334)
- [How to Use](#section113655616347)
- [Obtaining a PWM Device Handle](#section17816586359)
- [Setting the PWM Period](#section920214812397)
- [Setting the PWM Duty Cycle](#section519712820405)
- [Setting the PWM Polarity](#section12383334115)
- [Enabling the PWM Device](#section382684811414)
- [Disabling the PWM Device](#section16545114404218)
- [Obtaining PWM Device Configuration Parameters](#section117101243144311)
- [Setting PWM Device Configuration Parameters](#section13834163604414)
- [Releasing the PWM Device Handle](#section12987111511450)
- [Usage Example](#section138636719469)
## Overview<a name="section1043395117296"></a>
- Pulse width modulation \(PWM\) is a method used to digitally encode analog signal levels and convert them into pulses. It can be used for motor control and backlight brightness adjustment.
......
# PWM<a name="EN-US_TOPIC_0000001199714793"></a>
- [Overview](#section1591602238164144)
- [How to Develop](#section967396342164144)
- [PwmMethod](#section14560119104318)
- [Development Example](#section1883877829164144)
## Overview<a name="section1591602238164144"></a>
In the Hardware Driver Foundation \(HDF\) framework, the Pulse Width Modulator \(PWM\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# RTC<a name="EN-US_TOPIC_0000001206373007"></a>
- [Overview](#section104842041574)
- [Available APIs](#section20331159102519)
- [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<a name="section104842041574"></a>
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.
......
# RTC<a name="EN-US_TOPIC_0000001153785954"></a>
- [Overview](#section509989381142407)
- [How to Develop](#section1784450860142407)
- [RtcMethod](#section13652132473017)
- [Development Example](#section1594883301142407)
## Overview<a name="section509989381142407"></a>
In the Hardware Driver Foundation \(HDF\) framework, the real-time clock \(RTC\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# SDIO<a name="EN-US_TOPIC_0000001160653028"></a>
- [Overview](#section1155271783811)
- [Available APIs](#section12601496259)
- [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)
- [Usage Example](#section376910122382)
## Overview<a name="section1155271783811"></a>
- 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<a name="EN-US_TOPIC_0000001199682295"></a>
- [Overview](#section1347805272150053)
- [How to Develop](#section581179475150053)
- [SdioDeviceOps](#section482911395315)
- [Development Example](#section2112250242150053)
## Overview<a name="section1347805272150053"></a>
A Secure Digital Input Output \(SDIO\) card is an extension of the SD specification to cover I/O functions. SD and SDIO are called multimedia card \(MMCs\). In the Hardware Driver Foundation \(HDF\) framework, the SDIO module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# SPI<a name="EN-US_TOPIC_0000001206171293"></a>
- [Overview](#section193356154511)
- [Available APIs](#section1325964832615)
- [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)
- [Usage Example](#section06541058155120)
## Overview<a name="section193356154511"></a>
- Serial Peripheral Interface \(SPI\) is a serial bus specification used for high-speed, full-duplex, and synchronous communication.
......
# SPI<a name="EN-US_TOPIC_0000001199690327"></a>
- [Overview](#section84922229152909)
- [How to Develop](#section799667984152909)
- [SpiCntlrMethod](#section715682993110)
- [Development Example](#section956157227152909)
## Overview<a name="section84922229152909"></a>
In the Hardware Driver Foundation \(HDF\) framework, the Serial Peripheral Interface \(SPI\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# UART<a name="EN-US_TOPIC_0000001160652800"></a>
- [Overview](#section833012453535)
- [Available APIs](#section1928742202715)
- [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)
- [Usage Example](#section35404241311)
## Overview<a name="section833012453535"></a>
- 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<a name="EN-US_TOPIC_0000001153656474"></a>
- [Overview](#section1761881586154520)
- [How to Develop](#section944397404154520)
- [UartHostMethod](#section192316441461)
- [Development Example](#section774610224154520)
## Overview<a name="section1761881586154520"></a>
In the Hardware Driver Foundation \(HDF\) framework, the Universal Asynchronous Receiver/Transmitter \(UART\) uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# Watchdog<a name="EN-US_TOPIC_0000001206372825"></a>
- [Overview](#section14918241977)
- [Available APIs](#section1180575010271)
- [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 name="section14918241977"></a>
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.
......
# Watchdog<a name="EN-US_TOPIC_0000001199821009"></a>
- [Overview](#section1315827527160117)
- [How to Develop](#section477974542160117)
- [WatchdogMethod](#section220331929)
- [Development Example](#section1832270347160117)
## Overview<a name="section1315827527160117"></a>
In the Hardware Driver Foundation \(HDF\) framework, the Watchdog \(also called Watchdog timer\) module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
......
# Burning<a name="EN-US_TOPIC_0000001170009518"></a>
- [Mini and Small Systems](#section278314413530)
- ["Error: Opening COMxx: Access denied" Is Displayed After a Serial Port Is Selected for Burning](#section18988185615914)
- [What should I do when the image failed to be burnt?](#section1370982513317)
- [What should I do when no command output is displayed?](#section183421944953)
- [What should I do when Windows-based PC failed to be connected to the board?](#section1215410450215)
## Mini and Small Systems<a name="section278314413530"></a>
### "Error: Opening COMxx: Access denied" Is Displayed After a Serial Port Is Selected for Burning<a name="section18988185615914"></a>
......
# Compilation and Building Subsystem<a name="EN-US_TOPIC_0000001215530845"></a>
- [Mini and Small Systems](#section78686441462)
- [Invalid -- w Option](#section67961431372)
- [Library ncurses Not Found](#section199631617371)
- [mcopy not Found](#section937435175)
- [No riscv File or Directory](#section1115535018713)
- [No Crypto](#section17982573813)
- [Unexpected Operator](#section53663205819)
- [What should I do when the message Could not find a version that satisfies the requirement six\>=1.9.0 is displayed during compilation and building?](#section1917790845)
- [What should I do when the message cannot find -lgcc is displayed during compilation and building?](#section141771701647)
- [What should I do when the message indicating Python cannot be found is displayed during compilation and building?](#section51781202415)
- [What should I do when the message indicating Python 3 cannot be found is displayed during compilation and building?](#section1917950148)
## Mini and Small Systems<a name="section78686441462"></a>
### Invalid -- w Option<a name="section67961431372"></a>
......
# Environment Setup<a name="EN-US_TOPIC_0000001215650793"></a>
- [Mini and Small Systems](#section1742119306399)
- [What should I do if garbled characters and segmentation faults occur during hb installation?](#section36351051193919)
- [What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?](#section48221013144011)
- [What should I do if the message "module 'platform' has no attribute 'linux\_distribution'" is displayed during hb installation?](#section10307193044111)
- [What should I do if the message "Could not find a version that satisfies the requirement ohos-build" is displayed during hb installation?](#section8692735427)
- [What should I do when the message configure: error: no acceptable C compiler found in $PATH is displayed during Python 3 installation?](#section870082884217)
- [What should I do when the message -bash: make: command not found is displayed during Python 3 installation?](#section198707170455)
- [What should I do when the message zlib not available is displayed during Python 3 installation?](#section85401445204518)
- [What should I do when the message No module named '\_ctypes' is displayed during Python 3 installation?](#section12202694460)
- [What should I do when an error with lsb\_release occurs during kconfiglib installation?](#section5803174135115)
- [What should I do if the message "ImportError: No module named apt\_pkg" is displayed during the execution of an unidentifiable command?](#section510820516515)
## Mini and Small Systems<a name="section1742119306399"></a>
### What should I do if garbled characters and segmentation faults occur during hb installation?<a name="section36351051193919"></a>
......
# Kernel<a name="EN-US_TOPIC_0000001169850498"></a>
- [Basic Kernel](#section263912372168)
- [What are the differences between APIs provided by LiteOS-A and LiteOS-M?](#section447571122918)
- [How do I analyze thread stack overflow?](#section8623141711293)
- [File System](#section098519592162)
- [What should I do when the Hi3516 board fails to open the same file in write mode \(LiteOS-A\)?](#section517972255311)
- [What hardware platforms are supported by the LiteOS kernel?](#section868413518533)
- [What chip architectures are supported by the LiteOS kernel?](#section1131661465417)
- [Third-party Components](#section971818231178)
- [What third-party components are supported by OpenHarmony?](#section74138185411)
- [What should I do if the key length verification fails when OpenSSL is used on OpenHarmony?](#section10564614135516)
- [Does setsockopt support SO\_RCVBUF and SO\_SNDBUF?](#section2093373215556)
- [Compilation and Linking](#section10955302179)
- [How do I run an application developed by ARM Linux on LiteOS-A?](#section1164175713557)
- [What system is used for OpenHarmony compilation? What compiler is used?](#section132287223567)
- [For a third-party component that is independently compiled into a static library and used on LiteOS-M, what should I do when the component's global variable value is incorrect or the system is suspended after the component's function is called?](#section15189154225619)
- [What should I do if the message "use VFP register arguments, xxx.o does not" is displayed when LiteOS-A generates a target executable file?](#section193571012578)
- [What should I do when calling clock\_gettime obtains an incorrect time?](#section8973152015717)
## Basic Kernel<a name="section263912372168"></a>
### What are the differences between APIs provided by LiteOS-A and LiteOS-M?<a name="section447571122918"></a>
......
# Overview of FAQs<a name="EN-US_TOPIC_0000001169691604"></a>
- [Environment Setup](#section93289248249)
- [Mini and Small Systems](#section197234983111)
- [Compilation and Building](#section18826114693810)
- [Mini and Small Systems](#section693410399)
- [Burning](#section6556741113712)
- [Mini and Small Systems](#section1029933713812)
- [Kernel](#section13741125564211)
- [Basic Kernel](#section1723365191114)
- [File System](#section14523145918136)
- [Chip Adaptation](#section141541939159)
- [Third-party Components](#section4988163321816)
- [Compilation and Linking](#section080219574225)
- [Porting](#section129331824154313)
- [Startup and Recovery](#section83501764443)
- [System Services](#section19567132114455)
- [Utils](#section3214181711465)
- [Visual Applications](#section295651815466)
- [HDC](#section178081876506)
FAQs are used to help developers solve problems frequently encountered during development. They cover a wide range of topics.
## Environment Setup<a name="section93289248249"></a>
......
# Porting<a name="EN-US_TOPIC_0000001215769367"></a>
- [How Do I Mount the Heap Memory to the Kernel?](#section21471536184914)
## How Do I Mount the Heap Memory to the Kernel?<a name="section21471536184914"></a>
- The following table describes the macros for configuring the kernel heap memory. You can configure them as required in the **target\_config.h** file.
......
# Startup and Recovery<a name="EN-US_TOPIC_0000001215449321"></a>
- [System startup interrupted due to "parse failed!" error](#section835662214302)
- [System automatically restarted again and again](#section3857921143117)
- [Failed to call the SetParameter or GetParameter API with correct parameter values](#section548818116328)
## System startup interrupted due to "parse failed!" error<a name="section835662214302"></a>
**Problem**
......
# System Applications<a name="EN-US_TOPIC_0000001169690992"></a>
- [Utils](#section639433461512)
- [1. Failure in running the KV store on the LiteOS-A kernel \(Hi3516 or Hi3518\) due to incorrect path setting for the KV store](#section16520347131511)
- [Visual Applications](#section787718474161)
- [Is there a global variable that can be accessed by all pages?](#section187297991718)
- [How do I obtain DOM elements?](#section1833493719175)
- [How do I pass values between pages?](#section184283812183)
- [How do I scroll a list to an item?](#section11897734131811)
- [Does the <text\> component support multiple lines?](#section5872656121814)
- [Why is a component not displayed?](#section7397125317107)
- [How do I implement scrolling on a page?](#section338794422010)
- [Why do not the left and top attributes take effect?](#section2597193611217)
- [Why does not dynamic binding take effect?](#section6939050172115)
- [How do I implement relative and absolute positioning?](#section5547311192215)
- [How do I display or hide a component?](#section16107113352213)
- [What are the precautions for using the margin attribute?](#section1524910142314)
- [What are the precautions for event subscription?](#section1537132012231)
- [What are the precautions for using dynamic binding?](#section96561452236)
- [How does the loop attribute take effect for <swiper\>?](#section690166112414)
- [What are the precautions for using an array?](#section1554552822414)
- [HDC](#section412357182518)
- [hdc\_std Fails to Connect to a Device](#section1965012223257)
- [hdc\_std Fails to Run](#section1157575212515)
## Utils<a name="section639433461512"></a>
### 1. Failure in running the KV store on the LiteOS-A kernel \(Hi3516 or Hi3518\) due to incorrect path setting for the KV store<a name="section16520347131511"></a>
......
# Docker Environment<a name="EN-US_TOPIC_0000001055701144"></a>
- [Introduction](#section107932281315)
- [Preparations](#section7337134183512)
- [Standalone Docker Environment](#section2858536103611)
- [Setting Up the Docker Environment for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\)](#section319412277287)
- [Building for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\)](#section631485163615)
- [Setting Up the Docker Environment for Standard-System Devices \(reference memory ≥ 128 MB\)](#section13585262391)
- [Building for Standard-System Devices \(reference memory ≥ 128 MB\)](#section193711513406)
- [HPM-based Docker Environment](#section485713518337)
- [Setting Up the Docker Environment](#section3295842510)
- [Obtaining and Building Source Code](#section69141039143518)
## Introduction<a name="section107932281315"></a>
OpenHarmony provides the following two types of Docker environments for you to quickly get the development environment ready:
......
# IDE<a name="EN-US_TOPIC_0000001128361880"></a>
- [Acquiring the Device Development Tool \(HUAWEI DevEco Device Tool\)](#section2452141120244)
- [Acquiring the Application Development Tool \(HUAWEI DevEco Studio\)](#section0904101019258)
## Acquiring the Device Development Tool \(HUAWEI DevEco Device Tool\)<a name="section2452141120244"></a>
HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE\) provided to develop applications for OpenHarmony devices. It allows on-demand customization of OpenHarmony components, code editing, building, burning, and debugging, and supports C and C++ languages. This tool is installed in Visual Studio Code as a plug-in. For details, see [HUAWEI DevEco Device Tool](https://device.harmonyos.com/en/ide) and [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
......
# Obtaining Source Code<a name="EN-US_TOPIC_0000001150448437"></a>
- [About OpenHarmony](#section6370143622110)
- [Overview of Source Code Acquisition](#section12763342204)
- [Method 1: Acquiring Source Code from the Gitee Code Repository](#section537312010229)
- [When to Use](#section10881513459)
- [Prerequisites](#section102871547153314)
- [How to Use](#section429012478331)
- [Method 2: Acquiring Source Code from DevEco Marketplace](#section463013147412)
- [When to Use](#section26661067443)
- [Prerequisites](#section17544943123315)
- [How to Use](#section954619433333)
- [Method 3: Acquiring Source Code from a Mirror Site](#section1186691118430)
- [Method 4: Acquiring Source Code from the GitHub Image Repository \(at 23:00 UTC Every Day\)](#section23448418360)
- [ Source Code Directories](#section1072115612811)
## About OpenHarmony<a name="section6370143622110"></a>
OpenHarmony is an open-source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system \(OS\) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era.
......
# Glossary<a name="EN-US_TOPIC_0000001111039518"></a>
- [A](#en-us_topic_0000001050749051_section1679023922312)
- [B](#en-us_topic_0000001050749051_section62182102017)
- [D](#en-us_topic_0000001050749051_section1670294920236)
- [F](#en-us_topic_0000001050749051_section5406185415236)
- [H](#en-us_topic_0000001050749051_section891816813243)
- [I](#en-us_topic_0000001050749051_section10124052142516)
- [P](#en-us_topic_0000001050749051_section779354121411)
- [S](#en-us_topic_0000001050749051_section25661636182615)
## A<a name="en-us_topic_0000001050749051_section1679023922312"></a>
- **Ability**
......
# Photographing<a name="EN-US_TOPIC_0000001054915940"></a>
- [When to Use](#en-us_topic_0000001052170554_section1963312376119)
- [Available APIs](#en-us_topic_0000001052170554_section56549532016)
- [Limitations and Constraints](#en-us_topic_0000001052170554_section1165911177314)
- [How to Develop](#en-us_topic_0000001052170554_section138543918214)
## When to Use<a name="en-us_topic_0000001052170554_section1963312376119"></a>
Use the camera module APIs to capture frames \(photographing\).
......
# Previewing<a name="EN-US_TOPIC_0000001055394496"></a>
- [When to Use](#en-us_topic_0000001051930577_section186634310418)
- [Available APIs](#en-us_topic_0000001051930577_section125479541744)
- [Limitations and Constraints](#en-us_topic_0000001051930577_section1165911177314)
- [How to Develop](#en-us_topic_0000001051930577_section34171333656)
## When to Use<a name="en-us_topic_0000001051930577_section186634310418"></a>
Use the camera module APIs to generate and play video streams.
......
# Video Recording<a name="EN-US_TOPIC_0000001055234528"></a>
- [When to Use](#en-us_topic_0000001051451869_section186634310418)
- [Available APIs](#en-us_topic_0000001051451869_section125479541744)
- [Limitations and Constraints](#en-us_topic_0000001051451869_section1165911177314)
- [How to Develop](#en-us_topic_0000001051451869_section1196016315516)
## When to Use<a name="en-us_topic_0000001051451869_section186634310418"></a>
Use the camera module APIs to capture video streams.
......
# Adding Pages<a name="EN-US_TOPIC_0000001054607703"></a>
- [Creating the Home Page](#section16935511143715)
- [Creating the Details Page](#section122131729173819)
## Creating the Home Page<a name="section16935511143715"></a>
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.
......
# Building the Details Page<a name="EN-US_TOPIC_0000001054727679"></a>
- [detail.hml](#section275215487291)
- [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 **<div\>** components instead of one **<chart\>** component.
Add a root **<div\>**, set the **flex-direction** attribute to **column** to arrange the two bars vertically. The sample code is as follows:
......
# FAQs<a name="EN-US_TOPIC_0000001055049072"></a>
- [Visual Application FAQs](#section147421736145813)
- [Is there a global variable that can be accessed by all pages?](#section294382614018)
- [How do I obtain DOM elements?](#section1423713435019)
- [How do I pass values between pages?](#section119822143117)
- [How do I scroll a list to an item?](#section188663819111)
- [Does the <text\> component support multiple lines?](#section205741157418)
- [Why is a component not displayed?](#section1345810151025)
- [How do I implement scrolling on a page?](#section1724052813218)
- [Why do not the left and top attributes take effect?](#section34659571520)
- [Why does not dynamic binding take effect?](#section1758881511313)
- [How do I implement relative and absolute positioning?](#section1378730235)
- [How do I display or hide a component?](#section1243424718312)
- [What are the precautions for using the margin attribute?](#section7923357414)
- [What are the precautions for event subscription?](#section91641925548)
- [What are the precautions for using dynamic binding?](#section1292412431744)
- [How does the loop attribute take effect for <swiper\>?](#section1136434952)
- [What are the precautions for using an array?](#section1979819133510)
## Visual Application FAQs<a name="section147421736145813"></a>
### Is there a global variable that can be accessed by all pages?<a name="section294382614018"></a>
......
# Overview<a name="EN-US_TOPIC_0000001055367650"></a>
- [Display Effects](#section3997224182313)
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<a name="section3997224182313"></a>
......
# Preparations<a name="EN-US_TOPIC_0000001055087693"></a>
- [Setting Up the Development Environment](#section1912530122716)
- [Creating a Project](#section1456035192720)
## Setting Up the Development Environment<a name="section1912530122716"></a>
Download and install DevEco Studio. For details, see the [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/software_install-0000001053582415).
......
# Development Guidelines on Clock Apps<a name="EN-US_TOPIC_0000001115417926"></a>
- [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<a name="section11522349121115"></a>
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.
......
# Development Example for Platform Drivers<a name="EN-US_TOPIC_0000001157064271"></a>
- [Overview](#section194201316174215)
- [Preparations](#section6926133918422)
- [Development](#section65801539470)
- [File Description](#section0708184454414)
- [Instantiating the Driver Entry](#section85325864412)
- [Setting Related Parameters](#section8155172019453)
- [Adding a Controller](#section1335374114452)
- [Building Source Code and Burning Images](#section164824754712)
## Overview<a name="section194201316174215"></a>
This document uses the I2C driver as an example to describe how to develop platform drivers based on the hardware driver foundation \(HDF\).
......
# Photographing<a name="EN-US_TOPIC_0000001054954859"></a>
- [When to Use](#en-us_topic_0000001052170554_section1963312376119)
- [Available APIs](#en-us_topic_0000001052170554_section56549532016)
- [Limitations and Constraints](#en-us_topic_0000001052170554_section1165911177314)
- [How to Develop](#en-us_topic_0000001052170554_section138543918214)
## When to Use<a name="en-us_topic_0000001052170554_section1963312376119"></a>
Use the camera module APIs to capture frames \(photographing\).
......
# Video Recording<a name="EN-US_TOPIC_0000001054754827"></a>
- [When to Use](#en-us_topic_0000001051451869_section186634310418)
- [Available APIs](#en-us_topic_0000001051451869_section125479541744)
- [Limitations and Constraints](#en-us_topic_0000001051451869_section1165911177314)
- [How to Develop](#en-us_topic_0000001051451869_section1196016315516)
## When to Use<a name="en-us_topic_0000001051451869_section186634310418"></a>
Use the camera module APIs to capture video streams.
......
# Development Example for Peripheral Drivers<a name="EN-US_TOPIC_0000001157063303"></a>
- [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<a name="section86753818426"></a>
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 OpenHarmony peripheral driver development.
......
# LED Peripheral Control<a name="EN-US_TOPIC_0000001054530966"></a>
- [Overview](#section14639174516337)
- [Development](#section13857170163412)
- [Verification](#section1949121910344)
## Overview<a name="section14639174516337"></a>
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.
......
# Third-Party SDK Integration<a name="EN-US_TOPIC_0000001051612018"></a>
- [Planning a Directory Structure](#section1736472718351)
- [Building the Service libs](#section442815485351)
- [Compiling Adaptation Code](#section3984721113613)
- [Compiling Code](#section830417531286)
- [Compiling a Script](#section13500201173710)
- [Compiling Service Code](#section8754114803918)
- [Runtime](#section7737749184012)
- [End](#section153301392411)
To build a more open and complete Internet of Things \(IoT\) ecosystem, OpenHarmony has opened up a group of directories to integrate SDKs provided by different vendors. This guide describes how to integrate SDKs into OpenHarmony based on the Hi3861 board.
## Planning a Directory Structure<a name="section1736472718351"></a>
......
# Kernel Coding Specification<a name="EN-US_TOPIC_0000001079036432"></a>
- [Principle](#section9512812145915)
- [Directory Structure](#section1355317267017)
- [Naming](#section1375364815017)
- [Comments](#section1692516179119)
- [Format](#section10888536113)
- [Macros](#section12276501124)
- [Header Files](#section158507231319)
- [Data Types](#section91351731446)
- [Variables](#section575493915417)
- [Assertions](#section13864440410)
- [Functions](#section671919481745)
This kernel coding specification is developed based on the general programming specifications in the industry. It defines the programming styles for kernel developers to follow.
## Principle<a name="section9512812145915"></a>
......
# Doubly Linked List<a name="EN-US_TOPIC_0000001078588390"></a>
- [Basic Concepts](#section1990715203418)
- [Available APIs](#section848334511411)
- [How to Develop](#section01781261552)
- [Development Example](#section67569495514)
- [Example Description](#section48761994551)
- [Sample Code](#section1280202685519)
- [Verification](#section5811249105512)
## Basic Concepts<a name="section1990715203418"></a>
A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains a pointer to the previous node and a pointer to the next node in the sequence of nodes. The pointer head is unique.
......
# CMSIS Support<a name="EN-US_TOPIC_0000001124074753"></a>
- [Basic Concepts](#section131091144111615)
- [Development Guidelines](#section57653573161)
- [Available APIs](#section1795910417173)
- [How to Develop](#section48301225131720)
- [Development Example](#section524434761713)
## Basic Concepts<a name="section131091144111615"></a>
The Cortex Microcontroller Software Interface Standard \([CMSIS](https://developer.arm.com/tools-and-software/embedded/cmsis)\) is a vendor-independent hardware abstraction layer for microcontrollers based on Arm Cortex processors. Of the CMSIS components, the Real Time Operating System \(RTOS\) defines a set of universal and standardized APIs to reduce the dependency of application developers on specific RTOS and facilitate software porting and reuse. The CMSIS provides CMSIS-RTOS v1 and CMSIS-RTOS v2. The OpenHarmony LiteOS-M supports only the implementation of CMSIS-RTOS v2.
......
# POSIX Support<a name="EN-US_TOPIC_0000001078589734"></a>
- [Basic Concepts](#section1757915134139)
- [Development Guidelines](#section1573664211318)
- [Available APIs](#section10429150121317)
- [Important Notes](#section109174418147)
- [Development Example](#section206149278155)
## Basic Concepts<a name="section1757915134139"></a>
The OpenHarmony kernel uses the **musl libc** library and self-developed APIs and supports the Portable Operating System Interface \(POSIX\). You can develop components and applications working on the kernel based on the POSIX.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001079036458"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section11841123033618)
- [Development Example](#section460018317164)
- [Verification](#section1048572415182)
When an interrupt request is generated by a peripheral, the CPU suspends the current task and responds to the interrupt request. You need to register the interrupt handler and specify the operation to be performed by the CPU.
## Available APIs<a name="section158501652121514"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001123763599"></a>
- [Working Principles](#section1735611583011)
- [Event Control Block](#section1161415384467)
- [Working Principles](#section187761153144617)
An event is a mechanism for communication between tasks. It can be used to synchronize tasks. The events have the following features:
- Events can be synchronized in one-to-many or many-to-many mode. In one-to-many mode, a task can wait for multiple events. In many-to-many mode, multiple tasks can wait for multiple events. However, a write event wakes up only one task from the block.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078876508"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section896412438910)
- [Sample Code](#section149077554912)
- [Verification](#section4461439172017)
## Available APIs<a name="section158501652121514"></a>
<a name="table14277123518139"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001078716896"></a>
- [Working Principles](#section115161649726)
A mutual exclusion \(mutex\) is a special binary semaphore used for exclusive access to shared resources.
A mutex can be unlocked or locked. When a mutex is held by a task, the mutex is locked and the task obtains the ownership of the mutex. When the task releases the mutex, the mutex is unlocked and the task will lose the ownership of the mutex. When a task holds a mutex, other tasks cannot unlock or hold the mutex.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078588414"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section1426719434114)
- [Example Description](#section896412438910)
- [Sample Code](#section149077554912)
- [Verification](#section2059413981311)
## Available APIs<a name="section158501652121514"></a>
**Table 1** APIs of the mutex module
......
# Basic Concepts<a name="EN-US_TOPIC_0000001078876506"></a>
- [Working Principles](#section1582619446311)
- [Queue Control Block](#section1648304614720)
- [Working Principles](#section15384012164811)
A queue, also called a message queue, is a data structure used for communication between tasks. The queue receives messages of unfixed length from tasks or interrupts, and determines whether to store the transferred messages in the queue based on different APIs.
Tasks can read messages from a queue. When the queue has no messages, the tasks are suspended. When the queue has a new message, the suspended tasks are woken up and process the new message. Tasks can also write messages to the queue. When the queue is full, the write task is suspended. When there is an available message node in the queue, the suspended write task is woken up and writes a message.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001123763635"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section2148236125814)
- [Sample Code](#section121451047155716)
- [Verification](#section2742182082117)
## Available APIs<a name="section158501652121514"></a>
<a name="table10903105695114"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001124066587"></a>
- [Working Principles](#section1794010261861)
- [Semaphore control block](#section11372149164815)
- [Working Principles](#section139726510491)
Semaphore is a mechanism for implementing inter-task communication. It implements synchronization between tasks or exclusive access to shared resources.
In the data structure of a semaphore, there is a value indicating the number of shared resources available. The value can be:
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078876452"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section22061718111412)
- [Sample Code](#section1775922321416)
- [Verification](#section160404016213)
## Available APIs<a name="section158501652121514"></a>
<a name="table1078714915105"></a>
......
# Dynamic Memory<a name="EN-US_TOPIC_0000001123763647"></a>
- [Working Principles](#section328282013571)
- [Development Guidelines](#section7921151015814)
- [When to Use](#section326917198583)
- [Available APIs](#section1032331584)
- [How to Develop](#section07271773592)
- [Development Example](#section84931234145913)
- [Verification](#section165233233917)
## Working Principles<a name="section328282013571"></a>
Dynamic memory management allows memory blocks of any size to be allocated from a large contiguous memory \(memory pool or heap memory\) configured in the system based on user demands when memory resources are sufficient. The memory block can be released for further use when not required. Compared with static memory management, dynamic memory management allows memory allocation on demand but causes fragmentation of memory.
......
# Static Memory<a name="EN-US_TOPIC_0000001078876516"></a>
- [Working Principles](#section165473517522)
- [Development Guidelines](#section57511620165218)
- [When to Use](#section215474911529)
- [Available APIs](#section79231214539)
- [How to Develop](#section1388511316548)
- [Development Example](#section17801515105519)
- [Verification](#section11818154112319)
## Working Principles<a name="section165473517522"></a>
The static memory is a static array. The block size in the static memory pool is set during initialization and cannot be changed after initialization.
......
# Basic Concepts<a name="EN-US_TOPIC_0000001124074751"></a>
- [Working Principles](#section070665816719)
- [Timer States](#section115453813506)
- [Timer Modes](#section137521353175010)
The software timer is a software-simulated timer based on system tick interrupts. When the preset tick counter value has elapsed, the user-defined callback will be invoked. The timing precision is related to the cycle of the system tick clock.
Due to the limitation in hardware, the number of hardware timers cannot meet users' requirements. Therefore, the OpenHarmony LiteOS-M kernel provides the software timer function. The software timer allows more timing services to be created, increasing the number of timers.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001078718194"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section3741753191918)
- [Sample Code](#section20760101182016)
- [Verification](#section11244112818172)
## Available APIs<a name="section158501652121514"></a>
The following table describes APIs available for the OpenHarmony LiteOS-M software timer module. For more details about the APIs, see the API reference.
......
# Basic Concepts<a name="EN-US_TOPIC_0000001123863155"></a>
- [Task-related Concepts](#section673132352511)
- [Task Running Mechanism](#section176294469251)
From the perspective of the operating system, tasks are the minimum running units that compete for system resources. They can use or wait for CPUs, use system resources such as memory, and run independently.
The task module of the OpenHarmony LiteOS-M provides multiple tasks and supports switching between tasks, helping users manage business process procedures. The task module has the following features:
......
# Development Guidelines<a name="EN-US_TOPIC_0000001123948079"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Verification](#section189023104457)
When a task is created, the OpenHarmony LiteOS-M kernel can perform operations, such as locking or unlocking task scheduling, suspending, restoring, and delaying the task, and setting or obtaining the task priority.
## Available APIs<a name="section158501652121514"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001078876456"></a>
- [Time Unit](#section97172532397)
Time management provides all time-related services for applications based on the system clock.
The system clock is generated by the interrupts triggered by the output pulse of a timer or counter. The system clock is generally defined as an integer or a long integer. The period of an output pulse is a "clock tick". The system clock is also called time scale or tick.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001124066545"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section127752801718)
- [Sample Code](#section321653551711)
- [Verification](#section4366193318167)
The time management module provides APIs to implement conversion between the system running time, ticks, and seconds/milliseconds.
## Available APIs<a name="section158501652121514"></a>
......
# Basic Concepts<a name="EN-US_TOPIC_0000001123948105"></a>
- [Working Principles](#section96644177124)
The central processing unit percent \(CPUP\) includes the system CPUP and task CPUP.
The system CPUP is the CPU usage of the system within a period of time. It reflects the CPU load and the system running status \(idle or busy\) in the given period of time. The valid range of the system CPUP is 0 to 100 in percentage. The precision can be adjusted through configuration. The value **100** indicates that the system runs with full load.
......
# Development Guidelines<a name="EN-US_TOPIC_0000001079036450"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section783435801510)
- [Development Example](#section460018317164)
- [Example Description](#section51413507517)
- [Sample Code](#section17617965523)
- [Verification](#section1968771515188)
## Available APIs<a name="section158501652121514"></a>
**Table 1** Functions
......
# Basic Concepts<a name="EN-US_TOPIC_0000001136130422"></a>
- [Working Principles](#section139861939219)
- [Exporting the Symbol Table](#section15414650102716)
- [Loading an ELF File](#section5221181562810)
- [ELF File Link](#section68441639182817)
- [ELF Specifications](#section187315541916)
- [ELF Type](#section1701552268)
- [Options for Linking](#section17292133274)
In small devices with limited hardware resources, dynamic algorithm deployment capability is required to solve the problem that multiple algorithms cannot be deployed at the same time. The LiteOS-M kernel uses the Executable and Linkable Format \(ELF\) because it is easy to use and compatible with a wide variety of platforms. The LiteOS-M provides APIs similar to **dlopen** and **dlsym**. Apps can load and unload required algorithm libraries by using the APIs provided by the dynamic loading module. As shown in the following figure, the app obtains the corresponding information output through the API required by the third-party algorithm library. The third-party algorithm library depends on the basic APIs provided by the kernel, such as **malloc**. After the app loads the API and relocates undefined symbols, it can call the API to complete the function. The dynamic loading component supports only the Arm architecture. In addition, the signature and source of the shared library to be loaded must be verified to ensure the system security.
**Figure 1** LiteOS-M kernel dynamic loading architecture<a name="fig3662173651419"></a>
......
# Development Guidelines<a name="EN-US_TOPIC_0000001182409801"></a>
- [Available APIs](#section158501652121514)
- [How to Develop](#section5241132917523)
- [Development Example](#section8708112313531)
## Available APIs<a name="section158501652121514"></a>
**Table 1** Functions
......
# FAT<a name="EN-US_TOPIC_0000001153180399"></a>
- [Basic Concepts](#section1772629121418)
- [Development Guidelines](#section1149072811148)
- [Adaptation of Drivers](#section19174939191414)
- [How to Develop](#section131211626151513)
- [Development Example](#section1133718619459)
- [Example Description](#section45337345313)
- [Sample Code](#section119813171539)
- [Verification](#section7987101232311)
## Basic Concepts<a name="section1772629121418"></a>
File Allocation Table \(FAT\) is a file system developed for personal computers. It consists of the DOS Boot Record \(DBR\) region, FAT region, and Data region. Each entry in the FAT region records information about the corresponding cluster in the storage device. The cluster information includes whether the cluster is used, number of the next cluster of the file, whether the file ends with the cluster. The FAT file system supports multiple formats, such as FAT12, FAT16, and FAT32. The numbers 12, 16, and 32 indicate the number of bytes per cluster within the FAT, respectively. The FAT file system supports multiple media, especially removable storage media \(such as USB flash drives, SD cards, and removable hard drives\). The FAT file system ensures good compatibility between embedded devices and desktop systems \(such as Windows and Linux\) and facilitates file management.
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册