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

📄 lib_at91m40800.h

📁 在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LEA_4S的驱动,位置速寻算法,语音芯片ISD4004的录放音驱动,LED页面管理等等.从启动代码到操作系统的移植以及到业
💻 H
📖 第 1 页 / 共 3 页
字号:
//*----------------------------------------------------------------------------*/
//*         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_AT91R40008.h
//* Object              : AT91R40008 inlined functions
//* Generated           : AT91 SW Application Group  02/19/2003 (11:13:32)
//*
//* CVS Reference       : /lib_sf_x40.h/1.2/Tue Nov 19 13:48:02 2002//
//* CVS Reference       : /lib_pdc_1363d.h/1.2/Wed Feb 19 09:25:22 2003//
//* CVS Reference       : /lib_ebi_x40.h/1.1/Tue Nov 12 13:27:24 2002//
//* CVS Reference       : /lib_wd.h/1.3/Tue Nov 19 13:48:02 2002//
//* CVS Reference       : /lib_ps_x40.h/1.2/Mon Jan 06 13:15:22 2003//
//* CVS Reference       : /lib_pio_1321c.h/1.4/Thu Nov 21 15:03:14 2002//
//* CVS Reference       : /lib_usart_1242e.h/1.4/Thu Nov 21 15:03:14 2002//
//* CVS Reference       : /lib_aic_1246f.h/1.3/Wed Feb 19 09:25:20 2003//
//*----------------------------------------------------------------------------*/
#include "at91m40800.h"

#ifndef lib_AT91R40008_H
#define lib_AT91R40008_H

/* *****************************************************************************
                SOFTWARE API FOR SF
   ***************************************************************************** */
//*----------------------------------------------------------------------------*/
//* \fn    AT91F_SF_Configure
//* \brief Configure the SF
//*----------------------------------------------------------------------------*/
__inline unsigned int AT91F_SF_Configure (
        const unsigned int null) // \arg

{
        /* NOT DEFINED AT THIS MOMENT */
        return ( 0 );
}

/* *****************************************************************************
                SOFTWARE API FOR PDC
   ***************************************************************************** */
