diff options
| author | liu2guang <[email protected]> | 2017-10-02 23:30:46 +0800 |
|---|---|---|
| committer | liu2guang <[email protected]> | 2017-10-02 23:30:46 +0800 |
| commit | d47dd9a12c978d8237f090d6cdba7e75fa409445 (patch) | |
| tree | d8c9976c1227b44731d209860f7ab5e5797ac865 | |
| parent | 44e3a56d91674b727dc3c97feb66833c42072523 (diff) | |
修复无法重复使用finsh命令device_test进行驱动测试
1. 该问题是打开设备后, 出错或者成功后没有关闭设备而导致.
| -rw-r--r-- | examples/test/device_test.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/test/device_test.c b/examples/test/device_test.c index 337eb0dbd0..c1902fe919 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; } |
