diff --git a/en/device-dev/driver/driver-peripherals-lcd-des.md b/en/device-dev/driver/driver-peripherals-lcd-des.md index 0bed487f6cfde1253b21755f60d8ad9a8ee50e1d..1def774aeb36f20b380ba4296c22685e84d2a776 100644 --- a/en/device-dev/driver/driver-peripherals-lcd-des.md +++ b/en/device-dev/driver/driver-peripherals-lcd-des.md @@ -159,9 +159,9 @@ The following example shows code for developing an LCD driver: #define HORIZONTAL_BACK_PORCH 20 #define HORIZONTAL_FRONT_PORCH 20 #define HORIZONTAL_SYNC_WIDTH 10 -#define VERTIACL_BACK_PORCH 14 -#define VERTIACL_FRONT_PORCH 16 -#define VERTIACL_SYNC_WIDTH 2 +#define VERTICAL_BACK_PORCH 14 +#define VERTICAL_FRONT_PORCH 16 +#define VERTICAL_SYNC_WIDTH 2 #define FRAME_RATE 60 /* PanelInfo structure */ @@ -300,9 +300,9 @@ static struct PanelInfo g_panelInfo = { .hbp = HORIZONTAL_BACK_PORCH, /* horizontal back porch */ .hfp = HORIZONTAL_FRONT_PORCH, /* horizontal front porch */ .hsw = HORIZONTAL_SYNC_WIDTH, /* horizontal sync width */ - .vbp = VERTIACL_BACK_PORCH, /* vertiacl back porch */ - .vfp = VERTIACL_FRONT_PORCH, /* vertiacl front porch */ - .vsw = VERTIACL_SYNC_WIDTH, /* vertiacl sync width */ + .vbp = VERTICAL_BACK_PORCH, /* vertical back porch */ + .vfp = VERTICAL_FRONT_PORCH, /* vertical front porch */ + .vsw = VERTICAL_SYNC_WIDTH, /* vertical sync width */ .frameRate = FRAME_RATE, /* frame rate */ .intfType = MIPI_DSI, /* panel interface type */ .intfSync = OUTPUT_USER, /* output timming type */ diff --git a/en/device-dev/driver/driver-platform-hdmi-des.md b/en/device-dev/driver/driver-platform-hdmi-des.md index fde9530405b55cc883e2020e90a1583c862aa60b..aed0b9264778f64ea67de43989a793f18f1be811 100644 --- a/en/device-dev/driver/driver-platform-hdmi-des.md +++ b/en/device-dev/driver/driver-platform-hdmi-des.md @@ -1,128 +1,81 @@ -# HDMI +# HDMI -## Overview -High-Definition Multimedia Interface (HDMI) is an audio/video transmission protocol released by Hitachi, Panasonic, Philips, Silicon Image, Sony, Thomson, and Toshiba. +## Overview -HDMI works in master/slave mode and usually has a source and a sink. +### HDMI -The HDMI APIs provide a set of common functions for HDMI transmission, including: +- High-definition multimedia interface (HDMI) is an interface for transmitting audio and video data from a source device, such as a DVD player or set-top box (STB), to a sink device, such as a TV or display. +- HDMI works in master/slave mode and usually has a source and a sink. +- The HDMI APIs provide a set of common functions for HDMI transmission, including: -- Opening and closing an HDMI controller -- Starting and stopping HDMI transmission -- Setting audio, video, and High Dynamic Range (HDR) attributes, color depth, and AV mute -- Reading the raw Extended Display Identification Data (EDID) from a sink -- Registering and unregistering a callback for HDMI hot plug detect (HPD) + - Opening and closing an HDMI controller + - Starting and stopping HDMI transmission + - Setting audio, video, and High Dynamic Range (HDR) attributes, color depth, and AV mute + - Reading the raw Extended Display Identification Data (EDID) from a sink + - Registering and unregistering a callback for HDMI hot plug detect (HPD). -[Figure 1](#fig1) shows the HDMI physical connection. +### Basic Concepts - **Figure 1** HDMI physical connection +HDMI is an audio and video transmission protocol released by Hitachi, Panasonic, Philips, Silicon Image, Sony, Thomson, and Toshiba. The transmission process complies with the Transition-minimized Differential Signaling (TMDS). - ![](figures/HDMI_physical_connection.png "HDMI_physical_connection") +- TMDS is used to transmit audio, video, and various auxiliary data. +- Display data channel (DDC) allows the TX and RX ends to obtain the sending and receiving capabilities. However, the HDMI only needs to unidirectionally obtain the capabilities of the RX end (display). +- Consumer Electronics Control (CEC) enables interaction between the HDMI TX and RX devices. +- Fixed rate link (FRL) allows the maximum TMDS bandwidth to be increased from 18 Gbit/s to 48 Gbit/s. +- High-bandwidth Digital Content Protection (HDCP) prevents copying of digital audio and video content being transmitted across devices. +- Extended Display Identification Data (EDID), usually stored in the display firmware, provides the vendor information, EDID version, maximum image size, color settings, vendor pre-settings, frequency range limit, display name, and serial number. -## Available APIs +### Working Principles + +The HDMI source end provides +5 V and GND for DDC and CEC communication. Through the DDC, the source end obtains the sink end parameters, such as the RX capabilities. The CEC is optional. It is used to synchronize the control signals between the source and sink ends to improve user experience. There are four TMDS channels between the HDMI source and sink ends. The TMDS clock channel provides clock signals for TMDS, and the other three channels transmit audio, video, and auxiliary data. HPD is the hot plug detect port. When the sink end is connected, the source end responds by using an interrupt program. + +The figure below shows the HDMI physical connection. + +**Figure 1** HDMI physical connection + +![](figures/HDMI_physical_connection.png "HDMI_physical_connection") + +### Constraints + +Currently, the HDMI module supports only the kernels (LiteOS) of mini and small systems. + +## Development Guidelines + +### When to Use + +HDMI features high transmission rate, wide transmission bandwidth, high compatibility, and can transmit uncompressed audio and video signals. Compared with the traditional full analog interface, HDMI simplifies connection between devices and provides HDMI-specific intelligent features, which are ideal for high-quality audio and video transmission of small-sized devices. + +### Available APIs **Table 1** HDMI driver APIs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Category

