InPlay API
hal_trig.h
1 #ifndef HAL_TRIG_HDL_H
2 #define HAL_TRIG_HDL_H
3 #include <stdint.h>
4 #include "in_mmap.h"
5 #include "in_compile.h"
6 #if !CFG_NO_OS
7 #include "cmsis_os.h"
8 #endif
9 
19 #define TRIG_ODC_MAX_OUTPUT_NUM 5
20 #define TRIG_MAX_ADDR_OFT 512
21 
22 
23 #define TRIG_SET_TMR_CMD_LEN 1
24 #define TRIG_WAIT_TMR_CMD_LEN 1
25 #define TRIG_REG_RD_COMP_CMD_LEN 4
26 #define TRIG_REG_WR_CMD_LEN 3
27 #define TRIG_REG_RD_MODIFY_WR_CMD_LEN 4
28 #define TRIG_REG_CP_CMD_LEN 3
29 #define TRIG_REG_MASK_CP_CMD_LEN 4
30 #define TRIG_OUTPUT_CMD_LEN 2
31 #define TRIG_NULL_CMD_LEN 1
32 
33 #define TRIG_HIGH_PRI_Q_MAX_TRIG_ID 8
34 #define TRIG_MID_PRI_Q_MAX_TRIG_ID 8
35 #define TRIG_LOW_PRI_Q_MAX_TRIG_ID 16
36 #define TRIG_HIGH_PRI_Q_CMD_START_ADDR TRIG_HIGH_PRI_Q_MAX_TRIG_ID
37 #define TRIG_MID_PRI_Q_CMD_START_ADDR TRIG_MID_PRI_Q_MAX_TRIG_ID
38 #define TRIG_LOW_PRI_Q_CMD_START_ADDR TRIG_LOW_PRI_Q_MAX_TRIG_ID
39 
40 
41 /* Interrupt status 0 */
42 #define TRIG_HP_INTR_CMD_COMPLETED 0x1
43 #define TRIG_HP_INTR_QUEUE_OV 0x2
44 #define TRIG_HP_INTR_QUEUE_EMPTY 0x4
45 #define TRIG_HP_INTR_INVALID_CMD 0x8
46 #define TRIG_HP_INTR_TIMER_TMO 0x10
47 #define TRIG_HP_INTR_TIMER_DONE 0x20
48 #define TRIG_HP_INTR_READ_COMPARE_FAIL 0x40
49 
50 #define TRIG_MP_INTR_CMD_COMPLETED 0x100
51 #define TRIG_MP_INTR_QUEUE_OV 0x200
52 #define TRIG_MP_INTR_QUEUE_EMPTY 0x400
53 #define TRIG_MP_INTR_INVALID_CMD 0x800
54 #define TRIG_MP_INTR_TIMER_TMO 0x1000
55 #define TRIG_MP_INTR_TIMER_DONE 0x2000
56 #define TRIG_MP_INTR_READ_COMPARE_FAIL 0x4000
57 
58 #define TRIG_LP_INTR_CMD_COMPLETED 0x10000
59 #define TRIG_LP_INTR_QUEUE_OV 0x20000
60 #define TRIG_LP_INTR_QUEUE_EMPTY 0x40000
61 #define TRIG_LP_INTR_INVALID_CMD 0x80000
62 #define TRIG_LP_INTR_TIMER_TMO 0x100000
63 #define TRIG_LP_INTR_TIMER_DONE 0x200000
64 #define TRIG_LP_INTR_READ_COMPARE_FAIL 0x400000
65 
66 /* Interrupt status 1 */
67 #define TRIG_HP_INTR_CMD_START 0x1
68 #define TRIG_HP_INTR_CMD_DONE 0x2
69 #define TRIG_MP_INTR_CMD_START 0x10
70 #define TRIG_MP_INTR_CMD_DONE 0x20
71 #define TRIG_LP_INTR_CMD_START 0x100
72 #define TRIG_LP_INTR_CMD_DONE 0x200
73 
74 
78 enum trig_err {
83 };
84 
88 enum trig_queue {
93 };
94 
149 };
150 
289  TRIG_SIG_SW0 = 252,
290  TRIG_SIG_SW1 = 253,
291  TRIG_SIG_SW2 = 254,
293 };
294 
317 };
318 
324 };
325 
332  TRIG_REG_4_BYTES = 2,
333 };
334 
341 };
342 
351 };
352 
374  TRIG_APB_MAX,
375 };
376 
380 typedef struct {
381  int irq_prio;
383  void (*irq_cb)(void *arg, uint32_t status0, uint32_t status1);
384  void* cb_arg;
385  uint32_t intr_unmask0;
386  uint32_t intr_unmask1;
387  uint32_t mp_mem_addr;
388  uint32_t lp_mem_addr;
389 } trig_init_t;
390 
394 typedef struct {
395  uint16_t cmd_addr;
396  uint16_t cmd_num;
397  uint8_t run_until_null;
399 } trig_hdr_t;
400 
404 typedef struct {
405  int odc_idx[TRIG_ODC_MAX_OUTPUT_NUM];
406  uint8_t init_value[TRIG_ODC_MAX_OUTPUT_NUM];
407  uint8_t value[TRIG_ODC_MAX_OUTPUT_NUM];
408  uint8_t toggle_en[TRIG_ODC_MAX_OUTPUT_NUM];
410 
414 typedef struct {
416  int init_src;
418  uint32_t init_value;
420 
424 typedef struct {
426  uint32_t target_time;
428 
432 typedef struct {
433  int cont_cmp;
434  int cmp_cond;
435  int reg_bus;
436  uint32_t fail_cmd_addr;
437  uint32_t wait_time;
438  uint32_t max_rd_num;
439  uint32_t reg_addr;
440  uint32_t mask;
441  uint32_t exp_value;
443 
447 typedef struct {
448  int reg_bus;
449  uint32_t write_value;
450  uint32_t reg_addr;
452 
456 typedef struct {
457  int reg_bus;
458  uint32_t write_value;
459  uint32_t reg_addr;
460  uint32_t mask;
462 
466 typedef struct {
467  int size;
468  int src_bus;
469  int dst_bus;
470  uint32_t src_addr;
471  uint32_t dst_addr;
473 
477 typedef struct {
478  int size;
479  int src_bus;
480  int dst_bus;
481  uint32_t src_addr;
482  uint32_t dst_addr;
483  uint32_t mask;
485 
489 typedef struct {
490  int sig_idx;
493 } trig_sig_t;
494 
495 
496 static INLINE uint32_t trig_intr_status(void)
497 {
498  return RD_WORD(TRIG_HANDLER_REGS_INTR_STATUS);
499 }
500 static INLINE void trig_intr_clear(uint32_t val)
501 {
502  WR_WORD(TRIG_HANDLER_REGS_INTR_CLEAR, val);
503 }
504 static INLINE void trig_intr_mask(uint32_t val)
505 {
506  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_SET, val);
507 }
508 static INLINE void trig_intr_unmask(uint32_t val)
509 {
510  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_CLEAR, val);
511 }
512 static INLINE uint32_t trig_intr_status1(void)
513 {
514  return RD_WORD(TRIG_HANDLER_REGS_INTR_STATUS_1);
515 }
516 static INLINE void trig_intr_clear1(uint32_t val)
517 {
518  WR_WORD(TRIG_HANDLER_REGS_INTR_CLEAR_1, val);
519  WR_WORD(TRIG_HANDLER_REGS_INTR_CLEAR, 0);
520  WR_WORD(TRIG_HANDLER_REGS_INTR_CLEAR_1, 0);
521 }
522 static INLINE void trig_intr_mask1(uint32_t val)
523 {
524  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_SET_1, val);
525  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_SET, 0);
526  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_SET_1, 0);
527 }
528 static INLINE void trig_intr_unmask1(uint32_t val)
529 {
530  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_CLEAR_1, val);
531  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_CLEAR, 0);
532  WR_WORD(TRIG_HANDLER_REGS_INTR_MASK_CLEAR_1, 0);
533 }
534 
535 
536 static INLINE void trig_en(int en)
537 {
538  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MISC_CTRL);
539  if (en) {
540  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_TRIG_HANDLER_EN;
541  } else {
542  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_TRIG_HANDLER_EN;
543  }
544  WR_WORD(TRIG_HANDLER_REGS_MISC_CTRL, reg);
545 }
546 static INLINE void trig_hp_queue_en(int en, int invalid_cmd)
547 {
548  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MISC_CTRL);
549  if (en) {
550  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_HP_QUEUE_EN;
551  } else {
552  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_HP_QUEUE_EN;
553  }
554  if (invalid_cmd) {
555  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_HP_INVALID_CMD_CONT;
556  } else {
557  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_HP_INVALID_CMD_CONT;
558  }
559  WR_WORD(TRIG_HANDLER_REGS_MISC_CTRL, reg);
560 }
561 static INLINE void trig_mp_queue_en(int en, int invalid_cmd)
562 {
563  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MISC_CTRL);
564  if (en) {
565  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_MP_QUEUE_EN;
566  } else {
567  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_MP_QUEUE_EN;
568  }
569  if (invalid_cmd) {
570  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_MP_INVALID_CMD_CONT;
571  } else {
572  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_MP_INVALID_CMD_CONT;
573  }
574  WR_WORD(TRIG_HANDLER_REGS_MISC_CTRL, reg);
575 }
576 static INLINE void trig_lp_queue_en(int en, int invalid_cmd)
577 {
578  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MISC_CTRL);
579  if (en) {
580  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_LP_QUEUE_EN;
581  } else {
582  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_LP_QUEUE_EN;
583  }
584  if (invalid_cmd) {
585  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_LP_INVALID_CMD_CONT;
586  } else {
587  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_LP_INVALID_CMD_CONT;
588  }
589  WR_WORD(TRIG_HANDLER_REGS_MISC_CTRL, reg);
590 }
591 static INLINE void trig_dedmem_sw_access_en(int en)
592 {
593  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MISC_CTRL);
594  if (en) {
595  reg |= TRIG_HANDLER_REGS_MISC_CTRL_CTL_DEDM_SW_ACCESS_EN;
596  } else {
597  reg &=~TRIG_HANDLER_REGS_MISC_CTRL_CTL_DEDM_SW_ACCESS_EN;
598  }
599  WR_WORD(TRIG_HANDLER_REGS_MISC_CTRL, reg);
600 }
601 static INLINE void trig_dedmem_wr_init_addr(uint32_t addr)
602 {
603  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_DEDM_INI_ADDR);
604  reg &= ~TRIG_HANDLER_REGS_DEDM_INI_ADDR_CTL_DEDM_WR_INI_ADDR;
605  reg |= (addr&TRIG_HANDLER_REGS_DEDM_INI_ADDR_CTL_DEDM_WR_INI_ADDR_MASK)<<TRIG_HANDLER_REGS_DEDM_INI_ADDR_CTL_DEDM_WR_INI_ADDR_SHIFT;
606  WR_WORD(TRIG_HANDLER_REGS_DEDM_INI_ADDR, addr);
607 }
608 static INLINE void trig_dedmem_rd_init_addr(uint32_t addr)
609 {
610  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_DEDM_INI_ADDR);
611  reg &= ~TRIG_HANDLER_REGS_DEDM_INI_ADDR_CTL_DEDM_RD_INI_ADDR;
612  reg |= (addr&TRIG_HANDLER_REGS_DEDM_INI_ADDR_CTL_DEDM_RD_INI_ADDR_MASK)<<TRIG_HANDLER_REGS_DEDM_INI_ADDR_CTL_DEDM_RD_INI_ADDR_SHIFT;
613  WR_WORD(TRIG_HANDLER_REGS_DEDM_INI_ADDR, addr);
614 }
615 static INLINE void trig_dedmem_wr_data(uint32_t data)
616 {
617  WR_WORD(TRIG_HANDLER_REGS_DEDM_WDATA, data);
618 }
619 static INLINE uint32_t trig_dedmem_rd_data(void)
620 {
621  return RD_WORD(TRIG_HANDLER_REGS_DEDM_RDATA);
622 }
623 static INLINE void trig_sw_trig(int en, uint32_t sw_id)
624 {
625  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_SW_TRIG);
626  if (en) {
627  reg |= 1<<sw_id;
628  } else {
629  reg &= ~(1<<sw_id);
630  }
631  WR_WORD(TRIG_HANDLER_REGS_SW_TRIG, reg);
632 }
633 static INLINE void trig_set_lp_mem_addr(uint32_t addr_offset)
634 {
635  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET);
636  reg &= ~TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_LP_MEM_ADDR_OFFSET;
637  reg |= (addr_offset & TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_LP_MEM_ADDR_OFFSET_MASK)<<TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_LP_MEM_ADDR_OFFSET_SHIFT;
638  WR_WORD(TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET, reg);
639 }
640 static INLINE void trig_set_mp_mem_addr(uint32_t addr_offset)
641 {
642  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET);
643  reg &= ~TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_MP_MEM_ADDR_OFFSET;
644  reg |= (addr_offset & TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_MP_MEM_ADDR_OFFSET_MASK)<<TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_MP_MEM_ADDR_OFFSET_SHIFT;
645  WR_WORD(TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET, reg);
646 }
647 static INLINE uint32_t trig_get_lp_mem_addr(void)
648 {
649  return (RD_WORD(TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET)>>TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_LP_MEM_ADDR_OFFSET_SHIFT)&TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_LP_MEM_ADDR_OFFSET_MASK;
650 }
651 static INLINE uint32_t trig_get_mp_mem_addr(void)
652 {
653  return (RD_WORD(TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET)>>TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_MP_MEM_ADDR_OFFSET_SHIFT)&TRIG_HANDLER_REGS_MP_LP_MEM_ADDR_OFFSET_CTL_MP_MEM_ADDR_OFFSET_MASK;
654 }
655 static INLINE void trig_hp_trig_idx(uint8_t trig_id, uint8_t sig_idx)
656 {
657  uint32_t addr, reg, shift;
658  if (trig_id/4)
659  addr = TRIG_HANDLER_REGS_HP_TRIG_IDX_GROUP_1;
660  else
661  addr = TRIG_HANDLER_REGS_HP_TRIG_IDX_GROUP_0;
662  shift = (trig_id%4)*8;
663  reg = RD_WORD(addr);
664  reg &= ~(0xFF<<shift);
665  reg |= sig_idx<<shift;
666  WR_WORD(addr, reg);
667 }
668 static INLINE void trig_mp_trig_idx(uint8_t trig_id, uint8_t sig_idx)
669 {
670  uint32_t addr, reg, shift;
671  if (trig_id/4)
672  addr = TRIG_HANDLER_REGS_MP_TRIG_IDX_GROUP_1;
673  else
674  addr = TRIG_HANDLER_REGS_MP_TRIG_IDX_GROUP_0;
675  shift = (trig_id%4)*8;
676  reg = RD_WORD(addr);
677  reg &= ~(0xFF<<shift);
678  reg |= sig_idx<<shift;
679  WR_WORD(addr, reg);
680 }
681 static INLINE void trig_lp_trig_idx(uint8_t trig_id, uint8_t sig_idx)
682 {
683  uint32_t addr, reg, shift;
684  uint8_t group = trig_id/4;
685  if (group == 1)
686  addr = TRIG_HANDLER_REGS_LP_TRIG_IDX_GROUP_1;
687  else if (group == 2)
688  addr = TRIG_HANDLER_REGS_LP_TRIG_IDX_GROUP_2;
689  else if (group == 3)
690  addr = TRIG_HANDLER_REGS_LP_TRIG_IDX_GROUP_3;
691  else
692  addr = TRIG_HANDLER_REGS_LP_TRIG_IDX_GROUP_0;
693  shift = (trig_id%4)*8;
694  reg = RD_WORD(addr);
695  reg &= ~(0xFF<<shift);
696  reg |= sig_idx<<shift;
697  WR_WORD(addr, reg);
698 }
699 static INLINE void trig_hp_rising_edge_en(uint8_t trig_id, int en)
700 {
701  if (en) {
702  WR_WORD(TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_SET_CTL_HP_TRIG_RISE_EDGE_EN_SET_SHIFT));
703  } else {
704  WR_WORD(TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_SET_CTL_HP_TRIG_RISE_EDGE_EN_SET_SHIFT));
705  }
706 }
707 static INLINE void trig_mp_rising_edge_en(uint8_t trig_id, int en)
708 {
709  if (en) {
710  WR_WORD(TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR_CTL_MP_TRIG_RISE_EDGE_EN_CLR_SHIFT));
711  } else {
712  WR_WORD(TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR_CTL_MP_TRIG_RISE_EDGE_EN_CLR_SHIFT));
713  }
714 }
715 static INLINE void trig_lp_rising_edge_en(uint8_t trig_id, int en)
716 {
717  if (en) {
718  WR_WORD(TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR_CTL_LP_TRIG_RISE_EDGE_EN_CLR_SHIFT));
719  } else {
720  WR_WORD(TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_RISE_EDGE_EN_CLR_CTL_LP_TRIG_RISE_EDGE_EN_CLR_SHIFT));
721  }
722 }
723 static INLINE void trig_hp_falling_edge_en(uint8_t trig_id, int en)
724 {
725  if (en) {
726  WR_WORD(TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET_CTL_HP_TRIG_FALL_EDGE_EN_SET_SHIFT));
727  } else {
728  WR_WORD(TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET_CTL_HP_TRIG_FALL_EDGE_EN_SET_SHIFT));
729  }
730 }
731 static INLINE void trig_mp_falling_edge_en(uint8_t trig_id, int en)
732 {
733  if (en) {
734  WR_WORD(TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET_CTL_MP_TRIG_FALL_EDGE_EN_SET_SHIFT));
735  } else {
736  WR_WORD(TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET_CTL_MP_TRIG_FALL_EDGE_EN_SET_SHIFT));
737  }
738 }
739 static INLINE void trig_lp_falling_edge_en(uint8_t trig_id, int en)
740 {
741  if (en) {
742  WR_WORD(TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET_CTL_LP_TRIG_FALL_EDGE_EN_SET_SHIFT));
743  } else {
744  WR_WORD(TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET, 1<<(trig_id+TRIG_HANDLER_REGS_TRIG_FALL_EDGE_EN_SET_CTL_LP_TRIG_FALL_EDGE_EN_SET_SHIFT));
745  }
746 }
747 
748 static INLINE void trig_ctl_gpio_out_0(int en, uint32_t idx)
749 {
750  uint32_t reg = RD_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OUT_0);
751  if (en) {
752  reg |= 1<<idx;
753  } else {
754  reg &= ~(1<<idx);
755  }
756  WR_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OUT_0, reg);
757 }
758 static INLINE void trig_ctl_gpio_out_1(int en, uint32_t idx)
759 {
760  uint32_t reg = RD_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OUT_1);
761  if (en) {
762  reg |= 1<<idx;
763  } else {
764  reg &= ~(1<<idx);
765  }
766  WR_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OUT_1, reg);
767 }
768 static INLINE void trig_ctl_gpio_oe_0(int en, uint32_t idx)
769 {
770  uint32_t reg = RD_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OE_0);
771  if (en) {
772  reg |= 1<<idx;
773  } else {
774  reg &= ~(1<<idx);
775  }
776  WR_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OE_0, reg);
777 }
778 static INLINE void trig_ctl_gpio_oe_1(int en, uint32_t idx)
779 {
780  uint32_t reg = RD_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OE_1);
781  if (en) {
782  reg |= 1<<idx;
783  } else {
784  reg &= ~(1<<idx);
785  }
786  WR_WORD(GLOBAL2_REG_TRIG_HANDLR_CTL_GPIO_OE_1, reg);
787 }
788 
789 
790 static INLINE void trig_hdl_apb_mux(uint32_t pos, uint32_t val)
791 {
792  uint32_t reg = RD_WORD(GLOBAL2_REG_TRIG_HANDLR_APB_MASTER_MUX_CTRL);
793  if (val) {
794  reg |= 1<<pos;
795  } else {
796  reg &= ~(1<<pos);
797  }
798  WR_WORD(GLOBAL2_REG_TRIG_HANDLR_APB_MASTER_MUX_CTRL, reg);
799 }
800 
801 static INLINE void trig_hp_tmr_init_tick(uint32_t val)
802 {
803  WR_WORD(TRIG_HANDLER_REGS_HP_INI_TIMER_VALUE, val);
804 }
805 
806 static INLINE void trig_mp_tmr_init_tick(uint32_t val)
807 {
808  WR_WORD(TRIG_HANDLER_REGS_MP_INI_TIMER_VALUE, val);
809 }
810 
811 static INLINE void trig_lp_tmr_init_tick(uint32_t val)
812 {
813  WR_WORD(TRIG_HANDLER_REGS_LP_INI_TIMER_VALUE, val);
814 }
815 
816 static INLINE void trig_hp_tmr_reload_tick(uint32_t val)
817 {
818  WR_WORD(TRIG_HANDLER_REGS_HP_RELOAD_TIMER_VALUE, val);
819 }
820 
821 static INLINE void trig_mp_tmr_reload_tick(uint32_t val)
822 {
823  WR_WORD(TRIG_HANDLER_REGS_MP_RELOAD_TIMER_VALUE, val);
824 }
825 
826 static INLINE void trig_lp_tmr_reload_tick(uint32_t val)
827 {
828  WR_WORD(TRIG_HANDLER_REGS_LP_RELOAD_TIMER_VALUE, val);
829 }
830 
831 static INLINE void trig_apb_mux(uint32_t pos, int apb_sel)
832 {
833  uint32_t reg = RD_WORD(GLOBAL2_REG_TRIG_HANDLR_APB_MASTER_MUX_CTRL);
834  if (apb_sel) {
835  reg |= 1<<pos;
836  } else {
837  reg &= ~(1<<pos);
838  }
839  WR_WORD(GLOBAL2_REG_TRIG_HANDLR_APB_MASTER_MUX_CTRL, reg);
840 }
841 
842 static INLINE void trig_odc_init_val(uint32_t sig0, uint32_t val0, uint32_t sig1, uint32_t val1)
843 {
844  uint32_t reg;
845  reg = ((sig0&TRIG_HANDLER_REGS_ODC_INI_VAL_CTL_ODC_IDX_0_MASK)<<TRIG_HANDLER_REGS_ODC_INI_VAL_CTL_ODC_IDX_0_SHIFT)
846  | ((val0&0x1)<<15)
847  | ((sig1&TRIG_HANDLER_REGS_ODC_INI_VAL_CTL_ODC_IDX_1_MASK)<<TRIG_HANDLER_REGS_ODC_INI_VAL_CTL_ODC_IDX_1_SHIFT)
848  | ((val1&0x1)<<31);
849  WR_WORD(TRIG_HANDLER_REGS_ODC_INI_VAL, reg);
850 }
851 
852 static INLINE void trig_hp_intr_sig(uint8_t sig)
853 {
854  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX);
855  reg &= ~TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_HP_SPECIFIED_TRIG_IDX;
856  reg |= (sig&TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_HP_SPECIFIED_TRIG_IDX_MASK)<<TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_HP_SPECIFIED_TRIG_IDX_SHIFT;
857  WR_WORD(TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX, reg);
858 }
859 static INLINE void trig_mp_intr_sig(uint8_t sig)
860 {
861  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX);
862  reg &= ~TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_MP_SPECIFIED_TRIG_IDX;
863  reg |= (sig&TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_MP_SPECIFIED_TRIG_IDX_MASK)<<TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_MP_SPECIFIED_TRIG_IDX_SHIFT;
864  WR_WORD(TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX, reg);
865 }
866 static INLINE void trig_lp_intr_sig(uint8_t sig)
867 {
868  uint32_t reg = RD_WORD(TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX);
869  reg &= ~TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_LP_SPECIFIED_TRIG_IDX;
870  reg |= (sig&TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_LP_SPECIFIED_TRIG_IDX_MASK)<<TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX_CTL_LP_SPECIFIED_TRIG_IDX_SHIFT;
871  WR_WORD(TRIG_HANDLER_REGS_SPECIFIED_TRIG_IDX, reg);
872 }
880 int hal_trig_open(trig_init_t *init);
881 
888 void hal_trig_close(void);
889 
902 int hal_trig_set_mem_addr(int queue, uint32_t mem_addr);
903 
913 int hal_trig_queue_enable(int queue);
914 
924 int hal_trig_queue_disable(int queue);
925 
937 int hal_trig_wr_header(int queue, int trig_id, trig_hdr_t *hdr);
938 
951 int hal_trig_output_cmd(int queue, uint32_t addr_offset, trig_output_cmd_t* cmd, uint32_t *cmd_addr_oft);
952 
965 int hal_trig_set_tmr_cmd(int queue, uint32_t addr_offset, trig_set_tmr_cmd_t* cmd, uint32_t *cmd_addr_oft);
966 
979 int hal_trig_wait_tmr_cmd(int queue, uint32_t addr_offset, trig_wait_tmr_cmd_t* cmd, uint32_t *cmd_addr_oft);
980 
993 int hal_trig_reg_rd_cmp_cmd(int queue, uint32_t addr_offset, trig_reg_rd_cmp_cmd_t* cmd, uint32_t *cmd_addr_oft);
994 
1007 int hal_trig_reg_wr_cmd(int queue, uint32_t addr_offset, trig_reg_wr_cmd_t* cmd, uint32_t *cmd_addr_oft);
1008 
1021 int hal_trig_reg_rw_cmd(int queue, uint32_t addr_offset, trig_reg_rw_cmd_t* cmd, uint32_t *cmd_addr_oft);
1022 
1035 int hal_trig_reg_copy_cmd(int queue, uint32_t addr_offset, trig_reg_cp_cmd_t* cmd, uint32_t *cmd_addr_oft);
1036 
1049 int hal_trig_reg_mask_copy_cmd(int queue, uint32_t addr_offset, trig_reg_mask_cp_cmd_t* cmd, uint32_t *cmd_addr_oft);
1050 
1051 
1063 int hal_trig_set_sig(int queue, int trig_id, trig_sig_t* sig);
1064 
1077 int hal_trig_odc_gpio_output_en(int port, int pin, int en);
1078 
1092 int hal_trig_odc_gpio_oen_en(int port, int pin, int en);
1103 int hal_trig_odc_gpio_output_idx(int port, int pin);
1104 
1115 int hal_trig_odc_gpio_oen_idx(int port, int pin);
1126 int hal_trig_sig_gpio_input_idx(int port, int pin);
1127 
1138 int hal_trig_sig_gpio_ie_oe_idx(int port, int pin);
1139 
1150 int hal_trig_sig_gpio_output_idx(int port, int pin);
1151 
1163 int hal_trig_null_cmd(int queue, uint32_t addr_offset, uint32_t *cmd_addr_oft);
1164 
1175 uint32_t hal_trig_curr_cmd_addr(int queue);
1176 
1188 int hal_trig_sig_gpio_ie_oe(int port, int pin, int oe);
1189 
1200 int hal_trig_sig_ble_irq(int idx, uint8_t irq_signal);
1201 
1212 int hal_trig_sig_cpu_irq(int idx, uint8_t irq_num);
1213 
1224 int hal_trig_tmr_init_tick(int queue, uint32_t init_val);
1235 int hal_trig_tmr_reload_tick(int queue, uint32_t reload_val);
1236 
1247 int hal_trig_apb_mux(int peripheral, int bus_sel);
1248 
1257 void hal_trig_resume(void);
1258 
1267 int hal_trig_intr_sig(int queue, int trig_sig);
1269 
1270 #endif
Front end TX enable.
Definition: hal_trig.h:204
I2C1 register APB mux.
Definition: hal_trig.h:110
int auto_resume
1: auto resume, 0: mannual resume,should call hal_trig_resume to resume trigger.
Definition: hal_trig.h:382
int size
Copye size, enum trig_reg_cp_len_t.
Definition: hal_trig.h:467
AON timer 1 timeout IRQ.
Definition: hal_trig.h:241
TRX sequencer TX enable GPIO A.
Definition: hal_trig.h:171
System tick aon timer start ack signal.
Definition: hal_trig.h:246
TRX sequencer register.
Definition: hal_trig.h:370
int hal_trig_reg_wr_cmd(int queue, uint32_t addr_offset, trig_reg_wr_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger register write command.
Start of Sync sequence Tx in IPMAC.
Definition: hal_trig.h:220
Snapshot IPMAC timestamp counter(superframe + 24bit free running counter)
Definition: hal_trig.h:135
Snapshot trigger handler low priority queue timer.
Definition: hal_trig.h:140
trig_sig_idx
trigger signal index
Definition: hal_trig.h:154
IPMAC free running IRQ 1.
Definition: hal_trig.h:189
BLE IRQ signal 1, set irq signal with hal_trig_sig_ble_irq.
Definition: hal_trig.h:227
AGC too high.
Definition: hal_trig.h:211
uint32_t mp_mem_addr
Mid priority queue mem address offset. Unit is word, not byte.
Definition: hal_trig.h:387
AON timer 0 timeout IRQ.
Definition: hal_trig.h:240
Timer 0 emit 7 signal.
Definition: hal_trig.h:267
GPIO output base index, hal_trig_sig_gpio_output_idx.
Definition: hal_trig.h:156
IPMAC frame start.
Definition: hal_trig.h:213
Master SPI1 register APB mux.
Definition: hal_trig.h:115
Timer 6(addtional timer 0) emit 7 signal.
Definition: hal_trig.h:185
Modem sync found.
Definition: hal_trig.h:208
CPU in lockup.
Definition: hal_trig.h:232
End of TX IRQ.
Definition: hal_trig.h:309
AON timer 2 capture signal 0 captured.
Definition: hal_trig.h:258
int stop_timer
1 Stop timer, 0:Don&#39;t stop timer
Definition: hal_trig.h:425
Timer 1 timeout IRQ.
Definition: hal_trig.h:251
Timer 0 emit 2 signal.
Definition: hal_trig.h:262
uint32_t intr_unmask0
Interrupt unmask 0,.
Definition: hal_trig.h:385
I2C1.
Definition: hal_trig.h:363
Timer 0 emit 8 signal.
Definition: hal_trig.h:158
Timer 3 timeout IRQ.
Definition: hal_trig.h:253
Not equal.
Definition: hal_trig.h:348
Max queue.
Definition: hal_trig.h:92
Timer 6(addtional timer 0) emit 9 signal.
Definition: hal_trig.h:187
uint32_t hal_trig_curr_cmd_addr(int queue)
Get current command address. This address is used for next command. It is word address offset...
uint32_t lp_mem_addr
Low priority queue mem address offset. Unit is word, not byte.
Definition: hal_trig.h:388
System tick signal.
Definition: hal_trig.h:274
BLE TX enable.
Definition: hal_trig.h:198
Larger.
Definition: hal_trig.h:349
Timestamp target IRQ.
Definition: hal_trig.h:302
uint32_t write_value
Write value.
Definition: hal_trig.h:449
Snapshot timer 8(additional timer 2)
Definition: hal_trig.h:144
Sync found signal outside of sync window.
Definition: hal_trig.h:201
Global register.
Definition: hal_trig.h:366
External input WLAN TX signal.
Definition: hal_trig.h:206
int hal_trig_tmr_init_tick(int queue, uint32_t init_val)
Set trigger timer initial tick value to register.
int hal_trig_reg_copy_cmd(int queue, uint32_t addr_offset, trig_reg_cp_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger register copy and write command.
BLE deep sleep enable.
Definition: hal_trig.h:223
I2C0.
Definition: hal_trig.h:362
TRX sequencer RX enable GPIO.
Definition: hal_trig.h:170
uint32_t write_value
Write value.
Definition: hal_trig.h:458
Half slot IRQ.
Definition: hal_trig.h:311
Timer 1 emit 0 signal.
Definition: hal_trig.h:160
trigger set timer command parameter
Definition: hal_trig.h:414
CPU in halt.
Definition: hal_trig.h:231
CPU IRQ signal 6, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:282
Snapshot timer 5.
Definition: hal_trig.h:134
int hal_trig_reg_rd_cmp_cmd(int queue, uint32_t addr_offset, trig_reg_rd_cmp_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger register read and compare command.
Timer 0 emit 9 signal.
Definition: hal_trig.h:159
Snapshot timer 1.
Definition: hal_trig.h:130
Sync found signal in sync window.
Definition: hal_trig.h:200
void * cb_arg
Callback args.
Definition: hal_trig.h:384
uint32_t target_time
Target time.
Definition: hal_trig.h:426
GPIO ie/oe base index. To set oe or ie, hal_trig_sig_gpio_ie_oe.
Definition: hal_trig.h:157
Snapshot timer 2.
Definition: hal_trig.h:131
Snapshot timer 9(additional timer 3)
Definition: hal_trig.h:145
int reg_bus
Register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:457
trig_reg_cp_len_t
trigger register copy length
Definition: hal_trig.h:329
IPMAC free running us tick.
Definition: hal_trig.h:195
void hal_trig_close(void)
Close Trig device.
BLE IRQ signal 0, set irq signal with hal_trig_sig_ble_irq.
Definition: hal_trig.h:226
uint32_t mask
Register read mask.
Definition: hal_trig.h:440
int hal_trig_wr_header(int queue, int trig_id, trig_hdr_t *hdr)
Write trig header.
MPLL locked.
Definition: hal_trig.h:273
trig_timer_val_t
trigger timer value
Definition: hal_trig.h:321
Scheduler FSM timeout IRQ.
Definition: hal_trig.h:316
int reg_bus
Register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:448
Copy 1 byte.
Definition: hal_trig.h:330
Timer 6(addtional timer 0) timeout IRQ.
Definition: hal_trig.h:174
Timer 1 emit 8 signal.
Definition: hal_trig.h:168
Snapshot AON timer 2.
Definition: hal_trig.h:126
uint32_t init_value
initial value
Definition: hal_trig.h:418
unused index
Definition: hal_trig.h:148
int irq_prio
Trig interrupt priority.
Definition: hal_trig.h:381
End of sleep IRQ.
Definition: hal_trig.h:308
ADC.
Definition: hal_trig.h:365
I2C0 register APB mux.
Definition: hal_trig.h:111
Timer 1 emit 5 signal.
Definition: hal_trig.h:165
CPU IRQ signal 7, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:283
Master SPI1.
Definition: hal_trig.h:358
Event scheduler main FSM timeout IRQ.
Definition: hal_trig.h:312
Error IRQ.
Definition: hal_trig.h:303
int hal_trig_sig_gpio_ie_oe(int port, int pin, int oe)
Set trigger signal for GPIO ie/oe.
uint8_t run_until_invalid
Run until invalid command.
Definition: hal_trig.h:398
PD1 Watch dog reset.
Definition: hal_trig.h:196
Middle priority queue.
Definition: hal_trig.h:90
uint32_t wait_time
Wait time, 0 ~ 255.
Definition: hal_trig.h:437
Timer 0 emit 3 signal.
Definition: hal_trig.h:263
int hal_trig_odc_gpio_output_idx(int port, int pin)
Get GPIO output index for trigger ODC index.
End of RX IRQ.
Definition: hal_trig.h:310
trig_apb_mux_t
trigger apb bus mux
Definition: hal_trig.h:356
int reload_src
1: reload value from register, 0: reload value is same as init_value.
Definition: hal_trig.h:417
Snapshot timer 3.
Definition: hal_trig.h:132
trigger handler parameter
Definition: hal_trig.h:394
Timer 0 emit 6 signal.
Definition: hal_trig.h:266
BLE or IPMAC in sync search mode.
Definition: hal_trig.h:209
Input osc_en from PD0.
Definition: hal_trig.h:222
uint32_t fail_cmd_addr
Fail command address, 0 ~ 255, word address.
Definition: hal_trig.h:436
Timer 0 emit 4 signal.
Definition: hal_trig.h:264
Global register APB mux.
Definition: hal_trig.h:106
Timer register APB mux.
Definition: hal_trig.h:109
End of event IRQ.
Definition: hal_trig.h:306
trig_ble_irq_t
BLE IRQ signal.
Definition: hal_trig.h:298
AON timer 2 emit 1 signal.
Definition: hal_trig.h:257
CPU IRQ signal 3, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:279
IPMAC slave in sync.
Definition: hal_trig.h:190
CPLL reset.
Definition: hal_trig.h:268
TRX sequencer general-purpose toggle signal, check register 0x46a04034 to 0x46a040FC.
Definition: hal_trig.h:173
Timer 1 emit 4 signal.
Definition: hal_trig.h:164
Trigger timer use register initial/reload value.
Definition: hal_trig.h:323
int init_src
1: initial value from register, 0: initial value from init_value.
Definition: hal_trig.h:416
trigger register read and write command parameter
Definition: hal_trig.h:456
Timer 0 emit 5 signal.
Definition: hal_trig.h:265
int hal_trig_set_mem_addr(int queue, uint32_t mem_addr)
Set share mem word address.
Slave SPI.
Definition: hal_trig.h:359
Start of preamble Tx in IPMAC.
Definition: hal_trig.h:221
uint32_t exp_value
Expected value.
Definition: hal_trig.h:441
int hal_trig_output_cmd(int queue, uint32_t addr_offset, trig_output_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger output direct control command.
uint32_t reg_addr
Register address.
Definition: hal_trig.h:439
Timer 0 timeout IRQ.
Definition: hal_trig.h:250
int hal_trig_set_sig(int queue, int trig_id, trig_sig_t *sig)
Set trig signal.
Copy 2 bytes.
Definition: hal_trig.h:331
PA reached target gain.
Definition: hal_trig.h:234
Snapshot timer 7(additional timer 1)
Definition: hal_trig.h:143
TRX register.
Definition: hal_trig.h:371
int hal_trig_queue_enable(int queue)
Enable trig queue.
PA off.
Definition: hal_trig.h:235
AON watch dog timer timeout IRQ.
Definition: hal_trig.h:244
Snapshot BLE baseband counter(CLKN and fine)
Definition: hal_trig.h:127
int falling_edge
1:enable falling edge, 0:disable falling edge
Definition: hal_trig.h:492
int src_bus
Source register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:479
int hal_trig_open(trig_init_t *init)
Open Trig device.
Enable RX I/Q capture.
Definition: hal_trig.h:123
int dst_bus
Destination register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:480
int sig_idx
Trig signal index.
Definition: hal_trig.h:490
IPMAC slave tx done.
Definition: hal_trig.h:216
IPMAC background scan start.
Definition: hal_trig.h:192
uint32_t dst_addr
Destination register address.
Definition: hal_trig.h:471
Timer 6(addtional timer 0) emit 2 signal.
Definition: hal_trig.h:180
GPIO oen base index, hal_trig_odc_gpio_oen_idx.
Definition: hal_trig.h:100
IPMAC in suspend.
Definition: hal_trig.h:229
trigger register write command parameter
Definition: hal_trig.h:447
Software IRQ.
Definition: hal_trig.h:299
Timer 9(addtional timer 3) timeout IRQ.
Definition: hal_trig.h:177
uint32_t reg_addr
Register address.
Definition: hal_trig.h:450
trigger condition parameter
Definition: hal_trig.h:489
Timer 1 emit 9 signal.
Definition: hal_trig.h:169
Memory overflow.
Definition: hal_trig.h:81
External input WLAN RX signal.
Definition: hal_trig.h:207
Snapshot IPMAC counter(superframe, duration, and fine)
Definition: hal_trig.h:128
Snapshot timer 0.
Definition: hal_trig.h:129
Fine target timer IRQ.
Definition: hal_trig.h:300
trigger direct output command parameter
Definition: hal_trig.h:404
Share memory register.
Definition: hal_trig.h:369
int hal_trig_intr_sig(int queue, int trig_sig)
Set trigger signal for interrupt status 1, TRIG_HP_INTR_CMD_START.
uint32_t max_rd_num
Max number of read allowed, 0 ~ 255, 0 is forever.
Definition: hal_trig.h:438
MPLL reset.
Definition: hal_trig.h:271
Less.
Definition: hal_trig.h:350
Wake up source ready signal.
Definition: hal_trig.h:249
uint32_t intr_unmask1
Interrupt unmask 1,.
Definition: hal_trig.h:386
trig_err
trigger error code
Definition: hal_trig.h:78
int hal_trig_odc_gpio_oen_en(int port, int pin, int en)
Enable GPIO OE for trigger ODC output.
int cmp_cond
Compare condition, enum trig_reg_comp_cond_t.
Definition: hal_trig.h:434
2M data rate
Definition: hal_trig.h:202
Timer 4 timeout IRQ.
Definition: hal_trig.h:254
Timer 1 emit 3 signal.
Definition: hal_trig.h:163
GPIO input base index, hal_trig_sig_gpio_input_idx.
Definition: hal_trig.h:155
ADC register APB mux.
Definition: hal_trig.h:108
uint32_t dst_addr
Destination register address.
Definition: hal_trig.h:482
Timer additional register(timer6 ~ timer9)
Definition: hal_trig.h:373
Event FSM CLKN miss IRQ.
Definition: hal_trig.h:313
Snapshot BLE timestamp counter(27 bits)
Definition: hal_trig.h:136
uint16_t cmd_num
Command number.
Definition: hal_trig.h:396
IPMAC background scan channel done.
Definition: hal_trig.h:193
BLE CLKN matched(value 0)
Definition: hal_trig.h:284
BLE CLKN matched(value 1)
Definition: hal_trig.h:285
Equal.
Definition: hal_trig.h:347
AON timer 2 emit 0 signal.
Definition: hal_trig.h:256
Trigger handler APB mux.
Definition: hal_trig.h:105
High priority queue.
Definition: hal_trig.h:89
int hal_trig_wait_tmr_cmd(int queue, uint32_t addr_offset, trig_wait_tmr_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger wait timer command.
PWM.
Definition: hal_trig.h:368
IPMAC master tx done.
Definition: hal_trig.h:217
CPLL enable.
Definition: hal_trig.h:269
int hal_trig_null_cmd(int queue, uint32_t addr_offset, uint32_t *cmd_addr_oft)
Null command.
PA 2.4G enable.
Definition: hal_trig.h:203
TRX sequencer TX enable GPIO B.
Definition: hal_trig.h:172
uint32_t mask
Mask.
Definition: hal_trig.h:460
trigger wait timer command parameter
Definition: hal_trig.h:424
Trigger timer use command initial/reload value.
Definition: hal_trig.h:322
Timer 0 emit 0 signal.
Definition: hal_trig.h:260
Timer 5 timeout IRQ.
Definition: hal_trig.h:255
int reg_bus
Register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:435
uint32_t mask
Mask.
Definition: hal_trig.h:483
TRX sequencer register APB MUX.
Definition: hal_trig.h:102
TRX register APB mux.
Definition: hal_trig.h:101
Snapshot system tick counter (coarse and fine)
Definition: hal_trig.h:137
Timer 6(addtional timer 0) emit 0 signal.
Definition: hal_trig.h:178
int hal_trig_set_tmr_cmd(int queue, uint32_t addr_offset, trig_set_tmr_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger set timer command.
Timer 7(addtional timer 1) timeout IRQ.
Definition: hal_trig.h:175
Software trigger 1.
Definition: hal_trig.h:290
int auto_reload
1: auto reload, 0: Don&#39;t auto reload
Definition: hal_trig.h:415
CPU IRQ signal 5, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:281
Start of preamble Tx in BLE baseband.
Definition: hal_trig.h:219
System tick aon timer emit signal.
Definition: hal_trig.h:248
CPU IRQ signal 4, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:280
Snapshot timer 6(additional timer 0)
Definition: hal_trig.h:142
Enable IPMAC.
Definition: hal_trig.h:119
CPU reset.
Definition: hal_trig.h:233
void hal_trig_resume(void)
Manually resume trigger after wake up. Should set auto_resume to 0 when open trigger.
Timer 8(addtional timer 2) timeout IRQ.
Definition: hal_trig.h:176
GPIO output base index, hal_trig_odc_gpio_output_idx.
Definition: hal_trig.h:99
UART0.
Definition: hal_trig.h:360
int hal_trig_sig_gpio_input_idx(int port, int pin)
Get GPIO input index for trigger signal.
Timer 6(addtional timer 0) emit 6 signal.
Definition: hal_trig.h:184
CM4 system bus address match with an address specified in a global control register.
Definition: hal_trig.h:286
Snapshot trigger handler high priority queue timer.
Definition: hal_trig.h:138
Timer 1 emit 6 signal.
Definition: hal_trig.h:166
BLE RX packet with CRC fail.
Definition: hal_trig.h:224
AGC too low.
Definition: hal_trig.h:210
int hal_trig_odc_gpio_oen_idx(int port, int pin)
Get GPIO OE index for trigger ODC index.
trig_reg_bus_t
trigger register access bus
Definition: hal_trig.h:338
CM4 program counter matched with an address specified in a global control register.
Definition: hal_trig.h:288
int hal_trig_queue_disable(int queue)
Disable trig queue.
CM4 data bus address match with an address specified in a global control register.
Definition: hal_trig.h:287
Global2 register APB mux.
Definition: hal_trig.h:107
XO ready from PD0.
Definition: hal_trig.h:238
Timer 6(addtional timer 0) emit 4 signal.
Definition: hal_trig.h:182
Input BOD2 out from PMU.
Definition: hal_trig.h:237
Global2 register.
Definition: hal_trig.h:372
UART1 register APB mux.
Definition: hal_trig.h:112
int src_bus
Source register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:468
System tick aon timer timeout IRQ.
Definition: hal_trig.h:247
BLE event start.
Definition: hal_trig.h:212
Cryption IRQ.
Definition: hal_trig.h:304
Event Skipped IRQ.
Definition: hal_trig.h:307
int dst_bus
Destination register access bus, enum trig_reg_bus_t.
Definition: hal_trig.h:469
IPMAC master rx done.
Definition: hal_trig.h:214
Front end RX enable.
Definition: hal_trig.h:205
Input BOD out from PMU.
Definition: hal_trig.h:236
Timer 1 emit 1 signal.
Definition: hal_trig.h:161
CPLL locked.
Definition: hal_trig.h:270
Timer 0 ~ timer 5.
Definition: hal_trig.h:364
uint8_t run_until_null
Run until null command.
Definition: hal_trig.h:397
PD1 Watch dog timeout IRQ.
Definition: hal_trig.h:197
MPLL enable.
Definition: hal_trig.h:272
trigger register copy with mask command parameter
Definition: hal_trig.h:477
Slave SPI APB mux.
Definition: hal_trig.h:114
Software trigger 2.
Definition: hal_trig.h:291
Timer 6(addtional timer 0) emit 8 signal.
Definition: hal_trig.h:186
int hal_trig_sig_gpio_output_idx(int port, int pin)
Get GPIO output index for trigger signal.
uint32_t src_addr
Source register address.
Definition: hal_trig.h:481
uint32_t src_addr
Source register address.
Definition: hal_trig.h:470
Disable.
Definition: hal_trig.h:292
Start of envent IRQ.
Definition: hal_trig.h:305
Snapshot timer 4.
Definition: hal_trig.h:133
int hal_trig_odc_gpio_output_en(int port, int pin, int en)
Enable GPIO output for trigger ODC output.
Suspend IPMAC.
Definition: hal_trig.h:120
int hal_trig_reg_rw_cmd(int queue, uint32_t addr_offset, trig_reg_rw_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger register read and write command.
trigger init parameter
Definition: hal_trig.h:380
int hal_trig_sig_gpio_ie_oe_idx(int port, int pin)
Get GPIO ie or oe index for trigger signal. Use hal_trig_sig_gpio_ie_oe to select ie/oe...
IPMAC background scan all channel done.
Definition: hal_trig.h:194
BLE event done.
Definition: hal_trig.h:228
IPMAC slave sync miss.
Definition: hal_trig.h:191
Start of Sync sequence Tx in BLE baseband.
Definition: hal_trig.h:218
AON timer 2 timeout IRQ.
Definition: hal_trig.h:242
Timer 0 emit 1 signal.
Definition: hal_trig.h:261
CLKN count match IRQ.
Definition: hal_trig.h:314
int hal_trig_apb_mux(int peripheral, int bus_sel)
Set peripheral apb bus mux for trigger.
trigger register copy command parameter
Definition: hal_trig.h:466
CPU IRQ signal 1, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:277
trig_odc_idx
trigger output direct control index
Definition: hal_trig.h:98
Use APB bus.
Definition: hal_trig.h:340
Timer 6(addtional timer 0) emit 1 signal.
Definition: hal_trig.h:179
trig_reg_comp_cond_t
trigger register compare condition
Definition: hal_trig.h:346
Trigger handler register.
Definition: hal_trig.h:367
Timer 1 emit 2 signal.
Definition: hal_trig.h:162
IPMAC free running IRQ 0.
Definition: hal_trig.h:188
trigger register read and compare command parameter
Definition: hal_trig.h:432
BLE RX packet with CRC pass.
Definition: hal_trig.h:225
Snapshot AON watch dog timer.
Definition: hal_trig.h:146
Share memory register APB mux.
Definition: hal_trig.h:103
CPU IRQ signal 2, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:278
System tick aon timer stop ack signal.
Definition: hal_trig.h:245
System tick block IRQ(53), check register 0x4410C380.
Definition: hal_trig.h:275
CPU IRQ signal 0, set irq number with hal_trig_sig_cpu_irq.
Definition: hal_trig.h:276
int cont_cmp
1: continue compare, 0: Not continue compare
Definition: hal_trig.h:433
Snapshot trigger handler middle priority queue timer.
Definition: hal_trig.h:139
Force baseband Rx EN.
Definition: hal_trig.h:122
Max trigger ODC index.
Definition: hal_trig.h:147
Event timeout IRQ.
Definition: hal_trig.h:315
AON timer 2 capture signal 1 captured.
Definition: hal_trig.h:259
Gross target timer IRQ.
Definition: hal_trig.h:301
Invalid parameter.
Definition: hal_trig.h:80
Master SPI0.
Definition: hal_trig.h:357
Master SPI0 register APB mux.
Definition: hal_trig.h:116
Software trigger 0.
Definition: hal_trig.h:289
int size
Copye size, enum trig_reg_cp_len_t.
Definition: hal_trig.h:478
Snapshot AON timer 0.
Definition: hal_trig.h:124
Timer 6(addtional timer 0) emit 3 signal.
Definition: hal_trig.h:181
Low priority queue.
Definition: hal_trig.h:91
uint32_t reg_addr
Register address.
Definition: hal_trig.h:459
Snapshot AON timer 1.
Definition: hal_trig.h:125
AON timer 3 timeout IRQ.
Definition: hal_trig.h:243
int hal_trig_sig_cpu_irq(int idx, uint8_t irq_num)
Set CPU IRQ signal for trigger signal TRIG_SIG_CPU_IRQ0 ~ TRIG_SIG_CPU_IRQ7.
XO enable from PD0.
Definition: hal_trig.h:239
int hal_trig_sig_ble_irq(int idx, uint8_t irq_signal)
Set BLE IRQ signal for trigger signal TRIG_SIG_BLE_IRQ0 and TRIG_SIG_BLE_IRQ1.
UART0 register APB mux.
Definition: hal_trig.h:113
int rising_edge
1:enable rising edge, 0: disable rising edge
Definition: hal_trig.h:491
trig_queue
trigger queue
Definition: hal_trig.h:88
int hal_trig_tmr_reload_tick(int queue, uint32_t reload_val)
Set trigger timer reload tick value to register.
Snapshot IPMAC free running counter(superframe, duration, and fine)
Definition: hal_trig.h:141
Timer 2 timeout IRQ.
Definition: hal_trig.h:252
IPMAC slave rx done.
Definition: hal_trig.h:215
Timer 1 emit 7 signal.
Definition: hal_trig.h:167
int hal_trig_reg_mask_copy_cmd(int queue, uint32_t addr_offset, trig_reg_mask_cp_cmd_t *cmd, uint32_t *cmd_addr_oft)
Write trigger register copy with mask command.
Use AHB bus.
Definition: hal_trig.h:339
CPU in WFI.
Definition: hal_trig.h:230
Force baseband Tx EN.
Definition: hal_trig.h:121
Mutex error.
Definition: hal_trig.h:82
PWM APB mux.
Definition: hal_trig.h:104
No error.
Definition: hal_trig.h:79
Timer 6(addtional timer 0) emit 5 signal.
Definition: hal_trig.h:183
BLE RX enable.
Definition: hal_trig.h:199
Snapshot AON timer 3.
Definition: hal_trig.h:118
Timer additional register(timer6 ~ timer9) APB mux.
Definition: hal_trig.h:117
uint16_t cmd_addr
Trig command word address offset(not byte address).
Definition: hal_trig.h:395
UART1.
Definition: hal_trig.h:361