I've tried the variant with posix descriptor and got an error when trying to call close(fd). Program crashed with RTEMS_FATAL_SOURCE_EXCEPTION.
107 rv = IMFS_make_generic_node( 108 "/dev/gpio", 109 S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO, 110 &gpio_node_control, 111 NULL); 112 113 assert(rv == 0); 114 115 fd = open("/dev/gpio", O_RDWR); 116 117 if(fd < 0) 118 { 119 printf("stderr:[%s] at: [%d]\n", strerror (errno), __LINE__); 120 } 121 122 rv = ioctl(fd, SET_HIGH, NULL); 123 124 if(rv < 0) 125 { 126 printf("stderr:[%s] at: [%d]\n", strerror (errno), __LINE__); 127 } 128 */* Everything was ok until now*/* 129 rv = close(fd); 130 if(rv != 0) 131 { 132 printf("stderr:[%s] at: [%d]\n", strerror (errno), __LINE__); 133 } It even didn't enter inside the if block line:132. For test purpose I'm using such declaration of file handlers: static const rtems_filesystem_file_handlers_r gpio_node_handlers = { .open_h = rtems_filesystem_default_open, .close_h = rtems_filesystem_default_close, .read_h = NULL, .write_h = NULL, .ioctl_h = gpio_bus_ioctl, .lseek_h = rtems_filesystem_default_lseek, .fstat_h = IMFS_stat, .ftruncate_h = rtems_filesystem_default_ftruncate, .fsync_h = rtems_filesystem_default_fsync_or_fdatasync, .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync, .fcntl_h = rtems_filesystem_default_fcntl, .kqfilter_h = rtems_filesystem_default_kqfilter, .mmap_h = rtems_filesystem_default_mmap, .poll_h = rtems_filesystem_default_poll, .readv_h = rtems_filesystem_default_readv, .writev_h = rtems_filesystem_default_writev }; Could someone take a look and give some advice, seems like I made some silly mistake. On Fri, 9 Nov 2018 at 16:26, Ярослав Лещинский <midniwal...@gmail.com> wrote: > Hello Sebastian, > > Thank you. This looks like what I needed. > > On Fri, 9 Nov 2018 at 13:32, Sebastian Huber < > sebastian.hu...@embedded-brains.de> wrote: > >> Hello Yaroslav, >> >> the initialization sequence is documented here: >> >> >> https://docs.rtems.org/branches/master/c-user/initialization.html#initializing-rtems >> >> I would not use the I/O Manager. Working with major/minor numbers is >> quite painful. I would initialize custom devices in the initialization >> task. If you need the POSIX file descriptor API for your devices, then I >> would use IMFS_make_generic_node() to register them. >> >> On 09/11/2018 11:25, Ярослав Лещинский wrote: >> > Hello, >> > >> > I read the documentation about I/O Manager, found different source >> > codes where mentioning not only rtems_io_* functionality but also >> > drvmgr*, rtems_libio* and another mechanisms which are referred to >> > device driver topic and I have a feeling that I'm missing something. >> > >> > Could you please correct me if I'm wrong in the following steps of >> > initialization of device driver: >> > >> > 1. define *CONFIGURE_MAXIMUM_DRIVERS* macro >> > 1. Create *rtems_driver_address_table *and register it via >> > *register_io_register_driver* >> > 2. Write all necessary functions for *rtems_io_initialize, >> > rtems_io_open, etc* >> > 3. Associate name with major:minor pair using *rtems_register_name* >> > * >> > * >> > As I understood there are can be a lot of different device drivers >> > tables and I should somehow get the right major:minor driver from the >> > right table. How I can do this? >> > >> > -- >> > -- >> > Kind regards, >> > *Yaroslav Leshchinsky* >> > >> > _______________________________________________ >> > users mailing list >> > users@rtems.org >> > http://lists.rtems.org/mailman/listinfo/users >> >> -- >> Sebastian Huber, embedded brains GmbH >> >> Address : Dornierstr. 4, D-82178 Puchheim, Germany >> Phone : +49 89 189 47 41-16 >> Fax : +49 89 189 47 41-09 >> E-Mail : sebastian.hu...@embedded-brains.de >> PGP : Public key available on request. >> >> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. >> >> > > -- > -- > Kind regards, > *Yaroslav Leshchinsky* > -- -- Kind regards, *Yaroslav Leshchinsky*
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users