?? init.c
字號(hào):
//*----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name : init.c
//* Object : Low level initialisations written in C
//* Creation : ODi 06/26/2002
//*
//*----------------------------------------------------------------------------
#include <stdarg.h>
#include <stdio.h>
#include "Includes/AT91RM9200.h"
#include "Includes/lib_AT91RM9200.h"
#define AT91C_MASTER_CLOCK 60000000 // Processor clock set by the loader: 60MHz
//*----------------------------------------------------------------------------
//* \fn AT91F_DBGU_Printk
//* \brief This function is used to send a string through the DBGU channel (Very low level debugging)
//*----------------------------------------------------------------------------
void AT91F_DBGU_Printk(
char *buffer) // \arg pointer to a string ending by \0
{
while(*buffer != '\0') {
while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));
AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, *buffer++);
}
}
void uprintf(char *fmt,...)
{
va_list ap;
char string[256];
va_start(ap,fmt);
vsprintf(string,fmt,ap);
AT91F_DBGU_Printk(string);
va_end(ap);
}
//*----------------------------------------------------------------------------
//* \fn AT91F_LowLevelInit
//* \brief This function performs very low level HW initialization
//*----------------------------------------------------------------------------
void AT91F_LowLevelInit()
{
unsigned int i,*cp1,*cp2;
// Open PIO for DBGU
AT91F_DBGU_CfgPIO();
// Configure DBGU
AT91F_US_Configure (
(AT91PS_USART) AT91C_BASE_DBGU, // DBGU base address
AT91C_MASTER_CLOCK, // 60 MHz
AT91C_US_ASYNC_MODE , // mode Register to be programmed
115200 , // baudrate to be programmed
0); // timeguard to be programmed
// Enable Transmitter
AT91F_US_EnableTx((AT91PS_USART) AT91C_BASE_DBGU);
AT91F_DBGU_Printk("AT91F_LowLevelInit()\n\r");
cp1=(unsigned int *)0x20000000;
cp2=(unsigned int *)0x200000;
for(i=0;i<4*12;i++)
{
*cp2++=*cp1++;
}
}
void PrefetchAbortFun(void)
{
AT91F_DBGU_Printk("PrefetchAbort\n\r");
while(1);
}
void DataAbortFun(void)
{
AT91F_DBGU_Printk("DataAbort\n\r");
while(1);
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -