From 962e9d85f3b29ad9e057a4667fd96e4ca9e41adc Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Fri, 8 Aug 2003 20:25:50 +0000 Subject: [PATCH] * m68hc11_sim.c (print_io_word): New function to print 16-bit value. * sim-main.h (print_io_word): Declare. * dv-m68hc11tim.c (tmsk1_desc): New description table for TMSK1. (tflg1_desc): Likewise for TFLG1. (m68hc11tim_info): Print input and output compare registers --- sim/m68hc11/ChangeLog | 9 +++++ sim/m68hc11/dv-m68hc11tim.c | 79 ++++++++++++++++++++++++++++++++++++- sim/m68hc11/m68hc11_sim.c | 11 +++++- sim/m68hc11/sim-main.h | 4 +- 4 files changed, 99 insertions(+), 4 deletions(-) diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog index 9c34d47002b..27177512c4f 100644 --- a/sim/m68hc11/ChangeLog +++ b/sim/m68hc11/ChangeLog @@ -1,3 +1,12 @@ +2003-08-08 Stephane Carrez , + Gary Piercey + + * m68hc11_sim.c (print_io_word): New function to print 16-bit value. + * sim-main.h (print_io_word): Declare. + * dv-m68hc11tim.c (tmsk1_desc): New description table for TMSK1. + (tflg1_desc): Likewise for TFLG1. + (m68hc11tim_info): Print input and output compare registers + 2003-03-02 Stephane Carrez * Makefile.in (SIM_EXTRA_CFLAGS): Set WITH_TARGET_ADDRESS_BITSIZE diff --git a/sim/m68hc11/dv-m68hc11tim.c b/sim/m68hc11/dv-m68hc11tim.c index 3edcac068a3..b0ff2c35faf 100644 --- a/sim/m68hc11/dv-m68hc11tim.c +++ b/sim/m68hc11/dv-m68hc11tim.c @@ -1,6 +1,6 @@ /* dv-m68hc11tim.c -- Simulation of the 68HC11 timer devices. - Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. - Written by Stephane Carrez (stcarrez@worldnet.fr) + Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Written by Stephane Carrez (stcarrez@nerim.fr) (From a driver model Contributed by Cygnus Solutions.) This file is part of the program GDB, the GNU debugger. @@ -394,6 +394,30 @@ m68hc11tim_timer_event (struct hw *me, void *data) /* Descriptions of the Timer I/O ports. These descriptions are only used to give information of the Timer device under GDB. */ +io_reg_desc tmsk1_desc[] = { + { M6811_OC1I, "OC1I ", "Timer Output Compare 1 Interrupt Enable" }, + { M6811_OC2I, "OC2I ", "Timer Output Compare 2 Interrupt Enable" }, + { M6811_OC3I, "OC3I ", "Timer Output Compare 3 Interrupt Enable" }, + { M6811_OC4I, "OC4I ", "Timer Output Compare 4 Interrupt Enable" }, + { M6811_OC5I, "OC5I ", "Timer Input Capture 4 / Output Compare 5 Enable" }, + { M6811_IC1I, "IC1I ", "Timer Input Capture 1 Interrupt Enable" }, + { M6811_IC2I, "IC2I ", "Timer Input Capture 2 Interrupt Enable" }, + { M6811_IC3I, "IC3I ", "Timer Input Capture 3 Interrupt Enable" }, + { 0, 0, 0 } +}; + +io_reg_desc tflg1_desc[] = { + { M6811_OC1F, "OC1F ", "Timer Output Compare 1 Interrupt Flag" }, + { M6811_OC2F, "OC2F ", "Timer Output Compare 2 Interrupt Flag" }, + { M6811_OC3F, "OC3F ", "Timer Output Compare 3 Interrupt Flag" }, + { M6811_OC4F, "OC4F ", "Timer Output Compare 4 Interrupt Flag" }, + { M6811_OC5F, "OC5F ", "Timer Input Capture 4 / Output Compare 5 Flag" }, + { M6811_IC1F, "IC1F ", "Timer Input Capture 1 Interrupt Flag" }, + { M6811_IC2F, "IC2F ", "Timer Input Capture 2 Interrupt Flag" }, + { M6811_IC3F, "IC3F ", "Timer Input Capture 3 Interrupt Flag" }, + { 0, 0, 0 } +}; + io_reg_desc tmsk2_desc[] = { { M6811_TOI, "TOI ", "Timer Overflow Interrupt Enable" }, { M6811_RTII, "RTII ", "RTI Interrupt Enable" }, @@ -484,6 +508,7 @@ m68hc11tim_info (struct hw *me) sim_cpu *cpu; struct m68hc11tim *controller; uint8 val; + uint16 val16; sd = hw_system (me); cpu = STATE_CPU (sd, 0); @@ -493,6 +518,56 @@ m68hc11tim_info (struct hw *me) base = cpu_get_io_base (cpu); + /* Info for TIC1 */ + val16 = (cpu->ios[M6811_TIC1_H] << 8) + cpu->ios[M6811_TIC1_L]; + print_io_word (sd, "TIC1 ", 0, val16, base + M6811_TIC1); + sim_io_printf (sd, "\n"); + + /* Info for TIC2 */ + val16 = (cpu->ios[M6811_TIC2_H] << 8) + cpu->ios[M6811_TIC2_L]; + print_io_word (sd, "TIC2 ", 0, val16, base + M6811_TIC2); + sim_io_printf (sd, "\n"); + + /* Info for TIC3 */ + val16 = (cpu->ios[M6811_TIC3_H] << 8) + cpu->ios[M6811_TIC3_L]; + print_io_word (sd, "TIC3 ", 0, val16, base + M6811_TIC3); + sim_io_printf (sd, "\n"); + + /* Info for TOC1 */ + val16 = (cpu->ios[M6811_TOC1_H] << 8) + cpu->ios[M6811_TOC1_L]; + print_io_word (sd, "TOC1 ", 0, val16, base + M6811_TOC1); + sim_io_printf (sd, "\n"); + + /* Info for TOC2 */ + val16 = (cpu->ios[M6811_TOC2_H] << 8) + cpu->ios[M6811_TOC2_L]; + print_io_word (sd, "TOC2 ", 0, val16, base + M6811_TOC2); + sim_io_printf (sd, "\n"); + + /* Info for TOC3 */ + val16 = (cpu->ios[M6811_TOC3_H] << 8) + cpu->ios[M6811_TOC3_L]; + print_io_word (sd, "TOC3 ", 0, val16, base + M6811_TOC3); + sim_io_printf (sd, "\n"); + + /* Info for TOC4 */ + val16 = (cpu->ios[M6811_TOC4_H] << 8) + cpu->ios[M6811_TOC4_L]; + print_io_word (sd, "TOC4 ", 0, val16, base + M6811_TOC4); + sim_io_printf (sd, "\n"); + + /* Info for TOC5 */ + val16 = (cpu->ios[M6811_TOC5_H] << 8) + cpu->ios[M6811_TOC5_L]; + print_io_word (sd, "TOC5 ", 0, val16, base + M6811_TOC5); + sim_io_printf (sd, "\n"); + + /* Info for TMSK1 */ + val = cpu->ios[M6811_TMSK1]; + print_io_byte (sd, "TMSK1 ", tmsk1_desc, val, base + M6811_TMSK1); + sim_io_printf (sd, "\n"); + + /* Info for TFLG1 */ + val = cpu->ios[M6811_TFLG1]; + print_io_byte (sd, "TFLG1", tflg1_desc, val, base + M6811_TFLG1); + sim_io_printf (sd, "\n"); + val = cpu->ios[M6811_TMSK2]; print_io_byte (sd, "TMSK2 ", tmsk2_desc, val, base + M6811_TMSK2); sim_io_printf (sd, "\n"); diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c index fe5985f8f1c..3e345987234 100644 --- a/sim/m68hc11/m68hc11_sim.c +++ b/sim/m68hc11/m68hc11_sim.c @@ -1,5 +1,5 @@ /* m6811_cpu.c -- 68HC11&68HC12 CPU Emulation - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Stephane Carrez (stcarrez@nerim.fr) This file is part of GDB, GAS, and the GNU binutils. @@ -581,6 +581,15 @@ print_io_byte (SIM_DESC sd, const char *name, io_reg_desc *desc, print_io_reg_desc (sd, desc, val, 0); } +void +print_io_word (SIM_DESC sd, const char *name, io_reg_desc *desc, + uint16 val, uint16 addr) +{ + sim_io_printf (sd, " %-9.9s @ 0x%04x 0x%04x ", name, addr, val); + if (desc) + print_io_reg_desc (sd, desc, val, 0); +} + void cpu_ccr_update_tst8 (sim_cpu *proc, uint8 val) { diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h index c8933a0791f..b32076b6e16 100644 --- a/sim/m68hc11/sim-main.h +++ b/sim/m68hc11/sim-main.h @@ -1,5 +1,5 @@ /* sim-main.h -- Simulator for Motorola 68HC11 & 68HC12 - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Stephane Carrez (stcarrez@nerim.fr) This file is part of GDB, the GNU debugger. @@ -108,6 +108,8 @@ extern void print_io_reg_desc (SIM_DESC sd, io_reg_desc *desc, int val, int mode); extern void print_io_byte (SIM_DESC sd, const char *name, io_reg_desc *desc, uint8 val, uint16 addr); +extern void print_io_word (SIM_DESC sd, const char *name, + io_reg_desc *desc, uint16 val, uint16 addr); /* List of special 68HC11&68HC12 instructions that are not handled by the -- 2.30.2