Browse Source

revise some RT_USING_POSIX to RT_USING_POSIX_DEVIO

Meco Man 3 năm trước cách đây
mục cha
commit
7c789d4b11

+ 2 - 2
components/dfs/filesystems/devfs/devfs.c

@@ -173,7 +173,7 @@ int dfs_device_fs_open(struct dfs_fd *file)
     if (device == RT_NULL)
         return -ENODEV;
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
     if (device->fops)
     {
         /* use device fops */
@@ -192,7 +192,7 @@ int dfs_device_fs_open(struct dfs_fd *file)
         }
     }
     else
-#endif
+#endif /* RT_USING_POSIX_DEVIO */
     {
         result = rt_device_open(device, RT_DEVICE_OFLAG_RDWR);
         if (result == RT_EOK || result == -RT_ENOSYS)

+ 6 - 7
components/drivers/serial/serial.c

@@ -36,7 +36,7 @@
 #define DBG_LVL    DBG_INFO
 #include <rtdbg.h>
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #include <dfs_posix.h>
 #include <poll.h>
 #include <sys/ioctl.h>
@@ -203,7 +203,7 @@ const static struct dfs_file_ops _serial_fops =
     RT_NULL, /* getdents */
     serial_fops_poll,
 };
-#endif
+#endif /* RT_USING_POSIX_DEVIO */
 
 /*
  * Serial poll routines
@@ -976,8 +976,7 @@ static void _tc_flush(struct rt_serial_device *serial, int queue)
     }
 
 }
-
-#endif
+#endif /* RT_USING_POSIX_TERMIOS */
 
 static rt_err_t rt_serial_control(struct rt_device *dev,
                                   int              cmd,
@@ -1020,7 +1019,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
             }
 
             break;
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #ifdef RT_USING_POSIX_TERMIOS
         case TCGETA:
             {
@@ -1215,7 +1214,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
                 *(rt_size_t *)args = recved;
             }
             break;
-#endif /*RT_USING_POSIX*/
+#endif /* RT_USING_POSIX_DEVIO */
         default :
             /* control device */
             ret = serial->ops->control(serial, cmd, args);
@@ -1270,7 +1269,7 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
     /* register a character device */
     ret = rt_device_register(device, name, flag);
 
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_DEVIO
     /* set fops */
     device->fops        = &_serial_fops;
 #endif

+ 3 - 3
components/drivers/serial/serial_v2.c

@@ -16,7 +16,7 @@
 #define DBG_LVL    DBG_INFO
 #include <rtdbg.h>
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #include <dfs_posix.h>
 #include <poll.h>
 #include <sys/ioctl.h>
@@ -179,7 +179,7 @@ const static struct dfs_file_ops _serial_fops =
     RT_NULL, /* getdents */
     serial_fops_poll,
 };
-#endif
+#endif /* RT_USING_POSIX_DEVIO */
 
 static rt_size_t rt_serial_get_linear_buffer(struct rt_ringbuffer       *rb,
                                                     rt_uint8_t         **ptr)
@@ -1135,7 +1135,7 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial,
     /* register a character device */
     ret = rt_device_register(device, name, flag);
 
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_DEVIO
     /* set fops */
     device->fops        = &_serial_fops;
 #endif

+ 5 - 5
components/drivers/src/pipe.c

@@ -13,7 +13,7 @@
 #include <stdint.h>
 #include <sys/errno.h>
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #include <dfs_file.h>
 #include <dfs_posix.h>
 #include <poll.h>
@@ -320,7 +320,7 @@ static const struct dfs_file_ops pipe_fops =
     RT_NULL,
     pipe_fops_poll,
 };
-#endif /* end of RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */
 
 rt_err_t  rt_pipe_open(rt_device_t device, rt_uint16_t oflag)
 {
@@ -479,7 +479,7 @@ rt_pipe_t *rt_pipe_create(const char *name, int bufsz)
         rt_free(pipe);
         return RT_NULL;
     }
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
     dev->fops = (void*)&pipe_fops;
 #endif
 
@@ -529,7 +529,7 @@ int rt_pipe_delete(const char *name)
     return result;
 }
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 int pipe(int fildes[2])
 {
     rt_pipe_t *pipe;
@@ -575,4 +575,4 @@ int mkfifo(const char *path, mode_t mode)
 
     return 0;
 }
-#endif
+#endif /* RT_USING_POSIX_DEVIO */

+ 0 - 2
components/libc/compilers/common/sys/ioctl.h

@@ -11,9 +11,7 @@
 #define _SYS_IOCTL_H
 
 #include <rtconfig.h>
-#ifdef RT_USING_POSIX
 #include <dfs_posix.h>
-#endif
 
 #ifdef _WIN32
 #include <winsock.h>

+ 1 - 1
components/libc/posix/aio/SConscript

@@ -6,6 +6,6 @@ cwd     = GetCurrentDir()
 src     = Glob('*.c')
 CPPPATH = [cwd]
 
-group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX', 'RT_USING_POSIX_AIO'], CPPPATH = CPPPATH)
+group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_AIO'], CPPPATH = CPPPATH)
 
 Return('group')

+ 4 - 5
components/libc/posix/src/libc.c

