AzulSCSI_v1_1_gpio.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // GPIO definitions for AzulSCSI v1.1
  2. #pragma once
  3. // SCSI data output port.
  4. // The output data is written using BSRR mechanism, so all data pins must be on same GPIO port.
  5. // The output pins are open-drain in hardware, using separate buffer chips for driving.
  6. #define SCSI_OUT_PORT GPIOD
  7. #define SCSI_OUT_DB7 GPIO_PIN_9
  8. #define SCSI_OUT_DB6 GPIO_PIN_10
  9. #define SCSI_OUT_DB5 GPIO_PIN_11
  10. #define SCSI_OUT_DB4 GPIO_PIN_12
  11. #define SCSI_OUT_DB3 GPIO_PIN_13
  12. #define SCSI_OUT_DB2 GPIO_PIN_14
  13. #define SCSI_OUT_DB1 GPIO_PIN_0
  14. #define SCSI_OUT_DB0 GPIO_PIN_1
  15. #define SCSI_OUT_DBP GPIO_PIN_8
  16. #define SCSI_OUT_REQ GPIO_PIN_4
  17. #define SCSI_OUT_DATA_MASK (SCSI_OUT_DB0 | SCSI_OUT_DB1 | SCSI_OUT_DB2 | SCSI_OUT_DB3 | SCSI_OUT_DB4 | SCSI_OUT_DB5 | SCSI_OUT_DB6 | SCSI_OUT_DB7 | SCSI_OUT_DBP)
  18. #define SCSI_OUT_REQ_IDX 4
  19. // Control signals to optional PLD device
  20. #define SCSI_OUT_PLD1 GPIO_PIN_15
  21. #define SCSI_OUT_PLD2 GPIO_PIN_3
  22. #define SCSI_OUT_PLD3 GPIO_PIN_5
  23. #define SCSI_OUT_PLD4 GPIO_PIN_7
  24. // SCSI input data port
  25. #define SCSI_IN_PORT GPIOE
  26. #define SCSI_IN_DB7 GPIO_PIN_15
  27. #define SCSI_IN_DB6 GPIO_PIN_14
  28. #define SCSI_IN_DB5 GPIO_PIN_13
  29. #define SCSI_IN_DB4 GPIO_PIN_12
  30. #define SCSI_IN_DB3 GPIO_PIN_11
  31. #define SCSI_IN_DB2 GPIO_PIN_10
  32. #define SCSI_IN_DB1 GPIO_PIN_9
  33. #define SCSI_IN_DB0 GPIO_PIN_8
  34. #define SCSI_IN_DBP GPIO_PIN_7
  35. #define SCSI_IN_MASK (SCSI_IN_DB7|SCSI_IN_DB6|SCSI_IN_DB5|SCSI_IN_DB4|SCSI_IN_DB3|SCSI_IN_DB2|SCSI_IN_DB1|SCSI_IN_DB0|SCSI_IN_DBP)
  36. #define SCSI_IN_SHIFT 8
  37. // SCSI output status lines
  38. #define SCSI_OUT_IO_PORT GPIOA
  39. #define SCSI_OUT_IO_PIN GPIO_PIN_4
  40. #define SCSI_OUT_CD_PORT GPIOA
  41. #define SCSI_OUT_CD_PIN GPIO_PIN_5
  42. #define SCSI_OUT_SEL_PORT GPIOA
  43. #define SCSI_OUT_SEL_PIN GPIO_PIN_6
  44. #define SCSI_OUT_MSG_PORT GPIOA
  45. #define SCSI_OUT_MSG_PIN GPIO_PIN_7
  46. #define SCSI_OUT_RST_PORT GPIOB
  47. #define SCSI_OUT_RST_PIN GPIO_PIN_14
  48. #define SCSI_OUT_BSY_PORT GPIOB
  49. #define SCSI_OUT_BSY_PIN GPIO_PIN_15
  50. #define SCSI_OUT_REQ_PORT SCSI_OUT_PORT
  51. #define SCSI_OUT_REQ_PIN SCSI_OUT_REQ
  52. // SCSI input status signals
  53. #define SCSI_SEL_PORT GPIOB
  54. #define SCSI_SEL_PIN GPIO_PIN_11
  55. #define SCSI_ACK_PORT GPIOA
  56. #define SCSI_ACK_PIN GPIO_PIN_0
  57. #define SCSI_ATN_PORT GPIOB
  58. #define SCSI_ATN_PIN GPIO_PIN_12
  59. #define SCSI_IN_ACK_IDX 0
  60. // BSY pin uses EXTI interrupt
  61. #define SCSI_BSY_PORT GPIOB
  62. #define SCSI_BSY_PIN GPIO_PIN_10
  63. #define SCSI_BSY_EXTI EXTI_10
  64. #define SCSI_BSY_EXTI_SOURCE_PORT GPIO_PORT_SOURCE_GPIOB
  65. #define SCSI_BSY_EXTI_SOURCE_PIN GPIO_PIN_SOURCE_10
  66. #define SCSI_BSY_IRQ EXTI10_15_IRQHandler
  67. #define SCSI_BSY_IRQn EXTI10_15_IRQn
  68. // RST pin uses EXTI interrupt
  69. #define SCSI_RST_PORT GPIOB
  70. #define SCSI_RST_PIN GPIO_PIN_13
  71. #define SCSI_RST_EXTI EXTI_13
  72. #define SCSI_RST_EXTI_SOURCE_PORT GPIO_PORT_SOURCE_GPIOB
  73. #define SCSI_RST_EXTI_SOURCE_PIN GPIO_PIN_SOURCE_13
  74. #define SCSI_RST_IRQ EXTI10_15_IRQHandler
  75. #define SCSI_RST_IRQn EXTI10_15_IRQn
  76. // Terminator enable/disable config, active low
  77. #define SCSI_TERM_EN_PORT GPIOB
  78. #define SCSI_TERM_EN_PIN GPIO_PIN_0
  79. // SD card pins
  80. #define SD_USE_SDIO 1
  81. #define SD_SDIO_DATA_PORT GPIOC
  82. #define SD_SDIO_D0 GPIO_PIN_8
  83. #define SD_SDIO_D1 GPIO_PIN_9
  84. #define SD_SDIO_D2 GPIO_PIN_10
  85. #define SD_SDIO_D3 GPIO_PIN_11
  86. #define SD_SDIO_CLK_PORT GPIOC
  87. #define SD_SDIO_CLK GPIO_PIN_12
  88. #define SD_SDIO_CMD_PORT GPIOD
  89. #define SD_SDIO_CMD GPIO_PIN_2
  90. // DIP switches
  91. #define DIP_PORT GPIOB
  92. #define DIPSW1_PIN GPIO_PIN_4
  93. #define DIPSW2_PIN GPIO_PIN_5
  94. #define DIPSW3_PIN GPIO_PIN_6
  95. // Status LED pins
  96. #define LED_PORT GPIOC
  97. #define LED_I_PIN GPIO_PIN_4
  98. #define LED_E_PIN GPIO_PIN_5
  99. #define LED_PINS (LED_I_PIN | LED_E_PIN)
  100. #define LED_ON() gpio_bit_reset(LED_PORT, LED_PINS)
  101. #define LED_OFF() gpio_bit_set(LED_PORT, LED_PINS)