timings.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. #include "timings.h"
  22. #ifdef ZULUSCSI_MCU_RP23XX
  23. zuluscsi_timings_t g_zuluscsi_timings =
  24. {
  25. .clk_hz = 150000000,
  26. .scsi =
  27. {
  28. .delay0 = 0,
  29. .delay1 = 0,
  30. .req_delay = 0,
  31. .gpio_ack = 0,
  32. .gpio_req = 0,
  33. .mode = ZULUSCSI_PIO_TARGET_MODE_SIMPLE
  34. },
  35. .sdio =
  36. {
  37. .clk_div_1mhz = 0,
  38. .clk_div_pio = 0,
  39. .delay0 = 0,
  40. .delay1 = 0
  41. }
  42. };
  43. #else
  44. zuluscsi_timings_t g_zuluscsi_timings =
  45. {
  46. .clk_hz = 125000000,
  47. .scsi =
  48. {
  49. .delay0 = 0,
  50. .delay1 = 0,
  51. .req_delay = 0,
  52. .mode = ZULUSCSI_PIO_TARGET_MODE_SIMPLE
  53. },
  54. .sdio =
  55. {
  56. .clk_div_1mhz = 25, // = 125MHz clk / clk_div_pio
  57. .clk_div_pio = 5,
  58. .delay0 = 3 - 1, // subtract one for the instruction delay
  59. .delay1 = 2 - 1 // clk_div_pio - delay0 and subtract one for the instruction delay
  60. }
  61. };
  62. #endif
  63. zuluscsi_timings_t predefined_timings[] =
  64. {
  65. {
  66. .clk_hz = 125000000,
  67. .scsi =
  68. {
  69. .delay0 = 0,
  70. .delay1 = 0,
  71. .req_delay = 0,
  72. .mode = ZULUSCSI_PIO_TARGET_MODE_SIMPLE
  73. },
  74. .sdio =
  75. {
  76. .clk_div_1mhz = 25, // = 125MHz clk / clk_div_pio
  77. .clk_div_pio = 5,
  78. .delay0 = 3 - 1, // subtract one for the instruction delay
  79. .delay1 = 2 - 1 // clk_div_pio - delay0 and subtract one for the instruction delay
  80. }
  81. },
  82. {
  83. .clk_hz = 150000000,
  84. .scsi =
  85. {
  86. .delay0 = 0,
  87. .delay1 = 0,
  88. .req_delay = 0,
  89. .mode = ZULUSCSI_PIO_TARGET_MODE_SIMPLE
  90. },
  91. .sdio =
  92. {
  93. .clk_div_1mhz = 0,
  94. .clk_div_pio = 0,
  95. .delay0 = 0,
  96. .delay1 = 0
  97. }
  98. },
  99. {
  100. .clk_hz = 250000000,
  101. .scsi =
  102. {
  103. .delay0 = 0,
  104. .delay1 = 0,
  105. .req_delay = 0,
  106. .mode = ZULUSCSI_PIO_TARGET_MODE_SIMPLE
  107. },
  108. .sdio =
  109. {
  110. .clk_div_1mhz = 0,
  111. .clk_div_pio = 0,
  112. .delay0 = 0,
  113. .delay1 = 0
  114. }
  115. }
  116. };
  117. void set_timings(uint32_t system_clk)
  118. {
  119. ;
  120. }