[FE training-materials-updates] kernel-serial-iomem: clarify offset multiplication and reg_write prototype

Alexandre Belloni alexandre.belloni at free-electrons.com
Thu Nov 7 21:23:04 CET 2013


Repository : git://git.free-electrons.com/training-materials.git

On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=14e30c756ddc7307dd7f0cc5d7baa75a4c99fcff

>---------------------------------------------------------------

commit 14e30c756ddc7307dd7f0cc5d7baa75a4c99fcff
Author: Alexandre Belloni <alexandre.belloni at free-electrons.com>
Date:   Thu Nov 7 15:20:34 2013 -0500

    kernel-serial-iomem: clarify offset multiplication and reg_write prototype
    
    Signed-off-by: Alexandre Belloni <alexandre.belloni at free-electrons.com>


>---------------------------------------------------------------

14e30c756ddc7307dd7f0cc5d7baa75a4c99fcff
 labs/kernel-serial-iomem/kernel-serial-iomem.tex |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/labs/kernel-serial-iomem/kernel-serial-iomem.tex b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
index b26ca17..59aa89e 100644
--- a/labs/kernel-serial-iomem/kernel-serial-iomem.tex
+++ b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
@@ -211,12 +211,19 @@ pointer to an \code{feserial_dev} structure and an \code{offset} integer
 offset.
 
 In this function, read from a 32 bits register at the base virtual
-address for the device plus the offset multiplied by 4, and return
-this value.
-
-Create a similar \code{reg_write()} routine, writing an unsigned
-integer value at a given integer offset from the device base virtual
-address.
+address for the device plus the offset multiplied by 4\footnote{You have
+to multiply by 4 because we are using a void* pointer so pointer
+arithmetic will use the offset as bytes whereas we are using 32 bits
+registers.}, and return this value.
+
+Create a similar \code{reg_write()} routine, writing an unsigned integer
+value at a given integer offset (don't forget to multiply it by 4) from
+the device base virtual address. The following code samples are using
+the \code{writel()} convention of passing the value first, then the
+offset. Your prototype should look like:
+\begin{verbatim}
+    static void reg_write(struct feserial_dev *dev, int val, int off);
+\end{verbatim}
 
 All the UART register offsets have standardized values, shared between
 several types of serial drivers (see



More information about the training-materials-updates mailing list