⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ccall.asm

📁 ti的 F2XX 系列dsp的flash操作接口
💻 ASM
字号:
*****************************************************
* This file contains two Ccallable functions: *
* program(), and erase() *
* These functions are used for programming and *
* erasing the onchip flash EEPROM of the F2XX *
* product family. *
*****************************************************
* The erase function includes all the operations *
* (clear+erase+flw) required to prepare the flash *
* for programming. In addition to providing the *
* Ccallable interface, this function is very *
* useful since it provides a single call to erase *
* the flash memory. *
* Since programming the device requires a single *
* algorithm, the only purpose for the program() *
* function is to provide a Ccallable interface. *
* The program() function transfers a specified *
* block of data memory into a specified, erased *
* flash array. *
**
* The parameters for each function are described *
* in detail below. Note these functions cannot *
* reside in the same flash module that they are *
* meant to modify. *
**************************************************
		.title "Ccallable Interface to F2XX Flash Algorithms**"
;**Ccallable functions defined in this file.
		.global _erase, _program
		.global _wdfp	;hqn
;**Variables included from flash algorithms.
		.include "svar20.h";Variable declarations
		;.ref GCLR			;References clear algo.rewriten by hqn
		;.ref GPGMJ			;References program algo.
		;.ref GERS			;References erase algo.
		;.ref FLWS			;References flashwrite algo.
;**Parameters used by flash algorithms.
		;.def PRG_bufaddr, PRG_paddr
		;.def PRG_length, PARMS
		;.def SEG_ST,SEG_END,PROTECT 
*************************************************************
VARS:	.usect "PRG_data",16	;This is an uninitialized data *
								;section required by the standard
								;flash algos for temporary									
								;variables. Pointers to this								
								;space are hardcoded in SVAR20.H,							
								;and variables are init'd at								
								;run time.													
*************************************************************
PARMS:	.usect "PRG_parm",10	;This is an uninitialized data 
								;section used for temporary									
								;variables and for passing									
								;parameters to the flash									
								;algorithms.												
*************************************************************
PROTECT	.set PARMS				;Segment enable bits.		*
*************************************************************
***** Parameters needed for Programming algorithm.	 ********
*************************************************************
PRG_bufaddr .set PARMS+1		;Addr of buffer for pgm data *
PRG_paddr	.set PARMS+2		;First flash addr to program *
PRG_length	.set PARMS+3		;Length of block to program *
*************************************************************
** Parameters needed for CLEAR, ERASE, and FLW algorithms. *
*************************************************************
SEG_ST	.set PARMS+4			;Segment start address. *
SEG_END .set PARMS+5			;Segment end address. *
*************************************************************
**** Other misc variables. ****
*************************************************************
ERS_COUNT	.set PARMS+6		;Used for erase fail count. *
SV_AR1		.set PARMS+7		;Used to save AR1. *
watchdog	.set PARMS+9		;*
**************************************************************
		.sect "PRG_text"
**********************************************************
* function erase(PROTECT,SEG_ST,SEG_END) *
* Status is returned in the accumulator. *
* 0 = Fail,1 = Pass *
**********************************************************
* This function performs the clear and erase operation	*
* on the F2XX flash. If the erase operation fails, the	*
* flashwrite operation is used to try to recover from	*
* depletion. If the array recovers, the entire process	*
* (clr+ers+flw) is repeated a maximum of 10 times. The	*
* return value indicates the status. If this function	*
* passes, the flash is ready to be reprogrammed. The	*
* operations are performed on the segments of the flash	*
* module described by the parameter list:				*
* 1)PROTECT-defines which flash segments to protect.	*
* 2)SEG_ST -start address of segment to be erased.		*	
* 3)SEG_END-end address of segment to be erased.		*
* To erase flash0 use erase(0xff00,0x0000,0x3fff).		*
* To erase flash1 use erase(0xff00,0x4000,0x7fff).		*
*********************************************************
* CAUTION: Erasing individual segments is not allowed. *
* The PROTECT parameter should always be set to *
* enable all segments, and SEG_ST and SEG_END *
* should be set to the end and start address of *
* the array to be erased. *
*********************************************************
_erase:
ERS_PARAMS	.set 3
AR_STACK	.set ar1
AR_PROTECT	.set ar2
AR_SEG_ST	.set ar3
AR_SEG_END	.set ar4
;Begin C Preprocessing
	POPD *+					;pop return address, push on software stack
	sar ar0,*+				;save FP
	sar ar6,*				;save ar6
	sbrk #3
							;get arguments and place them properly 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -