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

!21928 [翻译完成】#I7L58N

Merge pull request !21928 from Annie_wang/PR20838A
......@@ -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.
......@@ -14,10 +14,9 @@ The display driver model based on the [Hardware Driver Foundation (HDF)](../driv
The following figure shows the HDF-based display driver model.
**Figure 1** HDF-based display driver model
**Figure 1** HDF-based display driver model
![image](figures/architecture-of-the-display-driver-model.png "Display Driver Model")
![image](figures/architecture-of-the-display-driver-model.png "Display Driver Model")
The display driver model consists of the display common driver layer, SoC adapter layer, and LCD panel driver layer. The HDF-based display driver model shields the differences between kernel forms through platform and OSAL APIs so that the LCD driver can be easily ported across OSs and chip platforms. The display driver model connects to the display common Hardware Abstraction Layer (HAL), supports the implementation of the Hardware Device Interface (HDI), and provides various driver capability interfaces for graphics services through the Display-HDI.
......@@ -47,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.
......@@ -63,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. |
......@@ -78,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.
......@@ -87,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.
......@@ -137,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 */
......@@ -180,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
......@@ -204,28 +205,28 @@ 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 {
uint32_t width;
uint32_t height;
uint32_t hbp;
uint32_t hfp;
uint32_t hsw;
uint32_t vbp;
uint32_t vfp;
uint32_t vsw;
uint32_t frameRate;
enum LcdIntfType intfType;
enum IntfSync intfSync;
uint32_t width; // Width
uint32_t height; // Height
uint32_t hbp; // Horizontal back porch
uint32_t hfp; // Horizontal front porch
uint32_t hsw; // Horizontal synchronization width
uint32_t vbp; // Vertical back porch
uint32_t vfp; // Vertical front porch
uint32_t vsw; // Vertical synchronization width
uint32_t frameRate; // Frame rate
enum LcdIntfType intfType; // LCD interface type
enum IntfSync intfSync; // User timing parameter
struct MipiDsiDesc mipi;
struct BlkDesc blk;
struct PwmCfg pwm;
};
```
- 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 };
......@@ -257,17 +258,19 @@ 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)
{
int32_t ret;
/* Set the pin direction. */
ret = GpioSetDir(RESET_GPIO, GPIO_DIR_OUT);
if (ret != HDF_SUCCESS) {
HDF_LOGE("GpioSetDir failure, ret:%d", ret);
return HDF_FAILURE;
}
/* Write the GPIO. */
ret = GpioWrite(RESET_GPIO, GPIO_VAL_HIGH);
if (ret != HDF_SUCCESS) {
HDF_LOGE("GpioWrite failure, ret:%d", ret);
......@@ -279,9 +282,10 @@ 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. */
int32_t SampleEntryInit(struct HdfDeviceObject *object)
{
HDF_LOGI("%s: enter", __func__);
......@@ -297,6 +301,7 @@ The following uses the Hi35xx series chips as an example to describe how to perf
return HDF_SUCCESS;
}
/* Implement the driver. */
struct HdfDriverEntry g_sampleDevEntry = {
.moduleVersion = 1,
.moduleName = "LCD_SAMPLE",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册