clean code under bsp/simulator
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2362 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
9b9266ad72
commit
76218a079d
|
@ -107,12 +107,4 @@ int rt_application_init()
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int rt_application_init(void);
|
||||
#if 1
|
||||
FINSH_FUNCTION_EXPORT(rt_application_init, app init)
|
||||
void testfun()
|
||||
{}
|
||||
FINSH_FUNCTION_EXPORT(testfun, test fun)
|
||||
#endif
|
||||
/*@}*/
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
#include "rtthread.h"
|
||||
//#ifdef RT_USING_SERIAL
|
||||
|
||||
#define _DEBUG_SERIAL 0
|
||||
#include "serial.h"
|
||||
|
@ -57,7 +56,6 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt
|
|||
rt_uint8_t* ptr;
|
||||
rt_err_t err_code;
|
||||
|
||||
#if 1
|
||||
ptr = buffer;
|
||||
err_code = RT_EOK;
|
||||
|
||||
|
@ -101,9 +99,8 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt
|
|||
/* set error code */
|
||||
rt_set_errno(err_code);
|
||||
return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
|
||||
{
|
||||
#if _DEBUG_SERIAL==1
|
||||
|
@ -161,4 +158,4 @@ rt_err_t rt_hw_serial_init(void)
|
|||
return rt_hw_serial_register(&serial_device,"sci0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* File : rtdef.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
|
@ -9,8 +9,7 @@
|
|||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2011-12-16 aozima the first version
|
||||
* 2012-02-01 mbbill MTD device version
|
||||
* 2012-10-21 prife the first version
|
||||
*/
|
||||
|
||||
#include <rtdevice.h>
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <stdio.h>
|
||||
#include <board.h>
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
/* dfs init */
|
||||
#include <dfs_init.h>
|
||||
/* dfs filesystem:ELM filesystem init */
|
||||
#include <dfs_elm.h>
|
||||
/* dfs Filesystem APIs */
|
||||
#include <dfs_fs.h>
|
||||
#endif
|
||||
|
||||
#include <dfs_posix.h>
|
||||
|
||||
int testfat(void)
|
||||
{
|
||||
int Fd,i;
|
||||
int res;
|
||||
|
||||
Fd = open("/nor/test.txt", O_WRONLY | O_CREAT | O_TRUNC, 0); //打开文件
|
||||
if (Fd>=0)
|
||||
{
|
||||
rt_kprintf("begin\n");
|
||||
for (i = 0; i < 94520 ; i++)
|
||||
//for (i = 0; i < 512 ; i++)
|
||||
{
|
||||
res = write(Fd, &i, 1);
|
||||
if (res < 0)
|
||||
{
|
||||
rt_kprintf("write %d bytes, then meet a error, break\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
close(Fd);
|
||||
rt_kprintf("over\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("failed\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char buf[94520];
|
||||
int testfat2(void)
|
||||
{
|
||||
int Fd,i;
|
||||
|
||||
Fd = open("/nor/test2.txt", O_WRONLY | O_CREAT | O_TRUNC, 0); //打开文件
|
||||
if (Fd>=0)
|
||||
{
|
||||
rt_kprintf("begin\n");
|
||||
for (i = 0; i < 94520 ; i++)
|
||||
{
|
||||
write(Fd, buf, 1);
|
||||
}
|
||||
close(Fd);
|
||||
rt_kprintf("over\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("failed\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int testfat3(void)
|
||||
{
|
||||
int Fd,i;
|
||||
|
||||
Fd = open("/nor/test3.txt", O_WRONLY | O_CREAT | O_TRUNC, 0); //打开文件
|
||||
if (Fd>=0)
|
||||
{
|
||||
rt_kprintf("begin\n");
|
||||
{
|
||||
write(Fd, buf, 94520);
|
||||
}
|
||||
close(Fd);
|
||||
rt_kprintf("over\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("failed\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <finsh.h>
|
||||
FINSH_FUNCTION_EXPORT(testfat, test fs);
|
||||
FINSH_FUNCTION_EXPORT(testfat2, test fs);
|
||||
FINSH_FUNCTION_EXPORT(testfat3, test fs);
|
|
@ -279,10 +279,6 @@
|
|||
RelativePath=".\startup.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\testfs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\usart_sim.c"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue