• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão664b117c0ca1a3df8947201f40ca6253cb741db3 (tree)
Hora2020-01-23 21:44:07
AutorPhilippe Mathieu-Daudé <philmd@redh...>
CommiterYoshinori Sato

Mensagem de Log

hw/registerfields.h: Add 8bit and 16bit register macros

Some RX peripheral using 8bit and 16bit registers.
Added 8bit and 16bit APIs.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190607091116.49044-11-ysato@users.sourceforge.jp>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Mudança Sumário

Diff

--- a/include/hw/registerfields.h
+++ b/include/hw/registerfields.h
@@ -22,6 +22,14 @@
2222 enum { A_ ## reg = (addr) }; \
2323 enum { R_ ## reg = (addr) / 4 };
2424
25+#define REG8(reg, addr) \
26+ enum { A_ ## reg = (addr) }; \
27+ enum { R_ ## reg = (addr) };
28+
29+#define REG16(reg, addr) \
30+ enum { A_ ## reg = (addr) }; \
31+ enum { R_ ## reg = (addr) / 2 };
32+
2533 /* Define SHIFT, LENGTH and MASK constants for a field within a register */
2634
2735 /* This macro will define R_FOO_BAR_MASK, R_FOO_BAR_SHIFT and R_FOO_BAR_LENGTH
@@ -34,6 +42,12 @@
3442 MAKE_64BIT_MASK(shift, length)};
3543
3644 /* Extract a field from a register */
45+#define FIELD_EX8(storage, reg, field) \
46+ extract8((storage), R_ ## reg ## _ ## field ## _SHIFT, \
47+ R_ ## reg ## _ ## field ## _LENGTH)
48+#define FIELD_EX16(storage, reg, field) \
49+ extract16((storage), R_ ## reg ## _ ## field ## _SHIFT, \
50+ R_ ## reg ## _ ## field ## _LENGTH)
3751 #define FIELD_EX32(storage, reg, field) \
3852 extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
3953 R_ ## reg ## _ ## field ## _LENGTH)
@@ -49,6 +63,22 @@
4963 * Assigning values larger then the target field will result in
5064 * compilation warnings.
5165 */
66+#define FIELD_DP8(storage, reg, field, val) ({ \
67+ struct { \
68+ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
69+ } v = { .v = val }; \
70+ uint8_t d; \
71+ d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
72+ R_ ## reg ## _ ## field ## _LENGTH, v.v); \
73+ d; })
74+#define FIELD_DP16(storage, reg, field, val) ({ \
75+ struct { \
76+ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
77+ } v = { .v = val }; \
78+ uint16_t d; \
79+ d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
80+ R_ ## reg ## _ ## field ## _LENGTH, v.v); \
81+ d; })
5282 #define FIELD_DP32(storage, reg, field, val) ({ \
5383 struct { \
5484 unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
@@ -57,7 +87,7 @@
5787 d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
5888 R_ ## reg ## _ ## field ## _LENGTH, v.v); \
5989 d; })
60-#define FIELD_DP64(storage, reg, field, val) ({ \
90+#define FIELD_DP64(storage, reg, field, val) ({ \
6191 struct { \
6292 unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
6393 } v = { .v = val }; \