Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 156 ---
1 file changed, 95 insertions(+), 61 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 1da0f96..5a93fb6 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -48,17 +48,32
On 02/15/2013 12:24 PM, Andreas Färber wrote:
The expected answer would've been "take guest X and do Y to see Z", or
better to extend the existing qtest cases to prove something was broken
before and fixed afterwards and to avoid the same bug being reintroduced
later.
If we are talking about ad
First, the ds1338 code was in a poor state and never handled the 12 hour
clock correctly. My first patch failed to fully fix the problem so I had
to write a second one, but at no point did Peter or I introduce a
regression, quite the opposite.
Second, I don't know where you got the idea that I
On 02/14/2013 10:30 AM, Paolo Bonzini wrote:
Nice. Do you have a testcase?
No, but the refactoring makes the code very easy to audit.
Please also test this patch with the two rtc-test patches at
http://thread.gmane.org/gmane.comp.emulators.qemu/188244.
I did and the tests pass.
This patch consolidates the bit twidling involved in reading and
writing the time registers to four functions that are used consistently.
This also has the effect of fixing bug 1090558.
Signed-off-by: Antoine Mathys
---
hw/mc146818rtc.c | 163
The proper mapping between 24 hours and 12 hours modes is:
0 12 AM
1-111-11 AM
12 12 PM
13-23 1-11 PM
Fix code accordingly.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
Public bug reported:
get_next_alarm() doesn't read the RTC_HOURS_ALARM field correctly.
- Bit 7 must be masked before conversion from BCD.
- Care must be taken to check the don't care condition before masking.
- The PM bit must be read from RTC_HOURS_ALARM, not from RTC_HOURS (as is done
in conv
On 12/13/2012 03:09 PM, Peter Maydell wrote:
I certainly will send further patches.
As you noticed I am new to git. Thanks for your patience and advice.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 17 +
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index d2f52fc..94a2f54 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -125,7 +125,8 @@ static int ds1338_send(I2CSlave *i2c, uint8_t
Per the datasheet, the DAY (wday) register is user defined. Implement this.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 15 ---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 94a2f54..1aefa3b 100644
--- a/hw/ds1338.c
+++ b/hw
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 12
1 file changed, 12 insertions(+)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 0f88720..d2f52fc 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -179,6 +179,17 @@ static int ds1338_init(I2CSlave *i2c)
return 0;
}
+static
Per the datasheet, the mapping between 12 and 24 hours modes is:
0 <-> 12 PM
1-12 <-> 1-12 AM
13-23 <-> 1-11 PM
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 29 ++---
1 file changed, 18 insertions(+), 11 deletions(-
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |6 ++
1 file changed, 6 insertions(+)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index faaa4a0..69018bc 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -17,6 +17,12 @@
*/
#define NVRAM_SIZE 64
+/* Flags definitions */
+#define SECONDS_CH
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index b576d56..faaa4a0 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -57,9 +57,9 @@ static void capture_current_time(DS1338State *s)
} else
Oops. There was a problem in the patch. Resending the series.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 51 ++-
1 file changed, 38 insertions(+), 13 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index b576d56..d2f52fc 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -17,6 +17,12 @@
*/
#define
Per the datasheet, the DAY (wday) register is user defined. Implement this.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 15 ---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 94a2f54..1aefa3b 100644
--- a/hw/ds1338.c
+++ b/hw
Per the datasheet, the mapping between 12 and 24 hours modes is:
0 <-> 12 PM
1-12 <-> 1-12 AM
13-23 <-> 1-11 PM
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 29 ++---
1 file changed, 18 insertions(+), 11 deletions(-
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 17 +
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index d2f52fc..94a2f54 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -125,7 +125,8 @@ static int ds1338_send(I2CSlave *i2c, uint8_t
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index b576d56..faaa4a0 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -57,9 +57,9 @@ static void capture_current_time(DS1338State *s)
} else
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |6 ++
1 file changed, 6 insertions(+)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index faaa4a0..69018bc 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -17,6 +17,12 @@
*/
#define NVRAM_SIZE 64
+/* Flags definitions */
+#define SECONDS_CH
It's true that it probably doesn't make much difference, but
both the addr_byte and ptr are part of the migration state
listed in the vmstate struct. I think it is cleaner and
more straightforward to reason about if resetting the
device returns it to an exact known state. The state may be
undefi
On 12/12/2012 01:05 PM, Peter Maydell wrote:
I think we need to reset ptr and addr_byte too...
The initial value of the register pointer is unspecified.
addr_byte is only used when receiving user data. It is written in
ds1338_event() then read in ds1338_send(). Setting it in ds1338_reset()
is
Per the datasheet, the DAY (wday) register is user defined. Implement this.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 15 ---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 319c341..c5cee99 100644
--- a/hw/ds1338.c
+++ b/hw
The previous patch has the side effect of clearing the control register.
That's already its proper power-on-reset value.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 17 +
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 10 ++
1 file changed, 10 insertions(+)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 0f88720..b4d5b74 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -179,6 +179,15 @@ static int ds1338_init(I2CSlave *i2c)
return 0;
}
+static void
Per the datasheet, the mapping between 12 and 24 hours modes is:
0 <-> 12 PM
1-12 <-> 1-12 AM
13-23 <-> 1-11 PM
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 29 ++---
1 file changed, 18 insertions(+), 11 deletions(-
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |6 ++
1 file changed, 6 insertions(+)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index faaa4a0..69018bc 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -17,6 +17,12 @@
*/
#define NVRAM_SIZE 64
+/* Flags definitions */
+#define SECONDS_CH
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index b576d56..faaa4a0 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -57,9 +57,9 @@ static void capture_current_time(DS1338State *s)
} else
This is the second version of my series of patch to hw/ds1338.c
It should address the various points that were made. The main difference
with the previous version is that I dropped some stuff that will only be
useful once we implement clock enable/disable.
On 12/04/2012 06:42 PM, Peter Maydell wrote:
This looks good as far as the logic goes, but I think we could use
some symbolic constants for the 12-hour and PM bits rather than all
the literal 0x20 0x40 0x60. thanks -- PMM
I refrained from using symbolic constants for three reasons:
1. You need
Per the datasheet, the DATE (wday) register is user defined. Implement this.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 14 --
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 8f85635..c502934 100644
--- a/hw/ds1338.c
+++ b/hw
supposed to set these bits it is safer to check
anyway. In order not to duplicate this logic I thus chose to enforce it
at read time.
Note that currently we don't preserve what the user sends in (2). We
will have to once we support stopping the clock (CH bit).
Signed-off-by: Antoine Mathys
--
Per the datasheet, the OSF bit in the control register can only be
cleared. Attempts to set it have no effect. Implement this.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c |7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 1fb152e
Minor fixes in the handling of the RTC registers.
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 15 ---
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/ds1338.c b/hw/ds1338.c
index 1274b22..1fb152e 100644
--- a/hw/ds1338.c
+++ b/hw/ds1338.c
@@ -62,9 +62,9
Per the datasheet, the mapping between 12 and 24 hours modes is:
0 <-> 12 PM
1-12 <-> 1-12 AM
13-23 <-> 1-11 PM
Signed-off-by: Antoine Mathys
---
hw/ds1338.c | 23 +++
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git
38 matches
Mail list logo