timer.h
上传用户:mhstny
上传日期:2022-08-05
资源大小:793k
文件大小:2k
源码类别:

微处理器开发

开发平台:

Unix_Linux

  1. #ifndef _TIMER_H
  2. #define _TIMER_H
  3. #define FCLK_260M ((252<<12)|(4<<4)|1)
  4. #define FCLK_240M ((232<<12)|(4<<4)|1)
  5. #define FCLK_220M ((212<<12)|(4<<4)|1)
  6. #define FCLK_200M ((192<<12)|(4<<4)|1)
  7. #define FCLK_180M ((172<<12)|(4<<4)|1)
  8. #define FCLK_160M ((152<<12)|(4<<4)|1)
  9. #define FCLK_140M ((132<<12)|(4<<4)|1)
  10. #define FCLK_120M ((112<<12)|(4<<4)|1)
  11. #define FCLK_100M ((92<<12)|(4<<4)|1)
  12. #define FCLK_80M ((72<<12)|(4<<4)|1)
  13. #define FCLK_60M ((52<<12)|(4<<4)|1)
  14. #define FCLK_48M ((40<<12)|(4<<4)|1)
  15. #define FCLK_36M ((28<<12)|(4<<4)|1)
  16. #define DFT_FCLK_VAL FCLK_200M
  17. #define CLKSLOW_SLOW_BIT 0x10
  18. #define CLKSLOW_UPLL_OFF 0x80
  19. #define CLKSLOW_MPLL_OFF 0x20
  20. #define CLKSLOW_PLL_OFF 0xb0
  21. #define CLKSLOW_PLL_ON 0
  22. #define EnableMPLL (rCLKSLOW &= ~CLKSLOW_MPLL_OFF)
  23. #define DisableMPLL (rCLKSLOW |= CLKSLOW_MPLL_OFF)
  24. #define EnableUPLL() (rCLKSLOW &= ~CLKSLOW_UPLL_OFF)
  25. #define DisableUPLL() (rCLKSLOW |= CLKSLOW_UPLL_OFF)
  26. #define CLOCK_SPI (1<<18)
  27. #define CLOCK_IIS (1<<17)
  28. #define CLOCK_IIC (1<<16)
  29. #define CLOCK_ADC (1<<15)
  30. #define CLOCK_RTC (1<<14)
  31. #define CLOCK_GPIO (1<<13)
  32. #define CLOCK_UART2 (1<<12)
  33. #define CLOCK_UART1 (1<<11)
  34. #define CLOCK_UART0 (1<<10)
  35. #define CLOCK_SDI (1<<9)
  36. #define CLOCK_TIMER (1<<8)
  37. #define CLOCK_USBD (1<<7)
  38. #define CLOCK_USBH (1<<6)
  39. #define CLOCK_LCD (1<<5)
  40. #define CLOCK_NAND (1<<4)
  41. //#define PWROFF (1<<3)
  42. //#define IDLE_MODE (1<<2)
  43. #define CLOCK_ALL 0xffff0
  44. #define EnableModuleClock(m) (rCLKCON |= (m))
  45. #define DisableModuleClock(m) (rCLKCON &= ~(m))
  46. #define MaxBiosTimerEvent 8
  47. U8 SetSysFclk(U32 val);
  48. void SetClockDivider(int hdivn, int pdivn);
  49. U32 OpenOsTimer(U16 OSTimer);
  50. void ReleaseOsTimer(void);
  51. __inline void ClearOsTimerPnd(void);
  52. //void OpenBiosTimer(void);
  53. int RequestBiosTimerEvent(U16 rld, void (*proc)(U32));
  54. void ReleaseBiosTimerEvent(U16 number);
  55. void RtcOpenTick(void);
  56. void RtcCloseTick(void);
  57. BYTE RtcReadTick(U32 *pTicks);
  58. void ChangeSlowMode(U16 mode);
  59. extern U32 SYS_FCLK, SYS_HCLK, SYS_PCLK;
  60. #endif /* _TIMER_H */