Listing 5: Registering a driver for use by real-time and non real-time tasks
// Linux driver operations
static struct file_operations ln_pd_fops =
{
read: ln_pd_read,
write: ln_pd_write,
... other ýmagicý functions
};
// RTLinux driver operations
static struct rtl_file_operations rtl_pd_fops = {
NULL,
rtl_pd_read,
rtl_pd_write,
... other ýmagicý functions
};
// register Linux driver...
if (register_chrdev(PD_LN_MAJOR, ýpdaqý, &ln_pd_fops))
{ handle errors... }
// ...and RTLinux driver
if (rtl_register_chrdev(PD_RT_MAJOR, ýpdaqý, &rtl_pd_fops))
{ handle errors... }
Return to article