[simulator] 消除windows下的警告
This commit is contained in:
parent
569facb12d
commit
08737c2a26
|
@ -345,7 +345,7 @@ static int dfs_win32_getdents(struct dfs_fd *file, struct dirent *dirp, rt_uint3
|
||||||
d->d_type = DT_DIR;
|
d->d_type = DT_DIR;
|
||||||
else
|
else
|
||||||
d->d_type = DT_REG;
|
d->d_type = DT_REG;
|
||||||
d->d_namlen = strlen(wdirp->curr);
|
d->d_namlen = (rt_uint8_t)strlen(wdirp->curr);
|
||||||
strncpy(d->d_name, wdirp->curr, DFS_PATH_MAX);
|
strncpy(d->d_name, wdirp->curr, DFS_PATH_MAX);
|
||||||
d->d_reclen = (rt_uint16_t)sizeof(struct dirent);
|
d->d_reclen = (rt_uint16_t)sizeof(struct dirent);
|
||||||
wdirp->curr += (strlen(wdirp->curr) + 1);
|
wdirp->curr += (strlen(wdirp->curr) + 1);
|
||||||
|
|
|
@ -58,10 +58,8 @@ static void get_rtc_timeval(struct timeval *tv)
|
||||||
tv->tv_usec = sys_time.wMilliseconds * 1000UL;
|
tv->tv_usec = sys_time.wMilliseconds * 1000UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_err_t windows_rtc_control(rt_device_t dev, int cmd, void *args)
|
static rt_err_t pc_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||||
{
|
{
|
||||||
struct tm newtime;
|
|
||||||
|
|
||||||
RT_ASSERT(dev != RT_NULL);
|
RT_ASSERT(dev != RT_NULL);
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
|
@ -70,7 +68,7 @@ static rt_err_t windows_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
get_rtc_timeval(&tv);
|
get_rtc_timeval(&tv);
|
||||||
*(rt_uint32_t *) args = tv.tv_sec;
|
*(time_t*) args = tv.tv_sec;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RT_DEVICE_CTRL_RTC_GET_TIMEVAL:
|
case RT_DEVICE_CTRL_RTC_GET_TIMEVAL:
|
||||||
|
@ -104,18 +102,18 @@ static rt_err_t windows_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RT_USING_DEVICE_OPS
|
#ifdef RT_USING_DEVICE_OPS
|
||||||
const static struct rt_device_ops soft_rtc_ops =
|
const static struct rt_device_ops pc_rtc_ops =
|
||||||
{
|
{
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
windows_rtc_control
|
pc_rtc_control
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int rt_windows_rtc_init(void)
|
int rt_pc_rtc_init(void)
|
||||||
{
|
{
|
||||||
/* make sure only one 'rtc' device */
|
/* make sure only one 'rtc' device */
|
||||||
RT_ASSERT(!rt_device_find("rtc"));
|
RT_ASSERT(!rt_device_find("rtc"));
|
||||||
|
@ -133,18 +131,18 @@ int rt_windows_rtc_init(void)
|
||||||
|
|
||||||
/* register rtc device */
|
/* register rtc device */
|
||||||
#ifdef RT_USING_DEVICE_OPS
|
#ifdef RT_USING_DEVICE_OPS
|
||||||
rtc_dev.ops = &soft_rtc_ops;
|
rtc_dev.ops = &pc_rtc_ops;
|
||||||
#else
|
#else
|
||||||
rtc_dev.init = RT_NULL;
|
rtc_dev.init = RT_NULL;
|
||||||
rtc_dev.open = RT_NULL;
|
rtc_dev.open = RT_NULL;
|
||||||
rtc_dev.close = RT_NULL;
|
rtc_dev.close = RT_NULL;
|
||||||
rtc_dev.read = RT_NULL;
|
rtc_dev.read = RT_NULL;
|
||||||
rtc_dev.write = RT_NULL;
|
rtc_dev.write = RT_NULL;
|
||||||
rtc_dev.control = windows_rtc_control;
|
rtc_dev.control = pc_rtc_control;
|
||||||
#endif
|
#endif
|
||||||
rtc_dev.user_data = RT_NULL; /* no private */
|
rtc_dev.user_data = RT_NULL; /* no private */
|
||||||
|
|
||||||
rt_device_register(&rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR);
|
rt_device_register(&rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_windows_rtc_init);
|
INIT_BOARD_EXPORT(rt_pc_rtc_init);
|
||||||
|
|
|
@ -29,6 +29,7 @@ static struct rt_serial_device _serial;
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
extern int getch(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handler for OSKey Thread
|
* Handler for OSKey Thread
|
||||||
|
|
|
@ -529,7 +529,7 @@ void finsh_thread_entry(void *parameter)
|
||||||
/* copy the history command */
|
/* copy the history command */
|
||||||
rt_memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
|
rt_memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
|
||||||
FINSH_CMD_SIZE);
|
FINSH_CMD_SIZE);
|
||||||
shell->line_curpos = shell->line_position = strlen(shell->line);
|
shell->line_curpos = shell->line_position = (rt_uint16_t)strlen(shell->line);
|
||||||
shell_handle_history(shell);
|
shell_handle_history(shell);
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
|
@ -551,7 +551,7 @@ void finsh_thread_entry(void *parameter)
|
||||||
|
|
||||||
rt_memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
|
rt_memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
|
||||||
FINSH_CMD_SIZE);
|
FINSH_CMD_SIZE);
|
||||||
shell->line_curpos = shell->line_position = strlen(shell->line);
|
shell->line_curpos = shell->line_position = (rt_uint16_t)strlen(shell->line);
|
||||||
shell_handle_history(shell);
|
shell_handle_history(shell);
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
|
@ -591,7 +591,7 @@ void finsh_thread_entry(void *parameter)
|
||||||
/* auto complete */
|
/* auto complete */
|
||||||
shell_auto_complete(&shell->line[0]);
|
shell_auto_complete(&shell->line[0]);
|
||||||
/* re-calculate position */
|
/* re-calculate position */
|
||||||
shell->line_curpos = shell->line_position = strlen(shell->line);
|
shell->line_curpos = shell->line_position = (rt_uint16_t)strlen(shell->line);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue