portio.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* ========================================================================
  2. * [PROJECT] SIR
  3. * [MODULE] PortIO
  4. * [TITLE] Port IO header file
  5. * [FILE] portio.h
  6. * [VSN] 2.0
  7. * [CREATED] 030414
  8. * [LASTCHNGD] 072405
  9. * [COPYRIGHT] Copyright (C) STREAMIT BV 2010
  10. * [PURPOSE] support for low-level pinning
  11. * ======================================================================== */
  12. /*-------------------------------------------------------------------------*/
  13. /* global defines */
  14. /*-------------------------------------------------------------------------*/
  15. // ********* PORT B ************
  16. // 7 6 5 4 3 2 1 0
  17. // ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
  18. // ³RES³CEN³CSC³XCS³SO ³ SI³CLK³CWP³
  19. // ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
  20. #define MMC_ENABLE 5 // active LOW!
  21. #define VS_ENABLE 6 // note that logic has changed since SIR80 V1
  22. #define MMCVS_OUT_DDR DDRB // data-direction of MMC/VS functions
  23. #define MMCVS_OUT_WRITE PORTB // write PORTB (B as output)
  24. // ********* PORT D ************
  25. // 7 6 5 4 3 2 1 0
  26. // ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
  27. // ³LD7³LD6³LD5³LD4³KC2³KC3³ EN³ - ³
  28. // ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
  29. #define LCD_EN 2 // LCD chip Enable (or: chip select)
  30. #define LCD_DATA_4 4
  31. #define LCD_DATA_5 5
  32. #define LCD_DATA_6 6
  33. #define LCD_DATA_7 7
  34. #define LCD_DATA_DDR DDRD // data-direction of LCD-data port
  35. #define LCD_DATA_PORT PORTD // port to write LCD-data
  36. #define LCD_IN_PORT PIND // port to read LCD-data
  37. #define LCD_EN_DDR DDRE // data-direction of LCD-control port
  38. #define LCD_EN_PORT PORTE // data of LCD-control port
  39. #define KB_OUT_DDR_B DDRD // data-direction of KB_OUT (second part)
  40. #define KB_OUT_WRITE_B PORTD // write PORTD (D as output)
  41. // ********* PORT E ************
  42. // 7 6 5 4 3 2 1 0
  43. // ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
  44. // ³CSF³REQ³ETH³IR ³BL ³ - ³TXD³RXD³
  45. // ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
  46. #define FLASH_ENABLE 7 // active LOW!
  47. #define LCD_BL_BIT 3 // Backlight LCD
  48. #define IR_PIN 4 // Infrared receive PIN
  49. #define FLASH_OUT_WRITE PORTE // write PORTE for Flash CS
  50. #define LCD_BL_PORT PORTE
  51. // ********* PORT F ************
  52. // 7 6 5 4 3 2 1 0
  53. // ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
  54. // ³KR3³KR2³KR1³KR0³LED³LRS³LRW³CRD³ // note TDI ( JTAG-pin) is shared with KR3
  55. // ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
  56. #define MMC_CDETECT 0 // signal card inserted/removed
  57. #define LCD_RW 1 // R/W LCD
  58. #define LCD_RS 2 // Register select LCD
  59. #define LED_PIN 3 // LED
  60. #define LCD_RS_DDR DDRF // data-direction of LCD-control port
  61. #define LCD_RS_PORT PORTF // data of LCD-control port
  62. #define LCD_RW_DDR DDRF // data-direction of LCD-control port
  63. #define LCD_RW_PORT PORTF // data of LCD-control port
  64. #define LED_OUT_DDR DDRF // data-direction of LED control pin
  65. #define LED_OUT_WRITE PORTF // write PORTF
  66. #define KB_IN_DDR DDRF // data-direction of KB_IN
  67. #define KB_IN_WRITE PORTF // write PORTF (F as output)
  68. #define KB_IN_READ PINF // read PINF (F as input)
  69. #define MMC_IN_DDR DDRF // data-direction of MMC_CDETECT
  70. #define MMC_IN_READ PINF // read PINF (F as input)
  71. // 7 6 5 4 3 2 1 0
  72. // ÚÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄÂÄÄÄ¿
  73. // ³ - ³ - ³ - ³KC1³KC0³ - ³ - ³ - ³
  74. // ÀÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÙ
  75. #define KB_OUT_DDR_A DDRG // data-direction of KB_OUT (first part)
  76. #define KB_OUT_WRITE_A PORTG // write PORTG (G as output)
  77. #define JTAG_REG MCUCR
  78. #define OVERFLOW_SIGNAL sig_OVERFLOW0
  79. #define init_8_bit_timer() \
  80. { \
  81. TCCR0B |= (1<<CS02); \
  82. TIFR0 |= 1<<TOV0; \
  83. TIMSK0 |= 1<<TOIE0; \
  84. }
  85. #define disable_8_bit_timer_ovfl_int() \
  86. { \
  87. TIMSK0 &= ~(1<<TOIE0); \
  88. }
  89. // ********* PORT G ************
  90. /*-------------------------------------------------------------------------*/
  91. /* export global routines (interface) */
  92. /*-------------------------------------------------------------------------*/
  93. /* ÍÍÍÍ End Of File ÍÍÍÍÍÍÍÍ ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */