Ingen lysbildetittel - Department of Computer and Information Science

Ingen lysbildetittel - Department of Computer and Information Science Ingen lysbildetittel - Department of Computer and Information Science

21.01.2014 Views

20 Register file functions • Create a struct file_operations which has links to functions: static struct file_operations foobar_fops = { } .owner = THIS_MODULE, .open = foobar_open, .release = foobar_release, .read = foobar_read, // etc. • Call cdev_init with the structure as argument (to tell the kernel how to use those functions)

21 Use of hardware (I/O ports) • Need to request for access to hardware with request_region • Otherwise, use the I/O ports in the same way as in exercise 2 • release_region when done

20<br />

Register file functions<br />

• Create a struct file_operations which has links to<br />

functions:<br />

static struct file_operations foobar_fops = {<br />

}<br />

.owner = THIS_MODULE,<br />

.open = foobar_open,<br />

.release = foobar_release,<br />

.read = foobar_read, // etc.<br />

• Call cdev_init with the structure as argument (to tell<br />

the kernel how to use those functions)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!