Skip to content

Commit

Permalink
Merge pull request lkl#41 from crmares/master
Browse files Browse the repository at this point in the history
Documentation: teaching: labs: interrupts.rst typos and errors correction
  • Loading branch information
tavip authored Mar 25, 2018
2 parents aeb2936 + f0c1034 commit 9b6771c
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions Documentation/teaching/labs/interrupts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,20 @@ are different port access functions depending on their size. The
following port access functions are defined in asm/io.h:


* *unsigned inb(int port)*, read one byte (8 bits) from port
* *void outb(unsigned char byte, int port)*, write one byte (8 bits) to port
* *unsigned inw(int port)*, read two bytes (16-bit) ports
* *void outw(unsigned short word, int port)* writes two bytes (16-bits) to port
* *unsigned inb(int port)*, reads one byte (8 bits) from port
* *void outb(unsigned char byte, int port)*, writes one byte (8 bits) to port
* *unsigned inw(int port)*, reads two bytes (16-bit) ports
* *void outw(unsigned short word, int port)*, writes two bytes (16-bits) to port
* *unsigned inl (int port)*, reads four bytes (32-bits) from port
* *void outl(unsigned long word, int port)* write four bytes (32-bits) to port
* *void outl(unsigned long word, int port)*, writes four bytes (32-bits) to port

The port argument specifies the address of the port where the reads or
writes are done, and its type is platform dependent (may be unsigned
long or unsigned short).

Some devices may have problems when the processor is trying to
transfer data too fast to and from the device. To avoid this issue we
may need to insert a delay after an I/O operation and there functions
may need to insert a delay after an I/O operation and there are functions
you can use that introduce this delay. Their names are similar to
those described above, with the exception that it ends in _p: inb_p,
outb_p, etc.
Expand Down Expand Up @@ -367,7 +367,7 @@ following operations will be executed:
free_irq (MY_IRQ, my_data);
During the initialization functiom (c:func:`init_module`), or in the
During the initialization function (c:func:`init_module`), or in the
function that opens the device, interrupts must be activated for the
device. This operation is dependent on the device, but most often
involves setting a bit from the control register.
Expand Down Expand Up @@ -502,7 +502,7 @@ If we want to disable interrupts at the interrupt controller level
(not recommended because disabling a particular interrupt is slower,
we can not disable shared interrupts) we can do this with
:c:func:`disable_irq`, :c:func:`disable_irq_nosync`, and
:c:func:`enable_irq`. Using these functions disabled the interrupts on
:c:func:`enable_irq`. Using these functions will disable the interrupts on
all processors. Calls can be nested: if disable_irq is called twice,
it will require as many calls enable_irq to enable it. The difference
between disable_irq and disable_irq_nosync is that the first one will
Expand Down Expand Up @@ -574,7 +574,7 @@ as follows:
The *my_access function* above runs in process context. To
synchronize access to the share data, we disable the interrupts and
synchronize access to the shared data, we disable the interrupts and
use the spinlock *lock*, i.e. the :c:func:`spin_lock_irqsave` and
:c:func:`spin_unlock_irqrestore` functions.

Expand Down Expand Up @@ -824,8 +824,6 @@ and our driver.

.. note:: More details about the format of the */proc/interrupts* can
be found in the `Interrupt statistics`_ section.

Add a message in the interrupt handling routine to check if it is
called. Compile and reload the module into the kernel. Check that the
interrupt handling routine is called when you press the keyboard on
the virtual machine. Also note that when you use the serial port no
Expand All @@ -846,7 +844,7 @@ following in the interrupt handling:
* copy the ASCII characters corresponding to the keystrokes and store
them in the buffer of the device

Follow the sectios marked **TODO 3** in the skeleton.
Follow the sections marked **TODO 3** in the skeleton.

Reading the data register
.........................
Expand All @@ -863,7 +861,7 @@ Then print information about the keystrokes int the following format:

.. code-block:: c
pr_info("IRQ:% d, scancode = 0x% x (% u,% c) \ n"
pr_info("IRQ:% d, scancode = 0x%x (%u,%c)\n",
irq_no, scancode, scancode, scancode);
Expand Down Expand Up @@ -976,14 +974,14 @@ character.
the value returned by the get_ascii() function.


Store characters to the buffer
..............................
4. Store characters to the buffer
---------------------------------

We want to collect the pressed characters (not the other keys) into
circular a buffer that can be consumed from user space. For this step
follow the sections marked with **TODO 4** in the skeleton.

Implement :c:func:`get_char` in a similar with :c:func:`put_char`.
Implement :c:func:`get_char` in a similar way to :c:func:`put_char`.

Update the interrupt handler to add a pressed ASCII character to the
end of the device buffer. If the buffer is full, the character will be
Expand Down Expand Up @@ -1024,8 +1022,8 @@ minor are defined as ``KBD_MAJOR`` and ``KBD_MINOR``:
cat /dev/kbd
Reset the buffer
................
5. Reset the buffer
-------------------

Reset the buffer if the device is written to. For this step follow the
sections marked with **TODO 5** in the skeleton.
Expand Down

0 comments on commit 9b6771c

Please sign in to comment.