-

API

-

Description

-

Managing HDMI controllers

-

HdmiOpen

-
Opens an HDMI controller.

-

HdmiClose

-

Closes an HDMI controller.

-

Starting or stopping HDMI transmission

-

HdmiStart

-
Starts HDMI transmission.

-

HdmiStop

-

Stops HDMI transmission.

-

Setting an HDMI controller

-

HdmiAvmuteSet

-
Sets the AV mute feature.

-

HdmiDeepColorSet

-

Sets the color depth.

-

HdmiDeepColorGet

-

Obtains the color depth.

-

HdmiSetVideoAttribute

-

Sets video attributes.

-

HdmiSetAudioAttribute

-

Sets audio attributes.

-

HdmiSetHdrAttribute

-

Sets HDR attributes.

-

Reading EDID

-

HdmiReadSinkEdid

-
Reads the raw EDID from a sink.

-

Registering or unregistering a callback for HDMI HPD

-

HdmiRegisterHpdCallbackFunc

-
Registers a callback for HDMI HPD.

-

HdmiUnregisterHpdCallbackFunc

-

Unregisters the callback for HDMI HPD.

-
- -## Usage Guidelines - -### How to Use - -[Figure 2](#fig2) shows how HDMI works. - -**Figure 2** How HDMI works + +| API | Description | +| ----------------------------- | -------------------------- | +| HdmiOpen | Opens an HDMI controller. | +| HdmiClose | Closes an HDMI controller. | +| HdmiStart | Starts HDMI transmission. | +| HdmiStop | Stops HDMI transmission. | +| HdmiAvmuteSet | Sets the AV mute feature. | +| HdmiDeepColorSet | Sets the color depth. | +| HdmiDeepColorGet | Obtains the color depth. | +| HdmiSetVideoAttribute | Sets video attributes. | +| HdmiSetAudioAttribute | Sets audio attributes. | +| HdmiSetHdrAttribute | Sets HDR attributes. | +| HdmiReadSinkEdid | Reads the raw EDID from a sink. | +| HdmiRegisterHpdCallbackFunc | Registers a callback for HDMI HPD.| +| HdmiUnregisterHpdCallbackFunc | Unregisters a callback for HDMI HPD.| + +### How to Develop + +The figure below illustrates the process of using an HDMI device. + +**Figure 2** Process of using an HDMI device ![](figures/HDMI_usage_flowchart.png "HDMI_usage_flowchart") -### Opening an HDMI Controller +#### Opening an HDMI Controller Before HDMI communication, call **HdmiOpen** to open an HDMI controller. @@ -132,38 +85,14 @@ DevHandle HdmiOpen(int16_t number); **Table 2** Description of HdmiOpen - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

number

-

HDMI controller ID.

-

Return Value

-

Description

-

NULL

-

Failed to open the HDMI controller.

-

Controller handle

-

Handle of the HDMI controller opened.

-
- -For example, the system has two HDMI controllers, numbered 0 and 1. Open controller 0. +| Parameter | Description | +| ---------- | -------------------- | +| number | HDMI controller ID. | +| **Return Value**| **Description** | +| NULL | Failed to open the HDMI controller. | +| Controller handle| Handle of the opened HDMI controller.| + +Example: Open controller 0 of the two HDMI controllers (numbered 0 and 1) in the system. ```c DevHandle hdmiHandle = NULL; /* HDMI controller handle / @@ -176,7 +105,7 @@ if (hdmiHandle == NULL) { } ``` -### Registering a Callback for HPD +#### Registering a Callback for HPD ```c int32_t HdmiRegisterHpdCallbackFunc(DevHandle handle, struct HdmiHpdCallbackInfo *callback); @@ -184,41 +113,13 @@ int32_t HdmiRegisterHpdCallbackFunc(DevHandle handle, struct HdmiHpdCallbackInfo **Table 3** Description of HdmiRegisterHpdCallbackFunc - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

callback

-

Pointer to the callback to be invoked to return the HPD result.

-

Return Value

-

Description

-

0

-

The callback is registered successfully.

-

Negative number

-

Failed to register the callback.

-
+| Parameter | Description | +| ---------- | ------------------ | +| handle | HDMI controller handle. | +| callback | Pointer to the callback to be invoked to return the HPD result.| +| **Return Value**| **Description** | +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of registering a callback for HPD: @@ -227,30 +128,31 @@ The following is an example of registering a callback for HPD: static void HdmiHpdHandle(void *data, bool hpd) { if (data == NULL) { - HDF_LOGE("priv data is NULL"); - return; -} - + HDF_LOGE("priv data is NULL"); + return; + } if (hpd == true) { HDF_LOGD("HdmiHpdHandle: hot plug"); /* Add related processing if required. */ } else { - HDF_LOGD("HdmiHpdHandle: hot unplog"); + HDF_LOGD("HdmiHpdHandle: hot unplug"); /* Add related processing if required. */ } } - /* Example of registering a callback for HPD */ - struct HdmiHpdCallbackInfo info = {0}; - info.data = handle; - info.callbackFunc = HdmiHpdHandle; - ret = HdmiRegisterHpdCallbackFunc(hdmiHandle, info); - if (ret != 0) { - HDF_LOGE("HdmiRegisterHpdCallbackFunc: Register failed."); - } +/* Example of registering a callback for HPD */ +··· +struct HdmiHpdCallbackInfo info = {0}; +info.data = handle; +info.callbackFunc = HdmiHpdHandle; +ret = HdmiRegisterHpdCallbackFunc(hdmiHandle, info); +if (ret != 0) { + HDF_LOGE("HdmiRegisterHpdCallbackFunc: Register failed."); +} +··· ``` -### Reading the RAW EDID +#### Reading the Raw EDID ```c int32_t HdmiReadSinkEdid(DevHandle handle, uint8_t *buffer, uint32_t len); @@ -258,46 +160,14 @@ int32_t HdmiReadSinkEdid(DevHandle handle, uint8_t *buffer, uint32_t len); **Table 4** Description of HdmiReadSinkEdid - - - - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

