Hi Peter,
On 4/16/20 8:45 AM, Peter Maydell wrote:
On Sun, 29 Mar 2020 at 00:18, Paul Zimmerman <pauld...@gmail.com> wrote:
< snip >
+/* nifty macros from Arnon's EHCI version */
+#define get_field(data, field) \
+ (((data) & field##_MASK) >> field##_SHIFT)
+
+#define set_field(data, newval, field) do { \
+ uint32_t val = *data; \
+ val &= ~field##_MASK; \
+ val |= ((newval) << field##_SHIFT) & field##_MASK; \
+ *data = val; \
+} while (0)
+
+#define get_bit(data, bitmask) \
+ (!!((data) & bitmask))
Could you use the standard field definition, extract, and deposit
macros from include/hw/registerfields.h, please?
I would prefer not to do that if possible. By using these macros
(which I borrowed from hcd-ehci and hcd-xhci BTW) I am able to use
the existing dwc2 register definition file from the Linux kernel
without modification. To use the macros from registerfields.h it
looks like I would need to write new definitions for all of the
dwc2 registers. I would really like to avoid that.
Thanks,
Paul