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

📄 lib_at91rm9200.c

📁 该源码是AT91RM9200处理器的loader文件
💻 C
📖 第 1 页 / 共 5 页
字号:
//*----------------------------------------------------------------------------//*         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           : lib_AT91RM9200.h//* Object              : AT91RM9200 d functions//* Generated           : AT91 SW Application Group  02/07/2003 (11:29:43)//*//* CVS Reference       : /lib_pdc.h/1.2/Tue Jul 02 12:29:40 2002////* CVS Reference       : /lib_dbgu.h/1.1/Fri Jan 31 12:15:24 2003////* CVS Reference       : /lib_rtc_1245d.h/1.1/Fri Jan 31 12:15:58 2003////* CVS Reference       : /lib_ssc.h/1.4/Fri Jan 31 12:16:12 2003////* CVS Reference       : /lib_spi_AT91RMxxxx.h/1.2/Fri Jan 31 12:16:26 2003////* CVS Reference       : /lib_tc_1753b.h/1.1/Fri Jan 31 12:17:10 2003////* CVS Reference       : /lib_pmc.h/1.3/Thu Nov 14 07:40:46 2002////* CVS Reference       : /lib_pio_1321c.h/1.4/Thu Nov 21 15:03:14 2002////* CVS Reference       : /lib_twi.h/1.2/Fri Jan 31 12:16:38 2003////* CVS Reference       : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002////* CVS Reference       : /lib_mci.h/1.2/Wed Nov 20 14:18:56 2002////* CVS Reference       : /lib_aic.h/1.3/Fri Jul 12 07:46:12 2002////* CVS Reference       : /lib_udp.h/1.3/Fri Jan 31 12:16:52 2003////* CVS Reference       : /lib_st.h/1.4/Fri Jan 31 10:43:12 2003////*----------------------------------------------------------------------------#include "main.h"/* *****************************************************************************                SOFTWARE API FOR PDC   ***************************************************************************** *///*----------------------------------------------------------------------------//* \fn    AT91F_PDC_SetNextRx//* \brief Set the next receive transfer descriptor//*---------------------------------------------------------------------------- void AT91F_PDC_SetNextRx (	AT91PS_PDC pPDC,     // \arg pointer to a PDC controller	char *address,       // \arg address to the next bloc to be received	unsigned int bytes)  // \arg number of bytes to be received{	pPDC->PDC_RNPR = (unsigned int) address;	pPDC->PDC_RNCR = bytes;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_SetNextTx//* \brief Set the next transmit transfer descriptor//*---------------------------------------------------------------------------- void AT91F_PDC_SetNextTx (	AT91PS_PDC pPDC,       // \arg pointer to a PDC controller	char *address,         // \arg address to the next bloc to be transmitted	unsigned int bytes)    // \arg number of bytes to be transmitted{	pPDC->PDC_TNPR = (unsigned int) address;	pPDC->PDC_TNCR = bytes;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_SetRx//* \brief Set the receive transfer descriptor//*---------------------------------------------------------------------------- void AT91F_PDC_SetRx (	AT91PS_PDC pPDC,       // \arg pointer to a PDC controller	char *address,         // \arg address to the next bloc to be received	unsigned int bytes)    // \arg number of bytes to be received{	pPDC->PDC_RPR = (unsigned int) address;	pPDC->PDC_RCR = bytes;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_SetTx//* \brief Set the transmit transfer descriptor//*---------------------------------------------------------------------------- void AT91F_PDC_SetTx (	AT91PS_PDC pPDC,       // \arg pointer to a PDC controller	char *address,         // \arg address to the next bloc to be transmitted	unsigned int bytes)    // \arg number of bytes to be transmitted{	pPDC->PDC_TPR = (unsigned int) address;	pPDC->PDC_TCR = bytes;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_EnableTx//* \brief Enable transmit//*---------------------------------------------------------------------------- void AT91F_PDC_EnableTx (	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	pPDC->PDC_PTCR = AT91C_PDC_TXTEN;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_EnableRx//* \brief Enable receive//*---------------------------------------------------------------------------- void AT91F_PDC_EnableRx (	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	pPDC->PDC_PTCR = AT91C_PDC_RXTEN;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_DisableTx//* \brief Disable transmit//*---------------------------------------------------------------------------- void AT91F_PDC_DisableTx (	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	pPDC->PDC_PTCR = AT91C_PDC_TXTDIS;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_DisableRx//* \brief Disable receive//*---------------------------------------------------------------------------- void AT91F_PDC_DisableRx (	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	pPDC->PDC_PTCR = AT91C_PDC_RXTDIS;}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_IsTxEmpty//* \brief Test if the current transfer descriptor has been sent//*---------------------------------------------------------------------------- int AT91F_PDC_IsTxEmpty ( // \return return 1 if transfer is complete	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	return !(pPDC->PDC_TCR);}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_IsNextTxEmpty//* \brief Test if the next transfer descriptor has been moved to the current td//*---------------------------------------------------------------------------- int AT91F_PDC_IsNextTxEmpty ( // \return return 1 if transfer is complete	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	return !(pPDC->PDC_TNCR);}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_IsRxEmpty//* \brief Test if the current transfer descriptor has been filled//*---------------------------------------------------------------------------- int AT91F_PDC_IsRxEmpty ( // \return return 1 if transfer is complete	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	return !(pPDC->PDC_RCR);}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_IsNextRxEmpty//* \brief Test if the next transfer descriptor has been moved to the current td//*---------------------------------------------------------------------------- int AT91F_PDC_IsNextRxEmpty ( // \return return 1 if transfer is complete	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller{	return !(pPDC->PDC_RNCR);}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_Open//* \brief Open PDC: disable TX and RX reset transfer descriptors, re-enable RX and TX//*---------------------------------------------------------------------------- void AT91F_PDC_Open (	AT91PS_PDC pPDC)       // \arg pointer to a PDC controller{    //* Disable the RX and TX PDC transfer requests	AT91F_PDC_DisableRx(pPDC);	AT91F_PDC_DisableTx(pPDC);	//* Reset all Counter register Next buffer first	AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0);	AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0);	AT91F_PDC_SetTx(pPDC, (char *) 0, 0);	AT91F_PDC_SetRx(pPDC, (char *) 0, 0);    //* Enable the RX and TX PDC transfer requests	AT91F_PDC_EnableRx(pPDC);	AT91F_PDC_EnableTx(pPDC);}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_Close//* \brief Close PDC: disable TX and RX reset transfer descriptors//*---------------------------------------------------------------------------- void AT91F_PDC_Close (	AT91PS_PDC pPDC)       // \arg pointer to a PDC controller{    //* Disable the RX and TX PDC transfer requests	AT91F_PDC_DisableRx(pPDC);	AT91F_PDC_DisableTx(pPDC);	//* Reset all Counter register Next buffer first	AT91F_PDC_SetNextTx(pPDC, (char *) 0, 0);	AT91F_PDC_SetNextRx(pPDC, (char *) 0, 0);	AT91F_PDC_SetTx(pPDC, (char *) 0, 0);	AT91F_PDC_SetRx(pPDC, (char *) 0, 0);}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_SendFrame//* \brief Close PDC: disable TX and RX reset transfer descriptors//*---------------------------------------------------------------------------- unsigned int AT91F_PDC_SendFrame(	AT91PS_PDC pPDC,	char *pBuffer,	unsigned int szBuffer,	char *pNextBuffer,	unsigned int szNextBuffer ){	if (AT91F_PDC_IsTxEmpty(pPDC)) {		//* Buffer and next buffer can be initialized		AT91F_PDC_SetTx(pPDC, pBuffer, szBuffer);		AT91F_PDC_SetNextTx(pPDC, pNextBuffer, szNextBuffer);		return 2;	}	else if (AT91F_PDC_IsNextTxEmpty(pPDC)) {		//* Only one buffer can be initialized		AT91F_PDC_SetNextTx(pPDC, pBuffer, szBuffer);		return 1;	}	else {		//* All buffer are in use...		return 0;	}}//*----------------------------------------------------------------------------//* \fn    AT91F_PDC_ReceiveFrame//* \brief Close PDC: disable TX and RX reset transfer descriptors//*---------------------------------------------------------------------------- unsigned int AT91F_PDC_ReceiveFrame (	AT91PS_PDC pPDC,	char *pBuffer,	unsigned int szBuffer,	char *pNextBuffer,	unsigned int szNextBuffer ){	if (AT91F_PDC_IsRxEmpty(pPDC)) {		//* Buffer and next buffer can be initialized		AT91F_PDC_SetRx(pPDC, pBuffer, szBuffer);		AT91F_PDC_SetNextRx(pPDC, pNextBuffer, szNextBuffer);		return 2;	}	else if (AT91F_PDC_IsNextRxEmpty(pPDC)) {		//* Only one buffer can be initialized		AT91F_PDC_SetNextRx(pPDC, pBuffer, szBuffer);		return 1;	}	else {		//* All buffer are in use...		return 0;	}}/* *****************************************************************************                SOFTWARE API FOR DBGU   ***************************************************************************** *///*----------------------------------------------------------------------------//* \fn    AT91F_DBGU_InterruptEnable//* \brief Enable DBGU Interrupt//*---------------------------------------------------------------------------- void AT91F_DBGU_InterruptEnable(        AT91PS_DBGU pDbgu,   // \arg  pointer to a DBGU controller        unsigned int flag) // \arg  dbgu interrupt to be enabled{        pDbgu->DBGU_IER = flag;}//*----------------------------------------------------------------------------//* \fn    AT91F_DBGU_InterruptDisable//* \brief Disable DBGU Interrupt//*---------------------------------------------------------------------------- void AT91F_DBGU_InterruptDisable(        AT91PS_DBGU pDbgu,   // \arg  pointer to a DBGU controller        unsigned int flag) // \arg  dbgu interrupt to be disabled{        pDbgu->DBGU_IDR = flag;}//*----------------------------------------------------------------------------//* \fn    AT91F_DBGU_GetInterruptMaskStatus//* \brief Return DBGU Interrupt Mask Status//*---------------------------------------------------------------------------- unsigned int AT91F_DBGU_GetInterruptMaskStatus( // \return DBGU Interrupt Mask Status        AT91PS_DBGU pDbgu) // \arg  pointer to a DBGU controller{        return pDbgu->DBGU_IMR;}//*----------------------------------------------------------------------------//* \fn    AT91F_DBGU_IsInterruptMasked//* \brief Test if DBGU Interrupt is Masked //*---------------------------------------------------------------------------- int AT91F_DBGU_IsInterruptMasked(        AT91PS_DBGU pDbgu,   // \arg  pointer to a DBGU controller        unsigned int flag) // \arg  flag to be tested{        return (AT91F_DBGU_GetInterruptMaskStatus(pDbgu) & flag);}/* *****************************************************************************                SOFTWARE API FOR RTC   ***************************************************************************** *///*----------------------------------------------------------------------------//* \fn    AT91F_RTC_InterruptEnable//* \brief Enable RTC Interrupt//*---------------------------------------------------------------------------- void AT91F_RTC_InterruptEnable(        AT91PS_RTC pRtc,   // \arg  pointer to a RTC controller        unsigned int flag) // \arg  RTC interrupt to be enabled{        pRtc->RTC_IER = flag;}//*----------------------------------------------------------------------------//* \fn    AT91F_RTC_InterruptDisable//* \brief Disable RTC Interrupt//*---------------------------------------------------------------------------- void AT91F_RTC_InterruptDisable(        AT91PS_RTC pRtc,   // \arg  pointer to a RTC controller        unsigned int flag) // \arg  RTC interrupt to be disabled{        pRtc->RTC_IDR = flag;}//*----------------------------------------------------------------------------//* \fn    AT91F_RTC_GetInterruptMaskStatus//* \brief Return RTC Interrupt Mask Status//*---------------------------------------------------------------------------- unsigned int AT91F_RTC_GetInterruptMaskStatus( // \return RTC Interrupt Mask Status        AT91PS_RTC pRtc) // \arg  pointer to a RTC controller{

⌨️ 快捷键说明

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