time.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (C) 2007 Atmel Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _ASM_AVR32_ARCH_AT32AP_TIME_H
  9. #define _ASM_AVR32_ARCH_AT32AP_TIME_H
  10. #include <linux/platform_device.h>
  11. extern struct irqaction timer_irqaction;
  12. extern struct platform_device at32_systc0_device;
  13. extern void local_timer_interrupt(int irq, void *dev_id);
  14. #define TIMER_BCR 0x000000c0
  15. #define TIMER_BCR_SYNC 0
  16. #define TIMER_BMR 0x000000c4
  17. #define TIMER_BMR_TC0XC0S 0
  18. #define TIMER_BMR_TC1XC1S 2
  19. #define TIMER_BMR_TC2XC2S 4
  20. #define TIMER_CCR 0x00000000
  21. #define TIMER_CCR_CLKDIS 1
  22. #define TIMER_CCR_CLKEN 0
  23. #define TIMER_CCR_SWTRG 2
  24. #define TIMER_CMR 0x00000004
  25. #define TIMER_CMR_ABETRG 10
  26. #define TIMER_CMR_ACPA 16
  27. #define TIMER_CMR_ACPC 18
  28. #define TIMER_CMR_AEEVT 20
  29. #define TIMER_CMR_ASWTRG 22
  30. #define TIMER_CMR_BCPB 24
  31. #define TIMER_CMR_BCPC 26
  32. #define TIMER_CMR_BEEVT 28
  33. #define TIMER_CMR_BSWTRG 30
  34. #define TIMER_CMR_BURST 4
  35. #define TIMER_CMR_CLKI 3
  36. #define TIMER_CMR_CPCDIS 7
  37. #define TIMER_CMR_CPCSTOP 6
  38. #define TIMER_CMR_CPCTRG 14
  39. #define TIMER_CMR_EEVT 10
  40. #define TIMER_CMR_EEVTEDG 8
  41. #define TIMER_CMR_ENETRG 12
  42. #define TIMER_CMR_ETRGEDG 8
  43. #define TIMER_CMR_LDBDIS 7
  44. #define TIMER_CMR_LDBSTOP 6
  45. #define TIMER_CMR_LDRA 16
  46. #define TIMER_CMR_LDRB 18
  47. #define TIMER_CMR_TCCLKS 0
  48. #define TIMER_CMR_WAVE 15
  49. #define TIMER_CMR_WAVSEL 13
  50. #define TIMER_CV 0x00000010
  51. #define TIMER_CV_CV 0
  52. #define TIMER_IDR 0x00000028
  53. #define TIMER_IDR_COVFS 0
  54. #define TIMER_IDR_CPAS 2
  55. #define TIMER_IDR_CPBS 3
  56. #define TIMER_IDR_CPCS 4
  57. #define TIMER_IDR_ETRGS 7
  58. #define TIMER_IDR_LDRAS 5
  59. #define TIMER_IDR_LDRBS 6
  60. #define TIMER_IDR_LOVRS 1
  61. #define TIMER_IER 0x00000024
  62. #define TIMER_IER_COVFS 0
  63. #define TIMER_IER_CPAS 2
  64. #define TIMER_IER_CPBS 3
  65. #define TIMER_IER_CPCS 4
  66. #define TIMER_IER_ETRGS 7
  67. #define TIMER_IER_LDRAS 5
  68. #define TIMER_IER_LDRBS 6
  69. #define TIMER_IER_LOVRS 1
  70. #define TIMER_IMR 0x0000002c
  71. #define TIMER_IMR_COVFS 0
  72. #define TIMER_IMR_CPAS 2
  73. #define TIMER_IMR_CPBS 3
  74. #define TIMER_IMR_CPCS 4
  75. #define TIMER_IMR_ETRGS 7
  76. #define TIMER_IMR_LDRAS 5
  77. #define TIMER_IMR_LDRBS 6
  78. #define TIMER_IMR_LOVRS 1
  79. #define TIMER_RA 0x00000014
  80. #define TIMER_RA_RA 0
  81. #define TIMER_RB 0x00000018
  82. #define TIMER_RB_RB 0
  83. #define TIMER_RC 0x0000001c
  84. #define TIMER_RC_RC 0
  85. #define TIMER_SR 0x00000020
  86. #define TIMER_SR_CLKSTA 16
  87. #define TIMER_SR_COVFS 0
  88. #define TIMER_SR_CPAS 2
  89. #define TIMER_SR_CPBS 3
  90. #define TIMER_SR_CPCS 4
  91. #define TIMER_SR_ETRGS 7
  92. #define TIMER_SR_LDRAS 5
  93. #define TIMER_SR_LDRBS 6
  94. #define TIMER_SR_LOVRS 1
  95. #define TIMER_SR_MTIOA 17
  96. #define TIMER_SR_MTIOB 18
  97. /* Bit manipulation macros */
  98. #define TIMER_BIT(name) (1 << TIMER_##name)
  99. #define TIMER_BF(name,value) ((value) << TIMER_##name)
  100. /* Register access macros */
  101. #define timer_read(port,instance,reg) \
  102. __raw_readl(port + (0x40 * instance) + TIMER_##reg)
  103. #define timer_write(port,instance,reg,value) \
  104. __raw_writel((value), port + (0x40 * instance) + TIMER_##reg)
  105. #endif /* _ASM_AVR32_ARCH_AT32AP_TIME_H */