AzulSCSI_v1_1_gpio.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. // Control signals for timer based DMA acceleration
  25. #define SCSI_TIMER TIMER7
  26. #define SCSI_TIMER_RCU RCU_TIMER7
  27. #define SCSI_TIMER_OUT_PORT GPIOB
  28. #define SCSI_TIMER_OUT_PIN GPIO_PIN_1
  29. #define SCSI_TIMER_IN_PORT GPIOC
  30. #define SCSI_TIMER_IN_PIN GPIO_PIN_6
  31. #define SCSI_TIMER_DMA DMA1
  32. #define SCSI_TIMER_DMA_RCU RCU_DMA1
  33. #define SCSI_TIMER_DMACHA DMA_CH4
  34. #define SCSI_TIMER_DMACHB DMA_CH1
  35. #define SCSI_TIMER_DMACHA_IRQ DMA1_Channel4_IRQHandler
  36. #define SCSI_TIMER_DMACHA_IRQn DMA1_Channel4_IRQn
  37. #define SCSI_TIMER_DMACHB_IRQ DMA1_Channel1_IRQHandler
  38. #define SCSI_TIMER_DMACHB_IRQn DMA1_Channel1_IRQn
  39. // SCSI input data port
  40. #define SCSI_IN_PORT GPIOE
  41. #define SCSI_IN_DB7 GPIO_PIN_15
  42. #define SCSI_IN_DB6 GPIO_PIN_14
  43. #define SCSI_IN_DB5 GPIO_PIN_13
  44. #define SCSI_IN_DB4 GPIO_PIN_12
  45. #define SCSI_IN_DB3 GPIO_PIN_11
  46. #define SCSI_IN_DB2 GPIO_PIN_10
  47. #define SCSI_IN_DB1 GPIO_PIN_9
  48. #define SCSI_IN_DB0 GPIO_PIN_8
  49. #define SCSI_IN_DBP GPIO_PIN_7
  50. #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)
  51. #define SCSI_IN_SHIFT 8
  52. // SCSI output status lines
  53. #define SCSI_OUT_IO_PORT GPIOA
  54. #define SCSI_OUT_IO_PIN GPIO_PIN_4
  55. #define SCSI_OUT_CD_PORT GPIOA
  56. #define SCSI_OUT_CD_PIN GPIO_PIN_5
  57. #define SCSI_OUT_SEL_PORT GPIOA
  58. #define SCSI_OUT_SEL_PIN GPIO_PIN_6
  59. #define SCSI_OUT_MSG_PORT GPIOA
  60. #define SCSI_OUT_MSG_PIN GPIO_PIN_7
  61. #define SCSI_OUT_RST_PORT GPIOB
  62. #define SCSI_OUT_RST_PIN GPIO_PIN_14
  63. #define SCSI_OUT_BSY_PORT GPIOB
  64. #define SCSI_OUT_BSY_PIN GPIO_PIN_15
  65. #define SCSI_OUT_REQ_PORT SCSI_OUT_PORT
  66. #define SCSI_OUT_REQ_PIN SCSI_OUT_REQ
  67. // SCSI input status signals
  68. #define SCSI_SEL_PORT GPIOB
  69. #define SCSI_SEL_PIN GPIO_PIN_11
  70. #define SCSI_ACK_PORT GPIOA
  71. #define SCSI_ACK_PIN GPIO_PIN_0
  72. #define SCSI_ATN_PORT GPIOB
  73. #define SCSI_ATN_PIN GPIO_PIN_12
  74. #define SCSI_IN_ACK_IDX 0
  75. // BSY pin uses EXTI interrupt
  76. #define SCSI_BSY_PORT GPIOB
  77. #define SCSI_BSY_PIN GPIO_PIN_10
  78. #define SCSI_BSY_EXTI EXTI_10
  79. #define SCSI_BSY_EXTI_SOURCE_PORT GPIO_PORT_SOURCE_GPIOB
  80. #define SCSI_BSY_EXTI_SOURCE_PIN GPIO_PIN_SOURCE_10
  81. #define SCSI_BSY_IRQ EXTI10_15_IRQHandler
  82. #define SCSI_BSY_IRQn EXTI10_15_IRQn
  83. // RST pin uses EXTI interrupt
  84. #define SCSI_RST_PORT GPIOB
  85. #define SCSI_RST_PIN GPIO_PIN_13
  86. #define SCSI_RST_EXTI EXTI_13
  87. #define SCSI_RST_EXTI_SOURCE_PORT GPIO_PORT_SOURCE_GPIOB
  88. #define SCSI_RST_EXTI_SOURCE_PIN GPIO_PIN_SOURCE_13
  89. #define SCSI_RST_IRQ EXTI10_15_IRQHandler
  90. #define SCSI_RST_IRQn EXTI10_15_IRQn
  91. // Terminator enable/disable config, active low
  92. #define SCSI_TERM_EN_PORT GPIOB
  93. #define SCSI_TERM_EN_PIN GPIO_PIN_0
  94. // SD card pins
  95. #define SD_USE_SDIO 1
  96. #define SD_SDIO_DATA_PORT GPIOC
  97. #define SD_SDIO_D0 GPIO_PIN_8
  98. #define SD_SDIO_D1 GPIO_PIN_9
  99. #define SD_SDIO_D2 GPIO_PIN_10
  100. #define SD_SDIO_D3 GPIO_PIN_11
  101. #define SD_SDIO_CLK_PORT GPIOC
  102. #define SD_SDIO_CLK GPIO_PIN_12
  103. #define SD_SDIO_CMD_PORT GPIOD
  104. #define SD_SDIO_CMD GPIO_PIN_2
  105. // DIP switches
  106. #define DIP_PORT GPIOB
  107. #define DIPSW1_PIN GPIO_PIN_4
  108. #define DIPSW2_PIN GPIO_PIN_5
  109. #define DIPSW3_PIN GPIO_PIN_6
  110. // Status LED pins
  111. #define LED_PORT GPIOC
  112. #define LED_I_PIN GPIO_PIN_4
  113. #define LED_E_PIN GPIO_PIN_5
  114. #define LED_PINS (LED_I_PIN | LED_E_PIN)
  115. #define LED_ON() gpio_bit_reset(LED_PORT, LED_PINS)
  116. #define LED_OFF() gpio_bit_set(LED_PORT, LED_PINS)