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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? arm7tdmi.c

?? 自制JTAG調試代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
 *		It is for later use to return from the DEBUG state back to 
 *		the SYSTEM state.
 *
 *		Please modify this function carefully.
 *
 *		@pc:	used to return the value of PC which indicates the next 
 *				instruction to be execute on exit from DEBUG state.
 */
int arm7tdmi_check_dbgstat(u32 *pc)
{
	int status;
	u32 r0;
	u32 dbgstat;
	u32 shift_in[2];
	u32 shift_out[2];

	if(pc == NULL)
		return XJERR_INVALID_PARAMATER;

	//In DEBUG state?
	if(arm7tdmi_status.state == ARM7TDMI_DEBUG_STATE)
		return XJERR_TARGET_HALTED;

	//Select scan chain 2
	status = arm7tdmi_connect_scanchain(2);
	if(status != XJ_OK)
		return status;

	//Check DEBUG status register
	arm7tdmi_ice_read(ARM7TDMI_ICE_DBGSTAT, &dbgstat);
	if(dbgstat & 0x1){
		arm7tdmi_status.state = ARM7TDMI_DEBUG_STATE;
		if (dbgstat & 0x10)
			arm7tdmi_status.from = ARM7TDMI_FROM_THUMB;
		else
			arm7tdmi_status.from = ARM7TDMI_FROM_ARM;
	}else
		return XJERR_TARGET_RUNNING;

	/*
	 * Try to obtain the value of PC when entering DEBUG state. The obtained
	 * value of PC indicates the next instruction to be executed on exit from
	 * DEBUG state.
	 */

	//Select scan chain 1
	status = arm7tdmi_connect_scanchain(1);
	if(status != XJ_OK)
		return status;


	if(arm7tdmi_status.from == ARM7TDMI_FROM_ARM){	//Enter DEBUG from ARM state

		//Step 1 - Read R0 

		//STR R0, [R0] = 0xE5800000					
		shift_in[0] = 0xE5800000;					//Instruction 1
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		/* 
		 * After the ARM7TDMI core has entered debug state from breakpt/watchpt,
		 * the first time the 33rd bit is captured and scanned out, its value 
		 * tells the debugger if the core entered debug state due to a breakpoint
		 * (bit 33 clear) or a watchpoint (bit 33 set).
		 */
		if(shift_out[1] & 0x1)
			arm7tdmi_status.by = ARM7TDMI_BY_WATCHPT;
		else
			arm7tdmi_status.by = ARM7TDMI_BY_BREAKPT;

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruction 2
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruction 3
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);
		r0 = shift_out[0];

		//Step 2 - Move PC to R0

		//MOV R0, PC = 0xE1A0000F
		shift_in[0] = 0xE1A0000F;					//Instruction 4
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);	

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//Step 3 - Read the value of PC from R0

		//STR R0, [R0] = 0xE5800000
		shift_in[0] = 0xE5800000;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);
		*pc = shift_out[0];

		/*
		 * Entry into DEBUG state from a breakpoint/watchpoint advances the 
		 * PC by four addresses. Each instruction executed in DEBUG state 
		 * advances the PC by one address. 
		 *
		 * To move the value of PC to R0, 4 instructions have been executed in D
		 * EBUG state. So,  the value of PC which indicates the next instruction
		 * should be executed on exit from DEBUG state is
		 *			pc - 4 x (4 + 4)
		 */
		*pc -= 32;

	}else{		//Enter DEBUG from THUMB state

		//Step 1 - Read R0 

		//STR R0, [R0] = 0x60006000
		shift_in[0] = 0x60006000;					//Instruction 1
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		/* 
		 * After the ARM7TDMI core has entered debug state from breakpt/watchpt,
		 * the first time the 33rd bit is captured and scanned out, its value 
		 * tells the debugger if the core entered debug state due to a breakpoint
		 * (bit 33 clear) or a watchpoint (bit 33 set).
		 */
		if(shift_out[1] & 0x1)
			arm7tdmi_status.by = ARM7TDMI_BY_WATCHPT;
		else
			arm7tdmi_status.by = ARM7TDMI_BY_BREAKPT;

		//NOP 
		shift_in[0] = 0x1C001C00;					//Instruction 2
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					//Instruction 3
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//R0
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);
		r0 = shift_out[0];

		//Step 2 - Move PC to R0

		//MOV R0, PC = 0x46784678
		shift_in[0] = 0x46784678;					//Instruction 4			
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//Step 3 - Read the value of PC from R0

		//STR R0, [R0] = 0x60006000
		shift_in[0] = 0x60006000;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);
		*pc = shift_out[0];

		/*
		 * Entry into DEBUG state from a breakpoint/watchpoint advances the 
		 * PC by four addresses. Each instruction executed in DEBUG state 
		 * advances the PC by one address. 
		 *
		 * To move the value of PC to R0, 4 instructions have been executed in D
		 * EBUG state. So,  the value of PC which indicates the next instruction
		 * should be executed on exit from DEBUG state is
		 *			pc - 2 x (4 + 4)
		 */	
		*pc -= 16;

		//Step4 - Switch from THUMB state to ARM state

		/*
		 * When enter DEBUG state, we make ARM7TDMI enter ARM state before any
		 * further debug is performed. When leave from DEBUG state, we make
		 * ARM7TDMI return to THUMB state before the normal operation is resumed.
		 */

		//BX PC = 0x47784778
		shift_in[0] = 0x47784778;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP 
		shift_in[0] = 0x1C001C00;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);
	}

	//LastStep - Restore R0
	arm7tdmi_core_wri_reg(ARM7TDMI_R0, r0);

	return XJ_OK;
}


