예제 #1
0
int mips_ejtag_drscan_38(struct mips_ejtag *ejtag_info, uint64_t *data)
{
	struct jtag_tap *tap;
	tap  = ejtag_info->tap;

	if (tap == NULL)
		return ERROR_FAIL;

	mips_ejtag_set_instr(ejtag_info, EJTAG_DCR_FDC);

	struct scan_field field;

	uint8_t t[5], r[5];
	int retval;

	field.num_bits = 38;
	field.out_value = &t;
	buf_set_u64(t, 0, field.num_bits, *data);
	field.in_value = r;

	jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
	retval = jtag_execute_queue();
	if (retval != ERROR_OK) {
		LOG_ERROR("register read failed");
		return retval;
	}

	*data = buf_get_u64(field.in_value, 0, 64);

	keep_alive();

	return ERROR_OK;
}
예제 #2
0
/*
 * PIR (Probe Mode Instruction Register), SUBMITPIR is an "IR only" TAP
 * command; there is no corresponding data register
 */
static int submit_pir(struct target *t, uint64_t op)
{
	struct x86_32_common *x86_32 = target_to_x86_32(t);
	uint32_t tapstatus = 0;

	uint8_t op_buf[8];
	buf_set_u64(op_buf, 0, 64, op);
	int flush = x86_32->flush;
	x86_32->flush = 0;
	scan.out[0] = WRPIR;
	if (irscan(t, scan.out, NULL, LMT_IRLEN) != ERROR_OK)
		return ERROR_FAIL;
	if (drscan(t, op_buf, scan.out, PIR_SIZE) != ERROR_OK)
		return ERROR_FAIL;
	scan.out[0] = SUBMITPIR;
	x86_32->flush = flush;
	if (irscan(t, scan.out, NULL, LMT_IRLEN) != ERROR_OK)
		return ERROR_FAIL;
	jtag_add_sleep(DELAY_SUBMITPIR);

	/* HACK */
	if (x86_32->flush) {
		int cnt = 10;
		do {
			tapstatus = get_tapstatus(t);
			if (!(tapstatus & TS_PIR_BIT))
				return ERROR_OK;

			LOG_DEBUG("%s Waiting for TS_PIR_BIT, TS = 0x%08" PRIx32,
					__func__, tapstatus);
			usleep(100);
			cnt--;
		} while (cnt);
		LOG_ERROR("%s TS_PIR_BIT did not clear, TS = 0x%08" PRIx32,
				__func__, tapstatus);
		return ERROR_FAIL;
		/* TODO: find a nicer way to wait until PM_BIT changes*/
	}

	return ERROR_OK;

}
예제 #3
0
/*
 * PIR (Probe Mode Instruction Register), SUBMITPIR is an "IR only" TAP
 * command; there is no corresponding data register
 */
static int submit_pir(struct target *t, uint64_t op)
{
	struct x86_32_common *x86_32 = target_to_x86_32(t);

	uint8_t op_buf[8];
	buf_set_u64(op_buf, 0, 64, op);
	int flush = x86_32->flush;
	x86_32->flush = 0;
	scan.out[0] = WRPIR;
	if (irscan(t, scan.out, NULL, LMT_IRLEN) != ERROR_OK)
		return ERROR_FAIL;
	if (drscan(t, op_buf, scan.out, PIR_SIZE) != ERROR_OK)
		return ERROR_FAIL;
	scan.out[0] = SUBMITPIR;
	x86_32->flush = flush;
	if (irscan(t, scan.out, NULL, LMT_IRLEN) != ERROR_OK)
		return ERROR_FAIL;
	jtag_add_sleep(DELAY_SUBMITPIR);
	return ERROR_OK;
}
예제 #4
0
파일: ls1_sap.c 프로젝트: arduino/OpenOCD
static void ls1_sap_memory_cmd(struct jtag_tap *tap, uint32_t address,
			       int32_t size, bool rnw)
{
	struct scan_field field;
	uint8_t cmd[8];

	ls1_sap_set_instr(tap, 0x24);

	field.num_bits = 64;
	field.out_value = cmd;
	buf_set_u64(cmd, 0, 9, 0);
	buf_set_u64(cmd, 9, 3, size);
	buf_set_u64(cmd, 12, 1, rnw);
	buf_set_u64(cmd, 13, 3, 0);
	buf_set_u64(cmd, 16, 32, address);
	buf_set_u64(cmd, 48, 16, 0);
	field.in_value = NULL;
	field.check_value = NULL;
	field.check_mask = NULL;
	jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
}