common_data.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. /* generated common source file - do not edit */
  2. #include "common_data.h"
  3. cmt_instance_ctrl_t g_timer0_ctrl;
  4. const timer_cfg_t g_timer0_cfg =
  5. {
  6. .mode = TIMER_MODE_PERIODIC,
  7. /* Actual period: 0.001 seconds. */ .period_counts = (uint32_t) 0x186a, .source_div = (timer_source_div_t)3,
  8. .channel = 0,
  9. .p_callback = rm_ssc_port_timer_interrupt,
  10. .p_context = NULL,
  11. .p_extend = NULL,
  12. .cycle_end_ipl = (12),
  13. #if defined(VECTOR_NUMBER_CMT0_CMI)
  14. .cycle_end_irq = VECTOR_NUMBER_CMT0_CMI,
  15. #else
  16. .cycle_end_irq = FSP_INVALID_VECTOR,
  17. #endif
  18. };
  19. /* Instance structure to use this module. */
  20. const timer_instance_t g_timer0 =
  21. {
  22. .p_ctrl = &g_timer0_ctrl,
  23. .p_cfg = &g_timer0_cfg,
  24. .p_api = &g_timer_on_cmt
  25. };
  26. ether_selector_instance_ctrl_t g_ether_selector1_ctrl;
  27. const ether_selector_cfg_t g_ether_selector1_cfg =
  28. {
  29. .channel = 1,
  30. .phylink = ETHER_SELECTOR_PHYLINK_POLARITY_LOW,
  31. .interface = ETHER_SELECTOR_INTERFACE_RGMII,
  32. .speed = ETHER_SELECTOR_SPEED_100_MBPS,
  33. .duplex = ETHER_SELECTOR_DUPLEX_FULL,
  34. .ref_clock = ETHER_SELECTOR_REF_CLOCK_INPUT,
  35. .p_extend = NULL,
  36. };
  37. /* Instance structure to use this module. */
  38. const ether_selector_instance_t g_ether_selector1 =
  39. {
  40. .p_ctrl = &g_ether_selector1_ctrl,
  41. .p_cfg = &g_ether_selector1_cfg,
  42. .p_api = &g_ether_selector_on_ether_selector
  43. };
  44. ether_phy_instance_ctrl_t g_ether_phy1_ctrl;
  45. const ether_phy_extend_cfg_t g_ether_phy1_extend =
  46. {
  47. .port_type = ETHER_PHY_PORT_TYPE_ETHER_CAT,
  48. .mdio_type = ETHER_PHY_MDIO_GMAC,
  49. .bps = ETHER_PHY_SPEED_100,
  50. .duplex = ETHER_PHY_DUPLEX_FULL,
  51. .auto_negotiation = ETHER_PHY_AUTO_NEGOTIATION_ON,
  52. .phy_reset_pin = BSP_IO_PORT_13_PIN_4,
  53. .phy_reset_time = 15000,
  54. .p_selector_instance = (ether_selector_instance_t *)&g_ether_selector1,
  55. .p_target_init = phy_rtl8211f_initial,
  56. };
  57. const ether_phy_cfg_t g_ether_phy1_cfg =
  58. {
  59. .channel = 1,
  60. .phy_lsi_address = 2,
  61. .phy_reset_wait_time = 0x00020000,
  62. .mii_bit_access_wait_time = 0, // Unused
  63. .phy_lsi_type = ETHER_PHY_LSI_TYPE_CUSTOM,
  64. .flow_control = ETHER_PHY_FLOW_CONTROL_DISABLE,
  65. .mii_type = (ether_phy_mii_type_t) 0, // Unused
  66. .p_context = NULL,
  67. .p_extend = &g_ether_phy1_extend
  68. };
  69. /* Instance structure to use this module. */
  70. const ether_phy_instance_t g_ether_phy1 =
  71. {
  72. .p_ctrl = &g_ether_phy1_ctrl,
  73. .p_cfg = &g_ether_phy1_cfg,
  74. .p_api = &g_ether_phy_on_ether_phy
  75. };
  76. ether_selector_instance_ctrl_t g_ether_selector0_ctrl;
  77. const ether_selector_cfg_t g_ether_selector0_cfg =
  78. {
  79. .channel = 0,
  80. .phylink = ETHER_SELECTOR_PHYLINK_POLARITY_LOW,
  81. .interface = ETHER_SELECTOR_INTERFACE_RGMII,
  82. .speed = ETHER_SELECTOR_SPEED_100_MBPS,
  83. .duplex = ETHER_SELECTOR_DUPLEX_FULL,
  84. .ref_clock = ETHER_SELECTOR_REF_CLOCK_INPUT,
  85. .p_extend = NULL,
  86. };
  87. /* Instance structure to use this module. */
  88. const ether_selector_instance_t g_ether_selector0 =
  89. {
  90. .p_ctrl = &g_ether_selector0_ctrl,
  91. .p_cfg = &g_ether_selector0_cfg,
  92. .p_api = &g_ether_selector_on_ether_selector
  93. };
  94. ether_phy_instance_ctrl_t g_ether_phy0_ctrl;
  95. const ether_phy_extend_cfg_t g_ether_phy0_extend =
  96. {
  97. .port_type = ETHER_PHY_PORT_TYPE_ETHER_CAT,
  98. .mdio_type = ETHER_PHY_MDIO_GMAC,
  99. .bps = ETHER_PHY_SPEED_100,
  100. .duplex = ETHER_PHY_DUPLEX_FULL,
  101. .auto_negotiation = ETHER_PHY_AUTO_NEGOTIATION_ON,
  102. .phy_reset_pin = BSP_IO_PORT_13_PIN_4,
  103. .phy_reset_time = 15000,
  104. .p_selector_instance = (ether_selector_instance_t *)&g_ether_selector0,
  105. .p_target_init = phy_rtl8211f_initial,
  106. };
  107. const ether_phy_cfg_t g_ether_phy0_cfg =
  108. {
  109. .channel = 0,
  110. .phy_lsi_address = 1,
  111. .phy_reset_wait_time = 0x00020000,
  112. .mii_bit_access_wait_time = 0, // Unused
  113. .phy_lsi_type = ETHER_PHY_LSI_TYPE_CUSTOM,
  114. .flow_control = ETHER_PHY_FLOW_CONTROL_DISABLE,
  115. .mii_type = (ether_phy_mii_type_t) 0, // Unused
  116. .p_context = NULL,
  117. .p_extend = &g_ether_phy0_extend
  118. };
  119. /* Instance structure to use this module. */
  120. const ether_phy_instance_t g_ether_phy0 =
  121. {
  122. .p_ctrl = &g_ether_phy0_ctrl,
  123. .p_cfg = &g_ether_phy0_cfg,
  124. .p_api = &g_ether_phy_on_ether_phy
  125. };
  126. ethercat_ssc_port_instance_ctrl_t g_ethercat_ssc_port0_ctrl;
  127. const ethercat_ssc_port_extend_cfg_t g_ethercat_ssc_port0_ext_cfg =
  128. {
  129. .eeprom_size = ETHERCAT_SSC_PORT_EEPROM_SIZE_UNDER_32KBIT,
  130. .txc0 = ETHERCAT_SSC_PORT_TXC_DELAY_00NS,
  131. .txc1 = ETHERCAT_SSC_PORT_TXC_DELAY_00NS,
  132. .txc2 = ETHERCAT_SSC_PORT_TXC_DELAY_00NS,
  133. .p_ether_phy_instance[0] =
  134. #define FSP_NOT_DEFINED (1)
  135. #if (FSP_NOT_DEFINED == g_ether_phy0)
  136. NULL,
  137. #else
  138. &g_ether_phy0,
  139. #endif
  140. .p_ether_phy_instance[1] =
  141. #if (FSP_NOT_DEFINED == g_ether_phy1)
  142. NULL,
  143. #else
  144. &g_ether_phy1,
  145. #endif
  146. .p_ether_phy_instance[2] =
  147. #if (FSP_NOT_DEFINED == FSP_NOT_DEFINED)
  148. NULL,
  149. #else
  150. &FSP_NOT_DEFINED,
  151. #endif
  152. };
  153. const ethercat_ssc_port_cfg_t g_ethercat_ssc_port0_cfg =
  154. {
  155. .reset_hold_time = 1,
  156. .reset_wait_time = 200000,
  157. .address_offset = 0,
  158. #if defined(VECTOR_NUMBER_ESC_CAT)
  159. .common_irq = VECTOR_NUMBER_ESC_CAT,
  160. #else
  161. .common_irq = FSP_INVALID_VECTOR,
  162. #endif
  163. .common_ipl = (12),
  164. #if defined(VECTOR_NUMBER_ESC_SYNC0)
  165. .sync0_irq = VECTOR_NUMBER_ESC_SYNC0,
  166. #else
  167. .sync0_irq = FSP_INVALID_VECTOR,
  168. #endif
  169. .sync0_ipl = (12),
  170. #if defined(VECTOR_NUMBER_ESC_SYNC1)
  171. .sync1_irq = VECTOR_NUMBER_ESC_SYNC1,
  172. #else
  173. .sync1_irq = FSP_INVALID_VECTOR,
  174. #endif
  175. .sync1_ipl = (12),
  176. .p_callback = NULL,
  177. .p_timer_instance =
  178. #if (FSP_NOT_DEFINED == g_timer0)
  179. NULL,
  180. #else
  181. &g_timer0,
  182. #endif
  183. .p_context = NULL,
  184. .p_extend = &g_ethercat_ssc_port0_ext_cfg,
  185. };
  186. /* Instance structure to use this module. */
  187. const ethercat_ssc_port_instance_t g_ethercat_ssc_port0 =
  188. {
  189. .p_ctrl = &g_ethercat_ssc_port0_ctrl,
  190. .p_cfg = &g_ethercat_ssc_port0_cfg,
  191. .p_api = &g_ethercat_ssc_port_on_ethercat_ssc_port
  192. };
  193. ethercat_ssc_port_instance_t const * gp_ethercat_ssc_port = &g_ethercat_ssc_port0;
  194. /** IOPORT interface configuration for event link **/
  195. const ioport_extend_cfg_t g_ioport_cfg_extend =
  196. {
  197. .port_group_output_cfg[IOPORT_PORT_GROUP_1] =
  198. {
  199. .pin_select = (uint8_t)( IOPORT_EVENT_PIN_SELECTION_NONE),
  200. .operation = IOPORT_EVENT_OUTPUT_OPERATION_LOW
  201. },
  202. .port_group_output_cfg[IOPORT_PORT_GROUP_2] =
  203. {
  204. .pin_select = (uint8_t)( IOPORT_EVENT_PIN_SELECTION_NONE),
  205. .operation = IOPORT_EVENT_OUTPUT_OPERATION_LOW
  206. },
  207. .port_group_input_cfg[IOPORT_PORT_GROUP_1] =
  208. {
  209. .event_control = IOPORT_EVENT_CONTROL_DISABLE,
  210. .pin_select = (uint8_t)( IOPORT_EVENT_PIN_SELECTION_NONE),
  211. .edge_detection = IOPORT_EVENT_DETECTION_RISING_EDGE,
  212. .overwrite_control = IOPORT_EVENT_CONTROL_DISABLE,
  213. .buffer_init_value = IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 7U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 6U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 5U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 4U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 3U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 2U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 1U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW
  214. },
  215. .port_group_input_cfg[IOPORT_PORT_GROUP_2] =
  216. {
  217. .event_control = IOPORT_EVENT_CONTROL_DISABLE,
  218. .pin_select = (uint8_t)( IOPORT_EVENT_PIN_SELECTION_NONE),
  219. .edge_detection = IOPORT_EVENT_DETECTION_RISING_EDGE,
  220. .overwrite_control = IOPORT_EVENT_CONTROL_DISABLE,
  221. .buffer_init_value = IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 7U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 6U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 5U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 4U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 3U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 2U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW << 1U | IOPORT_EVENT_INITIAL_BUFFER_VALUE_LOW
  222. },
  223. .single_port_cfg[IOPORT_SINGLE_PORT_0] =
  224. {
  225. .event_control = IOPORT_EVENT_CONTROL_DISABLE,
  226. .direction = IOPORT_EVENT_DIRECTION_OUTPUT,
  227. .port_num = (uint16_t)BSP_IO_PORT_16_PIN_0,
  228. .operation = IOPORT_EVENT_OUTPUT_OPERATION_LOW,
  229. .edge_detection = IOPORT_EVENT_DETECTION_RISING_EDGE
  230. },
  231. .single_port_cfg[IOPORT_SINGLE_PORT_1] =
  232. {
  233. .event_control = IOPORT_EVENT_CONTROL_DISABLE,
  234. .direction = IOPORT_EVENT_DIRECTION_OUTPUT,
  235. .port_num = (uint16_t)BSP_IO_PORT_16_PIN_0,
  236. .operation = IOPORT_EVENT_OUTPUT_OPERATION_LOW,
  237. .edge_detection = IOPORT_EVENT_DETECTION_RISING_EDGE
  238. },
  239. .single_port_cfg[IOPORT_SINGLE_PORT_2] =
  240. {
  241. .event_control = IOPORT_EVENT_CONTROL_DISABLE,
  242. .direction = IOPORT_EVENT_DIRECTION_OUTPUT,
  243. .port_num = (uint16_t)BSP_IO_PORT_16_PIN_0,
  244. .operation = IOPORT_EVENT_OUTPUT_OPERATION_LOW,
  245. .edge_detection = IOPORT_EVENT_DETECTION_RISING_EDGE
  246. },
  247. .single_port_cfg[IOPORT_SINGLE_PORT_3] =
  248. {
  249. .event_control = IOPORT_EVENT_CONTROL_DISABLE,
  250. .direction = IOPORT_EVENT_DIRECTION_OUTPUT,
  251. .port_num = (uint16_t)BSP_IO_PORT_16_PIN_0,
  252. .operation = IOPORT_EVENT_OUTPUT_OPERATION_LOW,
  253. .edge_detection = IOPORT_EVENT_DETECTION_RISING_EDGE
  254. }
  255. };
  256. ioport_instance_ctrl_t g_ioport_ctrl;
  257. const ioport_instance_t g_ioport =
  258. {
  259. .p_api = &g_ioport_on_ioport,
  260. .p_ctrl = &g_ioport_ctrl,
  261. .p_cfg = &g_bsp_pin_cfg
  262. };
  263. void g_common_init(void) {
  264. }