Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- com.c.orig 2021-01-01 17:50:19.699234954 +0900
- +++ com.c 2021-01-11 18:13:47.723157894 +0900
- @@ -128,10 +128,12 @@ __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.36
- #include "ioconf.h"
- +#if 0
- #define CSR_WRITE_1(r, o, v) \
- bus_space_write_1((r)->cr_iot, (r)->cr_ioh, (r)->cr_map[o], v)
- #define CSR_READ_1(r, o) \
- bus_space_read_1((r)->cr_iot, (r)->cr_ioh, (r)->cr_map[o])
- +#endif
- #define CSR_WRITE_2(r, o, v) \
- bus_space_write_2((r)->cr_iot, (r)->cr_ioh, (r)->cr_map[o], v)
- #define CSR_READ_2(r, o) \
- @@ -274,6 +276,76 @@ static const bus_size_t com_std_map[COM_
- #define COM_BARRIER(r, f) \
- bus_space_barrier((r)->cr_iot, (r)->cr_ioh, 0, (r)->cr_nports, (f))
- +struct event_rec_t {
- + unsigned char reg;
- + unsigned char write;
- + unsigned char dat;
- +};
- +
- +#define MAX_EVENTS 2048
- +static struct event_rec_t event_rec[MAX_EVENTS] = {{0,0,0}};
- +static int event_index = 0;
- +
- +static void event_record(int reg, int write, int dat)
- +{
- + if (event_index < MAX_EVENTS) {
- + event_rec[event_index].reg = reg;
- + event_rec[event_index].write = write;
- + event_rec[event_index].dat = dat;
- + event_index++;
- + }
- +}
- +
- +static void event_show(void)
- +{
- + static const char *string[] = {
- + "COM_REG_RXDATA",
- + "COM_REG_TXDATA",
- + "COM_REG_DLBL",
- + "COM_REG_DLBH",
- + "COM_REG_IER",
- + "COM_REG_IIR",
- + "COM_REG_FIFO",
- + "COM_REG_TCR",
- + "COM_REG_EFR",
- + "COM_REG_TLR",
- + "COM_REG_LCR",
- + "COM_REG_MCR",
- + "COM_REG_LSR",
- + "COM_REG_MSR",
- + "COM_REG_USR",
- + "COM_REG_TFL",
- + "COM_REG_RFL",
- + "COM_REG_HALT",
- + "COM_REG_MDR1",
- + };
- +
- + int i;
- + for (i = 0; i < event_index; i++) {
- + printf("%04d %s %s %02x\n", i,
- + string[event_rec[i].reg],
- + event_rec[i].write ? "<-" : "->",
- + event_rec[i].dat);
- + }
- +}
- +
- +static void CSR_WRITE_1(struct com_regs *r, int o, int v)
- +{
- +// if (o == COM_REG_FIFO) v = 0;
- + bus_space_write_1(r->cr_iot, r->cr_ioh, r->cr_map[o], v);
- + if (o == COM_REG_FIFO) event_record(o, 1, v);
- +}
- +
- +static uint8_t CSR_READ_1(struct com_regs *r, int o)
- +{
- + uint8_t v;
- +
- + v = bus_space_read_1(r->cr_iot, r->cr_ioh, r->cr_map[o]);
- + // event_record(o, 0, v);
- +
- + return v;
- +}
- +
- /*
- * com_init_regs --
- * Driver front-ends use this to initialize our register map
- @@ -1307,7 +1379,15 @@ com_break(struct com_softc *sc, int onof
- sc->sc_tbc = 0;
- sc->sc_heldchange = 1;
- } else
- + {
- + printf("%s: iot %p iobase %lx ioh %lx\n",
- + device_xname(sc->sc_dev),
- + sc->sc_regs.cr_iot,
- + sc->sc_regs.cr_iobase,
- + sc->sc_regs.cr_ioh);
- + event_show();
- com_loadchannelregs(sc);
- + }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment