cardinfo.h revision 30720
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 3118444Sbde#ifndef _PCCARD_CARD_H_ 3218444Sbde#define _PCCARD_CARD_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 */ 4810216Sphk/* 4910216Sphk * Debug codes. 5010216Sphk */ 5110216Sphk#define PIOCGREG _IOWR('P',100, struct pcic_reg) /* get reg */ 5210216Sphk#define PIOCSREG _IOW('P', 101, struct pcic_reg) /* Set reg */ 5310216Sphk 5410216Sphk/* 5510216Sphk * Slot states for PIOCGSTATE 5610216Sphk */ 5710216Sphkenum cardstate { noslot, empty, filled }; 5810216Sphk 5910216Sphk/* 6010216Sphk * Descriptor structure for memory map. 6110216Sphk */ 6212173Sphkstruct mem_desc { 6310216Sphk int window; /* Memory map window number (0-4) */ 6410216Sphk int flags; /* Flags - see below */ 6510216Sphk caddr_t start; /* System memory start */ 6610216Sphk int size; /* Size of memory area */ 6710216Sphk unsigned long card; /* Card memory address */ 6812173Sphk}; 6910216Sphk 7010216Sphk#define MDF_16BITS 0x01 /* Memory is 16 bits wide */ 7110216Sphk#define MDF_ZEROWS 0x02 /* Set no wait states for memory */ 7210216Sphk#define MDF_WS0 0x04 /* Wait state flags */ 7310216Sphk#define MDF_WS1 0x08 7410216Sphk#define MDF_ATTR 0x10 /* Memory is attribute memory */ 7510216Sphk#define MDF_WP 0x20 /* Write protect memory */ 7610216Sphk#define MDF_ACTIVE 0x40 /* Context active (read-only) */ 7710216Sphk 7810216Sphk/* 7910216Sphk * Descriptor structure for I/O map 8010216Sphk */ 8112173Sphkstruct io_desc { 8210216Sphk int window; /* I/O map number (0-1) */ 8310216Sphk int flags; /* Flags - see below */ 8410216Sphk int start; /* I/O port start */ 8510216Sphk int size; /* Number of port addresses */ 8612173Sphk}; 8710216Sphk 8810216Sphk#define IODF_WS 0x01 /* Set wait states for 16 bit I/O access */ 8910216Sphk#define IODF_16BIT 0x02 /* I/O access are 16 bit */ 9010216Sphk#define IODF_CS16 0x04 /* Allow card selection of 16 bit access */ 9110216Sphk#define IODF_ZEROWS 0x08 /* No wait states for 8 bit I/O */ 9210216Sphk#define IODF_ACTIVE 0x10 /* Context active (read-only) */ 9310216Sphk 9410216Sphk/* 9510216Sphk * Device descriptor for allocation of driver. 9610216Sphk */ 9730720Snatestruct dev_desc { 9810216Sphk char name[16]; /* Driver name */ 9910216Sphk int unit; /* Driver unit number */ 10010216Sphk unsigned long mem; /* Memory address of driver */ 10110216Sphk int memsize; /* Memory size (if used) */ 10210216Sphk int iobase; /* base of I/O ports */ 10310216Sphk int irqmask; /* Interrupt number(s) to allocate */ 10410216Sphk int flags; /* Device flags */ 10510914Sphk u_char misc[128]; /* For any random info */ 10612173Sphk}; 10710216Sphk 10812173Sphkstruct pcic_reg { 10910216Sphk unsigned char reg; 11010216Sphk unsigned char value; 11112173Sphk}; 11212173Sphk 11310216Sphk/* 11410216Sphk * Slot information. Used to read current status of slot. 11510216Sphk */ 11612173Sphkstruct slotstate { 11710216Sphk enum cardstate state; /* Current state of slot */ 11810216Sphk int maxmem; /* Max allowed memory windows */ 11910216Sphk int maxio; /* Max allowed I/O windows */ 12010216Sphk int irqs; /* Bitmap of IRQs allowed */ 12110216Sphk int flags; /* Capability flags */ 12212173Sphk}; 12310216Sphk 12410216Sphk/* 12510216Sphk * The power values are in volts * 10, e.g. 5V is 50, 3.3V is 33. 12610216Sphk */ 12712173Sphkstruct power { 12810216Sphk int vcc; 12910216Sphk int vpp; 13012173Sphk}; 13110216Sphk 13210216Sphk/* 13314172Snate * Beep parameters 13414172Snate */ 13514172Snate#define PCCARD_BEEP_PITCH0 1600 /* inserted/removed */ 13614172Snate#define PCCARD_BEEP_DURATION0 20 13714172Snate#define PCCARD_BEEP_PITCH1 1200 /* successed */ 13814172Snate#define PCCARD_BEEP_DURATION1 40 13914172Snate#define PCCARD_BEEP_PITCH2 3200 /* failed */ 14014172Snate#define PCCARD_BEEP_DURATION2 40 14114172Snate 14214172Snate/* 14310216Sphk * Other system limits 14410216Sphk */ 14510216Sphk#define MAXSLOT 16 14610216Sphk#define NUM_MEM_WINDOWS 10 14710216Sphk#define NUM_IO_WINDOWS 6 14810216Sphk#define CARD_DEVICE "/dev/card%d" /* String for sprintf */ 14918444Sbde 15018444Sbde#endif /* !_PCCARD_CARD_H_ */ 151