BlueSCSI_platform_gpio.h 2.3 KB

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