cardinfo.h revision 43964
110216Sphk/* 210216Sphk * Include file for PCMCIA user process interface 310216Sphk * 410216Sphk *------------------------------------------------------------------------- 510216Sphk * 610216Sphk * Copyright (c) 1995 Andrew McRae. All rights reserved. 710216Sphk * 810216Sphk * Redistribution and use in source and binary forms, with or without 910216Sphk * modification, are permitted provided that the following conditions 1010216Sphk * are met: 1110216Sphk * 1. Redistributions of source code must retain the above copyright 1210216Sphk * notice, this list of conditions and the following disclaimer. 1310216Sphk * 2. Redistributions in binary form must reproduce the above copyright 1410216Sphk * notice, this list of conditions and the following disclaimer in the 1510216Sphk * documentation and/or other materials provided with the distribution. 1610216Sphk * 3. The name of the author may not be used to endorse or promote products 1710216Sphk * derived from this software without specific prior written permission. 1810216Sphk * 1910216Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2010216Sphk * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2110216Sphk * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2210216Sphk * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2310216Sphk * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2410216Sphk * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2510216Sphk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2610216Sphk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2710216Sphk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2810216Sphk * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2910216Sphk */ 3018444Sbde 3131289Snate#ifndef _PCCARD_CARDINFO_H_ 3231289Snate#define _PCCARD_CARDINFO_H_ 3318444Sbde 3418444Sbde#ifndef KERNEL 3518444Sbde#include <sys/types.h> 3618444Sbde#endif 3718444Sbde#include <sys/ioccom.h> 3818444Sbde 3910216Sphk#define PIOCGSTATE _IOR('P', 1, struct slotstate) /* Get slot state */ 4010216Sphk#define PIOCGMEM _IOWR('P', 2, struct mem_desc) /* Get memory map */ 4110216Sphk#define PIOCSMEM _IOW('P', 3, struct mem_desc) /* Set memory map */ 4210216Sphk#define PIOCGIO _IOWR('P', 4, struct io_desc) /* Get I/O map */ 4310216Sphk#define PIOCSIO _IOW('P', 5, struct io_desc) /* Set I/O map */ 4430720Snate#define PIOCSDRV _IOW('P', 6, struct dev_desc) /* Set driver */ 4510216Sphk#define PIOCRWFLAG _IOW('P', 7, int) /* Set flags for drv use */ 4610216Sphk#define PIOCRWMEM _IOWR('P', 8, unsigned long) /* Set mem for drv use */ 4710216Sphk#define PIOCSPOW _IOW('P', 9, struct power) /* Set power structure */ 4843964Skuriyama#define PIOCSBEEP _IOW('P', 11, int) /* Select Beep */ 4910216Sphk/* 5010216Sphk * Debug codes. 5110216Sphk */ 5210216Sphk#define PIOCGREG _IOWR('P',100, struct pcic_reg) /* get reg */ 5310216Sphk#define PIOCSREG _IOW('P', 101, struct pcic_reg) /* Set reg */ 5410216Sphk 5510216Sphk/* 5610216Sphk * Slot states for PIOCGSTATE 5710216Sphk */ 5830815Snateenum cardstate { noslot, empty, suspend, filled }; 5910216Sphk 6010216Sphk/* 6110216Sphk * Descriptor structure for memory map. 6210216Sphk */ 6312173Sphkstruct mem_desc { 6410216Sphk int window; /* Memory map window number (0-4) */ 6510216Sphk int flags; /* Flags - see below */ 6610216Sphk caddr_t start; /* System memory start */ 6710216Sphk int size; /* Size of memory area */ 6810216Sphk unsigned long card; /* Card memory address */ 6912173Sphk}; 7010216Sphk 7110216Sphk#define MDF_16BITS 0x01 /* Memory is 16 bits wide */ 7210216Sphk#define MDF_ZEROWS 0x02 /* Set no wait states for memory */ 7310216Sphk#define MDF_WS0 0x04 /* Wait state flags */ 7410216Sphk#define MDF_WS1 0x08 7510216Sphk#define MDF_ATTR 0x10 /* Memory is attribute memory */ 7610216Sphk#define MDF_WP 0x20 /* Write protect memory */ 7710216Sphk#define MDF_ACTIVE 0x40 /* Context active (read-only) */ 7810216Sphk 7910216Sphk/* 8010216Sphk * Descriptor structure for I/O map 8110216Sphk */ 8212173Sphkstruct io_desc { 8310216Sphk int window; /* I/O map number (0-1) */ 8410216Sphk int flags; /* Flags - see below */ 8510216Sphk int start; /* I/O port start */ 8610216Sphk int size; /* Number of port addresses */ 8712173Sphk}; 8810216Sphk 8910216Sphk#define IODF_WS 0x01 /* Set wait states for 16 bit I/O access */ 9010216Sphk#define IODF_16BIT 0x02 /* I/O access are 16 bit */ 9110216Sphk#define IODF_CS16 0x04 /* Allow card selection of 16 bit access */ 9210216Sphk#define IODF_ZEROWS 0x08 /* No wait states for 8 bit I/O */ 9310216Sphk#define IODF_ACTIVE 0x10 /* Context active (read-only) */ 9410216Sphk 9510216Sphk/* 9610216Sphk * Device descriptor for allocation of driver. 9710216Sphk */ 9830720Snatestruct dev_desc { 9910216Sphk char name[16]; /* Driver name */ 10010216Sphk int unit; /* Driver unit number */ 10110216Sphk unsigned long mem; /* Memory address of driver */ 10210216Sphk int memsize; /* Memory size (if used) */ 10310216Sphk int iobase; /* base of I/O ports */ 10410216Sphk int irqmask; /* Interrupt number(s) to allocate */ 10510216Sphk int flags; /* Device flags */ 10610914Sphk u_char misc[128]; /* For any random info */ 10712173Sphk}; 10810216Sphk 10912173Sphkstruct pcic_reg { 11010216Sphk unsigned char reg; 11110216Sphk unsigned char value; 11212173Sphk}; 11312173Sphk 11410216Sphk/* 11510216Sphk * Slot information. Used to read current status of slot. 11610216Sphk */ 11712173Sphkstruct slotstate { 11810216Sphk enum cardstate state; /* Current state of slot */ 11935345Snate enum cardstate laststate; /* Previous state of slot */ 12010216Sphk int maxmem; /* Max allowed memory windows */ 12110216Sphk int maxio; /* Max allowed I/O windows */ 12210216Sphk int irqs; /* Bitmap of IRQs allowed */ 12310216Sphk int flags; /* Capability flags */ 12412173Sphk}; 12510216Sphk 12610216Sphk/* 12710216Sphk * The power values are in volts * 10, e.g. 5V is 50, 3.3V is 33. 12810216Sphk */ 12912173Sphkstruct power { 13010216Sphk int vcc; 13110216Sphk int vpp; 13212173Sphk}; 13310216Sphk 13410216Sphk/* 13510216Sphk * Other system limits 13610216Sphk */ 13710216Sphk#define MAXSLOT 16 13810216Sphk#define NUM_MEM_WINDOWS 10 13910216Sphk#define NUM_IO_WINDOWS 6 14010216Sphk#define CARD_DEVICE "/dev/card%d" /* String for sprintf */ 14118444Sbde 14231289Snate#endif /* !_PCCARD_CARDINFO_H_ */ 143