hdmi_time.c 833 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "drv_types.h"
  2. #include "hdmi_time.h"
  3. #include <linux/timer.h> // timer
  4. #include <linux/interrupt.h> /* in_interrupt() */
  5. #include <linux/delay.h>
  6. void HDMI_DelayMs(UINT32 x)
  7. {
  8. if(in_atomic())
  9. {
  10. mdelay(x);
  11. }
  12. else
  13. {
  14. msleep(x);
  15. }
  16. }
  17. void HDMI_DelayUs(UINT32 x)
  18. {
  19. udelay(x);
  20. }
  21. //------------------------------------------------------------------------------
  22. // Function: HDMI_GetSysTime
  23. // Description: Returns the current number of system ticks since we started (unit:1ms)
  24. // Parameters: None
  25. // Returns: the current number of system ticks since we started (unit:1ms)
  26. //------------------------------------------------------------------------------
  27. UINT32 HDMI_GetSysTime(void)
  28. {
  29. struct timespec now;
  30. getnstimeofday(&now);
  31. return(now.tv_sec*1000) +(now.tv_nsec/1000000); //transfer to minisecond
  32. }