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

📄 dbgu.c

📁 ATMEL ATSAM7S64处理器部分控制程序。
💻 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              : DBUG utility
//* Creation            : JPP   02/Jul/2004
//*----------------------------------------------------------------------------

// Include Standard LIB  files
#include "Board.h"
#include "dbgu.h"

//*--------------------------1--------------------------------------------------
//* \fn    AT91F_DBGU_Init
//* \brief This function is used to send a string through the DBGU channel (Very low level debugging)
//*----------------------------------------------------------------------------
void AT91F_DBGU_Init(void)
{
    //* Open PIO for DBGU
        AT91F_DBGU_CfgPIO();

    //* Configure DBGU
	AT91F_US_Configure (
		(AT91PS_USART) AT91C_BASE_DBGU,       // DBGU base address
		MCK,
		AT91C_US_ASYNC_MODE ,                 // Mode Register to be programmed
		AT91C_DBGU_BAUD ,                     // Baudrate to be programmed
		0);                                   // Timeguard to be programmed

    //* Enable Transmitter & receivier
       ((AT91PS_USART)AT91C_BASE_DBGU)->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
}

//*----------------------------------------------------------------------------
//* Function Name       : AT91F_DBGU_Get
//* Object              : Get a string to USART manage Blackspace and echo
//* Input Parameters    : com descriptor, type string & val return value
//* Output Parameters   : none
//*----------------------------------------------------------------------------
unsigned int AT91F_DBGU_Get( char *val)
{//* Begin
    if ((AT91F_US_RxReady((AT91PS_USART)AT91C_BASE_DBGU)) == 0)
        return (1);
    else
    {
        *val= AT91F_US_GetChar((AT91PS_USART)AT91C_BASE_DBGU);
        return (0);
    }
}//* End

//*----------------------------------------------------------------------------
//* \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
{//* Begin
	while(*buffer != '\0') {
		while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));
		AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, *buffer++);
	}
}//* End

⌨️ 快捷键说明

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