亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? register.c

?? 一個(gè)簡易調(diào)試器(支持ARM7TDMI)
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * target/arm7tdmi/register.c: implements the ARM7TDMI target core's registers
 * 			       read/write operations.
 *
 * Copyright (C) 2003, Rongkai zhan <zhanrk@163.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/* $Id$ */

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "jtager.h"
#include "jtag.h"
#include "target.h"

#define JTAGER_REGISTER_DEBUG

core_register_t arm7tdmi_regs[] = {
	{"R0", 0x0L}, {"R1", 0x0L}, {"R2", 0x0L}, {"R3", 0x0L},
	{"R4", 0x0L}, {"R5", 0x0L}, {"R6", 0x0L}, {"R7", 0x0L},
	{"R8", 0x0L}, {"R9", 0x0L}, {"R10", 0x0L}, {"R11", 0x0L},
	{"R12", 0x0L}, {"R13", 0x0L}, {"R14", 0x0L}, {"R15", 0x0L},
	{"PC", 0x0L}, {"CPSR", 0x0L}, {"SPSR", 0x0L},
	{NULL, 0x0L} /* the last element must be NULL */
};

/*
 * arm7tdmi_r0_read - read the content of R0 register
 */
u32 arm7tdmi_r0_read(void)
{
	scan_chain_t *sc1 = &arm7tdmi_target.sc[1];
	u32 value;
	
	sc1->writein[0] = 0xE5800000; /* STR R0, [R0] */
	sc1->writein[1] = DEBUG_SPEED;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* Execute "STR R0, [R0]" -- read out R0
	 * This is 1st cycle of STR instruction.
	 * In the 2nd cycle, R0's value will be visible on the data bus.
	 */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* 2nd cycle of STR instruction */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	value = sc1->readout[0]; /* get R0 value */
	return value;
} /* arm7tdmi_r0_read( ) */

/*
 * arm7tdmi_r0_write - write a new value into R0 register
 * 
 * NOTE: It seems only if we must perform two write stage,
 * the things will work. What's wrong??? Who can tell me?
 * 	 (1) Stage1: write a zero to R0 register.
 * 	 (2) Stage2: write the true new value to R0 register.
 */
void arm7tdmi_r0_write(u32 newval)
{
	scan_chain_t *sc1 = &arm7tdmi_target.sc[1];
	
	/*
	 * Stage 1: zero R0 register.
	 */
	sc1->writein[0] = 0xE5900000; /* LDR R0, [R0] = 0xE5900000 */
	sc1->writein[1] = DEBUG_SPEED;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* 1st cycle of LDR instruction */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* 2nd cycle of LDR instruction -- scan in data */
	sc1->writein[0] = 0;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* 3rd cycle of LDR instruction */
	sc1->writein[0] = ARM_NOP;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/*
	 * Stage 2: write the true new value.
	 */
	sc1->writein[0] = 0xE5900000; /* LDR R0, [R0] = 0xE5900000 */
	sc1->writein[1] = DEBUG_SPEED;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* LDR instruction's 1st cycle */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* LDR instruction's 2nd cycle ... scan in data */
	sc1->writein[0] = newval; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* LDR instruction's 3rd cycle */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	return;
} /* end of arm7tdmi_r0_write(...) */

static u32 arm7tdmi_cpsr_read(void)
{
	scan_chain_t *sc1 = &arm7tdmi_target.sc[1];
	u32 value;

	sc1->writein[0] = 0xE10F0000; /* MRS R0, CPSR */
	sc1->writein[1] = DEBUG_SPEED;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	sc1->writein[0] = 0xE5800000; /* STR R0, [R0] */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* Execute "MRS R0, CPSR" */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* Execute "STR R0, [R0]" -- read out R0
	 * This is 1st cycle of STR instruction.
	 * In the 2nd cycle, R0's value will be visible on the data bus.
	 */
	sc1->writein[0] = ARM_NOP;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* 2nd cycle of STR instruction */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	value = sc1->readout[0]; /* get CPSR value */
	return value;
} /* end of arm7tdmi_cpsr_read() */

static u32 arm7tdmi_spsr_read(void)
{
	scan_chain_t *sc1 = &arm7tdmi_target.sc[1];
	u32 value;

	sc1->writein[0] = 0xE14F0000; /* MRS R0, SPSR */
	sc1->writein[1] = DEBUG_SPEED;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	sc1->writein[0] = 0xE5800000; /* STR R0, [R0] */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* Execute "MRS R0, CPSR" */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* Execute "STR R0, [R0]" -- read out R0
	 * This is 1st cycle of STR instruction.
	 * In the 2nd cycle, R0's value will be visible on the data bus.
	 */
	sc1->writein[0] = ARM_NOP;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	/* 2nd cycle of STR instruction */
	sc1->writein[0] = ARM_NOP; /* NOP */
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);

	value = sc1->readout[0]; /* get SPSR value */
	return value;
} /* end of arm7tdmi_spsr_read() */

