Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <linux/module.h>
- #include <linux/kernel.h>
- #include <linux/ioport.h> /* request_region, check_region, release_region */
- #include <linux/init.h> /* Needed for the macros */
- #define MAGICNUM 0x14000000
- #define DEVNAME "/dev/sgifazza"
- int port;
- static int __init hello_init(void) {
- int result;
- printk("<1>Crime driver TEST!\n");
- port = check_region(MAGICNUM, 1);
- if (port) {
- printk("<1>sgifazza: cannot reserve 0x14000000\n");
- result = port;
- return -1;
- }
- request_region(MAGICNUM, 1, DEVNAME);
- return 0;
- }
- static void __exit hello_exit(void) {
- /* Make port free! */
- if (!port) {
- release_region(MAGICNUM,1);
- }
- printk("<1> Bye, cruel world [Crime driver TEST]\n");
- }
- module_init(hello_init);
- module_exit(hello_exit);
- MODULE_AUTHOR("tua sorella");
- MODULE_DESCRIPTION("è un po'mignotta");
- MODULE_LICENSE("DTFYWL");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement