| 1 | #ifndef __UCOS_DEV_H__ |
|---|
| 2 | #define __UCOS_DEV_H__ |
|---|
| 3 | |
|---|
| 4 | #include <sys/types.h> |
|---|
| 5 | #include <reent.h> |
|---|
| 6 | |
|---|
| 7 | typedef struct sys_table_t |
|---|
| 8 | { |
|---|
| 9 | int (*fork_r)(struct _reent *r); |
|---|
| 10 | int (*kill_r)(struct _reent *r, int pid, int sig); |
|---|
| 11 | int (*execve_r)(struct _reent *r, const char *, char *const *, char *const *); |
|---|
| 12 | int (*wait_r)(struct _reent *r, int *); |
|---|
| 13 | void (*exit)(int ret); |
|---|
| 14 | int (*gettimeofday_r)(struct _reent *r, struct timeval *tp, void *tzp); |
|---|
| 15 | _CLOCK_T_ (*times_r)(struct _reent *, struct tms *); |
|---|
| 16 | int (*getpid_r)(struct _reent *r); |
|---|
| 17 | int (*creat_r)(struct _reent *r, const char *path, int mode); |
|---|
| 18 | void* (*sbrk_r)(struct _reent *r, ptrdiff_t ptrdiff); |
|---|
| 19 | int (*isatty_r)(struct _reent *r, int fd); |
|---|
| 20 | } sys_table_t; |
|---|
| 21 | |
|---|
| 22 | extern sys_table_t *g_p_sys_table; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | typedef struct io_device_table_t |
|---|
| 26 | { |
|---|
| 27 | |
|---|
| 28 | const char *name; |
|---|
| 29 | void *p_internals; |
|---|
| 30 | |
|---|
| 31 | int (*open_r )( struct _reent *r, const char *path, int flags, int mode ); |
|---|
| 32 | |
|---|
| 33 | int (*close_r )( struct _reent *r, int fd ); |
|---|
| 34 | |
|---|
| 35 | long (*write_r )( struct _reent *r, int fd, const char *ptr, int len ); |
|---|
| 36 | |
|---|
| 37 | long (*read_r )( struct _reent *r, int fd, char *ptr, int len ); |
|---|
| 38 | |
|---|
| 39 | off_t (*lseek_r) (struct _reent *r, int fd, off_t offset, int whence); |
|---|
| 40 | |
|---|
| 41 | int (*fstat_r) (struct _reent *r, int fd, struct stat *buf); |
|---|
| 42 | |
|---|
| 43 | } io_device_table_t; |
|---|
| 44 | |
|---|
| 45 | extern io_device_table_t *g_device_tables[]; |
|---|
| 46 | |
|---|
| 47 | #endif /* __UCOS_DEV_H__ */ |
|---|