AzulSCSI_v1_1_gpio.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. // Control signals to optional PLD device
  19. #define SCSI_OUT_PLD1 GPIO_PIN_15
  20. #define SCSI_OUT_PLD2 GPIO_PIN_3
  21. #define SCSI_OUT_PLD3 GPIO_PIN_5
  22. #define SCSI_OUT_PLD4 GPIO_PIN_7
  23. // SCSI input data port
  24. #define SCSI_IN_PORT GPIOE
  25. #define SCSI_IN_DB7 GPIO_PIN_15
  26. #define SCSI_IN_DB6 GPIO_PIN_14
  27. #define SCSI_IN_DB5 GPIO_PIN_13
  28. #define SCSI_IN_DB4 GPIO_PIN_12
  29. #define SCSI_IN_DB3 GPIO_PIN_11
  30. #define SCSI_IN_DB2 GPIO_PIN_10
  31. #define SCSI_IN_DB1 GPIO_PIN_9
  32. #define SCSI_IN_DB0 GPIO_PIN_8
  33. #define SCSI_IN_DBP GPIO_PIN_7
  34. #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)
  35. #define SCSI_IN_SHIFT 8
  36. // SCSI output status lines
  37. #define SCSI_OUT_IO_PORT GPIOA
  38. #define SCSI_OUT_IO_PIN GPIO_PIN_4
  39. #define SCSI_OUT_CD_PORT GPIOA
  40. #define SCSI_OUT_CD_PIN GPIO_PIN_5
  41. #define SCSI_OUT_SEL_PORT GPIOA
  42. #define SCSI_OUT_SEL_PIN GPIO_PIN_6
  43. #define SCSI_OUT_MSG_PORT GPIOA
  44. #define SCSI_OUT_MSG_PIN GPIO_PIN_7
  45. #define SCSI_OUT_RST_PORT GPIOB
  46. #define SCSI_OUT_RST_PIN GPIO_PIN_14
  47. #define SCSI_OUT_BSY_PORT GPIOB
  48. #define SCSI_OUT_BSY_PIN GPIO_PIN_15
  49. #define SCSI_OUT_REQ_PORT SCSI_OUT_PORT
  50. #define SCSI_OUT_REQ_PIN SCSI_OUT_REQ
  51. // SCSI input status signals
  52. #define SCSI_BSY_PORT GPIOB
  53. #define SCSI_BSY_PIN GPIO_PIN_10
  54. #define SCSI_SEL_PORT GPIOB
  55. #define SCSI_SEL_PIN GPIO_PIN_11
  56. #define SCSI_ACK_PORT GPIOA
  57. #define SCSI_ACK_PIN GPIO_PIN_0
  58. #define SCSI_ATN_PORT GPIOB
  59. #define SCSI_ATN_PIN GPIO_PIN_12
  60. // RST pin uses EXTI interrupt
  61. #define SCSI_RST_PORT GPIOB
  62. #define SCSI_RST_PIN GPIO_PIN_13
  63. #define SCSI_RST_EXTI EXTI_13
  64. #define SCSI_RST_EXTI_SOURCE_PORT GPIO_PORT_SOURCE_GPIOB
  65. #define SCSI_RST_EXTI_SOURCE_PIN GPIO_PIN_SOURCE_13
  66. #define SCSI_RST_IRQ EXTI10_15_IRQHandler
  67. #define SCSI_RST_IRQn EXTI10_15_IRQn
  68. // Terminator enable/disable config, active low
  69. #define SCSI_TERM_EN_PORT GPIOB
  70. #define SCSI_TERM_EN_PIN GPIO_PIN_0
  71. // SD card pins
  72. #define SD_USE_SDIO 1
  73. // DIP switches
  74. #define DIP_PORT GPIOB
  75. #define DIPSW1_PIN GPIO_PIN_4
  76. #define DIPSW2_PIN GPIO_PIN_5
  77. #define DIPSW3_PIN GPIO_PIN_6
  78. // Status LED pins
  79. #define LED_PORT GPIOC
  80. #define LED_I_PIN GPIO_PIN_4
  81. #define LED_E_PIN GPIO_PIN_5
  82. #define LED_PINS (LED_I_PIN | LED_E_PIN)
  83. #define LED_ON() gpio_bit_reset(LED_PORT, LED_PINS)
  84. #define LED_OFF() gpio_bit_set(LED_PORT, LED_PINS)