mcftimer.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /****************************************************************************/
  2. /*
  3. * mcftimer.h -- ColdFire internal TIMER support defines.
  4. *
  5. * (C) Copyright 1999-2006, Greg Ungerer <gerg@snapgear.com>
  6. * (C) Copyright 2000, Lineo Inc. (www.lineo.com)
  7. */
  8. /****************************************************************************/
  9. #ifndef mcftimer_h
  10. #define mcftimer_h
  11. /****************************************************************************/
  12. /*
  13. * Get address specific defines for this ColdFire member.
  14. */
  15. #if defined(CONFIG_M5206) || defined(CONFIG_M5206e)
  16. #define MCFTIMER_BASE1 0x100 /* Base address of TIMER1 */
  17. #define MCFTIMER_BASE2 0x120 /* Base address of TIMER2 */
  18. #elif defined(CONFIG_M5272)
  19. #define MCFTIMER_BASE1 0x200 /* Base address of TIMER1 */
  20. #define MCFTIMER_BASE2 0x220 /* Base address of TIMER2 */
  21. #define MCFTIMER_BASE3 0x240 /* Base address of TIMER4 */
  22. #define MCFTIMER_BASE4 0x260 /* Base address of TIMER3 */
  23. #elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407)
  24. #define MCFTIMER_BASE1 0x140 /* Base address of TIMER1 */
  25. #define MCFTIMER_BASE2 0x180 /* Base address of TIMER2 */
  26. #elif defined(CONFIG_M532x)
  27. #define MCFTIMER_BASE1 0xfc070000 /* Base address of TIMER1 */
  28. #define MCFTIMER_BASE2 0xfc074000 /* Base address of TIMER2 */
  29. #define MCFTIMER_BASE3 0xfc078000 /* Base address of TIMER3 */
  30. #define MCFTIMER_BASE4 0xfc07c000 /* Base address of TIMER4 */
  31. #endif
  32. /*
  33. * Define the TIMER register set addresses.
  34. */
  35. #define MCFTIMER_TMR 0x00 /* Timer Mode reg (r/w) */
  36. #define MCFTIMER_TRR 0x04 /* Timer Reference (r/w) */
  37. #define MCFTIMER_TCR 0x08 /* Timer Capture reg (r/w) */
  38. #define MCFTIMER_TCN 0x0C /* Timer Counter reg (r/w) */
  39. #if defined(CONFIG_M532x)
  40. #define MCFTIMER_TER 0x03 /* Timer Event reg (r/w) */
  41. #else
  42. #define MCFTIMER_TER 0x11 /* Timer Event reg (r/w) */
  43. #endif
  44. /*
  45. * Bit definitions for the Timer Mode Register (TMR).
  46. * Register bit flags are common accross ColdFires.
  47. */
  48. #define MCFTIMER_TMR_PREMASK 0xff00 /* Prescalar mask */
  49. #define MCFTIMER_TMR_DISCE 0x0000 /* Disable capture */
  50. #define MCFTIMER_TMR_ANYCE 0x00c0 /* Capture any edge */
  51. #define MCFTIMER_TMR_FALLCE 0x0080 /* Capture fallingedge */
  52. #define MCFTIMER_TMR_RISECE 0x0040 /* Capture rising edge */
  53. #define MCFTIMER_TMR_ENOM 0x0020 /* Enable output toggle */
  54. #define MCFTIMER_TMR_DISOM 0x0000 /* Do single output pulse */
  55. #define MCFTIMER_TMR_ENORI 0x0010 /* Enable ref interrupt */
  56. #define MCFTIMER_TMR_DISORI 0x0000 /* Disable ref interrupt */
  57. #define MCFTIMER_TMR_RESTART 0x0008 /* Restart counter */
  58. #define MCFTIMER_TMR_FREERUN 0x0000 /* Free running counter */
  59. #define MCFTIMER_TMR_CLKTIN 0x0006 /* Input clock is TIN */
  60. #define MCFTIMER_TMR_CLK16 0x0004 /* Input clock is /16 */
  61. #define MCFTIMER_TMR_CLK1 0x0002 /* Input clock is /1 */
  62. #define MCFTIMER_TMR_CLKSTOP 0x0000 /* Stop counter */
  63. #define MCFTIMER_TMR_ENABLE 0x0001 /* Enable timer */
  64. #define MCFTIMER_TMR_DISABLE 0x0000 /* Disable timer */
  65. /*
  66. * Bit definitions for the Timer Event Registers (TER).
  67. */
  68. #define MCFTIMER_TER_CAP 0x01 /* Capture event */
  69. #define MCFTIMER_TER_REF 0x02 /* Refernece event */
  70. /****************************************************************************/
  71. #endif /* mcftimer_h */