MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / reset_simple_update

Function reset_simple_update

components/drivers/reset/reset-simple.c:22–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#define raw_to_reset_simple(raw) rt_container_of(raw, struct reset_simple, parent)
21
22static rt_err_t reset_simple_update(struct reset_simple *rsts, int id, rt_bool_t assert)
23{
24 rt_uint32_t reg;
25 rt_ubase_t level;
26 int reg_width = sizeof(rt_uint32_t);
27 int bank = id / (reg_width * 8);
28 int offset = id % (reg_width * 8);
29
30 level = rt_spin_lock_irqsave(&rsts->lock);
31
32 reg = HWREG32(rsts->mmio_base + (bank * reg_width));
33
34 if (assert ^ rsts->active_low)
35 {
36 reg |= RT_BIT(offset);
37 }
38 else
39 {
40 reg &= ~RT_BIT(offset);
41 }
42
43 HWREG32(rsts->mmio_base + (bank * reg_width)) = reg;
44
45 rt_spin_unlock_irqrestore(&rsts->lock, level);
46
47 return RT_EOK;
48}
49
50static rt_err_t reset_simple_assert(struct rt_reset_control *rstc)
51{

Callers 2

reset_simple_assertFunction · 0.85
reset_simple_deassertFunction · 0.85

Calls 2

rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected