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

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

?? cf_routines.asm

?? 通過TMS320VC5402DSP芯片讀寫CF卡的源程序
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
**********************************************************************
* Code to perform CompactFlash Memory Card Operations
* Author:	Miguel Hernandez IV
* Filename:	cf_routines.asm
* Date:		07-30-01
* Revised:	11-04-01, minor updates to prepare for publication.
**********************************************************************
* This file contains a set of '54x code functions used to access a 
* Compact Flash card. The concepts implemented here are documented 
* in an application note titled, "Compact Flash Memory Card 
* Interface for the TMS320VC54x", TI Literature number SPRA803.
*
* These functions are C-callable, but they can also be called from
* assembly code as long as the calling code follows the calling
* conventions. The first (left most) argument must be placed in
* accumulator A, and the remaning arguments must be placed on the 
* stack in reverse order. If a value is returned, it is placed in
* in accumulator A. Here's an example of calling one of these 
* functions from assembly:
*
*	LD #0, A			;Put 1st arg in A
*	PSHM BL				;Push next arg on stack
*	LD #1, B			;Get next arg 
*	NOP
*	PSHM BL				;Push next arg on stack
*	CALL _CF_IssueCommand		;Call the function
*	POPM BL				;Pop arguments off stack
*	POPM BL				;Pop arguments off stack
*
* Refer to Chapter 6 of, "TMS320C54x Optimizing C/C++ Compiler
* User's Guide", TI Literature number SPRU103 for more information
* on this.
**********************************************************************
* Note:	Some of the functions in this example terminate on an error 
*	condition by branching to the C exit function. An error flag 
*	is set in these functions prior to exiting. A more 
*	sophisticated error processing scheme should be implemented 
*	for real applications.
**********************************************************************                                                                      
	.mmregs
	.include "cf_io_space.inc"
                                                                      
**********************************************************************
* Macros
**********************************************************************

**** Read an ATA Register

ATARegRead	.macro	ATAReg, RegState
			CALL _CF_CheckReadyStatus
			PORTR #ATAReg, *(RegState)
			.endm
			
**** Write an ATA Register

ATARegWrite	.macro	ATARegParam, ATAReg
			CALL _CF_CheckReadyStatus
			PORTW *(ATARegParam), #ATAReg
			.endm						

**********************************************************************
* Function Definitions
**********************************************************************
     
        .def _DSP_Init
	.def _CF_HardwareReset
	.def _CF_CheckBusyStatus
	.def _CF_CheckReadyStatus
	.def _CF_CheckDrqStatus 
	.def _CF_CheckErrorStatus
	.def _CF_IssueCommand
	.def _CF_IdentifyDrive
	.def _ReadCF
	.def _WriteCF         
	.def _CF_Present
	
	.global C$$EXIT					;C exit label
	
**********************************************************************
* Uninitialized Variables
**********************************************************************

	.bss Status,		1	;status register state
	.bss CrdHeadSt, 	1       
	.bss ErrorSt, 		1         
	.bss SectCntSt, 	1       
	.bss SectNumSt, 	1       
	.bss CylnLowSt, 	1       
	.bss CylnHighSt,	1 
	.bss BusyTimeOut,	1	;Busy Timeout Indicator
	.bss RDYTimeOut, 	1	;RDY Timeout Indicator
	.bss DRQTimeOut, 	1	;DRQ Timeout Indicator
	.bss PhySector, 	2	;LBA
	.bss SectNum, 		1
	.bss CylnLow, 		1
	.bss CylnHigh, 		1
	.bss CrdHead, 		1
	.bss SectCnt, 		1
	.bss Command, 		1
	.bss ReadBuffer, 	256	;1 sector

**********************************************************************
* Data to be written to the CompactFlash Memory Card (1 sector), is
* read from a file ("cf_write_buffer.dat"). In a real application,
* the buffer should be filled from a true data source rather than
* than this example file.
********************************************************************** 
				.data 				
WriteBuffer		.copy   "cf_write_buffer.dat"
**********************************************************************
				
**********************************************************************
* Initial LBA value
* This variable should be modified before the _CF_IssueCommand
* subroutine when the desired LBA value changes for subsequent
* CF reads and writes
**********************************************************************      
     .global _LBA
