cardinfo.h revision 65991
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 3154021Simp/* $FreeBSD: head/sys/pccard/cardinfo.h 65991 2000-09-17 15:37:53Z sanpei $ */ 3254021Simp 3331289Snate#ifndef _PCCARD_CARDINFO_H_ 3431289Snate#define _PCCARD_CARDINFO_H_ 3518444Sbde 3655206Speter#ifndef _KERNEL 3718444Sbde#include <sys/types.h> 3818444Sbde#endif 3918444Sbde#include <sys/ioccom.h> 4018444Sbde 4110216Sphk#define PIOCGSTATE _IOR('P', 1, struct slotstate) /* Get slot state */ 4210216Sphk#define PIOCGMEM _IOWR('P', 2, struct mem_desc) /* Get memory map */ 4310216Sphk#define PIOCSMEM _IOW('P', 3, struct mem_desc) /* Set memory map */ 4410216Sphk#define PIOCGIO _IOWR('P', 4, struct io_desc) /* Get I/O map */ 4510216Sphk#define PIOCSIO _IOW('P', 5, struct io_desc) /* Set I/O map */ 4656095Shosokawa#define PIOCSDRV _IOWR('P', 6, struct dev_desc) /* Set driver */ 4710216Sphk#define PIOCRWFLAG _IOW('P', 7, int) /* Set flags for drv use */ 4810216Sphk#define PIOCRWMEM _IOWR('P', 8, unsigned long) /* Set mem for drv use */ 4910216Sphk#define PIOCSPOW _IOW('P', 9, struct power) /* Set power structure */ 5054021Simp#define PIOCSVIR _IOW('P', 10, int) /* Virtual insert/remove */ 5143964Skuriyama#define PIOCSBEEP _IOW('P', 11, int) /* Select Beep */ 5265991Ssanpei#define PIOCSRESOURCE _IOWR('P', 12, struct pccard_resource) /* get resource info */ 5310216Sphk/* 5410216Sphk * Debug codes. 5510216Sphk */ 5610216Sphk#define PIOCGREG _IOWR('P',100, struct pcic_reg) /* get reg */ 5710216Sphk#define PIOCSREG _IOW('P', 101, struct pcic_reg) /* Set reg */ 5810216Sphk 5910216Sphk/* 6010216Sphk * Slot states for PIOCGSTATE 6110216Sphk */ 6264878Sumeenum cardstate { noslot, empty, suspend, filled, inactive }; 6310216Sphk 6410216Sphk/* 6510216Sphk * Descriptor structure for memory map. 6610216Sphk */ 6712173Sphkstruct mem_desc { 6810216Sphk int window; /* Memory map window number (0-4) */ 6910216Sphk int flags; /* Flags - see below */ 7010216Sphk caddr_t start; /* System memory start */ 7110216Sphk int size; /* Size of memory area */ 7210216Sphk unsigned long card; /* Card memory address */ 7312173Sphk}; 7410216Sphk 7510216Sphk#define MDF_16BITS 0x01 /* Memory is 16 bits wide */ 7610216Sphk#define MDF_ZEROWS 0x02 /* Set no wait states for memory */ 7710216Sphk#define MDF_WS0 0x04 /* Wait state flags */ 7810216Sphk#define MDF_WS1 0x08 7910216Sphk#define MDF_ATTR 0x10 /* Memory is attribute memory */ 8010216Sphk#define MDF_WP 0x20 /* Write protect memory */ 8110216Sphk#define MDF_ACTIVE 0x40 /* Context active (read-only) */ 8210216Sphk 8310216Sphk/* 8410216Sphk * Descriptor structure for I/O map 8510216Sphk */ 8612173Sphkstruct io_desc { 8710216Sphk int window; /* I/O map number (0-1) */ 8810216Sphk int flags; /* Flags - see below */ 8910216Sphk int start; /* I/O port start */ 9010216Sphk int size; /* Number of port addresses */ 9112173Sphk}; 9210216Sphk 9310216Sphk#define IODF_WS 0x01 /* Set wait states for 16 bit I/O access */ 9410216Sphk#define IODF_16BIT 0x02 /* I/O access are 16 bit */ 9510216Sphk#define IODF_CS16 0x04 /* Allow card selection of 16 bit access */ 9610216Sphk#define IODF_ZEROWS 0x08 /* No wait states for 8 bit I/O */ 9710216Sphk#define IODF_ACTIVE 0x10 /* Context active (read-only) */ 9810216Sphk 9910216Sphk/* 10010216Sphk * Device descriptor for allocation of driver. 10110216Sphk */ 10230720Snatestruct dev_desc { 10310216Sphk char name[16]; /* Driver name */ 10410216Sphk int unit; /* Driver unit number */ 10510216Sphk unsigned long mem; /* Memory address of driver */ 10610216Sphk int memsize; /* Memory size (if used) */ 10710216Sphk int iobase; /* base of I/O ports */ 10849352Simp int iosize; /* Length of I/O ports */ 10910216Sphk int irqmask; /* Interrupt number(s) to allocate */ 11010216Sphk int flags; /* Device flags */ 11110914Sphk u_char misc[128]; /* For any random info */ 11212173Sphk}; 11349352Simp#define DEV_DESC_HAS_SIZE 1 11410216Sphk 11512173Sphkstruct pcic_reg { 11610216Sphk unsigned char reg; 11710216Sphk unsigned char value; 11812173Sphk}; 11912173Sphk 12010216Sphk/* 12110216Sphk * Slot information. Used to read current status of slot. 12210216Sphk */ 12312173Sphkstruct slotstate { 12410216Sphk enum cardstate state; /* Current state of slot */ 12535345Snate enum cardstate laststate; /* Previous state of slot */ 12610216Sphk int maxmem; /* Max allowed memory windows */ 12710216Sphk int maxio; /* Max allowed I/O windows */ 12810216Sphk int irqs; /* Bitmap of IRQs allowed */ 12910216Sphk int flags; /* Capability flags */ 13012173Sphk}; 13110216Sphk 13210216Sphk/* 13310216Sphk * The power values are in volts * 10, e.g. 5V is 50, 3.3V is 33. 13410216Sphk */ 13512173Sphkstruct power { 13610216Sphk int vcc; 13710216Sphk int vpp; 13812173Sphk}; 13910216Sphk 14010216Sphk/* 14165991Ssanpei * Th PC-Card resource IOC_GET_RESOURCE_RANGE 14265991Ssanpei */ 14365991Ssanpeistruct pccard_resource { 14465991Ssanpei int type; 14565991Ssanpei u_long size; 14665991Ssanpei u_long min; 14765991Ssanpei u_long max; 14865991Ssanpei u_long resource_addr; 14965991Ssanpei}; 15065991Ssanpei 15165991Ssanpei 15265991Ssanpei/* 15310216Sphk * Other system limits 15410216Sphk */ 15510216Sphk#define MAXSLOT 16 15610216Sphk#define NUM_MEM_WINDOWS 10 15710216Sphk#define NUM_IO_WINDOWS 6 15810216Sphk#define CARD_DEVICE "/dev/card%d" /* String for sprintf */ 15918444Sbde 16031289Snate#endif /* !_PCCARD_CARDINFO_H_ */ 161