@@ -23,7 +23,7 @@
 
 int libc_system_init(void)
 {
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
     rt_device_t dev_console;
 
     dev_console = rt_console_get_device();
@@ -31,7 +31,7 @@ int libc_system_init(void)
     {
         libc_stdio_set_console(dev_console->parent.name, O_RDWR);
     }
-#endif /* RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */
 
 #if defined RT_USING_PTHREADS && !defined RT_USING_COMPONENTS_INIT
     pthread_system_init();
@@ -41,8 +41,7 @@ int libc_system_init(void)
 }
 INIT_COMPONENT_EXPORT(libc_system_init);
 
-#ifdef RT_USING_POSIX
-
+#ifdef RT_USING_POSIX_DEVIO
 #if defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB)
 #define STDIO_DEVICE_NAME_MAX   32
 static FILE* std_console = NULL;
@@ -145,4 +144,4 @@ int libc_stdio_get_console(void) {
     return std_fd;
 }
 #endif /* defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB) */
-#endif /* RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */

+ 2 - 2
components/libc/posix/src/libc.h

@@ -17,10 +17,10 @@ extern "C" {
 #endif
 
 int libc_system_init(void);
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 int libc_stdio_get_console(void);
 int libc_stdio_set_console(const char* device_name, int mode);
-#endif /* RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */
 
 #ifdef __cplusplus
 }

+ 1 - 3
components/libc/posix/termios/SConscript

@@ -6,8 +6,6 @@ cwd = GetCurrentDir()
 src = Glob('*.c') + Glob('*.cpp')
 CPPPATH = [cwd]
 
-group = DefineGroup('POSIX', src, 
-    depend = ['RT_USING_LIBC', 'RT_USING_POSIX', 'RT_USING_POSIX_TERMIOS'], 
-    CPPPATH = CPPPATH)
+group = DefineGroup('POSIX', src, depend = ['RT_USING_LIBC', 'RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH)
 
 Return('group')

+ 3 - 3
components/utilities/rt-link/src/rtlink_dev.c

@@ -19,7 +19,7 @@
 
 #define RTLINK_SERV(dev)  (((struct rt_link_device*)dev)->service)
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #include <dfs_posix.h>
 #include <poll.h>
 
@@ -148,7 +148,7 @@ const static struct dfs_file_ops _rtlink_fops =
     RT_NULL, /* getdents */
     rtlink_fops_poll,
 };
-#endif /* RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */
 
 /* The event type for the service channel number,
  * which is used to wake up the service thread in blocking receive mode */
@@ -386,7 +386,7 @@ rt_err_t rt_link_dev_register(struct rt_link_device *rtlink,
     /* register a character device */
     ret = rt_device_register(device, name, flag);
 
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_DEVIO
     /* set fops */
     device->fops        = &_rtlink_fops;
 #endif

+ 0 - 12
examples/libc/termios_test.c

@@ -14,18 +14,6 @@
 #include <string.h>
 #include <sys/time.h>
 
-#if defined (RT_USING_POSIX)
-    #include <dfs_posix.h>
-    #include <sys/select.h>
-    #if defined (RT_USING_POSIX_TERMIOS)
-        #include <termios.h>
-    #else
-        #error "TERMIOS need RT_USING_POSIX_TERMIOS"
-    #endif
-#else
-    #error "POSIX poll/select need RT_USING_POSIX"
-#endif
-
 #define JOINT(x,y) x##y
 #define B(x) JOINT(B,x)
 #define Default_baud_rate   115200

+ 2 - 2
examples/rt-link/rtlink_dev_example.c

@@ -45,7 +45,7 @@ static rt_err_t rtlink_dev_tx_done(rt_device_t dev, void *buffer)
     return RT_EOK;
 }
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #include <dfs_posix.h>
 #include <poll.h>
 #include <sys/select.h>
@@ -205,7 +205,7 @@ static void rtlink_fselect()
     }
 }
 MSH_CMD_EXPORT(rtlink_fselect, rtlink posix interface example);
-#endif  /* RT_USING_POSIX */
+#endif  /* RT_USING_POSIX_DEVIO */
 
 static void rtlink_dread(void)
 {

+ 1 - 1
include/rtdef.h

@@ -1034,7 +1034,7 @@ struct rt_device
     rt_err_t  (*control)(rt_device_t dev, int cmd, void *args);
 #endif
 
-#if defined(RT_USING_POSIX)
+#ifdef RT_USING_POSIX_DEVIO
     const struct dfs_file_ops *fops;
     struct rt_wqueue wait_queue;
 #endif

+ 4 - 4
src/device.c

@@ -16,9 +16,9 @@
  */
 
 #include <rtthread.h>
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
 #include <rtdevice.h> /* for wqueue_init */
-#endif /* RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */
 
 #ifdef RT_USING_DEVICE
 
@@ -64,10 +64,10 @@ rt_err_t rt_device_register(rt_device_t dev,
     dev->ref_count = 0;
     dev->open_flag = 0;
 
-#ifdef RT_USING_POSIX
+#ifdef RT_USING_POSIX_DEVIO
     dev->fops = RT_NULL;
     rt_wqueue_init(&(dev->wait_queue));
-#endif /* RT_USING_POSIX */
+#endif /* RT_USING_POSIX_DEVIO */
 
     return RT_EOK;
 }