Advertisement
Guest User

asd

a guest
Oct 12th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. #ifndef _LCOM_I8254_H_
  2. #define _LCOM_I8254_H_
  3.  
  4. /** @defgroup i8254 i8254
  5. * @{
  6. *
  7. * Constants for programming the i8254 Timer. Needs to be completed.
  8. */
  9.  
  10. #define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
  11.  
  12. #define BIT(n) (0x01<<(n))
  13.  
  14. #define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
  15.  
  16. /* I/O port addresses */
  17.  
  18. #define TIMER_0 0x40 /**< @brief Timer 0 count register */
  19. #define TIMER_1 0x41 /**< @brief Timer 1 count register */
  20. #define TIMER_2 0x42 /**< @brief Timer 2 count register */
  21. #define TIMER_CTRL 0x43 /**< @brief Control register */
  22.  
  23. #define SPEAKER_CTRL 0x61 /**< @brief Register for speaker control */
  24.  
  25. /* Timer control */
  26.  
  27. /* Timer selection: bits 7 and 6 */
  28.  
  29. #define TIMER_SEL0 0x00 /**< @brief Control Word for Timer 0 */
  30. #define TIMER_SEL1 BIT(6) /**< @brief Control Word for Timer 1 */
  31. #define TIMER_SEL2 BIT(7) /**< @brief Control Word for Timer 2 */
  32. #define TIMER_RB_CMD (BIT(7)|BIT(6)) /**< @brief Read Back Command */
  33.  
  34. /* Register selection: bits 5 and 4 */
  35.  
  36. #define TIMER_LSB BIT(4) /**< @brief Initialize Counter LSB only */
  37. #define TIMER_MSB BIT(5) /**< @brief Initialize Counter MSB only */
  38. #define TIMER_LSB_MSB (TIMER_LSB | TIMER_MSB) /**< @brief Initialize LSB first and MSB afterwards */
  39.  
  40. /* Operating mode: bits 3, 2 and 1 */
  41. #define TIMER_HW_TRIG_STROBE (BIT(3)|BIT(1)) /*Mode 5*/
  42. #define TIMER_SW_TRIG_STROBE BIT(3) /*Mode 4*/
  43. #define TIMER_SQR_WAVE (BIT(2)|BIT(1)) /*Mode 3: square wave generator */
  44. #define TIMER_RATE_GEN BIT(2) /*Mode 2: rate generator */
  45. #define TIMER_HW_RETRIG_1S (BIT(1)) /*Mode 1*/
  46. #define TIMER_INT_TERM_CNT 0x00 /*Mode 0*/
  47. #define TIMER_INTEL_COMP BIT(3) /*Redundancia*/
  48.  
  49. /* Counting mode: bit 0 */
  50.  
  51. #define TIMER_BCD 0x01 /**< @brief Count in BCD */
  52. #define TIMER_BIN 0x00 /**< @brief Count in binary */
  53.  
  54. /* READ-BACK COMMAND FORMAT */
  55.  
  56. #define TIMER_RB_COUNT_ BIT(5)
  57. #define TIMER_RB_STATUS_ BIT(4)
  58. #define TIMER_RB_SEL(n) BIT((n)+1)
  59.  
  60.  
  61.  
  62. /**@}*/
  63.  
  64. #endif /* _LCOM_I8254_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement