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

📄 led.asm

📁 flash驱动和简单管理程序
💻 ASM
字号:
		
/*
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
File Name:	    Led_Driver.asm

Version:        1.0

Purpose:		To be used to indicate errors,exceptions and hints.
                It is quite useful when you are debugging you program code 
                ,cause their different indications can help to find errors in your code.
                
Software:       VisualDSP++3.5

Hardware:		ADSP-BF533 EZ-KIT Board

Programmer:     EricRao

Orgnization:    Supcon Company

Date:           2004.6.8-2004.6.15 
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@// 	
*/

#include "defBF533.h"
.global _Led_Blink;
.global _Led_Toggle;
.global _Led_Error_Indicator;

/*User Blink Definition*/
#define Flash_A_Registers 	0x20270000	//Base Address for Flash A Registers
#define PortB_Data_Out 		0x00000005	//offset
#define PortB_Data_Dir 		0x00000007	//offset
#define Delay 				0x3FFFFFF	//Loop Delay

//--------------------------------------------------------------------------//
// Function: Led_Blink	                                                    //
//                                                                          //
// Purpose:  Used to indicate any circs that occur in runtime               //
//--------------------------------------------------------------------------//
.section program;
_Led_Blink:
    [--SP]=RETS;
//Configurate Asynchronous Menmory Control Register		 
    P0.H = HI(EBIU_AMGCTL);
    P0.L = LO(EBIU_AMGCTL);
    R2.L = W[P0];
//Enable all AMS Banks
    R3 = 0xE;
    R2 = R2 | R3;
    W[P0] = R2.L;	
//Set all Flags as Outputs
    P1.H = HI(Flash_A_Registers);
    P1.L = LO(Flash_A_Registers) + PortB_Data_Dir;
    R2 = 0xFF;
    B[P1] = R2;
//Turn On LEDs
    P1.H = HI(Flash_A_Registers);
    P1.L = LO(Flash_A_Registers) + PortB_Data_Out;

    R2 = 0x15;
//Initialize Loop Counter
    P2.H = HI(Delay);
    P2.L = LO(Delay);
    Blink_Loop:
	//Write Port B
	B[P1] = R2;
	LSETUP(Delay_Start, Delay_End) LC0 = P2;
		Delay_Start:
		Delay_End: NOP;
	//Decrease counter 
	R0+=-1;	
	//Toggle LEDs
	R2 = ~R2;
    CC=R0==0x0;
    IF !CC JUMP Blink_Loop;
    //Turn off all lights
    B[P1]=R0;
    RETS=[SP++];
_Led_Blink.end:
    RTS;//End Label
    
    
//--------------------------------------------------------------------------//
// Function: Led_Toggle												    	//
//                                                                          //
// Purpose:  Used to indicate start or end of program running               //
//--------------------------------------------------------------------------//
_Led_Toggle:
    [--SP]=RETS;
  TOGGLE_LOOP:
    //Decrease count
    R0+=-1;	
    
    P2.H = HI(Delay);
    P2.L = LO(Delay);
    
	LSETUP(Delay_Start1, Delay_End1) LC0 = P2;
	Delay_Start1:
	Delay_End1: NOP;
	
	P3.H = hi(Flash_A_Registers);
	P3.L = lo(Flash_A_Registers) + PortB_Data_Out;
	
	R1 = B[P3] (z);// Read LEDs
	//Toggle all lights
	BITTGL (R1, 5);			
	BITTGL (R1, 4);			
	BITTGL (R1, 3);			
	BITTGL (R1, 2);			
	BITTGL (R1, 1);		
	BITTGL (R1, 0);
	
	B[P3] = R1;
	
	CC=R0==0x0;
    IF !CC JUMP TOGGLE_LOOP;
    //Turn all lights off
    B[P3]=R0;
    RETS=[SP++];
_Led_Toggle.end:
    RTS;
    
    
//--------------------------------------------------------------------------//
// Function: Led_Indicator								                	//
//                                                                          //
// Purpose:  Used to indicate any errors during when the system is working. //
//--------------------------------------------------------------------------//
_Led_Error_Indicator:
    [--SP]=RETS;
    ///*
    ERROR_LOOP:
    //Decrease count
    R0+=-1;	
    
    P2.H = HI(Delay);
    P2.L = LO(Delay);
    
	LSETUP(Delay_Start2, Delay_End2) LC0 = P2;
	Delay_Start2:
	Delay_End2: NOP;
	
	P3.H = hi(Flash_A_Registers);
	P3.L = lo(Flash_A_Registers) + PortB_Data_Out;
	
	R2 = B[P3] (z);// Read LEDs
POLL_TIMEOUT_ERROR_LED:
    CC=R1==0x0;
    if !CC Jump INVALID_SECTOR_LED;
    BITTGL (R2, 0);
    Jump Here;
INVALID_SECTOR_LED: 
    CC=R1==0x1;
    if !CC Jump INVALID_BLOCK_LED;
   	BITTGL (R2, 1);
   	Jump Here;
INVALID_BLOCK_LED:
    CC=R1==0x2;
    if !CC Jump ERASE_ERROR_LED;
   	BITTGL (R2, 2);	
   	Jump Here;
ERASE_ERROR_LED: 
    CC=R1==0x3;
    if !CC Jump READ_ERROR_LED;
   	BITTGL (R2, 3);	
   	Jump Here;
READ_ERROR_LED:
    R5=R1;//Save
    R1=R1>>0x1;
    CC=R1==0x2;
    R1=R5;//Restore
    if !CC Jump WRITE_ERROR_LED;
   	BITTGL (R2, 4);	
   	Jump Here;    
WRITE_ERROR_LED:
    R5=R1;//Save
    R1+=-1;
    R1=R1>>0x1;
    CC=R1==0x2;
    R1=R5;//Restore
    if !CC Jump INVALID_DATA_LED;
   	BITTGL (R2, 5);	
INVALID_DATA_LED:
    R5=R1;//Save
    R1+=-2;
    R1=R1>>0x1;
    CC=R1==0x2;
    R1=R5;//Restore
    if !CC Jump FLASH_EMPTY_LED;
   	BITTGL (R2, 0);	
   	BITTGL (R2, 1);	
FLASH_EMPTY_LED:
    R5=R1;//Save
    R1+=-3;
    R1=R1>>0x1;
    CC=R1==0x2;
    R1=R5;//Restore
    if !CC Jump GO_BACK;
   	BITTGL (R2, 3);	
   	BITTGL (R2, 4);		
Here:   	
	B[P3]=R2;
	CC=R0==0x0;
    IF !CC JUMP ERROR_LOOP;
    //Turn all lights off
    B[P3]=R0;
GO_BACK:

    RETS=[SP++];
_Led_Error_Indicator.end:
    RTS; 
    
    
    
    
    

⌨️ 快捷键说明

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