timings.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * ZuluSCSI™ - Copyright (c) 2024 Rabbit Hole Computing™
  3. *
  4. * ZuluSCSI™ firmware is licensed under the GPL version 3 or any later version. 
  5. *
  6. * https://www.gnu.org/licenses/gpl-3.0.html
  7. * ----
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version. 
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. * GNU General Public License for more details. 
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  20. **/
  21. #ifndef ZULUSCSI_RP2MCU_TIMINGS_H
  22. #define ZULUSCSI_RP2MCU_TIMINGS_H
  23. #include <stdint.h>
  24. typedef enum
  25. {
  26. ZULUSCSI_PIO_TARGET_MODE_SIMPLE,
  27. ZULUSCSI_PIO_TARGET_MODE_EXTRA_DELAY1,
  28. ZULUSCSI_PIO_TARGET_MODE_EXTRA_DELAY2,
  29. ZULUSCSI_PIO_TARGET_MODE_EXTRA_DELAY_1AND2
  30. } zuluscsi_pio_target_mode_t;
  31. typedef struct
  32. {
  33. uint32_t clk_hz;
  34. struct
  35. {
  36. uint8_t req_delay;
  37. zuluscsi_pio_target_mode_t mode;
  38. uint8_t delay0;
  39. uint8_t delay1;
  40. } scsi;
  41. struct
  42. {
  43. uint8_t clk_div_1mhz;
  44. uint8_t clk_div_pio;
  45. uint8_t delay0;
  46. uint8_t delay1;
  47. } sdio;
  48. } zuluscsi_timings_t;
  49. extern zuluscsi_timings_t g_zuluscsi_timings;
  50. void set_timings(uint32_t system_clk);
  51. #endif // ZULUSCSI_RP2MCU_TIMINGS_H