Home | History | Annotate | Line # | Download | only in pcmcia
pcmciachip.h revision 1.1.2.5
      1 #ifndef _PCMCIA_PCMCIACHIP_H_
      2 #define _PCMCIA_PCMCIACHIP_H_
      3 
      4 #include <machine/bus.h>
      5 
      6 struct pcmcia_function;
      7 struct pcmcia_mem_handle;
      8 struct pcmcia_io_handle;
      9 
     10 /* interfaces for pcmcia to call the chipset */
     11 
     12 typedef struct pcmcia_chip_functions *pcmcia_chipset_tag_t;
     13 typedef void *pcmcia_chipset_handle_t;
     14 typedef int pcmcia_mem_handle_t;
     15 
     16 #define PCMCIA_MEM_ATTR		1
     17 #define PCMCIA_MEM_COMMON	2
     18 
     19 #define PCMCIA_WIDTH_IO8	1
     20 #define PCMCIA_WIDTH_IO16	2
     21 
     22 struct pcmcia_chip_functions {
     23     /* memory space allocation */
     24     int (*mem_alloc) __P((pcmcia_chipset_handle_t, bus_size_t,
     25 			  struct pcmcia_mem_handle *));
     26     void (*mem_free) __P((pcmcia_chipset_handle_t,
     27 			  struct pcmcia_mem_handle *));
     28 
     29     /* memory space window mapping */
     30     int (*mem_map) __P((pcmcia_chipset_handle_t, int, bus_addr_t,
     31 			bus_size_t, struct pcmcia_mem_handle *,
     32 			bus_addr_t *, int *));
     33     void (*mem_unmap) __P((pcmcia_chipset_handle_t, int));
     34 
     35     /* I/O space allocation */
     36     int (*io_alloc) __P((pcmcia_chipset_handle_t, bus_addr_t, bus_size_t,
     37 			 struct pcmcia_io_handle *));
     38     void (*io_free) __P((pcmcia_chipset_handle_t,
     39 			 struct pcmcia_io_handle *));
     40 
     41     /* I/O space window mapping */
     42     int (*io_map) __P((pcmcia_chipset_handle_t, int, bus_addr_t,
     43 		       bus_size_t, struct pcmcia_io_handle *, int *));
     44     void (*io_unmap) __P((pcmcia_chipset_handle_t, int));
     45 
     46     /* interrupt glue */
     47     void *(*intr_establish) __P((pcmcia_chipset_handle_t,
     48     				 struct pcmcia_function *, int,
     49 				 int (*)(void *), void *));
     50     void (*intr_disestablish) __P((pcmcia_chipset_handle_t, void *));
     51 };
     52 
     53 #define pcmcia_chip_mem_alloc(tag, handle, size, pcmhp) \
     54 	((*(tag)->mem_alloc)((handle), (size), (pcmhp)))
     55 #define pcmcia_chip_mem_free(tag, handle, pcmhp) \
     56 	((*(tag)->mem_free)((handle), (pcmhp)))
     57 #define pcmcia_chip_mem_map(tag, handle, kind, card_addr, size, pcmhp, \
     58 			    offsetp, windowp) \
     59 	((*(tag)->mem_map)((handle), (kind), (card_addr), (size), (pcmhp), \
     60 			   (offsetp), (windowp)))
     61 #define pcmcia_chip_mem_unmap(tag, handle, window) \
     62 	((*(tag)->mem_unmap)((handle), (window)))
     63 
     64 #define pcmcia_chip_io_alloc(tag, handle, start, size, pcihp) \
     65 	((*(tag)->io_alloc)((handle), (start), (size), (pcihp)))
     66 #define pcmcia_chip_io_free(tag, handle, pcihp) \
     67 	((*(tag)->io_free)((handle), (pcihp)))
     68 #define pcmcia_chip_io_map(tag, handle, width, card_addr, size, pcihp, \
     69 			   windowp) \
     70 	((*(tag)->io_map)((handle), (width), (card_addr), (size), (pcihp), \
     71 			  (windowp)))
     72 #define pcmcia_chip_io_unmap(tag, handle, window) \
     73 	((*(tag)->io_unmap)((handle), (window)))
     74 
     75 #define pcmcia_chip_intr_establish(tag, handle, pf, ipl, fct, arg) \
     76 	((*(tag)->intr_establish)((handle), (pf), (ipl), (fct), (arg)))
     77 #define pcmcia_chip_intr_disestablish(tag, handle, ih) \
     78 	((*(tag)->intr_disestablish)((handle), (ih)))
     79 
     80 struct pcmciabus_attach_args {
     81     pcmcia_chipset_tag_t pct;
     82     pcmcia_chipset_handle_t pch;
     83 };
     84 
     85 /* interfaces for the chipset to call pcmcia */
     86 
     87 int pcmcia_attach_card __P((struct device *, int *));
     88 void pcmcia_detach_card __P((struct device *));
     89 
     90 #endif /* _PCMCIA_PCMCIACHIP_H_ */
     91