buffer

-

Pointer to the data buffer.

-

len

-

Data length.

-

Return Value

-

Description

-

Positive integer

-

Raw EDID read.

-

Negative number or **0**

-

Failed to read the EDID.

-
+| Parameter | Description | +| ---------- | ---------------------- | +| handle | HDMI controller handle. | +| buffer | Pointer to the data buffer. | +| len | Data length. | +| **Return Value**| **Description** | +| Positive integer | Raw EDID read.| +| Negative number or 0 | Failed to read the EDID. | The following is an example of reading the raw EDID from a sink: @@ -311,8 +181,6 @@ if (len <= 0) { } ``` -### Setting Video, Audio, and HDR Attributes - #### Setting Audio Attributes ```c @@ -321,41 +189,14 @@ int32_t HdmiSetAudioAttribute(DevHandle handle, struct HdmiAudioAttr *attr); **Table 5** Description of HdmiSetAudioAttribute - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

attr

-

Pointer to the audio attributes.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ------ | -------------- | +| handle | HDMI controller handle.| +| attr | Pointer to the audio attributes. | +| **Return Value**| **Description** | +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of setting audio attributes: @@ -382,41 +223,14 @@ int32_t HdmiSetVideoAttribute(DevHandle handle, struct HdmiVideoAttr *attr); **Table 6** Description of HdmiSetVideoAttribute - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

attr

-

Pointer to the video attributes.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| attr | Pointer to the video attributes. | +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of setting video attributes: @@ -442,41 +256,14 @@ int32_t HdmiSetHdrAttribute(DevHandle handle, struct HdmiHdrAttr *attr); **Table 7** Description of HdmiSetHdrAttribute - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

attr

-

Pointer to the HDR attributes.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| attr | Pinter to the HDR attributes. | +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of setting HDR attributes: @@ -495,8 +282,6 @@ if (ret != 0) { } ``` -### Setting Other Attributes - #### Setting HDMI AV Mute ```c @@ -505,41 +290,14 @@ int32_t HdmiAvmuteSet(DevHandle handle, bool enable); **Table 8** Description of HdmiAvmuteSet - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

enable

-

Whether the AV mute feature is enabled. -

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | ----------------- | +| handle | HDMI controller handle. | +| enable | Whether to enable the AV mute feature.| +| **Return Value**| **Description** | +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of setting AV mute: @@ -560,41 +318,14 @@ int32_t HdmiDeepColorSet(DevHandle handle, enum HdmiDeepColor color); **Table 9** Description of HdmiDeepColorSet - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

color

-

Color depth to set.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| color | Color depth to set. | +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of setting the color depth: @@ -615,41 +346,14 @@ int32_t HdmiDeepColorGet(DevHandle handle, enum HdmiDeepColor *color); **Table 10** Description of HdmiDeepColorGet - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

color

-

Pointer to the color depth.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| color | Pointer to the color depth. | +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of obtaining the color depth: @@ -663,7 +367,7 @@ if (ret != 0) { } ``` -### Starting HDMI Transmission +#### Starting HDMI Transmission ```c int32_t HdmiStart(DevHandle handle); @@ -671,36 +375,13 @@ int32_t HdmiStart(DevHandle handle); **Table 11** Description of HdmiStart - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of starting HDMI transmission: @@ -713,7 +394,7 @@ if (ret != 0) { } ``` -### Stopping HDMI Transmission +#### Stopping HDMI Transmission ```c int32_t HdmiStop(DevHandle handle); @@ -721,36 +402,13 @@ int32_t HdmiStop(DevHandle handle); **Table 12** Description of HdmiStop - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of stopping HDMI transmission: @@ -763,7 +421,7 @@ if (ret != 0) { } ``` -### Unregistering the Callback for HPD +#### Unregistering the Callback for HPD ```c int32_t HdmiUnregisterHpdCallbackFunc(DevHandle handle); @@ -771,36 +429,13 @@ int32_t HdmiUnregisterHpdCallbackFunc(DevHandle handle); **Table 13** Description of HdmiUnregisterHpdCallbackFunc - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-

Return Value

-

Description

-

0

-

The operation is successful.

-

Negative number

-

The operation failed.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| +| **Return Value**| **Description**| +| 0 | The operation is successful. | +| Negative value | The operation failed. | The following is an example of unregistering the callback for HPD: @@ -813,7 +448,7 @@ if (ret != 0) { } ``` -### Closing an HDMI Controller +#### Closing an HDMI Controller ```c void HdmiClose(DevHandle handle); @@ -821,21 +456,10 @@ void HdmiClose(DevHandle handle); **Table 14** Description of HdmiClose - - - - - - - - - - -

Parameter

-

Description

-

handle

-

HDMI controller handle.

