Lines Matching refs:id
27 static inline mem_addr_t get_lock_addr(const struct device *dev, uint32_t id) in get_lock_addr() argument
29 return (mem_addr_t)(DEVICE_MMIO_GET(dev) + id * sizeof(uint32_t)); in get_lock_addr()
43 static int sqn_hwspinlock_trylock(const struct device *dev, uint32_t id) in sqn_hwspinlock_trylock() argument
48 if (id > config->num_locks) { in sqn_hwspinlock_trylock()
60 if (sys_read8(get_lock_addr(dev, id)) == cpuid) { in sqn_hwspinlock_trylock()
64 sys_write8(cpuid, get_lock_addr(dev, id)); in sqn_hwspinlock_trylock()
65 if (sys_read8(get_lock_addr(dev, id)) == cpuid) { in sqn_hwspinlock_trylock()
72 static void sqn_hwspinlock_lock(const struct device *dev, uint32_t id) in sqn_hwspinlock_lock() argument
77 if (id > config->num_locks) { in sqn_hwspinlock_lock()
78 LOG_ERR("unsupported hwspinlock id '%d'", id); in sqn_hwspinlock_lock()
89 if (sys_read8(get_lock_addr(dev, id)) == 0) { in sqn_hwspinlock_lock()
90 sys_write8(cpuid, get_lock_addr(dev, id)); in sqn_hwspinlock_lock()
93 while (sys_read8(get_lock_addr(dev, id)) != cpuid) { in sqn_hwspinlock_lock()
95 sys_write8(cpuid, get_lock_addr(dev, id)); in sqn_hwspinlock_lock()
99 static void sqn_hwspinlock_unlock(const struct device *dev, uint32_t id) in sqn_hwspinlock_unlock() argument
104 if (id > config->num_locks) { in sqn_hwspinlock_unlock()
105 LOG_ERR("unsupported hwspinlock id '%d'", id); in sqn_hwspinlock_unlock()
116 sys_write8(cpuid, get_lock_addr(dev, id)); in sqn_hwspinlock_unlock()