From c0e7453d60231c949bde15bbcded33fef90be048 Mon Sep 17 00:00:00 2001 From: Patrick Macdonald Date: Wed, 17 Jun 1998 14:54:11 +0000 Subject: [PATCH] * sky-pke.h: PKE_REG_SET_MASK / PKE_MEM_WRITE macros updated to check/open the debug trace file --- sim/mips/sky-pke.h | 69 +++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/sim/mips/sky-pke.h b/sim/mips/sky-pke.h index 89634730b95..63601501176 100644 --- a/sim/mips/sky-pke.h +++ b/sim/mips/sky-pke.h @@ -326,16 +326,24 @@ do { \ #define PKE_REG_MASK_SET(me,reg,flag,value) \ do { \ unsigned_4 old = BIT_MASK_GET(((me)->regs[PKE_REG_##reg][0]), \ - PKE_REG_##reg##_##flag##_B, PKE_REG_##reg##_##flag##_E); \ + PKE_REG_##reg##_##flag##_B, PKE_REG_##reg##_##flag##_E); \ BIT_MASK_SET(((me)->regs[PKE_REG_##reg][0]), \ - PKE_REG_##reg##_##flag##_B, PKE_REG_##reg##_##flag##_E, \ - (value)); \ - if( indebug (me->dev.name)) \ - { \ - if (old != (value)) \ - fprintf(((me)->fifo_trace_file != NULL) ? (me)->fifo_trace_file : stdout, \ - "# Reg %s:%s = 0x%x\n", #reg, #flag, (unsigned)(value)); \ - } \ + PKE_REG_##reg##_##flag##_B, PKE_REG_##reg##_##flag##_E, \ + (value)); \ + if( indebug ((me)->dev.name)) \ + { \ + if (old != (value)) \ + { \ + if (((me)->fifo_trace_file == NULL ) && \ + ((me)->fifo_trace_file_name != NULL )) \ + sky_open_file (&((me)->fifo_trace_file), \ + (me)->fifo_trace_file_name, \ + (char *) NULL); \ + fprintf (((me)->fifo_trace_file != NULL) ? \ + (me)->fifo_trace_file : stdout, \ + "# Reg %s:%s = 0x%x\n", #reg, #flag, (unsigned)(value)); \ + } \ + } \ } while(0) /* get a bitfield from a register by "name" */ @@ -444,8 +452,8 @@ int read_pke_pcx (struct pke_device *device, void *buf); do { \ sim_cpu* cpu = STATE_CPU(CURRENT_STATE, 0); \ unsigned_##size value = \ - sim_core_read_aligned_##size(cpu, CIA_GET(cpu), read_map, \ - (SIM_ADDR)(addr)); \ + sim_core_read_aligned_##size(cpu, CIA_GET(cpu), read_map, \ + (SIM_ADDR)(addr)); \ memcpy((unsigned_##size*) (data), (void*) & value, size); \ } while(0) @@ -454,22 +462,31 @@ int read_pke_pcx (struct pke_device *device, void *buf); unsigned_##size value; \ memcpy((void*) & value, (unsigned_##size*)(data), size); \ sim_core_write_aligned_##size(cpu, CIA_GET(cpu), write_map, \ - (SIM_ADDR)(addr), value); \ + (SIM_ADDR)(addr), value); \ if (indebug (me->dev.name)) \ - { \ - int i; \ - unsigned_##size value_te; \ - value_te = H2T_##size(value); \ - fprintf(((me)->fifo_trace_file != NULL) ? (me)->fifo_trace_file : stdout, \ - "# Write %2d bytes to ", size); \ - fprintf(((me)->fifo_trace_file != NULL) ? (me)->fifo_trace_file : stdout, \ - "0x%08lx: ", (unsigned long)(addr)); \ - for(i=0; ififo_trace_file != NULL) ? (me)->fifo_trace_file : stdout, \ - " %02x", ((unsigned_1*)(& value_te))[i]); \ - fprintf(((me)->fifo_trace_file != NULL) ? (me)->fifo_trace_file : stdout, \ - "\n"); \ - } \ + { \ + int i; \ + unsigned_##size value_te; \ + value_te = H2T_##size(value); \ + if (((me)->fifo_trace_file == NULL ) && \ + ((me)->fifo_trace_file_name != NULL )) \ + sky_open_file (&((me)->fifo_trace_file), \ + (me)->fifo_trace_file_name, \ + (char *) NULL); \ + fprintf (((me)->fifo_trace_file != NULL) ? \ + (me)->fifo_trace_file : stdout, \ + "# Write %2d bytes to ", size); \ + fprintf (((me)->fifo_trace_file != NULL) ? \ + (me)->fifo_trace_file : stdout, \ + "0x%08lx: ", (unsigned long)(addr)); \ + for(i=0; ififo_trace_file != NULL) ? \ + (me)->fifo_trace_file : stdout, \ + " %02x", ((unsigned_1*)(& value_te))[i]); \ + fprintf (((me)->fifo_trace_file != NULL) ? \ + (me)->fifo_trace_file : stdout, \ + "\n"); \ + } \ } while(0) -- 2.30.2