BlueSCSI_platform_gpio.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // GPIO definitions for BlueSCSI Pico-based hardware
  2. #pragma once
  3. #include <hardware/gpio.h>
  4. #ifdef BLUESCSI_NETWORK
  5. #include <pico/cyw43_arch.h>
  6. #endif
  7. // SCSI data input/output port.
  8. // The data bus uses external bidirectional buffer, with
  9. // direction controlled by DATA_DIR pin.
  10. #define SCSI_IO_DB0 0
  11. #define SCSI_IO_DB1 1
  12. #define SCSI_IO_DB2 2
  13. #define SCSI_IO_DB3 3
  14. #define SCSI_IO_DB4 4
  15. #define SCSI_IO_DB5 5
  16. #define SCSI_IO_DB6 6
  17. #define SCSI_IO_DB7 7
  18. #define SCSI_IO_DBP 8
  19. #define SCSI_IO_DATA_MASK 0x1FF
  20. #define SCSI_IO_SHIFT 0
  21. // Data direction control
  22. #define SCSI_DATA_DIR 9
  23. #define SCSI_OUT_DIRECTIONPIN 9
  24. // SCSI control lines
  25. #define SCSI_OUT_IO 22
  26. #define SCSI_OUT_REQ 19
  27. #define SCSI_OUT_REQ_BEFORE_2023_09a 17
  28. #define SCSI_OUT_CD 18
  29. #define SCSI_IN_SEL 18
  30. #define SCSI_OUT_SEL 21
  31. #define SCSI_OUT_MSG 20
  32. #define SCSI_IN_BSY 20
  33. #define SCSI_IN_RST 21
  34. #define SCSI_OUT_RST 22 // No RST pin, manual or expander only
  35. #define SCSI_IN_ACK 26
  36. #define SCSI_OUT_BSY 27
  37. #define SCSI_IN_ATN 28
  38. // Status line outputs for initiator mode
  39. #define SCSI_OUT_ACK 26
  40. //#define SCSI_OUT_ATN 29 // ATN output is unused
  41. // Status line inputs for initiator mode
  42. #define SCSI_IN_IO 22
  43. #define SCSI_IN_CD 18
  44. #define SCSI_IN_MSG 28
  45. #define SCSI_IN_REQ 19
  46. // Status LED pins
  47. #define LED_PIN 25
  48. #ifdef BLUESCSI_NETWORK
  49. #define LED_ON() platform_network_supported() ? cyw43_gpio_set(&cyw43_state, 0, true) : sio_hw->gpio_set = 1 << LED_PIN
  50. #define LED_OFF() platform_network_supported() ? cyw43_gpio_set(&cyw43_state, 0, false) : sio_hw->gpio_clr = 1 << LED_PIN
  51. #else
  52. #define LED_ON() sio_hw->gpio_set = 1 << LED_PIN
  53. #define LED_OFF() sio_hw->gpio_clr = 1 << LED_PIN
  54. #endif
  55. // SDIO and SPI block
  56. #define SD_SPI_SCK 10
  57. #define SDIO_CLK 10
  58. #define SD_SPI_MOSI 11
  59. #define SDIO_CMD 11
  60. #define SD_SPI_MISO 12
  61. #define SDIO_D0 12
  62. #define SDIO_D1 13
  63. #define SDIO_D2 14
  64. #define SDIO_D3 15
  65. #define SD_SPI_CS 15
  66. // IO expander I2C
  67. #define GPIO_I2C_SDA 16
  68. #define GPIO_I2C_SCL 17
  69. // Other pins
  70. #define SWO_PIN 16
  71. #define SCSI_ACCEL_SETPINS 0x801FF
  72. #define SCSI_ACCEL_SETPINS_PRE09A 0x201FF
  73. typedef struct __attribute__((packed))
  74. {
  75. uint8_t OUT_IO;
  76. uint8_t OUT_CD;
  77. uint8_t OUT_REQ;
  78. uint8_t OUT_SEL;
  79. uint8_t OUT_MSG;
  80. uint8_t OUT_RST;
  81. uint8_t OUT_BSY;
  82. uint8_t OUT_ACK;
  83. uint8_t IN_IO;
  84. uint8_t IN_CD;
  85. uint8_t IN_MSG;
  86. uint8_t IN_REQ;
  87. uint8_t IN_SEL;
  88. uint8_t IN_BSY;
  89. uint8_t IN_RST;
  90. uint8_t IN_ACK;
  91. uint8_t IN_ATN;
  92. uint32_t SCSI_ACCEL_PINMASK;
  93. } SCSI_PINS;