On Using Tasklets': An Example of The Linux Kernel's Tasklet' Mechanism For Deferring Some Interrupt-Handling Work
On Using Tasklets': An Example of The Linux Kernel's Tasklet' Mechanism For Deferring Some Interrupt-Handling Work
On Using Tasklets': An Example of The Linux Kernel's Tasklet' Mechanism For Deferring Some Interrupt-Handling Work
7 6 5 4 3 2 1 0
LOOP
0 0 0 OUT2 OUT1 RTS DTR
BACK
Legend:
DTR = Data Terminal Ready (1=yes, 0=no)
RTS = Request To Send (1=yes, 0=no)
OUT1 = not used (except in loopback mode)
OUT2 = enables the UART to issue interrupts
LOOPBACK-mode (1=enabled, 0=disabled)
Modem Status Register
The sender checks this bit
7 6 5 4 3 2 1 0
CTS==1?
NO
YES
THRE==1?
NO
YES
DONE
The receiver’s actions
• When the receiver’s storage capacity has
been reached, it takes urgent action to
‘pause’ any further transfers of data (i.e., it
writes ‘0’ to the RTS-bit in its Modem
Control register)
• Then it needs to remove its accumulation
of received data out of its storage medium
• Being less urgent this can be postponed
Interrupt handling
• Often it’s beneficial to separate the actions
a driver performs in responding to a device
interrupt-request into two categories: the
urgent ones are performed immediately,
the less urgent ones temporarily delayed
• Accordingly programmers write separate
functions, known as the “top half” and the
“bottom half” for an interrupt handler
Application to the UART
• Top Half:
– Tell sender to ‘pause’ further data-transfers
• Bottom-Half:
– Move accumulated data out of the device’s
on-board storage-area (e.g., its receive FIFO)
A tasklet for ‘bottom half’ work
• Your device-driver allocates and initializes
a ‘struct tasklet_struct’ object, possessing a
name, a function and a pointer to data
name
function
‘virtual’ memory
More tasklet semantics…
$ cat /dev/uart
$ ls -l /usr/bin > /dev/uart