/*
 * arm7tdmi_get_core_state - Read all registers of cpu core
 * 
 * NOTE: We use the following instructions sequence to determine
 * the internal state of ARM7TDMI core:
 * 	STMIA R0, {R0-R15} ; make the contents of R1-R15 registers
 * 			   ; visible on the data bus.
 * 	MRS R0, CPSR ; copy CPSR to R0
 * 	STR R0, [R0] ; make CPSR's content visible on the data bus.
 * 	MRS R0, SPSR ; copy SPSR to R0
 * 	STR R0, [R0] ; make SPSR's content visible on the data bus.
 * 		     ; At the same time, we read out the value of CPSR.
 * 	MOV R0, R0 ; NOP
 * 	MOV R0, R0 ; NOP, read out the value of SPSR.
 *
 * NOTICE: All the above instructions are executed in debug-speed.
 *
 * STMIA R0, {R0-R15} = 0xE880FFFF
 * OPCODE: cond = AL (1110), always executed.
 * 	   bit[27:25] = 100, fixed.
 * 	   P bit (bit[24]) = 0, Post: add offset after transfer.
 * 	   U bit (bit[23]) = 1, Up: add offset to base.
 * 	   S bit (bit[22]) = 0. 
 * 	   W bit (bit[21]) = 0, do not update base register.
 * 	   L bit (bit[20]) = 0, Store instruction.
 * 	   Rn (bit[19:16]) = 0000, R0 is the base register.
 * 	   Register List (bit[15:0]) = FFFF, all register is invovled.
 * 1110 1000 1000 0000 1111 1111 1111 1111 = 0xE880FFFF
 *
 * MRS R0, CPSR = 0xE10F0000
 * STR R0, [R0] = 0xE5800000
 * MRS R0, SPSR = 0xE14F0000
 * MOV R0, R0 ; NOP, OPCODE = 0xE1A00000
 */
