📄 dbgu.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 : dbgu.c
//* Object : DBGU routines written in C
//* Creation : JG 16/Aug/2004
//*----------------------------------------------------------------------------
// Include Standard files
#include "project.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++);
}
}
void Init_DBGU(unsigned int uClock)
{
// Open PIO for DBGU
AT91F_DBGU_CfgPIO();
// Configure DBGU
AT91F_US_Configure(
(AT91PS_USART)AT91C_BASE_DBGU, // DBGU base address
uClock, // Master Clock
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);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -