board.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef _BOARD_H_
  14. #define _BOARD_H_
  15. /*
  16. * Setup for the Olimex AVR-MT-128 proto board.
  17. */
  18. /*
  19. * Board identifier.
  20. */
  21. #define BOARD_OLIMEX_AVR_MT_128
  22. #define BOARD_NAME "Olimex AVR-MT-128"
  23. /* PA7 RLY DS B5 B4 B3 B2 B1
  24. * IN OUT IN IN IN IN IN IN
  25. * DDRA 0 1 0 0 0 0 0 0
  26. * PU VAL HiZ HiZ HiZ HiZ HiZ HiZ
  27. * PORTA 1 0 0 0 0 0 0 0
  28. */
  29. #define VAL_DDRA 0x40
  30. #define VAL_PORTA 0x80
  31. /*
  32. * All inputs with pullups.
  33. */
  34. #define VAL_DDRB 0x00
  35. #define VAL_PORTB 0xFF
  36. /* D7 D6 D5 D4 PC3 E R/W RS
  37. * OUT OUT OUT OUT IN OUT OUT OUT
  38. * DDRC 1 1 1 1 0 1 1 1
  39. * PU PU PU PU PU VAL VAL VAL
  40. * PORTC 0 0 0 0 1 0 0 0
  41. */
  42. #define VAL_DDRC 0xF7
  43. #define VAL_PORTC 0x08
  44. /* PD7 PD6 PD5 PD4 TXD RXD PD1 PD0
  45. * IN IN IN IN OUT IN IN IN
  46. * DDRD 0 0 0 0 1 0 0 0
  47. * PU PU PU PU VAL HiZ PU PU
  48. * PORTD 1 1 1 1 1 0 1 1
  49. */
  50. #define VAL_DDRD 0x08
  51. #define VAL_PORTD 0xFB
  52. /* PE7 PE6 BZ2 BZ2 PE3 PE2 PE1 PE0
  53. * IN IN OUT OUT IN IN OUT IN
  54. * DDRE 0 0 1 1 0 0 1 0
  55. * PU PU VAL VAL PU PU VAL PU
  56. * PORTE 1 1 1 1 1 1 1 1
  57. */
  58. #define VAL_DDRE 0x32
  59. #define VAL_PORTE 0xFF
  60. /* TDI TDO TMS TCK PF3 PF2 PF1 PF0
  61. * x x x x IN IN IN IN
  62. * DDRF 0 0 0 0 0 0 0 0
  63. * x x x x PU PU PU PU
  64. * PORTF 0 0 0 0 1 1 1 1
  65. *
  66. */
  67. #define VAL_DDRF 0x00
  68. #define VAL_PORTF 0x0F
  69. /* x x x x x PG2 PG1 PG0
  70. * x x x x x IN IN IN
  71. * DDRG 0 0 0 0 0 0 0 0
  72. * x x x x x PU PU PU
  73. * PORTG 0 0 0 0 0 1 1 1
  74. *
  75. */
  76. #define VAL_DDRG 0x00
  77. #define VAL_PORTG 0x07
  78. #define PORTA_BUTTON1 0
  79. #define PORTA_BUTTON2 1
  80. #define PORTA_BUTTON3 2
  81. #define PORTA_BUTTON4 3
  82. #define PORTA_BUTTON5 4
  83. #define PORTA_DALLAS 5
  84. #define PORTA_RELAY 6
  85. #define PORTC_44780_RS_MASK (1 << 0)
  86. #define PORTC_44780_RW_MASK (1 << 1)
  87. #define PORTC_44780_E_MASK (1 << 2)
  88. #define PORTC_44780_D4_MASK (1 << 4)
  89. #define PORTC_44780_D5_MASK (1 << 5)
  90. #define PORTC_44780_D6_MASK (1 << 6)
  91. #define PORTC_44780_D7_MASK (1 << 7)
  92. #define PORTC_44780_DATA_MASK (PORTC_44780_D4_MASK | PORTC_44780_D5_MASK | \
  93. PORTC_44780_D6_MASK | PORTC_44780_D7_MASK)
  94. #define PORTE_BUZZ1 (1 << 4)
  95. #define PORTE_BUZZ2 (1 << 5)
  96. #if !defined(_FROM_ASM_)
  97. #ifdef __cplusplus
  98. extern "C" {
  99. #endif
  100. void boardInit(void);
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* _FROM_ASM_ */
  105. #endif /* _BOARD_H_ */