|
From: | Paul Zimmerman |
Subject: | Re: [PATCH v2 4/6] dwc-hsotg USB host controller emulation |
Date: | Sat, 18 Apr 2020 14:55:21 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 |
Hi Peter, On 4/16/20 8:45 AM, Peter Maydell wrote:
On Sun, 29 Mar 2020 at 00:18, Paul Zimmerman <address@hidden> 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
[Prev in Thread] | Current Thread | [Next in Thread] |