Home | History | Annotate | Line # | Download | only in pcmcia
pcmciachip.h revision 1.1.2.3
      1  1.1.2.1     marc #ifndef _PCMCIA_PCMCIACHIP_H_
      2  1.1.2.1     marc #define _PCMCIA_PCMCIACHIP_H_
      3  1.1.2.1     marc 
      4  1.1.2.1     marc #include <machine/bus.h>
      5  1.1.2.1     marc 
      6  1.1.2.1     marc /* interfaces for pcmcia to call the chipset */
      7  1.1.2.1     marc 
      8  1.1.2.1     marc typedef struct pcmcia_chip_functions *pcmcia_chipset_tag_t;
      9  1.1.2.1     marc typedef void *pcmcia_chipset_handle_t;
     10  1.1.2.1     marc typedef int pcmcia_mem_handle_t;
     11  1.1.2.1     marc 
     12  1.1.2.1     marc #define PCMCIA_MEM_ATTR		1
     13  1.1.2.1     marc #define PCMCIA_MEM_COMMON	2
     14  1.1.2.1     marc 
     15  1.1.2.1     marc #define PCMCIA_WIDTH_IO8	1
     16  1.1.2.1     marc #define PCMCIA_WIDTH_IO16	2
     17  1.1.2.1     marc 
     18  1.1.2.1     marc struct pcmcia_chip_functions {
     19  1.1.2.1     marc     /* XXX alloc/free should probably be somewhere more generic than the
     20  1.1.2.1     marc        pcmcia driver */
     21  1.1.2.1     marc     int (*mem_alloc) __P((pcmcia_chipset_handle_t, bus_size_t,
     22  1.1.2.1     marc 			  bus_space_tag_t *, bus_space_handle_t *,
     23  1.1.2.1     marc 			  pcmcia_mem_handle_t *, bus_size_t *));
     24  1.1.2.1     marc     void (*mem_free) __P((pcmcia_chipset_handle_t, bus_size_t,
     25  1.1.2.1     marc 			 bus_space_tag_t, bus_space_handle_t,
     26  1.1.2.1     marc 			  pcmcia_mem_handle_t));
     27  1.1.2.1     marc     int (*mem_map) __P((pcmcia_chipset_handle_t, int,
     28  1.1.2.1     marc 			bus_size_t, bus_space_tag_t, bus_space_handle_t,
     29  1.1.2.1     marc 			u_long, u_long *, int *));
     30  1.1.2.1     marc     void (*mem_unmap) __P((pcmcia_chipset_handle_t, int));
     31  1.1.2.1     marc 
     32  1.1.2.1     marc     int (*io_alloc) __P((pcmcia_chipset_handle_t, bus_addr_t, bus_size_t,
     33  1.1.2.1     marc 			  bus_space_tag_t *, bus_space_handle_t *));
     34  1.1.2.1     marc     void (*io_free) __P((pcmcia_chipset_handle_t, bus_size_t,
     35  1.1.2.1     marc 			 bus_space_tag_t, bus_space_handle_t));
     36  1.1.2.1     marc     int (*io_map) __P((pcmcia_chipset_handle_t, int, bus_size_t,
     37  1.1.2.1     marc 		       bus_space_tag_t, bus_space_handle_t, int *));
     38  1.1.2.1     marc     void (*io_unmap) __P((pcmcia_chipset_handle_t, int));
     39  1.1.2.1     marc 
     40  1.1.2.3  thorpej     void *(*intr_establish) __P((pcmcia_chipset_handle_t, u_int16_t, int,
     41  1.1.2.1     marc 				 int (*)(void *), void *));
     42  1.1.2.1     marc     void (*intr_disestablish) __P((pcmcia_chipset_handle_t, void *));
     43  1.1.2.1     marc };
     44  1.1.2.1     marc 
     45  1.1.2.1     marc #define pcmcia_chip_mem_alloc(tag, handle, size, memtp, memhp, mhandle, \
     46  1.1.2.1     marc 			      realsize) \
     47  1.1.2.1     marc 	((*(tag)->mem_alloc)((handle), (size), (memtp), (memhp), (mhandle), \
     48  1.1.2.1     marc 			     (realsize)))
     49  1.1.2.1     marc #define pcmcia_chip_mem_free(tag, handle, size, memt, memh, mhandle) \
     50  1.1.2.1     marc 	((*(tag)->mem_free)((handle), (size), (memt), (memh), (mhandle)))
     51  1.1.2.1     marc #define pcmcia_chip_mem_map(tag, handle, kind, size, memt, memh, \
     52  1.1.2.1     marc 			    card_addr, offsetp, windowp) \
     53  1.1.2.1     marc 	((*(tag)->mem_map)((handle), (kind), (size), (memt), (memh), \
     54  1.1.2.1     marc 			   (card_addr), (offsetp), (windowp)))
     55  1.1.2.1     marc #define pcmcia_chip_mem_unmap(tag, handle, window) \
     56  1.1.2.1     marc 	((*(tag)->mem_unmap)((handle), (window)))
     57  1.1.2.1     marc 
     58  1.1.2.1     marc #define pcmcia_chip_io_alloc(tag, handle, start, size, iotp, iohp) \
     59  1.1.2.1     marc 	((*(tag)->io_alloc)((handle), (start), (size), (iotp), (iohp)))
     60  1.1.2.1     marc #define pcmcia_chip_io_free(tag, handle, size, iot, ioh) \
     61  1.1.2.1     marc 	((*(tag)->io_free)((handle), (size), (iot), (ioh)))
     62  1.1.2.1     marc #define pcmcia_chip_io_map(tag, handle, width, size, iot, ioh, windowp) \
     63  1.1.2.1     marc 	((*(tag)->io_map)((handle), (width), (size), (iot), (ioh), (windowp)))
     64  1.1.2.1     marc #define pcmcia_chip_io_unmap(tag, handle, window) \
     65  1.1.2.1     marc 	((*(tag)->io_unmap)((handle), (window)))
     66  1.1.2.1     marc 
     67  1.1.2.3  thorpej #define pcmcia_chip_intr_establish(tag, handle, irqmask, ipl, fct, arg) \
     68  1.1.2.3  thorpej 	((*(tag)->intr_establish)((handle), (irqmask), (ipl), (fct), (arg)))
     69  1.1.2.1     marc #define pcmcia_chip_intr_disestablish(tag, handle, ih) \
     70  1.1.2.1     marc 	((*(tag)->intr_disestablish)((handle), (ih)))
     71  1.1.2.1     marc 
     72  1.1.2.1     marc struct pcmciabus_attach_args {
     73  1.1.2.1     marc     pcmcia_chipset_tag_t pct;
     74  1.1.2.1     marc     pcmcia_chipset_handle_t pch;
     75  1.1.2.1     marc };
     76  1.1.2.1     marc 
     77  1.1.2.1     marc /* interfaces for the chipset to call pcmcia */
     78  1.1.2.1     marc 
     79  1.1.2.1     marc int pcmcia_attach_card __P((struct device *, int *));
     80  1.1.2.1     marc void pcmcia_detach_card __P((struct device *));
     81  1.1.2.1     marc 
     82  1.1.2.1     marc #endif /* _PCMCIA_PCMCIACHIP_H_ */
     83