_LBA .ulong 6000
**********************************************************************
 
**********************************************************************
* Begin code section

	.text                                                             
**********************************************************************	

**********************************************************************
* _CF_IdentifyDrive
* Issue identify drive command                                                         
**********************************************************************	

_CF_IdentifyDrive:

	LD #0, A			;LBA is a dont care term for this command
	LD *(_CIdentifyDrive), B	;_CIdentifyDrive
	NOP
	PSHM BL				;push Command on stack
	LD #1, B			;SectorCount = 1 
	NOP
	PSHM BL				;push SectorCount on stack
	CALL _CF_IssueCommand		;issue Identify Drive command
	POPM BL				;pop SectorCount off stack
	POPM BL				;pop _CIdentifyDrive off stack
    
	CALL _CF_CheckDrqStatus		;CF ready for data transfer?
	STM #ReadBuffer, AR3		;AR3 = IdentDrvBuf
					; (beginning address)
	STM #255, BRC			;loop 256 times
	RPTB done-1					
	PORTR #WrdDataReg, *AR3+	;read 256 words 
	 				; (1 sector = 512 bytes)
	 				; from the CF Data 
	 				; Register
done:	
        
	CALL _CF_CheckReadyStatus	;cf ready?

	RET				;return  

**********************************************************************
* _CF_CheckBusyStatus
* Routine to check the BUSY bit in the Status Register
*  * BUSY = 1 => CompactFlash is Busy
*     if routine times out, set BusyTimeOut and exit
*  * BUSY = 0 => CompactFlash is not Busy
**********************************************************************

_CF_CheckBusyStatus:

	ST #0, *(BusyTimeOut)		;initialize BusyTimeOut indicator
	STM #5000, BRC			;BRC = 5000
	RPTB BusyStatusLoop-1		;loop
	PORTR #StatusReg, *(Status)	;read the status register, save
					; state in 'Status'
	STM #Status, AR2         	;AR2 = Status
	 
***** BUSY = 1?

	BIT *AR2, #15-7			;TC = D7 = BUSY Bit
	NOP
	NOP	
	BC Not_Busy, NTC		;loop until BUSY = 0
	 	                        ; or until the process times out
 	                        
	RPT #0x7FFF     		;delay
	NOP
	
BusyStatusLoop:

	ST #1, *(BusyTimeOut)		;CheckBusyStatus has timed out
	NOP
	NOP
	B C$$EXIT			;exit
	  
Not_Busy:				;CF is not Busy
	
	RET

**********************************************************************
* _CF_CheckReadyStatus
* CheckReadyStatus
*  Routine to check the RDY bit in the Status Register
*   RDY indicates when the CompactFlash is ready to perform operations
*   * RDY = 0 => not ready
*   * RDY = 1 => ready
*  
*   * Initialize timeout variable
*   * Initialize Card/Head Register with Drive 0 and LBA mode
*   * Checks the Busy status
*   * Wait for RDY = 1
*   * if RDY = 0, decrement TimeOut
*     - software delay
*     - if TimeOut = 0, exit and set RDYTimeOut
**********************************************************************

_CF_CheckReadyStatus:

	CALL _CF_CheckBusyStatus

	ST #0, *(RDYTimeOut)		;initialize RDYTimeOut indicator
	STM #5000, BRC			;BRC = 5000
	RPTB ReadyStatusLoop-1		;loop
	PORTR #StatusReg, *(Status)	;read the status register, save
					; state in 'Status'
	STM #Status, AR2         	;AR2 = Status
	 
***** RDY = 1?

	BIT *AR2, #15-6			;TC = D6 = RDY Bit
	BC Ready, TC			;loop until RDY = 1
	 	                        ; or until the process times out
	RPT #0x7FFF			;delay
	NOP
	
ReadyStatusLoop:

	ST #1, *(RDYTimeOut)		;CheckReadyStatus has timed out
	NOP
	NOP
	B C$$EXIT			;exit
	
Ready:					;CF is ready

	CALL _CF_CheckErrorStatus
	RET

**********************************************************************
* _CF_CheckDrqStatus
* Routine to check the DRQ bit in the Status Register
*  * DRQ = 1 => CompactFlash ready for data transfer
*
*  * Initialize timeout variable
*    - Wait for DRQ = 1
*    - if DRQ = 0, decrement TimeOut
*    - software delay
*    - if TimeOut = 0, exit and set DRQTimeOut  
**********************************************************************

