• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #include "hdmi_if.h"
10 #ifndef __USER__
11 #include "hdmi_core.h"
12 #endif
13 #include "hdf_base.h"
14 #include "hdf_log.h"
15 #include "osal_mem.h"
16 #ifdef __USER__
17 #include "hdf_io_service_if.h"
18 #include "securec.h"
19 #endif
20 
21 #define HDF_LOG_TAG hdmi_if_c
22 
23 #define HDMI_SERVICE_NAME_LEN 32
24 
25 #ifdef __USER__
26 
27 enum HdmiIoCmd {
28     HDMI_CMD_OPEN,
29     HDMI_CMD_CLOSE,
30     HDMI_CMD_START,
31     HDMI_CMD_STOP,
32     HDMI_CMD_AVMUTE_SET,
33     HDMI_CMD_DEEP_COLOR_SET,
34     HDMI_CMD_DEEP_COLOR_GET,
35     HDMI_CMD_VIDEO_ATTR_SET,
36     HDMI_CMD_AUDIO_ATTR_SET,
37     HDMI_CMD_HDR_ATTR_SET,
38     HDMI_CMD_READ_SINK_EDID,
39     HDMI_CMD_INFOFRAME_SET,
40     HDMI_CMD_INFOFRAME_GET,
41     HDMI_CMD_REGISTER_HPD_CALLBACK_FUNC,
42     HDMI_CMD_UNREGISTER_HPD_CALLBACK_FUNC,
43     HDMI_CMD_BUTT,
44 };
45 
HdmiGetDataFromReply(struct HdfSBuf * reply,uint8_t * data,uint32_t size)46 static int32_t HdmiGetDataFromReply(struct HdfSBuf *reply, uint8_t *data, uint32_t size)
47 {
48     uint32_t rLen;
49     const void *rBuf = NULL;
50 
51     if (HdfSbufReadBuffer(reply, &rBuf, &rLen) == false) {
52         HDF_LOGE("HdmiGetDataFromReply: read rBuf fail!");
53         return HDF_ERR_IO;
54     }
55     if (size != rLen) {
56         HDF_LOGE("HdmiGetDataFromReply: err len:%u, rLen:%u", size, rLen);
57         if (rLen > size) {
58             rLen = size;
59         }
60     }
61 
62     if (memcpy_s(data, size, rBuf, rLen) != EOK) {
63         HDF_LOGE("HdmiGetDataFromReply: memcpy rBuf fail!");
64         return HDF_ERR_IO;
65     }
66     return HDF_SUCCESS;
67 }
68 
HdmiUserClose(DevHandle handle)69 static void HdmiUserClose(DevHandle handle)
70 {
71     struct HdfIoService *service = (struct HdfIoService *)handle;
72     int32_t ret;
73 
74     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
75         HDF_LOGE("HdmiUserClose: service is invalid");
76         return;
77     }
78 
79     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_CLOSE, NULL, NULL);
80     if (ret != HDF_SUCCESS) {
81         HDF_LOGE("HdmiUserClose: failed to send service call:%d", ret);
82     }
83 }
84 
HdmiUserStart(DevHandle handle)85 static int32_t HdmiUserStart(DevHandle handle)
86 {
87     struct HdfIoService *service = (struct HdfIoService *)handle;
88     int32_t ret;
89 
90     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
91         HDF_LOGE("HdmiUserStart: service is invalid");
92         return HDF_ERR_INVALID_PARAM;
93     }
94 
95     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_START, NULL, NULL);
96     if (ret != HDF_SUCCESS) {
97         HDF_LOGE("HdmiUserStart: failed to send service call:%d", ret);
98         return ret;
99     }
100     return HDF_SUCCESS;
101 }
102 
HdmiUserStop(DevHandle handle)103 static int32_t HdmiUserStop(DevHandle handle)
104 {
105     struct HdfIoService *service = (struct HdfIoService *)handle;
106     int32_t ret;
107 
108     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
109         HDF_LOGE("HdmiUserStop: service is invalid");
110         return HDF_ERR_INVALID_PARAM;
111     }
112 
113     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_STOP, NULL, NULL);
114     if (ret != HDF_SUCCESS) {
115         HDF_LOGE("HdmiUserStop: failed to send service call:%d", ret);
116         return ret;
117     }
118     return HDF_SUCCESS;
119 }
120 
HdmiUserAvmuteSet(DevHandle handle,bool enable)121 static int32_t HdmiUserAvmuteSet(DevHandle handle, bool enable)
122 {
123     int32_t ret;
124     struct HdfSBuf *buf = NULL;
125     struct HdfIoService *service = (struct HdfIoService *)handle;
126 
127     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
128         HDF_LOGE("HdmiUserAvmuteSet: service is invalid");
129         return HDF_ERR_INVALID_PARAM;
130     }
131 
132     buf = HdfSbufObtain(sizeof(enable));
133     if (buf == NULL) {
134         HDF_LOGE("HdmiUserAvmuteSet: failed to obtain buf");
135         return HDF_ERR_MALLOC_FAIL;
136     }
137     if (!HdfSbufWriteBuffer(buf, &enable, sizeof(enable))) {
138         HDF_LOGE("HdmiUserAvmuteSet: sbuf write buffer failed");
139         HdfSbufRecycle(buf);
140         return HDF_ERR_IO;
141     }
142 
143     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_AVMUTE_SET, buf, NULL);
144     if (ret != HDF_SUCCESS) {
145         HDF_LOGE("HdmiUserAvmuteSet: failed to write, ret %d", ret);
146     }
147     HdfSbufRecycle(buf);
148     return ret;
149 }
150 
HdmiUserDeepColorSet(DevHandle handle,enum HdmiDeepColor color)151 static int32_t HdmiUserDeepColorSet(DevHandle handle, enum HdmiDeepColor color)
152 {
153     int32_t ret;
154     struct HdfSBuf *buf = NULL;
155     struct HdfIoService *service = (struct HdfIoService *)handle;
156 
157     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
158         HDF_LOGE("HdmiUserDeepColorSet: service is invalid");
159         return HDF_ERR_INVALID_PARAM;
160     }
161 
162     buf = HdfSbufObtain(sizeof(color));
163     if (buf == NULL) {
164         HDF_LOGE("HdmiUserDeepColorSet: failed to obtain buf");
165         return HDF_ERR_MALLOC_FAIL;
166     }
167     if (!HdfSbufWriteBuffer(buf, &color, sizeof(color))) {
168         HDF_LOGE("HdmiUserDeepColorSet: sbuf write color failed");
169         HdfSbufRecycle(buf);
170         return HDF_ERR_IO;
171     }
172 
173     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_DEEP_COLOR_SET, buf, NULL);
174     if (ret != HDF_SUCCESS) {
175         HDF_LOGE("HdmiUserDeepColorSet: failed to write, ret %d", ret);
176     }
177     HdfSbufRecycle(buf);
178     return ret;
179 }
180 
HdmiUserSetVideoAttribute(DevHandle handle,struct HdmiVideoAttr * attr)181 static int32_t HdmiUserSetVideoAttribute(DevHandle handle, struct HdmiVideoAttr *attr)
182 {
183     int32_t ret;
184     struct HdfSBuf *buf = NULL;
185     struct HdfIoService *service = (struct HdfIoService *)handle;
186 
187     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
188         HDF_LOGE("HdmiUserSetVideoAttribute: service is invalid");
189         return HDF_ERR_INVALID_PARAM;
190     }
191     if (attr == NULL) {
192         return HDF_ERR_INVALID_PARAM;
193     }
194 
195     buf = HdfSbufObtain(sizeof(struct HdmiVideoAttr));
196     if (buf == NULL) {
197         HDF_LOGE("HdmiUserSetVideoAttribute: failed to obtain buf");
198         return HDF_ERR_MALLOC_FAIL;
199     }
200     if (!HdfSbufWriteBuffer(buf, attr, sizeof(struct HdmiVideoAttr))) {
201         HDF_LOGE("HdmiUserSetVideoAttribute: sbuf write attr failed");
202         HdfSbufRecycle(buf);
203         return HDF_ERR_IO;
204     }
205 
206     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_VIDEO_ATTR_SET, buf, NULL);
207     if (ret != HDF_SUCCESS) {
208         HDF_LOGE("HdmiUserSetVideoAttribute: failed to write, ret %d", ret);
209     }
210     HdfSbufRecycle(buf);
211     return ret;
212 }
213 
HdmiUserSetAudioAttribute(DevHandle handle,struct HdmiAudioAttr * attr)214 static int32_t HdmiUserSetAudioAttribute(DevHandle handle, struct HdmiAudioAttr *attr)
215 {
216     int32_t ret;
217     struct HdfSBuf *buf = NULL;
218     struct HdfIoService *service = (struct HdfIoService *)handle;
219 
220     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
221         HDF_LOGE("HdmiUserSetAudioAttribute: service is invalid");
222         return HDF_ERR_INVALID_PARAM;
223     }
224     if (attr == NULL) {
225         HDF_LOGE("HdmiUserSetAudioAttribute: attr is NULL");
226         return HDF_ERR_INVALID_PARAM;
227     }
228 
229     buf = HdfSbufObtain(sizeof(struct HdmiAudioAttr));
230     if (buf == NULL) {
231         HDF_LOGE("HdmiUserSetAudioAttribute: failed to obtain buf");
232         return HDF_ERR_MALLOC_FAIL;
233     }
234     if (!HdfSbufWriteBuffer(buf, attr, sizeof(struct HdmiAudioAttr))) {
235         HDF_LOGE("HdmiUserSetAudioAttribute: sbuf write attr failed");
236         HdfSbufRecycle(buf);
237         return HDF_ERR_IO;
238     }
239 
240     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_AUDIO_ATTR_SET, buf, NULL);
241     if (ret != HDF_SUCCESS) {
242         HDF_LOGE("HdmiUserSetAudioAttribute: failed to write, ret %d", ret);
243     }
244     HdfSbufRecycle(buf);
245     return ret;
246 }
247 
HdmiUserSetHdrAttribute(DevHandle handle,struct HdmiHdrAttr * attr)248 static int32_t HdmiUserSetHdrAttribute(DevHandle handle, struct HdmiHdrAttr *attr)
249 {
250     int32_t ret;
251     struct HdfSBuf *buf = NULL;
252     struct HdfIoService *service = (struct HdfIoService *)handle;
253 
254     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
255         HDF_LOGE("HdmiUserSetHdrAttribute: service is invalid");
256         return HDF_ERR_INVALID_PARAM;
257     }
258     if (attr == NULL) {
259         HDF_LOGE("HdmiUserSetHdrAttribute: attr is NULL");
260         return HDF_ERR_INVALID_PARAM;
261     }
262 
263     buf = HdfSbufObtain(sizeof(struct HdmiHdrAttr));
264     if (buf == NULL) {
265         HDF_LOGE("HdmiUserSetHdrAttribute: failed to obtain buf");
266         return HDF_ERR_MALLOC_FAIL;
267     }
268     if (!HdfSbufWriteBuffer(buf, attr, sizeof(struct HdmiHdrAttr))) {
269         HDF_LOGE("HdmiUserSetHdrAttribute: sbuf write attr failed");
270         HdfSbufRecycle(buf);
271         return HDF_ERR_IO;
272     }
273 
274     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_HDR_ATTR_SET, buf, NULL);
275     if (ret != HDF_SUCCESS) {
276         HDF_LOGE("HdmiUserSetAudioAttribute: failed to write, ret %d", ret);
277     }
278     HdfSbufRecycle(buf);
279     return ret;
280 }
281 
HdmiUserDeepColorGet(DevHandle handle,enum HdmiDeepColor * color)282 static int32_t HdmiUserDeepColorGet(DevHandle handle, enum HdmiDeepColor *color)
283 {
284     int32_t ret;
285     struct HdfSBuf *reply = NULL;
286     struct HdfIoService *service = (struct HdfIoService *)handle;
287 
288     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
289         HDF_LOGE("HdmiUserDeepColorGet: service is invalid");
290         return HDF_ERR_INVALID_PARAM;
291     }
292     if (color == NULL) {
293         return HDF_ERR_INVALID_PARAM;
294     }
295 
296     /* Four bytes are used to store the buffer length, and four bytes are used to align the memory. */
297     reply = HdfSbufObtain(sizeof(*color) + sizeof(uint64_t));
298     if (reply == NULL) {
299         HDF_LOGE("HdmiUserDeepColorGet: failed to obtain reply");
300         ret = HDF_ERR_MALLOC_FAIL;
301         goto __EXIT;
302     }
303 
304     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_DEEP_COLOR_GET, NULL, reply);
305     if (ret != HDF_SUCCESS) {
306         HDF_LOGE("HdmiUserDeepColorGet: failed to write, ret %d", ret);
307     } else {
308         ret = HdmiGetDataFromReply(reply, (uint8_t *)color, sizeof(*color));
309     }
310 
311 __EXIT :
312     if (reply != NULL) {
313         HdfSbufRecycle(reply);
314     }
315     return ret;
316 }
317 
HdmiUserGetSinkEdid(DevHandle handle,uint8_t * buffer,uint32_t len)318 static int32_t HdmiUserGetSinkEdid(DevHandle handle, uint8_t *buffer, uint32_t len)
319 {
320     int32_t ret;
321     struct HdfSBuf *reply = NULL;
322     struct HdfIoService *service = (struct HdfIoService *)handle;
323 
324     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
325         HDF_LOGE("HdmiUserGetSinkEdid: service is invalid");
326         return HDF_ERR_INVALID_PARAM;
327     }
328     if (buffer == NULL || len == 0) {
329         return HDF_ERR_INVALID_PARAM;
330     }
331 
332     reply = HdfSbufObtain(len);
333     if (reply == NULL) {
334         HDF_LOGE("HdmiUserGetSinkEdid: failed to obtain reply");
335         ret = HDF_ERR_MALLOC_FAIL;
336         goto __EXIT;
337     }
338 
339     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_READ_SINK_EDID, NULL, reply);
340     if (ret <= 0) {
341         HDF_LOGE("HdmiUserGetSinkEdid: failed to write, ret %d", ret);
342     } else {
343         ret = HdmiGetDataFromReply(reply, buffer, len);
344     }
345 
346 __EXIT :
347     if (reply != NULL) {
348         HdfSbufRecycle(reply);
349     }
350     return ret;
351 }
352 
HdmiUserRegisterHpdCallbackFunc(DevHandle handle,struct HdmiHpdCallbackInfo * callback)353 static int32_t HdmiUserRegisterHpdCallbackFunc(DevHandle handle, struct HdmiHpdCallbackInfo *callback)
354 {
355     int32_t ret;
356     struct HdfSBuf *buf = NULL;
357     struct HdfIoService *service = (struct HdfIoService *)handle;
358     uint32_t addr = (uint32_t)(uintptr_t)callback;
359 
360     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
361         HDF_LOGE("HdmiUserRegisterHpdCallbackFunc: service is invalid");
362         return HDF_ERR_INVALID_PARAM;
363     }
364     if (callback == NULL) {
365         return HDF_ERR_INVALID_PARAM;
366     }
367 
368     buf = HdfSbufObtain(sizeof(uint32_t));
369     if (buf == NULL) {
370         HDF_LOGE("HdmiUserRegisterHpdCallbackFunc: failed to obtain buf");
371         return HDF_ERR_MALLOC_FAIL;
372     }
373     if (!HdfSbufWriteBuffer(buf, (void *)&addr, sizeof(uint32_t))) {
374         HDF_LOGE("HdmiUserRegisterHpdCallbackFunc: sbuf write attr failed");
375         HdfSbufRecycle(buf);
376         return HDF_ERR_IO;
377     }
378 
379     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_REGISTER_HPD_CALLBACK_FUNC, buf, NULL);
380     if (ret != HDF_SUCCESS) {
381         HDF_LOGE("HdmiUserRegisterHpdCallbackFunc: failed to write, ret %d", ret);
382     }
383     HdfSbufRecycle(buf);
384     return ret;
385 }
386 
HdmiUserUnregisterHpdCallbackFunc(DevHandle handle)387 static int32_t HdmiUserUnregisterHpdCallbackFunc(DevHandle handle)
388 {
389     struct HdfIoService *service = (struct HdfIoService *)handle;
390     int32_t ret;
391 
392     if (service == NULL || service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
393         HDF_LOGE("HdmiUserUnregisterHpdCallbackFunc: service is invalid");
394         return HDF_ERR_INVALID_PARAM;
395     }
396 
397     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_UNREGISTER_HPD_CALLBACK_FUNC, NULL, NULL);
398     if (ret != HDF_SUCCESS) {
399         HDF_LOGE("HdmiUserUnregisterHpdCallbackFunc: failed to send service call:%d", ret);
400         return ret;
401     }
402     return HDF_SUCCESS;
403 }
404 #endif
405 
HdmiCntlrObjGet(uint16_t busNum)406 static void *HdmiCntlrObjGet(uint16_t busNum)
407 {
408     char *serviceName = NULL;
409     void *obj = NULL;
410 
411     serviceName = (char *)OsalMemCalloc(HDMI_SERVICE_NAME_LEN + 1);
412     if (serviceName == NULL) {
413         HDF_LOGE("HDMI service name malloc fail.");
414         return NULL;
415     }
416     if (snprintf_s(serviceName, (HDMI_SERVICE_NAME_LEN + 1),
417         HDMI_SERVICE_NAME_LEN, "HDF_PLATFORM_HDMI_%u", busNum) < 0) {
418         HDF_LOGE("get HDMI service name fail.");
419         OsalMemFree(serviceName);
420         return obj;
421     }
422 #ifdef __USER__
423     obj = (void *)HdfIoServiceBind(serviceName);
424 #else
425     obj = (void *)HdmiCntlrGetByBusNum(busNum);
426 #endif
427     OsalMemFree(serviceName);
428     return obj;
429 }
430 
HdmiOpen(uint16_t busNum)431 DevHandle HdmiOpen(uint16_t busNum)
432 {
433     DevHandle *obj = (DevHandle *)HdmiCntlrObjGet(busNum);
434     int32_t ret;
435 
436     if (obj == NULL) {
437         return NULL;
438     }
439 #ifdef __USER__
440     struct HdfIoService *service = (struct HdfIoService *)obj;
441     if (service->dispatcher == NULL || service->dispatcher->Dispatch == NULL) {
442         HDF_LOGE("HdmiOpen: dispatcher or Dispatch is NULL!");
443         return NULL;
444     }
445     ret = service->dispatcher->Dispatch(&service->object, HDMI_CMD_OPEN, NULL, NULL);
446     if (ret != HDF_SUCCESS) {
447         HDF_LOGE("HdmiOpen: failed to send service call:%d", ret);
448         return NULL;
449     }
450 #else
451     ret = HdmiCntlrOpen((struct HdmiCntlr *)obj);
452     if (ret != HDF_SUCCESS) {
453         return NULL;
454     }
455 #endif
456     return obj;
457 }
458 
HdmiStart(DevHandle handle)459 int32_t HdmiStart(DevHandle handle)
460 {
461 #ifdef __USER__
462     return HdmiUserStart(handle);
463 #else
464     return HdmiCntlrStart((struct HdmiCntlr *)handle);
465 #endif
466 }
467 
HdmiStop(DevHandle handle)468 int32_t HdmiStop(DevHandle handle)
469 {
470 #ifdef __USER__
471     return HdmiUserStop(handle);
472 #else
473     return HdmiCntlrStop((struct HdmiCntlr *)handle);
474 #endif
475 }
476 
HdmiAvmuteSet(DevHandle handle,bool enable)477 int32_t HdmiAvmuteSet(DevHandle handle, bool enable)
478 {
479 #ifdef __USER__
480     return HdmiUserAvmuteSet(handle, enable);
481 #else
482     HdmiCntlrAvmuteSet((struct HdmiCntlr *)handle, enable);
483     return HDF_SUCCESS;
484 #endif
485 }
486 
HdmiDeepColorSet(DevHandle handle,enum HdmiDeepColor color)487 int32_t HdmiDeepColorSet(DevHandle handle, enum HdmiDeepColor color)
488 {
489 #ifdef __USER__
490     return HdmiUserDeepColorSet(handle, color);
491 #else
492     return HdmiCntlrDeepColorSet((struct HdmiCntlr *)handle, color);
493 #endif
494 }
495 
HdmiDeepColorGet(DevHandle handle,enum HdmiDeepColor * color)496 int32_t HdmiDeepColorGet(DevHandle handle, enum HdmiDeepColor *color)
497 {
498 #ifdef __USER__
499     return HdmiUserDeepColorGet(handle, color);
500 #else
501     return HdmiCntlrDeepColorGet((struct HdmiCntlr *)handle, color);
502 #endif
503 }
504 
HdmiSetVideoAttribute(DevHandle handle,struct HdmiVideoAttr * attr)505 int32_t HdmiSetVideoAttribute(DevHandle handle, struct HdmiVideoAttr *attr)
506 {
507 #ifdef __USER__
508     return HdmiUserSetVideoAttribute(handle, attr);
509 #else
510     return HdmiCntlrSetVideoAttribute((struct HdmiCntlr *)handle, attr);
511 #endif
512 }
513 
HdmiSetAudioAttribute(DevHandle handle,struct HdmiAudioAttr * attr)514 int32_t HdmiSetAudioAttribute(DevHandle handle, struct HdmiAudioAttr *attr)
515 {
516 #ifdef __USER__
517     return HdmiUserSetAudioAttribute(handle, attr);
518 #else
519     return HdmiCntlrSetAudioAttribute((struct HdmiCntlr *)handle, attr);
520 #endif
521 }
522 
HdmiSetHdrAttribute(DevHandle handle,struct HdmiHdrAttr * attr)523 int32_t HdmiSetHdrAttribute(DevHandle handle, struct HdmiHdrAttr *attr)
524 {
525 #ifdef __USER__
526     return HdmiUserSetHdrAttribute(handle, attr);
527 #else
528     return HdmiCntlrSetHdrAttribute((struct HdmiCntlr *)handle, attr);
529 #endif
530 }
531 
HdmiReadSinkEdid(DevHandle handle,uint8_t * buffer,uint32_t len)532 int32_t HdmiReadSinkEdid(DevHandle handle, uint8_t *buffer, uint32_t len)
533 {
534 #ifdef __USER__
535     return HdmiUserGetSinkEdid(handle, buffer, len);
536 #else
537     return HdmiCntlrGetSinkEdid((struct HdmiCntlr *)handle, buffer, len);
538 #endif
539 }
540 
HdmiRegisterHpdCallbackFunc(DevHandle handle,struct HdmiHpdCallbackInfo * callback)541 int32_t HdmiRegisterHpdCallbackFunc(DevHandle handle, struct HdmiHpdCallbackInfo *callback)
542 {
543 #ifdef __USER__
544     return HdmiUserRegisterHpdCallbackFunc(handle, callback);
545 #else
546     return HdmiCntlrRegisterHpdCallbackFunc((struct HdmiCntlr *)handle, callback);
547 #endif
548 }
549 
HdmiUnregisterHpdCallbackFunc(DevHandle handle)550 int32_t HdmiUnregisterHpdCallbackFunc(DevHandle handle)
551 {
552 #ifdef __USER__
553     return HdmiUserUnregisterHpdCallbackFunc(handle);
554 #else
555     return HdmiCntlrUnregisterHpdCallbackFunc((struct HdmiCntlr *)handle);
556 #endif
557 }
558 
HdmiClose(DevHandle handle)559 void HdmiClose(DevHandle handle)
560 {
561 #ifdef __USER__
562     HdmiUserClose(handle);
563 #else
564     HdmiCntlrClose((struct HdmiCntlr *)handle);
565 #endif
566 }
567