123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /*!
- * @file MHL_application.c
- *
- * @brief This file specifies the APIs provided to control MHL
- * @note Copyright (c) 2013 S2-Tek Co., LTD.
- * All rights reserved.
- * 19, Innovation First Road, Hsinchu Science Park, 300 Taiwan
- * @author
- */
- /*******************************************************************************
- * Header include
- ******************************************************************************/
- #include <linux/kernel.h> /* printk */
- #include <linux/workqueue.h> /* workqueue */
- #include "drv_types.h"
- #include "mhl_application.h"
- #include "cbus_debug.h"
- #include "cbus_app.h"
- #include "../hdmi_time.h"
- /*******************************************************************************
- * Constant
- ******************************************************************************/
- /*******************************************************************************
- * Variable
- ******************************************************************************/
- /*******************************************************************************
- * Global Variables
- ******************************************************************************/
- //GL_Task_t hMHL_CBUS_MainThread;
- static struct work_struct MHL_wq;
- static struct timer_list MHL_timer;
- static BOOL gfMhlWorkEn = FALSE;
- //------------------------------------------------------------------------------
- //MHL Application Instance Data
- //------------------------------------------------------------------------------
- void schedule_MHL_timer(struct timer_list *Timer, unsigned int tt);
- //------------------------------------------------------------------------------
- // Function: MHL_CBUS_main
- // Description: Main entry point for MHL driver module
- // Parameters: none
- // Returns: none
- //------------------------------------------------------------------------------
- void MHL_CBUS_main(void* arg)
- {
- //printk("[MHL] MHL_CBUS_main start................." __DATE__"-" __TIME__ "\n");
- CbusAppTask();
- return;
- }
- /*******************************************************************************
- * Program
- ******************************************************************************/
- /*!
- * @brief Initial the MHL_CBUS.
- *
- */
- void MHL_CBUS_Initial(void)
- {
- printk("%s\n", __FUNCTION__);
- INIT_WORK(&MHL_wq,(work_func_t) MHL_CBUS_main);
- init_timer(&MHL_timer);
- //return (eStatus == GL_SUCCESS ? DTV_TRUE : DTV_FALSE);
- }
- void MHL_Poling_TIMER(void* dummy)
- {
- if(gfMhlWorkEn)
- {
- schedule_work(&MHL_wq);
- schedule_MHL_timer(&MHL_timer,10); //10ms
- }
- }
- void schedule_MHL_timer(struct timer_list *Timer, unsigned int tt)
- {
- del_timer(Timer);
- Timer->expires = jiffies + (HZ*tt) / 1000; // 1ms per unit
- Timer->data = (unsigned int)NULL;
- Timer->function = (void (*)(unsigned long))MHL_Poling_TIMER;
- add_timer(Timer);
- }
- void MHL_CBUS_Work_Enable(BOOL fEn)
- {
- printk("%s %d\n", __FUNCTION__, fEn);
- //if(gfMhlWorkEn == fEn) //already started or paused, return
- // return;
- if(fEn)
- {
- CbusAppDeviceInit();
- gfMhlWorkEn = TRUE;
- }
- else
- gfMhlWorkEn = FALSE;
- MHL_Poling_TIMER(NULL); //start or pause MHL work
- }
|