The ZuluSCSI firmware is designed to be portable to a wide variety of platforms. This directory contains an example platform definition that can serve as a base for porting efforts.
The bare minimum to support a new platform is to:
- Make a copy of the
ZuluSCSI_platform_template
folder to a new name, e.g.ZuluSCSI_platform_MyCustomHardware
- Make a copy of the
[env:template]
section to a new name, e.g.[env:MyCustomHardware]
- Edit
ZuluSCSI_platform_gpio.h
to match the pinout of your platform. - Edit
ZuluSCSI_platform.h
for the hardware access functions implemented in your platform. - Edit
scsiPhy.cpp
to enable theRST
andBSY
interrupts.
The minimum IO capabilities for ZuluSCSI firmware are:
- Bidirectional access to SCSI data bus:
DB0
-DB7
,DBP
- Bidirectional access to SCSI signal
BSY
, with rising edge interrupt. - Bidirectional access to SCSI signal
RST
, with falling edge interrupt. - Output access to SCSI signals
REQ
,IO
,CD
,MSG
- Input access to SCSI signals
SEL
,ACK
,ATN
- Access to SD card, using either SDIO or SPI bus.
By default the ZuluSCSI firmware uses large buffers for best performance. The total RAM usage in default configuration is about 100 kB. Minimum possible RAM usage is about 10 kB.
To reduce the RAM usage, following settings can be given in platformio.ini
for the platform:
LOGBUFSIZE
: Default 16384, minimum 512 bytesPREFETCH_BUFFER_SIZE
: Default 8192, minimum 0 bytesMAX_SECTOR_SIZE
: Default 8192, minimum 512 bytesSCSI2SD_BUFFER_SIZE
: DefaultMAX_SECTOR_SIZE * 8
, minimumMAX_SECTOR_SIZE * 2
Access performance is improved a lot if SCSI access can occur in parallel with SD card access. To implement this, one or both of them must be able to execute transfers in background using hardware DMA. On most platforms this is possible for SD card access. The SCSI handshake mechanism is harder to implement using DMA.
To implement parallelism with SD card DMA, implement platform_set_sd_callback(func, buffer)
.
It sets a callback function which should be called by the SD card driver to report how many bytes have
been transferred to/from buffer
so far. The SD card driver should call this function in a loop while
it is waiting for SD card transfer to finish. The code in ZuluSCSI_disk.cpp
will implement the callback
that will transfer the data to SCSI bus during the wait.