www.pudn.com > 9200-DS1307.rar > init.c


//*---------------------------------------------------------------------------- 
//*         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 "AT91RM9200.h" 
#include "lib_AT91RM9200.h" 
//#include "main.h" 
 
//*---------------------------------------------------------------------------- 
//* \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++); 
	} 
} 
 
//*---------------------------------------------------------------------------- 
//* \fn    AT91F_LowLevelInit 
//* \brief This function performs very low level HW initialization 
//*---------------------------------------------------------------------------- 
void AT91F_LowLevelInit() 
{ 
 
	// Open PIO for DBGU 
	AT91F_DBGU_CfgPIO(); 
	 
	// Configure DBGU 
	AT91F_US_Configure ( 
		(AT91PS_USART) AT91C_BASE_DBGU,          // DBGU base address 
		59904000,        		   // +- 59,904 MHz with PLLA selected 
		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); 
	// Enable Receiver 
	AT91F_US_EnableRx((AT91PS_USART) AT91C_BASE_DBGU); 
	AT91F_DBGU_Printk("AT91F_LowLevelInit()\n\r"); 
}