> Not claiming that I fully understood your problem yet - code talks: >From your recommendation think you got the jist of it.
here's the problematic parts: /********************** * gpio class structure */ typedef struct gpio_s{ const char *name; int subclass; void *ddr; void *data; gpio_data shadow; gpio_data (*data_read)(struct gpio_s *gpio); int (*data_write)(struct gpio_s *gpio,gpio_data data); gpio_data (*ddr_read)(struct gpio_s *gpio); int (*ddr_write)(struct gpio_s *gpio,gpio_data data); #ifdef CONFIG_GPIOCLASS_RTDM struct rtdm_device rtd; #endif }gpio_t /*************************************************************************** * class instantiation */ struct class_device *gpio_register_class_device(gpio_t *gpio){ struct class *gpio_master = gpio_declare(); struct class_device *dev = class_device_create(gpio_master, NULL, MKDEV(0, 0), NULL, gpio->name); dev->class_data = gpio; #ifdef CONFIG_GPIOCLASS_SYSFS if((gpio->ddr_write)&&(gpio->ddr_read))class_device_create_file(dev,&class_device_attr_ddr); if((gpio->data_write)&&(gpio->data_read))class_device_create_file(dev,&class_device_attr_data); #endif #ifdef CONFIG_GPIOCLASS_RTDM rt_gpio_device_create(gpio->rtd); #endif return dev; } struct class_device *rt_gpio_device_create(rtdm_device *dev){ gpio_t *gpio = container_of(dev,gpio_t,rtd); memcpy(dev, &device_tmpl, sizeof(struct rtdm_device)); strncpy(dev->device_name, gpio->name, RTDM_MAX_DEVNAME_LEN); dev->device_sub_class = gpio->subclass; dev->peripheral_name = name;//used to back up and find the original structure. } > What about putting the rtdm_device and your standard device structure > into a "meta" structure. The type of the latter then only has be known > to those parts that access data "across" the two structure. Good idea!, So were on the same page, you mean like :? struct rtdm_ meta{ gpio_t *gpio; struct rtdm_device rtd; } static int rt_gpio_ioctl(struct rtdm_dev_context *context, rtdm_user_info_t *user_info, int request, void *umem){ struct rtsm_meta *meta = container_of(context->dev,rtdm_meta,rtd); gpio_t *gpio = meta->gpio; That sounds good, then the user space layer wouldn't have to be aware of the Xenomai side at all, with the exception of the atomic locks, which could be localized to a single module and defined away as a macro. clever, thx Jan, NZG _______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core