int arm7tdmi_get_core_state(void)
{
	int i, retval;
	core_register_t *reg_pc = reg_index("PC");
	core_register_t *cpsr = reg_index("CPSR");
	core_register_t *spsr = reg_index("SPSR");
	scan_chain_t *sc1 = &target->sc[1];

	if (target->status == TARGET_STATUS_RUNNING)
		return -ERR_TARGET_IS_RUNNING;
	else if (target->mode == TARGET_MODE_THUMB)
		return -ERR_TARGET_IN_THUMB_MODE;
	
	/*
	 * Select scan chain 1, and use INTEST instruction to make scan
	 * chain 1 into the internal test mode.
	 */	
	retval = jtag_select_scanchain(1);
	if (retval)
		return retval;
	retval = jtag_write_ireg(JTAG_INTEST);
	if (retval)
		return retval;

	/* all the following instructions are executed in debug-speed */
	sc1->writein[1] = DEBUG_SPEED;
	
	/* STMIA R0, {R0-R15} = 0xE880FFFF */
	sc1->writein[0] = 0xE880FFFF;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	sc1->writein[0] = ARM_NOP;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/*
	 * Execute "STMIA R0, {R0-R15} while fetching this instruction.
	 * This is the 1st cycle of STM instruction ...
	 */
	sc1->writein[0] = ARM_NOP;
	arm7tdmi_exec_instruction(sc1->writein, sc1->readout);
	
	/* 
	 * Read out the contents of r0-r15 registers in the
	 * next 16 cycles of STM instruction.
	 */
	sc1->writein[0] = ARM_NOP;
	for (i = 0; i <= 15; i++) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美综合另类在线卡通| 国产三级精品三级| 亚洲一区二区黄色| 欧美综合亚洲图片综合区| 亚洲日本一区二区三区| 欧美在线观看一区| 日韩电影免费一区| 欧美不卡视频一区| 国产电影一区二区三区| 国产精品二三区| 91久久精品一区二区二区| 亚洲成人资源网| 日韩欧美不卡在线观看视频| 国产精品资源站在线| 日韩一区欧美一区| 欧美精品粉嫩高潮一区二区| 国内精品视频一区二区三区八戒| 国产欧美一区二区三区鸳鸯浴| gogo大胆日本视频一区| 亚洲动漫第一页| 久久这里只有精品视频网| av午夜一区麻豆| 午夜精品视频在线观看| 国产夜色精品一区二区av| 色丁香久综合在线久综合在线观看| 午夜私人影院久久久久| 国产三级精品视频| 欧美日韩国产高清一区二区 | 欧美日韩免费高清一区色橹橹| 午夜久久福利影院| 国产亚洲婷婷免费| 色哟哟一区二区| 精品一区二区三区欧美| 亚洲欧美一区二区三区久本道91| 91麻豆精品国产91久久久资源速度 | 91在线观看一区二区| 午夜伦理一区二区| 国产精品久久久久久久浪潮网站 | 国产一区在线观看视频| 亚洲精品高清在线观看| 久久综合999| 欧美日韩亚洲国产综合| 成人av在线资源网站| 奇米精品一区二区三区在线观看 | 精品亚洲免费视频| 一区二区三区四区不卡在线 | 69堂精品视频| 91网站黄www| 国产美女娇喘av呻吟久久| 香蕉久久夜色精品国产使用方法| 国产精品久久综合| 久久综合九色综合欧美98| 欧美剧情片在线观看| 91蝌蚪porny| 丁香婷婷深情五月亚洲| 精品一区二区三区免费视频| 五月婷婷欧美视频| 亚洲免费av观看| 日本一区二区三区视频视频| 精品国产免费视频| 911精品产国品一二三产区| 91九色最新地址| www国产成人| 日韩欧美在线1卡| 7777精品伊人久久久大香线蕉的| 日本道免费精品一区二区三区| 高清国产一区二区| 国产河南妇女毛片精品久久久| 久久久久久免费毛片精品| 欧日韩精品视频| 99久久国产综合色|国产精品| 国产成人综合亚洲网站| 韩国三级电影一区二区| 美女尤物国产一区| 日韩成人精品视频| 日本在线不卡视频| 日韩av电影天堂| 美国毛片一区二区三区| 免费在线观看不卡| 久久国产成人午夜av影院| 日韩av电影免费观看高清完整版 | 日韩在线一区二区三区| 亚洲图片欧美色图| 爽爽淫人综合网网站| 日韩专区一卡二卡| 免费看黄色91| 国产美女久久久久| 不卡的av电影| 91福利资源站| 欧美乱熟臀69xxxxxx| 91精品婷婷国产综合久久| 91精品麻豆日日躁夜夜躁| 欧美一区二区三区免费大片| 日韩丝袜情趣美女图片| 久久久蜜桃精品| 国产精品久久久久久户外露出| 最新国产の精品合集bt伙计| 亚洲一区二区三区在线| 日韩中文字幕麻豆| 国产做a爰片久久毛片| 国产91在线|亚洲| 一本一道久久a久久精品| 欧美性xxxxxx少妇| 欧美电影精品一区二区| 国产欧美日韩精品在线| 亚洲综合一区在线| 久久狠狠亚洲综合| 成人美女在线视频| 欧美日韩中文字幕一区| 欧美sm美女调教| 国产精品久久久久精k8 | 午夜精品一区二区三区电影天堂| 美女脱光内衣内裤视频久久网站 | 亚洲乱码一区二区三区在线观看| 亚洲成在人线在线播放| 国产乱码精品一区二区三区忘忧草| 国产91精品欧美| 欧美日韩在线三级| 26uuu成人网一区二区三区| 亚洲欧美日韩国产综合| 老司机午夜精品| 色综合久久久网| 精品久久久久久最新网址| 亚洲三级视频在线观看| 久久精品99国产精品| 一本久道久久综合中文字幕| 精品少妇一区二区三区在线视频| 日韩久久一区二区| 紧缚奴在线一区二区三区| 色94色欧美sute亚洲线路一久 | 久久日韩粉嫩一区二区三区| 亚洲精品国产无套在线观| 国产又粗又猛又爽又黄91精品| 欧洲国产伦久久久久久久| 久久综合九色综合97婷婷 | 亚洲成a人v欧美综合天堂| 国产伦精品一区二区三区免费迷 | 国产精品高清亚洲| 久久国产成人午夜av影院| 欧美亚洲国产一区二区三区| 久久久精品tv| 久久99九九99精品| 欧美日韩亚洲不卡| 亚洲精品精品亚洲| 成人动漫中文字幕| 亚洲精品一区二区三区影院| 日日噜噜夜夜狠狠视频欧美人| 色综合中文字幕国产 | 欧美久久久一区| 亚洲乱码国产乱码精品精小说| 国产永久精品大片wwwapp| 欧美一区二区三区视频在线观看| 亚洲精品视频在线观看免费| 丁香一区二区三区| 久久久国产精品不卡| 美女网站一区二区| 欧美丰满美乳xxx高潮www| 亚洲一区二区三区四区在线 | 国产精品正在播放| 欧美电影免费观看高清完整版 | 亚洲一区二区三区小说| 91美女福利视频| 中文字幕亚洲一区二区av在线| 丁香另类激情小说| 国产欧美1区2区3区| 国产成人欧美日韩在线电影| 久久久久久久久99精品| 国产制服丝袜一区| 国产亚洲精品7777| 成人激情动漫在线观看| 国产精品久99| 色菇凉天天综合网| 性做久久久久久免费观看| 欧美巨大另类极品videosbest | 久久国产精品免费| 欧美r级电影在线观看| 精品亚洲免费视频| 久久久五月婷婷| 成人涩涩免费视频| 亚洲欧美视频一区| 欧美性videosxxxxx| 视频一区中文字幕| 欧美成人免费网站| 成人在线视频一区| 亚洲裸体在线观看| 欧美人妖巨大在线| 精品影视av免费| 国产精品乱子久久久久| 一本一道久久a久久精品| 午夜精品久久久久久久 | 国产喷白浆一区二区三区| 成人黄色软件下载| 亚洲黄色片在线观看| 欧美一区二区三区性视频| 国产酒店精品激情| 亚洲欧洲日韩综合一区二区| 在线观看一区不卡| 久久精品国产**网站演员| 中文字幕av一区二区三区高 | 欧美久久久久久久久久|