未验证 提交 74abdff4 编写于 作者: O openharmony_ci 提交者: Gitee

!21147 [翻译完成】#I7HAP5 (PR19268)

Merge pull request !21147 from Annie_wang/PR20122
......@@ -6,7 +6,7 @@
The Liquid Crystal Display (LCD) driver performs operations such as powering on the LCD and initializing the internal registers of the driver integrated circuits (ICs).
The display driver model based on the [Hardware Driver Foundation (HDF)](../driver/driver-hdf-overview.md) provides the following functions:
The display driver model based on the [Hardware Driver Foundation (HDF)](driver-overview-foundation.md) provides the following functions:
- Provides a basic framework for LCD driver development to improve development efficiency.
......@@ -46,7 +46,7 @@ The LCD interfaces include the Mobile Industry Processor Interface (MIPI) Displa
![](figures/ttl-interface.png "ttl-interface")
TTL level signals are generated by TTL devices, which are a major type of digital integrated circuits. TTL devices are manufactured using the bipolar process and feature high speed, low power consumption, and diversified types.
TTL level signals are generated by TTL devices, which are a major type of digital integrated circuits. TTL devices are manufactured using the bipolar process and feature high speed, low power consumption, and diversified types.
The TTL interface is used to transmit data in parallel mode under control signals. It transmits data signals, clock signals, and control signals (such as line synchronization signals, frame synchronization signals, and data validity signals). For the LCD with the TTL, additional peripheral interfaces, such as the Serial Peripheral Interface (SPI) and Inter-Integrated Circuit (I2C), are required for the read and write of the internal registers.
......@@ -62,11 +62,13 @@ Before applying your device with OpenHarmony system, you need to perform LCD dri
### Available APIs
To adjust the parameters of the LCD, establish a display channel with the display, and implement the display effect, use **display::host** to register the **PanelInfo** struct and interface information and add device description.
Table 1 APIs required for LCD driver adaptation
| API | Description |
| :------------------------------------------------------ | ------------------- |
| display :: host | Sets device information. |
| static int32_t MipiDsiInit(struct PanelInfo *info) | Initializes the corresponding chip platform driver.|
| static int32_t LcdResetOn(void) | Sets the status of the reset pin.|
| int32_t SampleEntryInit(struct HdfDeviceObject *object) | Initializes the entry function of the device driver. |
......@@ -77,7 +79,7 @@ Table 1 APIs required for LCD driver adaptation
2. Adapt the driver 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:
3. Add the LCD panel driver and register the panel driver data in the driver entry function **Init**. The driver data interface implements the following features:
- Powering on/off the LCD device
Based on the LCD hardware connection, use the GPIO APIs 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.
......@@ -86,7 +88,7 @@ Table 1 APIs required for LCD driver adaptation
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. (Optional) Implement other HDF APIs, such as **Release()**, as required.
4. (Optional) Implement other HDF interfaces as required.
5. (Optional) Create other device nodes for implementing service logic or debugging based on the HDF as required.
......@@ -136,7 +138,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
}
```
2. Configure the chip platform driver information in the **drivers/hdf_core/framework/model/display/driver/adapter_soc/hi35xx_disp.c file**.
2. Configure the chip platform driver information in **drivers/hdf_core/framework/model/display/driver/adapter_soc/hi35xx_disp.c**.
```c++
/* Configuration of the display driver to adapt to the MIPI and chip platform */
......@@ -179,9 +181,9 @@ The following uses the Hi35xx series chips as an example to describe how to perf
}
```
3. Add a device in **drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**.
3. Add a device.
- Define driver-related interface information.
- Define driver-related interfaces (**drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
```c++
#define RESET_GPIO 5
......@@ -203,7 +205,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
#define FRAME_RATE 60
```
- Define the **PanelInfo** structure.
- Define the **PanelInfo** struct (**drivers/hdf_core/framework/model/display/driver/hdf_disp.h**).
```c++
struct PanelInfo {
......@@ -214,7 +216,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
uint32_t hsw; // Horizontal synchronization width
uint32_t vbp; // Vertical back porch
uint32_t vfp; // Vertical front porch
uint32_t vsw; // Vertial synchronization width
uint32_t vsw; // Vertical synchronization width
uint32_t frameRate; // Frame rate
enum LcdIntfType intfType; // LCD interface type
enum IntfSync intfSync; // User timing parameter
......@@ -224,7 +226,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
};
```
- Initialize the LCD.
- Initialize the LCD (**drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
```c++
static uint8_t g_payLoad0[] = { 0xF0, 0x5A, 0x5A };
......@@ -256,7 +258,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
static DevHandle g_pwmHandle = NULL;
```
- Set the status of the reset pin.
- Set the Reset pin status (**/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
```c++
static int32_t LcdResetOn(void)
......@@ -280,7 +282,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
}
```
- Initialize the entry function of the device driver.
- Define the device driver entry function (**/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
```c++
/* Initialize the entry function. */
......
......@@ -23,7 +23,7 @@ The figure below illustrates how a motion driver works.
![](figures/motion_driver_work.png)
1. MSDP: The MSDP service obtains a Motion HDI service instance from the Motion Proxy and calls the Motion HDI API.
2. IDL: The IService Manager allocates a Motion HDI instance requested by the MSDP service, and the Motion Proxy forwards the instance to the MSDP service. After the MSDP service calls the HDI API provided by the Motion Proxy, Motion Stub is called through Inter-Process Communication (IPC) to invoke the Motion Service API. The code is automatically generated by a tool and does not need to be developed by the component vendor.
2. IDL: The MSDP service obtains a Motion HDI service instance from the Motion Proxy and calls the Motion HDI API. The interface instance is allocated by IService Manager. After the MSDP service calls the HDI API provided by the Motion Proxy, Motion Stub is called through Inter-Process Communication (IPC) to invoke the Motion Service API. The code is automatically generated by a tool and does not need to be developed by the component vendor.
3. HDI Service: The HDI service consists of Motion Interface Driver, Motion Service, and Motion Impl. Motion Interface Driver provides the motion driver code. A **HdfDriverEntry** structure is defined to implement the **Init**, **Bind**, and **Release** functions. The **HDF_INIT** macro is used to load the driver in the functions. Motion Service provides the motion recognition service interface class. The specific implementation is described in Motion Impl. The code of HDI Service must be developed by the component vendor.
## Development Guidelines
......@@ -36,6 +36,8 @@ The motion driver provides capabilities for the MSDP service to enable or disabl
**Table 1** Available APIs
**NOTE**<br>The following table lists the C++ function interfaces generated by the IDL interface description. For details about the interface declaration, see the IDL file [/drivers/interface/motion/v1_0/](https://gitee.com/openharmony/drivers_interface/tree/master/motion).
| API | Description |
| ------------------------------------------------------------ | ---------------------------- |
| int32_t EnableMotion(int32_t motionType) | Enables motion recognition of the specified type. The motion recognition data can be obtained only after the motion recognition is enabled.|
......@@ -48,29 +50,30 @@ The motion driver provides capabilities for the MSDP service to enable or disabl
The development procedure is as follows:
1. Develop the user-mode driver for motion recognition based on the HDF.
2. Implement the **EnableMotion**, **DisableMotion**, **Register**, and **Unregister** APIs.
The motion recognition directory structure is as follows:
```undefined
/drivers/peripheral/motion # Developed by the vendor.
├── hdi_service # Driver capabilities provided by the motion recognition module for the MSDP service layer.
├── test # Test code for the motion recognition module.
│ └── unittest\hdi # HDI unit test code for the motion recognition module.
```
/drivers/peripheral/motion // Developed by the vendor.
├── hdi_service // Driver capability provided by the motion module for upper-layer services.
├── test // Test codes for the motion module.
│ └── unittest\hdi // HDI unit test code of the motion driver module.
```
The following describes how to develop a user-mode motion driver based on the HDF. For details, see [motion_interface_driver.cpp](https://gitee.com/openharmony/drivers_peripheral/blob/master/motion/hdi_service/motion_interface_driver.cpp).
The following describes how to develop a user-mode motion driver based on the HDF. For details, see [motion_if_driver.cpp](https://gitee.com/openharmony/drivers_peripheral/blob/master/motion/hdi_service/motion_if_driver.cpp).
You need to implement the **Bind()**, **Init()**, **Release()**, and **Dispatch()** functions. The **Bind()** function binds the service capability with the driver; **Init()** implements the initialization required before the driver is loaded; **Release()** reclaims resources when **Init()** fails; **Dispatch()** implements the service, which is bound in **Bind()**.
```c++
// Custom HdfMotionInterfaceHost object
```c
/* Custom HdfMotionInterfaceHost object. */
struct HdfMotionInterfaceHost {
struct IDeviceIoService ioService;
OHOS::sptr<OHOS::IRemoteObject> stub;
};
// Enable the IPC service to call the response API.
/* Enable the IPC service to call the response API. */
static int32_t MotionInterfaceDriverDispatch(struct HdfDeviceIoClient *client, int cmdId, struct HdfSBuf *data,
struct HdfSBuf *reply)
{
......@@ -92,14 +95,14 @@ static int32_t MotionInterfaceDriverDispatch(struct HdfDeviceIoClient *client, i
return hdfMotionInterfaceHost->stub->SendRequest(cmdId, *dataParcel, *replyParcel, option);
}
// Initialize the HdfMotionInterface driver.
/* Initialize the HdfMotionInterface driver. */
int HdfMotionInterfaceDriverInit(struct HdfDeviceObject *deviceObject)
{
HDF_LOGI("HdfMotionInterfaceDriverInit enter");
return HDF_SUCCESS;
}
// Bind the services provided by the motion driver to the HDF.
/* Bind the services provided by the motion driver to the HDF. */
int HdfMotionInterfaceDriverBind(struct HdfDeviceObject *deviceObject)
{
HDF_LOGI("HdfMotionInterfaceDriverBind enter");
......@@ -131,7 +134,7 @@ int HdfMotionInterfaceDriverBind(struct HdfDeviceObject *deviceObject)
return HDF_SUCCESS;
}
// Release the resources used by the motion driver.
/* Release the resources used by the motion driver. */
void HdfMotionInterfaceDriverRelease(struct HdfDeviceObject *deviceObject)
{
HDF_LOGI("HdfMotionInterfaceDriverRelease enter");
......@@ -140,7 +143,7 @@ void HdfMotionInterfaceDriverRelease(struct HdfDeviceObject *deviceObject)
hdfMotionInterfaceHost = nullptr;
}
// Register the HDF driver entry g_motioninterfaceDriverEntry.
/* Register the HDF driver entry g_motioninterfaceDriverEntry. */
struct HdfDriverEntry g_motioninterfaceDriverEntry = {
.moduleVersion = 1,
.moduleName = "motion_service",
......@@ -149,7 +152,7 @@ struct HdfDriverEntry g_motioninterfaceDriverEntry = {
.Release = HdfMotionInterfaceDriverRelease,
};
// Call HDF_INIT to register the driver entry with the HDF. When loading the driver, the HDF calls the Bind function and then the Init function. If the Init function fails to be called, the HDF will call Release to release driver resources and exit the driver model.
/* Call HDF_INIT to register the driver entry with the HDF. When loading the driver, the HDF calls the Bind function and then the Init function. If the Init function fails to be called, the HDF will call Release to release driver resources and exit the driver model. */
HDF_INIT(g_userAuthInterfaceDriverEntry);
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册