|
@@ -89,76 +89,6 @@ static struct cvi_wdt_regs_t *cvi_wdt_reg = &cv182x_wdt_reg;
|
|
|
#define CV_RST_REG (CV_TOP + 0x3004)
|
|
|
#define CV_RST_WDT (1U << 16)
|
|
|
|
|
|
-rt_inline void cvi_wdt_top_setting()
|
|
|
-{
|
|
|
- uint32_t val;
|
|
|
-
|
|
|
- mmio_write_32(CV_TOP + CV_TOP_WDT_OFFSET, CV_TOP_WDT_VAL);
|
|
|
-
|
|
|
- val = mmio_read_32(CV_RST_REG);
|
|
|
- mmio_write_32(CV_RST_REG, val & ~CV_RST_WDT);
|
|
|
- rt_hw_us_delay(10);
|
|
|
- mmio_write_32(CV_RST_REG, val | CV_RST_WDT);
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_start_en(unsigned long reg_base)
|
|
|
-{
|
|
|
- WDT_CR(reg_base) |= CVI_WDT_CR_WDT_ENABLE_En;
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_start_dis(unsigned long reg_base)
|
|
|
-{
|
|
|
- WDT_CR(reg_base) &= ~CVI_WDT_CR_WDT_ENABLE_En;
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline uint32_t cvi_wdt_get_start(unsigned long reg_base)
|
|
|
-{
|
|
|
- return (WDT_CR(reg_base) & CVI_WDT_CR_WDT_ENABLE_Msk);
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_set_timeout(unsigned long reg_base, uint32_t value)
|
|
|
-{
|
|
|
- WDT_TORR(reg_base) &= ~CVI_WDT_TORR_WDT_TORR_Pos;
|
|
|
- WDT_TORR(reg_base) = ((value << CVI_WDT_TORR_WDT_ITORR_Pos) | (value << CVI_WDT_TORR_WDT_TORR_Pos));
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_set_respond_system_reset(unsigned long reg_base)
|
|
|
-{
|
|
|
- WDT_CR(reg_base) &= ~CVI_WDT_CR_WDT_RESPOND_IRQ_THEN_RST;
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_set_respond_irq_then_reset(unsigned long reg_base)
|
|
|
-{
|
|
|
- WDT_CR(reg_base) |= CVI_WDT_CR_WDT_RESPOND_IRQ_THEN_RST;
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_set_reset_pulse_width(unsigned long reg_base, uint32_t value)
|
|
|
-{
|
|
|
- WDT_CR(reg_base) &= ~CVI_WDT_CR_WDT_RESET_PULSE_WIDTH_Msk;
|
|
|
- WDT_CR(reg_base) |= (value << CVI_WDT_CR_WDT_RESET_PULSE_WIDTH_Pos);
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_feed_en(unsigned long reg_base)
|
|
|
-{
|
|
|
- WDT_CRR(reg_base) = CVI_WDT_CRR_FEED_En;
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline uint32_t cvi_wdt_get_counter_value(unsigned long reg_base)
|
|
|
-{
|
|
|
- return (WDT_CCVR(reg_base) & CVI_WDT_CCVR_COUNTER_Msk);
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline uint32_t cvi_wdt_get_irq_stat(unsigned long reg_base)
|
|
|
-{
|
|
|
- return (WDT_STAT(reg_base) & CVI_WDT_STAT_IRQ_STAT_Msk);
|
|
|
-}
|
|
|
-
|
|
|
-rt_inline void cvi_wdt_clr_irq_en(unsigned long reg_base)
|
|
|
-{
|
|
|
- WDT_EOI(reg_base);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
int rt_hw_wdt_init(void);
|
|
|
|
|
|
#endif /* __DRV_WDT_H__ */
|