amba_io.h
来自「嵌入式系统」· C头文件 代码 · 共 123 行
H
123 行
/*-----------------------------------------------------------------------------
@@
@@ Copyright (c) 1999 Sharp Corporation All rights reserved.
@@
@@ (Summary) : The file of the functions for ARM AMBA IO
@@
@@ (Comment) :
@@
@@ (Author) : Tsuneo TOMITA
@@
@@ (History) : Date Modifier Comment
@@
@@ (RCS ID) :
@@
-----------------------------------------------------------------------------*/
#ifndef AMBA_IO
#define AMBA_IO
/******************************************************************************
@@
@@ [Name] : apd_ReadReg
@@
@@ [Summary] : The function to read data from the address on AMBA BUS
@@
@@ [Argument] : reg_adrs : AMBA BUS address
@@
@@ [Return] : The read data from the specific address
@@
@@ [Desc] : Read data from the specific address on AMBA BUS
@@
@@ [History] : Date Modifier Comment
@@
@@ [END]
******************************************************************************/
APD_INLINE unsigned long apd_ReadReg(
volatile unsigned long *reg_adrs
)
{
return(*reg_adrs);
}
/******************************************************************************
@@
@@ [Name] : apd_WriteReg
@@
@@ [Summary] : The function to write data to the address on AMBA BUS
@@
@@ [Argument] : reg_adrs : AMBA BUS address
@@ reg_data : Written data
@@
@@ [Return] : None
@@
@@ [Desc] : Write the specific data to the specific address on AMBA BUS
@@
@@ [History] : Date Modifier Comment
@@
@@ [END]
******************************************************************************/
APD_INLINE void apd_WriteReg(
volatile unsigned long *reg_adrs,
unsigned long reg_data
)
{
*reg_adrs = reg_data;
}
/******************************************************************************
@@
@@ [Name] : apd_ReadRegByMask
@@
@@ [Summary] : The function to read from the address on AMBA BUS with mask
@@
@@ [Argument] : reg_adrs : AMBA BUS address
@@ mask : Mask data
@@
@@ [Return] : The read data from the specific address with mask
@@
@@ [Desc] : Read data from the specific address on AMBA BUS and mask this
@@ data with the specific mask data
@@
@@ [History] : Date Modifier Comment
@@
@@ [END]
******************************************************************************/
APD_INLINE unsigned long apd_ReadRegByMask(
volatile unsigned long *reg_adrs,
unsigned long mask
)
{
return(*reg_adrs & mask);
}
/******************************************************************************
@@
@@ [Name] : apd_WriteRegByMask
@@
@@ [Summary] : The function to write data to the address on AMBA BUS
@@ with mask
@@
@@ [Argument] : reg_adrs : AMBA BUS address
@@ reg_data : Written data
@@ mask : Mask data
@@
@@ [Return] : None
@@
@@ [Desc] : Mask data of the specific address with the specific mask
@@ data, and write the specific data to the address on AMBA BUS
@@
@@ [History] : Date Modifier Comment
@@
@@ [END]
******************************************************************************/
APD_INLINE void apd_WriteRegByMask(volatile unsigned long *reg_adrs,unsigned long reg_data,unsigned long mask)
{
unsigned long r;
r = *reg_adrs & ~mask;
*reg_adrs = r | reg_data;
}
#endif /* APD_AMBA_IO */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?