mehfet, v3hil: more detailed debugging (optional)
This commit is contained in:
parent
37aacaca2d
commit
8ddf3cb68c
|
@ -402,6 +402,72 @@ static uint8_t bitswap(uint8_t in) {
|
|||
return (bitswap_nyb(in&0xf) << 4) | bitswap_nyb(in>>4);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_MEHFET_PROTO_DRIVER
|
||||
static const char* get_ir_name(uint8_t ir) {
|
||||
switch (ir) {
|
||||
case 0x09: return "EMEX_DATA_EXCHANGE";
|
||||
case 0x0a: return "EMEX_READ_TRIGGER";
|
||||
case 0x0b: return "EMEX_READ_CONTROL";
|
||||
case 0x0c: return "EMEX_WRITE_CONTROL";
|
||||
case 0x0d: return "EMEX_READ_CONTROL_2";
|
||||
case 0x0e: return "EMEX_WRITE_CONTROL_2";
|
||||
|
||||
case 0x11: return "CNTRL_SIG_HIGH_BYTE";
|
||||
case 0x12: return "CNTRL_SIG_LOW_BYTE";
|
||||
case 0x13: return "CNTRL_SIG_16BIT";
|
||||
case 0x14: return "CNTRL_SIG_CAPTURE";
|
||||
case 0x15: return "CNTRL_SIG_RELEASE";
|
||||
case 0x17: return "COREIP_ID";
|
||||
|
||||
case 0x19: return "FLASH_16BIT_UPDATE";
|
||||
case 0x1a: return "FLASH_CAPTURE";
|
||||
case 0x1b: return "FLASH_16BIT_IN";
|
||||
case 0x1c: return "FLASH_UPDATE";
|
||||
|
||||
case 0x21: return "CNTRL";
|
||||
case 0x22: return "PREPARE_BLOW";
|
||||
case 0x24: return "EX_BLOX";
|
||||
case 0x29: return "CONFIG_FUSES";
|
||||
case 0x2a: return "TEST_REG";
|
||||
case 0x2f: return "TEST_3V_REG";
|
||||
|
||||
case 0x31: return "DUAL_8BIT";
|
||||
case 0x32: return "DUAL_CAPTURE";
|
||||
case 0x33: return "SELECT_MAIN";
|
||||
case 0x34: return "SELECT_ESP";
|
||||
|
||||
case 0x41: return "DATA_16BIT";
|
||||
case 0x42: return "DATA_CAPTURE";
|
||||
case 0x43: return "DATA_QUICK";
|
||||
case 0x44: return "DATA_PSA";
|
||||
case 0x45: return "DATA_16BIT_OPT";
|
||||
case 0x46: return "SHIFT_OUT_PSA";
|
||||
case 0x47: return "DTA";
|
||||
|
||||
case 0x59: return "ACCEPT_KEY";
|
||||
|
||||
case 0x61: return "JMB_EXCHANGE";
|
||||
case 0x62: return "JSTATE_ID";
|
||||
case 0x64: return "TDO_EVENT";
|
||||
case 0x65: return "TDO_EVENT_CTL";
|
||||
|
||||
case 0x81: return "ADDR_HIGH_BYTE";
|
||||
case 0x82: return "ADDR_LOW_BYTE";
|
||||
case 0x83: return "ADDR_16BIT";
|
||||
case 0x84: return "ADDR_CAPTURE";
|
||||
|
||||
case 0x85: return "DATA_TO_ADDR";
|
||||
case 0x86: return "CAPTURE_CPU_REG";
|
||||
case 0x87: return "DEVICE_ID";
|
||||
case 0x88: return "JMB_WRITE_32BIT_MODE";
|
||||
|
||||
case 0xFF: return "BYPASS";
|
||||
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int mehfet_cmd_irshift(transport_t t, uint8_t newir, uint8_t* oldir) {
|
||||
if (!oldir) return -1;
|
||||
|
||||
|
@ -431,7 +497,12 @@ int mehfet_cmd_irshift(transport_t t, uint8_t newir, uint8_t* oldir) {
|
|||
*oldir = buf[0];
|
||||
|
||||
#ifdef DEBUG_MEHFET_PROTO_DRIVER
|
||||
const char* s = get_ir_name(newir);
|
||||
if (s) {
|
||||
printc_dbg("mehfet: IRshift(new=IR_%s) = 0x%02x\n", s, *oldir);
|
||||
} else {
|
||||
printc_dbg("mehfet: IRshift(new=0x%02x) = 0x%02x\n", newir, *oldir);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -463,9 +534,26 @@ int mehfet_cmd_drshift(transport_t t, uint32_t nbits, const uint8_t* newdr, uint
|
|||
memcpy(olddr, buf, nbytes);
|
||||
|
||||
#ifdef DEBUG_MEHFET_PROTO_DRIVER
|
||||
if (nbits == 16) {
|
||||
uint16_t in, out;
|
||||
in = newdr[0] | ((uint16_t)newdr[1] << 8);
|
||||
out= olddr[0] | ((uint16_t)olddr[1] << 8);
|
||||
printc_dbg("mehfet: DRshift(nbits=%u): in: %04x, out: %04x\n", nbits, in, out);
|
||||
} else if (nbits == 20) {
|
||||
uint32_t in, out;
|
||||
in = newdr[0] | ((uint32_t)newdr[1] << 8) | ((uint32_t)newdr[2] << 16);
|
||||
out= olddr[0] | ((uint32_t)olddr[1] << 8) | ((uint32_t)olddr[2] << 16);
|
||||
printc_dbg("mehfet: DRshift(nbits=%u): in: %05x, out: %05x\n", nbits, in, out);
|
||||
} else if (nbits == 32) {
|
||||
uint32_t in, out;
|
||||
in = newdr[0] | ((uint32_t)newdr[1] << 8) | ((uint32_t)newdr[2] << 16) | ((uint32_t)newdr[3] << 24);
|
||||
out= olddr[0] | ((uint32_t)olddr[1] << 8) | ((uint32_t)olddr[2] << 16) | ((uint32_t)olddr[3] << 24);
|
||||
printc_dbg("mehfet: DRshift(nbits=%u): in: %08x, out: %08x\n", nbits, in, out);
|
||||
} else {
|
||||
printc_dbg("mehfet: DRshift(nbits=%u):\n", nbits);
|
||||
debug_hexdump("\tin ", newdr, nbytes);
|
||||
debug_hexdump("\tout", olddr, nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "opdb.h"
|
||||
|
||||
#ifdef DEBUG_V3HIL
|
||||
#define dbg_printc(fmt, ...) printc_dbg("v3hil: " fmt, ##__VA_ARGS__)
|
||||
#define dbg_printc(fmt, ...) printc_dbg("v3hil: %s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define dbg_printc(fmt, ...) do{}while(0)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue