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

📄 main.asm

📁 dynatic power management example code for BF5
💻 ASM
字号:
/****************************************************************************
 *																			*
 *																			*
 * Module: main.asm															*
 *																			*
 *																			*
 * Purpose: Demonstrate BF53x ability to reprogram core regulator voltage	*
 *			on-the-fly using the VR_CTL register							*
 *																			*
 *		- Observe flashing LED9 indicating iteration of core-loading loop	*
 *		- Push SW4 to cycle core voltage down								*
 *		- Push SW5 to cycle core voltage up									*
 ****************************************************************************/

#include <defBF533.h>
#include "startup.h"

/************************************************************************************************/
/*			   GLOBAL & EXTERNAL DECLARATIONS													*/	
/************************************************************************************************/    
.SECTION	data1;
.GLOBAL		_main;

.EXTERN 	Configure_Flash;
.EXTERN 	Configure_Flags;
.EXTERN 	Configure_Interrupts;

.align 4;
.byte4  buffer0 = 0xA0A0A0A0;
.GLOBAL buffer0;

.align 4;
.byte4  buffer1 = 0x0A0A0A0A;
.GLOBAL buffer1;

/************************************************************************  
 * 			BLACKFIN CODE STARTS HERE									*
 ************************************************************************/
.section program;

_main:
   call Configure_Flags;			// setup EZKIT switches as interrupt-generating inputs
   call Configure_Flash;			// set flash up for LED access
   call Configure_Interrupts;		// configure interrupt vectors
      
   load_core_loop:
		// flash A csio reg (portA,B data reg)
		P3.H = hi(flashA_csio);	P3.L = lo(flashA_csio) + portB_data_out;
		R0 = B[P3] (z); 		// Read LEDs
		BITTGL (R0, 5);			// Toggle LED9 Before Each Core Loop
		B[P3] = R0;
	
		p0.h = 0x0020; p0.l = 0x0000;
		lsetup(comptop, compbot) lc0=p0;
		comptop:  //Purpose-- Core running typical load.
			p1.h = buffer0;	p1.l = buffer0;
			p2.h = buffer1;	p2.l = buffer1;
			
			r0 =[p1];
			r1 =[p2];
			a1=a0=0;

			nop;
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
			r1.l=0xa0a0;
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
			r0=[p1];
			a0+=r0.l*r1.l, a1+=r0.h*r1.h || nop || nop;
		compbot: nop;

	jump load_core_loop;
	
_main.end: nop;	// for debug purposes only

⌨️ 快捷键说明

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