hal_data.c 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /* generated HAL source file - do not edit */
  2. #include "hal_data.h"
  3. xspi_hyper_instance_ctrl_t g_hyperbus0_ctrl;
  4. static xspi_hyper_cs_timing_setting_t g_hyperbus0_cs_timing_settings =
  5. {
  6. .transaction_interval = XSPI_HYPER_TRANSACTION_INTERVAL_CLOCKS_7,
  7. .cs_pullup_lag = XSPI_HYPER_CS_PULLUP_CLOCKS_NO_EXTENSION,
  8. .cs_pulldown_lead = XSPI_HYPER_CS_PULLDOWN_CLOCKS_NO_EXTENSION,
  9. };
  10. static xspi_hyper_address_space_t g_hyperbus0_address_space_settings =
  11. {
  12. .unit0_cs0_end_address = XSPI_HYPER_CFG_UNIT_0_CS_0_END_ADDRESS,
  13. .unit0_cs1_start_address = XSPI_HYPER_CFG_UNIT_0_CS_1_START_ADDRESS,
  14. .unit0_cs1_end_address = XSPI_HYPER_CFG_UNIT_0_CS_1_END_ADDRESS,
  15. .unit1_cs0_end_address = XSPI_HYPER_CFG_UNIT_1_CS_0_END_ADDRESS,
  16. .unit1_cs1_start_address = XSPI_HYPER_CFG_UNIT_1_CS_1_START_ADDRESS,
  17. .unit1_cs1_end_address = XSPI_HYPER_CFG_UNIT_1_CS_1_END_ADDRESS,
  18. };
  19. static xspi_hyper_extended_cfg_t g_hyperbus0_extended_cfg =
  20. {
  21. .unit = 0,
  22. .chip_select = XSPI_HYPER_CHIP_SELECT_1,
  23. .memory_size = XSPI_HYPER_MEMORY_SIZE_32MB,
  24. .data_latching_delay_clock = 0x08,
  25. .p_cs_timing_settings = &g_hyperbus0_cs_timing_settings,
  26. .p_autocalibration_preamble_pattern_addr = (uint8_t *) 0x00,
  27. #if 0 == 0
  28. .prefetch_en = (xspi_hyper_prefetch_function_t) XSPI_HYPER_CFG_UNIT_0_PREFETCH_FUNCTION,
  29. #else
  30. .prefetch_en = (xspi_hyper_prefetch_function_t) XSPI_HYPER_CFG_UNIT_1_PREFETCH_FUNCTION,
  31. #endif
  32. #if BSP_FEATURE_XSPI_VOLTAGE_SETTING_SUPPORTED
  33. #if 0 == 0
  34. .io_voltage = (xspi_hyper_io_voltage_t) XSPI_HYPER_CFG_UNIT_0_IOVOLTAGE,
  35. #else
  36. .io_voltage = (xspi_hyper_io_voltage_t) XSPI_HYPER_CFG_UNIT_1_IOVOLTAGE,
  37. #endif
  38. #endif
  39. .p_address_space = &g_hyperbus0_address_space_settings,
  40. };
  41. const hyperbus_cfg_t g_hyperbus0_cfg =
  42. {
  43. .burst_type = HYPERBUS_BURST_TYPE_LINEAR,
  44. .access_space = HYPERBUS_SPACE_SELECT_MEMORY_SPACE,
  45. .read_latency_count = HYPERBUS_LATENCY_COUNT_7,
  46. .memory_write_latency_count = HYPERBUS_LATENCY_COUNT_7,
  47. .register_write_latency_count = HYPERBUS_LATENCY_COUNT_0,
  48. .p_extend = &g_hyperbus0_extended_cfg,
  49. };
  50. /** This structure encompasses everything that is needed to use an instance of this interface. */
  51. const hyperbus_instance_t g_hyperbus0 =
  52. {
  53. .p_ctrl = &g_hyperbus0_ctrl,
  54. .p_cfg = &g_hyperbus0_cfg,
  55. .p_api = &g_hyperbus_on_xspi_hyper,
  56. };
  57. xspi_qspi_instance_ctrl_t g_qspi0_ctrl;
  58. static const spi_flash_erase_command_t g_qspi0_erase_command_list[] =
  59. {
  60. #if 4096 > 0
  61. {.command = 0x20, .size = 4096 },
  62. #endif
  63. #if 32768 > 0
  64. {.command = 0x52, .size = 32768 },
  65. #endif
  66. #if 65536 > 0
  67. {.command = 0xD8, .size = 65536 },
  68. #endif
  69. #if 0xC7 > 0
  70. {.command = 0xC7, .size = SPI_FLASH_ERASE_SIZE_CHIP_ERASE },
  71. #endif
  72. };
  73. static xspi_qspi_timing_setting_t g_qspi0_timing_settings =
  74. {
  75. .command_to_command_interval = XSPI_QSPI_COMMAND_INTERVAL_CLOCKS_16,
  76. .cs_pullup_lag = XSPI_QSPI_CS_PULLUP_CLOCKS_1,
  77. .cs_pulldown_lead = XSPI_QSPI_CS_PULLDOWN_CLOCKS_1
  78. };
  79. static xspi_qspi_address_space_t g_qspi0_address_space_settings =
  80. {
  81. .unit0_cs0_end_address = XSPI_QSPI_CFG_UNIT_0_CS_0_END_ADDRESS,
  82. .unit0_cs1_start_address = XSPI_QSPI_CFG_UNIT_0_CS_1_START_ADDRESS,
  83. .unit0_cs1_end_address = XSPI_QSPI_CFG_UNIT_0_CS_1_END_ADDRESS,
  84. .unit1_cs0_end_address = XSPI_QSPI_CFG_UNIT_1_CS_0_END_ADDRESS,
  85. .unit1_cs1_start_address = XSPI_QSPI_CFG_UNIT_1_CS_1_START_ADDRESS,
  86. .unit1_cs1_end_address = XSPI_QSPI_CFG_UNIT_1_CS_1_END_ADDRESS,
  87. };
  88. static const xspi_qspi_extended_cfg_t g_qspi0_extended_cfg =
  89. {
  90. .unit = 0,
  91. .chip_select = XSPI_QSPI_CHIP_SELECT_0,
  92. .memory_size = XSPI_QSPI_MEMORY_SIZE_8MB,
  93. .p_timing_settings = &g_qspi0_timing_settings,
  94. #if 0 == 0
  95. .prefetch_en = (xspi_qspi_prefetch_function_t) XSPI_QSPI_CFG_UNIT_0_PREFETCH_FUNCTION,
  96. #else
  97. .prefetch_en = (xspi_qspi_prefetch_function_t) XSPI_QSPI_CFG_UNIT_1_PREFETCH_FUNCTION,
  98. #endif
  99. #if BSP_FEATURE_XSPI_VOLTAGE_SETTING_SUPPORTED
  100. #if 0 == 0
  101. .io_voltage = (xspi_qspi_io_voltage_t) XSPI_QSPI_CFG_UNIT_0_IOVOLTAGE,
  102. #else
  103. .io_voltage = (xspi_qspi_io_voltage_t) XSPI_QSPI_CFG_UNIT_1_IOVOLTAGE,
  104. #endif
  105. #endif
  106. .p_address_space = &g_qspi0_address_space_settings,
  107. #if XSPI_QSPI_CFG_DMAC_SUPPORT_ENABLE
  108. .p_lower_lvl_transfer = &FSP_NOT_DEFINED
  109. #endif
  110. };
  111. const spi_flash_cfg_t g_qspi0_cfg =
  112. {
  113. .spi_protocol = SPI_FLASH_PROTOCOL_1S_1S_1S,
  114. .address_bytes = SPI_FLASH_ADDRESS_BYTES_3,
  115. .dummy_clocks = SPI_FLASH_DUMMY_CLOCKS_8,
  116. .read_command = 0x0B,
  117. .page_program_command = 0x02,
  118. .write_enable_command = 0x06,
  119. .status_command = 0x05,
  120. .write_status_bit = 0,
  121. .xip_enter_command = 0,
  122. .xip_exit_command = 0,
  123. .p_erase_command_list = &g_qspi0_erase_command_list[0],
  124. .erase_command_list_length = sizeof(g_qspi0_erase_command_list) / sizeof(g_qspi0_erase_command_list[0]),
  125. .p_extend = &g_qspi0_extended_cfg,
  126. };
  127. /** This structure encompasses everything that is needed to use an instance of this interface. */
  128. const spi_flash_instance_t g_qspi0 =
  129. {
  130. .p_ctrl = &g_qspi0_ctrl,
  131. .p_cfg = &g_qspi0_cfg,
  132. .p_api = &g_spi_flash_on_xspi_qspi,
  133. };
  134. sci_uart_instance_ctrl_t g_uart0_ctrl;
  135. #define FSP_NOT_DEFINED (1)
  136. #if (FSP_NOT_DEFINED) != (FSP_NOT_DEFINED)
  137. /* If the transfer module is DMAC, define a DMAC transfer callback. */
  138. extern void sci_uart_tx_dmac_callback(sci_uart_instance_ctrl_t * p_instance_ctrl);
  139. void g_uart0_tx_transfer_callback (transfer_callback_args_t * p_args)
  140. {
  141. FSP_PARAMETER_NOT_USED(p_args);
  142. sci_uart_tx_dmac_callback(&g_uart0_ctrl);
  143. }
  144. #endif
  145. #if (FSP_NOT_DEFINED) != (FSP_NOT_DEFINED)
  146. /* If the transfer module is DMAC, define a DMAC transfer callback. */
  147. extern void sci_uart_rx_dmac_callback(sci_uart_instance_ctrl_t * p_instance_ctrl);
  148. void g_uart0_rx_transfer_callback (transfer_callback_args_t * p_args)
  149. {
  150. FSP_PARAMETER_NOT_USED(p_args);
  151. sci_uart_rx_dmac_callback(&g_uart0_ctrl);
  152. }
  153. #endif
  154. #undef FSP_NOT_DEFINED
  155. sci_baud_setting_t g_uart0_baud_setting =
  156. {
  157. /* Baud rate calculated with 0.160% error. */ .baudrate_bits_b.abcse = 0, .baudrate_bits_b.abcs = 0, .baudrate_bits_b.bgdm = 1, .baudrate_bits_b.cks = 0, .baudrate_bits_b.brr = 51, .baudrate_bits_b.mddr = (uint8_t) 256, .baudrate_bits_b.brme = false
  158. };
  159. /** UART extended configuration for UARTonSCI HAL driver */
  160. const sci_uart_extended_cfg_t g_uart0_cfg_extend =
  161. {
  162. .clock = SCI_UART_CLOCK_INT,
  163. .rx_edge_start = SCI_UART_START_BIT_FALLING_EDGE,
  164. .noise_cancel = SCI_UART_NOISE_CANCELLATION_DISABLE,
  165. .rx_fifo_trigger = SCI_UART_RX_FIFO_TRIGGER_MAX,
  166. .p_baud_setting = &g_uart0_baud_setting,
  167. #if 1
  168. .clock_source = SCI_UART_CLOCK_SOURCE_SCI0ASYNCCLK,
  169. #else
  170. .clock_source = SCI_UART_CLOCK_SOURCE_PCLKM,
  171. #endif
  172. .flow_control = SCI_UART_FLOW_CONTROL_RTS,
  173. #if 0xFF != 0xFF
  174. .flow_control_pin = BSP_IO_PORT_FF_PIN_0xFF,
  175. #else
  176. .flow_control_pin = (bsp_io_port_pin_t) UINT16_MAX,
  177. #endif
  178. .rs485_setting = {
  179. .enable = SCI_UART_RS485_DISABLE,
  180. .polarity = SCI_UART_RS485_DE_POLARITY_HIGH,
  181. .assertion_time = 1,
  182. .negation_time = 1,
  183. },
  184. };
  185. /** UART interface configuration */
  186. const uart_cfg_t g_uart0_cfg =
  187. {
  188. .channel = 0,
  189. .data_bits = UART_DATA_BITS_8,
  190. .parity = UART_PARITY_OFF,
  191. .stop_bits = UART_STOP_BITS_1,
  192. .p_callback = user_uart0_callback,
  193. .p_context = NULL,
  194. .p_extend = &g_uart0_cfg_extend,
  195. .p_transfer_tx = g_uart0_P_TRANSFER_TX,
  196. .p_transfer_rx = g_uart0_P_TRANSFER_RX,
  197. .rxi_ipl = (12),
  198. .txi_ipl = (12),
  199. .tei_ipl = (12),
  200. .eri_ipl = (12),
  201. #if defined(VECTOR_NUMBER_SCI0_RXI)
  202. .rxi_irq = VECTOR_NUMBER_SCI0_RXI,
  203. #else
  204. .rxi_irq = FSP_INVALID_VECTOR,
  205. #endif
  206. #if defined(VECTOR_NUMBER_SCI0_TXI)
  207. .txi_irq = VECTOR_NUMBER_SCI0_TXI,
  208. #else
  209. .txi_irq = FSP_INVALID_VECTOR,
  210. #endif
  211. #if defined(VECTOR_NUMBER_SCI0_TEI)
  212. .tei_irq = VECTOR_NUMBER_SCI0_TEI,
  213. #else
  214. .tei_irq = FSP_INVALID_VECTOR,
  215. #endif
  216. #if defined(VECTOR_NUMBER_SCI0_ERI)
  217. .eri_irq = VECTOR_NUMBER_SCI0_ERI,
  218. #else
  219. .eri_irq = FSP_INVALID_VECTOR,
  220. #endif
  221. };
  222. /* Instance structure to use this module. */
  223. const uart_instance_t g_uart0 =
  224. {
  225. .p_ctrl = &g_uart0_ctrl,
  226. .p_cfg = &g_uart0_cfg,
  227. .p_api = &g_uart_on_sci
  228. };
  229. void g_hal_init(void) {
  230. g_common_init();
  231. }