Demonstrating a simple device driver with Hard IRQ ISR and Tasklet. Create a kernel module that will be our driver. Call it driver.c The ISR, whenever executed should schedule a tasklet to be run later on. The ISR should print ‘Your Name: Caught the IRQ. Urgent work Muhaha’ to dmesg The tasklet function should print ‘Your Name: Doing the hackey pending work Muhaha’ to dmesg The end result is that when this module is loaded, from then on pressing any key on your keyboard should print the two messages in dmesg. You should have two functions that are your ‘work’ – urgent and deferred static irqreturn_t irq_handler_isr(int, void *); void tasklet_fn(unsigned long); The irq_handler_isr function should print the required message and then create a tasklet_struct, init it and schedule it. In your module’s init function you should call request_irq() and register the irq_handler_isr function as the ISR for the keyboard’s interrupt number You can figure out the interrupt numbers that devices are using from the file /procs/interrupts In your module’s exit function, you should call free_irq() and deregister the irq_handler_isr function.

The task at hand involves creating a kernel module that serves as a device driver with two key components: a Hard IRQ ISR (Interrupt Service Routine) and a Tasklet. When the ISR is executed, it is expected to schedule the tasklet to be run at a later time. The driver will need to print specific messages to the dmesg log.

To begin, let’s create our kernel module and name it “driver.c”. Within this module, we will define two functions: “irq_handler_isr” and “tasklet_fn”. The first function serves as the ISR for the IRQ (Interrupt Request) and the second function represents the tasklet’s implementation.

The “irq_handler_isr” function will be responsible for printing the desired message to the dmesg log and then creating, initializing, and scheduling the tasklet. The message should be in the format: “Your Name: Caught the IRQ. Urgent work Muhaha”. The exact content of “Your Name” should be replaced with your own name.

Within the “driver.c” module’s init function, the “request_irq” function should be called to register the “irq_handler_isr” function as the ISR for the keyboard’s interrupt number. The interrupt number for the keyboard can be determined by examining the file “/proc/interrupts”.

On the other hand, the exit function of the “driver.c” module should call the “free_irq” function to deregister the “irq_handler_isr” function.

Now, let’s move on to the implementation of the tasklet. The “tasklet_fn” function should print the message “Your Name: Doing the hackey pending work Muhaha” to the dmesg log. Again, ensure to replace “Your Name” with your own name.

The end goal, when the module is loaded, is for both messages to be printed to the dmesg log when any key is pressed on the keyboard.

In summary, your “driver.c” module should include the following components:

1. The “irq_handler_isr” function, which prints the required message, initializes a tasklet_struct, and schedules the tasklet.
2. The “tasklet_fn” function, which prints the message about pending work to the dmesg log.
3. The module’s init function, which calls request_irq to register the keyboard’s interrupt number and the “irq_handler_isr” function.
4. The module’s exit function, which calls free_irq to deregister the “irq_handler_isr” function.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.

Click Here to Make an Order Click Here to Hire a Writer