/*
 * arm7tdmi_exit_dbgstat() - 
 *		This route is used to exit from the DEBUG state and return to the
 *		normal SYSTEM state. The input pc indicates the next instruction
 *		to be exectued on exit from DEBUG state. After some operations in
 *		the DEBUG state, this route can be used to exit from the DEBUG state
 *		and resume the execution of program under debug.
 *
 *		Please modify this function carefully.
 *
 *		@pc:	the value of pc which indicates the next instruction to
 *				be executed on exit from DEBUG state.
 */
int arm7tdmi_exit_dbgstat(u32 pc)
{
	int status;
	u32 r0;
	u32 shift_in[2];
	u32 shift_out[2];

	//In SYSTEM state?
	if(arm7tdmi_status.state == ARM7TDMI_SYSTEM_STATE)
		return XJ_OK;
	
	//Clear the DEBUGRQ flag in DBGCTRL register 
	status = arm7tdmi_connect_scanchain(2);
	if(status != XJ_OK)
		return status;

	status = arm7tdmi_ice_write(ARM7TDMI_ICE_DBGCTRL, 0x0);
	if(status != XJ_OK)
		return status;

	//Select scan chain 1
	status = arm7tdmi_connect_scanchain(1);
	if(status != XJ_OK)
		return status;

	if(arm7tdmi_status.from == ARM7TDMI_FROM_ARM){	//Enter DEBUG from ARM state

		//Step 1 - Read R0 & Write the new value of PC to R0

		pc &= 0xFFFFFFFC;	//Align
		status = arm7tdmi_core_rd_reg(ARM7TDMI_R0, &r0);
		status = arm7tdmi_core_wri_reg(ARM7TDMI_R0, pc);

		//Step 2 - Move R0 to PC

		//MOV PC, R0 = 0xE1A0F000					
		shift_in[0] = 0xE1A0F000;				
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 1
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 2
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//Step 3 - Restore R0

		//MOV R0, #0 = 0xE3A00000
		shift_in[0] = 0xE3A00000;					//Instruct 3
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 4
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 5
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//LDR R0, [R0] = 0xE5900000
		shift_in[0] = 0xE5900000;					//Instruct 6
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 7
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 8
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//R0 - put the value of R0 to the data bus
		shift_in[0] = r0;
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//Write the value obtained from data bus to R0
		shift_in[0] = ARM7TDMI_NOP;
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//Step 4 - Set SYSTEM speed flag

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 9	
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP + SYSTEM SPEED
		shift_in[0] = ARM7TDMI_NOP;					//Instruct 10		
		shift_in[1] = ARM7TDMI_SYSTEM_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		/*
		 * After move the new value to register PC, 10 instructions have been
		 * executed so far. To exit from DEBUG state and resume the normal 
		 * operation of the program under debug, 10 instructions backwards.
		 */

		//B -10 = 0xEAFFFFF6
		shift_in[0] = 0xEAFFFFF6;					//Final branch
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

	}else{	//Enter DEBUG from THUMB state

		//Step 1 - Read R0 & Write the new value of PC to R0

		pc &= 0xFFFFFFFE;	//Align
		status = arm7tdmi_core_rd_reg(ARM7TDMI_R0, &r0);
		status = arm7tdmi_core_wri_reg(ARM7TDMI_R0, pc + 1);

		//Step 2 - Switch from ARM state back to THUMB state first

		//BX R0 = 0xE12FFF10
		shift_in[0] = 0xE12FFF10;
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//NOP
		shift_in[0] = ARM7TDMI_NOP;					
		shift_in[1] = ARM7TDMI_DEBUG_SPEED;
		arm7tdmi_acs_sc1(shift_in, shift_out);

		//Step 3 - Sbbtract R0 by 1
		
		//SUB R0, #1 = 0x38013801
		shift_in[0] = 0x38013801;					

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲最大色网站| 一本色道久久综合精品竹菊| 国产大片一区二区| 欧美色网站导航| 亚洲国产精品av| 麻豆精品久久久| 日本国产一区二区| 国产精品久久久久久久久久免费看 | www国产精品av| 视频在线观看91| 99国产精品久| 2020国产成人综合网| 日本在线不卡视频| 欧美在线免费观看视频| 中文在线一区二区 | 国产福利一区二区三区| 欧美二区在线观看| 一区二区三区四区激情| 波多野结衣中文字幕一区二区三区| 日韩视频在线观看一区二区| 日韩主播视频在线| 欧美视频一区在线观看| 亚洲色图.com| 一本一道久久a久久精品 | 亚洲精品一线二线三线无人区| 亚洲成人一区二区在线观看| 在线看国产一区| 亚洲一区二区欧美| 91黄色小视频| 一区二区三区高清| 欧美在线观看一区| 亚洲图片欧美色图| 欧美一区二区三区小说| 日韩精品欧美成人高清一区二区| 欧美日韩在线不卡| 日本视频免费一区| 久久综合色8888| 国产剧情av麻豆香蕉精品| 国产欧美综合在线观看第十页| 国产精品资源网| 国产精品视频观看| 91蜜桃婷婷狠狠久久综合9色| 亚洲少妇30p| 欧美日韩视频在线一区二区| 日本美女一区二区| 久久综合中文字幕| 成人免费视频国产在线观看| 国产精品传媒入口麻豆| 色菇凉天天综合网| 日韩精品欧美成人高清一区二区| 日韩欧美中文字幕制服| 国产盗摄精品一区二区三区在线| 亚洲欧美日韩在线播放| 欧美另类videos死尸| 狠狠色伊人亚洲综合成人| 欧美国产综合色视频| 色呦呦日韩精品| 日本视频一区二区| 国产精品欧美一级免费| 欧美丝袜丝交足nylons| 精品午夜久久福利影院| 亚洲青青青在线视频| 欧美一区二区视频在线观看2022| 国产成人午夜视频| 亚洲一区二区美女| 久久这里只有精品视频网| 91丨porny丨户外露出| 日本一道高清亚洲日美韩| 中文字幕精品一区| 欧美日韩一区三区| 粉嫩高潮美女一区二区三区| 亚洲影院在线观看| 日本一区二区电影| 欧美日韩不卡一区二区| 成人免费视频网站在线观看| 爽好多水快深点欧美视频| 亚洲欧洲精品天堂一级| 欧美一级免费大片| 色婷婷精品大在线视频| 国产呦精品一区二区三区网站| 夜夜操天天操亚洲| 国产人成一区二区三区影院| 51精品秘密在线观看| 91丨九色porny丨蝌蚪| 国产高清成人在线| 久久精品国产99国产| 亚洲成人黄色影院| 亚洲日本青草视频在线怡红院| 久久久91精品国产一区二区精品 | 国产精品嫩草99a| 日韩欧美一区电影| 欧美色综合网站| 色婷婷久久99综合精品jk白丝| 国产91丝袜在线18| 精品一区二区三区在线播放| 亚洲不卡av一区二区三区| 日韩美女视频一区| 国产精品第五页| 国产日韩亚洲欧美综合| 精品国产免费一区二区三区四区 | 日本二三区不卡| 成人久久久精品乱码一区二区三区| 美女视频一区二区三区| 午夜欧美视频在线观看 | 欧美系列亚洲系列| 99久久国产综合精品女不卡| 国产成人激情av| 国产风韵犹存在线视精品| 久久精品国产精品青草| 秋霞电影网一区二区| 免费在线看一区| 麻豆成人91精品二区三区| 日韩国产一二三区| 日韩精品视频网| 毛片不卡一区二区| 黄网站免费久久| 国产精品99久久不卡二区| 国产福利一区在线| 粉嫩在线一区二区三区视频| 成人av免费网站| 91视频在线观看| 色94色欧美sute亚洲线路一久| 91精彩视频在线| 91精品国产综合久久福利软件| 欧美一级二级在线观看| 欧美精品一区二区三区很污很色的| 日韩亚洲欧美一区二区三区| 精品国产电影一区二区| 久久九九久精品国产免费直播| 国产精品久久久久久久久免费相片| 亚洲乱码国产乱码精品精98午夜| 一区二区不卡在线视频 午夜欧美不卡在| 亚洲精品国产a| 99国产精品久| 日韩美女视频在线| 欧美一级理论片| 精品一区二区在线观看| 欧美r级电影在线观看| 天天影视涩香欲综合网| 午夜电影一区二区三区| 日韩国产高清影视| 国产成人午夜精品影院观看视频 | 国产精品一区二区不卡| 99国产精品久| 91精品国产欧美日韩| 久久久不卡网国产精品二区| 国产精品白丝在线| 天天亚洲美女在线视频| 成人免费毛片片v| 欧美日韩高清一区二区不卡| 国产欧美日韩三级| 亚洲综合激情另类小说区| 精品一区二区日韩| 色婷婷综合中文久久一本| 欧美成人video| 亚洲猫色日本管| 黑人精品欧美一区二区蜜桃| 色婷婷精品久久二区二区蜜臂av| 欧美大片日本大片免费观看| ...av二区三区久久精品| 免费高清在线视频一区·| 99久久综合精品| 久久婷婷一区二区三区| 亚洲中国最大av网站| 不卡一区二区在线| 日韩欧美卡一卡二| 亚洲线精品一区二区三区| 丁香婷婷综合激情五月色| 91精品欧美综合在线观看最新| 国产精品久久久久7777按摩| 免费成人在线播放| 欧美三片在线视频观看| 中文字幕欧美一区| 国产一区久久久| 欧美大片在线观看| 日韩成人一区二区三区在线观看| 91丝袜美腿高跟国产极品老师 | 色8久久精品久久久久久蜜| 国产人妖乱国产精品人妖| 美国十次了思思久久精品导航| 欧美性色黄大片手机版| 国产精品不卡一区二区三区| 国产成人亚洲综合a∨婷婷图片| 日韩欧美国产麻豆| 日韩激情在线观看| 欧美日韩精品一区二区三区蜜桃 | 欧美日韩小视频| 亚洲一区二区三区不卡国产欧美| 99久久久久久| 国产精品入口麻豆九色| 国产成人av电影在线| 久久久精品一品道一区| 国内精品久久久久影院色 | 国产电影一区在线| 久久精品无码一区二区三区| 经典一区二区三区| 久久久久国色av免费看影院| 国产成人超碰人人澡人人澡| 久久久久国色av免费看影院| 粉嫩aⅴ一区二区三区四区 |