int dump_lcm_register(char *buf) { int i, j; unsigned char param_cnt; unsigned char addr; unsigned char data[15]; int table_size = sizeof(INN_register_table)/sizeof(LCM_register_table); int ret = FALSE; // register data not changed LCM_register_table *ptr = table_ptr; for(i = 0; i < table_size; i++) { memset(data, 0xFF, sizeof(data)); addr = ptr[i].address; param_cnt = ptr[i].count; register_data_read(addr, param_cnt, &data); LCM_PRINT("[LCD] DUMP LCM REGISTER ADDRESS : 0x%x, data : 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", addr, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14]); if(register_compare(addr, data, param_cnt) == FALSE) { sprintf(buf, "%s 0x%x", buf, addr); ret = TRUE; // register data changed } } sprintf(buf, "%s\0", buf); return ret; }
void discovery( chain_t *chain ) { int irlen; tap_register *ir; tap_register *irz; /* detecting IR size */ jtag_reset( chain ); printf( _("Detecting IR length ... ") ); fflush( stdout ); tap_capture_ir( chain ); irlen = detect_register_size( chain ); printf( _("%d\n"), irlen ); if (irlen < 1) { printf( _("Error: Invalid IR length!\n") ); return; } /* all 1 is BYPASS in all parts, so DR length gives number of parts */ ir = register_fill( register_alloc( irlen ), 1 ); irz = register_duplicate( ir ); if (!ir || !irz) { register_free( ir ); register_free( irz ); printf( _("Error: Out of memory!\n") ); return; } for (;;) { int rs; jtag_reset( chain ); tap_capture_ir( chain ); tap_shift_register( chain, ir, NULL, 1 ); printf( _("Detecting DR length for IR %s ... "), register_get_string( ir ) ); fflush( stdout ); tap_capture_dr( chain ); rs = detect_register_size( chain ); printf( _("%d\n"), rs ); register_inc( ir ); if (register_compare( ir, irz ) == 0) break; } register_free( ir ); register_free( irz ); }
bool lcm_register_check(unsigned char addr) { unsigned char data[15] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; unsigned char param_cnt; unsigned char i; bool result; switch(addr) { case 0x35 : // Fall through case 0x36 : // Fall through case 0x3A : // Fall through case 0xB4 : // Fall through case 0xB6 : // Fall through case 0xB7 : // Fall through case 0xC1 : // Fall through case 0xC2 : // Fall through case 0xC5 : // Fall through case 0xEE : // Fall through param_cnt = 1; break; case 0x0A : // Fall through case 0x44 : // Fall through case 0xB1 : // Fall through case 0xC0 : // Fall through case 0xCF : // Fall through param_cnt = 2; break; case 0xF6 : param_cnt = 3; break; case 0x09 : param_cnt = 5; break; case 0xE0 : // Fall through case 0xE1 : // Fall through param_cnt = 15; break; default : LCM_PRINT("[LCD] lcm_register_check, wrong address : 0x%x\n", addr); return TRUE; break; } result = register_data_read(addr, param_cnt, &data); if(result == TRUE) { return register_compare(addr, data, param_cnt); } else { LCM_PRINT("[LCD] register data read fail, return TRUE\n"); return TRUE; } }
int detect_register_size( chain_t *chain ) { int len; tap_register *rz; tap_register *rout; tap_register *rpat; /* This seems to be a good place to check if TDO changes at all */ int tdo, tdo_stuck = -2; for (len = 1; len <= MAX_REGISTER_LENGTH; len++) { int p; int ok = 0; rz = register_fill( register_alloc( len ), 0 ); rout = register_alloc( DETECT_PATTERN_SIZE + len ); rpat = register_inc( register_fill( register_alloc( DETECT_PATTERN_SIZE + len ), 0 ) ); for (p = 1; p < (1 << DETECT_PATTERN_SIZE); p++) { int i; const char *s; ok = 0; s = register_get_string( rpat ); while (*s) s++; for (i = 0; i < TEST_COUNT; i++) { tap_shift_register( chain, rz, NULL, 0 ); tap_shift_register( chain, rpat, rout, 0 ); #ifdef VERY_LOW_LEVEL_DEBUG printf(">>> %s\n", register_get_string(rz)); printf(" + %s\n", register_get_string(rpat)); #endif tdo = register_all_bits_same_value(rout); if(tdo_stuck == -2) tdo_stuck = tdo; if(tdo_stuck != tdo) tdo_stuck = -1; register_shift_right( rout, len ); if (register_compare( rpat, rout ) == 0) ok++; #ifdef VERY_LOW_LEVEL_DEBUG printf(" = %s => %d\n", register_get_string(rout), ok); #endif } if (100 * ok / TEST_COUNT < TEST_THRESHOLD) { ok = 0; break; } register_inc( rpat ); } register_free( rz ); register_free( rout ); register_free( rpat ); if (ok) return len; } if(tdo_stuck >= 0) { printf(_("Warning: TDO seems to be stuck at %d\n"), tdo_stuck); } return -1; }