From d47dd9a12c978d8237f090d6cdba7e75fa409445 Mon Sep 17 00:00:00 2001 From: liu2guang <1004383796@qq.com> Date: Mon, 2 Oct 2017 23:30:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E4=BD=BF=E7=94=A8finsh=E5=91=BD=E4=BB=A4device=5Ftest?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E9=A9=B1=E5=8A=A8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 该问题是打开设备后, 出错或者成功后没有关闭设备而导致. --- examples/test/device_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/test/device_test.c b/examples/test/device_test.c index 337eb0dbd..c1902fe91 100644 --- a/examples/test/device_test.c +++ b/examples/test/device_test.c @@ -90,7 +90,7 @@ static rt_err_t _block_device_test(rt_device_t device) /* step 3: R/W test */ { - rt_uint32_t i,err_count, sector_no; + rt_uint32_t i, err_count, sector_no; rt_uint8_t * data_point; i = rt_device_read(device, 0, read_buffer, 1); @@ -449,11 +449,13 @@ static rt_err_t _block_device_test(rt_device_t device) } } /* step 5: multiple sector speed test */ + rt_device_close(device); return RT_EOK; }// device can read and write. else { // device read only + rt_device_close(device); return RT_EOK; }// device read only @@ -466,6 +468,7 @@ __return: { rt_free(write_buffer); } + rt_device_close(device); return RT_ERROR; } -- GitLab