_CF_CheckDrqStatus:

	ST #0, *(DRQTimeOut)		;initialize DRQTimeOut indicator
	STM #5000, BRC			;BRC = 5000
	RPTB DRQStatusLoop-1        	;loop
	PORTR #StatusReg, *(Status);read the status register, save
					; state in 'Status'
	STM #Status, AR2         	;AR2 = Status
	 
***** DRQ = 1?

	BIT *AR2, #15-3			;TC = D3 = DRQ Bit
	BC DRQ_Ready, TC		;loop until DRQ = 1
	 	                        ; or until the process times out
	RPT #0x7FFF                	;delay
	NOP
	
DRQStatusLoop:

	ST #1, *(DRQTimeOut)		;CheckDrqStatus has timed out
	NOP
	NOP
	B C$$EXIT			;exit

DRQ_Ready:				;CF is ready for data transfer
	
	RET
	
**********************************************************************
* _DSP_Init
* Routine to initalize the C54x
**********************************************************************
	
_DSP_Init:

	STM #0xFFA8, PMST       
	STM #0x7000, SWWSR		;max amt of wait-states
	STM	#0x8002, BSCR		;BH = 1, EXIO = 0
	STM #0x0000, 0x002B		;SWWSM = 0 
	STM #0,CLKMD
	RPT #100
	NOP
	STM #0x4007,CLKMD
	RSBX SXM			;disable sign extension 
			
	RET	

**********************************************************************
* _CF_HardwareReset
* Routine to issue a hardware reset. The XF pin is used to control
* CF card reset. XF must be asserted for at least 25us (microseconds)
**********************************************************************

_CF_HardwareReset:

	RSBX XF				;assert /RESET
	RPT #07FFFh             
	NOP
	RPT #07FFFh             
	NOP
	SSBX XF			        ;deassert /RESET
 	
	CALL _CF_CheckReadyStatus
	
	RET
	
