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

📄 a_spi25128.asm

📁 TSM320C5000系列控制SPI25128器件的代码
💻 ASM
字号:
*************************************************************************
*		Copyright (c) 2005-2006, Chengdu University of Information Technology  
*		All rights reserved.
*  		
*		Filename:A_SPI25180.ASM       
*       Abstract:       
*
*       Current version: v1.0
*		Author/Modifier: YangSS
*		Completed: 2005/8/18           	
*************************************************************************

         .title    "A_SPI25128.ASM"
         .mmregs
         .include  "A_SPI25128_vectors.asm"
         .include  "A_SPI25128_head.asm"
         .ref    SPI_INIT, SPI_READ, SPI_WRITE
         .ref    SPI_RDSR, SPI_WRSR, WR_WAIT
         
*********************************************************
**SPI EEPROM  LOAD **
*********************************************************
         .text
_c_int00:
        ssbx    intm            ; disable all interrupts
        ld      #0, dp
        stm     #0FFFFh,@ifr    ; clear IFR flag
        orm     #02b00h, @st1   ; xf=1, hm=0, intm=1, ovm=1, sxm=1
        orm     #020h, @pmst    ; ovly=1
        stm     #07fffh, swwsr  ; 7 wait states for P_,D_, and I_ spaces
        stm     #0007dh, sp     ; Use top part of scratch-pad RAM for stack. 
                                  
* Initialize the McBSP1 for SPI mode *
        stm     SPSA1, ar4      ;AR4->SPSA1
        stm     dxr11-1, ar5    ;AR5->DXR21
        ld      #249, a         ;Bit-rate divisor (.4Mhz @100MIPs)
        call    SPI_INIT        ;Initialize McBSP.

* Main write  process *
EpW:
		stm     #1000h,	 ar1	;The code start address
        stm     #0,		 ar3	;Eeprom address start
        call    SPI_WRSR		;Enable eeprom write
        stm     #121h,	 brc    ;Configure the write times,字节数目
        rptb    WREND-1
        nop
        nop
        ld      *ar1,	a
        nop
        nop
        nop
        nop
        nop
        call    SPI_WRITE		;Write to eeprom 
        nop
        nop
        call    WR_WAIT         ;Wait for EEPROM to finish write
        mar     *ar1+			;Increase code address
        mar     *ar3+           ;Increment eeprom address.
		nop
WREND:
		nop
;       	b        EpW
;       .end
* Read eeprom correct to check*
EpR:
        stm     #2000h,	 ar1	;The code store address
        stm     #0,		 ar3	;Eeprom address start       
        stm     #121h,	 brc
        rptb    REEND-1
        nop
        nop 
        call    SPI_READ        ;Read  eprom
        stl     a,  *ar1     	;Store low8.
        mar     *ar3+           ;increment address
;        call    SPI_READ       ;Read address low-byte.
        mar     *ar1+           ;Temporarily save it. 
		nop
		nop
REEND:  
		stm     #1000h,   ar1
        b       REEND            



                              	      	      	

⌨️ 快捷键说明

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