Mity Mite GPIO device driver v.1.0.1

Copyright 2003
Renzo Davoli 

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2, or (at your option)
        any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
        02111-1307, USA.


This device drivers manages the GPIO lines of the Mity Mite module.

INSTALL:

Copy the mity_gpio.c file to the drivers/char subdirectory of your
linux kernel tree.

Apply the patch Makefile.diff to the Makefile in the same directory.

cd to the root of the kernel subtree (/usr/src/linux)

Add in your .config file:
CONFIG_MITY_GPIO=y
or
CONFIG_MITY_GPIO=m
(statically linked with the kernel or dynamic module)

Alternatively you can install the patch for Configure.help and drivercharConfig.in
and you can use your favourite config method (xconfig or menuconfig)

compile and install your kernel in the mity mite.

Major device number is dynamic, you can read it boot time in the messages (or later
using dmesg).

For your convenience the the file mknod_mity can be used to create all the devices
(mknod_mity assumes that the major number is 255, you must edit it by hand if the
number is different).

There are 36 /dev entries:
- mitygpiomask07 sets the mask for the lines 0..7: 0 means input, 1 means output.
Thus writing the char 0xff to mitygpiomask07 all the lines are used for output,
0x00 all for input. Any combination can be used.
When the driver is initialized all the lines are set or input (safe choice).
- mitygpiomask8F works like mitygpiomask07 for lines 8..15.
- mitygpio07 reads or writes all the lines 0..7 in a single operation. 
when several chars are written only the last one is used.
line 0 is the lsb, 7 is the msb.
- mitygpio8F is the same for lines 8..15
- mitygpio0..mitygpioF reads or writes the value of one single line.
write: just the lsb is used. thus 0, '0', 'r', 'R' are valid values to switch the 
line off, 1, '1', 'S, 's' can be used to switch it on.
read: returns '0' if the input line is 0 Volts (connected to ground), '1' if the 
line is switched on (power supply positive voltage).
- mitygpiomask0..mitygpiomaskF sets the mask for each single line.
The value (1 for write, 0 for read) is taken from the lsb.
1, '1', 'S', 's', 'W', 'w' are valid values to set the line for writing
0, '0', 'R', 'r' set the line as in input line (for reading).


