]> git.neil.brown.name Git - history.git/commitdiff
Import 2.3.31pre1 2.3.31pre1
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:29:04 +0000 (15:29 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:29:04 +0000 (15:29 -0500)
140 files changed:
Documentation/Configure.help
Documentation/joystick-api.txt
Documentation/joystick-parport.txt
Documentation/joystick.txt
Makefile
arch/arm/kernel/sys_arm.c
arch/i386/kernel/entry.S
arch/i386/kernel/smp.c
arch/i386/kernel/sys_i386.c
arch/i386/kernel/time.c
arch/m68k/kernel/sys_m68k.c
drivers/char/Config.in
drivers/char/Makefile
drivers/char/drm/Makefile
drivers/char/drm/README.drm
drivers/char/drm/auth.c
drivers/char/drm/bufs.c
drivers/char/drm/context.c
drivers/char/drm/dma.c
drivers/char/drm/drawable.c
drivers/char/drm/drm.h
drivers/char/drm/drmP.h
drivers/char/drm/fops.c
drivers/char/drm/gamma_dma.c
drivers/char/drm/gamma_drv.c
drivers/char/drm/gamma_drv.h
drivers/char/drm/init.c
drivers/char/drm/ioctl.c
drivers/char/drm/lists.c
drivers/char/drm/lock.c
drivers/char/drm/memory.c
drivers/char/drm/proc.c
drivers/char/drm/sigio.c [deleted file]
drivers/char/drm/tdfx_context.c [new file with mode: 0644]
drivers/char/drm/tdfx_drv.c [new file with mode: 0644]
drivers/char/drm/tdfx_drv.h [new file with mode: 0644]
drivers/char/drm/vm.c
drivers/char/joystick/Config.in
drivers/char/joystick/Makefile
drivers/char/joystick/joy-amiga.c
drivers/char/joystick/joy-analog.c
drivers/char/joystick/joy-analog.h
drivers/char/joystick/joy-assasin.c [deleted file]
drivers/char/joystick/joy-assassin.c [new file with mode: 0644]
drivers/char/joystick/joy-console.c
drivers/char/joystick/joy-creative.c [new file with mode: 0644]
drivers/char/joystick/joy-db9.c
drivers/char/joystick/joy-gravis.c
drivers/char/joystick/joy-lightning.c
drivers/char/joystick/joy-logitech.c
drivers/char/joystick/joy-magellan.c [new file with mode: 0644]
drivers/char/joystick/joy-pci.c [new file with mode: 0644]
drivers/char/joystick/joy-sidewinder.c
drivers/char/joystick/joy-spaceball.c [new file with mode: 0644]
drivers/char/joystick/joy-spaceorb.c [new file with mode: 0644]
drivers/char/joystick/joy-thrustmaster.c
drivers/char/joystick/joy-turbografx.c
drivers/char/joystick/joy-warrior.c [new file with mode: 0644]
drivers/char/joystick/joystick.c
drivers/net/Config.in
drivers/net/Makefile
drivers/net/aironet4500.h [new file with mode: 0644]
drivers/net/aironet4500_card.c [new file with mode: 0644]
drivers/net/aironet4500_core.c [new file with mode: 0644]
drivers/net/aironet4500_proc.c [new file with mode: 0644]
drivers/net/aironet4500_rid.c [new file with mode: 0644]
drivers/net/pcmcia/Config.in
drivers/net/pcmcia/Makefile
drivers/net/pcmcia/aironet4500_cs.c [new file with mode: 0644]
drivers/net/setup.c
drivers/sound/sonicvibes.c
drivers/usb/usb_scsi.c
fs/Config.in
fs/dcache.c
fs/ext2/inode.c
fs/ncpfs/Config.in
fs/ncpfs/dir.c
fs/ncpfs/inode.c
fs/ncpfs/ioctl.c
fs/ncpfs/ncplib_kernel.c
fs/ncpfs/ncplib_kernel.h
fs/ncpfs/symlink.c
fs/nfs/inode.c
fs/nfsd/nfsproc.c
fs/nfsd/nfssvc.c
fs/nfsd/nfsxdr.c
fs/nfsd/vfs.c
fs/nls/nls_base.c
fs/nls/nls_cp437.c
fs/nls/nls_cp737.c
fs/nls/nls_cp775.c
fs/nls/nls_cp850.c
fs/nls/nls_cp852.c
fs/nls/nls_cp855.c
fs/nls/nls_cp857.c
fs/nls/nls_cp860.c
fs/nls/nls_cp861.c
fs/nls/nls_cp862.c
fs/nls/nls_cp863.c
fs/nls/nls_cp864.c
fs/nls/nls_cp865.c
fs/nls/nls_cp866.c
fs/nls/nls_cp869.c
fs/nls/nls_cp874.c
fs/nls/nls_iso8859-1.c
fs/nls/nls_iso8859-14.c
fs/nls/nls_iso8859-15.c
fs/nls/nls_iso8859-2.c
fs/nls/nls_iso8859-3.c
fs/nls/nls_iso8859-4.c
fs/nls/nls_iso8859-5.c
fs/nls/nls_iso8859-6.c
fs/nls/nls_iso8859-7.c
fs/nls/nls_iso8859-8.c
fs/nls/nls_iso8859-9.c
fs/nls/nls_koi8-r.c
include/asm-alpha/system.h
include/asm-i386/system.h
include/asm-i386/unistd.h
include/linux/802_11.h [new file with mode: 0644]
include/linux/joystick.h
include/linux/mman.h
include/linux/ncp_fs.h
include/linux/ncp_fs_sb.h
include/linux/nfs.h
include/linux/nfs3.h
include/linux/nfsd/const.h
include/linux/nfsd/export.h
include/linux/nfsd/nfsd.h
include/linux/nfsd/nfsfh.h
include/linux/nfsd/syscall.h
include/linux/nls.h
kernel/acct.c
mm/memory.c
mm/mremap.c
mm/numa.c
net/sunrpc/clnt.c
net/sunrpc/stats.c
net/sunrpc/sunrpc_syms.c
net/sunrpc/svc.c

index 52aa2370d4f7a6023d2d19a3436e80108454b165..1d098d27bc7d4cbdf10c5b78859fdb33c65d1b3a 100644 (file)
@@ -5513,6 +5513,83 @@ CONFIG_ARLAN
   On some computers the card ends up in non-valid state after some time.
   Use a ping-reset script to clear it.
 
+Aironet 4500/4800 series adapters
+CONFIG_AIRONET4500
+  www.aironet.com (recently bought by Cisco) makes these 802.11 DS
+  adapters.  Driver by Elmer Joandi (elmer@ylenurme.ee).
+  Work sponsored by www.spectrumwireless.net and www.vendomar.ee
+  This configuration option enables common code for all devices (PCI, ISA,
+  PCMCIA)
+  module is aironet4500_core
+  quickconfig parameters: 
+       SSID=tsunami - "The Password"
+       adhoc=1         there are no Access Points around
+       master=1        Adhoc master (the one who creates network sync)
+       slave=1         Adhoc slave(btw, it is still forming own net 
+                       sometimes)
+       channel=1..?    meaningful in adhoc mode
+  all other parameters can be set via proc interface
+  These parameters belong to .._card module, but alas, they are here
+
+Aironet 4500/4800 ISA/PCI/PNP/365 support
+CONFIG_AIRONET4500_NONCS
+  This is module aironet4500_card, which includes _possibility_ to
+  support for following
+  PCI device
+  ISA device in ISA mode(does not work currently)
+  ISA device in PNP mode
+  PCMCIA device _without_ cardservices, direct 365 chip INIT, 
+       does not work currently
+  PCMCIA _with_ CardServices(normal way) is at another module 
+  radio parameters are currently configurable at ..._core module
+
+Aironet 4500/4800 PNP support
+CONFIG_AIRONET4500_PNP
+       This option should be enabled for ISA cards, remember to enable
+       PNP jumper on board. 
+       module aironet4500_card
+
+Aironet 4500/4800 PCI support
+CONFIG_AIRONET4500_PCI
+       This option should be enabled for PCI cards
+       module aironet4500_card
+
+Aironet 4500/4800 ISA broken support
+CONFIG_AIRONET4500_ISA
+       This option enables support for ISA cards in non-PNP mode. 
+       Does not operate correctly by now.
+       module aironet4500_card
+
+Aironet 4500/4800 I365 broken support
+CONFIG_AIRONET4500_I365
+       This option enables support for PCMCIA cards on i365 controller 
+       _without_ cardservices. Doesnt have much sense and is not working
+       properly. Comes from times where there was no PCMCIA support in
+       kernel main source tree
+
+Aironet 4500/4800 PCMCIA support
+CONFIG_AIRONET4500_CS
+       This option enables support for PCMCIA cards to be used with
+       CardServices. 
+       This is not for ISA and PCI adapters.
+       module aironet4500_cs.o
+       The same option is both on:
+               1. PCMCIA netdevices configuring panel
+               2. Wireless netdevices configuring panel
+       Possibility to change this option depeds on options set in 2.
+       
+Aironet 4500/4800 PROC interface
+CONFIG_AIRONET4500_PROC
+       This option enables /proc/sys/aironet4500 interface for 
+       configuring the device.
+       NOTE: it takes lot of memory. Compile it as module and remove
+       after configuration
+       module: aironet4500_proc
+
+
+
+
 LAPB over Ethernet driver
 CONFIG_LAPBETHER
   This is a driver for a pseudo device (typically called /dev/lapb0)
@@ -9960,6 +10037,10 @@ CONFIG_DRM
   synchronization, security, and DMA transfers. Select the module that
   provides support for your graphics card.
 
+tdfx Direct Rendering Manager (XFree86 DRI support)
+CONFIG_DRM_TDFX
+  Choose M here if you have a 3dfx Banshee/Voodoo3 graphics card.
+
 3dlabs GMX 2000 Direct Rendering Driver (XFree86 DRI support)
 CONFIG_DRM_GAMMA
   Choose M here if you have a 3dlabs GMX 2000 graphics card.
@@ -10352,83 +10433,117 @@ CONFIG_NVRAM
 
 Joystick support
 CONFIG_JOYSTICK
-  If you have a joystick, you can say Y here to enable generic
-  joystick support. You will also need to say Y or M to at least one
-  of the hardware specific joystick drivers. This will make the
-  joysticks available as /dev/jsX devices. Please read the file
-  Documentation/joystick.txt which contains more information and the
-  location of the joystick package that you'll need.
-
-  This driver is also available as a module ( = code which can be
-  inserted in and removed from the running kernel whenever you want).
-  The module will be called joystick.o. If you want to compile it as a
-  module, say M here and read Documentation/modules.txt.
-
-Classic PC analog joysticks and gamepads
+  If you have a joystick, 6dof controller, gamepad, steering wheel,
+  weapon control system or something like that you can say Y here to
+  enable generic support for these controllers. You will also need to
+  say Y or M to at least one of the hardware specific drivers. This
+  will make the controllers available as /dev/jsX devices. Please read
+  the file Documentation/joystick.txt which contains more information
+  and the location of the joystick package that you'll need.
+
+Classic PC analog
 CONFIG_JOY_ANALOG
-  Say Y here if you have an analog joystick or gamepad that connects
-  to the PC gameport. This supports many different types, including
-  joysticks with throttle control, with rudders, or with extensions
-  like additional hats and buttons compatible with CH Flightstick Pro,
+  Say Y here if you have a controller that connects to the PC
+  gameport. This supports many different types, including joysticks
+  with throttle control, with rudders, or with extensions like
+  additional hats and buttons compatible with CH Flightstick Pro,
   ThrustMaster FCS or 6 and 8 button gamepads. For more information on
   how to use the driver please read Documentation/joystick.txt
 
-FPGaming and MadCatz A3D controllers
-CONFIG_JOY_ASSASIN
-  Say Y here if you have an FPGaming Assasin 3D, MadCatz Panther or
-  MadCatz Panther XL. For more information on how to use the driver
-  please read Documentation/joystick.txt
+FPGaming and MadCatz A3D
+CONFIG_JOY_ASSASSIN
+  Say Y here if you have an FPGaming or MadCatz controller using the
+  A3D protocol over the PC gameport. For more information on how to
+  use the driver please read Documentation/joystick.txt
 
-Gravis GrIP joysticks and gamepads
+Gravis GrIP
 CONFIG_JOY_GRAVIS
-  Say Y here if you have a Gravis GamePad Pro, Gravis Xterminator or
-  Gravis Blackhawk Digital. For more information on how to use the
-  driver please read Documentation/joystick.txt
+  Say Y here if you have a Gravis controller using the GrIP protocol
+  over the PC gameport. For more information on how to use the driver
+  please read Documentation/joystick.txt
+
+Logitech ADI
+CONFIG_JOY_LOGITECH
+  Say Y here if you have a Logitech controller using the ADI
+  protocol over the PC gameport. For more information on how to use
+  the driver please read Documentation/joystick.txt
+
+Microsoft SideWinder
+CONFIG_JOY_SIDEWINDER
+  Say Y here if you have a Microsoft controller using the Digital
+  Overdrive protocol over PC gameport. For more information on how to
+  use the driver please read Documentation/joystick.txt
 
-PDPI Lightning 4 gamecards
+ThrustMaster DirectConnect
+CONFIG_JOY_THRUSTMASTER
+  Say Y here if you have a ThrustMaster controller using the
+  DirectConnect (BSP) protocol over the PC gameport. For more
+  information on how to use the driver please read
+  Documentation/joystick.txt
+
+Creative Labs Blaster
+CONFIG_JOY_CREATIVE
+  Say Y here if you have a Creative Labs controller using the
+  Blaster protocol over the PC gameport. For more information on how
+  to use the driver please read Documentation/joystick.txt
+
+PDPI Lightning 4 card
 CONFIG_JOY_LIGHTNING
   Say Y here if you have a PDPI Lightning 4 gamecard and an analog
   joystick or gamepad connected to it. For more information on how to
   use the driver please read Documentation/joystick.txt
 
-Logitech Digital joysticks and gamepads
-CONFIG_JOY_LOGITECH
-  Say Y here if you have a Logitech WingMan Extreme Digital,
-  Logitech ThunderPad Digital or Logitech CyberMan 2. For more
+Trident 4DWave and Aureal Vortex gameport
+CONFIG_JOY_PCI
+  Say Y here if you have a Trident 4DWave DX/NX or Aureal Vortex 1/2
+  card and want to use its gameport in its enhanced digital mode
+  with and ordinary analog joystick. For more information on how to
+  use the driver please read Documentation/joystick.txt
+
+Magellan and Space Mouse
+CONFIG_JOY_MAGELLAN
+  Say Y here if you have a Magellan or Space Mouse 6DOF controller
+  connected to your computer's serial port.  For more information on
+  how to use the driver please read Documentation/joystick.txt
+
+SpaceTec SpaceOrb 360 and SpaceBall Avenger
+CONFIG_JOY_SPACEORB
+  Say Y here if you have a SpaceOrb 360 or SpaceBall Avenger 6DOF
+  controller connected to your computer's serial port.  For more
   information on how to use the driver please read
   Documentation/joystick.txt
 
-Microsoft SideWinder, Genius Digital joysticks and gamepads
-CONFIG_JOY_SIDEWINDER
-  Say Y here if you have a Microsoft SideWinder 3d Pro, Microsoft
-  SideWinder Precision Pro, Microsoft SideWinder Force Feedback Pro,
-  Microsoft Sidewinder GamePad or Genius Flight2000 F-23 Digital. For
-  more information on how to use the driver please read
+SpaceTec SpaceBall 4000 FLX
+CONFIG_JOY_SPACEBALL
+  Say Y here if you have a SpaceTec SpaceBall 4000 FLX
+  controller connected to your computer's serial port.  For more
+  information on how to use the driver please read
   Documentation/joystick.txt
 
-ThrustMaster DirectConnect joysticks and gamepads
-CONFIG_JOY_THRUSTMASTER
-  Say Y here if you have a ThrustMaster Millenium 3D Inceptor or a
-  ThrustMaster 3D Rage Pad. For more information on how to use the
-  driver please read Documentation/joystick.txt
+Logitech WingMan Warrior
+CONFIG_JOY_WARRIOR
+  Say Y here if you have a Logitech WingMan Warrior controller
+  connected to your computer's serial port.  For more information on
+  how to use the driver please read Documentation/joystick.txt
 
-NES, SNES, PSX, Multisystem joysticks and gamepads
+NES, SNES, N64, PSX, Multi
 CONFIG_JOY_CONSOLE
   Say Y here if you have a Nintendo Entertainment System gamepad,
-  Super Nintendo Entertainment System gamepad, Sony PlayStation
-  gamepad or a Multisystem -- Atari, Amiga, Commodore, Amstrad CPC
-  joystick. For more information on how to use the driver please read
+  Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad,
+  Sony PlayStation gamepad or a Multisystem -- Atari, Amiga,
+  Commodore, Amstrad CPC joystick connected to your parallel port.
+  For more information on how to use the driver please read
   Documentation/joystick.txt and Documentation/joystick-parport.txt
 
-Sega, Multisystem joysticks and gamepads
+Sega, Multi
 CONFIG_JOY_DB9
   Say Y here if you have a Sega Master System gamepad, Sega Genesis
   gamepad, Sega Saturn gamepad, or a Multisystem -- Atari, Amiga,
-  Commodore, Amstrad CPC joystick. For more information on how to use
-  the driver please read Documentation/joystick.txt and
-  Documentation/joystick-parport.txt
+  Commodore, Amstrad CPC joystick connected to your parallel port. For
+  more information on how to use the driver please read
+  Documentation/joystick.txt and Documentation/joystick-parport.txt
 
-TurboGraFX Multisystem joystick interface
+TurboGraFX interface
 CONFIG_JOY_TURBOGRAFX
   Say Y here if you have the TurboGraFX interface by Steffen Schwenke,
   and want to use it with Multiststem -- Atari, Amiga, Commodore,
index fe3b6842c6fdce370f17c4a1fc11c3724e9ebd11..622c67d170ca510b22a76a2069bd523eb1fb355b 100644 (file)
@@ -74,10 +74,9 @@ is, you have both an axis 0 and a button 0). Generally,
        2nd Axis Y      3
        ...and so on
 
-Hats vary from one joystick type to another.  Some can be moved in 8
-directions, some only in 4.  The driver, however, always reports a hat
-as two independent axis, even if the hardware doesn't allow independent
-movement. 
+Hats vary from one joystick type to another. Some can be moved in 8
+directions, some only in 4, The driver, however, always reports a hat as two
+independent axis, even if the hardware doesn't allow independent movement.
 
 
 2.3 js_event.value
@@ -300,7 +299,7 @@ fixed range for reporting the values, 1 being the minimum, 128 the
 center, and 255 maximum value.
 
 The v0.8.0.2 driver also had an interface for 'digital joysticks', (now
-called Multisystem joystick in this driver), under /dev/djsX. This driver
+called Multisystem joysticks in this driver), under /dev/djsX. This driver
 doesn't try to be compatible with that interface.
 
 
index 880150b9ecd034e3aed5417fc21ad0df5d5e4fc1..2217a0489bf28e6f6e9d0d2020d2bc63ff91550e 100644 (file)
@@ -1,6 +1,7 @@
                  Linux Joystick parport drivers v1.2 BETA
-                 (c) 1998 Vojtech Pavlik <vojtech@suse.cz>
+              (c) 1998-1999 Vojtech Pavlik <vojtech@suse.cz>
               (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de>
+                            Sponsored by SuSE
 ----------------------------------------------------------------------------
 
 0. Disclaimer
@@ -44,7 +45,8 @@ you'll use for NES and SNES gamepads.
   The main problem with PC parallel ports is that they don't have +5V power
 source on any of their pins. So, if you want a reliable source of power
 for your pads, use either keyboard or joystick port, and make a pass-through
-cable.
+cable. You can also pull the power directly from the power supply (the red
+wire is +5V).
 
   If you want to use the parallel port only, you can take the power is from
 some data pin. For most gamepad and parport implementations only one pin is
@@ -298,27 +300,29 @@ work for most people. If you like adventure, you can try yourself.
 
   The PSX controller is supported by the joy-console.c.
 
-Pinout of the PSX controller:
+Pinout of the PSX controller (compatible with DirectPadPro):
 
   +---------+---------+---------+
 9 | o  o  o | o  o  o | o  o  o | 1               parallel
    \________|_________|________/                  port pins
     |  |      |  |  |   |
-    |  |      |  |  |   +-------->  Clock    ---  (1)
-    |  |      |  |  +------------>  Select   ---  (17)
-    |  |      |  +--------------->  Power    ---  (16)
+    |  |      |  |  |   +-------->  Clock    ---  (4)
+    |  |      |  |  +------------>  Select   ---  (3)
+    |  |      |  +--------------->  Power    ---  (5-9)
     |  |      +------------------>  Ground   ---  (18-25)
-    |  +------------------------->  Command  ---  (14)
+    |  +------------------------->  Command  ---  (2)
     +---------------------------->  Data     ---  (10,11,12,13,15) one only...
 
   You may have to add pull up/down resistors. Maybe your pad also won't like
 the 5V (PSX uses 3.7V).
 
-  Currently the driver supports only ONE psx pad and only one type of
-controller: The normal PSX controller. NEGCON support is planned for the
-next release. ANALOG controller may be too (I do not recommend to connect
-the "force feedback"/"rumble pack" version... it (may) use too much
-power...)
+  Currently the driver supports only one psx pad per parallel port, and these
+controllers:
+
+ * Standard PSX Pad
+ * NegCon PSX Pad
+ * Analog PSX Pad (red mode)
+ * Analog PSX Pad (green mode)
 
 2.4 Sega
 ~~~~~~~~
@@ -437,13 +441,15 @@ Linux kernels, the number of the parport interface (eg. 0 for parport0).
          4  | Multisystem 1-button joystick
          5  | Multisystem 2-button joystick
          6  | Sony PSX controller
+         7  | N64 pad
+         8  | N64 pad with direction pad as buttons (DirectPadPro style)
 
   The exact type of the PSX controller type is autoprobed, so you must have
 your controller plugged in before initializing.
 
   Should you want to use more than one of parallel ports at once, you can
-use js_console_2 and js_db9_3 as additional command line parameters for two
-more parallel ports.
+use js_console_2 and js_console_3 as additional command line parameters for
+two more parallel ports.
 
   Changes:
     v0.1  : First version (SNES only)
@@ -463,6 +469,9 @@ more parallel ports.
     v0.10 : Fixed PSX buttons 8 and 9
     v0.11V: Switched to EXCL mode
            Removed wakeup
+    v0.12V: Added N64 support
+    v0.13V: Updated N64 support
+    v0.14V: Fixed N64 axis/button counts
 
 3.2 joy-db9.c
 ~~~~~~~~~~~~~
@@ -475,6 +484,10 @@ joy-db9.c driver. It uses the following kernel/module command line:
 is connected to (eg. 0x378), or, if you are using the parport driver of 2.1+
 Linux kernels, the number of the parport interface (eg. 0 for parport0).
 
+  Caveat here: This driver only works on bidirectional parallel ports. If
+your parallel port is recent enough, you should have no trouble with this.
+Old parallel ports may not have this feature.
+
   'Type' is the type of joystick or pad attached:
 
        Type | Joystick/Pad
@@ -484,9 +497,10 @@ Linux kernels, the number of the parport interface (eg. 0 for parport0).
          2  | Multisystem 2-button joystick
          3  | Genesis pad (3+1 buttons)
          5  | Genesis pad (5+1 buttons)
-         6  | Genesis pad (6+1 buttons)
-         7  | Saturn pad
+         6  | Genesis pad (6+2 buttons)
+         7  | Saturn pad (8 buttons)
          8  | Multisystem 1-button joystick (v0.8.0.2 pin-out)
+         9  | Two Multiststem 1-button joysticks (v0.8.0.2 pin-out) 
 
   Should you want to use more than one of these joysticks/pads at once, you
 can use js_db9_2 and js_db9_3 as additional command line parameters for two
@@ -501,6 +515,8 @@ more joysticks/pads.
     v0.4V: Switched to EXCL mode
            Removed wakeup
     v0.5V: Added 0.8.0.2 HW compatibility for Multi sticks
+    v0.6V: Better timing for Genesis 6
+    v0.7V: Added 0.8.0.2 second joystick support
 
 3.3 joy-turbografx.c
 ~~~~~~~~~~~~~~~~~~~~
@@ -519,6 +535,27 @@ interface ports 1-7 have. For a standard multisystem joystick, this is 1.
 use js_tg_2 and js_tg_3 as additional command line parameters for two more
 interfaces.
 
-3.4 End
+3.4 PC parallel port pinout
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+                 .----------------------------------------.
+   At the PC:     \ 13 12 11 10  9  8  7  6  5  4  3  2  1 /
+                   \  25 24 23 22 21 20 19 18 17 16 15 14 /
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+         Pin | Name    | Description
+       ~~~~~~|~~~~~~~~~|~~~~~~~~~~
+           1 | /STROBE | Strobe
+         2-9 | D0-D7   | Data Bit 0-7
+          10 | /ACK    | Acknowledge
+          11 | BUSY    | Busy
+          12 | PE      | Paper End
+          13 | SELIN   | Select In
+          14 | /AUTOFD | Autofeed
+          15 | /ERROR  | Error
+          16 | /INIT   | Initialize
+          17 | /SEL    | Select
+       18-25 | GND     | Signal Ground
+
+3.5 End
 ~~~~~~~
   That's all, folks! Have fun!
index ab8a454a2ee60b02db3f231af21118f9830c866e..163fece8c930d87450c98a4cdf9b0b190fad6951 100644 (file)
@@ -1,5 +1,6 @@
-                    Linux Joystick driver v1.2.13
-              (c) 1996-1998 Vojtech Pavlik <vojtech@suse.cz>
+                      Linux Joystick driver v1.2.15
+              (c) 1996-1999 Vojtech Pavlik <vojtech@suse.cz>
+                            Sponsored by SuSE
 ----------------------------------------------------------------------------
 
 0. Disclaimer
@@ -38,18 +39,18 @@ gamepads.
 
   In addition to these it also supports some of the new PC joysticks that
 use proprietary digital protocols to communicate over the gameport,
-currently by FPGaming, Genius, Gravis, Logitech, MadCatz, Microsoft and
-ThrustMaster. Creative Labs protocol support is still to be done.
+currently by FPGaming, Gravis, Logitech, MadCatz, Microsoft, Creative and
+ThrustMaster. Saitek protocol support is still to be done.
 
   The driver also includes support for many gamepads and joysticks that were
 used by various non-PC computers and game consoles. These include Multi
 system joysticks (Atari, Amiga, Commodore, Amstrad), Sega gamepads (Master
-System, Genesis, Saturn), Nintendo gamepads (NES, SNES), Sony gamepads (PSX).
-Support for N64, Atari Jaguar, Atari 2600, NES FourScore, SNES MultiTap,
-PSX NegCon and others might be added later.
+System, Genesis, Saturn), Nintendo gamepads (NES, SNES, N64), Sony gamepads
+(PSX).  Support for Atari Jaguar, Atari 2600, NES FourScore, SNES MultiTap
+and others might be added later.
 
   Last, but not least there is also native Amiga joystick support for the
-Amiga linux port.
+Amiga Linux port.
 
   Should you encounter any problems while using the driver, or joysticks
 this driver can't make complete use of, I'm very interested in hearing about
@@ -57,18 +58,13 @@ them. Bug reports and success stories are also welcome.
 
   The joystick package is available at the following FTP sites:
 
+       ftp://ftp.suse.cz/pub/development/joystick/
        ftp://atrey.karlin.mff.cuni.cz/pub/linux/joystick/
-
-  The joystick driver is also included in the Linux 2.1+ kernels:
-
-       ftp://linux.kernel.org/pub/linux/kernel/
+       ftp://ftp.gts.cz/pub/linux/joystick/
 
   And a homepage of the driver is at:
 
        http://www.suse.cz/development/joystick/
-
-  Mirrors of the homepage are at:
-
        http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/
        http://www.trylinux.com/projects/joystick/
        http://www.linuxgames.com/joystick/
@@ -92,7 +88,21 @@ above mentioned locations. The rest of this file assumes you have it.
   To compile the utilities in the joystick package, and the driver itself,
 as a standalone module, you first unpack the package, and then edit the
 Makefile to meet your needs (namely whether are you using versioned
-modules). Then you compile it
+modules). You will also need an unpacked and configured
+
+       make config
+
+kernel in
+       
+       /usr/src/linux
+
+Furthermore, if you're using versioned modules, you'll also need
+
+       make dep
+
+done on the kernel, to create some needed files.
+
+After that, you compile the joystick driver
 
        make
 
@@ -163,6 +173,14 @@ joystick driver module into the kernel
   where 'something' is the type of your joystick. See below for more precise
 explanation.
 
+  Alternately you can add the lines
+
+       alias char-major-15 joy-something
+       options joy-something js_xx=x,x,x,x,...
+
+  to the /etc/conf.modules file, so that the joystick module will be loaded
+automatically when the /dev/js devices are accessed.
+
 2.5 Verifying that it works
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   For testing the joystick driver functionality, there is the jstest
@@ -197,14 +215,14 @@ what the driver would choose itself.
 calibration using the jstest command, and if you do, you then can save the
 correction coefficients into a file
 
-       jscal -s /dev/js0 > /etc/joystick.cal
+       jscal -p /dev/js0 > /etc/joystick.cal
 
   And add a line to your rc script executing that file
 
        source /etc/joystick.cal
 
   This way, after the next reboot your joystick will remain calibrated. You
-can also add the jscal -s line to your shutdown script.
+can also add the jscal -p line to your shutdown script.
 
 
 3. HW specific driver information
@@ -222,7 +240,7 @@ ThrustMaster FCS or 6 and 8 button gamepads.
 
 * 2-axis, 4-button joystick
 * 3-axis, 4-button joystick
-* Two 2-axis, 2-button joysticks on an Y-cable
+* 4-axis, 4-button joystick
 
   For other joystick types (more/less axes, hats, and buttons) support
 you'll need to specify the types either on the kernel command line or on the
@@ -261,6 +279,8 @@ you have any additions/corrections to it, e-mail me.
 
        Joystick                                | 'm' value
        ----------------------------------------------------
+       Simple 2-button 2-axis joystick         | 0x0033
+       Second simple joystick on Y-cable       | 0x00cc
        Genius Flight2000 F-12                  | 0x00f3
        Genius Flight2000 F-21                  | 0x08f7
        Genius Flight2000 F-22                  | 0x02ff
@@ -268,9 +288,11 @@ you have any additions/corrections to it, e-mail me.
        Genius MaxFire G-07                     | 0xf0f3   
        Genius PowerStation                     | 0xf0f3
        Laing #1 PC SuperPad                    | 0xf0f3
+       Logitech Wingman                        | 0x003b
        Microsoft SideWinder Standard           | 0x003b
        QuickShot QS-201 SuperWarrior           | 0x00fb
        Saitek Megapad XII                      | 0x30f3
+       PC Powerpad Pro                         | 0x30f3
 
   In case you have one of the joystick in the table below, and it doesn't
 work with a specific driver in digital mode for some reason, you can use
@@ -280,8 +302,7 @@ operation is always better.
        Joystick                                | 'm' value
        ----------------------------------------------------
        Gravis GamePad Pro - analog mode        | 0x00f3
-       Genius Flight2000 F-23 - CHF mode       | 0x02ff
-       Genius Flight2000 F-23 - FCS mode       | 0x08f7
+       Genius Flight2000 F-23                  | 0x02ff
        Microsoft SideWinder 3D Pro - CHF mode  | 0x02ff
        Microsoft SideWinder 3D Pro - FCS mode  | 0x08f7
 
@@ -302,70 +323,85 @@ Using this method you'd get a command line:
   And it would do the same as the above explained command line. Use
 whichever way you like best.
 
-3.2 Microsoft SideWinder and Genius Digital joysticks
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  SideWinder and Genius Digital joysticks are supported by the
+3.2 Microsoft SideWinder joysticks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  Microsoft 'Digital Overdrive' protocol is supported by the
 joy-sidewinder.c module. All currently supported joysticks:
 
-* SideWinder 3d Pro
-* SideWinder Precision Pro 
+* SideWinder 3D Pro
 * SideWinder Force Feedback Pro
-* SideWinder Game Pad (up to four, chained together)
-* Genius Flight2000 Digital F-23
+* SideWinder Force Feedback Wheel
+* SideWinder FreeStyle Pro
+* SideWinder GamePad (up to four, chained together)
+* SideWinder Precision Pro 
 
   are autodetected, and thus no module parameters are needed.
 
+  There is one caveat with the 3D Pro. There are 9 buttons reported,
+although the joystick has only 8. The 9th button is the mode switch on the
+rear side of the joystick. However, moving it, you'll reset the joystick,
+and make it unresponsive for about a one third of a second. Furthermore, the
+joystick will also re-center itself, taking the position it was in during
+this time as a new center position. Use it if you want, but think first.
+
   The SideWinder Standard is not a digital joystick, and thus is supported
-by the analog driver described above. SideWinder FreeStyle Pro and
-SideWinder Force Feedback Wheel are not supported yet.
+by the analog driver described above. 
 
-3.3 Logitech Digital joysticks
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  Logitech Digital joysticks are supported by the joy-logitech.c module. It
-currently supports these devices:
+3.3 Logitech ADI devices
+~~~~~~~~~~~~~~~~~~~~~~~~
+  Logitech ADI protocol is supported by the joy-logitech.c module. It should
+support any Logitech device using this protocol. This includes, but is not
+limited to:
 
-* Logitech Wingman Extreme Digital
 * Logitech CyberMan 2
 * Logitech ThunderPad Digital
-
-  All three are autodetected, and thus no parameters to the module are
-needed.
-
-  Logitech Wingman is not a digital joystick and is handled by the analog
-driver described above. Logitech Wingman Warrior communicates through a
-serial port and is not supported yet. Logitech Wingman Force, Wingman
-Formula, Wingman Formula Force, Wingman Gamepad, Wingman Interceptor are USB
-joysticks, with optional serial port connection, and are not supported yet.
+* Logitech WingMan Extreme Digital
+* Logitech WingMan Formula
+* Logitech WingMan Interceptor
+* Logitech WingMan GamePad
+* Logitech WingMan GamePad USB
+* Logitech WingMan GamePad Extreme
+* Logitech WingMan Extreme Digital 3D
+
+  ADI devices are autodetected, and the driver supports up to two (any
+combination of) devices on a single gameport, using an Y-cable or chained
+together.
+
+  Logitech WingMan Joystick, Logitech WingMan Attack, Logitech WingMan
+Extreme and Logitech WingMan ThunderPad are not digital joysticks and are
+handled by the analog driver described above. Logitech WingMan Warrior and
+Logitech Magellan are supported by serial drivers described below. Logitech
+CyberMan, Logitech WingMan Force and Logitech WingMan Formula Force are not
+supported yet.
 
 3.4 Gravis GrIP
 ~~~~~~~~~~~~~~~
-  Gravis GrIP gamepads are supported by the joy-gravis.c module. It
+  Gravis GrIP protocol is supported by the joy-gravis.c module. It
 currently supports:
 
 * Gravis GamePad Pro
 * Gravis Xterminator
-* Gravis Blackhawk Digital
+* Gravis BlackHawk Digital
 
-  All these pads are autodetected, and you can even use any combination of
-up to two of these pads either chained together or using an Y-cable on a single
-gameport.
+  All these devices are autodetected, and you can even use any combination
+of up to two of these pads either chained together or using an Y-cable on a
+single gameport.
 
-GrIP MultiPort support is in the works. Gravis Xcalibur, ArcadeXtreme,
-GamePad Pro/M are joysticks/pads that probably never reached mass
-production. Gravis Stinger is a serial device and hopefully will be
-supported in the future.
+GrIP MultiPort and Gravis Xterminator DualControl aren't supported yet.
+Gravis Stinger is a serial device and hopefully will be supported in the
+future. Other Gravis joysticks are supported by the joy-analog driver.
 
 3.5 FPGaming A3D and MadCatz A3D
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  The Assasin 3D protocol created by FPGaming, is used both by FPGaming
+  The Assassin 3D protocol created by FPGaming, is used both by FPGaming
 themselves and is licensed to MadCatz. A3D devices are supported by the
-joy-assasin.c module. It currently supports:
+joy-assassin.c module. It currently supports:
 
-* FPGaming Assasin 3D
+* FPGaming Assassin 3D
 * MadCatz Panther
 * MadCatz Panther XL
 
-  All these devices are autodetected. Because the Assasin 3D and the Panther
+  All these devices are autodetected. Because the Assassin 3D and the Panther
 allow connecting analog joysticks to them, these are supported in this
 driver, too. The driver uses the js_as parameter for the analog joysticks,
 which has the same syntax as js_an for the analog driver.
@@ -376,20 +412,33 @@ but should be well usable.
 3.6 ThrustMaster DirectConnect (BSP)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   The TM DirectConnect (BSP) protocol is supported by the joy-thrustmaster.c
-module. It currently supports:
+module. This includes, but is not limited to:
 
 * ThrustMaster Millenium 3D Inceptor
 * ThrustMaster 3D Rage Pad
+* ThrustMaster Fusion Digital Game Pad
+
+  Devices not directly supported, but hopefully working are:
 
-  Both these drvices are autodetected, and thus no parameters to the module
+* ThrustMaster FragMaster
+* ThrustMaster Attack Throttle
+
+  If you have one of these, contact me.
+
+  BSP devices are autodetected, and thus no parameters to the module
 are needed.
 
-  The Millenium and Rage Pad should work fine now. TM WCS III won't work,
-because important parts of code for that are missing. I'm not sure if it was
-ever mass produced.
+3.7 Creative Labs Blaster
+~~~~~~~~~~~~~~~~~~~~~~~~~
+  The Blaster protocol is supported by the joy-creative.c module. It
+currently supports only the:
+
+* Creative Blaster GamePad Cobra
 
-3.7 PDPI Lightning 4 gamecards
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  Up to two of these can be used on a single gameport, using an Y-cable.
+
+3.8 PDPI Lightning 4 gamecards
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   PDPI Lightning 4 gamecards are supported by the joy-lightning.c module.
 This driver is only for analog joysticks connected to the card - if you want
 to use some of the digital devices, you need to use its specific driver. The
@@ -420,8 +469,49 @@ port the joystick is attached to:
   See the description of analog joystick driver for explanations of m0 and
 n0 values.
 
-3.8 Amiga
-~~~~~~~~~
+3.9 Trident 4DWave / Aureal Vortex
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  Soundcards with a Trident 4DWave DX/NX or Aureal Vortex chipset provide an
+"Enhanced Game Port" mode where the soundcard handles polling the joystick.
+This mode is supported by the joy-pci module.
+
+  If no module parameters are given, the joy-pci module will set all the
+soundcards it finds to "enhanced" mode, and will try to autodetect the type
+of attached joystick. It can only detect the same types of joysticks that
+the joy-analog module can.
+
+  This module accepts parameters in the form:
+
+       js_pci=t0,i0,m0,n0,t1,i1,m1,n1,....
+
+  The "t" value specifies the type of card, as follows:
+
+         t  | Card Type
+       ----------------------------
+         0  | Trident 4DWave DX
+         1  | Trident 4DWave NX
+         2  | Aureal Vortex1 (Au8820 chipset)
+         3  | Aureal Vortex2 (Au8830 chipset)
+
+  If you have more than one card of the same type, the "i" parameter lets
+you choose which card to apply the "m" and "n" values to. It counts from
+"0". (The driver detects cards in the order listed in the above table.)
+
+  The "m" and "n" values have the same meaning as for the analog module,
+with the exception that the value m=0, n=0 indicates that joy-pci should
+completely ignore that port. This can be useful to reserve a certain port
+for purely MIDI operation.
+
+  For example, let's say you have 3 sound cards - a 4Dwave DX, a 4DWave NX,
+and a Vortex 2. You have a three-axis, four-button, one-hat CHF- compatible
+joystick on the DX. You use the NX to interface to an external MIDI device.
+Finally, you have two two-axis, two-button joysticks on the Vortex. Your
+command line might look like:
+
+       js_pci=0,0,0x207,0,1,1,0,0,3,0,0x33,0xcc
+
+3.10 Amiga
+~~~~~~~~~~
   Amiga joysticks, connected to an Amiga, are supported by the joy-amiga.c
 driver. Since they can't be autodetected, the driver has a command line.
 
@@ -438,10 +528,75 @@ the Amiga.
   No more joystick types are supported now, but that should change in the
 future if I get an Amiga in the reach of my fingers.
 
-3.9 Game console and 8-bit pads and joysticks
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+3.11 Game console and 8-bit pads and joysticks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 See joystick-parport.txt for more info.
 
+3.12 SpaceTec/LabTec devices
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  SpaceTec serial devices communicate using the SpaceWare protocol. It is
+supported by the joy-spaceorb and joy-spaceball drivers. The devices currently
+supported by joy-spaceorb are:
+
+* SpaceTec SpaceBall Avenger
+* SpaceTec SpaceOrb 360
+
+Devices currently supported by joy-spaceball are:
+
+* SpaceTec SpaceBall 4000 FLX
+
+  In addition to having the joy-spaceorb/spaceball module in the kernel, you
+also need to attach a serial port to it. to do that, run the jsattach
+program:
+
+       jsattach --spaceorb /dev/ttySx &
+or
+       jsattach --sball4 /dev/ttySx &
+
+where /dev/ttySx is the serial port which the device is connected to. After
+doing this, the device will be reported and will start working.
+
+  There is one caveat with the SpaceOrb. The button #6, the on the bottom
+side of the orb, although reported as an ordinary button, causes internal
+recentering of the spaceorb, moving the zero point to the position in which
+the ball is at the moment of pressing the button. So, think first before
+you bind it to some other function.
+
+SpaceTec SpaceBall 2003 FLX and 3003 FLX are not supported yet. 
+
+3.13 Logitech SWIFT devices
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  The SWIFT serial protocol is supported by the joy-warrior module. It
+currently supports only the:
+
+* Logitech WingMan Warrior
+
+but in the future, Logitech CyberMan (the original one, not CM2) could be
+supported as well. To use the module, you need to run jsattach after you
+insert/compile the module into your kernel:
+
+       jsattach --warrior /dev/ttySx &
+
+ttySx is the serial port your Warrior is attached to.
+
+3.14 Magellan / Space Mouse
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  The Magellan (or Space Mouse), manufactured by LogiCad3d (formerly Space
+Systems), for many other companies (Logitech, HP, ...) is supported by the
+joy-magellan module. It currently supports only the:
+
+* Magellan 3D
+* Space Mouse
+
+models, the additional buttons on the 'Plus' versions are not supported yet.
+
+  To use it, you need to attach the serial port to the driver using the
+
+       jsattach --magellan /dev/ttySx &
+
+command. After that the Magellan will be detected, initialized, will beep,
+and the /dev/jsX device should become useable.
+
 4. Troubleshooting
 ~~~~~~~~~~~~~~~~~~
   There is quite a high probability that you run into some problems. For
@@ -452,9 +607,10 @@ interface, and "old" for the "0.x" interface. You run it by typing:
        jstest --normal /dev/js0
        jstest --old    /dev/js0
 
-  If your trouble stems from the fact the drivers can't detect the attached
-joystick, and/or you decide you need my help (which I will gladly provide),
-please use the joydump utility first. It's created just by typing
+  If your trouble stems from the fact the drivers can't detect the joystick
+attached to your gameport, and you decide you need my help (which I will
+gladly provide), please use the joydump utility first. It's created just by
+typing
 
        make joydump.o
 
@@ -465,64 +621,73 @@ by typing
 
   in the same directory. It will return a 'device busy' or 'initialization
 failed' error. This is perfectly okay. It has already done it's job. The
-results can be found in the system log. Please send me the results along
-with your problem report.
+results can be found in the system log or in the output of the
+
+       dmesg
+
+command. Please send me the results along with your problem report.
 
   Oh, and read the FAQ! :)
 
 5. FAQ
 ~~~~~~
- Q: The driver doesn't find any joysticks connected to my soundcard with the
-message "joy-something: no joysticks found" and "joy-something.o:
-init_module: Device or resource busy." or "Initialization of joy-something
-failed"  What could be the cause?
-  A: The most common cause is that the joystick port on your soundcard is
-not enabled. If it is an ISA PnP card, you'll need isapnptools to configure
-the gameport. Non-PnP cards usually use some option to the sound driver -
-see the sound driver docs and source and enable the port.
-
-  Q: Any access to the joystick devices gives me "Operation not supported by
-device". What am I doing wrong?
-  A: You're running a 2.0 kernel and you forgot to insmod the hardware
-specific module. You not only need the joystick.o, but also one of the other
-joy-*.o files (most usually joy-analog.o), as described in this document,
-section 2. If you are not using modules, then you didn't say 'Y' to any of
-the hardware-specific questions. Again, see section 2. If you did select
-the specific support, and you still get this message, check that you
-selected the right one, and if it still doesn't work, go to the previous
-FAQ.
-
-  Q: Everything is fine, except I get "No such device" error when I try to
-do anything with /dev/js0. What's the cause?
-  A: You're running a 2.1 kernel and you want to read the previous FAQ.
-
-  Q: Upon 'insmod joystick.o' I get a LOT of unresolved symbols, including
-printk and others. Why?
-  A: You either don't have your kernel compiled with module support. If
-that's the cause, re-compile your kernel with module support switched on.
-Or, you use versioned symbols, and don't have -DMODVERSIONS in the joystick
-driver Makefile, or vice versa. Correct the situation by either removing or
-adding -DMODVERSIONS to the Makefile.
-
-  Q: Running 'jstest 1' or 'jscal 1' doesn't work, and returns with "File
-not found" error. What is the problem?
-  A: The command line interface for these tools is different from what
-version 0.8.0 used. You have to specify the whole device name, eg. 'jstest
-/dev/js0'.
-
-  Q: Running 'jstest /dev/js0' results in "File not found" error. What's the
-cause?
-  A: The device files don't exist. Run 'make devs'.
-
-  Q: Is it possible to connect my old Atari/Commodore/Amiga/console joystick
-or pad that uses a 9-pin D-type cannon connector to the serial port of my
-PC?
-  A: Yes, it is possible, but it'll burn your serial port or the pad. It
-won't work, of course.
-
-  Q: My joystick doesnt work with Quake / Quake 2. What's the cause?
-  A: Quake / Quake 2 don't support joystick. Use joy2key to simulate keypresses
-for them.
+Q: The driver doesn't find any joysticks connected to my soundcard with the
+   message "joy-something: no joysticks found" and "joy-something.o:
+   init_module: Device or resource busy." or "Initialization of joy-something
+   failed"  What could be the cause?
+A: The most common cause is that the joystick port on your soundcard is
+   not enabled. If it is an ISA PnP card, you'll need isapnptools to configure
+   the gameport. Non-PnP cards usually use some option to the sound driver -
+   see the sound driver docs and source and enable the port. Note that in case
+   of a PnP card you have to load the joystick driver as a module after running
+   the isapnp command, it will not work in the opposite order.
+
+Q: Any access to the joystick devices gives me "Operation not supported by
+   device". What am I doing wrong?
+A: You're running a 2.0 kernel and you forgot to insmod the hardware
+   specific module. You not only need the joystick.o, but also one of the other
+   joy-*.o files (most usually joy-analog.o), as described in this document,
+   section 2. If you are not using modules, then you didn't say 'Y' to any of
+   the hardware-specific questions. Again, see section 2. If you did select
+   the specific support, and you still get this message, check that you
+   selected the right one, and if it still doesn't work, go to the previous
+   FAQ.
+
+Q: Everything is fine, except I get "No such device" error when I try to
+   do anything with /dev/js0. What's the cause?
+A: You're running a 2.1 or 2.2. kernel and you want to read the previous FAQ.
+
+Q: Upon 'insmod joystick.o' I get a LOT of unresolved symbols, including
+   'printk' and others. Why?
+A: You either don't have your kernel compiled with module support. If
+   that's the cause, re-compile your kernel with module support switched on.
+   Or, you use versioned symbols, and don't have -DMODVERSIONS in the joystick
+   driver Makefile, or vice versa. Correct the situation by either removing or
+   adding -DMODVERSIONS to the Makefile.
+
+Q: Upon 'insmod joy-something' I get a bunch of unresolved symbols, like
+   'js_register_port, js_unregister device' and others. What's wrong?
+A: You need to 'insmod joystick.o' first.
+
+Q: Running 'jstest 1' or 'jscal 1' doesn't work, and returns with "File
+   not found" error. What is the problem?
+A: The command line interface for these tools is different from what
+   version 0.8.0 used. You have to specify the whole device name, eg. 'jstest
+   /dev/js0'.
+
+Q: Running 'jstest /dev/js0' results in "File not found" error. What's the
+   cause?
+A: The device files don't exist. Run 'make devs'.
+
+Q: Is it possible to connect my old Atari/Commodore/Amiga/console joystick
+   or pad that uses a 9-pin D-type cannon connector to the serial port of my
+   PC?
+A: Yes, it is possible, but it'll burn your serial port or the pad. It
+   won't work, of course.
+
+Q: My joystick doesn't work with Quake / Quake 2. What's the cause?
+A: Quake / Quake 2 don't support joystick. Use joy2key to simulate keypresses
+   for them.
 
 6. Programming Interface
 ~~~~~~~~~~~~~~~~~~~~~~~~
@@ -565,23 +730,31 @@ to the joystick driver development:
        Brian Gerst             <bgerst@quark.vpplus.com>
        Andree Borrmann         <a.borrmann@tu-bs.de>
        Martin Giguere          <zefrench@hotmail.com>
+       David Thompson          <dcthomp@mail.utexas.edu>
+       Justin Wake             <spectre@telefragged.com>
+       Benoit Triquet          <benoit@adsl-216-100-248-201.dsl.pacbell.net>
+       John Dahlstrom          <jodaman@bradley.edu>
+       Dan Gohman              <gohmandj@mrs.umn.edu>
+       Joe Krahn               <krahn@niehs.nih.gov>
+       David Kuder             <alphagod@penguinpowered.com>
+       Raymond Ingles          <sorceror@tir.com>
 
   If you think you should be in this list and are not, it's possible that
 I forgot to include you - contact me and I'll correct the error. :)
 
   Thanks to KYE Systems Europe, who provided me with driver sources for the
-Genius Flight2000 Digital F-23, which happens to be compatible with
-Microsoft SideWinder 3d Pro.
+Genius Flight2000 Digital F-23, which happens to be identical (in software)
+to Microsoft SideWinder 3D Pro.
 
   Thanks to ThrustMaster Inc. who provided me with docs for their digital
-protocol, and to Trystan A Larey-williams <axe@mail.wsu.edu>, who wrote an
-attempt of a driver for them.
+protocol specifications, and to Trystan A Larey-Williams <axe@mail.wsu.edu>,
+who wrote an attempt of a driver for them.
 
   Thanks to Creative Labs Europe, and Ifor Powell <ipowell@cle.creaf.com>,
-who provided me with docs for their first generation gamepad.
+who provided me with docs for their first generation Blaster GamePad.
 
   Special thanks go to FP-Gaming, Inc. and James C Barnes <james@fpgaming.com>,
-who provided me with help and detailed information about the Assasin 3D
+who provided me with help and detailed information about the Assassin 3D
 protocol and devices, and even sent me a Panther and Panther XL for testing,
 along with cool T-shirts.
 
@@ -590,10 +763,20 @@ along with cool T-shirts.
 code for their L4 gamecard, and sending me the card to test my driver with
 it.
 
+  Thanks to LogiCad3D for their support, for having the specifications
+online and for the nice music on their telephone.
+
+  Special thanks to Logitech, Jerry de Raad <Jerry_de_Raad@logitech.com>,
+Thomas Burgel <Thomas_Burgel@logitech.com>, Avinash Shinde
+<Avinash_Shinde@logitech.com> for providing me with a lot of documentation
+for their devices, and also for a big box, containing a CyberMan2, Wingman
+Extreme, Magellan, Wingman Warrior, two MouseMan mice, and a NewTouch
+keyboard.
+
   Thanks to everyone else who helped me develop this package of drivers!
 
-  No thanks to Microsoft, Logitech, and Gravis, who don't release a word
-about their hardware .... :(
+  No thanks to Microsoft and Gravis, who don't release a word about their
+hardware .... :(
 
 8. ChangeLog
 ~~~~~~~~~~~~
@@ -602,50 +785,3 @@ about their hardware .... :(
 9. To do
 ~~~~~~~~
   See the TODO file for the list of things planned.
-
-10. Current driver status
-~~~~~~~~~~~~~~~~~~~~~~~~~
-  OK means tested and not touched till this driver revision, unknown means
-that the driver was changed since last test, broken means doesn't work,
-incomplete means can't work, because vital parts of support are missing.
-
-joystick.c:            2.1.x kernel interface  - OK
-joy-amiga.c:           Multi1 stick            - unknown
-joy-analog.c:          standard joysticks      - OK
-                       FCS hats                - OK
-                       CHF hats & buttons      - OK
-                       XY buttons              - OK
-                       UV buttons              - OK
-joy-assasin.c:         MadCatz Panther XL      - OK
-                       MadCatz PXL rudder      - OK
-                       MadCatz Panther         - OK
-                       FPG Assasin 3D          - OK
-joy-console.c:         NES pad                 - OK
-                       SNES pad                - OK
-                       Multi1 stick            - OK
-                       Multi2 stick            - OK
-                       PSX                     - SW OK, HW unreliable
-joy-db9.c:             Multi1 stick            - OK
-                       Multi2 stick            - OK
-                       Sega Genesis pad        - OK
-                       Sega Genesis 5 pad      - OK
-                       Sega Genesis 6 pad      - OK
-                       Sega Saturn pad         - unknown
-joy-gravis.c           Gravis GamePad Pro      - OK
-                       Gravis Xterminator      - OK
-                       Gravis Blackhawk Digital- OK
-joy-lightning.c                PDPI Lightning 4        - OK
-joy-logitech.c         WingMan Extreme Digital - OK
-                       CyberMan 2              - OK
-                       Thunder Pad Digital     - unknown
-joy-sidewinder.c       SW 3D Pro               - OK
-                       Genius F-23             - OK
-                       SW GP                   - OK
-                       SW PP                   - OK
-                       SW FFP                  - OK
-joy-thrustmaster.c     Millenium 3D Inceptor   - OK
-                       3D-Rage Pad             - OK
-joy-turbografx.c       Multi1 stick            - OK
-
-Please help me and send me success / failure reports for the drivers,
-I need to know what works, and what needs to be debugged. Thank you.
index 2139dcbf1c947b313a02009b1f45318fb10b6258..4e32f9747ea8479848ab4f63bb25023e229e3d6d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 3
-SUBLEVEL = 30
+SUBLEVEL = 31
 EXTRAVERSION =
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
@@ -117,6 +117,10 @@ DRIVERS            =drivers/block/block.a \
 LIBS           =$(TOPDIR)/lib/lib.a
 SUBDIRS                =kernel drivers mm fs net ipc lib
 
+ifdef CONFIG_DRM
+DRIVERS += drivers/char/drm/drm.o
+endif
+
 ifdef CONFIG_NUBUS
 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
 endif
index 8462843f244d9dec1cf284fefcfff05f88ba3407..408149bc51dc1e33c26d244d29ce502b74a27f74 100644 (file)
@@ -49,6 +49,36 @@ asmlinkage int sys_pipe(unsigned long * fildes)
        return error;
 }
 
+/* common code for old and new mmaps */
+static inline long do_mmap2(
+       unsigned long addr, unsigned long len,
+       unsigned long prot, unsigned long flags,
+       unsigned long fd, unsigned long pgoff)
+{
+       int error = -EBADF;
+       struct file * file = NULL;
+
+       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+       if (!(flags & MAP_ANONYMOUS)) {
+               file = fget(fd);
+               if (!file)
+                       goto out;
+       }
+
+       down(&current->mm->mmap_sem);
+       lock_kernel();
+
+       error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+
+       unlock_kernel();
+       up(&current->mm->mmap_sem);
+
+       if (file)
+               fput(file);
+out:
+       return error;
+}
+
 /*
  * Perform the select(nd, in, out, ex, tv) and mmap() system
  * calls. ARM Linux didn't use to be able to handle more than
@@ -68,30 +98,20 @@ struct mmap_arg_struct {
 asmlinkage int old_mmap(struct mmap_arg_struct *arg)
 {
        int error = -EFAULT;
-       struct file * file = NULL;
        struct mmap_arg_struct a;
 
-       down(&current->mm->mmap_sem);
-       lock_kernel();
        if (copy_from_user(&a, arg, sizeof(a)))
+               goto out;;
+
+       error = -EINVAL;
+       if (a.offset & ~PAGE_MASK)
                goto out;
-       if (!(a.flags & MAP_ANONYMOUS)) {
-               error = -EBADF;
-               file = fget(a.fd);
-               if (!file)
-                       goto out;
-       }
-       a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-       error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset);
-       if (file)
-               fput(file);
+
+       error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
 out:
-       unlock_kernel();
-       up(&current->mm->mmap_sem);
        return error;
 }
 
-
 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 
 struct sel_arg_struct {
index 59e4207498fb6e2a98bcbce4c76d8a6cf97ade62..0f8534b7e2c354eaa7ddd2b44388a66395eb2ca0 100644 (file)
@@ -592,6 +592,7 @@ ENTRY(sys_call_table)
        .long SYMBOL_NAME(sys_ni_syscall)               /* streams2 */
        .long SYMBOL_NAME(sys_vfork)            /* 190 */
        .long SYMBOL_NAME(sys_getrlimit)
+       .long SYMBOL_NAME(sys_mmap2)
 
        /*
         * NOTE!! This doesn't have to be exact - we just have
@@ -599,6 +600,6 @@ ENTRY(sys_call_table)
         * entries. Don't panic if you notice that this hasn't
         * been shrunk every time we add a new system call.
         */
-       .rept NR_syscalls-191
+       .rept NR_syscalls-192
                .long SYMBOL_NAME(sys_ni_syscall)
        .endr
index b382ce0af3e7a855562057b421c8ba28858dcccb..59af7034d6e455a70f2ea4ba030758a4f694308b 100644 (file)
@@ -575,7 +575,7 @@ asmlinkage void smp_spurious_interrupt(void)
  * This interrupt should never happen with our APIC/SMP architecture
  */
 
-static spinlock_t err_lock;
+static spinlock_t err_lock = SPIN_LOCK_UNLOCKED;
 
 asmlinkage void smp_error_interrupt(void)
 {
index 289220d91b43a93e87100e3cd59c7f1be8c072ff..8a0c6dbdaf6aadb922a61882376f70cc4343d558 100644 (file)
@@ -41,6 +41,43 @@ asmlinkage int sys_pipe(unsigned long * fildes)
        return error;
 }
 
+/* common code for old and new mmaps */
+static inline long do_mmap2(
+       unsigned long addr, unsigned long len,
+       unsigned long prot, unsigned long flags,
+       unsigned long fd, unsigned long pgoff)
+{
+       int error = -EBADF;
+       struct file * file = NULL;
+
+       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+       if (!(flags & MAP_ANONYMOUS)) {
+               file = fget(fd);
+               if (!file)
+                       goto out;
+       }
+
+       down(&current->mm->mmap_sem);
+       lock_kernel();
+
+       error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+
+       unlock_kernel();
+       up(&current->mm->mmap_sem);
+
+       if (file)
+               fput(file);
+out:
+       return error;
+}
+
+asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
+       unsigned long prot, unsigned long flags,
+       unsigned long fd, unsigned long pgoff)
+{
+       return do_mmap2(addr, len, prot, flags, fd, pgoff);
+}
+
 /*
  * Perform the select(nd, in, out, ex, tv) and mmap() system
  * calls. Linux/i386 didn't use to be able to handle more than
@@ -59,32 +96,22 @@ struct mmap_arg_struct {
 
 asmlinkage int old_mmap(struct mmap_arg_struct *arg)
 {
-       int error = -EFAULT;
-       struct file * file = NULL;
        struct mmap_arg_struct a;
+       int err = -EFAULT;
 
        if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
+               goto out;
 
-       down(&current->mm->mmap_sem);
-       lock_kernel();
-       if (!(a.flags & MAP_ANONYMOUS)) {
-               error = -EBADF;
-               file = fget(a.fd);
-               if (!file)
-                       goto out;
-       }
-       a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+       err = -EINVAL;
+       if (a.offset & ~PAGE_MASK)
+               goto out;
 
-       error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset);
-       if (file)
-               fput(file);
+       err = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
 out:
-       unlock_kernel();
-       up(&current->mm->mmap_sem);
-       return error;
+       return err;
 }
 
+
 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 
 struct sel_arg_struct {
index d3f0d3109dc05b0af132244f6416a95852fc24c0..903dcf15d00c84582550eaf85b12c0d04f5f46d2 100644 (file)
@@ -80,8 +80,7 @@ extern rwlock_t xtime_lock;
 
 static inline unsigned long do_fast_gettimeoffset(void)
 {
-       register unsigned long eax asm("ax");
-       register unsigned long edx asm("dx");
+       register unsigned long eax, edx;
 
        /* Read the Time Stamp Counter */
 
index a85da4e107e934de43c372e8e3ce035a453978ac..1387f594ba7f580f3c6405246db2e4662552bf8b 100644 (file)
@@ -44,6 +44,43 @@ asmlinkage int sys_pipe(unsigned long * fildes)
        return error;
 }
 
+/* common code for old and new mmaps */
+static inline long do_mmap2(
+       unsigned long addr, unsigned long len,
+       unsigned long prot, unsigned long flags,
+       unsigned long fd, unsigned long pgoff)
+{
+       int error = -EBADF;
+       struct file * file = NULL;
+
+       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+       if (!(flags & MAP_ANONYMOUS)) {
+               file = fget(fd);
+               if (!file)
+                       goto out;
+       }
+
+       down(&current->mm->mmap_sem);
+       lock_kernel();
+
+       error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+
+       unlock_kernel();
+       up(&current->mm->mmap_sem);
+
+       if (file)
+               fput(file);
+out:
+       return error;
+}
+
+asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
+       unsigned long prot, unsigned long flags,
+       unsigned long fd, unsigned long pgoff)
+{
+       return do_mmap2(addr, len, prot, flags, fd, pgoff);
+}
+
 /*
  * Perform the select(nd, in, out, ex, tv) and mmap() system
  * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
@@ -62,13 +99,49 @@ struct mmap_arg_struct {
 
 asmlinkage int old_mmap(struct mmap_arg_struct *arg)
 {
-       int error;
-       struct file * file = NULL;
        struct mmap_arg_struct a;
+       int error = -EFAULT;
+
+       if (copy_from_user(&a, arg, sizeof(a)))
+               goto out;
+
+       error = -EINVAL;
+       if (a.offset & ~PAGE_MASK)
+               goto out;
+
+       a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+
+       error = do_mmap2(file, a.addr, a.len, a.prot, a.flags, a.offset >> PAGE_SHIFT);
+out:
+       return error;
+}
+
+struct mmap_arg_struct64 {
+       __u32 addr;
+       __u32 len;
+       __u32 prot;
+       __u32 flags;
+       __u64 offset; /* 64 bits */
+       __u32 fd;
+};
+
+asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
+{
+       int error = -EFAULT;
+       struct file * file = NULL;
+       struct mmap_arg_struct64 a;
+       unsigned long pgoff;
 
        if (copy_from_user(&a, arg, sizeof(a)))
                return -EFAULT;
 
+       if ((long)a.offset & ~PAGE_MASK)
+               return -EINVAL;
+
+       pgoff = a.offset >> PAGE_SHIFT;
+       if ((a.offset >> PAGE_SHIFT) != pgoff)
+               return -EINVAL;
+
        down(&current->mm->mmap_sem);
        lock_kernel();
        if (!(a.flags & MAP_ANONYMOUS)) {
@@ -79,7 +152,7 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
        }
        a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 
-       error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset);
+       error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
        if (file)
                fput(file);
 out:
@@ -88,7 +161,6 @@ out:
        return error;
 }
 
-
 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 
 struct sel_arg_struct {
@@ -103,7 +175,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
 
        if (copy_from_user(&a, arg, sizeof(a)))
                return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
+       /* sys_select() does the appropriate kernel locking */
        return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
 }
 
index bfcf5b39ffe083fd1ec3f216ddc162d1bb04eb40..81228715e7fc0a05e0bfd6a25d5b3a4eadae591e 100644 (file)
@@ -82,6 +82,8 @@ if [ "$CONFIG_MOUSE" != "n" ]; then
 fi
 endmenu
 
+source drivers/char/joystick/Config.in
+
 tristate 'QIC-02 tape support' CONFIG_QIC02_TAPE
 if [ "$CONFIG_QIC02_TAPE" != "n" ]; then
    bool '  Do you want runtime configuration for QIC-02' CONFIG_QIC02_DYNCONF
@@ -141,7 +143,6 @@ if [ "$CONFIG_VIDEO_DEV" != "n" ]; then
    fi
    if [ "$CONFIG_PCI" != "n" ]; then
       dep_tristate '  BT848 Video For Linux' CONFIG_VIDEO_BT848 $CONFIG_VIDEO_DEV
-       dep_tristate 'Zoran ZR36120/36125 support' CONFIG_VIDEO_ZR36120 $CONFIG_VIDEO_DEV
    fi
    dep_tristate '  GemTek Radio Card support' CONFIG_RADIO_GEMTEK $CONFIG_VIDEO_DEV
    if [ "$CONFIG_RADIO_GEMTEK" = "y" ]; then
@@ -200,15 +201,6 @@ fi
 
 endmenu
 
-mainmenu_option next_comment
-comment 'Joystick support'
-
-tristate 'Joystick support' CONFIG_JOYSTICK
-if [ "$CONFIG_JOYSTICK" != "n" ]; then
-   source drivers/char/joystick/Config.in
-fi
-endmenu
-
 tristate 'Double Talk PC internal speech card support' CONFIG_DTLK
 
 tristate 'Siemens R3964 line discipline' CONFIG_R3964
@@ -224,6 +216,7 @@ endmenu
 
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
    bool 'Direct Rendering Manager (XFree86 DRI support) (EXPERIMENTAL)' CONFIG_DRM
+   dep_tristate '  3dfx Banshee/Voodoo3' CONFIG_DRM_TDFX $CONFIG_DRM
    if [ "$CONFIG_DRM" = "y" ]; then
       dep_tristate '  3dlabs GMX 2000' CONFIG_DRM_GAMMA m
    fi
index f85f22b51e107131b16227cbaf90be6ef08328fc..7fdff597d28e5611fb1b7b5bca57eb4195c64a5a 100644 (file)
@@ -622,6 +622,7 @@ else
 endif
 
 ifeq ($(CONFIG_DRM),y)
+  SUB_DIRS += drm
   ALL_SUB_DIRS += drm
   MOD_SUB_DIRS += drm
 endif
index d72b726c09fabcaa7384c350cf1811194411f743..e33418fd4b11e2f65a2c4ce2323ae5474429cd32 100644 (file)
 #
 
 L_TARGET        := libdrm.a
+O_TARGET       := drm.o
 
 L_OBJS         := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
                        lists.o lock.o ioctl.o fops.o vm.o dma.o
 
 M_OBJS         := 
 
-ifdef CONFIG_DRM_GAMMA
-M_OBJS          += gamma.o
+ifeq ($(CONFIG_DRM_GAMMA),y)
+ O_OBJS += gamma.o
+else
+  ifeq ($(CONFIG_DRM_GAMMA),m)
+    M_OBJS += gamma.o
+  endif
+endif
+
+ifeq ($(CONFIG_DRM_TDFX),y)
+ O_OBJS += tdfx.o
+else
+  ifeq ($(CONFIG_DRM_TDFX),m)
+    M_OBJS += tdfx.o
+  endif
 endif
 
 include $(TOPDIR)/Rules.make
 
 gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET)
        $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o -L. -ldrm
+
+tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET)
+       $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm
index fc3c680e1787ad94ddb89a34a02ce8696113f546..1cc4c277033caf8a3fc5a8030c73ac8850d330a4 100644 (file)
@@ -37,3 +37,5 @@ For specific information about kernel-level support, see:
     http://precisioninsight.com/dr/security.html
 
 
+
+$XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.2 1999/09/27 14:59:24 dawes Exp $
index 2561264ff25d52bd6eadf320bbdb439a3e0d40c3..865681956e32bcba626b9d798effcd384ccd229f 100644 (file)
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/auth.c,v 1.4 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gen_ioctl.c,v 1.2 1999/06/27 14:08:27 dawes Exp $
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.4 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.1 1999/09/25 14:37:57 dawes Exp $
  *
  */
 
index 4771c3327ddf6ca6ea2177090c76d5bfc6b57857..780c4fb69c1948e9b84e3cd1dec1c0481096ead8 100644 (file)
@@ -1,6 +1,6 @@
 /* bufs.c -- IOCTLs to manage buffers -*- linux-c -*-
  * Created: Tue Feb  2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 22:48:10 1999 by faith@precisioninsight.com
+ * Revised: Fri Dec  3 12:11:11 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/bufs.c,v 1.8 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.8 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.1 1999/09/25 14:37:57 dawes Exp $
  *
  */
 
 #define __NO_VERSION__
-#include <linux/config.h>
 #include "drmP.h"
 #include "linux/un.h"
 
@@ -90,10 +89,11 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd,
                        
 
        case _DRM_SHM:
-               DRM_DEBUG("%ld %d\n", map->size, drm_order(map->size));
                map->handle = (void *)drm_alloc_pages(drm_order(map->size)
                                                      - PAGE_SHIFT,
                                                      DRM_MEM_SAREA);
+               DRM_DEBUG("%ld %d %p\n", map->size, drm_order(map->size),
+                         map->handle);
                if (!map->handle) {
                        drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                        return -ENOMEM;
index b85aed6065827dfcc6948383c44b34076445ec47..d7f8bdf2bcc469af60e84cfcae9ee01b027701a9 100644 (file)
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/context.c,v 1.5 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gen_ioctl.c,v 1.2 1999/06/27 14:08:27 dawes Exp $
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.5 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
  *
  */
 
index 0ccbfc146b51de11e96b8155cdd8e431b30eed6f..ea08a859e3762cc72d1dfc10e0c0e23bbafa14de 100644 (file)
@@ -1,6 +1,6 @@
 /* dma.c -- DMA IOCTL and function support -*- linux-c -*-
  * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:06:51 1999 by faith@precisioninsight.com
+ * Revised: Thu Sep 16 12:55:39 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/dma.c,v 1.6 1999/08/20 20:00:53 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.7 1999/09/16 16:56:18 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
  *
  */
 
@@ -176,6 +176,7 @@ void drm_reclaim_buffers(drm_device_t *dev, pid_t pid)
        drm_device_dma_t *dma = dev->dma;
        int              i;
 
+       if (!dma) return;
        for (i = 0; i < dma->buf_count; i++) {
                if (dma->buflist[i]->pid == pid) {
                        switch (dma->buflist[i]->list) {
index 6a8fc753a2a52bb62dfcd63b554705973905cebe..c26953c1d8e2b174a844496a4bafb75fa239a80a 100644 (file)
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drawable.c,v 1.3 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.3 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.1 1999/09/25 14:37:58 dawes Exp $
  *
  */
 
index 2251462e82f239d286d8143d4c104fb9a3a8aadf..320db51ebe03c7400effc70ece0bc8062f2deadc 100644 (file)
@@ -1,6 +1,6 @@
 /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*-
  * Created: Mon Jan  4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:08:18 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec  6 17:11:19 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All rights reserved.
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drm.h,v 1.2 1999/06/27 14:08:21 dawes Exp $
- * 
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.46 1999/08/20 20:00:53 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.1 1999/09/25 14:37:58 dawes Exp $
+ *
+ * Acknowledgements:
+ * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
+ *
  */
 
 #ifndef _DRM_H_
index 0cb4df4f2d3b1bd1e8b272b737b8db9fdd2f855c..966e6e05a60cd61905ef64c52bfddd038071d062 100644 (file)
@@ -1,6 +1,6 @@
 /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
  * Created: Mon Jan  4 10:05:05 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:04:33 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec  6 16:06:49 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All rights reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/drmP.h,v 1.2 1999/06/27 14:08:24 dawes Exp $
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.1 1999/09/25 14:37:59 dawes Exp $
  * 
  */
 
@@ -33,7 +33,6 @@
 #define _DRM_P_H_
 
 #ifdef __KERNEL__
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #define DRM_MEM_BUFLISTS 14
 
                                /* Backward compatibility section */
+                               /* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */
 #ifndef _PAGE_PWT
-                               /* The name of _PAGE_WT was changed to
-                                  _PAGE_PWT in Linux 2.2.6 */
 #define _PAGE_PWT _PAGE_WT
 #endif
-                               /* Wait queue declarations changes in 2.3.1 */
+                               /* Wait queue declarations changed in 2.3.1 */
 #ifndef DECLARE_WAITQUEUE
 #define DECLARE_WAITQUEUE(w,c) struct wait_queue w = { c, NULL }
 typedef struct wait_queue *wait_queue_head_t;
 #define init_waitqueue_head(q) *q = NULL;
 #endif
 
-#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock)
-#define _DRM_CAS(lock,old,new,__ret)                                  \
-       do {                                                           \
-               int __dummy;    /* Can't mark eax as clobbered */      \
-               __asm__ __volatile__(                                  \
-                       "lock ; cmpxchg %4,%1\n\t"                     \
-                       "setnz %0"                                     \
-                       : "=d" (__ret),                                \
-                         "=m" (__drm_dummy_lock(lock)),               \
-                         "=a" (__dummy)                               \
-                       : "2" (old),                                   \
-                         "r" (new));                                  \
-       } while (0)
+                               /* _PAGE_4M changed to _PAGE_PSE in 2.3.23 */
+#ifndef _PAGE_PSE
+#define _PAGE_PSE _PAGE_4M
+#endif
+
+                               /* vm_offset changed to vm_pgoff in 2.3.25 */
+#if LINUX_VERSION_CODE < 0x020319
+#define VM_OFFSET(vma) ((vma)->vm_offset)
+#else
+#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
+#endif
 
+                               /* *_nopage return values defined in 2.3.26 */
+#ifndef NOPAGE_SIGBUS
+#define NOPAGE_SIGBUS 0
+#endif
+#ifndef NOPAGE_OOM
+#define NOPAGE_OOM 0
+#endif
 
+                               /* Generic cmpxchg added in 2.3.x */
+#if CPU != 386
+#ifndef __HAVE_ARCH_CMPXCHG
+                               /* Include this here so that driver can be
+                                   used with older kernels. */
+static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+                                     unsigned long new, int size)
+{
+       unsigned long prev;
+       switch (size) {
+       case 1:
+               __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
+                                    : "=a"(prev)
+                                    : "q"(new), "m"(*__xg(ptr)), "0"(old)
+                                    : "memory");
+               return prev;
+       case 2:
+               __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
+                                    : "=a"(prev)
+                                    : "q"(new), "m"(*__xg(ptr)), "0"(old)
+                                    : "memory");
+               return prev;
+       case 4:
+               __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+                                    : "=a"(prev)
+                                    : "q"(new), "m"(*__xg(ptr)), "0"(old)
+                                    : "memory");
+               return prev;
+       }
+       return old;
+}
+
+#define cmpxchg(ptr,o,n)                                               \
+  ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),             \
+                                (unsigned long)(n),sizeof(*(ptr))))
+#endif
+#else
+                               /* Compiling for a 386 proper... */
+#error DRI not supported on Intel 80386
+#endif
 
                                /* Macros to make printk easier */
 #define DRM_ERROR(fmt, arg...) \
@@ -437,6 +480,7 @@ extern ssize_t           drm_read(struct file *filp, char *buf, size_t count,
 extern int          drm_write_string(drm_device_t *dev, const char *s);
 
                                /* Mapping support (vm.c) */
+#if LINUX_VERSION_CODE < 0x020317
 extern unsigned long drm_vm_nopage(struct vm_area_struct *vma,
                                   unsigned long address,
                                   int write_access);
@@ -446,6 +490,18 @@ extern unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
 extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
                                       unsigned long address,
                                       int write_access);
+#else
+                               /* Return type changed in 2.3.23 */
+extern struct page *drm_vm_nopage(struct vm_area_struct *vma,
+                                 unsigned long address,
+                                 int write_access);
+extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
+                                     unsigned long address,
+                                     int write_access);
+extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
+                                     unsigned long address,
+                                     int write_access);
+#endif
 extern void         drm_vm_open(struct vm_area_struct *vma);
 extern void         drm_vm_close(struct vm_area_struct *vma);
 extern int          drm_mmap_dma(struct file *filp,
@@ -570,7 +626,8 @@ extern int       drm_unblock(struct inode *inode, struct file *filp,
                                 unsigned int cmd, unsigned long arg);
 extern int          drm_lock_take(__volatile__ unsigned int *lock,
                                   unsigned int context);
-extern int          drm_lock_transfer(__volatile__ unsigned int *lock,
+extern int          drm_lock_transfer(drm_device_t *dev,
+                                      __volatile__ unsigned int *lock,
                                       unsigned int context);
 extern int          drm_lock_free(drm_device_t *dev,
                                   __volatile__ unsigned int *lock,
index 55deade81c98ea7ebc171d1d5c1950f461aa0b01..47eacb833b9e4df8370a94d4dc59895274a6cd31 100644 (file)
@@ -1,6 +1,6 @@
 /* fops.c -- File operations for DRM -*- linux-c -*-
  * Created: Mon Jan  4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:31:46 1999 by faith@precisioninsight.com
+ * Revised: Fri Dec  3 10:26:26 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/fops.c,v 1.3 1999/08/20 15:36:45 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.3 1999/08/20 15:36:45 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.1 1999/09/25 14:37:59 dawes Exp $
  *
  */
 
@@ -75,8 +75,8 @@ int drm_flush(struct file *filp)
        drm_file_t    *priv   = filp->private_data;
        drm_device_t  *dev    = priv->dev;
 
-       DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d, f_count = %d\n",
-                 current->pid, dev->device, dev->open_count, atomic_read(&filp->f_count));
+       DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
+                 current->pid, dev->device, dev->open_count);
        return 0;
 }
 
@@ -91,6 +91,20 @@ int drm_release(struct inode *inode, struct file *filp)
        DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
                  current->pid, dev->device, dev->open_count);
 
+       if (_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
+           && dev->lock.pid == current->pid) {
+               DRM_ERROR("Process %d dead, freeing lock for context %d\n",
+                         current->pid,
+                         _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+               drm_lock_free(dev,
+                             &dev->lock.hw_lock->lock,
+                             _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+               
+                               /* FIXME: may require heavy-handed reset of
+                                   hardware at this point, possibly
+                                   processed via a callback to the X
+                                   server. */
+       }
        drm_reclaim_buffers(dev, priv->pid);
 
        drm_fasync(-1, filp, 0);
@@ -197,7 +211,12 @@ int drm_write_string(drm_device_t *dev, const char *s)
                send -= count;
        }
 
-       if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_OUT);
+#if LINUX_VERSION_CODE < 0x020315
+       if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
+#else
+                               /* Parameter added in 2.3.21 */
+       if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
+#endif
        DRM_DEBUG("waking\n");
        wake_up_interruptible(&dev->buf_readers);
        return 0;
index 66d828a716558f28ad2d840ea4da992345204f92..3b1592180e0f3c531b5db8c8a32df2f57af40ef4 100644 (file)
@@ -1,6 +1,6 @@
 /* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*-
  * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:31:45 1999 by faith@precisioninsight.com
+ * Revised: Thu Sep 16 12:55:37 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_dma.c,v 1.8 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.9 1999/09/16 16:56:18 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
  *
  */
 
index b4490e918d90899c4cbf64dd4dded9bece19be89..0ae7814ccad729c4f07cf9f880cdd934ca69c230 100644 (file)
@@ -1,6 +1,6 @@
 /* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*-
  * Created: Mon Jan  4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 22:48:11 1999 by faith@precisioninsight.com
+ * Revised: Tue Oct 12 08:51:36 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.17 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.1 1999/09/25 14:38:00 dawes Exp $
  *
  */
 
 #define EXPORT_SYMTAB
-#include <linux/config.h>
 #include "drmP.h"
 #include "gamma_drv.h"
 EXPORT_SYMBOL(gamma_init);
@@ -509,7 +508,7 @@ int gamma_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
        atomic_inc(&dev->total_unlocks);
        if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock))
                atomic_inc(&dev->total_contends);
-       drm_lock_transfer(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
+       drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
        gamma_dma_schedule(dev, 1);
        if (!dev->context_flag) {
                if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
index d91526a98f5ff9c1494e3838508cb62098e5a343..15e77dca9ee6481eea27c79f98e7ebc27ccdf376 100644 (file)
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/gamma_drv.h,v 1.4 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.4 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.1 1999/09/25 14:38:00 dawes Exp $
  * 
  */
 
index ecdf62e7cb460f6bebbb5c71c1cd0888ada1424e..340ba8f5a87ecca57ca65ba369b871207ac1ff12 100644 (file)
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/init.c,v 1.3 1999/08/20 15:07:01 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.3 1999/08/20 15:07:01 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
  *
  */
 
index e5bfd69531ae2490d87d07de1e75cb951cfa7b04..886ef661c59ba0993ef1e71c2370352b4df44950 100644 (file)
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/ioctl.c,v 1.3 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.3 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
  *
  */
 
index 062631f98ea22f93e20eb563427d15c0379f1d12..b84561f2e519a4ae3e7459f5cfa0eb1aae0dbde1 100644 (file)
@@ -1,6 +1,6 @@
 /* lists.c -- Buffer list handling routines -*- linux-c -*-
  * Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:01 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec  6 16:04:44 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/lists.c,v 1.3 1999/08/20 15:07:02 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.3 1999/08/20 15:07:02 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
  *
  */
 
@@ -130,11 +130,9 @@ int drm_freelist_destroy(drm_freelist_t *bl)
 
 int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
 {
-       unsigned int     old;
-       unsigned int     new;
-       char             failed;
+       drm_buf_t        *old, *prev;
        int              count = 0;
-       drm_device_dma_t *dma = dev->dma;
+       drm_device_dma_t *dma  = dev->dma;
 
        if (!dma) {
                DRM_ERROR("No DMA support\n");
@@ -155,15 +153,14 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
 #endif
        buf->list       = DRM_LIST_FREE;
        do {
-               old       = (unsigned long)bl->next;
-               buf->next = (void *)old;
-               new       = (unsigned long)buf;
-               _DRM_CAS(&bl->next, old, new, failed);
+               old       = bl->next;
+               bl->next  = old;
+               prev      = cmpxchg(&bl->next, old, buf);
                if (++count > DRM_LOOPING_LIMIT) {
                        DRM_ERROR("Looping\n");
                        return 1;
                }
-       } while (failed);
+       } while (prev != old);
        atomic_inc(&bl->count);
        if (atomic_read(&bl->count) > dma->buf_count) {
                DRM_ERROR("%d of %d buffers free after addition of %d\n",
@@ -180,9 +177,7 @@ int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf)
 
 static drm_buf_t *drm_freelist_try(drm_freelist_t *bl)
 {
-       unsigned int      old;
-       unsigned int      new;
-       char              failed;
+       drm_buf_t         *old, *new, *prev;
        drm_buf_t         *buf;
        int               count = 0;
 
@@ -190,20 +185,18 @@ static drm_buf_t *drm_freelist_try(drm_freelist_t *bl)
        
                                /* Get buffer */
        do {
-               old = (unsigned int)bl->next;
-               if (!old) {
-                       return NULL;
-               }
-               new = (unsigned long)bl->next->next;
-               _DRM_CAS(&bl->next, old, new, failed);
+               old = bl->next;
+               if (!old) return NULL;
+               new  = bl->next->next;
+               prev = cmpxchg(&bl->next, old, new);
                if (++count > DRM_LOOPING_LIMIT) {
                        DRM_ERROR("Looping\n");
                        return NULL;
                }
-       } while (failed);
+       } while (prev != old);
        atomic_dec(&bl->count);
        
-       buf       = (drm_buf_t *)old;
+       buf       = old;
        buf->next = NULL;
        buf->list = DRM_LIST_NONE;
        DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n",
index 03931acc3d5d17c2b12874046b5d194d9b406988..e8c1eff1017ccb14186de0746bdd17d4e4fcf6be 100644 (file)
@@ -1,6 +1,6 @@
 /* lock.c -- IOCTLs for locking -*- linux-c -*-
  * Created: Tue Feb  2 08:37:54 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 09:27:01 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec  6 16:04:44 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/lock.c,v 1.5 1999/08/30 13:05:00 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.5 1999/08/30 13:05:00 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.1 1999/09/25 14:38:01 dawes Exp $
  *
  */
 
@@ -48,17 +48,15 @@ int drm_unblock(struct inode *inode, struct file *filp, unsigned int cmd,
 
 int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
 {
-       unsigned int old;
-       unsigned int new;
-       char         failed;
+       unsigned int old, new, prev;
 
        DRM_DEBUG("%d attempts\n", context);
        do {
                old = *lock;
                if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT;
                else                      new = context | _DRM_LOCK_HELD;
-               _DRM_CAS(lock, old, new, failed);
-       } while (failed);
+               prev = cmpxchg(lock, old, new);
+       } while (prev != old);
        if (_DRM_LOCKING_CONTEXT(old) == context) {
                if (old & _DRM_LOCK_HELD) {
                        if (context != DRM_KERNEL_CONTEXT) {
@@ -80,17 +78,17 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
 
 /* This takes a lock forcibly and hands it to context. Should ONLY be used
    inside *_unlock to give lock to kernel before calling *_dma_schedule. */
-int drm_lock_transfer(__volatile__ unsigned int *lock, unsigned int context)
+int drm_lock_transfer(drm_device_t *dev,
+                     __volatile__ unsigned int *lock, unsigned int context)
 {
-       unsigned int old;
-       unsigned int new;
-       char         failed;
+       unsigned int old, new, prev;
 
+       dev->lock.pid = 0;
        do {
-               old = *lock;
-               new = context | _DRM_LOCK_HELD;
-               _DRM_CAS(lock, old, new, failed);
-       } while (failed);
+               old  = *lock;
+               new  = context | _DRM_LOCK_HELD;
+               prev = cmpxchg(lock, old, new);
+       } while (prev != old);
        DRM_DEBUG("%d => %d\n", _DRM_LOCKING_CONTEXT(old), context);
        return 1;
 }
@@ -98,23 +96,23 @@ int drm_lock_transfer(__volatile__ unsigned int *lock, unsigned int context)
 int drm_lock_free(drm_device_t *dev,
                  __volatile__ unsigned int *lock, unsigned int context)
 {
-       unsigned int old;
-       unsigned int new;
-       char         failed;
+       unsigned int old, new, prev;
+       pid_t        pid = dev->lock.pid;
 
        DRM_DEBUG("%d\n", context);
+       dev->lock.pid = 0;
        do {
-               old = *lock;
-               new = 0;
-               _DRM_CAS(lock, old, new, failed);
-       } while (failed);
+               old  = *lock;
+               new  = 0;
+               prev = cmpxchg(lock, old, new);
+       } while (prev != old);
        if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
-               DRM_ERROR("%d freed heavyweight lock held by %d\n",
+               DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n",
                          context,
-                         _DRM_LOCKING_CONTEXT(old));
+                         _DRM_LOCKING_CONTEXT(old),
+                         pid);
                return 1;
        }
-       dev->lock.pid = 0;
        wake_up_interruptible(&dev->lock.lock_queue);
        return 0;
 }
index f7b5335a5fc7c9cb00f80c8f754f5511ef265a49..af8d510b583c85975dadb474ca8ca92c77ed3999 100644 (file)
@@ -1,6 +1,6 @@
 /* memory.c -- Memory management wrappers for DRM -*- linux-c -*-
  * Created: Thu Feb  4 14:00:34 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 13:04:33 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec  6 10:28:18 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/memory.c,v 1.4 1999/08/20 20:00:53 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.4 1999/08/20 20:00:53 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
  *
  */
 
@@ -42,7 +42,7 @@ typedef struct drm_mem_stats {
 } drm_mem_stats_t;
 
 static spinlock_t        drm_mem_lock      = SPIN_LOCK_UNLOCKED;
-static unsigned long     drm_ram_available = 0;
+static unsigned long     drm_ram_available = 0; /* In pages */
 static unsigned long     drm_ram_used      = 0;
 static drm_mem_stats_t   drm_mem_stats[]   = {
        [DRM_MEM_DMA]      = { "dmabufs"  },
@@ -77,7 +77,12 @@ void drm_mem_init(void)
        }
        
        si_meminfo(&si);
+#if LINUX_VERSION_CODE < 0x020317
+                               /* Changed to page count in 2.3.23 */
+       drm_ram_available = si.totalram >> PAGE_SHIFT;
+#else
        drm_ram_available = si.totalram;
+#endif
        drm_ram_used      = 0;
 }
 
@@ -95,10 +100,11 @@ static int _drm_mem_info(char *buf, char **start, off_t offset, int len,
                       " |    outstanding  \n");
        DRM_PROC_PRINT("type       alloc freed fail     bytes      freed"
                       " | allocs      bytes\n\n");
-       DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu            |\n",
-                      "system", 0, 0, 0, drm_ram_available);
-       DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu            |\n",
-                      "locked", 0, 0, 0, drm_ram_used);
+       DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB         |\n",
+                      "system", 0, 0, 0,
+                      drm_ram_available << (PAGE_SHIFT - 10));
+       DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB         |\n",
+                      "locked", 0, 0, 0, drm_ram_used >> 10);
        DRM_PROC_PRINT("\n");
        for (pt = drm_mem_stats; pt->name; pt++) {
                DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n",
@@ -207,7 +213,8 @@ unsigned long drm_alloc_pages(int order, int area)
        unsigned int  sz;
        
        spin_lock(&drm_mem_lock);
-       if (drm_ram_used > +(DRM_RAM_PERCENT * drm_ram_available) / 100) {
+       if ((drm_ram_used >> PAGE_SHIFT)
+           > (DRM_RAM_PERCENT * drm_ram_available) / 100) {
                spin_unlock(&drm_mem_lock);
                return 0;
        }
index 40f70a8e99a1a506aeb66ebafa67f81f94911495..33a5b20e817a919d3d7669399a27acda29052311 100644 (file)
@@ -1,6 +1,6 @@
 /* proc.c -- /proc support for DRM -*- linux-c -*-
  * Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 11:31:48 1999 by faith@precisioninsight.com
+ * Revised: Fri Dec  3 09:44:16 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
  *
  */
 
@@ -79,41 +79,44 @@ int drm_proc_init(drm_device_t *dev)
        struct proc_dir_entry *ent;
        int                   i, j;
 
-       drm_root = proc_mkdir("video", NULL);
+       drm_root = create_proc_entry("graphics", S_IFDIR, NULL);
        if (!drm_root) {
-               DRM_ERROR("Cannot create /proc/video\n");
+               DRM_ERROR("Cannot create /proc/graphics\n");
                return -1;
        }
 
                                /* Instead of doing this search, we should
-                                  add some global support for /proc/video. */
+                                  add some global support for /proc/graphics. */
        for (i = 0; i < 8; i++) {
-               sprintf(drm_slot_name, "video/%d", i);
-               drm_dev_root = proc_mkdir(drm_slot_name, NULL);
+               sprintf(drm_slot_name, "graphics/%d", i);
+               drm_dev_root = create_proc_entry(drm_slot_name, S_IFDIR, NULL);
                if (!drm_dev_root) {
                        DRM_ERROR("Cannot create /proc/%s\n", drm_slot_name);
-                       remove_proc_entry("video", NULL);
+                       remove_proc_entry("graphics", NULL);
                }
                if (drm_dev_root->nlink == 2) break;
                drm_dev_root = NULL;
        }
        if (!drm_dev_root) {
-               DRM_ERROR("Cannot find slot in /proc/video\n");
+               DRM_ERROR("Cannot find slot in /proc/graphics\n");
                return -1;
        }
 
        for (i = 0; i < DRM_PROC_ENTRIES; i++) {
-               if (create_proc_read_entry(drm_proc_list[i].name,0,drm_dev_root,
-                                          drm_proc_list[i].f, dev))
-                       continue;
-
-               DRM_ERROR("Cannot create /proc/%s/%s\n",
-                         drm_slot_name, drm_proc_list[i].name);
-               for (j = 0; j < i; j++)
-                       remove_proc_entry(drm_proc_list[i].name, drm_dev_root);
-               remove_proc_entry(drm_slot_name, NULL);
-               remove_proc_entry("video", NULL);
-               return -1;
+               ent = create_proc_entry(drm_proc_list[i].name,
+                                       S_IFREG|S_IRUGO, drm_dev_root);
+               if (!ent) {
+                       DRM_ERROR("Cannot create /proc/%s/%s\n",
+                                 drm_slot_name, drm_proc_list[i].name);
+                       for (j = 0; j < i; j++)
+                               remove_proc_entry(drm_proc_list[i].name,
+                                                 drm_dev_root);
+                       remove_proc_entry(drm_slot_name, NULL);
+                       remove_proc_entry("graphics", NULL);
+                       return -1;
+               }
+               ent->read_proc = drm_proc_list[i].f;
+               ent->data      = dev;
        }
 
        return 0;
@@ -132,7 +135,7 @@ int drm_proc_cleanup(void)
                        }
                        remove_proc_entry(drm_slot_name, NULL);
                }
-               remove_proc_entry("video", NULL);
+               remove_proc_entry("graphics", NULL);
                remove_proc_entry(DRM_NAME, NULL);
        }
        drm_root = drm_dev_root = NULL;
@@ -379,7 +382,8 @@ static int _drm_vma_info(char *buf, char **start, off_t offset, int len,
                               vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
                               vma->vm_flags & VM_LOCKED   ? 'l' : '-',
                               vma->vm_flags & VM_IO       ? 'i' : '-',
-                              vma->vm_pgoff << PAGE_SHIFT );
+                              VM_OFFSET(vma));
+               
 #if defined(__i386__)
                pgprot = pgprot_val(vma->vm_page_prot);
                DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c",
diff --git a/drivers/char/drm/sigio.c b/drivers/char/drm/sigio.c
deleted file mode 100644 (file)
index 30df60f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/* sigio.c -- Support for SIGIO handler -*- linux-c -*-
- * Created: Thu Jun  3 15:39:18 1999 by faith@precisioninsight.com
- * Revised: Thu Jun  3 16:16:35 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.2 1999/06/14 21:11:29 faith Exp $
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/sigio.c,v 1.2 1999/06/14 12:02:11 dawes Exp $
- * 
- */
-
-
-#ifdef XFree86Server
-# include "X.h"
-# include "xf86.h"
-# include "xf86drm.h"
-# include "xf86_OSlib.h"
-#else
-# include <unistd.h>
-# include <signal.h>
-# include <fcntl.h>
-#endif
-
-/*
- * Linux libc5 defines FASYNC, but not O_ASYNC.  Don't know if it is
- * functional or not.
- */
-#if defined(FASYNC) && !defined(O_ASYNC)
-#  define O_ASYNC FASYNC
-#endif
-
-int
-xf86InstallSIGIOHandler(int fd, void (*f)(int))
-{
-    struct sigaction sa;
-    struct sigaction osa;
-
-    sigemptyset(&sa.sa_mask);
-    sigaddset(&sa.sa_mask, SIGIO);
-    sa.sa_flags   = 0;
-    sa.sa_handler = f;
-    sigaction(SIGIO, &sa, &osa);
-    fcntl(fd, F_SETOWN, getpid());
-    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC);
-    return 0;
-}
-
-int
-xf86RemoveSIGIOHandler(int fd)
-{
-    struct sigaction sa;
-    struct sigaction osa;
-
-    sigemptyset(&sa.sa_mask);
-    sigaddset(&sa.sa_mask, SIGIO);
-    sa.sa_flags   = 0;
-    sa.sa_handler = SIG_DFL;
-    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
-    sigaction(SIGIO, &sa, &osa);
-    return 0;
-}
diff --git a/drivers/char/drm/tdfx_context.c b/drivers/char/drm/tdfx_context.c
new file mode 100644 (file)
index 0000000..0c3c541
--- /dev/null
@@ -0,0 +1,206 @@
+/* tdfx_context.c -- IOCTLs for tdfx contexts -*- linux-c -*-
+ * Created: Thu Oct  7 10:50:22 1999 by faith@precisioninsight.com
+ * Revised: Sat Oct  9 23:39:56 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * 
+ * $PI$
+ * $XFree86$
+ *
+ */
+
+#include <linux/sched.h>
+
+#define __NO_VERSION__
+#include "drmP.h"
+#include "tdfx_drv.h"
+
+extern drm_ctx_t tdfx_res_ctx;
+
+static int tdfx_alloc_queue(drm_device_t *dev)
+{
+       static int context = 0;
+
+       return ++context;       /* Should this reuse contexts in the future? */
+}
+
+int tdfx_context_switch(drm_device_t *dev, int old, int new)
+{
+        char        buf[64];
+
+        atomic_inc(&dev->total_ctx);
+
+        if (test_and_set_bit(0, &dev->context_flag)) {
+                DRM_ERROR("Reentering -- FIXME\n");
+                return -EBUSY;
+        }
+
+#if DRM_DMA_HISTOGRAM
+        dev->ctx_start = get_cycles();
+#endif
+        
+        DRM_DEBUG("Context switch from %d to %d\n", old, new);
+
+        if (new == dev->last_context) {
+                clear_bit(0, &dev->context_flag);
+                return 0;
+        }
+        
+        if (drm_flags & DRM_FLAG_NOCTX) {
+                tdfx_context_switch_complete(dev, new);
+        } else {
+                sprintf(buf, "C %d %d\n", old, new);
+                drm_write_string(dev, buf);
+        }
+        
+        return 0;
+}
+
+int tdfx_context_switch_complete(drm_device_t *dev, int new)
+{
+        dev->last_context = new;  /* PRE/POST: This is the _only_ writer. */
+        dev->last_switch  = jiffies;
+        
+        if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+                DRM_ERROR("Lock isn't held after context switch\n");
+        }
+
+                               /* If a context switch is ever initiated
+                                   when the kernel holds the lock, release
+                                   that lock here. */
+#if DRM_DMA_HISTOGRAM
+        atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles()
+                                                      - dev->ctx_start)]);
+                   
+#endif
+        clear_bit(0, &dev->context_flag);
+        wake_up(&dev->context_wait);
+        
+        return 0;
+}
+
+
+int tdfx_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
+              unsigned long arg)
+{
+       drm_ctx_res_t   res;
+       drm_ctx_t       ctx;
+       int             i;
+
+       DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS);
+       copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT);
+       if (res.count >= DRM_RESERVED_CONTEXTS) {
+               memset(&ctx, 0, sizeof(ctx));
+               for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
+                       ctx.handle = i;
+                       copy_to_user_ret(&res.contexts[i],
+                                        &i,
+                                        sizeof(i),
+                                        -EFAULT);
+               }
+       }
+       res.count = DRM_RESERVED_CONTEXTS;
+       copy_to_user_ret((drm_ctx_res_t *)arg, &res, sizeof(res), -EFAULT);
+       return 0;
+}
+
+
+int tdfx_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
+              unsigned long arg)
+{
+       drm_file_t      *priv   = filp->private_data;
+       drm_device_t    *dev    = priv->dev;
+       drm_ctx_t       ctx;
+
+       copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+       if ((ctx.handle = tdfx_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) {
+                               /* Skip kernel's context and get a new one. */
+               ctx.handle = tdfx_alloc_queue(dev);
+       }
+       DRM_DEBUG("%d\n", ctx.handle);
+       copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT);
+       return 0;
+}
+
+int tdfx_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
+       unsigned long arg)
+{
+       drm_ctx_t ctx;
+
+       copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT);
+       if (ctx.flags==_DRM_CONTEXT_PRESERVED)
+               tdfx_res_ctx.handle=ctx.handle;
+       return 0;
+}
+
+int tdfx_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
+       unsigned long arg)
+{
+       drm_ctx_t ctx;
+
+       copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT);
+       /* This is 0, because we don't hanlde any context flags */
+       ctx.flags = 0;
+       copy_to_user_ret((drm_ctx_t*)arg, &ctx, sizeof(ctx), -EFAULT);
+       return 0;
+}
+
+int tdfx_switchctx(struct inode *inode, struct file *filp, unsigned int cmd,
+                  unsigned long arg)
+{
+       drm_file_t      *priv   = filp->private_data;
+       drm_device_t    *dev    = priv->dev;
+       drm_ctx_t       ctx;
+
+       copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+       DRM_DEBUG("%d\n", ctx.handle);
+       return tdfx_context_switch(dev, dev->last_context, ctx.handle);
+}
+
+int tdfx_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
+               unsigned long arg)
+{
+       drm_file_t      *priv   = filp->private_data;
+       drm_device_t    *dev    = priv->dev;
+       drm_ctx_t       ctx;
+
+       copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+       DRM_DEBUG("%d\n", ctx.handle);
+       tdfx_context_switch_complete(dev, ctx.handle);
+
+       return 0;
+}
+
+int tdfx_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
+              unsigned long arg)
+{
+       drm_ctx_t       ctx;
+
+       copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT);
+       DRM_DEBUG("%d\n", ctx.handle);
+                               /* This is currently a noop because we
+                                  don't reuse context values.  Perhaps we
+                                  should? */
+       
+       return 0;
+}
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c
new file mode 100644 (file)
index 0000000..a555e9b
--- /dev/null
@@ -0,0 +1,600 @@
+/* tdfx.c -- tdfx driver -*- linux-c -*-
+ * Created: Thu Oct  7 10:38:32 1999 by faith@precisioninsight.com
+ * Revised: Tue Oct 12 08:51:35 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * 
+ * $PI$
+ * $XFree86$
+ *
+ */
+
+#define EXPORT_SYMTAB
+#include "drmP.h"
+#include "tdfx_drv.h"
+EXPORT_SYMBOL(tdfx_init);
+EXPORT_SYMBOL(tdfx_cleanup);
+
+#define TDFX_NAME       "tdfx"
+#define TDFX_DESC       "tdfx"
+#define TDFX_DATE       "19991009"
+#define TDFX_MAJOR      0
+#define TDFX_MINOR      0
+#define TDFX_PATCHLEVEL  1
+
+static drm_device_t          tdfx_device;
+drm_ctx_t                    tdfx_res_ctx;
+
+static struct file_operations tdfx_fops = {
+       open:    tdfx_open,
+       flush:   drm_flush,
+       release: tdfx_release,
+       ioctl:   tdfx_ioctl,
+       mmap:    drm_mmap,
+       read:    drm_read,
+       fasync:  drm_fasync,
+};
+
+static struct miscdevice      tdfx_misc = {
+       minor: MISC_DYNAMIC_MINOR,
+       name:  TDFX_NAME,
+       fops:  &tdfx_fops,
+};
+
+static drm_ioctl_desc_t              tdfx_ioctls[] = {
+       [DRM_IOCTL_NR(DRM_IOCTL_VERSION)]    = { tdfx_version,    0, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique,   0, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)]  = { drm_getmagic,    0, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)]  = { drm_irq_busid,   0, 1 },
+
+       [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique,   1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)]      = { drm_block,       1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)]    = { drm_unblock,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic,   1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)]    = { drm_addmap,      1, 1 },
+       
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)]    = { tdfx_addctx,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)]     = { tdfx_rmctx,      1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)]    = { tdfx_modctx,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)]    = { tdfx_getctx,     1, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { tdfx_switchctx,  1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)]    = { tdfx_newctx,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)]    = { tdfx_resctx,     1, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)]   = { drm_adddraw,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)]    = { drm_rmdraw,      1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_LOCK)]       = { tdfx_lock,       1, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)]     = { tdfx_unlock,     1, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_FINISH)]     = { drm_finish,      1, 0 },
+};
+#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls)
+
+static char                  *tdfx = NULL;
+
+MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas.");
+MODULE_DESCRIPTION("tdfx");
+MODULE_PARM(tdfx, "s");
+
+static int tdfx_setup(drm_device_t *dev)
+{
+       int i;
+       
+       atomic_set(&dev->ioctl_count, 0);
+       atomic_set(&dev->vma_count, 0);
+       dev->buf_use      = 0;
+       atomic_set(&dev->buf_alloc, 0);
+
+       atomic_set(&dev->total_open, 0);
+       atomic_set(&dev->total_close, 0);
+       atomic_set(&dev->total_ioctl, 0);
+       atomic_set(&dev->total_irq, 0);
+       atomic_set(&dev->total_ctx, 0);
+       atomic_set(&dev->total_locks, 0);
+       atomic_set(&dev->total_unlocks, 0);
+       atomic_set(&dev->total_contends, 0);
+       atomic_set(&dev->total_sleeps, 0);
+
+       for (i = 0; i < DRM_HASH_SIZE; i++) {
+               dev->magiclist[i].head = NULL;
+               dev->magiclist[i].tail = NULL;
+       }
+       dev->maplist        = NULL;
+       dev->map_count      = 0;
+       dev->vmalist        = NULL;
+       dev->lock.hw_lock   = NULL;
+       init_waitqueue_head(&dev->lock.lock_queue);
+       dev->queue_count    = 0;
+       dev->queue_reserved = 0;
+       dev->queue_slots    = 0;
+       dev->queuelist      = NULL;
+       dev->irq            = 0;
+       dev->context_flag   = 0;
+       dev->interrupt_flag = 0;
+       dev->dma            = 0;
+       dev->dma_flag       = 0;
+       dev->last_context   = 0;
+       dev->last_switch    = 0;
+       dev->last_checked   = 0;
+       init_timer(&dev->timer);
+       init_waitqueue_head(&dev->context_wait);
+
+       dev->ctx_start      = 0;
+       dev->lck_start      = 0;
+       
+       dev->buf_rp       = dev->buf;
+       dev->buf_wp       = dev->buf;
+       dev->buf_end      = dev->buf + DRM_BSZ;
+       dev->buf_async    = NULL;
+       init_waitqueue_head(&dev->buf_readers);
+       init_waitqueue_head(&dev->buf_writers);
+
+       tdfx_res_ctx.handle=-1;
+                       
+       DRM_DEBUG("\n");
+                       
+       /* The kernel's context could be created here, but is now created
+          in drm_dma_enqueue.  This is more resource-efficient for
+          hardware that does not do DMA, but may mean that
+          drm_select_queue fails between the time the interrupt is
+          initialized and the time the queues are initialized. */
+                       
+       return 0;
+}
+
+
+static int tdfx_takedown(drm_device_t *dev)
+{
+       int               i;
+       drm_magic_entry_t *pt, *next;
+       drm_map_t         *map;
+       drm_vma_entry_t   *vma, *vma_next;
+
+       DRM_DEBUG("\n");
+
+       down(&dev->struct_sem);
+       del_timer(&dev->timer);
+       
+       if (dev->devname) {
+               drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER);
+               dev->devname = NULL;
+       }
+       
+       if (dev->unique) {
+               drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER);
+               dev->unique = NULL;
+               dev->unique_len = 0;
+       }
+                               /* Clear pid list */
+       for (i = 0; i < DRM_HASH_SIZE; i++) {
+               for (pt = dev->magiclist[i].head; pt; pt = next) {
+                       next = pt->next;
+                       drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
+               }
+               dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
+       }
+       
+                               /* Clear vma list (only built for debugging) */
+       if (dev->vmalist) {
+               for (vma = dev->vmalist; vma; vma = vma_next) {
+                       vma_next = vma->next;
+                       drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
+               }
+               dev->vmalist = NULL;
+       }
+       
+                               /* Clear map area and mtrr information */
+       if (dev->maplist) {
+               for (i = 0; i < dev->map_count; i++) {
+                       map = dev->maplist[i];
+                       switch (map->type) {
+                       case _DRM_REGISTERS:
+                       case _DRM_FRAME_BUFFER:
+#ifdef CONFIG_MTRR
+                               if (map->mtrr >= 0) {
+                                       int retcode;
+                                       retcode = mtrr_del(map->mtrr,
+                                                          map->offset,
+                                                          map->size);
+                                       DRM_DEBUG("mtrr_del = %d\n", retcode);
+                               }
+#endif
+                               drm_ioremapfree(map->handle, map->size);
+                               break;
+                       case _DRM_SHM:
+                               drm_free_pages((unsigned long)map->handle,
+                                              drm_order(map->size)
+                                              - PAGE_SHIFT,
+                                              DRM_MEM_SAREA);
+                               break;
+                       }
+                       drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+               }
+               drm_free(dev->maplist,
+                        dev->map_count * sizeof(*dev->maplist),
+                        DRM_MEM_MAPS);
+               dev->maplist   = NULL;
+               dev->map_count = 0;
+       }
+       
+       if (dev->lock.hw_lock) {
+               dev->lock.hw_lock    = NULL; /* SHM removed */
+               dev->lock.pid        = 0;
+               wake_up_interruptible(&dev->lock.lock_queue);
+       }
+       up(&dev->struct_sem);
+       
+       return 0;
+}
+
+/* tdfx_init is called via init_module at module load time, or via
+ * linux/init/main.c (this is not currently supported). */
+
+int tdfx_init(void)
+{
+       int                   retcode;
+       drm_device_t          *dev = &tdfx_device;
+
+       DRM_DEBUG("\n");
+
+       memset((void *)dev, 0, sizeof(*dev));
+       dev->count_lock   = SPIN_LOCK_UNLOCKED;
+       sema_init(&dev->struct_sem, 1);
+       
+#ifdef MODULE
+       drm_parse_options(tdfx);
+#endif
+
+       if ((retcode = misc_register(&tdfx_misc))) {
+               DRM_ERROR("Cannot register \"%s\"\n", TDFX_NAME);
+               return retcode;
+       }
+       dev->device = MKDEV(MISC_MAJOR, tdfx_misc.minor);
+       dev->name   = TDFX_NAME;
+
+       drm_mem_init();
+       drm_proc_init(dev);
+
+       DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+                TDFX_NAME,
+                TDFX_MAJOR,
+                TDFX_MINOR,
+                TDFX_PATCHLEVEL,
+                TDFX_DATE,
+                tdfx_misc.minor);
+       
+       return 0;
+}
+
+/* tdfx_cleanup is called via cleanup_module at module unload time. */
+
+void tdfx_cleanup(void)
+{
+       drm_device_t          *dev = &tdfx_device;
+
+       DRM_DEBUG("\n");
+       
+       drm_proc_cleanup();
+       if (misc_deregister(&tdfx_misc)) {
+               DRM_ERROR("Cannot unload module\n");
+       } else {
+               DRM_INFO("Module unloaded\n");
+       }
+       tdfx_takedown(dev);
+}
+
+int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
+                 unsigned long arg)
+{
+       drm_version_t version;
+       int           len;
+
+       copy_from_user_ret(&version,
+                          (drm_version_t *)arg,
+                          sizeof(version),
+                          -EFAULT);
+
+#define DRM_COPY(name,value)                                \
+       len = strlen(value);                                 \
+       if (len > name##_len) len = name##_len;              \
+       name##_len = strlen(value);                          \
+       if (len && name) {                                   \
+               copy_to_user_ret(name, value, len, -EFAULT); \
+       }
+
+       version.version_major      = TDFX_MAJOR;
+       version.version_minor      = TDFX_MINOR;
+       version.version_patchlevel = TDFX_PATCHLEVEL;
+
+       DRM_COPY(version.name, TDFX_NAME);
+       DRM_COPY(version.date, TDFX_DATE);
+       DRM_COPY(version.desc, TDFX_DESC);
+
+       copy_to_user_ret((drm_version_t *)arg,
+                        &version,
+                        sizeof(version),
+                        -EFAULT);
+       return 0;
+}
+
+int tdfx_open(struct inode *inode, struct file *filp)
+{
+       drm_device_t  *dev    = &tdfx_device;
+       int           retcode = 0;
+       
+       DRM_DEBUG("open_count = %d\n", dev->open_count);
+       if (!(retcode = drm_open_helper(inode, filp, dev))) {
+               MOD_INC_USE_COUNT;
+               atomic_inc(&dev->total_open);
+               spin_lock(&dev->count_lock);
+               if (!dev->open_count++) {
+                       spin_unlock(&dev->count_lock);
+                       return tdfx_setup(dev);
+               }
+               spin_unlock(&dev->count_lock);
+       }
+       return retcode;
+}
+
+int tdfx_release(struct inode *inode, struct file *filp)
+{
+       drm_file_t    *priv   = filp->private_data;
+       drm_device_t  *dev    = priv->dev;
+       int           retcode = 0;
+
+       DRM_DEBUG("open_count = %d\n", dev->open_count);
+       if (!(retcode = drm_release(inode, filp))) {
+               MOD_DEC_USE_COUNT;
+               atomic_inc(&dev->total_close);
+               spin_lock(&dev->count_lock);
+               if (!--dev->open_count) {
+                       if (atomic_read(&dev->ioctl_count) || dev->blocked) {
+                               DRM_ERROR("Device busy: %d %d\n",
+                                         atomic_read(&dev->ioctl_count),
+                                         dev->blocked);
+                               spin_unlock(&dev->count_lock);
+                               return -EBUSY;
+                       }
+                       spin_unlock(&dev->count_lock);
+                       return tdfx_takedown(dev);
+               }
+               spin_unlock(&dev->count_lock);
+       }
+       return retcode;
+}
+
+/* tdfx_ioctl is called whenever a process performs an ioctl on /dev/drm. */
+
+int tdfx_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
+               unsigned long arg)
+{
+       int              nr      = DRM_IOCTL_NR(cmd);
+       drm_file_t       *priv   = filp->private_data;
+       drm_device_t     *dev    = priv->dev;
+       int              retcode = 0;
+       drm_ioctl_desc_t *ioctl;
+       drm_ioctl_t      *func;
+
+       atomic_inc(&dev->ioctl_count);
+       atomic_inc(&dev->total_ioctl);
+       ++priv->ioctl_count;
+       
+       DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n",
+                 current->pid, cmd, nr, dev->device, priv->authenticated);
+
+       if (nr >= TDFX_IOCTL_COUNT) {
+               retcode = -EINVAL;
+       } else {
+               ioctl     = &tdfx_ioctls[nr];
+               func      = ioctl->func;
+
+               if (!func) {
+                       DRM_DEBUG("no function\n");
+                       retcode = -EINVAL;
+               } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN))
+                           || (ioctl->auth_needed && !priv->authenticated)) {
+                       retcode = -EACCES;
+               } else {
+                       retcode = (func)(inode, filp, cmd, arg);
+               }
+       }
+       
+       atomic_dec(&dev->ioctl_count);
+       return retcode;
+}
+
+int tdfx_lock(struct inode *inode, struct file *filp, unsigned int cmd,
+             unsigned long arg)
+{
+        drm_file_t        *priv   = filp->private_data;
+        drm_device_t      *dev    = priv->dev;
+        DECLARE_WAITQUEUE(entry, current);
+        int               ret   = 0;
+        drm_lock_t        lock;
+#if DRM_DMA_HISTOGRAM
+        cycles_t          start;
+
+        dev->lck_start = start = get_cycles();
+#endif
+
+        copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
+
+        if (lock.context == DRM_KERNEL_CONTEXT) {
+                DRM_ERROR("Process %d using kernel context %d\n",
+                          current->pid, lock.context);
+                return -EINVAL;
+        }
+
+        DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+                  lock.context, current->pid, dev->lock.hw_lock->lock,
+                  lock.flags);
+
+#if 0
+                               /* dev->queue_count == 0 right now for
+                                   tdfx.  FIXME? */
+        if (lock.context < 0 || lock.context >= dev->queue_count)
+                return -EINVAL;
+#endif
+        
+        if (!ret) {
+#if 0
+                if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)
+                    != lock.context) {
+                        long j = jiffies - dev->lock.lock_time;
+
+                        if (lock.context == tdfx_res_ctx.handle &&
+                               j >= 0 && j < DRM_LOCK_SLICE) {
+                                /* Can't take lock if we just had it and
+                                   there is contention. */
+                                DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n",
+                                       lock.context, current->pid, j, 
+                                       dev->lock.lock_time, jiffies);
+                                current->state = TASK_INTERRUPTIBLE;
+                               current->policy |= SCHED_YIELD;
+                                schedule_timeout(DRM_LOCK_SLICE-j);
+                               DRM_DEBUG("jiffies=%d\n", jiffies);
+                        }
+                }
+#endif
+                add_wait_queue(&dev->lock.lock_queue, &entry);
+                for (;;) {
+                        if (!dev->lock.hw_lock) {
+                                /* Device has been unregistered */
+                                ret = -EINTR;
+                                break;
+                        }
+                        if (drm_lock_take(&dev->lock.hw_lock->lock,
+                                          lock.context)) {
+                                dev->lock.pid       = current->pid;
+                                dev->lock.lock_time = jiffies;
+                                atomic_inc(&dev->total_locks);
+                                break;  /* Got lock */
+                        }
+                        
+                                /* Contention */
+                        atomic_inc(&dev->total_sleeps);
+                        current->state = TASK_INTERRUPTIBLE;
+                       current->policy |= SCHED_YIELD;
+                        schedule();
+                        if (signal_pending(current)) {
+                                ret = -ERESTARTSYS;
+                                break;
+                        }
+                }
+                current->state = TASK_RUNNING;
+                remove_wait_queue(&dev->lock.lock_queue, &entry);
+        }
+
+#if 0
+       if (!ret && dev->last_context != lock.context &&
+               lock.context != tdfx_res_ctx.handle &&
+               dev->last_context != tdfx_res_ctx.handle) {
+               add_wait_queue(&dev->context_wait, &entry);
+               current->state = TASK_INTERRUPTIBLE;
+                /* PRE: dev->last_context != lock.context */
+               tdfx_context_switch(dev, dev->last_context, lock.context);
+               /* POST: we will wait for the context
+                   switch and will dispatch on a later call
+                   when dev->last_context == lock.context
+                   NOTE WE HOLD THE LOCK THROUGHOUT THIS
+                   TIME! */
+               current->policy |= SCHED_YIELD;
+               schedule();
+               current->state = TASK_RUNNING;
+               remove_wait_queue(&dev->context_wait, &entry);
+               if (signal_pending(current)) {
+                       ret = -EINTR;
+               } else if (dev->last_context != lock.context) {
+                       DRM_ERROR("Context mismatch: %d %d\n",
+                               dev->last_context, lock.context);
+               }
+       }
+#endif
+
+        if (!ret) {
+                if (lock.flags & _DRM_LOCK_READY) {
+                               /* Wait for space in DMA/FIFO */
+               }
+                if (lock.flags & _DRM_LOCK_QUIESCENT) {
+                               /* Make hardware quiescent */
+#if 0
+                        tdfx_quiescent(dev);
+#endif
+               }
+        }
+        DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
+
+#if DRM_DMA_HISTOGRAM
+        atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]);
+#endif
+        
+        return ret;
+}
+
+
+int tdfx_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
+                unsigned long arg)
+{
+       drm_file_t        *priv   = filp->private_data;
+       drm_device_t      *dev    = priv->dev;
+       drm_lock_t        lock;
+
+       copy_from_user_ret(&lock, (drm_lock_t *)arg, sizeof(lock), -EFAULT);
+       
+       if (lock.context == DRM_KERNEL_CONTEXT) {
+               DRM_ERROR("Process %d using kernel context %d\n",
+                         current->pid, lock.context);
+               return -EINVAL;
+       }
+
+       DRM_DEBUG("%d frees lock (%d holds)\n",
+                 lock.context,
+                 _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+       atomic_inc(&dev->total_unlocks);
+       if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock))
+               atomic_inc(&dev->total_contends);
+       drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT);
+                               /* FIXME: Try to send data to card here */
+       if (!dev->context_flag) {
+               if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+                                 DRM_KERNEL_CONTEXT)) {
+                       DRM_ERROR("\n");
+               }
+       }
+       
+       return 0;
+}
+
+module_init(tdfx_init);
+module_exit(tdfx_cleanup);
+
+/*
+ * tdfx_setup is called by the kernel to parse command-line options passed
+ * via the boot-loader (e.g., LILO).  It calls the insmod option routine,
+ * drm_parse_drm.
+ */
+static int __init tdfx_options(char *str)
+{
+       drm_parse_options(str);
+       return 1;
+}
+
+__setup("tdfx=", tdfx_options);
diff --git a/drivers/char/drm/tdfx_drv.h b/drivers/char/drm/tdfx_drv.h
new file mode 100644 (file)
index 0000000..bdff05e
--- /dev/null
@@ -0,0 +1,68 @@
+/* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*-
+ * Created: Thu Oct  7 10:40:04 1999 by faith@precisioninsight.com
+ * Revised: Sat Oct  9 23:38:19 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * 
+ * $PI$
+ * $XFree86$
+ * 
+ */
+
+#ifndef _TDFX_DRV_H_
+#define _TDFX_DRV_H_
+
+                               /* tdfx_drv.c */
+extern int  tdfx_init(void);
+extern void tdfx_cleanup(void);
+extern int  tdfx_version(struct inode *inode, struct file *filp,
+                         unsigned int cmd, unsigned long arg);
+extern int  tdfx_open(struct inode *inode, struct file *filp);
+extern int  tdfx_release(struct inode *inode, struct file *filp);
+extern int  tdfx_ioctl(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg);
+extern int  tdfx_lock(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg);
+extern int  tdfx_unlock(struct inode *inode, struct file *filp,
+                        unsigned int cmd, unsigned long arg);
+
+                               /* tdfx_context.c */
+
+extern int  tdfx_resctx(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg);
+extern int  tdfx_addctx(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg);
+extern int  tdfx_modctx(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg);
+extern int  tdfx_getctx(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg);
+extern int  tdfx_switchctx(struct inode *inode, struct file *filp,
+                          unsigned int cmd, unsigned long arg);
+extern int  tdfx_newctx(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg);
+extern int  tdfx_rmctx(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg);
+
+extern int  tdfx_context_switch(drm_device_t *dev, int old, int new);
+extern int  tdfx_context_switch_complete(drm_device_t *dev, int new);
+#endif
index d29594d1fcf2c15a2352f31882bb9308333ea06c..d649a6e75d80abc22f40e2ec91a0bb8c9b5ac809 100644 (file)
@@ -1,6 +1,6 @@
 /* vm.c -- Memory mapping for DRM -*- linux-c -*-
  * Created: Mon Jan  4 08:58:31 1999 by faith@precisioninsight.com
- * Revised: Fri Aug 20 22:48:11 1999 by faith@precisioninsight.com
+ * Revised: Mon Dec  6 16:54:35 1999 by faith@precisioninsight.com
  *
  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -24,8 +24,8 @@
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  * 
- * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/generic/vm.c,v 1.7 1999/08/21 02:48:34 faith Exp $
- * $XFree86$
+ * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.7 1999/08/21 02:48:34 faith Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.1 1999/09/25 14:38:02 dawes Exp $
  *
  */
 
@@ -50,18 +50,32 @@ struct vm_operations_struct   drm_vm_dma_ops = {
        close:   drm_vm_close,
 };
 
+#if LINUX_VERSION_CODE < 0x020317
 unsigned long drm_vm_nopage(struct vm_area_struct *vma,
                            unsigned long address,
                            int write_access)
+#else
+                               /* Return type changed in 2.3.23 */
+struct page *drm_vm_nopage(struct vm_area_struct *vma,
+                          unsigned long address,
+                          int write_access)
+#endif
 {
        DRM_DEBUG("0x%08lx, %d\n", address, write_access);
 
-       return 0;               /* Disallow mremap */
+       return NOPAGE_SIGBUS;           /* Disallow mremap */
 }
 
+#if LINUX_VERSION_CODE < 0x020317
 unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
                                unsigned long address,
                                int write_access)
+#else
+                               /* Return type changed in 2.3.23 */
+struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
+                              unsigned long address,
+                              int write_access)
+#endif
 {
        drm_file_t       *priv   = vma->vm_file->private_data;
        drm_device_t     *dev    = priv->dev;
@@ -69,8 +83,8 @@ unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
        unsigned long    offset;
        unsigned long    page;
 
-       if (address > vma->vm_end) return 0; /* Disallow mremap */
-       if (!dev->lock.hw_lock)    return 0; /* Nothing allocated */
+       if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
+       if (!dev->lock.hw_lock)    return NOPAGE_OOM;  /* Nothing allocated */
 
        offset   = address - vma->vm_start;
        page     = offset >> PAGE_SHIFT;
@@ -78,12 +92,23 @@ unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma,
        atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
 
        DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
+#if LINUX_VERSION_CODE < 0x020317
        return physical;
+#else
+       return mem_map + MAP_NR(physical);
+#endif
 }
 
+#if LINUX_VERSION_CODE < 0x020317
 unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
                                unsigned long address,
                                int write_access)
+#else
+                               /* Return type changed in 2.3.23 */
+struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
+                              unsigned long address,
+                              int write_access)
+#endif
 {
        drm_file_t       *priv   = vma->vm_file->private_data;
        drm_device_t     *dev    = priv->dev;
@@ -92,17 +117,21 @@ unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma,
        unsigned long    offset;
        unsigned long    page;
 
-       if (!dma)                  return 0; /* Error */
-       if (address > vma->vm_end) return 0; /* Disallow mremap */
-       if (!dma->pagelist)        return 0; /* Nothing allocated */
+       if (!dma)                  return NOPAGE_SIGBUS; /* Error */
+       if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
+       if (!dma->pagelist)        return NOPAGE_OOM ; /* Nothing allocated */
 
-       offset   = address - vma->vm_start; /* vm_pgoff should be 0 */
+       offset   = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
        page     = offset >> PAGE_SHIFT;
        physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
        atomic_inc(&mem_map[MAP_NR(physical)].count); /* Dec. by kernel */
 
        DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
+#if LINUX_VERSION_CODE < 0x020317
        return physical;
+#else
+       return mem_map + MAP_NR(physical);
+#endif
 }
 
 void drm_vm_open(struct vm_area_struct *vma)
@@ -168,8 +197,8 @@ int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
        drm_device_dma_t *dma    = dev->dma;
        unsigned long    length  = vma->vm_end - vma->vm_start;
        
-       DRM_DEBUG("start = 0x%lx, end = 0x%lx, pgoff = 0x%lx\n",
-                 vma->vm_start, vma->vm_end, vma->vm_pgoff);
+       DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
+                 vma->vm_start, vma->vm_end, VM_OFFSET(vma));
 
                                /* Length must match exact page count */
        if ((length >> PAGE_SHIFT) != dma->page_count) return -EINVAL;
@@ -192,17 +221,13 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
        drm_file_t      *priv   = filp->private_data;
        drm_device_t    *dev    = priv->dev;
        drm_map_t       *map    = NULL;
-       unsigned long   off;
        int             i;
        
        DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
-                 vma->vm_start, vma->vm_end, vma->vm_pgoff);
+                 vma->vm_start, vma->vm_end, VM_OFFSET(vma));
 
-       if (!vma->vm_pgoff) return drm_mmap_dma(filp, vma);
-       if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))       /* overflow? */
-               return -EINVAL;
+       if (!VM_OFFSET(vma)) return drm_mmap_dma(filp, vma);
 
-       off = vma->vm_pgoff << PAGE_SHIFT;
                                /* A sequential search of a linked list is
                                   fine here because: 1) there will only be
                                   about 5-10 entries in the list and, 2) a
@@ -212,7 +237,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
                                   bit longer. */
        for (i = 0; i < dev->map_count; i++) {
                map = dev->maplist[i];
-               if (map->offset == off) break;
+               if (map->offset == VM_OFFSET(vma)) break;
        }
        
        if (i >= dev->map_count) return -EINVAL;
@@ -226,7 +251,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
        switch (map->type) {
        case _DRM_FRAME_BUFFER:
        case _DRM_REGISTERS:
-               if (off >= __pa(high_memory)) {
+               if (VM_OFFSET(vma) >= __pa(high_memory)) {
 #if defined(__i386__)
                        if (boot_cpu_data.x86 > 3) {
                                pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
@@ -236,7 +261,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
                        vma->vm_flags |= VM_IO; /* not in core dump */
                }
                if (remap_page_range(vma->vm_start,
-                                    off,
+                                    VM_OFFSET(vma),
                                     vma->vm_end - vma->vm_start,
                                     vma->vm_page_prot))
                                return -EAGAIN;
@@ -253,7 +278,15 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
        }
        vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
        if (map->flags & _DRM_READ_ONLY) {
+#if defined(__i386__)
                pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
+#else
+                               /* Ye gads this is ugly.  With more thought
+                                   we could move this up higher and use
+                                   `protection_map' instead.  */
+               vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect(
+                       __pte(pgprot_val(vma->vm_page_prot)))));
+#endif
        }
 
        
index 810decada90f0ffe6ba4a528e32a71e30e9d0d2f..3e371744e4128381576582ee54d0cecf08751411 100644 (file)
@@ -1,19 +1,34 @@
 #
-# Joystick lowlevel driver configuration
+# Joystick driver
 #
 
-dep_tristate '  Classic PC analog joysticks and gamepads' CONFIG_JOY_ANALOG $CONFIG_JOYSTICK
-dep_tristate '  FPGaming and MadCatz A3D controllers' CONFIG_JOY_ASSASIN $CONFIG_JOYSTICK
-dep_tristate '  Gravis GrIP joysticks and gamepads' CONFIG_JOY_GRAVIS $CONFIG_JOYSTICK
-dep_tristate '  Logitech Digital joysticks and gamepads' CONFIG_JOY_LOGITECH $CONFIG_JOYSTICK
-dep_tristate '  Microsoft SideWinder, Genius Digital joysticks and gamepads' CONFIG_JOY_SIDEWINDER $CONFIG_JOYSTICK
-dep_tristate '  ThrustMaster DirectConnect joysticks and gamepads' CONFIG_JOY_THRUSTMASTER $CONFIG_JOYSTICK
-dep_tristate '  PDPI Lightning 4 gamecards' CONFIG_JOY_LIGHTNING $CONFIG_JOYSTICK
-if [ "$CONFIG_PARPORT" != "n" ]; then
-   dep_tristate '  NES, SNES, PSX, Multisystem joysticks and gamepads' CONFIG_JOY_CONSOLE $CONFIG_JOYSTICK $CONFIG_PARPORT
-   dep_tristate '  Sega, Multisystem joysticks and gamepads' CONFIG_JOY_DB9 $CONFIG_JOYSTICK $CONFIG_PARPORT
-   dep_tristate '  TurboGraFX Multisystem joystick interface' CONFIG_JOY_TURBOGRAFX $CONFIG_JOYSTICK $CONFIG_PARPORT
-fi  
-if [ "$CONFIG_AMIGA" = "y" ]; then
-   dep_tristate '  Amiga joysticks' CONFIG_JOY_AMIGA $CONFIG_JOYSTICK
+mainmenu_option next_comment
+comment 'Joysticks'
+
+tristate 'Joystick support' CONFIG_JOYSTICK
+
+if [ "$CONFIG_JOYSTICK" != "n" ]; then
+   dep_tristate '  Classic PC analog' CONFIG_JOY_ANALOG $CONFIG_JOYSTICK
+   dep_tristate '  FPGaming and MadCatz A3D' CONFIG_JOY_ASSASSIN $CONFIG_JOYSTICK
+   dep_tristate '  Gravis GrIP' CONFIG_JOY_GRAVIS $CONFIG_JOYSTICK
+   dep_tristate '  Logitech ADI' CONFIG_JOY_LOGITECH $CONFIG_JOYSTICK
+   dep_tristate '  Microsoft SideWinder' CONFIG_JOY_SIDEWINDER $CONFIG_JOYSTICK
+   dep_tristate '  ThrustMaster DirectConnect' CONFIG_JOY_THRUSTMASTER $CONFIG_JOYSTICK
+   dep_tristate '  Creative Labs Blaster' CONFIG_JOY_CREATIVE $CONFIG_JOYSTICK
+   dep_tristate '  PDPI Lightning 4 card' CONFIG_JOY_LIGHTNING $CONFIG_JOYSTICK
+   dep_tristate '  Trident 4DWave and Aureal Vortex gameport' CONFIG_JOY_PCI $CONFIG_JOYSTICK
+   dep_tristate '  Magellan and Space Mouse' CONFIG_JOY_MAGELLAN $CONFIG_JOYSTICK
+   dep_tristate '  SpaceTec SpaceOrb 360 and SpaceBall Avenger' CONFIG_JOY_SPACEORB $CONFIG_JOYSTICK
+   dep_tristate '  SpaceTec SpaceBall 4000 FLX' CONFIG_JOY_SPACEBALL $CONFIG_JOYSTICK
+   dep_tristate '  Logitech WingMan Warrior' CONFIG_JOY_WARRIOR $CONFIG_JOYSTICK
+   if [ "$CONFIG_PARPORT" != "n" ]; then
+      dep_tristate '  NES, SNES, PSX, N64, Multi' CONFIG_JOY_CONSOLE $CONFIG_JOYSTICK $CONFIG_PARPORT
+      dep_tristate '  Sega, Multi' CONFIG_JOY_DB9 $CONFIG_JOYSTICK $CONFIG_PARPORT
+      dep_tristate '  TurboGraFX interface' CONFIG_JOY_TURBOGRAFX $CONFIG_JOYSTICK $CONFIG_PARPORT
+   fi  
+   if [ "$CONFIG_AMIGA" = "y" ]; then
+      dep_tristate '  Amiga joysticks' CONFIG_JOY_AMIGA $CONFIG_JOYSTICK
+   fi
 fi
+
+endmenu
index 3339fc83f436bc4e7e815f0e8b51d572fbd21a13..2bb5870b0d93a8f93b05d3405d8c3939e404843b 100644 (file)
@@ -1,23 +1,18 @@
 #
 # Makefile for the joystick drivers.
 #
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now inherited from the
-# parent makes..
-#
 
 O_TARGET := js.o
+OX_OBJS  :=
 O_OBJS   :=
+MX_OBJS  :=
 M_OBJS   :=
 
 ifeq ($(CONFIG_JOYSTICK),y)
-O_OBJS += joystick.o
+OX_OBJS += joystick.o
 else
   ifeq ($(CONFIG_JOYSTICK),m)
-  M_OBJS += joystick.o
+  MX_OBJS += joystick.o
   endif
 endif
 
@@ -37,11 +32,11 @@ else
   endif
 endif
 
-ifeq ($(CONFIG_JOY_ASSASIN),y)
-O_OBJS += joy-assasin.o
+ifeq ($(CONFIG_JOY_ASSASSIN),y)
+O_OBJS += joy-assassin.o
 else
-  ifeq ($(CONFIG_JOY_ASSASIN),m)
-  M_OBJS += joy-assasin.o
+  ifeq ($(CONFIG_JOY_ASSASSIN),m)
+  M_OBJS += joy-assassin.o
   endif
 endif
 
@@ -53,6 +48,14 @@ else
   endif
 endif
 
+ifeq ($(CONFIG_JOY_CREATIVE),y)
+O_OBJS += joy-creative.o
+else
+  ifeq ($(CONFIG_JOY_CREATIVE),m)
+  M_OBJS += joy-creative.o
+  endif
+endif
+
 ifeq ($(CONFIG_JOY_DB9),y)
 O_OBJS += joy-db9.o
 else
@@ -85,6 +88,22 @@ else
   endif
 endif
 
+ifeq ($(CONFIG_JOY_MAGELLAN),y)
+O_OBJS += joy-magellan.o
+else
+  ifeq ($(CONFIG_JOY_MAGELLAN),m)
+  M_OBJS += joy-magellan.o
+  endif
+endif
+
+ifeq ($(CONFIG_JOY_PCI),y)
+O_OBJS += joy-pci.o
+else
+  ifeq ($(CONFIG_JOY_PCI),m)
+  M_OBJS += joy-pci.o
+  endif
+endif
+
 ifeq ($(CONFIG_JOY_SIDEWINDER),y)
 O_OBJS += joy-sidewinder.o
 else
@@ -93,6 +112,22 @@ else
   endif
 endif
 
+ifeq ($(CONFIG_JOY_SPACEORB),y)
+O_OBJS += joy-spaceorb.o
+else
+  ifeq ($(CONFIG_JOY_SPACEORB),m)
+  M_OBJS += joy-spaceorb.o
+  endif
+endif
+
+ifeq ($(CONFIG_JOY_SPACEBALL),y)
+O_OBJS += joy-spaceball.o
+else
+  ifeq ($(CONFIG_JOY_SPACEBALL),m)
+  M_OBJS += joy-spaceball.o
+  endif
+endif
+
 ifeq ($(CONFIG_JOY_THRUSTMASTER),y)
 O_OBJS += joy-thrustmaster.o
 else 
@@ -109,4 +144,12 @@ else
   endif
 endif
 
+ifeq ($(CONFIG_JOY_WARRIOR),y)
+O_OBJS += joy-warrior.o
+else
+  ifeq ($(CONFIG_JOY_WARRIOR),m)
+  M_OBJS += joy-warrior.o
+  endif
+endif
+
 include $(TOPDIR)/Rules.make
index 9180250402e7071f90aacc833f97b1e5f9be5cc3..5e3198f7024207992162617002a152b8021f5f07 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-amiga.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <asm/amigahw.h>
+#include <linux/init.h>
 
 static struct js_port* js_am_port __initdata = NULL;
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_PARM(js_am, "1-2i");
 
-static int js_am[]={0,0};
+static int __initdata js_am[] = { 0, 0 };
 
 /*
  * js_am_read() reads and Amiga joystick data.
@@ -69,7 +72,7 @@ static int js_am_read(void *info, int **axes, int **buttons)
 
        axes[0][0] = ((data >> 1) & 1) - ((data >> 9) & 1);
        data = ~(data ^ (data << 1));
-       axes[0][0] = ((data >> 1) & 1) - ((data >> 9) & 1);
+       axes[0][1] = ((data >> 1) & 1) - ((data >> 9) & 1);
 
        return 0;
 }
@@ -114,11 +117,14 @@ static void __init js_am_init_corr(struct js_corr **corr)
 }
 
 #ifndef MODULE
-void __init js_am_setup(char *str, int *ints)
+int __init js_am_setup(SETUP_PARAM)
 {
        int i;
+       SETUP_PARSE(2);
        for (i = 0; i <= ints[0] && i < 2; i++) js_am[i] = ints[i+1];
+       return 1;
 }
+__setup("js_am=", js_am_setup);
 #endif
 
 #ifdef MODULE
@@ -148,8 +154,8 @@ int __init js_am_init(void)
 #ifdef MODULE
 void cleanup_module(void)
 {
-       while (js_am_port != NULL) {
-               if (js_am_port->devs[0] != NULL)
+       while (js_am_port) {
+               if (js_am_port->devs[0])
                        js_unregister_device(js_am_port->devs[0]);
                js_am_port = js_unregister_port(js_am_port);
        }
index 7c1c9719d6a266a6f5c8aeadb1d3276ca7d84102..a4a7b9849c4ab3bfbeded298613ccca3826bf4bf 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-analog.c  Version 1.2
  *
- *  Copyright (c) 1996-1998 Vojtech Pavlik
+ *  Copyright (c) 1996-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
  */
 
 #include <asm/io.h>
+#include <asm/param.h>
+#include <asm/system.h>
+#include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/joystick.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/sched.h>
 #include <linux/string.h>
+#include <linux/init.h>
 
-#define JS_AN_MAX_TIME 3000
+#define JS_AN_MAX_TIME         3000    /* 3 ms */
+#define JS_AN_LOOP_TIME                2000    /* 2 t */
 
 static int js_an_port_list[] __initdata = {0x201, 0};
 static struct js_port* js_an_port __initdata = NULL;
@@ -46,53 +54,102 @@ static struct js_port* js_an_port __initdata = NULL;
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_PARM(js_an, "2-24i");
 
-static int js_an[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0};
+static int __initdata js_an[] = { -1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0 };
 
 #include "joy-analog.h"
 
+struct js_ax_info {
+        int io;
+       int speed;
+       int loop;
+       int timeout;
+        struct js_an_info an;
+};
+
+/*
+ * Time macros.
+ */
+
+#ifdef __i386__
+#ifdef CONFIG_X86_TSC
+#define GET_TIME(x)    __asm__ __volatile__ ( "rdtsc" : "=a" (x) : : "dx" )
+#define DELTA(x,y)     ((x)-(y))
+#define TIME_NAME "TSC"
+#else
+#define GET_TIME(x)    do { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } while (0)
+#define DELTA(x,y)     ((y)-(x)+((y)<(x)?1193180L/HZ:0))
+#define TIME_NAME "PIT"
+#endif
+#elif __alpha__
+#define GET_TIME(x)    __asm__ __volatile__ ( "rpcc %0" : "=r" (x) )
+#define DELTA(x,y)     ((x)-(y))
+#define TIME_NAME "PCC"
+#endif
+
+#ifndef GET_TIME
+#define FAKE_TIME
+static unsigned long js_an_faketime = 0;
+#define GET_TIME(x)     do { x = js_an_faketime++; } while(0)
+#define DELTA(x,y)     ((x)-(y))
+#define TIME_NAME "Unreliable"
+#endif
+
 /*
  * js_an_read() reads analog joystick data.
  */
 
 static int js_an_read(void *xinfo, int **axes, int **buttons)
 {
-       struct js_an_info *info = xinfo;
+       struct js_ax_info *info = xinfo;
+       struct js_an_info *an = &info->an;
+       int io = info->io;
+       unsigned long flags;
        unsigned char buf[4];
-       int time[4];
-       unsigned char u, v, a;
-       unsigned int t, t1;
+       unsigned int time[4];
+       unsigned char u, v, w;
+       unsigned int p, q, r, s, t;
        int i, j;
-       int timeout;
-       int io = info->io;
 
-       timeout = (JS_AN_MAX_TIME * js_time_speed_a) >> 10;
-
-       info->buttons = (~inb(io) & JS_AN_BUTTONS_STD) >> 4;
+       an->buttons = ~inb(io) >> 4;
 
        i = 0;
-       u = a = ((info->mask[0] | info->mask[1]) & JS_AN_AXES_STD) | (info->extensions & JS_AN_HAT_FCS)
-             | ((info->extensions & JS_AN_BUTTONS_PXY_XY) >> 2) | ((info->extensions & JS_AN_BUTTONS_PXY_UV) >> 4);
-
+       w = ((an->mask[0] | an->mask[1]) & JS_AN_AXES_STD) | (an->extensions & JS_AN_HAT_FCS)
+         | ((an->extensions & JS_AN_BUTTONS_PXY_XY) >> 2) | ((an->extensions & JS_AN_BUTTONS_PXY_UV) >> 4);
+       p = info->loop;
+       q = info->timeout;
+       
+       __save_flags(flags);
+       __cli();
        outb(0xff,io);
-       t = js_get_time_a();
+       GET_TIME(r);
+       __restore_flags(flags);
+       t = r;
+       v = w;
        do {
-               v = inb(io) & a;
-               t1 = js_get_time_a();
-               if (u ^ v) {
-                       time[i] = js_delta_a(t1,t);
+               s = t;
+               u = v;
+               __cli();
+               v = inb(io) & w;
+               GET_TIME(t);
+               __restore_flags(flags);
+               if ((u ^ v) && (DELTA(t,s) < p)) {
+                       time[i] = t;
                        buf[i] = u ^ v;
-                       u = v;
                        i++;
                }
-       } while (v && js_delta_a(t1,t) < timeout);
+       } while (v && (i < 4) && (DELTA(t,r) < q));
 
-       for (--i; i >= 0; i--)
+       v <<= 4;
+
+       for (--i; i >= 0; i--) {
+               v |= buf[i];
                for (j = 0; j < 4; j++)
-                       if (buf[i] & (1 << j)) info->axes[j] = (time[i] << 10) / js_time_speed_a;
+                       if (buf[i] & (1 << j)) an->axes[j] = (DELTA(time[i],r) << 10) / info->speed;
+       }
 
-       js_an_decode(info, axes, buttons);
+       js_an_decode(an, axes, buttons);
 
-       return 0;
+       return -(v != w);
 }
 
 /*
@@ -115,13 +172,54 @@ static int js_an_close(struct js_dev *jd)
        return 0;
 }
 
+/*
+ * js_an_calibrate_timer() calibrates the timer and computes loop
+ * and timeout values for a joystick port.
+ */
+
+static void __init js_an_calibrate_timer(struct js_ax_info *info)
+{
+       unsigned int i, t, tx, t1, t2, t3;
+       unsigned long flags;
+       int io = info->io;
+
+       save_flags(flags);
+       cli();
+       GET_TIME(t1);
+#ifdef FAKE_TIME
+       js_an_faketime += 830;
+#endif
+       udelay(1000);
+       GET_TIME(t2);
+       GET_TIME(t3);
+       restore_flags(flags);
+
+       info->speed = DELTA(t2, t1) - DELTA(t3, t2);
+
+       tx = 1 << 30;
+
+       for(i = 0; i < 50; i++) {
+               save_flags(flags);
+               cli();
+               GET_TIME(t1);
+               for(t = 0; t < 50; t++) { inb(io); GET_TIME(t2); }
+               GET_TIME(t3);
+               restore_flags(flags);
+               udelay(i);
+               if ((t = DELTA(t2,t1) - DELTA(t3,t2)) < tx) tx = t;
+       }
+
+        info->loop = (JS_AN_LOOP_TIME * t) / 50000;
+       info->timeout = (JS_AN_MAX_TIME * info->speed) / 1000;
+}
+
 /*
  * js_an_probe() probes for analog joysticks.
  */
 
 static struct js_port __init *js_an_probe(int io, int mask0, int mask1, struct js_port *port)
 {
-       struct js_an_info info;
+       struct js_ax_info info, *ax;
        int i, numdev;
        unsigned char u;
 
@@ -129,7 +227,6 @@ static struct js_port __init *js_an_probe(int io, int mask0, int mask1, struct j
 
        if (check_region(io, 1)) return port;
 
-       if (((u = inb(io)) & 3) == 3) return port;
        outb(0xff,io);
        u = inb(io);
        udelay(JS_AN_MAX_TIME);
@@ -138,31 +235,41 @@ static struct js_port __init *js_an_probe(int io, int mask0, int mask1, struct j
        if (!u) return port;
        if (u & 0xf0) return port;
 
-       if ((numdev = js_an_probe_devs(&info, u, mask0, mask1, port)) <= 0)
+       if ((numdev = js_an_probe_devs(&info.an, u, mask0, mask1, port)) <= 0)
                return port;
 
        info.io = io;
+       js_an_calibrate_timer(&info);
+
        request_region(info.io, 1, "joystick (analog)");
-       port = js_register_port(port, &info, numdev, sizeof(struct js_an_info), js_an_read);
+       port = js_register_port(port, &info, numdev, sizeof(struct js_ax_info), js_an_read);
+       ax = port->info;        
 
        for (i = 0; i < numdev; i++)
-               printk(KERN_INFO "js%d: %s at %#x\n",
-                       js_register_device(port, i, js_an_axes(i, &info), js_an_buttons(i, &info),
-                               js_an_name(i, &info), js_an_open, js_an_close),
-                       js_an_name(i, &info), info.io);
-
-       js_an_read(port->info, port->axes, port->buttons);
-       js_an_init_corr(port->info, port->axes, port->corr, 8);
+               printk(KERN_INFO "js%d: %s at %#x ["TIME_NAME" timer, %d %sHz clock, %d ns res]\n",
+                       js_register_device(port, i, js_an_axes(i, &ax->an), js_an_buttons(i, &ax->an),
+                               js_an_name(i, &ax->an), js_an_open, js_an_close),
+                       js_an_name(i, &ax->an),
+                       ax->io,
+                       ax->speed > 10000 ? (ax->speed + 800) / 1000 : ax->speed,
+                       ax->speed > 10000 ? "M" : "k",
+                       ax->loop * 1000000000 / JS_AN_LOOP_TIME / ax->speed);
+
+       js_an_read(ax, port->axes, port->buttons);
+       js_an_init_corr(&ax->an, port->axes, port->corr, 8);
 
        return port;
 }
 
 #ifndef MODULE
-void __init js_an_setup(char *str, int *ints)
+int __init js_an_setup(SETUP_PARAM)
 {
        int i;
+       SETUP_PARSE(24);
        for (i = 0; i <= ints[0] && i < 24; i++) js_an[i] = ints[i+1];
+       return 1;
 }
+__setup("js_an=", js_an_setup);
 #endif
 
 #ifdef MODULE
@@ -193,11 +300,11 @@ int __init js_an_init(void)
 void cleanup_module(void)
 {
        int i;
-       struct js_an_info *info;
+       struct js_ax_info *info;
 
-       while (js_an_port != NULL) {
+       while (js_an_port) {
                for (i = 0; i < js_an_port->ndevs; i++)
-                       if (js_an_port->devs[i] != NULL)
+                       if (js_an_port->devs[i])
                                js_unregister_device(js_an_port->devs[i]);
                info = js_an_port->info;
                release_region(info->io, 1);
index 84479fcd132a598c4094d4c75ac179b232ece43f..a1644350c2c79bc72ab53cb1ffec2d8ab7aac617 100644 (file)
@@ -1,13 +1,15 @@
 /*
  *  joy-analog.h  Version 1.2
  *
- *  Copyright (c) 1996-1998 Vojtech Pavlik
+ *  Copyright (c) 1996-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
  * This file is designed to be included in any joystick driver
  * that communicates with standard analog joysticks. This currently
- * is: joy-analog.c, joy-assasin.c, and joy-lightning.c
+ * is: joy-analog.c, joy-assassin.c, and joy-lightning.c
  */
 
 /*
@@ -30,6 +32,8 @@
  * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
  */
 
+#include <linux/bitops.h>
+
 #define JS_AN_AXES_STD         0x0f
 #define JS_AN_BUTTONS_STD      0xf0
 
@@ -53,7 +57,6 @@ static struct {
 } js_an_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1, 0}, { 0, 1}, {-1, 0}};
 
 struct js_an_info {
-       int io;
        unsigned char mask[2];
        unsigned int extensions;
        int axes[4];
@@ -75,7 +78,7 @@ static void js_an_decode(struct js_an_info *info, int **axes, int **buttons)
        if (info->mask[1] & JS_AN_BUTTONS_STD) buttons[1][0] = 0;
 
        if (info->extensions & JS_AN_ANY_CHF) {
-               switch (info->buttons) {
+               switch (info->buttons & 0xf) {
                        case 0x1: buttons[0][0] = 0x01; break;
                        case 0x2: buttons[0][0] = 0x02; break;
                        case 0x4: buttons[0][0] = 0x04; break;
@@ -134,19 +137,6 @@ static void js_an_decode(struct js_an_info *info, int **axes, int **buttons)
        }
 }
 
-/*
- * js_an_count_bits() counts set bits in a byte.
- */
-
-static inline int js_an_count_bits(unsigned long c)
-{
-       int i = 0;
-       while (c) {
-               i += c & 1;
-               c >>= 1;
-       }
-       return i;
-}
 
 /*
  * js_an_init_corr() initializes the correction values for
@@ -158,7 +148,7 @@ static void __init js_an_init_corr(struct js_an_info *info, int **axes, struct j
        int i, j, t;
 
        for (i = 0; i < 2; i++)
-       for (j = 0; j < js_an_count_bits(info->mask[i] & 0xf); j++) {
+       for (j = 0; j < hweight8(info->mask[i] & 0xf); j++) {
 
                if ((j == 2 && (info->mask[i] & 0xb) == 0xb) ||
                    (j == 3 && (info->mask[i] & 0xf) == 0xf)) {
@@ -175,9 +165,9 @@ static void __init js_an_init_corr(struct js_an_info *info, int **axes, struct j
                corr[i][j].coef[3] = (1 << 29) / (t - (t >> 2) + 1);
        }
 
-       i = js_an_count_bits(info->mask[0] & 0xf);
+       i = hweight8(info->mask[0] & 0xf);
 
-       for (j = i; j < i + (js_an_count_bits(info->extensions & JS_AN_HATS_ALL) << 1); j++) {
+       for (j = i; j < i + (hweight8(info->extensions & JS_AN_HATS_ALL) << 1); j++) {
                corr[0][j].type = JS_CORR_BROKEN;
                corr[0][j].prec = 0;
                corr[0][j].coef[0] = 0;
@@ -204,6 +194,7 @@ static int __init js_an_probe_devs(struct js_an_info *info, int exist, int mask0
                info->mask[1] = mask1 & (exist | 0xf0) & ~info->mask[0];
                info->extensions = (mask0 >> 8) & ((exist & JS_AN_HAT_FCS) | ((exist << 2) & JS_AN_BUTTONS_PXY_XY) |
                                        ((exist << 4) & JS_AN_BUTTONS_PXY_UV) | JS_AN_ANY_CHF);
+
                if (info->extensions & JS_AN_BUTTONS_PXY) {
                        info->mask[0] &= ~((info->extensions & JS_AN_BUTTONS_PXY_XY) >> 2);
                        info->mask[0] &= ~((info->extensions & JS_AN_BUTTONS_PXY_UV) >> 4);
@@ -212,7 +203,7 @@ static int __init js_an_probe_devs(struct js_an_info *info, int exist, int mask0
                if (info->extensions & JS_AN_HAT_FCS) {
                        info->mask[0] &= ~JS_AN_HAT_FCS;
                        info->mask[1] = 0;
-                       info->extensions &= ~(JS_AN_BUTTON_PXY_Y | JS_AN_BUTTON_PXY_U);
+                       info->extensions &= ~(JS_AN_BUTTON_PXY_Y | JS_AN_BUTTON_PXY_V);
                }
                if (info->extensions & JS_AN_ANY_CHF) {
                        info->mask[0] |= 0xf0;
@@ -233,8 +224,7 @@ static int __init js_an_probe_devs(struct js_an_info *info, int exist, int mask0
                                info->mask[0] = 0xcc; /* joystick 1 */
                                break;
                        case 0xf:
-                               info->mask[0] = 0x33; /* joysticks 0 and 1 */
-                               info->mask[1] = 0xcc;
+                               info->mask[0] = 0xff; /* 4-axis 4-button joystick */
                                break;
                        default:
                                printk(KERN_WARNING "joy-analog: Unknown joystick device detected "
@@ -252,7 +242,7 @@ static int __init js_an_probe_devs(struct js_an_info *info, int exist, int mask0
 
 static inline int js_an_axes(int i, struct js_an_info *info)
 {
-       return js_an_count_bits(info->mask[i] & 0x0f) + js_an_count_bits(info->extensions & JS_AN_HATS_ALL) * 2;
+       return hweight8(info->mask[i] & 0x0f) + hweight8(info->extensions & JS_AN_HATS_ALL) * 2;
 }
 
 /*
@@ -261,9 +251,9 @@ static inline int js_an_axes(int i, struct js_an_info *info)
 
 static inline int js_an_buttons(int i, struct js_an_info *info)
 {
-       return js_an_count_bits(info->mask[i] & 0xf0) +
+       return hweight8(info->mask[i] & 0xf0) +
               (info->extensions & JS_AN_BUTTONS_CHF) * 2 +
-              js_an_count_bits(info->extensions & JS_AN_BUTTONS_PXY);
+              hweight8(info->extensions & JS_AN_BUTTONS_PXY);
 }
 
 /*
@@ -276,13 +266,13 @@ static char __init *js_an_name(int i, struct js_an_info *info)
 {
 
        sprintf(js_an_name_buf, "Analog %d-axis %d-button",
-               js_an_count_bits(info->mask[i] & 0x0f),
+               hweight8(info->mask[i] & 0x0f),
                js_an_buttons(i, info));
 
        if (info->extensions & JS_AN_HATS_ALL)
                sprintf(js_an_name_buf, "%s %d-hat",
                        js_an_name_buf,
-                       js_an_count_bits(info->extensions & JS_AN_HATS_ALL));
+                       hweight8(info->extensions & JS_AN_HATS_ALL));
 
        strcat(js_an_name_buf, " joystick");
 
@@ -291,7 +281,7 @@ static char __init *js_an_name(int i, struct js_an_info *info)
                        js_an_name_buf,
                        info->extensions & JS_AN_ANY_CHF ? " CHF" : "",
                        info->extensions & JS_AN_HAT_FCS ? " FCS" : "",
-                       info->extensions & JS_AN_BUTTONS_PXY ? " XY-button" : "");
+                       info->extensions & JS_AN_BUTTONS_PXY ? " XY/UV" : "");
 
        return js_an_name_buf;
 }
diff --git a/drivers/char/joystick/joy-assasin.c b/drivers/char/joystick/joy-assasin.c
deleted file mode 100644 (file)
index 731c6e5..0000000
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- *  joy-assasin.c  Version 1.2
- *
- *  Copyright (c) 1998 Vojtech Pavlik
- */
-
-/*
- * This is a module for the Linux joystick driver, supporting
- * joysticks using FP-Gaming's Assasin 3D protocol.
- */
-
-/*
- * 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 of the License, 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
- * 
- * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
- * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
- */
-
-#include <asm/io.h>
-#include <asm/system.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/ioport.h>
-#include <linux/joystick.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/string.h>
-
-#define JS_AS_MAX_START                250
-#define JS_AS_MAX_STROBE       50
-#define JS_AS_MAX_TIME         2400
-#define JS_AS_MAX_LENGTH       40
-
-#define JS_AS_MODE_A3D         1       /* Assasin 3D */
-#define JS_AS_MODE_PAN         2       /* Panther */
-#define JS_AS_MODE_OEM         3       /* Panther OEM version */
-#define JS_AS_MODE_PXL         4       /* Panther XL */
-
-MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
-MODULE_PARM(js_as, "2-24i");
-
-static int js_as[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0};
-
-static int js_as_port_list[] __initdata = {0x201, 0};
-static struct js_port* js_as_port __initdata = NULL;
-
-#include "joy-analog.h"
-
-struct js_as_info {
-       int io;
-       char mode;
-       char rudder;
-       struct js_an_info an;
-};
-
-/*
- * js_as_read_packet() reads an Assasin 3D packet.
- */
-
-static int js_as_read_packet(int io, int length, char *data)
-{
-       unsigned char u, v;
-       int i;
-       unsigned int t, t1;
-       unsigned long flags;
-
-       int start = (js_time_speed * JS_AS_MAX_START) >> 10;
-       int strobe = (js_time_speed * JS_AS_MAX_STROBE) >> 10;
-
-       i = 0;
-
-       __save_flags(flags);
-       __cli();
-       outb(0xff,io);
-
-       u = inb(io);
-       t = js_get_time();
-
-       do {
-               v = inb(io);
-               t1 = js_get_time();
-       } while (u == v && js_delta(t1, t) < start);
-
-       t = t1;
-
-       do {
-               v = inb(io);
-               t1 = js_get_time();
-               if ((u ^ v) & u & 0x10) {
-                       data[i++] = v >> 5;
-                       t = t1;
-               }
-               u = v;
-       } while (i < length && js_delta(t1,t) < strobe);
-
-       __restore_flags(flags);
-
-       return i;
-}
-
-/*
- * js_as_csum() computes checksum of triplet packet
- */
-
-static int js_as_csum(char *data, int count)
-{
-       int i, csum = 0;
-       for (i = 0; i < count - 2; i++) csum += data[i];
-       return (csum & 0x3f) != ((data[count - 2] << 3) | data[count - 1]);
-}
-
-/*
- * js_as_read() reads and analyzes A3D joystick data.
- */
-
-static int js_as_read(void *xinfo, int **axes, int **buttons)
-{
-       struct js_as_info *info = xinfo;
-       char data[JS_AS_MAX_LENGTH];
-
-       switch (info->mode) {
-
-               case JS_AS_MODE_A3D:
-               case JS_AS_MODE_OEM:
-               case JS_AS_MODE_PAN:
-
-                       if (js_as_read_packet(info->io, 29, data) != 29) return -1;
-                       if (data[0] != info->mode) return -1;
-                       if (js_as_csum(data, 29)) return -1;
-
-                       axes[0][0] = ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7);
-                       axes[0][1] = ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7);
-
-                       buttons[0][0] = (data[2] << 2) | (data[3] >> 1);
-
-                       info->an.axes[0] = ((char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128;
-                       info->an.axes[1] = ((char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128;
-                       info->an.axes[2] = ((char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128;
-                       info->an.axes[3] = ((char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128;
-
-                       info->an.buttons = ((data[3] << 3) | data[4]) & 0xf;
-
-                       js_an_decode(&info->an, axes + 1, buttons + 1);
-
-                       return 0;
-
-               case JS_AS_MODE_PXL:
-
-                       if (js_as_read_packet(info->io, 33, data) != 33) return -1;
-                       if (data[0] != info->mode) return -1;
-                       if (js_as_csum(data, 33)) return -1;
-
-                       axes[0][0] = ((char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128;
-                       axes[0][1] = ((char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128;
-                       info->an.axes[0] = ((char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128;
-                       axes[0][2] = ((char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128;
-
-                       axes[0][3] = ( data[5]       & 1) - ((data[5] >> 2) & 1);
-                       axes[0][4] = ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1);
-                       axes[0][5] = ((data[4] >> 1) & 1) - ( data[3]       & 1);
-                       axes[0][6] = ((data[4] >> 2) & 1) - ( data[4]       & 1);
-
-                       axes[0][7] = ((data[ 9] << 6) | (data[10] << 3) | data[11]) - ((data[ 9] & 4) << 7);
-                       axes[0][8] = ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7);
-
-                       buttons[0][0] = (data[2] << 8) | ((data[3] & 6) << 5) | (data[7] << 3) | data[8];
-
-                       if (info->rudder) axes[1][0] = info->an.axes[0];
-
-                       return 0;
-
-               default:
-                       printk("Error.\n");
-                       return -1;
-       }
-}
-
-/*
- * js_as_open() is a callback from the file open routine.
- */
-
-static int js_as_open(struct js_dev *jd)
-{
-       MOD_INC_USE_COUNT;
-       return 0;
-}
-
-/*
- * js_as_close() is a callback from the file release routine.
- */
-
-static int js_as_close(struct js_dev *jd)
-{
-       MOD_DEC_USE_COUNT;
-       return 0;
-}
-
-/*
- * js_as_pxl_init_corr() initializes the correction values for
- * the Panther XL.
- */
-
-static void __init js_as_pxl_init_corr(struct js_corr **corr, int **axes)
-{
-       int i;
-
-       for (i = 0; i < 2; i++) {
-               corr[0][i].type = JS_CORR_BROKEN;
-               corr[0][i].prec = 0;
-               corr[0][i].coef[0] = axes[0][i] - 4;
-               corr[0][i].coef[1] = axes[0][i] + 4;
-               corr[0][i].coef[2] = (1 << 29) / (127 - 32);
-               corr[0][i].coef[3] = (1 << 29) / (127 - 32);
-       }
-
-       corr[0][2].type = JS_CORR_BROKEN;
-       corr[0][2].prec = 0;
-       corr[0][2].coef[0] = 127 - 4;
-       corr[0][2].coef[1] = 128 + 4;
-       corr[0][2].coef[2] = (1 << 29) / (127 - 6);
-       corr[0][2].coef[3] = (1 << 29) / (127 - 6);
-
-       for (i = 3; i < 7; i++) {
-               corr[0][i].type = JS_CORR_BROKEN;
-               corr[0][i].prec = 0;
-               corr[0][i].coef[0] = 0;
-               corr[0][i].coef[1] = 0;
-               corr[0][i].coef[2] = (1 << 29);
-               corr[0][i].coef[3] = (1 << 29);
-       }
-
-       for (i = 7; i < 9; i++) {
-               corr[0][i].type = JS_CORR_BROKEN;
-               corr[0][i].prec = -1;
-               corr[0][i].coef[0] = 0;
-               corr[0][i].coef[1] = 0;
-               corr[0][i].coef[2] = (104 << 14);
-               corr[0][i].coef[3] = (104 << 14);
-       }
-}
-
-/*
- * js_as_as_init_corr() initializes the correction values for
- * the Panther and Assasin.
- */
-
-static void __init js_as_as_init_corr(struct js_corr **corr)
-{
-       int i;
-
-       for (i = 0; i < 2; i++) {
-               corr[0][i].type = JS_CORR_BROKEN;
-               corr[0][i].prec = -1;
-               corr[0][i].coef[0] = 0;
-               corr[0][i].coef[1] = 0;
-               corr[0][i].coef[2] = (104 << 14);
-               corr[0][i].coef[3] = (104 << 14);
-       }
-}
-
-/*
- * js_as_rudder_init_corr() initializes the correction values for
- * the Panther XL connected rudder.
- */
-
-static void __init js_as_rudder_init_corr(struct js_corr **corr, int **axes)
-{
-       corr[1][0].type = JS_CORR_BROKEN;
-       corr[1][0].prec = 0;
-       corr[1][0].coef[0] = axes[1][0] - (axes[1][0] >> 3);
-       corr[1][0].coef[1] = axes[1][0] + (axes[1][0] >> 3);
-       corr[1][0].coef[2] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1);
-       corr[1][0].coef[3] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1);
-}
-
-/*
- * js_as_probe() probes for A3D joysticks.
- */
-
-static struct js_port __init *js_as_probe(int io, int mask0, int mask1, struct js_port *port)
-{
-       struct js_as_info iniinfo;
-       struct js_as_info *info = &iniinfo;
-       char *name;
-       char data[JS_AS_MAX_LENGTH];
-       unsigned char u;
-       int i;
-       int numdev;
-
-       memset(info, 0, sizeof(struct js_as_info));
-
-       if (io < 0) return port;
-
-       if (check_region(io, 1)) return port;
-       if (((u = inb(io)) & 3) == 3) return port;
-       outb(0xff,io);
-       if (!((inb(io) ^ u) & ~u & 0xf)) return port;
-
-       if (js_as_read_packet(io, 1, data) != 1) return port;
-
-       if (data[0] && data[0] <= 4) {
-               info->mode = data[0];
-               info->io = io;
-               request_region(io, 1, "joystick (assasin)");
-               port = js_register_port(port, info, 3, sizeof(struct js_as_info), js_as_read);
-               info = port->info;
-       } else {
-               printk(KERN_WARNING "joy-assasin: unknown joystick device detected "
-                       "(io=%#x, id=%d), contact <vojtech@suse.cz>\n", io, data[0]);
-               return port;
-       }
-
-       udelay(JS_AS_MAX_TIME);
-
-       if (info->mode == JS_AS_MODE_PXL) {
-                       printk(KERN_INFO "js%d: MadCatz Panther XL at %#x\n",
-                               js_register_device(port, 0, 9, 9, "MadCatz Panther XL", js_as_open, js_as_close),
-                               info->io);
-                       js_as_read(port->info, port->axes, port->buttons);
-                       js_as_pxl_init_corr(port->corr, port->axes);
-                       if (info->an.axes[0] < 254) {
-                       printk(KERN_INFO "js%d: Analog rudder on MadCatz Panther XL\n",
-                               js_register_device(port, 1, 1, 0, "Analog rudder", js_as_open, js_as_close));
-                               info->rudder = 1;
-                               port->axes[1][0] = info->an.axes[0];
-                               js_as_rudder_init_corr(port->corr, port->axes);
-                       }
-                       return port;
-       }
-
-       switch (info->mode) {
-               case JS_AS_MODE_A3D: name = "FP-Gaming Assasin 3D"; break;
-               case JS_AS_MODE_PAN: name = "MadCatz Panther"; break;
-               case JS_AS_MODE_OEM: name = "OEM Assasin 3D"; break;
-               default: name = "This cannot happen"; break;
-       }
-
-       printk(KERN_INFO "js%d: %s at %#x\n",
-               js_register_device(port, 0, 2, 3, name, js_as_open, js_as_close),
-               name, info->io);
-
-       js_as_as_init_corr(port->corr);
-
-       js_as_read(port->info, port->axes, port->buttons);
-
-       for (i = u = 0; i < 4; i++) if (info->an.axes[i] < 254) u |= 1 << i;
-
-       if ((numdev = js_an_probe_devs(&info->an, u, mask0, mask1, port)) <= 0)
-               return port;
-
-       for (i = 0; i < numdev; i++)
-               printk(KERN_INFO "js%d: %s on %s\n",
-                       js_register_device(port, i + 1, js_an_axes(i, &info->an), js_an_buttons(i, &info->an),
-                               js_an_name(i, &info->an), js_as_open, js_as_close),
-                       js_an_name(i, &info->an), name);
-
-       js_an_decode(&info->an, port->axes + 1, port->buttons + 1);
-       js_an_init_corr(&info->an, port->axes + 1, port->corr + 1, 0);
-
-       return port;
-}
-
-#ifndef MODULE
-void __init js_as_setup(char *str, int *ints)
-{
-       int i;
-       for (i = 0; i <= ints[0] && i < 24; i++) js_as[i] = ints[i+1];
-}
-#endif
-
-#ifdef MODULE
-int init_module(void)
-#else
-int __init js_as_init(void)
-#endif
-{
-       int i;
-
-       if (js_as[0] >= 0) {
-               for (i = 0; (js_as[i*3] >= 0) && i < 8; i++)
-                       js_as_port = js_as_probe(js_as[i*3], js_as[i*3+1], js_as[i*3+2], js_as_port);
-       } else {
-               for (i = 0; js_as_port_list[i]; i++) js_as_port = js_as_probe(js_as_port_list[i], 0, 0, js_as_port);
-       }
-       if (js_as_port) return 0;
-
-#ifdef MODULE
-       printk(KERN_WARNING "joy-assasin: no joysticks found\n");
-#endif
-
-       return -ENODEV;
-}
-
-#ifdef MODULE
-void cleanup_module(void)
-{
-       int i;
-       struct js_as_info *info;
-
-       while (js_as_port != NULL) {
-               for (i = 0; i < js_as_port->ndevs; i++)
-                       if (js_as_port->devs[i] != NULL)
-                               js_unregister_device(js_as_port->devs[i]);
-               info = js_as_port->info;
-               release_region(info->io, 1);
-               js_as_port = js_unregister_port(js_as_port);
-       }
-
-}
-#endif
diff --git a/drivers/char/joystick/joy-assassin.c b/drivers/char/joystick/joy-assassin.c
new file mode 100644 (file)
index 0000000..b76ba8e
--- /dev/null
@@ -0,0 +1,416 @@
+/*
+ *  joy-assassin.c  Version 1.2
+ *
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting
+ * joysticks using FP-Gaming's Assassin 3D protocol.
+ */
+
+/*
+ * 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 of the License, 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
+ * 
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/init.h>
+
+#define JS_AS_MAX_START                1000
+#define JS_AS_DELAY_READ       3000
+#define JS_AS_MAX_LENGTH       40
+
+#define JS_AS_MODE_A3D         1       /* Assassin 3D */
+#define JS_AS_MODE_PAN         2       /* Panther */
+#define JS_AS_MODE_OEM         3       /* Panther OEM version */
+#define JS_AS_MODE_PXL         4       /* Panther XL */
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_PARM(js_as, "2-24i");
+
+static int __initdata js_as[] = { -1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0 };
+
+static int js_as_port_list[] __initdata = {0x201, 0};
+static struct js_port* js_as_port __initdata = NULL;
+
+#include "joy-analog.h"
+
+struct js_as_info {
+       int io;
+       char mode;
+       char rudder;
+       struct js_an_info an;
+};
+
+/*
+ * js_as_read_packet() reads an Assassin 3D packet.
+ */
+
+static int js_as_read_packet(int io, int length, char *data)
+{
+       unsigned char u, v;
+       int i;
+       unsigned int t, p;
+       unsigned long flags;
+
+       i = 0;
+
+       __save_flags(flags);
+       __cli();
+
+       outb(0xff,io);
+       v = inb(io);
+       t = p = JS_AS_MAX_START;
+
+       while (t > 0 && i < length) {
+               t--;
+               u = v; v = inb(io);
+               if (~v & u & 0x10) {
+                       data[i++] = v >> 5;
+                       p = t = (p - t) << 3;
+               }
+       }
+
+       __restore_flags(flags);
+
+       return i;
+}
+
+/*
+ * js_as_csum() computes checksum of triplet packet
+ */
+
+static int js_as_csum(char *data, int count)
+{
+       int i, csum = 0;
+       for (i = 0; i < count - 2; i++) csum += data[i];
+       return (csum & 0x3f) != ((data[count - 2] << 3) | data[count - 1]);
+}
+
+/*
+ * js_as_read() reads and analyzes A3D joystick data.
+ */
+
+static int js_as_read(void *xinfo, int **axes, int **buttons)
+{
+       struct js_as_info *info = xinfo;
+       char data[JS_AS_MAX_LENGTH];
+
+       switch (info->mode) {
+
+               case JS_AS_MODE_A3D:
+               case JS_AS_MODE_OEM:
+               case JS_AS_MODE_PAN:
+
+                       if (js_as_read_packet(info->io, 29, data) != 29) return -1;
+                       if (data[0] != info->mode) return -1;
+                       if (js_as_csum(data, 29)) return -1;
+
+                       axes[0][0] = ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7);
+                       axes[0][1] = ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7);
+
+                       buttons[0][0] = (data[2] << 2) | (data[3] >> 1);
+
+                       info->an.axes[0] = ((char)((data[11] << 6) | (data[12] << 3) | (data[13]))) + 128;
+                       info->an.axes[1] = ((char)((data[14] << 6) | (data[15] << 3) | (data[16]))) + 128;
+                       info->an.axes[2] = ((char)((data[17] << 6) | (data[18] << 3) | (data[19]))) + 128;
+                       info->an.axes[3] = ((char)((data[20] << 6) | (data[21] << 3) | (data[22]))) + 128;
+
+                       info->an.buttons = ((data[3] << 3) | data[4]) & 0xf;
+
+                       js_an_decode(&info->an, axes + 1, buttons + 1);
+
+                       return 0;
+
+               case JS_AS_MODE_PXL:
+
+                       if (js_as_read_packet(info->io, 33, data) != 33) return -1;
+                       if (data[0] != info->mode) return -1;
+                       if (js_as_csum(data, 33)) return -1;
+
+                       axes[0][0] = ((char)((data[15] << 6) | (data[16] << 3) | (data[17]))) + 128;
+                       axes[0][1] = ((char)((data[18] << 6) | (data[19] << 3) | (data[20]))) + 128;
+                       info->an.axes[0] = ((char)((data[21] << 6) | (data[22] << 3) | (data[23]))) + 128;
+                       axes[0][2] = ((char)((data[24] << 6) | (data[25] << 3) | (data[26]))) + 128;
+
+                       axes[0][3] = ( data[5]       & 1) - ((data[5] >> 2) & 1);
+                       axes[0][4] = ((data[5] >> 1) & 1) - ((data[6] >> 2) & 1);
+                       axes[0][5] = ((data[4] >> 1) & 1) - ( data[3]       & 1);
+                       axes[0][6] = ((data[4] >> 2) & 1) - ( data[4]       & 1);
+
+                       axes[0][7] = ((data[ 9] << 6) | (data[10] << 3) | data[11]) - ((data[ 9] & 4) << 7);
+                       axes[0][8] = ((data[12] << 6) | (data[13] << 3) | data[14]) - ((data[12] & 4) << 7);
+
+                       buttons[0][0] = (data[2] << 8) | ((data[3] & 6) << 5) | (data[7] << 3) | data[8];
+
+                       if (info->rudder) axes[1][0] = info->an.axes[0];
+
+                       return 0;
+       }
+       return -1;
+}
+
+/*
+ * js_as_open() is a callback from the file open routine.
+ */
+
+static int js_as_open(struct js_dev *jd)
+{
+       MOD_INC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_as_close() is a callback from the file release routine.
+ */
+
+static int js_as_close(struct js_dev *jd)
+{
+       MOD_DEC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_as_pxl_init_corr() initializes the correction values for
+ * the Panther XL.
+ */
+
+static void __init js_as_pxl_init_corr(struct js_corr **corr, int **axes)
+{
+       int i;
+
+       for (i = 0; i < 2; i++) {
+               corr[0][i].type = JS_CORR_BROKEN;
+               corr[0][i].prec = 0;
+               corr[0][i].coef[0] = axes[0][i] - 4;
+               corr[0][i].coef[1] = axes[0][i] + 4;
+               corr[0][i].coef[2] = (1 << 29) / (127 - 32);
+               corr[0][i].coef[3] = (1 << 29) / (127 - 32);
+       }
+
+       corr[0][2].type = JS_CORR_BROKEN;
+       corr[0][2].prec = 0;
+       corr[0][2].coef[0] = 127 - 4;
+       corr[0][2].coef[1] = 128 + 4;
+       corr[0][2].coef[2] = (1 << 29) / (127 - 6);
+       corr[0][2].coef[3] = (1 << 29) / (127 - 6);
+
+       for (i = 3; i < 7; i++) {
+               corr[0][i].type = JS_CORR_BROKEN;
+               corr[0][i].prec = 0;
+               corr[0][i].coef[0] = 0;
+               corr[0][i].coef[1] = 0;
+               corr[0][i].coef[2] = (1 << 29);
+               corr[0][i].coef[3] = (1 << 29);
+       }
+
+       for (i = 7; i < 9; i++) {
+               corr[0][i].type = JS_CORR_BROKEN;
+               corr[0][i].prec = -1;
+               corr[0][i].coef[0] = 0;
+               corr[0][i].coef[1] = 0;
+               corr[0][i].coef[2] = (104 << 14);
+               corr[0][i].coef[3] = (104 << 14);
+       }
+}
+
+/*
+ * js_as_as_init_corr() initializes the correction values for
+ * the Panther and Assassin.
+ */
+
+static void __init js_as_as_init_corr(struct js_corr **corr)
+{
+       int i;
+
+       for (i = 0; i < 2; i++) {
+               corr[0][i].type = JS_CORR_BROKEN;
+               corr[0][i].prec = -1;
+               corr[0][i].coef[0] = 0;
+               corr[0][i].coef[1] = 0;
+               corr[0][i].coef[2] = (104 << 14);
+               corr[0][i].coef[3] = (104 << 14);
+       }
+}
+
+/*
+ * js_as_rudder_init_corr() initializes the correction values for
+ * the Panther XL connected rudder.
+ */
+
+static void __init js_as_rudder_init_corr(struct js_corr **corr, int **axes)
+{
+       corr[1][0].type = JS_CORR_BROKEN;
+       corr[1][0].prec = 0;
+       corr[1][0].coef[0] = axes[1][0] - (axes[1][0] >> 3);
+       corr[1][0].coef[1] = axes[1][0] + (axes[1][0] >> 3);
+       corr[1][0].coef[2] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1);
+       corr[1][0].coef[3] = (1 << 29) / (axes[1][0] - (axes[1][0] >> 2) + 1);
+}
+
+/*
+ * js_as_probe() probes for A3D joysticks.
+ */
+
+static struct js_port __init *js_as_probe(int io, int mask0, int mask1, struct js_port *port)
+{
+       struct js_as_info iniinfo;
+       struct js_as_info *info = &iniinfo;
+       char *name;
+       char data[JS_AS_MAX_LENGTH];
+       unsigned char u;
+       int i;
+       int numdev;
+
+       memset(info, 0, sizeof(struct js_as_info));
+
+       if (io < 0) return port;
+
+       if (check_region(io, 1)) return port;
+
+       i = js_as_read_packet(io, JS_AS_MAX_LENGTH, data);
+
+       printk("%d\n", i);
+
+       if (!i) return port;
+       if (js_as_csum(data, i)) return port;
+
+       if (data[0] && data[0] <= 4) {
+               info->mode = data[0];
+               info->io = io;
+               request_region(io, 1, "joystick (assassin)");
+               port = js_register_port(port, info, 3, sizeof(struct js_as_info), js_as_read);
+               info = port->info;
+       } else {
+               printk(KERN_WARNING "joy-assassin: unknown joystick device detected "
+                       "(io=%#x, id=%d), contact <vojtech@suse.cz>\n", io, data[0]);
+               return port;
+       }
+
+       udelay(JS_AS_DELAY_READ);
+
+       if (info->mode == JS_AS_MODE_PXL) {
+                       printk(KERN_INFO "js%d: MadCatz Panther XL at %#x\n",
+                               js_register_device(port, 0, 9, 9, "MadCatz Panther XL", js_as_open, js_as_close),
+                               info->io);
+                       js_as_read(port->info, port->axes, port->buttons);
+                       js_as_pxl_init_corr(port->corr, port->axes);
+                       if (info->an.axes[0] < 254) {
+                       printk(KERN_INFO "js%d: Analog rudder on MadCatz Panther XL\n",
+                               js_register_device(port, 1, 1, 0, "Analog rudder", js_as_open, js_as_close));
+                               info->rudder = 1;
+                               port->axes[1][0] = info->an.axes[0];
+                               js_as_rudder_init_corr(port->corr, port->axes);
+                       }
+                       return port;
+       }
+
+       switch (info->mode) {
+               case JS_AS_MODE_A3D: name = "FP-Gaming Assassin 3D"; break;
+               case JS_AS_MODE_PAN: name = "MadCatz Panther"; break;
+               case JS_AS_MODE_OEM: name = "OEM Assassin 3D"; break;
+               default: name = "This cannot happen"; break;
+       }
+
+       printk(KERN_INFO "js%d: %s at %#x\n",
+               js_register_device(port, 0, 2, 3, name, js_as_open, js_as_close),
+               name, info->io);
+
+       js_as_as_init_corr(port->corr);
+
+       js_as_read(port->info, port->axes, port->buttons);
+
+       for (i = u = 0; i < 4; i++) if (info->an.axes[i] < 254) u |= 1 << i;
+
+       if ((numdev = js_an_probe_devs(&info->an, u, mask0, mask1, port)) <= 0)
+               return port;
+
+       for (i = 0; i < numdev; i++)
+               printk(KERN_INFO "js%d: %s on %s\n",
+                       js_register_device(port, i + 1, js_an_axes(i, &info->an), js_an_buttons(i, &info->an),
+                               js_an_name(i, &info->an), js_as_open, js_as_close),
+                       js_an_name(i, &info->an), name);
+
+       js_an_decode(&info->an, port->axes + 1, port->buttons + 1);
+       js_an_init_corr(&info->an, port->axes + 1, port->corr + 1, 0);
+
+       return port;
+}
+
+#ifndef MODULE
+int __init js_as_setup(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(24);
+       for (i = 0; i <= ints[0] && i < 24; i++) js_as[i] = ints[i+1];
+       return 1;
+}
+__setup("js_as=", js_as_setup);
+#endif
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_as_init(void)
+#endif
+{
+       int i;
+
+       if (js_as[0] >= 0) {
+               for (i = 0; (js_as[i*3] >= 0) && i < 8; i++)
+                       js_as_port = js_as_probe(js_as[i*3], js_as[i*3+1], js_as[i*3+2], js_as_port);
+       } else {
+               for (i = 0; js_as_port_list[i]; i++) js_as_port = js_as_probe(js_as_port_list[i], 0, 0, js_as_port);
+       }
+       if (js_as_port) return 0;
+
+#ifdef MODULE
+       printk(KERN_WARNING "joy-assassin: no joysticks found\n");
+#endif
+
+       return -ENODEV;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+       int i;
+       struct js_as_info *info;
+
+       while (js_as_port) {
+               for (i = 0; i < js_as_port->ndevs; i++)
+                       if (js_as_port->devs[i])
+                               js_unregister_device(js_as_port->devs[i]);
+               info = js_as_port->info;
+               release_region(info->io, 1);
+               js_as_port = js_unregister_port(js_as_port);
+       }
+
+}
+#endif
index ad4be30769d7e779dd44d19da3f5aaa1e7db9181..58392f83917662a1755be1a90ab2daa4f813f2fa 100644 (file)
@@ -1,14 +1,19 @@
 /*
- * joy-console.c  Version 0.11V
+ *  joy-console.c  Version 0.14V
  *
- * Copyright (c) 1998 Andree Borrmann
+ *  Copyright (c) 1998 Andree Borrmann
+ *  Copyright (c) 1999 John Dahlstrom
+ *  Copyright (c) 1999 David Kuder
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
  * This is a module for the Linux joystick driver, supporting
- * console (NES, SNES, Multi1, Multi2, PSX) gamepads connected
- * via parallel port. Up to five such controllers can be
- * connected to one parallel port.
+ * console (NES, SNES, N64, Multi1, Multi2, PSX) gamepads 
+ * connected via parallel port. Up to five such controllers 
+ * can be connected to one parallel port.
  */
 
 /*
  * 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
+ *
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
  */
 
 #include <asm/io.h>
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 
 
-MODULE_AUTHOR("Andree Borrmann <A.Borrmann@tu-bs.de>");
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_PARM(js_console, "2-6i");
-MODULE_PARM(js_console2,"2-6i");
-MODULE_PARM(js_console3,"2-6i");
+MODULE_PARM(js_console_2,"2-6i");
+MODULE_PARM(js_console_3,"2-6i");
 
 
 #define JS_NO_PAD      0
@@ -51,29 +61,29 @@ MODULE_PARM(js_console3,"2-6i");
 #define JS_MULTI_STICK 4
 #define JS_MULTI2_STICK        5
 #define JS_PSX_PAD     6
-
-#define JS_MAX_PAD     JS_PSX_PAD
+#define JS_N64_PAD     7       
+#define JS_N64_PAD_DPP 8       /* DirectPad Pro compatible layout */
+#define JS_MAX_PAD     JS_N64_PAD_DPP
 
 struct js_console_info {
-#ifdef USE_PARPORT
        struct pardevice *port; /* parport device */
-#else
-       int port;               /* hw port */
-#endif
        int pads;               /* total number of pads */
+       int pad_to_device[5];   /* pad to js device mapping (js0, js1, etc.) */
        int snes;               /* SNES pads */
        int nes;                /* NES pads */
+       int n64;                /* N64 pads */
+       int n64_dpp;            /* bits indicate N64 pads treated 14 button, 2 axis */
        int multi;              /* Multi joysticks */
        int multi2;             /* Multi joysticks with 2 buttons */
-       int psx;                /* Normal PSX controllers */
-       int negcon;             /* PSX NEGCON controllers */
+       int psx;                /* PSX controllers */
 };
 
 static struct js_port* js_console_port = NULL;
 
 static int js_console[] __initdata = { -1, 0, 0, 0, 0, 0 };
-static int js_console2[] __initdata = { -1, 0, 0, 0, 0, 0 };
-static int js_console3[] __initdata = { -1, 0, 0, 0, 0, 0 };
+static int js_console_2[] __initdata = { -1, 0, 0, 0, 0, 0 };
+static int js_console_3[] __initdata = { -1, 0, 0, 0, 0, 0 };
 
 static int status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 };
 
@@ -109,7 +119,7 @@ static int status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 };
 #define JS_SNES_L      10
 #define JS_SNES_R      11
 
-#define JS_NES_POWER   0xf8
+#define JS_NES_POWER   0xfc
 #define JS_NES_CLOCK   0x01
 #define JS_NES_LATCH   0x02
 
@@ -123,17 +133,99 @@ static void js_nes_read_packet(struct js_console_info *info, int length, unsigne
 {
        int i;
 
-       JS_PAR_DATA_OUT(JS_NES_POWER + JS_NES_CLOCK + JS_NES_LATCH, info->port);
+       JS_PAR_DATA_OUT(JS_NES_POWER | JS_NES_CLOCK | JS_NES_LATCH, info->port);
        udelay(JS_NES_DELAY * 2);
-       JS_PAR_DATA_OUT(JS_NES_POWER + JS_NES_CLOCK, info->port);
+       JS_PAR_DATA_OUT(JS_NES_POWER | JS_NES_CLOCK, info->port);
 
        for (i = 0; i < length; i++) {
                udelay(JS_NES_DELAY);
                JS_PAR_DATA_OUT(JS_NES_POWER, info->port);
                data[i] = JS_PAR_STATUS(info->port) ^ ~JS_PAR_STATUS_INVERT;
                udelay(JS_NES_DELAY);
-               JS_PAR_DATA_OUT(JS_NES_POWER + JS_NES_CLOCK, info->port);
+               JS_PAR_DATA_OUT(JS_NES_POWER | JS_NES_CLOCK, info->port);
+       }
+}
+
+/*
+ * N64 support.
+ */
+
+#define JS_N64_A       0
+#define JS_N64_B       1
+#define JS_N64_Z       2
+#define JS_N64_START   3
+#define JS_N64_UP      4
+#define JS_N64_DOWN    5
+#define JS_N64_LEFT    6
+#define JS_N64_RIGHT   7
+#define JS_N64_UNUSED1 8
+#define JS_N64_UNUSED2 9
+#define JS_N64_L       10
+#define JS_N64_R       11
+#define JS_N64_CU      12
+#define JS_N64_CD      13
+#define JS_N64_CL      14
+#define JS_N64_CR      15
+#define JS_N64_X       23                      /* 16 - 23, signed 8-bit int */
+#define JS_N64_Y       31                      /* 24 - 31, signed 8-bit int */
+
+#define JS_N64_LENGTH          32              /* N64 bit length, not including stop bit */
+#define JS_N64_REQUEST_LENGTH  37              /* transmit request sequence is 9 bits long */
+#define JS_N64_DELAY           133             /* delay between transmit request, and response ready (us) */
+#define JS_N64_REQUEST         0x1dd1111111ULL /* the request data command (encoded for 000000011) */
+#define JS_N64_DWS             3               /* delay between write segments (required for sound playback because of ISA DMA) */
+                                               /* JS_N64_DWS > 24 is known to fail */ 
+#define JS_N64_POWER_W         0xe2            /* power during write (transmit request) */
+#define JS_N64_POWER_R         0xfd            /* power during read */
+#define JS_N64_OUT             0x1d            /* output bits to the 4 pads */
+                                               /* Reading the main axes of any N64 pad is known to fail if the corresponding bit */
+                                               /* in JS_N64_OUT is pulled low on the output port (by any routine) for more */
+                                               /* than 0.123 consecutive ms */
+#define JS_N64_CLOCK           0x02            /* clock bits for read */
+
+/* 
+ * js_n64_read_packet() reads an N64 packet. 
+ * Each pad uses one bit per byte. So all pads connected to this port are read in parallel.
+ */
+
+static void js_n64_read_packet(struct js_console_info *info, unsigned char *data)
+{
+       int i;
+       unsigned long flags;
+
+/*
+ * Request the pad to transmit data
+ */
+
+       save_flags(flags);
+       cli();
+       for (i = 0; i < JS_N64_REQUEST_LENGTH; i++) {
+               JS_PAR_DATA_OUT(JS_N64_POWER_W | ((JS_N64_REQUEST >> i) & 1 ? JS_N64_OUT : 0), info->port);
+               udelay(JS_N64_DWS);
        }
+       restore_flags(flags);
+
+/*
+ * Wait for the pad response to be loaded into the 33-bit register of the adapter
+ */
+
+       udelay(JS_N64_DELAY);
+
+/*
+ * Grab data (ignoring the last bit, which is a stop bit)
+ */
+
+       for (i = 0; i < JS_N64_LENGTH; i++) {
+               JS_PAR_DATA_OUT(JS_N64_POWER_R, info->port);
+               data[i] = JS_PAR_STATUS(info->port);
+               JS_PAR_DATA_OUT(JS_N64_POWER_R | JS_N64_CLOCK, info->port);
+        }
+
+/*
+ * We must wait ~0.2 ms here for the controller to reinitialize before the next read request.
+ * No worries as long as js_console_read is polled less frequently than this.
+ */
+
 }
 
 /*
@@ -161,7 +253,9 @@ static void js_multi_read_packet(struct js_console_info *info, int length, unsig
        for (i = 0; i < length; i++) {
                JS_PAR_DATA_OUT(~(1 << i), info->port);
                data[i] = JS_PAR_STATUS(info->port) ^ ~JS_PAR_STATUS_INVERT;
+               printk(" %d", data[i]);
        }
+       printk("\n");
 }
 
 /*
@@ -169,27 +263,28 @@ static void js_multi_read_packet(struct js_console_info *info, int length, unsig
  */
 
 #define JS_PSX_DELAY   10
+#define JS_PSX_LENGTH  8    /* talk to the controller in bytes */
 
-#define JS_PSX_LENGTH  8
+#define JS_PSX_NORMAL  0x41 /* Standard Digital controller */
+#define JS_PSX_NEGCON  0x23 /* NegCon pad */
+#define JS_PSX_MOUSE   0x12 /* PSX Mouse */
+#define JS_PSX_ANALOGR 0x73 /* Analog controller in Red mode */
+#define JS_PSX_ANALOGG 0x53 /* Analog controller in Green mode */
 
-#define JS_PSX_NORMAL  0x41
-#define JS_PSX_NEGCON  0x23
-#define JS_PSX_MOUSE   0x12
-
-#define JS_PSX_SELBUT  0x01
+#define JS_PSX_JOYR    0x02 /* These are for the Analog/Dual Shock controller in RED mode */
+#define JS_PSX_JOYL    0x04 /* I'm not sure the exact purpose of these but its in the docs */
+#define JS_PSX_SELBUT  0x01 /* Standard buttons on almost all PSX controllers. */
 #define JS_PSX_START   0x08
-#define JS_PSX_UP      0x10
+#define JS_PSX_UP      0x10 /* Digital direction pad */
 #define JS_PSX_RIGHT   0x20
 #define JS_PSX_DOWN    0x40
 #define JS_PSX_LEFT    0x80
 
-#define JS_PSX_CLOCK   0x01
-#define JS_PSX_COMMAND 0x02
-#define JS_PSX_POWER   0xf8
-#define JS_PSX_NOPOWER 0x04
-#define JS_PSX_SELECT  0x08
-
-#define JS_PSX_CTRL_OUT(X,Y)   JS_PAR_CTRL_OUT((X)^0x0f, Y)
+#define JS_PSX_CLOCK   0x04 /* Pin 3 */
+#define JS_PSX_COMMAND 0x01 /* Pin 1 */
+#define JS_PSX_POWER   0xf8 /* Pins 5-9 */
+#define JS_PSX_SELECT  0x02 /* Pin 2 */
+#define JS_PSX_NOPOWER  0x04
 
 /*
  * js_psx_command() writes 8bit command and reads 8bit data from
@@ -202,11 +297,11 @@ static int js_psx_command(struct js_console_info *info, int b)
 
        cmd = (b&1)?JS_PSX_COMMAND:0;
        for (i=0; i<8; i++) {
-               JS_PSX_CTRL_OUT(cmd, info->port);
+               JS_PAR_DATA_OUT(cmd | JS_PSX_POWER, info->port);
                udelay(JS_PSX_DELAY);
                ret |= ((JS_PAR_STATUS(info->port) ^ JS_PAR_STATUS_INVERT ) & info->psx) ? (1<<i) : 0;
                cmd = (b&1)?JS_PSX_COMMAND:0;
-               JS_PSX_CTRL_OUT(JS_PSX_CLOCK | cmd, info->port);
+               JS_PAR_DATA_OUT(cmd | JS_PSX_CLOCK | JS_PSX_POWER, info->port);
                udelay(JS_PSX_DELAY);
                b >>= 1;
        }
@@ -228,7 +323,7 @@ static int js_psx_read_packet(struct js_console_info *info, int length, unsigned
 
        JS_PAR_DATA_OUT(JS_PSX_POWER, info->port);
 
-       JS_PSX_CTRL_OUT(JS_PSX_CLOCK | JS_PSX_SELECT, info->port);      /* Select pad */
+       JS_PAR_DATA_OUT(JS_PSX_CLOCK | JS_PSX_SELECT | JS_PSX_POWER, info->port);       /* Select pad */
        udelay(JS_PSX_DELAY*2);
        js_psx_command(info, 0x01);                                     /* Access pad */
        ret = js_psx_command(info, 0x42);                               /* Get device id */
@@ -237,7 +332,7 @@ static int js_psx_read_packet(struct js_console_info *info, int length, unsigned
                        data[i]=js_psx_command(info, 0);
        else ret = -1;
 
-       JS_PSX_CTRL_OUT(JS_PSX_SELECT | JS_PSX_CLOCK, info->port);
+       JS_PAR_DATA_OUT(JS_PSX_SELECT | JS_PSX_CLOCK | JS_PSX_POWER, info->port);
        __restore_flags(flags);
 
        return ret;
@@ -248,14 +343,14 @@ static int js_psx_read_packet(struct js_console_info *info, int length, unsigned
  * js_console_read() reads and analyzes console pads data.
  */
 
-#define JS_MAX_LENGTH JS_SNES_LENGTH
+#define JS_MAX_LENGTH JS_N64_LENGTH
 
 static int js_console_read(void *xinfo, int **axes, int **buttons)
 {
        struct js_console_info *info = xinfo;
        unsigned char data[JS_MAX_LENGTH];
 
-       int i, s;
+       int i, j, s;
        int n = 0;
 
 /*
@@ -268,24 +363,68 @@ static int js_console_read(void *xinfo, int **axes, int **buttons)
 
                for (i = 0; i < 5; i++) {
                        s = status_bit[i];
+                       n = info->pad_to_device[i];
                        if (info->nes & s) {
                                axes[n][0] = (data[JS_SNES_RIGHT]&s?1:0) - (data[JS_SNES_LEFT]&s?1:0);
                                axes[n][1] = (data[JS_SNES_DOWN] &s?1:0) - (data[JS_SNES_UP]  &s?1:0);
 
-                               buttons[n][0] = ((data[JS_NES_A]    &s)?1:0) | ((data[JS_NES_B]     &s)?2:0)
-                                             | ((data[JS_NES_START]&s)?4:0) | ((data[JS_NES_SELECT]&s)?8:0);
-
-                               n++;
+                               buttons[n][0] = (data[JS_NES_A]    &s?1:0) | (data[JS_NES_B]     &s?2:0)
+                                             | (data[JS_NES_START]&s?4:0) | (data[JS_NES_SELECT]&s?8:0);
                        } else
                        if (info->snes & s) {
                                axes[n][0] = (data[JS_SNES_RIGHT]&s?1:0) - (data[JS_SNES_LEFT]&s?1:0);
                                axes[n][1] = (data[JS_SNES_DOWN] &s?1:0) - (data[JS_SNES_UP]  &s?1:0);
 
-                               buttons[n][0] = ((data[JS_SNES_A]    &s)?0x01:0) | ((data[JS_SNES_B]     &s)?0x02:0)
-                                             | ((data[JS_SNES_X]    &s)?0x04:0) | ((data[JS_SNES_Y]     &s)?0x08:0)
-                                             | ((data[JS_SNES_L]    &s)?0x10:0) | ((data[JS_SNES_R]     &s)?0x20:0)
-                                             | ((data[JS_SNES_START]&s)?0x40:0) | ((data[JS_SNES_SELECT]&s)?0x80:0);
-                               n++;
+                               buttons[n][0] = (data[JS_SNES_A]    &s?0x01:0) | (data[JS_SNES_B]     &s?0x02:0)
+                                             | (data[JS_SNES_X]    &s?0x04:0) | (data[JS_SNES_Y]     &s?0x08:0)
+                                             | (data[JS_SNES_L]    &s?0x10:0) | (data[JS_SNES_R]     &s?0x20:0)
+                                             | (data[JS_SNES_START]&s?0x40:0) | (data[JS_SNES_SELECT]&s?0x80:0);
+                       }
+               }
+       }
+
+/*
+ * N64 pads
+ */
+
+       if (info->n64) {
+               if ( (info->nes || info->snes) && (info->n64 & status_bit[0]) ) {
+                                       /* SNES/NES compatibility */
+                       udelay(240);    /* 200 us delay + 20% tolerance */
+               }
+
+               js_n64_read_packet(info, data);
+
+               for (i = 0; i < 5; i++) {
+                       s = status_bit[i];
+                       n = info->pad_to_device[i];
+                       if (info->n64 & s & ~(data[JS_N64_UNUSED1] | data[JS_N64_UNUSED2])) {
+
+                               buttons[n][0] = ( ((data[JS_N64_A]&s) ? 0x01:0) | ((data[JS_N64_B] & s ) ? 0x02:0) 
+                                               | ((data[JS_N64_Z]&s) ? 0x04:0) | ((data[JS_N64_L] & s ) ? 0x08:0) 
+                                               | ((data[JS_N64_R]&s) ? 0x10:0) | ((data[JS_N64_START]&s)? 0x20:0)
+                                               | ((data[JS_N64_CU]&s)? 0x40:0) | ((data[JS_N64_CR]&s)   ? 0x80:0)
+                                               | ((data[JS_N64_CD]&s)?0x100:0) | ((data[JS_N64_CL]&s)   ?0x200:0) );
+
+                               if (info->n64_dpp & s) { 
+                                       buttons[n][0] |= ((data[JS_N64_LEFT]&s) ? 0x400:0) | ((data[JS_N64_UP] & s)? 0x800:0)
+                                                       |((data[JS_N64_RIGHT]&s)?0x1000:0) | ((data[JS_N64_DOWN]&s)?0x2000:0);
+                               } else {
+                                       axes[n][2] = (data[JS_N64_RIGHT]&s?1:0) - (data[JS_N64_LEFT]&s?1:0);
+                                       axes[n][3] = (data[JS_N64_DOWN] &s?1:0) - (data[JS_N64_UP]  &s?1:0);
+                               }
+
+                                               /* build int from bits of signed 8-bit int's */
+                               j = 7;
+                               axes[n][0] = (data[JS_N64_X - j] & s) ? ~0x7f : 0;
+                               axes[n][1] = (data[JS_N64_Y - j] & s) ? ~0x7f : 0;
+                               while ( j-- > 0 ) {
+                                       axes[n][0] |= (data[JS_N64_X - j] & s) ? (1 << j) : 0; 
+                                       axes[n][1] |= (data[JS_N64_Y - j] & s) ? (1 << j) : 0; 
+                               }
+                                               /* flip Y-axis for conformity */
+                               axes[n][1] = -axes[n][1];
+
                        }
                }
        }
@@ -300,21 +439,18 @@ static int js_console_read(void *xinfo, int **axes, int **buttons)
 
                for (i = 0; i < 5; i++) {
                        s = status_bit[i];
+                       n = info->pad_to_device[i];
                        if (info->multi & s) {
                                axes[n][0] = (data[JS_MULTI_RIGHT]&s?1:0) - (data[JS_MULTI_LEFT]&s?1:0);
                                axes[n][1] = (data[JS_MULTI_DOWN] &s?1:0) - (data[JS_MULTI_UP]  &s?1:0);
 
                                buttons[n][0] = (data[JS_MULTI_BUTTON]&s)?1:0;
-
-                               n++;
                        } else
                        if (info->multi2 & s) {
                                axes[n][0] = (data[JS_MULTI_RIGHT]&s?1:0) - (data[JS_MULTI_LEFT]&s?1:0);
                                axes[n][1] = (data[JS_MULTI_DOWN] &s?1:0) - (data[JS_MULTI_UP]  &s?1:0);
 
                                buttons[n][0] = (data[JS_MULTI_BUTTON]&s)?1:0 | (data[JS_MULTI_BUTTON2]&s)?2:0;
-
-                               n++;
                        }
                }
        }
@@ -323,18 +459,44 @@ static int js_console_read(void *xinfo, int **axes, int **buttons)
  * PSX controllers
  */
 
-       if (info->psx && (js_psx_read_packet(info, 2, data) == JS_PSX_NORMAL)) {        /* FIXME? >1 PSX pads? */
+       if (info->psx) {
+
+               for ( i = 0; i < 5; i++ )
+                       if ( info->psx & status_bit[i] ) {
+                               n = info->pad_to_device[i];
+                               break;
+                       }
+
+               buttons[n][0] = 0;
+
+               switch (js_psx_read_packet(info, 6, data)) {
+
+                       case JS_PSX_ANALOGR:
+
+                               buttons[n][0] |= (data[0]&JS_PSX_JOYL?0:0x800) | (data[0]&JS_PSX_JOYR?0:0x400);
 
-               axes[n][0] = (data[0]&JS_PSX_RIGHT?0:1) - (data[0]&JS_PSX_LEFT?0:1);
-               axes[n][1] = (data[0]&JS_PSX_DOWN ?0:1) - (data[0]&JS_PSX_UP  ?0:1);
+                       case JS_PSX_ANALOGG:
+       
+                               axes[n][2] = data[2];
+                               axes[n][3] = data[3];
+                               axes[n][4] = data[4];
+                               axes[n][5] = data[5];
 
-               buttons[n][0] = ((~data[1]&0xf)<<4) | ((~data[1]&0xf0)>>4) |
-                               (data[0]&JS_PSX_START?0:0x200) | (data[0]&JS_PSX_SELBUT?0:0x100);
+                       case JS_PSX_NORMAL:
+                       case JS_PSX_NEGCON:
 
-               n++;
+                               axes[n][0] = (data[0]&JS_PSX_RIGHT?0:1) - (data[0]&JS_PSX_LEFT?0:1);
+                               axes[n][1] = (data[0]&JS_PSX_DOWN ?0:1) - (data[0]&JS_PSX_UP  ?0:1);
+
+                               buttons[n][0] |= ((~data[1]&0xf)<<4) | ((~data[1]&0xf0)>>4) |
+                                       (data[0]&JS_PSX_START?0:0x200) | (data[0]&JS_PSX_SELBUT?0:0x100);
+               
+                               break;
+
+               }
        }
 
-       return -(n != info->pads);
+       return 0;
 }
 
 /*
@@ -343,10 +505,8 @@ static int js_console_read(void *xinfo, int **axes, int **buttons)
 
 int js_console_open(struct js_dev *dev)
 {
-#ifdef USE_PARPORT
        struct js_console_info *info = dev->port->info;
        if (!MOD_IN_USE && parport_claim(info->port)) return -EBUSY;
-#endif
        MOD_INC_USE_COUNT;
        return 0;
 }
@@ -357,13 +517,9 @@ int js_console_open(struct js_dev *dev)
 
 int js_console_close(struct js_dev *dev)
 {
-#ifdef USE_PARPORT
        struct js_console_info *info = dev->port->info;
-#endif
        MOD_DEC_USE_COUNT;
-#ifdef USE_PARPORT
        if (!MOD_IN_USE) parport_release(info->port);
-#endif
        return 0;
 }
 
@@ -373,16 +529,12 @@ void cleanup_module(void)
        struct js_console_info *info;
        int i;
 
-       while (js_console_port != NULL) {
+       while (js_console_port) {
                for (i = 0; i < js_console_port->ndevs; i++)
-                       if (js_console_port->devs[i] != NULL)
+                       if (js_console_port->devs[i])
                                js_unregister_device(js_console_port->devs[i]);
                info = js_console_port->info;
-#ifdef USE_PARPORT
                parport_unregister_device(info->port);
-#else
-               release_region(info->port, 3);
-#endif
                js_console_port = js_unregister_port(js_console_port);
        }
 }
@@ -393,7 +545,7 @@ void cleanup_module(void)
  * console gamepads.
  */
 
-static void __init js_console_init_corr(int num_axes, struct js_corr *corr)
+static void __init js_console_init_corr(int num_axes, int type, struct js_corr *corr)
 {
        int i;
 
@@ -405,6 +557,28 @@ static void __init js_console_init_corr(int num_axes, struct js_corr *corr)
                corr[i].coef[2] = (1 << 29);
                corr[i].coef[3] = (1 << 29);
        }
+
+       if (type == JS_N64_PAD || type == JS_N64_PAD_DPP) {
+               for (i = 0; i < 2; i++) {
+                       corr[i].type = JS_CORR_BROKEN;
+                       corr[i].prec = 0;
+                       corr[i].coef[0] = 0;
+                       corr[i].coef[1] = 0;
+                       corr[i].coef[2] = (1 << 22);
+                       corr[i].coef[3] = (1 << 22);
+               }
+       }
+
+       if (type == JS_PSX_ANALOGG || type == JS_PSX_ANALOGR) {
+               for (i = 2; i < 6; i++)  {
+                       corr[i].type = JS_CORR_BROKEN;
+                       corr[i].prec = 0;
+                       corr[i].coef[0] = 127 - 2;
+                       corr[i].coef[1] = 128 + 2;
+                       corr[i].coef[2] = (1 << 29) / (127 - 4);
+                       corr[i].coef[3] = (1 << 29) / (127 - 4);
+               }
+       }
 }
 
 /*
@@ -415,45 +589,40 @@ static void __init js_console_init_corr(int num_axes, struct js_corr *corr)
 static struct js_port __init *js_console_probe(int *config, struct js_port *port)
 {
        char *name[5];
-       int i, psx, axes[5], buttons[5];
+       int i, psx, axes[5], buttons[5], type[5];
        unsigned char data[2];                  /* used for PSX probe */
        struct js_console_info info;
+       struct parport *pp;
 
        memset(&info, 0, sizeof(struct js_console_info));
 
        if (config[0] < 0) return port;
 
-#ifdef USE_PARPORT
-       {
-               struct parport *pp;
-
-               if (config[0] > 0x10)
-                       for (pp=parport_enumerate(); pp != NULL && (pp->base!=config[0]); pp=pp->next);
-               else
-                       for (pp=parport_enumerate(); pp != NULL && (config[0]>0); pp=pp->next) config[0]--;
-
-               if (pp == NULL) {
-                       printk(KERN_ERR "joy-console: no such parport\n");
-                       return port;
-               }
+       if (config[0] > 0x10)
+               for (pp=parport_enumerate(); pp && (pp->base!=config[0]); pp=pp->next);
+       else
+               for (pp=parport_enumerate(); pp && (config[0]>0); pp=pp->next) config[0]--;
 
-               info.port = parport_register_device(pp, "joystick (console)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
-               if (!info.port)
-                       return port;
+       if (!pp) {
+               printk(KERN_ERR "joy-console: no such parport\n");
+               return port;
        }
 
+       info.port = parport_register_device(pp, "joystick (console)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+       if (!info.port)
+               return port;
+
        if (parport_claim(info.port))
        {
                parport_unregister_device(info.port);   /* port currently not available ... */
                return port;
        }
-#else
-       info.port = config[0];
-       if (check_region(info.port, 3)) return port;
-       request_region(info.port, 3, "joystick (console pad)");
-#endif
 
-       for (i = 0; i < 5; i++)
+       for (i = 0; i < 5; i++) {
+
+               type[info.pads] = config[i+1];
+               info.pad_to_device[i] = info.pads;
+
                switch(config[i+1]) {
 
                        case JS_NO_PAD:
@@ -478,6 +647,23 @@ static struct js_port __init *js_console_probe(int *config, struct js_port *port
                                info.pads++;
                                break;
 
+                       case JS_N64_PAD:
+                               axes[info.pads]    = 4;
+                               buttons[info.pads] = 10;
+                               name[info.pads]    = "N64 pad";
+                               info.n64 |= status_bit[i];
+                               info.pads++;
+                               break;
+
+                       case JS_N64_PAD_DPP:
+                               axes[info.pads]    = 2;
+                               buttons[info.pads] = 14;
+                               name[info.pads]    = "N64 pad (DPP mode)";
+                               info.n64 |= status_bit[i];
+                               info.n64_dpp |= status_bit[i];
+                               info.pads++;
+                               break;
+                               
                        case JS_MULTI_STICK:
 
                                axes[info.pads]    = 2;
@@ -497,31 +683,58 @@ static struct js_port __init *js_console_probe(int *config, struct js_port *port
                                break;
 
                        case JS_PSX_PAD:
-
+                               
                                info.psx |= status_bit[i];
                                psx = js_psx_read_packet(&info, 2, data);
                                psx = js_psx_read_packet(&info, 2, data);
                                info.psx &= ~status_bit[i];
 
+                               type[i] = psx;
+
                                switch(psx) {
                                        case JS_PSX_NORMAL:
                                                axes[info.pads]    = 2;
                                                buttons[info.pads] = 10;
-                                               name[info.pads]    = "PSX controller";
+                                               name[info.pads]    = "PSX pad";
                                                info.psx |= status_bit[i];
                                                info.pads++;
                                                break;
+
+                                       case JS_PSX_ANALOGR:
+                                               axes[info.pads]    = 6;
+                                               buttons[info.pads] = 12;
+                                               name[info.pads]    = "Analog Red PSX pad";
+                                               info.psx |= status_bit[i];
+                                               info.pads++;
+                                               break;
+
+                                       case JS_PSX_ANALOGG:
+                                               axes[info.pads]    = 6;
+                                               buttons[info.pads] = 10;
+                                               name[info.pads]    = "Analog Green PSX pad";
+                                               info.psx |= status_bit[i];
+                                               info.pads++;
+                                               break;
+
                                        case JS_PSX_NEGCON:
-                                               printk(KERN_WARNING "joy-console: NegCon not yet supported...\n");
+                                               axes[info.pads]    = 2;
+                                               buttons[info.pads] = 10;
+                                               name[info.pads]    = "NegCon PSX pad";
+                                               info.psx |= status_bit[i];
+                                               info.pads++;
                                                break;
+
                                        case JS_PSX_MOUSE:
-                                               printk(KERN_WARNING "joy-console: PSX mouse not supported...\n");
+                                               printk(KERN_WARNING "joy-psx: PSX mouse not supported...\n");
                                                break;
+
                                        case -1:
-                                               printk(KERN_ERR "joy-console: no PSX controller found...\n");
+                                               printk(KERN_ERR "joy-psx: no PSX controller found...\n");
                                                break;
+
                                        default:
-                                               printk(KERN_WARNING "joy-console: unknown PSX controller 0x%x\n", psx);
+                                               printk(KERN_WARNING "joy-psx: PSX controller unknown: 0x%x,"
+                                                       " please report to <vojtech@suse.cz>.\n", psx);
                                }
                                break;
 
@@ -529,52 +742,53 @@ static struct js_port __init *js_console_probe(int *config, struct js_port *port
 
                                printk(KERN_WARNING "joy-console: pad type %d unknown\n", config[i+1]);
                }
+       }
 
        if (!info.pads) {
-#ifdef USE_PARPORT
                parport_release(info.port);
                parport_unregister_device(info.port);
-#else
-               release_region(info.port, 3);
-#endif
                return port;
        }
 
        port = js_register_port(port, &info, info.pads, sizeof(struct js_console_info), js_console_read);
 
        for (i = 0; i < info.pads; i++) {
-#ifdef USE_PARPORT
                printk(KERN_INFO "js%d: %s on %s\n",
                        js_register_device(port, i, axes[i], buttons[i], name[i], js_console_open, js_console_close),
                        name[i], info.port->port->name);
-#else
-               printk(KERN_INFO "js%d: %s at %#x\n",
-                       js_register_device(port, i, axes[i], buttons[i], name[i], js_console_open, js_console_close),
-                       name[i], info.port);
-#endif
 
-               js_console_init_corr(axes[i], port->corr[i]);
+               js_console_init_corr(axes[i], type[i], port->corr[i]);
        }
 
-#ifdef USE_PARPORT
        parport_release(info.port);
-#endif
        return port;
 }
 
 #ifndef MODULE
-void __init js_console_setup(char *str, int *ints)
+int __init js_console_setup(SETUP_PARAM)
 {
        int i;
-
-       if (!strcmp(str,"js_console"))
-               for (i = 0; i <= ints[0] && i < 6; i++) js_console[i] = ints[i+1];
-       if (!strcmp(str,"js_console2"))
-               for (i = 0; i <= ints[0] && i < 6; i++) js_console2[i] = ints[i+1];
-       if (!strcmp(str,"js_console3"))
-               for (i = 0; i <= ints[0] && i < 6; i++) js_console3[i] = ints[i+1];
-
+       SETUP_PARSE(6);
+       for (i = 0; i <= ints[0] && i < 6; i++) js_console[i] = ints[i+1];
+       return 1;
+}
+int __init js_console_setup_2(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(6);
+       for (i = 0; i <= ints[0] && i < 6; i++) js_console_2[i] = ints[i+1];
+       return 1;
+}
+int __init js_console_setup_3(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(6);
+       for (i = 0; i <= ints[0] && i < 6; i++) js_console_3[i] = ints[i+1];
+       return 1;
 }
+__setup("js_console=", js_console_setup);
+__setup("js_console_2=", js_console_setup_2);
+__setup("js_console_3=", js_console_setup_3);
 #endif
 
 #ifdef MODULE
@@ -584,8 +798,8 @@ int __init js_console_init(void)
 #endif
 {
        js_console_port = js_console_probe(js_console, js_console_port);
-       js_console_port = js_console_probe(js_console2, js_console_port);
-       js_console_port = js_console_probe(js_console3, js_console_port);
+       js_console_port = js_console_probe(js_console_2, js_console_port);
+       js_console_port = js_console_probe(js_console_3, js_console_port);
 
        if (js_console_port) return 0;
 
diff --git a/drivers/char/joystick/joy-creative.c b/drivers/char/joystick/joy-creative.c
new file mode 100644 (file)
index 0000000..7e97a67
--- /dev/null
@@ -0,0 +1,287 @@
+/*
+ *  joy-creative.c  Version 1.2
+ *
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting
+ * Creative Labs Blaster gamepad family.
+ */
+
+/*
+ * 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 of the License, 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
+ * 
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/init.h>
+
+#define JS_CR_MAX_STROBE       100     /* 100 us max wait for first strobe */
+#define JS_CR_LENGTH           36
+
+#define JS_CR_MODE_BGPC                8
+
+static int js_cr_port_list[] __initdata = {0x201, 0};
+static struct js_port* js_cr_port __initdata = NULL;
+
+struct js_cr_info {
+       int io;
+       unsigned char mode[2];
+};
+
+/*
+ * js_cr_read_packet() reads a Blaster gamepad packet.
+ */
+
+static int js_cr_read_packet(int io, unsigned int *data)
+{
+       unsigned long flags;
+       unsigned char u, v, w;
+       __u64 buf[2];
+       int r[2], t[2], p[2];
+       int i, j, ret;
+
+       for (i = 0; i < 2; i++); {
+               r[i] = buf[i] = 0;
+               p[i] = t[i] = JS_CR_MAX_STROBE;
+               p[i] += JS_CR_MAX_STROBE;
+       }
+       
+       __save_flags(flags);
+       __cli();
+
+       u = inb(io);
+
+       do {
+               t[0]--; t[1]--;
+               v = inb(io);
+               for (i = 0, w = u ^ v; i < 2 && w; i++, w >>= 2)
+                       if (w & 0x30) {
+                               if ((w & 0x30) < 0x30 && r[i] < JS_CR_LENGTH && t[i] > 0) {
+                                       buf[i] |= (__u64)((w >> 5) & 1) << r[i]++;
+                                       p[i] = t[i] = (p[i] - t[i]) << 1;
+                                       u = v;
+                               } else t[i] = 0;
+                       }
+       } while (t[0] > 0 || t[1] > 0);
+
+       __restore_flags(flags);
+
+
+       ret = 0;
+
+       for (i = 0; i < 2; i++) {
+
+               if (r[i] != JS_CR_LENGTH) continue;
+
+               for (j = 0; j < JS_CR_LENGTH && (buf[i] & 0x04104107f) ^ 0x041041040; j++)
+                       buf[i] = (buf[i] >> 1) | ((__u64)(buf[i] & 1) << (JS_CR_LENGTH - 1));
+
+               if (j < JS_CR_LENGTH) ret |= (1 << i);
+
+               data[i] = ((buf[i] >>  7) & 0x000001f) | ((buf[i] >>  8) & 0x00003e0)
+                       | ((buf[i] >>  9) & 0x0007c00) | ((buf[i] >> 10) & 0x00f8000)
+                       | ((buf[i] >> 11) & 0x1f00000);
+
+       }
+
+       return ret;
+}
+
+/*
+ * js_cr_read() reads and analyzes Blaster gamepad data.
+ */
+
+static int js_cr_read(void *xinfo, int **axes, int **buttons)
+{
+       struct js_cr_info *info = xinfo;
+       unsigned int data[2];
+       int i, r;
+
+       if (!(r = js_cr_read_packet(info->io, data)))
+               return -1;
+
+       for (i = 0; i < 2; i++)
+               if (r & (1 << i)) {
+                       switch (info->mode[i]) {
+
+                               case JS_CR_MODE_BGPC:
+
+                                       axes[i][0] = ((data[i] >> 4) & 1) - ((data[i] >> 3) & 1);
+                                       axes[i][1] = ((data[i] >> 2) & 1) - ((data[i] >> 1) & 1);
+
+                                       buttons[i][0] = ((data[i] >> 12) & 0x007) | ((data[i] >> 6) & 0x038)
+                                                     | ((data[i] >>  1) & 0x0c0) | ((data[i] >> 7) & 0x300)
+                                                     | ((data[i] <<  5) & 0xc00);
+
+                                       break;
+
+                               default:
+                                       break;
+
+                       }
+               }
+
+       return 0;
+}
+
+/*
+ * js_cr_open() is a callback from the file open routine.
+ */
+
+static int js_cr_open(struct js_dev *jd)
+{
+       MOD_INC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_cr_close() is a callback from the file release routine.
+ */
+
+static int js_cr_close(struct js_dev *jd)
+{
+       MOD_DEC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_cr_init_corr() initializes correction values of
+ * Blaster gamepads.
+ */
+
+static void __init js_cr_init_corr(int mode, struct js_corr *corr)
+{
+       int i;
+
+       switch (mode) {
+
+               case JS_CR_MODE_BGPC:
+
+                       for (i = 0; i < 2; i++) {
+                               corr[i].type = JS_CORR_BROKEN;
+                               corr[i].prec = 0;
+                               corr[i].coef[0] = 0;
+                               corr[i].coef[1] = 0;
+                               corr[i].coef[2] = (1 << 29);
+                               corr[i].coef[3] = (1 << 29);
+                       }
+
+                       break;
+
+       }
+}
+
+/*
+ * js_cr_probe() probes for Blaster gamepads.
+ */
+
+static struct js_port __init *js_cr_probe(int io, struct js_port *port)
+{
+       struct js_cr_info info;
+       char *names[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Blaster GamePad Cobra" };
+       char axes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2 };
+       char buttons[] = { 0, 0, 0, 0, 0, 0, 0, 0, 12 };
+       unsigned int data[2];
+       int i, r;
+
+       if (check_region(io, 1)) return port;
+
+       info.mode[0] = info.mode[1] = 0;
+
+       if (!(r = js_cr_read_packet(io, data)))
+               return port;
+
+       for (i = 0; i < 2; i++) {
+               if (r & (1 << i)) {
+                       if (~data[i] & 1) {
+                               info.mode[i] = JS_CR_MODE_BGPC;
+                       } else {
+                               info.mode[i] = (data[i] >> 2) & 7;
+                       }
+                       if (!names[info.mode[i]]) {
+                               printk(KERN_WARNING "joy-creative: Unknown Creative device %d at %#x\n",
+                                       info.mode[i], io);
+                               info.mode[i] = 0;
+                       }
+               }
+       }
+
+       if (!info.mode[0] && !info.mode[1]) return port;
+
+       info.io = io;
+
+       request_region(io, 1, "joystick (creative)");
+       port = js_register_port(port, &info, 2, sizeof(struct js_cr_info), js_cr_read);
+
+       for (i = 0; i < 2; i++)
+               if (info.mode[i]) {
+                       printk(KERN_INFO "js%d: %s at %#x\n",
+                               js_register_device(port, i, axes[info.mode[i]], buttons[info.mode[i]],
+                                       names[info.mode[i]], js_cr_open, js_cr_close),
+                               names[info.mode[i]], io);
+                       js_cr_init_corr(info.mode[i], port->corr[i]);
+               }
+
+       return port;
+}
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_cr_init(void)
+#endif
+{
+       int *p;
+
+       for (p = js_cr_port_list; *p; p++) js_cr_port = js_cr_probe(*p, js_cr_port);
+       if (js_cr_port) return 0;
+
+#ifdef MODULE
+       printk(KERN_WARNING "joy-creative: no joysticks found\n");
+#endif
+
+       return -ENODEV;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+       int i;
+       struct js_cr_info *info;
+
+       while (js_cr_port) {
+               for (i = 0; i < js_cr_port->ndevs; i++)
+                       if (js_cr_port->devs[i])
+                               js_unregister_device(js_cr_port->devs[i]);
+               info = js_cr_port->info;
+               release_region(info->io, 1);
+               js_cr_port = js_unregister_port(js_cr_port);
+       }
+}
+#endif
index b459b91f5da4afea05652bae067788ecf463a37b..d5b6565eebadbed600ca1c382c39935e85b9c51c 100644 (file)
@@ -1,7 +1,10 @@
 /*
- * joy-db9.c  Version 0.5V
+ *  joy-db9.c  Version 0.6V
  *
- * Copyright (c) 1998 Andree Borrmann
+ *  Copyright (c) 1998 Andree Borrmann
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
  * 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
+ *
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
  */
 
 #include <asm/io.h>
@@ -35,8 +42,9 @@
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 
-MODULE_AUTHOR("Andree Borrmann <A.Borrmann@tu-bs.de>");
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_PARM(js_db9, "2i");
 MODULE_PARM(js_db9_2, "2i");
 MODULE_PARM(js_db9_3, "2i");
@@ -48,7 +56,8 @@ MODULE_PARM(js_db9_3, "2i");
 #define JS_GENESIS6_PAD        0x06
 #define JS_SATURN_PAD  0x07
 #define JS_MULTI_0802  0x08
-#define JS_MAX_PAD     0x09
+#define JS_MULTI_0802_2        0x09
+#define JS_MAX_PAD     0x0A
 
 #define JS_DB9_UP      0x01
 #define JS_DB9_DOWN    0x02
@@ -59,8 +68,8 @@ MODULE_PARM(js_db9_3, "2i");
 #define JS_DB9_FIRE3   0x40
 #define JS_DB9_FIRE4   0x80
 
-#define JS_DB9_NORMAL  0x22
-#define JS_DB9_NOSELECT        0x20
+#define JS_DB9_NORMAL  0x2a
+#define JS_DB9_NOSELECT        0x28
 
 #define JS_DB9_SATURN0 0x20
 #define JS_DB9_SATURN1 0x22
@@ -76,11 +85,7 @@ static int js_db9_2[] __initdata = { -1, 0 };
 static int js_db9_3[] __initdata = { -1, 0 };
 
 struct js_db9_info {
-#ifdef USE_PARPORT
        struct pardevice *port; /* parport device */
-#else
-       int port;               /* hw port */
-#endif
        int mode;               /* pad mode */
 };
 
@@ -95,6 +100,15 @@ static int js_db9_read(void *xinfo, int **axes, int **buttons)
 
        switch(info->mode)
        {
+         case JS_MULTI_0802_2:
+
+               data = JS_PAR_DATA_IN(info->port) >> 3;
+
+               axes[1][1] = (data&JS_DB9_DOWN ?0:1) - (data&JS_DB9_UP  ?0:1);
+               axes[1][0] = (data&JS_DB9_RIGHT?0:1) - (data&JS_DB9_LEFT?0:1);
+
+               buttons[1][0] = (data&JS_DB9_FIRE1?0:1);
+
          case JS_MULTI_0802:
 
                data = JS_PAR_STATUS(info->port) >> 3;
@@ -185,11 +199,12 @@ static int js_db9_read(void *xinfo, int **axes, int **buttons)
                udelay(JS_GENESIS6_DELAY);
                JS_PAR_CTRL_OUT(JS_DB9_NOSELECT, info->port); /* 3 */
                udelay(JS_GENESIS6_DELAY);
-               JS_PAR_CTRL_OUT(JS_DB9_NORMAL, info->port);
                data=JS_PAR_DATA_IN(info->port);
 
-               buttons[0][0] |= (data&JS_DB9_LEFT?0:0x10) | (data&JS_DB9_DOWN?0:0x20) | (data&JS_DB9_UP?0:0x40);
+               buttons[0][0] |= (data&JS_DB9_LEFT?0:0x10) | (data&JS_DB9_DOWN ?0:0x20) |
+                                (data&JS_DB9_UP  ?0:0x40) | (data&JS_DB9_RIGHT?0:0x80);
 
+               JS_PAR_CTRL_OUT(JS_DB9_NORMAL, info->port);
                udelay(JS_GENESIS6_DELAY);
                JS_PAR_CTRL_OUT(JS_DB9_NOSELECT, info->port); /* 4 */
                udelay(JS_GENESIS6_DELAY);
@@ -236,11 +251,11 @@ int js_db9_open(struct js_dev *dev)
        struct js_db9_info *info = dev->port->info;
 
        if (!MOD_IN_USE) {
-#ifdef USE_PARPORT
                if (parport_claim(info->port)) return -EBUSY;
-#endif
 
-               JS_PAR_ECTRL_OUT(0x35,info->port);              /* enable PS/2 mode: */
+               JS_PAR_DATA_OUT(0xff, info->port);
+               if (info->mode != JS_MULTI_0802)
+                       JS_PAR_ECTRL_OUT(0x35,info->port);      /* enable PS/2 mode: */
                JS_PAR_CTRL_OUT(JS_DB9_NORMAL,info->port);      /* reverse direction, enable Select signal */
        }
                
@@ -260,12 +275,11 @@ int js_db9_close(struct js_dev *dev)
 
        if (!MOD_IN_USE) {
 
-               JS_PAR_CTRL_OUT(0x00,info->port);       /* normal direction */
-               JS_PAR_ECTRL_OUT(0x15,info->port);      /* enable normal mode */
+               JS_PAR_CTRL_OUT(0x00,info->port);               /* normal direction */
+               if (info->mode != JS_MULTI_0802)
+                       JS_PAR_ECTRL_OUT(0x15,info->port);      /* enable normal mode */
 
-#ifdef USE_PARPORT
                parport_release(info->port);
-#endif
        }
        return 0;
 }
@@ -274,16 +288,15 @@ int js_db9_close(struct js_dev *dev)
 void cleanup_module(void)
 {
        struct js_db9_info *info;
+       int i;
 
-       while (js_db9_port != NULL) {
-               js_unregister_device(js_db9_port->devs[0]);
+       while (js_db9_port) {
                info = js_db9_port->info;
-#ifdef USE_PARPORT
+
+               for (i = 0; i < js_db9_port->ndevs; i++)
+                       if (js_db9_port->devs[i])
+                               js_unregister_device(js_db9_port->devs[i]);
                parport_unregister_device(info->port);
-#else
-               release_region(info->port, 3);
-               release_region(info->port+0x402, 1);
-#endif
                js_db9_port = js_unregister_port(js_db9_port);
        }
 
@@ -295,17 +308,17 @@ void cleanup_module(void)
  * db9 gamepads.
  */
 
-static void __init js_db9_init_corr(struct js_corr **corr)
+static void __init js_db9_init_corr(struct js_corr *corr)
 {
        int i;
 
        for (i = 0; i < 2; i++) {
-               corr[0][i].type = JS_CORR_BROKEN;
-               corr[0][i].prec = 0;
-               corr[0][i].coef[0] = 0;
-               corr[0][i].coef[1] = 0;
-               corr[0][i].coef[2] = (1 << 29);
-               corr[0][i].coef[3] = (1 << 29);
+               corr[i].type = JS_CORR_BROKEN;
+               corr[i].prec = 0;
+               corr[i].coef[0] = 0;
+               corr[i].coef[1] = 0;
+               corr[i].coef[2] = (1 << 29);
+               corr[i].coef[3] = (1 << 29);
        }
 }
 
@@ -316,75 +329,76 @@ static void __init js_db9_init_corr(struct js_corr **corr)
 static struct js_port __init *js_db9_probe(int *config, struct js_port *port)
 {
        struct js_db9_info info;
-       char buttons[JS_MAX_PAD] = {0,1,2,4,0,6,7,8,1};
+       struct parport *pp;
+       int i;
+       char buttons[JS_MAX_PAD] = {0,1,2,4,0,6,8,8,1,1};
        char *name[JS_MAX_PAD] = {NULL, "Multisystem joystick", "Multisystem joystick (2 fire)", "Genesis pad",
-                                       NULL, "Genesis 5 pad", "Genesis 6 pad", "Saturn pad", "Multisystem (0.8.0.2) joystick"};
+                                       NULL, "Genesis 5 pad", "Genesis 6 pad", "Saturn pad", "Multisystem (0.8.0.2) joystick",
+                                       "Multisystem (0.8.0.2-dual) joystick"};
 
        if (config[0] < 0) return port;
        if (config[1] < 0 || config[1] >= JS_MAX_PAD || !name[config[1]]) return port;
 
-#ifdef USE_PARPORT
-       {
-               struct parport *pp;
-
-               if (config[0] > 0x10)
-                       for (pp=parport_enumerate(); pp != NULL && (pp->base!=config[0]); pp=pp->next);
-               else
-                       for (pp=parport_enumerate(); pp != NULL && (config[0]>0); pp=pp->next) config[0]--;
-
-               if (pp == NULL) {
-                       printk(KERN_ERR "joy-db9: no such parport\n");
-                       return port;
-               }
-
-               if (!(pp->modes & PARPORT_MODE_TRISTATE)) {
-                       printk(KERN_ERR "js-db9: specified parport is not bidirectional\n");
-                       return port;
-               }
-
-               info.port = parport_register_device(pp, "joystick (db9)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
-               if (!info.port)
-                       return port;
+       info.mode = config[1];
+
+       if (config[0] > 0x10)
+               for (pp=parport_enumerate(); pp && (pp->base!=config[0]); pp=pp->next);
+       else
+               for (pp=parport_enumerate(); pp && (config[0]>0); pp=pp->next) config[0]--;
+
+       if (!pp) {
+               printk(KERN_ERR "joy-db9: no such parport\n");
+               return port;
        }
-#else
-       info.port = config[0];
-       if (check_region(info.port, 3) || check_region(info.port+0x402,1)) return port;
-       request_region(info.port, 3, "joystick (db9)");
-       request_region(info.port+0x402, 1, "joystick (db9)");
-#endif
 
-       info.mode = config[1];
+       if (!(pp->modes & (PARPORT_MODE_PCPS2 | PARPORT_MODE_PCECPPS2)) && info.mode != JS_MULTI_0802) {
+               printk(KERN_ERR "js-db9: specified parport is not bidirectional\n");
+               return port;
+       }
 
-       port = js_register_port(port, &info, 1, sizeof(struct js_db9_info), js_db9_read);
+       info.port = parport_register_device(pp, "joystick (db9)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+       if (!info.port)
+               return port;
 
-#ifdef USE_PARPORT
-       printk(KERN_INFO "js%d: %s on %s\n",
-               js_register_device(port, 0, 2, buttons[info.mode], name[info.mode], js_db9_open, js_db9_close),
-               name[info.mode], info.port->port->name);
-#else
-       printk(KERN_INFO "js%d: %s at %#x\n",
-               js_register_device(port, 0, 2, buttons[info.mode], name[info.mode], js_db9_open, js_db9_close),
-               name[info.mode], info.port);
-#endif
+       port = js_register_port(port, &info, 1 + (info.mode == JS_MULTI_0802_2), sizeof(struct js_db9_info), js_db9_read);
+
+       for (i = 0; i < 1 + (info.mode == JS_MULTI_0802_2); i++) {
+               printk(KERN_INFO "js%d: %s on %s\n",
+                       js_register_device(port, i, 2, buttons[info.mode], name[info.mode], js_db9_open, js_db9_close),
+                       name[info.mode], info.port->port->name);
+
+               js_db9_init_corr(port->corr[i]);
+       }
 
-       js_db9_init_corr(port->corr);
 
        return port;
 }
 
 #ifndef MODULE
-void __init js_db9_setup(char *str, int *ints)
+int __init js_db9_setup(SETUP_PARAM)
 {
        int i;
-
-       if (!strcmp(str,"js_db9"))
-               for (i = 0; i <= ints[0] && i < 2; i++) js_db9[i] = ints[i+1];
-       if (!strcmp(str,"js_db9_2"))
-               for (i = 0; i <= ints[0] && i < 2; i++) js_db9_2[i] = ints[i+1];
-       if (!strcmp(str,"js_db9_3"))
-               for (i = 0; i <= ints[0] && i < 2; i++) js_db9_3[i] = ints[i+1];
-
+       SETUP_PARSE(2);
+       for (i = 0; i <= ints[0] && i < 2; i++) js_db9[i] = ints[i+1];
+       return 1;
+}
+int __init js_db9_setup_2(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(2);
+       for (i = 0; i <= ints[0] && i < 2; i++) js_db9_2[i] = ints[i+1];
+       return 1;
+}
+int __init js_db9_setup_3(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(2);
+       for (i = 0; i <= ints[0] && i < 2; i++) js_db9_3[i] = ints[i+1];
+       return 1;
 }
+__setup("js_db9=", js_db9_setup);
+__setup("js_db9_2=", js_db9_setup_2);
+__setup("js_db9_3=", js_db9_setup_3);
 #endif
 
 #ifdef MODULE
index 7416527e49c909dd2bb49d7d0d63f82c14ac0111..3863d161f4cf000184ce85e175020198e8d7cf21 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-gravis.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/init.h>
 
 #define JS_GR_MODE_GPP         1
 #define JS_GR_LENGTH_GPP       24
-#define JS_GR_STROBE_GPP       75
+#define JS_GR_STROBE_GPP       400
 
 #define JS_GR_MODE_XT          2
 #define JS_GR_MODE_BD          3
 #define JS_GR_LENGTH_XT                4
-#define JS_GR_STROBE_XT                30
+#define JS_GR_STROBE_XT                200
 #define JS_GR_MAX_CHUNKS_XT    10      
 #define JS_GR_MAX_BITS_XT      30      
 
@@ -63,37 +66,36 @@ struct js_gr_info {
 
 static int js_gr_gpp_read_packet(int io, int shift, unsigned int *data)
 {
-       unsigned int t, t1;
+       unsigned long flags;
        unsigned char u, v;
+       unsigned int t, p;
        int i;
-       unsigned long flags;
-
-       int strobe = (js_time_speed * JS_GR_STROBE_GPP) >> 10;
 
        i = 0;
        data[0] = 0;
+       p = t = JS_GR_STROBE_GPP;
+       p += JS_GR_STROBE_GPP;
 
        __save_flags(flags);
        __cli();
-       u = inb(io) >> shift;
-       t = js_get_time();
+
+       v = inb(io) >> shift;
 
        do {
-               v = (inb(io) >> shift) & 3;
-               t1 = js_get_time();
-               if ((u ^ v) & u & 1) {
+               t--;
+               u = v; v = (inb(io) >> shift) & 3;
+               if (~v & u & 1) {
                        data[0] |= (v >> 1) << i++;
-                       t = t1;
+                       p = t = (p - t) << 1;
                }
-               u = v;
-       } while (i < JS_GR_LENGTH_GPP && js_delta(t1,t) < strobe);
+       } while (i < JS_GR_LENGTH_GPP && t > 0);
 
        __restore_flags(flags);
 
        if (i < JS_GR_LENGTH_GPP) return -1;
 
        for (i = 0; i < JS_GR_LENGTH_GPP && (data[0] & 0xfe4210) ^ 0x7c0000; i++)
-               data[0] = data[0] >> 1 | (data[0] & 1) << 23;
+               data[0] = data[0] >> 1 | (data[0] & 1) << (JS_GR_LENGTH_GPP - 1);
 
        return -(i == JS_GR_LENGTH_GPP);
 }
@@ -104,35 +106,36 @@ static int js_gr_gpp_read_packet(int io, int shift, unsigned int *data)
 
 static int js_gr_xt_read_packet(int io, int shift, unsigned int *data)
 {
-       unsigned int t, t1;
-       unsigned char u, v, w;
        unsigned int i, j, buf, crc;
+       unsigned char u, v, w;
        unsigned long flags;
+       unsigned int t, p;
        char status;
 
-       int strobe = (js_time_speed * JS_GR_STROBE_XT) >> 10;
-
        data[0] = data[1] = data[2] = data[3] = 0;
        status = buf = i = j = 0;
+       p = t = JS_GR_STROBE_XT;
+       p += JS_GR_STROBE_XT;
 
        __save_flags(flags);
        __cli();
 
        v = w = (inb(io) >> shift) & 3;
-       t = js_get_time();
 
        do {
+               t--;
                u = (inb(io) >> shift) & 3;
-               t1 = js_get_time();
 
                if (u ^ v) {
 
                        if ((u ^ v) & 1) {
+                               p = t = (p - t) << 2;
                                buf = (buf << 1) | (u >> 1);
                                i++;
                        } else 
 
                        if ((((u ^ v) & (v ^ w)) >> 1) & ~(u | v | w) & 1) {
+                               p = t = (p - t) << 2;
                                if (i == 20) {
                                        crc = buf ^ (buf >> 7) ^ (buf >> 14);
                                        if (!((crc ^ (0x25cb9e70 >> ((crc >> 2) & 0x1c))) & 0xf)) {
@@ -145,12 +148,11 @@ static int js_gr_xt_read_packet(int io, int shift, unsigned int *data)
                                i = 0;
                        }
 
-                       t = t1;
                        w = v;
                        v = u;
                }
 
-       } while (status != 0xf && i < JS_GR_MAX_BITS_XT && j < JS_GR_MAX_CHUNKS_XT && js_delta(t1,t) < strobe);
+       } while (status != 0xf && i < JS_GR_MAX_BITS_XT && j < JS_GR_MAX_CHUNKS_XT && t > 0);
 
        __restore_flags(flags);
 
@@ -320,7 +322,7 @@ static void __init js_gr_init_corr(int mode, struct js_corr *corr)
 }
 
 /*
- * js_gr_probe() probes fro GrIP joysticks.
+ * js_gr_probe() probes for GrIP joysticks.
  */
 
 static struct js_port __init *js_gr_probe(int io, struct js_port *port)
@@ -389,9 +391,9 @@ void cleanup_module(void)
        int i;
        struct js_gr_info *info;
 
-       while (js_gr_port != NULL) {
+       while (js_gr_port) {
                for (i = 0; i < js_gr_port->ndevs; i++)
-                       if (js_gr_port->devs[i] != NULL)
+                       if (js_gr_port->devs[i])
                                js_unregister_device(js_gr_port->devs[i]);
                info = js_gr_port->info;
                release_region(info->io, 1);
index 3b337fd9fcdef3a9544c351f8f002bb9c31e74f4..038d33a3c1ca1c5ff046b852bf70ffca39b644ce 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-lightning.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
@@ -38,6 +40,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/init.h>
 
 #define JS_L4_PORT             0x201
 #define JS_L4_SELECT_ANALOG    0xa4
@@ -55,7 +58,7 @@ static struct js_port* __initdata js_l4_port = NULL;
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_PARM(js_l4, "2-24i");
 
-static int js_l4[]={-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0};
+static int __initdata js_l4[] = { -1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0 };
 
 #include "joy-analog.h"
 
@@ -70,11 +73,10 @@ struct js_l4_info {
 
 static int js_l4_wait_ready(void)
 {
-       unsigned int t, t1, timeout;
-       timeout = (JS_L4_TIMEOUT * js_time_speed) >> 10;
-       t = t1 = js_get_time();
-       while ((inb(JS_L4_PORT) & JS_L4_BUSY) && (js_delta(t1 = js_get_time(), t) < timeout));
-       return -(js_delta(t1, t) >= timeout);
+       unsigned int t;
+       t = JS_L4_TIMEOUT;
+       while ((inb(JS_L4_PORT) & JS_L4_BUSY) && t > 0) t--;
+       return -(t<=0);
 }
 
 /*
@@ -255,14 +257,14 @@ static struct js_port __init *js_l4_probe(unsigned char *cards, int l4port, int
 
        port = js_register_port(port, info, numdev, sizeof(struct js_l4_info), js_l4_read);
 
+       info = port->info;
+
        for (i = 0; i < numdev; i++)
                printk(KERN_INFO "js%d: %s on L4 port %d\n",
                        js_register_device(port, i, js_an_axes(i, &info->an), js_an_buttons(i, &info->an),
                                js_an_name(i, &info->an), js_l4_open, js_l4_close),
                        js_an_name(i, &info->an), info->port);
 
-       info = port->info;
-
        js_l4_calibrate(info);
        js_l4_read(info, port->axes, port->buttons);
        js_an_init_corr(&info->an, port->axes, port->corr, 0);
@@ -300,18 +302,21 @@ static void __init js_l4_card_probe(unsigned char *cards)
 
                cards[i] = rev; 
 
-               printk(KERN_INFO "js: PDPI Lightning 4 %s card (ports %d-%d) firmware v%d.%d found at %#x\n",
+               printk(KERN_INFO "js: PDPI Lightning 4 %s card (ports %d-%d) firmware v%d.%d at %#x\n",
                        i ? "secondary" : "primary", (i << 2), (i << 2) + 3, rev >> 4, rev & 0xf, JS_L4_PORT);
        }
 
 }
 
 #ifndef MODULE
-void __init js_l4_setup(char *str, int *ints)
+int __init js_l4_setup(SETUP_PARAM)
 {
        int i;
+       SETUP_PARSE(24);
        for (i = 0; i <= ints[0] && i < 24; i++) js_l4[i] = ints[i+1];
+       return 1;
 }
+__setup("js_l4=", js_l4_setup);
 #endif
 
 #ifdef MODULE
@@ -333,7 +338,7 @@ int __init js_l4_init(void)
                        js_l4_port = js_l4_probe(cards, i, 0, 0, js_l4_port);
        }
 
-       if (js_l4_port == NULL) {
+       if (!js_l4_port) {
 #ifdef MODULE
                printk(KERN_WARNING "joy-lightning: no joysticks found\n");
 #endif
@@ -352,9 +357,9 @@ void cleanup_module(void)
        int cal[4] = {59, 59, 59, 59};
        struct js_l4_info *info;
 
-       while (js_l4_port != NULL) {
+       while (js_l4_port) {
                for (i = 0; i < js_l4_port->ndevs; i++)
-                       if (js_l4_port->devs[i] != NULL)
+                       if (js_l4_port->devs[i])
                                js_unregister_device(js_l4_port->devs[i]);
                info = js_l4_port->info;
                js_l4_setcal(info->port, cal);
index 064ecade4bffe2f3ca79255dda9b62e2b260daaf..daea89c8bd3f17d72e1ed5aa3916f82ae3d6b2f7 100644 (file)
@@ -1,12 +1,14 @@
 /*
  *  joy-logitech.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
  * This is a module for the Linux joystick driver, supporting
- * Logitech Digital joystick family.
+ * Logitech ADI joystick family.
  */
 
 /*
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/malloc.h>
+#include <linux/init.h>
+
+/*
+ * Times array sizes, flags, ids.
+ */
+
+#undef JS_LT_DEBUG
+
+#define JS_LT_MAX_START                400     /* Trigger to packet timeout [400us] */
 
-#define JS_LT_MAX_START                250
-#define JS_LT_MAX_STROBE       25
-#define JS_LT_MAX_LENGTH       72
+#define JS_LT_MAX_LENGTH       256
+#define JS_LT_MIN_LENGTH       8
+#define JS_LT_MIN_LEN_LENGTH   10
+#define JS_LT_MIN_ID_LENGTH    66
+#define JS_LT_MAX_NAME_LENGTH  16
 
-#define JS_LT_MAX_DELAY                12000
+#define JS_LT_INIT_DELAY       10      /* Delay after init packet [10ms] */
+#define JS_LT_DATA_DELAY       4       /* Delay after data packet [4ms] */
 
-#define JS_LT_MODE_WMED                1
-#define JS_LT_MODE_CM2         2
-#define JS_LT_MODE_TPD         3
+#define JS_LT_FLAG_HAT         0x04
+#define JS_LT_FLAG_10BIT       0x08
 
-static int js_lt_seq_init[] __initdata = { 6000, 11000, 7000, 9000, 6000, 11000, 7000, 9000, 0 };
-static int js_lt_seq_reset[] __initdata = { 2000, 3000, 2000, 3000, 0 };
+#define JS_LT_ID_WMED          0x00
+#define JS_LT_ID_TPD           0x01
+#define JS_LT_ID_WMI           0x04
+#define JS_LT_ID_WGP           0x06
+#define JS_LT_ID_WM3D          0x07
+#define JS_LT_ID_WGPE          0x08
 
-static int js_lt_port_list[] __initdata = {0x201, 0};
+#define JS_LT_BUG_BUTTONS      0x01
+#define JS_LT_BUG_LONGID       0x02
+#define JS_LT_BUG_LONGDATA     0x04
+#define JS_LT_BUG_IGNTRIG      0x08
+
+/*
+ * Port probing variables.
+ */
+
+static int js_lt_port_list[] __initdata = { 0x201, 0 };
 static struct js_port* js_lt_port __initdata = NULL;
 
+/*
+ * Device names.
+ */
+
+#define JS_LT_MAX_ID           10
+
+static char *js_lt_names[] = { "WingMan Extreme Digital", "ThunderPad Digital", "SideCar", "CyberMan 2",
+                               "WingMan Interceptor", "WingMan Formula", "WingMan GamePad", 
+                               "WingMan Extreme Digital 3D", "WingMan GamePad Extreme", 
+                               "WingMan GamePad USB", "Unknown Device %#x"};
+
+/*
+ * Hat to axis conversion arrays.
+ */
+
 static struct {
        int x;
        int y;
 } js_lt_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
 
+/*
+ * Per-port information.
+ */
+
 struct js_lt_info {
-       int io;
-       unsigned char mode;
+       int  io;
+       int  length[2];
+       int  ret[2];
+       int  idx[2];
+       unsigned char id[2];
+       char buttons[2];
+       char axes10[2];
+       char axes8[2];
+       char pad[2];
+       char hats[2];
+       char name[2][JS_LT_MAX_NAME_LENGTH];
+       unsigned char data[2][JS_LT_MAX_LENGTH];
+       char bugs[2];
 };
 
 /*
- * js_lt_read_packet() reads a Logitech packet.
+ * js_lt_read_packet() reads a Logitech ADI packet.
  */
 
-static int js_lt_read_packet(int io, __u64 *data)
+static void js_lt_read_packet(struct js_lt_info *info)
 {
-
-       static unsigned char buf[JS_LT_MAX_LENGTH];
-       unsigned char u, v, w, mask = 0;
-       int i;
+       unsigned char u, v, w, x, z;
+       int t[2], s[2], p[2], i;
        unsigned long flags;
-       unsigned int t, t1;
-
-       int start = (js_time_speed * JS_LT_MAX_START) >> 10;
-       int strobe = (js_time_speed * JS_LT_MAX_STROBE) >> 10;
 
-       u = inb(io) >> 4;
-
-       if (u == 0xc) mask = 0x10;
-       if (u == 0x0) mask = 0x50;
-       if (!mask) return 0;
-
-       i = 0;
+       for (i = 0; i < 2; i++) {
+               info->ret[i] = -1;
+               p[i] = t[i] = JS_LT_MAX_START;
+               s[i] = 0;
+       }
 
        __save_flags(flags);
        __cli();
 
-       outb(0xff,io);
+       outb(0xff, info->io);
+       v = z = inb(info->io);
 
-       u = inb(io);
-       t = js_get_time();
+       do {
+               u = v;
+               w = u ^ (v = x = inb(info->io));
+               for (i = 0; i < 2; i++, w >>= 2, x >>= 2) {
+                       t[i]--;
+                       if ((w & 0x30) && s[i]) {
+                               if ((w & 0x30) < 0x30 && info->ret[i] < JS_LT_MAX_LENGTH && t[i] > 0) {
+                                       info->data[i][++info->ret[i]] = w;
+                                       p[i] = t[i] = (p[i] - t[i]) << 1;
+                               } else t[i] = 0;
+                       } else if (!(x & 0x30)) s[i] = 1;
+               }
+       } while (t[0] > 0 || t[1] > 0);
 
-       if ((u & 0xc) != 0xc) mask = 0x10;
+       __restore_flags(flags);
 
-       do {
-               u = inb(io);
-               t1 = js_get_time();
-       } while ((((u >> 1) ^ u) & mask) != mask && js_delta(t1,t) < start);
+       for (i = 0; i < 2; i++, z >>= 2)
+               if ((z & 0x30) && info->ret[i] > 0)
+                       info->bugs[i] |= JS_LT_BUG_BUTTONS;
+
+#ifdef JS_LT_DEBUG
+       printk(KERN_DEBUG "joy-logitech: read %d %d bits\n", info->ret[0], info->ret[1]);
+       printk(KERN_DEBUG "joy-logitech: stream0:");
+       for (i = 0; i <= info->ret[0]; i++) printk("%d", (info->data[0][i] >> 5) & 1);
+       printk("\n");
+       printk(KERN_DEBUG "joy-logitech: stream1:");
+       for (i = 0; i <= info->ret[1]; i++) printk("%d", (info->data[1][i] >> 5) & 1);
+       printk("\n");
+#endif
 
-       t = t1;
+       return;
+}
 
-       do {
-               v = inb(io);
-               t1 = js_get_time();
-               w = u ^ v;
-               if ((((w >> 1) ^ w) & mask) == mask) {
-                       buf[i++] = w;
-                       t = t1;
-                       u = v;
-               }
-       } while (i < JS_LT_MAX_LENGTH && js_delta(t1,t) < strobe);
+/*
+ * js_lt_move_bits() detects a possible 2-stream mode, and moves
+ * the bits accordingly. 
+ */
 
-       __restore_flags(flags);
+static void js_lt_move_bits(struct js_lt_info *info, int length)
+{
+       int i;
 
-       t = i;
-       *data = 0;
+       info->idx[0] = info->idx[1] = 0;
 
-       if (mask == 0x10) {
-               for (i = 0; i < t; i++)
-                       *data = ((buf[i] >> 5) & 1) | (*data << 1);
-               return t;
-       }
-       if (mask == 0x50) {
-               for (i = 0; i < t; i++)
-                       *data = ((__u64)(buf[i] & 0x20) << (t - 5)) | (buf[i] >> 7) | (*data << 1);
-               return t << 1;
-       }
-       return 0;
+       if (info->ret[0] <= 0 || info->ret[1] <= 0) return;
+       if (info->data[0][0] & 0x20 || ~info->data[1][0] & 0x20) return;
+
+       for (i = 1; i <= info->ret[1]; i++)
+               info->data[0][((length - 1) >> 1) + i + 1] = info->data[1][i];
+
+       info->ret[0] += info->ret[1];
+       info->ret[1] = -1;
 }
 
 /*
- * js_lt_reverse() reverses the order of bits in a byte.
+ * js_lt_get_bits() gathers bits from the data packet.
  */
 
-static unsigned char js_lt_reverse(unsigned char u)
+static inline int js_lt_get_bits(struct js_lt_info *info, int device, int count)
 {
-       u = ((u & 0x0f) << 4) | ((u >> 4) & 0x0f);
-       u = ((u & 0x33) << 2) | ((u >> 2) & 0x33);
-       u = ((u & 0x55) << 1) | ((u >> 1) & 0x55);
-       return u;
+       int bits = 0;
+       int i;
+       if ((info->idx[device] += count) > info->ret[device]) return 0;
+       for (i = 0; i < count; i++) bits |= ((info->data[device][info->idx[device] - i] >> 5) & 1) << i; 
+       return bits;
 }
 
 /*
@@ -154,54 +218,61 @@ static unsigned char js_lt_reverse(unsigned char u)
 static int js_lt_read(void *xinfo, int **axes, int **buttons)
 {
        struct js_lt_info *info = xinfo;
-       __u64 data;
-       int hat;
-
-       switch (info->mode) {
-
-               case JS_LT_MODE_TPD:
+       int i, j, k, l, t;
+       int ret = 0;
 
-                       if (js_lt_read_packet(info->io, &data) != 20) return -1;
+       js_lt_read_packet(info);
+       js_lt_move_bits(info, info->length[0]);
 
-                       axes[0][0] = ((data >> 6) & 1) - ((data >> 4) & 1);
-                       axes[0][1] = ((data >> 5) & 1) - ((data >> 7) & 1);
+       for (i = 0; i < 2; i++) {
 
-                       buttons[0][0] = js_lt_reverse((data & 0x0f) | ((data >> 4) & 0xf0));
-
-                       return 0;
-
-               case JS_LT_MODE_WMED:
-
-                       if (js_lt_read_packet(info->io, &data) != 42) return -1;
-                       if ((hat = data & 0xf) > 8) return -1;
-
-                       axes[0][0] = (data >> 26) & 0xff;
-                       axes[0][1] = (data >> 18) & 0xff;
-                       axes[0][2] = (data >> 10) & 0xff;
-                       axes[0][3] = js_lt_hat_to_axis[hat].x;
-                       axes[0][4] = js_lt_hat_to_axis[hat].y;
+               if (!info->length[i]) continue;
+               
+               if (info->length[i] > info->ret[i] ||
+                   info->id[i] != (js_lt_get_bits(info, i, 4) | (js_lt_get_bits(info, i, 4) << 4))) {
+                       ret = -1;
+                       continue;
+               }
 
-                       buttons[0][0] = js_lt_reverse((data >> 2) & 0xfc);
+               if (info->length[i] < info->ret[i])
+                       info->bugs[i] |= JS_LT_BUG_LONGDATA;
+                       
+               k = l = 0;
 
-                       return 0;
+               for (j = 0; j < info->axes10[i]; j++) 
+                       axes[i][k++] = js_lt_get_bits(info, i, 10);
 
-               case JS_LT_MODE_CM2:
+               for (j = 0; j < info->axes8[i]; j++) 
+                       axes[i][k++] = js_lt_get_bits(info, i, 8);
 
-                       if (js_lt_read_packet(info->io, &data) != 64) return -1;
+               for (j = 0; j <= (info->buttons[i] - 1) >> 5; j++) buttons[i][j] = 0;
 
-                       axes[0][0] = (data >> 48) & 0xff;
-                       axes[0][1] = (data >> 40) & 0xff;
-                       axes[0][2] = (data >> 32) & 0xff;
-                       axes[0][3] = (data >> 24) & 0xff;
-                       axes[0][4] = (data >> 16) & 0xff;
-                       axes[0][5] = (data >>  8) & 0xff;
+               for (j = 0; j < info->buttons[i] && j < 63; j++) {
+                       if (j == info->pad[i]) {
+                               t = js_lt_get_bits(info, i, 4);
+                               axes[i][k++] = ((t >> 2) & 1) - ( t       & 1);
+                               axes[i][k++] = ((t >> 1) & 1) - ((t >> 3) & 1);
+                       }
+                       buttons[i][l >> 5] |= js_lt_get_bits(info, i, 1) << (l & 0x1f);
+                       l++;
+               }
 
-                       buttons[0][0] = js_lt_reverse(data & 0xff);
+               for (j = 0; j < info->hats[i]; j++) {
+                       if((t = js_lt_get_bits(info, i, 4)) > 8) {
+                               if (t != 15) ret = -1; /* Hat press */
+                               t = 0;
+                       }
+                       axes[i][k++] = js_lt_hat_to_axis[t].x;
+                       axes[i][k++] = js_lt_hat_to_axis[t].y;
+               }
 
-                       return 0;
+               for (j = 63; j < info->buttons[i]; j++) {
+                       buttons[i][l >> 5] |= js_lt_get_bits(info, i, 1) << (l & 0x1f);
+                       l++;
+               }
        }
 
-       return -1;
+       return ret;
 }
 
 /*
@@ -225,15 +296,18 @@ static int js_lt_close(struct js_dev *jd)
 }
 
 /*
- * js_lt_trigger_sequence() sends a trigger & delay sequence
- * to reset/initialize a Logitech joystick.
+ * js_lt_init_digital() sends a trigger & delay sequence
+ * to reset and initialize a Logitech joystick into digital mode.
  */
 
-static void __init js_lt_trigger_sequence(int io, int *seq)
+static void __init js_lt_init_digital(int io)
 {
-       while (*seq) {
+       int seq[] = { 3, 2, 3, 10, 6, 11, 7, 9, 11, 0 };
+       int i;
+
+       for (i = 0; seq[i]; i++) {
                outb(0xff,io);
-               udelay(*seq++);
+               mdelay(seq[i]);
        }
 }
 
@@ -242,35 +316,45 @@ static void __init js_lt_trigger_sequence(int io, int *seq)
  * Logitech joysticks.
  */
 
-static void __init js_lt_init_corr(int num_axes, int mode, int **axes, struct js_corr **corr)
+static void __init js_lt_init_corr(int id, int naxes10, int naxes8, int naxes1, int *axes, struct js_corr *corr)
 {
        int j;
-
-       for (j = 0; j < num_axes; j++) {
-               corr[0][j].type = JS_CORR_BROKEN;
-               corr[0][j].prec = 2;
-               corr[0][j].coef[0] = axes[0][j] - 8;
-               corr[0][j].coef[1] = axes[0][j] + 8;
-               corr[0][j].coef[2] = (1 << 29) / (127 - 32);
-               corr[0][j].coef[3] = (1 << 29) / (127 - 32);
+       
+       if (id == JS_LT_ID_WMED) axes[2] = 128; /* Throttle fixup */
+       if (id == JS_LT_ID_WMI)  axes[2] = 512;
+       if (id == JS_LT_ID_WM3D) axes[3] = 128; 
+
+       if (id == JS_LT_ID_WGPE) {              /* Tilt fixup */
+               axes[0] = 512;
+               axes[1] = 512;
        }
 
-       switch (mode) {
-               case JS_LT_MODE_TPD:  j = 0; break;
-               case JS_LT_MODE_WMED: j = 3; break;
-               case JS_LT_MODE_CM2:  j = 6; break;
-               default:              j = 0; break;
+       for (j = 0; j < naxes10; j++) {
+               corr[j].type = JS_CORR_BROKEN;
+               corr[j].prec = 2;
+               corr[j].coef[0] = axes[j] - 16;
+               corr[j].coef[1] = axes[j] + 16;
+               corr[j].coef[2] = (1 << 29) / (256 - 32);
+               corr[j].coef[3] = (1 << 29) / (256 - 32);
        }
 
-       for (; j < num_axes; j++) {
-               corr[0][j].type = JS_CORR_BROKEN;
-               corr[0][j].prec = 0;
-               corr[0][j].coef[0] = 0;
-               corr[0][j].coef[1] = 0;
-               corr[0][j].coef[2] = (1 << 29);
-               corr[0][j].coef[3] = (1 << 29);
+       for (; j < naxes8 + naxes10; j++) {
+               corr[j].type = JS_CORR_BROKEN;
+               corr[j].prec = 1;
+               corr[j].coef[0] = axes[j] - 2;
+               corr[j].coef[1] = axes[j] + 2;
+               corr[j].coef[2] = (1 << 29) / (64 - 16);
+               corr[j].coef[3] = (1 << 29) / (64 - 16);
        }
 
+       for (; j < naxes1 + naxes8 + naxes10; j++) {
+               corr[j].type = JS_CORR_BROKEN;
+               corr[j].prec = 0;
+               corr[j].coef[0] = 0;
+               corr[j].coef[1] = 0;
+               corr[j].coef[2] = (1 << 29);
+               corr[j].coef[3] = (1 << 29);
+       }
 }
 
 /*
@@ -279,61 +363,157 @@ static void __init js_lt_init_corr(int num_axes, int mode, int **axes, struct js
 
 static struct js_port __init *js_lt_probe(int io, struct js_port *port)
 {
-       struct js_lt_info info;
-       char *name;
-       int axes, buttons, i;
-       __u64 data;
-       unsigned char u;
+       struct js_lt_info iniinfo;
+       struct js_lt_info *info = &iniinfo;
+       char name[32];
+       int i, j, t;
 
        if (check_region(io, 1)) return port;
 
-       if (((u = inb(io)) & 3) == 3) return port;
-       outb(0xff,io);
-       if (!((inb(io) ^ u) & ~u & 0xf)) return port;
+       js_lt_init_digital(io);
 
-       if (!(i = js_lt_read_packet(io, &data))) {
-               udelay(JS_LT_MAX_DELAY);
-               js_lt_trigger_sequence(io, js_lt_seq_reset);
-               js_lt_trigger_sequence(io, js_lt_seq_init);
-               i = js_lt_read_packet(io, &data);
-       }
+       memset(info, 0, sizeof(struct js_lt_info));
+
+       info->length[0] = info->length[1] = JS_LT_MAX_LENGTH;
+
+       info->io = io;
+       js_lt_read_packet(info);
+       
+       if (info->ret[0] >= JS_LT_MIN_LEN_LENGTH)
+               js_lt_move_bits(info, js_lt_get_bits(info, 0, 10));
+
+       info->length[0] = info->length[1] = 0;
+
+       for (i = 0; i < 2; i++) {
+
+               if (info->ret[i] < JS_LT_MIN_ID_LENGTH) continue; /* Minimum ID packet length */
+
+               if (info->ret[i] < (t = js_lt_get_bits(info, i, 10))) {
+                       printk(KERN_WARNING "joy-logitech: Short ID packet: reported: %d != read: %d\n",
+                               t, info->ret[i]); 
+                       continue;
+               }
+
+               if (info->ret[i] > t)
+                       info->bugs[i] |= JS_LT_BUG_LONGID;
+
+#ifdef JS_LT_DEBUG
+               printk(KERN_DEBUG "joy-logitech: id %d length %d", i, t);
+#endif
+
+               info->id[i] = js_lt_get_bits(info, i, 4) | (js_lt_get_bits(info, i, 4) << 4);
+
+               if ((t = js_lt_get_bits(info, i, 4)) & JS_LT_FLAG_HAT) info->hats[i]++;
+
+#ifdef JS_LT_DEBUG
+               printk(KERN_DEBUG "joy-logitech: id %d flags %d", i, t);
+#endif
+
+               if ((info->length[i] = js_lt_get_bits(info, i, 10)) >= JS_LT_MAX_LENGTH) {
+                       printk(KERN_WARNING "joy-logitech: Expected packet length too long (%d).\n",
+                               info->length[i]);
+                       continue;
+               }
+
+               if (info->length[i] < JS_LT_MIN_LENGTH) {
+                       printk(KERN_WARNING "joy-logitech: Expected packet length too short (%d).\n",
+                               info->length[i]);
+                       continue;
+               }
+
+               info->axes8[i] = js_lt_get_bits(info, i, 4);
+               info->buttons[i] = js_lt_get_bits(info, i, 6);
+
+               if (js_lt_get_bits(info, i, 6) != 8 && info->hats[i]) {
+                       printk(KERN_WARNING "joy-logitech: Other than 8-dir POVs not supported yet.\n");
+                       continue;
+               }
+
+               info->buttons[i] += js_lt_get_bits(info, i, 6);
+               info->hats[i] += js_lt_get_bits(info, i, 4);
+
+               j = js_lt_get_bits(info, i, 4);
+
+               if (t & JS_LT_FLAG_10BIT) {
+                       info->axes10[i] = info->axes8[i] - j;
+                       info->axes8[i] = j;
+               }
+
+               t = js_lt_get_bits(info, i, 4);
+
+               for (j = 0; j < t; j++)
+                       info->name[i][j] = js_lt_get_bits(info, i, 8);
+               info->name[i][j] = 0;
+
+               switch (info->id[i]) {
+                       case JS_LT_ID_TPD:
+                               info->pad[i] = 4;
+                               info->buttons[i] -= 4;
+                               break;
+                       case JS_LT_ID_WGP:
+                               info->pad[i] = 0;
+                               info->buttons[i] -= 4;
+                               break;
+                       default:
+                               info->pad[i] = -1;
+                               break;
+               }
+
+               if (info->length[i] != 
+                       (t = 8 + info->buttons[i] + info->axes10[i] * 10 + info->axes8[i] * 8 +
+                       info->hats[i] * 4 + (info->pad[i] != -1) * 4)) {
+                       printk(KERN_WARNING "js%d: Expected lenght %d != data length %d\n", i, t, info->length[i]);
+               }
 
-       switch (i) {
-               case 0:
-                       return port;
-               case 20:
-                       info.mode = JS_LT_MODE_TPD;
-                       axes = 2; buttons = 8; name = "Logitech ThunderPad Digital";
-                       break;
-               case 42:
-                       info.mode = JS_LT_MODE_WMED;
-                       axes = 5; buttons = 6; name = "Logitech WingMan Extreme Digital";
-                       break;
-               case 64:
-                       info.mode = JS_LT_MODE_CM2;
-                       axes = 6; buttons = 8; name = "Logitech CyberMan 2";
-                       break;
-               case 72:
-               case 144:
-                       return port;
-               default:
-                       printk(KERN_WARNING "joy-logitech: unknown joystick device detected "
-                               "(io=%#x, count=%d, data=0x%08x%08x), contact <vojtech@suse.cz>\n",
-                               io, i, (int)(data >> 32), (int)(data & 0xffffffff));
-                       return port;
        }
 
-       info.io = io;
+       if (!info->length[0] && !info->length[1])
+               return port;
 
        request_region(io, 1, "joystick (logitech)");
-       port = js_register_port(port, &info, 1, sizeof(struct js_lt_info), js_lt_read);
-       printk(KERN_INFO "js%d: %s at %#x\n",
-               js_register_device(port, 0, axes, buttons, name, js_lt_open, js_lt_close), name, io);
 
-       udelay(JS_LT_MAX_DELAY);
+       port = js_register_port(port, info, 2, sizeof(struct js_lt_info), js_lt_read);
+       info = port->info;
+
+       for (i = 0; i < 2; i++)
+               if (info->length[i] > 0) {
+                       sprintf(name, info->id[i] < JS_LT_MAX_ID ?
+                               js_lt_names[info->id[i]] : js_lt_names[JS_LT_MAX_ID], info->id[i]); 
+                       printk(KERN_INFO "js%d: %s [%s] at %#x\n",
+                               js_register_device(port, i,
+                                       info->axes10[i] + info->axes8[i] + ((info->hats[i] + (info->pad[i] >= 0)) << 1),
+                                       info->buttons[i], name, js_lt_open, js_lt_close), name, info->name[i], io);
+               }
+
+       mdelay(JS_LT_INIT_DELAY);
+       if (js_lt_read(info, port->axes, port->buttons)) {
+               if (info->ret[0] < 1) info->bugs[0] |= JS_LT_BUG_IGNTRIG;
+               if (info->ret[1] < 1) info->bugs[1] |= JS_LT_BUG_IGNTRIG;
+               mdelay(JS_LT_DATA_DELAY);
+               js_lt_read(info, port->axes, port->buttons);
+       }
 
-       js_lt_read(port->info, port->axes, port->buttons);
-       js_lt_init_corr(axes, info.mode, port->axes, port->corr);
+       for (i = 0; i < 2; i++)
+               if (info->length[i] > 0) {
+#ifdef JS_LT_DEBUG
+                               printk(KERN_DEBUG "js%d: length %d ret %d id %d buttons %d axes10 %d axes8 %d "
+                                                 "pad %d hats %d name %s explen %d\n",
+                                       i, info->length[i], info->ret[i], info->id[i],
+                                       info->buttons[i], info->axes10[i], info->axes8[i],
+                                       info->pad[i], info->hats[i], info->name[i],
+                                       8 + info->buttons[i] + info->axes10[i] * 10 + info->axes8[i] * 8 +
+                                       info->hats[i] * 4 + (info->pad[i] != -1) * 4);
+#endif
+                               if (info->bugs[i]) {
+                                       printk(KERN_WARNING "js%d: Firmware bugs detected:%s%s%s%s\n", i,
+                                               info->bugs[i] & JS_LT_BUG_BUTTONS ? " init_buttons" : "",
+                                               info->bugs[i] & JS_LT_BUG_LONGID ? " long_id" : "",
+                                               info->bugs[i] & JS_LT_BUG_LONGDATA ? " long_data" : "",
+                                               info->bugs[i] & JS_LT_BUG_IGNTRIG ? " ignore_trigger" : "");
+                               }
+                               js_lt_init_corr(info->id[i], info->axes10[i], info->axes8[i],
+                                       ((info->pad[i] >= 0) + info->hats[i]) << 1, port->axes[i], port->corr[i]);
+       }
 
        return port;
 }
@@ -359,10 +539,13 @@ int __init js_lt_init(void)
 #ifdef MODULE
 void cleanup_module(void)
 {
+       int i;
        struct js_lt_info *info;
 
-       while (js_lt_port != NULL) {
-               js_unregister_device(js_lt_port->devs[0]);
+       while (js_lt_port) {
+               for (i = 0; i < js_lt_port->ndevs; i++)
+                        if (js_lt_port->devs[i])
+                               js_unregister_device(js_lt_port->devs[i]);
                info = js_lt_port->info;
                release_region(info->io, 1);
                js_lt_port = js_unregister_port(js_lt_port);
diff --git a/drivers/char/joystick/joy-magellan.c b/drivers/char/joystick/joy-magellan.c
new file mode 100644 (file)
index 0000000..3a54d15
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+ *  joy-magellan.c  Version 0.1
+ *
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting
+ * the Magellan and Space Mouse 6dof controllers.
+ */
+
+/*
+ * 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 of the License, 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
+ * 
+ *  Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/errno.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+
+/*
+ * Constants.
+ */
+
+#define        N_JOYSTICK_MAG          14
+#define JS_MAG_MAX_LENGTH      64
+
+/*
+ * List of Magellans.
+ */
+
+static struct js_port* js_mag_port = NULL;
+
+/*
+ * Per-Magellan data.
+ */
+
+struct js_mag_info {
+       struct tty_struct* tty;
+       struct js_port* port;
+       int idx;
+       unsigned char data[JS_MAG_MAX_LENGTH];
+       unsigned char name[JS_MAG_MAX_LENGTH];
+       char ack;
+       char used;
+};
+
+/*
+ * js_mag_crunch_nibbles() verifies that the bytes sent from the Magellan
+ * have correct upper nibbles for the lower ones, if not, the packet will
+ * be thrown away. It also strips these upper halves to simplify further
+ * processing.
+ */
+
+static int js_mag_crunch_nibbles(unsigned char *data, int count)
+{
+       static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?";
+
+       do {
+               if (data[count] == nibbles[data[count] & 0xf])
+                       data[count] = data[count] & 0xf;
+               else
+                       return -1;
+       } while (--count);
+
+       return 0;
+}
+
+/*
+ * js_mag_process_packet() decodes packets the driver receives from the
+ * Magellan. It updates the data accordingly, and sets an ACK flag
+ * to the type of last packet received, if received OK.
+ */
+
+static void js_mag_process_packet(struct js_mag_info* info)
+{
+       int i;
+
+       if (!info->idx) return;
+
+       switch (info->data[0]) {
+
+               case 'd':                               /* Axis data */
+                       if (info->idx != 25) return;
+                       if (js_mag_crunch_nibbles(info->data, 24)) return;
+                       if (!info->port->devs[0]) return;
+                       for (i = 0; i < 6; i++) {
+                               info->port->axes[0][i] = 
+                                       ( info->data[(i << 2) + 1] << 12 | info->data[(i << 2) + 2] << 8 |
+                                         info->data[(i << 2) + 3] <<  4 | info->data[(i << 2) + 4] )
+                                        - 32768;
+                       }
+                       break;
+
+               case 'e':                               /* Error packet */
+                       if (info->idx != 4) return;
+                       if (js_mag_crunch_nibbles(info->data, 3)) return;
+                       switch (info->data[1]) {
+                               case 1:
+                                       printk(KERN_ERR "joy-magellan: Received command error packet. Failing command byte: %c\n",
+                                               info->data[2] | (info->data[3] << 4));
+                                       break;
+                               case 2:
+                                       printk(KERN_ERR "joy-magellan: Received framing error packet.\n");
+                                       break;
+                               default:
+                                       printk(KERN_ERR "joy-magellan: Received unknown error packet.\n");
+                       }
+                       break;
+
+               case 'k':                               /* Button data */
+                       if (info->idx != 4) return;
+                       if (js_mag_crunch_nibbles(info->data, 3)) return;
+                       if (!info->port->devs[0]) return;
+                       info->port->buttons[0][0] = (info->data[1] << 1) | (info->data[2] << 5) | info->data[3];
+                       break;
+
+               case 'm':                               /* Mode */
+                       if (info->idx != 2) return;
+                       if (js_mag_crunch_nibbles(info->data, 1)) return; 
+                       break;
+
+               case 'n':                               /* Null radius */
+                       if (info->idx != 2) return;
+                       if (js_mag_crunch_nibbles(info->data, 1)) return; 
+                       break;
+
+               case 'p':                               /* Data rate */
+                       if (info->idx != 3) return;
+                       if (js_mag_crunch_nibbles(info->data, 2)) return;
+                       break;
+
+               case 'q':                               /* Sensitivity */
+                       if (info->idx != 3) return;
+                       if (js_mag_crunch_nibbles(info->data, 2)) return; 
+                       break;
+
+               case 'v':                               /* Version string */
+                       info->data[info->idx] = 0;
+                       for (i = 1; i < info->idx && info->data[i] == ' '; i++);
+                       memcpy(info->name, info->data + i, info->idx - i);
+                       break;
+
+               case 'z':                               /* Zero position */
+                       break;
+
+               default:
+                       printk("joy-magellan: Unknown packet %d length %d:", info->data[0], info->idx);
+                       for (i = 0; i < info->idx; i++) printk(" %02x", info->data[i]);
+                       printk("\n");
+                       return;
+       }
+
+       info->ack = info->data[0];
+}
+
+/*
+ * js_mag_command() sends a command to the Magellan, and waits for
+ * acknowledge.
+ */
+
+static int js_mag_command(struct js_mag_info *info, char *command, int timeout)
+{
+       info->ack = 0;
+       if (info->tty->driver.write(info->tty, 0, command, strlen(command)) != strlen(command)) return -1;
+       while (!info->ack && timeout--) mdelay(1);
+       return -(info->ack != command[0]);
+}
+
+/*
+ * js_mag_setup() initializes the Magellan to sane state. Also works as
+ * a probe for Magellan existence.
+ */
+
+static int js_mag_setup(struct js_mag_info *info)
+{
+
+       if (js_mag_command(info, "vQ\r", 800))  /* Read version */
+               return -1;
+       if (js_mag_command(info, "m3\r", 50))   /* Set full 3d mode */
+               return -1;
+       if (js_mag_command(info, "pBB\r", 50))  /* Set 16 reports/second (max) */
+               return -1;
+       if (js_mag_command(info, "z\r", 50))    /* Set zero position */
+               return -1;
+
+       return 0;
+}
+
+/*
+ * js_mag_read() updates the axis and button data upon startup.
+ */
+
+static int js_mag_read(struct js_mag_info *info)
+{
+       memset(info->port->axes[0],0, sizeof(int) * 6);         /* Axes are 0 after zero postition cmd */ 
+
+       if (js_mag_command(info, "kQ\r", 50))                   /* Read buttons */
+               return -1;
+
+       return 0;
+}
+
+/*
+ * js_mag_open() is a callback from the joystick device open routine.
+ */
+
+static int js_mag_open(struct js_dev *jd)
+{
+       struct js_mag_info *info = jd->port->info;
+       info->used++;   
+       MOD_INC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_mag_close() is a callback from the joystick device release routine.
+ */
+
+static int js_mag_close(struct js_dev *jd)
+{
+       struct js_mag_info *info = jd->port->info;
+       if (!--info->used) {
+               js_unregister_device(jd->port->devs[0]);
+               js_mag_port = js_unregister_port(jd->port);
+       }
+       MOD_DEC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_mag_init_corr() initializes the correction values for the Magellan.
+ * It asumes gain setting of 0, question is, what we should do for higher
+ * gain settings ...
+ */
+
+static void js_mag_init_corr(struct js_corr **corr)
+{
+       int i;
+
+       for (i = 0; i < 6; i++) {
+               corr[0][i].type = JS_CORR_BROKEN;
+               corr[0][i].prec = 0;
+               corr[0][i].coef[0] = 0;
+               corr[0][i].coef[1] = 0;
+               corr[0][i].coef[2] = (1 << 29) / 256;
+               corr[0][i].coef[3] = (1 << 29) / 256;
+       }
+}
+
+/*
+ * js_mag_ldisc_open() is the routine that is called upon setting our line
+ * discipline on a tty. It looks for the Magellan, and if found, registers
+ * it as a joystick device.
+ */
+
+static int js_mag_ldisc_open(struct tty_struct *tty)
+{
+       struct js_mag_info iniinfo;
+       struct js_mag_info *info = &iniinfo;
+
+       info->tty = tty;
+       info->idx = 0;
+       info->used = 1;
+
+       js_mag_port = js_register_port(js_mag_port, info, 1, sizeof(struct js_mag_info), NULL);
+
+       info = js_mag_port->info;
+       info->port = js_mag_port;
+       tty->disc_data = info;
+
+       if (js_mag_setup(info)) {
+               js_mag_port = js_unregister_port(info->port);
+               return -ENODEV;
+       }
+
+       printk(KERN_INFO "js%d: Magellan [%s] on %s%d\n",
+               js_register_device(js_mag_port, 0, 6, 9, "Magellan", js_mag_open, js_mag_close),
+               info->name, tty->driver.name, MINOR(tty->device) - tty->driver.minor_start);
+
+
+       js_mag_read(info);
+       js_mag_init_corr(js_mag_port->corr);
+
+       MOD_INC_USE_COUNT;
+
+       return 0;
+}
+
+/*
+ * js_mag_ldisc_close() is the opposite of js_mag_ldisc_open()
+ */
+
+static void js_mag_ldisc_close(struct tty_struct *tty)
+{
+       struct js_mag_info* info = (struct js_mag_info*) tty->disc_data;
+       if (!--info->used) {
+               js_unregister_device(info->port->devs[0]);
+               js_mag_port = js_unregister_port(info->port);
+       }
+       MOD_DEC_USE_COUNT;
+}
+
+/*
+ * js_mag_ldisc_receive() is called by the low level driver when characters
+ * are ready for us. We then buffer them for further processing, or call the
+ * packet processing routine.
+ */
+
+static void js_mag_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
+{
+       struct js_mag_info* info = (struct js_mag_info*) tty->disc_data;
+       int i;
+
+       for (i = 0; i < count; i++)
+               if (cp[i] == '\r') {
+                       js_mag_process_packet(info);
+                       info->idx = 0;
+               } else {
+                       if (info->idx < JS_MAG_MAX_LENGTH)
+                               info->data[info->idx++] = cp[i];
+               } 
+}
+
+/*
+ * js_mag_ldisc_room() reports how much room we do have for receiving data.
+ * Although we in fact have infinite room, we need to specify some value
+ * here, so why not the size of our packet buffer. It's big anyway.
+ */
+
+static int js_mag_ldisc_room(struct tty_struct *tty)
+{
+       return JS_MAG_MAX_LENGTH;
+}
+
+/*
+ * The line discipline structure.
+ */
+
+static struct tty_ldisc js_mag_ldisc = {
+        magic:          TTY_LDISC_MAGIC,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+        name:           "magellan",
+#endif
+       open:           js_mag_ldisc_open,
+       close:          js_mag_ldisc_close,
+       receive_buf:    js_mag_ldisc_receive,
+       receive_room:   js_mag_ldisc_room,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_mag_init(void)
+#endif
+{
+        if (tty_register_ldisc(N_JOYSTICK_MAG, &js_mag_ldisc)) {
+                printk(KERN_ERR "joy-magellan: Error registering line discipline.\n");
+               return -ENODEV;
+       }
+
+       return  0;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+       tty_register_ldisc(N_JOYSTICK_MAG, NULL);
+}
+#endif
diff --git a/drivers/char/joystick/joy-pci.c b/drivers/char/joystick/joy-pci.c
new file mode 100644 (file)
index 0000000..ae49fd8
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ *  joy-pci.c  Version 0.4.0
+ *
+ *  Copyright (c) 1999 Raymond Ingles
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting the
+ * gameports on Trident 4DWave and Aureal Vortex soundcards, and
+ * analog joysticks connected to them.
+ */
+
+/*
+ * 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 of the License, 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
+ * 
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/init.h>
+
+MODULE_AUTHOR("Raymond Ingles <sorceror@tir.com>");
+MODULE_PARM(js_pci, "3-32i");
+
+#define NUM_CARDS              8
+static int js_pci[NUM_CARDS * 4] __initdata = { -1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0,
+                                               -1,0,0,0,-1,0,0,0,-1,0,0,0,-1,0,0,0 };
+
+static struct js_port * js_pci_port __initdata = NULL;
+
+#include "joy-analog.h"
+
+struct js_pci_info;
+typedef void (*js_pci_func)(struct js_pci_info *);
+
+struct js_pci_data {
+       int vendor;     /* PCI Vendor ID */
+       int model;      /* PCI Model ID */
+       int size;       /* Memory / IO region size */
+       int lcr;        /* Aureal Legacy Control Register */
+       int gcr;        /* Gameport control register */
+       int buttons;    /* Buttons location */
+       int axes;       /* Axes start */
+       int axsize;     /* Axis field size */
+       int axmax;      /* Axis field max value */
+       js_pci_func init;       
+       js_pci_func cleanup;    
+       char *name;
+};
+
+struct js_pci_info {
+        unsigned char *base;
+       struct pci_dev *pci_p;
+       __u32 lcr;
+       struct js_pci_data *data;
+        struct js_an_info an;
+};
+
+/*
+ * js_pci_*_init() sets the info->base field, disables legacy gameports,
+ * and enables the enhanced ones.
+ */
+
+static void js_pci_4dwave_init(struct js_pci_info *info)
+{
+       info->base = ioremap(BASE_ADDRESS(info->pci_p, 1), info->data->size);
+       pci_read_config_word(info->pci_p, info->data->lcr, (unsigned short *)&info->lcr);
+       pci_write_config_word(info->pci_p, info->data->lcr, info->lcr & ~0x20);
+       writeb(0x80, info->base + info->data->gcr);
+}
+
+static void js_pci_vortex_init(struct js_pci_info *info)
+{
+       info->base = ioremap(BASE_ADDRESS(info->pci_p, 0), info->data->size);
+       info->lcr = readl(info->base + info->data->lcr);
+       writel(info->lcr & ~0x8, info->base + info->data->lcr);
+       writel(0x40, info->base + info->data->gcr);
+}
+
+/*
+ * js_pci_*_cleanup does the opposite of the above functions.
+ */
+
+static void js_pci_4dwave_cleanup(struct js_pci_info *info)
+{
+       pci_write_config_word(info->pci_p, info->data->lcr, info->lcr);
+       writeb(0x00, info->base + info->data->gcr);
+       iounmap(info->base);
+}
+
+static void js_pci_vortex_cleanup(struct js_pci_info *info)
+{
+       writel(info->lcr, info->base + info->data->lcr);
+       writel(0x00, info->base + info->data->gcr);
+       iounmap(info->base);
+}
+
+static struct js_pci_data js_pci_data[] =
+{{ PCI_VENDOR_ID_TRIDENT, 0x2000, 0x10000, 0x00044 ,0x00030, 0x00031, 0x00034, 2, 0xffff,
+       js_pci_4dwave_init, js_pci_4dwave_cleanup, "Trident 4DWave DX" },
+ { PCI_VENDOR_ID_TRIDENT, 0x2001, 0x10000, 0x00044, 0x00030, 0x00031, 0x00034, 2, 0xffff,
+       js_pci_4dwave_init, js_pci_4dwave_cleanup, "Trident 4DWave NX" },
+ { PCI_VENDOR_ID_AUREAL,  0x0001, 0x40000, 0x1280c, 0x1100c, 0x11008, 0x11010, 4, 0x1fff,
+       js_pci_vortex_init, js_pci_vortex_cleanup, "Aureal Vortex1" },
+ { PCI_VENDOR_ID_AUREAL,  0x0002, 0x40000, 0x2a00c, 0x2880c, 0x28808, 0x28810, 4, 0x1fff,
+       js_pci_vortex_init, js_pci_vortex_cleanup, "Aureal Vortex2" },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL }};
+
+/*
+ * js_pci_read() reads data from a PCI gameport.
+ */
+
+static int js_pci_read(void *xinfo, int **axes, int **buttons)
+{
+        struct js_pci_info *info = xinfo;
+       int i;
+
+       info->an.buttons = ~readb(info->base + info->data->buttons) >> 4;
+
+       for (i = 0; i < 4; i++)
+               info->an.axes[i] = readw(info->base + info->data->axes + i * info->data->axsize);
+
+        js_an_decode(&info->an, axes, buttons);
+        
+        return 0;
+}
+       
+/*
+ * js_pci_open() is a callback from the file open routine.
+ */
+
+static int js_pci_open(struct js_dev *jd)
+{
+        MOD_INC_USE_COUNT;
+        return 0;
+}
+
+/*
+ * js_pci_close() is a callback from the file release routine.
+ */
+
+static int js_pci_close(struct js_dev *jd)
+{
+        MOD_DEC_USE_COUNT;
+        return 0;
+}
+
+static struct js_port * __init js_pci_probe(struct js_port *port, int type, int number,
+                                       struct pci_dev *pci_p, struct js_pci_data *data)
+{
+       int i;
+       unsigned char u;
+       int mask0, mask1, numdev;
+        struct js_pci_info iniinfo;
+        struct js_pci_info *info = &iniinfo;
+
+       mask0 = mask1 = 0;
+       
+       for (i = 0; i < NUM_CARDS; i++)
+               if (js_pci[i * 4] == type && js_pci[i * 4 + 1] == number) {
+                       mask0 = js_pci[i * 4 + 2];
+                       mask1 = js_pci[i * 4 + 3];
+                       if (!mask0 && !mask1) return port;
+                       break;
+               }
+
+       memset(info, 0,  sizeof(struct js_pci_info));
+
+       info->data = data;
+       info->pci_p = pci_p;
+       data->init(info);
+
+       mdelay(10);
+       js_pci_read(info, NULL, NULL);
+
+       for (i = u = 0; i < 4; i++)
+               if (info->an.axes[i] < info->data->axmax) u |= 1 << i;
+
+       if ((numdev = js_an_probe_devs(&info->an, u, mask0, mask1, port)) <= 0)
+               return port;
+
+       port = js_register_port(port, info, numdev, sizeof(struct js_pci_info), js_pci_read);
+
+       info = port->info;
+
+       for (i = 0; i < numdev; i++)
+               printk(KERN_WARNING "js%d: %s on %s #%d\n",
+                       js_register_device(port, i, js_an_axes(i, &info->an), js_an_buttons(i, &info->an),
+                       js_an_name(i, &info->an), js_pci_open, js_pci_close), js_an_name(i, &info->an), data->name, number);
+
+       js_pci_read(info, port->axes, port->buttons);
+       js_an_init_corr(&info->an, port->axes, port->corr, 32);
+
+       return port;
+}
+
+#ifndef MODULE
+int __init js_pci_setup(SETUP_PARAM)
+{
+        int i;
+       SETUP_PARSE(NUM_CARDS*4);
+        for (i = 0; i <= ints[0] && i < NUM_CARDS*4; i++)
+               js_pci[i] = ints[i+1];
+       return 1;
+}
+__setup("js_pci=", js_pci_setup);
+#endif
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_pci_init(void)
+#endif
+{
+        struct pci_dev *pci_p = NULL;
+        int i, j;
+
+       for (i = 0; js_pci_data[i].vendor; i++)
+               for (j = 0; (pci_p = pci_find_device(js_pci_data[i].vendor, js_pci_data[i].model, pci_p)); j++)
+                       js_pci_port = js_pci_probe(js_pci_port, i, j, pci_p, js_pci_data + i);
+
+        if (!js_pci_port) {
+#ifdef MODULE
+                printk(KERN_WARNING "joy-pci: no joysticks found\n");
+#endif
+                return -ENODEV;
+        }
+
+        return 0;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+        int i;
+        struct js_pci_info *info;
+
+        while (js_pci_port) {
+                for (i = 0; i < js_pci_port->ndevs; i++)
+                        if (js_pci_port->devs[i])
+                                js_unregister_device(js_pci_port->devs[i]);
+                info = js_pci_port->info;
+               info->data->cleanup(info);
+                js_pci_port = js_unregister_port(js_pci_port);
+        }
+}
+#endif
index d097471bc5be9c981974bf2556534b590f04ec7e..37d276ba1ca8c5e83007c05bd43245523fb262fa 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-sidewinder.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/init.h>
+
+/*
+ * These are really magic values. Changing them can make a problem go away,
+ * as well as break everything.
+ */
+
+#undef JS_SW_DEBUG
 
-#define JS_SW_MAX_START                250
-#define JS_SW_MIN_STROBE       25
-#define JS_SW_EXT_STROBE       45
-#define JS_SW_MIN_TIME         1500
-#define JS_SW_MAX_TIME         4000
+#define JS_SW_START            400     /* The time we wait for the first bit [400 us] */
+#define JS_SW_STROBE           45      /* Max time per bit [45 us] */
+#define JS_SW_TIMEOUT          4000    /* Wait for everything to settle [4 ms] */
+#define JS_SW_KICK             45      /* Wait after A0 fall till kick [45 us] */
+#define JS_SW_END              8       /* Number of bits before end of packet to kick */
+#define JS_SW_FAIL             16      /* Number of packet read errors to fail and reinitialize */
+#define JS_SW_BAD              2       /* Number of packet read errors to switch off 3d Pro optimization */
+#define JS_SW_OK               64      /* Number of packet read successes to switch optimization back on */
+#define JS_SW_LENGTH           512     /* Max number of bits in a packet */
 
-#define JS_SW_MAX_LENGTH       72
+/*
+ * SideWinder joystick types ...
+ */
 
-#define JS_SW_MODE_3DP         1
-#define JS_SW_MODE_PP          2
-#define JS_SW_MODE_GP          3
+#define JS_SW_TYPE_3DP         1
+#define JS_SW_TYPE_F23         2
+#define JS_SW_TYPE_GP          3
+#define JS_SW_TYPE_PP          4
+#define JS_SW_TYPE_FFP         5
+#define JS_SW_TYPE_FSP         6
+#define JS_SW_TYPE_FFW         7
 
 static int js_sw_port_list[] __initdata = {0x201, 0};
 static struct js_port* js_sw_port __initdata = NULL;
@@ -61,208 +81,398 @@ static struct {
 
 struct js_sw_info {
        int io;
-       unsigned char mode;
+       int length;
+       int speed;
+       unsigned char type;
+       unsigned char bits;
        unsigned char number;
-       unsigned char optimize;
+       unsigned char fail;
+       unsigned char ok;
 };
 
 /*
- * js_sw_init_digital() switches a SideWinder into digital mode.
+ * Gameport speed.
+ */
+
+unsigned int js_sw_io_speed = 0;
+
+/*
+ * js_sw_measure_speed() measures the gameport i/o speed.
  */
 
-static void __init js_sw_init_digital(int io)
+static int __init js_sw_measure_speed(int io)
 {
-       unsigned int t;
-       unsigned int timeout = (js_time_speed * JS_SW_MAX_TIME) >> 10;
-        int delays[] = {140, 140+726, 140+300, 0};
-       int i = 0;
-       unsigned long flags;
+#ifdef __i386__
 
-       __save_flags(flags);
-       __cli();
-       do {
-               outb(0xff,io);
-               t = js_get_time();
-               while ((inb(io) & 1) && (js_delta(js_get_time(),t) < timeout));
-               udelay(delays[i]);
-       } while (delays[i++]);
-       __restore_flags(flags);
+#define GET_TIME(x)     do { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } while (0)
+#define DELTA(x,y)      ((y)-(x)+((y)<(x)?1193180L/HZ:0))
+
+       unsigned int i, t, t1, t2, t3, tx;
+       unsigned long flags;
 
-       for (i = 0; i < 4; i++) {
-               udelay(300);
-               outb(0xff, io);
+       tx = 1 << 30;
+
+       for(i = 0; i < 50; i++) {
+               save_flags(flags);      /* Yes, all CPUs */
+               cli();
+               GET_TIME(t1);
+               for(t = 0; t < 50; t++) inb(io);
+               GET_TIME(t2);
+               GET_TIME(t3);
+               restore_flags(flags);
+               udelay(i * 10);
+               if ((t = DELTA(t2,t1) - DELTA(t3,t2)) < tx) tx = t;
        }
 
-       return;
+       return 59659 / t;
+
+#else
+
+       unsigned int j, t = 0;
+
+       j = jiffies; while (j == jiffies);
+       j = jiffies; while (j == jiffies) { t++; inb(0x201); }
+
+       return t * HZ / 1000;
+
+#endif
 }
 
 /*
- * js_sw_read_packet() reads a SideWinder packet.
+ * js_sw_read_packet() is a function which reads either a data packet, or an
+ * identification packet from a SideWinder joystick. Better don't try to
+ * understand this, since all the ugliness of the Microsoft Digital
+ * Overdrive protocol is concentrated in this function. If you really want
+ * to know how this works, first go watch a couple horror movies, so that
+ * you are well prepared, read US patent #5628686 and then e-mail me,
+ * and I'll send you an explanation.
+ *                                     Vojtech <vojtech@suse.cz>
  */
 
-static int js_sw_read_packet(int io, int l1, int l2, int strobe, __u64 *data)
+static int js_sw_read_packet(int io, int speed, unsigned char *buf, int length, int id)
 {
-       static unsigned char buf[JS_SW_MAX_LENGTH];
-       unsigned char u, v;
-       int i;
        unsigned long flags;
-       unsigned int t, t1;
-
-       int length = l1 < l2 ? l2 : l1;
-       int start = (js_time_speed * JS_SW_MAX_START) >> 10;
-       strobe = (js_time_speed * strobe) >> 10;
-
-       i = 0;
-
-       __save_flags(flags);
-       __cli();
-       outb(0xff,io);
-
+       int timeout, bitout, sched, i, kick, start, strobe;
+       unsigned char pending, u, v;
+
+       i = -id;                                                /* Don't care about data, only want ID */
+       timeout = id ? (JS_SW_TIMEOUT * speed) >> 10 : 0;       /* Set up global timeout for ID packet */
+       kick = id ? (JS_SW_KICK * speed) >> 10 : 0;             /* Set up kick timeout for ID packet */
+       start = (JS_SW_START * speed) >> 10;
+       strobe = (JS_SW_STROBE * speed) >> 10;
+       bitout = start;
+       pending = 0;
+       sched = 0;
+
+        __save_flags(flags);                                   /* Quiet, please */
+        __cli();
+
+       outb(0xff, io);                                         /* Trigger */
        v = inb(io);
-       t = js_get_time();
 
        do {
+               bitout--;
                u = v;
                v = inb(io);
-               t1 = js_get_time();
-       } while (!((u ^ v) & u & 0x10) && js_delta(t1, t) < start);
+       } while (!(~v & u & 0x10) && (bitout > 0));             /* Wait for first falling edge on clock */
 
-       t = t1;
+       if (bitout > 0) bitout = strobe;                        /* Extend time if not timed out */
 
-       do {
-               v = inb(io);
-               t1 = js_get_time();
-               if ((u ^ v) & v & 0x10) {
-                       buf[i++] = v >> 5;
-                       t = t1;
-               }
-               u = v;
-       } while (i < length && js_delta(t1,t) < strobe);
+       while ((timeout > 0 || bitout > 0) && (i < length)) {
 
-       __restore_flags(flags);
+               timeout--;
+               bitout--;                                       /* Decrement timers */
+               sched--;
 
-       *data = 0;
+               u = v;
+               v = inb(io);
 
-       if (i == l1) {
-               t = i > 64 ? 64 : i;
-               for (i = 0; i < t; i++)
-                       *data |= (__u64) (buf[i] & 1) << i;
-               return t;
+               if ((~u & v & 0x10) && (bitout > 0)) {          /* Rising edge on clock - data bit */
+                       if (i >= 0)                             /* Want this data */
+                               buf[i] = v >> 5;                /* Store it */
+                       i++;                                    /* Advance index */
+                       bitout = strobe;                        /* Extend timeout for next bit */
+               } 
+
+               if (kick && (~v & u & 0x01)) {                  /* Falling edge on axis 0 */
+                       sched = kick;                           /* Schedule second trigger */
+                       kick = 0;                               /* Don't schedule next time on falling edge */
+                       pending = 1;                            /* Mark schedule */
+               } 
+
+               if (pending && sched < 0 && (i > -JS_SW_END)) { /* Second trigger time */
+                       outb(0xff, io);                         /* Trigger */
+                       bitout = start;                         /* Long bit timeout */
+                       pending = 0;                            /* Unmark schedule */
+                       timeout = 0;                            /* Switch from global to bit timeouts */ 
+               }
        }
-       if (i == l2) {
-               t = i > 22 ? 22 : i;
-               for (i = 0; i < t; i++)
-                       *data |= (__u64) buf[i] << (3 * i);
-               return t * 3;
+
+       __restore_flags(flags);                                 /* Done - relax */
+
+#ifdef JS_SW_DEBUG
+       {
+               int j;
+               printk(KERN_DEBUG "joy-sidewinder: Read %d triplets. [", i);
+               for (j = 0; j < i; j++) printk("%d", buf[j]);
+               printk("]\n");
        }
+#endif
 
        return i;
 }
 
 /*
- * js_sw_parity computes parity of __u64
+ * js_sw_get_bits() and GB() compose bits from the triplet buffer into a __u64.
+ * Parameter 'pos' is bit number inside packet where to start at, 'num' is number
+ * of bits to be read, 'shift' is offset in the resulting __u64 to start at, bits
+ * is number of bits per triplet.
+ */
+
+#define GB(pos,num,shift) js_sw_get_bits(buf, pos, num, shift, info->bits)
+
+static __u64 js_sw_get_bits(unsigned char *buf, int pos, int num, char shift, char bits)
+{
+       __u64 data = 0;
+       int tri = pos % bits;                                           /* Start position */
+       int i   = pos / bits;
+       int bit = shift;
+
+       while (num--) {
+               data |= (__u64)((buf[i] >> tri++) & 1) << bit++;        /* Transfer bit */
+               if (tri == bits) {
+                       i++;                                            /* Next triplet */
+                       tri = 0;
+               }
+       }
+
+       return data;
+}
+
+/*
+ * js_sw_init_digital() initializes a SideWinder 3D Pro joystick
+ * into digital mode.
+ */
+
+static void js_sw_init_digital(int io, int speed)
+{
+       int seq[] = { 140, 140+725, 140+300, 0 };
+       unsigned long flags;
+       int i, t;
+
+        __save_flags(flags);
+        __cli();
+
+       i = 0;
+        do {
+                outb(0xff, io);                                        /* Trigger */
+               t = (JS_SW_TIMEOUT * speed) >> 10;
+               while ((inb(io) & 1) && t) t--;                 /* Wait for axis to fall back to 0 */
+                udelay(seq[i]);                                        /* Delay magic time */
+        } while (seq[++i]);
+
+       outb(0xff, io);                                         /* Last trigger */
+
+       __restore_flags(flags);
+}
+
+/*
+ * js_sw_parity() computes parity of __u64
  */
 
 static int js_sw_parity(__u64 t)
 {
-       t ^= t >> 32;
-       t ^= t >> 16;
-       t ^= t >> 8;
-       t ^= t >> 4;
-       t ^= t >> 2;
-       t ^= t >> 1;
-       return t & 1;
+       int x = t ^ (t >> 32);
+       x ^= x >> 16;
+       x ^= x >> 8;
+       x ^= x >> 4;
+       x ^= x >> 2;
+       x ^= x >> 1;
+       return x & 1;
 }
 
 /*
- * js_sw_csum() computes checksum of nibbles in __u64
+ * js_sw_ccheck() checks synchronization bits and computes checksum of nibbles.
  */
 
-static int js_sw_csum(__u64 t)
+static int js_sw_check(__u64 t)
 {
        char sum = 0;
-       while (t) {
+
+       if ((t & 0x8080808080808080ULL) ^ 0x80)                 /* Sync */
+               return -1;
+
+       while (t) {                                             /* Sum */
                sum += t & 0xf;
                t >>= 4;
        }
+
        return sum & 0xf;
 }
 
 /*
- * js_sw_read() reads and analyzes SideWinder joystick data.
+ * js_sw_parse() analyzes SideWinder joystick data, and writes the results into
+ * the axes and buttons arrays.
  */
 
-static int js_sw_read(void *xinfo, int **axes, int **buttons)
+static int js_sw_parse(unsigned char *buf, struct js_sw_info *info, int **axes, int **buttons)
 {
-       struct js_sw_info *info = xinfo;
-       __u64 data;
        int hat, i;
 
-       switch (info->mode) {
-
-               case JS_SW_MODE_3DP:
+       switch (info->type) {
 
-                       if (info->optimize) {
-                               i = js_sw_read_packet(info->io, -1, 22, JS_SW_EXT_STROBE, &data);
-                       } else {
-                               i = js_sw_read_packet(info->io, 64, 66, JS_SW_EXT_STROBE, &data);
-                               if (i == 198) info->optimize = 1;
-                       }
+               case JS_SW_TYPE_3DP:
+               case JS_SW_TYPE_F23:
 
-                       if (i < 60) {
-                               js_sw_init_digital(info->io);
-                               info->optimize = 0;
-                               return -1;
-                       }
+                       if (js_sw_check(GB(0,64,0)) || (hat = GB(6,1,3) | GB(60,3,0))  > 8) return -1;
 
-                       if (((data & 0x8080808080808080ULL) ^ 0x80) || js_sw_csum(data) ||
-                               (hat = ((data >> 3) & 0x08) | ((data >> 60) & 0x07)) > 8) {
-                               info->optimize = 0;
-                               return -1;
-                       }
-                       axes[0][0] = ((data <<  4) & 0x380) | ((data >> 16) & 0x07f);
-                       axes[0][1] = ((data <<  7) & 0x380) | ((data >> 24) & 0x07f);
-                       axes[0][2] = ((data >> 28) & 0x180) | ((data >> 40) & 0x07f);
-                       axes[0][3] = ((data >> 25) & 0x380) | ((data >> 48) & 0x07f);
+                       axes[0][0] = GB( 3,3,7) | GB(16,7,0);
+                       axes[0][1] = GB( 0,3,7) | GB(24,7,0);
+                       axes[0][2] = GB(35,2,7) | GB(40,7,0);
+                       axes[0][3] = GB(32,3,7) | GB(48,7,0);
                        axes[0][4] = js_sw_hat_to_axis[hat].x;
                        axes[0][5] = js_sw_hat_to_axis[hat].y;
-                       buttons[0][0] = ((~data >> 31) & 0x80) | ((~data >> 8) & 0x7f);
+                       buttons[0][0] = ~(GB(37,1,8) | GB(38,1,7) | GB(8,7,0));
 
                        return 0;
 
-               case JS_SW_MODE_PP:
+               case JS_SW_TYPE_GP:
 
-                       if (js_sw_read_packet(info->io, 48, 16, JS_SW_EXT_STROBE, &data) != 48) return -1;
-                       if (!js_sw_parity(data) || (hat = (data >> 42) & 0xf) > 8) return -1;
+                       for (i = 0; i < info->number * 15; i += 15) {
 
-                       axes[0][0] = (data >>  9) & 0x3ff;
-                       axes[0][1] = (data >> 19) & 0x3ff;
-                       axes[0][2] = (data >> 29) & 0x07f;
-                       axes[0][3] = (data >> 36) & 0x03f;
+                               if (js_sw_parity(GB(i,15,0))) return -1;
+
+                               axes[i][0] = GB(i+3,1,0) - GB(i+2,1,0);
+                               axes[i][1] = GB(i+0,1,0) - GB(i+1,1,0);
+                               buttons[i][0] = ~GB(i+4,10,0);
+
+                       }
+
+                       return 0;
+
+               case JS_SW_TYPE_PP:
+               case JS_SW_TYPE_FFP:
+
+                       if (!js_sw_parity(GB(0,48,0)) || (hat = GB(42,4,0)) > 8) return -1;
+
+                       axes[0][0] = GB( 9,10,0);
+                       axes[0][1] = GB(19,10,0);
+                       axes[0][2] = GB(36, 6,0);
+                       axes[0][3] = GB(29, 7,0);
                        axes[0][4] = js_sw_hat_to_axis[hat].x;
                        axes[0][5] = js_sw_hat_to_axis[hat].y;
-                       buttons[0][0] = ~data & 0x1ff;
+                       buttons[0][0] = ~GB(0,9,0);
 
                        return 0;
 
-               case JS_SW_MODE_GP:
+               case JS_SW_TYPE_FSP:
 
-                       if (js_sw_read_packet(info->io, 15 * info->number, 5 * info->number,
-                               JS_SW_EXT_STROBE, &data) != 15 * info->number) return -1;
-                       if (js_sw_parity(data)) return -1;
+                       if (!js_sw_parity(GB(0,43,0)) || (hat = GB(28,4,0)) > 8) return -1;
 
-                       for (i = 0; i < info->number; i++) {
-                               axes[i][0] = ((data >> 3) & 1) - ((data >> 2) & 1);
-                               axes[i][1] = ( data       & 1) - ((data >> 1) & 1);
-                               buttons[i][0] = (~data >> 4) & 0x3ff;
-                               data >>= 15;
-                       }
+                       axes[0][0] = GB( 0,10,0);
+                       axes[0][1] = GB(16,10,0);
+                       axes[0][2] = GB(32, 6,0);
+                       axes[0][3] = js_sw_hat_to_axis[hat].x;
+                       axes[0][4] = js_sw_hat_to_axis[hat].y;
+                       buttons[0][0] = ~(GB(10,6,0) | GB(26,2,6) | GB(38,2,8));
 
                        return 0;
 
-               default:
-                       return -1;
+               case JS_SW_TYPE_FFW:
+
+                       if (!js_sw_parity(GB(0,33,0))) return -1;
+
+                       axes[0][0] = GB( 0,10,0);
+                       axes[0][1] = GB(10, 6,0);
+                       axes[0][2] = GB(16, 6,0);
+                       buttons[0][0] = ~GB(22,8,0);
+
+                       return 0;
        }
+
+       return -1;
+}
+
+/*
+ * js_sw_read() reads SideWinder joystick data, and reinitializes
+ * the joystick in case of persistent problems. This is the function that is
+ * called from the generic code to poll the joystick.
+ */
+
+static int js_sw_read(void *xinfo, int **axes, int **buttons)
+{
+       struct js_sw_info *info = xinfo;
+       unsigned char buf[JS_SW_LENGTH];
+       int i;
+
+       i = js_sw_read_packet(info->io, info->speed, buf, info->length, 0);
+
+       if (info->type <= JS_SW_TYPE_F23 && info->length == 66 && i != 66) {    /* Broken packet, try to fix */
+
+               if (i == 64 && !js_sw_check(js_sw_get_bits(buf,0,64,0,1))) {    /* Last init failed, 1 bit mode */
+                       printk(KERN_WARNING "joy-sidewinder: Joystick in wrong mode on %#x"
+                               " - going to reinitialize.\n", info->io);
+                       info->fail = JS_SW_FAIL;                                /* Reinitialize */
+                       i = 128;                                                /* Bogus value */
+               }
+
+               if (i < 66 && GB(0,64,0) == GB(i*3-66,64,0))                    /* 1 == 3 */
+                       i = 66;                                                 /* Everything is fine */
+
+               if (i < 66 && GB(0,64,0) == GB(66,64,0))                        /* 1 == 2 */
+                       i = 66;                                                 /* Everything is fine */
+
+               if (i < 66 && GB(i*3-132,64,0) == GB(i*3-66,64,0)) {            /* 2 == 3 */
+                       memmove(buf, buf + i - 22, 22);                         /* Move data */
+                       i = 66;                                                 /* Carry on */
+               }
+       }
+
+       if (i == info->length && !js_sw_parse(buf, info, axes, buttons)) {      /* Parse data */
+
+               info->fail = 0;
+               info->ok++;
+
+               if (info->type <= JS_SW_TYPE_F23 && info->length == 66          /* Many packets OK */
+                       && info->ok > JS_SW_OK) {
+
+                       printk(KERN_INFO "joy-sidewinder: No more trouble on %#x"
+                               " - enabling optimization again.\n", info->io);
+                       info->length = 22;
+               }
+
+               return 0;
+       }
+
+       info->ok = 0;
+       info->fail++;
+
+       if (info->type <= JS_SW_TYPE_F23 && info->length == 22                  /* Consecutive bad packets */
+                       && info->fail > JS_SW_BAD) {
+
+               printk(KERN_INFO "joy-sidewinder: Many bit errors on %#x"
+                       " - disabling optimization.\n", info->io);
+               info->length = 66;
+       }
+
+       if (info->fail < JS_SW_FAIL) return -1;                                 /* Not enough, don't reinitialize yet */
+
+       printk(KERN_WARNING "joy-sidewinder: Too many bit errors on %#x"
+               " - reinitializing joystick.\n", info->io);
+
+       if (!i && info->type <= JS_SW_TYPE_F23) {                               /* 3D Pro can be in analog mode */
+               udelay(3 * JS_SW_TIMEOUT);
+               js_sw_init_digital(info->io, info->speed);
+       }
+
+       udelay(JS_SW_TIMEOUT);
+       i = js_sw_read_packet(info->io, info->speed, buf, JS_SW_LENGTH, 0);     /* Read normal data packet */
+       udelay(JS_SW_TIMEOUT);
+       js_sw_read_packet(info->io, info->speed, buf, JS_SW_LENGTH, i);         /* Read ID packet, this initializes the stick */
+
+       info->fail = JS_SW_FAIL;
+       
+       return -1;
 }
 
 /*
@@ -290,7 +500,7 @@ static int js_sw_close(struct js_dev *jd)
  * SideWinders.
  */
 
-static void __init js_sw_init_corr(int num_axes, int mode, int number, struct js_corr **corr)
+static void __init js_sw_init_corr(int num_axes, int type, int number, struct js_corr **corr)
 {
        int i, j;
 
@@ -305,9 +515,10 @@ static void __init js_sw_init_corr(int num_axes, int mode, int number, struct js
                        corr[i][j].coef[3] = (1 << 29) / (511 - 32);
                }
 
-               switch (mode) {
+               switch (type) {
 
-                       case JS_SW_MODE_3DP:
+                       case JS_SW_TYPE_3DP:
+                       case JS_SW_TYPE_F23:
 
                                corr[i][2].type = JS_CORR_BROKEN;
                                corr[i][2].prec = 4;
@@ -320,33 +531,73 @@ static void __init js_sw_init_corr(int num_axes, int mode, int number, struct js
 
                        break;
 
-                       case JS_SW_MODE_PP:
+                       case JS_SW_TYPE_PP:
+                       case JS_SW_TYPE_FFP:
 
                                corr[i][2].type = JS_CORR_BROKEN;
-                               corr[i][2].prec = 1;
-                               corr[i][2].coef[0] = 63 - 4;
-                               corr[i][2].coef[1] = 64 + 4;
-                               corr[i][2].coef[2] = (1 << 29) / (63 - 4);
-                               corr[i][2].coef[3] = (1 << 29) / (63 - 4);
+                               corr[i][2].prec = 0;
+                               corr[i][2].coef[0] = 31 - 2;
+                               corr[i][2].coef[1] = 32 + 2;
+                               corr[i][2].coef[2] = (1 << 29) / (31 - 2);
+                               corr[i][2].coef[3] = (1 << 29) / (31 - 2);
 
                                corr[i][3].type = JS_CORR_BROKEN;
-                               corr[i][3].prec = 0;
-                               corr[i][3].coef[0] = 31 - 2;
-                               corr[i][3].coef[1] = 32 + 2;
-                               corr[i][3].coef[2] = (1 << 29) / (31 - 2);
-                               corr[i][3].coef[3] = (1 << 29) / (31 - 2);
+                               corr[i][3].prec = 1;
+                               corr[i][3].coef[0] = 63 - 4;
+                               corr[i][3].coef[1] = 64 + 4;
+                               corr[i][3].coef[2] = (1 << 29) / (63 - 4);
+                               corr[i][3].coef[3] = (1 << 29) / (63 - 4);
 
                                j = 4;
 
                        break;
 
+                       case JS_SW_TYPE_FFW:
+
+                               corr[i][0].type = JS_CORR_BROKEN;
+                               corr[i][0].prec = 2;
+                               corr[i][0].coef[0] = 511 - 8;
+                               corr[i][0].coef[1] = 512 + 8;
+                               corr[i][0].coef[2] = (1 << 29) / (511 - 8);
+                               corr[i][0].coef[3] = (1 << 29) / (511 - 8);
+
+                               corr[i][1].type = JS_CORR_BROKEN;
+                               corr[i][1].prec = 1;
+                               corr[i][1].coef[0] = 63;
+                               corr[i][1].coef[1] = 63;
+                               corr[i][1].coef[2] = (1 << 29) / -63;
+                               corr[i][1].coef[3] = (1 << 29) / -63;
+
+                               corr[i][2].type = JS_CORR_BROKEN;
+                               corr[i][2].prec = 1;
+                               corr[i][2].coef[0] = 63;
+                               corr[i][2].coef[1] = 63;
+                               corr[i][2].coef[2] = (1 << 29) / -63;
+                               corr[i][2].coef[3] = (1 << 29) / -63;
+
+                               j = 3;
+
+                       break;
+
+                       case JS_SW_TYPE_FSP:
+                               
+                               corr[i][2].type = JS_CORR_BROKEN;
+                               corr[i][2].prec = 0;
+                               corr[i][2].coef[0] = 31 - 2;
+                               corr[i][2].coef[1] = 32 + 2;
+                               corr[i][2].coef[2] = (1 << 29) / (31 - 2);
+                               corr[i][2].coef[3] = (1 << 29) / (31 - 2);
+
+                               j = 3;
+
+                       break;
+
                        default:
 
                                j = 0;
-
                }
 
-               for (; j < num_axes; j++) {
+               for (; j < num_axes; j++) {                             /* Hats & other binary axes */
                        corr[i][j].type = JS_CORR_BROKEN;
                        corr[i][j].prec = 0;
                        corr[i][j].coef[0] = 0;
@@ -357,6 +608,61 @@ static void __init js_sw_init_corr(int num_axes, int mode, int number, struct js
        }
 }
 
+/*
+ * js_sw_print_packet() prints the contents of a SideWinder packet.
+ */
+
+static void js_sw_print_packet(char *name, int length, unsigned char *buf, char bits)
+{
+       int i;
+
+       printk("joy-sidewinder: %s packet, %d bits. [", name, length);
+       for (i = (((length + 3) >> 2) - 1); i >= 0; i--)
+               printk("%x", (int)js_sw_get_bits(buf, i << 2, 4, 0, bits));
+       printk("]\n");
+}
+
+/*
+ * js_sw_3dp_id() translates the 3DP id into a human legible string.
+ * Unfortunately I don't know how to do this for the other SW types.
+ */
+
+static void js_sw_3dp_id(unsigned char *buf, char *comment)
+{
+       int i;
+       char pnp[8], rev[9];
+
+       for (i = 0; i < 7; i++)                                         /* ASCII PnP ID */
+               pnp[i] = js_sw_get_bits(buf, 24+8*i, 8, 0, 1);
+
+       for (i = 0; i < 8; i++)                                         /* ASCII firmware revision */
+               rev[i] = js_sw_get_bits(buf, 88+8*i, 8, 0, 1);
+
+       pnp[7] = rev[8] = 0;
+
+       sprintf(comment, " [PnP %d.%02d id %s rev %s]",
+               (int) (js_sw_get_bits(buf, 8, 6, 6, 1) |                /* Two 6-bit values */
+                       js_sw_get_bits(buf, 16, 6, 0, 1)) / 100,
+               (int) (js_sw_get_bits(buf, 8, 6, 6, 1) |
+                       js_sw_get_bits(buf, 16, 6, 0, 1)) % 100,
+                pnp, rev);
+}
+
+/*
+ * js_sw_guess_mode() checks the upper two button bits for toggling -
+ * indication of that the joystick is in 3-bit mode. This is documented
+ * behavior for 3DP ID packet, and for example the FSP does this in
+ * normal packets instead. Fun ...
+ */
+
+static int js_sw_guess_mode(unsigned char *buf, int len)
+{
+       int i;
+       unsigned char xor = 0;
+       for (i = 1; i < len; i++) xor |= (buf[i - 1] ^ buf[i]) & 6;
+       return !!xor * 2 + 1;
+}
+
 /*
  * js_sw_probe() probes for SideWinder type joysticks.
  */
@@ -364,77 +670,150 @@ static void __init js_sw_init_corr(int num_axes, int mode, int number, struct js
 static struct js_port __init *js_sw_probe(int io, struct js_port *port)
 {
        struct js_sw_info info;
-       char *name;
-       int i, j, axes, buttons;
-       __u64 data;
-       unsigned char u;
-
+       char *names[] = {NULL, "SideWinder 3D Pro", "Flight2000 F-23", "SideWinder GamePad", "SideWinder Precision Pro",
+                       "SideWinder Force Feedback Pro", "SideWinder FreeStyle Pro", "SideWinder Force Feedback Wheel" };
+       char axes[] = { 0, 6, 6, 2, 6, 6, 5, 3 };
+       char buttons[] = { 0, 9, 9, 10, 9, 9, 10, 8 };
+       int i, j, k, l, speed;
+       unsigned char buf[JS_SW_LENGTH];
+       unsigned char idbuf[JS_SW_LENGTH];
+       unsigned char m = 1;
+       char comment[40];
+
+       comment[0] = 0;
 
        if (check_region(io, 1)) return port;
-       if (((u = inb(io)) & 3) == 3) return port;
-       outb(0xff,io);
-       if (!((inb(io) ^ u) & ~u & 0xf)) return port;
 
-       i = js_sw_read_packet(io, JS_SW_MAX_LENGTH, -1, JS_SW_EXT_STROBE, &data);
+       speed = js_sw_measure_speed(io);
+
+       i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0);         /* Read normal packet */
+       m |= js_sw_guess_mode(buf, i);                                  /* Data packet (1-bit) can carry mode info [FSP] */
+       udelay(JS_SW_TIMEOUT);
 
-       if (!i) {
-               udelay(JS_SW_MIN_TIME);
-               js_sw_init_digital(io);
-               udelay(JS_SW_MAX_TIME);
-               i = js_sw_read_packet(io, JS_SW_MAX_LENGTH, -1, JS_SW_EXT_STROBE, &data);
+#ifdef JS_SW_DEBUG
+       printk(KERN_DEBUG "joy-sidewinder: Init 1: Mode %d. Length %d.\n", m , i);
+#endif
+
+       if (!i) {                                                       /* No data. 3d Pro analog mode? */
+               js_sw_init_digital(io, speed);                          /* Switch to digital */
+               udelay(JS_SW_TIMEOUT);
+               i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Retry reading packet */
+               udelay(JS_SW_TIMEOUT);
+#ifdef JS_SW_DEBUG
+       printk(KERN_DEBUG "joy-sidewinder: Init 1b: Length %d.\n", i);
+#endif
+               if (!i) return port;                                    /* No data -> FAIL */
        }
 
-       switch (i) {
-               case 0:
-                       return port;
-               case 5:
-               case 10:
-               case 15:
-               case 20:
-               case 30:
-               case 45:
-               case 60:
-                       info.mode = JS_SW_MODE_GP;
-                       outb(0xff,io);                                                  /* Kick into 3-bit mode */
-                       udelay(JS_SW_MAX_TIME);
-                       i = js_sw_read_packet(io, 60, -1, JS_SW_EXT_STROBE, &data);     /* Get total length */
-                       udelay(JS_SW_MIN_TIME);
-                       j = js_sw_read_packet(io, 15, -1, JS_SW_MIN_STROBE, &data);     /* Get subpacket length */
-                       if (!i || !j) {
-                               printk(KERN_WARNING "joy-sidewinder: SideWinder GamePad detected (%d,%d),"
-                                                       " but not idenfitied.\n", i, j);
-                               return port;
+       j = js_sw_read_packet(io, speed, idbuf, JS_SW_LENGTH, i);       /* Read ID. This initializes the stick */
+       m |= js_sw_guess_mode(idbuf, j);                                /* ID packet should carry mode info [3DP] */
+
+#ifdef JS_SW_DEBUG
+       printk(KERN_DEBUG "joy-sidewinder: Init 2: Mode %d. ID Length %d.\n", m , j);
+#endif
+
+       if (!j) {                                                       /* Read ID failed. Happens in 1-bit mode on PP */
+               udelay(JS_SW_TIMEOUT);
+               i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Retry reading packet */
+#ifdef JS_SW_DEBUG
+       printk(KERN_DEBUG "joy-sidewinder: Init 2b: Mode %d. Length %d.\n", m , i);
+#endif
+               if (!i) return port;
+               udelay(JS_SW_TIMEOUT);
+               j = js_sw_read_packet(io, speed, idbuf, JS_SW_LENGTH, i);/* Retry reading ID */
+#ifdef JS_SW_DEBUG
+       printk(KERN_DEBUG "joy-sidewinder: Init 2c: ID Length %d.\n", j);
+#endif
+
+       }
+
+       k = JS_SW_FAIL;                                                 /* Try JS_SW_FAIL times */
+       l = 0;
+
+       do {
+               k--;
+               udelay(JS_SW_TIMEOUT);
+               i = js_sw_read_packet(io, speed, buf, JS_SW_LENGTH, 0); /* Read data packet */
+#ifdef JS_SW_DEBUG
+               printk(KERN_DEBUG "joy-sidewinder: Init 3: Length %d.\n", i);
+#endif
+
+               if (i > l) {                                            /* Longer? As we can only lose bits, it makes */
+                                                                       /* no sense to try detection for a packet shorter */
+                       l = i;                                          /* than the previous one */
+
+                       info.number = 1;
+                       info.io = io;
+                       info.speed = speed;
+                       info.length = i;
+                       info.bits = m;
+                       info.fail = 0;
+                       info.ok = 0;
+                       info.type = 0;
+
+                       switch (i * m) {
+                               case 60:
+                                       info.number++;
+                               case 45:                                /* Ambiguous packet length */
+                                       if (j <= 40) {                  /* ID length less or eq 40 -> FSP */    
+                               case 43:
+                                               info.type = JS_SW_TYPE_FSP;
+                                               break;
+                                       }
+                                       info.number++;
+                               case 30:
+                                       info.number++;
+                               case 15:
+                                       info.type = JS_SW_TYPE_GP;
+                                       break;
+                               case 33:
+                               case 31:
+                                       info.type = JS_SW_TYPE_FFW;
+                                       break;
+                               case 48:                                /* Ambiguous */
+                                       if (j == 14) {                  /* ID lenght 14*3 -> FFP */
+                                               info.type = JS_SW_TYPE_FFP;
+                                               sprintf(comment, " [AC %s]", js_sw_get_bits(idbuf,38,1,0,3) ? "off" : "on");
+                                       } else
+                                       info.type = JS_SW_TYPE_PP;
+                                       break;
+                               case 198:
+                                       info.length = 22;
+                               case 64:
+                                       info.type = JS_SW_TYPE_3DP;
+                                       if (j == 160) js_sw_3dp_id(idbuf, comment);
+                                       break;
                        }
-                       info.number = i / j;
-                       axes = 2; buttons = 10; name = "SideWinder GamePad";
-                       break;
-               case 16:
-               case 48:
-                       info.mode = JS_SW_MODE_PP; info.number = 1;
-                       axes = 6; buttons = 9; name = "SideWinder Precision Pro";
-                       break;
-               case 64:
-               case 66:
-                       info.mode = JS_SW_MODE_3DP; info.number = 1; info.optimize = 0;
-                       axes = 6; buttons = 8; name = "SideWinder 3D Pro";
-                       break;
-               case 72:
-                       return port;
-               default:
-                       printk(KERN_WARNING "joy-sidewinder: unknown joystick device detected "
-                               "(io=%#x, count=%d, data=0x%08x%08x), contact <vojtech@suse.cz>\n",
-                               io, i, (int)(data >> 32), (int)(data & 0xffffffff));
-                       return port;
+               }
+
+       } while (k && !info.type);
+
+       if (!info.type) {
+               printk(KERN_WARNING "joy-sidewinder: unknown joystick device detected "
+                       "(io=%#x), contact <vojtech@suse.cz>\n", io);
+               js_sw_print_packet("ID", j * 3, idbuf, 3);
+               js_sw_print_packet("Data", i * m, buf, m);
+               return port;
        }
 
-       info.io = io;
+#ifdef JS_SW_DEBUG
+       js_sw_print_packet("ID", j * 3, idbuf, 3);
+       js_sw_print_packet("Data", i * m, buf, m);
+#endif
+
+       k = i;
 
        request_region(io, 1, "joystick (sidewinder)");
+
        port = js_register_port(port, &info, info.number, sizeof(struct js_sw_info), js_sw_read);
+
        for (i = 0; i < info.number; i++)
-               printk(KERN_INFO "js%d: %s at %#x\n",
-                       js_register_device(port, i, axes, buttons, name, js_sw_open, js_sw_close), name, io);
-       js_sw_init_corr(axes, info.mode, info.number, port->corr);
+               printk(KERN_INFO "js%d: %s%s at %#x [%d ns res %d-bit id %d data %d]\n",
+                       js_register_device(port, i, axes[info.type], buttons[info.type],
+                               names[info.type], js_sw_open, js_sw_close), names[info.type], comment, io,
+                               1000000 / speed, m, j, k);
+
+       js_sw_init_corr(axes[info.type], info.type, info.number, port->corr);
 
        return port;
 }
@@ -463,9 +842,9 @@ void cleanup_module(void)
        int i;
        struct js_sw_info *info;
 
-       while (js_sw_port != NULL) {
+       while (js_sw_port) {
                for (i = 0; i < js_sw_port->ndevs; i++)
-                       if (js_sw_port->devs[i] != NULL)
+                       if (js_sw_port->devs[i])
                                js_unregister_device(js_sw_port->devs[i]);
                info = js_sw_port->info;
                release_region(info->io, 1);
diff --git a/drivers/char/joystick/joy-spaceball.c b/drivers/char/joystick/joy-spaceball.c
new file mode 100644 (file)
index 0000000..421a3cf
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ *  joy-spaceball.c  Version 0.1
+ *
+ *  Copyright (c) 1998 David Thompson
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *  Copyright (c) 1999 Joseph Krahn
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting
+ * the SpaceTec SpaceBall 4000 FLX.
+ */
+
+/*
+ * 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 of the License, 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
+ * 
+ *  Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/errno.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+
+/*
+ * Constants.
+ */
+
+#define        N_JOYSTICK_SBALL        12
+#define JS_SBALL_MAX_LENGTH    128
+
+/*
+ * List of SpaceBalls.
+ */
+
+static struct js_port* js_sball_port = NULL;
+
+/*
+ * Per-Ball data.
+ */
+
+struct js_sball_info {
+       struct tty_struct* tty;
+       struct js_port* port;
+       int idx;
+       unsigned char data[JS_SBALL_MAX_LENGTH];
+       int js;
+       char used;
+};
+
+/*
+ * js_sball_process_packet() decodes packets the driver receives from the
+ * SpaceBall.
+ */
+
+static void js_sball_process_packet(struct js_sball_info* info)
+{
+       int i,b;
+       int **axes = info->port->axes;
+       int **buttons = info->port->buttons;
+       unsigned char *data = info->data;
+
+       if (info->idx < 2) return;
+
+       switch (info->data[0]) {
+
+               case '@':                                       /* Reset packet */
+                       info->data[info->idx - 1] = 0;
+                       for (i = 1; i < info->idx && info->data[i] == ' '; i++);
+
+                       printk(KERN_INFO "js%d: SpaceBall 4000FLX [%s] on %s%d\n",
+                               info->js, info->data + i, info->tty->driver.name,
+                               MINOR(info->tty->device) - info->tty->driver.minor_start);
+
+                       memset(axes[0], 0, sizeof(int) * 6);    /* All axes, buttons should be zero */
+                       buttons[0][0] = 0;
+                       break;
+
+               case 'D':                                       /* Ball data */
+                       if (info->idx != 16) return;
+                       if (!info->port->devs[0]) return;
+                       axes[0][0] = ((data[3] << 8) | data[4] );
+                       axes[0][1] = ((data[5] << 8) | data[6] );
+                       axes[0][2] = ((data[7] << 8) | data[8] );
+                       axes[0][3] = ((data[9] << 8) | data[10]);
+                       axes[0][4] = ((data[11]<< 8) | data[12]);
+                       axes[0][5] = ((data[13]<< 8) | data[14]);
+                       for(i = 0; i < 6; i ++) if (axes[0][i] & 0x8000) axes[0][i] -= 0x10000;
+                       break;
+
+               case 'K':                               /* Button data, part1 */
+                       /* We can ignore this packet for the SB 4000FLX. */
+                       break;
+
+               case '.':                               /* Button data, part2 */
+                       if (info->idx != 4) return;
+                       if (!info->port->devs[0]) return;
+                       b = (data[1] & 0xbf) << 8 | (data[2] & 0xbf);
+                       buttons[0][0] = ((b & 0x1f80) >> 1 | (b & 0x3f));
+                       break;
+
+               case '?':                               /* Error packet */
+                       info->data[info->idx - 1] = 0;
+                       printk(KERN_ERR "joy-spaceball: Device error. [%s]\n",info->data+1);
+                       break;
+
+               case 'A':                               /* reply to A command (ID# report) */
+               case 'B':                               /* reply to B command (beep) */
+               case 'H':                               /* reply to H command (firmware report) */
+               case 'S':                               /* reply to S command (single beep) */
+               case 'Y':                               /* reply to Y command (scale flag) */
+               case '"':                               /* reply to "n command (report info, part n) */
+                       break;
+
+               case 'P':                               /* Pulse (update) speed */
+                       if (info->idx != 3) return;     /* data[2],data[3] = hex digits for speed 00-FF */
+                       break;
+
+               default:
+                       printk("joy-spaceball: Unknown packet %d length %d:", data[0], info->idx);
+                       for (i = 0; i < info->idx; i++) printk(" %02x", data[i]);
+                       printk("\n");
+                       return;
+       }
+}
+
+/*
+ * js_sball_open() is a callback from the joystick device open routine.
+ */
+
+static int js_sball_open(struct js_dev *jd)
+{
+       struct js_sball_info *info = jd->port->info;
+       info->used++;
+       MOD_INC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_sball_close() is a callback from the joystick device release routine.
+ */
+
+static int js_sball_close(struct js_dev *jd)
+{
+       struct js_sball_info *info = jd->port->info;
+       if (!--info->used) {
+               js_unregister_device(jd->port->devs[0]);
+               js_sball_port = js_unregister_port(jd->port);
+       }
+       MOD_DEC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_sball_init_corr() initializes the correction values for the SpaceBall.
+ */
+
+static void __init js_sball_init_corr(struct js_corr **corr)
+{
+       int j;
+
+       for (j = 0; j < 3; j++) {
+               corr[0][j].type = JS_CORR_BROKEN;
+               corr[0][j].prec = 0;
+               corr[0][j].coef[0] = 0;
+               corr[0][j].coef[1] = 0;
+               corr[0][j].coef[2] = 50000;
+               corr[0][j].coef[3] = 50000;
+       }
+       for (j = 3; j < 6; j++) {
+               corr[0][j].type = JS_CORR_BROKEN;
+               corr[0][j].prec = 0;
+               corr[0][j].coef[0] = 0;
+               corr[0][j].coef[1] = 0;
+               corr[0][j].coef[2] = 300000;
+               corr[0][j].coef[3] = 300000;
+       }
+}
+
+/*
+ * js_sball_ldisc_open() is the routine that is called upon setting our line
+ * discipline on a tty.
+ */
+
+static int js_sball_ldisc_open(struct tty_struct *tty)
+{
+       struct js_sball_info iniinfo;
+       struct js_sball_info *info = &iniinfo;
+
+       info->tty = tty;
+       info->idx = 0;
+       info->used = 1;
+
+       js_sball_port = js_register_port(js_sball_port, info, 1, sizeof(struct js_sball_info), NULL);
+       
+       info = js_sball_port->info;
+       info->port = js_sball_port;
+       tty->disc_data = info;
+
+       info->js = js_register_device(js_sball_port, 0, 6, 12, "SpaceBall 4000 FLX", js_sball_open, js_sball_close);
+
+       js_sball_init_corr(js_sball_port->corr);
+
+       MOD_INC_USE_COUNT;
+
+       return 0;
+}
+
+/*
+ * js_sball_ldisc_close() is the opposite of js_sball_ldisc_open()
+ */
+
+static void js_sball_ldisc_close(struct tty_struct *tty)
+{
+       struct js_sball_info* info = (struct js_sball_info*) tty->disc_data;
+       if (!--info->used) {
+               js_unregister_device(info->port->devs[0]);
+               js_sball_port = js_unregister_port(info->port);
+       }
+       MOD_DEC_USE_COUNT;
+}
+
+/*
+ * js_sball_ldisc_receive() is called by the low level driver when characters
+ * are ready for us. We then buffer them for further processing, or call the
+ * packet processing routine.
+ */
+
+static void js_sball_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
+{
+       struct js_sball_info* info = (struct js_sball_info*) tty->disc_data;
+       int i;
+       int esc_flag = 0;
+
+/*
+ * Spaceball 4000 FLX packets all start with a one letter packet-type decriptor,
+ * and end in 0x0d.  It uses '^' as an escape for 0x0d characters which can
+ * occur in the axis values.  ^M, ^Q and ^S all mean 0x0d, depending (I think)
+ * on whether the axis value is increasing, decreasing, or same as before.
+ * (I don't see why this is useful).
+ *
+ * There may be a nicer whay to handle the escapes, but I wanted to be sure to
+ * allow for an escape at the end of the buffer.
+ */
+       for (i = 0; i < count; i++) {
+               if (esc_flag) {  /* If the last char was an escape, overwrite it with the escaped value */
+
+                       switch (cp[i]){
+                               case 'M':
+                               case 'Q':
+                               case 'S':
+                                       info->data[info->idx]=0x0d;
+                                       break;
+                               case '^': /* escaped escape; leave as is */
+                                       break;
+                               default:
+                                       printk("joy-spaceball: Unknown escape character: %02x\n", cp[i]);
+                       }
+
+                       esc_flag = 0;
+
+               } else {
+
+                       if (info->idx < JS_SBALL_MAX_LENGTH)
+                               info->data[info->idx++] = cp[i];
+
+                       if (cp[i] == 0x0D) {
+                               if (info->idx)
+                                       js_sball_process_packet(info);
+                               info->idx = 0;
+                       } else
+                               if (cp[i] == '^') esc_flag = 1;
+
+               }
+       }
+}
+
+/*
+ * js_sball_ldisc_room() reports how much room we do have for receiving data.
+ * Although we in fact have infinite room, we need to specify some value
+ * here, so why not the size of our packet buffer. It's big anyway.
+ */
+
+static int js_sball_ldisc_room(struct tty_struct *tty)
+{
+       return JS_SBALL_MAX_LENGTH;
+}
+
+/*
+ * The line discipline structure.
+ */
+
+static struct tty_ldisc js_sball_ldisc = {
+       magic:          TTY_LDISC_MAGIC,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+       name:           "spaceball",
+#endif
+       open:           js_sball_ldisc_open,
+       close:          js_sball_ldisc_close,
+       receive_buf:    js_sball_ldisc_receive,
+       receive_room:   js_sball_ldisc_room,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_sball_init(void)
+#endif
+{
+        if (tty_register_ldisc(N_JOYSTICK_SBALL, &js_sball_ldisc)) {
+                printk(KERN_ERR "joy-spaceball: Error registering line discipline.\n");
+               return -ENODEV;
+       }
+
+       return  0;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+       tty_register_ldisc(N_JOYSTICK_SBALL, NULL);
+}
+#endif
diff --git a/drivers/char/joystick/joy-spaceorb.c b/drivers/char/joystick/joy-spaceorb.c
new file mode 100644 (file)
index 0000000..464e590
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ *  joy-spaceorb.c  Version 0.1
+ *
+ *  Copyright (c) 1998 David Thompson
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting
+ * the SpaceTec SpaceOrb 360 and SpaceBall Avenger 6dof controllers.
+ */
+
+/*
+ * 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 of the License, 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
+ * 
+ *  Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/errno.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+
+/*
+ * Constants.
+ */
+
+#define        N_JOYSTICK_ORB          15
+#define JS_ORB_MAX_LENGTH      64
+
+/*
+ * List of SpaceOrbs.
+ */
+
+static struct js_port* js_orb_port = NULL;
+
+/*
+ * Per-Orb data.
+ */
+
+struct js_orb_info {
+       struct tty_struct* tty;
+       struct js_port* port;
+       int idx;
+       unsigned char data[JS_ORB_MAX_LENGTH];
+       int js;
+       char used;
+};
+
+static unsigned char js_orb_xor[] = "SpaceWare";
+
+static unsigned char *js_orb_errors[] = { "EEPROM storing 0 failed", "Receive queue overflow", "Transmit queue timeout",
+               "Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; 
+
+/*
+ * js_orb_process_packet() decodes packets the driver receives from the
+ * SpaceOrb.
+ */
+
+static void js_orb_process_packet(struct js_orb_info* info)
+{
+       int i;
+       int **axes = info->port->axes;
+       int **buttons = info->port->buttons;
+       unsigned char *data = info->data;
+       unsigned char c = 0;
+
+       if (info->idx < 2) return;
+       for (i = 0; i < info->idx; i++) c ^= data[i];
+       if (c) return;
+
+       switch (info->data[0]) {
+
+               case 'R':                               /* Reset packet */
+                       info->data[info->idx - 1] = 0;
+                       for (i = 1; i < info->idx && info->data[i] == ' '; i++);
+                       printk(KERN_INFO "js%d: SpaceOrb 360 [%s] on %s%d\n",
+                               info->js, info->data + i, info->tty->driver.name,
+                               MINOR(info->tty->device) - info->tty->driver.minor_start);
+                       break;
+
+               case 'D':                               /* Ball + button data */
+                       if (info->idx != 12) return;
+                       if (!info->port->devs[0]) return;
+                       for (i = 0; i < 9; i++) info->data[i+2] ^= js_orb_xor[i]; 
+                       axes[0][0] = ( data[2]         << 3) | (data[ 3] >> 4);
+                       axes[0][1] = ((data[3] & 0x0f) << 6) | (data[ 4] >> 1);
+                       axes[0][2] = ((data[4] & 0x01) << 9) | (data[ 5] << 2) | (data[4] >> 5);
+                       axes[0][3] = ((data[6] & 0x1f) << 5) | (data[ 7] >> 2);
+                       axes[0][4] = ((data[7] & 0x03) << 8) | (data[ 8] << 1) | (data[7] >> 6);
+                       axes[0][5] = ((data[9] & 0x3f) << 4) | (data[10] >> 3);
+                       for(i = 0; i < 6; i ++) if (axes[0][i] & 0x200) axes[0][i] -= 1024;
+                       buttons[0][0] = data[1];
+                       break;
+
+               case 'K':                               /* Button data */
+                       if (info->idx != 5) return;
+                       if (!info->port->devs[0]) return;
+                       buttons[0][0] = data[2];
+                       break;
+
+               case 'E':                               /* Error packet */
+                       if (info->idx != 4) return;
+                       printk(KERN_ERR "joy-spaceorb: Device error. [ ");
+                       for (i = 0; i < 7; i++)
+                               if (data[1] & (1 << i))
+                                       printk("%s ", js_orb_errors[i]);
+                       printk("]\n");
+                       break;
+
+               case 'N':                               /* Null region */
+                       if (info->idx != 3) return;
+                       break;
+
+               case 'P':                               /* Pulse (update) speed */
+                       if (info->idx != 4) return;
+                       break;
+
+               default:
+                       printk("joy-spaceorb: Unknown packet %d length %d:", data[0], info->idx);
+                       for (i = 0; i < info->idx; i++) printk(" %02x", data[i]);
+                       printk("\n");
+                       return;
+       }
+}
+
+/*
+ * js_orb_open() is a callback from the joystick device open routine.
+ */
+
+static int js_orb_open(struct js_dev *jd)
+{
+       struct js_orb_info *info = jd->port->info;
+       info->used++;
+       MOD_INC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_orb_close() is a callback from the joystick device release routine.
+ */
+
+static int js_orb_close(struct js_dev *jd)
+{
+       struct js_orb_info *info = jd->port->info;
+       if (!--info->used) {
+               js_unregister_device(jd->port->devs[0]);
+               js_orb_port = js_unregister_port(jd->port);
+       }
+       MOD_DEC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_orb_init_corr() initializes the correction values for the SpaceOrb.
+ */
+
+static void __init js_orb_init_corr(struct js_corr **corr)
+{
+       int j;
+
+       for (j = 0; j < 6; j++) {
+               corr[0][j].type = JS_CORR_BROKEN;
+               corr[0][j].prec = 0;
+               corr[0][j].coef[0] = 0 ;
+               corr[0][j].coef[1] = 0 ;
+               corr[0][j].coef[2] = (1 << 29) / 511;
+               corr[0][j].coef[3] = (1 << 29) / 511;
+       }
+}
+
+/*
+ * js_orb_ldisc_open() is the routine that is called upon setting our line
+ * discipline on a tty.
+ */
+
+static int js_orb_ldisc_open(struct tty_struct *tty)
+{
+       struct js_orb_info iniinfo;
+       struct js_orb_info *info = &iniinfo;
+
+       info->tty = tty;
+       info->idx = 0;
+       info->used = 1;
+
+       js_orb_port = js_register_port(js_orb_port, info, 1, sizeof(struct js_orb_info), NULL);
+       
+       info = js_orb_port->info;
+       info->port = js_orb_port;
+       tty->disc_data = info;
+
+       info->js = js_register_device(js_orb_port, 0, 6, 7, "SpaceOrb 360", js_orb_open, js_orb_close);
+
+       js_orb_init_corr(js_orb_port->corr);
+
+       MOD_INC_USE_COUNT;
+
+       return 0;
+}
+
+/*
+ * js_orb_ldisc_close() is the opposite of js_orb_ldisc_open()
+ */
+
+static void js_orb_ldisc_close(struct tty_struct *tty)
+{
+       struct js_orb_info* info = (struct js_orb_info*) tty->disc_data;
+       if (!--info->used) {
+               js_unregister_device(info->port->devs[0]);
+               js_orb_port = js_unregister_port(info->port);
+       }
+       MOD_DEC_USE_COUNT;
+}
+
+/*
+ * js_orb_ldisc_receive() is called by the low level driver when characters
+ * are ready for us. We then buffer them for further processing, or call the
+ * packet processing routine.
+ */
+
+static void js_orb_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
+{
+       struct js_orb_info* info = (struct js_orb_info*) tty->disc_data;
+       int i;
+
+       for (i = 0; i < count; i++) {
+               if (~cp[i] & 0x80) {
+                       if (info->idx) js_orb_process_packet(info);
+                       info->idx = 0;
+               }
+               if (info->idx < JS_ORB_MAX_LENGTH)
+                       info->data[info->idx++] = cp[i] & 0x7f;
+       }
+}
+
+/*
+ * js_orb_ldisc_room() reports how much room we do have for receiving data.
+ * Although we in fact have infinite room, we need to specify some value
+ * here, so why not the size of our packet buffer. It's big anyway.
+ */
+
+static int js_orb_ldisc_room(struct tty_struct *tty)
+{
+       return JS_ORB_MAX_LENGTH;
+}
+
+/*
+ * The line discipline structure.
+ */
+
+static struct tty_ldisc js_orb_ldisc = {
+       magic:          TTY_LDISC_MAGIC,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+       name:           "spaceorb",
+#endif
+       open:           js_orb_ldisc_open,
+       close:          js_orb_ldisc_close,
+       receive_buf:    js_orb_ldisc_receive,
+       receive_room:   js_orb_ldisc_room,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_orb_init(void)
+#endif
+{
+        if (tty_register_ldisc(N_JOYSTICK_ORB, &js_orb_ldisc)) {
+                printk(KERN_ERR "joy-spaceorb: Error registering line discipline.\n");
+               return -ENODEV;
+       }
+
+       return  0;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+       tty_register_ldisc(N_JOYSTICK_ORB, NULL);
+}
+#endif
index 1e79b32810f8119e70c0c86a1e448555e258cc8b..4cd3de23ff296f096e8e9288fdfa3acc9e893fc7 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-thrustmaster.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/init.h>
 
 #define JS_TM_MAX_START                400
-#define JS_TM_MAX_STROBE       25
+#define JS_TM_MAX_STROBE       45
 #define JS_TM_MAX_LENGTH       13
 
 #define JS_TM_MODE_M3DI                1
 #define JS_TM_MODE_3DRP                3
-#define JS_TM_MODE_WCS3                4
-
-#define JS_TM_MODE_MAX         5       /* Last mode + 1 */
-
-#define JS_TM_BYTE_A0          0
-#define JS_TM_BYTE_A1          1
-#define JS_TM_BYTE_A2          3
-#define JS_TM_BYTE_A3          4
-#define JS_TM_BYTE_A4          6
-#define JS_TM_BYTE_A5          7
-
-#define JS_TM_BYTE_D0          2
-#define JS_TM_BYTE_D1          5
-#define JS_TM_BYTE_D2          8
-#define JS_TM_BYTE_D3          9
+#define JS_TM_MODE_FGP         163
 
 #define JS_TM_BYTE_ID          10
 #define JS_TM_BYTE_REV         11
 static int js_tm_port_list[] __initdata = {0x201, 0};
 static struct js_port* js_tm_port __initdata = NULL;
 
+static unsigned char js_tm_byte_a[16] = { 0, 1, 3, 4, 6, 7 };
+static unsigned char js_tm_byte_d[16] = { 2, 5, 8, 9 };
+
 struct js_tm_info {
        int io;
        unsigned char mode;
 };
 
-static int js_tm_id_to_def[JS_TM_MODE_MAX] = {0x00, 0x42, 0x00, 0x22, 0x00};
-
 /*
  * js_tm_read_packet() reads a ThrustMaster packet.
  */
 
 static int js_tm_read_packet(int io, unsigned char *data)
 {
-       unsigned int t, t1;
+       unsigned int t, p;
        unsigned char u, v, error;
        int i, j;
        unsigned long flags;
 
-       int start = (js_time_speed * JS_TM_MAX_START) >> 10;
-       int strobe = (js_time_speed * JS_TM_MAX_STROBE) >> 10;
-
        error = 0;
        i = j = 0;
+       p = t = JS_TM_MAX_START;
 
        __save_flags(flags);
        __cli();
        outb(0xff,io);
-
-       t = js_get_time();
-
-       do {
-               u = inb(io);
-               t1 = js_get_time();
-       } while ((u & 1) && js_delta(t1, t) < start);
-
-       t = t1;
-       u >>= 4;
+       
+       v = inb(io) >> 4;
 
        do {
-               v = inb(io) >> 4;
-               t1 = js_get_time();
-               if ((u ^ v) & u & 2) {
+               t--;
+               u = v; v = inb(io) >> 4;
+               if (~v & u & 2) {
                        if (j) {
                                if (j < 9) {                            /* Data bit */
                                        data[i] |= (~v & 1) << (j - 1);
@@ -124,10 +104,9 @@ static int js_tm_read_packet(int io, unsigned char *data)
                                error |= ~v & 1;
                                j++;
                        }
-                       t = t1;
+                       p = t = (p - t) << 1;
                }
-               u = v;
-       } while (!error && i < JS_TM_MAX_LENGTH && js_delta(t1,t) < strobe);
+       } while (!error && i < JS_TM_MAX_LENGTH && t > 0);
 
        __restore_flags(flags);
 
@@ -142,46 +121,39 @@ static int js_tm_read(void *xinfo, int **axes, int **buttons)
 {
        struct js_tm_info *info = xinfo;
        unsigned char data[JS_TM_MAX_LENGTH];
+       int i;
 
-       if (js_tm_read_packet(info->io, data)) {
-               printk(KERN_WARNING "joy-thrustmaster: failed to read data packet\n");
-               return -1;
-       }
-       if (data[JS_TM_BYTE_ID] != info->mode) {
-               printk(KERN_WARNING "joy-thrustmaster: ID (%d) != mode (%d)\n",
-                       data[JS_TM_BYTE_ID], info->mode);
-               return -1;
-       }
-       if (data[JS_TM_BYTE_DEF] != js_tm_id_to_def[info->mode]) {
-               printk(KERN_WARNING "joy-thrustmaster: DEF (%d) != def(mode) (%d)\n",
-                       data[JS_TM_BYTE_DEF], js_tm_id_to_def[info->mode]);
-               return -1;
-       }
+       if (js_tm_read_packet(info->io, data)) return -1;
+       if (data[JS_TM_BYTE_ID] != info->mode) return -1;
+
+       for (i = 0; i < data[JS_TM_BYTE_DEF] >> 4; i++) axes[0][i] = data[js_tm_byte_a[i]];
 
        switch (info->mode) {
 
                case JS_TM_MODE_M3DI:
 
-                       axes[0][0] = data[JS_TM_BYTE_A0];
-                       axes[0][1] = data[JS_TM_BYTE_A1];
-                       axes[0][2] = data[JS_TM_BYTE_A2];
-                       axes[0][3] = data[JS_TM_BYTE_A3];
+                       axes[0][4] = ((data[js_tm_byte_d[0]] >> 3) & 1) - ((data[js_tm_byte_d[0]] >> 1) & 1);
+                       axes[0][5] = ((data[js_tm_byte_d[0]] >> 2) & 1) - ( data[js_tm_byte_d[0]]       & 1);
 
-                       axes[0][4] = ((data[JS_TM_BYTE_D0] >> 3) & 1) - ((data[JS_TM_BYTE_D0] >> 1) & 1);
-                       axes[0][5] = ((data[JS_TM_BYTE_D0] >> 2) & 1) - ( data[JS_TM_BYTE_D0]       & 1);
-
-                       buttons[0][0] = ((data[JS_TM_BYTE_D0] >> 6) & 0x01) | ((data[JS_TM_BYTE_D0] >> 3) & 0x06)
-                                     | ((data[JS_TM_BYTE_D0] >> 4) & 0x08) | ((data[JS_TM_BYTE_D1] >> 2) & 0x30);
+                       buttons[0][0] = ((data[js_tm_byte_d[0]] >> 6) & 0x01) | ((data[js_tm_byte_d[0]] >> 3) & 0x06)
+                                     | ((data[js_tm_byte_d[0]] >> 4) & 0x08) | ((data[js_tm_byte_d[1]] >> 2) & 0x30);
 
                        return 0;
 
                case JS_TM_MODE_3DRP:
+               case JS_TM_MODE_FGP:
+
+                       buttons[0][0] = (data[js_tm_byte_d[0]] & 0x3f) | ((data[js_tm_byte_d[1]] << 6) & 0xc0)
+                                     | (( ((int) data[js_tm_byte_d[0]]) << 2) & 0x300);
+
+                       return 0;
+
+               default:
 
-                       axes[0][0] = data[JS_TM_BYTE_A0];
-                       axes[0][1] = data[JS_TM_BYTE_A1];
+                       buttons[0][0] = 0;
 
-                       buttons[0][0] = ( data[JS_TM_BYTE_D0]       & 0x3f) | ((data[JS_TM_BYTE_D1] << 6) & 0xc0)
-                                     | (( ((int) data[JS_TM_BYTE_D0]) << 2) & 0x300);
+                       for (i = 0; i < (data[JS_TM_BYTE_DEF] & 0xf); i++)
+                               buttons[0][0] |= ((int) data[js_tm_byte_d[i]]) << (i << 3);
 
                        return 0;
 
@@ -217,9 +189,9 @@ static int js_tm_close(struct js_dev *jd)
 
 static void __init js_tm_init_corr(int num_axes, int mode, int **axes, struct js_corr **corr)
 {
-       int j;
+       int j = 0;
 
-       for (j = 0; j < num_axes; j++) {
+       for (; j < num_axes; j++) {
                corr[0][j].type = JS_CORR_BROKEN;
                corr[0][j].prec = 0;
                corr[0][j].coef[0] = 127 - 2;
@@ -230,8 +202,7 @@ static void __init js_tm_init_corr(int num_axes, int mode, int **axes, struct js
 
        switch (mode) {
                case JS_TM_MODE_M3DI: j = 4; break;
-               case JS_TM_MODE_3DRP: j = 2; break;
-               default:              j = 0; break;
+               default: break;
        }
 
        for (; j < num_axes; j++) {
@@ -252,48 +223,46 @@ static void __init js_tm_init_corr(int num_axes, int mode, int **axes, struct js
 static struct js_port __init *js_tm_probe(int io, struct js_port *port)
 {
        struct js_tm_info info;
-       char *names[JS_TM_MODE_MAX] = { NULL, "ThrustMaster Millenium 3D Inceptor", NULL,
-                                               "ThrustMaster Rage 3D Gamepad", "ThrustMaster WCS III" };
-       char axes[JS_TM_MODE_MAX] = { 0, 6, 0, 2, 0 };
-       char buttons[JS_TM_MODE_MAX] = { 0, 5, 0, 10, 0 };
-
+       struct js_rm_models {
+               unsigned char id;
+               char *name;
+               char axes;
+               char buttons;
+       } models[] = {  {   1, "ThrustMaster Millenium 3D Inceptor", 6, 6 },
+                       {   3, "ThrustMaster Rage 3D Gamepad", 2, 10 },
+                       { 163, "Thrustmaster Fusion GamePad", 2, 10 },
+                       {   0, NULL, 0, 0 }};
+       char name[64];
        unsigned char data[JS_TM_MAX_LENGTH];
-       unsigned char u;
+       unsigned char a, b;
+       int i;
 
        if (check_region(io, 1)) return port;
 
-       if (((u = inb(io)) & 3) == 3) return port;
-       outb(0xff,io);
-       if (!((inb(io) ^ u) & ~u & 0xf)) return port;
-
-       if(js_tm_read_packet(io, data)) {
-               printk(KERN_WARNING "joy-thrustmaster: probe - can't read packet\n");
-               return port;
-       }
+       if (js_tm_read_packet(io, data)) return port;
 
        info.io = io;
        info.mode = data[JS_TM_BYTE_ID];
 
        if (!info.mode) return port;
 
-       if (info.mode >= JS_TM_MODE_MAX || !names[info.mode]) {
-               printk(KERN_WARNING "joy-thrustmaster: unknown device detected "
-                                   "(io=%#x, id=%d), contact <vojtech@suse.cz>\n",
-                                       io, info.mode);
-               return port;
-       }
+       for (i = 0; models[i].id && models[i].id != info.mode; i++);
 
-       if (data[JS_TM_BYTE_DEF] != js_tm_id_to_def[info.mode]) {
-               printk(KERN_WARNING "joy-thrustmaster: wrong DEF (%d) for ID %d - should be %d\n",
-                               data[JS_TM_BYTE_DEF], info.mode, js_tm_id_to_def[info.mode]);
+       if (models[i].id != info.mode) {
+               a = data[JS_TM_BYTE_DEF] >> 4;
+               b = (data[JS_TM_BYTE_DEF] & 0xf) << 3;
+               sprintf(name, "Unknown %d-axis, %d-button TM device %d", a, b, info.mode);
+       } else {
+               sprintf(name, models[i].name);
+               a = models[i].axes;
+               b = models[i].buttons;
        }
 
        request_region(io, 1, "joystick (thrustmaster)");
        port = js_register_port(port, &info, 1, sizeof(struct js_tm_info), js_tm_read);
        printk(KERN_INFO "js%d: %s revision %d at %#x\n",
-               js_register_device(port, 0, axes[info.mode], buttons[info.mode],
-                               names[info.mode], js_tm_open, js_tm_close), names[info.mode], data[JS_TM_BYTE_REV], io);
-       js_tm_init_corr(axes[info.mode], info.mode, port->axes, port->corr);
+               js_register_device(port, 0, a, b, name, js_tm_open, js_tm_close), name, data[JS_TM_BYTE_REV], io);
+       js_tm_init_corr(a, info.mode, port->axes, port->corr);
 
        return port;
 }
@@ -321,7 +290,7 @@ void cleanup_module(void)
 {
        struct js_tm_info *info;
 
-       while (js_tm_port != NULL) {
+       while (js_tm_port) {
                js_unregister_device(js_tm_port->devs[0]);
                info = js_tm_port->info;
                release_region(info->io, 1);
index 6b30efe852b49d03e3a848aec856a0eeb5544d31..0211ea6f9ae6278f1460d7dd6e31aa0731303de0 100644 (file)
@@ -1,7 +1,9 @@
 /*
  *  joy-turbografx.c  Version 1.2
  *
- *  Copyright (c) 1998 Vojtech Pavlik
+ *  Copyright (c) 1998-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
@@ -39,6 +41,7 @@
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
@@ -57,18 +60,14 @@ MODULE_PARM(js_tg_3, "2-8i");
 #define JS_TG_BUTTON4  0x01
 #define JS_TG_BUTTON5  0x08
 
-static struct js_port* js_tg_port = NULL;
+static struct js_port* js_tg_port __initdata = NULL;
 
 static int js_tg[] __initdata = { -1, 0, 0, 0, 0, 0, 0, 0 };
 static int js_tg_2[] __initdata = { -1, 0, 0, 0, 0, 0, 0, 0 };
 static int js_tg_3[] __initdata = { -1, 0, 0, 0, 0, 0, 0, 0 };
 
 struct js_tg_info {
-#ifdef USE_PARPORT
        struct pardevice *port; /* parport device */
-#else
-       int port;               /* hw port */
-#endif
        int sticks;             /* joysticks connected */
 };
 
@@ -109,9 +108,7 @@ int js_tg_open(struct js_dev *dev)
        struct js_tg_info *info = dev->port->info;
 
        if (!MOD_IN_USE) {
-#ifdef USE_PARPORT
                if (parport_claim(info->port)) return -EBUSY; 
-#endif
                JS_PAR_CTRL_OUT(0x04, info->port);
        }
        MOD_INC_USE_COUNT;
@@ -129,9 +126,7 @@ int js_tg_close(struct js_dev *dev)
         MOD_DEC_USE_COUNT;
        if (!MOD_IN_USE) {
                JS_PAR_CTRL_OUT(0x00, info->port);
-#ifdef USE_PARPORT
                parport_release(info->port);
-#endif
        }
         return 0;
 }
@@ -142,16 +137,12 @@ void cleanup_module(void)
        struct js_tg_info *info;
        int i;
 
-       while (js_tg_port != NULL) {
+       while (js_tg_port) {
                for (i = 0; i < js_tg_port->ndevs; i++)
-                       if (js_tg_port->devs[i] != NULL)
+                       if (js_tg_port->devs[i])
                                js_unregister_device(js_tg_port->devs[i]);
                info = js_tg_port->info;
-#ifdef USE_PARPORT
                parport_unregister_device(info->port);
-#else
-               release_region(info->port, 3);
-#endif
                js_tg_port = js_unregister_port(js_tg_port);
        }
 }
@@ -186,33 +177,25 @@ static struct js_port __init *js_tg_probe(int *config, struct js_port *port)
 {
        struct js_tg_info iniinfo;
        struct js_tg_info *info = &iniinfo;
+       struct parport *pp;
        int i;
 
        if (config[0] < 0) return port;
 
-#ifdef USE_PARPORT
-       {
-               struct parport *pp;
 
-               if (config[0] > 0x10)
-                       for (pp=parport_enumerate(); pp != NULL && (pp->base!=config[0]); pp=pp->next);
-               else
-                       for (pp=parport_enumerate(); pp != NULL && (config[0]>0); pp=pp->next) config[0]--;
+       if (config[0] > 0x10)
+               for (pp=parport_enumerate(); pp && (pp->base!=config[0]); pp=pp->next);
+       else
+               for (pp=parport_enumerate(); pp && (config[0]>0); pp=pp->next) config[0]--;
 
-               if (pp == NULL) {
-                       printk(KERN_ERR "joy-tg: no such parport\n");
-                       return port;
-               }
-
-               info->port = parport_register_device(pp, "joystick (turbografx)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
-               if (!info->port)
-                       return port;
+       if (!pp) {
+               printk(KERN_ERR "joy-tg: no such parport\n");
+               return port;
        }
-#else
-       info->port = config[0];
-       if (check_region(info->port, 3)) return port;
-       request_region(info->port, 3, "joystick (turbografx)");
-#endif
+
+       info->port = parport_register_device(pp, "joystick (turbografx)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+       if (!info->port)
+               return port;
 
        port = js_register_port(port, info, 7, sizeof(struct js_tg_info), js_tg_read);
        info = port->info;
@@ -221,24 +204,14 @@ static struct js_port __init *js_tg_probe(int *config, struct js_port *port)
 
        for (i = 0; i < 7; i++)
                if (config[i+1] > 0 && config[i+1] < 6) {
-#ifdef USE_PARPORT
                        printk(KERN_INFO "js%d: Multisystem joystick on %s\n",
                                js_register_device(port, i, 2, config[i+1], "Multisystem joystick", js_tg_open, js_tg_close),
                                info->port->port->name);
-#else
-                       printk(KERN_INFO "js%d: Multisystem joystick at %#x\n",
-                               js_register_device(port, i, 2, config[i+1], "Multisystem joystick", js_tg_open, js_tg_close),
-                               info->port);
-#endif
                        info->sticks |= (1 << i);
                }
 
         if (!info->sticks) {
-#ifdef USE_PARPORT
                parport_unregister_device(info->port);
-#else
-               release_region(info->port, 3);
-#endif
                return port;
         }
                
@@ -248,18 +221,30 @@ static struct js_port __init *js_tg_probe(int *config, struct js_port *port)
 }
 
 #ifndef MODULE
-void __init js_tg_setup(char *str, int *ints)
+int __init js_tg_setup(SETUP_PARAM)
 {
        int i;
-
-       if (!strcmp(str,"js_tg"))
-               for (i = 0; i <= ints[0] && i < 2; i++) js_tg[i] = ints[i+1];
-       if (!strcmp(str,"js_tg_2"))
-               for (i = 0; i <= ints[0] && i < 2; i++) js_tg_2[i] = ints[i+1];
-       if (!strcmp(str,"js_tg_3"))
-               for (i = 0; i <= ints[0] && i < 2; i++) js_tg_3[i] = ints[i+1];
-
+       SETUP_PARSE(2);
+       for (i = 0; i <= ints[0] && i < 2; i++) js_tg[i] = ints[i+1];
+       return 1;
+}
+int __init js_tg_setup_2(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(2);
+       for (i = 0; i <= ints[0] && i < 2; i++) js_tg_2[i] = ints[i+1];
+       return 1;
+}
+int __init js_tg_setup_3(SETUP_PARAM)
+{
+       int i;
+       SETUP_PARSE(2);
+       for (i = 0; i <= ints[0] && i < 2; i++) js_tg_3[i] = ints[i+1];
+       return 1;
 }
+__setup("js_tg=", js_tg_setup);
+__setup("js_tg_2=", js_tg_setup_2);
+__setup("js_tg_3=", js_tg_setup_3);
 #endif
 
 #ifdef MODULE
diff --git a/drivers/char/joystick/joy-warrior.c b/drivers/char/joystick/joy-warrior.c
new file mode 100644 (file)
index 0000000..fd7be57
--- /dev/null
@@ -0,0 +1,318 @@
+/*
+ *  joy-warrior.c  Version 0.1
+ *
+ *  Copyright (c) 1998 David Thompson
+ *  Copyright (c) 1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
+ */
+
+/*
+ * This is a module for the Linux joystick driver, supporting
+ * the Logitech WingMan Warrior joystick.
+ */
+
+/*
+ * This program is free warftware; 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 of the License, 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
+ * 
+ *  Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
+ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/errno.h>
+#include <linux/joystick.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+
+/*
+ * Constants.
+ */
+
+#define        N_JOYSTICK_WAR          13
+#define JS_WAR_MAX_LENGTH      16
+
+/*
+ * List of Warriors.
+ */
+
+static struct js_port* js_war_port = NULL;
+
+static char js_war_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; 
+
+/*
+ * Per-Warrior data.
+ */
+
+struct js_war_info {
+       struct tty_struct* tty;
+       struct js_port* port;
+       int idx;
+       int len;
+       unsigned char data[JS_WAR_MAX_LENGTH];
+       char used;
+};
+
+/*
+ * js_war_process_packet() decodes packets the driver receives from the
+ * Warrior. It updates the data accordingly.
+ */
+
+static void js_war_process_packet(struct js_war_info* info)
+{
+       int **axes = info->port->axes;
+       int **buttons = info->port->buttons;
+       unsigned char *data = info->data;
+       int i;
+
+       if (!info->idx) return;
+
+       switch ((data[0] >> 4) & 7) {
+
+               case 1:                                 /* Button data */
+                       if (!info->port->devs[0]) return;
+                       buttons[0][0] = ((data[3] & 0xa) >> 1) | ((data[3] & 0x5) << 1);
+                       return;
+               case 2:                                 /* Static status (Send !S to get one) */
+#if 0
+                       printk("joy-warrior: Static status:");
+                       for (i = 0; i < 12; i++)
+                               printk(" %02x", info->data[i]);
+                       printk("\n");
+#endif
+                       return;
+               case 3:                                 /* XY-axis info->data */
+                       if (!info->port->devs[0]) return;
+                       axes[0][0] = ((data[0] & 8) << 5) - (data[2] | ((data[0] & 4) << 5));
+                       axes[0][1] = (data[1] | ((data[0] & 1) << 7)) - ((data[0] & 2) << 7);
+                       return;
+                       break;
+               case 4:                                 /* Dynamic status */
+#if 0
+                       printk("joy-warrior: Dynamic status:");
+                       for (i = 0; i < 4; i++)
+                               printk(" %02x", info->data[i]);
+                       printk("\n");
+#endif
+                       return;
+               case 5:                                 /* Throttle, spinner, hat info->data */
+                       if (!info->port->devs[0]) return;
+                       axes[0][2] = (data[1] | ((data[0] & 1) << 7)) - ((data[0] & 2) << 7);
+                       axes[0][3] = (data[3] & 2 ? 1 : 0) - (info->data[3] & 1 ? 1 : 0);
+                       axes[0][4] = (data[3] & 8 ? 1 : 0) - (info->data[3] & 4 ? 1 : 0);
+                       axes[0][5] = (data[2] | ((data[0] & 4) << 5)) - ((data[0] & 8) << 5);
+                       return;
+               default:
+                       printk("joy-warrior: Unknown packet %d length %d:", (data[0] >> 4) & 7, info->idx);
+                       for (i = 0; i < info->idx; i++)
+                               printk(" %02x", data[i]);
+                       printk("\n");
+                       return;
+       }
+}
+
+/*
+ * js_war_open() is a callback from the joystick device open routine.
+ */
+
+static int js_war_open(struct js_dev *jd)
+{
+       struct js_war_info *info = jd->port->info;
+       info->used++;
+       MOD_INC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_war_close() is a callback from the joystick device release routine.
+ */
+
+static int js_war_close(struct js_dev *jd)
+{
+       struct js_war_info *info = jd->port->info;
+       if (!--info->used) {
+               js_unregister_device(jd->port->devs[0]);
+               js_war_port = js_unregister_port(jd->port);
+       }
+       MOD_DEC_USE_COUNT;
+       return 0;
+}
+
+/*
+ * js_war_init_corr() initializes the correction values for the Warrior.
+ */
+
+static void __init js_war_init_corr(struct js_corr **corr)
+{
+       int i;
+
+       for (i = 0; i < 6; i++) {
+               corr[0][i].type = JS_CORR_BROKEN;
+               corr[0][i].prec = 0;
+               corr[0][i].coef[0] = -8;
+               corr[0][i].coef[1] = 8;
+               corr[0][i].coef[2] = (1 << 29) / (128 - 64);
+               corr[0][i].coef[3] = (1 << 29) / (128 - 64);
+       }
+
+       corr[0][2].coef[2] = (1 << 29) / (128 - 16);
+       corr[0][2].coef[3] = (1 << 29) / (128 - 16);
+
+       for (i = 3; i < 5; i++) {
+               corr[0][i].coef[0] = 0;
+               corr[0][i].coef[1] = 0;
+               corr[0][i].coef[2] = (1 << 29);
+               corr[0][i].coef[3] = (1 << 29);
+       }
+
+       corr[0][5].prec = -1;
+       corr[0][5].coef[0] = 0;
+       corr[0][5].coef[1] = 0;
+       corr[0][5].coef[2] = (1 << 29) / 128;
+       corr[0][5].coef[3] = (1 << 29) / 128;
+}
+
+/*
+ * js_war_ldisc_open() is the routine that is called upon setting our line
+ * discipline on a tty.
+ */
+
+static int js_war_ldisc_open(struct tty_struct *tty)
+{
+       struct js_war_info iniinfo;
+       struct js_war_info *info = &iniinfo;
+
+       info->tty = tty;
+       info->idx = 0;
+       info->len = 0;
+       info->used = 1;
+
+       js_war_port = js_register_port(js_war_port, info, 1, sizeof(struct js_war_info), NULL);
+
+       info = js_war_port->info;
+       info->port = js_war_port;
+       tty->disc_data = info;
+
+       printk(KERN_INFO "js%d: WingMan Warrior on %s%d\n",
+               js_register_device(js_war_port, 0, 6, 4, "WingMan Warrior", js_war_open, js_war_close),
+               tty->driver.name, MINOR(tty->device) - tty->driver.minor_start);
+
+       js_war_init_corr(js_war_port->corr);
+
+       MOD_INC_USE_COUNT;
+
+       return 0;
+}
+
+/*
+ * js_war_ldisc_close() is the opposite of js_war_ldisc_open()
+ */
+
+static void js_war_ldisc_close(struct tty_struct *tty)
+{
+       struct js_war_info* info = (struct js_war_info*) tty->disc_data;
+       if (!--info->used) {
+               js_unregister_device(info->port->devs[0]);
+               js_war_port = js_unregister_port(info->port);
+       }
+       MOD_DEC_USE_COUNT;
+}
+
+/*
+ * js_war_ldisc_receive() is called by the low level driver when characters
+ * are ready for us. We then buffer them for further processing, or call the
+ * packet processing routine.
+ */
+
+static void js_war_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
+{
+       struct js_war_info* info = (struct js_war_info*) tty->disc_data;
+       int i;
+
+       for (i = 0; i < count; i++) {
+               if (cp[i] & 0x80) {
+                       if (info->idx)
+                               js_war_process_packet(info);
+                       info->idx = 0;
+                       info->len = js_war_lengths[(cp[i] >> 4) & 7];
+               }
+
+               if (info->idx < JS_WAR_MAX_LENGTH)
+                       info->data[info->idx++] = cp[i];
+
+               if (info->idx == info->len) {
+                       if (info->idx)
+                               js_war_process_packet(info);    
+                       info->idx = 0;
+                       info->len = 0;
+               }
+       }
+}
+
+/*
+ * js_war_ldisc_room() reports how much room we do have for receiving data.
+ * Although we in fact have infinite room, we need to specify some value
+ * here, so why not the size of our packet buffer. It's big anyway.
+ */
+
+static int js_war_ldisc_room(struct tty_struct *tty)
+{
+       return JS_WAR_MAX_LENGTH;
+}
+
+/*
+ * The line discipline structure.
+ */
+
+static struct tty_ldisc js_war_ldisc = {
+        magic:          TTY_LDISC_MAGIC,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+        name:           "warrior",
+#endif
+       open:           js_war_ldisc_open,
+       close:          js_war_ldisc_close,
+       receive_buf:    js_war_ldisc_receive,
+       receive_room:   js_war_ldisc_room,
+};
+
+/*
+ * The functions for inserting/removing us as a module.
+ */
+
+#ifdef MODULE
+int init_module(void)
+#else
+int __init js_war_init(void)
+#endif
+{
+        if (tty_register_ldisc(N_JOYSTICK_WAR, &js_war_ldisc)) {
+                printk(KERN_ERR "joy-warrior: Error registering line discipline.\n");
+               return -ENODEV;
+       }
+
+       return  0;
+}
+
+#ifdef MODULE
+void cleanup_module(void)
+{
+       tty_register_ldisc(N_JOYSTICK_WAR, NULL);
+}
+#endif
index 6c2abda1f6e9d15b3e075611d0ea1744886d18d2..48af4c713bbb72bfcf422e93231e4279e89b30c7 100644 (file)
@@ -1,7 +1,9 @@
 /*
- * joystick.c  Version 1.2
+ *  joystick.c  Version 1.2
  *
- * Copyright (c) 1996-1998 Vojtech Pavlik
+ *  Copyright (c) 1996-1999 Vojtech Pavlik
+ *
+ *  Sponsored by SuSE
  */
 
 /*
@@ -33,7 +35,6 @@
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/segment.h>
-#include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/joystick.h>
 #include <linux/malloc.h>
 #include <linux/mm.h>
 #include <linux/module.h>
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-#include <linux/spinlock.h>
 #include <linux/poll.h>
-#endif
+#include <linux/config.h>
+#include <linux/init.h>
 
 /*
  * Configurable parameters.
 
 #define JS_REFRESH_TIME                HZ/50   /* Time between two reads of joysticks (20ms) */
 
+/*
+ * Exported symbols.
+ */
+
+EXPORT_SYMBOL(js_register_port);
+EXPORT_SYMBOL(js_unregister_port);
+EXPORT_SYMBOL(js_register_device);
+EXPORT_SYMBOL(js_unregister_device);
+
 /*
  * Buffer macros.
  */
@@ -74,18 +82,6 @@ static struct timer_list js_timer;
 spinlock_t js_lock = SPIN_LOCK_UNLOCKED;
 static int js_use_count = 0;
 
-/*
- * Exported variables.
- */
-
-unsigned int js_time_speed = 0;
-js_time_func js_get_time;
-js_delta_func js_delta;
-
-unsigned int js_time_speed_a = 0;
-js_time_func js_get_time_a;
-js_delta_func js_delta_a;
-
 /*
  * Module info.
  */
@@ -93,244 +89,6 @@ js_delta_func js_delta_a;
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_SUPPORTED_DEVICE("js");
 
-/*
- * js_get_time_*() are different functions to get current time.
- * js_delta_*() are functions to compute time difference.
- */
-
-#ifdef __i386__
-
-static unsigned int js_get_time_rdtsc(void)
-{
-       unsigned int x;
-       __asm__ __volatile__ ( "rdtsc" : "=A" (x) );
-       return x;
-}
-
-static unsigned int js_get_time_pit(void)
-{
-       unsigned long flags;
-       unsigned int x;
-
-       __save_flags(flags);
-       __cli();
-       outb(0, 0x43);
-       x = inb(0x40);
-       x |= inb(0x40) << 8;
-       __restore_flags(flags);
-
-       return x;
-}
-
-static int js_delta_pit(unsigned int x, unsigned int y)
-{
-       return y - x + ( y < x ? 1193180L / HZ : 0 );
-}
-
-static unsigned int js_get_time_counter(void)
-{
-       static int time_counter = 0;
-       return time_counter++;
-}
-
-#else
-#ifdef __alpha__
-
-static unsigned int js_get_time_rpcc(void)
-{
-       unsigned int x;
-       __asm__ __volatile__ ( "rpcc %0" : "=r" (x) );
-       return x;
-}
-
-#else
-
-#ifndef MODULE
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-static unsigned int js_get_time_system(void)
-{
-       static struct timeval js_tv;
-       get_fast_time(&js_tv);
-       return js_tv.tv_sec * 1000000L + js_tv.tv_usec;
-}
-#endif
-#endif
-
-#endif
-#endif
-
-static int js_delta_normal(unsigned int x, unsigned int y)
-{
-       return x - y;
-}
-
-/*
- * js_calibrate_time() calibrates a given timer.
- */
-
-static int __init js_calibrate_time(js_time_func get_time, js_delta_func delta)
-{
-       unsigned int t1, t2, t3;
-       unsigned long flags;
-
-       __save_flags(flags);
-       __cli();
-       t1 = get_time();
-       udelay(1000);
-       t2 = get_time();
-       t3 = get_time();
-       __restore_flags(flags);
-
-       return delta(t2, t1) - delta(t3, t2);
-}
-
-/*
- * js_calibrate_time_counter() calibrates the counter timer, which can't
- * be calibrated using the above function.
- */
-
-#ifdef __i386__
-
-static int __init js_calibrate_time_counter(void)
-{
-       unsigned int i, j, t1, t2, t3;
-
-       j = jiffies; do { inb(0x201); t1 = js_get_time_counter(); } while (j == jiffies);
-       j = jiffies; do { inb(0x201); t2 = js_get_time_counter(); } while (j == jiffies);
-
-       j = (t2 - t1) * HZ / 1000;
-
-       t1 = js_get_time_pit();
-       for (i = 0; i < 1000; i++) {
-               inb(0x201);
-               js_get_time_counter();
-       }
-       t2 = js_get_time_pit();
-       t3 = js_get_time_pit();
-
-       i = 1193180L / (js_delta_pit(t2, t1) - js_delta_pit(t3, t2));
-
-       if (DIFF(i,j) > 5)
-               printk(KERN_WARNING "js: Counter timer calibration unsure,"
-                       " pass1 (0.%d MHz) and pass2 (0.%d MHz) differ.\n", j, i);
-
-       return (i + j) >> 1;
-}
-
-#endif
-
-/*
- * js_setup_time chooses the best available timers
- * on the system and calibrates them.
- */
-
-static int __init js_setup_time(void)
-{
-       int t;
-       char *name, *name_a;
-
-       name = "";
-       name_a = "";
-       js_time_speed = 0;
-       js_time_speed_a = 0;
-
-#ifdef __i386__
-
-       t = js_calibrate_time(js_get_time_pit, js_delta_pit);
-
-       if (DIFF(t, 1193) > 5)
-               printk(KERN_WARNING "js: Measured PIT speed is %d.%03d MHz, but should be 1.193 MHz.\n"
-                      KERN_WARNING "js: This is probably caused by wrong BogoMIPS value. It is: %ld, should be: %ld.\n",
-                       t / 1000, t % 1000, loops_per_sec / 500000, loops_per_sec / (t * 500000 / 1193));
-
-       if (JS_HAS_RDTSC && (t = js_calibrate_time(js_get_time_rdtsc, js_delta_normal)) > 0) {
-
-               js_time_speed_a = t;
-               js_get_time_a = js_get_time_rdtsc;
-               js_delta_a = js_delta_normal;
-               js_time_speed = t;
-               js_get_time = js_get_time_rdtsc;
-               js_delta = js_delta_normal;
-               name = "RDTSC";
-
-       } else {
-
-               js_time_speed_a = t;
-               js_get_time_a = js_get_time_pit;
-               js_delta_a = js_delta_pit;
-               name_a = "PIT";
-
-               t = js_calibrate_time_counter();
-
-               js_time_speed = t;
-               js_get_time = js_get_time_counter;
-               js_delta = js_delta_normal;
-               name = "counter";
-
-       }
-
-#else
-#ifdef __alpha__
-
-       t = js_calibrate_time(js_get_time_rpcc, js_delta_normal);
-
-       js_time_speed_a = t;
-       js_get_time_a = js_get_time_rpcc;
-       js_delta_a = js_delta_normal;
-       js_time_speed = t;
-       js_get_time = js_get_time_rpcc;
-       js_delta = js_delta_normal;
-       name = "RPCC";
-
-#else
-
-#ifndef MODULE
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-       t = js_calibrate_time(js_get_time_system, js_delta_normal);
-
-       js_time_speed_a = t;
-       js_get_time_a = js_get_time_system;
-       js_delta_a = js_delta_normal;
-       js_time_speed = t;
-       js_get_time = js_get_time_system;
-       js_delta = js_delta_normal;
-       name = "system";
-#endif
-#endif
-
-#endif
-#endif
-
-       printk(KERN_INFO "js: Version %d.%d.%d ",
-               JS_VERSION >> 16 & 0xff, JS_VERSION >> 8 & 0xff, JS_VERSION & 0xff);
-
-       if (js_time_speed_a <= 0 || js_time_speed <= 0) {
-               printk("\n");
-               return -1;
-       }
-
-       printk("using ");
-
-       if (js_time_speed > 10000) {
-               t = js_time_speed / 1000 + (js_time_speed % 1000 >= 500);
-               printk("%d MHz ", t);
-       } else {
-               t = js_time_speed / 10 + (js_time_speed % 10 >= 5);
-               printk("%d.%02d MHz ", t / 100, t % 100);
-       }
-
-       if (js_get_time_a != js_get_time) {
-               t = js_time_speed_a / 10 + (js_time_speed_a % 10 >= 5);
-               printk("%s timer and %d.%02d MHz %s timer.\n",
-                       name, t / 100, t % 100, name_a);
-       } else {
-               printk("%s timer.\n", name);
-       }
-
-       return 0;
-}
-
-
 /*
  * js_correct() performs correction of raw joystick data.
  */
@@ -365,7 +123,6 @@ static inline int js_button(int *buttons, int i)
        return (buttons[i >> 5] >> (i & 0x1f)) & 1;
 }
 
-
 /*
  * js_add_event() adds an event to the buffer. This requires additional
  * queue post-processing done by js_sync_buff.
@@ -458,14 +215,17 @@ static void js_do_timer(unsigned long data)
        struct js_dev *curd = js_dev;
        unsigned long flags;
 
-       while (curp != NULL) {
-               curp->read(curp->info, curp->axes, curp->buttons);
+       while (curp) {
+               if (curp->read) 
+                       if (curp->read(curp->info, curp->axes, curp->buttons))
+                               curp->fail++;
+               curp->total++;
                curp = curp->next;
        }
 
        spin_lock_irqsave(&js_lock, flags);
 
-       while (curd != NULL) {
+       while (curd) {
                if (data) {
                        js_process_data(curd);
                        js_sync_buff(curd);
@@ -486,11 +246,7 @@ static void js_do_timer(unsigned long data)
  * space.
  */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
 static ssize_t js_read(struct file *file, char *buf, size_t count, loff_t *ppos)
-#else
-static int js_read(struct inode *inode, struct file *file, char *buf, int count)
-#endif
 {
        DECLARE_WAITQUEUE(wait, current);
        struct js_event *buff = (void *) buf;
@@ -576,13 +332,8 @@ static int js_read(struct inode *inode, struct file *file, char *buf, int count)
 
                        tmpevent.time = jiffies * (1000/HZ);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
                        if (copy_to_user(&buff[written], &tmpevent, sizeof(struct js_event)))
                                retval = -EFAULT;
-#else
-                       if (!(retval = verify_area(VERIFY_WRITE, &buff[written], sizeof(struct js_event))))
-                               memcpy_tofs(&buff[written], &tmpevent, sizeof(struct js_event));
-#endif
 
                        curl->startup++;
                        written++;
@@ -594,17 +345,11 @@ static int js_read(struct inode *inode, struct file *file, char *buf, int count)
 
                while ((jd->bhead != (new_tail = GOF(curl->tail))) && (written < blocks) && !retval) {
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
                        if (copy_to_user(&buff[written], &jd->buff[new_tail], sizeof(struct js_event)))
                                retval = -EFAULT;
                        if (put_user((__u32)(jd->buff[new_tail].time * (1000/HZ)), &buff[written].time))
                                retval = -EFAULT;
-#else
-                       if (!(retval = verify_area(VERIFY_WRITE, &buff[written], sizeof(struct js_event)))) {
-                               memcpy_tofs(&buff[written], &jd->buff[new_tail], sizeof(struct js_event));
-                               put_user((__u32)(jd->buff[new_tail].time * (1000/HZ)), &buff[written].time);
-                       }
-#endif
+
                        curl->tail = new_tail;
                        written++;
                }
@@ -625,15 +370,9 @@ static int js_read(struct inode *inode, struct file *file, char *buf, int count)
                data.y = jd->num_axes < 2 ? 0 :
                        ((js_correct(jd->new.axes[1], &jd->corr[1]) / 256) + 128) >> js_comp_glue.JS_CORR.y;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
                retval = copy_to_user(buf, &data, sizeof(struct JS_DATA_TYPE)) ? -EFAULT : 0;
-#else
-               if (!(retval = verify_area(VERIFY_WRITE, buf, sizeof(struct JS_DATA_TYPE)))) {
-                       memcpy_tofs(buf, &data, sizeof(struct JS_DATA_TYPE));
-               }
-#endif
 
-               curl->startup = 0;
+               curl->startup = jd->num_axes + jd->num_buttons;
                curl->tail = GOB(jd->bhead);
                if (!retval) retval = sizeof(struct JS_DATA_TYPE);
        }
@@ -645,12 +384,12 @@ static int js_read(struct inode *inode, struct file *file, char *buf, int count)
        if (orig_tail == jd->tail) {
                new_tail = curl->tail;
                curl = jd->list;
-               while (curl != NULL && curl->tail != jd->tail) {
+               while (curl && curl->tail != jd->tail) {
                        if (ROT(jd->bhead, new_tail, curl->tail) ||
                                (jd->bhead == curl->tail)) new_tail = curl->tail;
                        curl = curl->next;
                }
-               if (curl == NULL) jd->tail = new_tail;
+               if (!curl) jd->tail = new_tail;
        }
 
        spin_unlock_irqrestore(&js_lock, flags);
@@ -662,8 +401,6 @@ static int js_read(struct inode *inode, struct file *file, char *buf, int count)
  * js_poll() does select() support.
  */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-
 static unsigned int js_poll(struct file *file, poll_table *wait)
 {
        struct js_list *curl = file->private_data;
@@ -677,20 +414,6 @@ static unsigned int js_poll(struct file *file, poll_table *wait)
        return retval;
 }
 
-#else
-
-static int js_select(struct inode *inode, struct file *file, int sel_type, select_table *wait)
-{
-       struct js_list *curl = file->private_data;
-       if (sel_type == SEL_IN) {
-               if (GOF(curl->tail) != curl->dev->bhead) return 1;
-               select_wait(&curl->dev->wait, wait);
-       }
-       return 0;
-}
-
-#endif
-
 /*
  * js_ioctl handles misc ioctl calls.
  */
@@ -704,8 +427,6 @@ static int js_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
        curl = file->private_data;
        jd = curl->dev;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-
        switch (cmd) {
 
 /*
@@ -758,95 +479,6 @@ static int js_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
                        }
        }
 
-#else
-
-       switch (cmd) {
-
-/*
- * 0.x compatibility
- */
-
-               case JS_SET_CAL:
-                       if (verify_area(VERIFY_READ, (struct JS_DATA_TYPE *) arg,
-                               sizeof(struct JS_DATA_TYPE))) return -EFAULT;
-                       memcpy_fromfs(&js_comp_glue.JS_CORR, (struct JS_DATA_SAVE_TYPE *) arg,
-                               sizeof(struct JS_DATA_TYPE));
-                       return 0;
-               case JS_GET_CAL:
-                       if (verify_area(VERIFY_WRITE, (struct JS_DATA_TYPE *) arg,
-                               sizeof(struct JS_DATA_TYPE))) return -EFAULT;
-                       memcpy_tofs((struct JS_DATA_SAVE_TYPE *) arg, &js_comp_glue.JS_CORR,
-                               sizeof(struct JS_DATA_TYPE));
-                       return 0;
-               case JS_SET_TIMEOUT:
-                       if (verify_area(VERIFY_READ, (int *) arg, sizeof(int))) return -EFAULT;
-                       js_comp_glue.JS_TIMEOUT = get_user((int *) arg);
-                       return 0;
-               case JS_GET_TIMEOUT:
-                       if (verify_area(VERIFY_WRITE, (int *) arg, sizeof(int))) return -EFAULT;
-                       put_user(js_comp_glue.JS_TIMEOUT, (int *) arg);
-                       return 0;
-               case JS_SET_TIMELIMIT:
-                       if (verify_area(VERIFY_READ, (long *) arg, sizeof(long))) return -EFAULT;
-                       js_comp_glue.JS_TIMELIMIT = get_user((long *) arg);
-                       return 0;
-               case JS_GET_TIMELIMIT:
-                       if (verify_area(VERIFY_WRITE, (long *) arg, sizeof(long))) return -EFAULT;
-                       put_user(js_comp_glue.JS_TIMELIMIT, (long *) arg);
-                       return 0;
-               case JS_SET_ALL:
-                       if (verify_area(VERIFY_READ, (struct JS_DATA_SAVE_TYPE *) arg,
-                               sizeof(struct JS_DATA_SAVE_TYPE))) return -EFAULT;
-                       memcpy_fromfs(&js_comp_glue, (struct JS_DATA_SAVE_TYPE *) arg,
-                               sizeof(struct JS_DATA_SAVE_TYPE));
-                       return 0;
-               case JS_GET_ALL:
-                       if (verify_area(VERIFY_WRITE, (struct JS_DATA_SAVE_TYPE *) arg,
-                               sizeof(struct JS_DATA_SAVE_TYPE))) return -EFAULT;
-                       memcpy_tofs((struct JS_DATA_SAVE_TYPE *) arg, &js_comp_glue,
-                               sizeof(struct JS_DATA_SAVE_TYPE));
-                       return 0;
-
-/*
- * 1.x ioctl calls
- */
-
-               case JSIOCGVERSION:
-                       if (verify_area(VERIFY_WRITE, (__u32 *) arg, sizeof(__u32))) return -EFAULT;
-                       put_user(JS_VERSION, (__u32 *) arg);
-                       return 0;
-               case JSIOCGAXES:
-                       if (verify_area(VERIFY_WRITE, (__u8 *) arg, sizeof(__u8))) return -EFAULT;
-                       put_user(jd->num_axes, (__u8 *) arg);
-                       return 0;
-               case JSIOCGBUTTONS:
-                       if (verify_area(VERIFY_WRITE, (__u8 *) arg, sizeof(__u8))) return -EFAULT;
-                       put_user(jd->num_buttons, (__u8 *) arg);
-                       return 0;
-               case JSIOCSCORR:
-                       if (verify_area(VERIFY_READ, (struct js_corr *) arg,
-                               sizeof(struct js_corr) * jd->num_axes)) return -EFAULT;
-                       memcpy_fromfs(jd->corr, (struct js_corr *) arg,
-                               sizeof(struct js_corr) * jd->num_axes);
-                       return 0;
-               case JSIOCGCORR:
-                       if (verify_area(VERIFY_WRITE, (struct js_corr *) arg,
-                               sizeof(struct js_corr) * jd->num_axes)) return -EFAULT;
-                       memcpy_tofs((struct js_corr *) arg,
-                               jd->corr, sizeof(struct js_corr) * jd->num_axes);
-                       return 0;
-               default:
-                       if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) {
-                               len = strlen(jd->name) + 1;
-                               if (verify_area(VERIFY_WRITE, (char *) arg, len)) return -EFAULT;
-                               if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-                               memcpy_tofs((char *) arg, jd->name, len);
-                               return len;
-                       }
-       }
-
-#endif
-
        return -EINVAL;
 }
 
@@ -868,21 +500,20 @@ static int js_open(struct inode *inode, struct file *file)
 
        spin_lock_irqsave(&js_lock, flags);
 
-       while (i > 0 && jd != NULL) {
+       while (i > 0 && jd) {
                jd = jd->next;
                i--;
        }
 
        spin_unlock_irqrestore(&js_lock, flags);
 
-       if (jd == NULL) return -ENODEV;
+       if (!jd) return -ENODEV;
 
        if ((result = jd->open(jd))) return result;
 
-       MOD_INC_USE_COUNT;
-       if (!js_use_count++) js_do_timer(0);
+       if ((new = kmalloc(sizeof(struct js_list), GFP_KERNEL))) {
 
-       if ((new = kmalloc(sizeof(struct js_list), GFP_KERNEL)) != NULL) {
+               MOD_INC_USE_COUNT;
 
                spin_lock_irqsave(&js_lock, flags);
 
@@ -897,6 +528,8 @@ static int js_open(struct inode *inode, struct file *file)
 
                spin_unlock_irqrestore(&js_lock, flags);
 
+               if (!js_use_count++) js_do_timer(0);
+
        } else {
                result = -ENOMEM;
        }
@@ -909,11 +542,7 @@ static int js_open(struct inode *inode, struct file *file)
  * used by it.
  */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
 static int js_release(struct inode *inode, struct file *file)
-#else
-static void js_release(struct inode *inode, struct file *file)
-#endif
 {
        struct js_list *curl = file->private_data;
        struct js_dev *jd = curl->dev;
@@ -926,11 +555,11 @@ static void js_release(struct inode *inode, struct file *file)
        while (*curp && (*curp != curl)) curp = &((*curp)->next);
        *curp = (*curp)->next;
 
-       if (jd->list != NULL)
+       if (jd->list)
        if (curl->tail == jd->tail) {
                curl = jd->list;
                new_tail = curl->tail;
-               while (curl != NULL && curl->tail != jd->tail) {
+               while (curl && curl->tail != jd->tail) {
                        if (ROT(jd->bhead, new_tail, curl->tail) ||
                               (jd->bhead == curl->tail)) new_tail = curl->tail;
                        curl = curl->next;
@@ -947,9 +576,7 @@ static void js_release(struct inode *inode, struct file *file)
 
        jd->close(jd);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
        return 0;
-#endif
 }
 
 /*
@@ -968,7 +595,7 @@ static void js_dump_mem(void)
        printk(",--- Dumping Devices:\n");
        printk("| js_dev = %x\n", (int) js_dev);
 
-       while (curd != NULL) {
+       while (curd) {
                printk("|  %s-device %x, next %x axes %d, buttons %d, port %x - %#x\n",
                        curd->next ? "|":"`",
                        (int) curd, (int) curd->next, curd->num_axes, curd->num_buttons, (int) curd->port, curd->port->io);
@@ -978,7 +605,7 @@ static void js_dump_mem(void)
        printk(">--- Dumping ports:\n");
        printk("| js_port = %x\n", (int) js_port);
 
-       while (curp != NULL) {
+       while (curp) {
                printk("|  %s-port %x, next %x, io %#x, devices %d\n",
                        curp->next ? "|":"`",
                        (int) curp, (int) curp->next, curp->io, curp->ndevs);
@@ -1010,7 +637,7 @@ struct js_port *js_register_port(struct js_port *port,
        int i;
        unsigned long flags;
 
-       if ((all = kmalloc(sizeof(struct js_port) + 4 * devs * sizeof(void*) + infos, GFP_KERNEL)) == NULL)
+       if (!(all = kmalloc(sizeof(struct js_port) + 4 * devs * sizeof(void*) + infos, GFP_KERNEL)))
                return NULL;
 
        curp = all;
@@ -1019,6 +646,8 @@ struct js_port *js_register_port(struct js_port *port,
        curp->prev = port;
        curp->read = read;
        curp->ndevs = devs;
+       curp->fail = 0;
+       curp->total = 0;
 
        curp->devs = all += sizeof(struct js_port);
        for (i = 0; i < devs; i++) curp->devs[i] = NULL;
@@ -1036,7 +665,7 @@ struct js_port *js_register_port(struct js_port *port,
 
        spin_lock_irqsave(&js_lock, flags);
 
-       while (*ptrp != NULL) ptrp=&((*ptrp)->next);
+       while (*ptrp) ptrp=&((*ptrp)->next);
        *ptrp = curp;
 
        spin_unlock_irqrestore(&js_lock, flags);
@@ -1052,7 +681,9 @@ struct js_port *js_unregister_port(struct js_port *port)
 
        spin_lock_irqsave(&js_lock, flags);
 
-       while (*curp != NULL && (*curp != port)) curp = &((*curp)->next);
+       printk("js: There were %d failures out of %d read attempts.\n", port->fail, port->total);
+
+       while (*curp && (*curp != port)) curp = &((*curp)->next);
        *curp = (*curp)->next;
 
        spin_unlock_irqrestore(&js_lock, flags);
@@ -1072,9 +703,9 @@ int js_register_device(struct js_port *port, int number, int axes, int buttons,
        int i = 0;
        unsigned long flags;
 
-       if ((all = kmalloc(sizeof(struct js_dev) + 2 * axes * sizeof(int) +
+       if (!(all = kmalloc(sizeof(struct js_dev) + 2 * axes * sizeof(int) +
                        2 * (((buttons - 1) >> 5) + 1) * sizeof(int) +
-                       axes * sizeof(struct js_corr) + strlen(name) + 1, GFP_KERNEL)) == NULL)
+                       axes * sizeof(struct js_corr) + strlen(name) + 1, GFP_KERNEL)))
                return -1;
 
        curd = all;
@@ -1082,10 +713,11 @@ int js_register_device(struct js_port *port, int number, int axes, int buttons,
        curd->next = NULL;
        curd->list = NULL;
        curd->port = port;
-       init_waitqueue_head(&curd->wait);
        curd->open = open;
        curd->close = close;
 
+       init_waitqueue_head(&curd->wait);
+
        curd->ahead = 0;
        curd->bhead = 0;
        curd->tail = JS_BUFF_SIZE - 1;
@@ -1108,7 +740,7 @@ int js_register_device(struct js_port *port, int number, int axes, int buttons,
 
        spin_lock_irqsave(&js_lock, flags);
 
-       while (*ptrd != NULL) { ptrd=&(*ptrd)->next; i++; }
+       while (*ptrd) { ptrd=&(*ptrd)->next; i++; }
        *ptrd = curd;
 
        spin_unlock_irqrestore(&js_lock, flags);        
@@ -1123,7 +755,7 @@ void js_unregister_device(struct js_dev *dev)
 
        spin_lock_irqsave(&js_lock, flags);
 
-       while (*curd != NULL && (*curd != dev)) curd = &((*curd)->next);
+       while (*curd && (*curd != dev)) curd = &((*curd)->next);
        *curd = (*curd)->next;
 
        spin_unlock_irqrestore(&js_lock, flags);        
@@ -1138,11 +770,7 @@ void js_unregister_device(struct js_dev *dev)
 static struct file_operations js_fops =
 {
        read:           js_read,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
        poll:           js_poll,
-#else
-       select:         js_select,
-#endif
        ioctl:          js_ioctl,
        open:           js_open,
        release:        js_release,
@@ -1159,15 +787,15 @@ int init_module(void)
 int __init js_init(void)
 #endif
 {
-       int result;
-
-       js_setup_time();
 
        if (register_chrdev(JOYSTICK_MAJOR, "js", &js_fops)) {
                printk(KERN_ERR "js: unable to get major %d for joystick\n", JOYSTICK_MAJOR);
                return -EBUSY;
        }
 
+       printk(KERN_INFO "js: Joystick driver v%d.%d.%d (c) 1999 Vojtech Pavlik <vojtech@suse.cz>\n",
+               JS_VERSION >> 16 & 0xff, JS_VERSION >> 8 & 0xff, JS_VERSION & 0xff);
+
        spin_lock_init(&js_lock);
 
        init_timer(&js_timer);
@@ -1178,44 +806,61 @@ int __init js_init(void)
        js_comp_glue.JS_TIMEOUT = JS_DEF_TIMEOUT;
        js_comp_glue.JS_TIMELIMIT = JS_DEF_TIMELIMIT;
 
-#ifdef MODULE
-       result = 0;
-#else
-       result = -ENODEV;
+#ifndef MODULE
+#ifdef CONFIG_JOY_PCI
+       js_pci_init();
+#endif
 #ifdef CONFIG_JOY_LIGHTNING
-       if (!js_l4_init()) result = 0;
+       js_l4_init();
 #endif
 #ifdef CONFIG_JOY_SIDEWINDER
-       if (!js_sw_init()) result = 0;
+       js_sw_init();
 #endif
-#ifdef CONFIG_JOY_ASSASIN
-       if (!js_as_init()) result = 0;
+#ifdef CONFIG_JOY_ASSASSIN
+       js_as_init();
 #endif
 #ifdef CONFIG_JOY_LOGITECH
-       if (!js_lt_init()) result = 0;
+       js_lt_init();
 #endif
 #ifdef CONFIG_JOY_THRUSTMASTER
-       if (!js_tm_init()) result = 0;
+       js_tm_init();
 #endif
 #ifdef CONFIG_JOY_GRAVIS
-       if (!js_gr_init()) result = 0;
+       js_gr_init();
+#endif
+#ifdef CONFIG_JOY_CREATIVE
+       js_cr_init();
 #endif
 #ifdef CONFIG_JOY_ANALOG
-       if (!js_an_init()) result = 0;
+       js_an_init();
 #endif
 #ifdef CONFIG_JOY_CONSOLE
-       if (!js_console_init()) result = 0;
+       js_console_init();
 #endif
 #ifdef CONFIG_JOY_DB9
-       if (!js_db9_init()) result = 0;
+       js_db9_init();
+#endif
+#ifdef CONFIG_JOY_TURBOGRAFX
+       js_tg_init();
 #endif
 #ifdef CONFIG_JOY_AMIGA
-       if (!js_am_init()) result = 0;
+       js_am_init();
+#endif
+#ifdef CONFIG_JOY_MAGELLAN
+       js_mag_init();
+#endif
+#ifdef CONFIG_JOY_WARRIOR
+       js_war_init();
+#endif
+#ifdef CONFIG_JOY_SPACEORB
+       js_orb_init();
+#endif
+#ifdef CONFIG_JOY_SPACEBALL
+       js_sball_init();
 #endif
-       if (result) printk(KERN_ERR "js: no joysticks found\n");
 #endif
 
-       return result;
+       return 0;
 }
 
 /*
@@ -1230,3 +875,4 @@ void cleanup_module(void)
                printk(KERN_ERR "js: can't unregister device\n");
 }
 #endif
+
index d072c53071aa8c4e402760287445de54b1194284..ccaa550a972023038e1f7bde03d92fc22772072f 100644 (file)
@@ -247,7 +247,18 @@ if [ "$CONFIG_NET_RADIO" = "y" ]; then
    dep_tristate '  STRIP (Metricom starmode radio IP)' CONFIG_STRIP $CONFIG_INET
    tristate '  AT&T WaveLAN & DEC RoamAbout DS support' CONFIG_WAVELAN
    tristate '  Aironet Arlan 655 & IC2200 DS support' CONFIG_ARLAN
-
+   tristate '  Aironet 4500/4800 series adapters' CONFIG_AIRONET4500
+   if [ ! "$CONFIG_AIRONET4500" = "n" ]; then
+          dep_tristate '   Aironet 4500/4800 ISA/PCI/PNP/365 support ' CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500
+          if [ ! "$CONFIG_AIRONET4500_NONCS" = "n" ]; then
+                  bool '     Aironet 4500/4800 PNP support ' CONFIG_AIRONET4500_PNP $CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500
+                  bool '     Aironet 4500/4800 PCI support ' CONFIG_AIRONET4500_PCI  $CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500
+                  bool '     Aironet 4500/4800 ISA broken support ' CONFIG_AIRONET4500_ISA  $CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500 $CONFIG_EXPERIMENTAL
+                  bool '     Aironet 4500/4800 I365 broken support ' CONFIG_AIRONET4500_I365   $CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500 $CONFIG_EXPERIMENTAL
+          fi
+          dep_tristate '   Aironet 4500/4800 PCMCIA support ' CONFIG_AIRONET4500_CS $CONFIG_AIRONET4500 $CONFIG_PCMCIA
+          dep_tristate '   Aironet 4500/4800 PROC interface ' CONFIG_AIRONET4500_PROC $CONFIG_AIRONET4500 m
+   fi
 fi
 
 endmenu
index 67f91ff9e80891b2166d3c3506babd5b1c1b9052..950ccbd39353a4cd6075bef8cdecaa3b544348af 100644 (file)
@@ -27,7 +27,7 @@ MOD_LIST_NAME := NET_MODULES
 # All of the (potential) objects that export symbols.
 # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
 
-export-objs     :=     8390.o arcnet.o arlan.o ppp_async.o \
+export-objs     :=     8390.o arcnet.o arlan.o aironet4500_core.o aironet4500_card.o ppp_async.o \
                        ppp_generic.o slhc.o
 
 ifeq ($(CONFIG_PCMCIA),y)
@@ -97,6 +97,12 @@ else
   endif
 endif
 
+
+
+obj-$(CONFIG_AIRONET4500)      += aironet4500_core.o
+obj-$(CONFIG_AIRONET4500_NONCS)  += aironet4500_card.o
+obj-$(CONFIG_AIRONET4500_PROC) += aironet4500_proc.o
+
 obj-$(CONFIG_NET) += Space.o setup.o net_init.o loopback.o
 obj-$(CONFIG_SEEQ8005) += seeq8005.o
 obj-$(CONFIG_ETHERTAP) += ethertap.o
diff --git a/drivers/net/aironet4500.h b/drivers/net/aironet4500.h
new file mode 100644 (file)
index 0000000..9ae1001
--- /dev/null
@@ -0,0 +1,1639 @@
+/*
+ *      Aironet 4500 Pcmcia driver
+ *
+ *             Elmer Joandi, Januar 1999
+ *     Copyright Elmer Joandi, all rights restricted
+ *     
+ *
+ *     Revision 0.1 ,started  30.12.1998
+ *
+ *
+ */
+
+#ifndef AIRONET4500_H
+#define        AIRONET4500_H
+// redefined to avoid PCMCIA includes
+
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+#if (LINUX_VERSION_CODE < 0x2030e)
+#define NET_DEVICE device 
+#else 
+#define NET_DEVICE net_device
+#endif                         
+
+#if LINUX_VERSION_CODE < 0x20300
+#define init_MUTEX(a)  *(a) = MUTEX;
+#endif
+
+#include <linux/types.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/delay.h>
+#include <linux/time.h>
+#include <linux/802_11.h>
+
+//damn idiot PCMCIA stuff
+#ifndef DEV_NAME_LEN
+       #define DEV_NAME_LEN 32
+#endif
+
+struct pcmcia_junkdev_node_t {
+    char               dev_name[DEV_NAME_LEN];
+    u_short            major, minor;
+    struct dev_node_t  *next;
+};
+
+#ifndef CS_RELEASE
+typedef struct pcmcia_junkdev_node_t dev_node_t;
+#endif
+
+
+
+#if LINUX_VERSION_CODE <= 0x20100
+
+typedef struct  { volatile int lock ;} my_spinlock_t;
+
+#define my_spin_lock_irqsave(a,b) {\
+       save_flags(b);\
+       cli();\
+       (a)->lock++;while(0);\
+       if ((a)->lock != 1 )\
+               printk("awc_spinlock high at locking \n");\
+}
+
+#define my_spin_unlock_irqrestore(a,b) {\
+       cli(); (a)->lock--;while(0);\
+       if ((a)->lock != 0 )\
+               printk("awc_spinlock !=0  at unlocking \n");\
+       restore_flags(b);\
+}
+       
+
+#else
+#if LINUX_VERSION_CODE < 0x20300
+#include <asm/spinlock.h>
+#else
+#include <linux/spinlock.h>
+#endif
+#ifndef __SMP__ 
+// #warning non-SMP 2.2 kernel
+#endif
+typedef spinlock_t                     my_spinlock_t   ;
+#define my_spin_lock_irqsave(a,b)      spin_lock_irqsave(a,b)
+#define my_spin_unlock_irqrestore(a,b)         spin_unlock_irqrestore(a,b)
+
+#endif //kernel version
+
+
+#if LINUX_VERSION_CODE <= 0x20100
+#define in_interrupt() intr_count
+#endif
+
+
+#define AWC_ERROR      -1
+#define AWC_SUCCESS    0
+
+struct awc_cis {
+       unsigned char cis[0x301];
+       unsigned char unknown302[0xdf];
+       unsigned short configuration_register;
+       unsigned short pin_replacement_register;
+       unsigned short socket_and_copy_register;
+
+};
+
+
+
+/***************************  REGISTER OFFSETS *********************/
+#define awc_Command_register           0x00
+#define awc_Param0_register            0x02
+#define awc_Param1_register            0x04
+#define awc_Param2_register            0x06
+#define awc_Status_register            0x08
+#define awc_Resp0_register             0x0A
+#define awc_Resp1_register             0x0C
+#define awc_Resp2_register             0x0E
+#define awc_EvStat_register            0x30
+#define awc_EvIntEn_register           0x32
+#define awc_EvAck_register             0x34
+#define awc_SWSupport0_register        0x28
+#define awc_SWSupport1_register        0x2A
+#define awc_SWSupport2_register        0x2C
+#define awc_SWSupport3_register        0x2E
+#define awc_LinkStatus_register        0x10
+// Memory access  RID FID
+#define awc_Select0_register           0x18
+#define awc_Offset0_register           0x1C
+#define awc_Data0_register             0x36
+#define awc_Select1_register           0x1A
+#define awc_Offset1_register           0x1E
+#define awc_Data1_register             0x38
+//
+#define awc_RxFID_register             0x20
+#define awc_TxAllocFID_register        0x22
+#define awc_TxComplFID_register        0x24
+#define awc_AuxPage_register           0x3A
+#define awc_AuxOffset_register                 0x3C
+#define awc_AuxData_register           0x3E
+
+
+struct awc_bap {
+       u16 select;
+       u16 offset;
+       u16 data;
+       volatile int lock;
+       volatile int    status;
+       struct semaphore sem;
+       my_spinlock_t spinlock;
+       unsigned long flags;
+};
+
+
+
+#define AWC_COMMAND_STATE_WAIT_CMD_BUSY                1
+#define AWC_COMMAND_STATE_WAIT_CMD_ACK         2
+#define AWC_COMMAND_STATE_WAIT_BAP_BUSY                3
+#define AWC_COMMAND_STATE_BAP_NOT_SET          4
+#define AWC_COMMAND_STATE_BAP_SET              5
+
+struct awc_command {
+       volatile int            state;
+       volatile int            lock_state;
+       struct NET_DEVICE *             dev;
+       struct awc_private *    priv;
+       u16                     port;
+       struct awc_bap *        bap;
+       u16                     command;
+       u16                     par0;
+       u16                     par1;
+       u16                     par2;
+       u16                     status;
+       u16                     resp0;
+       u16                     resp1;
+       u16                     resp2;
+       u16                     rid;
+       u16                     offset;
+       u16                     len;
+       void *                  buff;
+
+};
+
+
+
+
+#define DOWN(a) down_interruptible( a ) ; 
+//     if (in_interrupt()) { down_interruptible( a ) ; } else printk("semaphore DOWN in interrupt tried \n");
+#define UP(a)   up( a ) ;
+//     if (in_interrupt()) {up( a ) ; } else printk("semaphore UP in interrupt tried \n");
+
+/*     if (!in_interrupt())\
+       printk("bap lock under cli but not in int\n");\
+*/
+#define AWC_BAP_LOCK_UNDER_CLI_REAL(cmd) \
+       if (!cmd.priv) {\
+               printk(KERN_CRIT "awc4500: no priv present in command !");\
+       }\
+       cmd.bap = &(cmd.priv->bap1);\
+       if (cmd.bap){\
+               my_spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
+               cmd.bap->lock++;\
+               if (cmd.bap->lock > 1)\
+                       printk("Bap 1 lock high\n");\
+               cmd.lock_state |= AWC_BAP_LOCKED;\
+       }
+
+#define AWC_BAP_LOCK_NOT_CLI_REAL(cmd) {\
+       if (in_interrupt())\
+       printk("bap lock not cli in int\n");\
+       if (!cmd.priv) {\
+               printk(KERN_CRIT "awc4500: no priv present in command,lockup follows !");\
+       }\
+       cmd.bap = &(cmd.priv->bap0);\
+       my_spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
+       DOWN(&(cmd.priv->bap0.sem));\
+       cmd.bap->lock++;\
+       if (cmd.bap->lock > 1)\
+               printk("Bap 0 lock high\n");\
+       cmd.lock_state |= AWC_BAP_SEMALOCKED;\
+}
+
+#define AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd) {\
+       cmd.bap = &(cmd.priv->bap0);\
+       my_spin_lock_irqsave(&(cmd.bap->spinlock),cmd.bap->flags);\
+       cmd.bap->lock++;\
+       if (cmd.bap->lock > 1)\
+               printk("Bap 0 lock high\n");\
+       cmd.lock_state |= AWC_BAP_LOCKED;\
+}
+
+#define BAP_LOCK_ANY(cmd)\
+       if (in_interrupt())     AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd)\
+       else AWC_BAP_LOCK_NOT_CLI_REAL(cmd)
+       
+#define AWC_BAP_LOCK_NOT_CLI(cmd)      BAP_LOCK_ANY(cmd)
+#define AWC_BAP_LOCK_UNDER_CLI(cmd)    AWC_BAP_LOCK_UNDER_CLI_REAL(cmd)
+/*
+       if (!cmd.priv->bap1.lock ) {BAP_LOCK_ANY(cmd);}\
+       else AWC_BAP_LOCK_NOT_CLI_CLI_REAL(cmd);
+*/     
+#define AWC_BAP_LOCKED                 0x01
+#define AWC_BAP_SEMALOCKED     0x02
+
+#define AWC_BAP_BUSY   0x8000
+#define AWC_BAP_ERR    0x4000
+#define AWC_BAP_DONE   0x2000
+
+#define AWC_CLI                1
+#define AWC_NOT_CLI    2
+
+/*#define WAIT61x3     inb(0x61);\
+                       inb(0x61);\
+                       inb(0x61);
+*/ 
+#define WAIT61x3       udelay(bap_sleep)                       
+
+#define AWC_INIT_COMMAND(context, a_com, a_dev,a_cmmand,a_pr0, a_rid, a_offset, a_len, a_buff) {\
+       memset(&a_com,0,sizeof(a_com) );\
+       a_com.dev = a_dev;\
+       a_com.priv = a_dev->priv;\
+       a_com.port = a_dev->base_addr;\
+       a_com.bap = NULL;\
+       a_com.command = a_cmmand;\
+       a_com.par0 = a_pr0;\
+       a_com.rid = a_rid;\
+       a_com.offset = a_offset;\
+       a_com.len = a_len;\
+       a_com.buff = a_buff;\
+       a_com.lock_state = 0;\
+};
+
+/* väga veider asi järgnevast 
+ makrost välja jäetud  if (cmd.bap) AWC_IN((cmd.bap)->data);\
+*/
+
+#define AWC_BAP_UNLOCK(com) { \
+       if (com.bap){ \
+               if ( (com.lock_state & AWC_BAP_SEMALOCKED) &&\
+                    (com.lock_state & AWC_BAP_LOCKED) ){\
+                       printk("Both Sema and simple lock \n");\
+               }\
+               if ( com.lock_state & AWC_BAP_SEMALOCKED ){\
+                        com.bap->lock--; \
+                        com.lock_state &= ~AWC_BAP_SEMALOCKED;\
+                        UP(&(com.bap->sem)); \
+                        my_spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\
+               } else if (com.lock_state & AWC_BAP_LOCKED){\
+                        com.bap->lock--; \
+                        com.lock_state &= ~AWC_BAP_LOCKED;\
+                        my_spin_unlock_irqrestore(&(cmd.bap->spinlock),cmd.bap->flags);\
+               }\
+       }\
+}
+
+#define AWC_RELEASE_COMMAND(com) {\
+               AWC_BAP_UNLOCK(cmd);\
+       }
+
+
+
+#define awc_manufacturer_code  0x015F
+#define awc_product_code       0x0005
+
+
+#define awc_write(base,register,u16value) outw(u16value, (base)+(register))
+#define awc_read(base,register)           inw((base)+(register))
+#define AWC_OUT(base,val)              outw(val, base)
+#define AWC_IN(base)                   inw(base)
+
+
+#define awc_read_response(cmd) {       \
+       cmd->status=awc_read(cmd->port,awc_Status_register);\
+       cmd->resp0=awc_read(cmd->port,awc_Resp0_register);\
+       cmd->resp1=awc_read(cmd->port,awc_Resp1_register);\
+       cmd->resp2=awc_read(cmd->port,awc_Resp2_register);\
+};
+
+#define awc_command_busy(base)         (awc_read(base,awc_Command_register) & 0x8000)
+#define awc_command_read(base)         awc_read(base,awc_Command_register)
+#define awc_command_write(base,cmd)    awc_write(base,awc_Command_register,cmd) 
+#define awc_event_status_Awake(base)   (awc_read(base,awc_EvStat_register) & 0x0100)
+#define awc_event_status_Link(base)    (awc_read(base,awc_EvStat_register) & 0x0080)
+#define awc_event_status_Cmd(base)     (awc_read(base,awc_EvStat_register) & 0x0010)
+#define awc_event_status_Alloc(base)   (awc_read(base,awc_EvStat_register) & 0x0008)
+#define awc_event_status_TxExc(base)   (awc_read(base,awc_EvStat_register) & 0x0004)
+#define awc_event_status_Tx(base)      (awc_read(base,awc_EvStat_register) & 0x0002)
+#define awc_event_status_TxResp(base)  (awc_read(base,awc_EvStat_register) & 0x0006)
+#define awc_event_status_Rx(base)      (awc_read(base,awc_EvStat_register) & 0x0001)
+#define awc_event_status(base)         (awc_read(base,awc_EvStat_register))
+
+#define awc_Link_Status(base)          awc_read(base,awc_LinkStatus_register)
+
+#define awc_Rx_Fid(base)               awc_read(base,awc_RxFID_register)
+#define awc_Tx_Allocated_Fid(base)     awc_read(base,awc_TxAllocFID_register)
+#define awc_Tx_Compl_Fid(base)         awc_read(base,awc_TxComplFID_register)
+
+#define awc_event_ack_ClrStckCmdBsy(base) awc_write(base,awc_EvAck_register, 0x4000)
+#define awc_event_ack_WakeUp(base)     awc_write(base,awc_EvAck_register, 0x2000)
+#define awc_event_ack_Awaken(base)     awc_write(base,awc_EvAck_register, 0x0100)
+#define awc_event_ack_Link(base)       awc_write(base,awc_EvAck_register, 0x0080)
+#define awc_event_ack_Cmd(base)                awc_write(base,awc_EvAck_register, 0x0010)
+#define awc_event_ack_Alloc(base)      awc_write(base,awc_EvAck_register, 0x0008)
+#define awc_event_ack_TxExc(base)      awc_write(base,awc_EvAck_register, 0x0004)
+#define awc_event_ack_Tx(base)         awc_write(base,awc_EvAck_register, 0x0002)
+#define awc_event_ack_Rx(base)         awc_write(base,awc_EvAck_register, 0x0001)
+
+#define awc_event_ack(base,ints)       awc_write(base,awc_EvAck_register,ints)
+
+#define awc_ints_enabled(base)         (awc_read(base,awc_EvIntEn_register))
+#define awc_ints_enable(base,ints)     awc_write(base,awc_EvIntEn_register,ints)
+
+
+
+/************************      RX TX   BUFF    ************************/
+
+
+struct aironet4500_radio_rx_header {
+       u32     RxTime;
+       u16     Status;
+       u16     PayloadLength;
+       u8      Reserved0;
+       u8      RSSI;
+       u8      Rate;
+       u8      Frequency;
+       u8      Rx_association_count;
+       u8      Reserved1[3];
+       u8      PLCP_header[4];
+
+};
+
+
+struct aironet4500_radio_tx_header {
+       u32     SWSupport;
+       u16     Status;
+       #define aironet4500_tx_status_max_retries       0x0002
+       #define aironet4500_tx_status_lifetime_exceeded 0x0004
+       #define aironet4500_tx_status_AID_failure       0x0008
+       #define aironet4500_tx_status_MAC_disabled      0x0010
+       #define aironet4500_tx_status_association_lost  0x0020
+       u16     PayloadLength;
+       u16     TX_Control;
+       #define aironet4500_tx_control_tx_ok_event_enable       0x0002
+       #define aironet4500_tx_control_tx_fail_event_enable     0x0004
+       #define aironet4500_tx_control_header_type_802_11       0x0008
+       #define aironet4500_tx_control_payload_type_llc         0x0010
+       #define aironet4500_tx_control_no_release               0x0020
+       #define aironet4500_tx_control_reuse_fid \
+               (aironet4500_tx_control_tx_ok_event_enable |\
+                aironet4500_tx_control_tx_fail_event_enable |\
+                 aironet4500_tx_control_no_release)
+       #define aironet4500_tx_control_no_retries               0x0040
+       #define aironet4500_tx_control_clear_AID                0x0080
+       #define aironet4500_tx_control_strict_order             0x0100
+       #define aironet4500_tx_control_use_rts                  0x0200
+       u16     AID;
+       u8      Tx_Long_Retry;
+       u8      Tx_Short_Retry;
+       u8      tx_association_count;
+       u8      tx_bit_rate;
+       #define aironet4500_tx_bit_rate_automatic 0
+       #define aironet4500_tx_bit_rate_500kbps 1
+       #define aironet4500_tx_bit_rate_1Mbps   2
+       #define aironet4500_tx_bit_rate_2Mbps   4
+       u8      Max_Long_Retry;
+       u8      Max_Short_Retry;
+       u8      Reserved0[2];
+};
+
+
+struct aironet4500_rx_fid {
+
+       u16                                             rid;
+       struct aironet4500_radio_rx_header              radio_rx;
+       struct ieee_802_11_header                       ieee_802_11;
+       u16                                             gap_length;
+       struct ieee_802_3_header                        ieee_802_3;
+       u8                                      *       payload;
+};
+
+
+struct aironet4500_tx_fid {
+
+       u16                                             fid;
+       u16                                             fid_size;
+       struct aironet4500_radio_tx_header              radio_tx;
+       struct ieee_802_11_header                       ieee_802_11;
+       u16                                             gap_length;
+       #define aironet4500_gap_len_without_802_3       6
+       #define aironet4500_gap_len_with_802_3          0
+       struct ieee_802_3_header                        ieee_802_3;
+       u8                                      *       payload;        
+};
+
+struct awc_fid {
+
+       u32     type;
+       #define p80211_llc_snap         0x0100
+       #define p80211_8021H            0x0200
+       #define p80211_8022             0x0400
+       #define p80211_8023             0x0800
+       #define p80211_snap_8021H       0x1000
+       #define p80211copy_path_skb     0x2000
+
+       u8      priority;
+       u8      busy;
+       
+       #define awc_tx_fid_complete_read 0x01
+       u16     state;
+       union {
+               struct aironet4500_tx_fid tx;
+               struct aironet4500_rx_fid rx;   
+       } u;
+       
+       struct ieee_802_11_snap_header snap;
+       struct ieee_802_11_802_1H_header bridge;
+       u16                     bridge_size;
+       struct ieee_802_11_802_2_header p8022;
+
+       u16                     pkt_len;
+       u8      * mac;
+       struct sk_buff *        skb;
+       long long               transmit_start_time;
+       struct awc_fid  *       next;
+       struct awc_fid  *       prev;
+       
+};
+
+
+
+struct awc_fid_queue {
+
+
+       struct awc_fid * head;
+       struct awc_fid * tail;
+       int     size;
+       my_spinlock_t lock;
+};
+
+
+extern inline void
+awc_fid_queue_init(struct awc_fid_queue * queue){
+
+       unsigned long flags;
+#ifdef __SMP__
+       queue->lock.lock = 0;   
+#endif
+       memset(queue,0, sizeof(struct awc_fid_queue));  
+       
+       my_spin_lock_irqsave(&queue->lock,flags);
+       queue->head = NULL;
+       queue->tail = NULL;
+       queue->size = 0;
+       my_spin_unlock_irqrestore(&queue->lock,flags);  
+};
+
+extern inline void
+awc_fid_queue_push_tail(       struct awc_fid_queue *  queue,
+                               struct awc_fid *        fid){
+
+       unsigned long flags;
+
+       my_spin_lock_irqsave(&queue->lock,flags);       
+       
+       fid->prev = queue->tail;
+       fid->next = NULL;
+       
+       if (queue->tail){
+               queue->tail->next = fid;
+       }       
+       queue->tail  = fid;
+       
+       if (!queue->head)
+               queue->head = fid;
+       queue->size++;
+
+       my_spin_unlock_irqrestore(&queue->lock,flags);
+               
+};
+
+
+extern inline void
+awc_fid_queue_push_head(       struct awc_fid_queue *  queue,
+                               struct awc_fid *        fid){
+
+       unsigned long flags;
+
+       my_spin_lock_irqsave(&queue->lock,flags);       
+       
+       fid->prev = NULL;
+       fid->next = queue->head;
+       
+       if (queue->head){
+               queue->head->prev = fid;
+       }       
+       queue->head  = fid;
+       
+       if (!queue->tail)
+               queue->tail = fid;
+       queue->size++;
+       
+       
+       my_spin_unlock_irqrestore(&queue->lock,flags);
+       
+};
+
+
+
+extern inline void
+awc_fid_queue_rm(              struct awc_fid_queue *  queue,
+                               struct awc_fid *        fid){
+
+
+       if (fid->prev) {
+               fid->prev->next = fid->next;
+       };
+
+       if (fid->next) {
+               fid->next->prev = fid->prev;
+       };
+       
+       if (fid == queue->tail) {
+               queue->tail = fid->prev;
+       };
+       if (fid == queue->head) {
+               queue->head = fid->next;
+       };
+       fid->next = NULL;
+       fid->prev = NULL;
+       queue->size--;
+       if (queue->size ==0 ){
+               queue->tail = NULL;
+               queue->head = NULL;
+       }               
+};
+
+extern inline void
+awc_fid_queue_remove(          struct awc_fid_queue *  queue,
+                               struct awc_fid *        fid){
+       unsigned long flags;
+       my_spin_lock_irqsave(&queue->lock,flags);       
+       
+       awc_fid_queue_rm(queue,fid);
+       
+       my_spin_unlock_irqrestore(&queue->lock,flags);
+       
+};
+
+
+
+extern inline struct awc_fid * 
+awc_fid_queue_pop_head(                struct awc_fid_queue *  queue){
+
+       unsigned long flags;
+       struct awc_fid * fid;
+       
+       my_spin_lock_irqsave(&queue->lock,flags);       
+
+       fid = queue->head;
+       if (fid)
+               awc_fid_queue_rm(queue,fid);
+               
+       
+       my_spin_unlock_irqrestore(&queue->lock,flags);
+       
+       return fid;
+};
+
+
+
+
+extern inline struct awc_fid * 
+awc_fid_queue_pop_tail(                struct awc_fid_queue *  queue){
+
+       unsigned long flags;
+       struct awc_fid * fid;
+       
+       my_spin_lock_irqsave(&queue->lock,flags);       
+
+       fid = queue->tail;
+       if (fid)
+                       awc_fid_queue_rm(queue,fid);
+       
+       my_spin_unlock_irqrestore(&queue->lock,flags);
+       
+       return fid;
+};
+
+
+
+#define AWC_TX_HEAD_SIZE               0x44
+#define AWC_TX_ALLOC_SMALL_SIZE        150
+#define AWC_RX_BUFFS                   50
+
+
+/*****************************         RID & CONFIG    ***********************/
+
+struct awc_config{
+    unsigned short    Len;                                /* sizeof(PC4500_CONFIG) */
+    unsigned short    OperatingMode;                      /* operating mode        */
+
+    #define           MODE_STA_IBSS                0
+    #define           MODE_STA_ESS                 1
+    #define           MODE_AP                      2
+    #define           MODE_AP_RPTR                 3
+    #define           MODE_ETHERNET_HOST           (0<<8)    /* rx payloads converted */
+    #define           MODE_LLC_HOST                (1<<8)    /* rx payloads left as is */
+    #define           MODE_AIRONET_EXTEND          (1<<9)    /* enable Aironet extenstions */
+    #define           MODE_AP_INTERFACE            (1<<10) /* enable ap interface extensions */
+    unsigned short    ReceiveMode;                        /* receive mode */
+    #define           RXMODE_BC_MC_ADDR            0
+    #define           RXMODE_BC_ADDR               1         /* ignore multicasts */
+    #define           RXMODE_ADDR                  2         /* ignore multicast and broadcast */
+    #define           RXMODE_RFMON                 3         /* wireless monitor mode */
+    #define           RXMODE_RFMON_ANYBSS 4
+    #define           RXMODE_LANMON                5         /* lan style monitor -- data packets only */
+    #define           RXMODE_DISABLE_802_3_HEADER  0x100    /* disables 802.3 header on rx */
+
+    unsigned short    FragmentThreshold;
+    unsigned short    RtsThreshold;
+    unsigned char     StationMacAddress[6];
+    unsigned char     Rates[8];
+    unsigned short    ShortRetryLimit;
+    unsigned short    LongRetryLimit;
+    unsigned short    TxLifetime;                         /* in kusec */
+    unsigned short    RxLifetime;                         /* in kusec */
+    unsigned short    Stationary;
+    unsigned short    Ordering;
+    unsigned short    DeviceType;                         /* for overriding device type */
+    unsigned short    _reserved1[5];                         /*---------- Scanning/Associating ----------*/
+    unsigned short    ScanMode;
+    #define           SCANMODE_ACTIVE              0
+    #define           SCANMODE_PASSIVE             1
+    #define           SCANMODE_AIROSCAN            2
+    unsigned short    ProbeDelay;                         /* in kusec */
+    unsigned short    ProbeEnergyTimeout;                 /* in kusec */
+    unsigned short    ProbeResponseTimeout;
+    unsigned short    BeaconListenTimeout;
+    unsigned short    JoinNetTimeout;
+    unsigned short    AuthenticationTimeout;
+    unsigned short    AuthenticationType;
+    #define           AUTH_OPEN                    1
+    #define           AUTH_SHAREDKEY               2
+    #define           AUTH_EXCLUDENONWEP           4
+    unsigned short    AssociationTimeout;
+    unsigned short    SpecifiedApTimeout;
+    unsigned short    OfflineScanInterval;
+    unsigned short    OfflineScanDuration;
+    unsigned short    LinkLossDelay;
+    unsigned short    MaxBeaconLostTime;
+    unsigned short    RefreshInterval;
+   #define           DISABLE_REFRESH           0xFFFF
+   unsigned short    _reserved1a[1];                      /*---------- Power save operation ----------*/
+   unsigned short    PowerSaveMode;
+   #define           POWERSAVE_CAM             0
+   #define           POWERSAVE_PSP             1
+   #define           POWERSAVE_PSP_CAM         2
+   unsigned short    SleepForDtims;
+   unsigned short    ListenInterval;
+   unsigned short    FastListenInterval;
+   unsigned short    ListenDecay;
+   unsigned short    FastListenDelay;
+   unsigned short    _reserved2[2];                       /*---------- Ap/Ibss config items ----------*/
+   unsigned short    BeaconPeriod;
+   unsigned short    AtimDuration;
+   unsigned short    HopPeriod;
+   unsigned short    ChannelSet;
+   unsigned short    Channel;
+   unsigned short    DtimPeriod;
+   unsigned short    _reserved3[2];                       /*---------- Radio configuration ----------*/
+   unsigned short    RadioType;
+   #define           RADIOTYPE_DEFAULT         0
+   #define           RADIOTYPE_802_11          1
+   #define           RADIOTYPE_LEGACY          2
+   unsigned char     u8RxDiversity;
+   unsigned char     u8TxDiversity;
+   unsigned short    TxPower;
+   #define           TXPOWER_DEFAULT           0
+   unsigned short    RssiThreshold;
+   #define           RSSI_DEFAULT              0
+   unsigned short    RadioSpecific[4];                 /*---------- Aironet Extensions ----------*/
+   unsigned char     NodeName[16];
+   unsigned short    ArlThreshold;
+   unsigned short    ArlDecay;
+   unsigned short    ArlDelay;
+   unsigned short    _reserved4[1];                       /*---------- Aironet Extensions ----------*/
+   unsigned short    MagicAction;
+   #define           MAGIC_ACTION_STSCHG       1
+   #define           MACIC_ACTION_RESUME       2
+   #define           MAGIC_IGNORE_MCAST        (1<<8)
+   #define           MAGIC_IGNORE_BCAST        (1<<9)
+   #define           MAGIC_SWITCH_TO_PSP       (0<<10)
+   #define           MAGIC_STAY_IN_CAM         (1<<10)
+};
+
+
+
+struct awc_SSID {
+       u16     lenght;
+       u8      SSID[32];
+};
+
+struct awc_SSIDs {
+       u16     ridLen;
+       struct awc_SSID SSID[3];
+
+};
+
+struct awc_fixed_APs{
+       u16     ridLen;
+       u8      AP[4][6];
+};
+
+struct awc_driver_name{
+       u16     ridLen;
+       u8      name[16];
+};
+
+struct awc_encapsulation{
+       u16     etherType;
+       u16     Action;
+};
+
+struct awc_enc_trans{
+       u16                             ridLen;
+       struct awc_encapsulation        rules[8];
+};
+
+struct awc_wep_key {
+       u16     ridLen;
+       u16     KeyIndex;
+       u8      Address[6];
+       u16     KeyLen;
+       u8      Key[16];
+};
+
+struct awc_modulation {
+       u16     ridLen;
+       u16     Modulation;
+};
+
+struct awc_cap{
+       u16             ridLen;
+       u8              OUI[3];
+       u8              ProductNum[3];
+       u8              ManufacturerName[32];
+       u8              ProductName[16];
+       u8              ProductVersion[8];
+       u8              FactoryAddress[6];
+       u8              AironetAddress[6];
+       u16             RadioType;
+       u16             RegDomain;
+       u8              Callid[6];
+       u8              SupportedRates[8];
+       u8              RxDiversity;
+       u8              TxDiversity;
+       u16             TxPowerLevels[8];
+       u16             HardwareVersion;
+       u16             HardwareCapabilities;
+       u16             TemperatureRange;
+       u16             SoftwareVersion;
+       u16             SoftwareSubVersion;
+       u16             InterfaceVersion;
+       u16             SoftwareCapabilities;
+       u8              BootBlockVersionMajor;
+       u8              BootBlockVersionMinor;
+               
+};
+
+
+struct awc_status{
+       u16     ridLen;
+       u8      MacAddress[6];
+       u16     OperationalMode;
+       u16     ErrorCode;
+       u16     CurrentSignalQuality;
+       u16     SSIDlength;
+       u8      SSID[32];
+       u8      ApName[16];
+       u8      CurrentBssid[32];
+       u8      PreviousBSSIDs[3][6];
+       u16     BeaconPeriod;
+       u16     DtimPeriod;
+       u16     AtimDuration;
+       u16     HopPeriod;
+       u16     ChannelSet;
+       u16     Channel;
+
+       u16     HopsToBackbone;
+       u16     ApTotalLoad;
+       u16     OurGeneratedLoad;
+       u16     AccumulatedArl;
+       
+};
+
+
+struct awc_AP{
+       u16     ridLen;
+       u16     TIM_Addr;
+       u16     Airo_Addr;
+};
+
+struct awc_Statistics_32 {
+
+       u32     RidLen;
+       u32     RxOverrunErr;
+       u32     RxPlcpCrcErr;
+       u32     RxPlcpFormat;
+       u32     RxPlcpLength;
+       u32     RxMacCrcErr;
+       u32     RxMacCrcOk;
+       u32     RxWepErr;
+       u32     RxWepOk;
+       u32     RetryLong;
+       u32     RetryShort;
+       u32     MaxRetries;
+       u32     NoAck;
+
+       u32     NoCts;
+       u32     RxAck;
+       u32     RxCts;
+       u32     TxAck;
+       u32     TxRts;
+       u32     TxCts;
+       u32     TxMc;
+       u32     TxBc;
+       u32     TxUcFrags;
+       u32     TxUcPackets;
+       u32     TxBeacon;
+       u32     RxBeacon;
+       u32     TxSinColl;
+       u32     TxMulColl;
+       u32     DefersNo;
+       u32     DefersProt;
+       u32     DefersEngy;
+       u32     DupFram;
+       u32     RxFragDisc;
+       u32     TxAged;
+       u32     RxAged;
+       u32     LostSync_Max;
+       u32     LostSync_Mis;
+       u32     LostSync_Arl;
+       u32     LostSync_Dea;
+       u32     LostSync_Disa;
+       u32     LostSync_Tsf;
+       u32     HostTxMc;
+       u32     HostTxBc;
+       u32     HostTxUc;
+       u32     HostTxFail;
+       u32     HostRxMc;
+       u32     HostRxBc;
+       u32     HostRxUc;
+       u32     HostRxDiscar;
+       u32     HmacTxMc;
+       u32     HmacTxBc;
+       u32     HmacTxUc;
+       u32     HmacTxFail;
+       u32     HmacRxMc;
+       u32     HmacRxBc;
+       u32     HmacRxUc;
+       u32     HmacRxDisca;
+       u32     HmacRxAcce;
+       u32     SsidMismatch;
+       u32     ApMismatch;
+       u32     RatesMismatc;
+       u32     AuthReject;
+       u32     AuthTimeout;
+       u32     AssocReject;
+       u32     AssocTimeout;
+       u32     NewReason;
+       u32     AuthFail_1;
+       u32     AuthFail_2;
+       u32     AuthFail_3;
+       u32     AuthFail_4;
+       u32     AuthFail_5;
+       u32     AuthFail_6;
+       u32     AuthFail_7;
+       u32     AuthFail_8;
+       u32     AuthFail_9;
+       u32     AuthFail_10;
+       u32     AuthFail_11;
+       u32     AuthFail_12;
+       u32     AuthFail_13;
+       u32     AuthFail_14;
+       u32     AuthFail_15;
+       u32     AuthFail_16;
+       u32     AuthFail_17;
+       u32     AuthFail_18;
+       u32     AuthFail_19;
+       u32     RxMan;
+       u32     TxMan;
+       u32     RxRefresh;
+       u32     TxRefresh;
+       u32     RxPoll;
+       u32     TxPoll;
+       u32     HostRetries;
+       u32     LostSync_HostReq;
+       u32     HostTxBytes;
+       u32     HostRxBytes;
+       u32     ElapsedUsec;
+       u32     ElapsedSec;
+       u32     LostSyncBett;
+};
+
+struct awc_Statistics_16 {
+
+       u16     RidLen;
+       u16     RxOverrunErr;
+       u16     RxPlcpCrcErr;
+       u16     RxPlcpFormat;
+       u16     RxPlcpLength;
+       u16     RxMacCrcErr;
+       u16     RxMacCrcOk;
+       u16     RxWepErr;
+       u16     RxWepOk;
+       u16     RetryLong;
+       u16     RetryShort;
+       u16     MaxRetries;
+       u16     NoAck;
+       u16     NoCts;
+       u16     RxAck;
+       u16     RxCts;
+       u16     TxAck;
+       u16     TxRts;
+       u16     TxCts;
+       u16     TxMc;
+       u16     TxBc;
+       u16     TxUcFrags;
+       u16     TxUcPackets;
+       u16     TxBeacon;
+       u16     RxBeacon;
+       u16     TxSinColl;
+       u16     TxMulColl;
+       u16     DefersNo;
+       u16     DefersProt;
+       u16     DefersEngy;
+       u16     DupFram;
+       u16     RxFragDisc;
+       u16     TxAged;
+       u16     RxAged;
+       u16     LostSync_Max;
+       u16     LostSync_Mis;
+       u16     LostSync_Arl;
+       u16     LostSync_Dea;
+       u16     LostSync_Disa;
+       u16     LostSync_Tsf;
+       u16     HostTxMc;
+       u16     HostTxBc;
+       u16     HostTxUc;
+       u16     HostTxFail;
+       u16     HostRxMc;
+       u16     HostRxBc;
+       u16     HostRxUc;
+       u16     HostRxDiscar;
+       u16     HmacTxMc;
+       u16     HmacTxBc;
+       u16     HmacTxUc;
+       u16     HmacTxFail;
+       u16     HmacRxMc;
+       u16     HmacRxBc;
+       u16     HmacRxUc;
+       u16     HmacRxDisca;
+       u16     HmacRxAcce;
+       u16     SsidMismatch;
+       u16     ApMismatch;
+       u16     RatesMismatc;
+       u16     AuthReject;
+       u16     AuthTimeout;
+       u16     AssocReject;
+       u16     AssocTimeout;
+       u16     NewReason;
+       u16     AuthFail_1;
+       u16     AuthFail_2;
+       u16     AuthFail_3;
+       u16     AuthFail_4;
+       u16     AuthFail_5;
+       u16     AuthFail_6;
+       u16     AuthFail_7;
+       u16     AuthFail_8;
+       u16     AuthFail_9;
+       u16     AuthFail_10;
+       u16     AuthFail_11;
+       u16     AuthFail_12;
+       u16     AuthFail_13;
+       u16     AuthFail_14;
+       u16     AuthFail_15;
+       u16     AuthFail_16;
+       u16     AuthFail_17;
+       u16     AuthFail_18;
+       u16     AuthFail_19;
+       u16     RxMan;
+       u16     TxMan;
+       u16     RxRefresh;
+       u16     TxRefresh;
+       u16     RxPoll;
+       u16     TxPoll;
+       u16     HostRetries;
+       u16     LostSync_HostReq;
+       u16     HostTxBytes;
+       u16     HostRxBytes;
+       u16     ElapsedUsec;
+       u16     ElapsedSec;
+       u16     LostSyncBett;
+};
+
+
+#define AWC_TXCTL_TXOK                 (1<<1)  /* report if tx is ok */
+#define AWC_TXCTL_TXEX                 (1<<2)  /* report if tx fails */
+#define AWC_TXCTL_802_3                (0<<3)  /* 802.3 packet */
+#define AWC_TXCTL_802_11       (1<<3)  /* 802.11 mac packet */
+#define AWC_TXCTL_ETHERNET     (0<<4)  /* payload has ethertype */
+#define AWC_TXCTL_LLC                  (1<<4)  /* payload is llc */
+#define AWC_TXCTL_RELEASE      (0<<5)  /* release after completion */
+#define AWC_TXCTL_NORELEASE    (1<<5)  /* on completion returns to host */
+
+
+/************************* LINK STATUS STUFF *******************/
+
+#define        awc_link_status_loss_of_sync_missed_beacons     0x8000
+#define        awc_link_status_loss_of_sync_max_retries        0x8001
+#define        awc_link_status_loss_of_sync_ARL_exceed         0x8002
+#define        awc_link_status_loss_of_sync_host_request       0x8003
+#define        awc_link_status_loss_of_sync_TSF_sync           0x8004
+#define        awc_link_status_deauthentication                0x8100
+#define        awc_link_status_disassociation                  0x8200
+#define        awc_link_status_association_failed              0x8400
+#define        awc_link_status_authentication_failed           0x0300
+#define        awc_link_status_associated                      0x0400
+
+struct awc_strings {
+       int     par;
+       unsigned int    mask;
+       const char * string;
+
+};
+
+#define awc_link_status_strings {\
+{awc_link_status_loss_of_sync_missed_beacons,  0xFFFF,"Loss of sync -- missed beacons"},\
+{awc_link_status_loss_of_sync_max_retries,     0xFFFF,"Loss of sync -- max retries"},\
+{awc_link_status_loss_of_sync_ARL_exceed,      0xFFFF,"Loss of sync -- average retry level (ARL) exceeded"},\
+{awc_link_status_loss_of_sync_host_request,    0xFFFF,"Loss of sync -- host request"},\
+{awc_link_status_loss_of_sync_TSF_sync,                0xFFFF,"Loss of sync -- TSF synchronization"},\
+{awc_link_status_deauthentication,             0xFF00,"Deauthentication "},\
+{awc_link_status_disassociation,               0xFF00,"Disassocation "},\
+{awc_link_status_association_failed ,          0xFF00,"Association failed "},\
+{awc_link_status_authentication_failed,                0xFF00,"Authentication failure"},\
+{awc_link_status_associated,                   0xFFFF,"Associated "},\
+{0,0,NULL}\
+} 
+
+
+/****************************** COMMANDS and DEFAULTS and STATUSES ***********/
+
+/****************************** COMMANDS */
+
+
+// Command definitions
+
+
+
+
+#define awc4500wout(base, com, p0,p1,p2) {\
+       awc_write(base,awc_Param0_register, p0);\
+       awc_write(base,awc_Param1_register, p1);\
+       awc_write(base,awc_Param2_register, p2);\
+       WAIT61x3;\
+       awc_write(base,awc_Command_register, com);\
+       WAIT61x3;\
+}
+#define awc_wout(cmd, com, p0,p1,p2) {\
+       awc_write(base,awc_Param0_register, p0);\
+       awc_write(base,awc_Param1_register, p1);\
+       awc_write(base,awc_Param2_register, p2);\
+       WAIT61x3;\
+       awc_write(base,awc_Command_register, com);\
+       WAIT61x3;\
+}
+
+
+#define awc_command_NOP(cmd)                   awc_wout( cmd,0x0000,0,0,0) //  NOP
+#define awc_command_Enable_All(cmd)            awc_wout( cmd,0x0001,0,0,0) //  Enable
+#define awc_command_Enable_MAC(cmd)            awc_wout( cmd,0x0101,0,0,0) //  Enable Mac
+#define awc_command_Enable_Rx(cmd)             awc_wout( cmd,0x0201,0,0,0) //  Enable Rx
+#define awc_command_Disable_MAC(cmd)           awc_wout( cmd,0x0002,0,0,0) //  Disable
+#define awc_command_Sync_Loss(cmd)             awc_wout( cmd,0x0003,0,0,0) //  Force a Loss of Sync
+#define awc_command_Soft_Reset(cmd)            awc_wout( cmd,0x0004,0,0,0) //  Firmware Restart (soft reset)
+#define awc_command_Host_Sleep(cmd)            awc_wout( cmd,0x0005,0,0,0) //  Host Sleep (must be issued as 0x0085)
+#define awc_command_Magic_Packet(cmd)          awc_wout( cmd,0x0006,0,0,0) //  Magic Packet
+#define awc_command_Read_Configuration(cmd)    awc_wout( cmd,0x0008,0,0,0) //  Read the Configuration from nonvolatile  storage
+#define awc_command_Allocate_TX_Buff(cmd,size) awc_wout( cmd,0x000A,size,0,0) //       Allocate Transmit Buffer
+#define awc_command_TX(cmd,FID)                        awc_wout( cmd,0x000B,FID ,0,0) //       Transmit
+#define awc_command_Deallocate(cmd,FID)                awc_wout( cmd,0x000C,FID ,0,0) //       Deallocate
+#define awc_command_NOP2(cmd)                  awc_wout( cmd,0x0010,0,0,0) //  NOP (same as 0x0000)
+#define awc_command_Read_RID(cmd,RID)          awc_wout( cmd,0x0021,RID ,0,0) //       Read RID
+#define awc_command_Write_RID(cmd,RID)         awc_wout( cmd,0x0121,RID ,0,0) //       Write RID
+#define awc_command_Allocate_Buff(cmd,size)    awc_wout( cmd,0x0028,size,0,0) //       Allocate Buffer
+#define awc_command_PSP_Nodes(cmd)             awc_wout( cmd,0x0030,0,0,0) //  PSP nodes (AP only)
+#define awc_command_Set_Phy_register(cmd,phy_register,clear_bits, set_bits)\
+                                                       awc_wout( cmd,0x003E,phy_register,clear_bits, set_bits) //      Set PHY register
+#define awc_command_TX_Test(cmd,command, frequency, pattern)           awc_wout( cmd,0x003F,command, frequency, pattern) //    Transmitter Test
+#define awc_command_RX_Test(cmd)               awc_wout( cmd,0x013F,0,0,0) //  RX Test
+#define awc_command_Sleep(cmd)                 awc_wout( cmd,0x0085,0,0,0) //  Go to Sleep (No Ack bit is mandatory)
+#define awc_command_Save_Configuration(cmd)    awc_wout( cmd,0x0108,0,0,0) //  Save the configuration to nonvolatile
+
+
+#define AWC_COMMAND_NOOP_BULL          0x000
+#define AWC_COMMAND_ENABLE             0x001
+#define AWC_COMMAND_ENABLE_MAC         0x101
+#define AWC_COMMAND_ENABLE_RX          0x201
+#define AWC_COMMAND_DISABLE            0x002
+#define AWC_COMMAND_LOSE_SYNC          0x003
+#define AWC_COMMAND_SOFT_RESET         0x004
+#define AWC_COMMAND_HOST_SLEEP         0x085
+#define AWC_COMMAND_MAGIC_PACKET       0x006
+#define AWC_COMMAND_READ_CONF          0x008
+#define AWC_COMMAND_SAVE_CONF          0x108
+#define AWC_COMMAND_TX_ALLOC           0x00A
+#define AWC_COMMAND_TX                 0x00B
+#define AWC_COMMAND_DEALLOC            0x00C
+#define AWC_COMMAND_NOOP               0x010
+#define AWC_COMMAND_READ_RID           0x021
+#define AWC_COMMAND_WRITE_RID          0x121
+#define AWC_COMMAND_ALLOC              0x028
+#define AWC_COMMAND_PSP_NODES          0x030
+#define AWC_COMMAND_SET_PHY            0x03E
+#define AWC_COMMAND_TX_TEST            0x03F
+#define AWC_COMMAND_SLEEP              0x085
+
+
+#define awc_command_name_strings {\
+       {0x0000, 0x00FF,"awc_command_NOP " },\
+       {0x0001, 0x00FF,"awc_command_Enable_All " },\
+       {0x0101, 0x01FF,"awc_command_Enable_MAC " },\
+       {0x0201, 0x01FF,"awc_command_Enable_Rx " },\
+       {0x0002, 0x00FF,"awc_command_Disable_MAC " },\
+       {0x0003, 0x00FF,"awc_command_Sync_Loss " },\
+       {0x0004, 0x00FF,"awc_command_Soft_Reset " },\
+       {0x0005, 0x00FF,"awc_command_Host_Sleep " },\
+       {0x0006, 0x00FF,"awc_command_Magic_Packet " },\
+       {0x0008, 0x00FF,"awc_command_Read_Configuration " },\
+       {0x000A, 0x00FF,"awc_command_Allocate_TX_Buff " },\
+       {0x000B, 0x00FF,"awc_command_TX " },\
+       {0x000C, 0x00FF,"awc_command_Deallocate " },\
+       {0x0010, 0x00FF,"awc_command_NOP2 " },\
+       {0x0021, 0x00FF,"awc_command_Read_RID " },\
+       {0x0121, 0x01FF,"awc_command_Write_RID " },\
+       {0x0028, 0x00FF,"awc_command_Allocate_Buff " },\
+       {0x0030, 0x00FF,"awc_command_PSP_Nodes " },\
+       {0x003E, 0x00FF,"awc_command_Set_Phy_register " },\
+       {0x003F, 0x00FF,"awc_command_TX_Test " },\
+       {0x013F, 0x01FF,"awc_command_RX_Test " },\
+       {0x0085, 0x00FF,"awc_command_Sleep " },\
+       {0x0108, 0x01FF,"awc_command_Save_Configuration " },\
+       {0x0000, 0x00FF, NULL}\
+};
+
+
+/***************************** STATUSES */
+
+#define awc_reply_success 0x0000
+
+#define awc_reply_error_strings {\
+   { 0x0000, 0x00FF,"    Success"},\
+   { 0x0001, 0x00FF,"    Illegal command."},\
+   { 0x0002, 0x00FF,"    Illegal format."},\
+   { 0x0003, 0x00FF,"    Invalid FID."},\
+   { 0x0004, 0x00FF,"    Invalid RID."},\
+   { 0x0005, 0x00FF,"    Too Large"},\
+   { 0x0006, 0x00FF,"    MAC is not disabled."},\
+   { 0x0007, 0x00FF,"    Alloc is still busy processing previous alloc"},\
+   { 0x0008, 0x00FF,"    Invalid Mode Field"},\
+   { 0x0009, 0x00FF,"    Tx is not allowed in monitor mode"},\
+   { 0x000A, 0x00FF,"    Loop test or memory test error"},\
+   { 0x000B, 0x00FF,"    Cannot read this RID."},\
+   { 0x000C, 0x00FF,"    Cannot write to this RID."},\
+   { 0x000D, 0x00FF,"    Tag not found."},\
+   { 0x0080, 0x00FF,"    Config mode is invalid."},\
+   { 0x0081, 0x00FF,"    Config hop interval is invalid."},\
+   { 0x0082, 0x00FF,"    Config beacon interval is invalid."},\
+   { 0x0083, 0x00FF,"    Config receive mode is invalid."},\
+   { 0x0084, 0x00FF,"    Config MAC address is invalid."},\
+   { 0x0085, 0x00FF,"    Config rates are invalid."},\
+   { 0x0086, 0x00FF,"    Config ordering field is invalid."},\
+   { 0x0087, 0x00FF,"    Config scan mode is invalid."},\
+   { 0x0088, 0x00FF,"    Config authentication type is invalid."},\
+   { 0x0089, 0x00FF,"    Config power save mode is invalid."},\
+   { 0x008A, 0x00FF,"    Config radio type is invalid."},\
+   { 0x008B, 0x00FF,"    Config diversity is invalid."},\
+   { 0x008C, 0x00FF,"    Config SSID list is invalid."},\
+   { 0x008D, 0x00FF,"    Config specified AP list is invalid."},\
+   { 0x0000, 0x00FF, NULL}\
+};
+
+#define awc_reply_command_failed( status) ((status & 0x7F00) == 0x7F)
+
+
+/*************************   PHY and TEST commands   ****************/
+
+
+// this might be wrong and reading is not implemented(was not in spec properly)
+#define awc_Set_PLCP_Word(PLCP_Word)\
+       awc_command_Set_Phy_register(base,0x8000,0 ,PLCP_Word)
+#define awc_Set_TX_Test_Freq(Tx_Test_Freq)\
+       awc_command_Set_Phy_register(base,0x8002,0 ,Tx_Test_Freq)
+#define awc_Set_Tx_Power(Tx_Power)\
+       awc_command_Set_Phy_register(base,0x8004,0 ,Tx_Power)
+#define awc_Set_RSSI_Treshold(RSSI_Treshold)\
+       awc_command_Set_Phy_register(base,0x8006,0 ,RSSI_Treshold)
+#define awc_Get_PLCP_Word(PLCP_Word)\
+       awc_command_Set_Phy_register(base,0x8000,0 ,0)
+#define awc_Get_TX_Test_Freq(Tx_Test_Freq)\
+       awc_command_Set_Phy_register(base,0x8002,0 ,0)
+#define awc_Get_Tx_Power(Tx_Power)\
+       awc_command_Set_Phy_register(base,0x8004,0 ,0)
+#define awc_Get_RSSI_Treshold(RSSI_Treshold)\
+       awc_command_Set_Phy_register(base,0x8006,0 ,0)
+
+
+#define awc_tx_test_code_end   0x0000   //  Ends the transmitter test
+#define awc_tx_test_code_loop  0x0001   //  Loop back to the beginning of the commands
+#define awc_tx_test_code_start 0x0002   //  Start transmitting
+#define awc_tx_test_code_stop  0x0003   //  Stop transmitting
+#define awc_tx_test_code_delayu 0x0004   //  Delay for N usec where N is the next word
+#define awc_tx_test_code_delayk 0x0005   //  Delay for N Kusec where N is the next word
+#define awc_tx_test_code_next  0x0006   //  Go to the next frequency in the frequency RID
+#define awc_tx_test_code_rx    0x0007   //  Start receive mode
+
+#define awc_tx_test_code_strings {\
+{  awc_tx_test_code_end ,      0x000f ,"    Ends the transmitter test"},\
+{  awc_tx_test_code_loop ,     0x000f ,"     Loop back to the beginning of the commands"},\
+{  awc_tx_test_code_start ,    0x000f ,"    Start transmitting"},\
+{  awc_tx_test_code_stop ,     0x000f ,"    Stop transmitting"},\
+{  awc_tx_test_code_delayu ,   0x000f ,"    Delay for N usec where N is the next word"},\
+{  awc_tx_test_code_delayk ,   0x000f ,"    Delay for N Kusec where N is the next word"},\
+{  awc_tx_test_code_next ,     0x000f ,"    Go to the next frequency in the frequency RID"},\
+{  awc_tx_test_code_rx         ,       0x000f ,"    Start receive mode"},\
+{                      0   , 0x000f ,NULL}\
+};
+
+
+
+#define AWC_COMMSTAT_HARD_RESET                0x0000001
+#define AWC_COMMSTAT_WAKE              0x0000002
+#define AWC_COMMSTAT_SOFT_RESET                0x0000004
+#define AWC_COMMSTAT_CONFIGURE         0x0000008
+#define AWC_COMMSTAT_READ_CONF         0x0000010
+#define AWC_COMMSTAT_SAVE_CONF         0x0000020
+#define AWC_COMMSTAT_DEALLOC           0x0000040
+#define AWC_COMMSTAT_ALLOC_TX          0x0000080
+#define AWC_COMMSTAT_ALLOC_TEST                0x0000100
+#define AWC_COMMSTAT_ENABLE_MAC                0x0000200
+#define AWC_COMMSTAT_ENABLE_RX         0x0000400
+#define AWC_COMMSTAT_DISABLE_MAC       0x0000800
+#define AWC_COMMSTAT_RX_ACK            0x0001000
+#define AWC_COMMSTAT_TX_ACK            0x0002000
+#define AWC_COMMSTAT_AWAKEN_ACK                0x0004000
+#define AWC_COMMSTAT_TX_FAIL_ACK       0x0008000
+#define AWC_COMMSTAT_LINK_ACK          0x0010000
+#define AWC_COMMSTAT_CLR_CMD           0x0020000
+#define AWC_COMMSTAT_ALLOC_ACK         0x0040000
+#define AWC_COMMSTAT_HOST_SLEEP                0x0080000
+#define AWC_COMMSTAT_RX                        0x0100000
+#define AWC_COMMSTAT_TX                        0x0200000
+#define AWC_COMMSTAT_SLEEP             0x0400000
+#define AWC_COMMSTAT_PSP_NODES         0x0800000
+#define AWC_COMMSTAT_SET_TX_POWER      0x1000000
+
+
+/*****************************     R  I  D     ***************/
+
+#define AWC_NOF_RIDS   18
+extern int awc_rid_setup(struct NET_DEVICE * dev);
+
+struct aironet4500_rid_selector{
+       const u16 selector;
+       const unsigned  MAC_Disable_at_write:1;
+       const unsigned  read_only:1;
+       const unsigned  may_change:1;
+       const char *    name;
+};
+
+
+
+
+
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_General_Config;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_SSID_list;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_list    ;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Driver_name;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Encapsulation;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Active_Config;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Capabilities;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_AP_Info    ;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Radio_Info;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Status     ;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_Modulation ;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_volatile       ;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_WEP_nonvolatile    ;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_delta;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_16_stats_clear;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_delta;
+extern const struct aironet4500_rid_selector aironet4500_RID_Select_32_stats_clear;
+
+#define awc_def_gen_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_General_Config,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_SSID_RID(offset,name, bits,mask,value,value_name)\
+  {&aironet4500_RID_Select_SSID_list,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_AP_List_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_AP_list,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_Dname_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Driver_name,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_act_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Active_Config,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_Cap_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Capabilities,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_AP_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_AP_Info,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_Radio_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Radio_Info,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_Stat_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Status,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_Enc_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Encapsulation,offset, bits,1,1,0,0, mask, value, name, value_name}
+
+#define awc_def_WEPv_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_WEP_volatile,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_WEPnv_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_WEP_nonvolatile,offset, bits,1,1,0,0, mask, value, name, value_name}
+#define awc_def_Modulation_RID(offset,name, bits,mask,value,value_name)\
+ {&aironet4500_RID_Select_Modulation,offset, bits,1,1,0,0, mask, value, name, value_name}
+
+#define awc_def_Stats_RID(o16,offset,name, value_name)\
+ {&aironet4500_RID_Select_32_stats,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name}
+#define awc_def_Stats_delta_RID(o16,offset,name, value_name)\
+ {&aironet4500_RID_Select_32_stats_delta,offset, 32,1,1,0,0, 0xffffffff, 0, name, value_name}
+#define awc_def_Stats_clear_RID(o16,offset,name, value_name)\
+ {&aironet4500_RID_Select_32_stats_delta,offset,32,1,1,0,0, 0xffffffff,  0, name,value_name}
+
+#define awc_def_Stats16_RID(offset,o32,name, value_name)\
+ {&aironet4500_RID_Select_16_stats,offset, 16,1,1,0,0, 0xffffffff, 0, name, value_name}
+#define awc_def_Stats16_delta_RID(offset,o32,name, value_name)\
+ {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff,  0, name,value_name}
+#define awc_def_Stats16_clear_RID(offset,o32,name, value_name)\
+ {&aironet4500_RID_Select_16_stats_delta,offset, 16,1,1,0,0, 0xffffffff,  0, name,value_name}
+
+
+#define aironet4500_RID_Select_strings {\
+{ 0xFF10, 0xffff, "General Configuration"},\
+{ 0xFF11, 0xffff, "Valid SSID list" },\
+{ 0xFF12, 0xffff, "Valid AP list"},\
+{ 0xFF13, 0xffff, "Driver name"},\
+{ 0xFF14, 0xffff, "Ethernet Protocol"},\
+{ 0xFF15, 0xffff, "WEP volatile"},\
+{ 0xFF16, 0xffff, "WEP nonvolatile"},\
+{ 0xFF17, 0xffff, "Modulation"},\
+{ 0xFF20, 0xffff, "Actual Configuration"},\
+{ 0xFF00, 0xffff, "Capabilities"},\
+{ 0xFF01, 0xffff, "AP Info"},\
+{ 0xFF02, 0xffff, "Radio Info"},\
+{ 0xFF50, 0xffff, "Status"},\
+{ 0xFF60, 0xffff, "Cumulative 16-bit Statistics"},\
+{ 0xFF61, 0xffff, "Delta 16-bit Statistics"},\
+{ 0xFF62, 0xffff, "Delta 16-bit Statistics and Clear"},\
+{ 0xFF68, 0xffff, "Cumulative 32-bit Statistics"},\
+{ 0xFF69, 0xffff, "Delta 32-bit Statistics "},\
+{ 0xFF6A, 0xffff, "Delta 32-bit Statistics and Clear"},\
+{ 0x0000, 0xffff, NULL}\
+}
+
+
+
+
+
+struct aironet4500_RID {
+       const struct aironet4500_rid_selector   *  selector;
+       const u32       offset;
+       const u8        bits;
+       const u8        array;
+       const u32       units;
+       const unsigned read_only:1;
+       const unsigned null_terminated:1;
+       const u32       mask;
+       const u32       value;
+       const char * name;
+       const char * value_name;
+               
+};
+
+struct aironet4500_RID_names{
+       struct aironet4500_RID rid;
+       char *name;
+};
+
+struct aironet4500_RID_names_values{
+       struct aironet4500_RID rid;
+       char *name;
+       u32     mask;   
+};
+
+struct awc_rid_dir{
+       const struct aironet4500_rid_selector * selector;
+       const int size;
+       const struct aironet4500_RID * rids;
+       struct NET_DEVICE * dev ;
+       void *  buff;
+       int     bufflen; // just checking
+};
+
+extern int awc_nof_rids;
+extern struct awc_rid_dir  awc_rids[];
+
+
+
+
+
+struct awc_private {
+       dev_node_t node;
+
+
+       int dummy_test;
+       struct awc_config               config; // card RID mirrors
+       struct awc_config               general_config; // 
+       struct awc_SSIDs                SSIDs;
+       struct awc_fixed_APs            fixed_APs;
+       struct awc_driver_name          driver_name;
+       struct awc_enc_trans            enc_trans;
+       struct awc_cap                  capabilities;
+       struct awc_status               status;
+       struct awc_AP                   AP;
+       struct awc_Statistics_32        statistics;
+       struct awc_Statistics_32        statistics_delta;
+       struct awc_Statistics_32        statistics_delta_clear;
+       struct awc_Statistics_16        statistics16;
+       struct awc_Statistics_16        statistics16_delta;
+       struct awc_Statistics_16        statistics16_delta_clear;
+       struct awc_wep_key              wep_volatile;
+       struct awc_wep_key              wep_nonvolatile;
+       struct awc_modulation           modulation;
+
+       struct awc_rid_dir              rid_dir[AWC_NOF_RIDS];
+       int     rids_read;
+       
+       
+       struct awc_bap          bap0;
+       struct awc_bap          bap1;
+       int                     sleeping_bap;
+       
+       struct awc_fid_queue    tx_small_ready;
+       struct awc_fid_queue    tx_large_ready;
+       struct awc_fid_queue    tx_post_process;
+       struct awc_fid_queue    tx_in_transmit;
+       my_spinlock_t           queues_lock;
+
+       struct awc_fid_queue    rx_ready;
+       struct awc_fid_queue    rx_post_process;
+
+
+       
+       struct semaphore        tx_buff_semaphore;
+       volatile int            tx_buffs_in_use;
+       volatile int            tx_small_buffs_in_use;
+       volatile int            tx_buffs_total;
+       volatile int            tx_small_buffs_total;
+       int                     large_buff_mem;
+       int                     small_buff_no;
+       
+       int tx_timeout;
+       
+       volatile int            mac_enabled;
+       u16                     link_status;
+       u8                      link_status_changed;
+       
+       volatile int            ejected;
+       volatile int            bh_running;
+       volatile int            bh_active;
+       volatile int            tx_chain_active;
+       volatile u16            enabled_interrupts;
+       volatile u16            waiting_interrupts;
+       volatile int            interrupt_count;
+       
+       // Command serialize stuff
+        struct semaphore       command_semaphore;
+        volatile int           unlock_command_postponed;
+        struct awc_command     cmd;
+        long long              async_command_start;
+        volatile int           command_semaphore_on;
+        struct tq_struct       immediate_bh;
+       volatile int            process_tx_results;
+
+       u8                      p2p[6];
+       u8                      bssid[6];
+       int                     p2p_uc;
+       int                     p2p_found;
+       int                     p802_11_send;
+       
+       struct enet_statistics  stats;
+       
+       struct ctl_table * proc_table;
+
+       void    *               bus;
+       int                     card_type;
+};
+
+extern int             awc_init(struct NET_DEVICE * dev);
+extern void            awc_reset(struct NET_DEVICE *dev);
+extern int             awc_config(struct NET_DEVICE *dev);
+extern int             awc_open(struct NET_DEVICE *dev);
+extern void            awc_tx_timeout(struct NET_DEVICE *dev);
+extern int             awc_tx_done(struct awc_fid * rx_fid); 
+extern int             awc_start_xmit(struct sk_buff *, struct NET_DEVICE *);
+extern void            awc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+extern struct enet_statistics *        awc_get_stats(struct NET_DEVICE *dev);
+extern int             awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid);
+extern void            awc_set_multicast_list(struct NET_DEVICE *dev);
+extern int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu);  
+extern int             awc_close(struct NET_DEVICE *dev);
+extern int             awc_private_init(struct NET_DEVICE * dev);
+extern int awc_register_proc(int (*awc_proc_set_device) (int),int (*awc_proc_unset_device)(int));
+extern int awc_unregister_proc(void);
+extern int (* awc_proc_set_fun) (int) ;
+extern int (* awc_proc_unset_fun) (int) ;
+extern int     awc_interrupt_process(struct NET_DEVICE * dev);
+extern int     awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf );
+extern int     awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf);
+extern int     awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid );
+extern int     awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid);
+extern int     awc_tx_alloc(struct NET_DEVICE * dev) ;
+extern int     awc_tx_dealloc(struct NET_DEVICE * dev);
+extern struct awc_fid *awc_tx_fid_lookup(struct NET_DEVICE * dev, u16 fid);
+extern int     awc_issue_soft_reset(struct NET_DEVICE * dev);
+extern int     awc_issue_noop(struct NET_DEVICE * dev);
+extern int     awc_dump_registers(struct NET_DEVICE * dev);
+extern unsigned short  awc_issue_command_and_block(struct awc_command * cmd);
+extern int     awc_enable_MAC(struct NET_DEVICE * dev);
+extern int     awc_disable_MAC(struct NET_DEVICE * dev);
+extern int     awc_read_all_rids(struct NET_DEVICE * dev);
+extern int     awc_write_all_rids(struct NET_DEVICE * dev);
+extern int     awc_receive_packet(struct NET_DEVICE * dev);
+extern int     awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) ;
+extern int     awc_tx_complete_check(struct NET_DEVICE * dev);
+extern int     awc_interrupt_process(struct NET_DEVICE * dev);
+extern void    awc_bh(struct NET_DEVICE *dev);
+extern int     awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff);
+extern void    awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff);
+extern int     awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, struct sk_buff * skb);
+extern void    awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, struct awc_fid * tx_buff);
+extern void    awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,struct awc_fid * tx_buff);
+extern void    awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff);
+extern void    awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff);
+extern int     awc_tx_alloc(struct NET_DEVICE * dev) ;
+extern int     awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid);
+extern int     awc_tx_dealloc(struct NET_DEVICE * dev);
+extern struct awc_fid *
+       awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle);
+extern int     awc_queues_init(struct NET_DEVICE * dev);
+extern int     awc_queues_destroy(struct NET_DEVICE * dev);
+extern int     awc_rids_setup(struct NET_DEVICE * dev);
+
+
+
+extern int             awc_debug;
+extern int bap_sleep ;
+extern int bap_sleep_after_setup ;
+extern int sleep_before_command  ;
+extern int bap_sleep_before_write;
+extern int sleep_in_command    ;
+extern int tx_queue_len ;
+extern int tx_rate;
+extern int awc_full_stats;
+
+#define MAX_AWCS       4
+extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS];
+
+
+#ifdef AWC_DEBUG
+       #define DEBUG(a,args...) if (awc_debug & a) printk( args)
+       #define AWC_ENTRY_EXIT_DEBUG(a)  if (awc_debug & 8) printk( a)
+#else
+       #define DEBUG(a, args...)
+       #define AWC_ENTRY_EXIT_DEBUG(a)
+#endif
+
+#if LINUX_VERSION_CODE < 0x20100
+#ifndef test_and_set_bit
+          #define test_and_set_bit(a,b)           set_bit(a,b)
+#endif                         
+#endif
+
+#if LINUX_VERSION_CODE  < 0x20100
+       #define FREE_SKB(a) dev_kfree_skb(a, FREE_WRITE)
+#else
+       #define FREE_SKB(a) dev_kfree_skb(a)
+#endif
+
+#endif /* AIRONET4500_H */
diff --git a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
new file mode 100644 (file)
index 0000000..fe7b04a
--- /dev/null
@@ -0,0 +1,1119 @@
+/*
+ *      Aironet 4500 PCI-ISA-i365 driver
+ *
+ *             Elmer Joandi, Januar 1999
+ *     Copyright Elmer Joandi, all rights restricted
+ *     
+ *
+ *     Revision 0.1 ,started  30.12.1998
+ *
+ *
+ */
+#ifdef MODULE
+static const char *awc_version =
+"aironet4500_cards.c v0.1 28/03/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+#endif
+
+#include <linux/version.h>
+#include <linux/config.h>
+#include <linux/module.h>
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/ptrace.h>
+#include <linux/malloc.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/in.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <linux/timer.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/if_arp.h>
+#include <linux/ioport.h>
+
+#if LINUX_VERSION_CODE < 0x20100
+#include <linux/bios32.h>
+#endif
+
+#include "aironet4500.h"
+
+#define PCI_VENDOR_ID_AIRONET  0x14b9
+#define PCI_DEVICE_AIRONET_4800_1 0x1
+#define PCI_DEVICE_AIRONET_4800 0x4500
+#define PCI_DEVICE_AIRONET_4500 0x4800
+#define AIRONET4X00_IO_SIZE    0x40
+#define AIRONET4X00_CIS_SIZE   0x300
+#define AIRONET4X00_MEM_SIZE   0x300
+
+#define AIRONET4500_PCI        1
+#define AIRONET4500_PNP                2
+#define AIRONET4500_ISA                3
+#define AIRONET4500_365                4
+
+
+#ifdef CONFIG_AIRONET4500_PCI
+
+#include <linux/pci.h>
+
+
+static int reverse_probe =0 ;
+
+
+static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
+                       int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ;
+
+
+int awc4500_pci_probe(struct NET_DEVICE *dev)
+{
+       int cards_found = 0;
+       static int pci_index = 0;       /* Static, for multiple probe calls. */
+       u8 pci_irq_line = 0;
+//     int p;
+
+       unsigned char awc_pci_dev, awc_pci_bus;
+
+       if (!pcibios_present()) 
+               return -1;
+
+       for (;pci_index < 0xff; pci_index++) {
+               u16 vendor, device, pci_command, new_command;
+               u32 pci_memaddr;
+               u32 pci_ioaddr;
+               u32 pci_cisaddr;
+#if LINUX_VERSION_CODE < 0x20100
+               u16 pci_caps =0;
+               u8  pci_caps_ptr =0;
+#endif
+               if (pcibios_find_class  (PCI_CLASS_NETWORK_OTHER << 8,
+                        reverse_probe ? 0xfe - pci_index : pci_index,
+                                &awc_pci_bus, &awc_pci_dev) != PCIBIOS_SUCCESSFUL){
+                               if (reverse_probe){
+                                       continue;
+                               } else {
+                                       break;
+                               }
+               }
+               pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
+                                                                        PCI_VENDOR_ID, &vendor);
+               pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
+                                                                        PCI_DEVICE_ID, &device);
+#if LINUX_VERSION_CODE >= 0x20300
+               pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq;
+               pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[0].start;
+                pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[1].start;
+               pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[2].start;
+#else
+#if LINUX_VERSION_CODE >= 0x20155
+               pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq;
+               pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[0];
+                pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[1];
+               pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[2];          
+#else
+               pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_0, &pci_memaddr);
+               pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_1, &pci_cisaddr);
+               pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_2, &pci_ioaddr);
+               pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, PCI_INTERRUPT_LINE, &pci_irq_line);
+               pcibios_read_config_word(awc_pci_bus, awc_pci_dev,PCI_STATUS, &pci_caps);
+               pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, 0x34, &pci_caps_ptr);
+
+#endif // 2.2
+#endif // 2.3
+//             printk("\n pci capabilities %x and ptr %x \n",pci_caps,pci_caps_ptr);
+               /* Remove I/O space marker in bit 0. */
+
+               if (vendor != PCI_VENDOR_ID_AIRONET)
+                       continue;
+               if (device != PCI_DEVICE_AIRONET_4800_1 && 
+                               device != PCI_DEVICE_AIRONET_4800 &&
+                               device != PCI_DEVICE_AIRONET_4500 )
+                        continue;
+#if LINUX_VERSION_CODE < 0x20300
+
+               if (!(pci_ioaddr & 1)){
+                       printk("awc4X00 ioaddr location mismatch \n");
+                       return -1;
+               };
+
+               pci_ioaddr &= ~3;
+               pci_cisaddr &= ~0xf;
+               pci_memaddr &= ~0xf;
+#endif         
+//             if (check_region(pci_ioaddr, AIRONET4X00_IO_SIZE) ||
+//                     check_region(pci_cisaddr, AIRONET4X00_CIS_SIZE) ||
+//                     check_region(pci_memaddr, AIRONET4X00_MEM_SIZE)) {
+//                             printk(KERN_ERR "aironet4X00 mem addrs not available for maping \n");
+//                             continue;
+//             }
+               request_region(pci_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
+//             request_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
+//             request_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
+
+//             pcibios_write_config_word(awc_pci_bus, awc_pci_dev,
+//                                               PCI_COMMAND, 0);
+               udelay(10000);
+
+               pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
+                                        PCI_COMMAND, &pci_command);
+               new_command = pci_command |0x100 | PCI_COMMAND_MEMORY|PCI_COMMAND_IO;
+               if (pci_command != new_command) {
+                       printk(KERN_INFO "  The PCI BIOS has not enabled this"
+                                  " device!  Updating PCI command %4.4x->%4.4x.\n",
+                                  pci_command, new_command);
+                       pcibios_write_config_word(awc_pci_bus, awc_pci_dev,
+                                                 PCI_COMMAND, new_command);
+               }
+
+
+/*             if (device == PCI_DEVICE_AIRONET_4800)
+                       pcibios_write_config_dword(awc_pci_bus, awc_pci_dev,
+                               0x40, 0x00000000);
+
+               udelay(1000);
+*/
+               if (device == PCI_DEVICE_AIRONET_4800)
+                       pcibios_write_config_dword(awc_pci_bus, awc_pci_dev,
+                               0x40, 0x40000000);
+
+               if (awc_pci_init(dev, awc_pci_bus, awc_pci_dev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
+                       printk(KERN_ERR "awc4800 pci init failed \n");
+                       break;
+               }
+               dev = 0;
+               cards_found++;
+       }
+
+       return cards_found ? 0 : -ENODEV;
+}
+
+
+static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
+                       int ioaddr, int cis_addr, int mem_addr, u8 pci_irq_line) {
+
+       int i;
+
+       if (!dev) {
+               dev = init_etherdev(dev, 0 );   
+       }
+       dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
+       memset(dev->priv,0,sizeof(struct awc_private));
+       if (!dev->priv) {
+               printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n");
+               return -1;
+       };
+
+//     ether_setup(dev);
+
+//     dev->tx_queue_len = tx_queue_len;
+
+       dev->hard_start_xmit =          &awc_start_xmit;
+//     dev->set_config =               &awc_config_misiganes,aga mitte awc_config;
+       dev->get_stats =                &awc_get_stats;
+//     dev->set_multicast_list =       &awc_set_multicast_list;
+       dev->change_mtu         =       awc_change_mtu;
+       dev->init = &awc_init;
+       dev->open = &awc_open;
+       dev->stop = &awc_close;
+       dev->tbusy = 1;
+       dev->start  = 0;
+
+       dev->base_addr = ioaddr;
+
+
+       dev->irq = pci_irq_line;
+#if LINUX_VERSION_CODE > 0x20100
+       request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
+#else 
+       request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
+#endif
+       awc_private_init( dev);
+       awc_init(dev);
+
+       i=0;
+       while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
+       if (!aironet4500_devices[i]){
+               aironet4500_devices[i]=dev;
+               ((struct awc_private *)
+               aironet4500_devices[i]->priv)->card_type = AIRONET4500_PCI;
+
+               if (awc_proc_set_fun)
+                       awc_proc_set_fun(i);
+       }
+
+       dev->tbusy = 1;
+       dev->start = 0;
+
+       
+//     if (register_netdev(dev) != 0) {
+//             printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
+//             goto failed;
+//     }
+
+       
+
+       return 0; 
+//  failed:
+//     return -1;
+
+}
+
+#ifdef MODULE
+static void awc_pci_release(void) {
+
+//     long flags;
+       int i=0;
+
+       DEBUG(0, "awc_detach \n");
+
+       i=0;
+       while ( i < MAX_AWCS) {
+               if (!aironet4500_devices[i])
+                        {i++; continue;};
+               if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_PCI)
+                                 {i++;      continue;}
+
+               if (awc_proc_unset_fun)
+                       awc_proc_unset_fun(i);
+               release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
+//             release_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
+//             release_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
+
+               unregister_netdev(aironet4500_devices[i]);
+               free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
+               kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
+               kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+
+               aironet4500_devices[i]=0;
+
+
+               i++;
+       }
+       
+
+} 
+
+
+#endif //MODULE
+
+
+#endif /* CONFIG_AIRONET4500_PCI */
+
+#ifdef CONFIG_AIRONET4500_PNP
+
+#if LINUX_VERSION_CODE > 0x20300
+#include <linux/isapnp.h>
+#else
+#include "isapnp.h"
+#endif
+#define AIRONET4X00_IO_SIZE    0x40
+
+#if LINUX_VERSION_CODE > 0x20300
+#define isapnp_logdev pci_dev
+#define isapnp_dev    pci_bus
+#define isapnp_find_device isapnp_find_card
+#define isapnp_find_logdev isapnp_find_dev
+#define PNP_BUS bus
+#define PNP_BUS_NUMBER number
+#define PNP_DEV_NUMBER devfn
+#else 
+#define PNP_BUS dev
+#define PNP_BUS_NUMBER csn
+#define PNP_DEV_NUMBER number
+#endif
+
+int awc4500_pnp_hw_reset(struct NET_DEVICE *dev){
+       struct isapnp_logdev *logdev;
+#if LINUX_VERSION_CODE < 0x20300
+       struct isapnp_config cfg;
+#endif
+       DEBUG(0, "awc_pnp_reset \n");
+
+       if (!dev->priv ) {
+               printk("awc4500 no dev->priv in hw_reset\n");
+               return -1;
+       };
+
+       logdev = ((struct isapnp_logdev *) ((struct awc_private *)dev->priv)->bus);
+
+       if (!logdev ) {
+               printk("awc4500 no pnp logdev in hw_reset\n");
+               return -1;
+       };
+
+       if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0)
+               printk("isapnp cfg failed at release \n");
+       isapnp_deactivate(logdev->PNP_DEV_NUMBER);
+       isapnp_cfg_end();
+
+       udelay(100);
+
+
+       if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER) < 0) {
+               printk("%s cfg begin failed in hw_reset for csn %x devnum %x \n",
+                               dev->name, logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
+               return -EAGAIN;
+       }
+#if LINUX_VERSION_CODE < 0x20300
+       if (isapnp_config_init(&cfg, logdev)<0) {
+               printk("cfg init failed \n");
+               isapnp_cfg_end();
+               return -EAGAIN;
+       }
+       cfg.port[0]     = dev->base_addr;
+       cfg.irq[0]      = dev->irq;
+
+       if (isapnp_configure(&cfg)<0) {
+               printk("%s hw_reset, isapnp configure failed (out of resources?)\n",dev->name);
+               isapnp_cfg_end();
+               return -ENOMEM;
+       }
+#else
+       
+#endif
+       isapnp_activate(logdev->PNP_DEV_NUMBER);        /* activate device */
+       isapnp_cfg_end();
+
+       return 0;
+}
+
+int awc4500_pnp_probe(struct NET_DEVICE *dev)
+{
+       int isa_index = 0;
+       int isa_irq_line = 0;
+       int isa_ioaddr = 0;
+       int card = 0;
+       int i=0;
+       struct isapnp_dev * pnp_dev ;
+       struct isapnp_logdev *logdev;
+#if LINUX_VERSION_CODE < 0x20300
+       struct isapnp_config cfg;
+#endif
+
+       while (1) {
+
+               pnp_dev = isapnp_find_device(
+                                               ISAPNP_VENDOR('A','W','L'), 
+                                               ISAPNP_DEVICE(1),
+#if LINUX_VERSION_CODE < 0x20300                                               
+                                                isa_index 
+#else
+                                               0
+#endif                                          
+                                                );
+       
+               if (!pnp_dev) break;  
+               
+               isa_index++;
+
+               logdev = isapnp_find_logdev(pnp_dev, ISAPNP_VENDOR('A','W','L'),
+                                   ISAPNP_FUNCTION(1),
+                                   0);
+               if (!logdev){
+                       printk("No logical device found on Aironet board \n");
+                       return -ENODEV;
+               }
+               if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER) < 0) {
+                       printk("cfg begin failed for csn %x devnum %x \n",
+                                       logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
+                       return -EAGAIN;
+               }
+#if LINUX_VERSION_CODE < 0x20300
+               if (isapnp_config_init(&cfg, logdev)<0) {
+                       printk("cfg init failed \n");
+                       isapnp_cfg_end();
+                       return -EAGAIN;
+               }
+               if (isapnp_configure(&cfg)<0) {
+                       printk("isapnp configure failed (out of resources?)\n");
+                       isapnp_cfg_end();
+                       return -ENOMEM;
+               }
+#endif
+               isapnp_activate(logdev->PNP_DEV_NUMBER);        /* activate device */
+               isapnp_cfg_end();
+
+#if LINUX_VERSION_CODE < 0x20300               
+               isa_ioaddr = cfg.port[0];
+               isa_irq_line = cfg.irq[0];
+#else
+               isa_irq_line = logdev->irq;
+               isa_ioaddr = logdev->resource[0].start;
+#endif
+               request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
+
+               if (!dev) {
+                       dev = init_etherdev(dev, 0 );   
+               }
+               dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
+               memset(dev->priv,0,sizeof(struct awc_private));
+               if (!dev->priv) {
+                       printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n");
+                       return -1;
+               };
+               ((struct awc_private *)dev->priv)->bus =  logdev;
+
+       //      ether_setup(dev);
+       
+       //      dev->tx_queue_len = tx_queue_len;
+       
+               dev->hard_start_xmit =          &awc_start_xmit;
+       //      dev->set_config =               &awc_config_misiganes,aga mitte awc_config;
+               dev->get_stats =                &awc_get_stats;
+       //      dev->set_multicast_list =       &awc_set_multicast_list;        
+               dev->change_mtu         =       awc_change_mtu; 
+               dev->init = &awc_init;
+               dev->open = &awc_open;
+               dev->stop = &awc_close;
+               dev->tbusy = 1;
+               dev->start  = 0;
+               
+               dev->base_addr = isa_ioaddr;
+
+
+               dev->irq = isa_irq_line;
+#if LINUX_VERSION_CODE > 0x20100
+               request_irq(dev->irq,awc_interrupt , SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
+#else
+               request_irq(dev->irq,awc_interrupt, SA_SHIRQ  ,"Aironet 4X00",dev);
+#endif
+
+               awc_private_init( dev);
+
+               ((struct awc_private *)dev->priv)->bus =  logdev;
+
+               cli();
+               if ( awc_init(dev) ){
+                       printk("card not found at irq %x io %lx\n",dev->irq, dev->base_addr);
+                       if (card==0){
+                               sti();
+                               return -1;
+                       }
+                       sti();
+                       break;
+               }
+               udelay(10);
+               sti();
+               i=0;
+               while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
+               if (!aironet4500_devices[i] && i < MAX_AWCS-1 ){
+                       aironet4500_devices[i]=dev;
+
+               ((struct awc_private *)
+               aironet4500_devices[i]->priv)->card_type = AIRONET4500_PNP;
+
+                       if (awc_proc_set_fun)
+                               awc_proc_set_fun(i);    
+               } else { 
+                       printk(KERN_CRIT "Out of resources (MAX_AWCS) \n");
+                       return -1;
+               }
+
+               dev->tbusy = 1;
+               dev->start = 0;
+
+               card++; 
+       }
+
+       if (card == 0) return -ENODEV;
+       return 0;
+}
+
+#ifdef MODULE
+static void awc_pnp_release(void) {
+
+//     long flags;
+       int i=0;
+       struct isapnp_logdev *logdev;
+
+       DEBUG(0, "awc_detach \n");
+
+       i=0;
+       while ( i < MAX_AWCS) {
+               if (!aironet4500_devices[i])
+                                 {i++;      continue;}
+               if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_PNP)
+                                 {i++;      continue;}
+
+               logdev = ((struct isapnp_logdev *) ((struct awc_private *)aironet4500_devices[i]->priv)->bus);
+
+               if (!logdev ) 
+                       printk("awc4500 no pnp logdev in pnp_release\n");
+
+               if (awc_proc_unset_fun)
+                       awc_proc_unset_fun(i);
+               if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0)
+                       printk("isapnp cfg failed at release \n");
+               isapnp_deactivate(logdev->PNP_DEV_NUMBER);
+               isapnp_cfg_end();
+
+               release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
+//             release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
+//             release_region(isa_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
+
+               unregister_netdev(aironet4500_devices[i]);
+               free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
+               kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
+               kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+
+               aironet4500_devices[i]=0;
+
+
+               i++;
+       }
+       
+
+} 
+
+#endif //MODULE
+#endif /* CONFIG_AIRONET4500_PNP */
+
+#ifdef  CONFIG_AIRONET4500_ISA 
+
+static int irq[] = {0,0,0,0,0};
+static int io[] = {0,0,0,0,0};
+
+/* 
+       EXPORT_SYMBOL(irq);
+       EXPORT_SYMBOL(io);
+*/
+#if LINUX_VERSION_CODE >= 0x20100
+MODULE_PARM(irq,"i");
+MODULE_PARM_DESC(irq,"Aironet 4x00 ISA non-PNP irqs,required");
+MODULE_PARM(io,"i");
+MODULE_PARM_DESC(io,"Aironet 4x00 ISA non-PNP ioports,required");
+#endif
+
+
+
+int awc4500_isa_probe(struct NET_DEVICE *dev)
+{
+//     int cards_found = 0;
+//     static int isa_index = 0;       /* Static, for multiple probe calls. */
+       int isa_irq_line = 0;
+       int isa_ioaddr = 0;
+//     int p;
+       int card = 0;
+       int i=0;
+
+       if (! io[0] || ! irq[0]){
+       
+               printk("       Both irq and io params must be supplied  for ISA mode !!!\n");
+               return -ENODEV;
+       }
+
+       printk(KERN_WARNING "     Aironet ISA Card in non-PNP(ISA) mode sometimes feels bad on interrupt \n");
+       printk(KERN_WARNING "     Use aironet4500_pnp if any problems(i.e. card malfunctioning). \n");
+       printk(KERN_WARNING "     Note that this isa probe is not friendly... must give exact parameters \n");
+
+       while (irq[card] !=0){
+       
+               isa_ioaddr = io[card];
+               isa_irq_line = irq[card];
+
+               request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
+
+               if (!dev) {
+                       dev = init_etherdev(dev, 0 );   
+               }
+               dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
+               memset(dev->priv,0,sizeof(struct awc_private));
+               if (!dev->priv) {
+                       printk(KERN_CRIT "aironet4x00: could not allocate device private, some unstability may follow\n");
+                       return -1;
+               };
+
+       //      ether_setup(dev);
+       
+       //      dev->tx_queue_len = tx_queue_len;
+       
+               dev->hard_start_xmit =          &awc_start_xmit;
+       //      dev->set_config =               &awc_config_misiganes,aga mitte awc_config;
+               dev->get_stats =                &awc_get_stats;
+       //      dev->set_multicast_list =       &awc_set_multicast_list;        
+               dev->change_mtu         =       awc_change_mtu; 
+               dev->init = &awc_init;
+               dev->open = &awc_open;
+               dev->stop = &awc_close;
+               dev->tbusy = 1;
+               dev->start  = 0;
+               
+               dev->base_addr = isa_ioaddr;
+
+
+               dev->irq = isa_irq_line;
+
+#if LINUX_VERSION_CODE > 0x20100
+               request_irq(dev->irq,awc_interrupt ,SA_INTERRUPT ,"Aironet 4X00",dev);
+#else
+               request_irq(dev->irq,awc_interrupt ,0 ,"Aironet 4X00",dev);
+#endif
+
+               awc_private_init( dev);
+               if ( awc_init(dev) ){
+                       printk("card not found at irq %x mem %x\n",irq[card],io[card]);
+                       if (card==0)
+                               return -1;
+                       break;
+               }
+
+               i=0;
+               while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
+               if (!aironet4500_devices[i]){
+                       aironet4500_devices[i]=dev;
+               ((struct awc_private *)
+               aironet4500_devices[i]->priv)->card_type = AIRONET4500_ISA;
+
+                       if (awc_proc_set_fun)
+                               awc_proc_set_fun(i);    
+               }
+
+               dev->tbusy = 1;
+               dev->start = 0;
+
+               card++; 
+       }
+       if (card == 0 ) {
+               return -ENODEV;
+       };
+       return 0;
+}
+
+#ifdef MODULE
+static void awc_isa_release(void) {
+
+//     long flags;
+       int i=0;
+
+       DEBUG(0, "awc_detach \n");
+
+       i=0;
+       while ( i < MAX_AWCS) {
+       
+               if (!aironet4500_devices[i])
+                                 {i++;      continue;}
+               if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_ISA)
+                                 {i++;      continue;}
+
+               if (awc_proc_unset_fun)
+                       awc_proc_unset_fun(i);
+               release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
+//             release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
+//             release_region(isa_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
+
+               unregister_netdev(aironet4500_devices[i]);
+               free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
+               kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
+               kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+
+               aironet4500_devices[i]=0;
+
+
+               i++;
+       }
+       
+
+} 
+           
+#endif //MODULE   
+
+#endif /* CONFIG_AIRONET4500_ISA */
+
+#ifdef  CONFIG_AIRONET4500_365 
+
+#define port_range 0x40
+
+int awc_i365_offset_ports[] = {0x3e0,0x3e0,0x3e2,0x3e2};
+int awc_i365_data_ports [] = {0x3e1,0x3e1,0x3e3,0x3e3};
+int awc_i365_irq[]     = {5,5,11,12};
+int awc_i365_io[]      = {0x140,0x100,0x400,0x440};
+int awc_i365_sockets   = 0;
+
+struct i365_socket {
+       int offset_port ;
+       int data_port;
+       int socket;
+       int irq; 
+       int io;
+       int manufacturer;
+       int product;
+};
+       
+inline u8 i365_in (struct i365_socket * s, int offset) { 
+       outb(offset  + (s->socket % 2)* 0x40, s->offset_port);
+       return inb(s->data_port); 
+};
+
+inline void i365_out (struct i365_socket * s, int offset,int data){
+       outb(offset + (s->socket % 2)* 0x40 ,s->offset_port);
+       outb((data & 0xff),s->data_port)        ;
+       
+};
+
+void awc_i365_card_release(struct i365_socket * s){
+       
+       i365_out(s, 0x5, 0);            // clearing ints
+       i365_out(s, 0x6, 0x20);         // mem 16 bits
+       i365_out(s, 0x7, 0);            // clear IO
+       i365_out(s, 0x3, 0);            // gen ctrl reset + mem mode
+       i365_out(s, 0x2, 0);            // reset power
+       i365_out(s, 0x2, i365_in(s, 0x2) & 0x7f ); // cardenable off
+       i365_out(s, 0x2, 0);            // remove power
+       
+
+};
+int awc_i365_probe_once(struct i365_socket * s ){
+
+
+       int caps=i365_in(s, 0);
+       int ret;
+       unsigned long jiff;
+//     short rev       = 0x3000;
+       unsigned char cis [0x3e3];
+       unsigned char * mem = phys_to_virt(0xd000);
+       int i;
+       int port ;
+       
+       DEBUG(1," i365 control ID %x \n", caps);
+
+       if (caps & 0xC){
+               return 1;
+       };
+       
+       ret = i365_in(s, 0x1);
+
+       if ((ret & 0xC0) != 0xC0){
+               printk("card in socket %d port %x not in known state, %x \n",
+                       s->socket, s->offset_port, ret );
+               return -1;
+       };
+
+       
+       awc_i365_card_release(s);
+
+
+       udelay(100000);
+       
+       i365_out(s, 0x2, 0x10 );        // power enable
+       udelay(200000);
+       
+       i365_out(s, 0x2, 0x10 | 0x01 | 0x04 | 0x80);    //power enable
+       
+       udelay(250000);
+       
+       if (!s->irq)
+               s->irq = 11;
+       
+       i365_out(s, 0x3, 0x40 | 0x20 | s->irq);
+       
+       jiff = jiffies;
+       
+       while (jiffies-jiff < HZ ) 
+               if (i365_in(s,0x1) & 0x20)
+                       break;
+                       
+       if (! (i365_in(s,0x1) & 0x20) ){
+               printk("irq enable timeout on socket %x \n", s->socket);
+               return -1;
+       };
+       
+       i365_out(s,0x10,0xd0);
+       i365_out(s,0x11,0x0);
+       i365_out(s,0x12,0xd0);
+       i365_out(s,0x13,0x0);
+       i365_out(s,0x14,0x30 );
+       i365_out(s,0x15,0x3f | 0x40);           // enab mem reg bit
+       i365_out(s,0x06,0x01);                  // enab mem 
+       
+       udelay(10000);
+       
+       cis[0] = 0x45;
+       
+//     memcpy_toio( 0xd3e0, &(cis[0]),0x1);
+
+//     mem[0x3e0] = 0x0;
+//     mem[0] = 0x45;
+
+       mem[0x3e0] = 0x45;
+
+       udelay(10000);
+       
+       memcpy_fromio(cis,0xD000, 0x3e0);
+       
+       for (i = 0; i <= 0x3e2; i++)
+               printk("%02x", mem[i]);
+       for (i = 0; i <= 0x3e2; i++)
+               printk("%c", mem[i]);
+
+       i=0;    
+       while (i < 0x3e0){
+               if (cis[i] == 0xff)
+                       break;
+               if (cis[i] != 0x20 ){
+                       i = i + 2 + cis[i+1];
+                       continue;
+               }else {
+                       s->manufacturer = cis[i+2] | (cis[i+3]<<8);
+                       s->product      = cis[i+4] | (cis[i+5]<<8);
+                       break;
+               };
+               i++;
+       };
+       
+       DEBUG(1,"socket %x manufacturer %x product %x \n",
+               s->socket, s->manufacturer,s->product);
+
+       i365_out(s,0x07, 0x1 | 0x2);            // enable io 16bit
+       udelay(1000);
+       port = s->io;
+       i365_out(s,0x08, port & 0xff);
+       i365_out(s,0x09, (port & 0xff00)/ 0x100);
+       i365_out(s,0x0A, (port+port_range) & 0xff);
+       i365_out(s,0x0B, ((port+port_range) & 0xff00) /0x100);  
+
+       i365_out(s,0x06, 0x40);                 // enable io window
+
+       udelay(1000);
+
+       i365_out(s,0x3e0,0x45);
+       
+       outw(0x10, s->io);
+
+       jiff = jiffies;
+       while (!(inw(s->io + 0x30) & 0x10)){
+       
+               if (jiffies - jiff > HZ ){
+               
+                       printk("timed out waitin for command ack \n");
+                       break;
+               }
+       };
+
+       
+       outw(0x10, s->io + 0x34);
+       udelay(10000);
+       
+       return 0;
+       
+       
+
+               
+};
+
+
+static int awc_i365_init(struct i365_socket * s) {
+
+       struct NET_DEVICE * dev;
+       int i;
+
+
+       dev = init_etherdev(0, sizeof(struct awc_private) );
+
+//     dev->tx_queue_len = tx_queue_len;
+       ether_setup(dev);
+
+       dev->hard_start_xmit =          &awc_start_xmit;
+//     dev->set_config =               &awc_config_misiganes,aga mitte awc_config;
+       dev->get_stats =                &awc_get_stats;
+       dev->set_multicast_list =       &awc_set_multicast_list;
+
+       dev->init = &awc_init;
+       dev->open = &awc_open;
+       dev->stop = &awc_close;
+       dev->tbusy = 1;
+       dev->start  = 0;
+       dev->irq = s->irq;
+       dev->base_addr = s->io;
+
+
+       awc_private_init( dev);
+
+       i=0;
+       while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
+       if (!aironet4500_devices[i]){
+               aironet4500_devices[i]=dev;
+
+               ((struct awc_private *)
+               aironet4500_devices[i]->priv)->card_type = AIRONET4500_365;
+
+               if (awc_proc_set_fun)
+                       awc_proc_set_fun(i);
+       }
+
+       dev->tbusy = 1;
+       dev->start = 0;
+
+       
+       if (register_netdev(dev) != 0) {
+               printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
+               goto failed;
+       }
+
+       
+
+       return 0;
+  failed:
+       return -1;
+
+}
+
+static void awc_i365_release(void) {
+
+//     long flags;
+       int i=0;
+
+       DEBUG(0, "awc_detach \n");
+
+       i=0;
+       while ( i < MAX_AWCS) {
+       
+               if (!aironet4500_devices[i])
+                        {i++; continue;}
+
+               if (((struct awc_private *)aironet4500_devices[i]->priv)->card_type != AIRONET4500_365)
+                                 {i++;      continue;}
+
+               if (awc_proc_unset_fun)
+                       awc_proc_unset_fun(i);
+
+               unregister_netdev(aironet4500_devices[i]);
+
+               //kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
+               kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+
+               aironet4500_devices[i]=0;
+
+
+               i++;
+       }
+       
+
+} 
+
+
+
+
+
+        
+        
+int awc_i365_probe(void) {
+
+       int i = 1;
+       int k = 0;
+       int ret = 0;
+       int found=0;
+       
+       struct i365_socket s;
+       /* Always emit the version, before any failure. */
+
+       if (!awc_i365_sockets) {
+               printk("        awc i82635 4x00: use bitfiel opts awc_i365_sockets=0x3 <- (1|2) to probe sockets 0 and 1\n");
+               return -1;
+       };
+
+       while (k < 4){
+               if (i & awc_i365_sockets){
+
+                       s.offset_port   = awc_i365_offset_ports[k];
+                       s.data_port     = awc_i365_data_ports[k];
+                       s.socket        = k;
+                       s.manufacturer  = 0;
+                       s.product       = 0;
+                       s.irq           = awc_i365_irq[k];
+                       s.io            = awc_i365_io[k];
+                       
+                       ret = awc_i365_probe_once(&s);
+                       if (!ret){
+                               if (awc_i365_init(&s))
+                                       goto failed;
+                               else found++;
+                       } else if (ret == -1)
+                               goto failed;
+               };
+               k++;
+               i *=2;
+       };
+
+       if (!found){
+               printk("no aironet 4x00 cards found\n");
+               return -1;
+       }
+       return 0;
+
+failed: 
+       awc_i365_release();
+       return -1;
+       
+
+}
+
+#endif /* CONFIG_AIRONET4500_365 */
+
+#ifdef MODULE        
+int init_module(void)
+{
+       int found = 0;
+
+       printk("%s\n ", awc_version);
+               
+#ifdef CONFIG_AIRONET4500_PCI
+       if (awc4500_pci_probe(NULL) == -ENODEV){
+               printk("PCI 4X00 aironet cards not found\n");
+       } else {
+               found++;
+               printk("PCI 4X00 found some cards \n");
+       }
+#endif
+#ifdef CONFIG_AIRONET4500_PNP
+       if (awc4500_pnp_probe(NULL) == -ENODEV){
+               printk("PNP 4X00 aironet cards not found\n");
+       } else {
+               found++;
+               printk("PNP 4X00 found some cards \n");
+       }
+#endif
+#ifdef CONFIG_AIRONET4500_365
+       if ( awc_i365_probe() == -1) {
+               printk("PCMCIA 4X00 aironet cards not found for i365(without card services) initialization\n");
+       } else {
+                found++ ;
+                printk("PCMCIA 4X00 found some cards, take care, this code is not supposed to work yet \n");
+       }
+#endif
+#ifdef CONFIG_AIRONET4500_ISA
+       if (awc4500_isa_probe(NULL) == -ENODEV){
+               printk("ISA 4X00 aironet ISA-bus non-PNP-mode cards not found\n");
+       } else {
+               found++;
+               printk("ISA 4X00 found some cards \n");
+       }
+#endif
+       if (!found) return -1;
+       return 0;
+       
+
+}
+
+void cleanup_module(void)
+{
+       DEBUG(0, "awc_cs: unloading %c ",'\n');
+#ifdef CONFIG_AIRONET4500_PCI  
+       awc_pci_release();
+#endif
+#ifdef CONFIG_AIRONET4500_PNP
+       awc_pnp_release();
+#endif
+#ifdef CONFIG_AIRONET4500_365
+       awc_i365_release();
+#endif
+#ifdef CONFIG_AIRONET4500_ISA
+       awc_isa_release();
+#endif
+
+}
+#endif
\ No newline at end of file
diff --git a/drivers/net/aironet4500_core.c b/drivers/net/aironet4500_core.c
new file mode 100644 (file)
index 0000000..2462d9d
--- /dev/null
@@ -0,0 +1,3226 @@
+/*
+ *      Aironet 4500 Pcmcia driver
+ *
+ *             Elmer Joandi, Januar 1999
+ *     Copyright Elmer Joandi, all rights restricted
+ *     
+ *
+ *     Revision 0.1 ,started  30.12.1998
+ *
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/if_arp.h>
+#include <linux/ioport.h>
+
+#include <asm/io.h>
+#include <asm/bitops.h>
+#include <asm/system.h>
+#include <asm/byteorder.h>
+#include <asm/irq.h>
+#include <linux/time.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+#include "aironet4500.h"
+
+
+int bap_sleep = 10 ;
+int bap_sleep_after_setup = 1;
+int sleep_before_command  = 1;
+int bap_sleep_before_write= 1;
+int sleep_in_command     = 1;
+
+EXPORT_SYMBOL(bap_sleep);
+EXPORT_SYMBOL(bap_sleep_after_setup);
+EXPORT_SYMBOL(sleep_before_command);
+EXPORT_SYMBOL(bap_sleep_before_write);
+EXPORT_SYMBOL(sleep_in_command);
+
+struct awc_strings awc_status_error_codes[]=awc_reply_error_strings;
+struct awc_strings awc_command_names[]=awc_command_name_strings;
+struct awc_strings awc_link_status_names[]=awc_link_status_strings;
+struct awc_strings awc_rid_names[]=aironet4500_RID_Select_strings;
+struct awc_strings awc_link_failure_reason_names[]=IEEE_802_11_LINK_STATUS_FAILURE_REASON_STRINGS;
+
+const char *  awc_print_string( struct awc_strings* strings, int code){
+       
+       struct awc_strings * str = strings;
+       int i = 0;
+       while (str[i].string != NULL){
+               if (str[i].par == (code & str[i].mask )){
+                       return str[i].string;
+               };
+               i++;
+       };
+       return "UNKNOWN";
+};
+
+int awc_dump_registers(struct NET_DEVICE * dev){
+
+#ifdef AWC_DEBUG
+       int i;
+#endif
+       int status= inw(dev->base_addr +4*2);   
+       int r1= inw(dev->base_addr +5*2);       
+       int r2= inw(dev->base_addr +6*2);       
+       int r3= inw(dev->base_addr +7*2);       
+
+       printk(KERN_ERR "Command %s , result: %s, at memblk %x(RID %s) , offset %x \n",
+               awc_print_string(awc_command_names,status), 
+               awc_print_string(awc_status_error_codes,r1),
+               r2, awc_print_string(awc_rid_names,r2),
+               r3);
+
+#ifdef AWC_DEBUG
+       printk(KERN_ERR "%s aironet register dump ",dev->name );
+  
+                               
+       for (i=0; i < 32; i++){
+               printk("%4x ", inw(dev->base_addr + i*2 ) );
+               if ( (i+1)%8 == 0){
+                       printk("\n");
+                       printk(KERN_ERR "%02x",(i+1)*2);
+               }
+       };
+       printk(KERN_ERR " \n");
+#endif
+       return 0;                       
+};
+          
+/******************************                COMMAND         ******************/
+
+
+inline 
+int    awc_command_busy_clear_wait(struct NET_DEVICE * dev){
+//     long long jiff = jiffies;
+        u16  active_interrupts;
+        int  cnt= 0;
+        
+       AWC_ENTRY_EXIT_DEBUG(" entry awc_command_busy_clear_wait ");
+                    
+       while (awc_command_busy(dev->base_addr)){
+               if (cnt > 1000 ){
+                       printk(KERN_ERR "awc command busy too long, clearing\n");
+                       awc_dump_registers(dev);
+                       awc_event_ack_ClrStckCmdBsy(dev->base_addr);
+                       break;
+               };
+               if (((struct awc_private*) dev->priv)->ejected)
+                       return -1;
+               cnt++;
+               udelay(10);
+       }
+       
+       cnt = 0;
+       while (awc_command_busy(dev->base_addr)){
+               //if (jiffies - jiff > (HZ/3)){
+               if (cnt > 30000 ){
+                       printk(KERN_CRIT "awc command busy WAY too long, clearing\n");
+                       awc_dump_registers(dev);
+                       awc_event_ack_ClrStckCmdBsy(dev->base_addr);
+                       active_interrupts = awc_event_status(dev->base_addr);
+                       awc_event_ack(dev->base_addr, active_interrupts);
+                                                       
+                       AWC_ENTRY_EXIT_DEBUG("BAD exit\n ");
+                       return -1 ;
+                       
+               };
+               if (((struct awc_private*) dev->priv)->ejected)
+                       return -1;
+               cnt++;
+               udelay(10);
+       }
+
+       
+       AWC_ENTRY_EXIT_DEBUG(" exit\n ");
+            
+       return 0;
+         
+
+};
+
+
+
+inline unsigned short 
+awc_issue_command_and_block(struct awc_command * cmd){
+
+       int ticks;               
+     long long jiff;
+     u16       enabled_interrupts;
+     int cnt = 0;
+//     unsigned long flags;
+     
+     jiff = jiffies; 
+          
+
+  AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command_and_block ");
+               
+     DOWN(&cmd->priv->command_semaphore);
+
+//     save_flags(flags);
+//    cli();
+
+     if (awc_command_busy_clear_wait(cmd->dev))                goto final;
+
+     if (cmd->priv->sleeping_bap) udelay(sleep_before_command);                
+
+     awc4500wout(cmd->port,cmd->command,cmd->par0,cmd->par1,cmd->par2);
+//     awc_dump_registers(cmd->dev);
+
+
+     if (cmd->priv->sleeping_bap) udelay(sleep_in_command);
+     
+     enabled_interrupts = awc_ints_enabled(cmd->dev->base_addr);
+     awc_ints_enable(cmd->dev->base_addr, enabled_interrupts & ~0x10);
+      if(cmd->priv->enabled_interrupts & 0x10)
+       cmd->priv->enabled_interrupts &= ~0x10;
+
+       
+     while ( awc_command_read(cmd->port) == cmd->command) {
+                 udelay(1);
+          awc_command_write(cmd->port, cmd->command);
+          //if ((jiffies - jiff) > 2){
+         if (cnt > 2000 ){
+               printk(" long wait with commmand reg busy in blocking command \n");
+               awc_dump_registers(cmd->dev);
+               goto final;
+          };
+          if (cmd->priv->ejected)
+               goto final;
+         cnt++;
+         udelay(10);
+
+     };
+     AWC_ENTRY_EXIT_DEBUG(" issued " ); 
+
+     ticks = 0;
+     while ( awc_event_status_Cmd(cmd->port) == 0) {
+         ticks++;
+          if (ticks > 100000){
+               printk(" long wait with commmand reg busy \n");
+               awc_dump_registers(cmd->dev);
+                       goto final;
+          };
+         if (ticks > 500){
+              DEBUG(1, " long wait after issue 10mks * %d ", ticks ); 
+               //printk(" long wait with command reg busy about ticks\n");
+               // sti();
+          }
+          if (cmd->priv->ejected)
+               goto final;
+         udelay(10);
+     }            
+     if (cmd->priv->sleeping_bap) udelay(sleep_in_command);     
+
+     awc_read_response(cmd);
+     AWC_ENTRY_EXIT_DEBUG(" resp read \n"); 
+
+     if (awc_command_busy(cmd->port)) 
+       awc_event_ack_ClrStckCmdBsy(cmd->port);
+
+     awc_event_ack_Cmd(cmd->port);
+    if (cmd->priv->sleeping_bap) udelay(sleep_in_command);     
+     if (cmd->status & 0xff00){
+       printk(KERN_ERR " bad response to command %s, parameter %x \n",awc_print_string(awc_command_names, cmd->command),cmd->par0);
+       awc_dump_registers(cmd->dev);
+       goto final;      
+     } 
+
+ //    restore_flags(flags);   
+     UP(&cmd->priv->command_semaphore);
+     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+    udelay(1);
+     return 0;
+final: 
+//     restore_flags(flags);
+     UP(&cmd->priv->command_semaphore);
+     AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+     return -1; ;
+};
+
+
+inline 
+unsigned short 
+awc_issue_command(struct awc_command * cmd){
+
+
+//     long long jiff = jiffies;          
+//     unsigned short enabled_ints;               
+     int cnt = 0;
+//     int i=0; 
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command");
+     
+     if (!cmd){
+       printk(KERN_CRIT "cmd == NULL in awc_issue_command\n");
+       return -1;
+     
+     }
+     if (!cmd->dev){
+       printk(KERN_CRIT "cmd->dev == NULL in awc_issue_command\n");
+       return -1;
+     
+     }
+
+     DOWN(&cmd->priv->command_semaphore);      
+
+     if(awc_command_busy_clear_wait(cmd->dev))         goto final;                     
+
+      if(!cmd->priv->enabled_interrupts & 0x10){
+       cmd->priv->enabled_interrupts |= 0x10;
+       awc_ints_enable(cmd->port, cmd->priv->enabled_interrupts );
+      }
+
+     cmd->priv->async_command_start = jiffies;
+     cmd->priv->command_semaphore_on++;
+
+
+     awc4500wout(cmd->port,cmd->command,cmd->par0,cmd->par1,cmd->par2);
+     
+     while ( awc_command_read(cmd->port) == cmd->command) {
+       
+          awc_command_write(cmd->port, cmd->command);
+          //if ((jiffies - jiff) > 2){
+          if (cnt > 2000) {  
+               printk(" long wait with commmand reg busy in async command \n");
+               awc_dump_registers(cmd->dev);
+               goto final;
+          };
+          if (cmd->priv->ejected)
+               goto final;
+          cnt++;
+         udelay(10);
+     };
+     
+     cmd->priv->cmd = *cmd;
+     
+     
+     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+     return 0;
+ final:
+     UP(&cmd->priv->command_semaphore);
+     AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+
+};
+
+inline 
+unsigned short 
+awc_issue_command_no_ack(struct NET_DEVICE * dev,
+                       u16 com, u16 par1, u16 par2, u16 par3){
+
+     struct awc_private * priv = (struct awc_private *)dev->priv;
+     int cnt = 0;
+     long long jiff;
+     jiff = jiffies;          
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_command_no_ack ");
+     
+               
+     DOWN(&priv->command_semaphore);   
+
+     if (awc_command_busy_clear_wait(dev)) {
+               printk("aironet4x00 no_ack command (reset) with stuck card \n");
+     }
+
+     awc4500wout(dev->base_addr,com, par1, par2,par3);
+
+     udelay(10);     
+     while ( awc_event_status_Cmd(dev->base_addr) == 0) {
+          if (awc_command_read(dev->base_addr) == com) {                
+               awc_command_write(dev->base_addr, com);
+          }
+          //if ((jiffies - jiff) > 2){
+          if (cnt > 2000) {  
+               printk(" long wait with commmand reg busy in noack command %d par %d %d %d\n",com,par1,par2,par3);
+               awc_dump_registers(dev);
+                       goto final;
+          };
+          if (priv->ejected)
+               goto final;
+         udelay(10);
+         cnt++;
+     }            
+     
+     if (awc_command_busy(dev->base_addr)) 
+       awc_event_ack_ClrStckCmdBsy(dev->base_addr);
+
+     UP(&priv->command_semaphore);
+     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+ return 0;
+final: 
+     UP(&priv->command_semaphore);
+     AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+};
+
+
+/********************************      BAP     *************************/
+
+inline 
+int awc_bap_setup(struct awc_command * cmd) {
+
+       int status;
+       long long jiff;
+       unsigned long flags;    
+       int cleared = 0;
+       int cycles = 0;
+       
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_setup ");
+       
+     if ( cmd->priv->sleeping_bap)
+       udelay(bap_sleep);
+       
+       if (cmd->priv->ejected)
+               return -1;
+          
+     if (!cmd->bap || !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED)))
+       DEBUG(1,"no bap or bap not locked cmd %d !!", cmd->command);
+
+         
+         status = AWC_IN(cmd->bap->offset);
+         
+         if (status & ~0x2000 ){
+               WAIT61x3;
+               status = AWC_IN(cmd->bap->offset);
+         }
+
+         if (status & ~0x2000 ){
+                WAIT61x3;
+               AWC_IN(cmd->dev->base_addr + 0x26);
+                AWC_OUT(cmd->dev->base_addr + 0x26, 0);    
+               WAIT61x3;
+               udelay(60);
+               #ifdef AWC_DEBUG
+                       printk("b");
+               #endif
+               status = AWC_IN(cmd->bap->offset);
+         }
+
+         
+         if (status & 0xC000){
+               printk(KERN_ERR "bap entered with err or busy bit set %x \n",status);
+               if (cmd->bap->lock != 1) 
+                       printk(KERN_ERR "bap lock bad same time %x\n",cmd->bap->lock);
+               awc_dump_registers(cmd->dev);
+               //      AWC_OUT(cmd->bap->offset, 0x800);
+         }
+
+//       save_flags(flags);
+//       cli();
+           
+          AWC_OUT(cmd->bap->select, cmd->rid);
+         WAIT61x3;
+          AWC_OUT(cmd->bap->offset, cmd->offset);
+//          restore_flags(flags);
+
+         WAIT61x3;          
+          
+          jiff = jiffies;
+
+          while (1) {
+              cycles++;
+              status = AWC_IN(cmd->bap->offset);
+              if ( cmd->priv->sleeping_bap)
+                       udelay(bap_sleep);
+              if (cmd->priv->ejected)
+                       return -1;
+             udelay(1);
+             if (cycles > 10000) {
+                       printk(KERN_CRIT "deadlock in bap\n");
+                       return AWC_ERROR;
+             };
+              status = AWC_IN(cmd->bap->offset);
+              if (status & AWC_BAP_BUSY) {
+                 if (cycles % 100 == 99 ) {
+                      save_flags(flags);
+                      cli();
+                      if (!cleared){
+                       AWC_IN(cmd->dev->base_addr + 0x26);
+                       AWC_OUT(cmd->dev->base_addr + 0x26, 0);
+                       WAIT61x3;
+                       cleared = 1;
+                      }  
+                      AWC_OUT(cmd->bap->select, cmd->rid);
+                      WAIT61x3;
+                      AWC_OUT(cmd->bap->offset, cmd->offset);
+                      restore_flags(flags);
+                       #ifdef AWC_DEBUG
+                               printk("B");
+                       #endif      
+                      
+                      if ( cmd->priv->sleeping_bap)
+                       udelay(bap_sleep);
+                     else udelay(30);
+                      //restart_timeout();
+                  }
+                  if (jiffies - jiff > 1 ) {
+                       AWC_ENTRY_EXIT_DEBUG(" BAD BUSY  exit \n");
+                       awc_dump_registers(cmd->dev);
+                       return AWC_ERROR;
+                  }
+                  continue;
+              }
+             if (status & AWC_BAP_DONE) {
+                  WAIT61x3; WAIT61x3; WAIT61x3;
+                  
+                //  if ((status & 0xfff) != cmd->offset)
+                //     printk(KERN_ERR "awcPBD %x ",status);
+                   AWC_ENTRY_EXIT_DEBUG(" exit \n");
+                  if (cmd->priv->sleeping_bap)
+                       udelay(bap_sleep_after_setup); 
+                   
+                  // success
+                  return AWC_SUCCESS;
+              }
+
+              if (status & AWC_BAP_ERR) {
+                 AWC_ENTRY_EXIT_DEBUG(" BAD  exit \n");
+                  // invalid rid or offset
+                  printk(KERN_ERR "bap setup error bit set for rid %x offset %x \n",cmd->rid,cmd->offset);
+                  awc_dump_registers(cmd->dev);
+                  return AWC_ERROR;
+              }
+              if ( cmd->priv->sleeping_bap)
+                       udelay(bap_sleep);
+              else udelay(1);
+              // -- awc missed it, try again
+         
+              save_flags(flags);
+              cli();
+              AWC_OUT(cmd->bap->select, cmd->rid);
+              WAIT61x3;
+              AWC_OUT(cmd->bap->offset, cmd->offset);
+              WAIT61x3;
+              restore_flags(flags);
+               
+             if (jiffies - jiff > HZ)
+             if (! (status &(AWC_BAP_ERR |AWC_BAP_DONE |AWC_BAP_BUSY))){
+               printk("aironet4500: bap setup lock without any status bits set");
+               awc_dump_registers(cmd->dev);
+                return AWC_ERROR;
+
+             };
+         
+          }
+          
+     AWC_ENTRY_EXIT_DEBUG(" WE MUST NOT BE HERE exit \n");
+}
+
+
+       // requires call to awc_bap_setup() first
+inline 
+int
+awc_bap_read(struct awc_command * cmd) {
+       register u16 len;
+       register u16 * buff = (u16 *) cmd->buff;
+       register u16 port= cmd->bap->data;
+
+
+        AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_read ");
+       if (!cmd->bap && !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED)))
+               DEBUG(0,"no bap or bap not locked %d !!", cmd->command);
+        cmd->len = (cmd->len + 1) & (~1);               // round up to even value
+        len = cmd->len / 2;
+       if (cmd->priv->ejected)
+                       return -1;
+
+
+       if (cmd->priv->sleeping_bap)
+               udelay(bap_sleep_before_write);
+               
+        if (!cmd->priv->sleeping_bap)
+               while ( len-- > 0) 
+                       *buff++ = AWC_IN(port);
+       else 
+               while ( len-- > 0){
+                       *buff++ = AWC_IN(port);
+               }
+       AWC_ENTRY_EXIT_DEBUG(" exit  \n");
+       if (cmd->priv->ejected)
+                       return -1;
+               
+        return AWC_SUCCESS;
+}
+
+      // requires call to awc_bap_setup() first
+inline 
+int
+awc_bap_write(struct awc_command * cmd){
+          register u16 len;
+          register u16 * buff = (u16 *) cmd->buff;
+          register u16 port= cmd->bap->data;
+          
+           
+      AWC_ENTRY_EXIT_DEBUG(" entry awc_bap_write ");
+      if (!cmd->bap && !(cmd->lock_state & (AWC_BAP_SEMALOCKED |AWC_BAP_LOCKED)))
+               DEBUG(0,"no bap or bap not locked %d !!", cmd->command);
+     
+          cmd->len = (cmd->len + 1) & (~1);               // round up to even value
+          len = cmd->len / 2;
+
+         if (cmd->priv->ejected)
+                       return -1;
+
+         if (cmd->priv->sleeping_bap)
+               udelay(bap_sleep_before_write);
+
+
+          if (!cmd->priv->sleeping_bap)
+               while (len-- > 0) 
+                       AWC_OUT(port, *buff++);
+          else
+               while ( len-- > 0){
+                       AWC_OUT(port, *buff++);
+               }
+         if (cmd->priv->ejected)
+                       return -1;
+
+
+      AWC_ENTRY_EXIT_DEBUG(" exit  \n");
+               
+          return AWC_SUCCESS;
+}
+
+
+
+
+/*****************************         RID READ/WRITE  ********************/
+
+const struct aironet4500_rid_selector  aironet4500_RID_Select_General_Config   =(const struct aironet4500_rid_selector){ 0xFF10, 1,0,0, "General Configuration" }; //        See notes General Configuration        Many configuration items.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_SSID_list                =(const struct aironet4500_rid_selector){ 0xFF11, 1,0,0, "Valid SSID list" }; //          See notes Valid SSID list              List of SSIDs which the station may associate to.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_list          =(const struct aironet4500_rid_selector){ 0xFF12, 1,0,0, "Valid AP list" }; //          See notes Valid AP list                List of APs which the station may associate to.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Driver_name      =(const struct aironet4500_rid_selector){ 0xFF13, 1,0,0, "Driver name" }; //          See notes Driver name                  The name and version of the driver (for debugging)
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Encapsulation    =(const struct aironet4500_rid_selector){ 0xFF14, 1,0,0, "Ethernet Protocol" }; //          See notes Ethernet Protocol            Rules for encapsulating ethernet payloads onto 802.11.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_volatile     =(const struct aironet4500_rid_selector){ 0xFF15, 1,0,0, "WEP key volatile" }; //          
+const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_nonvolatile  =(const struct aironet4500_rid_selector){ 0xFF16, 1,0,0, "WEP key non-volatile" }; //
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Modulation       =(const struct aironet4500_rid_selector){ 0xFF17, 1,0,0, "Modulation" }; //
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Active_Config    =(const struct aironet4500_rid_selector){ 0xFF20, 0,1,1, "Actual Configuration" }; //          Read only      Actual Configuration    This has the same format as the General Configuration.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Capabilities     =(const struct aironet4500_rid_selector){ 0xFF00, 0,1,0, "Capabilities" }; //          Read Only      Capabilities            PC4500 Information
+const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_Info          =(const struct aironet4500_rid_selector){ 0xFF01, 0,1,1, "AP Info" }; //          Read Only      AP Info                 Access Point Information
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Radio_Info       =(const struct aironet4500_rid_selector){ 0xFF02, 0,1,1, "Radio Info" }; //          Read Only      Radio Info              Radio Information -- note radio specific
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Status           =(const struct aironet4500_rid_selector){ 0xFF50, 0,1,1, "Status" }; //          Read Only      Status                  PC4500 Current Status Information
+const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats         =(const struct aironet4500_rid_selector){ 0xFF60, 0,1,1, "Cumulative 16-bit Statistics" }; //          Read Only      16-bit Statistics       Cumulative 16-bit Statistics
+const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_delta   =(const struct aironet4500_rid_selector){ 0xFF61, 0,1,1, "Delta 16-bit Statistics" }; //          Read Only      16-bit Statistics       Delta 16-bit Statistics (since last clear)
+const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_clear   =(const struct aironet4500_rid_selector){ 0xFF62, 0,1,1, "Delta 16-bit Statistics and Clear" }; //          Read Only /    16-bit Statistics       Delta 16-bit Statistics and Clear
+const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats         =(const struct aironet4500_rid_selector){ 0xFF68, 0,1,1, "Cumulative 32-bit Statistics" }; //          Read Only      32-bit Statistics       Cumulative 32-bit Statistics
+const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_delta   =(const struct aironet4500_rid_selector){ 0xFF69, 0,1,1, "Delta 32-bit Statistics"  }; //          Read Only      32-bit Statistics       Delta 32-bit Statistics (since last clear)
+const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_clear   =(const struct aironet4500_rid_selector){ 0xFF6A, 0,1,1, "Delta 32-bit Statistics and Clear" }; //          Read Only /    32-bit Statistics       Delta 32-bit Statistics and Clear
+
+EXPORT_SYMBOL(aironet4500_RID_Select_General_Config); 
+EXPORT_SYMBOL(aironet4500_RID_Select_SSID_list); 
+EXPORT_SYMBOL(aironet4500_RID_Select_AP_list); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Driver_name); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Encapsulation); 
+EXPORT_SYMBOL(aironet4500_RID_Select_WEP_volatile); 
+EXPORT_SYMBOL(aironet4500_RID_Select_WEP_nonvolatile); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Modulation); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Active_Config); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Capabilities); 
+EXPORT_SYMBOL(aironet4500_RID_Select_AP_Info); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Radio_Info); 
+EXPORT_SYMBOL(aironet4500_RID_Select_Status); 
+EXPORT_SYMBOL(aironet4500_RID_Select_16_stats); 
+EXPORT_SYMBOL(aironet4500_RID_Select_16_stats_delta); 
+EXPORT_SYMBOL(aironet4500_RID_Select_16_stats_clear); 
+EXPORT_SYMBOL(aironet4500_RID_Select_32_stats); 
+EXPORT_SYMBOL(aironet4500_RID_Select_32_stats_delta); 
+EXPORT_SYMBOL(aironet4500_RID_Select_32_stats_clear); 
+
+
+struct awc_rid_dir awc_rids_temp[]={
+       // following MUST be consistent with awc_rids_setup !!!
+   {&aironet4500_RID_Select_General_Config,            0x100 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_SSID_list,                          0x68 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_AP_list,                    0x20 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_Driver_name,                0x12 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_Encapsulation,              0x22 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_Active_Config,             0x100 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_Capabilities,               0x80 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_Status,                     0x6c , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_AP_Info,                    0x06 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_32_stats,                  0x184 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_32_stats_delta,            0x184 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_32_stats_clear,            0x184 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_WEP_volatile,              0x1c , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_WEP_nonvolatile,           0x1c , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_Modulation,                0x04 , NULL, NULL, NULL,0 },
+
+#ifdef AWC_USE_16BIT_STATS
+   {&aironet4500_RID_Select_16_stats,                  0xC2 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_16_stats_delta,            0xC2 , NULL, NULL, NULL,0 },
+   {&aironet4500_RID_Select_16_stats_clear,            0xC2 , NULL, NULL, NULL,0 },
+#else 
+   {NULL},{NULL},{NULL},
+#endif 
+   {0} 
+
+
+};
+
+
+
+int 
+awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){
+         struct awc_command cmd;
+
+         int sleep_state ;
+
+       AWC_ENTRY_EXIT_DEBUG(" entry awc_readrid ");
+          if (!rid) return -1;
+          if (!rid->selector) return -1;
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
+               rid->selector->selector, rid->offset, (rid->bits / 8),pBuf);
+
+         sleep_state = cmd.priv->sleeping_bap ;
+         cmd.priv->sleeping_bap = 1;
+         udelay(500);
+         if (awc_issue_command_and_block(&cmd))        goto final;
+         AWC_BAP_LOCK_NOT_CLI(cmd);
+         udelay(1);
+          if (awc_bap_setup(&cmd))                     goto final;
+          udelay(1);
+          if (awc_bap_read(&cmd))                      goto final;
+          cmd.priv->sleeping_bap = sleep_state;
+         AWC_BAP_UNLOCK(cmd);
+
+
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+     final:
+         cmd.priv->sleeping_bap = sleep_state;
+         AWC_RELEASE_COMMAND(cmd);
+         AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+}
+
+int 
+awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){
+
+         struct awc_command cmd;
+         int sleep_state ;
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_writerid ");
+     
+
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
+               rid->selector->selector,rid->offset, rid->bits/8,pBuf);
+
+         sleep_state = cmd.priv->sleeping_bap ;
+         cmd.priv->sleeping_bap = 1;
+
+         udelay(500);
+         AWC_BAP_LOCK_NOT_CLI(cmd);      
+         if (awc_issue_command_and_block(&cmd))        goto final;
+         udelay(10);
+          if (awc_bap_setup(&cmd))                     goto final;
+          udelay(10);
+          if (awc_bap_write(&cmd))                     goto final;
+          udelay(10);  
+          cmd.command=0x121;
+         if (awc_issue_command_and_block(&cmd))        goto final;
+          AWC_BAP_UNLOCK(cmd);
+          cmd.priv->sleeping_bap = sleep_state;
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+     final:
+         cmd.priv->sleeping_bap = sleep_state;
+         AWC_RELEASE_COMMAND(cmd);
+         AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+}
+
+int 
+awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){
+         struct awc_command cmd;
+         int sleep_state;
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awcreadrid_dir ");
+     
+
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
+               rid->selector->selector,0, rid->bufflen,rid->buff);
+
+         sleep_state = cmd.priv->sleeping_bap ;
+         cmd.priv->sleeping_bap = 1;
+
+         udelay(500);
+         if (awc_issue_command_and_block(&cmd))        goto final;
+
+         AWC_BAP_LOCK_NOT_CLI(cmd);
+         
+          if (awc_bap_setup(&cmd))                     goto final;
+          if (awc_bap_read(&cmd))                      goto final;
+          cmd.priv->sleeping_bap = sleep_state;
+         AWC_BAP_UNLOCK(cmd);
+         
+
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+     final:
+         cmd.priv->sleeping_bap = sleep_state;
+         AWC_RELEASE_COMMAND(cmd);
+         AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+}
+
+int 
+awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid){
+
+         struct awc_command cmd;
+         int sleep_state ;
+
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_writerid_dir ");
+     
+
+
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x21, rid->selector->selector,
+               rid->selector->selector,0, rid->bufflen,((char *)rid->buff));
+
+         sleep_state = cmd.priv->sleeping_bap ;
+         cmd.priv->sleeping_bap = 1;
+
+         udelay(500);
+         if (awc_issue_command_and_block(&cmd))        goto final;
+
+         AWC_BAP_LOCK_NOT_CLI(cmd);
+          if (awc_bap_setup(&cmd))                     goto final;
+          if (awc_bap_write(&cmd))                     goto final;
+          cmd.priv->sleeping_bap = sleep_state;
+         AWC_BAP_UNLOCK(cmd);
+                   
+          cmd.command=0x121;
+          udelay(500);
+         if (awc_issue_command_and_block(&cmd))        goto final;
+
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+     final:
+         cmd.priv->sleeping_bap = sleep_state;
+         AWC_RELEASE_COMMAND(cmd);
+         AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+}
+
+EXPORT_SYMBOL(awc_readrid);
+EXPORT_SYMBOL(awc_writerid);
+EXPORT_SYMBOL(awc_readrid_dir);
+EXPORT_SYMBOL(awc_writerid_dir);
+
+/*****************************         STARTUP         *******************/
+
+
+inline
+int
+awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){
+
+         struct awc_command cmd;
+//       struct awc_private * priv = (struct awc_private *)dev->priv;
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_issue_blocking_command ");
+     
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,comm,0, 0, 0, 0 ,0 );
+          
+          if (awc_issue_command_and_block(&cmd))
+               goto final;
+
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+     final:
+         AWC_RELEASE_COMMAND(cmd);
+         AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+         return -1; ;
+         
+};
+
+int 
+awc_issue_soft_reset(struct NET_DEVICE * dev){
+
+       u16 status ;
+//     int i= 0;
+
+/*     outw(inw(dev->base_addr + 0x30), dev->base_addr + 0x32);
+       udelay(10);
+       outw(inw(dev->base_addr + 0x30), dev->base_addr + 0x34);
+
+       for (i=0; i< 32; i++)
+               outw(0,dev->base_addr + i*2);
+       udelay(100);
+       outw(0x6,dev->base_addr + 0x34);
+       udelay(100);
+       outw(0x6,dev->base_addr + 0x34);
+       outw(0x6,dev->base_addr + 0x34);
+                WAIT61x3;
+               AWC_IN(dev->base_addr + 0x26);
+                AWC_OUT(dev->base_addr + 0x26, 0);    
+               WAIT61x3;
+               udelay(60);
+       
+
+       outw(0x4, dev->base_addr);
+       udelay(1000);
+        WAIT61x3;
+        AWC_IN(dev->base_addr + 0x26);
+        AWC_OUT(dev->base_addr + 0x26, 0);    
+       WAIT61x3;
+       udelay(60);
+*/
+
+       status =  awc_issue_command_no_ack(dev, AWC_COMMAND_SOFT_RESET,0,0,0);
+       
+//     awc_command_busy_clear_wait(dev);
+
+       return status;
+};
+
+int
+awc_issue_noop(struct NET_DEVICE * dev){
+       int retval;
+       AWC_OUT(dev->base_addr + 0x28, 0);
+       AWC_OUT(dev->base_addr + 0x2A, 0);
+       udelay(1000);
+       retval= awc_issue_blocking_command(dev, AWC_COMMAND_NOOP);
+       udelay(1000);
+       return retval;
+};
+
+EXPORT_SYMBOL(awc_enable_MAC);
+
+int
+awc_enable_MAC(struct NET_DEVICE * dev){
+        
+   struct awc_private * priv = (struct awc_private *)dev->priv;
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_enable_MAC ");
+            
+        if (priv->mac_enabled){
+        
+               AWC_ENTRY_EXIT_DEBUG(" mac already enabled exit \n"); 
+               return 0;
+        }
+        udelay(500);
+       if (awc_issue_blocking_command(dev, AWC_COMMAND_ENABLE)){
+               AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+          return -1; ;
+       }
+        udelay(500);
+
+       priv->mac_enabled = 1;
+     
+       AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+       return 0;
+};
+
+EXPORT_SYMBOL(awc_disable_MAC);
+int
+awc_disable_MAC(struct NET_DEVICE * dev){
+        
+   struct awc_private * priv = (struct awc_private *)dev->priv;
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_disable_MAC ");
+            
+        if (!priv->mac_enabled){
+               AWC_ENTRY_EXIT_DEBUG(" mac allready disabled exit \n"); 
+               return 0;
+        }
+        udelay(1000);
+       if (awc_issue_blocking_command(dev, AWC_COMMAND_DISABLE)){
+               AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+               return -1; ;
+       }
+       udelay(1000);
+       priv->mac_enabled = 0;
+        AWC_ENTRY_EXIT_DEBUG(" exit \n");
+       return 0;
+};
+
+
+
+int
+awc_read_all_rids(struct NET_DEVICE * dev){
+
+       struct awc_private * priv = (struct awc_private *)dev->priv;
+       int status,i;
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_read_all_rids ");
+                                   
+       for (i=0; i< AWC_NOF_RIDS && priv->rid_dir[i].selector  ; i++){
+               status = awc_readrid_dir(dev,&priv->rid_dir[i]);
+               udelay(50);
+               if (status) return status;
+                               
+       }
+       priv->rids_read = 1;
+       
+     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+     return 0;
+}
+
+int
+awc_write_all_rids(struct NET_DEVICE * dev){
+
+       struct awc_private * priv = (struct awc_private *)dev->priv;
+       int i,status ;
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_write_all_rids ");
+                                   
+       for (i=0;i < 5 &&  i< AWC_NOF_RIDS && priv->rid_dir[i].selector  ; i++){
+            status = awc_writerid_dir(dev,&priv->rid_dir[i]);
+            udelay(10);
+            if(status) return status;
+       }
+     AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+     return 0;
+}
+
+/**************************    FID QUEUES ****************************/
+/****************************  TX  ALLOC / DEALLOC     ***************/
+
+
+
+int  awc_tx_alloc(struct NET_DEVICE * dev) {
+
+         struct awc_command cmd;
+         int k=0;
+         int tot=0;
+        struct awc_fid * fid = NULL;
+        
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_alloc ");
+         
+
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x0A,0, 0,0,0,NULL);
+         cmd.par0 = dev->mtu + AWC_TX_HEAD_SIZE + 8 ;
+
+         DEBUG(32,"about to allocate %x bytes ",cmd.priv->large_buff_mem);
+         DEBUG(32,"in %x large buffers ",cmd.priv->large_buff_mem / (dev->mtu + AWC_TX_HEAD_SIZE + 8) );
+               
+         k=0;tot=0;
+         while (k < cmd.priv->large_buff_mem / (dev->mtu + AWC_TX_HEAD_SIZE + 8) ) {
+               
+               fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL );
+               if (!fid)       goto final;
+               memset(fid, 0, sizeof(struct awc_fid));
+
+               if (awc_issue_command_and_block(&cmd))          goto final;
+               
+               while ( awc_event_status_Alloc(cmd.port) == 0) ;
+               fid->u.tx.fid           = awc_Tx_Allocated_Fid(cmd.port);
+               fid->u.tx.fid_size      = dev->mtu + AWC_TX_HEAD_SIZE ;
+               
+               DEBUG(32,"allocated large tx fid %x ",fid->u.tx.fid);
+               if(fid->u.tx.fid == 0
+                  || cmd.status != 0xA){
+                       printk(KERN_ERR "%s bad tx_alloc\n",dev->name);
+                       fid->busy =1;
+                       goto final;
+               } else {
+                       fid->busy =0;
+                       tot++;
+               }
+               awc_event_ack_Alloc(cmd.port);
+               
+               // shoudlnt goto final after that
+               awc_fid_queue_push_tail(&cmd.priv->tx_large_ready,fid);
+                               
+               k++;
+         }
+         cmd.priv->tx_buffs_total = tot;
+         DEBUG(32,"allocated %d large tx buffs\n",tot);
+
+         cmd.par0 = AWC_TX_ALLOC_SMALL_SIZE ;
+         k =0; tot = 0;
+
+         while (k < cmd.priv->small_buff_no) {
+               
+               fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL );
+               if (!fid)       goto final;
+               memset(fid, 0, sizeof(struct awc_fid));
+
+               cmd.par0 = AWC_TX_ALLOC_SMALL_SIZE ;
+
+               if (awc_issue_command_and_block(&cmd))          goto final;
+               
+               while ( awc_event_status_Alloc(cmd.port) == 0) ;
+               fid->u.tx.fid           = awc_Tx_Allocated_Fid(cmd.port);
+               fid->u.tx.fid_size      = AWC_TX_ALLOC_SMALL_SIZE;
+               
+               DEBUG(32,"allocated large tx fid %x ",fid->u.tx.fid);
+               if(fid->u.tx.fid == 0
+                  || cmd.status != 0xA){
+                       printk(KERN_ERR "%s bad tx_alloc\n",dev->name);
+                       fid->busy =1;
+                       goto final;
+               } else {
+                       fid->busy =0;
+                       tot++;
+               }
+               awc_event_ack_Alloc(cmd.port);
+               
+               // shoudlnt goto final after that
+               awc_fid_queue_push_tail(&cmd.priv->tx_small_ready,fid);
+                               
+               k++;
+         }
+
+         cmd.priv->tx_small_buffs_total = tot;
+         DEBUG(32,"allocated %d small tx buffs\n",tot);
+
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+
+     final:
+         if (fid ) 
+               kfree(fid);
+         printk(KERN_CRIT "%s awc tx prealloc failed \n",dev->name);
+         AWC_RELEASE_COMMAND(cmd);
+         AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+         return -1; ;
+
+};
+
+int 
+awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){
+
+         struct awc_command cmd;
+         int fid_handle = 0;
+         
+          AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0x0C,0, 0,0,0,NULL);
+
+         if (fid->u.tx.fid){
+                       fid_handle = cmd.par0 = fid->u.tx.fid;
+                       fid->u.tx.fid = 0;
+                       fid->busy =0;
+                       kfree(fid);
+
+                       if (!cmd.priv->ejected)
+                               if (awc_issue_command_and_block(&cmd))  goto final;
+                                               //awc_event_ack_Alloc(cmd.port);
+         }
+
+         AWC_RELEASE_COMMAND(cmd);
+          AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+         return 0;
+
+         final:
+               printk(KERN_ERR "awc_tx_dealloc failed for fid %x \n",fid_handle);
+               AWC_RELEASE_COMMAND(cmd);
+               AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+         return -1; ;
+
+
+};
+
+int
+awc_tx_dealloc(struct NET_DEVICE * dev){
+
+       struct awc_private * priv = (struct awc_private *)dev->priv;
+
+
+
+//       int k=0;
+         struct awc_fid * fid;
+         
+          AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_dealloc ");
+     
+         while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_large_ready)))
+               awc_tx_dealloc_fid(dev,fid);
+         while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_small_ready)))
+               awc_tx_dealloc_fid(dev,fid);
+         while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_post_process)))
+               awc_tx_dealloc_fid(dev,fid);
+         while (NULL != (fid = awc_fid_queue_pop_head(&priv->tx_in_transmit)))
+               awc_tx_dealloc_fid(dev,fid);
+       
+         return 0;
+
+};
+
+
+
+inline struct awc_fid *
+awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle){
+
+       struct awc_private * priv = (struct awc_private *)dev->priv;
+//     int k = 0;
+       unsigned long flags;
+       struct awc_fid * fid = NULL;
+       int cnt=0;
+       
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_fid_lookup ");
+
+       my_spin_lock_irqsave(&(priv->queues_lock),flags);
+
+
+       fid = priv->tx_in_transmit.head;
+       cnt = 0;
+       while (fid){
+               if (fid->u.tx.fid == fid_handle){
+                       awc_fid_queue_remove(&priv->tx_in_transmit, fid);
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return fid;
+               }
+               fid = fid->next;
+       //      printk("iT\n");
+               if (cnt++ > 200) {
+       //              printk("bbb in awc_fid_queue\n");
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return 0;
+               };
+       };
+
+       cnt=0;
+       fid = priv->tx_post_process.head;
+       while (fid){
+               if (fid->u.tx.fid == fid_handle){
+                       awc_fid_queue_remove(&priv->tx_post_process, fid);
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return fid;
+               }
+               fid = fid->next;
+       //      printk("pp\n");
+               if (cnt++ > 200) {
+       //              printk("bbb in awc_fid_queue\n");
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return 0;
+               };
+
+       };
+
+       cnt=0;
+       fid = priv->tx_large_ready.head;
+       while (fid){
+               if (fid->u.tx.fid == fid_handle){
+                       awc_fid_queue_remove(&priv->tx_large_ready, fid);
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return fid;
+               }
+               fid = fid->next;
+       //      printk("lr\n");
+               if (cnt++ > 200) {
+       //              printk("bbb in awc_fid_queue\n");
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return 0;
+               };
+
+       };
+       cnt=0;
+       fid = priv->tx_small_ready.head;
+       while (fid){
+               if (fid->u.tx.fid == fid_handle){
+                       awc_fid_queue_remove(&priv->tx_small_ready, fid);
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return fid;
+               }
+               fid = fid->next;
+       //      printk("sr\n");
+               if (cnt++ > 200) {
+       //              printk("bbb in awc_fid_queue\n");
+                       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+                       return 0;
+               };
+
+       };
+
+       my_spin_unlock_irqrestore(&(priv->queues_lock),flags);
+       
+       printk(KERN_ERR "%s tx fid %x not found \n",dev->name, fid_handle);  
+        AWC_ENTRY_EXIT_DEBUG(" BAD exit \n");            
+       return NULL;
+}
+
+
+
+
+
+int 
+awc_queues_init(struct NET_DEVICE * dev){
+       struct awc_private * priv = (struct awc_private *)dev->priv;
+       struct awc_fid * fid = NULL;
+       int retv =0;
+       int k = 0;
+
+       awc_fid_queue_init(&priv->tx_in_transmit);
+       awc_fid_queue_init(&priv->tx_post_process);
+       awc_fid_queue_init(&priv->tx_large_ready);
+       awc_fid_queue_init(&priv->tx_small_ready);
+       awc_fid_queue_init(&priv->rx_ready);
+       awc_fid_queue_init(&priv->rx_post_process);
+
+       retv = awc_tx_alloc(dev);
+
+       k = 0;
+       while (k < AWC_RX_BUFFS){
+               fid = kmalloc(sizeof(struct awc_fid),GFP_KERNEL);
+               if (!fid) return -1;
+               awc_fid_queue_push_tail(&priv->rx_ready,fid);
+               k++;
+       };
+
+       if (retv) return retv;
+
+       return 0;       
+};
+
+
+int 
+awc_queues_destroy(struct NET_DEVICE * dev){
+       struct awc_private * priv = (struct awc_private *)dev->priv;
+       struct awc_fid * fid = NULL;
+       int retv =0;
+       
+
+
+       while (NULL != (fid = awc_fid_queue_pop_head(&priv->rx_ready))){
+               kfree(fid);
+       }
+       while (NULL != (fid = awc_fid_queue_pop_head(&priv->rx_post_process))){
+               kfree(fid);
+       }
+
+       retv = awc_tx_dealloc(dev);
+
+       return retv;    
+};
+
+
+
+/******************************        802.11router    ******************/
+inline int 
+awc_802_11_copy_path_skb(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
+
+       struct awc_private * priv = (struct awc_private * )dev->priv;
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_copy_path_skb");
+
+        if (rx_buff->pkt_len < 22 ) rx_buff->pkt_len = 22;
+        
+//     if (!rx_buff->skb)
+               rx_buff->skb =  dev_alloc_skb(rx_buff->pkt_len + 12 +2);
+       
+       
+       if (rx_buff->skb == NULL) {
+               printk(KERN_CRIT "couldnt alloc rx_buff->skb in rx event \n");
+               priv->stats.rx_dropped++;
+               return -1;
+       }
+       rx_buff->type |= p80211copy_path_skb;
+       
+       rx_buff->skb->dev = dev;
+
+//     skb_reserve(rx_buff->skb, rx_buff->pkt_len + 12 );
+
+       rx_buff->u.rx.payload = skb_put(rx_buff->skb, rx_buff->pkt_len + 12 ) ;
+       rx_buff->u.rx.payload  = ((char *)rx_buff->u.rx.payload ) +12;
+
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+
+       return 0;
+
+
+};
+
+
+int
+awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
+
+//        struct awc_private * priv = (struct awc_private * )dev->priv;
+//        u8 is_802_3 = 0;
+//     int i = 0;
+
+       rx_buff->type =0;
+
+       return awc_802_11_copy_path_skb(dev,rx_buff);
+};
+
+
+/*     called from INTERRUPT context,
+
+       must deliver the packet to where it was meant by 
+               awc_802_11_find_copy_path
+       
+       SHOULD be efficient and
+       queue the packet if operations take longer
+
+*/ 
+
+
+int parse_not_8023= 0;
+       
+void
+awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
+
+        struct awc_private * priv = (struct awc_private * )dev->priv;
+       struct sk_buff * skb = rx_buff->skb;
+       u8 * payload = rx_buff->u.rx.payload;
+//     u8 * p802_3_macs_place = payload -12;
+       u16    pkt_len = rx_buff->pkt_len;      
+       struct ieee_802_11_802_1H_header * bridge = NULL;
+       struct ieee_802_11_snap_header * snap = NULL;
+       struct ieee_802_11_802_1H_header * bridge_tmp;
+       struct ieee_802_11_snap_header * snap_tmp;
+
+       u16     ptr = 0;
+       u16     len;
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_router_rx");
+
+//     if (rx_buff->type & p80211_8023)
+               rx_buff->mac = rx_buff->u.rx.ieee_802_3.dst_mac;
+//     else    
+//             rx_buff->mac = rx_buff->u.rx.ieee_802_11.mac1;  
+
+       if ( rx_buff->u.rx.ieee_802_11.frame_control == 0x8 )   
+               memcpy(priv->bssid,rx_buff->u.rx.ieee_802_11.mac3,6);
+       
+       while ((ptr < pkt_len - 1 ) && payload && parse_not_8023){
+
+               bridge_tmp      = (struct ieee_802_11_802_1H_header*) &payload[ptr];
+               snap_tmp        = (struct ieee_802_11_snap_header*) &payload[ptr];
+               len             = ntohs( *((u16*)&payload[ptr]) );
+
+               
+
+               if (  len < 0x5DC)      { // not a protocol
+                       
+                       if ( len != pkt_len-2 - ptr){
+                               printk(KERN_ERR "%s bad encapsulation lenght %x at pkt offset %x \n",dev->name,len,ptr);
+                               goto bad_packet;
+                       }
+                       DEBUG(1,"parisng packet of size %x\n",len);
+                       ptr +=2;
+                       continue;
+               }       
+               
+               DEBUG(1,"parisng packet of proto %x\n",len);
+               
+               if (snap_tmp->dsap == 0xaa &&  snap_tmp->ssap == 0xaa &&
+                   pkt_len - ptr > sizeof(struct ieee_802_11_snap_header) ){
+                       
+                       DEBUG(0x200,"%s SNAP ",dev->name);
+                       if (snap_tmp->ctrl != 0x03){
+                               printk(KERN_ERR "%s unknown snap ctrl %x \n",dev->name,snap_tmp->ctrl);
+                               goto bad_packet;
+                       };
+                       if (snap_tmp->oui[0] == 0 && // LLC RFC1042
+                           snap_tmp->oui[1] == 0 &&
+                           snap_tmp->oui[2] == 0 ){
+                               snap =  snap_tmp;
+                               ptr +=  sizeof(struct ieee_802_11_snap_header);
+                               DEBUG(0x200,"%s LLC RFC1042 \n",dev->name);
+                               continue;
+                       }
+                       if (snap_tmp->oui[0] == 0 && // LLC 802.1H
+                           snap_tmp->oui[1] == 0 &&
+                           snap_tmp->oui[2] == 0x78){
+                               snap = snap_tmp;
+                               DEBUG(0x200,"%s LLC 802.1H \n",dev->name);
+                               ptr +=  sizeof(struct ieee_802_11_snap_header);
+                               continue;  
+                       };
+                       if (snap_tmp->oui[0] == 0x00 && // 802.1H itself
+                           snap_tmp->oui[1] == 0x40 &&
+                           snap_tmp->oui[2] == 0x96){
+                               ptr +=  sizeof(struct ieee_802_11_802_1H_header);
+                               if (ptr >= pkt_len){
+                                       goto bad_packet;
+                                       DEBUG(1,"%s invalid packet len in 802.1H SNAP OUI check \n",dev->name);
+                               }
+                               DEBUG(0x200,"%s OUI 004096  \n",dev->name);
+                               DEBUG(0x200," 802.1H uknown1 %x  ",ntohs(bridge_tmp->unknown1));
+                               DEBUG(0x200," 802.1H uknw type %x  \n",0xf000 & ntohs(bridge_tmp->unknown2));
+                               DEBUG(0x200," 802.1H payloadsize %x  \n",0x0fff & ntohs(bridge_tmp->unknown2));
+                               
+                               //goto bad_packet; // TODO
+                               
+                               bridge = bridge_tmp;
+                               if (bridge_tmp->unknown1 == 0x0000 &&
+                                    ((ntohs(bridge_tmp->unknown2) & 0xf000) == 0x1000 ) ){
+                                    rx_buff->type |= p80211_8021H;
+                                    rx_buff->mac   = &payload[ptr];
+                                    DEBUG(0x200," 802.1H DATA packet of size %x\n",0xf000 & ntohs(bridge_tmp->unknown2) );
+                                    memcpy(priv->p2p,rx_buff->u.rx.ieee_802_11.mac2, 6);
+                                    ptr +=12;
+                                    continue;
+                               };
+                               DEBUG(0x200,"%s droping unknown  004096 packet \n ",dev->name);
+                               goto bad_packet;
+                               
+                        
+                       }
+                       goto bad_packet;
+               }
+               if ( len > 0x5DC){ 
+                       // packet without linklevel header for us
+               
+                       if (  len == 0x8000 ||  len == 0x8006){
+                       
+                               DEBUG(0x200,"Non IP packet %x \n",ntohs(len));
+                       
+                       };
+                       goto good_packet;
+               
+               };
+               
+               goto good_packet;
+       }
+       
+   good_packet:
+
+       if (ptr > pkt_len)      goto bad_packet;
+
+       if ( rx_buff->mac != (payload + ptr -12) )
+               memcpy( payload +ptr -12, rx_buff->mac , 12);
+
+       
+       
+       if (!payload || !skb || !rx_buff->skb || !rx_buff->u.rx.payload)
+               return ;
+       //skb->ip_summed = CHECKSUM_NONE;
+       skb->data = payload + ptr -12;
+       skb->len += ptr ;
+       
+       rx_buff->skb->protocol = eth_type_trans(rx_buff->skb,dev);
+       DEBUG(0x200,"eth_type_trans decided: %x\n",rx_buff->skb->protocol);
+       rx_buff->skb = NULL;
+       rx_buff->u.rx.payload = NULL;
+       priv->stats.rx_packets++;
+       netif_rx(skb);
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+       return ;
+
+   bad_packet:
+       DEBUG(0x200,"%s packet dropped in packet hdr parse \n ",dev->name);
+       if (rx_buff->skb && (rx_buff->type & p80211copy_path_skb)){
+
+               FREE_SKB(rx_buff->skb);         
+               rx_buff->skb = NULL;
+               rx_buff->u.rx.payload = NULL;
+       };
+
+       AWC_ENTRY_EXIT_DEBUG("exit\n"); 
+
+};
+
+void
+awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
+       struct awc_private * priv = (struct awc_private * )dev->priv;
+
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_failed_rx_copy");
+       if (rx_buff->skb)
+                FREE_SKB(rx_buff->skb);
+        rx_buff->skb = NULL;
+        rx_buff->u.rx.payload = NULL;
+       priv->stats.rx_errors++;
+
+
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+};
+
+/*
+       called from kernel->driver tx routine
+       must decide where and how to post the packet 
+       must post the packet to wherever it decides
+       either copy to card or enqueue to destination queue
+
+*/
+
+
+int
+awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
+                                struct sk_buff * skb){
+
+
+       struct awc_private * priv = (struct awc_private * )dev->priv;
+       int i;
+       int len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; /* check min length*/
+       struct awc_fid * fid = NULL;
+//     u16 saved_fid ;
+       u16 p2p_direct =priv->p2p_found;
+//     struct iphdr * ip_hdr;
+       //buffer = skb->data;
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_tx_find_path_and_post");       
+
+       DOWN(&priv->tx_buff_semaphore);
+       if (len  > dev->mtu + 16 ) {
+               printk(KERN_ERR "%s packet size too large %d \n",dev->name, len);
+               goto final;
+       }
+
+       if (len + AWC_TX_HEAD_SIZE < AWC_TX_ALLOC_SMALL_SIZE  )
+               fid = awc_fid_queue_pop_head(&priv->tx_small_ready);
+
+       if (!fid)
+               fid = awc_fid_queue_pop_head(&priv->tx_large_ready);
+                       
+       if (!fid) {
+               DEBUG(32,"%s buffs in use \n",dev->name);
+               goto no_space;
+       }               
+/*
+       if (fid->u.tx.fid_size < len + AWC_TX_HEAD_SIZE){
+               awc_fid_queue_push_tail(&priv->tx_small_ready, fid);
+               fid = awc_fid_queue_pop_head(&priv->tx_large_ready);
+       }
+*/
+       if (!fid) {
+              DEBUG(32,"%s buffs in use \n",dev->name);
+              goto no_space;
+       }
+       
+       if (fid->u.tx.fid_size < len + AWC_TX_HEAD_SIZE - 14){  
+               printk(KERN_ERR "found too small tx fid size %d, pktlen %d \n",fid->u.tx.fid_size, len);
+       }
+       memset(&fid->u.tx.radio_tx,             0,sizeof(struct aironet4500_radio_tx_header));
+       memset(&fid->u.tx.ieee_802_11,  0,sizeof(struct ieee_802_11_header));
+       memset(&fid->u.tx.ieee_802_3,   0,sizeof(struct ieee_802_3_header));
+       fid->u.tx.payload =NULL;
+       fid->u.tx.gap_length =0;
+       fid->busy = 1;
+       
+       
+       priv->tx_buffs_in_use++;
+       DEBUG(32,"found large buff %x \n",fid->u.tx.fid);
+
+/*
+       fid->type |= p80211_llc_snap;
+       fid->snap.dsap = 0xaa; 
+       fid->snap.ssap = 0xaa; 
+       fid->snap.ctrl = 0x03;  
+       fid->snap.oui[0] = 0x0;
+       fid->snap.oui[1] = 0x0;
+       fid->snap.oui[2] = 0x0;
+*/
+       fid->skb = skb;
+
+
+       if (priv->p2p_uc && !priv->p2p_found){ // we go without encapsulation to neighbour;
+       
+               for (i=0; i < 6; i++)
+                       if (priv->p2p[i] != skb->data[i]){
+                               p2p_direct = 1;
+                               break;
+                       }       
+       };
+
+       if (tx_rate == 2 || tx_rate == 4 || tx_rate== 20 || tx_rate == 22)
+               fid->u.tx.radio_tx.tx_bit_rate  = tx_rate;
+       fid->u.tx.radio_tx.TX_Control = 
+               aironet4500_tx_control_tx_ok_event_enable |
+               aironet4500_tx_control_tx_fail_event_enable |
+               aironet4500_tx_control_no_release;
+
+/*     if (len < 100){
+               fid->u.tx.radio_tx.TX_Control |=
+                       aironet4500_tx_control_use_rts;
+       };
+*/
+/*     ip_hdr = skb->data + 14;
+       if (ip_hdr && skb->data[12] == 0x80 ){
+               if (ip_hdr->tos & IPTOS_RELIABILITY)
+                       fid->u.tx.radio_tx.TX_Control |=
+                           aironet4500_tx_control_use_rts;
+               if (ip_hdr->tos & IPTOS_THROUGHPUT)
+                       fid->u.tx.radio_tx.TX_Control |=
+                           aironet4500_tx_control_no_retries;
+       };
+*/     
+       if (priv->p802_11_send ||  memcmp(dev->dev_addr, skb->data +6, 6)  ){
+               fid->u.tx.radio_tx.TX_Control |=
+                       aironet4500_tx_control_header_type_802_11;      
+               DEBUG(0x200,"%s bridging, forcing 802_11 send \n ",dev->name);
+       }
+
+
+       if (!priv->p2p_uc || p2p_direct) {
+               if ((fid->u.tx.radio_tx.TX_Control &
+                                aironet4500_tx_control_header_type_802_11 )){
+
+                       // including 802.3 header into 802.11 packet
+                       fid->u.tx.radio_tx.PayloadLength        = len -12;
+                       fid->u.tx.ieee_802_3.payload_length = len -12 ;
+                       fid->pkt_len = len -12;
+                       fid->u.tx.payload = skb->data +12;
+
+                       if (!memcmp(dev->dev_addr, skb->data +6, 6)){   
+                               memcpy(fid->u.tx.ieee_802_11.mac1,skb->data,6);
+                               memcpy(fid->u.tx.ieee_802_11.mac2,skb->data +6,6);
+                               memcpy(fid->u.tx.ieee_802_11.mac3,priv->status.CurrentBssid ,6);
+                               memset(fid->u.tx.ieee_802_11.mac4,0,6);
+                               fid->u.tx.ieee_802_11.frame_control = 0x8;
+                               fid->u.tx.ieee_802_11.gapLen=6;
+                       } else {
+
+                               memcpy(fid->u.tx.ieee_802_11.mac1,skb->data,6);
+                               memcpy(fid->u.tx.ieee_802_11.mac2,dev->dev_addr,6);
+                               memcpy(fid->u.tx.ieee_802_11.mac3,skb->data +6 ,6);
+                               memset(fid->u.tx.ieee_802_11.mac4,0 ,6);
+                               fid->u.tx.ieee_802_11.frame_control = 0x108;
+                               fid->u.tx.ieee_802_11.gapLen=6;                 
+
+                       }
+               } else { // plain old 802.3, with hdr copied
+                       fid->u.tx.radio_tx.PayloadLength        = len -12;
+                       fid->u.tx.ieee_802_3.payload_length = len -12;
+                       fid->pkt_len = len - 12;
+                       fid->u.tx.payload = skb->data +12;
+               };      
+               memcpy(fid->u.tx.ieee_802_3.dst_mac,skb->data, 12);
+               DEBUG(0x200,"%s tx simply 802.3 type \n ",dev->name);           
+
+       } else {// 802.1H bridgeing
+               fid->type               |= p80211_8021H;
+               fid->bridge_size        = len + sizeof(fid->bridge) ;
+               fid->bridge.dsap        = 0xaa;
+               fid->bridge.ssap        = 0xaa;
+               fid->bridge.ctrl        = 0x03;
+               fid->bridge.oui[0] = 0x0;
+               fid->bridge.oui[1] = 0x40;
+               fid->bridge.oui[2] = 0x96;
+               fid->bridge.unknown1= 0x0000;
+               fid->bridge.unknown2= htons((len) & 0x1000);
+               fid->u.tx.radio_tx.PayloadLength        = fid->bridge_size + 2;
+               fid->u.tx.ieee_802_3.payload_length = fid->u.tx.radio_tx.PayloadLength ;
+               
+
+               fid->u.tx.payload = skb->data +12;
+               if ((fid->u.tx.radio_tx.TX_Control &
+                                aironet4500_tx_control_header_type_802_11 )){
+       
+                       memcpy(fid->u.tx.ieee_802_11.mac1,priv->p2p,6);
+                       memcpy(fid->u.tx.ieee_802_11.mac2,skb->data +6,6);
+                       memcpy(fid->u.tx.ieee_802_11.mac3,priv->bssid ,6);
+                       memset(fid->u.tx.ieee_802_11.mac4,0,6);
+                       fid->u.tx.ieee_802_11.gapLen=6;
+
+                       fid->u.tx.ieee_802_11.frame_control = 0x8;                 
+               }               
+               memcpy(fid->u.tx.ieee_802_3.dst_mac,priv->p2p, 6);
+               memcpy(fid->u.tx.ieee_802_3.src_mac,dev->dev_addr, 6);
+               fid->u.tx.payload = skb->data + 2 + sizeof(fid->bridge);
+               fid->pkt_len = len ;
+       
+               DEBUG(0x200,"%s tx simply 802.1H type \n ",dev->name);
+               
+       };
+       
+       
+       
+       awc_fid_queue_push_tail(&priv->tx_in_transmit,fid);
+       udelay(1);
+       awc_transmit_packet(dev,fid);
+       UP(&priv->tx_buff_semaphore);
+       if (priv->tx_large_ready.size > 0 ){
+               dev->tbusy = 0;
+               mark_bh(NET_BH);
+       }
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+       return 0;
+
+       
+   no_space:
+       DEBUG(32,"%s tx buffs not found \n ",dev->name);
+       #ifdef AWC_DEBUG
+//             printk("s");
+       #endif
+       dev->tbusy = 1; //weell, here it must be set anyway and before
+       //priv->stats.tx_fifo_errors++;
+       UP(&priv->tx_buff_semaphore);
+       AWC_ENTRY_EXIT_DEBUG("NoSpaceExit\n");
+       return 1 ;
+  final:
+       priv->stats.tx_errors++;
+       UP(&priv->tx_buff_semaphore);
+       dev->tbusy = 0;
+       FREE_SKB(skb);
+       mark_bh(NET_BH);
+       AWC_ENTRY_EXIT_DEBUG("BADExit\n");
+       return -1;
+  
+};
+
+/*
+       called from low level driver->card tx copy routine  
+       probably wants to free skbuf if failed transmits won't be
+       resubmitted to another device (if more than one path)
+       or tried again (if tx buffer in card needs to be filled again)
+*/  
+  
+  
+void
+awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev,
+                                        struct awc_fid * tx_buff){
+
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_tx_packet_to_card_write");
+
+       if (!tx_buff){
+               DEBUG(1,"%s no damn tx_buff in awc_802_11_after_tx_packet_to_card_write \n",dev->name);
+       };
+
+       if(tx_buff->skb){
+               FREE_SKB(tx_buff->skb);
+               tx_buff->skb = NULL;
+       }
+       mark_bh(NET_BH);
+
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+};
+
+/*
+        called from low level driver->card tx copy routine
+        probably wants to free skbuf if failed writes won't be
+        resubmitted to another device (if more than one path) 
+        or tried again (if tx buffer in card needs to be filled again)
+*/
+                        
+void
+awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,
+                                         struct awc_fid * tx_buff){
+        struct awc_private * priv = (struct awc_private *)dev->priv;
+
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_failed_tx_packet_to_card_write");
+
+       if (!tx_buff){
+               DEBUG(1,"%s no damn tx_buff in awc_802_11_after_failed_tx_packet_to_card_write \n",dev->name);
+       };
+
+       if(tx_buff->skb){
+               FREE_SKB(tx_buff->skb);
+               tx_buff->skb = NULL;
+               tx_buff->busy =0;
+               printk(KERN_ERR "%s packet to card write failed \n",dev->name);
+       }
+       
+       awc_fid_queue_remove(&priv->tx_in_transmit,tx_buff);
+       
+       if (tx_buff->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
+               awc_fid_queue_push_tail(&priv->tx_small_ready,tx_buff);
+       else 
+               awc_fid_queue_push_tail(&priv->tx_large_ready,tx_buff);
+
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+
+};
+                                         
+void 
+awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){
+
+        struct awc_private * priv = (struct awc_private *)dev->priv;
+
+       AWC_ENTRY_EXIT_DEBUG("awc_802_11_after_tx_complete");                
+
+       DEBUG(32,"tx complete status %x \n ",tx_buff->u.tx.radio_tx.Status);
+
+       #ifdef AWC_DEBUG
+        if (tx_buff->u.tx.radio_tx.Status)
+               printk("tf%x ",tx_buff->u.tx.radio_tx.Status);
+       #endif
+       if (tx_buff->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE){
+               awc_fid_queue_push_tail(&priv->tx_small_ready,tx_buff);
+               priv->tx_small_buffs_in_use--;
+       } else { 
+               awc_fid_queue_push_tail(&priv->tx_large_ready,tx_buff);
+               priv->tx_buffs_in_use--;
+       }
+
+       tx_buff->busy = 0;
+       dev->tbusy = 0;
+       mark_bh(NET_BH);
+
+       AWC_ENTRY_EXIT_DEBUG("exit\n");
+};
+
+                                                 
+
+
+/********************************      R X     ***********************/
+
+
+
+inline int
+awc_receive_packet(struct NET_DEVICE * dev){
+       
+    struct awc_command cmd;
+    u16        Fid;
+//    struct sk_buff *skb = NULL;
+    struct awc_fid * rx_buff;
+
+
+    struct awc_private * priv ;
+       int i;    
+    
+       priv= (struct awc_private *)dev->priv;
+       rx_buff = priv->rx_ready.head        ;
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_receive_packet ");
+     
+       Fid = awc_Rx_Fid(dev->base_addr);
+       
+       DEBUG(128," RX FID  %x  \n",Fid);
+
+       if (!Fid){
+               printk(KERN_CRIT "No RxFid when rx event \n");
+               return -1;
+       }
+
+
+       
+       if (!rx_buff){
+               printk(KERN_CRIT "No rx_buff in rx event \n");
+               return -1;
+       }
+
+       rx_buff->type   = 0;
+
+                       
+       AWC_INIT_COMMAND(AWC_CLI,cmd,dev,0,0,
+                       Fid, 0, 0x14 , &(rx_buff->u.rx.radio_rx));
+
+
+// header reading , order is important
+       AWC_BAP_LOCK_UNDER_CLI(cmd);
+
+       if (awc_bap_setup(&cmd))                goto final;
+       if (awc_bap_read(&cmd))         goto final;
+
+       DEBUG(128, "rx receive radio header, length %x \n",rx_buff->u.rx.radio_rx.PayloadLength);
+
+       cmd.buff        = &(rx_buff->u.rx.ieee_802_11);
+       cmd.len         = 0x20;
+
+       if (awc_bap_read(&cmd))         goto final;
+
+       DEBUG(128, "rx receive 802_11 header, framecontrol %x \n",rx_buff->u.rx.ieee_802_11.frame_control);
+
+       if (rx_buff->u.rx.ieee_802_11.gapLen > 8) {
+               printk(KERN_ERR "%s: 802.11 gap lenght huge %d \n",dev->name,rx_buff->u.rx.ieee_802_11.gapLen);
+               goto final;
+       }
+       DEBUG(128,"SeqCtl %x, 802_11 macs: ",rx_buff->u.rx.ieee_802_11.SeqCtl);
+       if (awc_debug & 0x7000){
+               DEBUG(0x7000, " %s mac1 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac1[i] )) ;
+               DEBUG(0x7000, " %s mac2 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac2[i] )) ;
+               DEBUG(0x7000, " %s mac3 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac3[i] )) ;
+               DEBUG(0x7000, " %s mac4 ",dev->name); for (i = 0; i < 6; i++) DEBUG(0x7000, "%02x:",((unsigned char)rx_buff->u.rx.ieee_802_11.mac4[i] )) ;
+       }       
+       DEBUG(128,"\n GapLen %d ",rx_buff->u.rx.ieee_802_11.gapLen );
+       
+       if (rx_buff->u.rx.ieee_802_11.gapLen > 0) {
+               cmd.buff     = rx_buff->u.rx.ieee_802_11.gap;
+               cmd.len      = rx_buff->u.rx.ieee_802_11.gapLen;
+               if (awc_bap_read(&cmd))      goto final;
+               DEBUG(128, "rx receive gap header , gap length %x \n",rx_buff->u.rx.gap_length);
+       }
+       for (i = 0; i < rx_buff->u.rx.ieee_802_11.gapLen ; i++) DEBUG(128,"%x",((unsigned char)rx_buff->u.rx.ieee_802_11.gap[i] )) ;
+
+        
+       if ( !(priv->config.ReceiveMode & RXMODE_DISABLE_802_3_HEADER ) 
+            ){
+               cmd.buff         = &(rx_buff->u.rx.ieee_802_3);
+               cmd.len          = 0x10;
+               rx_buff->type   |= p80211_8023;
+               if (awc_bap_read(&cmd))                         goto final;
+               DEBUG(128, "rx receive 802_3 header, payload length %x \n",rx_buff->u.rx.ieee_802_3.payload_length);
+               DEBUG(128,"\n 802_3 status %x ",rx_buff->u.rx.ieee_802_3.status );
+               DEBUG(128," RX payloadLen %x, dst,src: ",rx_buff->u.rx.ieee_802_3.payload_length);
+               if (awc_debug & 0x7000){
+                       for (i = 0; i < 6; i++) printk("%02x:",((unsigned char)rx_buff->u.rx.ieee_802_3.dst_mac[i] )) ;
+                       for (i = 0; i < 6; i++) printk("%02x:",((unsigned char)rx_buff->u.rx.ieee_802_3.src_mac[i] )) ;
+               }
+       };
+
+       rx_buff->pkt_len = rx_buff->u.rx.radio_rx.PayloadLength;
+       
+       if (priv->config.OperatingMode & MODE_LLC_HOST)
+               rx_buff->type   |= p80211_llc_snap;
+
+       
+       if (awc_802_11_find_copy_path(dev,rx_buff))             goto final;
+
+
+       if (rx_buff->u.rx.payload ){    
+               cmd.buff = rx_buff->u.rx.payload;
+               cmd.len  = rx_buff->pkt_len;
+               if (awc_bap_read(&cmd))                         goto final;
+               DEBUG(128, "rx payload read %x \n",rx_buff->u.rx.ieee_802_3.payload_length);
+       };
+       
+       AWC_BAP_UNLOCK(cmd);
+
+        DEBUG(128,"\n payload hdr %x ",rx_buff->u.rx.ieee_802_3.status );
+        if (awc_debug && rx_buff->u.rx.payload)
+               for (i = 0; i < 20; i++) DEBUG(128,"%x",((unsigned char)rx_buff->u.rx.payload[i] )) ;
+       DEBUG(128,"%c",'\n');
+
+       awc_802_11_router_rx(dev,rx_buff);
+
+       AWC_RELEASE_COMMAND(cmd);
+//     awc_event_ack_Rx(dev->base_addr);
+       AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+       return 0;
+     final:
+     
+        awc_802_11_failed_rx_copy(dev,rx_buff);
+       // if (skb) dev_kfree_skb(skb, FREE_WRITE);
+       AWC_RELEASE_COMMAND(cmd);
+//     awc_event_ack_Rx(dev->base_addr);
+       AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+       return -1; ;
+       
+};
+
+
+int
+awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) {
+       
+       struct awc_command cmd;
+       u16 size ;
+//     unsigned long flags;
+       int i;
+    struct awc_private * priv= (struct awc_private *)dev->priv;
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_transmit_packet ");
+     
+       if (priv->link_status_changed ){
+               priv->link_status_changed =0;
+               awc_readrid_dir(dev,&priv->rid_dir[7]);
+       }
+       
+
+        AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0xB, tx_buff->u.tx.fid,
+               tx_buff->u.tx.fid, 0, 0x14 , &(tx_buff->u.tx.radio_tx));
+       
+       AWC_BAP_LOCK_NOT_CLI(cmd);
+
+#ifdef AWC_BY_BOOK
+#warning  By books is bad, AWC_BY_BOOK  
+#error cli sti bad here
+       if (    !(tx_buff->type &(p80211_llc_snap|p80211_8021H) ) 
+            && !(tx_buff->u.tx.radio_tx.TX_Control &
+                          aironet4500_tx_control_header_type_802_11 )){
+       
+               cmd.buff=&(tx_buff->u.tx.radio_tx.TX_Control);
+               cmd.len = 0x2 ;
+               cmd.offset = 0x8;
+               save_flags(flags);
+               cli();
+               if (awc_bap_setup(&cmd))                goto final;        
+               if (awc_bap_write(&cmd))                goto final;
+
+               cmd.buff=&(tx_buff->u.tx.ieee_802_3.payload_length);
+               cmd.len = 14;
+               cmd.offset = 0x36;
+               if (awc_bap_setup(&cmd))                goto final;        
+               if (awc_bap_write(&cmd))                goto final;
+               restore_flags(flags);
+
+       } else {
+#endif
+                       
+               if (awc_bap_setup(&cmd))                goto final;        
+               if (awc_bap_write(&cmd))                goto final;
+        
+               DEBUG(64," wrote radio tx header for fid %x \n",tx_buff->u.tx.fid);
+
+               // 802.11
+               cmd.buff=&(tx_buff->u.tx.ieee_802_11);
+               cmd.len = 0x20;
+               if (awc_bap_write(&cmd))                goto final;
+
+               // Gap
+               if (tx_buff->u.tx.ieee_802_11.gapLen) {
+                       cmd.buff=&(tx_buff->u.tx.ieee_802_11.gap);
+                       cmd.len = tx_buff->u.tx.ieee_802_11.gapLen;
+                       if (awc_bap_write(&cmd))        goto final;
+               }
+               // 802.3
+               if ( !  (tx_buff->u.tx.radio_tx.TX_Control & 
+                       aironet4500_tx_control_header_type_802_11 )){
+                        
+                               cmd.buff=&(tx_buff->u.tx.ieee_802_3);
+                       if (awc_debug & 0x7000){
+                               printk("%s TX dst ",dev->name);
+                               for (i=0; i < 6; i++) printk ("%02x:",(unsigned char) tx_buff->u.tx.ieee_802_3.dst_mac[i]);
+                               printk(" src ");
+                               for (i=0; i < 6; i++) printk ("%02x:",(unsigned char) tx_buff->u.tx.ieee_802_3.src_mac[i]);
+                               printk(" \n ");
+                       }
+                               cmd.len = 0x10; 
+                               if (awc_bap_write(&cmd))        goto final;
+                       };
+                       
+                       if (tx_buff->type & p80211_llc_snap) {
+                               cmd.buff=       & tx_buff->snap;
+                               cmd.len =       sizeof(tx_buff->snap);
+                               if (awc_bap_write(&cmd))                goto final;
+               };
+        
+               if (tx_buff->type & p80211_8021H) {
+                               size = htons(tx_buff->bridge_size);  
+               //      size = tx_buff->bridge_size;// to seasure raw speed of f** UC  
+                               cmd.buff=       & size;
+                               cmd.len =       2 ;
+                       if (awc_bap_write(&cmd))                goto final;
+                       
+                               cmd.buff=       & tx_buff->bridge;
+                               cmd.len =       sizeof(tx_buff->bridge);
+                               if (awc_bap_write(&cmd))                goto final;
+               };
+                
+#ifdef AWC_BY_BOOK              
+                
+       }
+#endif
+               cmd.buff=       tx_buff->u.tx.payload;
+               cmd.len =       tx_buff->pkt_len;
+
+               if (awc_bap_write(&cmd))                        goto final;
+
+      
+        AWC_BAP_UNLOCK(cmd);
+
+       if (awc_issue_command_and_block(&cmd))          goto final;
+//     if (awc_issue_command(&cmd))            goto final;
+       tx_buff->transmit_start_time = jiffies;
+       awc_802_11_after_tx_packet_to_card_write(dev,tx_buff);                  
+           // issue the transmit command
+
+
+       AWC_RELEASE_COMMAND(cmd);
+        AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+       return 0;
+     final:
+       awc_802_11_after_failed_tx_packet_to_card_write(dev,tx_buff);
+               
+       printk(KERN_CRIT "%s awc tx command failed \n",dev->name);
+       AWC_RELEASE_COMMAND(cmd);
+       AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+       return -1; ;
+}
+
+
+inline int
+awc_tx_complete_check(struct NET_DEVICE * dev){
+
+       struct awc_fid  * fid;
+       struct awc_command cmd;
+
+
+     AWC_ENTRY_EXIT_DEBUG(" entry awc_tx_complete_check ");
+     
+               
+
+       fid = awc_fid_queue_pop_head(&((struct awc_private *)dev->priv)->tx_post_process);
+       
+       if (!fid) {
+               printk("awc_tx_complete_check with empty queue \n ");
+               return -1;
+       }
+
+       DEBUG(64," tx_complete fid %x \n",fid->u.tx.fid);
+       
+        AWC_INIT_COMMAND(AWC_NOT_CLI,cmd,dev,0,0, fid->u.tx.fid,
+                               0, 0x14 , &(fid->u.tx.radio_tx));
+
+       fid->state  |= awc_tx_fid_complete_read;
+
+       AWC_BAP_LOCK_NOT_CLI(cmd);
+        if (awc_bap_setup(&cmd))               goto final;
+        if (awc_bap_read(&cmd))                        goto final;
+        AWC_BAP_UNLOCK(cmd);
+        
+       awc_802_11_after_tx_complete(dev,fid);                  
+
+       
+       AWC_RELEASE_COMMAND(cmd);
+        AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+       return 0;
+        
+     final:
+        awc_802_11_after_tx_complete(dev,fid);
+        printk(KERN_ERR "%s awc_tx_complete_check failed \n",dev->name);
+       AWC_RELEASE_COMMAND(cmd);
+       AWC_ENTRY_EXIT_DEBUG("  BAD exit \n");
+       return -1; ;
+}
+
+
+#define AWC_QUEUE_BH {\
+       if (!priv->bh_active && !priv->bh_running){\
+               priv->bh_active = 1;\
+               queue_task(&priv->immediate_bh, &tq_immediate);\
+               mark_bh(IMMEDIATE_BH);\
+       }\
+       }
+
+
+void
+awc_bh(struct NET_DEVICE *dev){
+
+        struct awc_private * priv = (struct awc_private *)dev->priv;
+       int  active_interrupts;
+       int enabled_interrupts;
+//     u16     tx_status;
+       int     multi_ints = 0;
+//     u16     tx_fid = 0;
+//     unsigned long flags;
+
+       DEBUG(8, "awc_bh awoken on jiffie %ld \n",jiffies);
+
+       priv->bh_running = 1;
+       
+       active_interrupts = awc_event_status(dev->base_addr);
+       
+        enabled_interrupts = awc_ints_enabled(dev->base_addr);
+
+       DEBUG(8, "awc_bh active ints %x \n",active_interrupts);
+
+        if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) {
+//             printk(KERN_ERR "tx chain active in bh \n");
+//             queue_task(&priv->immediate_bh, &tq_immediate);
+               goto bad_end;
+       }
+start:
+       if (active_interrupts == 0xffff){
+       
+               printk(KERN_CRIT "%s device ejected in interrupt, disabling\n",dev->name);
+               dev->tbusy = 1;
+               dev->start = 0;
+               if (priv->command_semaphore_on){
+                       priv->command_semaphore_on--;
+                       UP(&priv->command_semaphore);
+               }
+               priv->tx_chain_active =0;
+               goto bad_end;
+                   
+       }
+
+       if (priv->unlock_command_postponed ){
+       
+          priv->unlock_command_postponed-- ;
+          if( priv->command_semaphore_on ){
+               
+               awc_read_response((&priv->cmd));
+               priv->async_command_start = 0;
+               if (priv->command_semaphore_on){
+               
+                       priv->command_semaphore_on--;
+                       UP(&priv->command_semaphore);
+               }
+           }
+       };
+
+/*        if ( active_interrupts & 0x1 ){
+                       awc_receive_packet(dev) ;
+                       awc_event_ack_Rx(dev->base_addr);
+                       priv->waiting_interrupts &= ~0x1;
+       }
+*/
+       while (priv->tx_post_process.size)
+               if (awc_tx_complete_check(dev)) break;
+       
+       active_interrupts = awc_event_status(dev->base_addr);
+
+       if (priv->command_semaphore_on || priv->tx_post_process.size){
+                       if (multi_ints++ < 10000){
+                               goto start;
+                       }
+               };
+               priv->bh_active  = 0;
+               priv->bh_running = 0;
+
+        priv->tx_chain_active = 0;
+
+       
+
+  bad_end:
+//     if (!priv->tx_chain_active) 
+//             wake_up(&priv->tx_chain_wait_queue);
+  
+       priv->bh_running = 0;
+       priv->bh_active = 0;
+       return ;
+};
+
+
+inline int
+awc_interrupt_process(struct NET_DEVICE * dev){
+
+       struct awc_private * priv ;
+       int  active_interrupts;
+       int enabled_interrupts;
+       u16     tx_status;
+       int     multi_ints = 0;
+       u16     tx_fid = 0;
+//     u16     ints_to_ack =0;
+       struct awc_fid  * fid = NULL;
+//     int interrupt_reenter = 0;
+       unsigned long flags;    
+
+       save_flags(flags);
+       cli();
+//     disable_irq(dev->irq);
+
+       DEBUG(2," entering interrupt handler %s ",dev->name);
+
+       if (!dev) {
+               printk(KERN_ERR "No dev in interrupt   \n");
+               goto bad_end;
+       };
+
+       priv = (struct awc_private *)dev->priv;
+
+       if (!priv) {
+               printk(KERN_ERR "No PRIV in interrupt \n");
+               goto bad_end;
+       };
+
+
+        enabled_interrupts = awc_ints_enabled(dev->base_addr);
+       active_interrupts = awc_event_status(dev->base_addr);
+
+       DEBUG(2,"entry: processing interrupts waiting %x \n",priv->waiting_interrupts);
+       DEBUG(2,"entry: processing interrupts active  %x \n",active_interrupts);
+       DEBUG(2,"entry: processing interrupts enabled %x \n",enabled_interrupts);
+//     printk("ikka interruptis\n");
+
+
+        if (test_and_set_bit( 0, (void *) &dev->interrupt) ) {
+               printk("RI\n");
+               goto reenter_end_here;
+       }
+       priv->interrupt_count++;
+       if (priv->interrupt_count > 1 )
+               printk(" interrupt count on\n ");
+
+
+
+       if (priv->waiting_interrupts & active_interrupts)
+               printk(KERN_ERR "double interrupt waiting %x active %x \n",
+                               priv->waiting_interrupts, active_interrupts);
+
+ //       priv->waiting_interrupts |= active_interrupts;
+
+
+
+
+
+start:
+       DEBUG(2,"Start processing int, times %d\n",multi_ints);
+       
+       if (active_interrupts == 0xffff){
+       
+               printk(KERN_CRIT "%s device ejected, got interrupt, disabling\n",dev->name);
+               //priv->
+               dev->tbusy = 1;
+               dev->start = 0;
+               priv->ejected = 1;
+               if (priv->bh_active || priv->bh_running){
+                       priv->interrupt_count--;
+                       dev->interrupt = 0;
+                       goto bad_end;
+               } else if (priv->command_semaphore_on){
+                       
+                       printk(KERN_ERR "ejected, last BH fired \n");
+                       
+                        AWC_QUEUE_BH;    
+               }
+               priv->interrupt_count--;
+               dev->interrupt = 0;
+               goto bad_end;
+       }
+
+       
+
+       if (active_interrupts & 0x100 ){
+               awc_event_ack_Awaken(dev->base_addr);
+               udelay(10);
+               DEBUG(1,"%s device awoke \n",dev->name);
+               priv->waiting_interrupts &= ~0x100;
+       };
+       if (active_interrupts & 0x80 ){
+       
+               priv->link_status = awc_Link_Status(dev->base_addr);
+               DEBUG(1,"link status changed %x \n",priv->link_status);
+               awc_event_ack_Link(dev->base_addr);
+               priv->waiting_interrupts &= ~0x80;
+               if(priv->link_status == 0x400)
+                                       printk(KERN_INFO "%s Associated\n",dev->name );
+               else { 
+                       printk(KERN_INFO "%s Link status change : %s \n",dev->name, awc_print_string(awc_link_status_names, priv->link_status) );
+                       if (    priv->link_status & 0x8100  ||
+                               priv->link_status & 0x0100  ||
+                               priv->link_status & 0x8200  ||
+                               priv->link_status & 0x8400  ||
+                               priv->link_status & 0x0300  )
+                       printk(KERN_INFO "%s Link status change reason : %s \n",dev->name, awc_print_string(awc_link_failure_reason_names, priv->link_status & 0xff) );
+                               
+               }
+       };
+
+
+       if (active_interrupts & 0x10 & enabled_interrupts ){
+
+//             printk(KERN_ERR "cmd int shouldnt be active in interrupt routine\n");
+
+               awc_event_ack_Cmd(priv->cmd.port);
+     
+               if ( priv->enabled_interrupts & 0x10) 
+                       priv->enabled_interrupts &= ~0x10;
+               
+               enabled_interrupts = awc_ints_enabled(dev->base_addr);
+
+               if (enabled_interrupts & 0x10){
+                       awc_ints_enable(dev->base_addr, enabled_interrupts & ~0x10);
+               }
+
+               if (priv->command_semaphore_on){
+                       priv->unlock_command_postponed++;
+
+                       AWC_QUEUE_BH;
+               }
+       }
+       
+       if ((active_interrupts & 0x10) && !(0x10 & enabled_interrupts) ){
+
+//             printk(KERN_ERR "%s: aironet4500: cmd int shouldnt be active in interrupt routine\n",dev->name);
+
+               //awc_event_ack_Cmd(priv->cmd.port);
+       }     
+
+
+//     active_interrupts = awc_event_status(dev->base_addr);
+
+       tx_status = active_interrupts & 0x6 ;
+       
+
+
+       if (tx_status) {
+
+               tx_fid = awc_Tx_Compl_Fid(dev->base_addr);
+               if (!tx_fid){
+                       udelay(10);
+                       tx_fid = awc_Tx_Compl_Fid(dev->base_addr);
+               }
+               if (!tx_fid)
+                       printk(KERN_ERR "No tx fid when tx int active\n");
+                       
+               fid = awc_tx_fid_lookup_and_remove(dev, tx_fid);
+               if (fid) {
+                       if (priv->process_tx_results) {
+                               awc_fid_queue_push_tail(&priv->tx_post_process,fid);
+                               AWC_QUEUE_BH;
+                       }else {
+                               if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
+                                       awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
+                               else
+                                       awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
+                               dev->tbusy = 0;
+                               mark_bh(NET_BH);
+                       }
+               } else 
+                       printk(KERN_ERR "awc fid %x not found\n",tx_fid);
+               
+
+               if (tx_status & 2){
+                       awc_event_ack_Tx(dev->base_addr);
+                       priv->stats.tx_packets++;
+                       priv->waiting_interrupts  &= ~0x2;
+               }
+               if (tx_status & 4){
+                       priv->stats.tx_errors++;
+                       awc_event_ack_TxExc(dev->base_addr);
+                       priv->waiting_interrupts  &= ~0x4;
+               }
+               if ((tx_status&6) == 6)
+                       printk(KERN_NOTICE "%s: both tx and txExc up\n",dev->name);
+
+
+       }
+
+//     active_interrupts = awc_event_status(dev->base_addr);
+
+        if ( active_interrupts & 0x1 ){
+                       awc_receive_packet(dev);
+                       awc_event_ack_Rx(dev->base_addr);
+                       priv->waiting_interrupts &= ~0x1;
+       }
+
+       active_interrupts = awc_event_status(dev->base_addr);
+
+       if ((active_interrupts & 0x7) && 
+            !priv->bh_active && 
+            !priv->bh_running ){
+               if (multi_ints++ < 5)
+                       goto start;
+        }
+       if (multi_ints >=5 )
+               printk(KERN_ERR "%s multi_ints > 5 interrupts still active %x\n",dev->name,active_interrupts); 
+
+       priv->interrupt_count--;
+       dev->interrupt = 0;
+
+       awc_ints_enable(dev->base_addr, 0x0000);
+
+
+       DEBUG(0x8, " enabling ints in interrupt_process %x \n",
+               priv->enabled_interrupts & ~priv->waiting_interrupts);
+
+
+        AWC_ENTRY_EXIT_DEBUG(" exit \n"); 
+
+       awc_ints_enable(dev->base_addr, 
+               priv->enabled_interrupts);
+
+//end_here:
+
+//     enable_irq(dev->irq);
+       restore_flags(flags);
+
+        return 0;
+reenter_end_here:
+
+        AWC_ENTRY_EXIT_DEBUG(" reenter-bad end exit \n"); 
+//     enable_irq(dev->irq);
+       restore_flags(flags);
+        return 0;
+
+bad_end:
+       dev->interrupt = 0;
+        AWC_ENTRY_EXIT_DEBUG(" bad_end exit \n");      
+//     enable_irq(dev->irq);
+       restore_flags(flags);
+       return -1;
+
+
+};
+
+static const char *aironet4500_core_version =
+"aironet4500.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+
+struct NET_DEVICE * aironet4500_devices[MAX_AWCS]  = {NULL,NULL,NULL,NULL};
+
+static int awc_debug = 0; // 0xffffff;
+static int p802_11_send  =  0; // 1
+
+static int awc_process_tx_results = 0;
+int tx_queue_len = 10;
+int tx_rate = 0;
+static int channel = 5;
+//static int tx_full_rate = 0;
+static int max_mtu = 2312;
+static int adhoc = 0;
+static int large_buff_mem = 1700 * 10;
+static int small_buff_no       = 20;
+static int awc_full_stats = 0;
+static char SSID[33] = {0};
+static int master= 0;
+static int slave = 0;
+// int debug =0;
+
+#if LINUX_VERSION_CODE >= 0x20100
+
+MODULE_PARM(awc_debug,"i");
+MODULE_PARM(rx_queue_len,"i");
+MODULE_PARM(tx_rate,"i");
+MODULE_PARM(channel,"i");
+MODULE_PARM(tx_full_rate,"i");
+MODULE_PARM(adhoc,"i");
+MODULE_PARM(master,"i");
+MODULE_PARM(slave,"i");
+MODULE_PARM(max_mtu,"i");
+MODULE_PARM(large_buff_mem,"i");
+MODULE_PARM(small_buff_no,"i");
+MODULE_PARM(SSID,"1-4c31");
+#endif
+
+/*EXPORT_SYMBOL(tx_queue_len);
+EXPORT_SYMBOL(awc_debug);
+ */
+EXPORT_SYMBOL(awc_init);
+EXPORT_SYMBOL(awc_open);
+EXPORT_SYMBOL(awc_close);
+EXPORT_SYMBOL(awc_reset);
+EXPORT_SYMBOL(awc_config);
+
+EXPORT_SYMBOL(aironet4500_devices);
+EXPORT_SYMBOL(awc_debug);
+//EXPORT_SYMBOL();
+
+EXPORT_SYMBOL(awc_private_init);
+EXPORT_SYMBOL(awc_tx_timeout);
+EXPORT_SYMBOL(awc_start_xmit);
+EXPORT_SYMBOL(awc_tx_done);
+EXPORT_SYMBOL(awc_rx);
+EXPORT_SYMBOL(awc_interrupt);
+EXPORT_SYMBOL(awc_get_stats);
+EXPORT_SYMBOL(awc_change_mtu);
+EXPORT_SYMBOL(awc_set_multicast_list);
+
+EXPORT_SYMBOL(awc_proc_set_fun);
+EXPORT_SYMBOL(awc_proc_unset_fun);
+EXPORT_SYMBOL(awc_register_proc);
+EXPORT_SYMBOL(awc_unregister_proc);
+
+
+/***************************  RESET INIT CONFIG ***********************/
+
+
+ void awc_reset(struct NET_DEVICE *dev)
+{
+
+       long long jiff;
+
+       DEBUG(2, " awc_reset dev %x \n", (int)dev);
+       DEBUG(2, "%s: awc_reset \n",  dev->name);
+       
+       awc_issue_soft_reset(dev);
+       
+       jiff = jiffies;
+       udelay(1000);
+       while (awc_command_read(dev->base_addr)){
+               udelay(1000);
+               if (jiffies - jiff > 5*HZ){
+                       printk(KERN_CRIT "%s bad reset\n",dev->name);
+                       break;
+               }
+       };
+
+}
+
+ int awc_config(struct NET_DEVICE *dev)
+{
+//     struct awc_private *priv = (struct awc_private *)dev->priv;
+
+       DEBUG(2, "%s: awc_config \n",  dev->name);
+
+       
+        if( awc_disable_MAC(dev))              goto final;
+       udelay(100);        
+       if( awc_write_all_rids(dev) )           goto final;
+       udelay(100);
+        if( awc_enable_MAC(dev))               goto final;
+
+       return 0;
+   final: 
+       return -1;
+}
+
+
+char name[] = "ElmerLinux";
+
+ int awc_init(struct NET_DEVICE *dev){
+        struct awc_private *priv = (struct awc_private *)dev->priv;
+       int i;        
+       const char * radioType;
+       DEBUG(2, "%s: awc_init \n",  dev->name);
+
+
+
+       //awc_dump_registers(dev);
+
+       if (adhoc & !max_mtu)
+               max_mtu= 2250;
+       else if (!max_mtu)
+               max_mtu= 1500;
+                       
+        priv->sleeping_bap = 1;
+               
+
+       priv->enabled_interrupts = awc_ints_enabled(dev->base_addr);
+        
+       if( awc_issue_noop(dev) )       goto final;
+
+       awc_ints_enable(dev->base_addr,0);
+
+       if( awc_disable_MAC(dev) )      goto final;
+
+               
+//     awc_rids_setup(dev);
+       i=0;
+       while ( i < AWC_NOF_RIDS){
+               if (awc_rids_temp[i].selector)
+                       memcpy(&priv->rid_dir[i],&awc_rids_temp[i],sizeof(priv->rid_dir[0]) );
+               else priv->rid_dir[i].selector = NULL;
+               i++;
+       }
+       
+       // following MUST be consistent with awc_rids !!!
+       priv->rid_dir[0].buff = &priv->config; // card RID mirrors
+       priv->rid_dir[1].buff = &priv->SSIDs;
+       priv->rid_dir[2].buff = &priv->fixed_APs;
+       priv->rid_dir[3].buff = &priv->driver_name;
+       priv->rid_dir[4].buff = &priv->enc_trans;
+       priv->rid_dir[5].buff = &priv->general_config; //       
+       priv->rid_dir[6].buff = &priv->capabilities;
+       priv->rid_dir[7].buff = &priv->status;
+       priv->rid_dir[8].buff = &priv->AP;
+       priv->rid_dir[9].buff = &priv->statistics;
+       priv->rid_dir[10].buff = &priv->statistics_delta;
+       priv->rid_dir[11].buff = &priv->statistics_delta_clear;
+       priv->rid_dir[12].buff = &priv->wep_volatile;
+       priv->rid_dir[13].buff = &priv->wep_nonvolatile;
+       priv->rid_dir[14].buff = &priv->modulation;
+
+       priv->rid_dir[15].buff = &priv->statistics16;
+       priv->rid_dir[16].buff = &priv->statistics16_delta;
+       priv->rid_dir[17].buff = &priv->statistics16_delta_clear;
+                               
+       priv->rid_dir[0].bufflen = sizeof(priv->config); // card RID mirrors
+       priv->rid_dir[1].bufflen = sizeof(priv->SSIDs);
+       priv->rid_dir[2].bufflen = sizeof(priv->fixed_APs);
+       priv->rid_dir[3].bufflen = sizeof(priv->driver_name);
+       priv->rid_dir[4].bufflen = sizeof(priv->enc_trans);
+       priv->rid_dir[5].bufflen = sizeof(priv->general_config); //
+       priv->rid_dir[6].bufflen = sizeof(priv->capabilities);
+       priv->rid_dir[7].bufflen = sizeof(priv->status);
+       priv->rid_dir[8].bufflen = sizeof(priv->AP);
+       priv->rid_dir[9].bufflen = sizeof(priv->statistics);
+       priv->rid_dir[10].bufflen = sizeof(priv->statistics_delta);
+       priv->rid_dir[11].bufflen = sizeof(priv->statistics_delta_clear);
+       priv->rid_dir[12].bufflen = sizeof(priv->wep_volatile);
+       priv->rid_dir[13].bufflen = sizeof(priv->wep_nonvolatile);
+       priv->rid_dir[14].bufflen = sizeof(priv->modulation);
+
+       priv->rid_dir[15].bufflen = sizeof(priv->statistics16);
+       priv->rid_dir[16].bufflen = sizeof(priv->statistics16_delta);
+       priv->rid_dir[17].bufflen = sizeof(priv->statistics16_delta_clear);
+
+
+       if( awc_read_all_rids(dev) )    goto final;
+
+       priv->config.OperatingMode = 0;// MODE_LLC_HOST;
+       DEBUG(1,"ReceiveMode %x \n",priv->config.ReceiveMode);
+ //    priv->config.ReceiveMode        =  RXMODE_DISABLE_802_3_HEADER;
+       
+       if (!adhoc)
+               priv->config.OperatingMode = MODE_STA_ESS;
+//        priv->config.OperatingMode = MODE_AP;
+//     priv->config.Rates[0]   =0x82;
+//     priv->config.Rates[1]   =0x4;
+//     priv->config.Rates[2]   =tx_full_rate;
+//     priv->config.Rates[3]   =0;
+//     priv->config.Rates[4]   =0;
+//     priv->config.Rates[5]   =0;
+//     priv->config.Rates[6]   =0;
+//     priv->config.Rates[7]   =0;
+       priv->config.Channel    = channel;
+       if (adhoc && master){
+               priv->config.JoinNetTimeout     = 0x1;//0 is facotry default
+       } else if (adhoc && slave){
+               priv->config.JoinNetTimeout     = 0xffff;
+       };      
+//     priv->config.AuthenticationType = 1;
+       priv->config.Stationary =1;
+//     priv->config.ScanMode   = 1;
+//     priv->config.LinkLossDelay      = 100;
+       priv->config.FragmentThreshold = 1700;
+       priv->config.RtsThreshold       = 1700;
+       memcpy(priv->config.NodeName, name, 10);
+
+       DEBUG(1,"%s supported Rates \n",dev->name);
+       for (i=0; i< 8; i++)
+               DEBUG(1,"%x ",priv->capabilities.SupportedRates[i]);
+       DEBUG(1,"%c",'\n');
+       DEBUG(1,"%s default Rates \n",dev->name);
+       for (i=0; i< 8; i++)
+               DEBUG(1,"%x ",priv->config.Rates[i]);
+       DEBUG(1,"%c",'\n');
+                       
+
+       // here we go, bad aironet
+       memset(&priv->SSIDs,0,sizeof(priv->SSIDs));
+
+       memset(&priv->queues_lock,0,sizeof(priv->queues_lock));
+
+        priv->SSIDs.ridLen             =0;
+        if (!SSID) {
+               priv->SSIDs.SSID[0].SSID[0]     ='a';
+               priv->SSIDs.SSID[0].SSID[1]     ='b';
+               priv->SSIDs.SSID[0].SSID[2]     ='c';
+               priv->SSIDs.SSID[0].lenght      =3;
+        } else {
+               int sidlen = strlen(SSID);
+               memcpy(priv->SSIDs.SSID[0].SSID,SSID,sidlen);
+               priv->SSIDs.SSID[0].lenght = sidlen;
+        };
+        
+        priv->SSIDs.SSID[1].lenght     =0;
+        priv->SSIDs.SSID[1].SSID[0]    =0;
+        priv->SSIDs.SSID[1].SSID[1]    =0;        
+        priv->SSIDs.SSID[2].lenght     =0;
+        priv->SSIDs.SSID[2].SSID[0]    =0;
+        priv->SSIDs.SSID[2].SSID[1]    =0;
+
+
+//     priv->enc_trans.rules[0].etherType= 0x0008;
+//     priv->enc_trans.rules[0].Action   = 1;        
+               
+       memcpy( priv->config.StationMacAddress,
+               priv->capabilities.FactoryAddress,      6       );
+
+        memcpy(dev->dev_addr, priv->config.StationMacAddress, 6);
+
+       DEBUG(2, "%s: awc_init success \n",  dev->name);
+       
+       if (priv->capabilities.RadioType == 1) radioType = "802.11 Frequency Hoping";
+       else if (priv->capabilities.RadioType == 2) radioType = "802.11 Direct Sequence";
+       else if (priv->capabilities.RadioType == 4) radioType = "LM2000";
+       else radioType = "Multiple Radio Types";
+
+       printk("%s: %s %s found @ 0x%lx irq %d firmwareVersion %d \n",dev->name,
+               priv->capabilities.ProductName,radioType,
+               dev->base_addr,dev->irq,
+               priv->capabilities.SoftwareVersion);
+       return 0; 
+   final:
+       printk(KERN_ERR "aironet init failed \n");
+       return NODEV;
+       
+ };
+
+int awc_private_init(struct NET_DEVICE * dev){
+       struct awc_private * priv = (struct awc_private *) dev->priv;
+       int i = 0;
+
+       DEBUG(2, "%s: awc_private_init \n",  dev->name);
+       
+       
+       memset(priv, 0, sizeof(struct awc_private)); 
+       
+       priv->bap0.select       = dev->base_addr + awc_Select0_register;
+       priv->bap0.offset       = dev->base_addr + awc_Offset0_register;
+       priv->bap0.data         = dev->base_addr + awc_Data0_register;
+       priv->bap0.lock         = 0;
+       priv->bap0.status       = 0;
+       init_MUTEX(&priv->bap0.sem);
+       priv->bap1.select       = dev->base_addr + awc_Select1_register;
+       priv->bap1.offset       = dev->base_addr + awc_Offset1_register;
+       priv->bap1.data         = dev->base_addr + awc_Data1_register;
+       priv->bap1.lock         = 0;
+       priv->bap1.status       = 0;
+       init_MUTEX(&priv->bap1.sem);
+       priv->sleeping_bap      = 1;
+       
+       init_MUTEX(&priv->command_semaphore);
+       priv->command_semaphore_on = 0;
+       priv->unlock_command_postponed = 0;
+       priv->immediate_bh.next         = NULL;
+       priv->immediate_bh.sync         = 0;
+       priv->immediate_bh.routine      = (void *)(void *)awc_bh;
+       priv->immediate_bh.data         = dev;
+       priv->bh_running        = 0;
+       priv->bh_active         = 0;
+       priv->tx_chain_active   = 0;
+       priv->enabled_interrupts= 0x00;
+       priv->waiting_interrupts= 0x00;
+       
+       
+       init_MUTEX(&priv->tx_buff_semaphore);
+       priv->tx_buffs_in_use   = 0;
+       priv->tx_small_buffs_in_use = 0;
+       priv->mac_enabled       =0;
+       priv->link_status       =0;
+       priv->large_buff_mem    = large_buff_mem;
+       if (priv->large_buff_mem < max_mtu + AWC_TX_HEAD_SIZE + 10 )
+               priv->large_buff_mem = max_mtu + AWC_TX_HEAD_SIZE + 10;
+       priv->small_buff_no     = small_buff_no;
+       if (priv->small_buff_no  < 1 )
+               priv->small_buff_no = 1 ;
+
+       priv->process_tx_results = awc_process_tx_results;
+
+       //init_waitqueue(&priv->tx_chain_wait_queue);
+
+       for (i=0; i< 6 ; i++ ) {
+               priv->p2p[i] = 0xff;
+               priv->bssid[i] =0;
+       }
+//     priv->p2p_uc            =1;
+       priv->p2p_found         =0;
+
+       priv->p802_11_send      =p802_11_send;
+       
+
+       priv->ejected           =0;     
+       dev->interrupt          =0;
+       priv->interrupt_count   =0;
+       
+       return 0;
+       
+};
+
+/****************************  OPEN    CLOSE   **********************/
+
+ int awc_open(struct NET_DEVICE *dev)
+{
+       struct awc_private *priv = (struct awc_private *)dev->priv;
+
+
+
+       DEBUG(2, "%s: awc_open \n",  dev->name);
+
+       dev->interrupt = 0; dev->tbusy = 1; dev->start = 0;
+
+
+       if( awc_queues_init(dev) )              goto final;
+       if( awc_config(dev) )           goto final;
+       
+       memcpy(dev->dev_addr, priv->config.StationMacAddress, 6);
+        
+       priv->enabled_interrupts = 0x87;
+       awc_ints_enable(dev->base_addr,priv->enabled_interrupts);
+
+//     priv->p8022_client      = register_8022_client;
+//     priv->snap_client       = register_snap_client; 
+       DEBUG(2, "%s: opened \n", dev->name);
+
+       priv->sleeping_bap  = 0;
+       
+       
+       MOD_INC_USE_COUNT;
+//     kernel_thread(awc_thread,dev,0);
+
+       dev->tbusy = 0; dev->start = 1;
+       return 0;                                       /* Always succeed */
+
+   final:
+       dev->tbusy = 0; dev->start = 0;
+       printk(KERN_ERR "aironet open failed \n");
+       return -1;
+}
+
+
+ int awc_close(struct NET_DEVICE *dev)
+{
+       struct awc_private * priv = (struct awc_private *) dev->priv;
+
+       DEBUG(2, "%s: closing device.\n", dev->name);
+
+       dev->start = 0;
+       dev->tbusy=1;
+       
+       awc_disable_MAC(dev);
+       awc_queues_destroy(dev);
+       
+       awc_reset(dev);
+       
+       udelay(10000);
+       
+       DOWN(&priv->command_semaphore);
+
+       MOD_DEC_USE_COUNT;
+
+       UP(&priv->command_semaphore);
+        
+       return 0;
+}
+
+
+
+/******************************                TX  RX STUFF    ******************/
+
+
+
+ void awc_tx_timeout(struct NET_DEVICE *dev)
+{
+       struct awc_private *priv = (struct awc_private *)dev->priv;
+
+       DEBUG(2, "%s: awc_tx_timeout \n",  dev->name);
+
+       printk(KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d  \n ",
+                       dev->name,priv->tx_small_buffs_total ,priv->tx_buffs_total,
+                       priv->tx_in_transmit.size,priv->tx_post_process.size,
+                       priv->tx_large_ready.size,priv->tx_small_ready.size);
+       priv->stats.tx_errors++;
+
+       dev->trans_start = jiffies;
+       dev->tbusy = 0;
+}
+
+long long last_tx_q_hack = 0;
+int direction = 1;
+
+ int awc_start_xmit(struct sk_buff *skb, struct NET_DEVICE *dev) {
+
+       struct awc_private *priv = (struct awc_private *)dev->priv;
+       int retval = 0;
+       unsigned long flags;
+       struct awc_fid * fid = NULL;
+       int cnt=0;
+
+       DEBUG(2, "%s: awc_start_xmit \n",  dev->name);
+
+
+       if (!dev) {
+               DEBUG(1, " xmit dev=NULL, jiffie %ld \n",jiffies);
+               return -1;
+       };
+
+       /* Transmitter timeout, serious problems. */
+       if (test_and_set_bit( 0, (void *) &dev->tbusy) ) {
+               if (jiffies - dev->trans_start > 3* HZ ){
+                       save_flags(flags);
+                       cli();
+                       fid = priv->tx_in_transmit.head;
+                       cnt = 0;
+                       while (fid){
+                               if (jiffies - fid->transmit_start_time > (HZ)){
+                               //      printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name,
+                               //              jiffies - fid->transmit_start_time );
+                                       awc_fid_queue_remove(&priv->tx_in_transmit, fid);
+                                       if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
+                                               awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
+                                       else
+                                               awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
+                                       dev->tbusy = 0;
+                               }
+                               fid = fid->next;
+                               if (cnt++ > 200) {
+                                       printk("bbb in awc_fid_queue\n");
+                                       restore_flags(flags);
+                                       return -1;
+                               };
+
+                       }
+                       restore_flags(flags);
+                       //debug =0x8;
+               };
+               if (jiffies - dev->trans_start >= (5* HZ) ) {
+                       awc_tx_timeout(dev);
+               }
+               return 1;
+       }
+
+       if (!skb) {
+               DEBUG(1, " xmit skb=NULL, jiffie %ld \n",jiffies);
+               return -1;
+       };
+       
+       if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) {
+               dev->tbusy=0;
+               return 1;
+       }
+
+       dev->trans_start = jiffies;
+       retval = awc_802_11_tx_find_path_and_post(dev,skb);
+       priv->tx_chain_active = 0;
+//     wake_up_interruptible(&priv->tx_chain_wait_queue);      
+
+//     if (!dev->tbusy) dev_tint(dev);
+       return retval;
+}
+
+int awc_tx_done(struct awc_fid * rx_fid){
+       
+//     dev->tbusy = 0;
+       mark_bh(NET_BH);
+       
+       return 0;
+};
+
+int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
+
+//     struct awc_private *lp = (struct awc_private *)dev->priv;
+
+       DEBUG(3, "%s: in rx_packet \n",dev->name);
+
+       if (!rx_fid ){
+               DEBUG(3, "%s: not rx_buff in rx_packet \n",dev->name);
+               return -1;
+       };
+       if ( !rx_fid->skb){
+               DEBUG(3, "%s: not  rx_buff->skb in rx_packet \n",dev->name);
+               return -1;
+       };
+
+       
+       rx_fid->skb->protocol = eth_type_trans(rx_fid->skb,dev);
+       netif_rx(rx_fid->skb);
+        rx_fid = NULL;
+
+       return 0;
+}
+
+
+ void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+       struct NET_DEVICE *dev = (struct NET_DEVICE *)dev_id;
+//     struct awc_private *lp;
+//     unsigned long flags;
+
+//     if ((dev == NULL)) return;
+
+//     lp = (struct awc_private *)dev->priv;
+
+
+       
+
+       DEBUG(2, "%s: awc_interrupt \n",  dev->name);
+       
+       awc_interrupt_process(dev);
+
+       return;
+}
+
+
+
+/************************      STATS, MULTICAST & STUFF  ****************/
+
+
+
+ struct enet_statistics *awc_get_stats(struct NET_DEVICE *dev)
+{
+       struct awc_private *priv = (struct awc_private *)dev->priv;
+        unsigned long flags;
+//     int cnt = 0;
+//     int unlocked_stats_in_interrupt=0;
+       
+       DEBUG(2, "%s: awc_get_stats \n",  dev->name);
+
+       if (!dev->start) {
+               return 0;                       
+       }
+       save_flags(flags);
+       cli();
+       if (awc_full_stats)
+               awc_readrid_dir(dev, &priv->rid_dir[9]);
+       restore_flags(flags);
+
+       // the very following is the very wrong very probably
+       if (awc_full_stats){
+               priv->stats.rx_fifo_errors      = priv->statistics.RxOverrunErr ;
+               priv->stats.rx_crc_errors       = priv->statistics.RxPlcpCrcErr + priv->statistics.RxMacCrcErr ;
+               priv->stats.rx_frame_errors     = priv->statistics.RxPlcpFormat ;
+               priv->stats.rx_length_errors    =  priv->statistics.RxPlcpLength   ;
+               priv->stats.rx_missed_errors    = priv->statistics.RxAged ;
+               priv->stats.rx_over_errors      = priv->statistics.RxOverrunErr ;
+                       
+               priv->stats.collisions          = priv->statistics.TxSinColl;
+               priv->stats.tx_aborted_errors   = priv->statistics.TxAged ;
+               priv->stats.tx_fifo_errors      = priv->statistics.HostTxFail ;
+               priv->stats.tx_window_errors    = priv->statistics.TxMulColl  ;
+               priv->stats.tx_heartbeat_errors = priv->statistics.DefersProt +priv->statistics.DefersEngy ;
+               priv->stats.tx_carrier_errors   = priv->statistics.RetryLong +priv->statistics.RetryShort  ;
+               priv->stats.multicast           = priv->statistics.HostRxMc;
+       }
+
+
+//     printk("rx_packets %d\n",priv->stats.rx_packets);
+       return &(priv->stats);
+}
+
+
+int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){
+
+//     struct awc_private *priv = (struct awc_private *)dev->priv;
+        unsigned long flags;
+
+       if ((new_mtu < 256 ) || (new_mtu > 2312) || (max_mtu && new_mtu > max_mtu) )
+                return -EINVAL;
+
+       if (dev->start) {
+               printk("PLEASE, ifconfig %s down for mtu change\n",dev->name);
+
+       };
+       if (dev->mtu != new_mtu) {
+               save_flags(flags);
+               cli();
+               awc_disable_MAC(dev);
+               awc_tx_dealloc(dev);
+               dev->mtu = new_mtu;
+               awc_tx_alloc(dev);
+               awc_enable_MAC(dev);
+               restore_flags(flags);
+
+               printk("%s mtu has been changed to %d \n ",dev->name,dev->mtu);
+
+       }
+
+       return 0;
+
+};
+
+
+ void
+awc_set_multicast_list(struct NET_DEVICE *dev) {
+//     int ioaddr = dev->base_addr;
+
+/*     if (dev->flags & IFF_PROMISC)
+               promisc
+       else if (dev->mc_count || (dev->flags & IFF_ALLMULTI))
+               allmulti
+       else
+               normal
+               */
+
+
+}
+
+
+
+int (* awc_proc_set_fun) (int) = NULL;
+int (* awc_proc_unset_fun) (int) = NULL;
+
+
+int awc_register_proc(int (*awc_proc_set_device)(int),int (*awc_proc_unset_device)(int)){
+
+       AWC_ENTRY_EXIT_DEBUG("awc_register_proc");
+       awc_proc_set_fun        = awc_proc_set_device;
+       awc_proc_unset_fun      = awc_proc_unset_device;
+       AWC_ENTRY_EXIT_DEBUG("exit");
+       return 0;
+};
+
+int awc_unregister_proc(void){
+
+       AWC_ENTRY_EXIT_DEBUG("awc_unregister_proc");
+       
+       awc_proc_set_fun        = NULL;
+       awc_proc_unset_fun      = NULL;                 
+       AWC_ENTRY_EXIT_DEBUG("exit");
+       return 0;
+};
+
+#ifdef MODULE
+        
+int init_module(void)
+{
+//     unsigned long flags;
+
+//     debug =  awc_debug;
+       printk(KERN_INFO"%s", aironet4500_core_version);
+       return 0;
+       
+
+}
+
+void cleanup_module(void)
+{
+       printk(KERN_INFO "aironet4500 unloading core module \n");
+
+}
+
+#endif
+        
\ No newline at end of file
diff --git a/drivers/net/aironet4500_proc.c b/drivers/net/aironet4500_proc.c
new file mode 100644 (file)
index 0000000..58aec79
--- /dev/null
@@ -0,0 +1,554 @@
+/*
+ *      Aironet 4500 Pcmcia driver
+ *
+ *             Elmer Joandi, Januar 1999
+ *     Copyright Elmer Joandi, all rights restricted
+ *     
+ *
+ *     Revision 0.1 ,started  30.12.1998
+ *
+ *
+ */
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/kernel.h>
+
+#include <linux/version.h>
+
+#include <linux/sched.h>
+#include <linux/ptrace.h>
+#include <linux/malloc.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/in.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <linux/timer.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/if_arp.h>
+#include <linux/ioport.h>
+
+
+#ifdef CONFIG_PROC_FS
+
+#ifdef CONFIG_PROC_FS
+#include <linux/sysctl.h>
+#else
+#error awc driver needs CONFIG_PROC_FS
+#endif
+
+
+
+#include "aironet4500_rid.c"
+
+
+#define AWC_STR_SIZE   0x2ff0
+#define DEV_AWC_INFO   1
+#define DEV_AWC        1
+
+struct awc_proc_private{
+       struct ctl_table_header *       sysctl_header;
+       struct ctl_table        *       proc_table;
+       struct ctl_table                proc_table_device_root[2];
+       struct ctl_table                proc_table_sys_root[2];
+       char                            proc_name[10];
+};             
+static char awc_drive_info[AWC_STR_SIZE]="Zcom \n\0";
+static char awc_proc_buff[AWC_STR_SIZE]="\0";
+static int  awc_int_buff;
+static struct awc_proc_private awc_proc_priv[MAX_AWCS]; 
+
+extern int awc_proc_unset_device(int device_number);
+
+int awc_proc_format_array(int write,char * buff, size_t * len, struct awc_rid_dir * rid_dir, struct aironet4500_RID * rid){
+
+  u8 * data = rid_dir->buff + rid->offset;
+  int pos = 0;
+  int null_past = 0;
+  int hex = ((rid->mask == 0xff) && (rid->value == 0x0 ));
+  int string = ((rid->mask == 0) && (rid->value == 0 ));
+  u32 val =0;
+  int bytes = (rid->bits / 8);
+  int ch =0;
+  int i,k;
+  int array_len = rid->array;
+  int nullX = 0;
+
+       AWC_ENTRY_EXIT_DEBUG("awc_proc_format_array");
+
+      if (rid->bits %8 ) bytes +=1;
+     
+     if (bytes > 4 && rid->array == 1){
+       array_len = bytes;
+       bytes = 1;
+       hex = 1;
+     };
+     if (bytes < 1 || bytes > 4){
+       printk(KERN_ERR " weird number of bytes %d in aironet rid \n",bytes);
+       return -1;
+     };        
+     DEBUG(0x20000,"awc proc array  bytes %d",bytes);
+     DEBUG(0x20000," hex %d",hex);
+     DEBUG(0x20000," string %d",string);
+
+     DEBUG(0x20000," array_len %d \n",array_len);
+     DEBUG(0x20000," offset %d \n",rid->offset);
+
+     if (!write){
+       for (i=0; i < array_len ; i++){
+       
+               if      (bytes <= 1 ) val = data[i*bytes];
+               else if (bytes <= 2 ) val = *((u16 *)&data[i*bytes]);
+               else if (bytes <= 4 ) val = *((u32 *)&data[i*bytes]);
+               
+               if (rid->null_terminated && !val)
+                       null_past =1;
+                        
+               if (hex && !string)
+                       for (k=0; k <bytes; k++)
+                               pos += sprintf(buff+pos, "%02x",(unsigned char ) data[i*bytes +k]);
+               else if (string)
+                       pos += sprintf(buff+pos, "%c",val);
+               else    pos += sprintf(buff+pos, "%c",val);
+
+               DEBUG(0x20000, "awcproc %x %x \n",data[i], val);
+       };
+       
+     } else {
+       for (i=0; i < array_len ; i++){
+       
+               DEBUG(0x20000, "awcproc %x %x \n",data[i], buff[i]);
+
+               if (hex && ! string){
+                       
+                       val = 0;
+                       
+                       for (k=0; k < bytes; k++){
+                               val <<= 8;
+                                       ch = *(buff + 2*i*bytes +k + nullX);
+                               if (ch >= '0' && ch <='9')
+                                       ch -= '0';
+                               if (ch >= 'A' && ch <='F')
+                                       ch -= 'A'+ 0xA;
+                               if (ch >= 'a' && ch <='f')
+                                       ch -= 'a'+ 0xA;
+                               val += ch <<4;
+                               k++;
+                               
+                               ch = *(buff + 2*i*bytes +k + nullX);
+                               if (val == 0 && (ch == 'X' || ch == 'x')){
+                                       nullX=2;
+                                       val = 0;
+                                       k = -1;
+                                       continue;
+                               };
+                               if (ch >= '0' && ch <='9')
+                                       ch -= '0';
+                               if (ch >= 'A' && ch <='F')
+                                       ch -= 'A'+ 0xA;
+                               if (ch >= 'a' && ch <='f')
+                                       ch -= 'a'+ 0xA;
+                                       
+                               val += ch;
+                               if (i*bytes > *len )
+                                       val = 0;        
+                       }
+                       if (rid->bits <=8 )                 data[i*bytes]  = val;
+                       else if (rid->bits <=16 ) *((u16 *)&data[i*bytes]) = val;
+                       else if (rid->bits <=32 ) *((u32 *)&data[i*bytes]) = val;
+                       if (!val) null_past=1;  
+                       
+               } else {
+                       for (k=0; k < bytes; k++){
+                               data[i*bytes +k] = *(buff + i*bytes +k);
+                               if (i*bytes +k > *len || !data[i*bytes +k])
+                                       null_past = 1;;
+                       }
+       
+               }
+               if (null_past){
+                       if (rid->bits <=8 )                 data[i*bytes]  = 0;
+                       else if (rid->bits <=16 ) *((u16 *)&data[i*bytes]) = 0;
+                       else if (rid->bits <=32 ) *((u32 *)&data[i*bytes]) = 0;
+               }
+
+       }
+       
+     };
+     
+       
+//     *len = pos;
+       AWC_ENTRY_EXIT_DEBUG("awc_proc_format_array");
+     return 0; 
+};
+
+
+int awc_proc_format_bits(int write,u32 * buff, size_t* lenp, struct awc_rid_dir * rid_dir, struct aironet4500_RID * rid){
+
+  u8 * data = rid_dir->buff + rid->offset;
+  u32 val = 0;
+  int not_bool = 0;
+       AWC_ENTRY_EXIT_DEBUG("awc_proc_format_bits");
+
+       if ((rid->bits == 8 && rid->mask == 0xff)       || 
+           (rid->bits == 16 && rid->mask == 0xffff)    || 
+           (rid->bits == 32 && rid->mask == 0xffffffff)   )
+           not_bool = 1;
+           
+       if (rid->bits <=8 )             val =           *data;
+       else if (rid->bits <=16 )       val = *((u16 *)data);
+       else if (rid->bits <=32 )       val = *((u32 *)data);
+
+       DEBUG(0x20000,"awc proc int enter data %x \n",val);
+       DEBUG(0x20000,"awc proc int enter buff %x \n",*buff);
+       DEBUG(0x20000,"awc proc int enter intbuff %x \n",awc_int_buff);
+       DEBUG(0x20000,"awc proc int enter lenp  %x \n",*lenp);
+
+
+
+       if (!write){
+               if (rid->mask)
+                       val &= rid->mask;
+
+               if (!not_bool && rid->mask && 
+                   ((val & rid->mask) == (rid->value & rid->mask)))
+                       *buff = 1;
+               else if (!not_bool) *buff = 0;
+               else *buff = val;
+       } else {
+               if (not_bool){
+                       val &= ~rid->mask; 
+                       val |= (*buff & rid->mask);
+               } else {
+                       if (*buff){
+                               val &= ~rid->mask;
+                               if (rid->value)
+                                       val |= rid->mask & rid->value;
+                               else    val |= rid->mask & ~rid->value;
+                       } else val &= ~rid->mask;
+               };
+               if (rid->bits == 8) *data = val & 0xff;
+               if (rid->bits == 16) *((u16*)data) = val &0xffff;
+               if (rid->bits == 32) *((u32*)data) = val &0xffffffff; 
+       
+       }
+       DEBUG(0x20000,"awc proc int buff %x \n",awc_int_buff);
+       if (rid->bits <=8 )             val =           *data;
+       else if (rid->bits <=16 )       val = *((u16 *)data);
+       else if (rid->bits <=32 )       val = *((u32 *)data);
+
+       DEBUG(0x20000,"awc proc int data %x \n",val);
+       
+//     *lenp = sizeof(int);
+       *lenp += 1;
+       
+       AWC_ENTRY_EXIT_DEBUG("exit");
+       return 0;
+
+};
+
+int awc_proc_fun(ctl_table *ctl, int write, struct file * filp,
+                           void *buffer, size_t *lenp)
+{
+        int retv =-1;
+       struct awc_private *priv = NULL;
+       unsigned long  flags;
+//     int device_number = (int ) ctl->extra1;
+
+       struct awc_rid_dir * rid_dir;
+
+       struct NET_DEVICE * dev= NULL;
+       struct aironet4500_RID * rid = (struct aironet4500_RID * ) ctl->extra2;
+       
+       AWC_ENTRY_EXIT_DEBUG("awc_proc_fun");
+
+       if (!write && filp)
+        if (filp->f_pos){
+//             printk(KERN_CRIT "Oversize read\n");
+               *lenp = 0;// hack against reading til eof
+               return  0;
+        }
+       MOD_INC_USE_COUNT;
+
+       rid_dir = ((struct awc_rid_dir *)ctl->extra1);
+       dev = rid_dir->dev;
+       
+       if (!dev){
+               printk(KERN_ERR " NO device here \n");
+               goto final;
+       }
+
+       if(ctl->procname == NULL || awc_drive_info == NULL ){
+               printk(KERN_WARNING " procname is NULL in sysctl_table or awc_mib_info is NULL \n at awc module\n ");
+               MOD_DEC_USE_COUNT;
+               return -1;
+       }
+       priv = (struct awc_private * ) dev->priv; 
+
+       if ((rid->selector->read_only || rid->read_only) && write){
+               printk(KERN_ERR "This value is read-only \n");
+               goto final;
+       };
+
+       if (!write && rid->selector->may_change) {
+               save_flags(flags);
+               cli();  
+               awc_readrid(dev,rid,rid_dir->buff + rid->offset);
+               restore_flags(flags);
+       };
+       
+       if (rid->array > 1 || rid->bits > 32){
+               if (write){
+                       retv = proc_dostring(ctl, write, filp, buffer, lenp);
+                       if (retv) goto final;
+                       retv = awc_proc_format_array(write, awc_proc_buff, lenp, rid_dir, rid);
+                       if (retv) goto final;
+               } else {
+                       retv = awc_proc_format_array(write, awc_proc_buff, lenp, rid_dir, rid);
+                       if (retv) goto final;
+                       retv = proc_dostring(ctl, write, filp, buffer, lenp);
+                       if (retv) goto final;
+               }
+        } else {
+               if (write){
+                       retv = proc_dointvec(ctl, write, filp, buffer, lenp);        
+                       if (retv) goto final;   
+                       retv = awc_proc_format_bits(write, &awc_int_buff, lenp, rid_dir, rid);
+                       if (retv) goto final;   
+               } else {
+                       retv = awc_proc_format_bits(write, &awc_int_buff, lenp,rid_dir, rid);
+                       if (retv) goto final;   
+                       retv = proc_dointvec(ctl, write, filp, buffer, lenp);        
+                       if (retv) goto final;   
+               }
+        }
+       if (write) {
+               save_flags(flags);
+               cli();  
+
+               if (rid->selector->MAC_Disable_at_write){
+                       awc_disable_MAC(dev);
+               };
+               awc_writerid(dev,rid,rid_dir->buff + rid->offset);
+               if (rid->selector->MAC_Disable_at_write){
+                       awc_enable_MAC(dev);
+               };
+               restore_flags(flags);
+
+       };
+
+               DEBUG(0x20000,"awc proc ret  %x \n",retv);
+               DEBUG(0x20000,"awc proc lenp  %x \n",*lenp);
+       MOD_DEC_USE_COUNT;
+       return retv;
+  
+final:
+       AWC_ENTRY_EXIT_DEBUG("exit");
+       MOD_DEC_USE_COUNT;
+        return -1 ;
+}
+
+
+char  conf_reset_result[200];
+
+
+ctl_table awc_exdev_table[] = {
+       {0, NULL, NULL,0, 0400, NULL},
+       {0}
+};
+ctl_table awc_exroot_table[] = {
+        {254, "aironet4500", NULL, 0, 0555, NULL},
+        {0}
+};
+
+ctl_table awc_driver_proc_table[] = {
+        {1, "debug"                    , &awc_debug, sizeof(awc_debug), 0600,NULL, proc_dointvec},
+        {2, "bap_sleep"                        , &bap_sleep, sizeof(bap_sleep), 0600,NULL, proc_dointvec},
+        {3, "bap_sleep_after_setup"    , &bap_sleep_after_setup, sizeof(bap_sleep_after_setup), 0600,NULL, proc_dointvec},
+        {4, "sleep_before_command"     , &sleep_before_command, sizeof(sleep_before_command), 0600,NULL, proc_dointvec},
+        {5, "bap_sleep_before_write"   , &bap_sleep_before_write, sizeof(bap_sleep_before_write), 0600,NULL, proc_dointvec},
+        {6, "sleep_in_command"         , &sleep_in_command     , sizeof(sleep_in_command), 0600,NULL, proc_dointvec},
+        {0}
+};
+
+ctl_table awc_root_table[] = {
+        {254, "aironet4500", NULL, 0, 0555, awc_driver_proc_table},
+        {0}
+};
+
+struct ctl_table_header * awc_driver_sysctl_header = NULL;
+
+const char awc_procname[]= "awc5";
+
+
+int awc_proc_set_device(int device_number){
+  int group =0;
+  int rid = 0;
+  struct awc_priv * priv;
+
+  AWC_ENTRY_EXIT_DEBUG("awc_proc_set_device");  
+  if (!aironet4500_devices[device_number] || (awc_nof_rids <=0 )) return -1 ;
+  priv = (struct awc_priv * )aironet4500_devices[device_number]->priv;
+
+  awc_rids_setup(aironet4500_devices[device_number]);
+
+  memcpy(&(awc_proc_priv[device_number].proc_table_sys_root[0]), awc_exroot_table,sizeof(struct ctl_table)*2);
+  awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name = 254 - device_number;
+  memcpy(awc_proc_priv[device_number].proc_table_device_root, awc_exdev_table,sizeof(awc_exdev_table) );
+  awc_proc_priv[device_number].proc_table_device_root[0].ctl_name = device_number+1;
+
+  awc_proc_priv[device_number].proc_table_sys_root->child = awc_proc_priv[device_number].proc_table_device_root;
+  memcpy(awc_proc_priv[device_number].proc_name,(struct awc_priv * )aironet4500_devices[device_number]->name,5);
+  awc_proc_priv[device_number].proc_name[4]=0;
+ // awc_proc_priv[device_number].proc_name[3]=48+device_number;
+  awc_proc_priv[device_number].proc_table_device_root[0].procname = &(awc_proc_priv[device_number].proc_name[0]);
+  awc_proc_priv[device_number].proc_table = kmalloc(sizeof(struct ctl_table) * (awc_nof_rids+2),GFP_KERNEL);
+  if (!awc_proc_priv[device_number].proc_table){
+   printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n");
+   return -1;
+  }
+  awc_proc_priv[device_number].proc_table_device_root[0].child=awc_proc_priv[device_number].proc_table;
+  
+
+ if (awc_debug) printk("device  %d of %d proc interface setup ",device_number, awc_nof_rids);
+
+
+  while (awc_rids[group].selector && group < awc_nof_rids){
+       if (awc_debug & 0x20000)
+               printk(KERN_CRIT "ridgroup %s  size %d \n", awc_rids[group].selector->name,awc_rids[group].size);
+
+       awc_proc_priv[device_number].proc_table[group].ctl_name = group +1;
+       awc_proc_priv[device_number].proc_table[group+1].ctl_name = 0;
+       awc_proc_priv[device_number].proc_table[group].procname = awc_rids[group].selector->name;
+       awc_proc_priv[device_number].proc_table[group].data     = awc_proc_buff;
+       awc_proc_priv[device_number].proc_table[group].maxlen  = sizeof(awc_proc_buff) -1;
+       awc_proc_priv[device_number].proc_table[group].mode     = 0600;
+       awc_proc_priv[device_number].proc_table[group].child    = kmalloc(sizeof(struct ctl_table) * (awc_rids[group].size +2), GFP_KERNEL);
+       awc_proc_priv[device_number].proc_table[group].proc_handler = NULL;
+       awc_proc_priv[device_number].proc_table[group].strategy = NULL;
+       awc_proc_priv[device_number].proc_table[group].de       = NULL;
+       awc_proc_priv[device_number].proc_table[group].extra1   = NULL;
+       awc_proc_priv[device_number].proc_table[group].extra2   = NULL;
+       if (!awc_proc_priv[device_number].proc_table[group].child) {
+               awc_proc_priv[device_number].proc_table[group].ctl_name = 0;
+               printk(KERN_CRIT "Out of memory on aironet4500_proc huge table alloc \n");
+               return 0;
+       }
+       rid=0;
+       while (awc_rids[group].rids[rid].selector && (rid < awc_rids[group].size -1)){
+
+//             DEBUG(0x20000,"rid %s  \n", awc_rids[group].rids[rid].name);
+
+               awc_proc_priv[device_number].proc_table[group].child[rid].ctl_name      = rid +1;
+               awc_proc_priv[device_number].proc_table[group].child[rid+1].ctl_name    = 0;
+               awc_proc_priv[device_number].proc_table[group].child[rid].procname      = awc_rids[group].rids[rid].name;
+               if (awc_rids[group].rids[rid].array > 1 ||
+                   awc_rids[group].rids[rid].bits  > 32 ){
+                       awc_proc_priv[device_number].proc_table[group].child[rid].data          = awc_proc_buff;
+                       awc_proc_priv[device_number].proc_table[group].child[rid].maxlen        = sizeof(awc_proc_buff) -1;             
+               } else {
+                       awc_proc_priv[device_number].proc_table[group].child[rid].data          = &awc_int_buff;
+                       awc_proc_priv[device_number].proc_table[group].child[rid].maxlen        = sizeof(awc_int_buff);
+         
+               }
+                       if ( awc_rids[group].rids[rid].read_only ||
+                    awc_rids[group].rids[rid].selector->read_only )
+                       awc_proc_priv[device_number].proc_table[group].child[rid].mode          = 0400;
+               else
+                       awc_proc_priv[device_number].proc_table[group].child[rid].mode          = 0600;
+               awc_proc_priv[device_number].proc_table[group].child[rid].child         = NULL;
+               awc_proc_priv[device_number].proc_table[group].child[rid].proc_handler  = awc_proc_fun;
+               awc_proc_priv[device_number].proc_table[group].child[rid].strategy      = NULL;
+               awc_proc_priv[device_number].proc_table[group].child[rid].de            = NULL;
+               awc_proc_priv[device_number].proc_table[group].child[rid].extra1        = (void *) &(((struct awc_private* )aironet4500_devices[device_number]->priv)->rid_dir[group]);
+               awc_proc_priv[device_number].proc_table[group].child[rid].extra2        = (void *) &(awc_rids[group].rids[rid]);
+
+               rid++;  
+       }
+       
+       group++;
+
+  };
+
+       awc_proc_priv[device_number].sysctl_header = 
+               register_sysctl_table(awc_proc_priv[device_number].proc_table_sys_root,0);
+       AWC_ENTRY_EXIT_DEBUG("exit");
+
+       if (awc_proc_priv[device_number].sysctl_header)
+               return 0;
+       return 1;  
+
+};
+
+int awc_proc_unset_device(int device_number){
+  int k;
+
+ AWC_ENTRY_EXIT_DEBUG("awc_proc_unset_device");
+  if (awc_proc_priv[device_number].sysctl_header){
+       unregister_sysctl_table(awc_proc_priv[device_number].sysctl_header);
+       awc_proc_priv[device_number].sysctl_header = NULL;
+  }
+  if (awc_proc_priv[device_number].proc_table){
+         for (k=0; awc_proc_priv[device_number].proc_table[k].ctl_name ; k++ ){
+               if (awc_proc_priv[device_number].proc_table[k].child)
+                       kfree(awc_proc_priv[device_number].proc_table[k].child);
+         }
+         kfree(awc_proc_priv[device_number].proc_table);
+         awc_proc_priv[device_number].proc_table = NULL;
+  }
+  if (awc_proc_priv[device_number].proc_table_device_root[0].ctl_name)
+          awc_proc_priv[device_number].proc_table_device_root[0].ctl_name = 0;
+  if (awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name)
+          awc_proc_priv[device_number].proc_table_sys_root[0].ctl_name = 0;
+  
+       AWC_ENTRY_EXIT_DEBUG("exit");
+   return 0;
+};
+
+int init_module(void) {
+       int i=0;
+
+       AWC_ENTRY_EXIT_DEBUG("init_module");
+
+
+       for (i=0; i < MAX_AWCS;  i++){
+               awc_proc_set_device(i);
+       }
+
+       awc_register_proc(awc_proc_set_device, awc_proc_unset_device);
+
+       awc_driver_sysctl_header = register_sysctl_table(awc_root_table,0);
+
+       AWC_ENTRY_EXIT_DEBUG("exit");
+       return 0;
+
+};
+
+void cleanup_module(void){
+
+       int i=0;
+       AWC_ENTRY_EXIT_DEBUG("cleanup_module");
+       awc_unregister_proc();
+       for (i=0; i < MAX_AWCS;  i++){
+               awc_proc_unset_device(i);
+       }
+       if (awc_driver_sysctl_header)
+               unregister_sysctl_table(awc_driver_sysctl_header);
+       AWC_ENTRY_EXIT_DEBUG("exit");
+};
+
+#endif // whole proc system styff
\ No newline at end of file
diff --git a/drivers/net/aironet4500_rid.c b/drivers/net/aironet4500_rid.c
new file mode 100644 (file)
index 0000000..99163c7
--- /dev/null
@@ -0,0 +1,2200 @@
+/*
+ *      Aironet 4500 Pcmcia driver
+ *
+ *             Elmer Joandi, Januar 1999
+ *     Copyright Elmer Joandi, all rights restricted
+ *     
+ *
+ *     Revision 0.1 ,started  30.12.1998
+ *
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+#include "aironet4500.h"
+
+
+
+#define awc_RID_gen_RidLen                             {(const struct aironet4500_rid_selector *)&aironet4500_RID_Select_General_Config,0x0000, 8,1,1,1,0, 0xffffffff,0x0000, "Length of RID" }
+#define awc_RID_gen_OperatingMode_adhoc                {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0000,"Opmode IBSS Adhoc operation" } // Without AP
+#define awc_RID_gen_OperatingMode_Infrastructure       {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0001,"Opmode Infrastructure Station operation" }// With AP
+#define awc_RID_gen_OperatingMode_AP                   {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0002,"Opmode Access Point" } // Aironet doesnt release info on use 
+#define awc_RID_gen_OperatingMode_AP_and_repeater      {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000003,0x0003,"Opmode Access Point and Repeater" } // no info
+#define awc_RID_gen_OperatingMode_No_payload_modify    {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000100,0x0100,"Opmode Payload without modify" } 
+#define awc_RID_gen_OperatingMode_LLC_802_3_convert    {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000100,0x0000,"Opmode LLC -> 802.3 convert" }
+#define awc_RID_gen_OperatingMode_proprietary_ext      {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000200,0x0200,"Opmode Aironet Extentsions enabled" } // neened for 11Mbps
+#define awc_RID_gen_OperatingMode_no_proprietary_ext   {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0,0x00000200,0x0000,"Opmode Aironet Extentsions disabled" }
+#define awc_RID_gen_OperatingMode_AP_ext               {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000400,0x0400,"Opmode AP Extentsions enabled" }  // no info
+#define awc_RID_gen_OperatingMode_no_AP_ext            {&aironet4500_RID_Select_General_Config,0x0002,16,1,1,0,0, 0x00000400,0x0000,"Opmode AP Extentsions disabled" }
+#define awc_RID_gen_ReceiveMode                        {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000ffff,0x0000,"RX Mode"}
+#define awc_RID_gen_ReceiveMode_BMA                    {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0000,"RX Mode BC MC ADDR"}
+#define awc_RID_gen_ReceiveMode_BA                     {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0001,"RX Mode BC ADDR"}
+#define awc_RID_gen_ReceiveMode_A                      {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0002,"RX Mode ADDR"}
+#define awc_RID_gen_ReceiveMode_802_11_monitor         {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0003,"RX Mode 802.11 Monitor current BSSID"}
+#define awc_RID_gen_ReceiveMode_802_11_any_monitor     {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0004,"RX Mode 802.11 Monitor any BSSID"}
+#define awc_RID_gen_ReceiveMode_LAN_monitor            {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x0000000f,0x0005,"RX Mode LAN Monitor current BSSID"}
+#define awc_RID_gen_ReceiveMode_802_3_hdr_disable      {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x00000100,0x0100,"RX Mode Disable RX 802.3 Header"}
+#define awc_RID_gen_ReceiveMode_802_3_hdr_enable       {&aironet4500_RID_Select_General_Config,0x0004,16,1,1,0,0,0x00000100,0x0000,"RX Mode Enable RX 802.3 header"}
+#define awc_RID_gen_Fragmentation_threshold            {&aironet4500_RID_Select_General_Config,0x0006,16,1,1,0,0,0x0000ffff,0x0000,"Fragmentation Threshold"}          // treshold of packet size starting to be fragmented
+#define awc_RID_gen_RTS_threshold                      {&aironet4500_RID_Select_General_Config,0x0008,16,1,1,0,0,0xffff,0x0000,"RTS Threshold"}        // packet size, larger ones get sent with RTS/CTS
+#define awc_RID_gen_Station_Mac_Id                     {&aironet4500_RID_Select_General_Config,0x000A, 8,6,1,0,0,0xff,0,"Station MAC Id"}
+#define awc_RID_gen_Supported_rates                    {&aironet4500_RID_Select_General_Config,0x0010, 8,8,1,0,1,0xff,0x00,"Supported Rates"}  // Hex encoded 500kbps 
+#define awc_RID_gen_Basic_Rate                                 {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x80,0x80,"Basic Rate"}       // if 0x80 bit is set
+#define awc_RID_gen_Rate_500kbps                       {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x01,"Rate 500kbps"}
+#define awc_RID_gen_Rate_1Mbps                                 {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x02,"Rate 1Mbps"}
+#define awc_RID_gen_Rate_2Mbps                                 {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x04,"Rate 2Mbps"}
+#define awc_RID_gen_Rate_4Mbps                                 {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x08,"Rate 4Mbps"}
+#define awc_RID_gen_Rate_5Mbps                                 {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x0B,"Rate 5.5Mbps"}
+#define awc_RID_gen_Rate_10Mbps                        {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x14,"Rate 10Mbps"}
+#define awc_RID_gen_Rate_11Mbps                        {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0x7f,0x16,"Rate 11Mbps"}
+#define awc_RID_gen_BasicRate_500kbps                  {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x81,"BasicRate 500kbps"}
+#define awc_RID_gen_BasicRate_1Mbps                            {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x82,"BasicRate 1Mbps"}
+#define awc_RID_gen_BasicRate_2Mbps                            {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x84,"BasicRate 2Mbps"}
+#define awc_RID_gen_BasicRate_4Mbps                            {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x88,"BasicRate 4Mbps"}
+#define awc_RID_gen_BasicRate_5Mbps                            {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x8B,"BasicRate 5.5Mbps"}
+#define awc_RID_gen_BasicRate_10Mbps                   {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x94,"BasicRate 10Mbps"}
+#define awc_RID_gen_BasicRate_11Mbps                   {&aironet4500_RID_Select_General_Config,0x0010, 8,1,1,0,1,0xff,0x96,"BasicRate 11Mbps"}
+
+
+#define awc_RID_gen_Long_retry_limit                   {&aironet4500_RID_Select_General_Config,0x0018,16, 1,1,0,0,0,0,"Short Retry Limit"}
+#define awc_RID_gen_Short_retry_limit                  {&aironet4500_RID_Select_General_Config,0x001A,16, 1,1,0,0,0,0,"Long Retry Limit"}
+#define awc_RID_gen_Tx_MSDU_lifetime                   {&aironet4500_RID_Select_General_Config,0x001C,16, 1,1000,0,0,0,0,"TX MSDU Lifetime"}
+#define awc_RID_gen_Rx_MSDU_lifetime                   {&aironet4500_RID_Select_General_Config,0x001E,16, 1,1000,0,0,0,0,"RX MSDU Lifetime"}
+#define awc_RID_gen_Stationary                                 {&aironet4500_RID_Select_General_Config,0x0020,16, 1,1,0,0,0,0,"Stationary"}
+#define awc_RID_gen_BC_MC_Ordering                     {&aironet4500_RID_Select_General_Config,0x0022,16, 1,1,0,0,0,0,"Strictly order Bcast and Mcast"}
+#define awc_RID_gen_Device_type                        {&aironet4500_RID_Select_General_Config,0x0024,16, 1,1,1,0,0xffff,0x0065,"Radio Type PC4500"}
+#define awc_RID_gen_Reserved_0x0026                    {&aironet4500_RID_Select_General_Config,0x0026, 8,10,1,0,0,0,0,"Reserved 0x0028"}
+
+
+//SCANNING/ASSOCIATING
+#define awc_RID_gen_ScanMode                           awc_def_gen_RID(0x0030,"ScanMode",              16,0xf,0, NULL)
+#define awc_RID_gen_ScanMode_Active                    awc_def_gen_RID(0x0030,"ScanMode Active",               16,0xf,0, "Active")
+#define awc_RID_gen_ScanMode_Passive                   awc_def_gen_RID(0x0030,"ScanMode Passive",              16,0xf,1, "Passive")
+#define awc_RID_gen_ScanMode_Aironet_ext               awc_def_gen_RID(0x0030,"ScanMode Aironet Ext",          16,0xf,2, "Aironet Ext")
+#define awc_RID_gen_ProbeDelay                                 awc_def_gen_RID(0x0032,"ProbeDelay",            16,0xffff,0," msek")            //                 Time ms to wait after switching to a channel for clear channel assessment.
+#define awc_RID_gen_ProbeEnergyTimeout                         awc_def_gen_RID(0x0034,"ProbeEnergyTimeout",    16,0xffff,0,"msek")     //          Time to wait for energy after an active probe.
+#define awc_RID_gen_ProbeResponseTimeout               awc_def_gen_RID(0x0036,"ProbeResponseTimeout",  16,0xffff,0,"msek")     // Time to wait for a probe response after energy detected.
+#define awc_RID_gen_BeaconListenTimeout                awc_def_gen_RID(0x0038,"BeaconListenTimeout",   16,0xffff,0,"msek")     //    0 default    40          Time to listen for a beacon on each channel.
+#define awc_RID_gen_IbssJoinNetTimeout                         awc_def_gen_RID(0x003A,"IbssJoinNetTimeout",    16,0xffff,0,"msek")     //       0 default    10000       IBSS: Time to scan for an IBSS before forming a
+#define awc_RID_gen_AuthenticationTimeout              awc_def_gen_RID(0x003C,"AuthenticationTimeout",16,0xffff,0,"msek")      //       0 default    2000        Time limit after which an authentication sequence will
+#define awc_RID_gen_AuthenticationType                         awc_def_gen_RID(0x003E,"AuthenticationType",    16,0xffff,0,NULL)       //       0 default    1 (open) //    Selects the desired authentication and privacy methods.             
+#define awc_RID_gen_AuthenticationType_None            awc_def_gen_RID(0x003E,"AuthenticationType None",       16,0xffff,0,"None")     //   0x00 = None        
+#define awc_RID_gen_AuthenticationType_Open            awc_def_gen_RID(0x003E,"AuthenticationType Open",       16,0xffff,1,"Open")     //             0x01 = Open
+#define awc_RID_gen_AuthenticationType_Shared          awc_def_gen_RID(0x003E,"AuthenticationType Shared-Key", 16,0xffff,2,"Shared-Key")       //     0x02 = Shared-Key
+#define awc_RID_gen_AuthenticationType_Exclude_Open    awc_def_gen_RID(0x003E,"AuthenticationType Exclude Open",       16,0xffff,4,"Exclude Open")     //              0x04 = Exclude Unencrypted
+#define awc_RID_gen_AssociationTimeout                         awc_def_gen_RID(0x0040,"AssociationTimeout",    16,0xffff,0,"msek")     //       0 default    2000        ESS: Time limit after which an association sequence
+#define awc_RID_gen_SpecifiedAPtimeout                         awc_def_gen_RID(0x0042,"SpecifiedAPtimeout",    16,0xffff,0,"msek")     //       0 default    10000       0 selects the factory default [~10 sec].
+#define awc_RID_gen_OfflineScanInterval                awc_def_gen_RID(0x0044,"OfflineScanInterval",   16,0xffff,0,"msek")     //       0            0           0 disables offline scanning.(kus)        The time period between offline scans.
+#define awc_RID_gen_OfflineScanDuration                awc_def_gen_RID(0x0046,"OfflineScanDuration",   16,0xffff,0,"msek")     //       0            0           0 disables offline scanning. //    (kus)        The duration of an offline scan.
+#define awc_RID_gen_LinkLossDelay                      awc_def_gen_RID(0x0048,"LinkLossDelay", 16,0xffff,0,"msek")     //       0  0 Time to delay before reporting a loss of association
+#define awc_RID_gen_MaxBeaconLostTime                  awc_def_gen_RID(0x004A,"MaxBeaconLostTime",     16,0xffff,0,"msek")     //      0 default    500        If no beacons are received for this time period, the unit
+#define awc_RID_gen_RefreshInterval                    awc_def_gen_RID(0x004C,"RefreshInterval",       16,0xffff,0,"msek")             //      0 default    10000      At the specified interval, the station will send a refresh
+//POWER SAVE OPERATION
+#define awc_RID_gen_PowerSaveMode                      awc_def_gen_RID(0x0050,"PowerSaveMode", 16,0xffff,0,NULL)               //      0  0Note, for IBSS there is only one PSP mode and it is only enabled if the ATIMwindow is non-zero.
+#define awc_RID_gen_PowerSaveMode_CAM          awc_def_gen_RID(0x0050,"PowerSaveMode CAM",     16,0x000f,0,"CAM")      // 0 = CAM
+#define awc_RID_gen_PowerSaveMode_PSP          awc_def_gen_RID(0x0050,"PowerSaveMode PSP",     16,0x000f,1,"PSP")      // 1 = PSP
+#define awc_RID_gen_PowerSaveMode_Fast_PSP             awc_def_gen_RID(0x0050,"PowerSaveMode Fast PSP",        16,0x000f,2,"Fast PSP") //2 = PSP-CAM [FASTPSP]
+#define awc_RID_gen_SleepForDTIMs                      awc_def_gen_RID(0x0052,"SleepForDTIMs", 16,0xffff,0,"DTIMs")    //      0  0If non-zero, the station may sleep through DTIMs; this
+#define awc_RID_gen_ListenInterval                     awc_def_gen_RID(0x0054,"ListenInterval",        16,0xffff,0,"msek")             //      0 default    200 kus    Maximum time to awaken for TIMs. 0 selects factory
+#define awc_RID_gen_FastListenInterval                 awc_def_gen_RID(0x0056,"FastListenInterval",    16,0xffff,0,"msek")     // 0 default    100 kus    The listen interval to be used immediately after
+#define awc_RID_gen_ListenDecay                        awc_def_gen_RID(0x0058,"ListenDecay",           16,0xffff,0,"times")    //      0 default    2Number of times to use the current listen interval
+#define awc_RID_gen_FastListenDelay            awc_def_gen_RID(0x005A,"FastListenDelay",       16,0xffff,0,"msek")     //      0 default    200 kus    Time interval to delay before going to fast listen
+#define awc_RID_gen_Reserved0x005C                     awc_def_gen_RID(0x005C,"Reserved0x005C",        32,0,0,"")      //
+//ADHOC (or AP) OPERATION
+#define awc_RID_gen_BeaconPeriod                       awc_def_gen_RID(0x0060,"BeaconPeriod",          16,0xffff,0,"msek")     //      0 default    100        0 selects the factory default of [~100 ms].  (kus)
+#define awc_RID_gen_AtimDuration                       awc_def_gen_RID(0x0062,"AtimDuration",          16,0xffff,0,"msek")     //      0 default    5 kus      The time period reserved for ATIMs immediately after (kus)      the beacon. 0xFFFF will disable the ATIM window; power save mode will not operate.This parameter only applies to adhoc/IBSS.
+#define awc_RID_gen_Reserved0x0064                     awc_def_gen_RID(0x0064,"Reserved64",            16,0xffff,0,"") //      0  0Reserved for future use
+#define awc_RID_gen_DSChannel                  awc_def_gen_RID(0x0066,"DSChannel",             16,0xffff,0,"") //      0 default    1The desired operating channel.  ()refer to 802.11)       For North America, a Channel of 0 is 2412 MHz.
+#define awc_RID_gen_Reserved0x0068                     awc_def_gen_RID(0x0068,"Reserved68",            16,0xffff,0,"") //      0  0Reserved for future use
+#define awc_RID_gen_DTIM_Period                        awc_def_gen_RID(0x006A,"DTIM Period",           16,0xffff,0,"") //      0 default    1Selects how often a beacon is a DTIM for APs
+#define awc_RID_gen_Reserved0x0006C            awc_def_gen_RID(0x006C,"Reserved6C",            32,0xffffffff,0,"")     //    0's0's        Reserved for future use
+//RADIO OPERATION
+#define awc_RID_gen_RadioSpreadType            awc_def_gen_RID(0x0070,"RadioSpreadType",       16,0xffff,0,NULL)       //      0 default    0Selects the radio operational mode. By default, this will
+#define awc_RID_gen_RadioSpreadType_FH                 awc_def_gen_RID(0x0070,"RadioSpreadType FH",    16,0xffff,0,"FH")       //0 = 802.11 FH Radio (Default)
+#define awc_RID_gen_RadioSpreadType_DS                 awc_def_gen_RID(0x0070,"RadioSpreadType DS",    16,0xffff,1,"DS")       //1 = 802.11 DS Radio
+#define awc_RID_gen_RadioSpreadType_LM                 awc_def_gen_RID(0x0070,"RadioSpreadType LM2000",        16,0xffff,2,"LM2000")   //2 = LM2000 (Legacy) DS Radio
+#define awc_RID_gen_TX_antenna_Diversity               awc_def_gen_RID(0x0072,"TX antenna Diversity",  16,0xff00,0,NULL)       //       0 default    0x0303    This field is bit-mapped to select the operational
+#define awc_RID_gen_TX_antenna_Diversity_default       awc_def_gen_RID(0x0072,"TX antenna Diversity Default",  16,0xff00,0x0000,"Default")     //  0 = Diversity as programmed at the factory
+#define awc_RID_gen_TX_antenna_Diversity_1             awc_def_gen_RID(0x0072,"TX antenna Diversity Antenna 1",        16,0xff00,0x0100,"Antenna 1")   //  1 = Antenna 1 only
+#define awc_RID_gen_TX_antenna_Diversity_2             awc_def_gen_RID(0x0072,"TX antenna Diversity Antenna 2",        16,0xff00,0x0200,"Antenna 2")   //  2 = Antenna 2 only
+#define awc_RID_gen_TX_antenna_Diversity_both  awc_def_gen_RID(0x0072,"TX antenna Diversity both antennas",    16,0xff00,0x0300,"both antennas")       //  3 = Antennas 1 and 2 are active
+#define awc_RID_gen_RX_antenna_Diversity               awc_def_gen_RID(0x0072,"RX antenna Diversity",  16,0x00ff,0,NULL)       //       0 default    0x0303    This field is bit-mapped to select the operational
+#define awc_RID_gen_RX_antenna_Diversity_default       awc_def_gen_RID(0x0072,"RX antenna Diversity Default",  16,0x00ff,0,"Default")  //  0 = Diversity as programmed at the factory
+#define awc_RID_gen_RX_antenna_Diversity_1             awc_def_gen_RID(0x0072,"RX antenna Diversity Antenna 1",        16,0x00ff,1,"Antenna 1")        //  1 = Antenna 1 only
+#define awc_RID_gen_RX_antenna_Diversity_2             awc_def_gen_RID(0x0072,"RX antenna Diversity Antenna 2",        16,0x00ff,2,"Antenna 2")        //  2 = Antenna 2 only
+#define awc_RID_gen_RX_antenna_Diversity_both  awc_def_gen_RID(0x0072,"RX antenna Diversity both antennas",    16,0x00ff,3,"both antennas")    //
+#define awc_RID_gen_TransmitPower                      awc_def_gen_RID(0x0074,"TransmitPower", 16,0xffff,0,"mW (rounded up, btw)")     //       0 default    250 or    0 selects the default (maximum power allowed for the
+#define awc_RID_gen_RSSIthreshold                      awc_def_gen_RID(0x0076,"RSSIthreshold", 16,0xffff,0,"units")    //       0 default    0         RSSI threshold. 0 selects factory default.
+#define awc_RID_gen_Modulation                                 awc_def_gen_RID(0x0078,"Modulation",    8,0xff,0,"")    //     modulation type
+#define awc_RID_gen_Reserved0x0079                     awc_def_gen_RID(0x0079,"Reserved0x0079",        56,0xff,0,"")   //     0's0's       reserved for future radio specific parameters
+
+
+//AIRONET EXTENSIONS
+#define awc_RID_gen_NodeName                   awc_def_gen_RID(0x0080,"NodeName",              128,0,0,"")     //    0  0         Station name.
+#define awc_RID_gen_ARLThreshold                       awc_def_gen_RID(0x0090,"ARLThreshold",          16,0xffff,0,"times")    //       0 default    0xFFFF    0 selects the factory defaults. (which for now is
+#define awc_RID_gen_ARLDecay                   awc_def_gen_RID(0x0092,"ARLDecay",              16,0xffff,0,"times")    //       0 default    0xFFFF    0 selects the factory defaults. (which for now is
+#define awc_RID_gen_ARLDelay                   awc_def_gen_RID(0x0094,"ARLDelay",              16,0xffff,0,"times")    //       0 default    0xFFFF    0 selects the factory defaults. (which for now is
+#define awc_RID_gen_Unused0x0096                       awc_def_gen_RID(0x0096,"Unused",                16,0,0,"")      //
+#define awc_RID_gen_MagicPacketAction          awc_def_gen_RID(0x0098,"MagicPacketAction",     8,0xff,0," hell knows what")    //        0  0         0 selects no action to be taken on a magic packet and"
+#define awc_RID_gen_MagicPacketControl                 awc_def_gen_RID(0x0099,"MagicPacketControl",    8,0xff,0," hell know what")     //        0  0         0 will disable the magic packet mode command"
+
+
+#define awc_RID_act_RidLen                             {&aironet4500_RID_Select_Active_Config,0x0000, 8,1,1,1,0, 0xffffffff,0x0000, "Length of RID" }
+#define awc_RID_act_OperatingMode_adhoc                {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0000,"Opmode IBSS Adhoc operation" }
+#define awc_RID_act_OperatingMode_Infrastructure       {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0001,"Opmode Infrastructure Station operation" }
+#define awc_RID_act_OperatingMode_AP           {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0002,"Opmode Access Point" }
+#define awc_RID_act_OperatingMode_AP_and_repeater      {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000003,0x0003,"Opmode Access Point and Repeater" }
+#define awc_RID_act_OperatingMode_No_payload_modify    {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000100,0x0100,"Opmode Payload without modify" }
+#define awc_RID_act_OperatingMode_LLC_802_3_convert    {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000100,0x0000,"Opmode LLC -> 802.3 convert" }
+#define awc_RID_act_OperatingMode_proprietary_ext      {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000200,0x0200,"Opmode Aironet Extentsions enabled" }
+#define awc_RID_act_OperatingMode_no_proprietary_ext {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0,0x00000200,0x0000,"Opmode Aironet Extentsions disabled" }
+#define awc_RID_act_OperatingMode_AP_ext               {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000400,0x0400,"Opmode AP Extentsions enabled" }
+#define awc_RID_act_OperatingMode_no_AP_ext            {&aironet4500_RID_Select_Active_Config,0x0002,16,1,1,0,0, 0x00000400,0x0000,"Opmode AP Extentsions disabled" }
+#define awc_RID_act_ReceiveMode                        {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0xffffffff,0x0000,"RX Mode"}
+#define awc_RID_act_ReceiveMode_BMA            {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0000,"RX Mode BC MC ADDR"}
+#define awc_RID_act_ReceiveMode_BA                     {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0001,"RX Mode BC ADDR"}
+#define awc_RID_act_ReceiveMode_A                      {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0002,"RX Mode ADDR"}
+#define awc_RID_act_ReceiveMode_802_11_monitor {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0003,"RX Mode 802.11 Monitor current BSSID"}
+#define awc_RID_act_ReceiveMode_802_11_any_monitor     {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0004,"RX Mode 802.11 Monitor any BSSID"}
+#define awc_RID_act_ReceiveMode_LAN_monitor    {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x0000000f,0x0005,"RX Mode LAN Monitor current BSSID"}
+#define awc_RID_act_ReceiveMode_802_3_hdr_disable      {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x00000100,0x0100,"RX Mode Disable RX 802.3 Header"}
+#define awc_RID_act_ReceiveMode_802_3_hdr_enable       {&aironet4500_RID_Select_Active_Config,0x0004,16,1,1,0,0,0x00000100,0x0000,"RX Mode Enable RX 802.3 header"}
+#define awc_RID_act_Fragmentation_threshold            {&aironet4500_RID_Select_Active_Config,0x0006,16,1,1,0,0,0x0000ffff,0x0000,"Fragmentation Threshold"}
+#define awc_RID_act_RTS_threshold                      {&aironet4500_RID_Select_Active_Config,0x0008,16,1,1,0,0,0xffff,0x0000,"RTS Threshold"}
+#define awc_RID_act_Station_Mac_Id                     {&aironet4500_RID_Select_Active_Config,0x000A, 8,6,1,0,0,0xff,0,"Station MAC Id"}
+#define awc_RID_act_Supported_rates                    {&aironet4500_RID_Select_Active_Config,0x0010, 8,8,1,0,1,0xff,0x00,"Supported Rates"}
+#define awc_RID_act_Basic_Rate                                 {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x80,0x80,"Basic Rate"}
+#define awc_RID_act_Rate_500kbps                       {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x01,"Rate 500kbps"}
+#define awc_RID_act_Rate_1Mbps                                 {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x02,"Rate 1Mbps"}
+#define awc_RID_act_Rate_2Mbps                                 {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x04,"Rate 2Mbps"}
+#define awc_RID_act_Rate_4Mbps                                 {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x08,"Rate 4Mbps"}
+#define awc_RID_act_Rate_5Mbps                                 {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x0B,"Rate 5.5Mbps"}
+#define awc_RID_act_Rate_10Mbps                        {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x14,"Rate 10Mbps"}
+#define awc_RID_act_Rate_11Mbps                        {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0x7f,0x16,"Rate 11Mbps"}
+#define awc_RID_act_BasicRate_500kbps                  {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x81,"BasicRate 500kbps"}
+#define awc_RID_act_BasicRate_1Mbps                            {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x82,"BasicRate 1Mbps"}
+#define awc_RID_act_BasicRate_2Mbps                            {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x84,"BasicRate 2Mbps"}
+#define awc_RID_act_BasicRate_4Mbps                            {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x88,"BasicRate 4Mbps"}
+#define awc_RID_act_BasicRate_5Mbps                            {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x8B,"BasicRate 5.5Mbps"}
+#define awc_RID_act_BasicRate_10Mbps                   {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x94,"BasicRate 10Mbps"}
+#define awc_RID_act_BasicRate_11Mbps                   {&aironet4500_RID_Select_Active_Config,0x0010, 8,1,1,0,1,0xff,0x96,"BasicRate 11Mbps"}
+
+
+#define awc_RID_act_Long_retry_limit           {&aironet4500_RID_Select_Active_Config,0x0018,16, 1,1,0,0,0,0,"Short Retry Limit"}
+#define awc_RID_act_Short_retry_limit          {&aironet4500_RID_Select_Active_Config,0x001A,16, 1,1,0,0,0,0,"Long Retry Limit"}
+#define awc_RID_act_Tx_MSDU_lifetime           {&aironet4500_RID_Select_Active_Config,0x001C,16, 1,1000,0,0,0,0,"TX MSDU Lifetime"}
+#define awc_RID_act_Rx_MSDU_lifetime           {&aironet4500_RID_Select_Active_Config,0x001E,16, 1,1000,0,0,0,0,"RX MSDU Lifetime"}
+#define awc_RID_act_Stationary                         {&aironet4500_RID_Select_Active_Config,0x0020,16, 1,1,0,0,0,0,"Stationary"}
+#define awc_RID_act_BC_MC_Ordering                     {&aironet4500_RID_Select_Active_Config,0x0022,16, 1,1,0,0,0,0,"Strictly order Bcast and Mcast"}
+#define awc_RID_act_Device_type                        {&aironet4500_RID_Select_Active_Config,0x0024,16, 1,1,1,0,0xffff,0x0065,"Radio Type PC4500"}
+#define awc_RID_act_Reserved_0x0026                    {&aironet4500_RID_Select_Active_Config,0x0026, 8,10,1,0,0,0,0,"Reserved 0x0028"}
+
+
+//SCANNING/ASSOCIATING
+#define awc_RID_act_ScanMode                   awc_def_act_RID(0x0030,"ScanMode",              16,0xf,0, NULL)
+#define awc_RID_act_ScanMode_Active            awc_def_act_RID(0x0030,"ScanMode Active",               16,0xf,0, "Active")
+#define awc_RID_act_ScanMode_Passive           awc_def_act_RID(0x0030,"ScanMode Passive",              16,0xf,1, "Passive")
+#define awc_RID_act_ScanMode_Aironet_ext               awc_def_act_RID(0x0030,"ScanMode Aironet Ext",  16,0xf,2, "Aironet Ext")
+#define awc_RID_act_ProbeDelay                         awc_def_act_RID(0x0032,"ProbeDelay",            16,0xffff,0," msek")            //                 Time ms to wait after switching to a channel for clear channel assessment.
+#define awc_RID_act_ProbeEnergyTimeout                 awc_def_act_RID(0x0034,"ProbeEnergyTimeout",    16,0xffff,0,"msek")     //          Time to wait for energy after an active probe.
+#define awc_RID_act_ProbeResponseTimeout               awc_def_act_RID(0x0036,"ProbeResponseTimeout",  16,0xffff,0,"msek")     // Time to wait for a probe response after energy detected.
+#define awc_RID_act_BeaconListenTimeout                awc_def_act_RID(0x0038,"BeaconListenTimeout",   16,0xffff,0,"msek")     //    0 default    40          Time to listen for a beacon on each channel.
+#define awc_RID_act_IbssJoinNetTimeout                 awc_def_act_RID(0x003A,"IbssJoinNetTimeout",    16,0xffff,0,"msek")     //       0 default    10000       IBSS: Time to scan for an IBSS before forming a
+#define awc_RID_act_AuthenticationTimeout              awc_def_act_RID(0x003C,"AuthenticationTimeout",16,0xffff,0,"msek")      //       0 default    2000        Time limit after which an authentication sequence will
+#define awc_RID_act_AuthenticationType                 awc_def_act_RID(0x003E,"AuthenticationType",    16,0xffff,0,NULL)       //       0 default    1 (open) //    Selects the desired authentication and privacy methods.             
+#define awc_RID_act_AuthenticationType_None    awc_def_act_RID(0x003E,"AuthenticationType None",       16,0xffff,0,"None")     //   0x00 = None        
+#define awc_RID_act_AuthenticationType_Open            awc_def_act_RID(0x003E,"AuthenticationType Open",       16,0xffff,1,"Open")     //             0x01 = Open
+#define awc_RID_act_AuthenticationType_Shared  awc_def_act_RID(0x003E,"AuthenticationType Shared-Key", 16,0xffff,2,"Shared-Key")       //     0x02 = Shared-Key
+#define awc_RID_act_AuthenticationType_Exclude_Open awc_def_act_RID(0x003E,"AuthenticationType Exclude Open",  16,0xffff,4,"Exclude Open")     //              0x04 = Exclude Unencrypted
+#define awc_RID_act_AssociationTimeout                 awc_def_act_RID(0x0040,"AssociationTimeout",    16,0xffff,0,"msek")     //       0 default    2000        ESS: Time limit after which an association sequence
+#define awc_RID_act_SpecifiedAPtimeout                 awc_def_act_RID(0x0042,"SpecifiedAPtimeout",    16,0xffff,0,"msek")     //       0 default    10000       0 selects the factory default [~10 sec].
+#define awc_RID_act_OfflineScanInterval                awc_def_act_RID(0x0044,"OfflineScanInterval",   16,0xffff,0,"msek")     //       0            0           0 disables offline scanning.(kus)        The time period between offline scans.
+#define awc_RID_act_OfflineScanDuration                awc_def_act_RID(0x0046,"OfflineScanDuration",   16,0xffff,0,"msek")     //       0            0           0 disables offline scanning. //    (kus)        The duration of an offline scan.
+#define awc_RID_act_LinkLossDelay                      awc_def_act_RID(0x0048,"LinkLossDelay", 16,0xffff,0,"msek")     //       0  0 Time to delay before reporting a loss of association
+#define awc_RID_act_MaxBeaconLostTime          awc_def_act_RID(0x004A,"MaxBeaconLostTime",     16,0xffff,0,"msek")     //      0 default    500        If no beacons are received for this time period, the unit
+#define awc_RID_act_RefreshInterval            awc_def_act_RID(0x004C,"RefreshInterval",       16,0xffff,0,"msek")             //      0 default    10000      At the specified interval, the station will send a refresh
+//POWER SAVE OPERATION
+#define awc_RID_act_PowerSaveMode                      awc_def_act_RID(0x0050,"PowerSaveMode", 16,0xffff,0,NULL)               //      0  0Note, for IBSS there is only one PSP mode and it is only enabled if the ATIMwindow is non-zero.
+#define awc_RID_act_PowerSaveMode_CAM          awc_def_act_RID(0x0050,"PowerSaveMode CAM",     16,0x000f,0,"CAM")      // 0 = CAM
+#define awc_RID_act_PowerSaveMode_PSP          awc_def_act_RID(0x0050,"PowerSaveMode PSP",     16,0x000f,1,"PSP")      // 1 = PSP
+#define awc_RID_act_PowerSaveMode_Fast_PSP             awc_def_act_RID(0x0050,"PowerSaveMode Fast PSP",        16,0x000f,2,"Fast PSP") //2 = PSP-CAM [FASTPSP]
+#define awc_RID_act_SleepForDTIMs                      awc_def_act_RID(0x0052,"SleepForDTIMs", 16,0xffff,0,"DTIMs")    //      0  0If non-zero, the station may sleep through DTIMs; this
+#define awc_RID_act_ListenInterval                     awc_def_act_RID(0x0054,"ListenInterval",        16,0xffff,0,"msek")             //      0 default    200 kus    Maximum time to awaken for TIMs. 0 selects factory
+#define awc_RID_act_FastListenInterval                 awc_def_act_RID(0x0056,"FastListenInterval",    16,0xffff,0,"msek")  //    0 default    100 kus    The listen interval to be used immediately after
+#define awc_RID_act_ListenDecay                        awc_def_act_RID(0x0058,"ListenDecay",           16,0xffff,0,"times")    //      0 default    2Number of times to use the current listen interval
+#define awc_RID_act_FastListenDelay            awc_def_act_RID(0x005A,"FastListenDelay",       16,0xffff,0,"msek")     //      0 default    200 kus    Time interval to delay before going to fast listen
+#define awc_RID_act_Reserved0x005C                     awc_def_act_RID(0x005C,"Reserved0x005C",        32,0,0,"")      //
+//ADHOC (or AP) OPERATION
+#define awc_RID_act_BeaconPeriod                       awc_def_act_RID(0x0060,"BeaconPeriod",          16,0xffff,0,"msek")     //      0 default    100        0 selects the factory default of [~100 ms].  (kus)
+#define awc_RID_act_AtimDuration                       awc_def_act_RID(0x0062,"AtimDuration",          16,0xffff,0,"msek")     //      0 default    5 kus      The time period reserved for ATIMs immediately after (kus)      the beacon. 0xFFFF will disable the ATIM window; power save mode will not operate.This parameter only applies to adhoc/IBSS.
+#define awc_RID_act_Reserved0x0064                     awc_def_act_RID(0x0064,"Reserved64",            16,0xffff,0,"") //      0  0Reserved for future use
+#define awc_RID_act_DSChannel                  awc_def_act_RID(0x0066,"DSChannel",             16,0xffff,0,"") //      0 default    1The desired operating channel.  ()refer to 802.11)       For North America, a Channel of 0 is 2412 MHz.
+#define awc_RID_act_Reserved0x0068                     awc_def_act_RID(0x0068,"Reserved68",            16,0xffff,0,"") //      0  0Reserved for future use
+#define awc_RID_act_DTIM_Period                        awc_def_act_RID(0x006A,"DTIM Period",           16,0xffff,0,"") //      0 default    1Selects how often a beacon is a DTIM for APs
+#define awc_RID_act_Reserved0x0006C            awc_def_act_RID(0x006C,"Reserved6C",            32,0xffffffff,0,"")     //    0's0's        Reserved for future use
+//RADIO OPERATION
+#define awc_RID_act_RadioSpreadType            awc_def_act_RID(0x0070,"RadioSpreadType",       16,0xffff,0,NULL)       //      0 default    0Selects the radio operational mode. By default, this will
+#define awc_RID_act_RadioSpreadType_FH                 awc_def_act_RID(0x0070,"RadioSpreadType FH",    16,0xffff,0,"FH")       //0 = 802.11 FH Radio (Default)
+#define awc_RID_act_RadioSpreadType_DS                 awc_def_act_RID(0x0070,"RadioSpreadType DS",    16,0xffff,1,"DS")       //1 = 802.11 DS Radio
+#define awc_RID_act_RadioSpreadType_LM                 awc_def_act_RID(0x0070,"RadioSpreadType LM2000",        16,0xffff,2,"LM2000")   //2 = LM2000 (Legacy) DS Radio
+#define awc_RID_act_TX_antenna_Diversity               awc_def_act_RID(0x0072,"TX antenna Diversity",  16,0xff00,0,NULL)       //       0 default    0x0303    This field is bit-mapped to select the operational
+#define awc_RID_act_TX_antenna_Diversity_default       awc_def_act_RID(0x0072,"TX antenna Diversity Default",  16,0xff00,0x0000,"Default")     //  0 = Diversity as programmed at the factory
+#define awc_RID_act_TX_antenna_Diversity_1             awc_def_act_RID(0x0072,"TX antenna Diversity Antenna 1",        16,0xff00,0x0100,"Antenna 1")   //  1 = Antenna 1 only
+#define awc_RID_act_TX_antenna_Diversity_2             awc_def_act_RID(0x0072,"TX antenna Diversity Antenna 2",        16,0xff00,0x0200,"Antenna 2")   //  2 = Antenna 2 only
+#define awc_RID_act_TX_antenna_Diversity_both  awc_def_act_RID(0x0072,"TX antenna Diversity both antennas",    16,0xff00,0x0300,"both antennas")       //  3 = Antennas 1 and 2 are active
+#define awc_RID_act_RX_antenna_Diversity               awc_def_act_RID(0x0072,"RX antenna Diversity",  16,0x00ff,0,NULL)       //       0 default    0x0303    This field is bit-mapped to select the operational
+#define awc_RID_act_RX_antenna_Diversity_default       awc_def_act_RID(0x0072,"RX antenna Diversity Default",  16,0x00ff,0,"Default")  //  0 = Diversity as programmed at the factory
+#define awc_RID_act_RX_antenna_Diversity_1             awc_def_act_RID(0x0072,"RX antenna Diversity Antenna 1",        16,0x00ff,1,"Antenna 1")        //  1 = Antenna 1 only
+#define awc_RID_act_RX_antenna_Diversity_2             awc_def_act_RID(0x0072,"RX antenna Diversity Antenna 2",        16,0x00ff,2,"Antenna 2")        //  2 = Antenna 2 only
+#define awc_RID_act_RX_antenna_Diversity_both  awc_def_act_RID(0x0072,"RX antenna Diversity both antennas",    16,0x00ff,3,"both antennas")    //
+#define awc_RID_act_TransmitPower                      awc_def_act_RID(0x0074,"TransmitPower", 16,0xffff,0,"mW (rounded up, btw)")     //       0 default    250 or    0 selects the default (maximum power allowed for the
+#define awc_RID_act_RSSIthreshold                      awc_def_act_RID(0x0076,"RSSIthreshold", 16,0xffff,0,"units")    //       0 default    0         RSSI threshold. 0 selects factory default.
+#define awc_RID_act_Reserved0x0078                     awc_def_act_RID(0x0078,"Reserved0x0078",        64,0,0,"")      //     0's0's       reserved for future radio specific parameters
+#define awc_RID_act_Modulation                                 awc_def_act_RID(0x0078,"Modulation",    8,0xff,0,"")    //     modulation type
+#define awc_RID_act_Reserved0x0079                     awc_def_act_RID(0x0079,"Reserved0x0079",        56,0xff,0,"")   //     0's0's       reserved for future radio specific parameters
+
+//AIRONET EXTENSIONS
+#define awc_RID_act_NodeName                   awc_def_act_RID(0x0080,"NodeName",              128,0,0,"")     //    0  0         Station name.
+#define awc_RID_act_ARLThreshold               awc_def_act_RID(0x0090,"ARLThreshold",          16,0xffff,0,"times")    //       0 default    0xFFFF    0 selects the factory defaults. (which for now is
+#define awc_RID_act_ARLDecay                   awc_def_act_RID(0x0092,"ARLDecay",              16,0xffff,0,"times")    //       0 default    0xFFFF    0 selects the factory defaults. (which for now is
+#define awc_RID_act_ARLDelay                   awc_def_act_RID(0x0094,"ARLDelay",              16,0xffff,0,"times")    //       0 default    0xFFFF    0 selects the factory defaults. (which for now is
+#define awc_RID_act_Unused0x0096               awc_def_act_RID(0x0096,"Unused",                16,0,0,"")      //
+#define awc_RID_act_MagicPacketAction          awc_def_act_RID(0x0098,"MagicPacketAction",     8,0xff,0," hell knows what")    //        0  0         0 selects no action to be taken on a magic packet and"
+#define awc_RID_act_MagicPacketControl                 awc_def_act_RID(0x0099,"MagicPacketControl",    8,0xff,0," hell know what")     //        0  0         0 will disable the magic packet mode command"
+
+
+
+// ***************************        SSID  RID
+
+
+
+#define awc_RID_SSID_RidLen                            awc_def_SSID_RID(0x0000,"RidLen",               16,0xffff,0,"") //RidLen     ",16,0xffff,,"")   //      read-only        Length of this RID including the length field 0x68
+#define awc_RID_SSID_Accept_any                awc_def_SSID_RID(0x0002,"Accept Any SSID",      16,0xffff,0,"Accept ANY SSID")  //
+#define awc_RID_SSIDlen1                       awc_def_SSID_RID(0x0002,"SSIDlen1",             16,0xffff,0,"") //      7      The length of the SSID1 byte string.
+#define awc_RID_SSID1                          awc_def_SSID_RID(0x0004,"SSID1",                255,0,0,"")     //    "tsunami"        The identifier uniquely identifying the wireless system.
+#define awc_RID_SSIDlen2                       awc_def_SSID_RID(0x0024,"SSIDlen2",             16,0xffff,0,"") //      0      The length of the SSID2 byte string.
+#define awc_RID_SSID2                          awc_def_SSID_RID(0x0026,"SSID2",                255,0,0,"")     //   0's    The identifier uniquely identifying the wireless system.
+#define awc_RID_SSIDlen3                       awc_def_SSID_RID(0x0046,"SSIDlen3",             16,0xffff,0,"") //      0      The length of the SSID3 byte string.
+#define awc_RID_SSID3                          awc_def_SSID_RID(0x0048,"SSID3",                255,0,0,"")     //    0's    The identifier uniquely identifying the wireless system.
+
+// AP list
+
+#define awc_RID_AP_List_RidLen                         awc_def_AP_List_RID(0x0000,"RidLen",            16,0xffff,0,"")         //      read-only     Length of this RID including the length field
+#define awc_RID_AP_List_SpecifiedAP1           awc_def_AP_List_RID(0x0002,"SpecifiedAP1",              48,0xff,0,"")   //    0   Specifies the MAC address of an access point to attempt to associate to first, before looking for other Access Points
+#define awc_RID_AP_List_SpecifiedAP2           awc_def_AP_List_RID(0x0008,"SpecifiedAP2",              48,0xff,0,"")   //    0   Allows for a secondary AP to associate to if the radio cannot associate to the primary AP.
+#define awc_RID_AP_List_SpecifiedAP3           awc_def_AP_List_RID(0x000E,"SpecifiedAP3",              48,0xff,0,"")   //    0   Allows for a third option when specifying a list of APs.
+#define awc_RID_AP_List_SpecifiedAP4           awc_def_AP_List_RID(0x0014,"SpecifiedAP4",              48,0xff,0,"")   //    0   Allows for a fourth option when specifying a list of  APs.
+
+//   Driver Name
+
+#define awc_RID_Dname_RidLen                   awc_def_Dname_RID(0x0000,"RidLen",              16,0xffff,0,"") //      read-only     Length of this RID including the length field
+#define awc_RID_Dname_DriverName               awc_def_Dname_RID(0x0002,"DriverName",          128,0,0,"")     // The driver name and version can be written here for  debugging support
+
+
+//       Encapsulation Transformations RID
+
+#define awc_RID_Enc_RidLen                     awc_def_Enc_RID(0x0000,"RidLen",        16,0xffff,0,"") //       read-only     Length of this RID including the length field
+#define awc_RID_Enc_EtherType1                         awc_def_Enc_RID(0x0002,"EtherType1",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_1                awc_def_Enc_RID(0x0004,"RX Action 1",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_1_RFC_1042       awc_def_Enc_RID(0x0004,"RX Action 1",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_1_802_11                 awc_def_Enc_RID(0x0004,"RX Action 1",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_1                awc_def_Enc_RID(0x0004,"TX Action 1",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_1_RFC_1042       awc_def_Enc_RID(0x0004,"TX Action 1",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_1_802_11                 awc_def_Enc_RID(0x0004,"Tx Action 1",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType2                         awc_def_Enc_RID(0x0006,"EtherType2",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_2                awc_def_Enc_RID(0x0008,"RX Action 2",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_2_RFC_1042       awc_def_Enc_RID(0x0008,"RX Action 2",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_2_802_11                 awc_def_Enc_RID(0x0008,"RX Action 2",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_2                awc_def_Enc_RID(0x0008,"TX Action 2",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_2_RFC_1042       awc_def_Enc_RID(0x0008,"TX Action 2",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_2_802_11                 awc_def_Enc_RID(0x0008,"Tx Action 2",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType3                         awc_def_Enc_RID(0x000A,"EtherType3",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_3                awc_def_Enc_RID(0x000C,"RX Action 3",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_3_RFC_1042       awc_def_Enc_RID(0x000C,"RX Action 3",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_3_802_11                 awc_def_Enc_RID(0x000C,"RX Action 3",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_3_               awc_def_Enc_RID(0x000C,"TX Action 3",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_3_RFC_1042       awc_def_Enc_RID(0x000C,"TX Action 3",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_3_802_11                 awc_def_Enc_RID(0x000C,"Tx Action 3",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType4                 awc_def_Enc_RID(0x000E,"EtherType4",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_4                        awc_def_Enc_RID(0x0010,"RX Action 4",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_4_RFC_1042       awc_def_Enc_RID(0x0010,"RX Action 4",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_4_802_11                 awc_def_Enc_RID(0x0010,"RX Action 4",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_4                awc_def_Enc_RID(0x0010,"TX Action 4",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_4_RFC_1042       awc_def_Enc_RID(0x0010,"TX Action 4",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_4_802_11                 awc_def_Enc_RID(0x0010,"Tx Action 4",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType5                         awc_def_Enc_RID(0x0012,"EtherType5",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_5                awc_def_Enc_RID(0x0014,"RX Action 5",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_5_RFC_1042       awc_def_Enc_RID(0x0014,"RX Action 5",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_5_802_11                 awc_def_Enc_RID(0x0014,"RX Action 5",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_5                awc_def_Enc_RID(0x0014,"TX Action 5",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_5_RFC_1042       awc_def_Enc_RID(0x0014,"TX Action 5",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_5_802_11                 awc_def_Enc_RID(0x0014,"Tx Action 5",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType6                         awc_def_Enc_RID(0x0016,"EtherType6",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_6                awc_def_Enc_RID(0x0018,"RX Action 6",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_6_RFC_1042       awc_def_Enc_RID(0x0018,"RX Action 6",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_6_802_11                 awc_def_Enc_RID(0x0018,"RX Action 6",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_6                awc_def_Enc_RID(0x0018,"TX Action 6",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_6_RFC_1042       awc_def_Enc_RID(0x0018,"TX Action 6",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_6_802_11                 awc_def_Enc_RID(0x0018,"Tx Action 6",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType7                         awc_def_Enc_RID(0x001A,"EtherType7",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_7                awc_def_Enc_RID(0x001C,"RX Action 8",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_7_RFC_1042       awc_def_Enc_RID(0x001C,"RX Action 7",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_7_802_11                 awc_def_Enc_RID(0x001C,"RX Action 7",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_7                awc_def_Enc_RID(0x001C,"TX Action 7",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_7_RFC_1042       awc_def_Enc_RID(0x001C,"TX Action 7",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_7_802_11                 awc_def_Enc_RID(0x001C,"Tx Action 7",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_EtherType8                         awc_def_Enc_RID(0x001E,"EtherType7",    16,0xffff,0,"") //       0   Note, the ethertype values are in network transmission order.  So IP (0x800) is actually (0x0008). Zero ends the list and selects the default action.
+#define awc_RID_Enc_Action_RX_8                awc_def_Enc_RID(0x0020,"RX Action 8",   16,0x0001,0,NULL)       //       0   This field is bit encoded as follows:
+#define awc_RID_Enc_Action_RX_8_RFC_1042       awc_def_Enc_RID(0x0020,"RX Action 8",   16,0x0001,1,"RX RFC1042")       //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_RX_8_802_11                 awc_def_Enc_RID(0x0020,"RX Action 8",   16,0x0001,0,"RX 802.11")        //  bit 0   (0x0001)  1=RFC1042 is kept for receive packets.
+#define awc_RID_Enc_Action_TX_8                awc_def_Enc_RID(0x0020,"TX Action 8",   16,0x0002,0,NULL)       //
+#define awc_RID_Enc_Action_TX_8_RFC_1042       awc_def_Enc_RID(0x0020,"TX Action 8",   16,0x0002,1,"TX 802.11" )       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+#define awc_RID_Enc_Action_TX_8_802_11                 awc_def_Enc_RID(0x0020,"Tx Action 8",   16,0x0002,0,"TX RFC1042")       //  bit 1   (0x0002)  0=RFC1042 is used for transmit encapsulation.  1=802.1H is used for transmit encapsulation.
+
+
+// WEP Key volatile
+#define awc_RID_WEPv_RidLen                    awc_def_WEPv_RID(0x0000,"RidLen",       16,0xffff,0,"") //       read-only     Length of this RID including the length field
+#define awc_RID_WEPv_KeyIndex                  awc_def_WEPv_RID(0x0002,"KeyIndex",     16,0xffff,0,"Index to list of keys")    
+#define awc_RID_WEPv_Address                   awc_def_WEPv_RID(0x0004,"Address",      48,0xff,0,"mac address related to keys")        
+#define awc_RID_WEPv_KeyLen                    awc_def_WEPv_RID(0x000A,"KeyLen",       16,0xffff,0,"Key Length (0 and 5 are valid)")   
+#define awc_RID_WEPv_Key                       awc_def_WEPv_RID(0x000C,"Key",          128,0xff,0,"Key itself in hex coding")
+#define awc_RID_WEPv_KeyAscii                  awc_def_WEPv_RID(0x000C,"KeyAscii",     128,0,0,"Key itself in ascii coding")
+
+// WEP Key non-volatile
+#define awc_RID_WEPnv_RidLen                   awc_def_WEPnv_RID(0x0000,"RidLen",      16,0xffff,0,"") //       read-only     Length of this RID including the length field
+#define awc_RID_WEPnv_KeyIndex                         awc_def_WEPnv_RID(0x0002,"KeyIndex",    16,0xffff,0,"Index to list of keys")    
+#define awc_RID_WEPnv_Address                  awc_def_WEPnv_RID(0x0004,"Address",     48,0xff,0,"mac address related to keys")        
+#define awc_RID_WEPnv_KeyLen                   awc_def_WEPnv_RID(0x000A,"KeyLen",      16,0xffff,0,"Key Length (0 and 5 are valid)")   
+#define awc_RID_WEPnv_Key                      awc_def_WEPnv_RID(0x000C,"Key",         128,0xff,0,"Key itself in hex coding")
+#define awc_RID_WEPnv_KeyAscii                         awc_def_WEPnv_RID(0x000C,"KeyAscii",    128,0,0,"Key itself in ascii coding")
+
+// Modulation
+#define awc_RID_Modulation_RidLen              awc_def_Modulation_RID(0x0000,"RidLen",         16,0xffff,0,"") //       read-only     Length of this RID including the length field
+#define awc_RID_Modulation_Modulation          awc_def_Modulation_RID(0x0002,"Modulation",     16,0xffff,0,"Modulation")       
+
+
+//   Capabilities RID
+#define awc_RID_Cap_RidLen             awc_def_Cap_RID(0x0000,"RidLen",                16,0xffff,0,"") //        read-only      Length of this RID including the length field
+#define awc_RID_Cap_OUI                awc_def_Cap_RID(0x0002,"OUI",                   24,0xffff,0,"") //      0x00 0x40      This field will give the manufacturer OUI (fourth byte   always zero).
+#define awc_RID_Cap_ProductNum                 awc_def_Cap_RID(0x0006,"ProductNum",            24,0xffff,0,"") //      0x0004         This field will give the product number.
+#define awc_RID_Cap_ManufacturerName   awc_def_Cap_RID(0x0008,"ManufacturerName",      255,0,0,"")     //      ASCIIz encoding of manufacturer name.
+#define awc_RID_Cap_ProductName        awc_def_Cap_RID(0x0028,"ProductName",           128,0,0,"")     //     PC4500         ASCIIz encoding of product name.
+#define awc_RID_Cap_ProductVersion     awc_def_Cap_RID(0x0038,"ProductVersion",        64,0,0,"")      //      .    ASCIIz encoding of product (firmware?) version.
+#define awc_RID_Cap_FactoryAddress     awc_def_Cap_RID(0x0040,"FactoryAddress",        48,0xff,0,"")   // This field will contain the OEM assigned IEEE address. If there is no OEM address assigned, the Aironet assigned  IEEE Address will be returned in this field.
+#define awc_RID_Cap_AironetAddress     awc_def_Cap_RID(0x0046,"AironetAddress",        48,0xff,0,"")   // This field will contain the Aironet factory assigned    IEEE address.
+#define awc_RID_Cap_RadioSpreadType_DS         awc_def_Cap_RID(0x004C,"RadioType_FH",          16,0x0001,1,"") //        0x01 = 802.11 FH
+#define awc_RID_Cap_RadioSpreadType_FH         awc_def_Cap_RID(0x004C,"RadioType_DS",          16,0x0002,2,"") //        0x02 = 802.11 DS
+#define awc_RID_Cap_RadioSpreadType_Legacy awc_def_Cap_RID(0x004C,"RadioType_Legacy",  16,0x0004,4,"") //        0x04 = LM2000 (Legacy) DS //  Note, more than one bit may be set for radios     supporting multiple modes of operation.
+#define awc_RID_Cap_RegDomain          awc_def_Cap_RID(0x004E,"RegDomain",             16,0xffff,0,"") // This field indicates the registration domain/country   The values as assigned by 802.11 will be used.
+#define awc_RID_Cap_Callid             awc_def_Cap_RID(0x0050,"Callid",                48,0xff,0,"")   // This field indicates the callid assigned to the unit (if  RegDomain is Japan) Each nibble will contain one decimal digit of the 12 digit callid. (Note, this is not the encoded format).
+#define awc_RID_Cap_SupportedRates     awc_def_Cap_RID(0x0056,"SupportedRates",        64,0xff,0,"")   //      0x02, 0x04,    This field will indicate the 802.11 supported rates as  specified in the rates.
+#define awc_RID_Cap_RxDiversity        awc_def_Cap_RID(0x005E,"RxDiversity",           8 ,0xff,0,"")   //         0x03 This field will indicate the number of antennas  supported as a bit mask.
+#define awc_RID_Cap_TxDiversity        awc_def_Cap_RID(0x005F,"TxDiversity",           8 ,0xff,0,"")   //         0x03 This field will indicate the number of antennas supported as a bit mask.
+#define awc_RID_Cap_TxPowerLevels      awc_def_Cap_RID(0x0060,"TxPowerLevels", 128,0xff,0,"")  //     250  This table indicates the supported transmit power  levels. (values are in mW)  Zero terminates the list. Note, this may be further restricted depending on   country selected.
+#define awc_RID_Cap_HardwareVersion    awc_def_Cap_RID(0x0070,"HardwareVersion",       16,0xffff,0,"") //        0    This indicates the revision of hardware.
+#define awc_RID_Cap_HardwareCapabilit  awc_def_Cap_RID(0x0072,"HardwareCapabilit",     16,0xffff,0,"") //        0    This is a bit-mapped field indicating harware  capabilities. No bits have been assigned yet. Initially this is zero.
+#define awc_RID_Cap_TemperatureRange   awc_def_Cap_RID(0x0074,"TemperatureRange",      16,0xffff,0,"") //        0    This indicates the temperature range capability.
+#define awc_RID_Cap_SoftwareVersion    awc_def_Cap_RID(0x0076,"SoftwareVersion",       16,0xffff,0,"") //        0    This indicates the revision of software.
+#define awc_RID_Cap_SoftwareVersion_major      awc_def_Cap_RID(0x0076,"SoftwareVersion major", 16,0xff00,0,"") //  The upper byte indicates the major version and the
+#define awc_RID_Cap_SoftwareVersion_minor      awc_def_Cap_RID(0x0076,"SoftwareVersion minor", 16,0x00ff,0,"") //  lower byte the minor version.
+#define awc_RID_Cap_SoftwareSubVersion         awc_def_Cap_RID(0x0078,"SoftwareSubVersio",     16,0xffff,0,"") //        0    This indicates the sub-revision of software.
+#define awc_RID_Cap_InterfaceVersion   awc_def_Cap_RID(0x007A,"InterfaceVersion",      16,0xffff,0,"") //        0    This indicates the revision of the interface. This will be bumped whenever there are incompatible  modifications made to the interfac  This may be bumped on first release to ensure that  "unreleased" utilities/drivers become unusable.
+#define awc_RID_Cap_SoftwareCapabilities awc_def_Cap_RID(0x007C,"SoftwareCapabiliti",  160,0xff,0,"")  //    0    This field gives a bit mapped indication of capabilities. No capability bits have yet been assigned.
+#define awc_RID_Cap_BootBlockVersion   awc_def_Cap_RID(0x007E,"BootBlockVersion ",     16,0xffff,0,"") // This indicates the revision of bootblock software. The upper byte indicates the major version and the lower byte the minor version.  Note, BCD encoding is used. (version 2.11 would be  0x0211.)
+
+
+// Status RID 
+
+#define awc_RID_Status_RidLen          awc_def_Stat_RID( 0x0000,"RidLen",              16,0xffff,0,"")         //    Length of this RID including the length field
+#define awc_RID_Status_MacAddress      awc_def_Stat_RID( 0x0002,"MacAddress",          48,0xff,0,"")           //  The MAC address in use by the station.
+#define awc_RID_Status_OperationalMode         awc_def_Stat_RID( 0x0008,"OperationalMode",     16,0xffff,0,NULL)       //    Bit-mapped.
+#define awc_RID_Status_Configured      awc_def_Stat_RID( 0x0008,"OperationalMode Configured",  16,0x0001,1,"Configured")       //
+#define awc_RID_Status_MAC_Enabled     awc_def_Stat_RID( 0x0008,"OperationalMode MAC Enabled", 16,0x0002,2,"MAC Enabled")      //
+#define awc_RID_Status_Receive_Enabled         awc_def_Stat_RID( 0x0008,"OperationalMode Receive Enabled",     16,0x0004,4,"Receive Enabled")  //
+#define awc_RID_Status_In_Sync                 awc_def_Stat_RID( 0x0008,"OperationalMode In Sync with cell",   16,0x0010,10,"In Sync with cell")       //
+#define awc_RID_Status_Associated      awc_def_Stat_RID( 0x0008,"OperationalMode Associated",  16,0x0020,20,"Associated")      //
+#define awc_RID_Status_Error           awc_def_Stat_RID( 0x0008,"OperationalMode Error",       16,0x8000,0x8000,"Error")       //
+#define awc_RID_Status_ErrorCode       awc_def_Stat_RID( 0x000A,"ErrorCode",           16,0xffff,0,"")         //    Non-zero if an error state has been entered
+#define awc_RID_Status_CurrentSignalQuality awc_def_Stat_RID( 0x000C,"CurrentSignalQuality",16,0xffff,0,"")            //    A measure of the current signal quality.
+#define awc_RID_Status_SSIDlength      awc_def_Stat_RID( 0x000E,"SSIDlength",          16,0xffff,0,"")         //    This length of the following SSID.
+#define awc_RID_Status_SSID            awc_def_Stat_RID( 0x0010,"SSID",                255,0,0,"")             // The SSID that is currently in effect.
+#define awc_RID_Status_ApName          awc_def_Stat_RID( 0x0030,"ApName",              128,0,0,"")             // The name of the current BSSID (ESS mode only)
+#define awc_RID_Status_CurrentBssid    awc_def_Stat_RID( 0x0040,"CurrentBssid",        48,0xff,0,"")           // BSSID that is currently in effect.
+#define awc_RID_Status_PreviousBssid1  awc_def_Stat_RID( 0x0046,"PreviousBssid1",      48,0xff,0,"")           // A former BSSID.
+#define awc_RID_Status_PreviousBssid2  awc_def_Stat_RID( 0x004C,"PreviousBssid2",      48,0xff,0,"")           //  A former BSSID.
+#define awc_RID_Status_PreviousBssid3  awc_def_Stat_RID( 0x0052,"PreviousBssid3",      48,0xff,0,"")           //  A former BSSID.
+#define awc_RID_Status_BeaconPeriod    awc_def_Stat_RID( 0x0058,"BeaconPeriod",        16,0xffff,0,"msek")     // (kus)        The current beacon period.
+#define awc_RID_Status_DtimPeriod      awc_def_Stat_RID( 0x005A,"DtimPeriod",          16,0xffff,0,"units")    //    The current DTIM period (number of beacons between DTIMs).
+#define awc_RID_Status_AtimDuration    awc_def_Stat_RID( 0x005C,"AtimDuration",        16,0xffff,0,"msek")     // (kus)        The current ATIM window duration. Adhoc/Ibss only
+#define awc_RID_Status_HopPeriod       awc_def_Stat_RID( 0x005E,"HopPeriod",           16,0xffff,0,"msek")     // (kus)        The current hopping period.
+#define awc_RID_Status_ChannelSet      awc_def_Stat_RID( 0x0060,"ChannelSet",          16,0xffff,0,"Set")      //    The current channel set.
+#define awc_RID_Status_Channel         awc_def_Stat_RID( 0x0062,"Channel",             16,0xffff,0," ")        //    The current operating channel.
+#define awc_RID_Status_HopsToBackbone  awc_def_Stat_RID( 0x0064,"HopsToBackbone",      16,0xffff,0,"hops")     //    0 indicates a backbone association.
+#define awc_RID_Status_ApTotalLoad     awc_def_Stat_RID( 0x0066,"ApTotalLoad", 16,0xffff,0,"units")    //    Total load including broadcast/multicast from backbone.  This is the value extracted from the Aironet element.
+#define awc_RID_Status_OurGeneratedLoad awc_def_Stat_RID( 0x0068,"OurGeneratedLoad",   16,0xffff,0,"units")    //   Total load generated by our station (transmitted and received). Excludes received broadcast/multicast traffic.
+#define awc_RID_Status_AccumulatedArl  awc_def_Stat_RID( 0x006A,"AccumulatedArl",      16,0xffff,0,"units")    //
+
+// AP RID
+
+#define awc_RID_AP_16RidLen            awc_def_AP_RID(0x0000,"RidLen",         16,0xffff,0,"") //        0x06, read-only Length of this RID including the length field
+#define awc_RID_AP_TIM_addr            awc_def_AP_RID(0x0002,"TIM Addr",               16,0xffff,0,"") //        Read only       The "Traffic Indication Map" is updated by the host via
+#define awc_RID_AP_Airo_addr           awc_def_AP_RID(0x0004,"Airo Addr",              16,0xffff,0,"") //        Read only       The "Aironet Information Element" is updated by the host via the AUX I/O ports. This is the address of the Aironet Element.
+
+
+// Statistics RID
+
+#define awc_RID_Stats_RidLen           awc_def_Stats_RID(0x0000,0x0000,"RidLen",               "Length of the RID including the length field.")
+#define awc_RID_Stats_RxOverrunErr     awc_def_Stats_RID(0x0002,0x0004,"Stats_RxOverrunErr",   "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
+#define awc_RID_Stats_RxPlcpCrcErr     awc_def_Stats_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",   "PLCP header checksum errors (CRC16).")
+#define awc_RID_Stats_RxPlcpFormat     awc_def_Stats_RID(0x0006,0x000C,"Stats_RxPlcpFormat",   "PLCP format errors.")
+#define awc_RID_Stats_RxPlcpLength     awc_def_Stats_RID(0x0008,0x0010,"Stats_RxPlcpLength",   "PLCP length is incorrect.")
+#define awc_RID_Stats_RxMacCrcErr      awc_def_Stats_RID(0x000A,0x0014,"Stats_RxMacCrcErr",    "Count of MAC CRC32 errors.")
+#define awc_RID_Stats_RxMacCrcOk       awc_def_Stats_RID(0x000C,0x0018,"Stats_RxMacCrcOk",     "Count of MAC CRC32 received correctly.")
+#define awc_RID_Stats_RxWepErr                 awc_def_Stats_RID(0x000E,0x001C,"Stats_RxWepErr",       "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats_RxWepOk          awc_def_Stats_RID(0x0010,0x0020,"Stats_RxWepOk",        "Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats_RetryLong        awc_def_Stats_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).")
+#define awc_RID_Stats_RetryShort       awc_def_Stats_RID(0x0014,0x0028,"Stats_RetryShort",     "Count of all short retries. (Does not include first attempt for   a packet).")
+#define awc_RID_Stats_MaxRetries       awc_def_Stats_RID(0x0016,0x002C,"Stats_MaxRetries",     "Count of number of packets that max-retried -- ie were  never ACK-d.")
+#define awc_RID_Stats_NoAck            awc_def_Stats_RID(0x0018,0x0030,"Stats_NoAck",          "Count of number of times that ACK was not received.")
+#define awc_RID_Stats_NoCts            awc_def_Stats_RID(0x001A,0x0034,"Stats_NoCts",          "Count of number of timer that CTS was not received.")
+#define awc_RID_Stats_RxAck            awc_def_Stats_RID(0x001C,0x0038,"Stats_RxAck",          "Count of number of expected ACKs that were received.")
+#define awc_RID_Stats_RxCts            awc_def_Stats_RID(0x001E,0x003C,"Stats_RxCts",          "Count of number of expected CTSs that were received.")
+#define awc_RID_Stats_TxAck            awc_def_Stats_RID(0x0020,0x0040,"Stats_TxAck",          "Count of number of ACKs transmitted.")
+#define awc_RID_Stats_TxRts            awc_def_Stats_RID(0x0022,0x0044,"Stats_TxRts",          "Count of number of RTSs transmitted.")
+#define awc_RID_Stats_TxCts            awc_def_Stats_RID(0x0024,0x0048,"Stats_TxCts",          "Count of number of CTSs transmitted.")
+#define awc_RID_Stats_TxMc             awc_def_Stats_RID(0x0026,0x004C,"Stats_TxMc",           " LMAC count of multicast packets sent (uses 802.11  Address1).")
+#define awc_RID_Stats_TxBc             awc_def_Stats_RID(0x0028,0x0050,"Stats_TxBc",           " LMAC count of broadcast packets sent (uses 802.11")
+#define awc_RID_Stats_TxUcFrags        awc_def_Stats_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",  " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
+#define awc_RID_Stats_TxUcPackets      awc_def_Stats_RID(0x002C,0x0058,"Stats_TxUcPackets",    "LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
+#define awc_RID_Stats_TxBeacon                 awc_def_Stats_RID(0x002E,0x005C,"Stats_TxBeacon",       " Count of beacon packets transmitted.")
+#define awc_RID_Stats_RxBeacon                 awc_def_Stats_RID(0x0030,0x0060,"Stats_RxBeacon",       " Count of beacon packets received matching our BSSID.")
+#define awc_RID_Stats_TxSinColl        awc_def_Stats_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
+#define awc_RID_Stats_TxMulColl        awc_def_Stats_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
+#define awc_RID_Stats_DefersNo                 awc_def_Stats_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
+#define awc_RID_Stats_DefersProt       awc_def_Stats_RID(0x0038,0x0070,"Stats_DefersProt",     " Transmit frames deferred due to protocol.")
+#define awc_RID_Stats_DefersEngy       awc_def_Stats_RID(0x003A,0x0074,"Stats_DefersEngy",     " Transmit frames deferred due to energy detect.")
+#define awc_RID_Stats_DupFram          awc_def_Stats_RID(0x003C,0x0078,"Stats_DupFram",        "  Duplicate receive frames and fragments.")
+#define awc_RID_Stats_RxFragDisc       awc_def_Stats_RID(0x003E,0x007C,"Stats_RxFragDisc",     " Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
+#define awc_RID_Stats_TxAged           awc_def_Stats_RID(0x0040,0x0080,"Stats_TxAged",         "   Transmit packets exceeding maximum transmit lifetime. **")
+#define awc_RID_Stats_RxAged           awc_def_Stats_RID(0x0042,0x0084,"Stats_RxAgedReceive",  " packets exceeding maximum receive lifetime. **")
+#define awc_RID_Stats_LostSync_Max     awc_def_Stats_RID(0x0044,0x0088,"Stats_LostSync_Max",   " Lost sync with our cell due to maximum retries occuring. Retry")
+#define awc_RID_Stats_LostSync_Mis     awc_def_Stats_RID(0x0046,0x008C,"Stats_LostSync_Mis",   "Lost sync with our cell due to missing too many beacons. sedBeacons")
+#define awc_RID_Stats_LostSync_Arl     awc_def_Stats_RID(0x0048,0x0090,"Stats_LostSync_Arl",   "Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
+#define awc_RID_Stats_LostSync_Dea     awc_def_Stats_RID(0x004A,0x0094,"Stats_LostSync_Dea",   "Lost sync with our cell due to being deauthenticated.,thed")
+#define awc_RID_Stats_LostSync_Disa    awc_def_Stats_RID(0x004C,0x0098,"Stats_LostSync_Disa",  " Lost sync with our cell due to being disassociated. ssoced")
+#define awc_RID_Stats_LostSync_Tsf     awc_def_Stats_RID(0x004E,0x009C,"Stats_LostSync_Tsf",   "Lost sync with our cell due to excessive change in TSF  Timingtiming.")
+#define awc_RID_Stats_HostTxMc                 awc_def_Stats_RID(0x0050,0x00A0,"Stats_HostTxMc",       "Count of multicast packets sent by the host.")
+#define awc_RID_Stats_HostTxBc                 awc_def_Stats_RID(0x0052,0x00A4,"Stats_HostTxBc",       "Count of broadcast packets sent by the host.")
+#define awc_RID_Stats_HostTxUc                 awc_def_Stats_RID(0x0054,0x00A8,"Stats_HostTxUc",       "Count of unicast packets sent by the host.")
+#define awc_RID_Stats_HostTxFail       awc_def_Stats_RID(0x0056,0x00AC,"Stats_HostTxFail",     "  Count of host transmitted packets which failed.")
+#define awc_RID_Stats_HostRxMc                 awc_def_Stats_RID(0x0058,0x00B0,"Stats_HostRxMc",       "Count of host received multicast packets.")
+#define awc_RID_Stats_HostRxBc                 awc_def_Stats_RID(0x005A,0x00B4,"Stats_HostRxBc",       "Count of host received broadcast packets.")
+#define awc_RID_Stats_HostRxUc                 awc_def_Stats_RID(0x005C,0x00B8,"Stats_HostRxUc",       "Count of host received unicast packets.")
+#define awc_RID_Stats_HostRxDiscar     awc_def_Stats_RID(0x005E,0x00BC,"Stats_HostRxDiscar",   "Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
+#define awc_RID_Stats_HmacTxMc                 awc_def_Stats_RID(0x0060,0x00C0,"Stats_HmacTxMc",       "Count of internally generated multicast (DA) packets.")
+#define awc_RID_Stats_HmacTxBc                 awc_def_Stats_RID(0x0062,0x00C4,"Stats_HmacTxBc",       "Count of internally generated broadcast (DA) packets.")
+#define awc_RID_Stats_HmacTxUc                 awc_def_Stats_RID(0x0064,0x00C8,"Stats_HmacTxUc",       "Count of internally generated unicast (DA) packets.")
+#define awc_RID_Stats_HmacTxFail       awc_def_Stats_RID(0x0066,0x00CC,"Stats_HmacTxFail",     "  Count of internally generated transmit packets that failed.")
+#define awc_RID_Stats_HmacRxMc                 awc_def_Stats_RID(0x0068,0x00D0,"Stats_HmacRxMc",       "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats_HmacRxBc                 awc_def_Stats_RID(0x006A,0x00D4,"Stats_HmacRxBc",       "Count of internally received broadcast (DA) packets.")
+#define awc_RID_Stats_HmacRxUc                 awc_def_Stats_RID(0x006C,0x00D8,"Stats_HmacRxUc",       "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats_HmacRxDisca      awc_def_Stats_RID(0x006E,0x00DC,"Stats_HmacRxDisca",    " Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
+#define awc_RID_Stats_HmacRxAcce       awc_def_Stats_RID(0x0070,0x00E0,"Stats_HmacRxAcce",     "  Count of internally received packets that were accepted")
+#define awc_RID_Stats_SsidMismatch     awc_def_Stats_RID(0x0072,0x00E4,"Stats_SsidMismatch",   " Count of SSID mismatches.")
+#define awc_RID_Stats_ApMismatch       awc_def_Stats_RID(0x0074,0x00E8,"Stats_ApMismatch",     "  Count of specified AP mismatches.")
+#define awc_RID_Stats_RatesMismatc     awc_def_Stats_RID(0x0076,0x00EC,"Stats_RatesMismatc",   " Count of rate mismatches.")
+#define awc_RID_Stats_AuthReject       awc_def_Stats_RID(0x0078,0x00F0,"Stats_AuthReject",     "  Count of authentication rejections.")
+#define awc_RID_Stats_AuthTimeout      awc_def_Stats_RID(0x007A,0x00F4,"Stats_AuthTimeout",    " Count of authentication timeouts.")
+#define awc_RID_Stats_AssocReject      awc_def_Stats_RID(0x007C,0x00F8,"Stats_AssocReject",    " Count of association rejections.")
+#define awc_RID_Stats_AssocTimeout     awc_def_Stats_RID(0x007E,0x00FC,"Stats_AssocTimeout",   " Count of association timeouts.")
+#define awc_RID_Stats_NewReason        awc_def_Stats_RID(0x0080,0x0100,"Stats_NewReason",      "Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
+#define awc_RID_Stats_AuthFail_1       awc_def_Stats_RID(0x0082,0x0104,"Stats_AuthFail_1",     "Unspecified reason.")
+#define awc_RID_Stats_AuthFail_2       awc_def_Stats_RID(0x0084,0x0108,"Stats_AuthFail_2",     "Previous authentication no longer valid.")
+#define awc_RID_Stats_AuthFail_3       awc_def_Stats_RID(0x0086,0x010C,"Stats_AuthFail_3",     "Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
+#define awc_RID_Stats_AuthFail_4       awc_def_Stats_RID(0x0088,0x0110,"Stats_AuthFail_4",     "Disassociated due to inactivity")
+#define awc_RID_Stats_AuthFail_5       awc_def_Stats_RID(0x008A,0x0114,"Stats_AuthFail_5",     "Disassociated because AP is unable to handle all currently  associated stations.")
+#define awc_RID_Stats_AuthFail_6       awc_def_Stats_RID(0x008C,0x0118,"Stats_AuthFail_6",     "Class 2 Frame received from non-Authenticated station.")
+#define awc_RID_Stats_AuthFail_7       awc_def_Stats_RID(0x008E,0x011C,"Stats_AuthFail_7",     "Class 3 Frame received from non-Associated station.")
+#define awc_RID_Stats_AuthFail_8       awc_def_Stats_RID(0x0090,0x0120,"Stats_AuthFail_8",     "Disassociated because sending station is leaving (has left)")
+#define awc_RID_Stats_AuthFail_9       awc_def_Stats_RID(0x0092,0x0124,"Stats_AuthFail_9",     "Station requesting (Re)Association is not Authenticated")
+#define awc_RID_Stats_AuthFail_10      awc_def_Stats_RID(0x0094,0x0128,"Stats_AuthFail_10",    "Cannot support all requested capabilities in the Capability")
+#define awc_RID_Stats_AuthFail_11      awc_def_Stats_RID(0x0096,0x012C,"Stats_AuthFail_11",    "Reassociation denied due to inability to confirm")
+#define awc_RID_Stats_AuthFail_12      awc_def_Stats_RID(0x0098,0x0130,"Stats_AuthFail_12",    "Association denied due to reason outside the scope of the 802.11")
+#define awc_RID_Stats_AuthFail_13      awc_def_Stats_RID(0x009A,0x0134,"Stats_AuthFail_13",    "Responding station does not support the specified Auth Alogorithm")
+#define awc_RID_Stats_AuthFail_14      awc_def_Stats_RID(0x009C,0x0138,"Stats_AuthFail_14",    "Received an out of sequence Authentication Frame.")
+#define awc_RID_Stats_AuthFail_15      awc_def_Stats_RID(0x009E,0x013C,"Stats_AuthFail_15",    "Authentication rejected due to challenge failure.")
+#define awc_RID_Stats_AuthFail_16      awc_def_Stats_RID(0x00A0,0x0140,"Stats_AuthFail_16",    "Authentication rejected due to timeout waiting for next  frame in sequence.")
+#define awc_RID_Stats_AuthFail_17      awc_def_Stats_RID(0x00A2,0x0144,"Stats_AuthFail_17",    "Association denied because AP is unable to handle  additional associated stations.")
+#define awc_RID_Stats_AuthFail_18      awc_def_Stats_RID(0x00A4,0x0148,"Stats_AuthFail_18",    "Association denied due to requesting station not supportingall basic rates.")
+#define awc_RID_Stats_AuthFail_19      awc_def_Stats_RID(0x00A6,0x014C,"Stats_AuthFail_19",    "Reserved")
+#define awc_RID_Stats_RxMan            awc_def_Stats_RID(0x00A8,0x0150,"Stats_RxMan",          " Count of management packets received and handled.")
+#define awc_RID_Stats_TxMan            awc_def_Stats_RID(0x00AA,0x0154,"Stats_TxMan",          " Count of management packets transmitted.")
+#define awc_RID_Stats_RxRefresh        awc_def_Stats_RID(0x00AC,0x0158,"Stats_RxRefresh",      " Count of null data packets received.")
+#define awc_RID_Stats_TxRefresh        awc_def_Stats_RID(0x00AE,0x015C,"Stats_TxRefresh",      " Count of null data packets transmitted.")
+#define awc_RID_Stats_RxPoll           awc_def_Stats_RID(0x00B0,0x0160,"Stats_RxPoll",         "Count of PS-Poll packets received.")
+#define awc_RID_Stats_TxPoll           awc_def_Stats_RID(0x00B2,0x0164,"Stats_TxPoll",         "Count of PS-Poll packets transmitted.")
+#define awc_RID_Stats_HostRetries      awc_def_Stats_RID(0x00B4,0x0168,"Stats_HostRetries",    " Count of long and short retries used to transmit host packets  (does not include first attempt).")
+#define awc_RID_Stats_LostSync_HostReq         awc_def_Stats_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
+#define awc_RID_Stats_HostTxBytes      awc_def_Stats_RID(0x00B8,0x0170,"Stats_HostTxBytes",    " Count of bytes transferred from the host.")
+#define awc_RID_Stats_HostRxBytes      awc_def_Stats_RID(0x00BA,0x0174,"Stats_HostRxBytes",    " Count of bytes transferred to the host.")
+#define awc_RID_Stats_ElapsedUsec      awc_def_Stats_RID(0x00BC,0x0178,"Stats_ElapsedUsec",    " Total time since power up (or clear) in microseconds.")
+#define awc_RID_Stats_ElapsedSec       awc_def_Stats_RID(0x00BE,0x017C,"Stats_ElapsedSec",     " Total time since power up (or clear) in seconds.")
+#define awc_RID_Stats_LostSyncBett     awc_def_Stats_RID(0x00C0,0x0180,"Stats_LostSyncBett",   "Lost Sync to switch to a better access point")
+
+
+
+#define awc_RID_Stats_delta_RidLen             awc_def_Stats_delta_RID(0x0000,0x0000,"RidLen",         "Length of the RID including the length field.")
+#define awc_RID_Stats_delta_RxOverrunErr       awc_def_Stats_delta_RID(0x0002,0x0004,"Stats_RxOverrunErr",     "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
+#define awc_RID_Stats_delta_RxPlcpCrcErr       awc_def_Stats_delta_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",     "PLCP header checksum errors (CRC16).")
+#define awc_RID_Stats_delta_RxPlcpFormat       awc_def_Stats_delta_RID(0x0006,0x000C,"Stats_RxPlcpFormat",     "PLCP format errors.")
+#define awc_RID_Stats_delta_RxPlcpLength       awc_def_Stats_delta_RID(0x0008,0x0010,"Stats_RxPlcpLength",     "PLCP length is incorrect.")
+#define awc_RID_Stats_delta_RxMacCrcErr        awc_def_Stats_delta_RID(0x000A,0x0014,"Stats_RxMacCrcErr",      "Count of MAC CRC32 errors.")
+#define awc_RID_Stats_delta_RxMacCrcOk                 awc_def_Stats_delta_RID(0x000C,0x0018,"Stats_RxMacCrcOk",       "Count of MAC CRC32 received correctly.")
+#define awc_RID_Stats_delta_RxWepErr           awc_def_Stats_delta_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats_delta_RxWepOk            awc_def_Stats_delta_RID(0x0010,0x0020,"Stats_RxWepOk",  "Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats_delta_RetryLong          awc_def_Stats_delta_RID(0x0012,0x0024,"Stats_RetryLongCount",   "of all long retries. (Does not include first attempt for a packet).")
+#define awc_RID_Stats_delta_RetryShort                 awc_def_Stats_delta_RID(0x0014,0x0028,"Stats_RetryShort",       "Count of all short retries. (Does not include first attempt for   a packet).")
+#define awc_RID_Stats_delta_MaxRetries                 awc_def_Stats_delta_RID(0x0016,0x002C,"Stats_MaxRetries",       "Count of number of packets that max-retried -- ie were  never ACKd.")
+#define awc_RID_Stats_delta_NoAck              awc_def_Stats_delta_RID(0x0018,0x0030,"Stats_NoAck",            "Count of number of times that ACK was not received.")
+#define awc_RID_Stats_delta_NoCts              awc_def_Stats_delta_RID(0x001A,0x0034,"Stats_NoCts",            "Count of number of timer that CTS was not received.")
+#define awc_RID_Stats_delta_RxAck              awc_def_Stats_delta_RID(0x001C,0x0038,"Stats_RxAck",            "Count of number of expected ACKs that were received.")
+#define awc_RID_Stats_delta_RxCts              awc_def_Stats_delta_RID(0x001E,0x003C,"Stats_RxCts",            "Count of number of expected CTSs that were received.")
+#define awc_RID_Stats_delta_TxAck              awc_def_Stats_delta_RID(0x0020,0x0040,"Stats_TxAck",            "Count of number of ACKs transmitted.")
+#define awc_RID_Stats_delta_TxRts              awc_def_Stats_delta_RID(0x0022,0x0044,"Stats_TxRts",            "Count of number of RTSs transmitted.")
+#define awc_RID_Stats_delta_TxCts              awc_def_Stats_delta_RID(0x0024,0x0048,"Stats_TxCts",            "Count of number of CTSs transmitted.")
+#define awc_RID_Stats_delta_TxMc               awc_def_Stats_delta_RID(0x0026,0x004C,"Stats_TxMc",             " LMAC count of multicast packets sent (uses 802.11  Address1).")
+#define awc_RID_Stats_delta_TxBc               awc_def_Stats_delta_RID(0x0028,0x0050,"Stats_TxBc",             " LMAC count of broadcast packets sent (uses 802.11")
+#define awc_RID_Stats_delta_TxUcFrags          awc_def_Stats_delta_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",    " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
+#define awc_RID_Stats_delta_TxUcPackets        awc_def_Stats_delta_RID(0x002C,0x0058,"Stats_TxUcPackets",      "LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
+#define awc_RID_Stats_delta_TxBeacon           awc_def_Stats_delta_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.")
+#define awc_RID_Stats_delta_RxBeacon           awc_def_Stats_delta_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.")
+#define awc_RID_Stats_delta_TxSinColl          awc_def_Stats_delta_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
+#define awc_RID_Stats_delta_TxMulColl          awc_def_Stats_delta_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
+#define awc_RID_Stats_delta_DefersNo           awc_def_Stats_delta_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
+#define awc_RID_Stats_delta_DefersProt                 awc_def_Stats_delta_RID(0x0038,0x0070,"Stats_DefersProt",       " Transmit frames deferred due to protocol.")
+#define awc_RID_Stats_delta_DefersEngy                 awc_def_Stats_delta_RID(0x003A,0x0074,"Stats_DefersEngy",       " Transmit frames deferred due to energy detect.")
+#define awc_RID_Stats_delta_DupFram            awc_def_Stats_delta_RID(0x003C,0x0078,"Stats_DupFram",  "  Duplicate receive frames and fragments.")
+#define awc_RID_Stats_delta_RxFragDisc                 awc_def_Stats_delta_RID(0x003E,0x007C,"Stats_RxFragDisc",       " Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
+#define awc_RID_Stats_delta_TxAged             awc_def_Stats_delta_RID(0x0040,0x0080,"Stats_TxAged",           "   Transmit packets exceeding maximum transmit lifetime. **")
+#define awc_RID_Stats_delta_RxAged             awc_def_Stats_delta_RID(0x0042,0x0084,"Stats_RxAgedReceive",    " packets exceeding maximum receive lifetime. **")
+#define awc_RID_Stats_delta_LostSync_Max       awc_def_Stats_delta_RID(0x0044,0x0088,"Stats_LostSync_Max",     " Lost sync with our cell due to maximum retries occuring. Retry")
+#define awc_RID_Stats_delta_LostSync_Mis       awc_def_Stats_delta_RID(0x0046,0x008C,"Stats_LostSync_Mis",     "Lost sync with our cell due to missing too many beacons. sedBeacons")
+#define awc_RID_Stats_delta_LostSync_Arl       awc_def_Stats_delta_RID(0x0048,0x0090,"Stats_LostSync_Arl",     "Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
+#define awc_RID_Stats_delta_LostSync_Dea       awc_def_Stats_delta_RID(0x004A,0x0094,"Stats_LostSync_Dea",     "Lost sync with our cell due to being deauthenticated.,thed")
+#define awc_RID_Stats_delta_LostSync_Disa      awc_def_Stats_delta_RID(0x004C,0x0098,"Stats_LostSync_Disa",    " Lost sync with our cell due to being disassociated. ssoced")
+#define awc_RID_Stats_delta_LostSync_Tsf       awc_def_Stats_delta_RID(0x004E,0x009C,"Stats_LostSync_Tsf",     "Lost sync with our cell due to excessive change in TSF  Timingtiming.")
+#define awc_RID_Stats_delta_HostTxMc           awc_def_Stats_delta_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.")
+#define awc_RID_Stats_delta_HostTxBc           awc_def_Stats_delta_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.")
+#define awc_RID_Stats_delta_HostTxUc           awc_def_Stats_delta_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.")
+#define awc_RID_Stats_delta_HostTxFail                 awc_def_Stats_delta_RID(0x0056,0x00AC,"Stats_HostTxFail",       "  Count of host transmitted packets which failed.")
+#define awc_RID_Stats_delta_HostRxMc           awc_def_Stats_delta_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.")
+#define awc_RID_Stats_delta_HostRxBc           awc_def_Stats_delta_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.")
+#define awc_RID_Stats_delta_HostRxUc           awc_def_Stats_delta_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.")
+#define awc_RID_Stats_delta_HostRxDiscar       awc_def_Stats_delta_RID(0x005E,0x00BC,"Stats_HostRxDiscar",     "Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
+#define awc_RID_Stats_delta_HmacTxMc           awc_def_Stats_delta_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.")
+#define awc_RID_Stats_delta_HmacTxBc           awc_def_Stats_delta_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.")
+#define awc_RID_Stats_delta_HmacTxUc           awc_def_Stats_delta_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.")
+#define awc_RID_Stats_delta_HmacTxFail                 awc_def_Stats_delta_RID(0x0066,0x00CC,"Stats_HmacTxFail",       "  Count of internally generated transmit packets that failed.")
+#define awc_RID_Stats_delta_HmacRxMc           awc_def_Stats_delta_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats_delta_HmacRxBc           awc_def_Stats_delta_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.")
+#define awc_RID_Stats_delta_HmacRxUc           awc_def_Stats_delta_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats_delta_HmacRxDisca        awc_def_Stats_delta_RID(0x006E,0x00DC,"Stats_HmacRxDisca",      " Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
+#define awc_RID_Stats_delta_HmacRxAcce                 awc_def_Stats_delta_RID(0x0070,0x00E0,"Stats_HmacRxAcce",       "  Count of internally received packets that were accepted")
+#define awc_RID_Stats_delta_SsidMismatch       awc_def_Stats_delta_RID(0x0072,0x00E4,"Stats_SsidMismatch",     " Count of SSID mismatches.")
+#define awc_RID_Stats_delta_ApMismatch                 awc_def_Stats_delta_RID(0x0074,0x00E8,"Stats_ApMismatch",       "  Count of specified AP mismatches.")
+#define awc_RID_Stats_delta_RatesMismatc       awc_def_Stats_delta_RID(0x0076,0x00EC,"Stats_RatesMismatc",     " Count of rate mismatches.")
+#define awc_RID_Stats_delta_AuthReject                 awc_def_Stats_delta_RID(0x0078,0x00F0,"Stats_AuthReject",       "  Count of authentication rejections.")
+#define awc_RID_Stats_delta_AuthTimeout        awc_def_Stats_delta_RID(0x007A,0x00F4,"Stats_AuthTimeout",      " Count of authentication timeouts.")
+#define awc_RID_Stats_delta_AssocReject        awc_def_Stats_delta_RID(0x007C,0x00F8,"Stats_AssocReject",      " Count of association rejections.")
+#define awc_RID_Stats_delta_AssocTimeout       awc_def_Stats_delta_RID(0x007E,0x00FC,"Stats_AssocTimeout",     " Count of association timeouts.")
+#define awc_RID_Stats_delta_NewReason          awc_def_Stats_delta_RID(0x0080,0x0100,"Stats_NewReason",        "Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
+#define awc_RID_Stats_delta_AuthFail_1                 awc_def_Stats_delta_RID(0x0082,0x0104,"Stats_AuthFail_1",       "Unspecified reason.")
+#define awc_RID_Stats_delta_AuthFail_2                 awc_def_Stats_delta_RID(0x0084,0x0108,"Stats_AuthFail_2",       "Previous authentication no longer valid.")
+#define awc_RID_Stats_delta_AuthFail_3                 awc_def_Stats_delta_RID(0x0086,0x010C,"Stats_AuthFail_3",       "Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
+#define awc_RID_Stats_delta_AuthFail_4                 awc_def_Stats_delta_RID(0x0088,0x0110,"Stats_AuthFail_4",       "Disassociated due to inactivity")
+#define awc_RID_Stats_delta_AuthFail_5                 awc_def_Stats_delta_RID(0x008A,0x0114,"Stats_AuthFail_5",       "Disassociated because AP is unable to handle all currently  associated stations.")
+#define awc_RID_Stats_delta_AuthFail_6                 awc_def_Stats_delta_RID(0x008C,0x0118,"Stats_AuthFail_6",       "Class 2 Frame received from non-Authenticated station.")
+#define awc_RID_Stats_delta_AuthFail_7                 awc_def_Stats_delta_RID(0x008E,0x011C,"Stats_AuthFail_7",       "Class 3 Frame received from non-Associated station.")
+#define awc_RID_Stats_delta_AuthFail_8                 awc_def_Stats_delta_RID(0x0090,0x0120,"Stats_AuthFail_8",       "Disassociated because sending station is leaving (has left)")
+#define awc_RID_Stats_delta_AuthFail_9                 awc_def_Stats_delta_RID(0x0092,0x0124,"Stats_AuthFail_9",       "Station requesting (Re)Association is not Authenticated")
+#define awc_RID_Stats_delta_AuthFail_10        awc_def_Stats_delta_RID(0x0094,0x0128,"Stats_AuthFail_10",      "Cannot support all requested capabilities in the Capability")
+#define awc_RID_Stats_delta_AuthFail_11        awc_def_Stats_delta_RID(0x0096,0x012C,"Stats_AuthFail_11",      "Reassociation denied due to inability to confirm")
+#define awc_RID_Stats_delta_AuthFail_12        awc_def_Stats_delta_RID(0x0098,0x0130,"Stats_AuthFail_12",      "Association denied due to reason outside the scope of the 802.11")
+#define awc_RID_Stats_delta_AuthFail_13        awc_def_Stats_delta_RID(0x009A,0x0134,"Stats_AuthFail_13",      "Responding station does not support the specified Auth Alogorithm")
+#define awc_RID_Stats_delta_AuthFail_14        awc_def_Stats_delta_RID(0x009C,0x0138,"Stats_AuthFail_14",      "Received an out of sequence Authentication Frame.")
+#define awc_RID_Stats_delta_AuthFail_15        awc_def_Stats_delta_RID(0x009E,0x013C,"Stats_AuthFail_15",      "Authentication rejected due to challenge failure.")
+#define awc_RID_Stats_delta_AuthFail_16        awc_def_Stats_delta_RID(0x00A0,0x0140,"Stats_AuthFail_16",      "Authentication rejected due to timeout waiting for next  frame in sequence.")
+#define awc_RID_Stats_delta_AuthFail_17        awc_def_Stats_delta_RID(0x00A2,0x0144,"Stats_AuthFail_17",      "Association denied because AP is unable to handle  additional associated stations.")
+#define awc_RID_Stats_delta_AuthFail_18        awc_def_Stats_delta_RID(0x00A4,0x0148,"Stats_AuthFail_18",      "Association denied due to requesting station not supportingall basic rates.")
+#define awc_RID_Stats_delta_AuthFail_19        awc_def_Stats_delta_RID(0x00A6,0x014C,"Stats_AuthFail_19",      "Reserved")
+#define awc_RID_Stats_delta_RxMan              awc_def_Stats_delta_RID(0x00A8,0x0150,"Stats_RxMan",            " Count of management packets received and handled.")
+#define awc_RID_Stats_delta_TxMan              awc_def_Stats_delta_RID(0x00AA,0x0154,"Stats_TxMan",            " Count of management packets transmitted.")
+#define awc_RID_Stats_delta_RxRefresh          awc_def_Stats_delta_RID(0x00AC,0x0158,"Stats_RxRefresh",        " Count of null data packets received.")
+#define awc_RID_Stats_delta_TxRefresh          awc_def_Stats_delta_RID(0x00AE,0x015C,"Stats_TxRefresh",        " Count of null data packets transmitted.")
+#define awc_RID_Stats_delta_RxPoll             awc_def_Stats_delta_RID(0x00B0,0x0160,"Stats_RxPoll",           "Count of PS-Poll packets received.")
+#define awc_RID_Stats_delta_TxPoll             awc_def_Stats_delta_RID(0x00B2,0x0164,"Stats_TxPoll",           "Count of PS-Poll packets transmitted.")
+#define awc_RID_Stats_delta_HostRetries        awc_def_Stats_delta_RID(0x00B4,0x0168,"Stats_HostRetries",      " Count of long and short retries used to transmit host packets  (does not include first attempt).")
+#define awc_RID_Stats_delta_LostSync_HostReq   awc_def_Stats_delta_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
+#define awc_RID_Stats_delta_HostTxBytes        awc_def_Stats_delta_RID(0x00B8,0x0170,"Stats_HostTxBytes",      " Count of bytes transferred from the host.")
+#define awc_RID_Stats_delta_HostRxBytes        awc_def_Stats_delta_RID(0x00BA,0x0174,"Stats_HostRxBytes",      " Count of bytes transferred to the host.")
+#define awc_RID_Stats_delta_ElapsedUsec        awc_def_Stats_delta_RID(0x00BC,0x0178,"Stats_ElapsedUsec",      " Total time since power up (or clear) in microseconds.")
+#define awc_RID_Stats_delta_ElapsedSec                 awc_def_Stats_delta_RID(0x00BE,0x017C,"Stats_ElapsedSec",       " Total time since power up (or clear) in seconds.")
+#define awc_RID_Stats_delta_LostSyncBett       awc_def_Stats_delta_RID(0x00C0,0x0180,"Stats_LostSyncBett",     "Lost Sync to switch to a better access point")
+
+
+
+#define awc_RID_Stats_clear_RidLen             awc_def_Stats_clear_RID(0x0000,0x0000,"RidLen",         "Length of the RID including the length field.")
+#define awc_RID_Stats_clear_RxOverrunErr       awc_def_Stats_clear_RID(0x0002,0x0004,"Stats_RxOverrunErr",     "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
+#define awc_RID_Stats_clear_RxPlcpCrcErr       awc_def_Stats_clear_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",     "PLCP header checksum errors (CRC16).")
+#define awc_RID_Stats_clear_RxPlcpFormat       awc_def_Stats_clear_RID(0x0006,0x000C,"Stats_RxPlcpFormat",     "PLCP format errors.")
+#define awc_RID_Stats_clear_RxPlcpLength       awc_def_Stats_clear_RID(0x0008,0x0010,"Stats_RxPlcpLength",     "PLCP length is incorrect.")
+#define awc_RID_Stats_clear_RxMacCrcErr        awc_def_Stats_clear_RID(0x000A,0x0014,"Stats_RxMacCrcErr",      "Count of MAC CRC32 errors.")
+#define awc_RID_Stats_clear_RxMacCrcOk                 awc_def_Stats_clear_RID(0x000C,0x0018,"Stats_RxMacCrcOk",       "Count of MAC CRC32 received correctly.")
+#define awc_RID_Stats_clear_RxWepErr           awc_def_Stats_clear_RID(0x000E,0x001C,"Stats_RxWepErr", "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats_clear_RxWepOk            awc_def_Stats_clear_RID(0x0010,0x0020,"Stats_RxWepOk",  "Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats_clear_RetryLong          awc_def_Stats_clear_RID(0x0012,0x0024,"Stats_RetryLongCount",   "of all long retries. (Does not include first attempt for a packet).")
+#define awc_RID_Stats_clear_RetryShort                 awc_def_Stats_clear_RID(0x0014,0x0028,"Stats_RetryShort",       "Count of all short retries. (Does not include first attempt for   a packet).")
+#define awc_RID_Stats_clear_MaxRetries                 awc_def_Stats_clear_RID(0x0016,0x002C,"Stats_MaxRetries",       "Count of number of packets that max-retried -- ie were  never ACKd.")
+#define awc_RID_Stats_clear_NoAck              awc_def_Stats_clear_RID(0x0018,0x0030,"Stats_NoAck",            "Count of number of times that ACK was not received.")
+#define awc_RID_Stats_clear_NoCts              awc_def_Stats_clear_RID(0x001A,0x0034,"Stats_NoCts",            "Count of number of timer that CTS was not received.")
+#define awc_RID_Stats_clear_RxAck              awc_def_Stats_clear_RID(0x001C,0x0038,"Stats_RxAck",            "Count of number of expected ACKs that were received.")
+#define awc_RID_Stats_clear_RxCts              awc_def_Stats_clear_RID(0x001E,0x003C,"Stats_RxCts",            "Count of number of expected CTSs that were received.")
+#define awc_RID_Stats_clear_TxAck              awc_def_Stats_clear_RID(0x0020,0x0040,"Stats_TxAck",            "Count of number of ACKs transmitted.")
+#define awc_RID_Stats_clear_TxRts              awc_def_Stats_clear_RID(0x0022,0x0044,"Stats_TxRts",            "Count of number of RTSs transmitted.")
+#define awc_RID_Stats_clear_TxCts              awc_def_Stats_clear_RID(0x0024,0x0048,"Stats_TxCts",            "Count of number of CTSs transmitted.")
+#define awc_RID_Stats_clear_TxMc               awc_def_Stats_clear_RID(0x0026,0x004C,"Stats_TxMc",             " LMAC count of multicast packets sent (uses 802.11  Address1).")
+#define awc_RID_Stats_clear_TxBc               awc_def_Stats_clear_RID(0x0028,0x0050,"Stats_TxBc",             " LMAC count of broadcast packets sent (uses 802.11")
+#define awc_RID_Stats_clear_TxUcFrags          awc_def_Stats_clear_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",    " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
+#define awc_RID_Stats_clear_TxUcPackets        awc_def_Stats_clear_RID(0x002C,0x0058,"Stats_TxUcPackets",      "LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
+#define awc_RID_Stats_clear_TxBeacon           awc_def_Stats_clear_RID(0x002E,0x005C,"Stats_TxBeacon", " Count of beacon packets transmitted.")
+#define awc_RID_Stats_clear_RxBeacon           awc_def_Stats_clear_RID(0x0030,0x0060,"Stats_RxBeacon", " Count of beacon packets received matching our BSSID.")
+#define awc_RID_Stats_clear_TxSinColl          awc_def_Stats_clear_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
+#define awc_RID_Stats_clear_TxMulColl          awc_def_Stats_clear_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
+#define awc_RID_Stats_clear_DefersNo           awc_def_Stats_clear_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
+#define awc_RID_Stats_clear_DefersProt                 awc_def_Stats_clear_RID(0x0038,0x0070,"Stats_DefersProt",       " Transmit frames deferred due to protocol.")
+#define awc_RID_Stats_clear_DefersEngy                 awc_def_Stats_clear_RID(0x003A,0x0074,"Stats_DefersEngy",       " Transmit frames deferred due to energy detect.")
+#define awc_RID_Stats_clear_DupFram            awc_def_Stats_clear_RID(0x003C,0x0078,"Stats_DupFram",  "  Duplicate receive frames and fragments.")
+#define awc_RID_Stats_clear_RxFragDisc                 awc_def_Stats_clear_RID(0x003E,0x007C,"Stats_RxFragDisc",       " Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
+#define awc_RID_Stats_clear_TxAged             awc_def_Stats_clear_RID(0x0040,0x0080,"Stats_TxAged",           "   Transmit packets exceeding maximum transmit lifetime. **")
+#define awc_RID_Stats_clear_RxAged             awc_def_Stats_clear_RID(0x0042,0x0084,"Stats_RxAgedReceive",    " packets exceeding maximum receive lifetime. **")
+#define awc_RID_Stats_clear_LostSync_Max       awc_def_Stats_clear_RID(0x0044,0x0088,"Stats_LostSync_Max",     " Lost sync with our cell due to maximum retries occuring. Retry")
+#define awc_RID_Stats_clear_LostSync_Mis       awc_def_Stats_clear_RID(0x0046,0x008C,"Stats_LostSync_Mis",     "Lost sync with our cell due to missing too many beacons. sedBeacons")
+#define awc_RID_Stats_clear_LostSync_Arl       awc_def_Stats_clear_RID(0x0048,0x0090,"Stats_LostSync_Arl",     "Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
+#define awc_RID_Stats_clear_LostSync_Dea       awc_def_Stats_clear_RID(0x004A,0x0094,"Stats_LostSync_Dea",     "Lost sync with our cell due to being deauthenticated.,thed")
+#define awc_RID_Stats_clear_LostSync_Disa      awc_def_Stats_clear_RID(0x004C,0x0098,"Stats_LostSync_Disa",    " Lost sync with our cell due to being disassociated. ssoced")
+#define awc_RID_Stats_clear_LostSync_Tsf       awc_def_Stats_clear_RID(0x004E,0x009C,"Stats_LostSync_Tsf",     "Lost sync with our cell due to excessive change in TSF  Timingtiming.")
+#define awc_RID_Stats_clear_HostTxMc           awc_def_Stats_clear_RID(0x0050,0x00A0,"Stats_HostTxMc", "Count of multicast packets sent by the host.")
+#define awc_RID_Stats_clear_HostTxBc           awc_def_Stats_clear_RID(0x0052,0x00A4,"Stats_HostTxBc", "Count of broadcast packets sent by the host.")
+#define awc_RID_Stats_clear_HostTxUc           awc_def_Stats_clear_RID(0x0054,0x00A8,"Stats_HostTxUc", "Count of unicast packets sent by the host.")
+#define awc_RID_Stats_clear_HostTxFail                 awc_def_Stats_clear_RID(0x0056,0x00AC,"Stats_HostTxFail",       "  Count of host transmitted packets which failed.")
+#define awc_RID_Stats_clear_HostRxMc           awc_def_Stats_clear_RID(0x0058,0x00B0,"Stats_HostRxMc", "Count of host received multicast packets.")
+#define awc_RID_Stats_clear_HostRxBc           awc_def_Stats_clear_RID(0x005A,0x00B4,"Stats_HostRxBc", "Count of host received broadcast packets.")
+#define awc_RID_Stats_clear_HostRxUc           awc_def_Stats_clear_RID(0x005C,0x00B8,"Stats_HostRxUc", "Count of host received unicast packets.")
+#define awc_RID_Stats_clear_HostRxDiscar       awc_def_Stats_clear_RID(0x005E,0x00BC,"Stats_HostRxDiscar",     "Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
+#define awc_RID_Stats_clear_HmacTxMc           awc_def_Stats_clear_RID(0x0060,0x00C0,"Stats_HmacTxMc", "Count of internally generated multicast (DA) packets.")
+#define awc_RID_Stats_clear_HmacTxBc           awc_def_Stats_clear_RID(0x0062,0x00C4,"Stats_HmacTxBc", "Count of internally generated broadcast (DA) packets.")
+#define awc_RID_Stats_clear_HmacTxUc           awc_def_Stats_clear_RID(0x0064,0x00C8,"Stats_HmacTxUc", "Count of internally generated unicast (DA) packets.")
+#define awc_RID_Stats_clear_HmacTxFail                 awc_def_Stats_clear_RID(0x0066,0x00CC,"Stats_HmacTxFail",       "  Count of internally generated transmit packets that failed.")
+#define awc_RID_Stats_clear_HmacRxMc           awc_def_Stats_clear_RID(0x0068,0x00D0,"Stats_HmacRxMc", "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats_clear_HmacRxBc           awc_def_Stats_clear_RID(0x006A,0x00D4,"Stats_HmacRxBc", "Count of internally received broadcast (DA) packets.")
+#define awc_RID_Stats_clear_HmacRxUc           awc_def_Stats_clear_RID(0x006C,0x00D8,"Stats_HmacRxUc", "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats_clear_HmacRxDisca        awc_def_Stats_clear_RID(0x006E,0x00DC,"Stats_HmacRxDisca",      " Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
+#define awc_RID_Stats_clear_HmacRxAcce                 awc_def_Stats_clear_RID(0x0070,0x00E0,"Stats_HmacRxAcce",       "  Count of internally received packets that were accepted")
+#define awc_RID_Stats_clear_SsidMismatch       awc_def_Stats_clear_RID(0x0072,0x00E4,"Stats_SsidMismatch",     " Count of SSID mismatches.")
+#define awc_RID_Stats_clear_ApMismatch                 awc_def_Stats_clear_RID(0x0074,0x00E8,"Stats_ApMismatch",       "  Count of specified AP mismatches.")
+#define awc_RID_Stats_clear_RatesMismatc       awc_def_Stats_clear_RID(0x0076,0x00EC,"Stats_RatesMismatc",     " Count of rate mismatches.")
+#define awc_RID_Stats_clear_AuthReject                 awc_def_Stats_clear_RID(0x0078,0x00F0,"Stats_AuthReject",       "  Count of authentication rejections.")
+#define awc_RID_Stats_clear_AuthTimeout        awc_def_Stats_clear_RID(0x007A,0x00F4,"Stats_AuthTimeout",      " Count of authentication timeouts.")
+#define awc_RID_Stats_clear_AssocReject        awc_def_Stats_clear_RID(0x007C,0x00F8,"Stats_AssocReject",      " Count of association rejections.")
+#define awc_RID_Stats_clear_AssocTimeout       awc_def_Stats_clear_RID(0x007E,0x00FC,"Stats_AssocTimeout",     " Count of association timeouts.")
+#define awc_RID_Stats_clear_NewReason          awc_def_Stats_clear_RID(0x0080,0x0100,"Stats_NewReason",        "Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
+#define awc_RID_Stats_clear_AuthFail_1                 awc_def_Stats_clear_RID(0x0082,0x0104,"Stats_AuthFail_1",       "Unspecified reason.")
+#define awc_RID_Stats_clear_AuthFail_2                 awc_def_Stats_clear_RID(0x0084,0x0108,"Stats_AuthFail_2",       "Previous authentication no longer valid.")
+#define awc_RID_Stats_clear_AuthFail_3                 awc_def_Stats_clear_RID(0x0086,0x010C,"Stats_AuthFail_3",       "Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
+#define awc_RID_Stats_clear_AuthFail_4                 awc_def_Stats_clear_RID(0x0088,0x0110,"Stats_AuthFail_4",       "Disassociated due to inactivity")
+#define awc_RID_Stats_clear_AuthFail_5                 awc_def_Stats_clear_RID(0x008A,0x0114,"Stats_AuthFail_5",       "Disassociated because AP is unable to handle all currently  associated stations.")
+#define awc_RID_Stats_clear_AuthFail_6                 awc_def_Stats_clear_RID(0x008C,0x0118,"Stats_AuthFail_6",       "Class 2 Frame received from non-Authenticated station.")
+#define awc_RID_Stats_clear_AuthFail_7                 awc_def_Stats_clear_RID(0x008E,0x011C,"Stats_AuthFail_7",       "Class 3 Frame received from non-Associated station.")
+#define awc_RID_Stats_clear_AuthFail_8                 awc_def_Stats_clear_RID(0x0090,0x0120,"Stats_AuthFail_8",       "Disassociated because sending station is leaving (has left)")
+#define awc_RID_Stats_clear_AuthFail_9                 awc_def_Stats_clear_RID(0x0092,0x0124,"Stats_AuthFail_9",       "Station requesting (Re)Association is not Authenticated")
+#define awc_RID_Stats_clear_AuthFail_10        awc_def_Stats_clear_RID(0x0094,0x0128,"Stats_AuthFail_10",      "Cannot support all requested capabilities in the Capability")
+#define awc_RID_Stats_clear_AuthFail_11        awc_def_Stats_clear_RID(0x0096,0x012C,"Stats_AuthFail_11",      "Reassociation denied due to inability to confirm")
+#define awc_RID_Stats_clear_AuthFail_12        awc_def_Stats_clear_RID(0x0098,0x0130,"Stats_AuthFail_12",      "Association denied due to reason outside the scope of the 802.11")
+#define awc_RID_Stats_clear_AuthFail_13        awc_def_Stats_clear_RID(0x009A,0x0134,"Stats_AuthFail_13",      "Responding station does not support the specified Auth Alogorithm")
+#define awc_RID_Stats_clear_AuthFail_14        awc_def_Stats_clear_RID(0x009C,0x0138,"Stats_AuthFail_14",      "Received an out of sequence Authentication Frame.")
+#define awc_RID_Stats_clear_AuthFail_15        awc_def_Stats_clear_RID(0x009E,0x013C,"Stats_AuthFail_15",      "Authentication rejected due to challenge failure.")
+#define awc_RID_Stats_clear_AuthFail_16        awc_def_Stats_clear_RID(0x00A0,0x0140,"Stats_AuthFail_16",      "Authentication rejected due to timeout waiting for next  frame in sequence.")
+#define awc_RID_Stats_clear_AuthFail_17        awc_def_Stats_clear_RID(0x00A2,0x0144,"Stats_AuthFail_17",      "Association denied because AP is unable to handle  additional associated stations.")
+#define awc_RID_Stats_clear_AuthFail_18        awc_def_Stats_clear_RID(0x00A4,0x0148,"Stats_AuthFail_18",      "Association denied due to requesting station not supportingall basic rates.")
+#define awc_RID_Stats_clear_AuthFail_19        awc_def_Stats_clear_RID(0x00A6,0x014C,"Stats_AuthFail_19",      "Reserved")
+#define awc_RID_Stats_clear_RxMan              awc_def_Stats_clear_RID(0x00A8,0x0150,"Stats_RxMan",            " Count of management packets received and handled.")
+#define awc_RID_Stats_clear_TxMan              awc_def_Stats_clear_RID(0x00AA,0x0154,"Stats_TxMan",            " Count of management packets transmitted.")
+#define awc_RID_Stats_clear_RxRefresh          awc_def_Stats_clear_RID(0x00AC,0x0158,"Stats_RxRefresh",        " Count of null data packets received.")
+#define awc_RID_Stats_clear_TxRefresh          awc_def_Stats_clear_RID(0x00AE,0x015C,"Stats_TxRefresh",        " Count of null data packets transmitted.")
+#define awc_RID_Stats_clear_RxPoll             awc_def_Stats_clear_RID(0x00B0,0x0160,"Stats_RxPoll",           "Count of PS-Poll packets received.")
+#define awc_RID_Stats_clear_TxPoll             awc_def_Stats_clear_RID(0x00B2,0x0164,"Stats_TxPoll",           "Count of PS-Poll packets transmitted.")
+#define awc_RID_Stats_clear_HostRetries        awc_def_Stats_clear_RID(0x00B4,0x0168,"Stats_HostRetries",      " Count of long and short retries used to transmit host packets  (does not include first attempt).")
+#define awc_RID_Stats_clear_LostSync_HostReq   awc_def_Stats_clear_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
+#define awc_RID_Stats_clear_HostTxBytes        awc_def_Stats_clear_RID(0x00B8,0x0170,"Stats_HostTxBytes",      " Count of bytes transferred from the host.")
+#define awc_RID_Stats_clear_HostRxBytes        awc_def_Stats_clear_RID(0x00BA,0x0174,"Stats_HostRxBytes",      " Count of bytes transferred to the host.")
+#define awc_RID_Stats_clear_ElapsedUsec        awc_def_Stats_clear_RID(0x00BC,0x0178,"Stats_ElapsedUsec",      " Total time since power up (or clear) in microseconds.")
+#define awc_RID_Stats_clear_ElapsedSec                 awc_def_Stats_clear_RID(0x00BE,0x017C,"Stats_ElapsedSec",       " Total time since power up (or clear) in seconds.")
+#define awc_RID_Stats_clear_LostSyncBett       awc_def_Stats_clear_RID(0x00C0,0x0180,"Stats_LostSyncBett",     "Lost Sync to switch to a better access point")
+
+
+
+#define awc_RID_Stats16_RidLen                 awc_def_Stats16_RID(0x0000,0x0000,"RidLen",             "Length of the RID including the length field.")
+#define awc_RID_Stats16_RxOverrunErr   awc_def_Stats16_RID(0x0002,0x0004,"Stats_RxOverrunErr", "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
+#define awc_RID_Stats16_RxPlcpCrcErr   awc_def_Stats16_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr", "PLCP header checksum errors (CRC16).")
+#define awc_RID_Stats16_RxPlcpFormat   awc_def_Stats16_RID(0x0006,0x000C,"Stats_RxPlcpFormat", "PLCP format errors.")
+#define awc_RID_Stats16_RxPlcpLength   awc_def_Stats16_RID(0x0008,0x0010,"Stats_RxPlcpLength", "PLCP length is incorrect.")
+#define awc_RID_Stats16_RxMacCrcErr    awc_def_Stats16_RID(0x000A,0x0014,"Stats_RxMacCrcErr",  "Count of MAC CRC32 errors.")
+#define awc_RID_Stats16_RxMacCrcOk     awc_def_Stats16_RID(0x000C,0x0018,"Stats_RxMacCrcOk",   "Count of MAC CRC32 received correctly.")
+#define awc_RID_Stats16_RxWepErr       awc_def_Stats16_RID(0x000E,0x001C,"Stats_RxWepErr",     "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats16_RxWepOk        awc_def_Stats16_RID(0x0010,0x0020,"Stats_RxWepOk",      "Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats16_RetryLong      awc_def_Stats16_RID(0x0012,0x0024,"Stats_RetryLongCount",       "of all long retries. (Does not include first attempt for a packet).")
+#define awc_RID_Stats16_RetryShort     awc_def_Stats16_RID(0x0014,0x0028,"Stats_RetryShort",   "Count of all short retries. (Does not include first attempt for   a packet).")
+#define awc_RID_Stats16_MaxRetries     awc_def_Stats16_RID(0x0016,0x002C,"Stats_MaxRetries",   "Count of number of packets that max-retried -- ie were  never ACKd.")
+#define awc_RID_Stats16_NoAck          awc_def_Stats16_RID(0x0018,0x0030,"Stats_NoAck",                "Count of number of times that ACK was not received.")
+#define awc_RID_Stats16_NoCts          awc_def_Stats16_RID(0x001A,0x0034,"Stats_NoCts",                "Count of number of timer that CTS was not received.")
+#define awc_RID_Stats16_RxAck          awc_def_Stats16_RID(0x001C,0x0038,"Stats_RxAck",                "Count of number of expected ACKs that were received.")
+#define awc_RID_Stats16_RxCts          awc_def_Stats16_RID(0x001E,0x003C,"Stats_RxCts",                "Count of number of expected CTSs that were received.")
+#define awc_RID_Stats16_TxAck          awc_def_Stats16_RID(0x0020,0x0040,"Stats_TxAck",                "Count of number of ACKs transmitted.")
+#define awc_RID_Stats16_TxRts          awc_def_Stats16_RID(0x0022,0x0044,"Stats_TxRts",                "Count of number of RTSs transmitted.")
+#define awc_RID_Stats16_TxCts          awc_def_Stats16_RID(0x0024,0x0048,"Stats_TxCts",                "Count of number of CTSs transmitted.")
+#define awc_RID_Stats16_TxMc           awc_def_Stats16_RID(0x0026,0x004C,"Stats_TxMc",         " LMAC count of multicast packets sent (uses 802.11  Address1).")
+#define awc_RID_Stats16_TxBc           awc_def_Stats16_RID(0x0028,0x0050,"Stats_TxBc",         " LMAC count of broadcast packets sent (uses 802.11")
+#define awc_RID_Stats16_TxUcFrags      awc_def_Stats16_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",        " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
+#define awc_RID_Stats16_TxUcPackets    awc_def_Stats16_RID(0x002C,0x0058,"Stats_TxUcPackets",  "LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
+#define awc_RID_Stats16_TxBeacon       awc_def_Stats16_RID(0x002E,0x005C,"Stats_TxBeacon",     " Count of beacon packets transmitted.")
+#define awc_RID_Stats16_RxBeacon       awc_def_Stats16_RID(0x0030,0x0060,"Stats_RxBeacon",     " Count of beacon packets received matching our BSSID.")
+#define awc_RID_Stats16_TxSinColl      awc_def_Stats16_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
+#define awc_RID_Stats16_TxMulColl      awc_def_Stats16_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
+#define awc_RID_Stats16_DefersNo       awc_def_Stats16_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
+#define awc_RID_Stats16_DefersProt     awc_def_Stats16_RID(0x0038,0x0070,"Stats_DefersProt",   " Transmit frames deferred due to protocol.")
+#define awc_RID_Stats16_DefersEngy     awc_def_Stats16_RID(0x003A,0x0074,"Stats_DefersEngy",   " Transmit frames deferred due to energy detect.")
+#define awc_RID_Stats16_DupFram        awc_def_Stats16_RID(0x003C,0x0078,"Stats_DupFram",      "  Duplicate receive frames and fragments.")
+#define awc_RID_Stats16_RxFragDisc     awc_def_Stats16_RID(0x003E,0x007C,"Stats_RxFragDisc",   " Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
+#define awc_RID_Stats16_TxAged                 awc_def_Stats16_RID(0x0040,0x0080,"Stats_TxAged",               "   Transmit packets exceeding maximum transmit lifetime. **")
+#define awc_RID_Stats16_RxAged                 awc_def_Stats16_RID(0x0042,0x0084,"Stats_RxAgedReceive",        " packets exceeding maximum receive lifetime. **")
+#define awc_RID_Stats16_LostSync_Max   awc_def_Stats16_RID(0x0044,0x0088,"Stats_LostSync_Max", " Lost sync with our cell due to maximum retries occuring. Retry")
+#define awc_RID_Stats16_LostSync_Mis   awc_def_Stats16_RID(0x0046,0x008C,"Stats_LostSync_Mis", "Lost sync with our cell due to missing too many beacons. sedBeacons")
+#define awc_RID_Stats16_LostSync_Arl   awc_def_Stats16_RID(0x0048,0x0090,"Stats_LostSync_Arl", "Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
+#define awc_RID_Stats16_LostSync_Dea   awc_def_Stats16_RID(0x004A,0x0094,"Stats_LostSync_Dea", "Lost sync with our cell due to being deauthenticated.,thed")
+#define awc_RID_Stats16_LostSync_Disa  awc_def_Stats16_RID(0x004C,0x0098,"Stats_LostSync_Disa",        " Lost sync with our cell due to being disassociated. ssoced")
+#define awc_RID_Stats16_LostSync_Tsf   awc_def_Stats16_RID(0x004E,0x009C,"Stats_LostSync_Tsf", "Lost sync with our cell due to excessive change in TSF  Timingtiming.")
+#define awc_RID_Stats16_HostTxMc       awc_def_Stats16_RID(0x0050,0x00A0,"Stats_HostTxMc",     "Count of multicast packets sent by the host.")
+#define awc_RID_Stats16_HostTxBc       awc_def_Stats16_RID(0x0052,0x00A4,"Stats_HostTxBc",     "Count of broadcast packets sent by the host.")
+#define awc_RID_Stats16_HostTxUc       awc_def_Stats16_RID(0x0054,0x00A8,"Stats_HostTxUc",     "Count of unicast packets sent by the host.")
+#define awc_RID_Stats16_HostTxFail     awc_def_Stats16_RID(0x0056,0x00AC,"Stats_HostTxFail",   "  Count of host transmitted packets which failed.")
+#define awc_RID_Stats16_HostRxMc       awc_def_Stats16_RID(0x0058,0x00B0,"Stats_HostRxMc",     "Count of host received multicast packets.")
+#define awc_RID_Stats16_HostRxBc       awc_def_Stats16_RID(0x005A,0x00B4,"Stats_HostRxBc",     "Count of host received broadcast packets.")
+#define awc_RID_Stats16_HostRxUc       awc_def_Stats16_RID(0x005C,0x00B8,"Stats_HostRxUc",     "Count of host received unicast packets.")
+#define awc_RID_Stats16_HostRxDiscar   awc_def_Stats16_RID(0x005E,0x00BC,"Stats_HostRxDiscar", "Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
+#define awc_RID_Stats16_HmacTxMc       awc_def_Stats16_RID(0x0060,0x00C0,"Stats_HmacTxMc",     "Count of internally generated multicast (DA) packets.")
+#define awc_RID_Stats16_HmacTxBc       awc_def_Stats16_RID(0x0062,0x00C4,"Stats_HmacTxBc",     "Count of internally generated broadcast (DA) packets.")
+#define awc_RID_Stats16_HmacTxUc       awc_def_Stats16_RID(0x0064,0x00C8,"Stats_HmacTxUc",     "Count of internally generated unicast (DA) packets.")
+#define awc_RID_Stats16_HmacTxFail     awc_def_Stats16_RID(0x0066,0x00CC,"Stats_HmacTxFail",   "  Count of internally generated transmit packets that failed.")
+#define awc_RID_Stats16_HmacRxMc       awc_def_Stats16_RID(0x0068,0x00D0,"Stats_HmacRxMc",     "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats16_HmacRxBc       awc_def_Stats16_RID(0x006A,0x00D4,"Stats_HmacRxBc",     "Count of internally received broadcast (DA) packets.")
+#define awc_RID_Stats16_HmacRxUc       awc_def_Stats16_RID(0x006C,0x00D8,"Stats_HmacRxUc",     "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats16_HmacRxDisca    awc_def_Stats16_RID(0x006E,0x00DC,"Stats_HmacRxDisca",  " Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
+#define awc_RID_Stats16_HmacRxAcce     awc_def_Stats16_RID(0x0070,0x00E0,"Stats_HmacRxAcce",   "  Count of internally received packets that were accepted")
+#define awc_RID_Stats16_SsidMismatch   awc_def_Stats16_RID(0x0072,0x00E4,"Stats_SsidMismatch", " Count of SSID mismatches.")
+#define awc_RID_Stats16_ApMismatch     awc_def_Stats16_RID(0x0074,0x00E8,"Stats_ApMismatch",   "  Count of specified AP mismatches.")
+#define awc_RID_Stats16_RatesMismatc   awc_def_Stats16_RID(0x0076,0x00EC,"Stats_RatesMismatc", " Count of rate mismatches.")
+#define awc_RID_Stats16_AuthReject     awc_def_Stats16_RID(0x0078,0x00F0,"Stats_AuthReject",   "  Count of authentication rejections.")
+#define awc_RID_Stats16_AuthTimeout    awc_def_Stats16_RID(0x007A,0x00F4,"Stats_AuthTimeout",  " Count of authentication timeouts.")
+#define awc_RID_Stats16_AssocReject    awc_def_Stats16_RID(0x007C,0x00F8,"Stats_AssocReject",  " Count of association rejections.")
+#define awc_RID_Stats16_AssocTimeout   awc_def_Stats16_RID(0x007E,0x00FC,"Stats_AssocTimeout", " Count of association timeouts.")
+#define awc_RID_Stats16_NewReason      awc_def_Stats16_RID(0x0080,0x0100,"Stats_NewReason",    "Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
+#define awc_RID_Stats16_AuthFail_1     awc_def_Stats16_RID(0x0082,0x0104,"Stats_AuthFail_1",   "Unspecified reason.")
+#define awc_RID_Stats16_AuthFail_2     awc_def_Stats16_RID(0x0084,0x0108,"Stats_AuthFail_2",   "Previous authentication no longer valid.")
+#define awc_RID_Stats16_AuthFail_3     awc_def_Stats16_RID(0x0086,0x010C,"Stats_AuthFail_3",   "Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
+#define awc_RID_Stats16_AuthFail_4     awc_def_Stats16_RID(0x0088,0x0110,"Stats_AuthFail_4",   "Disassociated due to inactivity")
+#define awc_RID_Stats16_AuthFail_5     awc_def_Stats16_RID(0x008A,0x0114,"Stats_AuthFail_5",   "Disassociated because AP is unable to handle all currently  associated stations.")
+#define awc_RID_Stats16_AuthFail_6     awc_def_Stats16_RID(0x008C,0x0118,"Stats_AuthFail_6",   "Class 2 Frame received from non-Authenticated station.")
+#define awc_RID_Stats16_AuthFail_7     awc_def_Stats16_RID(0x008E,0x011C,"Stats_AuthFail_7",   "Class 3 Frame received from non-Associated station.")
+#define awc_RID_Stats16_AuthFail_8     awc_def_Stats16_RID(0x0090,0x0120,"Stats_AuthFail_8",   "Disassociated because sending station is leaving (has left)")
+#define awc_RID_Stats16_AuthFail_9     awc_def_Stats16_RID(0x0092,0x0124,"Stats_AuthFail_9",   "Station requesting (Re)Association is not Authenticated")
+#define awc_RID_Stats16_AuthFail_10    awc_def_Stats16_RID(0x0094,0x0128,"Stats_AuthFail_10",  "Cannot support all requested capabilities in the Capability")
+#define awc_RID_Stats16_AuthFail_11    awc_def_Stats16_RID(0x0096,0x012C,"Stats_AuthFail_11",  "Reassociation denied due to inability to confirm")
+#define awc_RID_Stats16_AuthFail_12    awc_def_Stats16_RID(0x0098,0x0130,"Stats_AuthFail_12",  "Association denied due to reason outside the scope of the 802.11")
+#define awc_RID_Stats16_AuthFail_13    awc_def_Stats16_RID(0x009A,0x0134,"Stats_AuthFail_13",  "Responding station does not support the specified Auth Alogorithm")
+#define awc_RID_Stats16_AuthFail_14    awc_def_Stats16_RID(0x009C,0x0138,"Stats_AuthFail_14",  "Received an out of sequence Authentication Frame.")
+#define awc_RID_Stats16_AuthFail_15    awc_def_Stats16_RID(0x009E,0x013C,"Stats_AuthFail_15",  "Authentication rejected due to challenge failure.")
+#define awc_RID_Stats16_AuthFail_16    awc_def_Stats16_RID(0x00A0,0x0140,"Stats_AuthFail_16",  "Authentication rejected due to timeout waiting for next  frame in sequence.")
+#define awc_RID_Stats16_AuthFail_17    awc_def_Stats16_RID(0x00A2,0x0144,"Stats_AuthFail_17",  "Association denied because AP is unable to handle  additional associated stations.")
+#define awc_RID_Stats16_AuthFail_18    awc_def_Stats16_RID(0x00A4,0x0148,"Stats_AuthFail_18",  "Association denied due to requesting station not supportingall basic rates.")
+#define awc_RID_Stats16_AuthFail_19    awc_def_Stats16_RID(0x00A6,0x014C,"Stats_AuthFail_19",  "Reserved")
+#define awc_RID_Stats16_RxMan          awc_def_Stats16_RID(0x00A8,0x0150,"Stats_RxMan",                " Count of management packets received and handled.")
+#define awc_RID_Stats16_TxMan          awc_def_Stats16_RID(0x00AA,0x0154,"Stats_TxMan",                " Count of management packets transmitted.")
+#define awc_RID_Stats16_RxRefresh      awc_def_Stats16_RID(0x00AC,0x0158,"Stats_RxRefresh",    " Count of null data packets received.")
+#define awc_RID_Stats16_TxRefresh      awc_def_Stats16_RID(0x00AE,0x015C,"Stats_TxRefresh",    " Count of null data packets transmitted.")
+#define awc_RID_Stats16_RxPoll                 awc_def_Stats16_RID(0x00B0,0x0160,"Stats_RxPoll",               "Count of PS-Poll packets received.")
+#define awc_RID_Stats16_TxPoll                 awc_def_Stats16_RID(0x00B2,0x0164,"Stats_TxPoll",               "Count of PS-Poll packets transmitted.")
+#define awc_RID_Stats16_HostRetries    awc_def_Stats16_RID(0x00B4,0x0168,"Stats_HostRetries",  " Count of long and short retries used to transmit host packets  (does not include first attempt).")
+#define awc_RID_Stats16_LostSync_HostReq awc_def_Stats16_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
+#define awc_RID_Stats16_HostTxBytes    awc_def_Stats16_RID(0x00B8,0x0170,"Stats_HostTxBytes",  " Count of bytes transferred from the host.")
+#define awc_RID_Stats16_HostRxBytes    awc_def_Stats16_RID(0x00BA,0x0174,"Stats_HostRxBytes",  " Count of bytes transferred to the host.")
+#define awc_RID_Stats16_ElapsedUsec    awc_def_Stats16_RID(0x00BC,0x0178,"Stats_ElapsedUsec",  " Total time since power up (or clear) in microseconds.")
+#define awc_RID_Stats16_ElapsedSec     awc_def_Stats16_RID(0x00BE,0x017C,"Stats_ElapsedSec",   " Total time since power up (or clear) in seconds.")
+#define awc_RID_Stats16_LostSyncBett   awc_def_Stats16_RID(0x00C0,0x0180,"Stats_LostSyncBett", "Lost Sync to switch to a better access point")
+
+
+
+#define awc_RID_Stats16_delta_RidLen           awc_def_Stats16_delta_RID(0x0000,0x0000,"RidLen",               "Length of the RID including the length field.")
+#define awc_RID_Stats16_delta_RxOverrunErr     awc_def_Stats16_delta_RID(0x0002,0x0004,"Stats_RxOverrunErr",   "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
+#define awc_RID_Stats16_delta_RxPlcpCrcErr     awc_def_Stats16_delta_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",   "PLCP header checksum errors (CRC16).")
+#define awc_RID_Stats16_delta_RxPlcpFormat     awc_def_Stats16_delta_RID(0x0006,0x000C,"Stats_RxPlcpFormat",   "PLCP format errors.")
+#define awc_RID_Stats16_delta_RxPlcpLength     awc_def_Stats16_delta_RID(0x0008,0x0010,"Stats_RxPlcpLength",   "PLCP length is incorrect.")
+#define awc_RID_Stats16_delta_RxMacCrcErr      awc_def_Stats16_delta_RID(0x000A,0x0014,"Stats_RxMacCrcErr",    "Count of MAC CRC32 errors.")
+#define awc_RID_Stats16_delta_RxMacCrcOk       awc_def_Stats16_delta_RID(0x000C,0x0018,"Stats_RxMacCrcOk",     "Count of MAC CRC32 received correctly.")
+#define awc_RID_Stats16_delta_RxWepErr                 awc_def_Stats16_delta_RID(0x000E,0x001C,"Stats_RxWepErr",       "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats16_delta_RxWepOk          awc_def_Stats16_delta_RID(0x0010,0x0020,"Stats_RxWepOk",        "Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats16_delta_RetryLong        awc_def_Stats16_delta_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).")
+#define awc_RID_Stats16_delta_RetryShort       awc_def_Stats16_delta_RID(0x0014,0x0028,"Stats_RetryShort",     "Count of all short retries. (Does not include first attempt for   a packet).")
+#define awc_RID_Stats16_delta_MaxRetries       awc_def_Stats16_delta_RID(0x0016,0x002C,"Stats_MaxRetries",     "Count of number of packets that max-retried -- ie were  never ACKd.")
+#define awc_RID_Stats16_delta_NoAck            awc_def_Stats16_delta_RID(0x0018,0x0030,"Stats_NoAck",          "Count of number of times that ACK was not received.")
+#define awc_RID_Stats16_delta_NoCts            awc_def_Stats16_delta_RID(0x001A,0x0034,"Stats_NoCts",          "Count of number of timer that CTS was not received.")
+#define awc_RID_Stats16_delta_RxAck            awc_def_Stats16_delta_RID(0x001C,0x0038,"Stats_RxAck",          "Count of number of expected ACKs that were received.")
+#define awc_RID_Stats16_delta_RxCts            awc_def_Stats16_delta_RID(0x001E,0x003C,"Stats_RxCts",          "Count of number of expected CTSs that were received.")
+#define awc_RID_Stats16_delta_TxAck            awc_def_Stats16_delta_RID(0x0020,0x0040,"Stats_TxAck",          "Count of number of ACKs transmitted.")
+#define awc_RID_Stats16_delta_TxRts            awc_def_Stats16_delta_RID(0x0022,0x0044,"Stats_TxRts",          "Count of number of RTSs transmitted.")
+#define awc_RID_Stats16_delta_TxCts            awc_def_Stats16_delta_RID(0x0024,0x0048,"Stats_TxCts",          "Count of number of CTSs transmitted.")
+#define awc_RID_Stats16_delta_TxMc             awc_def_Stats16_delta_RID(0x0026,0x004C,"Stats_TxMc",           " LMAC count of multicast packets sent (uses 802.11  Address1).")
+#define awc_RID_Stats16_delta_TxBc             awc_def_Stats16_delta_RID(0x0028,0x0050,"Stats_TxBc",           " LMAC count of broadcast packets sent (uses 802.11")
+#define awc_RID_Stats16_delta_TxUcFrags        awc_def_Stats16_delta_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",  " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
+#define awc_RID_Stats16_delta_TxUcPackets      awc_def_Stats16_delta_RID(0x002C,0x0058,"Stats_TxUcPackets",    "LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
+#define awc_RID_Stats16_delta_TxBeacon                 awc_def_Stats16_delta_RID(0x002E,0x005C,"Stats_TxBeacon",       " Count of beacon packets transmitted.")
+#define awc_RID_Stats16_delta_RxBeacon                 awc_def_Stats16_delta_RID(0x0030,0x0060,"Stats_RxBeacon",       " Count of beacon packets received matching our BSSID.")
+#define awc_RID_Stats16_delta_TxSinColl        awc_def_Stats16_delta_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
+#define awc_RID_Stats16_delta_TxMulColl        awc_def_Stats16_delta_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
+#define awc_RID_Stats16_delta_DefersNo                 awc_def_Stats16_delta_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
+#define awc_RID_Stats16_delta_DefersProt       awc_def_Stats16_delta_RID(0x0038,0x0070,"Stats_DefersProt",     " Transmit frames deferred due to protocol.")
+#define awc_RID_Stats16_delta_DefersEngy       awc_def_Stats16_delta_RID(0x003A,0x0074,"Stats_DefersEngy",     " Transmit frames deferred due to energy detect.")
+#define awc_RID_Stats16_delta_DupFram          awc_def_Stats16_delta_RID(0x003C,0x0078,"Stats_DupFram",        "  Duplicate receive frames and fragments.")
+#define awc_RID_Stats16_delta_RxFragDisc       awc_def_Stats16_delta_RID(0x003E,0x007C,"Stats_RxFragDisc",     " Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
+#define awc_RID_Stats16_delta_TxAged           awc_def_Stats16_delta_RID(0x0040,0x0080,"Stats_TxAged",         "   Transmit packets exceeding maximum transmit lifetime. **")
+#define awc_RID_Stats16_delta_RxAged           awc_def_Stats16_delta_RID(0x0042,0x0084,"Stats_RxAgedReceive",  " packets exceeding maximum receive lifetime. **")
+#define awc_RID_Stats16_delta_LostSync_Max     awc_def_Stats16_delta_RID(0x0044,0x0088,"Stats_LostSync_Max",   " Lost sync with our cell due to maximum retries occuring. Retry")
+#define awc_RID_Stats16_delta_LostSync_Mis     awc_def_Stats16_delta_RID(0x0046,0x008C,"Stats_LostSync_Mis",   "Lost sync with our cell due to missing too many beacons. sedBeacons")
+#define awc_RID_Stats16_delta_LostSync_Arl     awc_def_Stats16_delta_RID(0x0048,0x0090,"Stats_LostSync_Arl",   "Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
+#define awc_RID_Stats16_delta_LostSync_Dea     awc_def_Stats16_delta_RID(0x004A,0x0094,"Stats_LostSync_Dea",   "Lost sync with our cell due to being deauthenticated.,thed")
+#define awc_RID_Stats16_delta_LostSync_Disa    awc_def_Stats16_delta_RID(0x004C,0x0098,"Stats_LostSync_Disa",  " Lost sync with our cell due to being disassociated. ssoced")
+#define awc_RID_Stats16_delta_LostSync_Tsf     awc_def_Stats16_delta_RID(0x004E,0x009C,"Stats_LostSync_Tsf",   "Lost sync with our cell due to excessive change in TSF  Timingtiming.")
+#define awc_RID_Stats16_delta_HostTxMc                 awc_def_Stats16_delta_RID(0x0050,0x00A0,"Stats_HostTxMc",       "Count of multicast packets sent by the host.")
+#define awc_RID_Stats16_delta_HostTxBc                 awc_def_Stats16_delta_RID(0x0052,0x00A4,"Stats_HostTxBc",       "Count of broadcast packets sent by the host.")
+#define awc_RID_Stats16_delta_HostTxUc                 awc_def_Stats16_delta_RID(0x0054,0x00A8,"Stats_HostTxUc",       "Count of unicast packets sent by the host.")
+#define awc_RID_Stats16_delta_HostTxFail       awc_def_Stats16_delta_RID(0x0056,0x00AC,"Stats_HostTxFail",     "  Count of host transmitted packets which failed.")
+#define awc_RID_Stats16_delta_HostRxMc                 awc_def_Stats16_delta_RID(0x0058,0x00B0,"Stats_HostRxMc",       "Count of host received multicast packets.")
+#define awc_RID_Stats16_delta_HostRxBc                 awc_def_Stats16_delta_RID(0x005A,0x00B4,"Stats_HostRxBc",       "Count of host received broadcast packets.")
+#define awc_RID_Stats16_delta_HostRxUc                 awc_def_Stats16_delta_RID(0x005C,0x00B8,"Stats_HostRxUc",       "Count of host received unicast packets.")
+#define awc_RID_Stats16_delta_HostRxDiscar     awc_def_Stats16_delta_RID(0x005E,0x00BC,"Stats_HostRxDiscar",   "Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
+#define awc_RID_Stats16_delta_HmacTxMc                 awc_def_Stats16_delta_RID(0x0060,0x00C0,"Stats_HmacTxMc",       "Count of internally generated multicast (DA) packets.")
+#define awc_RID_Stats16_delta_HmacTxBc                 awc_def_Stats16_delta_RID(0x0062,0x00C4,"Stats_HmacTxBc",       "Count of internally generated broadcast (DA) packets.")
+#define awc_RID_Stats16_delta_HmacTxUc                 awc_def_Stats16_delta_RID(0x0064,0x00C8,"Stats_HmacTxUc",       "Count of internally generated unicast (DA) packets.")
+#define awc_RID_Stats16_delta_HmacTxFail       awc_def_Stats16_delta_RID(0x0066,0x00CC,"Stats_HmacTxFail",     "  Count of internally generated transmit packets that failed.")
+#define awc_RID_Stats16_delta_HmacRxMc                 awc_def_Stats16_delta_RID(0x0068,0x00D0,"Stats_HmacRxMc",       "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats16_delta_HmacRxBc                 awc_def_Stats16_delta_RID(0x006A,0x00D4,"Stats_HmacRxBc",       "Count of internally received broadcast (DA) packets.")
+#define awc_RID_Stats16_delta_HmacRxUc                 awc_def_Stats16_delta_RID(0x006C,0x00D8,"Stats_HmacRxUc",       "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats16_delta_HmacRxDisca      awc_def_Stats16_delta_RID(0x006E,0x00DC,"Stats_HmacRxDisca",    " Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
+#define awc_RID_Stats16_delta_HmacRxAcce       awc_def_Stats16_delta_RID(0x0070,0x00E0,"Stats_HmacRxAcce",     "  Count of internally received packets that were accepted")
+#define awc_RID_Stats16_delta_SsidMismatch     awc_def_Stats16_delta_RID(0x0072,0x00E4,"Stats_SsidMismatch",   " Count of SSID mismatches.")
+#define awc_RID_Stats16_delta_ApMismatch       awc_def_Stats16_delta_RID(0x0074,0x00E8,"Stats_ApMismatch",     "  Count of specified AP mismatches.")
+#define awc_RID_Stats16_delta_RatesMismatc     awc_def_Stats16_delta_RID(0x0076,0x00EC,"Stats_RatesMismatc",   " Count of rate mismatches.")
+#define awc_RID_Stats16_delta_AuthReject       awc_def_Stats16_delta_RID(0x0078,0x00F0,"Stats_AuthReject",     "  Count of authentication rejections.")
+#define awc_RID_Stats16_delta_AuthTimeout      awc_def_Stats16_delta_RID(0x007A,0x00F4,"Stats_AuthTimeout",    " Count of authentication timeouts.")
+#define awc_RID_Stats16_delta_AssocReject      awc_def_Stats16_delta_RID(0x007C,0x00F8,"Stats_AssocReject",    " Count of association rejections.")
+#define awc_RID_Stats16_delta_AssocTimeout     awc_def_Stats16_delta_RID(0x007E,0x00FC,"Stats_AssocTimeout",   " Count of association timeouts.")
+#define awc_RID_Stats16_delta_NewReason        awc_def_Stats16_delta_RID(0x0080,0x0100,"Stats_NewReason",      "Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
+#define awc_RID_Stats16_delta_AuthFail_1       awc_def_Stats16_delta_RID(0x0082,0x0104,"Stats_AuthFail_1",     "Unspecified reason.")
+#define awc_RID_Stats16_delta_AuthFail_2       awc_def_Stats16_delta_RID(0x0084,0x0108,"Stats_AuthFail_2",     "Previous authentication no longer valid.")
+#define awc_RID_Stats16_delta_AuthFail_3       awc_def_Stats16_delta_RID(0x0086,0x010C,"Stats_AuthFail_3",     "Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
+#define awc_RID_Stats16_delta_AuthFail_4       awc_def_Stats16_delta_RID(0x0088,0x0110,"Stats_AuthFail_4",     "Disassociated due to inactivity")
+#define awc_RID_Stats16_delta_AuthFail_5       awc_def_Stats16_delta_RID(0x008A,0x0114,"Stats_AuthFail_5",     "Disassociated because AP is unable to handle all currently  associated stations.")
+#define awc_RID_Stats16_delta_AuthFail_6       awc_def_Stats16_delta_RID(0x008C,0x0118,"Stats_AuthFail_6",     "Class 2 Frame received from non-Authenticated station.")
+#define awc_RID_Stats16_delta_AuthFail_7       awc_def_Stats16_delta_RID(0x008E,0x011C,"Stats_AuthFail_7",     "Class 3 Frame received from non-Associated station.")
+#define awc_RID_Stats16_delta_AuthFail_8       awc_def_Stats16_delta_RID(0x0090,0x0120,"Stats_AuthFail_8",     "Disassociated because sending station is leaving (has left)")
+#define awc_RID_Stats16_delta_AuthFail_9       awc_def_Stats16_delta_RID(0x0092,0x0124,"Stats_AuthFail_9",     "Station requesting (Re)Association is not Authenticated")
+#define awc_RID_Stats16_delta_AuthFail_10      awc_def_Stats16_delta_RID(0x0094,0x0128,"Stats_AuthFail_10",    "Cannot support all requested capabilities in the Capability")
+#define awc_RID_Stats16_delta_AuthFail_11      awc_def_Stats16_delta_RID(0x0096,0x012C,"Stats_AuthFail_11",    "Reassociation denied due to inability to confirm")
+#define awc_RID_Stats16_delta_AuthFail_12      awc_def_Stats16_delta_RID(0x0098,0x0130,"Stats_AuthFail_12",    "Association denied due to reason outside the scope of the 802.11")
+#define awc_RID_Stats16_delta_AuthFail_13      awc_def_Stats16_delta_RID(0x009A,0x0134,"Stats_AuthFail_13",    "Responding station does not support the specified Auth Alogorithm")
+#define awc_RID_Stats16_delta_AuthFail_14      awc_def_Stats16_delta_RID(0x009C,0x0138,"Stats_AuthFail_14",    "Received an out of sequence Authentication Frame.")
+#define awc_RID_Stats16_delta_AuthFail_15      awc_def_Stats16_delta_RID(0x009E,0x013C,"Stats_AuthFail_15",    "Authentication rejected due to challenge failure.")
+#define awc_RID_Stats16_delta_AuthFail_16      awc_def_Stats16_delta_RID(0x00A0,0x0140,"Stats_AuthFail_16",    "Authentication rejected due to timeout waiting for next  frame in sequence.")
+#define awc_RID_Stats16_delta_AuthFail_17      awc_def_Stats16_delta_RID(0x00A2,0x0144,"Stats_AuthFail_17",    "Association denied because AP is unable to handle  additional associated stations.")
+#define awc_RID_Stats16_delta_AuthFail_18      awc_def_Stats16_delta_RID(0x00A4,0x0148,"Stats_AuthFail_18",    "Association denied due to requesting station not supportingall basic rates.")
+#define awc_RID_Stats16_delta_AuthFail_19      awc_def_Stats16_delta_RID(0x00A6,0x014C,"Stats_AuthFail_19",    "Reserved")
+#define awc_RID_Stats16_delta_RxMan            awc_def_Stats16_delta_RID(0x00A8,0x0150,"Stats_RxMan",          " Count of management packets received and handled.")
+#define awc_RID_Stats16_delta_TxMan            awc_def_Stats16_delta_RID(0x00AA,0x0154,"Stats_TxMan",          " Count of management packets transmitted.")
+#define awc_RID_Stats16_delta_RxRefresh        awc_def_Stats16_delta_RID(0x00AC,0x0158,"Stats_RxRefresh",      " Count of null data packets received.")
+#define awc_RID_Stats16_delta_TxRefresh        awc_def_Stats16_delta_RID(0x00AE,0x015C,"Stats_TxRefresh",      " Count of null data packets transmitted.")
+#define awc_RID_Stats16_delta_RxPoll           awc_def_Stats16_delta_RID(0x00B0,0x0160,"Stats_RxPoll",         "Count of PS-Poll packets received.")
+#define awc_RID_Stats16_delta_TxPoll           awc_def_Stats16_delta_RID(0x00B2,0x0164,"Stats_TxPoll",         "Count of PS-Poll packets transmitted.")
+#define awc_RID_Stats16_delta_HostRetries      awc_def_Stats16_delta_RID(0x00B4,0x0168,"Stats_HostRetries",    " Count of long and short retries used to transmit host packets  (does not include first attempt).")
+#define awc_RID_Stats16_delta_LostSync_HostReq         awc_def_Stats16_delta_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
+#define awc_RID_Stats16_delta_HostTxBytes      awc_def_Stats16_delta_RID(0x00B8,0x0170,"Stats_HostTxBytes",    " Count of bytes transferred from the host.")
+#define awc_RID_Stats16_delta_HostRxBytes      awc_def_Stats16_delta_RID(0x00BA,0x0174,"Stats_HostRxBytes",    " Count of bytes transferred to the host.")
+#define awc_RID_Stats16_delta_ElapsedUsec      awc_def_Stats16_delta_RID(0x00BC,0x0178,"Stats_ElapsedUsec",    " Total time since power up (or clear) in microseconds.")
+#define awc_RID_Stats16_delta_ElapsedSec       awc_def_Stats16_delta_RID(0x00BE,0x017C,"Stats_ElapsedSec",     " Total time since power up (or clear) in seconds.")
+#define awc_RID_Stats16_delta_LostSyncBett     awc_def_Stats16_delta_RID(0x00C0,0x0180,"Stats_LostSyncBett",   "Lost Sync to switch to a better access point")
+
+
+#define awc_RID_Stats16_clear_RidLen           awc_def_Stats16_clear_RID(0x0000,0x0000,"RidLen",               "Length of the RID including the length field.")
+#define awc_RID_Stats16_clear_RxOverrunErr     awc_def_Stats16_clear_RID(0x0002,0x0004,"Stats_RxOverrunErr",   "Receive overruns -- No buffer available to handle the receive. (result is that the packet is never received)")
+#define awc_RID_Stats16_clear_RxPlcpCrcErr     awc_def_Stats16_clear_RID(0x0004,0x0008,"Stats_RxPlcpCrcErr",   "PLCP header checksum errors (CRC16).")
+#define awc_RID_Stats16_clear_RxPlcpFormat     awc_def_Stats16_clear_RID(0x0006,0x000C,"Stats_RxPlcpFormat",   "PLCP format errors.")
+#define awc_RID_Stats16_clear_RxPlcpLength     awc_def_Stats16_clear_RID(0x0008,0x0010,"Stats_RxPlcpLength",   "PLCP length is incorrect.")
+#define awc_RID_Stats16_clear_RxMacCrcErr      awc_def_Stats16_clear_RID(0x000A,0x0014,"Stats_RxMacCrcErr",    "Count of MAC CRC32 errors.")
+#define awc_RID_Stats16_clear_RxMacCrcOk       awc_def_Stats16_clear_RID(0x000C,0x0018,"Stats_RxMacCrcOk",     "Count of MAC CRC32 received correctly.")
+#define awc_RID_Stats16_clear_RxWepErr                 awc_def_Stats16_clear_RID(0x000E,0x001C,"Stats_RxWepErr",       "Count of all WEP ICV checks that failed. (this value is included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats16_clear_RxWepOk          awc_def_Stats16_clear_RID(0x0010,0x0020,"Stats_RxWepOk",        "Count of all WEP ICV checks that passed. (this value is  included in Stats_RxMacCrcOk)")
+#define awc_RID_Stats16_clear_RetryLong        awc_def_Stats16_clear_RID(0x0012,0x0024,"Stats_RetryLongCount", "of all long retries. (Does not include first attempt for a packet).")
+#define awc_RID_Stats16_clear_RetryShort       awc_def_Stats16_clear_RID(0x0014,0x0028,"Stats_RetryShort",     "Count of all short retries. (Does not include first attempt for   a packet).")
+#define awc_RID_Stats16_clear_MaxRetries       awc_def_Stats16_clear_RID(0x0016,0x002C,"Stats_MaxRetries",     "Count of number of packets that max-retried -- ie were  never ACKd.")
+#define awc_RID_Stats16_clear_NoAck            awc_def_Stats16_clear_RID(0x0018,0x0030,"Stats_NoAck",          "Count of number of times that ACK was not received.")
+#define awc_RID_Stats16_clear_NoCts            awc_def_Stats16_clear_RID(0x001A,0x0034,"Stats_NoCts",          "Count of number of timer that CTS was not received.")
+#define awc_RID_Stats16_clear_RxAck            awc_def_Stats16_clear_RID(0x001C,0x0038,"Stats_RxAck",          "Count of number of expected ACKs that were received.")
+#define awc_RID_Stats16_clear_RxCts            awc_def_Stats16_clear_RID(0x001E,0x003C,"Stats_RxCts",          "Count of number of expected CTSs that were received.")
+#define awc_RID_Stats16_clear_TxAck            awc_def_Stats16_clear_RID(0x0020,0x0040,"Stats_TxAck",          "Count of number of ACKs transmitted.")
+#define awc_RID_Stats16_clear_TxRts            awc_def_Stats16_clear_RID(0x0022,0x0044,"Stats_TxRts",          "Count of number of RTSs transmitted.")
+#define awc_RID_Stats16_clear_TxCts            awc_def_Stats16_clear_RID(0x0024,0x0048,"Stats_TxCts",          "Count of number of CTSs transmitted.")
+#define awc_RID_Stats16_clear_TxMc             awc_def_Stats16_clear_RID(0x0026,0x004C,"Stats_TxMc",           " LMAC count of multicast packets sent (uses 802.11  Address1).")
+#define awc_RID_Stats16_clear_TxBc             awc_def_Stats16_clear_RID(0x0028,0x0050,"Stats_TxBc",           " LMAC count of broadcast packets sent (uses 802.11")
+#define awc_RID_Stats16_clear_TxUcFrags        awc_def_Stats16_clear_RID(0x002A,0x0054,"Stats_TxUcFragsLMAC",  " count of ALL unicast fragments and whole packets sent (uses 802.11 Address1).")
+#define awc_RID_Stats16_clear_TxUcPackets      awc_def_Stats16_clear_RID(0x002C,0x0058,"Stats_TxUcPackets",    "LMAC count of unicast packets that were ACKd (uses   802.11 Address 1).")
+#define awc_RID_Stats16_clear_TxBeacon                 awc_def_Stats16_clear_RID(0x002E,0x005C,"Stats_TxBeacon",       " Count of beacon packets transmitted.")
+#define awc_RID_Stats16_clear_RxBeacon                 awc_def_Stats16_clear_RID(0x0030,0x0060,"Stats_RxBeacon",       " Count of beacon packets received matching our BSSID.")
+#define awc_RID_Stats16_clear_TxSinColl        awc_def_Stats16_clear_RID(0x0032,0x0064,"Stats_TxSinCollTransmit"," single collisions. **")
+#define awc_RID_Stats16_clear_TxMulColl        awc_def_Stats16_clear_RID(0x0034,0x0068,"Stats_TxMulCollTransmit"," multiple collisions. **")
+#define awc_RID_Stats16_clear_DefersNo                 awc_def_Stats16_clear_RID(0x0036,0x006C,"Stats_DefersNo Transmit"," frames sent with no deferral. **")
+#define awc_RID_Stats16_clear_DefersProt       awc_def_Stats16_clear_RID(0x0038,0x0070,"Stats_DefersProt",     " Transmit frames deferred due to protocol.")
+#define awc_RID_Stats16_clear_DefersEngy       awc_def_Stats16_clear_RID(0x003A,0x0074,"Stats_DefersEngy",     " Transmit frames deferred due to energy detect.")
+#define awc_RID_Stats16_clear_DupFram          awc_def_Stats16_clear_RID(0x003C,0x0078,"Stats_DupFram",        "  Duplicate receive frames and fragments.")
+#define awc_RID_Stats16_clear_RxFragDisc       awc_def_Stats16_clear_RID(0x003E,0x007C,"Stats_RxFragDisc",     " Received partial frames. (each tally could indicate the  discarding of one or more fragments)")
+#define awc_RID_Stats16_clear_TxAged           awc_def_Stats16_clear_RID(0x0040,0x0080,"Stats_TxAged",         "   Transmit packets exceeding maximum transmit lifetime. **")
+#define awc_RID_Stats16_clear_RxAged           awc_def_Stats16_clear_RID(0x0042,0x0084,"Stats_RxAgedReceive",  " packets exceeding maximum receive lifetime. **")
+#define awc_RID_Stats16_clear_LostSync_Max     awc_def_Stats16_clear_RID(0x0044,0x0088,"Stats_LostSync_Max",   " Lost sync with our cell due to maximum retries occuring. Retry")
+#define awc_RID_Stats16_clear_LostSync_Mis     awc_def_Stats16_clear_RID(0x0046,0x008C,"Stats_LostSync_Mis",   "Lost sync with our cell due to missing too many beacons. sedBeacons")
+#define awc_RID_Stats16_clear_LostSync_Arl     awc_def_Stats16_clear_RID(0x0048,0x0090,"Stats_LostSync_Arl",   "Lost sync with our cell due to Average Retry Level being  Exceeded  exceeded.")
+#define awc_RID_Stats16_clear_LostSync_Dea     awc_def_Stats16_clear_RID(0x004A,0x0094,"Stats_LostSync_Dea",   "Lost sync with our cell due to being deauthenticated.,thed")
+#define awc_RID_Stats16_clear_LostSync_Disa    awc_def_Stats16_clear_RID(0x004C,0x0098,"Stats_LostSync_Disa",  " Lost sync with our cell due to being disassociated. ssoced")
+#define awc_RID_Stats16_clear_LostSync_Tsf     awc_def_Stats16_clear_RID(0x004E,0x009C,"Stats_LostSync_Tsf",   "Lost sync with our cell due to excessive change in TSF  Timingtiming.")
+#define awc_RID_Stats16_clear_HostTxMc                 awc_def_Stats16_clear_RID(0x0050,0x00A0,"Stats_HostTxMc",       "Count of multicast packets sent by the host.")
+#define awc_RID_Stats16_clear_HostTxBc                 awc_def_Stats16_clear_RID(0x0052,0x00A4,"Stats_HostTxBc",       "Count of broadcast packets sent by the host.")
+#define awc_RID_Stats16_clear_HostTxUc                 awc_def_Stats16_clear_RID(0x0054,0x00A8,"Stats_HostTxUc",       "Count of unicast packets sent by the host.")
+#define awc_RID_Stats16_clear_HostTxFail       awc_def_Stats16_clear_RID(0x0056,0x00AC,"Stats_HostTxFail",     "  Count of host transmitted packets which failed.")
+#define awc_RID_Stats16_clear_HostRxMc                 awc_def_Stats16_clear_RID(0x0058,0x00B0,"Stats_HostRxMc",       "Count of host received multicast packets.")
+#define awc_RID_Stats16_clear_HostRxBc                 awc_def_Stats16_clear_RID(0x005A,0x00B4,"Stats_HostRxBc",       "Count of host received broadcast packets.")
+#define awc_RID_Stats16_clear_HostRxUc                 awc_def_Stats16_clear_RID(0x005C,0x00B8,"Stats_HostRxUc",       "Count of host received unicast packets.")
+#define awc_RID_Stats16_clear_HostRxDiscar     awc_def_Stats16_clear_RID(0x005E,0x00BC,"Stats_HostRxDiscar",   "Count of host received packets discarded due to:\n  Host not enabling receive.\n  Host failing to dequeue receive packets quickly.\n Packets being discarded due to magic packet mode.")
+#define awc_RID_Stats16_clear_HmacTxMc                 awc_def_Stats16_clear_RID(0x0060,0x00C0,"Stats_HmacTxMc",       "Count of internally generated multicast (DA) packets.")
+#define awc_RID_Stats16_clear_HmacTxBc                 awc_def_Stats16_clear_RID(0x0062,0x00C4,"Stats_HmacTxBc",       "Count of internally generated broadcast (DA) packets.")
+#define awc_RID_Stats16_clear_HmacTxUc                 awc_def_Stats16_clear_RID(0x0064,0x00C8,"Stats_HmacTxUc",       "Count of internally generated unicast (DA) packets.")
+#define awc_RID_Stats16_clear_HmacTxFail       awc_def_Stats16_clear_RID(0x0066,0x00CC,"Stats_HmacTxFail",     "  Count of internally generated transmit packets that failed.")
+#define awc_RID_Stats16_clear_HmacRxMc                 awc_def_Stats16_clear_RID(0x0068,0x00D0,"Stats_HmacRxMc",       "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats16_clear_HmacRxBc                 awc_def_Stats16_clear_RID(0x006A,0x00D4,"Stats_HmacRxBc",       "Count of internally received broadcast (DA) packets.")
+#define awc_RID_Stats16_clear_HmacRxUc                 awc_def_Stats16_clear_RID(0x006C,0x00D8,"Stats_HmacRxUc",       "Count of internally received multicast (DA) packets.")
+#define awc_RID_Stats16_clear_HmacRxDisca      awc_def_Stats16_clear_RID(0x006E,0x00DC,"Stats_HmacRxDisca",    " Count of internally received packets that were discarded  (usually because the destination address is not for the host).")
+#define awc_RID_Stats16_clear_HmacRxAcce       awc_def_Stats16_clear_RID(0x0070,0x00E0,"Stats_HmacRxAcce",     "  Count of internally received packets that were accepted")
+#define awc_RID_Stats16_clear_SsidMismatch     awc_def_Stats16_clear_RID(0x0072,0x00E4,"Stats_SsidMismatch",   " Count of SSID mismatches.")
+#define awc_RID_Stats16_clear_ApMismatch       awc_def_Stats16_clear_RID(0x0074,0x00E8,"Stats_ApMismatch",     "  Count of specified AP mismatches.")
+#define awc_RID_Stats16_clear_RatesMismatc     awc_def_Stats16_clear_RID(0x0076,0x00EC,"Stats_RatesMismatc",   " Count of rate mismatches.")
+#define awc_RID_Stats16_clear_AuthReject       awc_def_Stats16_clear_RID(0x0078,0x00F0,"Stats_AuthReject",     "  Count of authentication rejections.")
+#define awc_RID_Stats16_clear_AuthTimeout      awc_def_Stats16_clear_RID(0x007A,0x00F4,"Stats_AuthTimeout",    " Count of authentication timeouts.")
+#define awc_RID_Stats16_clear_AssocReject      awc_def_Stats16_clear_RID(0x007C,0x00F8,"Stats_AssocReject",    " Count of association rejections.")
+#define awc_RID_Stats16_clear_AssocTimeout     awc_def_Stats16_clear_RID(0x007E,0x00FC,"Stats_AssocTimeout",   " Count of association timeouts.")
+#define awc_RID_Stats16_clear_NewReason        awc_def_Stats16_clear_RID(0x0080,0x0100,"Stats_NewReason",      "Count of reason/status codes of greater than 19.  (Values of 0 = successful are not counted)")
+#define awc_RID_Stats16_clear_AuthFail_1       awc_def_Stats16_clear_RID(0x0082,0x0104,"Stats_AuthFail_1",     "Unspecified reason.")
+#define awc_RID_Stats16_clear_AuthFail_2       awc_def_Stats16_clear_RID(0x0084,0x0108,"Stats_AuthFail_2",     "Previous authentication no longer valid.")
+#define awc_RID_Stats16_clear_AuthFail_3       awc_def_Stats16_clear_RID(0x0086,0x010C,"Stats_AuthFail_3",     "Deauthenticated because sending station is leaving (has left) IBSS or ESS.")
+#define awc_RID_Stats16_clear_AuthFail_4       awc_def_Stats16_clear_RID(0x0088,0x0110,"Stats_AuthFail_4",     "Disassociated due to inactivity")
+#define awc_RID_Stats16_clear_AuthFail_5       awc_def_Stats16_clear_RID(0x008A,0x0114,"Stats_AuthFail_5",     "Disassociated because AP is unable to handle all currently  associated stations.")
+#define awc_RID_Stats16_clear_AuthFail_6       awc_def_Stats16_clear_RID(0x008C,0x0118,"Stats_AuthFail_6",     "Class 2 Frame received from non-Authenticated station.")
+#define awc_RID_Stats16_clear_AuthFail_7       awc_def_Stats16_clear_RID(0x008E,0x011C,"Stats_AuthFail_7",     "Class 3 Frame received from non-Associated station.")
+#define awc_RID_Stats16_clear_AuthFail_8       awc_def_Stats16_clear_RID(0x0090,0x0120,"Stats_AuthFail_8",     "Disassociated because sending station is leaving (has left) " )
+#define awc_RID_Stats16_clear_AuthFail_9       awc_def_Stats16_clear_RID(0x0092,0x0124,"Stats_AuthFail_9",     "Station requesting (Re)Association is not Authenticated")
+#define awc_RID_Stats16_clear_AuthFail_10      awc_def_Stats16_clear_RID(0x0094,0x0128,"Stats_AuthFail_10",    "Cannot support all requested capabilities in the Capability")
+#define awc_RID_Stats16_clear_AuthFail_11      awc_def_Stats16_clear_RID(0x0096,0x012C,"Stats_AuthFail_11",    "Reassociation denied due to inability to confirm")
+#define awc_RID_Stats16_clear_AuthFail_12      awc_def_Stats16_clear_RID(0x0098,0x0130,"Stats_AuthFail_12",    "Association denied due to reason outside the scope of the 802.11")
+#define awc_RID_Stats16_clear_AuthFail_13      awc_def_Stats16_clear_RID(0x009A,0x0134,"Stats_AuthFail_13",    "Responding station does not support the specified Auth Alogorithm")
+#define awc_RID_Stats16_clear_AuthFail_14      awc_def_Stats16_clear_RID(0x009C,0x0138,"Stats_AuthFail_14",    "Received an out of sequence Authentication Frame.")
+#define awc_RID_Stats16_clear_AuthFail_15      awc_def_Stats16_clear_RID(0x009E,0x013C,"Stats_AuthFail_15",    "Authentication rejected due to challenge failure.")
+#define awc_RID_Stats16_clear_AuthFail_16      awc_def_Stats16_clear_RID(0x00A0,0x0140,"Stats_AuthFail_16",    "Authentication rejected due to timeout waiting for next  frame in sequence.")
+#define awc_RID_Stats16_clear_AuthFail_17      awc_def_Stats16_clear_RID(0x00A2,0x0144,"Stats_AuthFail_17",    "Association denied because AP is unable to handle  additional associated stations.")
+#define awc_RID_Stats16_clear_AuthFail_18      awc_def_Stats16_clear_RID(0x00A4,0x0148,"Stats_AuthFail_18",    "Association denied due to requesting station not supportingall basic rates.")
+#define awc_RID_Stats16_clear_AuthFail_19      awc_def_Stats16_clear_RID(0x00A6,0x014C,"Stats_AuthFail_19",    "Reserved")
+#define awc_RID_Stats16_clear_RxMan            awc_def_Stats16_clear_RID(0x00A8,0x0150,"Stats_RxMan",          " Count of management packets received and handled.")
+#define awc_RID_Stats16_clear_TxMan            awc_def_Stats16_clear_RID(0x00AA,0x0154,"Stats_TxMan",          " Count of management packets transmitted.")
+#define awc_RID_Stats16_clear_RxRefresh        awc_def_Stats16_clear_RID(0x00AC,0x0158,"Stats_RxRefresh",      " Count of null data packets received.")
+#define awc_RID_Stats16_clear_TxRefresh        awc_def_Stats16_clear_RID(0x00AE,0x015C,"Stats_TxRefresh",      " Count of null data packets transmitted.")
+#define awc_RID_Stats16_clear_RxPoll           awc_def_Stats16_clear_RID(0x00B0,0x0160,"Stats_RxPoll",         "Count of PS-Poll packets received.")
+#define awc_RID_Stats16_clear_TxPoll           awc_def_Stats16_clear_RID(0x00B2,0x0164,"Stats_TxPoll",         "Count of PS-Poll packets transmitted.")
+#define awc_RID_Stats16_clear_HostRetries      awc_def_Stats16_clear_RID(0x00B4,0x0168,"Stats_HostRetries",    " Count of long and short retries used to transmit host packets  (does not include first attempt).")
+#define awc_RID_Stats16_clear_LostSync_HostReq         awc_def_Stats16_clear_RID(0x00B6,0x016C,"Stats_LostSync_HostReq","Lost sync with our cell due to host request.")
+#define awc_RID_Stats16_clear_HostTxBytes      awc_def_Stats16_clear_RID(0x00B8,0x0170,"Stats_HostTxBytes",    " Count of bytes transferred from the host.")
+#define awc_RID_Stats16_clear_HostRxBytes      awc_def_Stats16_clear_RID(0x00BA,0x0174,"Stats_HostRxBytes",    " Count of bytes transferred to the host.")
+#define awc_RID_Stats16_clear_ElapsedUsec      awc_def_Stats16_clear_RID(0x00BC,0x0178,"Stats_ElapsedUsec",    " Total time since power up (or clear) in microseconds.")
+#define awc_RID_Stats16_clear_ElapsedSec       awc_def_Stats16_clear_RID(0x00BE,0x017C,"Stats_ElapsedSec",     " Total time since power up (or clear) in seconds.")
+#define awc_RID_Stats16_clear_LostSyncBett     awc_def_Stats16_clear_RID(0x00C0,0x0180,"Stats_LostSyncBett",   "Lost Sync to switch to a better access point")
+/*
+const struct aironet4500_rid_selector  aironet4500_RID_Select_General_Config   =(const struct aironet4500_rid_selector){ 0xFF10, 1,0,0, "General Configuration" }; //        See notes General Configuration        Many configuration items.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_SSID_list                =(const struct aironet4500_rid_selector){ 0xFF11, 1,0,0, "Valid SSID list" }; //          See notes Valid SSID list              List of SSIDs which the station may associate to.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_list          =(const struct aironet4500_rid_selector){ 0xFF12, 1,0,0, "Valid AP list" }; //          See notes Valid AP list                List of APs which the station may associate to.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Driver_name      =(const struct aironet4500_rid_selector){ 0xFF13, 1,0,0, "Driver name" }; //          See notes Driver name                  The name and version of the driver (for debugging)
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Encapsulation    =(const struct aironet4500_rid_selector){ 0xFF14, 1,0,0, "Ethernet Protocol" }; //          See notes Ethernet Protocol            Rules for encapsulating ethernet payloads onto 802.11.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_volatile     =(const struct aironet4500_rid_selector){ 0xFF15, 1,0,0, "WEP key volatile" }; //          
+const struct aironet4500_rid_selector  aironet4500_RID_Select_WEP_nonvolatile  =(const struct aironet4500_rid_selector){ 0xFF16, 1,0,0, "WEP key non-volatile" }; //
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Modulation       =(const struct aironet4500_rid_selector){ 0xFF17, 1,0,0, "Modulation" }; //
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Active_Config    =(const struct aironet4500_rid_selector){ 0xFF20, 0,1,1, "Actual Configuration" }; //          Read only      Actual Configuration    This has the same format as the General Configuration.
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Capabilities     =(const struct aironet4500_rid_selector){ 0xFF00, 0,1,0, "Capabilities" }; //          Read Only      Capabilities            PC4500 Information
+const struct aironet4500_rid_selector  aironet4500_RID_Select_AP_Info          =(const struct aironet4500_rid_selector){ 0xFF01, 0,1,1, "AP Info" }; //          Read Only      AP Info                 Access Point Information
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Radio_Info       =(const struct aironet4500_rid_selector){ 0xFF02, 0,1,1, "Radio Info" }; //          Read Only      Radio Info              Radio Information -- note radio specific
+const struct aironet4500_rid_selector  aironet4500_RID_Select_Status           =(const struct aironet4500_rid_selector){ 0xFF50, 0,1,1, "Status" }; //          Read Only      Status                  PC4500 Current Status Information
+const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats         =(const struct aironet4500_rid_selector){ 0xFF60, 0,1,1, "Cumulative 16-bit Statistics" }; //          Read Only      16-bit Statistics       Cumulative 16-bit Statistics
+const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_delta   =(const struct aironet4500_rid_selector){ 0xFF61, 0,1,1, "Delta 16-bit Statistics" }; //          Read Only      16-bit Statistics       Delta 16-bit Statistics (since last clear)
+const struct aironet4500_rid_selector  aironet4500_RID_Select_16_stats_clear   =(const struct aironet4500_rid_selector){ 0xFF62, 0,1,1, "Delta 16-bit Statistics and Clear" }; //          Read Only /    16-bit Statistics       Delta 16-bit Statistics and Clear
+const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats         =(const struct aironet4500_rid_selector){ 0xFF68, 0,1,1, "Cumulative 32-bit Statistics" }; //          Read Only      32-bit Statistics       Cumulative 32-bit Statistics
+const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_delta   =(const struct aironet4500_rid_selector){ 0xFF69, 0,1,1, "Delta 32-bit Statistics"  }; //          Read Only      32-bit Statistics       Delta 32-bit Statistics (since last clear)
+const struct aironet4500_rid_selector  aironet4500_RID_Select_32_stats_clear   =(const struct aironet4500_rid_selector){ 0xFF6A, 0,1,1, "Delta 32-bit Statistics and Clear" }; //          Read Only /    32-bit Statistics       Delta 32-bit Statistics and Clear
+*/
+
+struct aironet4500_RID awc_gen_RID[] ={
+       awc_RID_gen_RidLen,
+       awc_RID_gen_OperatingMode_adhoc,
+       awc_RID_gen_OperatingMode_Infrastructure,
+       awc_RID_gen_OperatingMode_AP,
+       awc_RID_gen_OperatingMode_AP_and_repeater,
+       awc_RID_gen_OperatingMode_No_payload_modify,
+       awc_RID_gen_OperatingMode_LLC_802_3_convert,
+       awc_RID_gen_OperatingMode_proprietary_ext,
+       awc_RID_gen_OperatingMode_no_proprietary_ext,
+       awc_RID_gen_OperatingMode_AP_ext,
+       awc_RID_gen_OperatingMode_no_AP_ext,
+       awc_RID_gen_ReceiveMode,
+       awc_RID_gen_ReceiveMode_BMA,
+       awc_RID_gen_ReceiveMode_BA,
+       awc_RID_gen_ReceiveMode_A,
+       awc_RID_gen_ReceiveMode_802_11_monitor,
+       awc_RID_gen_ReceiveMode_802_11_any_monitor,
+       awc_RID_gen_ReceiveMode_LAN_monitor,
+       awc_RID_gen_ReceiveMode_802_3_hdr_disable,
+       awc_RID_gen_ReceiveMode_802_3_hdr_enable,
+       awc_RID_gen_Fragmentation_threshold,
+       awc_RID_gen_RTS_threshold,
+       awc_RID_gen_Station_Mac_Id,
+       awc_RID_gen_Supported_rates,
+       awc_RID_gen_Basic_Rate,
+       awc_RID_gen_Rate_500kbps,
+       awc_RID_gen_Rate_1Mbps,
+       awc_RID_gen_Rate_2Mbps,
+       awc_RID_gen_Rate_4Mbps,
+       awc_RID_gen_Rate_5Mbps,
+       awc_RID_gen_Rate_10Mbps,
+       awc_RID_gen_Rate_11Mbps,
+       awc_RID_gen_BasicRate_500kbps,
+       awc_RID_gen_BasicRate_1Mbps,
+       awc_RID_gen_BasicRate_2Mbps,
+       awc_RID_gen_BasicRate_4Mbps,
+       awc_RID_gen_BasicRate_5Mbps,
+       awc_RID_gen_BasicRate_10Mbps,
+       awc_RID_gen_BasicRate_11Mbps,
+       awc_RID_gen_Long_retry_limit,
+       awc_RID_gen_Short_retry_limit,
+       awc_RID_gen_Tx_MSDU_lifetime,
+       awc_RID_gen_Rx_MSDU_lifetime,
+       awc_RID_gen_Stationary,
+       awc_RID_gen_BC_MC_Ordering,
+       awc_RID_gen_Device_type,
+       awc_RID_gen_Reserved_0x0026,
+       awc_RID_gen_ScanMode,
+       awc_RID_gen_ScanMode_Active,
+       awc_RID_gen_ScanMode_Passive,
+       awc_RID_gen_ScanMode_Aironet_ext,
+       awc_RID_gen_ProbeDelay,
+       awc_RID_gen_ProbeEnergyTimeout,
+       awc_RID_gen_ProbeResponseTimeout,
+       awc_RID_gen_BeaconListenTimeout,
+       awc_RID_gen_IbssJoinNetTimeout,
+       awc_RID_gen_AuthenticationTimeout,
+       awc_RID_gen_AuthenticationType,
+       awc_RID_gen_AuthenticationType_None,
+       awc_RID_gen_AuthenticationType_Open,
+       awc_RID_gen_AuthenticationType_Shared,
+       awc_RID_gen_AuthenticationType_Exclude_Open,
+       awc_RID_gen_AssociationTimeout,
+       awc_RID_gen_SpecifiedAPtimeout,
+       awc_RID_gen_OfflineScanInterval,
+       awc_RID_gen_OfflineScanDuration,
+       awc_RID_gen_LinkLossDelay,
+       awc_RID_gen_MaxBeaconLostTime,
+       awc_RID_gen_RefreshInterval,
+       awc_RID_gen_PowerSaveMode,
+       awc_RID_gen_PowerSaveMode_CAM,
+       awc_RID_gen_PowerSaveMode_PSP,
+       awc_RID_gen_PowerSaveMode_Fast_PSP,
+       awc_RID_gen_SleepForDTIMs,
+       awc_RID_gen_ListenInterval,
+       awc_RID_gen_FastListenInterval,
+       awc_RID_gen_ListenDecay,
+       awc_RID_gen_FastListenDelay,
+       awc_RID_gen_Reserved0x005C,
+       awc_RID_gen_BeaconPeriod,
+       awc_RID_gen_AtimDuration,
+       awc_RID_gen_Reserved0x0064,
+       awc_RID_gen_DSChannel,
+       awc_RID_gen_Reserved0x0068,
+       awc_RID_gen_DTIM_Period,
+       awc_RID_gen_Reserved0x0006C,
+       awc_RID_gen_RadioSpreadType,
+       awc_RID_gen_RadioSpreadType_FH,
+       awc_RID_gen_RadioSpreadType_DS,
+       awc_RID_gen_RadioSpreadType_LM,
+       awc_RID_gen_TX_antenna_Diversity,
+       awc_RID_gen_TX_antenna_Diversity_default,
+       awc_RID_gen_TX_antenna_Diversity_1,
+       awc_RID_gen_TX_antenna_Diversity_2,
+       awc_RID_gen_TX_antenna_Diversity_both,
+       awc_RID_gen_RX_antenna_Diversity,
+       awc_RID_gen_RX_antenna_Diversity_default,
+       awc_RID_gen_RX_antenna_Diversity_1,
+       awc_RID_gen_RX_antenna_Diversity_2,
+       awc_RID_gen_RX_antenna_Diversity_both,
+       awc_RID_gen_TransmitPower,
+       awc_RID_gen_RSSIthreshold,
+       awc_RID_gen_Modulation,
+       awc_RID_gen_Reserved0x0079,
+       awc_RID_gen_NodeName,
+       awc_RID_gen_ARLThreshold,
+       awc_RID_gen_ARLDecay,
+       awc_RID_gen_ARLDelay,
+       awc_RID_gen_Unused0x0096,
+       awc_RID_gen_MagicPacketAction,
+       awc_RID_gen_MagicPacketControl,
+       {0}
+};
+
+struct aironet4500_RID awc_act_RID[]={
+       awc_RID_act_RidLen,
+       awc_RID_act_OperatingMode_adhoc,
+       awc_RID_act_OperatingMode_Infrastructure,
+       awc_RID_act_OperatingMode_AP,
+       awc_RID_act_OperatingMode_AP_and_repeater,
+       awc_RID_act_OperatingMode_No_payload_modify,
+       awc_RID_act_OperatingMode_LLC_802_3_convert,
+       awc_RID_act_OperatingMode_proprietary_ext,
+       awc_RID_act_OperatingMode_no_proprietary_ext,
+       awc_RID_act_OperatingMode_AP_ext,
+       awc_RID_act_OperatingMode_no_AP_ext,
+       awc_RID_act_ReceiveMode,
+       awc_RID_act_ReceiveMode_BMA,
+       awc_RID_act_ReceiveMode_BA,
+       awc_RID_act_ReceiveMode_A,
+       awc_RID_act_ReceiveMode_802_11_monitor,
+       awc_RID_act_ReceiveMode_802_11_any_monitor,
+       awc_RID_act_ReceiveMode_LAN_monitor,
+       awc_RID_act_ReceiveMode_802_3_hdr_disable,
+       awc_RID_act_ReceiveMode_802_3_hdr_enable,
+       awc_RID_act_Fragmentation_threshold,
+       awc_RID_act_RTS_threshold,
+       awc_RID_act_Station_Mac_Id,
+       awc_RID_act_Supported_rates,
+       awc_RID_act_Basic_Rate,
+       awc_RID_act_Rate_500kbps,
+       awc_RID_act_Rate_1Mbps,
+       awc_RID_act_Rate_2Mbps,
+       awc_RID_act_Rate_4Mbps,
+       awc_RID_act_Rate_5Mbps,
+       awc_RID_act_Rate_10Mbps,
+       awc_RID_act_Rate_11Mbps,
+       awc_RID_act_BasicRate_500kbps,
+       awc_RID_act_BasicRate_1Mbps,
+       awc_RID_act_BasicRate_2Mbps,
+       awc_RID_act_BasicRate_4Mbps,
+       awc_RID_act_BasicRate_5Mbps,
+       awc_RID_act_BasicRate_10Mbps,
+       awc_RID_act_BasicRate_11Mbps,
+       awc_RID_act_Long_retry_limit,
+       awc_RID_act_Short_retry_limit,
+       awc_RID_act_Tx_MSDU_lifetime,
+       awc_RID_act_Rx_MSDU_lifetime,
+       awc_RID_act_Stationary,
+       awc_RID_act_BC_MC_Ordering,
+       awc_RID_act_Device_type,
+       awc_RID_act_Reserved_0x0026,
+       awc_RID_act_ScanMode,
+       awc_RID_act_ScanMode_Active,
+       awc_RID_act_ScanMode_Passive,
+       awc_RID_act_ScanMode_Aironet_ext,
+       awc_RID_act_ProbeDelay,
+       awc_RID_act_ProbeEnergyTimeout,
+       awc_RID_act_ProbeResponseTimeout,
+       awc_RID_act_BeaconListenTimeout,
+       awc_RID_act_IbssJoinNetTimeout,
+       awc_RID_act_AuthenticationTimeout,
+       awc_RID_act_AuthenticationType,
+       awc_RID_act_AuthenticationType_None,
+       awc_RID_act_AuthenticationType_Open,
+       awc_RID_act_AuthenticationType_Shared,
+       awc_RID_act_AuthenticationType_Exclude_Open,
+       awc_RID_act_AssociationTimeout,
+       awc_RID_act_SpecifiedAPtimeout,
+       awc_RID_act_OfflineScanInterval,
+       awc_RID_act_OfflineScanDuration,
+       awc_RID_act_LinkLossDelay,
+       awc_RID_act_MaxBeaconLostTime,
+       awc_RID_act_RefreshInterval,
+       awc_RID_act_PowerSaveMode,
+       awc_RID_act_PowerSaveMode_CAM,
+       awc_RID_act_PowerSaveMode_PSP,
+       awc_RID_act_PowerSaveMode_Fast_PSP,
+       awc_RID_act_SleepForDTIMs,
+       awc_RID_act_ListenInterval,
+       awc_RID_act_FastListenInterval,
+       awc_RID_act_ListenDecay,
+       awc_RID_act_FastListenDelay,
+       awc_RID_act_Reserved0x005C,
+       awc_RID_act_BeaconPeriod,
+       awc_RID_act_AtimDuration,
+       awc_RID_act_Reserved0x0064,
+       awc_RID_act_DSChannel,
+       awc_RID_act_Reserved0x0068,
+       awc_RID_act_DTIM_Period,
+       awc_RID_act_Reserved0x0006C,
+       awc_RID_act_RadioSpreadType,
+       awc_RID_act_RadioSpreadType_FH,
+       awc_RID_act_RadioSpreadType_DS,
+       awc_RID_act_RadioSpreadType_LM,
+       awc_RID_act_TX_antenna_Diversity,
+       awc_RID_act_TX_antenna_Diversity_default,
+       awc_RID_act_TX_antenna_Diversity_1,
+       awc_RID_act_TX_antenna_Diversity_2,
+       awc_RID_act_TX_antenna_Diversity_both,
+       awc_RID_act_RX_antenna_Diversity,
+       awc_RID_act_RX_antenna_Diversity_default,
+       awc_RID_act_RX_antenna_Diversity_1,
+       awc_RID_act_RX_antenna_Diversity_2,
+       awc_RID_act_RX_antenna_Diversity_both,
+       awc_RID_act_TransmitPower,
+       awc_RID_act_RSSIthreshold,
+       awc_RID_act_Modulation,
+       awc_RID_act_Reserved0x0079,
+       awc_RID_act_NodeName,
+       awc_RID_act_ARLThreshold,
+       awc_RID_act_ARLDecay,
+       awc_RID_act_ARLDelay,
+       awc_RID_act_Unused0x0096,
+       awc_RID_act_MagicPacketAction,
+       awc_RID_act_MagicPacketControl,
+       {0}
+};
+
+
+
+struct aironet4500_RID awc_SSID_RID[]={
+       awc_RID_SSID_RidLen,
+       awc_RID_SSID_Accept_any,
+       awc_RID_SSIDlen1,
+       awc_RID_SSID1,
+       awc_RID_SSIDlen2,
+       awc_RID_SSID2,
+       awc_RID_SSIDlen3,
+       awc_RID_SSID3,
+       {0}
+};
+
+
+struct aironet4500_RID awc_AP_List_RID[]={
+       awc_RID_AP_List_RidLen,
+       awc_RID_AP_List_SpecifiedAP1,
+       awc_RID_AP_List_SpecifiedAP2,
+       awc_RID_AP_List_SpecifiedAP3,
+       awc_RID_AP_List_SpecifiedAP4,
+       {0}
+};
+
+
+struct aironet4500_RID awc_Dname_RID[]={
+       awc_RID_Dname_RidLen,
+       awc_RID_Dname_DriverName,
+       {0}
+};
+
+
+
+
+struct aironet4500_RID awc_enc_RID[]={
+       awc_RID_Enc_RidLen,
+       awc_RID_Enc_EtherType1,
+       awc_RID_Enc_Action_RX_1,
+       awc_RID_Enc_Action_RX_1_RFC_1042,
+       awc_RID_Enc_Action_RX_1_802_11,
+       awc_RID_Enc_Action_TX_1,
+       awc_RID_Enc_Action_TX_1_RFC_1042,
+       awc_RID_Enc_Action_TX_1_802_11,
+       awc_RID_Enc_EtherType2,
+       awc_RID_Enc_Action_RX_2,
+       awc_RID_Enc_Action_RX_2_RFC_1042,
+       awc_RID_Enc_Action_RX_2_802_11,
+       awc_RID_Enc_Action_TX_2,
+       awc_RID_Enc_Action_TX_2_RFC_1042,
+       awc_RID_Enc_Action_TX_2_802_11,
+       awc_RID_Enc_EtherType3,
+       awc_RID_Enc_Action_RX_3,
+       awc_RID_Enc_Action_RX_3_RFC_1042,
+       awc_RID_Enc_Action_RX_3_802_11,
+       awc_RID_Enc_Action_TX_3_,
+       awc_RID_Enc_Action_TX_3_RFC_1042,
+       awc_RID_Enc_Action_TX_3_802_11,
+       awc_RID_Enc_EtherType4,
+       awc_RID_Enc_Action_RX_4,
+       awc_RID_Enc_Action_RX_4_RFC_1042,
+       awc_RID_Enc_Action_RX_4_802_11,
+       awc_RID_Enc_Action_TX_4,
+       awc_RID_Enc_Action_TX_4_RFC_1042,
+       awc_RID_Enc_Action_TX_4_802_11,
+       awc_RID_Enc_EtherType5,
+       awc_RID_Enc_Action_RX_5,
+       awc_RID_Enc_Action_RX_5_RFC_1042,
+       awc_RID_Enc_Action_RX_5_802_11,
+       awc_RID_Enc_Action_TX_5,
+       awc_RID_Enc_Action_TX_5_RFC_1042,
+       awc_RID_Enc_Action_TX_5_802_11,
+       awc_RID_Enc_EtherType6,
+       awc_RID_Enc_Action_RX_6,
+       awc_RID_Enc_Action_RX_6_RFC_1042,
+       awc_RID_Enc_Action_RX_6_802_11,
+       awc_RID_Enc_Action_TX_6,
+       awc_RID_Enc_Action_TX_6_RFC_1042,
+       awc_RID_Enc_Action_TX_6_802_11,
+       awc_RID_Enc_EtherType7,
+       awc_RID_Enc_Action_RX_7,
+       awc_RID_Enc_Action_RX_7_RFC_1042,
+       awc_RID_Enc_Action_RX_7_802_11,
+       awc_RID_Enc_Action_TX_7,
+       awc_RID_Enc_Action_TX_7_RFC_1042,
+       awc_RID_Enc_Action_TX_7_802_11,
+       awc_RID_Enc_EtherType8,
+       awc_RID_Enc_Action_RX_8,
+       awc_RID_Enc_Action_RX_8_RFC_1042,
+       awc_RID_Enc_Action_RX_8_802_11,
+       awc_RID_Enc_Action_TX_8,
+       awc_RID_Enc_Action_TX_8_RFC_1042,
+       awc_RID_Enc_Action_TX_8_802_11,
+       {0}
+};
+
+struct aironet4500_RID awc_WEPv_RID[]={
+       awc_RID_WEPv_RidLen,
+       awc_RID_WEPv_KeyIndex,
+       awc_RID_WEPv_Address,
+       awc_RID_WEPv_KeyLen,
+       awc_RID_WEPv_Key,
+       awc_RID_WEPv_KeyAscii,
+       {0}
+};
+
+struct aironet4500_RID awc_WEPnv_RID[]={
+       awc_RID_WEPnv_RidLen,
+       awc_RID_WEPnv_KeyIndex,
+       awc_RID_WEPnv_Address,
+       awc_RID_WEPnv_KeyLen,
+       awc_RID_WEPnv_Key,
+       awc_RID_WEPnv_KeyAscii,
+       {0}
+};
+
+struct aironet4500_RID awc_Modulation_RID[]={
+       awc_RID_Modulation_RidLen,
+       awc_RID_Modulation_Modulation,
+       {0}
+};
+
+
+
+struct aironet4500_RID awc_Cap_RID[]={
+       awc_RID_Cap_RidLen,
+       awc_RID_Cap_OUI,
+       awc_RID_Cap_ProductNum,
+       awc_RID_Cap_ManufacturerName,
+       awc_RID_Cap_ProductName,
+       awc_RID_Cap_ProductVersion,
+       awc_RID_Cap_FactoryAddress,
+       awc_RID_Cap_AironetAddress,
+       awc_RID_Cap_RadioSpreadType_DS,
+       awc_RID_Cap_RadioSpreadType_FH,
+       awc_RID_Cap_RadioSpreadType_Legacy,
+       awc_RID_Cap_RegDomain,
+       awc_RID_Cap_Callid,
+       awc_RID_Cap_SupportedRates,
+       awc_RID_Cap_RxDiversity,
+       awc_RID_Cap_TxDiversity,
+       awc_RID_Cap_TxPowerLevels,
+       awc_RID_Cap_HardwareVersion,
+       awc_RID_Cap_HardwareCapabilit,
+       awc_RID_Cap_TemperatureRange,
+       awc_RID_Cap_SoftwareVersion,
+       awc_RID_Cap_SoftwareVersion_major,
+       awc_RID_Cap_SoftwareVersion_minor,
+       awc_RID_Cap_SoftwareSubVersion,
+       awc_RID_Cap_InterfaceVersion,
+       awc_RID_Cap_SoftwareCapabilities,
+       awc_RID_Cap_BootBlockVersion,
+       {0}
+};
+
+
+struct aironet4500_RID awc_Status_RID[]={
+       awc_RID_Status_RidLen,
+       awc_RID_Status_MacAddress,
+       awc_RID_Status_OperationalMode,
+       awc_RID_Status_Configured,
+       awc_RID_Status_MAC_Enabled,
+       awc_RID_Status_Receive_Enabled,
+       awc_RID_Status_In_Sync,
+       awc_RID_Status_Associated,
+       awc_RID_Status_Error,
+       awc_RID_Status_ErrorCode,
+       awc_RID_Status_CurrentSignalQuality,
+       awc_RID_Status_SSIDlength,
+       awc_RID_Status_SSID,
+       awc_RID_Status_ApName,
+       awc_RID_Status_CurrentBssid,
+       awc_RID_Status_PreviousBssid1,
+       awc_RID_Status_PreviousBssid2,
+       awc_RID_Status_PreviousBssid3,
+       awc_RID_Status_BeaconPeriod,
+       awc_RID_Status_DtimPeriod,
+       awc_RID_Status_AtimDuration,
+       awc_RID_Status_HopPeriod,
+       awc_RID_Status_ChannelSet,
+       awc_RID_Status_Channel,
+       awc_RID_Status_HopsToBackbone,
+       awc_RID_Status_ApTotalLoad,
+       awc_RID_Status_OurGeneratedLoad,
+       awc_RID_Status_AccumulatedArl,
+       {0}
+};
+
+
+struct aironet4500_RID awc_AP_RID[]={
+       awc_RID_AP_16RidLen,
+       awc_RID_AP_TIM_addr,
+       awc_RID_AP_Airo_addr,
+       {0}
+};
+
+
+struct aironet4500_RID awc_Stats_RID[]={
+       awc_RID_Stats_RidLen,
+       awc_RID_Stats_RxOverrunErr,
+       awc_RID_Stats_RxPlcpCrcErr,
+       awc_RID_Stats_RxPlcpFormat,
+       awc_RID_Stats_RxPlcpLength,
+       awc_RID_Stats_RxMacCrcErr,
+       awc_RID_Stats_RxMacCrcOk,
+       awc_RID_Stats_RxWepErr,
+       awc_RID_Stats_RxWepOk,
+       awc_RID_Stats_RetryLong,
+       awc_RID_Stats_RetryShort,
+       awc_RID_Stats_MaxRetries,
+       awc_RID_Stats_NoAck,
+       awc_RID_Stats_NoCts,
+       awc_RID_Stats_RxAck,
+       awc_RID_Stats_RxCts,
+       awc_RID_Stats_TxAck,
+       awc_RID_Stats_TxRts,
+       awc_RID_Stats_TxCts,
+       awc_RID_Stats_TxMc,
+       awc_RID_Stats_TxBc,
+       awc_RID_Stats_TxUcFrags,
+       awc_RID_Stats_TxUcPackets,
+       awc_RID_Stats_TxBeacon,
+       awc_RID_Stats_RxBeacon,
+       awc_RID_Stats_TxSinColl,
+       awc_RID_Stats_TxMulColl,
+       awc_RID_Stats_DefersNo,
+       awc_RID_Stats_DefersProt,
+       awc_RID_Stats_DefersEngy,
+       awc_RID_Stats_DupFram,
+       awc_RID_Stats_RxFragDisc,
+       awc_RID_Stats_TxAged,
+       awc_RID_Stats_RxAged,
+       awc_RID_Stats_LostSync_Max,
+       awc_RID_Stats_LostSync_Mis,
+       awc_RID_Stats_LostSync_Arl,
+       awc_RID_Stats_LostSync_Dea,
+       awc_RID_Stats_LostSync_Disa,
+       awc_RID_Stats_LostSync_Tsf,
+       awc_RID_Stats_HostTxMc,
+       awc_RID_Stats_HostTxBc,
+       awc_RID_Stats_HostTxUc,
+       awc_RID_Stats_HostTxFail,
+       awc_RID_Stats_HostRxMc,
+       awc_RID_Stats_HostRxBc,
+       awc_RID_Stats_HostRxUc,
+       awc_RID_Stats_HostRxDiscar,
+       awc_RID_Stats_HmacTxMc,
+       awc_RID_Stats_HmacTxBc,
+       awc_RID_Stats_HmacTxUc,
+       awc_RID_Stats_HmacTxFail,
+       awc_RID_Stats_HmacRxMc,
+       awc_RID_Stats_HmacRxBc,
+       awc_RID_Stats_HmacRxUc,
+       awc_RID_Stats_HmacRxDisca,
+       awc_RID_Stats_HmacRxAcce,
+       awc_RID_Stats_SsidMismatch,
+       awc_RID_Stats_ApMismatch,
+       awc_RID_Stats_RatesMismatc,
+       awc_RID_Stats_AuthReject,
+       awc_RID_Stats_AuthTimeout,
+       awc_RID_Stats_AssocReject,
+       awc_RID_Stats_AssocTimeout,
+       awc_RID_Stats_NewReason,
+       awc_RID_Stats_AuthFail_1,
+       awc_RID_Stats_AuthFail_2,
+       awc_RID_Stats_AuthFail_3,
+       awc_RID_Stats_AuthFail_4,
+       awc_RID_Stats_AuthFail_5,
+       awc_RID_Stats_AuthFail_6,
+       awc_RID_Stats_AuthFail_7,
+       awc_RID_Stats_AuthFail_8,
+       awc_RID_Stats_AuthFail_9,
+       awc_RID_Stats_AuthFail_10,
+       awc_RID_Stats_AuthFail_11,
+       awc_RID_Stats_AuthFail_12,
+       awc_RID_Stats_AuthFail_13,
+       awc_RID_Stats_AuthFail_14,
+       awc_RID_Stats_AuthFail_15,
+       awc_RID_Stats_AuthFail_16,
+       awc_RID_Stats_AuthFail_17,
+       awc_RID_Stats_AuthFail_18,
+       awc_RID_Stats_AuthFail_19,
+       awc_RID_Stats_RxMan,
+       awc_RID_Stats_TxMan,
+       awc_RID_Stats_RxRefresh,
+       awc_RID_Stats_TxRefresh,
+       awc_RID_Stats_RxPoll,
+       awc_RID_Stats_TxPoll,
+       awc_RID_Stats_HostRetries,
+       awc_RID_Stats_LostSync_HostReq,
+       awc_RID_Stats_HostTxBytes,
+       awc_RID_Stats_HostRxBytes,
+       awc_RID_Stats_ElapsedUsec,
+       awc_RID_Stats_ElapsedSec,
+       awc_RID_Stats_LostSyncBett,
+       {0}
+};
+
+
+
+struct aironet4500_RID awc_Stats_delta_RID[]={
+       awc_RID_Stats_delta_RidLen,
+       awc_RID_Stats_delta_RxOverrunErr,
+       awc_RID_Stats_delta_RxPlcpCrcErr,
+       awc_RID_Stats_delta_RxPlcpFormat,
+       awc_RID_Stats_delta_RxPlcpLength,
+       awc_RID_Stats_delta_RxMacCrcErr,
+       awc_RID_Stats_delta_RxMacCrcOk,
+       awc_RID_Stats_delta_RxWepErr,
+       awc_RID_Stats_delta_RxWepOk,
+       awc_RID_Stats_delta_RetryLong,
+       awc_RID_Stats_delta_RetryShort,
+       awc_RID_Stats_delta_MaxRetries,
+       awc_RID_Stats_delta_NoAck,
+       awc_RID_Stats_delta_NoCts,
+       awc_RID_Stats_delta_RxAck,
+       awc_RID_Stats_delta_RxCts,
+       awc_RID_Stats_delta_TxAck,
+       awc_RID_Stats_delta_TxRts,
+       awc_RID_Stats_delta_TxCts,
+       awc_RID_Stats_delta_TxMc,
+       awc_RID_Stats_delta_TxBc,
+       awc_RID_Stats_delta_TxUcFrags,
+       awc_RID_Stats_delta_TxUcPackets,
+       awc_RID_Stats_delta_TxBeacon,
+       awc_RID_Stats_delta_RxBeacon,
+       awc_RID_Stats_delta_TxSinColl,
+       awc_RID_Stats_delta_TxMulColl,
+       awc_RID_Stats_delta_DefersNo,
+       awc_RID_Stats_delta_DefersProt,
+       awc_RID_Stats_delta_DefersEngy,
+       awc_RID_Stats_delta_DupFram,
+       awc_RID_Stats_delta_RxFragDisc,
+       awc_RID_Stats_delta_TxAged,
+       awc_RID_Stats_delta_RxAged,
+       awc_RID_Stats_delta_LostSync_Max,
+       awc_RID_Stats_delta_LostSync_Mis,
+       awc_RID_Stats_delta_LostSync_Arl,
+       awc_RID_Stats_delta_LostSync_Dea,
+       awc_RID_Stats_delta_LostSync_Disa,
+       awc_RID_Stats_delta_LostSync_Tsf,
+       awc_RID_Stats_delta_HostTxMc,
+       awc_RID_Stats_delta_HostTxBc,
+       awc_RID_Stats_delta_HostTxUc,
+       awc_RID_Stats_delta_HostTxFail,
+       awc_RID_Stats_delta_HostRxMc,
+       awc_RID_Stats_delta_HostRxBc,
+       awc_RID_Stats_delta_HostRxUc,
+       awc_RID_Stats_delta_HostRxDiscar,
+       awc_RID_Stats_delta_HmacTxMc,
+       awc_RID_Stats_delta_HmacTxBc,
+       awc_RID_Stats_delta_HmacTxUc,
+       awc_RID_Stats_delta_HmacTxFail,
+       awc_RID_Stats_delta_HmacRxMc,
+       awc_RID_Stats_delta_HmacRxBc,
+       awc_RID_Stats_delta_HmacRxUc,
+       awc_RID_Stats_delta_HmacRxDisca,
+       awc_RID_Stats_delta_HmacRxAcce,
+       awc_RID_Stats_delta_SsidMismatch,
+       awc_RID_Stats_delta_ApMismatch,
+       awc_RID_Stats_delta_RatesMismatc,
+       awc_RID_Stats_delta_AuthReject,
+       awc_RID_Stats_delta_AuthTimeout,
+       awc_RID_Stats_delta_AssocReject,
+       awc_RID_Stats_delta_AssocTimeout,
+       awc_RID_Stats_delta_NewReason,
+       awc_RID_Stats_delta_AuthFail_1,
+       awc_RID_Stats_delta_AuthFail_2,
+       awc_RID_Stats_delta_AuthFail_3,
+       awc_RID_Stats_delta_AuthFail_4,
+       awc_RID_Stats_delta_AuthFail_5,
+       awc_RID_Stats_delta_AuthFail_6,
+       awc_RID_Stats_delta_AuthFail_7,
+       awc_RID_Stats_delta_AuthFail_8,
+       awc_RID_Stats_delta_AuthFail_9,
+       awc_RID_Stats_delta_AuthFail_10,
+       awc_RID_Stats_delta_AuthFail_11,
+       awc_RID_Stats_delta_AuthFail_12,
+       awc_RID_Stats_delta_AuthFail_13,
+       awc_RID_Stats_delta_AuthFail_14,
+       awc_RID_Stats_delta_AuthFail_15,
+       awc_RID_Stats_delta_AuthFail_16,
+       awc_RID_Stats_delta_AuthFail_17,
+       awc_RID_Stats_delta_AuthFail_18,
+       awc_RID_Stats_delta_AuthFail_19,
+       awc_RID_Stats_delta_RxMan,
+       awc_RID_Stats_delta_TxMan,
+       awc_RID_Stats_delta_RxRefresh,
+       awc_RID_Stats_delta_TxRefresh,
+       awc_RID_Stats_delta_RxPoll,
+       awc_RID_Stats_delta_TxPoll,
+       awc_RID_Stats_delta_HostRetries,
+       awc_RID_Stats_delta_LostSync_HostReq,
+       awc_RID_Stats_delta_HostTxBytes,
+       awc_RID_Stats_delta_HostRxBytes,
+       awc_RID_Stats_delta_ElapsedUsec,
+       awc_RID_Stats_delta_ElapsedSec,
+       awc_RID_Stats_delta_LostSyncBett,
+       {0}
+};
+
+struct aironet4500_RID awc_Stats_clear_RID[]={
+       awc_RID_Stats_clear_RidLen,
+       awc_RID_Stats_clear_RxOverrunErr,
+       awc_RID_Stats_clear_RxPlcpCrcErr,
+       awc_RID_Stats_clear_RxPlcpFormat,
+       awc_RID_Stats_clear_RxPlcpLength,
+       awc_RID_Stats_clear_RxMacCrcErr,
+       awc_RID_Stats_clear_RxMacCrcOk,
+       awc_RID_Stats_clear_RxWepErr,
+       awc_RID_Stats_clear_RxWepOk,
+       awc_RID_Stats_clear_RetryLong,
+       awc_RID_Stats_clear_RetryShort,
+       awc_RID_Stats_clear_MaxRetries,
+       awc_RID_Stats_clear_NoAck,
+       awc_RID_Stats_clear_NoCts,
+       awc_RID_Stats_clear_RxAck,
+       awc_RID_Stats_clear_RxCts,
+       awc_RID_Stats_clear_TxAck,
+       awc_RID_Stats_clear_TxRts,
+       awc_RID_Stats_clear_TxCts,
+       awc_RID_Stats_clear_TxMc,
+       awc_RID_Stats_clear_TxBc,
+       awc_RID_Stats_clear_TxUcFrags,
+       awc_RID_Stats_clear_TxUcPackets,
+       awc_RID_Stats_clear_TxBeacon,
+       awc_RID_Stats_clear_RxBeacon,
+       awc_RID_Stats_clear_TxSinColl,
+       awc_RID_Stats_clear_TxMulColl,
+       awc_RID_Stats_clear_DefersNo,
+       awc_RID_Stats_clear_DefersProt,
+       awc_RID_Stats_clear_DefersEngy,
+       awc_RID_Stats_clear_DupFram,
+       awc_RID_Stats_clear_RxFragDisc,
+       awc_RID_Stats_clear_TxAged,
+       awc_RID_Stats_clear_RxAged,
+       awc_RID_Stats_clear_LostSync_Max,
+       awc_RID_Stats_clear_LostSync_Mis,
+       awc_RID_Stats_clear_LostSync_Arl,
+       awc_RID_Stats_clear_LostSync_Dea,
+       awc_RID_Stats_clear_LostSync_Disa,
+       awc_RID_Stats_clear_LostSync_Tsf,
+       awc_RID_Stats_clear_HostTxMc,
+       awc_RID_Stats_clear_HostTxBc,
+       awc_RID_Stats_clear_HostTxUc,
+       awc_RID_Stats_clear_HostTxFail,
+       awc_RID_Stats_clear_HostRxMc,
+       awc_RID_Stats_clear_HostRxBc,
+       awc_RID_Stats_clear_HostRxUc,
+       awc_RID_Stats_clear_HostRxDiscar,
+       awc_RID_Stats_clear_HmacTxMc,
+       awc_RID_Stats_clear_HmacTxBc,
+       awc_RID_Stats_clear_HmacTxUc,
+       awc_RID_Stats_clear_HmacTxFail,
+       awc_RID_Stats_clear_HmacRxMc,
+       awc_RID_Stats_clear_HmacRxBc,
+       awc_RID_Stats_clear_HmacRxUc,
+       awc_RID_Stats_clear_HmacRxDisca,
+       awc_RID_Stats_clear_HmacRxAcce,
+       awc_RID_Stats_clear_SsidMismatch,
+       awc_RID_Stats_clear_ApMismatch,
+       awc_RID_Stats_clear_RatesMismatc,
+       awc_RID_Stats_clear_AuthReject,
+       awc_RID_Stats_clear_AuthTimeout,
+       awc_RID_Stats_clear_AssocReject,
+       awc_RID_Stats_clear_AssocTimeout,
+       awc_RID_Stats_clear_NewReason,
+       awc_RID_Stats_clear_AuthFail_1,
+       awc_RID_Stats_clear_AuthFail_2,
+       awc_RID_Stats_clear_AuthFail_3,
+       awc_RID_Stats_clear_AuthFail_4,
+       awc_RID_Stats_clear_AuthFail_5,
+       awc_RID_Stats_clear_AuthFail_6,
+       awc_RID_Stats_clear_AuthFail_7,
+       awc_RID_Stats_clear_AuthFail_8,
+       awc_RID_Stats_clear_AuthFail_9,
+       awc_RID_Stats_clear_AuthFail_10,
+       awc_RID_Stats_clear_AuthFail_11,
+       awc_RID_Stats_clear_AuthFail_12,
+       awc_RID_Stats_clear_AuthFail_13,
+       awc_RID_Stats_clear_AuthFail_14,
+       awc_RID_Stats_clear_AuthFail_15,
+       awc_RID_Stats_clear_AuthFail_16,
+       awc_RID_Stats_clear_AuthFail_17,
+       awc_RID_Stats_clear_AuthFail_18,
+       awc_RID_Stats_clear_AuthFail_19,
+       awc_RID_Stats_clear_RxMan,
+       awc_RID_Stats_clear_TxMan,
+       awc_RID_Stats_clear_RxRefresh,
+       awc_RID_Stats_clear_TxRefresh,
+       awc_RID_Stats_clear_RxPoll,
+       awc_RID_Stats_clear_TxPoll,
+       awc_RID_Stats_clear_HostRetries,
+       awc_RID_Stats_clear_LostSync_HostReq,
+       awc_RID_Stats_clear_HostTxBytes,
+       awc_RID_Stats_clear_HostRxBytes,
+       awc_RID_Stats_clear_ElapsedUsec,
+       awc_RID_Stats_clear_ElapsedSec,
+       awc_RID_Stats_clear_LostSyncBett,
+       {0}
+};
+#ifdef AWC_USE_16BIT_STATS
+struct aironet4500_RID awc_Stats16_RID[]={
+       awc_RID_Stats16_RidLen,
+       awc_RID_Stats16_RxOverrunErr,
+       awc_RID_Stats16_RxPlcpCrcErr,
+       awc_RID_Stats16_RxPlcpFormat,
+       awc_RID_Stats16_RxPlcpLength,
+       awc_RID_Stats16_RxMacCrcErr,
+       awc_RID_Stats16_RxMacCrcOk,
+       awc_RID_Stats16_RxWepErr,
+       awc_RID_Stats16_RxWepOk,
+       awc_RID_Stats16_RetryLong,
+       awc_RID_Stats16_RetryShort,
+       awc_RID_Stats16_MaxRetries,
+       awc_RID_Stats16_NoAck,
+       awc_RID_Stats16_NoCts,
+       awc_RID_Stats16_RxAck,
+       awc_RID_Stats16_RxCts,
+       awc_RID_Stats16_TxAck,
+       awc_RID_Stats16_TxRts,
+       awc_RID_Stats16_TxCts,
+       awc_RID_Stats16_TxMc,
+       awc_RID_Stats16_TxBc,
+       awc_RID_Stats16_TxUcFrags,
+       awc_RID_Stats16_TxUcPackets,
+       awc_RID_Stats16_TxBeacon,
+       awc_RID_Stats16_RxBeacon,
+       awc_RID_Stats16_TxSinColl,
+       awc_RID_Stats16_TxMulColl,
+       awc_RID_Stats16_DefersNo,
+       awc_RID_Stats16_DefersProt,
+       awc_RID_Stats16_DefersEngy,
+       awc_RID_Stats16_DupFram,
+       awc_RID_Stats16_RxFragDisc,
+       awc_RID_Stats16_TxAged,
+       awc_RID_Stats16_RxAged,
+       awc_RID_Stats16_LostSync_Max,
+       awc_RID_Stats16_LostSync_Mis,
+       awc_RID_Stats16_LostSync_Arl,
+       awc_RID_Stats16_LostSync_Dea,
+       awc_RID_Stats16_LostSync_Disa,
+       awc_RID_Stats16_LostSync_Tsf,
+       awc_RID_Stats16_HostTxMc,
+       awc_RID_Stats16_HostTxBc,
+       awc_RID_Stats16_HostTxUc,
+       awc_RID_Stats16_HostTxFail,
+       awc_RID_Stats16_HostRxMc,
+       awc_RID_Stats16_HostRxBc,
+       awc_RID_Stats16_HostRxUc,
+       awc_RID_Stats16_HostRxDiscar,
+       awc_RID_Stats16_HmacTxMc,
+       awc_RID_Stats16_HmacTxBc,
+       awc_RID_Stats16_HmacTxUc,
+       awc_RID_Stats16_HmacTxFail,
+       awc_RID_Stats16_HmacRxMc,
+       awc_RID_Stats16_HmacRxBc,
+       awc_RID_Stats16_HmacRxUc,
+       awc_RID_Stats16_HmacRxDisca,
+       awc_RID_Stats16_HmacRxAcce,
+       awc_RID_Stats16_SsidMismatch,
+       awc_RID_Stats16_ApMismatch,
+       awc_RID_Stats16_RatesMismatc,
+       awc_RID_Stats16_AuthReject,
+       awc_RID_Stats16_AuthTimeout,
+       awc_RID_Stats16_AssocReject,
+       awc_RID_Stats16_AssocTimeout,
+       awc_RID_Stats16_NewReason,
+       awc_RID_Stats16_AuthFail_1,
+       awc_RID_Stats16_AuthFail_2,
+       awc_RID_Stats16_AuthFail_3,
+       awc_RID_Stats16_AuthFail_4,
+       awc_RID_Stats16_AuthFail_5,
+       awc_RID_Stats16_AuthFail_6,
+       awc_RID_Stats16_AuthFail_7,
+       awc_RID_Stats16_AuthFail_8,
+       awc_RID_Stats16_AuthFail_9,
+       awc_RID_Stats16_AuthFail_10,
+       awc_RID_Stats16_AuthFail_11,
+       awc_RID_Stats16_AuthFail_12,
+       awc_RID_Stats16_AuthFail_13,
+       awc_RID_Stats16_AuthFail_14,
+       awc_RID_Stats16_AuthFail_15,
+       awc_RID_Stats16_AuthFail_16,
+       awc_RID_Stats16_AuthFail_17,
+       awc_RID_Stats16_AuthFail_18,
+       awc_RID_Stats16_AuthFail_19,
+       awc_RID_Stats16_RxMan,
+       awc_RID_Stats16_TxMan,
+       awc_RID_Stats16_RxRefresh,
+       awc_RID_Stats16_TxRefresh,
+       awc_RID_Stats16_RxPoll,
+       awc_RID_Stats16_TxPoll,
+       awc_RID_Stats16_HostRetries,
+       awc_RID_Stats16_LostSync_HostReq,
+       awc_RID_Stats16_HostTxBytes,
+       awc_RID_Stats16_HostRxBytes,
+       awc_RID_Stats16_ElapsedUsec,
+       awc_RID_Stats16_ElapsedSec,
+       awc_RID_Stats16_LostSyncBett,
+       {0}
+};
+
+struct aironet4500_RID awc_Stats16_delta_RID[]={
+       awc_RID_Stats16_delta_RidLen,
+       awc_RID_Stats16_delta_RxOverrunErr,
+       awc_RID_Stats16_delta_RxPlcpCrcErr,
+       awc_RID_Stats16_delta_RxPlcpFormat,
+       awc_RID_Stats16_delta_RxPlcpLength,
+       awc_RID_Stats16_delta_RxMacCrcErr,
+       awc_RID_Stats16_delta_RxMacCrcOk,
+       awc_RID_Stats16_delta_RxWepErr,
+       awc_RID_Stats16_delta_RxWepOk,
+       awc_RID_Stats16_delta_RetryLong,
+       awc_RID_Stats16_delta_RetryShort,
+       awc_RID_Stats16_delta_MaxRetries,
+       awc_RID_Stats16_delta_NoAck,
+       awc_RID_Stats16_delta_NoCts,
+       awc_RID_Stats16_delta_RxAck,
+       awc_RID_Stats16_delta_RxCts,
+       awc_RID_Stats16_delta_TxAck,
+       awc_RID_Stats16_delta_TxRts,
+       awc_RID_Stats16_delta_TxCts,
+       awc_RID_Stats16_delta_TxMc,
+       awc_RID_Stats16_delta_TxBc,
+       awc_RID_Stats16_delta_TxUcFrags,
+       awc_RID_Stats16_delta_TxUcPackets,
+       awc_RID_Stats16_delta_TxBeacon,
+       awc_RID_Stats16_delta_RxBeacon,
+       awc_RID_Stats16_delta_TxSinColl,
+       awc_RID_Stats16_delta_TxMulColl,
+       awc_RID_Stats16_delta_DefersNo,
+       awc_RID_Stats16_delta_DefersProt,
+       awc_RID_Stats16_delta_DefersEngy,
+       awc_RID_Stats16_delta_DupFram,
+       awc_RID_Stats16_delta_RxFragDisc,
+       awc_RID_Stats16_delta_TxAged,
+       awc_RID_Stats16_delta_RxAged,
+       awc_RID_Stats16_delta_LostSync_Max,
+       awc_RID_Stats16_delta_LostSync_Mis,
+       awc_RID_Stats16_delta_LostSync_Arl,
+       awc_RID_Stats16_delta_LostSync_Dea,
+       awc_RID_Stats16_delta_LostSync_Disa,
+       awc_RID_Stats16_delta_LostSync_Tsf,
+       awc_RID_Stats16_delta_HostTxMc,
+       awc_RID_Stats16_delta_HostTxBc,
+       awc_RID_Stats16_delta_HostTxUc,
+       awc_RID_Stats16_delta_HostTxFail,
+       awc_RID_Stats16_delta_HostRxMc,
+       awc_RID_Stats16_delta_HostRxBc,
+       awc_RID_Stats16_delta_HostRxUc,
+       awc_RID_Stats16_delta_HostRxDiscar,
+       awc_RID_Stats16_delta_HmacTxMc,
+       awc_RID_Stats16_delta_HmacTxBc,
+       awc_RID_Stats16_delta_HmacTxUc,
+       awc_RID_Stats16_delta_HmacTxFail,
+       awc_RID_Stats16_delta_HmacRxMc,
+       awc_RID_Stats16_delta_HmacRxBc,
+       awc_RID_Stats16_delta_HmacRxUc,
+       awc_RID_Stats16_delta_HmacRxDisca,
+       awc_RID_Stats16_delta_HmacRxAcce,
+       awc_RID_Stats16_delta_SsidMismatch,
+       awc_RID_Stats16_delta_ApMismatch,
+       awc_RID_Stats16_delta_RatesMismatc,
+       awc_RID_Stats16_delta_AuthReject,
+       awc_RID_Stats16_delta_AuthTimeout,
+       awc_RID_Stats16_delta_AssocReject,
+       awc_RID_Stats16_delta_AssocTimeout,
+       awc_RID_Stats16_delta_NewReason,
+       awc_RID_Stats16_delta_AuthFail_1,
+       awc_RID_Stats16_delta_AuthFail_2,
+       awc_RID_Stats16_delta_AuthFail_3,
+       awc_RID_Stats16_delta_AuthFail_4,
+       awc_RID_Stats16_delta_AuthFail_5,
+       awc_RID_Stats16_delta_AuthFail_6,
+       awc_RID_Stats16_delta_AuthFail_7,
+       awc_RID_Stats16_delta_AuthFail_8,
+       awc_RID_Stats16_delta_AuthFail_9,
+       awc_RID_Stats16_delta_AuthFail_10,
+       awc_RID_Stats16_delta_AuthFail_11,
+       awc_RID_Stats16_delta_AuthFail_12,
+       awc_RID_Stats16_delta_AuthFail_13,
+       awc_RID_Stats16_delta_AuthFail_14,
+       awc_RID_Stats16_delta_AuthFail_15,
+       awc_RID_Stats16_delta_AuthFail_16,
+       awc_RID_Stats16_delta_AuthFail_17,
+       awc_RID_Stats16_delta_AuthFail_18,
+       awc_RID_Stats16_delta_AuthFail_19,
+       awc_RID_Stats16_delta_RxMan,
+       awc_RID_Stats16_delta_TxMan,
+       awc_RID_Stats16_delta_RxRefresh,
+       awc_RID_Stats16_delta_TxRefresh,
+       awc_RID_Stats16_delta_RxPoll,
+       awc_RID_Stats16_delta_TxPoll,
+       awc_RID_Stats16_delta_HostRetries,
+       awc_RID_Stats16_delta_LostSync_HostReq,
+       awc_RID_Stats16_delta_HostTxBytes,
+       awc_RID_Stats16_delta_HostRxBytes,
+       awc_RID_Stats16_delta_ElapsedUsec,
+       awc_RID_Stats16_delta_ElapsedSec,
+       awc_RID_Stats16_delta_LostSyncBett,
+       {0}
+};
+
+struct aironet4500_RID awc_Stats16_clear_RID[]={
+       awc_RID_Stats16_clear_RidLen,
+       awc_RID_Stats16_clear_RxOverrunErr,
+       awc_RID_Stats16_clear_RxPlcpCrcErr,
+       awc_RID_Stats16_clear_RxPlcpFormat,
+       awc_RID_Stats16_clear_RxPlcpLength,
+       awc_RID_Stats16_clear_RxMacCrcErr,
+       awc_RID_Stats16_clear_RxMacCrcOk,
+       awc_RID_Stats16_clear_RxWepErr,
+       awc_RID_Stats16_clear_RxWepOk,
+       awc_RID_Stats16_clear_RetryLong,
+       awc_RID_Stats16_clear_RetryShort,
+       awc_RID_Stats16_clear_MaxRetries,
+       awc_RID_Stats16_clear_NoAck,
+       awc_RID_Stats16_clear_NoCts,
+       awc_RID_Stats16_clear_RxAck,
+       awc_RID_Stats16_clear_RxCts,
+       awc_RID_Stats16_clear_TxAck,
+       awc_RID_Stats16_clear_TxRts,
+       awc_RID_Stats16_clear_TxCts,
+       awc_RID_Stats16_clear_TxMc,
+       awc_RID_Stats16_clear_TxBc,
+       awc_RID_Stats16_clear_TxUcFrags,
+       awc_RID_Stats16_clear_TxUcPackets,
+       awc_RID_Stats16_clear_TxBeacon,
+       awc_RID_Stats16_clear_RxBeacon,
+       awc_RID_Stats16_clear_TxSinColl,
+       awc_RID_Stats16_clear_TxMulColl,
+       awc_RID_Stats16_clear_DefersNo,
+       awc_RID_Stats16_clear_DefersProt,
+       awc_RID_Stats16_clear_DefersEngy,
+       awc_RID_Stats16_clear_DupFram,
+       awc_RID_Stats16_clear_RxFragDisc,
+       awc_RID_Stats16_clear_TxAged,
+       awc_RID_Stats16_clear_RxAged,
+       awc_RID_Stats16_clear_LostSync_Max,
+       awc_RID_Stats16_clear_LostSync_Mis,
+       awc_RID_Stats16_clear_LostSync_Arl,
+       awc_RID_Stats16_clear_LostSync_Dea,
+       awc_RID_Stats16_clear_LostSync_Disa,
+       awc_RID_Stats16_clear_LostSync_Tsf,
+       awc_RID_Stats16_clear_HostTxMc,
+       awc_RID_Stats16_clear_HostTxBc,
+       awc_RID_Stats16_clear_HostTxUc,
+       awc_RID_Stats16_clear_HostTxFail,
+       awc_RID_Stats16_clear_HostRxMc,
+       awc_RID_Stats16_clear_HostRxBc,
+       awc_RID_Stats16_clear_HostRxUc,
+       awc_RID_Stats16_clear_HostRxDiscar,
+       awc_RID_Stats16_clear_HmacTxMc,
+       awc_RID_Stats16_clear_HmacTxBc,
+       awc_RID_Stats16_clear_HmacTxUc,
+       awc_RID_Stats16_clear_HmacTxFail,
+       awc_RID_Stats16_clear_HmacRxMc,
+       awc_RID_Stats16_clear_HmacRxBc,
+       awc_RID_Stats16_clear_HmacRxUc,
+       awc_RID_Stats16_clear_HmacRxDisca,
+       awc_RID_Stats16_clear_HmacRxAcce,
+       awc_RID_Stats16_clear_SsidMismatch,
+       awc_RID_Stats16_clear_ApMismatch,
+       awc_RID_Stats16_clear_RatesMismatc,
+       awc_RID_Stats16_clear_AuthReject,
+       awc_RID_Stats16_clear_AuthTimeout,
+       awc_RID_Stats16_clear_AssocReject,
+       awc_RID_Stats16_clear_AssocTimeout,
+       awc_RID_Stats16_clear_NewReason,
+       awc_RID_Stats16_clear_AuthFail_1,
+       awc_RID_Stats16_clear_AuthFail_2,
+       awc_RID_Stats16_clear_AuthFail_3,
+       awc_RID_Stats16_clear_AuthFail_4,
+       awc_RID_Stats16_clear_AuthFail_5,
+       awc_RID_Stats16_clear_AuthFail_6,
+       awc_RID_Stats16_clear_AuthFail_7,
+       awc_RID_Stats16_clear_AuthFail_8,
+       awc_RID_Stats16_clear_AuthFail_9,
+       awc_RID_Stats16_clear_AuthFail_10,
+       awc_RID_Stats16_clear_AuthFail_11,
+       awc_RID_Stats16_clear_AuthFail_12,
+       awc_RID_Stats16_clear_AuthFail_13,
+       awc_RID_Stats16_clear_AuthFail_14,
+       awc_RID_Stats16_clear_AuthFail_15,
+       awc_RID_Stats16_clear_AuthFail_16,
+       awc_RID_Stats16_clear_AuthFail_17,
+       awc_RID_Stats16_clear_AuthFail_18,
+       awc_RID_Stats16_clear_AuthFail_19,
+       awc_RID_Stats16_clear_RxMan,
+       awc_RID_Stats16_clear_TxMan,
+       awc_RID_Stats16_clear_RxRefresh,
+       awc_RID_Stats16_clear_TxRefresh,
+       awc_RID_Stats16_clear_RxPoll,
+       awc_RID_Stats16_clear_TxPoll,
+       awc_RID_Stats16_clear_HostRetries,
+       awc_RID_Stats16_clear_LostSync_HostReq,
+       awc_RID_Stats16_clear_HostTxBytes,
+       awc_RID_Stats16_clear_HostRxBytes,
+       awc_RID_Stats16_clear_ElapsedUsec,
+       awc_RID_Stats16_clear_ElapsedSec,
+       awc_RID_Stats16_clear_LostSyncBett,
+       {0}
+};
+
+#endif
+
+struct awc_rid_dir awc_rids[]={
+       // following MUST be consistent with awc_rids_setup !!!
+   {&aironet4500_RID_Select_General_Config,sizeof(awc_gen_RID) / sizeof(struct aironet4500_RID)  ,awc_gen_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_SSID_list, sizeof(awc_SSID_RID) / sizeof(struct aironet4500_RID) , awc_SSID_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_AP_list, sizeof(awc_AP_List_RID) / sizeof(struct aironet4500_RID) , awc_AP_List_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_Driver_name, sizeof(awc_Dname_RID) / sizeof(struct aironet4500_RID) , awc_Dname_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_Encapsulation, sizeof(awc_enc_RID) / sizeof(struct aironet4500_RID) , awc_enc_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_Active_Config, sizeof(awc_act_RID) / sizeof(struct aironet4500_RID) , awc_act_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_Capabilities, sizeof(awc_Cap_RID) / sizeof(struct aironet4500_RID) , awc_Cap_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_Status, sizeof(awc_Status_RID) / sizeof(struct aironet4500_RID) , awc_Status_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_AP_Info, sizeof(awc_AP_RID) / sizeof(struct aironet4500_RID) , awc_AP_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_32_stats, sizeof(awc_Stats_RID) / sizeof(struct aironet4500_RID) , awc_Stats_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_32_stats_delta, sizeof(awc_Stats_delta_RID) / sizeof(struct aironet4500_RID) , awc_Stats_delta_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_32_stats_clear, sizeof(awc_Stats_clear_RID) / sizeof(struct aironet4500_RID) , awc_Stats_clear_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_WEP_volatile, sizeof(awc_WEPv_RID) / sizeof(struct aironet4500_RID) , awc_WEPv_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_WEP_nonvolatile, sizeof(awc_WEPnv_RID) / sizeof(struct aironet4500_RID) , awc_WEPnv_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_Modulation, sizeof(awc_Modulation_RID) / sizeof(struct aironet4500_RID) , awc_Modulation_RID , NULL, NULL,0 },
+
+#ifdef AWC_USE_16BIT_STATS
+   {&aironet4500_RID_Select_16_stats, sizeof(awc_Stats16_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_16_stats_delta, sizeof(awc_Stats16_delta_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_delta_RID , NULL, NULL,0 },
+   {&aironet4500_RID_Select_16_stats_clear, sizeof(awc_Stats16_clear_RID) / sizeof(struct aironet4500_RID) , awc_Stats16_clear_RID , NULL, NULL,0 },
+#else 
+   {NULL},{NULL},{NULL},
+#endif 
+   {0} 
+
+
+};
+
+
+int awc_nof_rids = (sizeof(awc_rids) / sizeof(struct awc_rid_dir)) -1;
+
+
+int awc_rids_setup(struct NET_DEVICE * dev){
+
+       struct awc_private * priv = (struct awc_private *) dev->priv;
+       int i=0;
+       while ( i < AWC_NOF_RIDS){
+               if (awc_rids[i].selector)
+                       memcpy(&priv->rid_dir[i],&awc_rids[i],sizeof(priv->rid_dir[0]) );
+               else priv->rid_dir[i].selector = NULL;
+               i++;
+       }
+       for (i=0; i< AWC_NOF_RIDS && i < awc_nof_rids; i++){
+               priv->rid_dir[i].dev = dev;
+       };
+       
+       // following MUST be consistent with awc_rids !!!
+       priv->rid_dir[0].buff = &priv->config; // card RID mirrors
+       priv->rid_dir[1].buff = &priv->SSIDs;
+       priv->rid_dir[2].buff = &priv->fixed_APs;
+       priv->rid_dir[3].buff = &priv->driver_name;
+       priv->rid_dir[4].buff = &priv->enc_trans;
+       priv->rid_dir[5].buff = &priv->general_config; //       
+       priv->rid_dir[6].buff = &priv->capabilities;
+       priv->rid_dir[7].buff = &priv->status;
+       priv->rid_dir[8].buff = &priv->AP;
+       priv->rid_dir[9].buff = &priv->statistics;
+       priv->rid_dir[10].buff = &priv->statistics_delta;
+       priv->rid_dir[11].buff = &priv->statistics_delta_clear;
+       priv->rid_dir[12].buff = &priv->wep_volatile;
+       priv->rid_dir[13].buff = &priv->wep_nonvolatile;
+       priv->rid_dir[14].buff = &priv->modulation;
+
+       priv->rid_dir[15].buff = &priv->statistics16;
+       priv->rid_dir[16].buff = &priv->statistics16_delta;
+       priv->rid_dir[17].buff = &priv->statistics16_delta_clear;
+                               
+       priv->rid_dir[0].bufflen = sizeof(priv->config); // card RID mirrors
+       priv->rid_dir[1].bufflen = sizeof(priv->SSIDs);
+       priv->rid_dir[2].bufflen = sizeof(priv->fixed_APs);
+       priv->rid_dir[3].bufflen = sizeof(priv->driver_name);
+       priv->rid_dir[4].bufflen = sizeof(priv->enc_trans);
+       priv->rid_dir[5].bufflen = sizeof(priv->general_config); //
+       priv->rid_dir[6].bufflen = sizeof(priv->capabilities);
+       priv->rid_dir[7].bufflen = sizeof(priv->status);
+       priv->rid_dir[8].bufflen = sizeof(priv->AP);
+       priv->rid_dir[9].bufflen = sizeof(priv->statistics);
+       priv->rid_dir[10].bufflen = sizeof(priv->statistics_delta);
+       priv->rid_dir[11].bufflen = sizeof(priv->statistics_delta_clear);
+       priv->rid_dir[12].bufflen = sizeof(priv->wep_volatile);
+       priv->rid_dir[13].bufflen = sizeof(priv->wep_nonvolatile);
+       priv->rid_dir[14].bufflen = sizeof(priv->modulation);
+
+       priv->rid_dir[15].bufflen = sizeof(priv->statistics16);
+       priv->rid_dir[16].bufflen = sizeof(priv->statistics16_delta);
+       priv->rid_dir[17].bufflen = sizeof(priv->statistics16_delta_clear);
+
+       return 0;
+
+};
+
+
+
+
+
index 5cb25eb8853fb163753e19cc9e28e38501747f83..2ccfd28b89d9cc2eae0ffd08203c81d8e168e4cf 100644 (file)
@@ -14,6 +14,7 @@ if [ "$CONFIG_NET_PCMCIA" = "y" ]; then
    dep_tristate '  New Media PCMCIA support' CONFIG_PCMCIA_NMCLAN $CONFIG_PCMCIA
    dep_tristate '  SMC 91Cxx PCMCIA support' CONFIG_PCMCIA_SMC91C92 $CONFIG_PCMCIA
    dep_tristate '  Xircom 16-bit PCMCIA support' CONFIG_PCMCIA_XIRC2PS $CONFIG_PCMCIA
+   dep_tristate '  Aironet 4500/4800 PCMCIA support ' CONFIG_AIRONET4500_CS $CONFIG_AIRONET4500 $CONFIG_PCMCIA
 
    if [ "$CONFIG_CARDBUS" = "y" ]; then
       dep_tristate '  3Com 3c575 CardBus support' CONFIG_PCMCIA_3C575 m
index 91c284adaac8612a856b87940d1566fcf7976f81..8359bc1cbf74fb80e7a371b6557302166f4e8478 100644 (file)
@@ -35,6 +35,7 @@ obj-$(CONFIG_PCMCIA_XIRC2PS)  += xirc2ps_cs.o
 obj-$(CONFIG_PCMCIA_RAYCS)     += ray_cs.o
 obj-$(CONFIG_PCMCIA_NETWAVE)   += netwave_cs.o
 obj-$(CONFIG_PCMCIA_WAVELAN)   += wavelan_cs.o
+obj-$(CONFIG_AIRONET4500_CS)   += aironet4500_cs.o
 
 # Cardbus client drivers
 obj-$(CONFIG_PCMCIA_3C575)     += 3c575_cb.o
diff --git a/drivers/net/pcmcia/aironet4500_cs.c b/drivers/net/pcmcia/aironet4500_cs.c
new file mode 100644 (file)
index 0000000..f97f41b
--- /dev/null
@@ -0,0 +1,642 @@
+/*
+ *      Aironet 4500 Pcmcia driver
+ *
+ *             Elmer Joandi, Januar 1999
+ *     Copyright Elmer Joandi, all rights restricted
+ *     
+ *
+ *     Revision 0.1 ,started  30.12.1998
+ *
+ *
+ */
+
+static const char *awc_version =
+"aironet4500_cs.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+
+
+#include <linux/config.h>
+#include <linux/module.h>
+//#include <pcmcia/config.h>
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/ptrace.h>
+#include <linux/malloc.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/in.h>
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/bitops.h>
+#include <linux/timer.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/if_arp.h>
+#include <linux/ioport.h>
+
+
+#include <pcmcia/version.h>
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/cisreg.h>
+#include <pcmcia/ciscode.h>
+#if LINUX_VERSION_CODE < 0x20300
+#ifdef MODULE
+#include <pcmcia/k_compat.h>
+#endif
+#endif
+#include <pcmcia/ds.h>
+
+#include "../aironet4500.h"
+
+
+static u_int irq_mask = 0x5eF8;
+static int     awc_ports[] = {0x140,0x100,0xc0, 0x80 };
+#if LINUX_VERSION_CODE > 0x20100
+MODULE_PARM(irq_mask, "i");
+
+#endif
+
+
+#define RUN_AT(x)               (jiffies+(x))
+
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+#define PC_DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"aironet4500_cs.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+#else
+#define PC_DEBUG(n, args...)
+#endif
+
+/* Index of functions. */
+
+static dev_info_t dev_info = "aironet4500_cs";
+
+static dev_link_t *awc_attach(void);
+static void awc_detach(dev_link_t *);
+static void awc_release(u_long arg);
+static int awc_event(event_t event, int priority,
+                                          event_callback_args_t *args);
+
+static dev_link_t *dev_list = NULL;
+
+static void cs_error(client_handle_t handle, int func, int ret)
+{
+#if CS_RELEASE_CODE < 0x2911
+    CardServices(ReportError, dev_info, (void *)func, (void *)ret);
+#else
+       error_info_t err = { func, ret };
+       CardServices(ReportError, handle, &err);
+#endif
+}
+
+#define CFG_CHECK(fn, args...) if (CardServices(fn, args) != 0) goto next_entry
+
+static void flush_stale_links(void)
+{
+    dev_link_t *link, *next;
+    for (link = dev_list; link; link = next) {
+       next = link->next;
+       if (link->state & DEV_STALE_LINK)
+           awc_detach(link);
+    }
+}
+
+
+/*
+   We never need to do anything when a awc device is "initialized"
+   by the net software, because we only register already-found cards.
+*/
+
+static int awc_pcmcia_init(struct NET_DEVICE *dev)
+{
+       return awc_init(dev);
+
+}
+
+static int awc_pcmcia_open(struct NET_DEVICE *dev)
+{
+       dev_link_t *link;
+       int status;
+       
+       for (link = dev_list; link; link = link->next)
+               if (link->priv == dev) break;
+       if (!DEV_OK(link))
+               return -ENODEV;
+       
+       status = awc_open(dev);
+       
+       if (!status )
+               link->open++;
+       
+       return status;
+}
+
+static int awc_pcmcia_close(struct NET_DEVICE *dev)
+{
+//     int ioaddr = dev->base_addr;
+       dev_link_t *link;
+       int ret;
+       
+       for (link = dev_list; link; link = link->next)
+               if (link->priv == dev) break;
+       if (link == NULL)
+               return -ENODEV;
+
+       PC_DEBUG(2, "%s: closing device.\n", dev->name);
+
+       link->open--;
+       ret = awc_close(dev);
+       
+       if (link->state & DEV_STALE_CONFIG) {
+               link->release.expires = RUN_AT( HZ/20 );
+               link->state |= DEV_RELEASE_PENDING;
+               add_timer(&link->release);
+       }
+       return ret;
+}
+
+/*
+       awc_attach() creates an "instance" of the driver, allocating
+       local data structures for one device.  The device is registered
+       with Card Services.
+*/
+
+static dev_link_t *awc_attach(void)
+{
+       client_reg_t client_reg;
+       dev_link_t *link = NULL;
+       struct NET_DEVICE *dev = NULL;
+       int  ret;
+
+       PC_DEBUG(0, "awc_attach()\n");
+       flush_stale_links();
+
+       /* Create the PC card device object. */
+       link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
+       memset(link, 0, sizeof(struct dev_link_t));
+       link->dev = kmalloc(sizeof(struct dev_node_t), GFP_KERNEL);
+       memset(link->dev, 0, sizeof(struct dev_node_t));
+
+       link->release.function = &awc_release;
+       link->release.data = (u_long)link;
+//     link->io.NumPorts1 = 32;
+       link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
+//     link->io.IOAddrLines = 5;
+       link->irq.Attributes = IRQ_HANDLE_PRESENT ; // |IRQ_TYPE_EXCLUSIVE  ;
+       link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID;
+       link->irq.IRQInfo2 = irq_mask;
+       link->irq.Handler = &awc_interrupt;
+       link->conf.Attributes = CONF_ENABLE_IRQ;
+       link->conf.Vcc = 50;
+       link->conf.IntType = INT_MEMORY_AND_IO;
+       link->conf.ConfigIndex = 1;
+       link->conf.Present = PRESENT_OPTION;
+
+       /* Create the network device object. */
+
+       dev = kmalloc(sizeof(struct NET_DEVICE ), GFP_KERNEL);
+       memset(dev,0,sizeof(struct NET_DEVICE));
+//     dev =  init_etherdev(0, sizeof(struct awc_private) );
+       if (!dev ) {
+               printk(KERN_CRIT "out of mem on dev alloc \n");
+               kfree(link->dev);
+               kfree(link);
+               return NULL;
+       };
+       dev->priv = kmalloc(sizeof(struct awc_private), GFP_KERNEL);
+       if (!dev->priv ) {printk(KERN_CRIT "out of mem on dev priv alloc \n"); return NULL;};
+       memset(dev->priv,0,sizeof(struct awc_private));
+       
+//     link->dev->minor = dev->minor;
+//     link->dev->major = dev->major;
+
+       /* The 4500-specific entries in the device structure. */
+
+//     dev->tx_queue_len = tx_queue_len;
+
+       dev->hard_start_xmit =          &awc_start_xmit;
+//     dev->set_config =               &awc_config_misiganes,aga mitte awc_config;
+       dev->get_stats =                &awc_get_stats;
+//     dev->set_multicast_list =       &awc_set_multicast_list;
+
+       ether_setup(dev);
+
+       dev->name = ((struct awc_private *)dev->priv)->node.dev_name;
+
+       dev->init = &awc_pcmcia_init;
+       dev->open = &awc_pcmcia_open;
+       dev->stop = &awc_pcmcia_close;
+       dev->tbusy = 1;
+       dev->start  = 0;
+       
+       link->priv = dev;
+#if CS_RELEASE_CODE > 0x2911
+       link->irq.Instance = dev;
+#endif
+
+       /* Register with Card Services */
+       link->next = dev_list;
+       dev_list = link;
+       
+        
+       client_reg.dev_info = &dev_info;
+       client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+       client_reg.EventMask =
+               CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+                       CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
+                               CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+       client_reg.event_handler = &awc_event;
+       client_reg.Version = 0x0210;
+       client_reg.event_callback_args.client_data = link;
+       ret = CardServices(RegisterClient, &link->handle, &client_reg);
+       if (ret != 0) {
+               cs_error(link->handle, RegisterClient, ret);
+               awc_detach(link);
+               return NULL;
+       }
+
+       return link;
+} /* awc_attach */
+
+/*
+
+       This deletes a driver "instance".  The device is de-registered
+       with Card Services.  If it has been released, all local data
+       structures are freed.  Otherwise, the structures will be freed
+       when the device is released.
+
+*/
+
+static void awc_detach(dev_link_t *link)
+{
+       dev_link_t **linkp;
+       long flags;
+       int i=0;
+
+       DEBUG(0, "awc_detach(0x%p)\n", link);
+
+       /* Locate device structure */
+       for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+               if (*linkp == link) break;
+       if (*linkp == NULL)
+       return;
+
+       save_flags(flags);
+       cli();
+       if (link->state & DEV_RELEASE_PENDING) {
+               del_timer(&link->release);
+               link->state &= ~DEV_RELEASE_PENDING;
+       }
+       restore_flags(flags);
+
+       if (link->state & DEV_CONFIG) {
+               awc_release((u_long)link);
+               if (link->state & DEV_STALE_CONFIG) {
+                       link->state |= DEV_STALE_LINK;
+                       return;
+               }
+       }
+
+       if (link->handle)
+               CardServices(DeregisterClient, link->handle);
+
+       /* Unlink device structure, free bits */
+       *linkp = link->next;
+
+       i=0;
+       while ( i < MAX_AWCS) {
+               if (!aironet4500_devices[i])
+                       {i++; continue;}
+               if (aironet4500_devices[i] == link->priv){
+                       if (awc_proc_unset_fun)
+                               awc_proc_unset_fun(i);
+
+                       aironet4500_devices[i]=0;
+               }
+               i++;
+       }
+       
+       if (link->priv) {
+               //struct NET_DEVICE *dev = link->priv;
+               // dam dam damn mif (dev->priv)
+               //      kfree_s(dev->priv, sizeof(struct awc_private));
+               kfree_s(link->priv, sizeof(struct NET_DEVICE));
+       }
+       kfree_s(link->dev, sizeof(struct dev_node_t));
+       kfree_s(link, sizeof(struct dev_link_t));
+
+} /* awc_detach */
+
+/*
+
+       awc_pcmcia_config() is scheduled to run after a CARD_INSERTION event
+       is received, to configure the PCMCIA socket, and to make the
+       ethernet device available to the system.
+
+*/
+
+#define CS_CHECK(fn, args...) \
+while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
+
+static void awc_pcmcia_config(dev_link_t *link)
+{
+       client_handle_t handle;
+       struct NET_DEVICE *dev;
+       struct awc_private *lp;
+       tuple_t tuple;
+       int ii;
+       cisparse_t parse;
+       u_short buf[64];
+       int last_fn, last_ret, i = 0;
+//     int ioaddr;
+       u16 *phys_addr;
+       int retval;
+       
+       handle = link->handle;
+       dev = link->priv;
+       phys_addr = (u16 *)dev->dev_addr;
+
+       PC_DEBUG(0, "awc_pcmcia_config(0x%p)\n", link);
+
+       tuple.Attributes = 0;
+       tuple.DesiredTuple = CISTPL_CONFIG;
+       CS_CHECK(GetFirstTuple, handle, &tuple);
+       tuple.TupleData = (cisdata_t *)buf;
+       tuple.TupleDataMax = 64;
+       tuple.TupleOffset = 0;
+       CS_CHECK(GetTupleData, handle, &tuple);
+       CS_CHECK(ParseTuple, handle, &tuple, &parse);
+       link->conf.ConfigBase = parse.config.base;
+       link->conf.Present = parse.config.rmask[0];
+
+
+       /* Configure card */
+       link->state |= DEV_CONFIG;
+
+       tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
+        CS_CHECK(GetFirstTuple, handle, &tuple);
+
+       while (1) {
+               cistpl_cftable_entry_t dflt = { 0 };
+               cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
+               CFG_CHECK(GetTupleData, handle, &tuple);
+               CFG_CHECK(ParseTuple, handle, &tuple, &parse);
+
+               if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg;
+               if (cfg->index == 0) goto next_entry;
+               link->conf.ConfigIndex = cfg->index;
+
+               /* Use power settings for Vcc and Vpp if present */
+               /*  Note that the CIS values need to be rescaled */
+               if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM))
+                   link->conf.Vcc = cfg->vcc.param[CISTPL_POWER_VNOM]/10000;
+               else if (dflt.vcc.present & (1<<CISTPL_POWER_VNOM))
+                   link->conf.Vcc = dflt.vcc.param[CISTPL_POWER_VNOM]/10000;
+           
+               if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
+                   link->conf.Vpp1 = link->conf.Vpp2 =
+                       cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
+               else if (dflt.vpp1.present & (1<<CISTPL_POWER_VNOM))
+                   link->conf.Vpp1 = link->conf.Vpp2 =
+                       dflt.vpp1.param[CISTPL_POWER_VNOM]/10000;
+       
+               /* Do we need to allocate an interrupt? */
+               if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
+                   link->conf.Attributes |= CONF_ENABLE_IRQ;
+       
+               /* IO window settings */
+               link->io.NumPorts1 = link->io.NumPorts2 = 0;
+               if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
+                       cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
+                       link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
+                       if (!(io->flags & CISTPL_IO_8BIT))
+                               link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
+                       if (!(io->flags & CISTPL_IO_16BIT)) {
+                               
+                               link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+                               printk(KERN_CRIT "8-bit IO not supported on this aironet 4500 driver \n");
+                       }
+                       link->io.BasePort1 = io->win[0].base;
+                       
+                       link->io.NumPorts1 = io->win[0].len;
+                       if (io->nwin > 1) {
+                               link->io.Attributes2 = link->io.Attributes1;
+                               link->io.BasePort2 = io->win[1].base;
+                               link->io.NumPorts2 = io->win[1].len;
+                       }
+               }
+               ii = 0;
+               last_fn = RequestIO;
+               while ((last_ret = CardServices(RequestIO, link->handle, &link->io)) ){
+               
+                       if (ii > 4) 
+                               goto cs_failed;
+                       link->io.BasePort1 = awc_ports[ii];
+                       ii++;
+               };
+
+
+               break;
+       
+       next_entry:
+               if (CardServices(GetNextTuple, handle, &tuple))
+                       break;
+       }
+    
+       if (link->conf.Attributes & CONF_ENABLE_IRQ){
+       
+               ii = 0;  last_fn = RequestIRQ; 
+               while ((last_ret  = CardServices(RequestIRQ, link->handle, &link->irq)) ){
+               
+                       ii++;   
+                       while (!(irq_mask & (1 << ii) ) && ii < 15)
+                               ii++;
+                       link->irq.IRQInfo2 = 1 << ii;
+
+                       if(ii > 15)
+                               goto cs_failed;
+                       printk("trying irq %d , mask %x \n",ii, link->irq.IRQInfo2); 
+                        
+               };
+       }
+
+       CS_CHECK(RequestConfiguration, link->handle, &link->conf);
+
+
+       dev->irq = link->irq.AssignedIRQ;
+       dev->base_addr = link->io.BasePort1;
+
+
+       awc_private_init( dev);
+
+
+       
+       retval = register_netdev(dev);
+       if (retval != 0) {
+               printk(KERN_NOTICE "awc_cs: register_netdev() failed for dev %x retval %x\n",(unsigned int)dev,retval);
+               goto failed;
+       }
+
+       if(awc_pcmcia_init(dev)) goto failed;
+
+       i=0;
+       while (aironet4500_devices[i] && i < MAX_AWCS-1) i++;
+       if (!aironet4500_devices[i]){
+               aironet4500_devices[i]=dev;
+               if (awc_proc_set_fun)
+                       awc_proc_set_fun(i);
+       }
+       
+
+       link->state &= ~DEV_CONFIG_PENDING;
+
+       lp = (struct awc_private *)dev->priv;
+
+       DEBUG(1,"pcmcia config complete on port %x \n",(unsigned int)dev->base_addr);
+
+       return;
+
+cs_failed:
+       cs_error(link->handle, last_fn, last_ret);
+       link->dev=NULL;
+failed:
+
+       awc_release((u_long)link);
+       return;
+
+} /* awc_pcmcia_config */
+
+/*
+       After a card is removed, awc_release() will unregister the net
+       device, and release the PCMCIA configuration.  If the device is
+       still open, this will be postponed until it is closed.
+
+*/
+
+static void awc_release(u_long arg)
+{
+       dev_link_t *link = (dev_link_t *)arg;
+       struct NET_DEVICE *dev = link->priv;
+
+       DEBUG(0, "awc_release(0x%p)\n", link);
+
+       if (link->open) {
+               DEBUG(1, "awc_cs: release postponed, '%s' still open\n",
+                         link->dev->dev_name);
+               link->state |= DEV_STALE_CONFIG;
+               return;
+       }
+
+       CardServices(ReleaseConfiguration, link->handle);
+       CardServices(ReleaseIO, link->handle, &link->io);
+       CardServices(ReleaseIRQ, link->handle, &link->irq);
+
+       CardServices(ReleaseWindow, link->win);
+       if (link->dev)
+               unregister_netdev(dev);
+       // link->dev = NULL;
+
+       link->state &= ~DEV_CONFIG;
+       if (link->state & DEV_STALE_LINK)
+               awc_detach(link);
+
+} /* awc_release */
+
+/*
+
+       The card status event handler.  Mostly, this schedules other
+       stuff to run after an event is received.  A CARD_REMOVAL event
+       also sets some flags to discourage the net drivers from trying
+       to talk to the card any more.
+*/
+
+static int awc_event(event_t event, int priority,
+                                          event_callback_args_t *args)
+{
+       dev_link_t *link = args->client_data;
+       struct NET_DEVICE *dev = link->priv;
+
+       PC_DEBUG(1, "awc_event(0x%06x)\n", event);
+
+       switch (event) {
+       case CS_EVENT_CARD_REMOVAL:
+               link->state &= ~DEV_PRESENT;
+               if (link->state & DEV_CONFIG) {
+                       dev->tbusy = 1; dev->start = 0;
+                       link->release.expires = RUN_AT( HZ/20 );
+                       add_timer(&link->release);
+               }
+               break;
+       case CS_EVENT_CARD_INSERTION:
+               link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+               awc_pcmcia_config(link);
+               break;
+       case CS_EVENT_PM_SUSPEND:
+               link->state |= DEV_SUSPEND;
+               /* Fall through... */
+       case CS_EVENT_RESET_PHYSICAL:
+               if (link->state & DEV_CONFIG) {
+                       if (link->open) {
+                               dev->tbusy = 1; dev->start = 0;
+                       }
+                       CardServices(ReleaseConfiguration, link->handle);
+               }
+               break;
+       case CS_EVENT_PM_RESUME:
+               link->state &= ~DEV_SUSPEND;
+               /* Fall through... */
+       case CS_EVENT_CARD_RESET:
+               if (link->state & DEV_CONFIG) {
+                       CardServices(RequestConfiguration, link->handle, &link->conf);
+                       if (link->open) {
+                               // awc_reset(dev);
+                               dev->tbusy = 0; dev->start = 1;
+                       }
+               }
+               break;
+       }
+       return 0;
+} /* awc_event */
+
+
+        
+int init_module(void)
+{
+       servinfo_t serv;
+
+       /* Always emit the version, before any failure. */
+       printk(KERN_INFO"%s", awc_version);
+       PC_DEBUG(0, "%s\n", version);
+       CardServices(GetCardServicesInfo, &serv);
+       if (serv.Revision != CS_RELEASE_CODE) {
+               printk(KERN_NOTICE "awc_cs: Card Services release "
+                          "does not match!\n");
+               return -1;
+       }
+       register_pcmcia_driver(&dev_info, &awc_attach, &awc_detach);
+       return 0;
+}
+
+void cleanup_module(void)
+{
+       DEBUG(0, "awc_cs: unloading %c ",'\n');
+       unregister_pcmcia_driver(&dev_info);
+       
+       while (dev_list != NULL) {
+               if (dev_list->state & DEV_CONFIG)
+                       awc_release((u_long)dev_list);
+               awc_detach(dev_list);
+       }
+               
+//     while (dev_list != NULL)
+//             awc_detach(dev_list);
+}
+
+        
\ No newline at end of file
index 2debe8a00e06e94000b7ca49a2935385b0a2cd52..045e226fe9cb6c3e13a29a48fb6e08bba7f712a6 100644 (file)
@@ -22,6 +22,10 @@ extern int scc_init(void);
 extern int yam_init(void);
 
 extern int acenic_probe(void); 
+extern int awc4500_pci_probe(void);
+extern int awc4500_isa_probe(void);
+extern int awc4500_pnp_probe(void);
+extern int awc4500_365_probe(void);
 extern int arcnet_init(void); 
 extern int bigmac_probe(void); 
 extern int bmac_probe(void); 
@@ -214,6 +218,22 @@ struct net_probe pci_probes[] __initdata = {
        {starfire_probe, 0},
 #endif
 
+/*
+*
+*      Wireless non-HAM
+*
+*/
+#ifdef CONFIG_AIRONET4500_NONCS
+
+#ifdef CONFIG_AIRONET4500_PCI
+       {awc4500_pci_probe,0},
+#endif
+
+#ifdef CONFIG_AIRONET4500_PNP
+       {awc4500_pnp_probe,0},
+#endif
+
+#endif
 /*
  *     Amateur Radio Drivers
  */    
index 2942d4ffc9718a46a6be198190cc2436684ad5b4..20f9107983e02cf26c2d4fb84e5ff502e4902d40 100644 (file)
@@ -83,6 +83,7 @@
  *                     OSS more closely; remove possible wakeup race
  *    28.10.99   0.22  More waitqueue races fixed
  *    01.12.99   0.23  New argument to allocate_resource
+ *    07.12.99   0.24  More allocate_resource semantics change
  *
  */
 
@@ -2434,7 +2435,7 @@ static int __init init_sonicvibes(void)
 
        if (!pci_present())   /* No PCI bus in this machine! */
                return -ENODEV;
-       printk(KERN_INFO "sv: version v0.23 time " __TIME__ " " __DATE__ "\n");
+       printk(KERN_INFO "sv: version v0.24 time " __TIME__ " " __DATE__ "\n");
 #if 0
        if (!(wavetable_mem = __get_free_pages(GFP_KERNEL, 20-PAGE_SHIFT)))
                printk(KERN_INFO "sv: cannot allocate 1MB of contiguous nonpageable memory for wavetable data\n");
@@ -2458,7 +2459,7 @@ static int __init init_sonicvibes(void)
                        memcpy(ddmaname, sv_ddma_name, ddmanamelen);
                        pcidev->resource[RESOURCE_DDMA].name = ddmaname;
                        if (allocate_resource(&ioport_resource, pcidev->resource+RESOURCE_DDMA, 
-                                             2*SV_EXTENT_DMA, 0x1000, 0x10000-2*SV_EXTENT_DMA, 1024, pcidev)) {
+                                             2*SV_EXTENT_DMA, 0x1000, 0x10000-2*SV_EXTENT_DMA, 1024, NULL, NULL)) {
                                pcidev->resource[RESOURCE_DDMA].name = NULL;
                                kfree(ddmaname);
                                printk(KERN_ERR "sv: cannot allocate DDMA controller io ports\n");
index cb6ce5031b437a45de268f17cf21dd7364eab390..5e09030c1d2cf394304bea6a318e509e36eca8f8 100644 (file)
@@ -1,11 +1,12 @@
-
 /* Driver for USB SCSI-like devices
  *
- * (C) Michael Gee (michael@linuxspecific.com) 1999
+ * (c) 1999 Michael Gee (michael@linuxspecific.com)
+ * (c) 1999 Matthew Dharm (mdharm@one-eyed-alien.net)
  *
- * This driver is schizoid  - it makes a USB device appear as both a SCSI device
- * and a character device. The latter is only available if the device has an
- * interrupt endpoint, and is used specifically to receive interrupt events.
+ * This driver is schizoid  - it makes a USB device appear as both a SCSI
+ * device and a character device. The latter is only available if the device
+ * has an interrupt endpoint, and is used specifically to receive interrupt
+ * events.
  *
  * In order to support various 'strange' devices, this module supports plug-in
  * device-specific filter modules, which can do their own thing when required.
@@ -58,7 +59,7 @@ unsigned char us_direction[256/8] = {
 #ifdef REWRITE_PROJECT
 #define IRQ_PERIOD             255
 #else
-#define IRQ_PERIOD             0       /* single IRQ transfer then remove it */
+#define IRQ_PERIOD             0    /* single IRQ transfer then remove it */
 #endif
 
 /*
@@ -70,38 +71,37 @@ static int my_host_number;
 int usbscsi_debug = 1;
 
 struct us_data {
-       struct us_data          *next;                  /* next device */
-       struct usb_device       *pusb_dev;
-       struct usb_scsi_filter  *filter;                /* filter driver */
-       void                    *fdata;                 /* filter data */
-       unsigned int            flags;                  /* from filter initially */
-       __u8                    ifnum;                  /* interface number */
-       __u8                    ep_in;                  /* in endpoint */
-       __u8                    ep_out;                 /* out ....... */
-       __u8                    ep_int;                 /* interrupt . */
-       __u8                    subclass;               /* as in overview */
-       __u8                    protocol;               /* .............. */
-       __u8                    attention_done;         /* force attention on first command */
-       int (*pop)(Scsi_Cmnd *);                        /* protocol specific do cmd */
-       int (*pop_reset)(struct us_data *);             /* ................. device reset */
-       GUID(guid);                                     /* unique dev id */
-       struct Scsi_Host        *host;                  /* our dummy host data */
-       Scsi_Host_Template      *htmplt;                /* own host template */
-       int                     host_number;            /* to find us */
-       int                     host_no;                /* allocated by scsi */
-       int                     fixedlength;            /* expand commands */
-       Scsi_Cmnd               *srb;                   /* current srb */
-       int                     action;                 /* what to do */
-       wait_queue_head_t       waitq;                  /* thread waits */
-       wait_queue_head_t       ip_waitq;               /* for CBI interrupts */
-       __u16                   ip_data;                /* interrupt data */
-       int                     ip_wanted;              /* needed */
-       int                     pid;                    /* control thread */
-       struct semaphore        *notify;                /* wait for thread to begin */
-       void                    *irq_handle;            /* for USB interrupt requests */
-       unsigned int            irqpipe;                /* remember pipe for release_irq */
-       int                     mode_xlate;             /* if current SCSI command is MODE_6 */
-                                                       /* but is translated to MODE_10 for UFI */
+       struct us_data          *next;          /* next device */
+       struct usb_device       *pusb_dev;
+       struct usb_scsi_filter  *filter;        /* filter driver */
+       void                    *fdata;         /* filter data */
+       unsigned int            flags;          /* from filter initially */
+       __u8                    ifnum;          /* interface number */
+       __u8                    ep_in;          /* in endpoint */
+       __u8                    ep_out;         /* out ....... */
+       __u8                    ep_int;         /* interrupt . */
+       __u8                    subclass;       /* as in overview */
+       __u8                    protocol;       /* .............. */
+       __u8                    attention_done; /* force attn on first cmd */
+       int (*pop)(Scsi_Cmnd *);                /* protocol specific do cmd */
+       int (*pop_reset)(struct us_data *);     /* ........... device reset */
+       GUID(guid);                             /* unique dev id */
+       struct Scsi_Host        *host;          /* our dummy host data */
+       Scsi_Host_Template      *htmplt;        /* own host template */
+       int                     host_number;    /* to find us */
+       int                     host_no;        /* allocated by scsi */
+       int                     fixedlength;    /* expand commands */
+       Scsi_Cmnd               *srb;           /* current srb */
+       int                     action;         /* what to do */
+       wait_queue_head_t       waitq;          /* thread waits */
+       wait_queue_head_t       ip_waitq;       /* for CBI interrupts */
+       __u16                   ip_data;        /* interrupt data */
+       int                     ip_wanted;      /* needed */
+       int                     pid;            /* control thread */
+       struct semaphore        *notify;        /* wait for thread to begin */
+       void                    *irq_handle;    /* for USB int requests */
+       unsigned int            irqpipe;        /* pipe for release_irq */
+       int                     mode_xlate;     /* trans MODE_6 to _10? */
 };
 
 /*
@@ -131,230 +131,230 @@ static struct usb_driver scsi_driver = {
 
 static int us_one_transfer(struct us_data *us, int pipe, char *buf, int length)
 {
-    int max_size = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe)) * 16;
-    int this_xfer;
-    int result;
-    unsigned long partial;
-    int maxtry = 100;
-    while (length) {
-       this_xfer = length > max_size ? max_size : length;
-       length -= this_xfer;
-       do {
-           /* US_DEBUGP("Bulk xfer %x(%d)\n", (unsigned int)buf, this_xfer); */
-           result = usb_bulk_msg(us->pusb_dev, pipe, buf,
-                               this_xfer, &partial, HZ*5);
-
-           if (result != 0 || partial != this_xfer)
-               US_DEBUGP("bulk_msg returned %d xferred %lu/%d\n",
-                         result, partial, this_xfer);
-
-           if (result == USB_ST_STALL) {
-               US_DEBUGP("clearing endpoint halt for pipe %x\n", pipe);
-               usb_clear_halt(us->pusb_dev,
-                       usb_pipeendpoint(pipe) | (pipe & USB_DIR_IN));
-           }
-
-           /* we want to retry if the device reported NAK */
-           if (result == USB_ST_TIMEOUT) {
-               if (partial != this_xfer) {
-                   return 0;   /* I do not like this */
-               }
-               if (!maxtry--)
-                   break;
-               this_xfer -= partial;
-               buf += partial;
-           } else if (!result && partial != this_xfer) {
-               /* short data - assume end */
-               result = USB_ST_DATAUNDERRUN;
-               break;
-           } else if (result == USB_ST_STALL && us->protocol == US_PR_CB) {
-               if (!maxtry--)
-                   break;
-               this_xfer -= partial;
-               buf += partial;
-           } else
-               break;
-       } while ( this_xfer );
-       if (result)
-           return result;
-       buf += this_xfer;
-    }
+       int max_size = usb_maxpacket(us->pusb_dev, pipe, usb_pipeout(pipe)) * 16;
+       int this_xfer;
+       int result;
+       unsigned long partial;
+       int maxtry = 100;
+       while (length) {
+               this_xfer = length > max_size ? max_size : length;
+               length -= this_xfer;
+               do {
+                       US_DEBUGP("Bulk xfer %x(%d)\n", (unsigned int)buf, this_xfer);
+                       result = usb_bulk_msg(us->pusb_dev, pipe, buf,
+                                             this_xfer, &partial, HZ*5);
+
+                       if (result != 0 || partial != this_xfer)
+                               US_DEBUGP("bulk_msg returned %d xferred %lu/%d\n",
+                                         result, partial, this_xfer);
+
+                       if (result == USB_ST_STALL) {
+                               US_DEBUGP("clearing endpoint halt for pipe %x\n", pipe);
+                               usb_clear_halt(us->pusb_dev,
+                                              usb_pipeendpoint(pipe) | (pipe & USB_DIR_IN));
+                       }
 
-    return 0;
+                       /* we want to retry if the device reported NAK */
+                       if (result == USB_ST_TIMEOUT) {
+                               if (partial != this_xfer) {
+                                       return 0;       /* I do not like this */
+                               }
+                               if (!maxtry--)
+                                       break;
+                               this_xfer -= partial;
+                               buf += partial;
+                       } else if (!result && partial != this_xfer) {
+                               /* short data - assume end */
+                               result = USB_ST_DATAUNDERRUN;
+                               break;
+                       } else if (result == USB_ST_STALL && us->protocol == US_PR_CB) {
+                               if (!maxtry--)
+                                       break;
+                               this_xfer -= partial;
+                               buf += partial;
+                       } else
+                               break;
+               } while ( this_xfer );
+               if (result)
+                       return result;
+               buf += this_xfer;
+       }
+
+       return 0;
 }
 
 static int us_transfer(Scsi_Cmnd *srb, int dir_in)
 {
-    struct us_data *us = (struct us_data *)srb->host_scribble;
-    int i;
-    int result = -1;
-    unsigned int pipe = dir_in ? usb_rcvbulkpipe(us->pusb_dev, us->ep_in) :
-           usb_sndbulkpipe(us->pusb_dev, us->ep_out);
-
-    if (srb->use_sg) {
-       struct scatterlist *sg = (struct scatterlist *) srb->request_buffer;
-
-       for (i = 0; i < srb->use_sg; i++) {
-           result = us_one_transfer(us, pipe, sg[i].address, sg[i].length);
-           if (result)
-               break;
+       struct us_data *us = (struct us_data *)srb->host_scribble;
+       int i;
+       int result = -1;
+       unsigned int pipe = dir_in ? usb_rcvbulkpipe(us->pusb_dev, us->ep_in) :
+               usb_sndbulkpipe(us->pusb_dev, us->ep_out);
+
+       if (srb->use_sg) {
+               struct scatterlist *sg = (struct scatterlist *) srb->request_buffer;
+
+               for (i = 0; i < srb->use_sg; i++) {
+                       result = us_one_transfer(us, pipe, sg[i].address, sg[i].length);
+                       if (result)
+                               break;
+               }
        }
-    }
-    else
-       result = us_one_transfer(us, pipe,
-                                srb->request_buffer, srb->request_bufflen);
-
-    if (result)
-       US_DEBUGP("us_transfer returning error %d\n", result);
-    return result;
+       else
+               result = us_one_transfer(us, pipe,
+                                        srb->request_buffer, srb->request_bufflen);
+
+       if (result)
+               US_DEBUGP("us_transfer returning error %d\n", result);
+       return result;
 }
 
 static unsigned int us_transfer_length(Scsi_Cmnd *srb)
 {
-    int i;
-    unsigned int total = 0;
-
-    /* always zero for some commands */
-    switch (srb->cmnd[0]) {
-    case SEEK_6:
-    case SEEK_10:
-    case REZERO_UNIT:
-    case ALLOW_MEDIUM_REMOVAL:
-    case START_STOP:
-    case TEST_UNIT_READY:
-       return 0;
+       int i;
+       unsigned int total = 0;
+
+       /* always zero for some commands */
+       switch (srb->cmnd[0]) {
+       case SEEK_6:
+       case SEEK_10:
+       case REZERO_UNIT:
+       case ALLOW_MEDIUM_REMOVAL:
+       case START_STOP:
+       case TEST_UNIT_READY:
+               return 0;
 
-    default:
-       break;
-    }
+       default:
+               break;
+       }
 
-    if (srb->use_sg) {
-       struct scatterlist *sg = (struct scatterlist *) srb->request_buffer;
+       if (srb->use_sg) {
+               struct scatterlist *sg = (struct scatterlist *) srb->request_buffer;
 
-       for (i = 0; i < srb->use_sg; i++) {
-           total += sg[i].length;
+               for (i = 0; i < srb->use_sg; i++) {
+                       total += sg[i].length;
+               }
+               return total;
        }
-       return total;
-    }
-    else
-       return srb->request_bufflen;
+       else
+               return srb->request_bufflen;
 }
 
 static int pop_CBI_irq(int state, void *buffer, int len, void *dev_id)
 {
-    struct us_data *us = (struct us_data *)dev_id;
-
-    if (state != USB_ST_REMOVED) {
-       us->ip_data = le16_to_cpup((__u16 *)buffer);
-       /* US_DEBUGP("Interrupt Status %x\n", us->ip_data); */
-    }
-    if (us->ip_wanted) {
-       us->ip_wanted = 0;
-       wake_up(&us->ip_waitq);
-    }
-
-    /* we don't want another interrupt */
-    return 0;
+       struct us_data *us = (struct us_data *)dev_id;
+
+       if (state != USB_ST_REMOVED) {
+               us->ip_data = le16_to_cpup((__u16 *)buffer);
+               /* US_DEBUGP("Interrupt Status %x\n", us->ip_data); */
+       }
+       if (us->ip_wanted) {
+               us->ip_wanted = 0;
+               wake_up(&us->ip_waitq);
+       }
+
+       /* we don't want another interrupt */
+       return 0;
 }
 
 static int pop_CB_reset(struct us_data *us)
 {
-    unsigned char cmd[12];
-    int result;
+       unsigned char cmd[12];
+       int result;
 
-    US_DEBUGP("pop_CB_reset\n");
+       US_DEBUGP("pop_CB_reset\n");
 
-    memset(cmd, -1, sizeof(cmd));
-    cmd[0] = SEND_DIAGNOSTIC;
-    cmd[1] = 4;
-    result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
-                       US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
-                       0, us->ifnum, cmd, sizeof(cmd), HZ*5);
+       memset(cmd, -1, sizeof(cmd));
+       cmd[0] = SEND_DIAGNOSTIC;
+       cmd[1] = 4;
+       result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
+                                US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
+                                0, us->ifnum, cmd, sizeof(cmd), HZ*5);
 
-    /* long wait for reset */
+       /* long wait for reset */
 
-    schedule_timeout(HZ*6);
+       schedule_timeout(HZ*6);
 
-    US_DEBUGP("pop_CB_reset: clearing endpoint halt\n");
-    usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN);
-    usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT);
+       US_DEBUGP("pop_CB_reset: clearing endpoint halt\n");
+       usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN);
+       usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT);
 
-    US_DEBUGP("pop_CB_reset done\n");
-    return 0;
+       US_DEBUGP("pop_CB_reset done\n");
+       return 0;
 }
 
 static int pop_CB_command(Scsi_Cmnd *srb)
 {
-    struct us_data *us = (struct us_data *)srb->host_scribble;
-    unsigned char cmd[16];
-    int result;
-    int retry = 5;
-    int done_start = 0;
+       struct us_data *us = (struct us_data *)srb->host_scribble;
+       unsigned char cmd[16];
+       int result;
+       int retry = 5;
+       int done_start = 0;
 
-    while (retry--) {
+       while (retry--) {
 
-       if (us->flags & US_FL_FIXED_COMMAND) {
-           memset(cmd, 0, us->fixedlength);
-
-           /* fix some commands */
-
-           switch (srb->cmnd[0]) {
-           case WRITE_6:
-           case READ_6:
-               cmd[0] = srb->cmnd[0] | 0x20;
-               cmd[1] = srb->cmnd[1] & 0xE0;
-               cmd[2] = 0;
-               cmd[3] = srb->cmnd[1] & 0x1F;
-               cmd[4] = srb->cmnd[2];
-               cmd[5] = srb->cmnd[3];
-               cmd[8] = srb->cmnd[4];
-               break;
+               if (us->flags & US_FL_FIXED_COMMAND) {
+                       memset(cmd, 0, us->fixedlength);
+
+                       /* fix some commands */
+
+                       switch (srb->cmnd[0]) {
+                       case WRITE_6:
+                       case READ_6:
+                               cmd[0] = srb->cmnd[0] | 0x20;
+                               cmd[1] = srb->cmnd[1] & 0xE0;
+                               cmd[2] = 0;
+                               cmd[3] = srb->cmnd[1] & 0x1F;
+                               cmd[4] = srb->cmnd[2];
+                               cmd[5] = srb->cmnd[3];
+                               cmd[8] = srb->cmnd[4];
+                               break;
 
-           case MODE_SENSE:
-           case MODE_SELECT:
-               us->mode_xlate = (srb->cmnd[0] == MODE_SENSE);
-               cmd[0] = srb->cmnd[0] | 0x40;
-               cmd[1] = srb->cmnd[1];
-               cmd[2] = srb->cmnd[2];
-               cmd[8] = srb->cmnd[4];
-               break;
+                       case MODE_SENSE:
+                       case MODE_SELECT:
+                               us->mode_xlate = (srb->cmnd[0] == MODE_SENSE);
+                               cmd[0] = srb->cmnd[0] | 0x40;
+                               cmd[1] = srb->cmnd[1];
+                               cmd[2] = srb->cmnd[2];
+                               cmd[8] = srb->cmnd[4];
+                               break;
 
-           default:
-               us->mode_xlate = 0;
-               memcpy(cmd, srb->cmnd, srb->cmd_len);
-               break;
-           }
-           result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
-                               US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
-                               0, us->ifnum,
-                               cmd, us->fixedlength, HZ*5);
-           if (!done_start && (us->subclass == US_SC_UFI /*|| us->subclass == US_SC_8070*/)
-                && cmd[0] == TEST_UNIT_READY && result) {
-               /* as per spec try a start command, wait and retry */
-
-               done_start++;
-               memset(cmd, 0, sizeof(cmd));
-               cmd[0] = START_STOP;
-               cmd[4] = 1;             /* start */
-               result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
-                               US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
-                               0, us->ifnum,
-                               cmd, us->fixedlength, HZ*5);
-               wait_ms(100);
-               retry++;
-               continue;
-           }
-       } else {
-           result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
-                               US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
-                               0, us->ifnum,
-                               srb->cmnd, srb->cmd_len, HZ*5);
+                       default:
+                               us->mode_xlate = 0;
+                               memcpy(cmd, srb->cmnd, srb->cmd_len);
+                               break;
+                       }
+                       result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
+                                                US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
+                                                0, us->ifnum,
+                                                cmd, us->fixedlength, HZ*5);
+                       if (!done_start && (us->subclass == US_SC_UFI /*|| us->subclass == US_SC_8070*/)
+                           && cmd[0] == TEST_UNIT_READY && result) {
+                               /* as per spec try a start command, wait and retry */
+
+                               done_start++;
+                               memset(cmd, 0, sizeof(cmd));
+                               cmd[0] = START_STOP;
+                               cmd[4] = 1;             /* start */
+                               result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
+                                                        US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
+                                                        0, us->ifnum,
+                                                        cmd, us->fixedlength, HZ*5);
+                               wait_ms(100);
+                               retry++;
+                               continue;
+                       }
+               } else {
+                       result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
+                                                US_CBI_ADSC, USB_TYPE_CLASS | USB_RT_INTERFACE,
+                                                0, us->ifnum,
+                                                srb->cmnd, srb->cmd_len, HZ*5);
+               }
+               if (/*result != USB_ST_STALL &&*/ result != USB_ST_TIMEOUT)
+                       return result;
        }
-       if (/*result != USB_ST_STALL &&*/ result != USB_ST_TIMEOUT)
-           return result;
-    }
 
-    return result;
+       return result;
 }
 
 /*
@@ -363,237 +363,237 @@ static int pop_CB_command(Scsi_Cmnd *srb)
 
 static int pop_CB_status(Scsi_Cmnd *srb)
 {
-    struct us_data *us = (struct us_data *)srb->host_scribble;
-    int result;
-    __u8 status[2];
-    int retry = 5;
-
-    US_DEBUGP("pop_CB_status, proto=%x\n", us->protocol);
-    switch (us->protocol) {
-    case US_PR_CB:
-       /* get from control */
-
-       while (retry--) {
-           result = usb_control_msg(us->pusb_dev, usb_rcvctrlpipe(us->pusb_dev,0),
-                               USB_REQ_GET_STATUS, USB_DIR_IN | USB_TYPE_STANDARD | USB_RT_DEVICE,
-                               0, us->ifnum,
-                               status, sizeof(status), HZ*5);
-           if (result != USB_ST_TIMEOUT)
+       struct us_data *us = (struct us_data *)srb->host_scribble;
+       int result;
+       __u8 status[2];
+       int retry = 5;
+
+       US_DEBUGP("pop_CB_status, proto=%x\n", us->protocol);
+       switch (us->protocol) {
+       case US_PR_CB:
+               /* get from control */
+
+               while (retry--) {
+                       result = usb_control_msg(us->pusb_dev, usb_rcvctrlpipe(us->pusb_dev,0),
+                                                USB_REQ_GET_STATUS, USB_DIR_IN | USB_TYPE_STANDARD | USB_RT_DEVICE,
+                                                0, us->ifnum,
+                                                status, sizeof(status), HZ*5);
+                       if (result != USB_ST_TIMEOUT)
+                               break;
+               }
+               if (result) {
+                       US_DEBUGP("Bad AP status request %d\n", result);
+                       return DID_ABORT << 16;
+               }
+               US_DEBUGP("Got AP status %x %x\n", status[0], status[1]);
+               if (srb->cmnd[0] != REQUEST_SENSE && srb->cmnd[0] != INQUIRY &&
+                   ( (status[0] & ~3) || status[1]))
+                       return (DID_OK << 16) | 2;
+               else
+                       return DID_OK << 16;
                break;
-       }
-       if (result) {
-           US_DEBUGP("Bad AP status request %d\n", result);
-           return DID_ABORT << 16;
-       }
-       US_DEBUGP("Got AP status %x %x\n", status[0], status[1]);
-       if (srb->cmnd[0] != REQUEST_SENSE && srb->cmnd[0] != INQUIRY &&
-           ( (status[0] & ~3) || status[1]))
-           return (DID_OK << 16) | 2;
-       else
-           return DID_OK << 16;
-       break;
-
-    case US_PR_CBI:
-       /* get from interrupt pipe */
 
-       /* add interrupt transfer, marked for removal */
-       us->ip_wanted = 1;
-       us->irqpipe = usb_rcvintpipe(us->pusb_dev, us->ep_int);
-       result = usb_request_irq(us->pusb_dev, us->irqpipe, pop_CBI_irq,
-                               IRQ_PERIOD, (void *)us, &us->irq_handle);
-       if (result) {
-           US_DEBUGP("usb_request_irq failed (0x%x), No interrupt for CBI\n",
-               result);
-           return DID_ABORT << 16;
-       }
+       case US_PR_CBI:
+               /* get from interrupt pipe */
+
+               /* add interrupt transfer, marked for removal */
+               us->ip_wanted = 1;
+               us->irqpipe = usb_rcvintpipe(us->pusb_dev, us->ep_int);
+               result = usb_request_irq(us->pusb_dev, us->irqpipe, pop_CBI_irq,
+                                        IRQ_PERIOD, (void *)us, &us->irq_handle);
+               if (result) {
+                       US_DEBUGP("usb_request_irq failed (0x%x), No interrupt for CBI\n",
+                                 result);
+                       return DID_ABORT << 16;
+               }
 
-       sleep_on(&us->ip_waitq);
+               sleep_on(&us->ip_waitq);
 #ifdef REWRITE_PROJECT
-       usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe);
-       us->irq_handle = NULL;
+               usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe);
+               us->irq_handle = NULL;
 #endif
 
-       if (us->ip_wanted) {
-           US_DEBUGP("Did not get interrupt on CBI\n");
-           us->ip_wanted = 0;
-           return DID_ABORT << 16;
-       }
+               if (us->ip_wanted) {
+                       US_DEBUGP("Did not get interrupt on CBI\n");
+                       us->ip_wanted = 0;
+                       return DID_ABORT << 16;
+               }
 
-       US_DEBUGP("Got interrupt data %x\n", us->ip_data);
+               US_DEBUGP("Got interrupt data %x\n", us->ip_data);
 
-       /* sort out what it means */
+               /* sort out what it means */
 
-       if (us->subclass == US_SC_UFI) {
-           /* gives us asc and ascq, as per request sense */
+               if (us->subclass == US_SC_UFI) {
+                       /* gives us asc and ascq, as per request sense */
 
-           if (srb->cmnd[0] == REQUEST_SENSE ||
-               srb->cmnd[0] == INQUIRY)
-               return DID_OK << 16;
-           else
-               return (DID_OK << 16) + ((us->ip_data & 0xff) ? 2 : 0);
-       }
-       if (us->ip_data & 0xff) {
-           US_DEBUGP("Bad CBI interrupt data %x\n", us->ip_data);
-           return DID_ABORT << 16;
+                       if (srb->cmnd[0] == REQUEST_SENSE ||
+                           srb->cmnd[0] == INQUIRY)
+                               return DID_OK << 16;
+                       else
+                               return (DID_OK << 16) + ((us->ip_data & 0xff) ? 2 : 0);
+               }
+               if (us->ip_data & 0xff) {
+                       US_DEBUGP("Bad CBI interrupt data %x\n", us->ip_data);
+                       return DID_ABORT << 16;
+               }
+               return (DID_OK << 16) + ((us->ip_data & 0x300) ? 2 : 0);
        }
-       return (DID_OK << 16) + ((us->ip_data & 0x300) ? 2 : 0);
-    }
-    return DID_ERROR << 16;
+       return DID_ERROR << 16;
 }
 
 /* Protocol command handlers */
 
 static int pop_CBI(Scsi_Cmnd *srb)
 {
-    int result;
+       int result;
 
-    /* run the command */
+       /* run the command */
 
-    if ((result = pop_CB_command(srb))) {
-       US_DEBUGP("CBI command %x\n", result);
-       if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) {
-           return (DID_OK << 16) | 2;
+       if ((result = pop_CB_command(srb))) {
+               US_DEBUGP("CBI command %x\n", result);
+               if (result == USB_ST_STALL || result == USB_ST_TIMEOUT) {
+                       return (DID_OK << 16) | 2;
+               }
+               return DID_ERROR << 16;
        }
-       return DID_ERROR << 16;
-    }
 
-    /* transfer the data */
+       /* transfer the data */
 
-    if (us_transfer_length(srb)) {
-       result = us_transfer(srb, US_DIRECTION(srb->cmnd[0]));
-       if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) {
-           US_DEBUGP("CBI transfer %x\n", result);
-           return DID_ERROR << 16;
-       }
+       if (us_transfer_length(srb)) {
+               result = us_transfer(srb, US_DIRECTION(srb->cmnd[0]));
+               if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) {
+                       US_DEBUGP("CBI transfer %x\n", result);
+                       return DID_ERROR << 16;
+               }
 #if 0
-       else if (result == USB_ST_DATAUNDERRUN) {
-           return DID_OK << 16;
-       }
-    } else {
-       if (!result) {
-           return DID_OK << 16;
-       }
+               else if (result == USB_ST_DATAUNDERRUN) {
+                       return DID_OK << 16;
+               }
+       } else {
+               if (!result) {
+                       return DID_OK << 16;
+               }
 #endif
-    }
+       }
 
-    /* get status */
-    return pop_CB_status(srb);
+       /* get status */
+       return pop_CB_status(srb);
 }
 
 static int pop_Bulk_reset(struct us_data *us)
 {
-    int result;
+       int result;
 
-    result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
-                       US_BULK_RESET, USB_TYPE_CLASS | USB_RT_INTERFACE,
-                       US_BULK_RESET_HARD, us->ifnum,
-                       NULL, 0, HZ*5);
-    if (result)
-       US_DEBUGP("Bulk hard reset failed %d\n", result);
-    usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN);
-    usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT);
+       result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
+                                US_BULK_RESET, USB_TYPE_CLASS | USB_RT_INTERFACE,
+                                US_BULK_RESET_HARD, us->ifnum,
+                                NULL, 0, HZ*5);
+       if (result)
+               US_DEBUGP("Bulk hard reset failed %d\n", result);
+       usb_clear_halt(us->pusb_dev, us->ep_in | USB_DIR_IN);
+       usb_clear_halt(us->pusb_dev, us->ep_out | USB_DIR_OUT);
 
-    /* long wait for reset */
+       /* long wait for reset */
 
-    schedule_timeout(HZ*6);
+       schedule_timeout(HZ*6);
 
-    return result;
+       return result;
 }
 
 /*
  * The bulk only protocol handler.
- *     Uses the in and out endpoints to transfer commands and data (nasty)
+ *     Uses the in and out endpoints to transfer commands and data (nasty)
  */
 static int pop_Bulk(Scsi_Cmnd *srb)
 {
-    struct us_data *us = (struct us_data *)srb->host_scribble;
-    struct bulk_cb_wrap bcb;
-    struct bulk_cs_wrap bcs;
-    int result;
-    unsigned long partial;
-    int stall;
-
-    /* set up the command wrapper */
-
-    bcb.Signature = US_BULK_CB_SIGN;
-    bcb.DataTransferLength = us_transfer_length(srb);;
-    bcb.Flags = US_DIRECTION(srb->cmnd[0]) << 7;
-    bcb.Tag = srb->serial_number;
-    bcb.Lun = 0;
-    memset(bcb.CDB, 0, sizeof(bcb.CDB));
-    memcpy(bcb.CDB, srb->cmnd, srb->cmd_len);
-    if (us->flags & US_FL_FIXED_COMMAND) {
-       bcb.Length = us->fixedlength;
-    } else {
-       bcb.Length = srb->cmd_len;
-    }
-
-    /* send it to out endpoint */
-
-    US_DEBUGP("Bulk command S %x T %x L %d F %d CL %d\n",
-               bcb.Signature, bcb.Tag, bcb.DataTransferLength,
-               bcb.Flags, bcb.Length);
-    result = usb_bulk_msg(us->pusb_dev,
-                       usb_sndbulkpipe(us->pusb_dev, us->ep_out), &bcb,
-                       US_BULK_CB_WRAP_LEN, &partial, HZ*5);
-    if (result) {
-       US_DEBUGP("Bulk command result %x\n", result);
-       return DID_ABORT << 16;
-    }
-
-    //return DID_BAD_TARGET << 16;
-    /* send/receive data */
-
-    if (bcb.DataTransferLength) {
-       result = us_transfer(srb, bcb.Flags);
-       if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) {
-           US_DEBUGP("Bulk transfer result %x\n", result);
-           return DID_ABORT << 16;
+       struct us_data *us = (struct us_data *)srb->host_scribble;
+       struct bulk_cb_wrap bcb;
+       struct bulk_cs_wrap bcs;
+       int result;
+       unsigned long partial;
+       int stall;
+
+       /* set up the command wrapper */
+
+       bcb.Signature = US_BULK_CB_SIGN;
+       bcb.DataTransferLength = us_transfer_length(srb);;
+       bcb.Flags = US_DIRECTION(srb->cmnd[0]) << 7;
+       bcb.Tag = srb->serial_number;
+       bcb.Lun = 0;
+       memset(bcb.CDB, 0, sizeof(bcb.CDB));
+       memcpy(bcb.CDB, srb->cmnd, srb->cmd_len);
+       if (us->flags & US_FL_FIXED_COMMAND) {
+               bcb.Length = us->fixedlength;
+       } else {
+               bcb.Length = srb->cmd_len;
        }
-    }
 
-    /* get status */
+       /* send it to out endpoint */
 
-    stall = 0;
-    do {
+       US_DEBUGP("Bulk command S %x T %x L %d F %d CL %d\n",
+                 bcb.Signature, bcb.Tag, bcb.DataTransferLength,
+                 bcb.Flags, bcb.Length);
        result = usb_bulk_msg(us->pusb_dev,
-                       usb_rcvbulkpipe(us->pusb_dev, us->ep_in), &bcs,
-                       US_BULK_CS_WRAP_LEN, &partial, HZ*5);
-       if (result == USB_ST_STALL || result == USB_ST_TIMEOUT)
-           stall++;
-       else
-           break;
-    } while ( stall < 3);
-    if (result && result != USB_ST_DATAUNDERRUN) {
-       US_DEBUGP("Bulk status result = %x\n", result);
-       return DID_ABORT << 16;
-    }
-
-    /* check bulk status */
-
-    US_DEBUGP("Bulk status S %x T %x R %d V %x\n",
-               bcs.Signature, bcs.Tag, bcs.Residue, bcs.Status);
-    if (bcs.Signature != US_BULK_CS_SIGN || bcs.Tag != bcb.Tag ||
-       bcs.Status > US_BULK_STAT_PHASE) {
-       US_DEBUGP("Bulk logical error\n");
-       return DID_ABORT << 16;
-    }
-    switch (bcs.Status) {
-    case US_BULK_STAT_OK:
-       return DID_OK << 16;
-
-    case US_BULK_STAT_FAIL:
-       /* check for underrun - dont report */
-       if (bcs.Residue)
-           return DID_OK << 16;
-       //pop_Bulk_reset(us);
-       break;
-
-    case US_BULK_STAT_PHASE:
-       return DID_ERROR << 16;
-    }
+                             usb_sndbulkpipe(us->pusb_dev, us->ep_out), &bcb,
+                             US_BULK_CB_WRAP_LEN, &partial, HZ*5);
+       if (result) {
+               US_DEBUGP("Bulk command result %x\n", result);
+               return DID_ABORT << 16;
+       }
+
+       //return DID_BAD_TARGET << 16;
+       /* send/receive data */
+
+       if (bcb.DataTransferLength) {
+               result = us_transfer(srb, bcb.Flags);
+               if (result && result != USB_ST_DATAUNDERRUN && result != USB_ST_STALL) {
+                       US_DEBUGP("Bulk transfer result %x\n", result);
+                       return DID_ABORT << 16;
+               }
+       }
+
+       /* get status */
 
-    return (DID_OK << 16) | 2;         /* check sense required */
+       stall = 0;
+       do {
+               result = usb_bulk_msg(us->pusb_dev,
+                                     usb_rcvbulkpipe(us->pusb_dev, us->ep_in), &bcs,
+                                     US_BULK_CS_WRAP_LEN, &partial, HZ*5);
+               if (result == USB_ST_STALL || result == USB_ST_TIMEOUT)
+                       stall++;
+               else
+                       break;
+       } while ( stall < 3);
+       if (result && result != USB_ST_DATAUNDERRUN) {
+               US_DEBUGP("Bulk status result = %x\n", result);
+               return DID_ABORT << 16;
+       }
+
+       /* check bulk status */
+
+       US_DEBUGP("Bulk status S %x T %x R %d V %x\n",
+                 bcs.Signature, bcs.Tag, bcs.Residue, bcs.Status);
+       if (bcs.Signature != US_BULK_CS_SIGN || bcs.Tag != bcb.Tag ||
+           bcs.Status > US_BULK_STAT_PHASE) {
+               US_DEBUGP("Bulk logical error\n");
+               return DID_ABORT << 16;
+       }
+       switch (bcs.Status) {
+       case US_BULK_STAT_OK:
+               return DID_OK << 16;
+
+       case US_BULK_STAT_FAIL:
+               /* check for underrun - dont report */
+               if (bcs.Residue)
+                       return DID_OK << 16;
+               //pop_Bulk_reset(us);
+               break;
+
+       case US_BULK_STAT_PHASE:
+               return DID_ERROR << 16;
+       }
+
+       return (DID_OK << 16) | 2;              /* check sense required */
 }
 
 /* Host functions */
@@ -601,25 +601,25 @@ static int pop_Bulk(Scsi_Cmnd *srb)
 /* detect adapter (always true ) */
 static int us_detect(struct SHT *sht)
 {
-    /* FIXME - not nice at all, but how else ? */
-    struct us_data *us = (struct us_data *)sht->proc_dir;
-    char name[32];
-
-    sprintf(name, "usbscsi%d", us->host_number);
-    sht->name = sht->proc_name = kmalloc(strlen(name)+1, GFP_KERNEL);
-    if (!sht->proc_name)
+       /* FIXME - not nice at all, but how else ? */
+       struct us_data *us = (struct us_data *)sht->proc_dir;
+       char name[32];
+
+       sprintf(name, "usbscsi%d", us->host_number);
+       sht->name = sht->proc_name = kmalloc(strlen(name)+1, GFP_KERNEL);
+       if (!sht->proc_name)
+               return 0;
+       strcpy(sht->proc_name, name);
+       sht->proc_dir = NULL;
+       us->host = scsi_register(sht, sizeof(us));
+       if (us->host) {
+               us->host->hostdata[0] = (unsigned long)us;
+               us->host_no = us->host->host_no;
+               return 1;
+       }
+       kfree(sht->proc_name);
+       sht->proc_name = sht->name = NULL;
        return 0;
-    strcpy(sht->proc_name, name);
-    sht->proc_dir = NULL;
-    us->host = scsi_register(sht, sizeof(us));
-    if (us->host) {
-       us->host->hostdata[0] = (unsigned long)us;
-       us->host_no = us->host->host_no;
-       return 1;
-    }
-    kfree(sht->proc_name);
-    sht->proc_name = sht->name = NULL;
-    return 0;
 }
 
 /* release - must be here to stop scsi
@@ -628,71 +628,71 @@ static int us_detect(struct SHT *sht)
  */
 static int us_release(struct Scsi_Host *psh)
 {
-    struct us_data *us = (struct us_data *)psh->hostdata[0];
-    struct us_data *prev = (struct us_data *)&us_list;
-
-    if (us->irq_handle) {
-       usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe);
-       us->irq_handle = NULL;
-    }
-    if (us->filter)
-       us->filter->release(us->fdata);
-    if (us->pusb_dev)
-       usb_deregister(&scsi_driver);
+       struct us_data *us = (struct us_data *)psh->hostdata[0];
+       struct us_data *prev = (struct us_data *)&us_list;
 
-    /* FIXME - leaves hanging host template copy */
-    /* (because scsi layer uses it after removal !!!) */
-    while (prev->next != us)
-       prev = prev->next;
-    prev->next = us->next;
-    return 0;
+       if (us->irq_handle) {
+               usb_release_irq(us->pusb_dev, us->irq_handle, us->irqpipe);
+               us->irq_handle = NULL;
+       }
+       if (us->filter)
+               us->filter->release(us->fdata);
+       if (us->pusb_dev)
+               usb_deregister(&scsi_driver);
+
+       /* FIXME - leaves hanging host template copy */
+       /* (because scsi layer uses it after removal !!!) */
+       while (prev->next != us)
+               prev = prev->next;
+       prev->next = us->next;
+       return 0;
 }
 
 /* run command */
 static int us_command( Scsi_Cmnd *srb )
 {
-    US_DEBUGP("Bad use of us_command\n");
+       US_DEBUGP("Bad use of us_command\n");
 
-    return DID_BAD_TARGET << 16;
+       return DID_BAD_TARGET << 16;
 }
 
 /* run command */
 static int us_queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *))
 {
-    struct us_data *us = (struct us_data *)srb->host->hostdata[0];
+       struct us_data *us = (struct us_data *)srb->host->hostdata[0];
 
-    US_DEBUGP("Command wakeup\n");
-    if (us->srb) {
-       /* busy */
-    }
-    srb->host_scribble = (unsigned char *)us;
-    us->srb = srb;
-    srb->scsi_done = done;
-    us->action = US_ACT_COMMAND;
+       US_DEBUGP("Command wakeup\n");
+       if (us->srb) {
+               /* busy */
+       }
+       srb->host_scribble = (unsigned char *)us;
+       us->srb = srb;
+       srb->scsi_done = done;
+       us->action = US_ACT_COMMAND;
 
-    /* wake up the process task */
+       /* wake up the process task */
 
-    wake_up_interruptible(&us->waitq);
+       wake_up_interruptible(&us->waitq);
 
-    return 0;
+       return 0;
 }
 
 static int us_abort( Scsi_Cmnd *srb )
 {
-    return 0;
+       return 0;
 }
 
 static int us_bus_reset( Scsi_Cmnd *srb )
 {
-    struct us_data *us = (struct us_data *)srb->host->hostdata[0];
+       struct us_data *us = (struct us_data *)srb->host->hostdata[0];
 
-    us->pop_reset(us);
-    return SUCCESS;
+       us->pop_reset(us);
+       return SUCCESS;
 }
 
 static int us_host_reset( Scsi_Cmnd *srb )
 {
-    return 0;
+       return 0;
 }
 
 #undef SPRINTF
@@ -700,62 +700,62 @@ static int us_host_reset( Scsi_Cmnd *srb )
 
 int usb_scsi_proc_info (char *buffer, char **start, off_t offset, int length, int hostno, int inout)
 {
-    struct us_data *us = us_list;
-    char *pos = buffer;
-    char *vendor;
-    char *product;
-    char *style = "";
-
-    /* find our data from hostno */
-
-    while (us) {
-       if (us->host_no == hostno)
-           break;
-       us = us->next;
-    }
-
-    if (!us)
-       return -ESRCH;
-
-    /* null on outward */
-
-    if (inout)
-       return length;
-
-    if (!us->pusb_dev || !(vendor = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iManufacturer)))
-       vendor = "?";
-    if (!us->pusb_dev || !(product = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iProduct)))
-       product = "?";
-
-    switch (us->protocol) {
-    case US_PR_CB:
-       style = "Control/Bulk";
-       break;
-
-    case US_PR_CBI:
-       style = "Control/Bulk/Interrupt";
-       break;
-
-    case US_PR_ZIP:
-       style = "Bulk only";
-       break;
-
-    }
-    SPRINTF ("Host scsi%d: usb-scsi\n", hostno);
-    SPRINTF ("Device: %s %s - GUID " GUID_FORMAT "\n", vendor, product, GUID_ARGS(us->guid) );
-    SPRINTF ("Style: %s\n", style);
-
-    /*
-     * Calculate start of next buffer, and return value.
-     */
-    *start = buffer + offset;
-
-    if ((pos - buffer) < offset)
-       return (0);
-    else if ((pos - buffer - offset) < length)
-       return (pos - buffer - offset);
-    else
-       return (length);
+       struct us_data *us = us_list;
+       char *pos = buffer;
+       char *vendor;
+       char *product;
+       char *style = "";
+
+       /* find our data from hostno */
+
+       while (us) {
+               if (us->host_no == hostno)
+                       break;
+               us = us->next;
+       }
+
+       if (!us)
+               return -ESRCH;
+
+       /* null on outward */
+
+       if (inout)
+               return length;
+
+       if (!us->pusb_dev || !(vendor = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iManufacturer)))
+               vendor = "?";
+       if (!us->pusb_dev || !(product = usb_string(us->pusb_dev, us->pusb_dev->descriptor.iProduct)))
+               product = "?";
+
+       switch (us->protocol) {
+       case US_PR_CB:
+               style = "Control/Bulk";
+               break;
+
+       case US_PR_CBI:
+               style = "Control/Bulk/Interrupt";
+               break;
+
+       case US_PR_ZIP:
+               style = "Bulk only";
+               break;
+
+       }
+       SPRINTF ("Host scsi%d: usb-scsi\n", hostno);
+       SPRINTF ("Device: %s %s - GUID " GUID_FORMAT "\n", vendor, product, GUID_ARGS(us->guid) );
+       SPRINTF ("Style: %s\n", style);
+
+       /*
+        * Calculate start of next buffer, and return value.
+        */
+       *start = buffer + offset;
+
+       if ((pos - buffer) < offset)
+               return (0);
+       else if ((pos - buffer - offset) < length)
+               return (pos - buffer - offset);
+       else
+               return (length);
 }
 
 /*
@@ -763,599 +763,599 @@ int usb_scsi_proc_info (char *buffer, char **start, off_t offset, int length, in
  */
 
 static Scsi_Host_Template my_host_template = {
-    NULL,                      /* next */
-    NULL,                      /* module */
-    NULL,                      /* proc_dir */
-    usb_scsi_proc_info,
-    NULL,                      /* name - points to unique */
-    us_detect,
-    us_release,
-    NULL,                      /* info */
-    NULL,                      /* ioctl */
-    us_command,
-    us_queuecommand,
-    NULL,                      /* eh_strategy */
-    us_abort,
-    us_bus_reset,
-    us_bus_reset,
-    us_host_reset,
-    NULL,                      /* abort */
-    NULL,                      /* reset */
-    NULL,                      /* slave_attach */
-    NULL,                      /* bios_param */
-    1,                         /* can_queue */
-    -1,                                /* this_id */
-    SG_ALL,                    /* sg_tablesize */
-    1,                         /* cmd_per_lun */
-    0,                         /* present */
-    FALSE,                     /* unchecked_isa_dma */
-    FALSE,                     /* use_clustering */
-    TRUE,                      /* use_new_eh_code */
-    TRUE                       /* emulated */
+       NULL,                   /* next */
+       NULL,                   /* module */
+       NULL,                   /* proc_dir */
+       usb_scsi_proc_info,
+       NULL,                   /* name - points to unique */
+       us_detect,
+       us_release,
+       NULL,                   /* info */
+       NULL,                   /* ioctl */
+       us_command,
+       us_queuecommand,
+       NULL,                   /* eh_strategy */
+       us_abort,
+       us_bus_reset,
+       us_bus_reset,
+       us_host_reset,
+       NULL,                   /* abort */
+       NULL,                   /* reset */
+       NULL,                   /* slave_attach */
+       NULL,                   /* bios_param */
+       1,                              /* can_queue */
+       -1,                             /* this_id */
+       SG_ALL,                 /* sg_tablesize */
+       1,                              /* cmd_per_lun */
+       0,                              /* present */
+       FALSE,                  /* unchecked_isa_dma */
+       FALSE,                  /* use_clustering */
+       TRUE,                   /* use_new_eh_code */
+       TRUE                    /* emulated */
 };
 
 static unsigned char sense_notready[] = {
-    0x70,                      /* current error */
-    0x00,
-    0x02,                      /* not ready */
-    0x00,
-    0x00,
-    10,                                /* additional length */
-    0x00,
-    0x00,
-    0x00,
-    0x00,
-    0x04,                      /* not ready */
-    0x03,                      /* manual intervention */
-    0x00,
-    0x00,
-    0x00,
-    0x00
+       0x70,                   /* current error */
+       0x00,
+       0x02,                   /* not ready */
+       0x00,
+       0x00,
+       10,                             /* additional length */
+       0x00,
+       0x00,
+       0x00,
+       0x00,
+       0x04,                   /* not ready */
+       0x03,                   /* manual intervention */
+       0x00,
+       0x00,
+       0x00,
+       0x00
 };
 
 static int usbscsi_control_thread(void * __us)
 {
-    struct us_data *us = (struct us_data *)__us;
-    int action;
-
-    lock_kernel();
-
-    /*
-     * This thread doesn't need any user-level access,
-     * so get rid of all our resources..
-     */
-    exit_mm(current);
-    exit_files(current);
-    //exit_fs(current);
-
-    sprintf(current->comm, "usbscsi%d", us->host_number);
-
-    unlock_kernel();
+       struct us_data *us = (struct us_data *)__us;
+       int action;
 
-    up(us->notify);
+       lock_kernel();
 
-    for(;;) {
-           siginfo_t info;
-           int unsigned long signr;
+       /*
+        * This thread doesn't need any user-level access,
+        * so get rid of all our resources..
+        */
+       exit_mm(current);
+       exit_files(current);
+       //exit_fs(current);
 
-           interruptible_sleep_on(&us->waitq);
+       sprintf(current->comm, "usbscsi%d", us->host_number);
 
-           action = us->action;
-           us->action = 0;
+       unlock_kernel();
 
-           switch (action) {
-           case US_ACT_COMMAND:
-               if (us->srb->target || us->srb->lun) {
-                   /* bad device */
-                   US_DEBUGP( "Bad device number (%d/%d) or dev %x\n",
-                       us->srb->target, us->srb->lun, (unsigned int)us->pusb_dev);
-                   us->srb->result = DID_BAD_TARGET << 16;
-               } else if (!us->pusb_dev) {
+       up(us->notify);
 
-                   /* our device has gone - pretend not ready */
+       for(;;) {
+               siginfo_t info;
+               int unsigned long signr;
 
-                   if (us->srb->cmnd[0] == REQUEST_SENSE) {
-                       memcpy(us->srb->request_buffer, sense_notready, sizeof(sense_notready));
-                       us->srb->result = DID_OK << 16;
-                   } else {
-                       us->srb->result = (DID_OK << 16) | 2;
-                   }
-               } else {
-                   US_DEBUG(us_show_command(us->srb));
-
-                   /* check for variable length - do properly if so */
-
-                   if (us->filter && us->filter->command)
-                       us->srb->result = us->filter->command(us->fdata, us->srb);
-                   else if (us->srb->cmnd[0] == START_STOP &&
-                            us->pusb_dev->descriptor.idProduct == 0x0001 &&
-                            us->pusb_dev->descriptor.idVendor == 0x04e6)
-                       us->srb->result = DID_OK << 16;
-                   else {
-                       unsigned int savelen = us->srb->request_bufflen;
-                       unsigned int saveallocation = 0;
-
-                       switch (us->srb->cmnd[0]) {
-                       case REQUEST_SENSE:
-                           if (us->srb->request_bufflen > 18)
-                               us->srb->request_bufflen = 18;
-                           else
-                               break;
-                           saveallocation = us->srb->cmnd[4];
-                           us->srb->cmnd[4] = 18;
-                           break;
-
-                       case INQUIRY:
-                           if (us->srb->request_bufflen > 36)
-                               us->srb->request_bufflen = 36;
-                           else
-                               break;
-                           saveallocation = us->srb->cmnd[4];
-                           us->srb->cmnd[4] = 36;
-                           break;
+               interruptible_sleep_on(&us->waitq);
 
-                       case MODE_SENSE:
-                           if (us->srb->request_bufflen > 4)
-                               us->srb->request_bufflen = 4;
-                           else
-                               break;
-                           saveallocation = us->srb->cmnd[4];
-                           us->srb->cmnd[4] = 4;
-                           break;
-
-                       case LOG_SENSE:
-                       case MODE_SENSE_10:
-                           if (us->srb->request_bufflen > 8)
-                               us->srb->request_bufflen = 8;
-                           else
-                               break;
-                           saveallocation = (us->srb->cmnd[7] << 8) | us->srb->cmnd[8];
-                           us->srb->cmnd[7] = 0;
-                           us->srb->cmnd[8] = 8;
-                           break;
+               action = us->action;
+               us->action = 0;
 
-                       default:
-                           break;
-                       } /* end switch on cmnd[0] */
-                       us->srb->result = us->pop(us->srb);
-
-                       if (savelen != us->srb->request_bufflen &&
-                           us->srb->result == (DID_OK << 16)) {
-                           unsigned char *p = (unsigned char *)us->srb->request_buffer;
-                           unsigned int length = 0;
-
-                           /* set correct length and retry */
-                           switch (us->srb->cmnd[0]) {
-                           case REQUEST_SENSE:
-                               /* simply return 18 bytes */
-                               p[7] = 10;
-                               length = us->srb->request_bufflen;;
-                               break;
-
-                           case INQUIRY:
-                               length = p[4] + 5 > savelen ? savelen : p[4] + 5;
-                               us->srb->cmnd[4] = length;
-                               break;
-
-                           case MODE_SENSE:
-                               length = p[0] + 4 > savelen ? savelen : p[0] + 4;
-                               us->srb->cmnd[4] = 4;
-                               break;
+               switch (action) {
+               case US_ACT_COMMAND:
+                       if (us->srb->target || us->srb->lun) {
+                               /* bad device */
+                               US_DEBUGP( "Bad device number (%d/%d) or dev %x\n",
+                                          us->srb->target, us->srb->lun, (unsigned int)us->pusb_dev);
+                               us->srb->result = DID_BAD_TARGET << 16;
+                       } else if (!us->pusb_dev) {
 
-                           case LOG_SENSE:
-                               length = ((p[2] << 8) + p[3]) + 4 > savelen ? savelen : ((p[2] << 8) + p[3]) + 4;
-                               us->srb->cmnd[7] = length >> 8;
-                               us->srb->cmnd[8] = length;
-                               break;
+                               /* our device has gone - pretend not ready */
 
-                           case MODE_SENSE_10:
-                               length = ((p[0] << 8) + p[1]) + 8 > savelen ? savelen : ((p[0] << 8) + p[1]) + 8;
-                               us->srb->cmnd[7] = length >> 8;
-                               us->srb->cmnd[8] = length;
-                               break;
-                           } /* end switch on cmnd[0] */
-
-                           US_DEBUGP("Old/New length = %d/%d\n",
-                               savelen, length);
-
-                           if (us->srb->request_bufflen != length) {
-                               US_DEBUGP("redoing cmd with len=%d\n", length);
-                               us->srb->request_bufflen = length;
-                               us->srb->result = us->pop(us->srb);
-                           }
-                           /* reset back to original values */
-
-                           us->srb->request_bufflen = savelen;
-                           switch (us->srb->cmnd[0]) {
-                           case REQUEST_SENSE:
-                           case INQUIRY:
-                           case MODE_SENSE:
-                               if (us->srb->use_sg == 0 && length > 0) {
-                                   int i;
-                                   printk(KERN_DEBUG "Data is");
-                                   for (i = 0; i < 32 && i < length; ++i)
-                                       printk(" %.2x", ((unsigned char *)us->srb->request_buffer)[i]);
-                                   if (i < length)
-                                       printk(" ...");
-                                   printk("\n");
+                               if (us->srb->cmnd[0] == REQUEST_SENSE) {
+                                       memcpy(us->srb->request_buffer, sense_notready, sizeof(sense_notready));
+                                       us->srb->result = DID_OK << 16;
+                               } else {
+                                       us->srb->result = (DID_OK << 16) | 2;
                                }
-                               us->srb->cmnd[4] = saveallocation;
-                               if (us->mode_xlate) {
-                                       /* convert MODE_SENSE_10 return data
-                                        * format to MODE_SENSE_6 format */
-                                       unsigned char *dta = (unsigned char *)us->srb->request_buffer;
-                                       dta[0] = dta[1];        /* data len */
-                                       dta[1] = dta[2];        /* med type */
-                                       dta[2] = dta[3];        /* dev-spec prm */
-                                       dta[3] = dta[7];        /* block desc len */
-                                       printk (KERN_DEBUG USB_SCSI "new MODE_SENSE_6 data = %.2X %.2X %.2X %.2X\n",
-                                               dta[0], dta[1], dta[2], dta[3]);
-                               }
-                               break;
-
-                           case LOG_SENSE:
-                           case MODE_SENSE_10:
-                               us->srb->cmnd[7] = saveallocation >> 8;
-                               us->srb->cmnd[8] = saveallocation;
-                               break;
-                           } /* end switch on cmnd[0] */
-                       }
-                       /* force attention on first command */
-                       if (!us->attention_done) {
-                           US_DEBUGP("forcing unit attention\n");
-                           if (us->srb->cmnd[0] == REQUEST_SENSE) {
-                               if (us->srb->result == (DID_OK << 16)) {
-                                   unsigned char *p = (unsigned char *)us->srb->request_buffer;
-
-                                   us->attention_done = 1;
-                                   if ((p[2] & 0x0f) != UNIT_ATTENTION) {
-                                       p[2] = UNIT_ATTENTION;
-                                       p[12] = 0x29;   /* power on, reset or bus-reset */
-                                       p[13] = 0;
-                                   }
+                       } else {
+                               US_DEBUG(us_show_command(us->srb));
+
+                               /* check for variable length - do properly if so */
+
+                               if (us->filter && us->filter->command)
+                                       us->srb->result = us->filter->command(us->fdata, us->srb);
+                               else if (us->srb->cmnd[0] == START_STOP &&
+                                        us->pusb_dev->descriptor.idProduct == 0x0001 &&
+                                        us->pusb_dev->descriptor.idVendor == 0x04e6)
+                                       us->srb->result = DID_OK << 16;
+                               else {
+                                       unsigned int savelen = us->srb->request_bufflen;
+                                       unsigned int saveallocation = 0;
+
+                                       switch (us->srb->cmnd[0]) {
+                                       case REQUEST_SENSE:
+                                               if (us->srb->request_bufflen > 18)
+                                                       us->srb->request_bufflen = 18;
+                                               else
+                                                       break;
+                                               saveallocation = us->srb->cmnd[4];
+                                               us->srb->cmnd[4] = 18;
+                                               break;
+
+                                       case INQUIRY:
+                                               if (us->srb->request_bufflen > 36)
+                                                       us->srb->request_bufflen = 36;
+                                               else
+                                                       break;
+                                               saveallocation = us->srb->cmnd[4];
+                                               us->srb->cmnd[4] = 36;
+                                               break;
+
+                                       case MODE_SENSE:
+                                               if (us->srb->request_bufflen > 4)
+                                                       us->srb->request_bufflen = 4;
+                                               else
+                                                       break;
+                                               saveallocation = us->srb->cmnd[4];
+                                               us->srb->cmnd[4] = 4;
+                                               break;
+
+                                       case LOG_SENSE:
+                                       case MODE_SENSE_10:
+                                               if (us->srb->request_bufflen > 8)
+                                                       us->srb->request_bufflen = 8;
+                                               else
+                                                       break;
+                                               saveallocation = (us->srb->cmnd[7] << 8) | us->srb->cmnd[8];
+                                               us->srb->cmnd[7] = 0;
+                                               us->srb->cmnd[8] = 8;
+                                               break;
+
+                                       default:
+                                               break;
+                                       } /* end switch on cmnd[0] */
+                                       us->srb->result = us->pop(us->srb);
+
+                                       if (savelen != us->srb->request_bufflen &&
+                                           us->srb->result == (DID_OK << 16)) {
+                                               unsigned char *p = (unsigned char *)us->srb->request_buffer;
+                                               unsigned int length = 0;
+
+                                               /* set correct length and retry */
+                                               switch (us->srb->cmnd[0]) {
+                                               case REQUEST_SENSE:
+                               /* simply return 18 bytes */
+                                                       p[7] = 10;
+                                                       length = us->srb->request_bufflen;;
+                                                       break;
+
+                                               case INQUIRY:
+                                                       length = p[4] + 5 > savelen ? savelen : p[4] + 5;
+                                                       us->srb->cmnd[4] = length;
+                                                       break;
+
+                                               case MODE_SENSE:
+                                                       length = p[0] + 4 > savelen ? savelen : p[0] + 4;
+                                                       us->srb->cmnd[4] = 4;
+                                                       break;
+
+                                               case LOG_SENSE:
+                                                       length = ((p[2] << 8) + p[3]) + 4 > savelen ? savelen : ((p[2] << 8) + p[3]) + 4;
+                                                       us->srb->cmnd[7] = length >> 8;
+                                                       us->srb->cmnd[8] = length;
+                                                       break;
+
+                                               case MODE_SENSE_10:
+                                                       length = ((p[0] << 8) + p[1]) + 8 > savelen ? savelen : ((p[0] << 8) + p[1]) + 8;
+                                                       us->srb->cmnd[7] = length >> 8;
+                                                       us->srb->cmnd[8] = length;
+                                                       break;
+                                               } /* end switch on cmnd[0] */
+
+                                               US_DEBUGP("Old/New length = %d/%d\n",
+                                                         savelen, length);
+
+                                               if (us->srb->request_bufflen != length) {
+                                                       US_DEBUGP("redoing cmd with len=%d\n", length);
+                                                       us->srb->request_bufflen = length;
+                                                       us->srb->result = us->pop(us->srb);
+                                               }
+                                               /* reset back to original values */
+
+                                               us->srb->request_bufflen = savelen;
+                                               switch (us->srb->cmnd[0]) {
+                                               case REQUEST_SENSE:
+                                               case INQUIRY:
+                                               case MODE_SENSE:
+                                                       if (us->srb->use_sg == 0 && length > 0) {
+                                                               int i;
+                                                               printk(KERN_DEBUG "Data is");
+                                                               for (i = 0; i < 32 && i < length; ++i)
+                                                                       printk(" %.2x", ((unsigned char *)us->srb->request_buffer)[i]);
+                                                               if (i < length)
+                                                                       printk(" ...");
+                                                               printk("\n");
+                                                       }
+                                                       us->srb->cmnd[4] = saveallocation;
+                                                       if (us->mode_xlate) {
+                                                               /* convert MODE_SENSE_10 return data
+                                                                * format to MODE_SENSE_6 format */
+                                                               unsigned char *dta = (unsigned char *)us->srb->request_buffer;
+                                                               dta[0] = dta[1];        /* data len */
+                                                               dta[1] = dta[2];        /* med type */
+                                                               dta[2] = dta[3];        /* dev-spec prm */
+                                                               dta[3] = dta[7];        /* block desc len */
+                                                               printk (KERN_DEBUG USB_SCSI "new MODE_SENSE_6 data = %.2X %.2X %.2X %.2X\n",
+                                                                       dta[0], dta[1], dta[2], dta[3]);
+                                                       }
+                                                       break;
+
+                                               case LOG_SENSE:
+                                               case MODE_SENSE_10:
+                                                       us->srb->cmnd[7] = saveallocation >> 8;
+                                                       us->srb->cmnd[8] = saveallocation;
+                                                       break;
+                                               } /* end switch on cmnd[0] */
+                                       }
+                                       /* force attention on first command */
+                                       if (!us->attention_done) {
+                                               US_DEBUGP("forcing unit attention\n");
+                                               if (us->srb->cmnd[0] == REQUEST_SENSE) {
+                                                       if (us->srb->result == (DID_OK << 16)) {
+                                                               unsigned char *p = (unsigned char *)us->srb->request_buffer;
+
+                                                               us->attention_done = 1;
+                                                               if ((p[2] & 0x0f) != UNIT_ATTENTION) {
+                                                                       p[2] = UNIT_ATTENTION;
+                                                                       p[12] = 0x29;   /* power on, reset or bus-reset */
+                                                                       p[13] = 0;
+                                                               }
+                                                       }
+                                               } else if (us->srb->cmnd[0] != INQUIRY &&
+                                                          us->srb->result == (DID_OK << 16)) {
+                                                       us->srb->result |= 2;   /* force check condition */
+                                               }
+                                       }
                                }
-                           } else if (us->srb->cmnd[0] != INQUIRY &&
-                                   us->srb->result == (DID_OK << 16)) {
-                               us->srb->result |= 2;   /* force check condition */
-                           }
                        }
-                   }
-               }
-               US_DEBUGP("scsi cmd done, result=%x\n", us->srb->result);
-               us->srb->scsi_done(us->srb);
-               us->srb = NULL;
-               break;
+                       US_DEBUGP("scsi cmd done, result=%x\n", us->srb->result);
+                       us->srb->scsi_done(us->srb);
+                       us->srb = NULL;
+                       break;
 
-           case US_ACT_ABORT:
-               break;
+               case US_ACT_ABORT:
+                       break;
 
-           case US_ACT_DEVICE_RESET:
-               break;
+               case US_ACT_DEVICE_RESET:
+                       break;
 
-           case US_ACT_BUS_RESET:
-               break;
+               case US_ACT_BUS_RESET:
+                       break;
 
-           case US_ACT_HOST_RESET:
-               break;
+               case US_ACT_HOST_RESET:
+                       break;
 
-           } /* end switch on action */
+               } /* end switch on action */
 
-           if (signal_pending(current)) {
-                   /* sending SIGUSR1 makes us print out some info */
-                   spin_lock_irq(&current->sigmask_lock);
-                   signr = dequeue_signal(&current->blocked, &info);
-                   spin_unlock_irq(&current->sigmask_lock);
+               if (signal_pending(current)) {
+                       /* sending SIGUSR1 makes us print out some info */
+                       spin_lock_irq(&current->sigmask_lock);
+                       signr = dequeue_signal(&current->blocked, &info);
+                       spin_unlock_irq(&current->sigmask_lock);
 
-                   if (signr == SIGUSR2) {
-                           usbscsi_debug = !usbscsi_debug;
-                           printk(USB_SCSI "debug toggle = %d\n", usbscsi_debug);
-                   } else {
-                           break;      /* exit the loop on any other signal */
-                   }
-           }
-    }
+                       if (signr == SIGUSR2) {
+                               usbscsi_debug = !usbscsi_debug;
+                               printk(USB_SCSI "debug toggle = %d\n", usbscsi_debug);
+                       } else {
+                               break;  /* exit the loop on any other signal */
+                       }
+               }
+       }
 
-    MOD_DEC_USE_COUNT;
+       MOD_DEC_USE_COUNT;
 
-    printk("usbscsi_control_thread exiting\n");
+       printk("usbscsi_control_thread exiting\n");
 
-    return 0;
+       return 0;
 }      
 
 static void * scsi_probe(struct usb_device *dev, unsigned int ifnum)
 {
-    struct usb_interface_descriptor *interface;
-    int i;
-    char *mf;          /* manufacturer */
-    char *prod;                /* product */
-    char *serial;              /* serial number */
-    struct us_data *ss = NULL;
-    struct usb_scsi_filter *filter = filters;
-    void *fdata = NULL;
-    unsigned int flags = 0;
-    GUID(guid);
-    struct us_data *prev;
-    Scsi_Host_Template *htmplt;
-    int protocol = 0;
-    int subclass = 0;
-
-    GUID_CLEAR(guid);
-    mf = usb_string(dev, dev->descriptor.iManufacturer);
-    prod = usb_string(dev, dev->descriptor.iProduct);
-    serial = usb_string(dev, dev->descriptor.iSerialNumber);
-
-    /* probe with filters first */
-
-    if (mf && prod)    {
-           while (filter) {
-                   if ((fdata = filter->probe(dev, mf, prod, serial)) != NULL) {
-                           flags = filter->flags;
-                           printk(KERN_INFO "USB Scsi filter %s\n", filter->name);
-                           break;
-                   }
-                   filter = filter->next;
-           }
-    }
-
-    /* generic devices next */
-
-    if (fdata == NULL) {
-
-       /* some exceptions */
-       if (dev->descriptor.idVendor == 0x04e6 &&
-           dev->descriptor.idProduct == 0x0001) {
-           /* shuttle E-USB */
-           protocol = US_PR_CB;
-           subclass = US_SC_8070;      /* an assumption */
-       } else if (dev->descriptor.bDeviceClass != 0 ||
-           dev->actconfig->interface[ifnum].altsetting[0].bInterfaceClass !=
-               USB_CLASS_MASS_STORAGE ||
-           dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass < US_SC_MIN ||
-           dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass > US_SC_MAX) {
-           return NULL;
+       struct usb_interface_descriptor *interface;
+       int i;
+       char *mf;               /* manufacturer */
+       char *prod;             /* product */
+       char *serial;           /* serial number */
+       struct us_data *ss = NULL;
+       struct usb_scsi_filter *filter = filters;
+       void *fdata = NULL;
+       unsigned int flags = 0;
+       GUID(guid);
+       struct us_data *prev;
+       Scsi_Host_Template *htmplt;
+       int protocol = 0;
+       int subclass = 0;
+
+       GUID_CLEAR(guid);
+       mf = usb_string(dev, dev->descriptor.iManufacturer);
+       prod = usb_string(dev, dev->descriptor.iProduct);
+       serial = usb_string(dev, dev->descriptor.iSerialNumber);
+
+       /* probe with filters first */
+
+       if (mf && prod) {
+               while (filter) {
+                       if ((fdata = filter->probe(dev, mf, prod, serial)) != NULL) {
+                               flags = filter->flags;
+                               printk(KERN_INFO "USB Scsi filter %s\n", filter->name);
+                               break;
+                       }
+                       filter = filter->next;
+               }
+       }
+
+       /* generic devices next */
+
+       if (fdata == NULL) {
+
+               /* some exceptions */
+               if (dev->descriptor.idVendor == 0x04e6 &&
+                   dev->descriptor.idProduct == 0x0001) {
+                       /* shuttle E-USB */
+                       protocol = US_PR_CB;
+                       subclass = US_SC_8070;  /* an assumption */
+               } else if (dev->descriptor.bDeviceClass != 0 ||
+                          dev->actconfig->interface[ifnum].altsetting[0].bInterfaceClass !=
+                          USB_CLASS_MASS_STORAGE ||
+                          dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass < US_SC_MIN ||
+                          dev->actconfig->interface[ifnum].altsetting[0].bInterfaceSubClass > US_SC_MAX) {
+                       return NULL;
+               }
+
+               /* now check if we have seen it before */
+
+               if (dev->descriptor.iSerialNumber &&
+                   usb_string(dev, dev->descriptor.iSerialNumber) ) {
+                       make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct,
+                                 usb_string(dev, dev->descriptor.iSerialNumber));
+               } else {
+                       make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct,
+                                 "0");
+               }
+               for (ss = us_list; ss; ss = ss->next) {
+                       if (!ss->pusb_dev && GUID_EQUAL(guid, ss->guid))        {
+                               US_DEBUGP("Found existing GUID " GUID_FORMAT "\n",
+                                         GUID_ARGS(guid));
+                               flags = ss->flags;
+                               break;
+                       }
+               }
        }
 
-       /* now check if we have seen it before */
+       if (!ss) {
+               if ((ss = (struct us_data *)kmalloc(sizeof(*ss), GFP_KERNEL)) == NULL) {
+                       printk(KERN_WARNING USB_SCSI "Out of memory\n");
+                       if (filter)
+                               filter->release(fdata);
+                       return NULL;
+               }
+               memset(ss, 0, sizeof(struct us_data));
+       }
 
-       if (dev->descriptor.iSerialNumber &&
-           usb_string(dev, dev->descriptor.iSerialNumber) ) {
-           make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct,
-               usb_string(dev, dev->descriptor.iSerialNumber));
+       interface = &dev->actconfig->interface[ifnum].altsetting[0];
+       ss->filter = filter;
+       ss->fdata = fdata;
+       ss->flags = flags;
+       if (subclass) {
+               ss->subclass = subclass;
+               ss->protocol = protocol;
        } else {
-           make_guid(guid, dev->descriptor.idVendor, dev->descriptor.idProduct,
-               "0");
+               ss->subclass = interface->bInterfaceSubClass;
+               ss->protocol = interface->bInterfaceProtocol;
        }
-       for (ss = us_list; ss; ss = ss->next) {
-           if (!ss->pusb_dev && GUID_EQUAL(guid, ss->guid))    {
-               US_DEBUGP("Found existing GUID " GUID_FORMAT "\n",
-                       GUID_ARGS(guid));
-               flags = ss->flags;
+       ss->attention_done = 0;
+
+       /* set the protocol op */
+
+       US_DEBUGP("Protocol ");
+       switch (ss->protocol) {
+       case US_PR_CB:
+               US_DEBUGPX("Control/Bulk\n");
+               ss->pop = pop_CBI;
+               ss->pop_reset = pop_CB_reset;
+               break;
+
+       case US_PR_CBI:
+               US_DEBUGPX("Control/Bulk/Interrupt\n");
+               ss->pop = pop_CBI;
+               ss->pop_reset = pop_CB_reset;
+               break;
+
+       default:
+               US_DEBUGPX("Bulk\n");
+               ss->pop = pop_Bulk;
+               ss->pop_reset = pop_Bulk_reset;
                break;
-           }
-       }
-    }
-
-    if (!ss) {
-       if ((ss = (struct us_data *)kmalloc(sizeof(*ss), GFP_KERNEL)) == NULL) {
-           printk(KERN_WARNING USB_SCSI "Out of memory\n");
-           if (filter)
-                   filter->release(fdata);
-           return NULL;
        }
-       memset(ss, 0, sizeof(struct us_data));
-    }
-
-    interface = &dev->actconfig->interface[ifnum].altsetting[0];
-    ss->filter = filter;
-    ss->fdata = fdata;
-    ss->flags = flags;
-    if (subclass) {
-       ss->subclass = subclass;
-       ss->protocol = protocol;
-    } else {
-       ss->subclass = interface->bInterfaceSubClass;
-       ss->protocol = interface->bInterfaceProtocol;
-    }
-    ss->attention_done = 0;
-
-    /* set the protocol op */
-
-    US_DEBUGP("Protocol ");
-    switch (ss->protocol) {
-    case US_PR_CB:
-       US_DEBUGPX("Control/Bulk\n");
-       ss->pop = pop_CBI;
-       ss->pop_reset = pop_CB_reset;
-       break;
-
-    case US_PR_CBI:
-       US_DEBUGPX("Control/Bulk/Interrupt\n");
-       ss->pop = pop_CBI;
-       ss->pop_reset = pop_CB_reset;
-       break;
-
-    default:
-       US_DEBUGPX("Bulk\n");
-       ss->pop = pop_Bulk;
-       ss->pop_reset = pop_Bulk_reset;
-       break;
-    }
-
-    /*
-     * We are expecting a minimum of 2 endpoints - in and out (bulk).
-     * An optional interrupt is OK (necessary for CBI protocol).
-     * We will ignore any others.
-     */
-
-    for (i = 0; i < interface->bNumEndpoints; i++) {
-           if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-                       == USB_ENDPOINT_XFER_BULK) {
-                   if (interface->endpoint[i].bEndpointAddress & USB_DIR_IN)
-                           ss->ep_in = interface->endpoint[i].bEndpointAddress &
-                               USB_ENDPOINT_NUMBER_MASK;
-                   else
-                           ss->ep_out = interface->endpoint[i].bEndpointAddress &
-                               USB_ENDPOINT_NUMBER_MASK;
-           } else if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-                       == USB_ENDPOINT_XFER_INT) {
-                   ss->ep_int = interface->endpoint[i].bEndpointAddress &
+
+       /*
+        * We are expecting a minimum of 2 endpoints - in and out (bulk).
+        * An optional interrupt is OK (necessary for CBI protocol).
+        * We will ignore any others.
+        */
+
+       for (i = 0; i < interface->bNumEndpoints; i++) {
+               if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
+                   == USB_ENDPOINT_XFER_BULK) {
+                       if (interface->endpoint[i].bEndpointAddress & USB_DIR_IN)
+                               ss->ep_in = interface->endpoint[i].bEndpointAddress &
+                                       USB_ENDPOINT_NUMBER_MASK;
+                       else
+                               ss->ep_out = interface->endpoint[i].bEndpointAddress &
+                                       USB_ENDPOINT_NUMBER_MASK;
+               } else if ((interface->endpoint[i].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
+                          == USB_ENDPOINT_XFER_INT) {
+                       ss->ep_int = interface->endpoint[i].bEndpointAddress &
                                USB_ENDPOINT_NUMBER_MASK;
-           }
-    }
-    US_DEBUGP("Endpoints In %d Out %d Int %d\n",
-               ss->ep_in, ss->ep_out, ss->ep_int);
-
-    /* save the interface number */
-    ss->ifnum = ifnum;
-
-    /* exit if strange looking */
-
-    if (usb_set_interface(dev, interface->bInterfaceNumber, 0) ||
-       !ss->ep_in || !ss->ep_out || (ss->protocol == US_PR_CBI && ss->ep_int == 0)) {
-       US_DEBUGP("Problems with device\n");
-       if (ss->host) {
-           scsi_unregister_module(MODULE_SCSI_HA, ss->htmplt);
-           kfree(ss->htmplt->name);
-           kfree(ss->htmplt);
+               }
        }
-       if (filter)
-               filter->release(fdata);
-       kfree(ss);
-       return NULL;                    /* no endpoints */
-    }
-
-    if (dev->actconfig->iConfiguration && usb_string(dev, dev->actconfig->iConfiguration))
-       US_DEBUGP("Configuration %s\n",
-               usb_string(dev, dev->actconfig->iConfiguration));
-    if (interface->iInterface && usb_string(dev, interface->iInterface))
-       US_DEBUGP("Interface %s\n",
-               usb_string(dev, interface->iInterface));
-
-    ss->pusb_dev = dev;
-
-    /* Now generate a scsi host definition, and register with scsi above us */
-
-    if (!ss->host) {
-
-       /* make unique id if possible */
-
-       US_DEBUGP("New GUID " GUID_FORMAT "\n", GUID_ARGS(guid));
-       memcpy(ss->guid, guid, sizeof(guid));
-
-       /* set class specific stuff */
-
-       US_DEBUGP("SubClass ");
-       switch (ss->subclass) {
-       case US_SC_RBC:
-           US_DEBUGPX("Reduced Block Commands\n");
-           break;
-       case US_SC_8020:
-           US_DEBUGPX("8020\n");
-           break;
-       case US_SC_QIC:
-           US_DEBUGPX("QIC157\n");
-           break;
-       case US_SC_8070:
-           US_DEBUGPX("8070\n");
-           ss->flags |= US_FL_FIXED_COMMAND;
-           ss->fixedlength = 12;
-           break;
-       case US_SC_SCSI:
-           US_DEBUGPX("Transparent SCSI\n");
-           break;
-       case US_SC_UFI:
-           US_DEBUGPX(" UFF\n");
-           ss->flags |= US_FL_FIXED_COMMAND;
-           ss->fixedlength = 12;
-           break;
+       US_DEBUGP("Endpoints In %d Out %d Int %d\n",
+                 ss->ep_in, ss->ep_out, ss->ep_int);
 
-       default:
-           break;
-       }
+       /* save the interface number */
+       ss->ifnum = ifnum;
 
-       /* create unique host template */
+       /* exit if strange looking */
 
-       if ((htmplt = (Scsi_Host_Template *)kmalloc(sizeof(*ss->htmplt), GFP_KERNEL)) == NULL ) {
-           printk(KERN_WARNING USB_SCSI "Out of memory\n");
-           if (filter)
-                   filter->release(fdata);
-           kfree(ss);
-           return NULL;
+       if (usb_set_interface(dev, interface->bInterfaceNumber, 0) ||
+           !ss->ep_in || !ss->ep_out || (ss->protocol == US_PR_CBI && ss->ep_int == 0)) {
+               US_DEBUGP("Problems with device\n");
+               if (ss->host) {
+                       scsi_unregister_module(MODULE_SCSI_HA, ss->htmplt);
+                       kfree(ss->htmplt->name);
+                       kfree(ss->htmplt);
+               }
+               if (filter)
+                       filter->release(fdata);
+               kfree(ss);
+               return NULL;                    /* no endpoints */
        }
-       memcpy(htmplt, &my_host_template, sizeof(my_host_template));
-       ss->host_number = my_host_number++;
-
-       (struct us_data *)htmplt->proc_dir = ss;
-
-       if (dev->descriptor.idVendor == 0x04e6 &&
-           dev->descriptor.idProduct == 0x0001) {
-           __u8 qstat[2];
-           int result;
-
-           /* shuttle E-USB */
-           result = usb_control_msg(ss->pusb_dev, usb_rcvctrlpipe(dev,0),
-                       1, 0xC0,
-                       0, ss->ifnum,
-                       qstat, 2, HZ*5);
-           US_DEBUGP("C0 status %x %x\n", qstat[0], qstat[1]);
-           init_waitqueue_head(&ss->ip_waitq);
-           ss->irqpipe = usb_rcvintpipe(ss->pusb_dev, ss->ep_int);
-           result = usb_request_irq(ss->pusb_dev, ss->irqpipe, pop_CBI_irq,
-                               IRQ_PERIOD, (void *)ss, &ss->irq_handle);
-           if (result)
-               return NULL;
-
-           interruptible_sleep_on_timeout(&ss->ip_waitq, HZ*6);
+
+       if (dev->actconfig->iConfiguration && usb_string(dev, dev->actconfig->iConfiguration))
+               US_DEBUGP("Configuration %s\n",
+                         usb_string(dev, dev->actconfig->iConfiguration));
+       if (interface->iInterface && usb_string(dev, interface->iInterface))
+               US_DEBUGP("Interface %s\n",
+                         usb_string(dev, interface->iInterface));
+
+       ss->pusb_dev = dev;
+
+       /* Now generate a scsi host definition, and register with scsi above us */
+
+       if (!ss->host) {
+
+               /* make unique id if possible */
+
+               US_DEBUGP("New GUID " GUID_FORMAT "\n", GUID_ARGS(guid));
+               memcpy(ss->guid, guid, sizeof(guid));
+
+               /* set class specific stuff */
+
+               US_DEBUGP("SubClass ");
+               switch (ss->subclass) {
+               case US_SC_RBC:
+                       US_DEBUGPX("Reduced Block Commands\n");
+                       break;
+               case US_SC_8020:
+                       US_DEBUGPX("8020\n");
+                       break;
+               case US_SC_QIC:
+                       US_DEBUGPX("QIC157\n");
+                       break;
+               case US_SC_8070:
+                       US_DEBUGPX("8070\n");
+                       ss->flags |= US_FL_FIXED_COMMAND;
+                       ss->fixedlength = 12;
+                       break;
+               case US_SC_SCSI:
+                       US_DEBUGPX("Transparent SCSI\n");
+                       break;
+               case US_SC_UFI:
+                       US_DEBUGPX(" UFF\n");
+                       ss->flags |= US_FL_FIXED_COMMAND;
+                       ss->fixedlength = 12;
+                       break;
+
+               default:
+                       break;
+               }
+
+               /* create unique host template */
+
+               if ((htmplt = (Scsi_Host_Template *)kmalloc(sizeof(*ss->htmplt), GFP_KERNEL)) == NULL ) {
+                       printk(KERN_WARNING USB_SCSI "Out of memory\n");
+                       if (filter)
+                               filter->release(fdata);
+                       kfree(ss);
+                       return NULL;
+               }
+               memcpy(htmplt, &my_host_template, sizeof(my_host_template));
+               ss->host_number = my_host_number++;
+
+               (struct us_data *)htmplt->proc_dir = ss;
+
+               if (dev->descriptor.idVendor == 0x04e6 &&
+                   dev->descriptor.idProduct == 0x0001) {
+                       __u8 qstat[2];
+                       int result;
+
+                       /* shuttle E-USB */
+                       result = usb_control_msg(ss->pusb_dev, usb_rcvctrlpipe(dev,0),
+                                                1, 0xC0,
+                                                0, ss->ifnum,
+                                                qstat, 2, HZ*5);
+                       US_DEBUGP("C0 status %x %x\n", qstat[0], qstat[1]);
+                       init_waitqueue_head(&ss->ip_waitq);
+                       ss->irqpipe = usb_rcvintpipe(ss->pusb_dev, ss->ep_int);
+                       result = usb_request_irq(ss->pusb_dev, ss->irqpipe, pop_CBI_irq,
+                                                IRQ_PERIOD, (void *)ss, &ss->irq_handle);
+                       if (result)
+                               return NULL;
+
+                       interruptible_sleep_on_timeout(&ss->ip_waitq, HZ*6);
 #ifdef REWRITE_PROJECT
-           /* FIXME: Don't know if this release_irq() call is at the
-               right place/time. */
-           usb_release_irq(ss->pusb_dev, ss->irq_handle, ss->irqpipe);
-           ss->irq_handle = NULL;
+                       /* FIXME: Don't know if this release_irq() call is at the
+                          right place/time. */
+                       usb_release_irq(ss->pusb_dev, ss->irq_handle, ss->irqpipe);
+                       ss->irq_handle = NULL;
 #endif
 
-       } else if (ss->protocol == US_PR_CBI)
-           init_waitqueue_head(&ss->ip_waitq);
+               } else if (ss->protocol == US_PR_CBI)
+                       init_waitqueue_head(&ss->ip_waitq);
 
-       /* start up our thread */
+               /* start up our thread */
 
-       {
-           DECLARE_MUTEX_LOCKED(sem);
+               {
+                       DECLARE_MUTEX_LOCKED(sem);
 
-           init_waitqueue_head(&ss->waitq);
+                       init_waitqueue_head(&ss->waitq);
 
-           ss->notify = &sem;
-           ss->pid = kernel_thread(usbscsi_control_thread, ss,
-                   CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
-           if (ss->pid < 0) {
-               printk(KERN_WARNING USB_SCSI "Unable to start control thread\n");
-               kfree(htmplt);
-               if (filter)
-                       filter->release(fdata);
-               kfree(ss);
-               return NULL;
-           }
+                       ss->notify = &sem;
+                       ss->pid = kernel_thread(usbscsi_control_thread, ss,
+                                               CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+                       if (ss->pid < 0) {
+                               printk(KERN_WARNING USB_SCSI "Unable to start control thread\n");
+                               kfree(htmplt);
+                               if (filter)
+                                       filter->release(fdata);
+                               kfree(ss);
+                               return NULL;
+                       }
 
-           /* wait for it to start */
+                       /* wait for it to start */
 
-           down(&sem);
-       }
+                       down(&sem);
+               }
 
-       /* now register - our detect function will be called */
+               /* now register - our detect function will be called */
 
-       scsi_register_module(MODULE_SCSI_HA, htmplt);
+               scsi_register_module(MODULE_SCSI_HA, htmplt);
 
-       /* put us in the list */
+               /* put us in the list */
 
-       prev = (struct us_data *)&us_list;
-       while (prev->next)
-           prev = prev->next;
-       prev->next = ss;
-    }
+               prev = (struct us_data *)&us_list;
+               while (prev->next)
+                       prev = prev->next;
+               prev->next = ss;
+       }
 
-    printk(KERN_WARNING "DANGEROUS: USB SCSI driver data integrity not assured !!!\n");
-    printk(KERN_INFO "USB SCSI device found at address %d\n", dev->devnum);
+       printk(KERN_WARNING "DANGEROUS: USB SCSI driver data integrity not assured !!!\n");
+       printk(KERN_INFO "USB SCSI device found at address %d\n", dev->devnum);
 
-    return ss;
+       return ss;
 }
 
 static void scsi_disconnect(struct usb_device *dev, void *ptr)
@@ -1363,7 +1363,7 @@ static void scsi_disconnect(struct usb_device *dev, void *ptr)
        struct us_data *ss = ptr;
 
        if (!ss)
-           return;
+               return;
        if (ss->filter)
                ss->filter->release(ss->fdata);
        ss->pusb_dev = NULL;
index 821f6c68e16fca5c711d31535585df17280a4e30..3bfc3172d4e885dde43eea46c41600ef63bf604e 100644 (file)
@@ -22,7 +22,7 @@ fi
 # msdos filesystems
 tristate 'DOS FAT fs support' CONFIG_FAT_FS
 dep_tristate '  MSDOS fs support' CONFIG_MSDOS_FS $CONFIG_FAT_FS
-dep_tristate '  UMSDOS: Unix-like filesystem on top of standard MSDOS filesystem' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS
+dep_tristate '    UMSDOS: Unix-like filesystem on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS
 dep_tristate '  VFAT (Windows-95) fs support' CONFIG_VFAT_FS $CONFIG_FAT_FS
 
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -37,11 +37,6 @@ else
    define_bool CONFIG_JOLIET n
 fi
 
-tristate 'UDF filesystem support (read only)' CONFIG_UDF_FS
-if [ "$CONFIG_UDF_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
-   bool '  UDF write support (DANGEROUS)' CONFIG_UDF_RW
-fi
-
 tristate 'Minix fs support' CONFIG_MINIX_FS
 tristate 'NTFS filesystem support (read only)' CONFIG_NTFS_FS
 if [ "$CONFIG_NTFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -68,6 +63,10 @@ tristate 'System V and Coherent filesystem support' CONFIG_SYSV_FS
 if [ "$CONFIG_SYSV_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
    bool '  SYSV filesystem write support (DANGEROUS)' CONFIG_SYSV_FS_WRITE
 fi
+tristate 'UDF filesystem support (read only)' CONFIG_UDF_FS
+if [ "$CONFIG_UDF_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
+   bool '  UDF write support (DANGEROUS)' CONFIG_UDF_RW
+fi
 tristate 'UFS filesystem support (read only)' CONFIG_UFS_FS
 if [ "$CONFIG_UFS_FS" != "n" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then
    bool '  UFS filesystem write support (DANGEROUS)' CONFIG_UFS_FS_WRITE
index f96f8cf7f0db90d93d1f9035a24f10f56e58df12..75a44c8d953ef9f8205ed3a1a6e122c889f70d79 100644 (file)
@@ -553,8 +553,7 @@ struct dentry * d_lookup(struct dentry * parent, struct qstr * name)
 /*
  * An insecure source has sent us a dentry, here we verify it.
  *
- * This is just to make knfsd able to have the dentry pointer
- * in the NFS file handle.
+ * This is used by ncpfs in its readdir implementation.
  *
  * NOTE! Do _not_ dereference the pointers before we have
  * validated them. We can test the pointer values, but we
index e86557e039312fa54e299d2f85c0d515fc8d1375..21a636a474891af0cd888a1d17273bd370efbb40 100644 (file)
@@ -42,7 +42,8 @@ void ext2_put_inode (struct inode * inode)
  */
 void ext2_delete_inode (struct inode * inode)
 {
-       if (inode->i_ino == EXT2_ACL_IDX_INO ||
+       if (is_bad_inode(inode) ||
+           inode->i_ino == EXT2_ACL_IDX_INO ||
            inode->i_ino == EXT2_ACL_DATA_INO)
                return;
        inode->u.ext2_i.i_dtime = CURRENT_TIME;
index b871745cde7f7b0e5c39faffbc21bbd918429f88..a9909cb497ee367bc3a625ab4669bf0669ba1bc2 100644 (file)
@@ -6,9 +6,7 @@ bool '  Proprietary file locking' CONFIG_NCPFS_IOCTL_LOCKING
 bool '  Clear remove/delete inhibit when needed' CONFIG_NCPFS_STRONG
 bool '  Use NFS namespace if available' CONFIG_NCPFS_NFS_NS
 bool '  Use LONG (OS/2) namespace if available' CONFIG_NCPFS_OS2_NS
-if [ "$CONFIG_NCPFS_OS2_NS" = "y" ]; then
-   bool '    Lowercase DOS filenames' CONFIG_NCPFS_SMALLDOS
-fi
+bool '  Lowercase DOS filenames' CONFIG_NCPFS_SMALLDOS
 bool '  Allow mounting of volume subdirectories' CONFIG_NCPFS_MOUNT_SUBDIR
 bool '  NDS authentication support' CONFIG_NCPFS_NDS_DOMAINS
 bool '  Use Native Language Support' CONFIG_NCPFS_NLS
index 96f6dc8a16cc46a19a27f34edb5f27c5e6b3ee51..31e414ebb32b1d0caa5c5e0e74d4630a1859f342 100644 (file)
@@ -4,7 +4,7 @@
  *  Copyright (C) 1995, 1996 by Volker Lendecke
  *  Modified for big endian by J.F. Chadima and David S. Miller
  *  Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
- *  Modified 1998 Wolfram Pienkoss for NLS
+ *  Modified 1998, 1999 Wolfram Pienkoss for NLS
  *  Modified 1999 Wolfram Pienkoss for directory caching
  *
  */
@@ -109,12 +109,6 @@ struct dentry_operations ncp_dentry_operations =
 };
 
 
-/*
- * XXX: It would be better to use the tolower from linux/ctype.h,
- * but _ctype is needed and it is not exported.
- */
-#define tolower(c) (((c) >= 'A' && (c) <= 'Z') ? (c)-('A'-'a') : (c))
-
 /*
  * Note: leave the hash unchanged if the directory
  * is case-sensitive.
@@ -122,13 +116,17 @@ struct dentry_operations ncp_dentry_operations =
 static int 
 ncp_hash_dentry(struct dentry *dentry, struct qstr *this)
 {
+       struct nls_table *t;
        unsigned long hash;
        int i;
 
+       t = NCP_IO_TABLE(dentry);
+
        if (!ncp_case_sensitive(dentry->d_inode)) {
                hash = init_name_hash();
                for (i=0; i<this->len ; i++)
-                       hash = partial_name_hash(tolower(this->name[i]),hash);
+                       hash = partial_name_hash(ncp_tolower(t, this->name[i]),
+                                                                       hash);
                this->hash = end_name_hash(hash);
        }
        return 0;
@@ -137,18 +135,13 @@ ncp_hash_dentry(struct dentry *dentry, struct qstr *this)
 static int
 ncp_compare_dentry(struct dentry *dentry, struct qstr *a, struct qstr *b)
 {
-       int i;
-
-       if (a->len != b->len) return 1;
+       if (a->len != b->len)
+               return 1;
 
        if (ncp_case_sensitive(dentry->d_inode))
-           return strncmp(a->name, b->name, a->len);
+               return strncmp(a->name, b->name, a->len);
 
-       for (i=0; i<a->len; i++)
-         if (tolower(a->name[i]) != tolower(b->name[i]))
-           return 1;
-
-       return 0;
+       return ncp_strnicmp(NCP_IO_TABLE(dentry), a->name, b->name, a->len);
 }
 
 /*
@@ -301,10 +294,9 @@ ncp_lookup_validate(struct dentry * dentry, int flags)
 {
        struct ncp_server *server;
        struct inode *dir = dentry->d_parent->d_inode;
-       int res, val = 0;
-       int len = dentry->d_name.len;      
        struct ncp_entry_info finfo;
-       __u8 __name[dentry->d_name.len + 1];
+       int res, val = 0, len = dentry->d_name.len + 1;
+       __u8 __name[len];
 
        if (!dentry->d_inode || !dir)
                goto finished;
@@ -324,45 +316,39 @@ ncp_lookup_validate(struct dentry * dentry, int flags)
        if (val)
                goto finished;
 
-       PPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld\n",
+       DDPRINTK("ncp_lookup_validate: %s/%s not valid, age=%ld, server lookup\n",
                dentry->d_parent->d_name.name, dentry->d_name.name,
                NCP_GET_AGE(dentry));
 
-       memcpy(__name, dentry->d_name.name, len);
-       __name[len] = '\0';
-
-       PPRINTK("ncp_lookup_validate: %s, len %d\n", __name, len);
-       PPRINTK("ncp_lookup_validate: server lookup for %s/%s\n",
-                       dentry->d_parent->d_name.name, __name);
-
        if (ncp_is_server_root(dir)) {
-               io2vol(server, __name, 1);
-               res = ncp_lookup_volume(server, __name, &(finfo.i));
+               res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, 1);
+               if (!res)
+                       res = ncp_lookup_volume(server, __name, &(finfo.i));
        } else {
-               io2vol(server, __name, !ncp_preserve_case(dir));
-               res = ncp_obtain_info(server, dir, __name, &(finfo.i));
+               res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, !ncp_preserve_case(dir));
+               if (!res)
+                       res = ncp_obtain_info(server, dir, __name, &(finfo.i));
        }
-       PPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
+       DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
                dentry->d_parent->d_name.name, __name, res);
        /*
         * If we didn't find it, or if it has a different dirEntNum to
         * what we remember, it's not valid any more.
         */
        if (!res) {
-               if (finfo.i.dirEntNum == NCP_FINFO(dentry->d_inode)->dirEntNum)
+               if (finfo.i.dirEntNum == NCP_FINFO(dentry->d_inode)->dirEntNum) {
+                       ncp_new_dentry(dentry);
                        val=1;
-               else
-                       PPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
+               else
+                       DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
 
-               vol2io(server, finfo.i.entryName,
-                       !ncp_preserve_entry_case(dir, finfo.i.NSCreator));
                ncp_update_inode2(dentry->d_inode, &finfo);
-               if (val)
-                       ncp_new_dentry(dentry);
        }
 
 finished:
-       PPRINTK("ncp_lookup_validate: result=%d\n", val);
+       DDPRINTK("ncp_lookup_validate: result=%d\n", val);
        return val;
 }
 
@@ -425,11 +411,12 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
                        goto out;
                next = next->next;
        }
-       dent = NULL;
+       return NULL;
+
 out:
-       if (dent)
-               if (dent->d_inode)
-                       return dget(dent);
+       if (dent->d_inode)
+               return dget(dent);
+
        return NULL;
 }
 
@@ -439,8 +426,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
        struct ncp_server *server = NCP_SERVER(inode);
        struct nw_info_struct i;
 
-       if (!ncp_conn_valid(server) ||
-           ncp_is_server_root(inode))
+       if (!ncp_conn_valid(server) || ncp_is_server_root(inode))
                return 0;
 
        if (ncp_obtain_info(server, inode, NULL, &i))
@@ -517,8 +503,7 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
                        ctl.page = find_lock_page(&inode->i_data, ctl.ofs);
                        if (!ctl.page)
                                goto invalid_cache;
-                       ctl.cache = (union ncp_dir_cache *)
-                                       kmap(ctl.page);
+                       ctl.cache = (union ncp_dir_cache *) kmap(ctl.page);
                        if (!Page_Uptodate(ctl.page))
                                goto invalid_cache;
                }
@@ -605,17 +590,19 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
 {
        struct dentry *newdent, *dentry = filp->f_dentry;
        struct inode *newino, *inode = dentry->d_inode;
-       struct ncp_server *server = NCP_SERVER(inode);
        struct ncp_cache_control ctl = *ctrl;
        struct qstr qname;
-       ino_t ino = 0;
        int valid = 0;
+       ino_t ino = 0;
+       __u8 __name[256];
 
-       vol2io(server, entry->i.entryName,
-               !ncp_preserve_entry_case(inode, entry->i.NSCreator));
+       qname.len = 256;
+       if (ncp_vol2io(NCP_SERVER(inode), __name, &qname.len,
+                       entry->i.entryName, entry->i.nameLen,
+                       !ncp_preserve_entry_case(inode, entry->i.NSCreator)))
+               return 1; /* I'm not sure */
 
-       qname.name = entry->i.entryName;
-       qname.len  = entry->i.nameLen;
+       qname.name = __name;
        qname.hash = full_name_hash(qname.name, qname.len);
 
        if (dentry->d_op && dentry->d_op->d_hash)
@@ -661,8 +648,7 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
                ctl.ofs  += 1;
                ctl.page  = grab_cache_page(&inode->i_data, ctl.ofs);
                if (ctl.page)
-                       ctl.cache = (union ncp_dir_cache *)
-                                       kmap(ctl.page);
+                       ctl.cache = (union ncp_dir_cache *) kmap(ctl.page);
        }
        if (ctl.cache) {
                ctl.cache->dentry[ctl.idx] = newdent;
@@ -677,8 +663,8 @@ end_advance:
                        ino = find_inode_number(dentry, &qname);
                if (!ino)
                        ino = iunique(inode->i_sb, 2);
-               ctl.filled = filldir(dirent, entry->i.entryName,
-                                       entry->i.nameLen, filp->f_pos, ino);
+               ctl.filled = filldir(dirent, qname.name, qname.len,
+                                                       filp->f_pos, ino);
                if (!ctl.filled)
                        filp->f_pos += 1;
        }
@@ -723,8 +709,9 @@ ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
        }
 }
 
-static void ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
-                               struct ncp_cache_control *ctl)
+static void
+ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
+                                               struct ncp_cache_control *ctl)
 {
        struct dentry *dentry = filp->f_dentry;
        struct inode *dir = dentry->d_inode;
@@ -760,19 +747,21 @@ int ncp_conn_logged_in(struct super_block *sb)
 {
        struct ncp_server* server = NCP_SBP(sb);
        struct nw_info_struct i;
-       int result;
+       int result, len = strlen(server->m.mounted_vol) + 1;
+       __u8 __name[len];
 
        if (ncp_single_volume(server)) {
                struct dentry* dent;
 
                result = -ENOENT;
-               io2vol(server, server->m.mounted_vol, 1);
-               if (ncp_lookup_volume(server, server->m.mounted_vol, &i)) {
+               if (ncp_io2vol(server, __name, &len, server->m.mounted_vol,
+                                                               len-1, 1))
+                       goto out;
+               if (ncp_lookup_volume(server, __name, &i)) {
                        PPRINTK("ncp_conn_logged_in: %s not found\n",
                                server->m.mounted_vol);
                        goto out;
                }
-               vol2io(server, i.entryName, 1);
                dent = sb->s_root;
                if (dent) {
                        struct inode* ino = dent->d_inode;
@@ -795,29 +784,29 @@ out:
 
 static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry)
 {
-       struct ncp_server *server;
+       struct ncp_server *server = NCP_SERVER(dir);
        struct inode *inode = NULL;
-       int error, res, len = dentry->d_name.len;
        struct ncp_entry_info finfo;
-       __u8 __name[dentry->d_name.len + 1];
-
-       server = NCP_SERVER(dir);
+       int error, res, len = dentry->d_name.len + 1;
+       __u8 __name[len];
 
        error = -EIO;
        if (!ncp_conn_valid(server))
                goto finished;
 
-       memcpy(__name, dentry->d_name.name, len);
-       __name[len] = '\0';
-       PPRINTK("ncp_lookup: %s, len %d\n", __name, len);
        PPRINTK("ncp_lookup: server lookup for %s/%s\n",
-               dentry->d_parent->d_name.name, __name);
+               dentry->d_parent->d_name.name, dentry->d_name.name);
+
        if (ncp_is_server_root(dir)) {
-               io2vol(server, __name, 1);
-               res = ncp_lookup_volume(server, __name, &(finfo.i));
+               res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, 1);
+               if (!res)
+                       res = ncp_lookup_volume(server, __name, &(finfo.i));
        } else {
-               io2vol(server, __name, !ncp_preserve_case(dir));
-               res = ncp_obtain_info(server, dir, __name, &(finfo.i));
+               res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, !ncp_preserve_case(dir));
+               if (!res)
+                       res = ncp_obtain_info(server, dir, __name, &(finfo.i));
        }
        PPRINTK("ncp_lookup: looked for %s/%s, res=%d\n",
                dentry->d_parent->d_name.name, __name, res);
@@ -827,9 +816,6 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry)
        if (res)
                goto add_entry;
 
-       vol2io(server, finfo.i.entryName,
-               !ncp_preserve_entry_case(dir, finfo.i.NSCreator));
-
        /*
         * Create an inode for the entry.
         */
@@ -839,10 +825,10 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry)
        inode = ncp_iget(dir->i_sb, &finfo);
 
        if (inode) {
+               ncp_new_dentry(dentry);
 add_entry:
                dentry->d_op = &ncp_dentry_operations;
                d_add(dentry, inode);
-               ncp_new_dentry(dentry);
                error = 0;
        }
 
@@ -879,10 +865,10 @@ out_close:
 int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode,
                int attributes)
 {
-       int error, result;
-       struct ncp_entry_info finfo;
        struct ncp_server *server = NCP_SERVER(dir);
-       __u8 _name[dentry->d_name.len + 1];
+       struct ncp_entry_info finfo;
+       int error, result, len = dentry->d_name.len + 1;
+       __u8 __name[len];
        
        PPRINTK("ncp_create_new: creating %s/%s, mode=%x\n",
                dentry->d_parent->d_name.name, dentry->d_name.name, mode);
@@ -891,16 +877,15 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode,
                goto out;
 
        ncp_age_dentry(server, dentry);
-
-       memcpy(_name, dentry->d_name.name, dentry->d_name.len);
-       _name[dentry->d_name.len] = '\0';
-
-       io2vol(server, _name, !ncp_preserve_case(dir));
+       error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, !ncp_preserve_case(dir));
+       if (error)
+               goto out;
 
        error = -EACCES;
-       result = ncp_open_create_file_or_subdir(server, dir, _name,
-                          OC_MODE_CREATE | OC_MODE_OPEN | OC_MODE_REPLACE,
-                          attributes, AR_READ | AR_WRITE, &finfo);
+       result = ncp_open_create_file_or_subdir(server, dir, __name,
+                               OC_MODE_CREATE | OC_MODE_OPEN | OC_MODE_REPLACE,
+                               attributes, AR_READ | AR_WRITE, &finfo);
        if (!result) {
                finfo.access = O_RDWR;
                error = ncp_instantiate(dir, dentry, &finfo);
@@ -921,10 +906,10 @@ static int ncp_create(struct inode *dir, struct dentry *dentry, int mode)
 
 static int ncp_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
-       int error;
        struct ncp_entry_info finfo;
        struct ncp_server *server = NCP_SERVER(dir);
-       __u8 _name[dentry->d_name.len + 1];
+       int error, len = dentry->d_name.len + 1;
+       __u8 __name[len];
 
        DPRINTK("ncp_mkdir: making %s/%s\n",
                dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -933,13 +918,13 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, int mode)
                goto out;
 
        ncp_age_dentry(server, dentry);
-
-       memcpy(_name, dentry->d_name.name, dentry->d_name.len);
-       _name[dentry->d_name.len] = '\0';
-       io2vol(server, _name, !ncp_preserve_case(dir));
+       error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, !ncp_preserve_case(dir));
+       if (error)
+               goto out;
 
        error = -EACCES;
-       if (ncp_open_create_file_or_subdir(server, dir, _name,
+       if (ncp_open_create_file_or_subdir(server, dir, __name,
                                           OC_MODE_CREATE, aDIR, 0xffff,
                                           &finfo) == 0)
        {
@@ -951,9 +936,9 @@ out:
 
 static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
 {
-       int error, result;
        struct ncp_server *server = NCP_SERVER(dir);
-       __u8 _name[dentry->d_name.len + 1];
+       int error, result, len = dentry->d_name.len + 1;
+       __u8 __name[len];
 
        DPRINTK("ncp_rmdir: removing %s/%s\n",
                dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -966,11 +951,12 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
        if (!list_empty(&dentry->d_hash))
                goto out;
 
-       memcpy(_name, dentry->d_name.name, dentry->d_name.len);
-       _name[dentry->d_name.len] = '\0';
-           
-       io2vol(server, _name, !ncp_preserve_case(dir));
-       result = ncp_del_file_or_subdir(server, dir, _name);
+       error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
+                                               len-1, !ncp_preserve_case(dir));
+       if (error)
+               goto out;
+
+       result = ncp_del_file_or_subdir(server, dir, __name);
        switch (result) {
                case 0x00:
                        error = 0;
@@ -1063,38 +1049,42 @@ out:
 static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
                      struct inode *new_dir, struct dentry *new_dentry)
 {
-       int old_len = old_dentry->d_name.len;
-       int new_len = new_dentry->d_name.len;
+       struct ncp_server *server = NCP_SERVER(old_dir);
        int error;
-       char _old_name[old_dentry->d_name.len + 1];
-       char _new_name[new_dentry->d_name.len + 1];
+       int old_len = old_dentry->d_name.len + 1;
+       int new_len = new_dentry->d_name.len + 1;
+       __u8 __old_name[old_len], __new_name[new_len];
 
        DPRINTK("ncp_rename: %s/%s to %s/%s\n",
                old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
                new_dentry->d_parent->d_name.name, new_dentry->d_name.name);
 
        error = -EIO;
-       if (!ncp_conn_valid(NCP_SERVER(old_dir)))
+       if (!ncp_conn_valid(server))
                goto out;
 
-       ncp_age_dentry(NCP_SERVER(old_dir), old_dentry);
-       ncp_age_dentry(NCP_SERVER(new_dir), new_dentry);
+       ncp_age_dentry(server, old_dentry);
+       ncp_age_dentry(server, new_dentry);
 
-       memcpy(_old_name, old_dentry->d_name.name, old_len);
-       _old_name[old_len] = '\0';
-       io2vol(NCP_SERVER(old_dir), _old_name, !ncp_preserve_case(old_dir));
+       error = ncp_io2vol(server, __old_name, &old_len,
+                                       old_dentry->d_name.name, old_len-1,
+                                       !ncp_preserve_case(old_dir));
+       if (error)
+               goto out;
 
-       memcpy(_new_name, new_dentry->d_name.name, new_len);
-       _new_name[new_len] = '\0';
-       io2vol(NCP_SERVER(new_dir), _new_name, !ncp_preserve_case(new_dir));
+       error = ncp_io2vol(server, __new_name, &new_len,
+                                       new_dentry->d_name.name, new_len-1,
+                                       !ncp_preserve_case(new_dir));
+       if (error)
+               goto out;
 
-       error = ncp_ren_or_mov_file_or_subdir(NCP_SERVER(old_dir),
-                                           old_dir, _old_name,
-                                           new_dir, _new_name);
+       error = ncp_ren_or_mov_file_or_subdir(server, old_dir, __old_name,
+                                                     new_dir, __new_name);
 #ifdef CONFIG_NCPFS_STRONG
-       if ((error == 0x90 || error == -EACCES) && NCP_SERVER(old_dir)->m.flags & NCP_MOUNT_STRONG) {   /* RO */
-               error = ncp_force_rename(old_dir, old_dentry, _old_name,
-                                         new_dir, new_dentry, _new_name);
+       if ((error == 0x90 || error == -EACCES) &&
+                       server->m.flags & NCP_MOUNT_STRONG) {   /* RO */
+               error = ncp_force_rename(old_dir, old_dentry, __old_name,
+                                        new_dir, new_dentry, __new_name);
        }
 #endif
        switch (error) {
index ec2c1a4e476b2438674eb8e6d861709ea3c4d073..26bd474d2a3748d52422d9ecc4162957c6ebac2a 100644 (file)
@@ -124,16 +124,15 @@ void ncp_update_inode2(struct inode* inode, struct ncp_entry_info *nwinfo)
        }
        inode->i_blocks = (inode->i_size + NCP_BLOCK_SIZE - 1) >> NCP_BLOCK_SHIFT;
 
-       inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwinfo->i.modifyTime),
-                                          le16_to_cpu(nwinfo->i.modifyDate));
-       inode->i_ctime = ncp_date_dos2unix(le16_to_cpu(nwinfo->i.creationTime),
-                                          le16_to_cpu(nwinfo->i.creationDate));
-       inode->i_atime = ncp_date_dos2unix(0,
-                                          le16_to_cpu(nwinfo->i.lastAccessDate));
+       inode->i_mtime = ncp_date_dos2unix(le16_to_cpu(nwi->modifyTime),
+                                          le16_to_cpu(nwi->modifyDate));
+       inode->i_ctime = ncp_date_dos2unix(le16_to_cpu(nwi->creationTime),
+                                          le16_to_cpu(nwi->creationDate));
+       inode->i_atime = ncp_date_dos2unix(0, le16_to_cpu(nwi->lastAccessDate));
 
-       NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum;
-       NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum;
-       NCP_FINFO(inode)->volNumber = nwinfo->i.volNumber;
+       NCP_FINFO(inode)->DosDirNum = nwi->DosDirNum;
+       NCP_FINFO(inode)->dirEntNum = nwi->dirEntNum;
+       NCP_FINFO(inode)->volNumber = nwi->volNumber;
 }
 
 /*
index 6bcc342335a3f03c223dc94896340a932db4ee17..36063db81390bc8882a876da4ea00e8a483b4bd0 100644 (file)
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 1995, 1996 by Volker Lendecke
  *  Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
- *  Modified 1998 Wolfram Pienkoss for NLS
+ *  Modified 1998, 1999 Wolfram Pienkoss for NLS
  *
  */
 
@@ -527,7 +527,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
 
                        codepage = NULL;
                        user.codepage[NCP_IOCSNAME_LEN] = 0;
-                       if (!user.codepage[0])
+                       if (!user.codepage[0] ||
+                                       !strcmp(user.codepage, "default"))
                                codepage = load_nls_default();
                        else {
                                codepage = load_nls(user.codepage);
@@ -538,13 +539,21 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
 
                        iocharset = NULL;
                        user.iocharset[NCP_IOCSNAME_LEN] = 0;
-                       if (user.iocharset[0] == 0)
+                       if (!user.iocharset[0] ||
+                                       !strcmp(user.iocharset, "default")) {
                                iocharset = load_nls_default();
-                       else {
-                               iocharset = load_nls(user.iocharset);
-                               if (!iocharset) {
-                                       unload_nls(codepage);
-                                       return -EBADRQC;
+                               NCP_CLR_FLAG(server, NCP_FLAG_UTF8);
+                       } else {
+                               if (!strcmp(user.iocharset, "utf8")) {
+                                       iocharset = load_nls_default();
+                                       NCP_SET_FLAG(server, NCP_FLAG_UTF8);
+                               } else {
+                                       iocharset = load_nls(user.iocharset);
+                                       if (!iocharset) {
+                                               unload_nls(codepage);
+                                               return -EBADRQC;
+                                       }
+                                       NCP_CLR_FLAG(server, NCP_FLAG_UTF8);
                                }
                        }
 
@@ -564,35 +573,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
        case NCP_IOC_GETCHARSETS: /* not tested */
                {
                        struct ncp_nls_ioctl user;
+                       int len;
 
                        memset(&user, 0, sizeof(user));
-                       if (server->nls_vol)
-                               if (server->nls_vol->charset) {
-                                       strncpy(user.codepage,
-                                               server->nls_vol->charset,
-                                               NCP_IOCSNAME_LEN);
-                                       user.codepage[NCP_IOCSNAME_LEN] = 0;
-                                       if (!strcmp(user.codepage, "default"))
-                                               /* unfortunately, we cannot set
-                                                  'default' charset... maybe
-                                                  we should change load_nls()?
-                                                  It is easy, do not initialize
-                                                  'tables' in fs/nls/nls_base.c
-                                                  with NULL, but with
-                                                  'default_table'... */
-                                               memset(user.codepage, 0,
-                                                       sizeof(user.codepage));
-                               }
+                       if (server->nls_vol && server->nls_vol->charset) {
+                               len = strlen(server->nls_vol->charset);
+                               if (len > NCP_IOCSNAME_LEN)
+                                       len = NCP_IOCSNAME_LEN;
+                               strncpy(user.codepage,
+                                               server->nls_vol->charset, len);
+                               user.codepage[len] = 0;
+                       }
 
-                       if (server->nls_io)
-                               if (server->nls_io->charset) {
+                       if (NCP_IS_FLAG(server, NCP_FLAG_UTF8))
+                               strcpy(user.iocharset, "utf8");
+                       else
+                               if (server->nls_io && server->nls_io->charset) {
+                                       len = strlen(server->nls_io->charset);
+                                       if (len > NCP_IOCSNAME_LEN)
+                                               len = NCP_IOCSNAME_LEN;
                                        strncpy(user.iocharset,
-                                               server->nls_io->charset,
-                                               NCP_IOCSNAME_LEN);
-                                       user.iocharset[NCP_IOCSNAME_LEN] = 0;
-                                       if (!strcmp(user.iocharset, "default"))
-                                               memset(user.iocharset, 0,
-                                                       sizeof(user.iocharset));
+                                               server->nls_io->charset, len);
+                                       user.iocharset[len] = 0;
                                }
 
                        if (copy_to_user((struct ncp_nls_ioctl*)arg, &user,
index 5dbd0c55ad181c3e47d51c2e15cd174abd05a99b..7220e4852bdeeafb913e64f8bc331d64253872df 100644 (file)
@@ -4,6 +4,7 @@
  *  Copyright (C) 1995, 1996 by Volker Lendecke
  *  Modified for big endian by J.F. Chadima and David S. Miller
  *  Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
+ *  Modified 1999 Wolfram Pienkoss for NLS
  *
  */
 
@@ -886,4 +887,225 @@ ncp_ClearPhysicalRecord(struct ncp_server *server, const char *file_id,
 }
 #endif /* CONFIG_NCPFS_IOCTL_LOCKING */
 
+#ifdef CONFIG_NCPFS_NLS
+/* This are the NLS conversion routines with inspirations and code parts
+ * from the vfat file system and hints from Petr Vandrovec.
+ */
+
+inline unsigned char
+ncp__tolower(struct nls_table *t, unsigned char c)
+{
+       unsigned char nc = t->charset2lower[c];
+
+       return nc ? nc : c;
+}
+
+inline unsigned char
+ncp__toupper(struct nls_table *t, unsigned char c)
+{
+       unsigned char nc = t->charset2upper[c];
+
+       return nc ? nc : c;
+}
+
+int
+ncp__io2vol(struct ncp_server *server, unsigned char *vname, unsigned int *vlen,
+               const unsigned char *iname, unsigned int ilen, int cc)
+{
+       struct nls_table *in = server->nls_io;
+       struct nls_table *out = server->nls_vol;
+       struct nls_unicode uc;
+       unsigned char nc, *up;
+       int i, k, maxlen = *vlen - 1;
+       __u16 ec;
+
+       *vlen = 0;
+
+       for (i = 0; i < ilen;) {
+               if (*vlen == maxlen)
+                       return -ENAMETOOLONG;
+
+               if (NCP_IS_FLAG(server, NCP_FLAG_UTF8)) {
+                       k = utf8_mbtowc(&ec, iname, ilen - i);
+                       if (k == -1)
+                               return -EINVAL;
+                       uc.uni1 = ec & 0xFF;
+                       uc.uni2 = ec >> 8;
+                       iname += k;
+                       i += k;
+               } else {
+                       if (*iname == NCP_ESC) {
+                               if (i > ilen - 5)
+                                       return -EINVAL;
+
+                               ec = 0;
+                               for (k = 1; k < 5; k++) {
+                                       nc = iname[k];
+                                       ec <<= 4;
+                                       if (nc >= '0' && nc <= '9') {
+                                               ec |= nc - '0';
+                                               continue;
+                                       }
+                                       if (nc >= 'a' && nc <= 'f') {
+                                               ec |= nc - ('a' - 10);
+                                               continue;
+                                       }
+                                       if (nc >= 'A' && nc <= 'F') {
+                                               ec |= nc - ('A' - 10);
+                                               continue;
+                                       }
+                                       return -EINVAL;
+                               }
+                               uc.uni1 = ec & 0xFF;
+                               uc.uni2 = ec >> 8;
+                               iname += 5;
+                               i += 5;
+                       } else {
+                               uc = in->charset2uni[*iname];
+                               iname++;
+                               i++;
+                       }
+               }
+
+               up = out->page_uni2charset[uc.uni2];
+               if (!up)
+                       return -EINVAL;
+
+               nc = up[uc.uni1];
+               if (!nc)
+                       return -EINVAL;
+
+               *vname = cc ? ncp_toupper(out, nc) : nc;
+               vname++;
+               *vlen += 1;
+       }
+
+       *vname = 0;
+       return 0;
+}
+
+int
+ncp__vol2io(struct ncp_server *server, unsigned char *iname, unsigned int *ilen,
+               const unsigned char *vname, unsigned int vlen, int cc)
+{
+       struct nls_table *in = server->nls_vol;
+       struct nls_table *out = server->nls_io;
+       struct nls_unicode uc;
+       unsigned char nc, *up;
+       int i, k, maxlen = *ilen - 1;
+       __u16 ec;
+
+       *ilen = 0;
+
+       for (i = 0; i < vlen; i++) {
+               if (*ilen == maxlen)
+                       return -ENAMETOOLONG;
+
+               uc = in->charset2uni[cc ? ncp_tolower(in, *vname) : *vname];
+
+               if (NCP_IS_FLAG(server, NCP_FLAG_UTF8)) {
+                       k = utf8_wctomb(iname, (uc.uni2 << 8) + uc.uni1,
+                                                               maxlen - *ilen);
+                       if (k == -1)
+                               return -ENAMETOOLONG;
+                       iname += k;
+                       *ilen += k;
+               } else {
+                       up = out->page_uni2charset[uc.uni2];
+                       if (up)
+                               nc = up[uc.uni1];
+                       else
+                               nc = 0;
+
+                       if (nc) {
+                               *iname = nc;
+                               iname++;
+                               *ilen += 1;
+                       } else {
+                               if (*ilen > maxlen - 5)
+                                       return -ENAMETOOLONG;
+                               ec = (uc.uni2 << 8) + uc.uni1;
+                               *iname = NCP_ESC;
+                               for (k = 4; k > 0; k--) {
+                                       nc = ec & 0xF;
+                                       iname[k] = nc > 9 ? nc + ('a' - 10)
+                                                         : nc + '0';
+                                       ec >>= 4;
+                               }
+                               iname += 5;
+                               *ilen += 5;
+                       }
+               }
+               vname++;
+       }
+
+       *iname = 0;
+       return 0;
+}
 
+#else
+
+int
+ncp__io2vol(unsigned char *vname, unsigned int *vlen,
+               const unsigned char *iname, unsigned int ilen, int cc)
+{
+       int i;
+
+       if (*vlen <= ilen)
+               return -ENAMETOOLONG;
+
+       if (cc)
+               for (i = 0; i < ilen; i++) {
+                       *vname = toupper(*iname);
+                       vname++;
+                       iname++;
+               }
+       else {
+               memmove(vname, iname, ilen);
+               vname += ilen;
+       }
+
+       *vlen = ilen;
+       *vname = 0;
+       return 0;
+}
+
+int
+ncp__vol2io(unsigned char *iname, unsigned int *ilen,
+               const unsigned char *vname, unsigned int vlen, int cc)
+{
+       int i;
+
+       if (*ilen <= vlen)
+               return -ENAMETOOLONG;
+
+       if (cc)
+               for (i = 0; i < vlen; i++) {
+                       *iname = tolower(*vname);
+                       iname++;
+                       vname++;
+               }
+       else {
+               memmove(iname, vname, vlen);
+               iname += vlen;
+       }
+
+       *ilen = vlen;
+       *iname = 0;
+       return 0;
+}
+
+#endif
+
+inline int
+ncp_strnicmp(struct nls_table *t, const unsigned char *s1,
+                                       const unsigned char *s2, int n)
+{
+       int i;
+
+       for (i=0; i<n; i++)
+               if (ncp_tolower(t, s1[i]) != ncp_tolower(t, s2[i]))
+                       return 1;
+
+       return 0;
+}
index 92309db268a0d33ee6eaab3239bf30319db9c83d..8b33a5c2e9b1b60d13a7da298dad453fcd1963a2 100644 (file)
@@ -4,7 +4,7 @@
  *  Copyright (C) 1995, 1996 by Volker Lendecke
  *  Modified for big endian by J.F. Chadima and David S. Miller
  *  Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
- *  Modified 1998 Wolfram Pienkoss for NLS
+ *  Modified 1998, 1999 Wolfram Pienkoss for NLS
  *  Modified 1999 Wolfram Pienkoss for directory caching
  *
  */
@@ -29,7 +29,9 @@
 
 #ifdef CONFIG_NCPFS_NLS
 #include <linux/nls.h>
-#endif
+#else
+#include <linux/ctype.h>
+#endif /* CONFIG_NCPFS_NLS */
 
 #include <linux/ncp_fs.h>
 
@@ -97,82 +99,40 @@ ncp_mount_subdir(struct ncp_server *, struct nw_info_struct *,
 #endif /* CONFIG_NCPFS_MOUNT_SUBDIR */
 
 #ifdef CONFIG_NCPFS_NLS
-/* This are the NLS conversion routines with inspirations and code parts
- * from the vfat file system and hints from Petr Vandrovec.
- */
 
-/*
- * It should be replaced by charset specifc conversion. Gordon Chaffee
- * has prepared some things, but I don't know, what he thinks about it.
- * The conversion tables for the io charsets should be generatable by
- * Unicode table, shouldn't it? I have written so generation code for it.
- * The tables for the vendor specific codepages...? Hmm. The Samba sources
- * contains also any hints.
- */
+inline unsigned char ncp__tolower(struct nls_table *, unsigned char);
+inline unsigned char ncp__toupper(struct nls_table *, unsigned char);
+int ncp__io2vol(struct ncp_server *, unsigned char *, unsigned int *,
+                               const unsigned char *, unsigned int, int);
+int ncp__vol2io(struct ncp_server *, unsigned char *, unsigned int *,
+                               const unsigned char *, unsigned int, int);
 
-#define toupperif(c, u) ((((u) != 0) && ((c) >= 'a') && ((c) <= 'z')) \
-                       ? (c)-('a'-'A') : (c))
-#define tolowerif(c, u) ((((u) != 0) && ((c) >= 'A') && ((c) <= 'Z')) \
-                       ? (c)-('A'-'a') : (c))
-
-static inline void
-io2vol(struct ncp_server *server, char *name, int case_trans)
-{
-       unsigned char nc;
-       unsigned char *np;
-       unsigned char *up;
-       struct nls_unicode uc;
-       struct nls_table *nls_in;
-       struct nls_table *nls_out;
-
-       nls_in = server->nls_io;
-       nls_out = server->nls_vol;
-       np = name;
-
-       while (*np)
-       {
-               nc = 0;
-               uc = nls_in->charset2uni[toupperif(*np, case_trans)];
-               up = nls_out->page_uni2charset[uc.uni2];
-               if (up != NULL) nc = up[uc.uni1];
-               if (nc != 0) *np = nc;
-               np++;
-       }
-}
-
-static inline void
-vol2io(struct ncp_server *server, char *name, int case_trans)
-{
-       unsigned char nc;
-       unsigned char *np;
-       unsigned char *up;
-       struct nls_unicode uc;
-       struct nls_table *nls_in;
-       struct nls_table *nls_out;
-
-       nls_in = server->nls_vol;
-       nls_out = server->nls_io;
-       np = name;
-
-       while (*np)
-       {
-               nc = 0;
-               uc = nls_in->charset2uni[*np];
-               up = nls_out->page_uni2charset[uc.uni2];
-               if (up != NULL) nc = up[uc.uni1];
-               if (nc == 0) nc = *np;
-               *np = tolowerif(nc, case_trans);
-               np++;
-       }
-}
+#define NCP_ESC                        ':'
+#define NCP_IO_TABLE(dentry)   (NCP_SERVER((dentry)->d_inode)->nls_io)
+#define ncp_tolower(t, c)      ncp__tolower(t, c)
+#define ncp_toupper(t, c)      ncp__toupper(t, c)
+#define ncp_io2vol(S,m,i,n,k,U)        ncp__io2vol(S,m,i,n,k,U)
+#define ncp_vol2io(S,m,i,n,k,U)        ncp__vol2io(S,m,i,n,k,U)
 
 #else
 
-#define io2vol(S,N,U) if (U) str_upper(N)
-#define vol2io(S,N,U) if (U) str_lower(N)
+int ncp__io2vol(unsigned char *, unsigned int *,
+                               const unsigned char *, unsigned int, int);
+int ncp__vol2io(unsigned char *, unsigned int *,
+                               const unsigned char *, unsigned int, int);
+
+#define NCP_IO_TABLE(dentry)   NULL
+#define ncp_tolower(t, c)      tolower(c)
+#define ncp_toupper(t, c)      toupper(c)
+#define ncp_io2vol(S,m,i,n,k,U)        ncp__io2vol(m,i,n,k,U)
+#define ncp_vol2io(S,m,i,n,k,U)        ncp__vol2io(m,i,n,k,U)
 
 #endif /* CONFIG_NCPFS_NLS */
 
+inline int
+ncp_strnicmp(struct nls_table *,
+               const unsigned char *, const unsigned char *, int);
+
 #define NCP_GET_AGE(dentry)    (jiffies - (dentry)->d_time)
 #define NCP_MAX_AGE(server)    ((server)->dentry_ttl)
 #define NCP_TEST_AGE(server,dentry)    (NCP_GET_AGE(dentry) < NCP_MAX_AGE(server))
index 5d6954df9b0a0928d862157a1a1d2066eef22105..58786a8da97efdc7104d6815f28a089305e23a07 100644 (file)
@@ -74,8 +74,8 @@ static struct dentry *ncp_follow_link(struct dentry *dentry,
                                      unsigned int follow)
 {
        struct inode *inode=dentry->d_inode;
-       int error, length, cnt;
-       char *link;
+       int error, length, len, cnt;
+       char *link, *buf;
 
 #ifdef DEBUG
        PRINTK("ncp_follow_link(dentry=%p,base=%p,follow=%u)\n",dentry,base,follow);
@@ -91,7 +91,7 @@ static struct dentry *ncp_follow_link(struct dentry *dentry,
                return ERR_PTR(-EIO);
        }
 
-       for (cnt = 0; (link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE+1, GFP_NFS))==NULL; cnt++) {
+       for (cnt = 0; (link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_NFS))==NULL; cnt++) {
                if (cnt > 10) {
                        dput(base);
                        return ERR_PTR(-EAGAIN); /* -ENOMEM? */
@@ -108,14 +108,25 @@ static struct dentry *ncp_follow_link(struct dentry *dentry,
                kfree(link);
                return ERR_PTR(-EIO);
        }
-       link[length]=0;
 
-       vol2io(NCP_SERVER(inode), link+8, 0);
+       len = NCP_MAX_SYMLINK_SIZE;
+       buf = (char *) kmalloc(len, GFP_NFS);
+       if (!buf) {
+               dput(base);
+               kfree(link);
+               return ERR_PTR(-EAGAIN);
+       }
+       error = ncp_vol2io(NCP_SERVER(inode), buf, &len, link+8, length-8, 0);
+       kfree(link);
+       if (error) {
+               dput(base);
+               kfree(buf);
+               return ERR_PTR(error);
+       }
        
        /* UPDATE_ATIME(inode); */
-       base=lookup_dentry(link+8, base, follow);
-       kfree(link);
+       base = lookup_dentry(buf, base, follow);
+       kfree(buf);
 
        return base;
 }
@@ -125,8 +136,8 @@ static struct dentry *ncp_follow_link(struct dentry *dentry,
 static int ncp_readlink(struct dentry * dentry, char * buffer, int buflen)
 {
        struct inode *inode=dentry->d_inode;
-       char *link;
-       int length,error;
+       char *link, *buf;
+       int length, len, error;
 
 #ifdef DEBUG
        PRINTK("ncp_readlink(dentry=%p,buffer=%p,buflen=%d)\n",dentry,buffer,buflen);
@@ -138,7 +149,7 @@ static int ncp_readlink(struct dentry * dentry, char * buffer, int buflen)
        if(ncp_make_open(inode,O_RDONLY))
                return -EIO;
 
-       if((link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE+1,GFP_NFS))==NULL)
+       if((link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE,GFP_NFS))==NULL)
                return -ENOMEM;
 
        error = ncp_read_kernel(NCP_SERVER(inode),NCP_FINFO(inode)->file_handle,
@@ -150,15 +161,25 @@ static int ncp_readlink(struct dentry * dentry, char * buffer, int buflen)
                goto out;
        }
 
-       link[length] = 0;
+       len = NCP_MAX_SYMLINK_SIZE;
+       buf = (char *) kmalloc(len, GFP_NFS);
+       if (!buf) {
+               error = -ENOMEM;
+               goto out;
+       }
+       error = ncp_vol2io(NCP_SERVER(inode), buf, &len, link+8, length-8, 0);
+       if (error || buflen < len) {
+               error = -EIO;
+               kfree(buf);
+               goto out;
+       }
 
-       vol2io(NCP_SERVER(inode), link+8, 0);
-       
-       error = length - 8;
-       if(copy_to_user(buffer, link+8, error))
+       error = len;
+       if(copy_to_user(buffer, buf, error))
                error = -EFAULT;
-      
-out:;
+       kfree(buf);
+
+out:
        kfree(link);
        return error;
 }
@@ -166,9 +187,9 @@ out:;
 /* ----- create a new symbolic link -------------------------------------- */
  
 int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
-       int i,length;
        struct inode *inode;
        char *link;
+       int length, err, i;
 
 #ifdef DEBUG
        PRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
@@ -177,7 +198,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
        if (!(NCP_SERVER(dir)->m.flags & NCP_MOUNT_SYMLINKS))
                return -EPERM;  /* EPERM is returned by VFS if symlink procedure does not exist */
 
-       if ((length=strlen(symname))>NCP_MAX_SYMLINK_SIZE)
+       if ((length=strlen(symname))>NCP_MAX_SYMLINK_SIZE-8)
                return -EINVAL;
 
        if ((link=(char *)kmalloc(length+9,GFP_NFS))==NULL)
@@ -192,12 +213,16 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
 
        ((__u32 *)link)[0]=NCP_SYMLINK_MAGIC0;
        ((__u32 *)link)[1]=NCP_SYMLINK_MAGIC1;
-       memcpy(link+8, symname, length+1); /* including last zero for io2vol */
 
        /* map to/from server charset, do not touch upper/lower case as
           symlink can point out of ncp filesystem */
-       io2vol(NCP_SERVER(inode), link+8, 0);
-       
+       length += 1;
+       err = ncp_io2vol(NCP_SERVER(inode),link+8,&length,symname,length-1,0);
+       if (err) {
+               kfree(link);
+               return err;
+       }
+
        if(ncp_write_kernel(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, 
                            0, length+8, link, &i) || i!=length+8) {
                kfree(link);
index 00b310e065b51cf70ba9b9504955de83edbd52a3..abf7f16f956826ff1cf63eb7b0547fd5716b22f7 100644 (file)
@@ -958,8 +958,6 @@ init_nfs_fs(void)
                return err;
 
 #ifdef CONFIG_PROC_FS
-       rpc_register_sysctl();
-       rpc_proc_init();
        rpc_proc_register(&nfs_rpcstat);
 #endif
         return register_filesystem(&nfs_fs_type);
index 9fd2ab9c7930e1af2c1a36fb152e2a6539d04ff6..c05a6304fae52e6b7b921393cbca8ec0db407345 100644 (file)
@@ -1,7 +1,10 @@
 /*
  * nfsproc2.c  Process version 2 NFS requests.
+ * linux/fs/nfsd/nfs2proc.c
+ * 
+ * Process version 2 NFS requests.
  *
- * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
+ * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
  */
 
 #include <linux/linkage.h>
@@ -144,7 +147,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
                                ntohl(rqstp->rq_addr.sin_addr.s_addr),
                                ntohs(rqstp->rq_addr.sin_port),
                                argp->count);
-               argp->count = avail;
+               argp->count = avail << 2;
        }
 
        resp->count = argp->count;
@@ -273,19 +276,22 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
                rdev = (dev_t) size;
                if (type != S_IFBLK && type != S_IFCHR) {
                        rdev = 0;
-               } else if (type == S_IFCHR && size == ~(u32) 0) {
+               } else if (type == S_IFCHR && !(attr->ia_valid & ATTR_SIZE)) {
                        /* If you think you've seen the worst, grok this. */
                        attr->ia_mode = S_IFIFO | mode;
                        type = S_IFIFO;
                } else if (size != rdev) {
                        /* dev got truncated because of 16bit Linux dev_t */
-                       nfserr = nfserr_io;     /* or nfserr_inval? */
+                       nfserr = nfserr_inval;
                        goto out_unlock;
                } else {
                        /* Okay, char or block special */
                        is_borc = 1;
                }
 
+               /* we've used the SIZE information, so discard it */
+               attr->ia_valid &= ~ATTR_SIZE;
+
                /* Make sure the type and device matches */
                nfserr = nfserr_exist;
                if (inode && (type != (inode->i_mode & S_IFMT) || 
@@ -442,8 +448,8 @@ static int
 nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp,
                                          struct nfsd_readdirres  *resp)
 {
-       u32 *   buffer;
-       int     nfserr, count;
+       u32 *           buffer;
+       int             nfserr, count;
 
        dprintk("nfsd: READDIR  %d/%d %d bytes at %d\n",
                SVCFH_DEV(&argp->fh), SVCFH_INO(&argp->fh),
@@ -556,33 +562,15 @@ nfserrno (int errno)
                { NFSERR_DQUOT, EDQUOT },
 #endif
                { NFSERR_STALE, ESTALE },
-               { NFSERR_WFLUSH, EIO },
                { -1, EIO }
        };
        int     i;
 
        for (i = 0; nfs_errtbl[i].nfserr != -1; i++) {
                if (nfs_errtbl[i].syserr == errno)
-                       return htonl (nfs_errtbl[i].nfserr);
+                       return htonl(nfs_errtbl[i].nfserr);
        }
        printk (KERN_INFO "nfsd: non-standard errno: %d\n", errno);
        return nfserr_io;
 }
 
-#if 0
-static void
-nfsd_dump(char *tag, u32 *buf, int len)
-{
-       int     i;
-
-       printk(KERN_NOTICE
-               "nfsd: %s (%d words)\n", tag, len);
-
-       for (i = 0; i < len && i < 32; i += 8)
-               printk(KERN_NOTICE
-                       " %08lx %08lx %08lx %08lx"
-                       " %08lx %08lx %08lx %08lx\n",
-                       buf[i],   buf[i+1], buf[i+2], buf[i+3],
-                       buf[i+4], buf[i+5], buf[i+6], buf[i+7]);
-}
-#endif
index 0057e1fa3c0300ddb4005e74d8b436fa90c33fd1..7c3a22fd5aa63f3e127acd13edb140d4063f07f7 100644 (file)
@@ -196,7 +196,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp)
        kxdrproc_t              xdr;
        u32                     nfserr;
 
-       dprintk("nfsd_dispatch: proc %d\n", rqstp->rq_proc);
+       dprintk("nfsd_dispatch: vers %d proc %d\n",
+                               rqstp->rq_vers, rqstp->rq_proc);
        proc = rqstp->rq_procinfo;
 
        /* Check whether we have this call in the cache. */
index 1d9a9dd5a79a3c4a7b3c538e380cd79c72750d28..3afe9f83eedb3f573296e657ee6702621dde25ae 100644 (file)
 #define NFSDDBG_FACILITY               NFSDDBG_XDR
 
 u32    nfs_ok, nfserr_perm, nfserr_noent, nfserr_io, nfserr_nxio,
-       nfserr_inval, nfserr_acces, nfserr_exist, nfserr_nodev, nfserr_notdir,
-       nfserr_isdir, nfserr_fbig, nfserr_nospc, nfserr_rofs,
-       nfserr_nametoolong, nfserr_dquot, nfserr_stale;
+       nfserr_acces, nfserr_exist, nfserr_xdev, nfserr_nodev,
+       nfserr_notdir, nfserr_isdir, nfserr_inval, nfserr_fbig,
+       nfserr_nospc, nfserr_rofs, nfserr_mlink,
+       nfserr_nametoolong, nfserr_notempty, nfserr_dquot, nfserr_stale,
+       nfserr_remote, nfserr_badhandle, nfserr_notsync,
+       nfserr_badcookie, nfserr_notsupp, nfserr_toosmall,
+       nfserr_serverfault, nfserr_badtype, nfserr_jukebox;
+
 
 #ifdef NFSD_OPTIMIZE_SPACE
 # define inline
@@ -52,18 +57,32 @@ nfsd_xdr_init(void)
        nfserr_noent    = htonl(NFSERR_NOENT);
        nfserr_io       = htonl(NFSERR_IO);
        nfserr_inval    = htonl(NFSERR_INVAL);
-       nfserr_nxio = htonl(NFSERR_NXIO);
-       nfserr_acces = htonl(NFSERR_ACCES);
-       nfserr_exist = htonl(NFSERR_EXIST);
-       nfserr_nodev = htonl(NFSERR_NODEV);
-       nfserr_notdir = htonl(NFSERR_NOTDIR);
-       nfserr_isdir = htonl(NFSERR_ISDIR);
-       nfserr_fbig = htonl(NFSERR_FBIG);
-       nfserr_nospc = htonl(NFSERR_NOSPC);
-       nfserr_rofs = htonl(NFSERR_ROFS);
+       nfserr_nxio     = htonl(NFSERR_NXIO);
+       nfserr_acces    = htonl(NFSERR_ACCES);
+       nfserr_exist    = htonl(NFSERR_EXIST);
+       nfserr_xdev     = htonl(NFSERR_XDEV);
+       nfserr_nodev    = htonl(NFSERR_NODEV);
+       nfserr_notdir   = htonl(NFSERR_NOTDIR);
+       nfserr_isdir    = htonl(NFSERR_ISDIR);
+       nfserr_inval    = htonl(NFSERR_INVAL);
+       nfserr_fbig     = htonl(NFSERR_FBIG);
+       nfserr_nospc    = htonl(NFSERR_NOSPC);
+       nfserr_rofs     = htonl(NFSERR_ROFS);
+       nfserr_mlink    = htonl(NFSERR_MLINK);
        nfserr_nametoolong = htonl(NFSERR_NAMETOOLONG);
-       nfserr_dquot = htonl(NFSERR_DQUOT);
-       nfserr_stale = htonl(NFSERR_STALE);
+       nfserr_notempty = htonl(NFSERR_NOTEMPTY);
+       nfserr_dquot    = htonl(NFSERR_DQUOT);
+       nfserr_stale    = htonl(NFSERR_STALE);
+       nfserr_remote   = htonl(NFSERR_REMOTE);
+       nfserr_badhandle = htonl(NFSERR_BADHANDLE);
+       nfserr_notsync  = htonl(NFSERR_NOT_SYNC);
+       nfserr_badcookie = htonl(NFSERR_BAD_COOKIE);
+       nfserr_notsupp  = htonl(NFSERR_NOTSUPP);
+       nfserr_toosmall = htonl(NFSERR_TOOSMALL);
+       nfserr_serverfault = htonl(NFSERR_SERVERFAULT);
+       nfserr_badtype  = htonl(NFSERR_BADTYPE);
+       nfserr_jukebox  = htonl(NFSERR_JUKEBOX);
+
 
        inited = 1;
 }
index 398d2ebaeba528d81c9bd45468ea07a18df494b1..f929c4860e20ca244d8c465857e5f6954704e527 100644 (file)
 
 /* Hack until we have a macro check for mandatory locks. */
 #ifndef IS_ISMNDLK
-#define IS_ISMNDLK(i)  (((i)->i_mode & (S_ISGID|S_IXGRP)) == S_ISGID)
+/* We must ignore files (but only file) which might have mandatory
+ * locks on them because there is no way to know if the accesser has
+ * the lock.
+ */
+#define IS_ISMNDLK(i)  (((i)->i_mode & (S_ISGID|S_IXGRP|S_IFMT)) \
+                        == (S_ISGID|S_IFREG))
 #endif
 
 /* Check for dir entries '.' and '..' */
@@ -78,39 +83,44 @@ int nfsd_nservers = 0;
 static struct raparms *                raparml = NULL;
 static struct raparms *                raparm_cache = NULL;
 
+
+/*
+ * We need to do a check-parent every time
+ * after we have locked the parent - to verify
+ * that the parent is still our parent and
+ * that we are still hashed onto it..
+ *
+ * This is required in case two processes race
+ * on removing (or moving) the same entry: the
+ * parent lock will serialize them, but the
+ * other process will be too late..
+ *
+ * Note that this nfsd_check_parent is identical
+ * the check_parent in linux/fs/namei.c.
+ */
+#define nfsd_check_parent(dir, dentry) \
+       ((dir) == (dentry)->d_parent && !list_empty(&dentry->d_hash))
+
 /*
  * Lock a parent directory following the VFS locking protocol.
  */
 int
 fh_lock_parent(struct svc_fh *parent_fh, struct dentry *dchild)
 {
-       int     nfserr = 0;
-
        fh_lock(parent_fh);
        /*
         * Make sure the parent->child relationship still holds,
         * and that the child is still hashed.
         */
-       if (dchild->d_parent != parent_fh->fh_dentry) 
-               goto out_not_parent;
-       if (list_empty(&dchild->d_hash))
-               goto out_not_hashed; 
-out:
-       return nfserr;
+       if (nfsd_check_parent(parent_fh->fh_dentry, dchild))
+           return 0;
 
-out_not_parent:
        printk(KERN_WARNING
-               "fh_lock_parent: %s/%s parent changed\n",
+               "fh_lock_parent: %s/%s parent changed or child unhashed\n",
                dchild->d_parent->d_name.name, dchild->d_name.name);
-       goto out_unlock;
-out_not_hashed:
-       printk(KERN_WARNING
-               "fh_lock_parent: %s/%s unhashed\n",
-               dchild->d_parent->d_name.name, dchild->d_name.name);
-out_unlock:
-       nfserr = nfserr_noent;
+
        fh_unlock(parent_fh);
-       goto out;
+       return nfserr_noent;
 }
 
 /*
@@ -250,6 +260,32 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap)
        inode = dentry->d_inode;
 
        err = inode_change_ok(inode, iap);
+       /* could be a "touch" (utimes) request where the user is not the owner but does
+        * have write permission. In this case the user should be allowed to set
+        * both times to the current time.  We could just assume any such SETATTR
+        * is intended to set the times to "now", but we do a couple of simple tests
+        * to increase our confidence.
+        */
+#define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
+#define        MAX_TOUCH_TIME_ERROR (30*60)
+       if (err
+           && (iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET
+           && iap->ia_mtime == iap->ia_ctime
+           ) {
+           /* looks good.  now just make sure time is in the right ballpark.
+            * solaris, at least, doesn't seem to care what the time request is
+            */
+           time_t delta = iap->ia_atime - CURRENT_TIME;
+           if (delta<0) delta = -delta;
+           if (delta < MAX_TOUCH_TIME_ERROR) {
+               /* turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME
+                * this will cause notify_change to setthese times to "now"
+                */
+               iap->ia_valid &= ~BOTH_TIME_SET;
+               err = inode_change_ok(inode, iap);
+           }
+       }
+           
        if (err)
                goto out_nfserr;
 
@@ -415,11 +451,28 @@ nfsd_close(struct file *filp)
 
 /*
  * Sync a file
+ * As this calls fsync (not fdatasync) there is no need for a write_inode
+ * after it.
  */
 void
-nfsd_sync(struct inode *inode, struct file *filp)
+nfsd_sync(struct file *filp)
 {
+       dprintk("nfsd: sync file %s\n", filp->f_dentry->d_name.name);
+       down(&filp->f_dentry->d_inode->i_sem);
        filp->f_op->fsync(filp, filp->f_dentry);
+       up(&filp->f_dentry->d_inode->i_sem);
+}
+
+void
+nfsd_sync_dir(struct dentry *dp)
+{
+       struct inode *inode = dp->d_inode;
+       int (*fsync) (struct file *, struct dentry *);
+       
+       if (inode->i_op->default_file_ops
+           && (fsync = inode->i_op->default_file_ops->fsync)) {
+               fsync(NULL, dp);
+       }
 }
 
 /*
@@ -574,7 +627,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
        /* clear setuid/setgid flag after write */
        if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) {
                struct iattr    ia;
-               kernel_cap_t    saved_cap;
+               kernel_cap_t    saved_cap = 0;
 
                ia.ia_valid = ATTR_MODE;
                ia.ia_mode  = inode->i_mode & ~(S_ISUID | S_ISGID);
@@ -616,15 +669,14 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
 
                if (inode->i_state & I_DIRTY) {
                        dprintk("nfsd: write sync %d\n", current->pid);
-                       nfsd_sync(inode, &file);
-                       write_inode_now(inode);
+                       nfsd_sync(&file);
                }
                wake_up(&inode->i_wait);
                last_ino = inode->i_ino;
                last_dev = inode->i_dev;
        }
 
-       dprintk("nfsd: write complete\n");
+       dprintk("nfsd: write complete err=%d\n", err);
        if (err >= 0)
                err = 0;
        else 
@@ -672,6 +724,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
         * If it has, the parent directory should already be locked.
         */
        if (!resfhp->fh_dverified) {
+               /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */
                dchild = lookup_dentry(fname, dget(dentry), 0);
                err = PTR_ERR(dchild);
                if (IS_ERR(dchild))
@@ -682,20 +735,24 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
                if (err)
                        goto out;
        } else {
+               /* called from nfsd_proc_create */
                dchild = resfhp->fh_dentry;
-               if (!fhp->fh_locked)
+               if (!fhp->fh_locked) {
+                       /* not actually possible */
                        printk(KERN_ERR
                                "nfsd_create: parent %s/%s not locked!\n",
                                dentry->d_parent->d_name.name,
                                dentry->d_name.name);
+                       err = -EIO;
+                       goto out;
+               }
        }
        /*
         * Make sure the child dentry is still negative ...
         */
        err = nfserr_exist;
        if (dchild->d_inode) {
-               printk(KERN_WARNING
-                       "nfsd_create: dentry %s/%s not negative!\n",
+               dprintk("nfsd_create: dentry %s/%s not negative!\n",
                        dentry->d_name.name, dchild->d_name.name);
                goto out; 
        }
@@ -725,6 +782,9 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
        case S_IFSOCK:
                opfunc = dirp->i_op->mknod;
                break;
+       default:
+               printk("nfsd: bad file type %o in nfsd_create\n", type);
+               err = nfserr_inval;
        }
        if (!opfunc)
                goto out;
@@ -740,8 +800,10 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
        if (err < 0)
                goto out_nfserr;
 
-       if (EX_ISSYNC(fhp->fh_export))
-               write_inode_now(dirp);
+       if (EX_ISSYNC(fhp->fh_export)) {
+               nfsd_sync_dir(dentry);
+               write_inode_now(dchild->d_inode);
+       }
 
        /*
         * Update the file handle to get the new inode info.
@@ -779,7 +841,7 @@ nfsd_truncate(struct svc_rqst *rqstp, struct svc_fh *fhp, unsigned long size)
        struct inode    *inode;
        struct iattr    newattrs;
        int             err;
-       kernel_cap_t    saved_cap;
+       kernel_cap_t    saved_cap = 0;
 
        err = fh_verify(rqstp, fhp, S_IFREG, MAY_WRITE | MAY_TRUNC);
        if (err)
@@ -815,6 +877,8 @@ nfsd_truncate(struct svc_rqst *rqstp, struct svc_fh *fhp, unsigned long size)
        if (current->fsuid != 0)
                current->cap_effective = saved_cap;
        put_write_access(inode);
+       if (EX_ISSYNC(fhp->fh_export))
+               nfsd_sync_dir(dentry);
        fh_unlock(fhp);
 out_nfserr:
        if (err)
@@ -848,7 +912,10 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
                goto out;
 
        UPDATE_ATIME(inode);
-       /* N.B. Why does this call need a get_fs()?? */
+       /* N.B. Why does this call need a get_fs()??
+        * Remove the set_fs and watch the fireworks:-) --okir
+        */
+
        oldfs = get_fs(); set_fs(KERNEL_DS);
        err = inode->i_op->readlink(dentry, buf, *lenp);
        set_fs(oldfs);
@@ -913,7 +980,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
                err = dirp->i_op->symlink(dirp, dnew, path);
                if (!err) {
                        if (EX_ISSYNC(fhp->fh_export))
-                               write_inode_now(dirp);
+                               nfsd_sync_dir(dentry);
                } else
                        err = nfserrno(-err);
        }
@@ -945,7 +1012,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
        err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE);
        if (err)
                goto out;
-       err = fh_verify(rqstp, tfhp, S_IFREG, MAY_NOP);
+       err = fh_verify(rqstp, tfhp, -S_IFDIR, MAY_NOP);
        if (err)
                goto out;
 
@@ -991,7 +1058,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
        err = dirp->i_op->link(dold, dirp, dnew);
        if (!err) {
                if (EX_ISSYNC(ffhp->fh_export)) {
-                       write_inode_now(dirp);
+                       nfsd_sync_dir(ddir);
                        write_inode_now(dest);
                }
        } else
@@ -1009,30 +1076,13 @@ out_nfserr:
        goto out;
 }
 
-/*
- * We need to do a check-parent every time
- * after we have locked the parent - to verify
- * that the parent is still our parent and
- * that we are still hashed onto it..
- *
- * This is required in case two processes race
- * on removing (or moving) the same entry: the
- * parent lock will serialize them, but the
- * other process will be too late..
- *
- * Note that this nfsd_check_parent is different
- * than the one in linux/include/dcache_func.h.
- */
-#define nfsd_check_parent(dir, dentry) \
-       ((dir) == (dentry)->d_parent->d_inode && !list_empty(&dentry->d_hash))
-
 /*
  * This follows the model of double_lock() in the VFS.
  */
 static inline void nfsd_double_down(struct semaphore *s1, struct semaphore *s2)
 {
        if (s1 != s2) {
-               if ((unsigned long) s1 > (unsigned long) s2) {
+               if ((unsigned long) s1 < (unsigned long) s2) {
                        struct semaphore *tmp = s1;
                        s1 = s2;
                        s2 = tmp;
@@ -1102,13 +1152,13 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
        nfsd_double_down(&tdir->i_sem, &fdir->i_sem);
        err = -ENOENT;
        /* GAM3 check for parent changes after locking. */
-       if (nfsd_check_parent(fdir, odentry) &&
-           nfsd_check_parent(tdir, ndentry)) {
+       if (nfsd_check_parent(fdentry, odentry) &&
+           nfsd_check_parent(tdentry, ndentry)) {
 
                err = vfs_rename(fdir, odentry, tdir, ndentry);
                if (!err && EX_ISSYNC(tfhp->fh_export)) {
-                       write_inode_now(fdir);
-                       write_inode_now(tdir);
+                       nfsd_sync_dir(tdentry);
+                       nfsd_sync_dir(fdentry);
                }
        } else
                dprintk("nfsd: Caught race in nfsd_rename");
@@ -1182,17 +1232,13 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
 
                rdentry->d_count++;
                nfsd_double_down(&dirp->i_sem, &rdentry->d_inode->i_sem);
-               if (!fhp->fh_pre_mtime)
-                       fhp->fh_pre_mtime = dirp->i_mtime;
                fhp->fh_locked = 1;
 
                err = -ENOENT;
-               if (nfsd_check_parent(dirp, rdentry))
+               if (nfsd_check_parent(dentry, rdentry))
                        err = vfs_rmdir(dirp, rdentry);
 
                rdentry->d_count--;
-               if (!fhp->fh_post_version)
-                       fhp->fh_post_version = dirp->i_version;
                fhp->fh_locked = 0;
                nfsd_double_up(&dirp->i_sem, &rdentry->d_inode->i_sem);
 
@@ -1201,8 +1247,11 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
 
        if (err)
                goto out_nfserr;
-       if (EX_ISSYNC(fhp->fh_export))
-               write_inode_now(dirp);
+       if (EX_ISSYNC(fhp->fh_export)) {
+               down(&dentry->d_inode->i_sem);
+               nfsd_sync_dir(dentry);
+               up(&dentry->d_inode->i_sem);
+       }
 out:
        return err;
 
@@ -1334,7 +1383,7 @@ nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc)
 {
        struct inode    *inode = dentry->d_inode;
        int             err;
-       kernel_cap_t    saved_cap;
+       kernel_cap_t    saved_cap = 0;
 
        if (acc == MAY_NOP)
                return 0;
index 40d5d6c2cbd2bf016c0ff618c96ae77fe9f17c22..c1ea11ff807b0e4100b9a5207b08c44877bee5ff 100644 (file)
@@ -4,6 +4,8 @@
  * Native language support--charsets and unicode translations.
  * By Gordon Chaffee 1996, 1997
  *
+ * Unicode based case conversion 1999 by Wolfram Pienkoss
+ *
  */
 
 #include <linux/version.h>
@@ -363,6 +365,78 @@ static unsigned char *page_uni2charset[256] = {
        page00
 };
 
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
+static unsigned char charset2upper[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
+       0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 
 void inc_use_count(void)
 {
@@ -376,6 +450,8 @@ static struct nls_table default_table = {
        "default",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 46a5621b13feddb2b503c753dea552c341ef3579..a64a12d4b65ec538908f7d7995d901dcee233188 100644 (file)
@@ -355,7 +355,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -369,15 +404,16 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0x00, 0x8e, 0x00, 0x8f, 0x80, /* 0x80-0x87 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x90, 0x92, 0x92, 0x00, 0x99, 0x00, 0x00, 0x00, /* 0x90-0x97 */
        0x00, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
@@ -385,12 +421,11 @@ static unsigned char charset2upper[256] = {
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */
+       0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -407,6 +442,8 @@ static struct nls_table table = {
        "cp437",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 6b34b38bd9d04bb8dced047faa3383d059ddc384..0ae5575e05780254c9f31231ae84d98cdc27c54a 100644 (file)
@@ -283,7 +283,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x80-0x87 */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x88-0x8f */
+       0xa8, 0xa9, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xe0, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xe1, 0xe2, 0xe3, 0xe5, 0xe6, 0xe7, /* 0xe8-0xef */
+       0xe9, 0xf1, 0xf2, 0xf3, 0xe4, 0xe8, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -297,28 +332,28 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x98-0x9f */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0xa0-0xa7 */
+       0x90, 0x91, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0x97, 0xea, 0xeb, 0xec, 0xf4, 0xed, 0xee, 0xef, /* 0xe0-0xe7 */
+       0xf5, 0xf0, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -335,6 +370,8 @@ static struct nls_table table = {
        "cp737",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 4c11d63ffa7276c7cb93aefb7ffbccc4388eb917..d740adbba1bb6f2ca817af1e96caa80127a37ed7 100644 (file)
@@ -283,7 +283,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8b, 0x8b, 0x8c, 0xa5, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x91, 0x91, 0x93, 0x94, 0x85, 0x96, 0x98, /* 0x90-0x97 */
+       0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */
+       0x83, 0x8c, 0xa2, 0xa4, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x88, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xd0, 0xd1, 0xd2, /* 0xb0-0xb7 */
+       0xd3, 0xb9, 0xba, 0xbb, 0xbc, 0xd4, 0xd5, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xd6, 0xd7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xd8, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xa2, 0xe1, 0x93, 0xe7, 0xe4, 0xe4, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe9, 0xe9, 0xeb, 0xeb, 0xec, 0x89, 0xec, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -297,28 +332,28 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
-       0x00, 0x00, 0x8a, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0xa0, 0x8e, 0x95, 0x8f, 0x80, /* 0x80-0x87 */
+       0xad, 0xed, 0x8a, 0x8a, 0xa1, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x92, 0x92, 0xe2, 0x99, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x97, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xe0, 0xa3, 0xa3, 0x8d, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
-       0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0xe0, 0x00, 0xe2, 0xe3, 0x00, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0x00, 0xea, 0x00, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xb5, 0xb6, 0xb7, 0xb8, 0xbd, 0xbe, 0xc6, 0xc7, /* 0xd0-0xd7 */
+       0xcf, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe5, 0xe5, 0x00, 0xe3, /* 0xe0-0xe7 */
+       0xe8, 0xe8, 0xea, 0xea, 0xee, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -335,6 +370,8 @@ static struct nls_table table = {
        "cp775",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index c93b99c9beebcec56d4b381bffa72adf6d524ab5..d15cfd8935a1ad804267fdc0fe25e0a1c8e05d1c 100644 (file)
@@ -247,7 +247,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xa0, 0x83, 0x85, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd0, 0x88, 0x89, 0x8a, 0xd5, 0xa1, 0x8c, /* 0xd0-0xd7 */
+       0x8b, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x8d, 0xdf, /* 0xd8-0xdf */
+       0xa2, 0xe1, 0x93, 0x95, 0xe4, 0xe4, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe7, 0xa3, 0x96, 0x97, 0xec, 0xec, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -261,28 +296,28 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
-       0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0xb6, 0x8e, 0xb7, 0x8f, 0x80, /* 0x80-0x87 */
+       0xd2, 0xd3, 0xd4, 0xd8, 0xd7, 0xde, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x92, 0x92, 0xe2, 0x99, 0xe3, 0xea, 0xeb, /* 0x90-0x97 */
+       0x00, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
+       0xb5, 0xd6, 0xe0, 0xe9, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd1, 0xd1, 0xd2, 0xd3, 0xd4, 0x49, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0xe0, 0x00, 0xe2, 0xe3, 0x00, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe5, 0xe5, 0x00, 0xe8, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xed, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -299,6 +334,8 @@ static struct nls_table table = {
        "cp850",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 1a1385936c3348356763fad4e7cae47ec92dba78..f270943ff9c876488cfd4a16783e7b1abfff3ecd 100644 (file)
@@ -247,7 +247,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8b, 0x8b, 0x8c, 0xab, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x92, 0x92, 0x93, 0x94, 0x96, 0x96, 0x98, /* 0x90-0x97 */
+       0x98, 0x94, 0x81, 0x9c, 0x9c, 0x88, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa5, 0xa5, 0xa7, 0xa7, /* 0xa0-0xa7 */
+       0xa9, 0xa9, 0xaa, 0xab, 0x9f, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xa0, 0x83, 0xd8, /* 0xb0-0xb7 */
+       0xad, 0xb9, 0xba, 0xbb, 0xbc, 0xbe, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd0, 0xd4, 0x89, 0xd4, 0xe5, 0xa1, 0x8c, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xee, 0x85, 0xdf, /* 0xd8-0xdf */
+       0xa2, 0xe1, 0x93, 0xe4, 0xe4, 0xe5, 0xe7, 0xe7, /* 0xe0-0xe7 */
+       0xea, 0xa3, 0xea, 0xfb, 0xec, 0xec, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfd, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -261,28 +296,28 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
-       0x00, 0x00, 0x8a, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x00, 0x00, 0x00, 0x95, 0x00, 0x97, /* 0x90-0x97 */
-       0x00, 0x99, 0x9a, 0x9b, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0x00, /* 0xa0-0xa7 */
-       0xa8, 0x00, 0xaa, 0x00, 0xac, 0x00, 0xae, 0xaf, /* 0xa8-0xaf */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0xb6, 0x8e, 0xde, 0x8f, 0x80, /* 0x80-0x87 */
+       0x9d, 0xd3, 0x8a, 0x8a, 0xd7, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x91, 0xe2, 0x99, 0x95, 0x95, 0x97, /* 0x90-0x97 */
+       0x97, 0x99, 0x9a, 0x9b, 0x9b, 0x9d, 0x9e, 0xac, /* 0x98-0x9f */
+       0xb5, 0xd6, 0xe0, 0xe9, 0xa4, 0xa4, 0xa6, 0xa6, /* 0xa0-0xa7 */
+       0xa8, 0xa8, 0xaa, 0x8d, 0xac, 0xb8, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
-       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0x00, 0xbf, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbd, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0x00, 0xd1, 0xd2, 0xd3, 0x00, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0xe0, 0x00, 0xe2, 0xe3, 0x00, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0x00, 0xef, /* 0xe8-0xef */
+       0xd1, 0xd1, 0xd2, 0xd3, 0xd2, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xb7, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe3, 0xd5, 0xe6, 0xe6, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xe8, 0xeb, 0xed, 0xed, 0xdd, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0x00, 0xfc, 0x00, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xeb, 0xfc, 0xfc, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -299,6 +334,8 @@ static struct nls_table table = {
        "cp852",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 7c1c06d0d64707e34b7df09c2d880f771bf3dbe0..c0b6eb7fcebf9e6708040c0141f9c745bb0cbfcf 100644 (file)
@@ -247,7 +247,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   page21, NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x80, 0x82, 0x82, 0x84, 0x84, 0x86, 0x86, /* 0x80-0x87 */
+       0x88, 0x88, 0x8a, 0x8a, 0x8c, 0x8c, 0x8e, 0x8e, /* 0x88-0x8f */
+       0x90, 0x90, 0x92, 0x92, 0x94, 0x94, 0x96, 0x96, /* 0x90-0x97 */
+       0x98, 0x98, 0x9a, 0x9a, 0x9c, 0x9c, 0x9e, 0x9e, /* 0x98-0x9f */
+       0xa0, 0xa0, 0xa2, 0xa2, 0xa4, 0xa4, 0xa6, 0xa6, /* 0xa0-0xa7 */
+       0xa8, 0xa8, 0xaa, 0xaa, 0xac, 0xac, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb5, 0xb7, /* 0xb0-0xb7 */
+       0xb7, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbd, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd0, 0xd2, 0xd2, 0xd4, 0xd4, 0xd6, 0xd6, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xd8, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xde, 0xe1, 0xe1, 0xe3, 0xe3, 0xe5, 0xe5, 0xe7, /* 0xe0-0xe7 */
+       0xe7, 0xe9, 0xe9, 0xeb, 0xeb, 0xed, 0xed, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf1, 0xf3, 0xf3, 0xf5, 0xf5, 0xf7, /* 0xf0-0xf7 */
+       0xf7, 0xf9, 0xf9, 0xfb, 0xfb, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -261,28 +296,28 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x00, 0x81, 0x00, 0x83, 0x00, 0x85, 0x00, 0x87, /* 0x80-0x87 */
-       0x00, 0x89, 0x00, 0x8b, 0x00, 0x8d, 0x00, 0x8f, /* 0x88-0x8f */
-       0x00, 0x91, 0x00, 0x93, 0x00, 0x95, 0x00, 0x97, /* 0x90-0x97 */
-       0x00, 0x99, 0x00, 0x9b, 0x00, 0x9d, 0x00, 0x9f, /* 0x98-0x9f */
-       0x00, 0xa1, 0x00, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */
-       0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0x00, /* 0xb0-0xb7 */
-       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x81, 0x81, 0x83, 0x83, 0x85, 0x85, 0x87, 0x87, /* 0x80-0x87 */
+       0x89, 0x89, 0x8b, 0x8b, 0x8d, 0x8d, 0x8f, 0x8f, /* 0x88-0x8f */
+       0x91, 0x91, 0x93, 0x93, 0x95, 0x95, 0x97, 0x97, /* 0x90-0x97 */
+       0x99, 0x99, 0x9b, 0x9b, 0x9d, 0x9d, 0x9f, 0x9f, /* 0x98-0x9f */
+       0xa1, 0xa1, 0xa3, 0xa3, 0xa5, 0xa5, 0xa7, 0xa7, /* 0xa0-0xa7 */
+       0xa9, 0xa9, 0xab, 0xab, 0xad, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb6, 0xb6, 0xb8, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbe, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0x00, 0xd1, 0x00, 0xd3, 0x00, 0xd5, 0x00, 0xd7, /* 0xd0-0xd7 */
-       0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */
-       0xe0, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0x00, 0xea, 0x00, 0xec, 0x00, 0xee, 0xef, /* 0xe8-0xef */
-       0xf0, 0x00, 0xf2, 0x00, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */
-       0xf8, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xd1, 0xd1, 0xd3, 0xd3, 0xd5, 0xd5, 0xd7, 0xd7, /* 0xd0-0xd7 */
+       0xdd, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xe0, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe2, 0xe2, 0xe4, 0xe4, 0xe6, 0xe6, 0xe8, /* 0xe0-0xe7 */
+       0xe8, 0xea, 0xea, 0xec, 0xec, 0xee, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf2, 0xf2, 0xf4, 0xf4, 0xf6, 0xf6, 0xf8, /* 0xf0-0xf7 */
+       0xf8, 0xfa, 0xfa, 0xfc, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -299,6 +334,8 @@ static struct nls_table table = {
        "cp855",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index b3007525acced1e0689223105c6d886671ce7327..8125401f1f3e77ab5972773eb49b6ccfb9ef6fec 100644 (file)
@@ -211,7 +211,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x69, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9f, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa7, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xa0, 0x83, 0x85, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0x88, 0x89, 0x8a, 0x00, 0xa1, 0x8c, /* 0xd0-0xd7 */
+       0x8b, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xec, 0xdf, /* 0xd8-0xdf */
+       0xa2, 0xe1, 0x93, 0x95, 0xe4, 0xe4, 0xe6, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xa3, 0x96, 0x97, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -225,28 +260,28 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0x00, /* 0xa0-0xa7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0xb6, 0x8e, 0xb7, 0x8f, 0x80, /* 0x80-0x87 */
+       0xd2, 0xd3, 0xd4, 0xd8, 0xd7, 0x49, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x92, 0x92, 0xe2, 0x99, 0xe3, 0xea, 0xeb, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x9e, /* 0x98-0x9f */
+       0xb5, 0xd6, 0xe0, 0xe9, 0xa5, 0xa5, 0xa6, 0xa6, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc7, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0xe0, 0x00, 0xe2, 0xe3, 0x00, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */
-       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe5, 0xe5, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xde, 0x00, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -263,6 +298,8 @@ static struct nls_table table = {
        "cp857",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index af1ee235892f4f6728ee397069b1fded87536b2e..187187f24e2ed5df046be586b273ff53f282d1b3 100644 (file)
@@ -319,7 +319,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0xa0, 0x87, /* 0x80-0x87 */
+       0x88, 0x88, 0x8a, 0xa1, 0x93, 0x8d, 0x84, 0x83, /* 0x88-0x8f */
+       0x82, 0x85, 0x8a, 0x93, 0x94, 0x95, 0xa3, 0x97, /* 0x90-0x97 */
+       0x8d, 0x94, 0x81, 0x9b, 0x9c, 0x97, 0x9e, 0xa2, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0x95, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -333,15 +368,16 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, /* 0x80-0x87 */
-       0x00, 0x89, 0x00, 0x8b, 0x8c, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x96, 0x00, /* 0x90-0x97 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0x8f, 0x8e, 0x91, 0x86, 0x80, /* 0x80-0x87 */
+       0x89, 0x89, 0x92, 0x8b, 0x8c, 0x98, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x8c, 0x99, 0xa9, 0x96, 0x9d, /* 0x90-0x97 */
        0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x86, 0x8b, 0x9f, 0x96, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
@@ -349,12 +385,11 @@ static unsigned char charset2upper[256] = {
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */
+       0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -371,6 +406,8 @@ static struct nls_table table = {
        "cp860",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index bdb085abf686624ff2846e55650ae4d28631f103..d42259d0a28b24b18f88ff816157942f71143fba 100644 (file)
@@ -355,7 +355,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8c, 0x8c, 0x95, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x98, /* 0x90-0x97 */
+       0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa0, 0xa1, 0xa2, 0xa3, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -369,15 +404,16 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
-       0x00, 0x00, 0x00, 0x8b, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x97, /* 0x90-0x97 */
-       0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0x00, 0x8e, 0x00, 0x8f, 0x80, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x8b, 0x8b, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x92, 0x92, 0x00, 0x99, 0x8d, 0x00, 0x97, /* 0x90-0x97 */
+       0x97, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
+       0xa4, 0xa5, 0xa6, 0xa7, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
@@ -385,12 +421,11 @@ static unsigned char charset2upper[256] = {
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */
+       0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
 
 
 static void inc_use_count(void)
@@ -407,6 +442,8 @@ static struct nls_table table = {
        "cp861",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index b0c7a49b49e0d6b399f0c6a3e0b70ae149558bfb..6a86e5ef527ce2d8729918b5955ad39f7efe2bf5 100644 (file)
@@ -391,7 +391,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -405,15 +440,16 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
        0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
@@ -421,12 +457,12 @@ static unsigned char charset2upper[256] = {
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */
+       0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -442,6 +478,8 @@ static struct nls_table table = {
        "cp862",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index cea3d163d52325a96fe6ed7ebe53583a196b5bfd..06e5361bcf0ec306437f1841608aa852a111debe 100644 (file)
@@ -355,7 +355,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x83, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x85, 0x8f, /* 0x88-0x8f */
+       0x82, 0x8a, 0x88, 0x93, 0x89, 0x8b, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x93, 0x81, 0x9b, 0x9c, 0x97, 0x96, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x8c, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -369,13 +404,14 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x84, 0x00, 0x86, 0x00, /* 0x80-0x87 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x94, 0x95, 0x00, 0x00, /* 0x90-0x97 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0x84, 0x84, 0x8e, 0x86, 0x80, /* 0x80-0x87 */
+       0x92, 0x94, 0x91, 0x95, 0xa8, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x99, 0x94, 0x95, 0x9e, 0x9d, /* 0x90-0x97 */
        0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
        0xa0, 0xa1, 0x00, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
@@ -385,12 +421,12 @@ static unsigned char charset2upper[256] = {
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */
+       0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -406,6 +442,8 @@ static struct nls_table table = {
        "cp863",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 972c728bdfebc163153c982cc722290286cc296b..6f3182aecdc004270c10308c5571fc19843e2c81 100644 (file)
@@ -346,7 +346,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   pagefe, NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -360,15 +395,16 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x00, 0x91, 0x00, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
@@ -379,9 +415,9 @@ static unsigned char charset2upper[256] = {
        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
        0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -397,6 +433,8 @@ static struct nls_table table = {
        "cp864",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index c681274504a685fa9db7a3a28537d19a267023d5..24dd1dabb02b9f7856031077887218698ed0e101 100644 (file)
@@ -355,7 +355,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x87, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x84, 0x86, /* 0x88-0x8f */
+       0x82, 0x91, 0x91, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x94, 0x81, 0x9b, 0x9c, 0x9b, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0x00, 0xe3, 0xe5, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xed, 0x00, 0x00, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -369,15 +404,16 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x9a, 0x90, 0x00, 0x8e, 0x00, 0x8f, 0x80, /* 0x80-0x87 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
-       0x00, 0x99, 0x9a, 0x00, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x90, 0x92, 0x92, 0x00, 0x99, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x99, 0x9a, 0x9d, 0x9c, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */
+       0x00, 0x00, 0x00, 0x00, 0xa5, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
@@ -385,12 +421,12 @@ static unsigned char charset2upper[256] = {
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0x00, /* 0xe0-0xe7 */
-       0xe8, 0xe9, 0xea, 0x00, 0xec, 0x00, 0x00, 0xef, /* 0xe8-0xef */
+       0x00, 0xe1, 0xe2, 0x00, 0xe4, 0xe4, 0x00, 0x00, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0x00, 0xec, 0xe8, 0x00, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -406,6 +442,8 @@ static struct nls_table table = {
        "cp865",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index d548247046b1185303bc21d0e44c3e1de1c41918..b78dd51480982388959ef5865f98239be7d526c5 100644 (file)
@@ -283,7 +283,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   page21, page22, NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x80-0x87 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x88-0x8f */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x90-0x97 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf1, 0xf1, 0xf3, 0xf3, 0xf5, 0xf5, 0xf7, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -297,28 +332,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
        0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0xa0-0xa7 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0xf0, 0x00, 0xf2, 0x00, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */
+       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0xe0-0xe7 */
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0xe8-0xef */
+       0xf0, 0xf0, 0xf2, 0xf2, 0xf4, 0xf4, 0xf6, 0xf6, /* 0xf0-0xf7 */
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -334,6 +370,8 @@ static struct nls_table table = {
        "cp866",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 586fb993648de59593e47dc48bd72488f5207451..76a693299f8b5fe4d7018ec37462cb5563570188 100644 (file)
@@ -247,7 +247,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0x00, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x9d, 0x8e, 0x9e, /* 0x88-0x8f */
+       0x9f, 0xa0, 0xa2, 0x00, 0x00, 0xa3, 0xfb, 0x97, /* 0x90-0x97 */
+       0xfd, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xd6, 0xd7, 0xd8, 0xdd, /* 0xa0-0xa7 */
+       0xde, 0xe0, 0xe1, 0xab, 0xe2, 0xe3, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xe4, 0xe5, 0xe6, /* 0xb0-0xb7 */
+       0xe7, 0xb9, 0xba, 0xbb, 0xbc, 0xe8, 0xe9, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xea, 0xeb, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xec, /* 0xc8-0xcf */
+       0xee, 0xf2, 0xf3, 0xf4, 0xf6, 0xfa, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -261,28 +296,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, /* 0x80-0x87 */
        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x00, 0x9c, 0x00, 0x00, 0x00, /* 0x98-0x9f */
-       0x00, 0x00, 0x00, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x90, 0x91, 0x92, 0x00, 0x00, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x86, 0x9c, 0x8d, 0x8f, 0x90, /* 0x98-0x9f */
+       0x91, 0xa1, 0x92, 0x95, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0x00, 0x00, /* 0xd0-0xd7 */
-       0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, /* 0xe8-0xef */
-       0xf0, 0xf1, 0x00, 0x00, 0x00, 0xf5, 0x00, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, /* 0xf8-0xff */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xa4, 0xa5, /* 0xd0-0xd7 */
+       0xa6, 0xd9, 0xda, 0xdb, 0xdc, 0xa7, 0xa8, 0xdf, /* 0xd8-0xdf */
+       0xa9, 0xaa, 0xac, 0xad, 0xb5, 0xb6, 0xb7, 0xb8, /* 0xe0-0xe7 */
+       0xbd, 0xbe, 0xc6, 0xc7, 0xcf, 0xcf, 0xd0, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xd1, 0xd2, 0xd3, 0xf5, 0xd4, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xd5, 0x96, 0xfc, 0x98, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -298,6 +334,8 @@ static struct nls_table table = {
        "cp869",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index b2c35c843c168187a29fc5e58b26e522c062f396..108a7045ea3c611d75493acffeea981b54fbae84 100644 (file)
@@ -211,7 +211,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -225,14 +260,15 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
@@ -240,13 +276,13 @@ static unsigned char charset2upper[256] = {
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
        0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -262,6 +298,8 @@ static struct nls_table table = {
        "cp874",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 94ff9c39c4294a66f13dd5dcf1a6e1eaa8e2a4d5..070d97920cf7f82ef11963bf56aac152f6e08131 100644 (file)
@@ -135,7 +135,42 @@ static unsigned char *page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -149,28 +184,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -186,6 +222,8 @@ static struct nls_table table = {
        "iso8859-1",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index b466a65604759a92e6d006013855dc31c93ef877..7cbd8c316414ccb2fd3e028f3733ce8f2cc68b68 100644 (file)
@@ -219,6 +219,79 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
 };
 
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa2, 0xa2, 0xa3, 0xab, 0xab, 0xab, 0xa7, /* 0xa0-0xa7 */
+       0xb8, 0xa9, 0xba, 0xab, 0xbc, 0xad, 0xae, 0xff, /* 0xa8-0xaf */
+       0xb1, 0xb1, 0xb3, 0xb3, 0xb5, 0xb5, 0xb6, 0xb9, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbf, 0xbc, 0xbe, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
+static unsigned char charset2upper[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
+       0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa1, 0xa3, 0xa6, 0xa6, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xa6, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb0, 0xb2, 0xb2, 0xb4, 0xb4, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xa8, 0xb7, 0xaa, 0xbb, 0xac, 0xbd, 0xbd, 0xbb, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xaf, /* 0xf8-0xff */
+};
+
+
 static void inc_use_count(void)
 {
        MOD_INC_USE_COUNT;
@@ -233,6 +306,8 @@ static struct nls_table table = {
        "iso8859-14",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 33478bf9b1de72607ffc50dd8464a117168e0800..1376d1f4a7c46883c5a580af82ece39acd5c191e 100644 (file)
@@ -212,6 +212,79 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
 };
 
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa8, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb8, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbd, 0xbd, 0xff, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
+static unsigned char charset2upper[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
+       0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa6, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb4, 0xb9, 0xba, 0xbb, 0xbc, 0xbc, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xbe, /* 0xf8-0xff */
+};
+
+
 static void inc_use_count(void)
 {
        MOD_INC_USE_COUNT;
@@ -226,6 +299,8 @@ static struct nls_table table = {
        "iso8859-15",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 8349b879a25c5e5c3ee7c60cb1a38cfb12521410..274a717c95312736b25bf8e6102a323e6bf6cc7c 100644 (file)
@@ -207,7 +207,42 @@ static unsigned char *page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xb1, 0xa2, 0xb3, 0xa4, 0xb5, 0xb6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xb9, 0xba, 0xbb, 0xbc, 0xad, 0xbe, 0xbf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -221,28 +256,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0x00, 0xb2, 0x00, 0xb4, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */
-       0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */
+       0xb0, 0xa1, 0xb2, 0xa3, 0xb4, 0xa5, 0xa6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xa9, 0xaa, 0xab, 0xac, 0xbd, 0xae, 0xaf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -258,6 +294,8 @@ static struct nls_table table = {
        "iso8859-2",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 23af5447b9a0bca2418f65b4583dfed2c0fb095a..34eebad9347d45a532c002499d0c02024d329807 100644 (file)
@@ -207,7 +207,42 @@ static unsigned char *page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xb1, 0xa2, 0xa3, 0xa4, 0x00, 0xb6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0x69, 0xba, 0xbb, 0xbc, 0xad, 0x00, 0xbf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0x00, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -221,28 +256,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
-       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */
-       0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xa1, 0xb2, 0xb3, 0xb4, 0x00, 0xa6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0x49, 0xaa, 0xab, 0xac, 0xbd, 0x00, 0xaf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */
+       0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -258,6 +294,8 @@ static struct nls_table table = {
        "iso8859-3",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index abbe1bd9bd53a88ed7b5397d7391375c2b6ad745..18ef00e491f09fff99f1aa4dc15cfd6fc03e08ca 100644 (file)
@@ -207,7 +207,42 @@ static unsigned char *page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xb1, 0xa2, 0xb3, 0xa4, 0xb5, 0xb6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xb9, 0xba, 0xbb, 0xbc, 0xad, 0xbe, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbf, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -221,28 +256,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0x00, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0x00, 0xb2, 0x00, 0xb4, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */
-       0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */
+       0xb0, 0xa1, 0xb2, 0xa3, 0xb4, 0xa5, 0xa6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xa9, 0xaa, 0xab, 0xac, 0xbd, 0xae, 0xbd, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -258,6 +294,8 @@ static struct nls_table table = {
        "iso8859-4",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 1fe18003f32938a3ba21a7d5f9a055e0695c264b..2ba940d789cdd47829438d6923a40018736e25ff 100644 (file)
@@ -211,7 +211,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   page21, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xa0-0xa7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xad, 0xfe, 0xff, /* 0xa8-0xaf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xb0-0xb7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -225,28 +260,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xd0-0xd7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xf0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xf0-0xf7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xfd, 0xae, 0xaf, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -262,6 +298,8 @@ static struct nls_table table = {
        "iso8859-5",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 7ed46f426ef40edf775e6dedc814b2f5561d4a6a..78b0203cf8d662ed2b0ee857e68ad708e48b0222 100644 (file)
@@ -171,7 +171,42 @@ static unsigned char *page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   NULL,   NULL,   page06, NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
+       0x00, 0x00, 0x00, 0x00, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
+       0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */
+       0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -185,28 +220,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
-       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
-       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
+       0x00, 0x00, 0x00, 0x00, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
+       0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */
+       0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
        0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
-       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -222,6 +258,8 @@ static struct nls_table table = {
        "iso8859-6",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 180ac239b3ceba7093e0dd704c1025681791594b..a21a56d03af82e79237bef247a08cabc94ddfde2 100644 (file)
@@ -247,7 +247,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xdc, 0xb7, /* 0xb0-0xb7 */
+       0xdd, 0xde, 0xdf, 0xbb, 0xfc, 0xbd, 0xfd, 0xfe, /* 0xb8-0xbf */
+       0xc0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -261,28 +296,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
-       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0xf8-0xff */
+       0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xb6, 0xb8, 0xb9, 0xba, /* 0xd8-0xdf */
+       0xe0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd3, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xbc, 0xbe, 0xbf, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -298,6 +334,8 @@ static struct nls_table table = {
        "iso8859-7",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index 054f5a4a8af3cc4b76d0727583859500707a1988..c8282dad30bb66a36b6f7a3dd306d8fdc5035fe5 100644 (file)
@@ -211,7 +211,42 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -225,28 +260,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
-       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
-       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
-       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
        0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
-       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+       0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -262,6 +298,8 @@ static struct nls_table table = {
        "iso8859-8",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index eaa8c4c68ad80cb66ca23b5b81cb4aff8f13fde8..74baa761e02fc76605dbc915d863f9fd6415c5c7 100644 (file)
@@ -171,7 +171,42 @@ static unsigned char *page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x69, 0xfe, 0xdf, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -185,28 +220,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
-       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
-       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
-       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
-       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
-       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
-       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x49, 0xde, 0x00, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -222,6 +258,8 @@ static struct nls_table table = {
        "iso8859-9",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index c6ee51f991510167db9d0eec469317d841af182e..3dc3effaae00caf89c3527442dbc79b6dc2ae95f 100644 (file)
@@ -283,7 +283,42 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-#if 0
+static unsigned char charset2lower[256] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
+       0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
+       0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */
+       0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */
+       0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */
+       0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */
+       0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */
+       0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */
+       0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
+       0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */
+       0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */
+       0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */
+       0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
+       0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
+       0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
+       0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
+       0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
+       0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
+       0xb0, 0xb1, 0xb2, 0xa3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
+       0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
+       0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */
+       0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */
+       0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xf0-0xf7 */
+       0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */
+};
+
 static unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
@@ -297,28 +332,29 @@ static unsigned char charset2upper[256] = {
        0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */
        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */
        0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */
-       0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
-       0x00, 0x00, 0x00, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+       0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */
+       0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */
+       0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */
+       0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
+
        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */
        0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */
        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */
        0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */
-       0xa0, 0xa1, 0xa2, 0x00, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
+       0xa0, 0xa1, 0xa2, 0xb3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
+       0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */
+       0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */
+       0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */
+       0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xd8-0xdf */
        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
        0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
-#endif
+
 
 static void inc_use_count(void)
 {
@@ -334,6 +370,8 @@ static struct nls_table table = {
        "koi8-r",
        page_uni2charset,
        charset2uni,
+       charset2lower,
+       charset2upper,
        inc_use_count,
        dec_use_count,
        NULL
index ed420db58d0fb4a1078997b461384b0c6e66e354..d298c51db3898e83e37e223bdd0d2b6b3c216ab7 100644 (file)
@@ -317,12 +317,11 @@ extern void __global_restore_flags(unsigned long flags);
 #define tbia()         __tbi(-2, /* no second argument */)
 
 /*
- * Give prototypes to shut up gcc.
+ * Atomic exchange.
  */
-extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val);
-extern __inline__ unsigned long xchg_u64(volatile long *m, unsigned long val);
 
-extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val)
+extern __inline__ unsigned long
+__xchg_u32(volatile int *m, unsigned long val)
 {
        unsigned long dummy;
 
@@ -341,7 +340,8 @@ extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val)
        return val;
 }
 
-extern __inline__ unsigned long xchg_u64(volatile long * m, unsigned long val)
+extern __inline__ unsigned long
+__xchg_u64(volatile long *m, unsigned long val)
 {
        unsigned long dummy;
 
@@ -360,33 +360,109 @@ extern __inline__ unsigned long xchg_u64(volatile long * m, unsigned long val)
        return val;
 }
 
-/*
- * This function doesn't exist, so you'll get a linker error
- * if something tries to do an invalid xchg().
- *
- * This only works if the compiler isn't horribly bad at optimizing.
- * gcc-2.5.8 reportedly can't handle this, but as that doesn't work
- * too well on the alpha anyway..
- */
+/* This function doesn't exist, so you'll get a linker error
+   if something tries to do an invalid xchg().  */
 extern void __xchg_called_with_bad_pointer(void);
 
 static __inline__ unsigned long
-__xchg(unsigned long x, volatile void * ptr, int size)
+__xchg(volatile void *ptr, unsigned long x, int size)
 {
        switch (size) {
                case 4:
-                       return xchg_u32(ptr, x);
+                       return __xchg_u32(ptr, x);
                case 8:
-                       return xchg_u64(ptr, x);
+                       return __xchg_u64(ptr, x);
        }
        __xchg_called_with_bad_pointer();
        return x;
 }
 
-#define xchg(ptr,x) \
-  ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+#define xchg(ptr,x)                                                         \
+  ({                                                                        \
+     __typeof__(*(ptr)) _x_ = (x);                                          \
+     (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
+  })
+
 #define tas(ptr) (xchg((ptr),1))
 
+
+/* 
+ * Atomic compare and exchange.  Compare OLD with MEM, if identical,
+ * store NEW in MEM.  Return the initial value in MEM.  Success is
+ * indicated by comparing RETURN with OLD.
+ */
+
+#define __HAVE_ARCH_CMPXCHG 1
+
+extern __inline__ unsigned long
+__cmpxchg_u32(volatile int *m, int old, int new)
+{
+       unsigned long prev, cmp;
+
+       __asm__ __volatile__(
+       "1:     ldl_l %0,%2\n"
+       "       cmpeq %0,%3,%1\n"
+       "       beq %1,2f\n"
+       "       mov %4,%1\n"
+       "       stl_c %1,%2\n"
+       "       beq %1,3f\n"
+       "2:     mb\n"
+       ".section .text2,\"ax\"\n"
+       "3:     br 1b\n"
+       ".previous"
+       : "=&r"(prev), "=&r"(cmp), "=m"(*m)
+       : "r"((long) old), "r"(new), "m"(*m));
+
+       return prev;
+}
+
+extern __inline__ unsigned long
+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
+{
+       unsigned long prev, cmp;
+
+       __asm__ __volatile__(
+       "1:     ldq_l %0,%2\n"
+       "       cmpeq %0,%3,%1\n"
+       "       beq %1,2f\n"
+       "       mov %4,%1\n"
+       "       stq_c %1,%2\n"
+       "       beq %1,3f\n"
+       "2:     mb\n"
+       ".section .text2,\"ax\"\n"
+       "3:     br 1b\n"
+       ".previous"
+       : "=&r"(prev), "=&r"(cmp), "=m"(*m)
+       : "r"((long) old), "r"(new), "m"(*m));
+
+       return prev;
+}
+
+/* This function doesn't exist, so you'll get a linker error
+   if something tries to do an invalid cmpxchg().  */
+extern void __cmpxchg_called_with_bad_pointer(void);
+
+static __inline__ unsigned long
+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+       switch (size) {
+               case 4:
+                       return __cmpxchg_u32(ptr, old, new);
+               case 8:
+                       return __cmpxchg_u64(ptr, old, new);
+       }
+       __cmpxchg_called_with_bad_pointer();
+       return old;
+}
+
+#define cmpxchg(ptr,o,n)                                                \
+  ({                                                                    \
+     __typeof__(*(ptr)) _o_ = (o);                                      \
+     __typeof__(*(ptr)) _n_ = (n);                                      \
+     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,          \
+                                   (unsigned long)_n_, sizeof(*(ptr))); \
+  })
+
 #endif /* __ASSEMBLY__ */
 
 #endif
index e980ec02b208ec1820cc3976a2d14a6709e330e9..ac0ff6e1e53950f839ccd2e06238c4a7ab0c6eab 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/kernel.h>
 #include <asm/segment.h>
+#include <linux/bitops.h> /* for LOCK_PREFIX */
 
 #ifdef __KERNEL__
 
@@ -208,6 +209,50 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
        return x;
 }
 
+/*
+ * Atomic compare and exchange.  Compare OLD with MEM, if identical,
+ * store NEW in MEM.  Return the initial value in MEM.  Success is
+ * indicated by comparing RETURN with OLD.
+ */
+
+#if CPU != 386
+#define __HAVE_ARCH_CMPXCHG 1
+
+static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+                                     unsigned long new, int size)
+{
+       unsigned long prev;
+       switch (size) {
+       case 1:
+               __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
+                                    : "=a"(prev)
+                                    : "q"(new), "m"(*__xg(ptr)), "0"(old)
+                                    : "memory");
+               return prev;
+       case 2:
+               __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
+                                    : "=a"(prev)
+                                    : "q"(new), "m"(*__xg(ptr)), "0"(old)
+                                    : "memory");
+               return prev;
+       case 4:
+               __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
+                                    : "=a"(prev)
+                                    : "q"(new), "m"(*__xg(ptr)), "0"(old)
+                                    : "memory");
+               return prev;
+       }
+       return old;
+}
+
+#define cmpxchg(ptr,o,n)\
+       ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
+                                       (unsigned long)(n),sizeof(*(ptr))))
+    
+#else
+/* Compiling for a 386 proper. Is it worth implementing via cli/sti?  */
+#endif
+
 /*
  * Force strict CPU ordering.
  * And yes, this is required on UP too when we're talking
index b3cb91024027e769f786b1aa3f597ba0a87956ea..9211147235f4b8fc46e8db0719b3df9f21733ffd 100644 (file)
 #define __NR_putpmsg           189     /* some people actually want streams */
 #define __NR_vfork             190
 #define __NR_ugetrlimit                191     /* SuS compliant getrlimit */
+#define __NR_mmap2             192
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
@@ -273,6 +274,19 @@ __asm__ volatile ("int $0x80" \
 __syscall_return(type,__res); \
 }
 
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+         type5,arg5,type6,arg6) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
+{ \
+long __res; \
+__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
+       : "=a" (__res) \
+       : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
+         "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
+         "0" ((long)(arg6))); \
+__syscall_return(type,__res); \
+}
+
 #ifdef __KERNEL_SYSCALLS__
 
 /*
diff --git a/include/linux/802_11.h b/include/linux/802_11.h
new file mode 100644 (file)
index 0000000..cff4760
--- /dev/null
@@ -0,0 +1,191 @@
+#ifndef IEEE_802_11
+#define IEEE_802_11  
+
+#include <linux/types.h>
+
+enum ieee_802_11_link_status_failure_reason {
+       reserved0, Unspecified=1, Previous_not_valid, 
+       Sender_Quits_ESS_or_IBSS,
+       Due_Inactivity, AP_Overload, 
+       Class_2_from_NonAuth,
+       Class_3_from_NonAuth,
+       Sender_Quits_BSS,
+       Association_requester_not_authenticated,
+       Reserved10 
+};
+       
+       
+#define IEEE_802_11_LINK_STATUS_FAILURE_REASON_STRINGS \
+{      \
+        {reserved0,            0xff," Reserved reason "},\
+        {Unspecified,          0xff," Unspecified Reason "},\
+        {Previous_not_valid,   0xff," Previous Authentication no longer valid "},\
+        {Sender_Quits_ESS_or_IBSS,0xff," Deauthenticated because sending station is leaving (has left) IBSS or ESS "},\
+        {Due_Inactivity,       0xff," Disassociated due to inactivity "},\
+        {AP_Overload,          0xff," Disassociated because AP is unable to handle all currently associated stations "},\
+        {Class_2_from_NonAuth, 0xff," Class 2 frame received from non-Authenticated station"},\
+        {Class_3_from_NonAuth, 0xff," Class 3 frame received from non­Associated station"},\
+        {Sender_Quits_BSS,     0xff," Disassociated because sending station is leaving (has left) BSS"},\
+        {Association_requester_not_authenticated,0xff," Station requesting (Re)Association is not Authenticated with responding station"},\
+        {Reserved10,           0xff," Reserved"},\
+       {0,0,NULL}\
+};
+
+
+
+struct ieee_802_11_header {
+       u16     frame_control;// needs to be subtyped
+       u16     duration;
+       u8      mac1[6];
+       u8      mac2[6];
+       u8      mac3[6];
+       u16     SeqCtl;
+       u8      mac4[6];
+       u16     gapLen;
+       u8      gap[8];
+};
+
+
+struct ieee_802_3_header {
+
+       u16     status;
+       u16     payload_length;
+       u8      dst_mac[6];
+       u8      src_mac[6];
+       
+};
+
+#define P80211_OUI_LEN 3
+
+struct ieee_802_11_snap_header { 
+
+       u8    dsap;   /* always 0xAA */
+       u8    ssap;   /* always 0xAA */
+       u8    ctrl;   /* always 0x03 */
+       u8    oui[P80211_OUI_LEN];    /* organizational universal id */
+
+} __attribute__ ((packed));
+
+#define P80211_LLC_OUI_LEN 3
+
+struct ieee_802_11_802_1H_header {
+
+       u8    dsap;   
+       u8    ssap;   /* always 0xAA */
+       u8    ctrl;   /* always 0x03 */
+       u8    oui[P80211_OUI_LEN];    /* organizational universal id */
+       u16    unknown1;      /* packet type ID fields */
+       u16    unknown2;                /* here is something like length in some cases */
+} __attribute__ ((packed));
+
+struct ieee_802_11_802_2_header {
+
+       u8    dsap;   
+       u8    ssap;   /* always 0xAA */
+       u8    ctrl;   /* always 0x03 */
+       u8    oui[P80211_OUI_LEN];    /* organizational universal id */
+       u8    type;      /* packet type ID field. i guess,  */
+
+} __attribute__ ((packed));
+
+
+
+// following is incoplete and may be incorrect and need reorganization
+
+#define ieee_802_11_frame_type_Management      0x00
+#define ieee_802_11_frame_type_Control         0x01
+#define ieee_802_11_frame_type_Data            0x10
+#define ieee_802_11_frame_type_Reserved                0x11
+
+#define ieee_802_11_frame_subtype_Association_Req      0x0 // Association Request
+#define ieee_802_11_frame_subtype_Association_Resp     0x1 // Association Response
+#define ieee_802_11_frame_subtype_Reassociation_Req    0x2 // Reassociation Request
+#define ieee_802_11_frame_subtype_Reassociation_Resp   0x3 // Reassociation Response
+#define ieee_802_11_frame_subtype_Probe_Req            0x4 // Probe Request
+#define ieee_802_11_frame_subtype_Probe_Resp           0x5 // Probe Response
+#define ieee_802_11_frame_subtype_Beacon               0x8 // Beacon
+#define ieee_802_11_frame_subtype_ATIM                         0x9 // ATIM
+#define ieee_802_11_frame_subtype_Disassociation       0xA // Disassociation
+#define ieee_802_11_frame_subtype_Authentication       0xB // Authentication
+#define ieee_802_11_frame_subtype_Deauthentication     0xC // Deauthentication
+#define ieee_802_11_frame_subtype_PS_Poll              0xA // PS-Poll
+#define ieee_802_11_frame_subtype_RTS                  0xB // RTS
+#define ieee_802_11_frame_subtype_CTS                  0xC // CTS
+#define ieee_802_11_frame_subtype_ACK                  0xD // ACK
+#define ieee_802_11_frame_subtype_CFEnd                0xE // CF-End
+#define ieee_802_11_frame_subtype_CFEnd_CFAck          0xF // CF-End + CF-Ack
+#define ieee_802_11_frame_subtype_Data                         0x0 // Data
+#define ieee_802_11_frame_subtype_Data_CFAck           0x1 // Data + CF-Ack
+#define ieee_802_11_frame_subtype_Data_CF_Poll                 0x2 // Data + CF-Poll
+#define ieee_802_11_frame_subtype_Data_CF_AckCF_Poll   0x3 // Data + CF-Ack + CF-Poll
+#define ieee_802_11_frame_subtype_NullFunction                 0x4 // Null Function (no data)
+#define ieee_802_11_frame_subtype_CF_Ack               0x5 // CF-Ack (no data)
+#define ieee_802_11_frame_subtype_CF_Poll              0x6 // CF-Poll (no data)
+#define ieee_802_11_frame_subtype_CF_AckCF_Poll        0x7 // CF-Ack + CF-Poll (no data)
+
+
+#define ieee_802_11_frame_subtype_strings {\
+       { ieee_802_11_frame_subtype_Association_Req,    0xF,"f  Association Request"},\
+       { ieee_802_11_frame_subtype_Association_Resp,   0xF,"1  Association Response"},\
+       { ieee_802_11_frame_subtype_Reassociation_Req,  0xF,"2  Reassociation Request"},\
+       { ieee_802_11_frame_subtype_Reassociation_Resp, 0xF,"3  Reassociation Response"},\
+       { ieee_802_11_frame_subtype_Probe_Req   ,       0xF,"4  Probe Request"},\
+       { ieee_802_11_frame_subtype_Probe_Resp  ,       0xF,"5  Probe Response"},\
+       { ieee_802_11_frame_subtype_Beacon      ,       0xF,"8  Beacon"},\
+       { ieee_802_11_frame_subtype_ATIM        ,       0xF,"9  ATIM"},\
+       { ieee_802_11_frame_subtype_Disassociation,     0xF,"A  Disassociation"},\
+       { ieee_802_11_frame_subtype_Authentication,     0xF,"B  Authentication"},\
+       { ieee_802_11_frame_subtype_Deauthentication,   0xF,"C  Deauthentication"},\
+       { ieee_802_11_frame_subtype_PS_Poll     ,       0xF,"A  PS-Poll"},\
+       { ieee_802_11_frame_subtype_RTS         ,       0xF,"B  RTS"},\
+       { ieee_802_11_frame_subtype_CTS         ,       0xF,"C  CTS"},\
+       { ieee_802_11_frame_subtype_ACK         ,       0xF,"D  ACK"},\
+       { ieee_802_11_frame_subtype_CFEnd       ,       0xF,"E  CF-End"},\
+       { ieee_802_11_frame_subtype_CFEnd_CFAck ,       0xF,"F  CF-End + CF-Ack"},\
+       { ieee_802_11_frame_subtype_Data        ,       0xF,"0  Data"},\
+       { ieee_802_11_frame_subtype_Data_CFAck  ,       0xF,"1  Data + CF-Ack"},\
+       { ieee_802_11_frame_subtype_Data_CFPoll ,       0xF,"2  Data + CF-Poll"},\
+       { ieee_802_11_frame_subtype_Data_CFAck_CFPoll,  0xF,"3  Data + CF-Ack + CF-Poll"},\
+       { ieee_802_11_frame_subtype_Null_Function ,     0xF,"4  Null Function (no data)"},\
+       { ieee_802_11_frame_subtype_CFAck ,             0xF,"5  CF-Ack (no data)"},\
+       { ieee_802_11_frame_subtype_CFPoll ,            0xF,"6  CF-Poll (no data)"},\
+       { ieee_802_11_frame_subtype_CFAck_CFPoll,       0xF,"y7  CF-Ack + CF-Poll (no data)"},\
+       { 0,0,NULL}\
+}
+struct ieee_802_11_frame_subtype_class {
+       u8      subtype;
+       u8      mask;
+       u8      class;
+       u8      type;
+};
+#define ieee_802_11_frame_subtype_classes {\
+       { ieee_802_11_frame_subtype_Association_Req,    0xF,2,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Association_Resp,   0xF,2,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Reassociation_Req,  0xF,2,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Reassociation_Resp, 0xF,2,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Probe_Req   ,       0xF,1,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Probe_Resp  ,       0xF,1,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Beacon      ,       0xF,1,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_ATIM        ,       0xF,1,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Disassociation,     0xF,2,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Authentication,     0xF,1,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_Deauthentication,   0xF,3,ieee_802_11_frame_type_Management},\
+       { ieee_802_11_frame_subtype_PS-Poll     ,       0xF,3,ieee_802_11_frame_type_Control},\
+       { ieee_802_11_frame_subtype_RTS         ,       0xF,1,ieee_802_11_frame_type_Control},\
+       { ieee_802_11_frame_subtype_CTS         ,       0xF,1,ieee_802_11_frame_type_Control},\
+       { ieee_802_11_frame_subtype_ACK         ,       0xF,1,ieee_802_11_frame_type_Control},\
+       { ieee_802_11_frame_subtype_CFEnd       ,       0xF,1,ieee_802_11_frame_type_Control},\
+       { ieee_802_11_frame_subtype_CFEnd_CFAck ,       0xF,1,ieee_802_11_frame_type_Control},\
+       { ieee_802_11_frame_subtype_Data        ,       0xF,3,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_Data_CFAck  ,       0xF,3,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_Data_CF_Poll        0xF,3,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_Data_CF_AckCF_Poll, 0xF,3,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_NullFunction        0xF,1,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_CF_Ack ,            0xF,1,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_CF_Poll ,           0xF,1,ieee_802_11_frame_type_Data},\
+       { ieee_802_11_frame_subtype_CF_AckCF_Poll,      0xF,1,ieee_802_11_frame_type_Data},\
+       { 0,0,NULL}\
+}
+
+
+#endif
\ No newline at end of file
index 0aa715cb39c60aa4ac2404d48c3e35a8c997beff..b5b39d0f59e33f537d8ebb82bacde90a4ff0f690 100644 (file)
@@ -4,7 +4,9 @@
 /*
  * /usr/include/linux/joystick.h  Version 1.2
  *
- * Copyright (C) 1996-1998 Vojtech Pavlik
+ * Copyright (C) 1996-1999 Vojtech Pavlik
+ *
+ * Sponsored by SuSE
  */
 
 /*
@@ -34,7 +36,7 @@
  * Version
  */
 
-#define JS_VERSION             0x01020d
+#define JS_VERSION             0x01020f
 
 /*
  * Types and constants for reading from /dev/js
@@ -128,64 +130,61 @@ struct JS_DATA_SAVE_TYPE {
 
 #include <linux/version.h>
 
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
-
-#ifndef LINUX_VERSION_CODE
-#error "You need to use at least 2.0 Linux kernel."
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
+#error "You need to use at least v2.2 Linux kernel."
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0)
-#error "You need to use at least 2.0 Linux kernel."
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-#define JS_HAS_RDTSC (current_cpu_data.x86_capability & 0x10)
-#include <linux/init.h>
-#else
-#ifdef MODULE
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,35)
-#define JS_HAS_RDTSC (x86_capability & 0x10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
+#include <asm/spinlock.h>
+typedef struct wait_queue *wait_queue_head_t;
+#define __setup(a,b)
+#define BASE_ADDRESS(x,i)      ((x)->base_address[i])
+#define DECLARE_WAITQUEUE(x,y) struct wait_queue x = { y, NULL }
+#define init_waitqueue_head(x) do { *(x) = NULL; } while (0)
+#define __set_current_state(x) current->state = x
+#define SETUP_PARAM            char *str, int *ints
+#define SETUP_PARSE(x)         do {} while (0)
 #else
-#define JS_HAS_RDTSC 0
-#endif
-#else
-#define JS_HAS_RDTSC (x86_capability & 0x10)
-#endif
-#define __initdata
-#define __init
-#define __cli cli
-#define __save_flags(flags) save_flags(flags)
-#define __restore_flags(flags) restore_flags(flags)
-#define spin_lock_irqsave(x, flags) do { save_flags(flags); cli(); } while (0)
-#define spin_unlock_irqrestore(x, flags) restore_flags(flags)
-#define spin_lock_init(x) do { } while (0)
-typedef struct { int something; } spinlock_t;
-#define SPIN_LOCK_UNLOCKED { 0 }
-#define MODULE_AUTHOR(x)
-#define MODULE_PARM(x,y)
-#define MODULE_SUPPORTED_DEVICE(x)
-#define signal_pending(x) (((x)->signal) & ~((x)->blocked))
+#include <linux/spinlock.h>
+#define BASE_ADDRESS(x,i)      ((x)->resource[i].start)
+#define SETUP_PARAM            char *str
+#define SETUP_PARSE(x)         int ints[x]; get_options(str, x, ints)
 #endif
 
+#define PCI_VENDOR_ID_AUREAL   0x12eb
+
 /*
  * Parport stuff
  */
 
-#define USE_PARPORT
-
 #include <linux/parport.h>
-#include <linux/parport_pc.h>
+
+#define JS_PAR_STATUS_INVERT   (0x80)
+#define JS_PAR_CTRL_INVERT     (0x04)
 #define JS_PAR_DATA_IN(y)      parport_read_data(y->port)
 #define JS_PAR_DATA_OUT(x,y)   parport_write_data(y->port, x)
 #define JS_PAR_STATUS(y)       parport_read_status(y->port)
+
+#ifndef PARPORT_NEED_GENERIC_OPS
 #define JS_PAR_CTRL_IN(y)      parport_read_control(y->port)
-#define JS_PAR_CTRL_OUT(x,y)   parport_write_control(y->port, x)
-#define JS_PAR_ECTRL_OUT(x,y)  outb(x, ECONTROL(y->port))
+#else
+#define JS_PAR_CTRL_IN(y)      inb(y->port->base+2) 
+#endif
 
-#define JS_PAR_STATUS_INVERT   (0x80)
-#define JS_PAR_CTRL_INVERT     (0x04)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
+#define JS_PAR_CTRL_OUT(x,y)   parport_write_control(y->port, x)
+#define JS_PAR_ECTRL_OUT(x,y)  parport_write_econtrol(y->port, x)
+#else
+#define JS_PAR_CTRL_OUT(x,y)                                   \
+       do {                                                    \
+               if ((x) & 0x20) parport_data_reverse(y->port);  \
+               else parport_data_forward(y->port);             \
+               parport_write_control(y->port, (x) & ~0x20);    \
+       } while (0)
+#define JS_PAR_ECTRL_OUT(x,y)  /*parport sets PS/2 mode on ECR chips */
+#define PARPORT_MODE_PCPS2     PARPORT_MODE_TRISTATE
+#define PARPORT_MODE_PCECPPS2  PARPORT_MODE_TRISTATE
+#endif
 
 /*
  * Internal types
@@ -194,8 +193,6 @@ typedef struct { int something; } spinlock_t;
 struct js_dev;
 
 typedef int (*js_read_func)(void *info, int **axes, int **buttons);
-typedef unsigned int (*js_time_func)(void);
-typedef int (*js_delta_func)(unsigned int x, unsigned int y);
 typedef int (*js_ops_func)(struct js_dev *dev);
 
 struct js_data {
@@ -239,20 +236,14 @@ struct js_port {
        struct js_corr **corr;
        void *info;
        int ndevs;
+       int fail;
+       int total;
 };
 
 /*
  * Sub-module interface
  */
 
-extern unsigned int js_time_speed;
-extern js_time_func js_get_time;
-extern js_delta_func js_delta;
-
-extern unsigned int js_time_speed_a;
-extern js_time_func js_get_time_a;
-extern js_delta_func js_delta_a;
-
 extern struct js_port *js_register_port(struct js_port *port, void *info,
        int devs, int infos, js_read_func read);
 extern struct js_port *js_unregister_port(struct js_port *port);
@@ -270,19 +261,19 @@ extern int js_am_init(void);
 extern int js_an_init(void);
 extern int js_as_init(void);
 extern int js_console_init(void);
+extern int js_cr_init(void);
 extern int js_db9_init(void);
 extern int js_gr_init(void);
 extern int js_l4_init(void);
 extern int js_lt_init(void);
+extern int js_mag_init(void);
+extern int js_pci_init(void);
 extern int js_sw_init(void);
+extern int js_sball_init(void);
+extern int js_orb_init(void);
 extern int js_tm_init(void);
-
-extern void js_am_setup(char *str, int *ints);
-extern void js_an_setup(char *str, int *ints);
-extern void js_as_setup(char *str, int *ints);
-extern void js_console_setup(char *str, int *ints);
-extern void js_db9_setup(char *str, int *ints);
-extern void js_l4_setup(char *str, int *ints);
+extern int js_tg_init(void);
+extern int js_war_init(void);
 
 #endif /* __KERNEL__ */
 
index 3bc0430bc43ac94bce3c9247dccd735ea6cff0a6..73d4c2adede434aef63cbc52c7c28786bc61799d 100644 (file)
@@ -4,5 +4,6 @@
 #include <asm/mman.h>
 
 #define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED   2
 
 #endif /* _LINUX_MMAN_H */
index 11acbd7b755a93cfc682bc84573a734d890337e5..0ce8596ed84176e229fd9af75bde3afa06865233 100644 (file)
@@ -213,7 +213,7 @@ static inline void ncp_kfree_s(void *obj, int size)
 #endif                         /* DEBUG_NCP_MALLOC */
 
 /* linux/fs/ncpfs/inode.c */
-int ncp_notify_change(struct dentry *, struct iattr *attr);
+int ncp_notify_change(struct dentry *, struct iattr *);
 struct super_block *ncp_read_super(struct super_block *, void *, int);
 struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
 void ncp_update_inode(struct inode *, struct ncp_entry_info *);
@@ -250,54 +250,24 @@ int ncp_mmap(struct file *, struct vm_area_struct *);
 /* linux/fs/ncpfs/ncplib_kernel.c */
 int ncp_make_closed(struct inode *);
 
-static inline void str_upper(char *name)
-{
-       while (*name) {
-               if (*name >= 'a' && *name <= 'z') {
-                       *name -= ('a' - 'A');
-               }
-               name++;
-       }
-}
-
-static inline void str_lower(char *name)
-{
-       while (*name) {
-               if (*name >= 'A' && *name <= 'Z') {
-                       *name += ('a' - 'A');
-               }
-               name++;
-       }
-}
+#define ncp_namespace(i)       (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber])
 
-static inline int ncp_namespace(struct inode *inode)
+static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator)
 {
-       struct ncp_server *server = NCP_SERVER(inode);
-       return server->name_space[NCP_FINFO(inode)->volNumber];
-}
-
-static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) {
-#if defined(CONFIG_NCPFS_NFS_NS) || defined(CONFIG_NCPFS_OS2_NS)
+#ifdef CONFIG_NCPFS_SMALLDOS
        int ns = ncp_namespace(i);
-#endif
-#if defined(CONFIG_NCPFS_SMALLDOS) && defined(CONFIG_NCPFS_OS2_NS)
-       if ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS))
-               return 0;
-#endif
-       return
+
+       if ((ns == NW_NS_DOS)
 #ifdef CONFIG_NCPFS_OS2_NS
-       (ns == NW_NS_OS2) ||
-#endif /* CONFIG_NCPFS_OS2_NS */
-#ifdef CONFIG_NCPFS_NFS_NS
-       (ns == NW_NS_NFS) ||
-#endif /* CONFIG_NCPFS_NFS_NS */
-       0;
+               || ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS))
+#endif /* CONFIG_NCPFS_OS2_NS */
+                               )
+               return 0;
+#endif /* CONFIG_NCPFS_SMALLDOS */
+       return 1;
 }
 
-static inline int ncp_preserve_case(struct inode *i)
-{
-       return ncp_preserve_entry_case(i, NW_NS_OS2);
-}
+#define ncp_preserve_case(i)   (ncp_namespace(i) != NW_NS_DOS)
 
 static inline int ncp_case_sensitive(struct inode *i)
 {
index 6f71f8e37e2a6315097fe4bcedac0a0843015319..46f100eb44266a5bbfe066bafc6d43fddb58f7d4 100644 (file)
@@ -52,23 +52,23 @@ struct ncp_server {
 
        int root_setuped;
 
-/* info for packet signing */
-       int sign_wanted;        /* 1=Server needs signed packets */
-       int sign_active;        /* 0=don't do signing, 1=do */
+       /* info for packet signing */
+       int sign_wanted;        /* 1=Server needs signed packets */
+       int sign_active;        /* 0=don't do signing, 1=do */
        char sign_root[8];      /* generated from password and encr. key */
        char sign_last[16];     
 
        /* Authentication info: NDS or BINDERY, username */
        struct {
-               int    auth_type;
-               size_t object_name_len;
-               void*  object_name;
-               int    object_type;
+               int     auth_type;
+               size_t  object_name_len;
+               void*   object_name;
+               int     object_type;
        } auth;
        /* Password info */
        struct {
-               size_t len;
-               void*  data;
+               size_t  len;
+               void*   data;
        } priv;
 
        /* nls info: codepage for volume and charset for I/O */
@@ -77,10 +77,18 @@ struct ncp_server {
 
        /* maximum age in jiffies */
        int dentry_ttl;
+
+       /* miscellaneous */
+       unsigned int flags;
 };
 
 #define ncp_sb_info    ncp_server
 
+#define NCP_FLAG_UTF8  1
+
+#define NCP_CLR_FLAG(server, flag)     ((server)->flags &= ~(flag))
+#define NCP_SET_FLAG(server, flag)     ((server)->flags |= (flag))
+#define NCP_IS_FLAG(server, flag)      ((server)->flags & (flag))
 
 static inline int ncp_conn_valid(struct ncp_server *server)
 {
index c188fc8083e972e33c045803817872cf6ef3eb48..e476cdbf9ae7af25f0a52f39e5a86e48df286de8 100644 (file)
@@ -1,5 +1,8 @@
 /*
  * NFS protocol definitions
+ *
+ * This file contains constants mostly for Version 2 of the protocol,
+ * but also has a couple of NFSv3 bits in (notably the error codes).
  */
 #ifndef _LINUX_NFS_H
 #define _LINUX_NFS_H
 #define NFSMODE_FIFO   0010000
 
        
-enum nfs_stat {
-       NFS_OK = 0,
-       NFSERR_PERM = 1,
-       NFSERR_NOENT = 2,
-       NFSERR_IO = 5,
-       NFSERR_NXIO = 6,
-       NFSERR_EAGAIN = 11,
-       NFSERR_ACCES = 13,
-       NFSERR_EXIST = 17,
-       NFSERR_XDEV = 18,
-       NFSERR_NODEV = 19,
-       NFSERR_NOTDIR = 20,
-       NFSERR_ISDIR = 21,
-       NFSERR_INVAL = 22,      /* that Sun forgot */
-       NFSERR_FBIG = 27,
-       NFSERR_NOSPC = 28,
-       NFSERR_ROFS = 30,
-       NFSERR_OPNOTSUPP = 45,
-       NFSERR_NAMETOOLONG = 63,
-       NFSERR_NOTEMPTY = 66,
-       NFSERR_DQUOT = 69,
-       NFSERR_STALE = 70,
-       NFSERR_WFLUSH = 99
-};
+/*
+ * NFS stats. The good thing with these values is that NFSv3 errors are
+ * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
+ * no-one uses anyway), so we can happily mix code as long as we make sure
+ * no NFSv3 errors are returned to NFSv2 clients.
+ * Error codes that have a `--' in the v2 column are not part of the
+ * standard, but seem to be widely used nevertheless.
+ */
+ enum nfs_stat {
+       NFS_OK = 0,                     /* v2 v3 */
+       NFSERR_PERM = 1,                /* v2 v3 */
+       NFSERR_NOENT = 2,               /* v2 v3 */
+       NFSERR_IO = 5,                  /* v2 v3 */
+       NFSERR_NXIO = 6,                /* v2 v3 */
+       NFSERR_EAGAIN = 11,             /* v2 v3 */
+       NFSERR_ACCES = 13,              /* v2 v3 */
+       NFSERR_EXIST = 17,              /* v2 v3 */
+       NFSERR_XDEV = 18,               /*    v3 */
+       NFSERR_NODEV = 19,              /* v2 v3 */
+       NFSERR_NOTDIR = 20,             /* v2 v3 */
+       NFSERR_ISDIR = 21,              /* v2 v3 */
+       NFSERR_INVAL = 22,              /* v2 v3 that Sun forgot */
+       NFSERR_FBIG = 27,               /* v2 v3 */
+       NFSERR_NOSPC = 28,              /* v2 v3 */
+       NFSERR_ROFS = 30,               /* v2 v3 */
+       NFSERR_MLINK = 31,              /*    v3 */
+       NFSERR_OPNOTSUPP = 45,          /* v2 v3 */
+       NFSERR_NAMETOOLONG = 63,        /* v2 v3 */
+       NFSERR_NOTEMPTY = 66,           /* v2 v3 */
+       NFSERR_DQUOT = 69,              /* v2 v3 */
+       NFSERR_STALE = 70,              /* v2 v3 */
+       NFSERR_REMOTE = 71,             /* v2 v3 */
+       NFSERR_WFLUSH = 99,             /* v2    */
+       NFSERR_BADHANDLE = 10001,       /*    v3 */
+       NFSERR_NOT_SYNC = 10002,        /*    v3 */
+       NFSERR_BAD_COOKIE = 10003,      /*    v3 */
+       NFSERR_NOTSUPP = 10004,         /*    v3 */
+       NFSERR_TOOSMALL = 10005,        /*    v3 */
+       NFSERR_SERVERFAULT = 10006,     /*    v3 */
+       NFSERR_BADTYPE = 10007,         /*    v3 */
+       NFSERR_JUKEBOX = 10008          /*    v3 */
+ };
+/* NFSv2 file types - beware, these are not the same in NFSv3 */
 
 enum nfs_ftype {
        NFNON = 0,
@@ -93,7 +116,14 @@ struct nfs_fh {
 #define NFS_MNT_PORT           627
 #define NFS_MNTPROC_MNT                1
 #define NFS_MNTPROC_UMNT       3
-#endif
+
+/*
+ * This is really a general kernel constant, but since nothing like
+ * this is defined in the kernel headers, I have to do it here.
+ */
+#define NFS_OFFSET_MAX         ((__s64)((~(__u64)0) >> 1))
+
+#endif /* __KERNEL__ */
 
 #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES)
 
index 94ec44b6a059dd68bef88744e91350c4861b718b..cf5405b35ce43d23ee49201272455a65e15b2b9b 100644 (file)
@@ -12,7 +12,6 @@
 #define NFS3_MAXPATHLEN                PATH_MAX
 #define NFS3_MAXNAMLEN         NAME_MAX
 #define NFS3_MAXGROUPS         16
-#define NFS3_FHSIZE            NFS_FHSIZE
 #define NFS3_COOKIESIZE                4
 #define NFS3_FIFO_DEV          (-1)
 #define NFS3MODE_FMT           0170000
 #define NFS3MODE_FIFO          0010000
 
        
-enum nfs3_stat {
-       NFS3_OK                 = 0,
-       NFS3ERR_PERM            = 1,
-       NFS3ERR_NOENT           = 2,
-       NFS3ERR_IO              = 5,
-       NFS3ERR_NXIO            = 6,
-       NFS3ERR_EAGAIN          = 11,
-       NFS3ERR_ACCES           = 13,
-       NFS3ERR_EXIST           = 17,
-       NFS3ERR_XDEV            = 18,   /* new in NFSv3 */
-       NFS3ERR_NODEV           = 19,
-       NFS3ERR_NOTDIR          = 20,
-       NFS3ERR_ISDIR           = 21,
-       NFS3ERR_INVAL           = 22,   /* new in NFSv3 */
-       NFS3ERR_FBIG            = 27,
-       NFS3ERR_NOSPC           = 28,
-       NFS3ERR_ROFS            = 30,
-       NFS3ERR_MLINK           = 31,   /* new in NFSv3 */
-       NFS3ERR_NAMETOOLONG     = 63,
-       NFS3ERR_NOTEMPTY        = 66,
-       NFS3ERR_DQUOT           = 69,
-       NFS3ERR_STALE           = 70,
-       NFS3ERR_REMOTE          = 71,   /* new in NFSv3 */
-       NFS3ERR_BADHANDLE       = 10001,/* ditto */
-       NFS3ERR_NOT_SYNC        = 10002,/* ditto */
-       NFS3ERR_BAD_COOKIE      = 10003,/* ditto */
-       NFS3ERR_NOTSUPP         = 10004,/* ditto */
-       NFS3ERR_TOOSMALL        = 10005,/* ditto */
-       NFS3ERR_SERVERFAULT     = 10006,/* ditto */
-       NFS3ERR_BADTYPE         = 10007,/* ditto */
-       NFS3ERR_JUKEBOX         = 10008,/* ditto */
-};
+/* Flags for access() call */
+#define NFS3_ACCESS_READ       0x0001
+#define NFS3_ACCESS_LOOKUP     0x0002
+#define NFS3_ACCESS_MODIFY     0x0004
+#define NFS3_ACCESS_EXTEND     0x0008
+#define NFS3_ACCESS_DELETE     0x0010
+#define NFS3_ACCESS_EXECUTE    0x0020
+
+/* Flags for create mode */
+#define NFS3_CREATE_UNCHECKED  0
+#define NFS3_CREATE_GUARDED    1
+#define NFS3_CREATE_EXCLUSIVE  2
+
+/* NFSv3 file system properties */
+#define NFS3_FSF_LINK          0x0001
+#define NFS3_FSF_SYMLINK       0x0002
+#define NFS3_FSF_HOMOGENEOUS   0x0008
+#define NFS3_FSF_CANSETTIME    0x0010
+/* Some shorthands. See fs/nfsd/nfs3proc.c */
+#define NFS3_FSF_DEFAULT       0x001B
+#define NFS3_FSF_BILLYBOY      0x0018
+#define NFS3_FSF_READONLY      0x0008
 
 enum nfs3_ftype {
        NF3NON  = 0,
@@ -92,10 +81,8 @@ enum nfs3_ftype {
 
 #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES)
 
-struct nfs3_fh {
-       __u32                   size;
-       __u8                    data[NFS3_FHSIZE];
-};
+/* Number of 32bit words in post_op_attr */
+#define NFS3_POST_OP_ATTR_WORDS                22
 
 struct nfs3_fattr {
        enum nfs3_ftype         type;
index 0727e12889a5b3b12caad839532c0dc73b8666cb..22c7ff1e8d90f9d415685e2d73d435e2c90d63f1 100644 (file)
@@ -1,19 +1,14 @@
 /*
- * include/linux/nfsd/nfsconst.h
+ * include/linux/nfsd/const.h
  *
  * Various constants related to NFS.
  *
- * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
+ * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
  */
 
-#ifndef __NFSCONST_H__
-#define __NFSCONST_H__
+#ifndef _LINUX_NFSD_CONST_H
+#define _LINUX_NFSD_CONST_H
 
-#include <linux/limits.h>
-#include <linux/types.h>
-#include <linux/unistd.h>
-#include <linux/dirent.h>
-#include <linux/fs.h>
 #include <linux/nfs.h>
 
 /*
@@ -33,7 +28,7 @@
 
 #define NFS3_MAXPATHLEN                PATH_MAX
 #define NFS3_MAXNAMLEN         NAME_MAX
-#define NFS3_FHSIZE            NFS_FHSIZE
+#define NFS3_FHSIZE            64
 #define NFS3_COOKIEVERFSIZE    8
 #define NFS3_CREATEVERFSIZE    8
 #define NFS3_WRITEVERFSIZE     8
 # define NFS_SUPER_MAGIC       0x6969
 #endif
 
-/*
- * NFS stats. The good thing with these values is that NFSv3 errors are
- * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
- * no-one uses anyway), so we can happily mix code as long as we make sure
- * no NFSv3 errors are returned to NFSv2 clients.
- */
-#define NFS_OK                 0               /* v2 v3 */
-#define NFSERR_PERM            1               /* v2 v3 */
-#define NFSERR_NOENT           2               /* v2 v3 */
-#define NFSERR_IO              5               /* v2 v3 */
-#define NFSERR_NXIO            6               /* v2 v3 */
-#define NFSERR_ACCES           13              /* v2 v3 */
-#define NFSERR_EXIST           17              /* v2 v3 */
-#define NFSERR_XDEV            18              /*    v3 */
-#define NFSERR_NODEV           19              /* v2 v3 */
-#define NFSERR_NOTDIR          20              /* v2 v3 */
-#define NFSERR_ISDIR           21              /* v2 v3 */
-#define NFSERR_INVAL           22              /*    v3 */
-#define NFSERR_FBIG            27              /* v2 v3 */
-#define NFSERR_NOSPC           28              /* v2 v3 */
-#define NFSERR_ROFS            30              /* v2 v3 */
-#define NFSERR_MLINK           31              /*    v3 */
-#define NFSERR_NAMETOOLONG     63              /* v2 v3 */
-#define NFSERR_NOTEMPTY                66              /* v2 v3 */
-#define NFSERR_DQUOT           69              /* v2 v3 */
-#define NFSERR_STALE           70              /* v2 v3 */
-#define NFSERR_REMOTE          71              /*    v3 */
-#define NFSERR_WFLUSH          99              /* v2    */
-#define NFSERR_BADHANDLE       10001           /*    v3 */
-#define NFSERR_NOT_SYNC                10002           /*    v3 */
-#define NFSERR_BAD_COOKIE      10003           /*    v3 */
-#define NFSERR_NOTSUPP         10004           /*    v3 */
-#define NFSERR_TOOSMALL                10005           /*    v3 */
-#define NFSERR_SERVERFAULT     10006           /*    v3 */
-#define NFSERR_BADTYPE         10007           /*    v3 */
-#define NFSERR_JUKEBOX         10008           /*    v3 */
-
 #endif /* __KERNEL__ */
 
-#endif /* __NFSCONST_H__ */
+#endif /* _LINUX_NFSD_CONST_H */
index 1f3a6148619396f112bff24ef4ef93e59d046915..febb7c74150e81349843deef18deebdb596c49b2 100644 (file)
@@ -4,16 +4,17 @@
  * Public declarations for NFS exports. The definitions for the
  * syscall interface are in nfsctl.h
  *
- * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
+ * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
  */
 
 #ifndef NFSD_EXPORT_H
 #define NFSD_EXPORT_H
 
-#include <linux/types.h>
-#include <linux/socket.h>
-#include <linux/in.h>
-#include <linux/fs.h>
+#include <asm/types.h>
+#ifdef __KERNEL__
+# include <linux/types.h>
+# include <linux/in.h>
+#endif
 
 /*
  * Important limits for the exports stuff.
index 4c32fe530be4712902af246161f460e4ae8b679c..5799d3d70cc4ac3a7b67e82b816299cd2481bad3 100644 (file)
@@ -24,7 +24,7 @@
 /*
  * nfsd version
  */
-#define NFSD_VERSION           "0.4"
+#define NFSD_VERSION           "0.5"
 
 #ifdef __KERNEL__
 /*
@@ -146,6 +146,7 @@ extern u32  nfs_ok,
                nfserr_rofs,
                nfserr_mlink,
                nfserr_nametoolong,
+               nfserr_notempty,
                nfserr_dquot,
                nfserr_stale,
                nfserr_remote,
index ca34d85e330247d4861ee90ff502b24e5776be23..f12b87153fea5db26f6031bec85227f79a12d78a 100644 (file)
  * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
  */
 
-#ifndef NFSD_FH_H
-#define NFSD_FH_H
+#ifndef _LINUX_NFSD_FH_H
+#define _LINUX_NFSD_FH_H
 
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/fs.h>
+#include <asm/types.h>
+#ifdef __KERNEL__
+# include <linux/types.h>
+# include <linux/string.h>
+# include <linux/fs.h>
+#endif
 #include <linux/nfsd/const.h>
 #include <linux/nfsd/debug.h>
 
@@ -83,10 +86,6 @@ typedef struct svc_fh {
        struct knfs_fh          fh_handle;      /* FH data */
        struct dentry *         fh_dentry;      /* validated dentry */
        struct svc_export *     fh_export;      /* export pointer */
-       size_t                  fh_pre_size;    /* size before operation */
-       time_t                  fh_pre_mtime;   /* mtime before oper */
-       time_t                  fh_pre_ctime;   /* ctime before oper */
-       unsigned long           fh_post_version;/* inode version after oper */
        unsigned char           fh_locked;      /* inode locked by us */
        unsigned char           fh_dverified;   /* dentry has been checked */
 } svc_fh;
@@ -138,10 +137,9 @@ fh_lock(struct svc_fh *fhp)
        struct dentry   *dentry = fhp->fh_dentry;
        struct inode    *inode;
 
-       /*
        dfprintk(FILEOP, "nfsd: fh_lock(%x/%ld) locked = %d\n",
-                       SVCFH_DEV(fhp), SVCFH_INO(fhp), fhp->fh_locked);
-        */
+                       SVCFH_DEV(fhp), (long)SVCFH_INO(fhp), fhp->fh_locked);
+
        if (!fhp->fh_dverified) {
                printk(KERN_ERR "fh_lock: fh not verified!\n");
                return;
@@ -154,8 +152,6 @@ fh_lock(struct svc_fh *fhp)
 
        inode = dentry->d_inode;
        down(&inode->i_sem);
-       if (!fhp->fh_pre_mtime)
-               fhp->fh_pre_mtime = inode->i_mtime;
        fhp->fh_locked = 1;
 }
 
@@ -172,41 +168,11 @@ fh_unlock(struct svc_fh *fhp)
                struct dentry *dentry = fhp->fh_dentry;
                struct inode *inode = dentry->d_inode;
 
-               if (!fhp->fh_post_version)
-                       fhp->fh_post_version = inode->i_version;
                fhp->fh_locked = 0;
                up(&inode->i_sem);
        }
 }
-
-/*
- * Release an inode
- */
-#if 0
-#define fh_put(fhp)    __fh_put(fhp, __FILE__, __LINE__)
-
-static inline void
-__fh_put(struct svc_fh *fhp, char *file, int line)
-{
-       struct dentry   *dentry;
-
-       if (!fhp->fh_dverified)
-               return;
-
-       dentry = fhp->fh_dentry;
-       if (!dentry->d_count) {
-               printk("nfsd: trying to free free dentry in %s:%d\n"
-                      "      file %s/%s\n",
-                      file, line,
-                      dentry->d_parent->d_name.name, dentry->d_name.name);
-       } else {
-               fh_unlock(fhp);
-               fhp->fh_dverified = 0;
-               dput(dentry);
-       }
-}
-#endif
-
 #endif /* __KERNEL__ */
 
-#endif /* NFSD_FH_H */
+
+#endif /* _LINUX_NFSD_FH_H */
index 019d33f7664e8262fba1187412d140defaa48f98..1d42ec550e2f055e1023f693bcd56b29a50c5c5e 100644 (file)
@@ -3,15 +3,18 @@
  *
  * This file holds all declarations for the knfsd syscall interface.
  *
- * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
+ * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
  */
 
 #ifndef NFSD_SYSCALL_H
 #define NFSD_SYSCALL_H
 
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/socket.h>
+#include <asm/types.h>
+#ifdef __KERNEL__
+# include <linux/config.h>
+# include <linux/types.h>
+# include <linux/in.h>
+#endif 
 #include <linux/posix_types.h>
 #include <linux/nfsd/const.h>
 #include <linux/nfsd/export.h>
index efcd5892051109ea1e39d022630fd0b38f62e5f8..9e39d3cd4195022cc8b3ce648fb3adb1bdf3b38f 100644 (file)
@@ -7,7 +7,8 @@ struct nls_table {
        char *charset;
        unsigned char **page_uni2charset;
        struct nls_unicode *charset2uni;
-
+       unsigned char *charset2lower;
+       unsigned char *charset2upper;
        void (*inc_use_count) (void);
        void (*dec_use_count) (void);
        struct nls_table *next;
index 7e64105a8566d098dd1b63ff142d778c16530ce1..fdadf7a9f8ae930e5a8bb5c9d5d53ee2ab7806aa 100644 (file)
@@ -150,12 +150,12 @@ asmlinkage long sys_acct(const char *name)
 {
        struct file *file = NULL, *old_acct = NULL;
        char *tmp;
-       int error = -EPERM;
+       int error;
 
-       lock_kernel();
        if (!capable(CAP_SYS_PACCT))
-               goto out;
+               return -EPERM;
 
+       lock_kernel();
        if (name) {
                tmp = getname(name);
                error = PTR_ERR(tmp);
@@ -257,8 +257,6 @@ static comp_t encode_comp_t(unsigned long value)
  *  into the accounting file. This function should only be called from
  *  do_exit().
  */
-#define KSTK_EIP(stack) (((unsigned long *)(stack))[1019])
-#define KSTK_ESP(stack) (((unsigned long *)(stack))[1022])
 
 /*
  *  do_acct_process does all actual work.
index 88232ba05df9b2ebd3d666a9fad94c166327c1f3..c8321290f12f13bc8e92c29329bbaf601e49bca2 100644 (file)
@@ -982,7 +982,6 @@ static int do_swap_page(struct task_struct * tsk,
        struct vm_area_struct * vma, unsigned long address,
        pte_t * page_table, swp_entry_t entry, int write_access)
 {
-       int dograb = 0;
        struct page *page = lookup_swap_cache(entry);
        pte_t pte;
 
index 118aeac7bad695618ed9036c2a1e7b10ad1e24a8..2ecdf9ed6e70cdffe47d82fd8e7e058e9a86df40 100644 (file)
@@ -124,15 +124,14 @@ oops_we_failed:
 }
 
 static inline unsigned long move_vma(struct vm_area_struct * vma,
-       unsigned long addr, unsigned long old_len, unsigned long new_len)
+       unsigned long addr, unsigned long old_len, unsigned long new_len,
+       unsigned long new_addr)
 {
        struct vm_area_struct * new_vma;
 
        new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
        if (new_vma) {
-               unsigned long new_addr = get_unmapped_area(addr, new_len);
-
-               if (new_addr && !move_page_tables(current->mm, new_addr, addr, old_len)) {
+               if (!move_page_tables(current->mm, new_addr, addr, old_len)) {
                        *new_vma = *vma;
                        new_vma->vm_start = new_addr;
                        new_vma->vm_end = new_addr+new_len;
@@ -163,20 +162,49 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
 /*
  * Expand (or shrink) an existing mapping, potentially moving it at the
  * same time (controlled by the MREMAP_MAYMOVE flag and available VM space)
+ *
+ * MREMAP_FIXED option added 5-Dec-1999 by Benjamin LaHaise
+ * This option implies MREMAP_MAYMOVE.
  */
 asmlinkage unsigned long sys_mremap(unsigned long addr,
        unsigned long old_len, unsigned long new_len,
-       unsigned long flags)
+       unsigned long flags, unsigned long new_addr)
 {
        struct vm_area_struct *vma;
        unsigned long ret = -EINVAL;
 
        down(&current->mm->mmap_sem);
+       if (flags & ~(MREMAP_FIXED | MREMAP_MAYMOVE))
+               goto out;
+
        if (addr & ~PAGE_MASK)
                goto out;
+
        old_len = PAGE_ALIGN(old_len);
        new_len = PAGE_ALIGN(new_len);
 
+       /* new_addr is only valid if MREMAP_FIXED is specified */
+       if (flags & MREMAP_FIXED) {
+               if (new_addr & ~PAGE_MASK)
+                       goto out;
+               if (!(flags & MREMAP_MAYMOVE))
+                       goto out;
+
+               if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len)
+                       goto out;
+
+               /* Check if the location we're moving into overlaps the
+                * old location at all, and fail if it does.
+                */
+               if ((new_addr <= addr) && (new_addr+new_len) > addr)
+                       goto out;
+
+               if ((addr <= new_addr) && (addr+old_len) > new_addr)
+                       goto out;
+
+               do_munmap(new_addr, new_len);
+       }
+
        /*
         * Always allow a shrinking remap: that just unmaps
         * the unnecessary pages..
@@ -184,11 +212,12 @@ asmlinkage unsigned long sys_mremap(unsigned long addr,
        ret = addr;
        if (old_len >= new_len) {
                do_munmap(addr+new_len, old_len - new_len);
-               goto out;
+               if (!(flags & MREMAP_FIXED) || (new_addr == addr))
+                       goto out;
        }
 
        /*
-        * Ok, we need to grow..
+        * Ok, we need to grow..  or relocate.
         */
        ret = -EFAULT;
        vma = find_vma(current->mm, addr);
@@ -214,8 +243,11 @@ asmlinkage unsigned long sys_mremap(unsigned long addr,
            !vm_enough_memory((new_len - old_len) >> PAGE_SHIFT))
                goto out;
 
-       /* old_len exactly to the end of the area.. */
+       /* old_len exactly to the end of the area..
+        * And we're not relocating the area.
+        */
        if (old_len == vma->vm_end - addr &&
+           !((flags & MREMAP_FIXED) && (addr != new_addr)) &&
            (old_len != new_len || !(flags & MREMAP_MAYMOVE))) {
                unsigned long max_addr = TASK_SIZE;
                if (vma->vm_next)
@@ -241,10 +273,15 @@ asmlinkage unsigned long sys_mremap(unsigned long addr,
         * We weren't able to just expand or shrink the area,
         * we need to create a new one and move it..
         */
-       if (flags & MREMAP_MAYMOVE)
-               ret = move_vma(vma, addr, old_len, new_len);
-       else
-               ret = -ENOMEM;
+       ret = -ENOMEM;
+       if (flags & MREMAP_MAYMOVE) {
+               if (!(flags & MREMAP_FIXED)) {
+                       new_addr = get_unmapped_area(addr, new_len);
+                       if (!new_addr)
+                               goto out;
+               }
+               ret = move_vma(vma, addr, old_len, new_len, new_addr);
+       }
 out:
        up(&current->mm->mmap_sem);
        return ret;
index dcbc37c35cd12e4eab0853a8296f8a997727881c..ad6660b73d77e38078a958b5ae54df6933f3163c 100644 (file)
--- a/mm/numa.c
+++ b/mm/numa.c
@@ -7,7 +7,6 @@
 #include <linux/init.h>
 #include <linux/bootmem.h>
 #include <linux/mmzone.h>
-#include <linux/init.h>
 #include <linux/spinlock.h>
 
 int numnodes = 1;      /* Initialized for UMA platforms */
index df722997f6f4b880c3229cbf42dce84da664038f..b4d6bd81a3a8d306c1dcd24b1e2ff80dd67b09d5 100644 (file)
@@ -76,6 +76,10 @@ rpc_create_client(struct rpc_xprt *xprt, char *servname,
        dprintk("RPC: creating %s client for %s (xprt %p)\n",
                program->name, servname, xprt);
 
+#ifdef RPC_DEBUG
+       rpc_register_sysctl();
+#endif
+
        if (!xprt)
                goto out;
        if (vers >= program->nrvers || !(version = program->version[vers]))
index b2b37e859861b994335d3387a7f6813eeb27813f..9016889325f213a8809dce77dbf95d4eacd0e1f3 100644 (file)
@@ -126,6 +126,7 @@ svc_proc_read(char *buffer, char **start, off_t offset, int count,
 static inline struct proc_dir_entry *
 do_register(const char *name, void *data, int issvc)
 {
+       rpc_proc_init();
        dprintk("RPC: registering /proc/net/rpc/%s\n", name);
        return create_proc_read_entry(name, 0, proc_net_rpc, 
                                      issvc? svc_proc_read : rpc_proc_read,
index e0be9527cf9a2ff6ce47825130a83d00570782e2..9a186104168b4ccf5f66986c4b983986f697b0b7 100644 (file)
@@ -76,9 +76,7 @@ EXPORT_SYMBOL(svc_makesock);
 
 /* RPC statistics */
 #ifdef CONFIG_PROC_FS
-EXPORT_SYMBOL(rpc_proc_init);
 EXPORT_SYMBOL(rpc_proc_register);
-EXPORT_SYMBOL(rpc_register_sysctl);
 EXPORT_SYMBOL(rpc_proc_unregister);
 EXPORT_SYMBOL(rpc_proc_read);
 EXPORT_SYMBOL(svc_proc_register);
index d98adb31cfabb35c7d273fc4a090946aead549f3..55bc69e550ef89bda2a9c36fac151b08d9306eab 100644 (file)
@@ -32,6 +32,9 @@ svc_create(struct svc_program *prog, unsigned int bufsize, unsigned int xdrsize)
        struct svc_serv *serv;
 
        xdr_init();
+#ifdef RPC_DEBUG
+       rpc_register_sysctl();
+#endif
 
        if (!(serv = (struct svc_serv *) kmalloc(sizeof(*serv), GFP_KERNEL)))
                return NULL;