commandProcessing.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. *
  3. * arch/arm/mach-u300/timer.c
  4. *
  5. *
  6. * Copyright (C) 2007-2009 ST-Ericsson AB
  7. * License terms: GNU General Public License (GPL) version 2
  8. * Timer COH 901 328, runs the OS timer interrupt.
  9. * Author: Linus Walleij <linus.walleij@stericsson.com>
  10. */
  11. #include <linux/interrupt.h>
  12. #include <linux/time.h>
  13. #include <linux/timex.h>
  14. #include <linux/clockchips.h>
  15. #include <linux/clocksource.h>
  16. #include <linux/types.h>
  17. #include <linux/io.h>
  18. #include <linux/clk.h>
  19. #include <linux/err.h>
  20. #include <linux/irq.h>
  21. #include <mach/hardware.h>
  22. #include <mach/irqs.h>
  23. /* Generic stuff */
  24. #include <asm/sched_clock.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/mach/time.h>
  27. #include "timer.h"
  28. /*
  29. * APP side special timer registers
  30. * This timer contains four timers which can fire an interrupt each.
  31. * OS (operating system) timer @ 32768 Hz
  32. * DD (device driver) timer @ 1 kHz
  33. * GP1 (general purpose 1) timer @ 1MHz
  34. * GP2 (general purpose 2) timer @ 1MHz
  35. */
  36. /* Reset OS Timer 32bit (-/W) */
  37. #define U300_TIMER_APP_ROST (0x0000)
  38. #define U300_TIMER_APP_ROST_TIMER_RESET (0x00000000)
  39. /* Enable OS Timer 32bit (-/W) */
  40. #define U300_TIMER_APP_EOST (0x0004)
  41. #define U300_TIMER_APP_EOST_TIMER_ENABLE (0x00000000)
  42. /* Disable OS Timer 32bit (-/W) */
  43. #define U300_TIMER_APP_DOST (0x0008)
  44. #define U300_TIMER_APP_DOST_TIMER_DISABLE (0x00000000)
  45. /* OS Timer Mode Register 32bit (-/W) */
  46. #define U300_TIMER_APP_SOSTM (0x000c)
  47. #define U300_TIMER_APP_SOSTM_MODE_CONTINUOUS (0x00000000)
  48. #define U300_TIMER_APP_SOSTM_MODE_ONE_SHOT (0x00000001)
  49. /* OS Timer Status Register 32bit (R/-) */
  50. #define U300_TIMER_APP_OSTS (0x0010)
  51. #define U300_TIMER_APP_OSTS_TIMER_STATE_MASK (0x0000000F)
  52. #define U300_TIMER_APP_OSTS_TIMER_STATE_IDLE (0x00000001)
  53. #define U300_TIMER_APP_OSTS_TIMER_STATE_ACTIVE (0x00000002)
  54. #define U300_TIMER_APP_OSTS_ENABLE_IND (0x00000010)
  55. #define U300_TIMER_APP_OSTS_MODE_MASK (0x00000020)
  56. #define U300_TIMER_APP_OSTS_MODE_CONTINUOUS (0x00000000)
  57. #define U300_TIMER_APP_OSTS_MODE_ONE_SHOT (0x00000020)
  58. #define U300_TIMER_APP_OSTS_IRQ_ENABLED_IND (0x00000040)
  59. #define U300_TIMER_APP_OSTS_IRQ_PENDING_IND (0x00000080)
  60. /* OS Timer Current Count Register 32bit (R/-) */
  61. #define U300_TIMER_APP_OSTCC (0x0014)
  62. /* OS Timer Terminal Count Register 32bit (R/W) */
  63. #define U300_TIMER_APP_OSTTC (0x0018)
  64. /* OS Timer Interrupt Enable Register 32bit (-/W) */
  65. #define U300_TIMER_APP_OSTIE (0x001c)
  66. #define U300_TIMER_APP_OSTIE_IRQ_DISABLE (0x00000000)
  67. #define U300_TIMER_APP_OSTIE_IRQ_ENABLE (0x00000001)
  68. /* OS Timer Interrupt Acknowledge Register 32bit (-/W) */
  69. #define U300_TIMER_APP_OSTIA (0x0020)
  70. #define U300_TIMER_APP_OSTIA_IRQ_ACK (0x00000080)
  71. /* Reset DD Timer 32bit (-/W) */
  72. #define U300_TIMER_APP_RDDT (0x0040)
  73. #define U300_TIMER_APP_RDDT_TIMER_RESET (0x00000000)
  74. /* Enable DD Timer 32bit (-/W) */
  75. #define U300_TIMER_APP_EDDT (0x0044)
  76. #define U300_TIMER_APP_EDDT_TIMER_ENABLE (0x00000000)
  77. /* Disable DD Timer 32bit (-/W) */
  78. #define U300_TIMER_APP_DDDT (0x0048)
  79. #define U300_TIMER_APP_DDDT_TIMER_DISABLE (0x00000000)
  80. /* DD Timer Mode Register 32bit (-/W) */