hv_comm_Timer.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /**
  2. * @file hv_comm_Timer.h
  3. * @brief Header file of mute module.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. *
  10. * @endverbatim
  11. *
  12. * @author HiView SoC Software Team
  13. * @version 1.0.0
  14. * @date 2022-08-22
  15. */
  16. #ifndef _HV_COMMON_TIMER_H
  17. #define _HV_COMMON_TIMER_H
  18. #include "hv_vos_Comm.h"
  19. #include "hv_comm_DataType.h"
  20. #include "hv_comm_Event.h"
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. typedef enum
  25. {
  26. SYS_EVENT_TIMER_START = 0x4000, /*Defined the timer event start from 0x4000*/
  27. /* Here add the system event timer enum */
  28. SYS_EVENT_TIMER_POWR_BEGIN = SYS_EVENT_TIMER_START,
  29. SYS_EVENT_TIMER_TYPEC_PARSE_TIME_OUT = 0x4001,
  30. SYS_EVENT_TIMER_POWER_SIGNAL_CHECK = 0x4002,
  31. SYS_EVENT_TIMER_POWR_END = 0x4003,
  32. /*SystemTask Inputport module timer begin*/
  33. SYS_EVENT_TIMER_IP_BEGIN = 0x4004,
  34. SYS_EVENT_TIMER_DP0_BEGIN = SYS_EVENT_TIMER_IP_BEGIN,
  35. SYS_EVENT_TIMER_DP0_HPD_TIMEOUT = 0x4005,
  36. SYS_EVENT_TIMER_DP0_TIMING_CHECK = 0x4006,
  37. SYS_EVENT_TIMER_DP0_TRAINING_NG = 0x4007,
  38. SYS_EVENT_TIMER_DP0_AUDIO_CHECK = 0x4008,
  39. SYS_EVENT_TIMER_DP0_END = 0x4009,
  40. SYS_EVENT_TIMER_DP1_BEGIN = 0x400A,
  41. SYS_EVENT_TIMER_DP1_HPD_TIMEOUT = SYS_EVENT_TIMER_DP1_BEGIN,
  42. SYS_EVENT_TIMER_DP1_TIMING_CHECK = 0x400B,
  43. SYS_EVENT_TIMER_DP1_TRAINING_NG = 0x400C,
  44. SYS_EVENT_TIMER_DP1_AUDIO_CHECK = 0x400D,
  45. SYS_EVENT_TIMER_DP1_END = 0x400E,
  46. SYS_EVENT_TIMER_HDMI0_BEGIN = 0x400F,
  47. SYS_EVENT_TIMER_HDMI0_WAITSYNC = SYS_EVENT_TIMER_HDMI0_BEGIN,
  48. SYS_EVENT_TIMER_HDMI0_SYNCOK = 0x4010,
  49. SYS_EVENT_TIMER_HDMI0_HPD_SET_HIGH = 0x4011,
  50. SYS_EVENT_TIMER_HDMI0_WAIT_EQ_DONE = 0x4012,
  51. SYS_EVENT_TIMER_HDMI0_FASTLCK = 0x4013,
  52. SYS_EVENT_TIMER_HDMI0_HDCPSYNC = 0x4014,
  53. SYS_EVENT_TIMER_HDMI0_END = 0x4015,
  54. SYS_EVENT_TIMER_HDMI0_RATIO = SYS_EVENT_TIMER_HDMI0_END,
  55. SYS_EVENT_TIMER_HDMI1_BEGIN = 0x4016,
  56. SYS_EVENT_TIMER_HDMI1_WAITSYNC = SYS_EVENT_TIMER_HDMI1_BEGIN,
  57. SYS_EVENT_TIMER_HDMI1_SYNCOK = 0x4017,
  58. SYS_EVENT_TIMER_HDMI1_HPD_SET_HIGH = 0x4018,
  59. SYS_EVENT_TIMER_HDMI1_WAIT_EQ_DONE = 0x4019,
  60. SYS_EVENT_TIMER_HDMI1_FASTLCK = 0x401A,
  61. SYS_EVENT_TIMER_HDMI1_HDCPSYNC = 0x401B,
  62. SYS_EVENT_TIMER_HDMI1_END = 0x401C,
  63. SYS_EVENT_TIMER_HDMI1_RATIO = SYS_EVENT_TIMER_HDMI1_END,
  64. SYS_EVENT_TIMER_IP_END = 0x401D,
  65. /*SystemTask Inputport module timer end*/
  66. SYS_EVENT_TIMER_HDCP0 = 0x401E,
  67. SYS_EVENT_TIMER_HDCP1 = 0x401F,
  68. /*SystemTask Channel module timer begin*/
  69. SYS_EVENT_TIMER_CHANNEL_BEGIN = 0x4020,
  70. SYS_EVENT_TIMER_CH_MAIN_SERACH_OUT = SYS_EVENT_TIMER_CHANNEL_BEGIN,
  71. SYS_EVENT_TIMER_CH_SUB_SERACH_OUT = 0x4021,
  72. SYS_EVENT_TIMER_CH_MAIN_PERIOD_SERACH = 0x4022,
  73. SYS_EVENT_TIMER_CH_SUB_PERIOD_SERACH = 0x4023,
  74. SYS_EVENT_TIMER_CH_MAIN_AV_STABLE = 0x4024,
  75. SYS_EVENT_TIMER_CH_SUB_AV_STABLE = 0x4025,
  76. SYS_EVENT_TIMER_MAIN_NO_SIGNAL_TIMER = 0x4026,
  77. SYS_EVENT_TIMER_SUB_NO_SIGNAL_TIMER = 0x4027,
  78. SYS_EVENT_TIMER_MAIN_MUTE_TIMER = 0x4028,
  79. SYS_EVENT_TIMER_SUB_MUTE_TIMER = 0x4029,
  80. SYS_EVENT_TIMER_MAIN_AUDIO_MUTE_TIMER = 0x402A,
  81. SYS_EVENT_TIMER_SUB_AUDIO_MUTE_TIMER = 0x402B,
  82. SYS_EVENT_TIMER_BURN_IN_PERIOD_CHECK_TIMER = 0x402C,
  83. SYS_EVENT_TIMER_AUDIO_DELAY = 0x402D,
  84. SYS_EVENT_TIMER_DATABASE_SYNC_TIMER = 0x402E, /*周期性判断*/
  85. SYS_EVENT_TIMER_AV_WATCHDOG_TIMER = 0x402F,
  86. SYS_EVENT_TIMER_MAIN_AUDIO_FS_CHECK_TIMER = 0x4030,
  87. SYS_EVENT_TIMER_SUB_AUDIO_FS_CHECK_TIMER = 0x4031,
  88. SYS_EVENT_TIMER_CHANNEL_TIMER_END = 0x4032,
  89. /*SystemTask Channel module timer end*/
  90. /*SystemTask Pannel module timer begin*/
  91. SYS_EVENT_TIMER_PANEL_BEGIN = 0x4033,
  92. SYS_EVENT_TIMER_PANEL_POWER_ON = SYS_EVENT_TIMER_PANEL_BEGIN, /* Panel开始上电 */
  93. SYS_EVENT_TIMER_PANEL_DATA_ON = 0x4034, /* Panel上电完成,开始传输数据 */
  94. SYS_EVENT_TIMER_PANEL_BLK_ON = 0x4035, /* 开始传输有效数据,背光上电 */
  95. SYS_EVENT_TIMER_PANEL_BLK_OFF = 0x4036, /* 关闭背光*/
  96. SYS_EVENT_TIMER_PANEL_DATA_OFF = 0x4037, /* 关闭数据*/
  97. SYS_EVENT_TIMER_PANEL_POWER_OFF = 0x4038, /* Panel断电*/
  98. SYS_EVENT_TIMER_CHECK_TRAINING_STATUS = 0x4039, /* 等待KTX PLL 锁定*/
  99. SYS_EVENT_TIMER_PANEL_IDLE_PATT = 0x403A, /* 发送idle pattern*/
  100. SYS_EVENT_TIMER_SPI_BACK_LIGHT = 0x403B, /* SPI_BACK_LIGHT*/
  101. SYS_EVENT_TIMER_PANEL_END = 0x403C, /*SystemTask Pannel module timer end*/
  102. SYS_EVENT_TIMER_END = 0x403D,
  103. /*发送到SystemTask end*/
  104. /*发送到OsdTask begin*/
  105. OSD_EVENT_TIMER_START = 0x403E,
  106. OSD_EVENT_TIMER_KEY_REPEAT = OSD_EVENT_TIMER_START,
  107. OSD_EVENT_TIMER_KEY_HOLD = 0x403F,
  108. OSD_EVENT_TIMER_AUTO_CLOSE = 0x4040,
  109. OSD_EVENT_TIMER_AUTO_REFRESH = 0x4041,
  110. OSD_EVENT_TIMER_LOGO_HIDE = 0x4042,
  111. OSD_EVENT_TIMER_REMIND = 0x4043,
  112. OSD_EVENT_TIMER_AUTO_TEST = 0x4044,
  113. OSD_EVENT_TIMER_END = 0x4045,
  114. /*发送到OsdTask end*/
  115. /*发送到EventHubTask begin*/
  116. EVENT_HUB_TIMER_START = 0x4046,
  117. EVENT_HUB_TIMER_END = 0x4047,
  118. /*发送到EventHubTask End*/
  119. /*周期检测SDR或者ucBrightness*/
  120. EVENT_POWER_LOAD_CHECK_TIMER = 0x4048, /*周期性判断*/
  121. /*在timer任务中 回调不会 将timeout消息发送给任务!!!*/
  122. EVENT_TIMER_MAX = 0x4049, //0x4049 - 0x4000 = 72个在裸机下TIMER_NUM对应
  123. }TIMER_EVENT_E;
  124. typedef struct _HwTimerParams HvCommonHwTimer;
  125. typedef void (*HV_HW_TMR_CALLBACK)(HvCommonHwTimer* pstTimer);
  126. typedef struct _HwTimerParams{
  127. const CHAR8 * name; /* Hardware timer name for debug */
  128. UINT64 periodMs; /* Hardware timer period */
  129. HV_HW_TMR_CALLBACK callbackFn; /* Hardware timer callback function */
  130. TIMER_EVENT_E timerEvent; /* Hardware timer eventID that send to conrresponding task */
  131. HvCommonHwTimer* next; /* Hardware timer next pointer */
  132. UINT32 param; /* Hardware timer param */
  133. } HwTimerParams;
  134. void Hv_Common_Timer_DispatchEvent(VOID* pvArgument, USHORT16 usTimerId);
  135. /**
  136. * @brief Create Hardware timer instance.
  137. * @param[in] timer init struct parm.
  138. * @return malloc timer instance.
  139. */
  140. HvCommonHwTimer* Hv_Common_HwTimer_Create(HvCommonHwTimer* pstTimer);
  141. /**
  142. * @brief Delete Hardware timer instance.
  143. * @param[in] timer instance brefore creating.
  144. * @return None.
  145. */
  146. void Hv_Common_HwTimer_Delete(HvCommonHwTimer* pstTimer);
  147. /**
  148. * @brief Start Hardware timer instance.
  149. * @param[in] timer instance brefore creating.
  150. * @return None.
  151. */
  152. void Hv_Common_HwTimer_Start(HvCommonHwTimer* pstTimer);
  153. /**
  154. * @brief Stop Hardware timer instance.
  155. * @param[in] timer instance brefore creating.
  156. * @return None.
  157. */
  158. void Hv_Common_HwTimer_Stop(HvCommonHwTimer* pstTimer);
  159. /**
  160. * @brief Test function for Demo.
  161. * @param[in] None.
  162. * @return None.
  163. */
  164. void Hv_Test_Timer_Event();
  165. #ifdef HV_SCALER_DEBUG_VERSION
  166. CHAR8* TimerEventIDConvert(TIMER_EVENT_E enEventType);
  167. #endif
  168. #ifdef __cplusplus
  169. }
  170. #endif
  171. #endif /* _HV_COMMON_TIMER_H */