**********************************************************************
* _CF_IssueCommand

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品自拍av| 欧美日高清视频| 91国在线观看| 欧美大片在线观看| 亚洲欧洲日韩一区二区三区| 日日夜夜免费精品视频| 成人午夜短视频| 91精品欧美一区二区三区综合在 | 色菇凉天天综合网| 精品国产人成亚洲区| 亚洲一区二区五区| 95精品视频在线| 中文字幕欧美国产| 精久久久久久久久久久| 欧美伦理影视网| 一区二区三区在线观看动漫| 岛国精品在线观看| 26uuu成人网一区二区三区| 喷白浆一区二区| 欧美视频在线播放| 亚洲午夜电影网| 91福利小视频| 一区二区三区日韩| 一本一道久久a久久精品| 中文字幕第一区第二区| 国产一区亚洲一区| 欧美成人bangbros| 蜜臀av亚洲一区中文字幕| 欧美日韩久久久一区| 亚洲精品中文在线| 色综合久久天天综合网| 亚洲国产精品99久久久久久久久| 国产乱码字幕精品高清av | 91麻豆精品秘密| 国产精品三级av| 99久久精品99国产精品| 337p粉嫩大胆色噜噜噜噜亚洲| 丝瓜av网站精品一区二区| 欧美日韩中文国产| 国产精品77777| 久久久精品免费观看| 国产资源在线一区| 亚洲国产成人一区二区三区| 成人三级在线视频| 亚洲视频 欧洲视频| 91国内精品野花午夜精品| 亚洲大片一区二区三区| 欧美日韩国产综合久久 | 亚洲免费av在线| 在线观看av一区| 午夜国产不卡在线观看视频| 欧美电影一区二区| 国产一区二区毛片| 亚洲欧洲三级电影| 91福利小视频| 免费精品视频最新在线| 久久综合久久久久88| 成人av综合在线| 一区二区三区日韩欧美| 日韩三级.com| 国产成人免费高清| 亚洲午夜精品17c| 日韩一级高清毛片| 国产69精品久久久久777| 亚洲欧美韩国综合色| 欧美一区二区三区视频免费 | 亚洲国产日韩a在线播放| 91精品久久久久久久91蜜桃| 国产一区二区在线观看视频| 国产精品区一区二区三区 | 91亚洲精品久久久蜜桃网站| 一卡二卡欧美日韩| 精品国产91九色蝌蚪| 色婷婷国产精品综合在线观看| 日韩一区欧美二区| 国产精品毛片a∨一区二区三区| 欧美色涩在线第一页| 国产成人无遮挡在线视频| 一区二区三区四区在线免费观看| 日韩欧美一区二区三区在线| 91片黄在线观看| 国产一区二区主播在线| 午夜精品免费在线| 国产精品麻豆久久久| 337p亚洲精品色噜噜狠狠| 不卡一区二区在线| 黑人巨大精品欧美黑白配亚洲| 亚洲精品免费看| 国产日韩高清在线| 91精品国产全国免费观看| 99精品偷自拍| 国产成a人亚洲精| 蜜臀av国产精品久久久久| 中文字幕欧美一区| 国产人妖乱国产精品人妖| 欧美一区二区三区在线观看| 91免费视频观看| 成人一区二区三区| 久久国产夜色精品鲁鲁99| 午夜a成v人精品| 亚洲精品成人少妇| 亚洲欧美韩国综合色| 中文字幕高清一区| 国产日韩欧美高清| 久久久影院官网| 久久综合九色综合97_久久久| 欧美二区在线观看| 777亚洲妇女| 欧美日韩1234| 色欧美日韩亚洲| av在线播放不卡| www.爱久久.com| 成人激情午夜影院| 成人高清免费观看| 99久久国产综合精品色伊| 成人在线综合网站| av成人老司机| 色婷婷综合五月| 在线免费观看日本欧美| 在线一区二区视频| 欧美在线免费观看亚洲| 欧美性大战xxxxx久久久| 欧美午夜精品一区| 欧美高清精品3d| 精品久久久久久久人人人人传媒| 欧美电影免费提供在线观看| 日韩欧美在线网站| 久久久久久久久久久久久久久99| 久久久一区二区三区捆绑**| 中文一区在线播放| 亚洲男同1069视频| 亚洲高清免费观看 | 久久久亚洲午夜电影| 国产三级精品视频| 中文字幕一区二区三区色视频 | a在线播放不卡| 在线影视一区二区三区| 91精品国产91久久久久久最新毛片| 欧美一区二区在线不卡| 精品久久免费看| 1区2区3区欧美| 亚洲成人7777| 久草在线在线精品观看| 成人av在线看| 欧美年轻男男videosbes| 日韩欧美卡一卡二| 亚洲欧美综合另类在线卡通| 亚洲一区在线播放| 精东粉嫩av免费一区二区三区| 国产99精品国产| 欧美人体做爰大胆视频| 26uuu色噜噜精品一区二区| 综合欧美亚洲日本| 日韩成人伦理电影在线观看| 成人av在线观| 91超碰这里只有精品国产| 亚洲三级在线观看| 天堂资源在线中文精品| 国产精品一二三| 欧美日韩国产电影| 国产欧美中文在线| 亚洲福利一区二区| 国产成a人亚洲| 91精品久久久久久蜜臀| 日韩伦理av电影| 经典三级视频一区| 欧美久久高跟鞋激| 亚洲视频每日更新| 国产高清亚洲一区| 欧美一区二区三区人| ...av二区三区久久精品| 国产一区二区三区免费播放| 欧美三级三级三级| 国产精品灌醉下药二区| 捆绑紧缚一区二区三区视频| 色婷婷综合久久久| 国产精品欧美久久久久一区二区| 日本成人在线一区| 欧美色图在线观看| 中文字幕一区二区三区视频| 国产在线不卡视频| 欧美成人精品3d动漫h| 三级欧美韩日大片在线看| 91精彩视频在线| 亚洲天堂2016| 成人深夜福利app| 国产网红主播福利一区二区| 美女免费视频一区二区| 欧美日韩视频在线第一区 | 爽好多水快深点欧美视频| aa级大片欧美| 国产精品久久久久一区二区三区 | 日韩欧美在线1卡| 视频一区视频二区中文| 91福利视频在线| 夜夜嗨av一区二区三区网页| av电影在线观看一区| 国产精品二三区| av网站一区二区三区| 中文字幕av在线一区二区三区|