tmrHw_reg.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*****************************************************************************
  2. * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved.
  3. *
  4. * Unless you and Broadcom execute a separate written software license
  5. * agreement governing use of this software, this software is licensed to you
  6. * under the terms of the GNU General Public License version 2, available at
  7. * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  8. *
  9. * Notwithstanding the above, under no circumstances may you combine this
  10. * software in any way with any other Broadcom software provided under a
  11. * license other than the GPL, without Broadcom's express prior written
  12. * consent.
  13. *****************************************************************************/
  14. /****************************************************************************/
  15. /**
  16. * @file tmrHw_reg.h
  17. *
  18. * @brief Definitions for low level Timer registers
  19. *
  20. */
  21. /****************************************************************************/
  22. #ifndef _TMRHW_REG_H
  23. #define _TMRHW_REG_H
  24. #include <mach/csp/mm_io.h>
  25. #include <mach/csp/hw_cfg.h>
  26. /* Base address */
  27. #define tmrHw_MODULE_BASE_ADDR MM_IO_BASE_TMR
  28. /*
  29. This platform has four different timers running at different clock speed
  30. Timer one (Timer ID 0) runs at 25 MHz
  31. Timer two (Timer ID 1) runs at 25 MHz
  32. Timer three (Timer ID 2) runs at 150 MHz
  33. Timer four (Timer ID 3) runs at 150 MHz
  34. */
  35. #define tmrHw_LOW_FREQUENCY_MHZ 25 /* Always 25MHz from XTAL */
  36. #define tmrHw_LOW_FREQUENCY_HZ 25000000
  37. #if defined(CFG_GLOBAL_CHIP) && (CFG_GLOBAL_CHIP == FPGA11107)
  38. #define tmrHw_HIGH_FREQUENCY_MHZ 150 /* Always 150MHz for FPGA */
  39. #define tmrHw_HIGH_FREQUENCY_HZ 150000000
  40. #else
  41. #define tmrHw_HIGH_FREQUENCY_HZ HW_CFG_BUS_CLK_HZ
  42. #define tmrHw_HIGH_FREQUENCY_MHZ (HW_CFG_BUS_CLK_HZ / 1000000)
  43. #endif
  44. #define tmrHw_LOW_RESOLUTION_CLOCK tmrHw_LOW_FREQUENCY_HZ
  45. #define tmrHw_HIGH_RESOLUTION_CLOCK tmrHw_HIGH_FREQUENCY_HZ
  46. #define tmrHw_MAX_COUNT (0xFFFFFFFF) /* maximum number of count a timer can count */
  47. #define tmrHw_TIMER_NUM_COUNT (4) /* Number of timer module supported */
  48. typedef struct {
  49. uint32_t LoadValue; /* Load value for timer */
  50. uint32_t CurrentValue; /* Current value for timer */
  51. uint32_t Control; /* Control register */
  52. uint32_t InterruptClear; /* Interrupt clear register */
  53. uint32_t RawInterruptStatus; /* Raw interrupt status */
  54. uint32_t InterruptStatus; /* Masked interrupt status */
  55. uint32_t BackgroundLoad; /* Background load value */
  56. uint32_t padding; /* Padding register */
  57. } tmrHw_REG_t;
  58. /* Control bot masks */
  59. #define tmrHw_CONTROL_TIMER_ENABLE 0x00000080
  60. #define tmrHw_CONTROL_PERIODIC 0x00000040
  61. #define tmrHw_CONTROL_INTERRUPT_ENABLE 0x00000020
  62. #define tmrHw_CONTROL_PRESCALE_MASK 0x0000000C
  63. #define tmrHw_CONTROL_PRESCALE_1 0x00000000
  64. #define tmrHw_CONTROL_PRESCALE_16 0x00000004
  65. #define tmrHw_CONTROL_PRESCALE_256 0x00000008
  66. #define tmrHw_CONTROL_32BIT 0x00000002
  67. #define tmrHw_CONTROL_ONESHOT 0x00000001
  68. #define tmrHw_CONTROL_FREE_RUNNING 0x00000000
  69. #define tmrHw_CONTROL_MODE_MASK (tmrHw_CONTROL_PERIODIC | tmrHw_CONTROL_ONESHOT)
  70. #define pTmrHw ((volatile tmrHw_REG_t *)tmrHw_MODULE_BASE_ADDR)
  71. #endif /* _TMRHW_REG_H */