提交 29e4bb50 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 43d1aae5
...@@ -182,39 +182,39 @@ The following uses **mipi_tx_hi35xx.c** as an example to present the contents th ...@@ -182,39 +182,39 @@ The following uses **mipi_tx_hi35xx.c** as an example to present the contents th
Attaches the **MipiDsiCntlrMethod** instance, calls **MipiDsiRegisterCntlr**, and performs other vendor-defined initialization operations. Attaches the **MipiDsiCntlrMethod** instance, calls **MipiDsiRegisterCntlr**, and performs other vendor-defined initialization operations.
``` ```
static int32_t Hi35xxMipiTxInit(struct HdfDeviceObject *device) static int32_t Hi35xxMipiTxInit(struct HdfDeviceObject *device)
{ {
int32_t ret; int32_t ret;
g_mipiTx.priv = NULL; // g_mipiTx is a global variable defined. g_mipiTx.priv = NULL; // g_mipiTx is a global variable defined.
// static struct MipiDsiCntlr g_mipiTx { // static struct MipiDsiCntlr g_mipiTx {
// .devNo=0 // .devNo=0
//}; //};
g_mipiTx.ops = &g_method; // Attach the MipiDsiCntlrMethod instance. g_mipiTx.ops = &g_method; // Attach the MipiDsiCntlrMethod instance.
ret = MipiDsiRegisterCntlr(&g_mipiTx, device);// (Mandatory) Call the function at the core layer and g_mipiTx to initialize global variables at the core layer. ret = MipiDsiRegisterCntlr(&g_mipiTx, device);// (Mandatory) Call the function at the core layer and g_mipiTx to initialize global variables at the core layer.
... ...
return MipiTxDrvInit(0); // (Mandatory) Device initialization customized by the vendor. return MipiTxDrvInit(0); // (Mandatory) Device initialization customized by the vendor.
} }
// mipi_dsi_core.c file // mipi_dsi_core.c file
int32_t MipiDsiRegisterCntlr(struct MipiDsiCntlr *cntlr, struct HdfDeviceObject *device) int32_t MipiDsiRegisterCntlr(struct MipiDsiCntlr *cntlr, struct HdfDeviceObject *device)
{ {
... ...
// Define the global variable static struct MipiDsiHandle g_mipiDsihandle[MAX_CNTLR_CNT]. // Define the global variable static struct MipiDsiHandle g_mipiDsihandle[MAX_CNTLR_CNT].
if (g_mipiDsihandle[cntlr->devNo].cntlr == NULL) { if (g_mipiDsihandle[cntlr->devNo].cntlr == NULL) {
(void)OsalMutexInit(&g_mipiDsihandle[cntlr->devNo].lock); (void)OsalMutexInit(&g_mipiDsihandle[cntlr->devNo].lock);
(void)OsalMutexInit(&(cntlr->lock)); (void)OsalMutexInit(&(cntlr->lock));
g_mipiDsihandle[cntlr->devNo].cntlr = cntlr;// Initialize MipiDsiHandle. g_mipiDsihandle[cntlr->devNo].cntlr = cntlr;// Initialize MipiDsiHandle.
g_mipiDsihandle[cntlr->devNo].priv = NULL; g_mipiDsihandle[cntlr->devNo].priv = NULL;
cntlr->device = device; // Prerequisites for conversion between HdfDeviceObject and MipiDsiHandle. cntlr->device = device; // Prerequisites for conversion between HdfDeviceObject and MipiDsiHandle.
device->service = &(cntlr->service); // Prerequisites for conversion between HdfDeviceObject and MipiDsiHandle. device->service = &(cntlr->service); // Prerequisites for conversion between HdfDeviceObject and MipiDsiHandle.
cntlr->priv = NULL; cntlr->priv = NULL;
... ...
return HDF_SUCCESS; return HDF_SUCCESS;
} }
... ...
return HDF_FAILURE; return HDF_FAILURE;
} }
``` ```
- **Release** function - **Release** function
...@@ -237,17 +237,15 @@ The following uses **mipi_tx_hi35xx.c** as an example to present the contents th ...@@ -237,17 +237,15 @@ The following uses **mipi_tx_hi35xx.c** as an example to present the contents th
``` ```
static void Hi35xxMipiTxRelease(struct HdfDeviceObject *device) static void Hi35xxMipiTxRelease(struct HdfDeviceObject *device)
{ {
struct MipiDsiCntlr *cntlr = NULL; struct MipiDsiCntlr *cntlr = NULL;
... ...
cntlr = MipiDsiCntlrFromDevice(device);// A forced conversion from HdfDeviceObject to MipiDsiCntlr is involved. cntlr = MipiDsiCntlrFromDevice(device);// A forced conversion from HdfDeviceObject to MipiDsiCntlr is involved.
// return (device == NULL) ? NULL : (struct MipiDsiCntlr *)device->service; // return (device == NULL) ? NULL : (struct MipiDsiCntlr *)device->service;
... ...
MipiTxDrvExit(; // (Mandatory) Release the resources occupied by the vendor's devices. MipiTxDrvExit(; // (Mandatory) Release the resources occupied by the vendor's devices.
MipiDsiUnregisterCntlr(&g_mipiTx); // Empty function MipiDsiUnregisterCntlr(&g_mipiTx); // Empty function
g_mipiTx.priv = NULL; g_mipiTx.priv = NULL;
HDF_LOGI("%s: unload mipi_tx driver 1212!", __func__); HDF_LOGI("%s: unload mipi_tx driver 1212!", __func__);
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册