//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PDC_Open
//* \brief Clear Transmit and Receive Counters
//*----------------------------------------------------------------------------*/
__inline void AT91F_PDC_Open ( 
	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller
{
	pPDC->PDC_TCR = 0 ;
	pPDC->PDC_RCR = 0 ;
}
//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PDC_Close
//* \brief Clear Transmit and Receive Counters
//*----------------------------------------------------------------------------*/
__inline void AT91F_PDC_Close ( 
	AT91PS_PDC pPDC )       // \arg pointer to a PDC controller
{
	pPDC->PDC_TCR = 0 ;
	pPDC->PDC_RCR = 0 ;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PDC_IsTxEmpty
//* \brief Test if the current transfer descriptor has been sent
//*----------------------------------------------------------------------------*/
__inline 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_IsRxEmpty
//* \brief Test if the current transfer descriptor has been filled
//*----------------------------------------------------------------------------*/
__inline 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_SendFrame
//* \brief Send a Frame with the PDC.
//*----------------------------------------------------------------------------*/
__inline unsigned int AT91F_PDC_SendFrame(
	AT91PS_PDC pPDC,
	char *pBuffer,
	unsigned int szBuffer )
{
	if (AT91F_PDC_IsTxEmpty(pPDC)) {
		// Transmit buffer can be initialized
	        pPDC->PDC_TPR = (unsigned int) pBuffer;
        	pPDC->PDC_TCR = szBuffer;
		return 1;
	}
	else {
		// Transmit buffer is in use...
		return 0;
	}
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PDC_ReceiveFrame
//* \brief Receive a Frame with PDC.
//*----------------------------------------------------------------------------*/
__inline unsigned int AT91F_PDC_ReceiveFrame (
	AT91PS_PDC pPDC,
	char *pBuffer,
	unsigned int szBuffer )
{
	if (AT91F_PDC_IsRxEmpty(pPDC)) {
		//Receive buffer can be initialized
	        pPDC->PDC_RPR = (unsigned int) pBuffer;
		pPDC->PDC_RCR = szBuffer;
		return 1;
	}
	else {
		//Receive buffer is in use...
		return 0;
	}
}
/* *****************************************************************************
                SOFTWARE API FOR EBI
   ***************************************************************************** */
//*----------------------------------------------------------------------------*/
//* \fn    AT91F_EBI_OpenChipSelect
//* \brief Open a Chip Select Line
//*----------------------------------------------------------------------------*/
__inline void AT91F_EBI_OpenChipSelect (
        AT91PS_EBI pEbi,                        // \arg pointer to the EBI registers
        unsigned int chip_select_num,           // \arg Chip Select Number
        unsigned int chip_select_config)        // \arg Chip Select Configuration
{
    pEbi->EBI_CSR[chip_select_num] = chip_select_config ;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_EBI_CloseChipSelect
//* \brief Close a Chip Select Line
//*----------------------------------------------------------------------------*/
__inline void AT91F_EBI_CloseChipSelect (
        AT91PS_EBI pEbi,                        // \arg pointer to the EBI registers
        unsigned int chip_select_num )          // \arg Chip Select Number
{
    pEbi->EBI_CSR[chip_select_num]  &= ~AT91C_EBI_CSEN ;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_EBI_GetChipSelectConfig
//* \brief Return the Configuration of a Chip Select Line
//*----------------------------------------------------------------------------*/
__inline unsigned int AT91F_EBI_GetChipSelectConfig (
        AT91PS_EBI pEbi,                        // \arg pointer to the EBI registers
        unsigned int chip_select_num )          // \arg Chip Select Number
{
    return ( pEbi->EBI_CSR[chip_select_num] ) ;
}/* *****************************************************************************
                SOFTWARE API FOR WD
   ***************************************************************************** */
//*----------------------------------------------------------------------------*/
//* \fn    AT91F_WD_Configure
//* \brief Configure the watchdog
//*----------------------------------------------------------------------------*/
__inline unsigned int AT91F_WD_Configure (
        const unsigned int null) // \arg
{
        /* NOT DEFINED AT THIS MOMENT */
    return (0);
}

/* *****************************************************************************
                SOFTWARE API FOR PS
   ***************************************************************************** */
//*--------------------------------------------------------------------------
//* \fn    AT91F_PS_EnablePeriphClock
//* \brief Enable peripheral clock
//*--------------------------------------------------------------------------*/
__inline void AT91F_PS_EnablePeriphClock (
        AT91PS_PS pPS, // \arg pointer to PS controller
        unsigned int periphIds)  // \arg IDs of peripherals to enable
{
        pPS->PS_PCER = periphIds;
}

//*--------------------------------------------------------------------------
//* \fn    AT91F_PS_DisablePeriphClock
//* \brief Enable peripheral clock
//*--------------------------------------------------------------------------*/
__inline void AT91F_PS_DisablePeriphClock (
        AT91PS_PS pPS, // \arg pointer to PS controller
        unsigned int periphIds)  // \arg IDs of peripherals to enable
{
        pPS->PS_PCDR = periphIds;
}

//*--------------------------------------------------------------------------
//* \fn    AT91F_PS_GetPeriphClockStatus
//* \brief Return the peripheral clock status
//*--------------------------------------------------------------------------*/
__inline int AT91F_PS_GetPeriphClockStatus (
        AT91PS_PS pPS) // \arg pointer to PS controller
{
        return(pPS->PS_PCSR);
}/* *****************************************************************************
                SOFTWARE API FOR PIO
   ***************************************************************************** */
//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_CfgPeriph
//* \brief Enable pins to be drived by peripheral
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_CfgPeriph(
        AT91PS_PIO pPio,             // \arg pointer to a PIO controller
        unsigned int periphEnable,  // \arg PERIPH to enable
        unsigned int unused)                  // \arg void arguments. Not used. It's to allows compatibility
                                    // with the same function for PIO2 with 2 peripherals by PIO line.
{
        pPio->PIO_PDR = periphEnable; // Set in Periph mode
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_CfgOutput
//* \brief Enable PIO in output mode
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_CfgOutput(
        AT91PS_PIO pPio,             // \arg pointer to a PIO controller
        unsigned int pioEnable)      // \arg PIO to be enabled
{
        pPio->PIO_PER = pioEnable; // Set in PIO mode
        pPio->PIO_OER = pioEnable; // Configure in Output
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_CfgInput
//* \brief Enable PIO in input mode
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_CfgInput(
        AT91PS_PIO pPio,             // \arg pointer to a PIO controller
        unsigned int inputEnable)      // \arg PIO to be enabled
{
        // Disable output
        pPio->PIO_ODR  = inputEnable;
        pPio->PIO_PER  = inputEnable;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_CfgOpendrain
//* \brief Configure PIO in open drain
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_CfgOpendrain(
        AT91PS_PIO pPio,             // \arg pointer to a PIO controller
        unsigned int multiDrvEnable) // \arg pio to be configured in open drain
{
        // Configure the multi-drive option
        pPio->PIO_MDDR = ~multiDrvEnable;
        pPio->PIO_MDER = multiDrvEnable;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_CfgInputFilter
//* \brief Enable input filter on input PIO
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_CfgInputFilter(
        AT91PS_PIO pPio,             // \arg pointer to a PIO controller
        unsigned int inputFilter)    // \arg PIO to be configured with input filter

{
        // Configure the Direct Drive
        pPio->PIO_IFDR  = ~inputFilter;
        pPio->PIO_IFER  = inputFilter;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_GetInput
//* \brief Return PIO input value
//*----------------------------------------------------------------------------*/
__inline unsigned int AT91F_PIO_GetInput( // \return PIO input
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_PDSR;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_IsInputSet
//* \brief Test if PIO is input flag is active
//*----------------------------------------------------------------------------*/
__inline int AT91F_PIO_IsInputSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_GetInput(pPio) & flag);
}


//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_SetOutput
//* \brief Set to 1 output PIO
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_SetOutput(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  output to be set
{
        pPio->PIO_SODR = flag;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_ClearOutput
//* \brief Set to 0 output PIO
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_ClearOutput(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  output to be cleared
{
        pPio->PIO_CODR = flag;
}

//*----------------------------------------------------------------------------*/
//* \fn    AT91F_PIO_EnableIt
//* \brief Enable a PIO pin IT
//*----------------------------------------------------------------------------*/
__inline void AT91F_PIO_EnableIt (

⌨️ 快捷键说明

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