📄 lib_at91m55800a.h
字号:
//*----------------------------------------------------------------------------
//* 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_AT91M55800A.h
//* Object : AT91M55800A inlined functions
//* Generated : AT91 SW Application Group 07/01/2003 (17:21:53)
//*
//* CVS Reference : /lib_sf.h/1.2/Tue Nov 19 12:48:00 2002//
//* CVS Reference : /lib_pdc_1363d.h/1.2/Wed Feb 19 08:25:20 2003//
//* CVS Reference : /lib_ebi_55800a.h/1.1/Tue Oct 29 13:28:50 2002//
//* CVS Reference : /lib_wd.h/1.3/Tue Nov 19 12:48:00 2002//
//* CVS Reference : /lib_rtc_1366c.h/1.2/Tue Nov 19 12:48:00 2002//
//* CVS Reference : /lib_pio_1321c.h/1.4/Thu Nov 21 14:03:12 2002//
//* CVS Reference : /lib_spi.h/1.3/Thu Nov 21 12:37:56 2002//
//* CVS Reference : /lib_apmc_55800a.h/1.7/Thu Nov 21 12:36:40 2002//
//* CVS Reference : /lib_usart_1242e.h/1.4/Thu Nov 21 14:03:12 2002//
//* CVS Reference : /lib_aic_1246f.h/1.3/Wed Feb 19 08:25:20 2003//
//*----------------------------------------------------------------------------
#ifndef lib_AT91M55800A_H
#define lib_AT91M55800A_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 RTC
***************************************************************************** */
//*----------------------------------------------------------------------------
//* \fn AT91F_RTC_Configure
//* \brief Configure the RTC
//*----------------------------------------------------------------------------
__inline unsigned int AT91F_RTC_Configure (
const unsigned int null) // \arg
{
/* NOT DEFINED AT THIS MOMENT */
return (0);
}
/* *****************************************************************************
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 (
AT91PS_PIO pPio, // \arg pointer to a PIO controller
unsigned int pin) // \arg IT to be enabled
{
//* Write to the IER register
pPio->PIO_IER = pin;
}
//*----------------------------------------------------------------------------
//* \fn AT91F_PIO_DisableIt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -