61 #include <sys/types.h>
68 #include "dsserverlogger.h"
76 #define direct_list_top(list) ((list))
77 #define IARM_BUS_Lock(lock) pthread_mutex_lock(&fpLock)
78 #define IARM_BUS_Unlock(lock) pthread_mutex_unlock(&fpLock)
80 static int m_isInitialized = 0;
81 static int m_isPlatInitialized=0;
82 static pthread_mutex_t fpLock = PTHREAD_MUTEX_INITIALIZER;
84 IARM_Result_t dsCompositeInMgr_init();
85 IARM_Result_t dsCompositeInMgr_term();
86 IARM_Result_t _dsCompositeInInit(
void *arg);
87 IARM_Result_t _dsCompositeInTerm(
void *arg);
88 IARM_Result_t _dsCompositeInGetNumberOfInputs(
void *arg);
89 IARM_Result_t _dsCompositeInGetStatus(
void *arg);
90 IARM_Result_t _dsCompositeInSelectPort(
void *arg);
91 IARM_Result_t _dsCompositeInScaleVideo(
void *arg);
93 void _dsCompositeInConnectCB(dsCompositeInPort_t port,
bool isPortConnected);
94 void _dsCompositeInSignalChangeCB(dsCompositeInPort_t port, dsCompInSignalStatus_t sigStatus);
99 #include "hostPersistence.hpp"
106 IARM_Result_t dsCompositeInMgr_init()
109 _dsCompositeInInit(NULL);
112 return IARM_RESULT_SUCCESS;
115 IARM_Result_t dsCompositeInMgr_term()
118 _dsCompositeInTerm(NULL);
119 return IARM_RESULT_SUCCESS;
122 IARM_Result_t _dsCompositeInInit(
void *arg)
124 printf(
"%s:%d ---> m_isInitialized=%d, m_isPlatInitialized=%d \n",
125 __PRETTY_FUNCTION__,__LINE__, m_isInitialized, m_isPlatInitialized);
130 #ifdef HAS_COMPOSITE_IN_SUPPORT
131 if (!m_isPlatInitialized)
133 typedef dsError_t (*dsCompositeInInit_t)(void);
134 static dsCompositeInInit_t func = 0;
136 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
138 func = (dsCompositeInInit_t) dlsym(dllib,
"dsCompositeInInit");
140 printf(
"dsCompositeInInit(void) is not defined\r\n");
145 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
150 printf(
"%s:%d - invoking dsCompositeInInit()\n", __PRETTY_FUNCTION__,__LINE__);
154 m_isPlatInitialized++;
157 if (!m_isInitialized)
159 #ifdef HAS_COMPOSITE_IN_SUPPORT
161 static dsCompositeInRegisterConnectCB_t cbfunc = 0;
163 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
165 cbfunc = (dsCompositeInRegisterConnectCB_t) dlsym(dllib,
"dsCompositeInRegisterConnectCB");
167 printf(
"dsCompositeInRegisterConnectCB(dsCompositeInConnectCB_t) is not defined\r\n");
172 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
177 printf(
"%s:%d - invoking dsCompositeInRegisterConnectCB()\n", __PRETTY_FUNCTION__,__LINE__);
178 cbfunc(_dsCompositeInConnectCB);
182 static dsCompositeInRegisterSignalCB_t signalChangeCBFunc = 0;
183 if (signalChangeCBFunc == 0) {
184 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
186 signalChangeCBFunc = (dsCompositeInRegisterSignalCB_t) dlsym(dllib,
"dsCompositeInRegisterSignalChangeCB");
187 if(signalChangeCBFunc == 0) {
188 printf(
"dsCompositeInRegisterSignalChangeCB(dsCompositeInSignalChangeCB_t) is not defined\r\n");
193 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
197 if(signalChangeCBFunc) {
198 printf(
"%s - invoking dsCompositeInRegisterSignalChangeCB()\n", __PRETTY_FUNCTION__);
199 signalChangeCBFunc(_dsCompositeInSignalChangeCB);
203 static dsCompositeInRegisterStatusChangeCB_t statusChangeCBFunc = 0;
204 if (statusChangeCBFunc == 0) {
205 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
207 statusChangeCBFunc = (dsCompositeInRegisterStatusChangeCB_t) dlsym(dllib,
"dsCompositeInRegisterStatusChangeCB");
208 if(statusChangeCBFunc == 0) {
209 printf(
"dsCompositeInRegisterStatusChangeCB(dsCompositeInStatusChangeCB_t) is not defined\r\n");
214 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
218 if(statusChangeCBFunc) {
219 printf(
"%s - invoking dsCompositeInRegisterStatusChangeCB()\n", __PRETTY_FUNCTION__);
220 statusChangeCBFunc(_dsCompositeInStatusChangeCB);
225 IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsCompositeInGetNumberOfInputs, _dsCompositeInGetNumberOfInputs);
233 IARM_BUS_Unlock(lock);
235 return IARM_RESULT_SUCCESS;
239 IARM_Result_t _dsCompositeInTerm(
void *arg)
242 printf(
"%s:%d ---> m_isPlatInitialized=%d\n", __PRETTY_FUNCTION__,__LINE__, m_isPlatInitialized);
245 #ifdef HAS_COMPOSITE_IN_SUPPORT
246 if (m_isPlatInitialized)
248 m_isPlatInitialized--;
249 if (!m_isPlatInitialized)
251 typedef dsError_t (*dsCompositeInTerm_t)(void);
252 static dsCompositeInTerm_t func = 0;
254 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
256 func = (dsCompositeInTerm_t) dlsym(dllib,
"dsCompositeInTerm");
258 printf(
"dsCompositeInTerm(void) is not defined\r\n");
263 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
267 printf(
"%s:%d - invoking dsCompositeInTerm()\n", __PRETTY_FUNCTION__,__LINE__);
273 IARM_BUS_Unlock(lock);
275 return IARM_RESULT_SUCCESS;
279 IARM_Result_t _dsCompositeInGetNumberOfInputs(
void *arg)
287 #ifdef HAS_COMPOSITE_IN_SUPPORT
288 typedef dsError_t (*dsCompositeInGetNumberOfInputs_t)(uint8_t *);
289 static dsCompositeInGetNumberOfInputs_t func = NULL;
291 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
293 func = (dsCompositeInGetNumberOfInputs_t) dlsym(dllib,
"dsCompositeInGetNumberOfInputs");
295 printf(
"dsCompositeInGetNumberOfInputs(uint8_t *) is not defined\r\n");
300 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
304 printf(
"%s:%d - invoking dsCompositeInGetNumberOfInputs()\n", __PRETTY_FUNCTION__,__LINE__);
305 param->result = func(¶m->numCompositeInputs);
310 IARM_BUS_Unlock(lock);
311 return IARM_RESULT_SUCCESS;
314 IARM_Result_t _dsCompositeInGetStatus(
void *arg)
322 #ifdef HAS_COMPOSITE_IN_SUPPORT
324 static dsCompositeInGetStatus_t func = NULL;
326 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
328 func = (dsCompositeInGetStatus_t) dlsym(dllib,
"dsCompositeInGetStatus");
330 printf(
"dsCompositeInGetStatus(dsCompositeInStatus_t *) is not defined\r\n");
335 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
339 printf(
"%s:%d - invoking dsCompositeInGetStatus()\n", __PRETTY_FUNCTION__,__LINE__);
340 param->result = func(¶m->status);
346 IARM_BUS_Unlock(lock);
348 return IARM_RESULT_SUCCESS;
351 IARM_Result_t _dsCompositeInSelectPort(
void *arg)
359 #ifdef HAS_COMPOSITE_IN_SUPPORT
360 typedef dsError_t (*dsCompositeInSelectPort_t)(dsCompositeInPort_t);
361 static dsCompositeInSelectPort_t func = NULL;
363 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
365 func = (dsCompositeInSelectPort_t) dlsym(dllib,
"dsCompositeInSelectPort");
367 printf(
"dsCompositeInSelectPort(dsCompositeInPort_t) is not defined\r\n");
372 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
376 printf(
"%s:%d - invoking dsCompositeInSelectPort()\n", __PRETTY_FUNCTION__,__LINE__);
377 param->result = func(param->port);
383 IARM_BUS_Unlock(lock);
385 return IARM_RESULT_SUCCESS;
388 IARM_Result_t _dsCompositeInScaleVideo(
void *arg)
395 #ifdef HAS_COMPOSITE_IN_SUPPORT
396 typedef dsError_t (*dsCompositeInScaleVideo_t)(int32_t , int32_t , int32_t , int32_t);
397 static dsCompositeInScaleVideo_t func = NULL;
399 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
401 func = (dsCompositeInScaleVideo_t) dlsym(dllib,
"dsCompositeInScaleVideo");
403 printf(
"dsCompositeInScaleVideo(int32_t x, int32_t y, int32_t width, int32_t height) is not defined\r\n");
408 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
413 printf(
"%s:%d - invoking dsCompositeInScaleVideo()\n", __PRETTY_FUNCTION__,__LINE__);
414 param->result = func(param->videoRect.x, param->videoRect.y, param->videoRect.width, param->videoRect.height);
420 IARM_BUS_Unlock(lock);
422 return IARM_RESULT_SUCCESS;
426 void _dsCompositeInConnectCB(dsCompositeInPort_t port,
bool isPortConnected)
430 printf(
"%s:%d - COMPOSITE In hotplug update!!!!!!..%d, %d\r\n",__PRETTY_FUNCTION__,__LINE__, port, isPortConnected);
431 composite_in_hpd_eventData.data.composite_in_connect.port = port;
432 composite_in_hpd_eventData.data.composite_in_connect.isPortConnected = isPortConnected;
436 (
void *)&composite_in_hpd_eventData,
437 sizeof(composite_in_hpd_eventData));
442 void _dsCompositeInSignalChangeCB(dsCompositeInPort_t port, dsCompInSignalStatus_t sigStatus)
445 printf(
"%s:%d Composite In signal change update!!!!!! Port: %d, Signal Status: %d\r\n", __PRETTY_FUNCTION__, __LINE__, port, sigStatus);
446 composite_in_sigStatus_eventData.data.composite_in_sig_status.port = port;
447 composite_in_sigStatus_eventData.data.composite_in_sig_status.status = sigStatus;
451 (
void *)&composite_in_sigStatus_eventData,
452 sizeof(composite_in_sigStatus_eventData));
454 printf(
"%s <-- \n", __PRETTY_FUNCTION__);
460 printf(
"%s:%d Composite In status change update!!!!!! Port: %d, isPresented: %d\r\n", __PRETTY_FUNCTION__, __LINE__, inputStatus.
activePort, inputStatus.
isPresented);
461 hdmi_in_status_eventData.data.composite_in_status.port = inputStatus.
activePort;
462 hdmi_in_status_eventData.data.composite_in_status.isPresented = inputStatus.
isPresented;
466 (
void *)&hdmi_in_status_eventData,
467 sizeof(hdmi_in_status_eventData));
469 printf(
"%s <-- \n", __PRETTY_FUNCTION__);