You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lkmpg.tex
+12-10Lines changed: 12 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1931,34 +1931,36 @@ \subsection{Bottom Half}
1931
1931
1932
1932
\subsection{Threaded IRQ}
1933
1933
1934
-
Threaded IRQ is a mechanism to handle both top-half and bottom-half of an IRQ at once.
1935
-
A threaded IRQ splits one handler into two: one for the top-half, the other for the bottom-half.
1936
-
Those two handlers are registered at once by \cpp|request_threaded_irq()|.
1934
+
Threaded IRQ is a mechanism to organize both top-half and bottom-half of an IRQ at once.
1935
+
A threaded IRQ splits the one handler in \cpp|request_irq()| into two: one for the top-half, the other for the bottom-half.
1936
+
The \cpp|request_threaded_irq()| is the function for using threaded IRQs.
1937
+
Two handlers are registered at once in the \cpp|request_threaded_irq()|.
1937
1938
1939
+
Those two handlers run in different context.
1938
1940
The top-half handler runs in interrupt context.
1939
1941
It's the equivalence of the handler passed to the \cpp|request_irq()|.
1940
1942
The bottom-half handler on the other hand runs in its own thread.
1941
-
This thread is created on registration of a threaded IRQ. Its sole purpose is to run this bottom-half handler.
1943
+
This thread is created on registration of a threaded IRQ.
1944
+
Its sole purpose is to run this bottom-half handler.
1942
1945
This is where a threaded IRQ is ``threaded''.
1943
-
1944
-
Whether the bottom-half handler will be invoked is determined by the return value of the top-half handler.
1945
-
If \cpp|IRQ_WAKE_THREAD| is returned, that bottom-half serving thread will wake up.
1946
+
If \cpp|IRQ_WAKE_THREAD| is returned by the top-half handler, that bottom-half serving thread will wake up.
1946
1947
The thread then runs the bottom-half handler.
1947
1948
1948
1949
Here is an example of how to do the same thing as before, with top and bottom halves, but using threads.
1949
1950
1950
1951
\samplec{examples/bh_threaded.c}
1951
1952
1952
-
\cpp|request_threaded_irq()| only takes one additional parameter than the \cpp|request_irq()| -- the bottom-half handling function that runs in its own thread.
1953
+
A threaded IRQ is registered using \cpp|request_threaded_irq()|.
1954
+
This function only takes one additional parameter than the \cpp|request_irq()| -- the bottom-half handling function that runs in its own thread.
1953
1955
In this example it is the \cpp|button_bottom_half()|.
1954
1956
Usage of other parameters are the same as \cpp|request_irq()|.
1955
1957
1956
1958
Presence of both handlers is not mandatory.
1957
1959
If either of them is not needed, pass the \cpp|NULL| instead.
1958
-
A \cpp|NULL| top-half handler implicitly means doing nothing but waking up the bottom-half serving thread; A \cpp|NULL| bottom-half handler will have the same effect as \cpp|request_irq()|.
1960
+
A \cpp|NULL| top-half handler implicitly means doing nothing but waking up the bottom-half serving thread (for running the bottom-half handler); A \cpp|NULL| bottom-half handler would have the same effect as if \cpp|request_irq()| were used.
1959
1961
In fact, this is how \cpp|request_irq()| is implemented.
1960
1962
1961
-
Note that passing \cpp|NULL| as both handlers is considered an error and will make registration fail.
1963
+
Note that passing \cpp|NULL| to both handlers is considered an error and will make registration fail.
0 commit comments