-
+ +| Parameter | Description | +| ---------- | -------------- | +| handle | HDMI controller handle.| The following is an example of closing an HDMI controller: @@ -843,7 +467,7 @@ The following is an example of closing an HDMI controller: HdmiClose(hdmiHandle); ``` -## Example +### Development Example This following example shows how to use HDMI APIs to manage an HDMI device on a Hi3516D V300 development board. @@ -873,7 +497,7 @@ static void HdmiHpdHandle(void *data, bool hpd) HDF_LOGD("HdmiHpdHandle: hot plug"); /* Add related processing if required. */ } else { - HDF_LOGD("HdmiHpdHandle: hot unplog"); + HDF_LOGD("HdmiHpdHandle: hot unplug"); /* Add related processing if required. */ } } diff --git a/en/device-dev/driver/driver-platform-hdmi-develop.md b/en/device-dev/driver/driver-platform-hdmi-develop.md index 0b384358d886aaca37f28251ca2c61d6f11bc64d..56e47fa0bf12ad68ace3f8460e4ed0a5c687f569 100644 --- a/en/device-dev/driver/driver-platform-hdmi-develop.md +++ b/en/device-dev/driver/driver-platform-hdmi-develop.md @@ -1,119 +1,145 @@ # HDMI -## Overview +## Overview -High-Definition Multimedia Interface (HDMI) is an audio/video transmission protocol released by Hitachi, Panasonic, Philips, Silicon Image, Sony, Thomson, and Toshiba. It is used to transmit audio or video data from an audio or video source device, such as a DVD player or STB, to a sink device, such as a TV or monitor. The transmission process complies with the Transition Minimized Differential Signaling (TMDS) protocol. +### HDMI + +High-definition multimedia interface (HDMI) is an interface for transmitting audio and video data from a source device, such as a DVD player or set-top box (STB), to a sink device, such as a TV or display. + +### Basic Concepts + +HDMI is an audio and video transmission protocol released by Hitachi, Panasonic, Philips, Silicon Image, Sony, Thomson, and Toshiba. The transmission process complies with the Transition Minimized Differential Signaling (TMDS) protocol. + +- TMDS is used to transmit audio, video, and various auxiliary data. + +- Display data channel (DDC) allows the TX and RX ends to obtain the sending and receiving capabilities. However, the HDMI only needs to unidirectionally obtain the capabilities of the RX end (display). + +- Consumer Electronics Control (CEC) enables interaction between the HDMI TX and RX devices. + +- Fixed rate link (FRL) allows the maximum TMDS bandwidth to be increased from 18 Gbit/s to 48 Gbit/s. +- High-bandwidth Digital Content Protection (HDCP) prevents copying of digital audio and video content being transmitted across devices. + + +### Working Principles In the HDF, the HDMI module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to process external access requests. After receiving an access request, 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 node for each device, which increases the memory usage. - **Figure 1** Independent service mode + **Figure 1** Independent service mode ![image1](figures/independent-service-mode.png) -## Available APIs +### Constraints - **HdmiCntlrOps**: - ```c - struct HdmiCntlrOps { - void (*hardWareInit)(struct HdmiCntlr *cntlr); - void (*hardWareStatusGet)(struct HdmiCntlr *cntlr, struct HdmiHardwareStatus *status); - void (*controllerReset)(struct HdmiCntlr *cntlr); - bool (*hotPlugStateGet)(struct HdmiCntlr *cntlr); - bool (*hotPlugInterruptStateGet)(struct HdmiCntlr *cntlr); - void (*lowPowerSet)(struct HdmiCntlr *cntlr, bool enable); - void (*tmdsModeSet)(struct HdmiCntlr *cntlr, enum HdmiTmdsModeType mode); - int32_t (*tmdsConfigSet)(struct HdmiCntlr *cntlr, struct HdmiTmdsConfig mode); - void (*infoFrameEnable)(struct HdmiCntlr *cntlr, enum HdmiPacketType infoFrameType, bool enable); - int32_t (*infoFrameSend)(struct HdmiCntlr *cntlr, enum HdmiPacketType infoFrameType, uint8_t *data, uint32_t len); - int32_t (*infoFrameDataSet)(struct HdmiCntlr *cntlr, uint32_t type, uint8_t *data, uint32_t len); - int32_t (*cecMsgSend)(struct HdmiCntlr *cntlr, struct HdmiCecMsg *msg); - void (*audioPathEnable)(struct HdmiCntlr *cntlr, bool enable); - void (*audioPathSet)(struct HdmiCntlr *cntlr, struct HdmiAudioConfigInfo *config); - void (*phyOutputEnable)(struct HdmiCntlr *cntlr, bool enable); - void (*phyOutputSet)(struct HdmiCntlr *cntlr, struct HdmiPhyCfg *cfg); - void (*blackDataSet)(struct HdmiCntlr *cntlr, bool enable); - void (*videoMuteEnable)(struct HdmiCntlr *cntlr, bool enable); - void (*videoPathSet)(struct HdmiCntlr *cntlr, struct HdmiVideoAttr *attr); - void (*audioMuteEnable)(struct HdmiCntlr *cntlr, bool enable); - void (*avmuteSet)(struct HdmiCntlr *cntlr, bool enable); - int32_t (*ddcTransfer)(struct HdmiCntlr *cntlr, struct HdmiDdcCfg *ddcCfg); - bool (*scdcSourceScrambleGet)(struct HdmiCntlr *cntlr); - int32_t (*scdcSourceScrambleSet)(struct HdmiCntlr *cntlr, bool enable); - void (*frlSet)(struct HdmiCntlr *cntlr); - int32_t (*frlEnable)(struct HdmiCntlr *cntlr, bool enable); - int32_t (*audioNctsSet)(struct HdmiCntlr *cntlr, struct HdmiFrlAudioNctsConfig *cfg); - void (*frlTrainingConfigSet)(struct HdmiCntlr *cntlr, struct HdmiFrlTrainConfig *cfg); - void (*frlTrainingStart)(struct HdmiCntlr *cntlr); - void (*frlGetTriningRslt)(struct HdmiCntlr *cntlr, struct HdmiFrlTrainRslt *rslt); - void (*hdcpRegInit)(struct HdmiCntlr *cntlr); - int32_t (*hdcpGenerateAksvAndAn)(struct HdmiCntlr *cntlr); - int32_t (*hdcpOptReg)(struct HdmiCntlr *cntlr, enum HdmiHdcpRegOptType type, uint8_t *data, uint32_t len); - void (*hdrTimerSet)(struct HdmiCntlr *cntlr, struct HdmiHdrTimerConfig *config); - }; - ``` +Currently, the HDMI module supports only the kernels (LiteOS) of mini and small systems. + +## Development Guidelines +### Use Cases + +HDMI features high transmission rate, wide transmission bandwidth, high compatibility, and can transmit uncompressed audio and video signals. Compared with the traditional full analog interface, HDMI simplifies connection between devices and provides HDMI-specific intelligent features, which are ideal for high-quality audio and video transmission of small-sized devices. + +### Available APIs + **HdmiCntlrOps**: +```c +struct HdmiCntlrOps { + void (*hardWareInit)(struct HdmiCntlr *cntlr); + void (*hardWareStatusGet)(struct HdmiCntlr *cntlr, struct HdmiHardwareStatus *status); + void (*controllerReset)(struct HdmiCntlr *cntlr); + bool (*hotPlugStateGet)(struct HdmiCntlr *cntlr); + bool (*hotPlugInterruptStateGet)(struct HdmiCntlr *cntlr); + void (*lowPowerSet)(struct HdmiCntlr *cntlr, bool enable); + void (*tmdsModeSet)(struct HdmiCntlr *cntlr, enum HdmiTmdsModeType mode); + int32_t (*tmdsConfigSet)(struct HdmiCntlr *cntlr, struct HdmiTmdsConfig mode); + void (*infoFrameEnable)(struct HdmiCntlr *cntlr, enum HdmiPacketType infoFrameType, bool enable); + int32_t (*infoFrameSend)(struct HdmiCntlr *cntlr, enum HdmiPacketType infoFrameType, uint8_t *data, uint32_t len); + int32_t (*infoFrameDataSet)(struct HdmiCntlr *cntlr, uint32_t type, uint8_t *data, uint32_t len); + int32_t (*cecMsgSend)(struct HdmiCntlr *cntlr, struct HdmiCecMsg *msg); + void (*audioPathEnable)(struct HdmiCntlr *cntlr, bool enable); + void (*audioPathSet)(struct HdmiCntlr *cntlr, struct HdmiAudioConfigInfo *config); + void (*phyOutputEnable)(struct HdmiCntlr *cntlr, bool enable); + void (*phyOutputSet)(struct HdmiCntlr *cntlr, struct HdmiPhyCfg *cfg); + void (*blackDataSet)(struct HdmiCntlr *cntlr, bool enable); + void (*videoMuteEnable)(struct HdmiCntlr *cntlr, bool enable); + void (*videoPathSet)(struct HdmiCntlr *cntlr, struct HdmiVideoAttr *attr); + void (*audioMuteEnable)(struct HdmiCntlr *cntlr, bool enable); + void (*avmuteSet)(struct HdmiCntlr *cntlr, bool enable); + int32_t (*ddcTransfer)(struct HdmiCntlr *cntlr, struct HdmiDdcCfg *ddcCfg); + bool (*scdcSourceScrambleGet)(struct HdmiCntlr *cntlr); + int32_t (*scdcSourceScrambleSet)(struct HdmiCntlr *cntlr, bool enable); + void (*frlSet)(struct HdmiCntlr *cntlr); + int32_t (*frlEnable)(struct HdmiCntlr *cntlr, bool enable); + int32_t (*audioNctsSet)(struct HdmiCntlr *cntlr, struct HdmiFrlAudioNctsConfig *cfg); + void (*frlTrainingConfigSet)(struct HdmiCntlr *cntlr, struct HdmiFrlTrainConfig *cfg); + void (*frlTrainingStart)(struct HdmiCntlr *cntlr); + void (*frlGetTriningRslt)(struct HdmiCntlr *cntlr, struct HdmiFrlTrainRslt *rslt); + void (*hdcpRegInit)(struct HdmiCntlr *cntlr); + int32_t (*hdcpGenerateAksvAndAn)(struct HdmiCntlr *cntlr); + int32_t (*hdcpOptReg)(struct HdmiCntlr *cntlr, enum HdmiHdcpRegOptType type, uint8_t *data, uint32_t len); + void (*hdrTimerSet)(struct HdmiCntlr *cntlr, struct HdmiHdrTimerConfig *config); +}; +``` + +**Table 1** Description of the HdmiCntlrOps structure + +| Function | Input Parameter | Output Parameter | Return Value | Description | +| ------------------------ | ------------------------------------------------------------ | -------------------------------------- | ------------------ | -------------------------------------------------- | +| hardWareInit | **cntlr**: structure pointer to an HDMI controller at the core layer.| –| –| Initializes the HDMI hardware.| +| hardWareStatusGet | **cntlr**: structure pointer to an HDMI controller at the core layer.
| **status**: pointer to the HDMI hardware status.| –| Obtains the HDMI hardware status. | +| controllerReset | **cntlr**: structure pointer to an HDMI controller at the core layer.| – | –| Resets an HDMI controller. | +| hotPlugStateGet | **cntlr**: structure pointer to an HDMI controller at the core layer. | – | **bool**: HDMI hot-plug status.| Obtains the HDMI hot-plug status. | +| hotPlugInterruptStateGet | **cntlr**: structure pointer to an HDMI controller at the core layer. | – | **bool**: HDMI hot-plug interrupt status.| Obtains the HDMI hot-plug interrupt status. | +| lowPowerSet | **cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable low power consumption.| – | –| Enables or disables low power consumption.| +| tmdsModeSet | **cntlr**: structure pointer to an HDMI controller at the core layer.
**mode**: TMDS mode.| – | –| Sets the TMDS mode. | +|tmdsConfigSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**mode**: TMDS parameters.|–|HDF_STATUS|Sets TMDS parameters.| +|infoFrameEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**infoFrameType**: packet type.
**enable**: whether to enable infoFrame.|–|–|Enables or disables infoFrame.| +|infoFrameSend|**cntlr**: structure pointer to an HDMI controller at the core layer.
**infoFrameType**: packet type.
**data**: pointer to infoFrame data.
**len**: data length.|–|HDF_STATUS|Sends an infoFrame.| +|cecMsgSend|**cntlr**: structure pointer to an HDMI controller at the core layer.
**msg**: pointer to the CEC message|–|HDF_STATUS|Sends a CEC message.| +|audioPathEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the audio path.|–|–|Enables or disables the audio path.| +|audioPathSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**config**: pointer to the audio path configuration.|–|–|Sets the audio path.| +|phyOutputEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the physical layer output.|–|–|Enables or disables the physical layer output.| +|phyOutputSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**cfg**: pointer to the physical layer configuration.|–|–|Sets the physical layer information.| +|blackDataSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the black screen.|–|–|Sets the black screen.| +|videoMuteEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the video mute feature.|–|–|Enables or disables the video mute feature.| +|videoPathSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**attr**: pointer to the video path configuration.|–|–|Sets the video path.| +|audioMuteEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the audio mute feature.|–|–|Enables or disables the audio mute feature.| +|avmuteSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the AV mute feature.|–|–|Enables or disables the AV mute feature.| +|ddcTransfer|**cntlr**: structure pointer to an HDMI controller at the core layer.
**ddcCfg**: pointer to the DDC configuration.|**ddcCfg**: DDC configuration.|HDF_STATUS|Reads and writes data through the DDC.| +|scdcSourceScrambleGet|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|Scrambling status of the source.|Obtains the scrambling status of the source.| +|scdcSourceScrambleSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the scrambling for the source.|–|HDF_STATUS|Enables or disable scrambling for the source.| +|frlEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the FRL.|–|HDF_STATUS|Enables or disables the FRL.| +|audioNctsSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**cfg**: pointer to the N/CTS configuration.|–|HDF_STATUS|Sets the audio N/CTS information.| +|frlTrainingConfigSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**cfg**: pointer to the FRL training configuration.|–|–|Sets FRL training information.| +|frlTrainingStart|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|–|Starts FRL training.| +|frlGetTriningRslt|**cntlr**: structure pointer to an HDMI controller at the core layer.|**rslt**: FRL training result.|–|Obtains the FRL training result.| +|hdcpRegInit|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|–|Initializes registers related to the High-bandwidth Digital Content Protection (HDCP) process.| +|hdcpGenerateAksvAndAn|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|HDF_STATUS|Generates the **Aksv** and **An** in the HDCP process.| +|hdcpOptReg|**cntlr**: structure pointer to an HDMI controller at the core layer.
**type**: operation type.
**data**: register data.
**len**: data length.|**data**: register data.|HDF_STATUS|Reads or writes the registers during the HDCP process.| +|hdrTimerSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**config**: pointer to the timer configuration|–|–|Sets the HDR-related timer.| -**Table 1** APIs for the members in the HdmiCntlrOps structure - | Method| Input Parameter| Output Parameter| Return Value| Description| - | ------------------------ | ------------------------------------------------------------ | -------------------------------------- | ------------------ | -------------------------------------------------- | - | hardWareInit | **cntlr**: structure pointer to an HDMI controller at the core layer.| –| –| Initializes HDMI hardware.| - | hardWareStatusGet | **cntlr**: structure pointer to an HDMI controller at the core layer.
| **status**: pointer to the HDMI hardware status.| –| Obtains the HDMI hardware status.| - | controllerReset | **cntlr**: structure pointer to an HDMI controller at the core layer.| –| –| Resets an HDMI controller.| - | hotPlugStateGet | **cntlr**: structure pointer to an HDMI controller at the core layer.| –| **bool**: HDMI hot-plug status.| Obtains the HDMI hot-plug status.| - | hotPlugInterruptStateGet | **cntlr**: structure pointer to an HDMI controller at the core layer.| –| **bool**: HDMI hot-plug interrupt status.| Obtains the HDMI hot-plug interrupt status.| - | lowPowerSet | **cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable low power consumption.| –| –| Enables or disables low power consumption.| - | tmdsModeSet | **cntlr**: structure pointer to an HDMI controller at the core layer.
**mode**: TMDS mode.| –| –| Sets the TMDS mode. | - |tmdsConfigSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**mode**: TMDS parameters.|–|HDF_STATUS|Sets TMDS parameters.| - |infoFrameEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**infoFrameType**: packet type.
**enable**: whether to enable infoFrame.|–|–|Enables or disables infoFrame.| - |infoFrameSend|**cntlr**: structure pointer to an HDMI controller at the core layer.
**infoFrameType**: packet type.
**data**: pointer to infoFrame data.
**len**: data length.|–|HDF_STATUS|Sends an infoFrame.| - |cecMsgSend|**cntlr**: structure pointer to an HDMI controller at the core layer.
**msg**: pointer to the Consumer Electronics Control (CEC) message.|–|HDF_STATUS|Sends a CEC message.| - |audioPathEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the audio path.|–|–|Enables or disables the audio path.| - |audioPathSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**config**: pointer to the audio path configuration.|–|–|Sets the audio path.| - |phyOutputEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the physical layer output.|–|–|Enables or disables the physical layer output.| - |phyOutputSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**cfg**: pointer to the physical layer configuration.|–|–|Sets the physical layer information.| - |blackDataSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the black screen.|–|–|Sets the black screen.| - |videoMuteEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the video mute feature.|–|–|Enables or disables the video mute feature.| - |videoPathSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**attr**: pointer to the video path configuration.|–|–|Sets the video path.| - |audioMuteEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the audio mute feature.|–|–|Enables or disables the audio mute feature.| - |avmuteSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the AV mute feature.|–|–|Enables or disables the AV mute feature.| - |ddcTransfer|**cntlr**: structure pointer to an HDMI controller at the core layer.
**ddcCfg**: pointer to the display data channel (DDC) configuration.|**ddcCfg**: DDC configuration.|HDF_STATUS|Reads and writes data through the DDC.| - |scdcSourceScrambleGet|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|Scrambling status of the source.|Obtains the scrambling status of the source.| - |scdcSourceScrambleSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable scrambling for the source.|–|HDF_STATUS|Enables or disable scrambling for the source.| - |frlEnable|**cntlr**: structure pointer to an HDMI controller at the core layer.
**enable**: whether to enable the fixed rate link (FRL).|–|HDF_STATUS|Enables or disables the FRL.| - |audioNctsSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**cfg**: pointer to the N/CTS configuration.|–|HDF_STATUS|Sets the audio N/CTS information.| - |frlTrainingConfigSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**cfg**: pointer to the FRL training configuration.|–|–|Sets FRL training information.| - |frlTrainingStart|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|–|Starts FRL training.| - |frlGetTriningRslt|**cntlr**: structure pointer to an HDMI controller at the core layer.|**rslt**: FRL training result.|–|Obtains the FRL training result.| - |hdcpRegInit|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|–|Initializes registers related to the High-bandwidth Digital Content Protection (HDCP) process.| - |hdcpGenerateAksvAndAn|**cntlr**: structure pointer to an HDMI controller at the core layer.|–|HDF_STATUS|Generates the **Aksv** and **An** in the HDCP process.| - |hdcpOptReg|**cntlr**: structure pointer to an HDMI controller at the core layer.
**type**: operation type.
**data**: pointer to the register data.
**len**: data length.|**data**: register data.|HDF_STATUS|Reads or writes the registers in the HDCP process.| - |hdrTimerSet|**cntlr**: structure pointer to an HDMI controller at the core layer.
**config**: pointer to the timer configuration.|–|–|Sets the HDR-related timer.| - - -## How to Develop + +### How to Develop The HDMI module adaptation involves the following steps: -1. Instantiate the driver entry. +- Instantiate the driver entry. - Instantiate the **HdfDriverEntry** structure. - Call **HDF_INIT** to register the **HdfDriverEntry** instance with the HDF. -2. Configure attribute files. +- Configure attribute files. - Add the **deviceNode** information to the **device_info.hcs** file. - (Optional) Add the **hdmi_config.hcs** file. -3. Instantiate the HDMI controller object. +- Instantiate the HDMI controller object. - Initialize **HdmiCntlr**. - - Instantiate **HdmiCntlrOps** in **HdmiCntlr**. For details, see [Available APIs](#available_apis). - + - Instantiate **HdmiCntlrOps** in **HdmiCntlr**. -## Development Example +1. Instantiate the driver entry. -1. Instantiate the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type (defined in **hdf\_device\_desc.h**), and the value of **moduleName** must be the same as that in **device\_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers are collected to form a segment address space similar to an array for the upper layer to invoke. + The driver entry must be a global variable of the **HdfDriverEntry** type (which is defined in **hdf_device_desc.h**), and the value of **moduleName** must be the same as that in **device_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers is collected to form a segment address space similar to an array for the upper layer to invoke. - Generally, the HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, the HDF calls **Release** to release driver resources and exit. + Generally, the HDF calls the **Bind()** function and then the **Init()** function to load a driver. If **Init()** fails to be called, the HDF calls **Release()** to release driver resources and exit. HDMI driver entry reference: @@ -128,7 +154,9 @@ The HDMI module adaptation involves the following steps: HDF_INIT(g_hdmiDriverEntry); // Call HDF_INIT to register the driver entry with the HDF. ``` -2. Add **deviceNode** to the **device_info.hcs** file, and configure the device attributes in the **hdmi\_config.hcs** file. The **deviceNode** information is related to registration of the driver entry. The device attribute values are closely related to the driver implementation and the default values or restriction ranges of the **HdmiCntlr** members at the core layer. +2. Configure attribute files. + + Add **deviceNode** to the **device_info.hcs** file, and configure the device attributes in the **hdmi\_config.hcs** file. The **deviceNode** information is related to registration of the driver entry. The device attribute values are closely related to the driver implementation and the default values or restriction ranges of the **HdmiCntlr** members at the core layer. Configure HDMI controller information from the first node. This node specifies a type of HDMI controllers rather than a specific HDMI controller. In this example, there is only one HDMI controller. If there are multiple HDMI controllers, you need to add the **deviceNode** information to the **device\_info** file and add the corresponding device attributes to the **hdmi\_config** file. @@ -200,14 +228,15 @@ The HDMI module adaptation involves the following steps: } ``` -3. Initialize the **HdmiCntlr** object at the core layer, including initializing the vendor custom structure (passing parameters and data) and instantiating the **HdmiCntlrOps** (used to call the underlying functions of the driver). The **HdfDriverEntry** member functions (**Bind**, **Init**, and **Release**) must be implemented in this step. - - - Custom structure reference: - - > ![](../public_sys-resources/icon-note.gif) **NOTE** - > +3. Instantiate the **HdmiCntlr** object. + + Initialize the **HdmiCntlr** object at the core layer, including initializing the vendor custom structure (passing parameters and data) and instantiating the **HdmiCntlrOps** (used to call the underlying functions of the driver). The **HdfDriverEntry** member functions (**Bind**, **Init**, and **Release**) must be implemented in this step. + + - Custom structure reference + + > ![](../public_sys-resources/icon-note.gif) **NOTE**
> To the driver, the custom structure carries parameters and data. The values in the **hdmi_config.hcs** file are read by the HDF, and structure members are initialized by **DeviceResourceIface**. Some important values (such as the device number and bus number) are also passed to the **HdmiCntlr** object at the core layer. - + ```c struct HdmiAdapterHost { struct HdmiCntlr *cntlr; // (Mandatory) Control object at the core layer. The details are as follows: @@ -216,8 +245,8 @@ The HDMI module adaptation involves the following steps: uint32_t regSize; // (Mandatory) Register bit width. uint32_t irqNum; // (Mandatory) IRQ number. }; - - /* HdmiCntlr is the controller structure at the core layer. Its members are assigned with values by using the Init function. */ + + /* HdmiCntlr is the controller structure at the core layer. Its members are assigned with values by using the Init() function. */ struct HdmiCntlr { struct IDeviceIoService service; struct HdfDeviceObject *hdfDevObj; @@ -242,9 +271,9 @@ The HDMI module adaptation involves the following steps: void *priv; }; ``` - - - **(Important)** Instantiate the callback structure **HdmiCntlrOps** in **HdmiCntlr**. - + + - Instantiate **HdmiCntlrOps** in **HdmiCntlr**. + ```c static struct HdmiCntlrOps g_hdmiAdapterHostOps = { .hardWareInit = HdmiAdapterHardWareInit, @@ -283,29 +312,29 @@ The HDMI module adaptation involves the following steps: .hdrTimerSet = HdmiAdapterHdrTimerSet, }; ``` - - - **Bind** function - - > Input parameter: - > **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration. - > - > Return value: - > **HDF\_STATUS** (The following table lists some states. For more details, see **HDF\_STATUS** definition in the **/drivers/framework/include/utils/hdf\_base.h file**.) - - |State|Description| + + - **Bind()** function + + **Input parameter**: + **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration. + + **Return value**: + **HDF\_STATUS** (The following table lists some states. For more details, see **HDF\_STATUS** definition in the **/drivers/framework/include/utils/hdf\_base.h file**.) + + | State | Description | |:-|:-| |HDF_ERR_INVALID_OBJECT|Invalid controller object.| - |HDF_ERR_INVALID_PARAM |Invalid parameter.| - |HDF_ERR_MALLOC_FAIL |Failed to allocate memory.| + |HDF_ERR_INVALID_PARAM|Invalid parameter.| + |HDF_ERR_MALLOC_FAIL |Memory allocation failed.| |HDF_ERR_IO |I/O error.| |HDF_SUCCESS |Transmission successful.| |HDF_FAILURE |Transmission failed.| - - > Function description: - > Initializes the custom structure object **HdmiAdapterHost** and **HdmiCntlr**, and calls the **HdmiCntlrAdd** function to add the HDMI controller to the core layer. - > - > The **HdmiCntlr**, **HdmiAdapterHost**, and **HdfDeviceObject** assign values with each other so that other functions can be converted successfully. - + + **Function description**: + Initializes the custom structure object **HdmiAdapterHost** and **HdmiCntlr**, and calls the **HdmiCntlrAdd** function to add the HDMI controller to the core layer. + + The **HdmiCntlr**, **HdmiAdapterHost**, and **HdfDeviceObject** assign values with each other so that other functions can be converted successfully. + ```c static int32_t HdmiAdapterBind(struct HdfDeviceObject *obj) { @@ -342,45 +371,47 @@ The HDMI module adaptation involves the following steps: return ret; } ``` - - - **Init** function - - >Input parameter: - >**HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration. - > - >Return value: - >HDF_STATUS - > - >Function description: - > - >Implements the **HdmiAdapterInit** function. - + + - **Init()** function + + **Input parameter**: + **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration. + + **Return value**: + HDF_STATUS + + **Function description**: + + Implements the **HdmiAdapterInit** function. + ```c static int32_t HdmiAdapterInit(struct HdfDeviceObject *obj) { return HDF_SUCCESS; } ``` - - - **Release** function - - > Input parameter: - > **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration. - > - > Return value: - > – - > - > Function description: - > Releases the memory and deletes the controller. This function assigns a value to the **Release** API in the driver entry structure. If the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. - + + - **Release()** function + + **Input parameter**: + **HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration. + + **Return value**: + – + + **Function description**: + Releases the memory and deletes the controller. This function assigns a value to the **Release()** API in the driver entry structure. If the HDF fails to call the **Init()** function to initialize the driver, the **Release()** function can be called to release driver resources. + ```c static void HdmiAdapterRelease(struct HdfDeviceObject *obj) { struct HdmiCntlr *cntlr = NULL; ... - cntlr = (struct MmcCntlr *)obj->service;// Forcibly convert HdfDeviceObject to HdmiCntlr by using service. For details about the value assignment, see the Bind function. + cntlr = (struct MmcCntlr *)obj->service;// Forcibly convert HdfDeviceObject to HdmiCntlr by using service. For details about the value assignment, see the Bind() function. ... HimciDeleteHost((struct HimciAdapterHost *)cntlr->priv);// Memory release function customized by the vendor. A forced conversion from HdmiCntlr to HimciAdapterHost is involved in the process. } ``` - > All forced conversion operations for obtaining the corresponding object can be successful only when the **Init** function has the corresponding value assignment operations. + + > ![](../public_sys-resources/icon-note.gif) **NOTE**
+ > All forced conversion operations for obtaining the corresponding object can be successful only when the **Init()** function has the corresponding value assignment operations. diff --git a/en/device-dev/driver/driver-platform-i3c-develop.md b/en/device-dev/driver/driver-platform-i3c-develop.md index c47b24c2987e02659db151cfdf0307d6afad4d01..e21de4f0cc61b257bf87c4171622e44b5dd37e50 100644 --- a/en/device-dev/driver/driver-platform-i3c-develop.md +++ b/en/device-dev/driver/driver-platform-i3c-develop.md @@ -164,9 +164,9 @@ The I3C module adaptation involves the following steps: ```c struct VirtualI3cCntlr { - struct AdcDevice device;// (Mandatory) Control object at the core layer. For details, see the following description of I3cCntlr. + struct I3cCntlr cntlr; // (Mandatory) Control object at the core layer. For details, see the following description of I3cCntlr. volatile unsigned char *regBase;// (Mandatory) Register base address. - uint32_t regBasePhy; // (Mandatory) Physical base address of the register. + uint32_t regBasePhy; // (Mandatory) Physical base address of the register. uint32_t regSize; // (Mandatory) Bit width of the register. uint16_t busId; // (Mandatory) Device number. uint16_t busMode;