hpm_sei_drv.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  1. /*
  2. * Copyright (c) 2023 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_SEI_DRV_H
  8. #define HPM_SEI_DRV_H
  9. #include "hpm_common.h"
  10. #include "hpm_sei_regs.h"
  11. #include "hpm_soc_feature.h"
  12. #include "hpm_soc_ip_feature.h"
  13. /**
  14. * @brief sei arming action
  15. */
  16. typedef enum {
  17. sei_arming_direct_exec = 0,
  18. sei_arming_wait_trigger
  19. } sei_arming_mode_t;
  20. /**
  21. * @brief sei watchdog action
  22. */
  23. typedef enum {
  24. sei_wdg_exec_next_instr = 0,
  25. sei_wdg_exec_exception_instr
  26. } sei_wdg_action_t;
  27. /**
  28. * @brief sei transfer mode
  29. */
  30. typedef enum {
  31. sei_synchronous_master_mode = 0,
  32. sei_synchronous_slave_mode,
  33. sei_asynchronous_mode
  34. } sei_tranceiver_mode_t;
  35. /**
  36. * @brief sei asynchronous mode parity
  37. */
  38. typedef enum {
  39. sei_asynchronous_parity_even = 0,
  40. sei_asynchronous_parity_odd
  41. } sei_asynchronous_parity_t;
  42. /**
  43. * @brief sei ilde state
  44. */
  45. typedef enum {
  46. sei_idle_low_state = 0,
  47. sei_idle_high_state,
  48. } sei_idle_state_t;
  49. /**
  50. * @brief sei data mode
  51. */
  52. typedef enum {
  53. sei_data_mode = 0,
  54. sei_check_mode,
  55. sei_crc_mode
  56. } sei_data_mode_t;
  57. /**
  58. * @brief sei data bit order
  59. */
  60. typedef enum {
  61. sei_bit_lsb_first = 0,
  62. sei_bit_msb_first
  63. } sei_data_bit_order_t;
  64. /**
  65. * @brief sei data word order
  66. */
  67. typedef enum {
  68. sei_word_nonreverse = 0,
  69. sei_word_reverse
  70. } sei_data_word_order_t;
  71. /**
  72. * @brief sei state transition condition
  73. */
  74. typedef enum {
  75. sei_state_tran_condition_high_match = 0,
  76. sei_state_tran_condition_low_dismatch,
  77. sei_state_tran_condition_rise_entry,
  78. sei_state_tran_condition_fall_leave
  79. } sei_state_tran_condition_t;
  80. /**
  81. * @brief sei trig in type
  82. */
  83. typedef enum {
  84. sei_trig_in0 = 0,
  85. sei_trig_in1,
  86. sei_trig_in_period,
  87. sei_trig_in_soft
  88. } sei_trig_in_type_t; /**< trig input type */
  89. /**
  90. * @brief sei irq event
  91. */
  92. typedef enum {
  93. sei_irq_stall_event = SEI_CTRL_IRQ_INT_FLAG_STALL_MASK,
  94. sei_irq_execpt_event = SEI_CTRL_IRQ_INT_FLAG_EXCEPT_MASK,
  95. sei_irq_wdog_event = SEI_CTRL_IRQ_INT_FLAG_WDOG_MASK,
  96. sei_irq_instr_ptr0_start_event = SEI_CTRL_IRQ_INT_FLAG_PTR0_ST_MASK,
  97. sei_irq_instr_ptr1_start_event = SEI_CTRL_IRQ_INT_FLAG_PTR1_ST_MASK,
  98. sei_irq_instr_value0_start_event = SEI_CTRL_IRQ_INT_FLAG_INSTR0_ST_MASK,
  99. sei_irq_instr_value1_start_event = SEI_CTRL_IRQ_INT_FLAG_INSTR1_ST_MASK,
  100. sei_irq_instr_ptr0_end_event = SEI_CTRL_IRQ_INT_FLAG_PTR0_END_MASK,
  101. sei_irq_instr_ptr1_end_event = SEI_CTRL_IRQ_INT_FLAG_PTR1_END_MASK,
  102. sei_irq_instr_value0_end_event = SEI_CTRL_IRQ_INT_FLAG_INSTR0_END_MASK,
  103. sei_irq_instr_value1_end_event = SEI_CTRL_IRQ_INT_FLAG_INSTR1_END_MASK,
  104. sei_irq_trx_err_event = SEI_CTRL_IRQ_INT_FLAG_TRX_ERR_MASK,
  105. sei_irq_timeout_event = SEI_CTRL_IRQ_INT_FLAG_TIMEOUT_MASK,
  106. sei_irq_latch0_event = SEI_CTRL_IRQ_INT_FLAG_LATCH0_MASK,
  107. sei_irq_latch1_event = SEI_CTRL_IRQ_INT_FLAG_LATCH1_MASK,
  108. sei_irq_latch2_event = SEI_CTRL_IRQ_INT_FLAG_LATCH2_MASK,
  109. sei_irq_latch3_event = SEI_CTRL_IRQ_INT_FLAG_LATCH3_MASK,
  110. sei_irq_sample_err_event = SEI_CTRL_IRQ_INT_FLAG_SMP_ERR_MASK,
  111. sei_irq_trig0_event = SEI_CTRL_IRQ_INT_FLAG_TRIGER0_MASK,
  112. sei_irq_trig1_event = SEI_CTRL_IRQ_INT_FLAG_TRIGER1_MASK,
  113. sei_irq_trig2_event = SEI_CTRL_IRQ_INT_FLAG_TRIGER2_MASK,
  114. sei_irq_trig3_event = SEI_CTRL_IRQ_INT_FLAG_TRIGER3_MASK,
  115. sei_irq_trig0_err_event = SEI_CTRL_IRQ_INT_FLAG_TRG_ERR0_MASK,
  116. sei_irq_trig1_err_event = SEI_CTRL_IRQ_INT_FLAG_TRG_ERR1_MASK,
  117. sei_irq_trig2_err_event = SEI_CTRL_IRQ_INT_FLAG_TRG_ERR2_MASK,
  118. sei_irq_trig3_err_event = SEI_CTRL_IRQ_INT_FLAG_TRG_ERR3_MASK,
  119. } sei_irq_event_t; /**< irq event type */
  120. /**
  121. * @brief sei select command or data
  122. */
  123. #define SEI_SELECT_CMD true /**< select cmd */
  124. #define SEI_SELECT_DATA false /**< select data */
  125. /**
  126. * @brief sei const data register index
  127. */
  128. #define SEI_DATA_CONST_0 (30UL)
  129. #define SEI_DATA_CONST_1 (31UL)
  130. /**
  131. * @brief sei instruction operation command
  132. */
  133. #define SEI_INSTR_OP_HALT 0u /**< op halt */
  134. #define SEI_INSTR_OP_JUMP 1u /**< op jump */
  135. #define SEI_INSTR_OP_SEND_WDG 2u /**< op send with watchdog */
  136. #define SEI_INSTR_OP_SEND 3u /**< op send */
  137. #define SEI_INSTR_OP_WAIT_WDG 4u /**< op wait with watchdog */
  138. #define SEI_INSTR_OP_WAIT 5u /**< op wait */
  139. #define SEI_INSTR_OP_RECV_WDG 6u /**< op recv with watchdog */
  140. #define SEI_INSTR_OP_RECV 7u /**< op recv */
  141. /**
  142. * @brief sei instruction synchronous master clock type
  143. */
  144. #define SEI_INSTR_M_CK_LOW 0u /**< clock low */
  145. #define SEI_INSTR_M_CK_RISE_FALL 1u /**< clock rise fall */
  146. #define SEI_INSTR_M_CK_FALL_RISE 2u /**< clock fall rise */
  147. #define SEI_INSTR_M_CK_HIGH 3u /**< clock high */
  148. /**
  149. * @brief sei instruction synchronous slave clock type
  150. */
  151. #define SEI_INSTR_S_CK_DEFAULT 0u /**< default */
  152. #define SEI_INSTR_S_CK_TRX_EXCH 1u /**< rx tx exchange */
  153. #define SEI_INSTR_S_CK_TIMEOUT_EN 2u /**< enable timeout */
  154. #define SEI_INSTR_S_CK_TRX_EXCH_TIMEOUT_EN 3u /**< rx tx exchange and enable timeout */
  155. /**
  156. * @brief sei instruction jump intructions index
  157. */
  158. #define SEI_JUMP_INIT_INSTR_IDX 0x00u /**< jump init instr index */
  159. #define SEI_JUMP_WDG_INSTR_IDX 0x01u /**< jump watchdog instr index */
  160. #define SEI_JUMP_CMD_TABLE_INSTR_IDX0 0x10u /**< jump command table instr ptr0 */
  161. #define SEI_JUMP_CMD_TABLE_INSTR_IDX1 0x11u /**< jump command table instr ptr1 */
  162. #define SEI_JUMP_CMD_TABLE_INSTR_IDX2 0x12u /**< jump command table instr ptr2 */
  163. #define SEI_JUMP_CMD_TABLE_INSTR_IDX3 0x13u /**< jump command table instr ptr3 */
  164. #define SEI_JUMP_CMD_TABLE_INSTR_IDX4 0x14u /**< jump command table instr ptr4 */
  165. #define SEI_JUMP_CMD_TABLE_INSTR_IDX5 0x15u /**< jump command table instr ptr5 */
  166. #define SEI_JUMP_CMD_TABLE_INSTR_IDX6 0x16u /**< jump command table instr ptr6 */
  167. #define SEI_JUMP_CMD_TABLE_INSTR_IDX7 0x17u /**< jump command table instr ptr7 */
  168. #define SEI_JUMP_CMD_TABLE_INSTR_IDX8 0x18u /**< jump command table instr ptr8 */
  169. #define SEI_JUMP_CMD_TABLE_INSTR_IDX9 0x19u /**< jump command table instr ptr9 */
  170. #define SEI_JUMP_CMD_TABLE_INSTR_IDX10 0x1Au /**< jump command table instr ptr10 */
  171. #define SEI_JUMP_CMD_TABLE_INSTR_IDX11 0x1Bu /**< jump command table instr ptr11 */
  172. #define SEI_JUMP_CMD_TABLE_INSTR_IDX12 0x1Cu /**< jump command table instr ptr12 */
  173. #define SEI_JUMP_CMD_TABLE_INSTR_IDX13 0x1Du /**< jump command table instr ptr13 */
  174. #define SEI_JUMP_CMD_TABLE_INSTR_IDX14 0x1Eu /**< jump command table instr ptr14 */
  175. #define SEI_JUMP_CMD_TABLE_INSTR_IDX15 0x1Fu /**< jump command table instr ptr15 */
  176. /**
  177. * @brief sei engine config structure
  178. */
  179. typedef struct {
  180. sei_arming_mode_t arming_mode;
  181. uint8_t data_cdm_idx;
  182. uint8_t data_base_idx;
  183. uint8_t init_instr_idx;
  184. bool wdg_enable;
  185. sei_wdg_action_t wdg_action;
  186. uint8_t wdg_instr_idx;
  187. uint16_t wdg_time;
  188. } sei_engine_config_t; /**< engine config struct */
  189. /**
  190. * @brief sei tranceiver synchronous master mode config structure
  191. */
  192. typedef struct {
  193. bool data_idle_high_z;
  194. sei_idle_state_t data_idle_state;
  195. bool clock_idle_high_z;
  196. sei_idle_state_t clock_idle_state;
  197. uint32_t baudrate;
  198. } sei_tranceiver_synchronous_master_config_t; /**< tranceiver synchronous master config struct */
  199. /**
  200. * @brief sei tranceiver synchronous master mode config structure
  201. */
  202. typedef struct {
  203. bool data_idle_high_z;
  204. sei_idle_state_t data_idle_state;
  205. bool clock_idle_high_z;
  206. sei_idle_state_t clock_idle_state;
  207. uint32_t max_baudrate;
  208. uint16_t ck0_timeout_us;
  209. uint16_t ck1_timeout_us;
  210. } sei_tranceiver_synchronous_slave_config_t; /**< tranceiver synchronous slave config struct */
  211. /**
  212. * @brief sei tranceiver asynchronous mode config structure
  213. */
  214. typedef struct {
  215. uint8_t wait_len;
  216. uint8_t data_len;
  217. bool parity_enable;
  218. sei_asynchronous_parity_t parity;
  219. bool data_idle_high_z;
  220. sei_idle_state_t data_idle_state;
  221. uint32_t baudrate;
  222. } sei_tranceiver_asynchronous_config_t; /**< tranceiver asynchronous config struct */
  223. /**
  224. * @brief sei tranceiver config structure
  225. */
  226. typedef struct {
  227. sei_tranceiver_mode_t mode;
  228. bool tri_sample;
  229. uint32_t src_clk_freq;
  230. sei_tranceiver_synchronous_master_config_t synchronous_master_config;
  231. sei_tranceiver_synchronous_slave_config_t synchronous_slave_config;
  232. sei_tranceiver_asynchronous_config_t asynchronous_config;
  233. } sei_tranceiver_config_t; /**< tranceiver config struct */
  234. /**
  235. * @brief sei trigger input config structure
  236. */
  237. typedef struct {
  238. bool trig_in0_enable;
  239. uint8_t trig_in0_select;
  240. bool trig_in1_enable;
  241. uint8_t trig_in1_select;
  242. bool trig_period_enable;
  243. sei_arming_mode_t trig_period_arming_mode;
  244. bool trig_period_sync_enable;
  245. uint8_t trig_period_sync_select;
  246. uint32_t trig_period_time;
  247. #if defined(HPM_IP_FEATURE_SEI_TIMEOUT_REWIND_FEATURE) && HPM_IP_FEATURE_SEI_TIMEOUT_REWIND_FEATURE
  248. uint8_t rewind_enable;
  249. uint8_t rewind_select;
  250. #endif
  251. } sei_trigger_input_config_t; /**< trigger input config struct */
  252. /**
  253. * @brief sei trigger output config structure
  254. */
  255. typedef struct {
  256. uint8_t src_latch_select;
  257. bool trig_out_enable;
  258. uint8_t trig_out_select;
  259. } sei_trigger_output_config_t; /**< trigger output config struct */
  260. /**
  261. * @brief sei data format config structure
  262. */
  263. typedef struct {
  264. sei_data_mode_t mode;
  265. bool signed_flag;
  266. sei_data_bit_order_t bit_order;
  267. sei_data_word_order_t word_order;
  268. uint8_t word_len;
  269. bool crc_invert;
  270. bool crc_shift_mode;
  271. uint8_t crc_len;
  272. uint8_t last_bit;
  273. uint8_t first_bit;
  274. uint8_t max_bit;
  275. uint8_t min_bit;
  276. uint32_t gold_value;
  277. uint32_t crc_init_value;
  278. uint32_t crc_poly;
  279. } sei_data_format_config_t; /**< cmd or data format config struct */
  280. /**
  281. * @brief sei command table config structure
  282. */
  283. typedef struct {
  284. uint32_t cmd_min_value;
  285. uint32_t cmd_max_value;
  286. uint32_t cmd_mask_value;
  287. uint8_t instr_idx[16];
  288. } sei_command_table_config_t; /**< cmd table config struct */
  289. /**
  290. * @brief sei state transition config structure
  291. */
  292. typedef struct {
  293. bool disable_instr_ptr_check;
  294. sei_state_tran_condition_t instr_ptr_cfg;
  295. uint8_t instr_ptr_value;
  296. bool disable_clk_check;
  297. sei_state_tran_condition_t clk_cfg;
  298. bool disable_txd_check;
  299. sei_state_tran_condition_t txd_cfg;
  300. bool disable_rxd_check;
  301. sei_state_tran_condition_t rxd_cfg;
  302. bool disable_timeout_check;
  303. sei_state_tran_condition_t timeout_cfg;
  304. } sei_state_transition_config_t; /**< state transition config struct */
  305. /**
  306. * @brief sei state transition latch config structure
  307. */
  308. typedef struct {
  309. bool enable;
  310. uint8_t output_select;
  311. uint16_t delay;
  312. } sei_state_transition_latch_config_t; /**< state transition latch config struct */
  313. /**
  314. * @brief sei sample config structure
  315. */
  316. typedef struct {
  317. uint8_t acc_data_idx;
  318. uint8_t spd_data_idx;
  319. uint8_t rev_data_idx;
  320. uint8_t pos_data_idx;
  321. bool acc_data_use_rx; /**< true - use rx data, false - use override data */
  322. bool spd_data_use_rx; /**< true - use rx data, false - use override data */
  323. bool rev_data_use_rx; /**< true - use rx data, false - use override data */
  324. bool pos_data_use_rx; /**< true - use rx data, false - use override data */
  325. uint8_t latch_select;
  326. bool sample_once;
  327. uint16_t sample_window;
  328. uint32_t data_register_select;
  329. } sei_sample_config_t; /**< sample config struct */
  330. /**
  331. * @brief sei update config structure
  332. */
  333. typedef struct {
  334. uint8_t acc_data_idx;
  335. uint8_t spd_data_idx;
  336. uint8_t rev_data_idx;
  337. uint8_t pos_data_idx;
  338. bool acc_data_use_rx; /**< true - use rx data, false - use override data */
  339. bool spd_data_use_rx; /**< true - use rx data, false - use override data */
  340. bool rev_data_use_rx; /**< true - use rx data, false - use override data */
  341. bool pos_data_use_rx; /**< true - use rx data, false - use override data */
  342. bool time_use_override; /**< true - use override data, false - use timestamp data */
  343. bool update_on_err;
  344. uint8_t latch_select;
  345. uint32_t data_register_select;
  346. } sei_update_config_t; /**< update config struct */
  347. #if defined(__cplusplus)
  348. extern "C" {
  349. #endif /* __cplusplus */
  350. /**
  351. * @brief Set the SEI engine enable or disable
  352. * @param [in] ptr SEI base address
  353. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  354. * @param [in] enable enable or disable
  355. * @arg true enable
  356. * @arg false disable
  357. */
  358. static inline void sei_set_engine_enable(SEI_Type *ptr, uint8_t idx, bool enable)
  359. {
  360. if (enable) {
  361. ptr->CTRL[idx].ENGINE.CTRL |= SEI_CTRL_ENGINE_CTRL_ENABLE_MASK;
  362. } else {
  363. ptr->CTRL[idx].ENGINE.CTRL &= ~SEI_CTRL_ENGINE_CTRL_ENABLE_MASK;
  364. }
  365. }
  366. /**
  367. * @brief Rewind the SEI engine
  368. * @param [in] ptr SEI base address
  369. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  370. */
  371. static inline void sei_set_engine_rewind(SEI_Type *ptr, uint8_t idx)
  372. {
  373. ptr->CTRL[idx].ENGINE.CTRL |= SEI_CTRL_ENGINE_CTRL_REWIND_MASK;
  374. }
  375. /**
  376. * @brief Set the SEI trigger input trig in0 enable or disable
  377. * @param [in] ptr SEI base address
  378. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  379. * @param [in] enable enable or disable
  380. * @arg true enable
  381. * @arg false disable
  382. */
  383. static inline void sei_set_trig_input_in0_enable(SEI_Type *ptr, uint8_t idx, bool enable)
  384. {
  385. if (enable) {
  386. ptr->CTRL[idx].TRG.IN_CFG |= SEI_CTRL_TRG_IN_CFG_IN0_EN_MASK;
  387. } else {
  388. ptr->CTRL[idx].TRG.IN_CFG &= ~SEI_CTRL_TRG_IN_CFG_IN0_EN_MASK;
  389. }
  390. }
  391. /**
  392. * @brief Set the SEI trigger input trig in1 enable or disable
  393. * @param [in] ptr SEI base address
  394. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  395. * @param [in] enable enable or disable
  396. * @arg true enable
  397. * @arg false disable
  398. */
  399. static inline void sei_set_trig_input_in1_enable(SEI_Type *ptr, uint8_t idx, bool enable)
  400. {
  401. if (enable) {
  402. ptr->CTRL[idx].TRG.IN_CFG |= SEI_CTRL_TRG_IN_CFG_IN1_EN_MASK;
  403. } else {
  404. ptr->CTRL[idx].TRG.IN_CFG &= ~SEI_CTRL_TRG_IN_CFG_IN1_EN_MASK;
  405. }
  406. }
  407. /**
  408. * @brief Set the SEI trigger input period enable or disable
  409. * @param [in] ptr SEI base address
  410. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  411. * @param [in] enable enable or disable
  412. * @arg true enable
  413. * @arg false disable
  414. */
  415. static inline void sei_set_trig_input_period_enable(SEI_Type *ptr, uint8_t idx, bool enable)
  416. {
  417. if (enable) {
  418. ptr->CTRL[idx].TRG.IN_CFG |= SEI_CTRL_TRG_IN_CFG_PRD_EN_MASK;
  419. } else {
  420. ptr->CTRL[idx].TRG.IN_CFG &= ~SEI_CTRL_TRG_IN_CFG_PRD_EN_MASK;
  421. }
  422. }
  423. /**
  424. * @brief Set the SEI trigger input soft enable or disable
  425. * @param [in] ptr SEI base address
  426. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  427. * @arg true enable
  428. * @arg false disable
  429. */
  430. static inline void sei_set_trig_input_soft_enable(SEI_Type *ptr, uint8_t idx)
  431. {
  432. ptr->CTRL[idx].TRG.SW |= SEI_CTRL_TRG_SW_SOFT_MASK;
  433. }
  434. /**
  435. * @brief Set the SEI trigger input command value
  436. * @param [in] ptr SEI base address
  437. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  438. * @param [in] type trigger input type @ref sei_trig_in_type_t
  439. * @param [in] data command data
  440. */
  441. static inline void sei_set_trig_input_command_value(SEI_Type *ptr, uint8_t idx, sei_trig_in_type_t type, uint32_t data)
  442. {
  443. ptr->CTRL[idx].TRG_TABLE.CMD[type] = data;
  444. }
  445. /**
  446. * @brief Get the SEI trigger input time
  447. * @param [in] ptr SEI base address
  448. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  449. * @param [in] type trigger input type @ref sei_trig_in_type_t
  450. * @retval trigger input time
  451. */
  452. static inline uint32_t sei_get_trig_input_time(SEI_Type *ptr, uint8_t idx, sei_trig_in_type_t type)
  453. {
  454. return ptr->CTRL[idx].TRG_TABLE.TIME[type];
  455. }
  456. /**
  457. * @brief Get the SEI latch time
  458. * @param [in] ptr SEI base address
  459. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  460. * @param [in] latch_idx
  461. * @arg SEI_LATCH_0
  462. * @arg SEI_LATCH_1
  463. * @arg SEI_LATCH_2
  464. * @arg SEI_LATCH_3
  465. * @retval latch time
  466. */
  467. static inline uint32_t sei_get_latch_time(SEI_Type *ptr, uint8_t idx, uint8_t latch_idx)
  468. {
  469. return ptr->CTRL[idx].LATCH[latch_idx].TIME;
  470. }
  471. /**
  472. * @brief Set the SEI tranceiver rx point
  473. * @param [in] ptr SEI base address
  474. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  475. * @param [in] point rx point value
  476. */
  477. static inline void sei_set_xcvr_rx_point(SEI_Type *ptr, uint8_t idx, uint16_t point)
  478. {
  479. uint32_t tmp;
  480. assert(point > 0);
  481. tmp = ptr->CTRL[idx].XCVR.DATA_CFG;
  482. tmp &= ~SEI_CTRL_XCVR_DATA_CFG_RXD_POINT_MASK;
  483. tmp |= SEI_CTRL_XCVR_DATA_CFG_RXD_POINT_SET(point);
  484. ptr->CTRL[idx].XCVR.DATA_CFG = tmp;
  485. }
  486. /**
  487. * @brief Set the SEI tranceiver tx point
  488. * @param [in] ptr SEI base address
  489. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  490. * @param [in] point tx point value
  491. */
  492. static inline void sei_set_xcvr_tx_point(SEI_Type *ptr, uint8_t idx, uint16_t point)
  493. {
  494. uint32_t tmp;
  495. assert(point > 0);
  496. tmp = ptr->CTRL[idx].XCVR.DATA_CFG;
  497. tmp &= ~SEI_CTRL_XCVR_DATA_CFG_TXD_POINT_MASK;
  498. tmp |= SEI_CTRL_XCVR_DATA_CFG_TXD_POINT_SET(point);
  499. ptr->CTRL[idx].XCVR.DATA_CFG = tmp;
  500. }
  501. /**
  502. * @brief Set the SEI tranceiver ck0 point
  503. * @param [in] ptr SEI base address
  504. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  505. * @param [in] point ck0 point value
  506. */
  507. static inline void sei_set_xcvr_ck0_point(SEI_Type *ptr, uint8_t idx, uint16_t point)
  508. {
  509. uint32_t tmp;
  510. assert(point > 0);
  511. tmp = ptr->CTRL[idx].XCVR.CLK_CFG;
  512. tmp &= ~SEI_CTRL_XCVR_CLK_CFG_CK0_POINT_MASK;
  513. tmp |= SEI_CTRL_XCVR_CLK_CFG_CK0_POINT_SET(point);
  514. ptr->CTRL[idx].XCVR.CLK_CFG = tmp;
  515. }
  516. /**
  517. * @brief Set the SEI tranceiver ck1 point
  518. * @param [in] ptr SEI base address
  519. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  520. * @param [in] point ck1 point value
  521. */
  522. static inline void sei_set_xcvr_ck1_point(SEI_Type *ptr, uint8_t idx, uint16_t point)
  523. {
  524. uint32_t tmp;
  525. assert(point > 0);
  526. tmp = ptr->CTRL[idx].XCVR.CLK_CFG;
  527. tmp &= ~SEI_CTRL_XCVR_CLK_CFG_CK1_POINT_MASK;
  528. tmp |= SEI_CTRL_XCVR_CLK_CFG_CK1_POINT_SET(point);
  529. ptr->CTRL[idx].XCVR.CLK_CFG = tmp;
  530. }
  531. /**
  532. * @brief Get the SEI tranceiver ck0 point
  533. * @param [in] ptr SEI base address
  534. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  535. * @retval ck0 point value
  536. */
  537. static inline uint16_t sei_get_xcvr_ck0_point(SEI_Type *ptr, uint8_t idx)
  538. {
  539. return SEI_CTRL_XCVR_CLK_CFG_CK0_POINT_GET(ptr->CTRL[idx].XCVR.CLK_CFG);
  540. }
  541. /**
  542. * @brief Get the SEI tranceiver ck1 point
  543. * @param [in] ptr SEI base address
  544. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  545. * @retval ck1 point value
  546. */
  547. static inline uint16_t sei_get_xcvr_ck1_point(SEI_Type *ptr, uint8_t idx)
  548. {
  549. return SEI_CTRL_XCVR_CLK_CFG_CK1_POINT_GET(ptr->CTRL[idx].XCVR.CLK_CFG);
  550. }
  551. /**
  552. * @brief Set the SEI command value
  553. * @param [in] ptr SEI base address
  554. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  555. * @param [in] cmd command value
  556. */
  557. static inline void sei_set_command_value(SEI_Type *ptr, uint8_t idx, uint32_t cmd)
  558. {
  559. ptr->CTRL[idx].CMD.CMD = cmd;
  560. }
  561. /**
  562. * @brief Get the SEI command value
  563. * @param [in] ptr SEI base address
  564. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  565. * @retval command value
  566. */
  567. static inline uint32_t sei_get_command_value(SEI_Type *ptr, uint8_t idx)
  568. {
  569. return ptr->CTRL[idx].CMD.CMD;
  570. }
  571. /**
  572. * @brief Rewind the SEI command
  573. * @param [in] ptr SEI base address
  574. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  575. */
  576. static inline void sei_set_command_rewind(SEI_Type *ptr, uint8_t idx)
  577. {
  578. ptr->CTRL[idx].CMD.MODE |= SEI_CTRL_CMD_MODE_REWIND_MASK;
  579. }
  580. /**
  581. * @brief Set the SEI data value
  582. * @param [in] ptr SEI base address
  583. * @param [in] idx SEI data index, such as SEI_DAT_2, SEI_DAT_3, etc.
  584. * @param [in] data data value
  585. */
  586. static inline void sei_set_data_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  587. {
  588. ptr->DAT[idx].DATA = data;
  589. }
  590. /**
  591. * @brief Get the SEI data value
  592. * @param [in] ptr SEI base address
  593. * @param [in] idx SEI data index, such as SEI_DAT_2, SEI_DAT_3, etc.
  594. * @retval data value
  595. */
  596. static inline uint32_t sei_get_data_value(SEI_Type *ptr, uint8_t idx)
  597. {
  598. return ptr->DAT[idx].DATA;
  599. }
  600. /**
  601. * @brief Rewind the SEI data
  602. * @param [in] ptr SEI base address
  603. * @param [in] idx SEI data index, such as SEI_DAT_2, SEI_DAT_3, etc.
  604. */
  605. static inline void sei_set_data_rewind(SEI_Type *ptr, uint8_t idx)
  606. {
  607. ptr->DAT[idx].MODE |= SEI_DAT_MODE_REWIND_MASK;
  608. }
  609. /**
  610. * @brief Set the SEI sample position (singleturn) override value
  611. * @param [in] ptr SEI base address
  612. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  613. * @param [in] data position (singleturn) override value
  614. */
  615. static inline void sei_set_sample_pos_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  616. {
  617. ptr->CTRL[idx].POS.SMP_POS = data;
  618. }
  619. /**
  620. * @brief Set the SEI sample revolution (multiturn) override value
  621. * @param [in] ptr SEI base address
  622. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  623. * @param [in] data revolution (multiturn) override value
  624. */
  625. static inline void sei_set_sample_rev_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  626. {
  627. ptr->CTRL[idx].POS.SMP_REV = data;
  628. }
  629. /**
  630. * @brief Set the SEI sample speed override value
  631. * @param [in] ptr SEI base address
  632. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  633. * @param [in] data speed override value
  634. */
  635. static inline void sei_set_sample_spd_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  636. {
  637. ptr->CTRL[idx].POS.SMP_SPD = data;
  638. }
  639. /**
  640. * @brief Set the SEI sample acceleration override value
  641. * @param [in] ptr SEI base address
  642. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  643. * @param [in] data acceleration override value
  644. */
  645. static inline void sei_set_sample_acc_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  646. {
  647. ptr->CTRL[idx].POS.SMP_ACC = data;
  648. }
  649. /**
  650. * @brief Set the SEI update position (singleturn) override value
  651. * @param [in] ptr SEI base address
  652. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  653. * @param [in] data position (singleturn) override value
  654. */
  655. static inline void sei_set_update_pos_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  656. {
  657. ptr->CTRL[idx].POS.UPD_POS = data;
  658. }
  659. /**
  660. * @brief Set the SEI update revolution (multiturn) override value
  661. * @param [in] ptr SEI base address
  662. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  663. * @param [in] data revolution (multiturn) override value
  664. */
  665. static inline void sei_set_update_rev_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  666. {
  667. ptr->CTRL[idx].POS.UPD_REV = data;
  668. }
  669. /**
  670. * @brief Set the SEI update speed override value
  671. * @param [in] ptr SEI base address
  672. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  673. * @param [in] data speed override value
  674. */
  675. static inline void sei_set_update_spd_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  676. {
  677. ptr->CTRL[idx].POS.UPD_SPD = data;
  678. }
  679. /**
  680. * @brief Set the SEI update acceleration override value
  681. * @param [in] ptr SEI base address
  682. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  683. * @param [in] data acceleration override value
  684. */
  685. static inline void sei_set_update_acc_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  686. {
  687. ptr->CTRL[idx].POS.UPD_ACC = data;
  688. }
  689. /**
  690. * @brief Set the SEI update time override value
  691. * @param [in] ptr SEI base address
  692. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  693. * @param [in] data time override value
  694. */
  695. static inline void sei_set_update_time_override_value(SEI_Type *ptr, uint8_t idx, uint32_t data)
  696. {
  697. ptr->CTRL[idx].POS.UPD_TIME = data;
  698. }
  699. /**
  700. * @brief Set the SEI irq match pointer0
  701. * @param [in] ptr SEI base address
  702. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  703. * @param [in] instr_idx match instr0 index
  704. */
  705. static inline void sei_set_irq_match_instr0_ptr(SEI_Type *ptr, uint8_t idx, uint8_t instr_idx)
  706. {
  707. ptr->CTRL[idx].IRQ.POINTER0 = SEI_CTRL_IRQ_POINTER0_POINTER_SET(instr_idx);
  708. }
  709. /**
  710. * @brief Set the SEI irq match pointer1
  711. * @param [in] ptr SEI base address
  712. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  713. * @param [in] instr_idx match instr1 index
  714. */
  715. static inline void sei_set_irq_match_instr1_ptr(SEI_Type *ptr, uint8_t idx, uint8_t instr_idx)
  716. {
  717. ptr->CTRL[idx].IRQ.POINTER1 = SEI_CTRL_IRQ_POINTER1_POINTER_SET(instr_idx);
  718. }
  719. /**
  720. * @brief Set the SEI irq match instr0
  721. * @param [in] ptr SEI base address
  722. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  723. * @param [in] instr_value match instr0 value
  724. */
  725. static inline void sei_set_irq_match_instr0_value(SEI_Type *ptr, uint8_t idx, uint32_t instr_value)
  726. {
  727. ptr->CTRL[idx].IRQ.INSTR0 = SEI_CTRL_IRQ_INSTR0_INSTR_SET(instr_value);
  728. }
  729. /**
  730. * @brief Set the SEI irq match instr1
  731. * @param [in] ptr SEI base address
  732. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  733. * @param [in] instr_value match instr1 value
  734. */
  735. static inline void sei_set_irq_match_instr1_value(SEI_Type *ptr, uint8_t idx, uint32_t instr_value)
  736. {
  737. ptr->CTRL[idx].IRQ.INSTR1 = SEI_CTRL_IRQ_INSTR1_INSTR_SET(instr_value);
  738. }
  739. /**
  740. * @brief Set the SEI irq enable or disable
  741. * @param [in] ptr SEI base address
  742. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  743. * @param [in] irq_mask irq mask, @ref sei_irq_event_t
  744. * @param [in] enable enable or disable
  745. * @arg true enable
  746. * @arg false disable
  747. */
  748. static inline void sei_set_irq_enable(SEI_Type *ptr, uint8_t idx, uint32_t irq_mask, bool enable)
  749. {
  750. if (enable) {
  751. ptr->CTRL[idx].IRQ.INT_EN |= irq_mask;
  752. } else {
  753. ptr->CTRL[idx].IRQ.INT_EN &= ~irq_mask;
  754. }
  755. }
  756. /**
  757. * @brief Get the SEI irq status
  758. * @param [in] ptr SEI base address
  759. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  760. * @param [in] irq_mask irq mask, @ref sei_irq_event_t
  761. *
  762. * @retval true-has irq req, false-no irq req.
  763. */
  764. static inline bool sei_get_irq_status(SEI_Type *ptr, uint8_t idx, uint32_t irq_mask)
  765. {
  766. return ((ptr->CTRL[idx].IRQ.INT_FLAG & irq_mask) == irq_mask) ? true : false;
  767. }
  768. /**
  769. * @brief Clear the SEI irq flag
  770. * @param [in] ptr SEI base address
  771. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  772. * @param [in] irq_mask irq mask, @ref sei_irq_event_t
  773. */
  774. static inline void sei_clear_irq_flag(SEI_Type *ptr, uint8_t idx, uint32_t irq_mask)
  775. {
  776. ptr->CTRL[idx].IRQ.INT_FLAG = irq_mask;
  777. }
  778. /**
  779. * @brief Init SEI tranceiver configuration
  780. * @param [in] ptr SEI base address
  781. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  782. * @param [in] config tranceiver configuration @ref sei_tranceiver_config_t
  783. * @retval API execution status
  784. */
  785. hpm_stat_t sei_tranceiver_config_init(SEI_Type *ptr, uint8_t idx, sei_tranceiver_config_t *config);
  786. /**
  787. * @brief Init SEI command or data format configuration
  788. * @param [in] ptr SEI base address
  789. * @param [in] cmd_data_select
  790. * @arg @ref SEI_SELECT_CMD select command
  791. * @arg @ref SEI_SELECT_DATA select data
  792. * @param [in] idx SEI ctrl index or data index, decided by cmd_data_select, such as SEI_CTRL_0, SEI_CTRL_1, SEI_DAT_2, SEI_DAT_3, etc.
  793. * @param [in] config command or data format configuration @ref sei_data_format_config_t
  794. * @retval API execution status
  795. */
  796. hpm_stat_t sei_cmd_data_format_config_init(SEI_Type *ptr, bool cmd_data_select, uint8_t idx, sei_data_format_config_t *config);
  797. /**
  798. * @brief Init SEI command table configuration
  799. * @param [in] ptr SEI base address
  800. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  801. * @param [in] table_idx command table index, 0 - 7
  802. * @param [in] config command table configuration @ref sei_command_table_config_t
  803. * @retval API execution status
  804. */
  805. hpm_stat_t sei_cmd_table_config_init(SEI_Type *ptr, uint8_t idx, uint8_t table_idx, sei_command_table_config_t *config);
  806. /**
  807. * @brief Init SEI state transition configuration
  808. * @param [in] ptr SEI base address
  809. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  810. * @param [in] latch_idx latch index
  811. * @arg SEI_LATCH_0
  812. * @arg SEI_LATCH_1
  813. * @arg SEI_LATCH_2
  814. * @arg SEI_LATCH_3
  815. * @param [in] state transition state
  816. * @arg SEI_CTRL_LATCH_TRAN_0_1
  817. * @arg SEI_CTRL_LATCH_TRAN_1_2
  818. * @arg SEI_CTRL_LATCH_TRAN_2_3
  819. * @arg SEI_CTRL_LATCH_TRAN_3_0
  820. * @param [in] config state transition configuration @ref sei_state_transition_config_t
  821. * @retval API execution status
  822. */
  823. hpm_stat_t sei_state_transition_config_init(SEI_Type *ptr, uint8_t idx, uint8_t latch_idx, uint8_t state, sei_state_transition_config_t *config);
  824. /**
  825. * @brief Init SEI state transition latch configuration
  826. * @param [in] ptr SEI base address
  827. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  828. * @param [in] latch_idx latch index
  829. * @arg SEI_LATCH_0
  830. * @arg SEI_LATCH_1
  831. * @arg SEI_LATCH_2
  832. * @arg SEI_LATCH_3
  833. * @param [in] config state transition latch configuration @ref sei_state_transition_latch_config_t
  834. * @retval API execution status
  835. */
  836. hpm_stat_t sei_state_transition_latch_config_init(SEI_Type *ptr, uint8_t idx, uint8_t latch_idx, sei_state_transition_latch_config_t *config);
  837. /**
  838. * @brief Init SEI sample configuration
  839. * @param [in] ptr SEI base address
  840. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  841. * @param [in] config sample configuration @ref sei_sample_config_t
  842. * @retval API execution status
  843. */
  844. hpm_stat_t sei_sample_config_init(SEI_Type *ptr, uint8_t idx, sei_sample_config_t *config);
  845. /**
  846. * @brief Init SEI update configuration
  847. * @param [in] ptr SEI base address
  848. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  849. * @param [in] config update configuration @ref sei_update_config_t
  850. * @retval API execution status
  851. */
  852. hpm_stat_t sei_update_config_init(SEI_Type *ptr, uint8_t idx, sei_update_config_t *config);
  853. /**
  854. * @brief Init SEI trigger input configuration
  855. * @param [in] ptr SEI base address
  856. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  857. * @param [in] config trigger input configuration @ref sei_trigger_input_config_t
  858. * @retval API execution status
  859. */
  860. hpm_stat_t sei_trigger_input_config_init(SEI_Type *ptr, uint8_t idx, sei_trigger_input_config_t *config);
  861. /**
  862. * @brief Init SEI trigger output configuration
  863. * @param [in] ptr SEI base address
  864. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  865. * @param [in] config trigger output configuration @ref sei_trigger_output_config_t
  866. * @retval API execution status
  867. */
  868. hpm_stat_t sei_trigger_output_config_init(SEI_Type *ptr, uint8_t idx, sei_trigger_output_config_t *config);
  869. /**
  870. * @brief Init SEI engine configuration
  871. * @param [in] ptr SEI base address
  872. * @param [in] idx SEI ctrl index, such as SEI_CTRL_0, SEI_CTRL_1, etc.
  873. * @param [in] config engine configuration @ref sei_engine_config_t
  874. * @retval API execution status
  875. */
  876. hpm_stat_t sei_engine_config_init(SEI_Type *ptr, uint8_t idx, sei_engine_config_t *config);
  877. /**
  878. * @brief Set SEI Intsructions
  879. * @param [in] ptr SEI base address
  880. * @param [in] idx SEI instruction index.
  881. * @param [in] op SEI instruction operation
  882. * @arg @ref SEI_INSTR_OP_HALT
  883. * @arg @ref SEI_INSTR_OP_JUMP
  884. * @arg @ref SEI_INSTR_OP_SEND_WDG
  885. * @arg @ref SEI_INSTR_OP_SEND
  886. * @arg @ref SEI_INSTR_OP_WAIT_WDG
  887. * @arg @ref SEI_INSTR_OP_WAIT
  888. * @arg @ref SEI_INSTR_OP_RECV_WDG
  889. * @arg @ref SEI_INSTR_OP_RECV
  890. * @param [in] ck SEI instruction clock
  891. * [1] synchronous master clock type
  892. * @arg @ref SEI_INSTR_M_CK_LOW
  893. * @arg @ref SEI_INSTR_M_CK_RISE_FALL
  894. * @arg @ref SEI_INSTR_M_CK_FALL_RISE
  895. * @arg @ref SEI_INSTR_M_CK_HIGH
  896. * [2] synchronous slave clock type
  897. * @arg @ref SEI_INSTR_S_CK_DEFAULT
  898. * @arg @ref SEI_INSTR_S_CK_TRX_EXCH
  899. * @arg @ref SEI_INSTR_S_CK_TIMEOUT_EN
  900. * @arg @ref SEI_INSTR_S_CK_TRX_EXCH_TIMEOUT_EN
  901. * @param [in] crc SEI instruction crc register, such as SEI_DAT_0, SEI_DAT_1, etc.
  902. * @param [in] data SEI instruction data register, such as SEI_DAT_0, SEI_DAT_1, etc.
  903. * @param [in] opr SEI instruction operand.
  904. * [1] When OP is SEI_INSTR_OP_HALT, opr is the halt time in baudrate, 0 represents infinite time.
  905. * [2] When OP is SEI_INSTR_OP_JUMP, opr is command table pointer, init pointer or wdg pointer.
  906. * @arg @ref SEI_JUMP_INIT_INSTR_IDX
  907. * @arg @ref SEI_JUMP_WDG_INSTR_IDX
  908. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX0
  909. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX1
  910. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX2
  911. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX3
  912. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX4
  913. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX5
  914. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX6
  915. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX7
  916. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX8
  917. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX9
  918. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX10
  919. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX11
  920. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX12
  921. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX13
  922. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX14
  923. * @arg @ref SEI_JUMP_CMD_TABLE_INSTR_IDX15
  924. * [3] Other OP, this area is the data length.
  925. */
  926. void sei_set_instr(SEI_Type *ptr, uint8_t idx, uint8_t op, uint8_t ck, uint8_t crc, uint8_t data, uint8_t opr);
  927. #if defined(__cplusplus)
  928. }
  929. #endif /* __cplusplus */
  930. #endif