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

📄 lib_at91sam9261.h

📁 AT91RM9200 DataFlash boot源码
💻 H
📖 第 1 页 / 共 5 页
字号:
        return (AT91F_PIO_GetInputFilterStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_GetOutputDataStatus
// \brief Return PIO Output Data Status 
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_GetOutputDataStatus( // \return PIO Output Data Status 
	AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_ODSR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_InterruptEnable
// \brief Enable PIO Interrupt
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_InterruptEnable(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio interrupt to be enabled
{
        pPio->PIO_IER = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_InterruptDisable
// \brief Disable PIO Interrupt
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_InterruptDisable(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio interrupt to be disabled
{
        pPio->PIO_IDR = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_GetInterruptMaskStatus
// \brief Return PIO Interrupt Mask Status
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_GetInterruptMaskStatus( // \return PIO Interrupt Mask Status
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_IMR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_GetInterruptStatus
// \brief Return PIO Interrupt Status
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_GetInterruptStatus( // \return PIO Interrupt Status
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_ISR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsInterruptMasked
// \brief Test if PIO Interrupt is Masked 
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsInterruptMasked(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_GetInterruptMaskStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsInterruptSet
// \brief Test if PIO Interrupt is Set
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsInterruptSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_GetInterruptStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_MultiDriverEnable
// \brief Multi Driver Enable PIO
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_MultiDriverEnable(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio to be enabled
{
        pPio->PIO_MDER = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_MultiDriverDisable
// \brief Multi Driver Disable PIO
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_MultiDriverDisable(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio to be disabled
{
        pPio->PIO_MDDR = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_GetMultiDriverStatus
// \brief Return PIO Multi Driver Status
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_GetMultiDriverStatus( // \return PIO Multi Driver Status
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_MDSR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsMultiDriverSet
// \brief Test if PIO MultiDriver is Set
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsMultiDriverSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_GetMultiDriverStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_A_RegisterSelection
// \brief PIO A Register Selection 
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_A_RegisterSelection(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio A register selection
{
        pPio->PIO_ASR = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_B_RegisterSelection
// \brief PIO B Register Selection 
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_B_RegisterSelection(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio B register selection 
{
        pPio->PIO_BSR = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_Get_AB_RegisterStatus
// \brief Return PIO Interrupt Status
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_Get_AB_RegisterStatus( // \return PIO AB Register Status
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_ABSR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsAB_RegisterSet
// \brief Test if PIO AB Register is Set
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsAB_RegisterSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_Get_AB_RegisterStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_OutputWriteEnable
// \brief Output Write Enable PIO
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_OutputWriteEnable(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio output write to be enabled
{
        pPio->PIO_OWER = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_OutputWriteDisable
// \brief Output Write Disable PIO
//----------------------------------------------------------------------------*/
static inline void AT91F_PIO_OutputWriteDisable(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  pio output write to be disabled
{
        pPio->PIO_OWDR = flag;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_GetOutputWriteStatus
// \brief Return PIO Output Write Status
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_GetOutputWriteStatus( // \return PIO Output Write Status
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_OWSR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsOutputWriteSet
// \brief Test if PIO OutputWrite is Set
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsOutputWriteSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_GetOutputWriteStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_GetCfgPullup
// \brief Return PIO Configuration Pullup
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PIO_GetCfgPullup( // \return PIO Configuration Pullup 
        AT91PS_PIO pPio) // \arg  pointer to a PIO controller
{
        return pPio->PIO_PPUSR;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsOutputDataStatusSet
// \brief Test if PIO Output Data Status is Set 
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsOutputDataStatusSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (AT91F_PIO_GetOutputDataStatus(pPio) & flag);
}

//----------------------------------------------------------------------------
// \fn    AT91F_PIO_IsCfgPullupStatusSet
// \brief Test if PIO Configuration Pullup Status is Set
//----------------------------------------------------------------------------*/
static inline int AT91F_PIO_IsCfgPullupStatusSet(
        AT91PS_PIO pPio,   // \arg  pointer to a PIO controller
        unsigned int flag) // \arg  flag to be tested
{
        return (~AT91F_PIO_GetCfgPullup(pPio) & flag);
}

/* *****************************************************************************
                SOFTWARE API FOR PMC
   ***************************************************************************** */
//----------------------------------------------------------------------------
// \fn    AT91F_PMC_CfgSysClkEnableReg
// \brief Configure the System Clock Enable Register of the PMC controller
//----------------------------------------------------------------------------*/
static inline void AT91F_PMC_CfgSysClkEnableReg (
	AT91PS_PMC pPMC, // \arg pointer to PMC controller
	unsigned int mode)
{
	// Write to the SCER register
	pPMC->PMC_SCER = mode;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PMC_CfgSysClkDisableReg
// \brief Configure the System Clock Disable Register of the PMC controller
//----------------------------------------------------------------------------*/
static inline void AT91F_PMC_CfgSysClkDisableReg (
	AT91PS_PMC pPMC, // \arg pointer to PMC controller
	unsigned int mode) 
{
	// Write to the SCDR register
	pPMC->PMC_SCDR = mode;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PMC_GetSysClkStatusReg
// \brief Return the System Clock Status Register of the PMC controller
//----------------------------------------------------------------------------*/
static inline unsigned int AT91F_PMC_GetSysClkStatusReg (
	AT91PS_PMC pPMC // pointer to a CAN controller
	)
{
	return pPMC->PMC_SCSR;	
}

//----------------------------------------------------------------------------
// \fn    AT91F_PMC_EnableHCK
// \brief Enable AHB peripheral clock
//----------------------------------------------------------------------------*/
static inline void AT91F_PMC_EnableHCK (
	AT91PS_PMC pPMC, // \arg pointer to PMC controller
	unsigned int hck)
{
	pPMC->PMC_SCER = (1 << hck) << 16;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PMC_DisableHCK
// \brief Disable AHB peripheral clock
//----------------------------------------------------------------------------*/
static inline void AT91F_PMC_DisableHCK (
	AT91PS_PMC pPMC, // \arg pointer to PMC controller
	unsigned int hck)  // \arg Peripheral clock identifier 0 .. 7
{
	pPMC->PMC_SCDR = (1 << hck) << 16;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PMC_EnablePeriphClock
// \brief Enable peripheral clock
//----------------------------------------------------------------------------*/
static inline void AT91F_PMC_EnablePeriphClock (
	AT91PS_PMC pPMC, // \arg pointer to PMC controller
	unsigned int periphIds)  // \arg IDs of peripherals to enable
{
	pPMC->PMC_PCER = periphIds;
}

//----------------------------------------------------------------------------
// \fn    AT91F_PMC_DisablePeriphClock
// \brief Disable peripheral clock
//----------------------------------------------------------------------------*/
static inline void AT91F_PMC_DisablePeriphClock (
	AT91PS_PMC pPMC, // \arg pointer to PMC controller
	unsigned int periphIds)  // \arg IDs of peripherals to enable
{

⌨️ 快捷键说明

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