Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
9971072b
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9971072b
编写于
12月 25, 2017
作者:
S
SummerGift
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp] : modify some rt_inline function to adapt the new compiler
上级
9644678d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
161 addition
and
164 deletion
+161
-164
bsp/fh8620/libraries/driverlib/fh_i2c.c
bsp/fh8620/libraries/driverlib/fh_i2c.c
+0
-51
bsp/fh8620/libraries/driverlib/fh_mmc.c
bsp/fh8620/libraries/driverlib/fh_mmc.c
+0
-85
bsp/fh8620/libraries/driverlib/fh_wdt.c
bsp/fh8620/libraries/driverlib/fh_wdt.c
+0
-6
bsp/fh8620/libraries/inc/fh_i2c.h
bsp/fh8620/libraries/inc/fh_i2c.h
+49
-9
bsp/fh8620/libraries/inc/fh_mmc.h
bsp/fh8620/libraries/inc/fh_mmc.h
+105
-12
bsp/fh8620/libraries/inc/fh_wdt.h
bsp/fh8620/libraries/inc/fh_wdt.h
+7
-1
未找到文件。
bsp/fh8620/libraries/driverlib/fh_i2c.c
浏览文件 @
9971072b
...
...
@@ -157,26 +157,6 @@ static int I2C_SetSpeedCount(struct fh_i2c_obj *i2c_obj)
return
0
;
}
inline
UINT8
I2C_GetData
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_DATA_CMD
)
&
0xff
;
}
inline
void
I2C_SetDataCmd
(
struct
fh_i2c_obj
*
i2c_obj
,
UINT32
reg
)
{
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_DATA_CMD
,
reg
);
}
inline
void
I2C_SetInterruptMask
(
struct
fh_i2c_obj
*
i2c_obj
,
UINT32
mask
)
{
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_INTR_MASK
,
mask
);
}
inline
UINT32
I2C_GetInterruptMask
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_INTR_MASK
);
}
UINT32
I2C_ClearAndGetInterrupts
(
struct
fh_i2c_obj
*
i2c_obj
)
{
UINT32
stat
;
...
...
@@ -256,37 +236,6 @@ int I2C_HandleTxAbort(struct fh_i2c_obj *i2c_obj)
return
0
;
}
inline
UINT32
I2C_SetTransmitThreshold
(
struct
fh_i2c_obj
*
i2c_obj
,
int
txtl
)
{
return
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TX_TL
,
txtl
);
}
inline
UINT32
I2C_GetReceiveFifoLevel
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_RXFLR
);
}
inline
UINT32
I2C_GetTransmitFifoLevel
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TXFLR
);
}
inline
void
I2C_SetSlaveAddress
(
struct
fh_i2c_obj
*
i2c_obj
,
rt_uint16_t
addr
)
{
UINT32
reg
;
reg
=
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TAR
);
reg
&=
~
(
0x3ff
);
reg
|=
addr
&
0x3ff
;
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TAR
,
reg
);
}
inline
void
I2C_Enable
(
struct
fh_i2c_obj
*
i2c_obj
,
int
enable
)
{
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_ENABLE
,
enable
);
}
void
I2C_Init
(
struct
fh_i2c_obj
*
i2c_obj
)
{
UINT32
ic_con
;
...
...
bsp/fh8620/libraries/driverlib/fh_mmc.c
浏览文件 @
9971072b
...
...
@@ -28,31 +28,7 @@
// *1: card off
// *0: card on
inline
rt_uint32_t
MMC_GetCardStatus
(
struct
fh_mmc_obj
*
mmc_obj
)
{
rt_uint32_t
card_status
=
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_CDETECT
);
return
card_status
&
0x1
;
}
inline
void
MMC_StartDma
(
struct
fh_mmc_obj
*
mmc_obj
)
{
rt_uint32_t
reg
;
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_DBADDR
,
(
rt_uint32_t
)
mmc_obj
->
descriptors
);
reg
=
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
);
reg
|=
1
<<
7
;
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
,
reg
);
}
inline
void
MMC_StopDma
(
struct
fh_mmc_obj
*
mmc_obj
)
{
rt_uint32_t
reg
;
reg
=
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
);
reg
&=
~
(
1
<<
7
);
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
,
reg
);
}
void
MMC_InitDescriptors
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
*
buf
,
rt_uint32_t
size
)
{
...
...
@@ -80,67 +56,6 @@ void MMC_InitDescriptors(struct fh_mmc_obj *mmc_obj, rt_uint32_t *buf, rt_uint32
desc
[
desc_cnt
-
1
].
desc3
.
bit
.
buffer_addr1
=
0
;
}
inline
rt_uint32_t
MMC_GetWaterlevel
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
(
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
)
>>
17
)
&
0x1fff
;
}
inline
rt_uint32_t
MMC_GetStatus
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
);
}
inline
rt_uint32_t
MMC_GetRawInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_RINTSTS
);
}
inline
rt_uint32_t
MMC_GetUnmaskedInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_MINTSTS
);
}
inline
rt_uint32_t
MMC_ClearRawInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
interrupts
)
{
return
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_RINTSTS
,
interrupts
);
}
inline
rt_uint32_t
MMC_GetInterruptMask
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_INTMASK
);
}
inline
rt_uint32_t
MMC_SetInterruptMask
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
mask
)
{
return
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_INTMASK
,
mask
);
}
inline
void
MMC_SetByteCount
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
bytes
)
{
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BYTCNT
,
bytes
);
}
inline
void
MMC_SetBlockSize
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
size
)
{
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BLKSIZ
,
size
);
}
inline
rt_uint32_t
MMC_GetResponse
(
struct
fh_mmc_obj
*
mmc_obj
,
int
resp_num
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_RESP0
+
resp_num
*
4
);
}
inline
rt_uint32_t
MMC_IsFifoEmpty
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
(
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
)
>>
2
)
&
0x1
;
}
inline
rt_uint32_t
MMC_IsDataStateBusy
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
(
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
)
>>
10
)
&
0x1
;
}
int
MMC_WriteData
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
*
buf
,
rt_uint32_t
size
)
{
int
filled
=
0
,
fifo_available
,
i
,
retries
;
...
...
bsp/fh8620/libraries/driverlib/fh_wdt.c
浏览文件 @
9971072b
...
...
@@ -31,12 +31,6 @@ void WDT_Enable(struct fh_wdt_obj *wdt_obj, int enable)
SET_REG
(
wdt_obj
->
base
+
WDOG_CONTROL_REG_OFFSET
,
enable
);
}
inline
int
WDT_IsEnable
(
struct
fh_wdt_obj
*
wdt_obj
)
{
return
GET_REG
(
wdt_obj
->
base
+
WDOG_CONTROL_REG_OFFSET
)
&
WDOG_CONTROL_REG_WDT_EN_MASK
;
}
void
WDT_SetTopValue
(
struct
fh_wdt_obj
*
wdt_obj
,
int
top
)
{
SET_REG
(
wdt_obj
->
base
+
WDOG_TIMEOUT_RANGE_REG_OFFSET
,
top
);
...
...
bsp/fh8620/libraries/inc/fh_i2c.h
浏览文件 @
9971072b
...
...
@@ -208,18 +208,58 @@ struct fh_i2c_obj
};
rt_inline
UINT32
I2C_SetTransmitThreshold
(
struct
fh_i2c_obj
*
i2c_obj
,
int
txtl
)
{
return
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TX_TL
,
txtl
);
}
rt_inline
UINT32
I2C_GetReceiveFifoLevel
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_RXFLR
);
}
rt_inline
UINT32
I2C_GetTransmitFifoLevel
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TXFLR
);
}
rt_inline
void
I2C_SetSlaveAddress
(
struct
fh_i2c_obj
*
i2c_obj
,
rt_uint16_t
addr
)
{
UINT32
reg
;
reg
=
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TAR
);
reg
&=
~
(
0x3ff
);
reg
|=
addr
&
0x3ff
;
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_TAR
,
reg
);
}
rt_inline
void
I2C_Enable
(
struct
fh_i2c_obj
*
i2c_obj
,
int
enable
)
{
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_ENABLE
,
enable
);
}
rt_inline
UINT8
I2C_GetData
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_DATA_CMD
)
&
0xff
;
}
rt_inline
void
I2C_SetDataCmd
(
struct
fh_i2c_obj
*
i2c_obj
,
UINT32
reg
)
{
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_DATA_CMD
,
reg
);
}
rt_inline
void
I2C_SetInterruptMask
(
struct
fh_i2c_obj
*
i2c_obj
,
UINT32
mask
)
{
SET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_INTR_MASK
,
mask
);
}
rt_inline
UINT32
I2C_GetInterruptMask
(
struct
fh_i2c_obj
*
i2c_obj
)
{
return
GET_REG
(
i2c_obj
->
base
+
OFFSET_I2C_INTR_MASK
);
}
void
I2C_Init
(
struct
fh_i2c_obj
*
i2c_obj
);
inline
void
I2C_Enable
(
struct
fh_i2c_obj
*
i2c_obj
,
int
enable
);
inline
void
I2C_SetSlaveAddress
(
struct
fh_i2c_obj
*
i2c_obj
,
rt_uint16_t
addr
);
inline
UINT32
I2C_GetTransmitFifoLevel
(
struct
fh_i2c_obj
*
i2c_obj
);
inline
UINT32
I2C_GetReceiveFifoLevel
(
struct
fh_i2c_obj
*
i2c_obj
);
inline
UINT32
I2C_SetTransmitThreshold
(
struct
fh_i2c_obj
*
i2c_obj
,
int
txtl
);
int
I2C_HandleTxAbort
(
struct
fh_i2c_obj
*
i2c_obj
);
UINT32
I2C_ClearAndGetInterrupts
(
struct
fh_i2c_obj
*
i2c_obj
);
inline
void
I2C_SetInterruptMask
(
struct
fh_i2c_obj
*
i2c_obj
,
UINT32
mask
);
inline
UINT32
I2C_GetInterruptMask
(
struct
fh_i2c_obj
*
i2c_obj
);
inline
void
I2C_SetDataCmd
(
struct
fh_i2c_obj
*
i2c_obj
,
UINT32
reg
);
inline
UINT8
I2C_GetData
(
struct
fh_i2c_obj
*
i2c_obj
);
int
I2C_WaitMasterIdle
(
struct
fh_i2c_obj
*
i2c_obj
);
int
I2C_WaitDeviceIdle
(
struct
fh_i2c_obj
*
i2c_obj
);
...
...
bsp/fh8620/libraries/inc/fh_mmc.h
浏览文件 @
9971072b
...
...
@@ -197,18 +197,111 @@ struct fh_mmc_obj
MMC_DMA_Descriptors
*
descriptors
;
void
(
*
mmc_reset
)(
struct
fh_mmc_obj
*
);
};
inline
void
MMC_SetBlockSize
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
size
);
inline
void
MMC_SetByteCount
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
bytes
);
inline
rt_uint32_t
MMC_GetWaterlevel
(
struct
fh_mmc_obj
*
mmc_obj
);
inline
rt_uint32_t
MMC_GetResponse
(
struct
fh_mmc_obj
*
mmc_obj
,
int
resp_num
);
inline
rt_uint32_t
MMC_GetRegCmd
(
struct
fh_mmc_obj
*
mmc_obj
);
inline
rt_uint32_t
MMC_GetRegCtrl
(
struct
fh_mmc_obj
*
mmc_obj
);
inline
rt_uint32_t
MMC_SetInterruptMask
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
mask
);
inline
rt_uint32_t
MMC_GetInterruptMask
(
struct
fh_mmc_obj
*
mmc_obj
);
inline
rt_uint32_t
MMC_ClearRawInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
interrupts
);
inline
rt_uint32_t
MMC_GetRawInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
);
inline
rt_uint32_t
MMC_GetStatus
(
struct
fh_mmc_obj
*
mmc_obj
);
inline
rt_uint32_t
MMC_GetCardStatus
(
struct
fh_mmc_obj
*
mmc_obj
);
rt_inline
rt_uint32_t
MMC_GetCardStatus
(
struct
fh_mmc_obj
*
mmc_obj
)
{
rt_uint32_t
card_status
=
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_CDETECT
);
return
card_status
&
0x1
;
}
rt_inline
void
MMC_StartDma
(
struct
fh_mmc_obj
*
mmc_obj
)
{
rt_uint32_t
reg
;
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_DBADDR
,
(
rt_uint32_t
)
mmc_obj
->
descriptors
);
reg
=
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
);
reg
|=
1
<<
7
;
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
,
reg
);
}
rt_inline
void
MMC_StopDma
(
struct
fh_mmc_obj
*
mmc_obj
)
{
rt_uint32_t
reg
;
reg
=
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
);
reg
&=
~
(
1
<<
7
);
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BMOD
,
reg
);
}
rt_inline
rt_uint32_t
MMC_GetWaterlevel
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
(
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
)
>>
17
)
&
0x1fff
;
}
rt_inline
rt_uint32_t
MMC_GetStatus
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
);
}
rt_inline
rt_uint32_t
MMC_GetRawInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_RINTSTS
);
}
rt_inline
rt_uint32_t
MMC_GetUnmaskedInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_MINTSTS
);
}
rt_inline
rt_uint32_t
MMC_ClearRawInterrupt
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
interrupts
)
{
return
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_RINTSTS
,
interrupts
);
}
rt_inline
rt_uint32_t
MMC_GetInterruptMask
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_INTMASK
);
}
rt_inline
rt_uint32_t
MMC_SetInterruptMask
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
mask
)
{
return
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_INTMASK
,
mask
);
}
rt_inline
void
MMC_SetByteCount
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
bytes
)
{
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BYTCNT
,
bytes
);
}
rt_inline
void
MMC_SetBlockSize
(
struct
fh_mmc_obj
*
mmc_obj
,
rt_uint32_t
size
)
{
SET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_BLKSIZ
,
size
);
}
rt_inline
rt_uint32_t
MMC_GetResponse
(
struct
fh_mmc_obj
*
mmc_obj
,
int
resp_num
)
{
return
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_RESP0
+
resp_num
*
4
);
}
rt_inline
rt_uint32_t
MMC_IsFifoEmpty
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
(
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
)
>>
2
)
&
0x1
;
}
rt_inline
rt_uint32_t
MMC_IsDataStateBusy
(
struct
fh_mmc_obj
*
mmc_obj
)
{
return
(
GET_REG
(
mmc_obj
->
base
+
OFFSET_SDC_STATUS
)
>>
10
)
&
0x1
;
}
void
MMC_Init
(
struct
fh_mmc_obj
*
mmc_obj
);
int
MMC_ResetFifo
(
struct
fh_mmc_obj
*
mmc_obj
);
...
...
bsp/fh8620/libraries/inc/fh_wdt.h
浏览文件 @
9971072b
...
...
@@ -56,7 +56,13 @@ struct fh_wdt_obj
};
void
WDT_Enable
(
struct
fh_wdt_obj
*
wdt_obj
,
int
enable
);
inline
int
WDT_IsEnable
(
struct
fh_wdt_obj
*
wdt_obj
);
rt_inline
int
WDT_IsEnable
(
struct
fh_wdt_obj
*
wdt_obj
)
{
return
GET_REG
(
wdt_obj
->
base
+
WDOG_CONTROL_REG_OFFSET
)
&
WDOG_CONTROL_REG_WDT_EN_MASK
;
}
void
WDT_SetTopValue
(
struct
fh_wdt_obj
*
wdt_obj
,
int
top
);
void
WDT_SetCtrl
(
struct
fh_wdt_obj
*
wdt_obj
,
UINT32
reg
);
void
WDT_Kick
(
struct
fh_wdt_obj
*
wdt_obj
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录