dm365_timer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * File : dm365_timer.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2010-11-13 weety first version
  23. */
  24. #ifndef __ASM_ARCH_TIME_H
  25. #define __ASM_ARCH_TIME_H
  26. /* Timer register offsets */
  27. #define PID12 0x0
  28. #define TIM12 0x10
  29. #define TIM34 0x14
  30. #define PRD12 0x18
  31. #define PRD34 0x1c
  32. #define TCR 0x20
  33. #define TGCR 0x24
  34. #define WDTCR 0x28
  35. #define CMP12(n) (0x60 + ((n) << 2))
  36. /* Timer register bitfields */
  37. #define ENAMODE12_SHIFT 6
  38. #define ENAMODE34_SHIFT 22
  39. #define TCR_ENAMODE_DISABLE 0x0
  40. #define TCR_ENAMODE_ONESHOT 0x1
  41. #define TCR_ENAMODE_PERIODIC 0x2
  42. #define TCR_ENAMODE_MASK 0x3
  43. #define TGCR_TIMMODE_SHIFT 2
  44. #define TGCR_TIMMODE_64BIT_GP 0x0
  45. #define TGCR_TIMMODE_32BIT_UNCHAINED 0x1
  46. #define TGCR_TIMMODE_64BIT_WDOG 0x2
  47. #define TGCR_TIMMODE_32BIT_CHAINED 0x3
  48. #define TGCR_TIM12RS_SHIFT 0
  49. #define TGCR_TIM34RS_SHIFT 1
  50. #define TGCR_RESET 0x0
  51. #define TGCR_UNRESET 0x1
  52. #define TGCR_RESET_MASK 0x3
  53. #define WDTCR_WDEN_SHIFT 14
  54. #define WDTCR_WDEN_DISABLE 0x0
  55. #define WDTCR_WDEN_ENABLE 0x1
  56. #define WDTCR_WDKEY_SHIFT 16
  57. #define WDTCR_WDKEY_SEQ0 0xA5C6
  58. #define WDTCR_WDKEY_SEQ1 0xDA7E
  59. enum {
  60. T0_BOT,
  61. T0_TOP,
  62. T1_BOT,
  63. T1_TOP,
  64. NUM_TIMERS
  65. };
  66. #endif /* __ASM_ARCH_TIME_H__ */