[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] hw/char/avr_usart: Restrict register definitions to source
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 3/5] hw/char/avr_usart: Restrict register definitions to source |
Date: |
Fri, 14 Aug 2020 18:39:22 +0200 |
Nothing out of our model implementation is supposed to access its
registers. Keep the definitions local.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/char/avr_usart.h | 30 ------------------------------
hw/char/avr_usart.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/include/hw/char/avr_usart.h b/include/hw/char/avr_usart.h
index 5739aaf26f..46d6c76e50 100644
--- a/include/hw/char/avr_usart.h
+++ b/include/hw/char/avr_usart.h
@@ -26,36 +26,6 @@
#include "chardev/char-fe.h"
#include "hw/hw.h"
-/* Offsets of registers. */
-#define USART_DR 0x06
-#define USART_CSRA 0x00
-#define USART_CSRB 0x01
-#define USART_CSRC 0x02
-#define USART_BRRH 0x05
-#define USART_BRRL 0x04
-
-/* Relevant bits in regiters. */
-#define USART_CSRA_RXC (1 << 7)
-#define USART_CSRA_TXC (1 << 6)
-#define USART_CSRA_DRE (1 << 5)
-#define USART_CSRA_MPCM (1 << 0)
-
-#define USART_CSRB_RXCIE (1 << 7)
-#define USART_CSRB_TXCIE (1 << 6)
-#define USART_CSRB_DREIE (1 << 5)
-#define USART_CSRB_RXEN (1 << 4)
-#define USART_CSRB_TXEN (1 << 3)
-#define USART_CSRB_CSZ2 (1 << 2)
-#define USART_CSRB_RXB8 (1 << 1)
-#define USART_CSRB_TXB8 (1 << 0)
-
-#define USART_CSRC_MSEL1 (1 << 7)
-#define USART_CSRC_MSEL0 (1 << 6)
-#define USART_CSRC_PM1 (1 << 5)
-#define USART_CSRC_PM0 (1 << 4)
-#define USART_CSRC_CSZ1 (1 << 2)
-#define USART_CSRC_CSZ0 (1 << 1)
-
#define TYPE_AVR_USART "avr-usart"
#define AVR_USART(obj) \
OBJECT_CHECK(AVRUsartState, (obj), TYPE_AVR_USART)
diff --git a/hw/char/avr_usart.c b/hw/char/avr_usart.c
index fbe2a112b7..fd0b488ef9 100644
--- a/hw/char/avr_usart.c
+++ b/hw/char/avr_usart.c
@@ -25,6 +25,36 @@
#include "hw/irq.h"
#include "hw/qdev-properties.h"
+/* Offsets of registers. */
+#define USART_DR 0x06
+#define USART_CSRA 0x00
+#define USART_CSRB 0x01
+#define USART_CSRC 0x02
+#define USART_BRRH 0x05
+#define USART_BRRL 0x04
+
+/* Relevant bits in regiters. */
+#define USART_CSRA_RXC (1 << 7)
+#define USART_CSRA_TXC (1 << 6)
+#define USART_CSRA_DRE (1 << 5)
+#define USART_CSRA_MPCM (1 << 0)
+
+#define USART_CSRB_RXCIE (1 << 7)
+#define USART_CSRB_TXCIE (1 << 6)
+#define USART_CSRB_DREIE (1 << 5)
+#define USART_CSRB_RXEN (1 << 4)
+#define USART_CSRB_TXEN (1 << 3)
+#define USART_CSRB_CSZ2 (1 << 2)
+#define USART_CSRB_RXB8 (1 << 1)
+#define USART_CSRB_TXB8 (1 << 0)
+
+#define USART_CSRC_MSEL1 (1 << 7)
+#define USART_CSRC_MSEL0 (1 << 6)
+#define USART_CSRC_PM1 (1 << 5)
+#define USART_CSRC_PM0 (1 << 4)
+#define USART_CSRC_CSZ1 (1 << 2)
+#define USART_CSRC_CSZ0 (1 << 1)
+
static int avr_usart_can_receive(void *opaque)
{
AVRUsartState *usart = opaque;
--
2.21.3
- [PATCH 0/5] hw/avr: Start using the Clock API, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 1/5] hw/avr/atmega: Introduce the I/O clock, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 2/5] hw/timer/avr_timer16: Use the Clock API, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 3/5] hw/char/avr_usart: Restrict register definitions to source,
Philippe Mathieu-Daudé <=
- [PATCH 4/5] hw/char/avr_usart: Use the Clock API, Philippe Mathieu-Daudé, 2020/08/14
- [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes, Philippe Mathieu-Daudé, 2020/08/14
- Re: [PATCH 0/5] hw/avr: Start using the Clock API, Michael Rolnik, 2020/08/26