The HW has a built-in random number generator. This
patch adds a convenient helper to get random 16-bit
values in the firmware.
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
set(AR9170_GPIO_REG_PORT_DATA, ledstate);
}
+static inline __inline u16 get_random_u16(void)
+{
+ return getw(AR9170_RAND_REG_NUM);
+}
+
#ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
void gpio_timer(void);
setb(addr, getb(addr) | val);
}
+static inline __inline uint16_t getw(const volatile uint32_t addr)
+{
+ return readw((const volatile void *) addr);
+}
+
#endif /* __CARL9170FW_IO_H */