88 * 2018-09-25 misonyo first edition.
99 */
1010/*
11- * 程序清单:这是一个通过SD卡设备的使用例程
11+ * 程序清单:这是一个SD卡设备的使用例程
1212 * 例程导出了 sd_sample 命令到控制终端
1313 * 命令调用格式:sd_sample sd0
1414 * 命令解释:命令第二个参数是要使用的SD设备的名称,为空则使用例程默认的SD设备。
@@ -32,9 +32,9 @@ void fill_buffer(rt_uint8_t *buff, rt_uint32_t buff_length)
3232 }
3333}
3434
35- static rt_err_t sd_sample (int argc , char * argv [])
35+ static int sd_sample (int argc , char * argv [])
3636{
37- rt_err_t result ;
37+ rt_err_t ret ;
3838 rt_device_t sd_device ;
3939 char sd_name [RT_NAME_MAX ];
4040 rt_uint8_t * write_buff , * read_buff ;
@@ -57,20 +57,20 @@ static rt_err_t sd_sample(int argc, char *argv[])
5757 return RT_ERROR ;
5858 }
5959 /* 打开设备 */
60- result = rt_device_open (sd_device , RT_DEVICE_OFLAG_RDWR );
61- if (result != RT_EOK )
60+ ret = rt_device_open (sd_device , RT_DEVICE_OFLAG_RDWR );
61+ if (ret != RT_EOK )
6262 {
6363 rt_kprintf ("open device %s failed!\n" , sd_name );
64- return result ;
64+ return ret ;
6565 }
6666
6767 rt_memset (& geo , 0 , sizeof (geo ));
6868 /* 获取块设备信息 */
69- result = rt_device_control (sd_device , RT_DEVICE_CTRL_BLK_GETGEOME , & geo );
70- if (result != RT_EOK )
69+ ret = rt_device_control (sd_device , RT_DEVICE_CTRL_BLK_GETGEOME , & geo );
70+ if (ret != RT_EOK )
7171 {
7272 rt_kprintf ("control device %s failed!\n" , sd_name );
73- return result ;
73+ return ret ;
7474 }
7575 rt_kprintf ("device information:\n" );
7676 rt_kprintf ("sector size : %d byte\n" , geo .bytes_per_sector );
0 commit comments