未验证 提交 5ab2901d 编写于 作者: G guo 提交者: GitHub

Merge pull request #5168 from mysterywolf/str

...@@ -11,6 +11,14 @@ ...@@ -11,6 +11,14 @@
#include <shell.h> #include <shell.h>
#ifdef RT_USING_POSIX
#error "simulator does not support RT_USING_POSIX"
#endif
#ifdef RT_USING_LIBC
#error "simulator does not support RT_USING_LIBC"
#endif
int platform_init(void) int platform_init(void)
{ {
#ifdef RT_USING_LWIP #ifdef RT_USING_LWIP
......
...@@ -110,4 +110,10 @@ int rt_hw_board_init(void) ...@@ -110,4 +110,10 @@ int rt_hw_board_init(void)
#endif #endif
return 0; return 0;
} }
void rt_hw_us_delay(rt_uint32_t usec)
{
}
/*@}*/ /*@}*/
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#ifdef _WIN32
#include <winsock.h>
#endif
#ifndef FD_SETSIZE #ifndef FD_SETSIZE
#define FD_SETSIZE 32 #define FD_SETSIZE 32
#endif #endif
...@@ -26,16 +30,17 @@ ...@@ -26,16 +30,17 @@
#define FD_SETSIZE DFS_FD_MAX #define FD_SETSIZE DFS_FD_MAX
#endif /* SAL_USING_POSIX */ #endif /* SAL_USING_POSIX */
#define NBBY 8 /* number of bits in a byte */
typedef long fd_mask; typedef long fd_mask;
#ifndef _WIN32
#ifndef _SYS_TYPES_FD_SET /* MIPS */
#define NBBY 8 /* number of bits in a byte */
#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ #define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
#ifndef howmany #ifndef howmany
#define howmany(x,y) (((x)+((y)-1))/(y)) #define howmany(x,y) (((x)+((y)-1))/(y))
#endif #endif
#ifndef _SYS_TYPES_FD_SET /* MIPS */
typedef struct _types_fd_set { typedef struct _types_fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} _types_fd_set; } _types_fd_set;
...@@ -48,5 +53,6 @@ typedef struct _types_fd_set { ...@@ -48,5 +53,6 @@ typedef struct _types_fd_set {
#endif /* _SYS_TYPES_FD_SET */ #endif /* _SYS_TYPES_FD_SET */
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
#endif /* _WIN32 */
#endif /* __SYS_SELECT_H__ */ #endif /* __SYS_SELECT_H__ */
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#include <dfs_posix.h> #include <dfs_posix.h>
#endif #endif
#ifdef _WIN32
#include <winsock.h>
#endif
struct winsize { struct winsize {
unsigned short ws_row; unsigned short ws_row;
unsigned short ws_col; unsigned short ws_col;
...@@ -35,8 +39,8 @@ struct winsize { ...@@ -35,8 +39,8 @@ struct winsize {
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ #define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ #define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
#define FIONWRITE _IOR('f', 121, int) /* get # bytes outstanding in send queue */
#endif #endif
#define FIONWRITE _IOR('f', 121, int) /* get # bytes outstanding in send queue */
#define TCGETS 0x5401 #define TCGETS 0x5401
#define TCSETS 0x5402 #define TCSETS 0x5402
......
...@@ -72,7 +72,8 @@ int libc_stdio_set_console(const char* device_name, int mode) ...@@ -72,7 +72,8 @@ int libc_stdio_set_console(const char* device_name, int mode)
return -1; return -1;
} }
int libc_stdio_get_console(void) { int libc_stdio_get_console(void)
{
if (std_console) if (std_console)
return fileno(std_console); return fileno(std_console);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册