imx_epit.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * i.MX EPIT Timer
  3. *
  4. * Copyright (c) 2008 OK Labs
  5. * Copyright (c) 2011 NICTA Pty Ltd
  6. * Originally written by Hans Jiang
  7. * Updated by Peter Chubb
  8. * Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining a copy
  11. * of this software and associated documentation files (the "Software"), to deal
  12. * in the Software without restriction, including without limitation the rights
  13. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  14. * copies of the Software, and to permit persons to whom the Software is
  15. * furnished to do so, subject to the following conditions:
  16. *
  17. * The above copyright notice and this permission notice shall be included in
  18. * all copies or substantial portions of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  23. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  24. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  25. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  26. * THE SOFTWARE.
  27. */
  28. #ifndef IMX_EPIT_H
  29. #define IMX_EPIT_H
  30. #include "hw/sysbus.h"
  31. #include "hw/ptimer.h"
  32. #include "hw/misc/imx_ccm.h"
  33. #include "qom/object.h"
  34. /*
  35. * EPIT: Enhanced periodic interrupt timer
  36. */
  37. #define CR_EN (1 << 0)
  38. #define CR_ENMOD (1 << 1)
  39. #define CR_OCIEN (1 << 2)
  40. #define CR_RLD (1 << 3)
  41. #define CR_PRESCALE_SHIFT (4)
  42. #define CR_PRESCALE_BITS (12)
  43. #define CR_SWR (1 << 16)
  44. #define CR_IOVW (1 << 17)
  45. #define CR_DBGEN (1 << 18)
  46. #define CR_WAITEN (1 << 19)
  47. #define CR_DOZEN (1 << 20)
  48. #define CR_STOPEN (1 << 21)
  49. #define CR_CLKSRC_SHIFT (24)
  50. #define CR_CLKSRC_BITS (2)
  51. #define SR_OCIF (1 << 0)
  52. #define EPIT_TIMER_MAX 0XFFFFFFFFUL
  53. #define TYPE_IMX_EPIT "imx.epit"
  54. OBJECT_DECLARE_SIMPLE_TYPE(IMXEPITState, IMX_EPIT)
  55. struct IMXEPITState {
  56. /*< private >*/
  57. SysBusDevice parent_obj;
  58. /*< public >*/
  59. ptimer_state *timer_reload;
  60. ptimer_state *timer_cmp;
  61. MemoryRegion iomem;
  62. IMXCCMState *ccm;
  63. uint32_t cr;
  64. uint32_t sr;
  65. uint32_t lr;
  66. uint32_t cmp;
  67. qemu_irq irq;
  68. };
  69. #endif /* IMX_EPIT_H */