diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2017-12-13 02:17:35 -0300 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2017-12-18 17:07:02 +0300 |
commit | cdb70a5c18aec03ef3b8b1bc68d5ca8a3cd80155 (patch) | |
tree | 16731a87ec51a02f7a5c17b3ed948b3140e4cf36 /include | |
parent | 9102fe6c7f63306670b7d45635ddfeab72409199 (diff) | |
download | qemu-cdb70a5c18aec03ef3b8b1bc68d5ca8a3cd80155.zip qemu-cdb70a5c18aec03ef3b8b1bc68d5ca8a3cd80155.tar.gz qemu-cdb70a5c18aec03ef3b8b1bc68d5ca8a3cd80155.tar.bz2 |
hw/registerfields: add 64-bit extract/deposit macros
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/registerfields.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/hw/registerfields.h b/include/hw/registerfields.h index ad9d7a8..f59e7f4 100644 --- a/include/hw/registerfields.h +++ b/include/hw/registerfields.h @@ -35,6 +35,9 @@ #define FIELD_EX32(storage, reg, field) \ extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ R_ ## reg ## _ ## field ## _LENGTH) +#define FIELD_EX64(storage, reg, field) \ + extract64((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH) /* Extract a field from an array of registers */ #define ARRAY_FIELD_EX32(regs, reg, field) \ @@ -52,6 +55,14 @@ d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \ R_ ## reg ## _ ## field ## _LENGTH, v.v); \ d; }) +#define FIELD_DP64(storage, reg, field, val) ({ \ + struct { \ + unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \ + } v = { .v = val }; \ + uint64_t d; \ + d = deposit64((storage), R_ ## reg ## _ ## field ## _SHIFT, \ + R_ ## reg ## _ ## field ## _LENGTH, v.v); \ + d; }) /* Deposit a field to array of registers. */ #define ARRAY_FIELD_DP32(regs, reg, field, val) \ |