cardinfo.h revision 56095
1254721Semaste/* 2254721Semaste * Include file for PCMCIA user process interface 3254721Semaste * 4254721Semaste *------------------------------------------------------------------------- 5254721Semaste * 6254721Semaste * Copyright (c) 1995 Andrew McRae. All rights reserved. 7254721Semaste * 8254721Semaste * Redistribution and use in source and binary forms, with or without 9254721Semaste * modification, are permitted provided that the following conditions 10254721Semaste * are met: 11254721Semaste * 1. Redistributions of source code must retain the above copyright 12254721Semaste * notice, this list of conditions and the following disclaimer. 13254721Semaste * 2. Redistributions in binary form must reproduce the above copyright 14254721Semaste * notice, this list of conditions and the following disclaimer in the 15254721Semaste * documentation and/or other materials provided with the distribution. 16254721Semaste * 3. The name of the author may not be used to endorse or promote products 17280031Sdim * derived from this software without specific prior written permission. 18254721Semaste * 19276479Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20276479Sdim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21254721Semaste * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22254721Semaste * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23262528Semaste * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24254721Semaste * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25254721Semaste * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26254721Semaste * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27254721Semaste * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28254721Semaste * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29254721Semaste */ 30254721Semaste 31254721Semaste/* $FreeBSD: head/sys/pccard/cardinfo.h 56095 2000-01-16 06:44:48Z hosokawa $ */ 32254721Semaste 33296417Sdim#ifndef _PCCARD_CARDINFO_H_ 34296417Sdim#define _PCCARD_CARDINFO_H_ 35296417Sdim 36296417Sdim#ifndef _KERNEL 37280031Sdim#include <sys/types.h> 38280031Sdim#endif 39280031Sdim#include <sys/ioccom.h> 40280031Sdim 41280031Sdim#define PIOCGSTATE _IOR('P', 1, struct slotstate) /* Get slot state */ 42254721Semaste#define PIOCGMEM _IOWR('P', 2, struct mem_desc) /* Get memory map */ 43254721Semaste#define PIOCSMEM _IOW('P', 3, struct mem_desc) /* Set memory map */ 44254721Semaste#define PIOCGIO _IOWR('P', 4, struct io_desc) /* Get I/O map */ 45254721Semaste#define PIOCSIO _IOW('P', 5, struct io_desc) /* Set I/O map */ 46254721Semaste#define PIOCSDRV _IOWR('P', 6, struct dev_desc) /* Set driver */ 47254721Semaste#define PIOCRWFLAG _IOW('P', 7, int) /* Set flags for drv use */ 48254721Semaste#define PIOCRWMEM _IOWR('P', 8, unsigned long) /* Set mem for drv use */ 49254721Semaste#define PIOCSPOW _IOW('P', 9, struct power) /* Set power structure */ 50254721Semaste#define PIOCSVIR _IOW('P', 10, int) /* Virtual insert/remove */ 51254721Semaste#define PIOCSBEEP _IOW('P', 11, int) /* Select Beep */ 52254721Semaste/* 53254721Semaste * Debug codes. 54254721Semaste */ 55254721Semaste#define PIOCGREG _IOWR('P',100, struct pcic_reg) /* get reg */ 56254721Semaste#define PIOCSREG _IOW('P', 101, struct pcic_reg) /* Set reg */ 57254721Semaste 58254721Semaste/* 59254721Semaste * Slot states for PIOCGSTATE 60254721Semaste */ 61254721Semasteenum cardstate { noslot, empty, suspend, filled }; 62254721Semaste 63254721Semaste/* 64254721Semaste * Descriptor structure for memory map. 65254721Semaste */ 66254721Semastestruct mem_desc { 67254721Semaste int window; /* Memory map window number (0-4) */ 68254721Semaste int flags; /* Flags - see below */ 69254721Semaste caddr_t start; /* System memory start */ 70254721Semaste int size; /* Size of memory area */ 71254721Semaste unsigned long card; /* Card memory address */ 72254721Semaste}; 73254721Semaste 74254721Semaste#define MDF_16BITS 0x01 /* Memory is 16 bits wide */ 75254721Semaste#define MDF_ZEROWS 0x02 /* Set no wait states for memory */ 76254721Semaste#define MDF_WS0 0x04 /* Wait state flags */ 77254721Semaste#define MDF_WS1 0x08 78254721Semaste#define MDF_ATTR 0x10 /* Memory is attribute memory */ 79254721Semaste#define MDF_WP 0x20 /* Write protect memory */ 80254721Semaste#define MDF_ACTIVE 0x40 /* Context active (read-only) */ 81254721Semaste 82254721Semaste/* 83254721Semaste * Descriptor structure for I/O map 84254721Semaste */ 85254721Semastestruct io_desc { 86254721Semaste int window; /* I/O map number (0-1) */ 87254721Semaste int flags; /* Flags - see below */ 88254721Semaste int start; /* I/O port start */ 89254721Semaste int size; /* Number of port addresses */ 90254721Semaste}; 91254721Semaste 92254721Semaste#define IODF_WS 0x01 /* Set wait states for 16 bit I/O access */ 93254721Semaste#define IODF_16BIT 0x02 /* I/O access are 16 bit */ 94254721Semaste#define IODF_CS16 0x04 /* Allow card selection of 16 bit access */ 95254721Semaste#define IODF_ZEROWS 0x08 /* No wait states for 8 bit I/O */ 96254721Semaste#define IODF_ACTIVE 0x10 /* Context active (read-only) */ 97254721Semaste 98254721Semaste/* 99254721Semaste * Device descriptor for allocation of driver. 100254721Semaste */ 101254721Semastestruct dev_desc { 102254721Semaste char name[16]; /* Driver name */ 103254721Semaste int unit; /* Driver unit number */ 104254721Semaste unsigned long mem; /* Memory address of driver */ 105254721Semaste int memsize; /* Memory size (if used) */ 106254721Semaste int iobase; /* base of I/O ports */ 107254721Semaste int iosize; /* Length of I/O ports */ 108262528Semaste int irqmask; /* Interrupt number(s) to allocate */ 109262528Semaste int flags; /* Device flags */ 110262528Semaste u_char misc[128]; /* For any random info */ 111276479Sdim}; 112262528Semaste#define DEV_DESC_HAS_SIZE 1 113262528Semaste 114262528Semastestruct pcic_reg { 115262528Semaste unsigned char reg; 116262528Semaste unsigned char value; 117262528Semaste}; 118262528Semaste 119262528Semaste/* 120262528Semaste * Slot information. Used to read current status of slot. 121262528Semaste */ 122262528Semastestruct slotstate { 123262528Semaste enum cardstate state; /* Current state of slot */ 124262528Semaste enum cardstate laststate; /* Previous state of slot */ 125262528Semaste int maxmem; /* Max allowed memory windows */ 126262528Semaste int maxio; /* Max allowed I/O windows */ 127262528Semaste int irqs; /* Bitmap of IRQs allowed */ 128262528Semaste int flags; /* Capability flags */ 129262528Semaste}; 130262528Semaste 131262528Semaste/* 132262528Semaste * The power values are in volts * 10, e.g. 5V is 50, 3.3V is 33. 133262528Semaste */ 134254721Semastestruct power { 135262528Semaste int vcc; 136262528Semaste int vpp; 137262528Semaste}; 138254721Semaste 139254721Semaste/* 140254721Semaste * Other system limits 141254721Semaste */ 142254721Semaste#define MAXSLOT 16 143254721Semaste#define NUM_MEM_WINDOWS 10 144254721Semaste#define NUM_IO_WINDOWS 6 145254721Semaste#define CARD_DEVICE "/dev/card%d" /* String for sprintf */ 146254721Semaste 147254721Semaste#endif /* !_PCCARD_CARDINFO_H_ */ 148254721Semaste