Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
33ec49fc
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
33ec49fc
编写于
1月 05, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
1月 05, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4165 from Hxinrong/rt_mutex_takeBranch
add error checks of rt_mutex_take()
上级
b8bd21f6
3f140782
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
110 addition
and
11 deletion
+110
-11
bsp/CME_M7/drivers/emac.c
bsp/CME_M7/drivers/emac.c
+12
-1
bsp/fh8620/drivers/i2c.c
bsp/fh8620/drivers/i2c.c
+4
-1
bsp/lpc55sxx/Libraries/drivers/drv_sd.c
bsp/lpc55sxx/Libraries/drivers/drv_sd.c
+25
-3
bsp/simulator/drivers/sst25vfxx_mtd_sim.c
bsp/simulator/drivers/sst25vfxx_mtd_sim.c
+33
-3
bsp/swm320-lq100/drivers/drv_nor_flash.c
bsp/swm320-lq100/drivers/drv_nor_flash.c
+36
-3
未找到文件。
bsp/CME_M7/drivers/emac.c
浏览文件 @
33ec49fc
...
...
@@ -312,8 +312,19 @@ struct pbuf *rt_cme_eth_rx(rt_device_t dev)
ETH_RX_DESC
*
desc
;
uint32_t
framelength
;
struct
rt_cme_eth
*
cme_eth
=
(
struct
rt_cme_eth
*
)
dev
;
rt_err_t
result
;
rt_mutex_take
(
&
cme_eth
->
lock
,
RT_WAITING_FOREVER
);
result
=
rt_mutex_take
(
&
cme_eth
->
lock
,
RT_WAITING_FOREVER
);
if
(
result
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
goto
_exit
;
}
else
if
(
result
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
goto
_exit
;
}
desc
=
ETH_AcquireFreeRxDesc
();
if
(
desc
==
RT_NULL
)
...
...
bsp/fh8620/drivers/i2c.c
浏览文件 @
33ec49fc
...
...
@@ -87,7 +87,10 @@ static rt_size_t fh_i2c_xfer(struct rt_i2c_bus_device *dev,
rt_completion_init
(
&
i2c_drv
->
transfer_completion
);
ret
=
rt_mutex_take
(
i2c_drv
->
lock
,
RT_WAITING_FOREVER
);
ret
=
rt_mutex_take
(
i2c_drv
->
lock
,
RT_WAITING_FOREVER
);
if
(
ret
!=
RT_EOK
)
{
goto
done
;
}
i2c_drv
->
msgs
=
msgs
;
i2c_drv
->
msgs_num
=
num
;
...
...
bsp/lpc55sxx/Libraries/drivers/drv_sd.c
浏览文件 @
33ec49fc
...
...
@@ -52,8 +52,19 @@ static rt_size_t rt_mci_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_siz
{
rt_uint8_t
status
=
kStatus_Success
;
struct
mci_device
*
mci
=
(
struct
mci_device
*
)
dev
;
int
ret
;
rt_mutex_take
(
&
mci
->
lock
,
RT_WAITING_FOREVER
);
ret
=
rt_mutex_take
(
&
mci
->
lock
,
RT_WAITING_FOREVER
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
ret
;
}
else
if
(
ret
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
ret
;
}
{
/* non-aligned. */
...
...
@@ -66,7 +77,7 @@ static rt_size_t rt_mci_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_siz
for
(
i
=
0
;
i
<
size
;
i
++
)
{
status
=
SD_ReadBlocks
(
&
mci
->
card
,
sdio_buffer
,
sector_adr
,
1
);
status
=
SD_ReadBlocks
(
&
mci
->
card
,
sdio_buffer
,
sector_adr
,
1
);
memcpy
(
copy_buffer
,
sdio_buffer
,
mci
->
card
.
blockSize
);
sector_adr
++
;
...
...
@@ -85,8 +96,19 @@ static rt_size_t rt_mci_write(rt_device_t dev, rt_off_t pos, const void *buffer,
{
rt_uint8_t
status
=
kStatus_Success
;
struct
mci_device
*
mci
=
(
struct
mci_device
*
)
dev
;
int
ret
;
rt_mutex_take
(
&
mci
->
lock
,
RT_WAITING_FOREVER
);
ret
=
rt_mutex_take
(
&
mci
->
lock
,
RT_WAITING_FOREVER
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
ret
;
}
else
if
(
ret
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
ret
;
}
{
/* non-aligned. */
...
...
bsp/simulator/drivers/sst25vfxx_mtd_sim.c
浏览文件 @
33ec49fc
...
...
@@ -58,7 +58,17 @@ static int sst25vfxx_read(struct rt_mtd_nor_device *device, rt_off_t position, r
sst25
=
SST25_MTD
(
device
);
RT_ASSERT
(
sst25
!=
RT_NULL
);
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
result
=
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
if
(
result
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
result
;
}
else
if
(
result
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
result
;
}
fseek
(
sst25
->
file
,
position
,
SEEK_SET
);
result
=
fread
(
data
,
size
,
1
,
sst25
->
file
);
...
...
@@ -78,7 +88,17 @@ static int sst25vfxx_write(struct rt_mtd_nor_device *device, rt_off_t position,
sst25
=
SST25_MTD
(
device
);
RT_ASSERT
(
sst25
!=
RT_NULL
);
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
result
=
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
if
(
result
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
result
;
}
else
if
(
result
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
result
;
}
fseek
(
sst25
->
file
,
position
,
SEEK_SET
);
result
=
fwrite
(
data
,
size
,
1
,
sst25
->
file
);
...
...
@@ -99,7 +119,17 @@ static rt_err_t sst25vfxx_erase_block(struct rt_mtd_nor_device *device, rt_off_t
RT_ASSERT
(
sst25
!=
RT_NULL
);
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
result
=
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
if
(
result
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
-
RT_ETIMEOUT
;
}
else
if
(
result
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
-
RT_ERROR
;
}
memset
(
block_buffer
,
0xFF
,
BLOCK_SIZE
);
fseek
(
sst25
->
file
,
offset
,
SEEK_SET
);
...
...
bsp/swm320-lq100/drivers/drv_nor_flash.c
浏览文件 @
33ec49fc
...
...
@@ -32,7 +32,18 @@ static rt_size_t swm320_read(struct rt_mtd_nor_device *device,
rt_uint8_t
*
data
,
rt_size_t
size
)
{
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
int
ret
=
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
ret
;
}
else
if
(
ret
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
ret
;
}
memcpy
(
data
,
((
const
void
*
)(
NORFLM_BASE
+
position
)),
size
);
rt_mutex_release
(
&
flash_lock
);
return
size
;
...
...
@@ -45,7 +56,18 @@ static rt_size_t swm320_write(struct rt_mtd_nor_device *device,
{
rt_size_t
i
;
const
rt_uint16_t
*
hwdata
=
(
const
rt_uint16_t
*
)
data
;
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
int
ret
=
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
ret
;
}
else
if
(
ret
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
size
/
2
;
i
++
)
{
NORFL_Write
(
position
,
hwdata
[
i
]);
...
...
@@ -59,7 +81,18 @@ static rt_err_t swm320_erase_block(struct rt_mtd_nor_device *device,
rt_off_t
offset
,
rt_uint32_t
length
)
{
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
rt_err_t
ret
=
rt_mutex_take
(
&
flash_lock
,
RT_WAITING_FOREVER
);
if
(
ret
==
-
RT_ETIMEOUT
)
{
rt_kprintf
(
"Take mutex time out.
\n
"
);
return
ret
;
}
else
if
(
ret
==
-
RT_ERROR
)
{
rt_kprintf
(
"Take mutex error.
\n
"
);
return
ret
;
}
NORFL_SectorErase
(
offset
);
rt_mutex_release
(
&
flash_lock
);
return
RT_EOK
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录