scsi_accel_dma.h 858 B

123456789101112131415161718192021222324252627
  1. // SCSI subroutines that use hardware DMA for transfer in the background.
  2. // Uses either GD32 timer or external GreenPAK to implement REQ pin toggling.
  3. #pragma once
  4. #include <stdint.h>
  5. #include "BlueSCSI_platform.h"
  6. #include "greenpak.h"
  7. #ifdef SCSI_TIMER
  8. #define SCSI_ACCEL_DMA_AVAILABLE 1
  9. #endif
  10. /* Initialization function decides whether to use timer or GreenPAK */
  11. void scsi_accel_greenpak_dma_init();
  12. void scsi_accel_timer_dma_init();
  13. /* Common functions */
  14. void scsi_accel_dma_startWrite(const uint8_t* data, uint32_t count, volatile int *resetFlag);
  15. void scsi_accel_dma_stopWrite();
  16. void scsi_accel_dma_finishWrite(volatile int *resetFlag);
  17. // Query whether the data at pointer has already been read, i.e. buffer can be reused.
  18. // If data is NULL, checks if all writes have completed.
  19. bool scsi_accel_dma_isWriteFinished(const uint8_t* data);