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

📄 44blib.c

📁 arm7的启动代码
💻 C
字号:
#include "44b.h"
#include "44blib.h"
#include "def.h"
#include "option.h"

#include "T820.h"

#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>



#define STACKSIZE    0xa00 //SVC satck size(do not use user stack)//
#define HEAPEND     (_ISR_STARTADDRESS-STACKSIZE-0x500) // = 0xc7ff000//
//SVC Stack Area:0xc(e)7ff000-0xc(e)7ffaff//

extern char Image$$RW$$Limit[];
volatile unsigned char *downPt;
unsigned int fileSize;
void *mallocPt=Image$$RW$$Limit;

void (*restart)(void)=(void (*)(void))0x0;
void (*run)(void)=(void (*)(void))DOWNLOAD_ADDRESS;
//--------------------------------SYSTEM---------------------------------//
//static int delayLoopCount=400;
int delayLoopCount=400;

void Delay(int time)

{
	int i,adjust=0;
	if(time==0)
	{
			time=200;
			adjust=1;
			delayLoopCount=400;
			rWTCON=((MCLK/1000000-1)<<8)|(2<<3);	// 1M/64,Watch-dog,nRESET,interrupt disable//
			rWTDAT=0xffff;
			rWTCNT=0xffff;	 
			rWTCON=((MCLK/1000000-1)<<8)|(2<<3)|(1<<5); // 1M/64,Watch-dog enable,nRESET,interrupt disable //
	}
	for(;time>0;time--)
	{
			for(i=0;i<delayLoopCount;i++);
	}
	if(adjust==1)
	{
			rWTCON=((MCLK/1000000-1)<<8)|(2<<3);
			i=0xffff-rWTCNT;   //  1count/16us?????????//
			delayLoopCount=8000000/(i*64);	//400*100/(i*64/200)   //
	}
}

//------------------------PORTS------------------------------//
void Port_Init(void)
{
		rPCONA = 0x1ff;	
	
		rPDATB = 0x7ff;
		rPCONB = 0x7ff;
	    
	  rPDATC = 0xffff;
		rPCONC = 0x0f010000;
		rPUPC  = 0x3000;
		 
		rPCOND= 0x0;	
		rPUPD = 0x0;
	
		rPDATE	= 0x1ff;
		rPCONE	= 0x10428;	
		rPUPE	= 0x26;
		
		rPCONF = 0x0;     // I2C
		rPUPF  = 0x0;
	
		rPCONG = 0x0; //EXINT0~3 enabled
		rPUPG  = 0x0;	//pull-up regiseter should be enabled  
		
		rSPUCR=0x7;  //D15-D0 pull-up disable
	
		/*定义非Cache区*/
		rNCACHBE0=((Non_Cache_End>>12)<<16)|(Non_Cache_Start>>12); 
		/*均为低电平触发,Exint3设置为上升沿触发----modify at 04-12-11*/
		rEXTINT=0x0|(1<<14);
}

⌨️ 快捷键说明

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