Skip to content

Commit 0f1db56

Browse files
committed
Fixing timestamps and finishing stm32 timer off for the time being
1 parent b6f36e3 commit 0f1db56

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

hw/arm/stm32_flashboard.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,23 @@ static void printLedStatus(Stm32Flashboard *s)
151151
{
152152
int64_t now = qemu_get_clock_ns(vm_clock);
153153
int64_t secs = now / 1000000000;
154-
int64_t frac = (now % 1000000000) / 10000;
154+
int64_t frac = (now % 1000000000);
155155

156156
if (!s->ledDrive1 && !s->ledDrive2)
157157
{
158-
printf("(%"PRId64".%06"PRId64") LED %s\n", secs, frac, "Shutdown");
158+
printf("(%"PRId64".%09"PRId64") LED %s\n", secs, frac, "Shutdown");
159159
}
160160
else if (s->ledDrive1 && !s->ledDrive2)
161161
{
162-
printf("(%"PRId64".%06"PRId64") LED %s\n", secs, frac, "Low current");
162+
printf("(%"PRId64".%09"PRId64") LED %s\n", secs, frac, "Low current");
163163
}
164164
else if (!s->ledDrive1 && s->ledDrive2)
165165
{
166-
printf("(%"PRId64".%06"PRId64") LED %s\n", secs, frac, "High current");
166+
printf("(%"PRId64".%09"PRId64") LED %s\n", secs, frac, "High current");
167167
}
168168
else if (s->ledDrive1 && s->ledDrive2)
169169
{
170-
printf("(%"PRId64".%06"PRId64") LED %s\n", secs, frac, "Low+High current");
170+
printf("(%"PRId64".%09"PRId64") LED %s\n", secs, frac, "Low+High current");
171171
}
172172
}
173173

@@ -217,7 +217,7 @@ static void gpiob_irq_handler(void *opaque, int n, int level)
217217
{
218218
int64_t now = qemu_get_clock_ns(vm_clock);
219219
int64_t secs = now / 1000000000;
220-
int64_t frac = (now % 1000000000) / 10000;
220+
int64_t frac = (now % 1000000000);
221221

222222
int gpio = (int) opaque;
223223
const char *name;
@@ -241,10 +241,10 @@ static void gpiob_irq_handler(void *opaque, int n, int level)
241241
*/
242242
switch (level) {
243243
case 0:
244-
printf("(%"PRId64".%06"PRId64") %s Off\n", secs, frac, name);
244+
printf("(%"PRId64".%09"PRId64") %s Off\n", secs, frac, name);
245245
break;
246246
case 1:
247-
printf("(%"PRId64".%06"PRId64") %s On\n", secs, frac, name);
247+
printf("(%"PRId64".%09"PRId64") %s On\n", secs, frac, name);
248248
break;
249249
}
250250
}
@@ -272,8 +272,8 @@ static void stm32_flashboard_key_event(void *opaque, int keycode)
272272
if(!s->triggered) {
273273
int64_t now = qemu_get_clock_ns(vm_clock);
274274
int64_t secs = now / 1000000000;
275-
int64_t frac = (now % 1000000000) / 10000;
276-
printf("(%"PRId64".%06"PRId64") Trigger GPIO 0\n", secs, frac);
275+
int64_t frac = (now % 1000000000);
276+
printf("(%"PRId64".%09"PRId64") Trigger GPIO 0\n", secs, frac);
277277
qemu_irq_raise(s->gpioIRQ);
278278
s->triggered = true;
279279
}
@@ -290,8 +290,8 @@ static void stm32_flashboard_key_event(void *opaque, int keycode)
290290
if(!s->triggered) {
291291
int64_t now = qemu_get_clock_ns(vm_clock);
292292
int64_t secs = now / 1000000000;
293-
int64_t frac = (now % 1000000000) / 10000;
294-
printf("(%"PRId64".%06"PRId64") Trigger OD_IN\n", secs, frac);
293+
int64_t frac = (now % 1000000000);
294+
printf("(%"PRId64".%09"PRId64") Trigger OD_IN\n", secs, frac);
295295
qemu_irq_raise(s->odIRQ);
296296
s->triggered = true;
297297
}

hw/timer/stm32_timer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
/* DEFINITIONS*/
3030

3131
/* See the README file for details on these settings. */
32-
#define DEBUG_STM32_TIMER
32+
//#define DEBUG_STM32_TIMER
3333

3434
#ifdef DEBUG_STM32_TIMER
3535
#define DPRINTF(fmt, ...) \
3636
do { \
3737
int64_t now = qemu_get_clock_ns(vm_clock); \
3838
int64_t secs = now / 1000000000; \
39-
int64_t frac = (now % 1000000000) / 10000; \
40-
printf("STM32_TIMER (%"PRId64".%06"PRId64"): ", secs, frac); \
39+
int64_t frac = (now % 1000000000); \
40+
printf("STM32_TIMER (%"PRId64".%09"PRId64"): ", secs, frac); \
4141
printf(fmt, ## __VA_ARGS__); } while (0)
4242
#else
4343
#define DPRINTF(fmt, ...)

0 commit comments

Comments
 (0)