Home | History | Annotate | Line # | Download | only in pcmcia
pcmciachip.h revision 1.1.2.10
      1  1.1.2.10    enami /*	$NetBSD: pcmciachip.h,v 1.1.2.10 1997/10/16 09:15:32 enami Exp $	*/
      2   1.1.2.9  thorpej 
      3   1.1.2.1     marc #ifndef _PCMCIA_PCMCIACHIP_H_
      4   1.1.2.9  thorpej #define	_PCMCIA_PCMCIACHIP_H_
      5   1.1.2.1     marc 
      6   1.1.2.1     marc #include <machine/bus.h>
      7   1.1.2.1     marc 
      8   1.1.2.5  thorpej struct pcmcia_function;
      9   1.1.2.4  thorpej struct pcmcia_mem_handle;
     10   1.1.2.4  thorpej struct pcmcia_io_handle;
     11   1.1.2.4  thorpej 
     12   1.1.2.1     marc /* interfaces for pcmcia to call the chipset */
     13   1.1.2.1     marc 
     14   1.1.2.1     marc typedef struct pcmcia_chip_functions *pcmcia_chipset_tag_t;
     15   1.1.2.1     marc typedef void *pcmcia_chipset_handle_t;
     16   1.1.2.1     marc typedef int pcmcia_mem_handle_t;
     17   1.1.2.1     marc 
     18   1.1.2.9  thorpej #define	PCMCIA_MEM_ATTR		1
     19   1.1.2.9  thorpej #define	PCMCIA_MEM_COMMON	2
     20   1.1.2.1     marc 
     21  1.1.2.10    enami #define	PCMCIA_WIDTH_AUTO	0
     22   1.1.2.9  thorpej #define	PCMCIA_WIDTH_IO8	1
     23   1.1.2.9  thorpej #define	PCMCIA_WIDTH_IO16	2
     24   1.1.2.1     marc 
     25   1.1.2.1     marc struct pcmcia_chip_functions {
     26   1.1.2.9  thorpej 	/* memory space allocation */
     27   1.1.2.9  thorpej 	int	(*mem_alloc) __P((pcmcia_chipset_handle_t, bus_size_t,
     28   1.1.2.9  thorpej 		    struct pcmcia_mem_handle *));
     29   1.1.2.9  thorpej 	void	(*mem_free) __P((pcmcia_chipset_handle_t,
     30   1.1.2.9  thorpej 		    struct pcmcia_mem_handle *));
     31   1.1.2.9  thorpej 
     32   1.1.2.9  thorpej 	/* memory space window mapping */
     33   1.1.2.9  thorpej 	int	(*mem_map) __P((pcmcia_chipset_handle_t, int, bus_addr_t,
     34   1.1.2.9  thorpej 		    bus_size_t, struct pcmcia_mem_handle *,
     35   1.1.2.9  thorpej 		    bus_addr_t *, int *));
     36   1.1.2.9  thorpej 	void	(*mem_unmap) __P((pcmcia_chipset_handle_t, int));
     37   1.1.2.9  thorpej 
     38   1.1.2.9  thorpej 	/* I/O space allocation */
     39   1.1.2.9  thorpej 	int	(*io_alloc) __P((pcmcia_chipset_handle_t, bus_addr_t,
     40   1.1.2.9  thorpej 		    bus_size_t, bus_size_t, struct pcmcia_io_handle *));
     41   1.1.2.9  thorpej 	void	(*io_free) __P((pcmcia_chipset_handle_t,
     42   1.1.2.9  thorpej 		    struct pcmcia_io_handle *));
     43   1.1.2.9  thorpej 
     44   1.1.2.9  thorpej 	/* I/O space window mapping */
     45   1.1.2.9  thorpej 	int	(*io_map) __P((pcmcia_chipset_handle_t, int, bus_addr_t,
     46   1.1.2.9  thorpej 		    bus_size_t, struct pcmcia_io_handle *, int *));
     47   1.1.2.9  thorpej 	void	(*io_unmap) __P((pcmcia_chipset_handle_t, int));
     48   1.1.2.9  thorpej 
     49   1.1.2.9  thorpej 	/* interrupt glue */
     50   1.1.2.9  thorpej 	void	*(*intr_establish) __P((pcmcia_chipset_handle_t,
     51   1.1.2.9  thorpej 		    struct pcmcia_function *, int, int (*)(void *), void *));
     52   1.1.2.9  thorpej 	void	(*intr_disestablish) __P((pcmcia_chipset_handle_t, void *));
     53   1.1.2.9  thorpej 
     54   1.1.2.9  thorpej 	/* card enable/disable */
     55   1.1.2.9  thorpej 	void	(*socket_enable) __P((pcmcia_chipset_handle_t));
     56   1.1.2.9  thorpej 	void	(*socket_disable) __P((pcmcia_chipset_handle_t));
     57   1.1.2.1     marc };
     58   1.1.2.1     marc 
     59   1.1.2.9  thorpej /* Memory space functions. */
     60   1.1.2.9  thorpej #define pcmcia_chip_mem_alloc(tag, handle, size, pcmhp)			\
     61   1.1.2.4  thorpej 	((*(tag)->mem_alloc)((handle), (size), (pcmhp)))
     62   1.1.2.9  thorpej 
     63   1.1.2.9  thorpej #define pcmcia_chip_mem_free(tag, handle, pcmhp)			\
     64   1.1.2.4  thorpej 	((*(tag)->mem_free)((handle), (pcmhp)))
     65   1.1.2.9  thorpej 
     66   1.1.2.9  thorpej #define pcmcia_chip_mem_map(tag, handle, kind, card_addr, size, pcmhp,	\
     67   1.1.2.9  thorpej 	    offsetp, windowp)						\
     68   1.1.2.4  thorpej 	((*(tag)->mem_map)((handle), (kind), (card_addr), (size), (pcmhp), \
     69   1.1.2.9  thorpej 	    (offsetp), (windowp)))
     70   1.1.2.9  thorpej 
     71   1.1.2.9  thorpej #define pcmcia_chip_mem_unmap(tag, handle, window)			\
     72   1.1.2.1     marc 	((*(tag)->mem_unmap)((handle), (window)))
     73   1.1.2.1     marc 
     74   1.1.2.9  thorpej /* I/O space functions. */
     75   1.1.2.9  thorpej #define pcmcia_chip_io_alloc(tag, handle, start, size, align, pcihp)	\
     76   1.1.2.8  thorpej 	((*(tag)->io_alloc)((handle), (start), (size), (align), (pcihp)))
     77   1.1.2.9  thorpej 
     78   1.1.2.9  thorpej #define pcmcia_chip_io_free(tag, handle, pcihp)				\
     79   1.1.2.4  thorpej 	((*(tag)->io_free)((handle), (pcihp)))
     80   1.1.2.9  thorpej 
     81   1.1.2.9  thorpej #define pcmcia_chip_io_map(tag, handle, width, card_addr, size, pcihp,	\
     82   1.1.2.9  thorpej 	    windowp) \
     83   1.1.2.4  thorpej 	((*(tag)->io_map)((handle), (width), (card_addr), (size), (pcihp), \
     84   1.1.2.9  thorpej 	    (windowp)))
     85   1.1.2.9  thorpej 
     86   1.1.2.9  thorpej #define pcmcia_chip_io_unmap(tag, handle, window)			\
     87   1.1.2.1     marc 	((*(tag)->io_unmap)((handle), (window)))
     88   1.1.2.1     marc 
     89   1.1.2.9  thorpej /* Interrupt functions. */
     90   1.1.2.9  thorpej #define pcmcia_chip_intr_establish(tag, handle, pf, ipl, fct, arg)	\
     91   1.1.2.5  thorpej 	((*(tag)->intr_establish)((handle), (pf), (ipl), (fct), (arg)))
     92   1.1.2.9  thorpej 
     93   1.1.2.9  thorpej #define pcmcia_chip_intr_disestablish(tag, handle, ih)			\
     94   1.1.2.1     marc 	((*(tag)->intr_disestablish)((handle), (ih)))
     95   1.1.2.6  thorpej 
     96   1.1.2.9  thorpej /* Socket functions. */
     97   1.1.2.9  thorpej #define	pcmcia_chip_socket_enable(tag, handle)				\
     98   1.1.2.6  thorpej 	((*(tag)->socket_enable)((handle)))
     99   1.1.2.9  thorpej #define	pcmcia_chip_socket_disable(tag, handle)				\
    100   1.1.2.6  thorpej 	((*(tag)->socket_disable)((handle)))
    101   1.1.2.1     marc 
    102   1.1.2.1     marc struct pcmciabus_attach_args {
    103   1.1.2.9  thorpej 	pcmcia_chipset_tag_t pct;
    104   1.1.2.9  thorpej 	pcmcia_chipset_handle_t pch;
    105   1.1.2.1     marc };
    106   1.1.2.1     marc 
    107   1.1.2.1     marc /* interfaces for the chipset to call pcmcia */
    108   1.1.2.1     marc 
    109   1.1.2.9  thorpej int	pcmcia_card_attach __P((struct device *));
    110   1.1.2.9  thorpej void	pcmcia_card_detach __P((struct device *));
    111   1.1.2.9  thorpej int	pcmcia_card_gettype __P((struct device *));
    112   1.1.2.1     marc 
    113   1.1.2.1     marc #endif /* _PCMCIA_PCMCIACHIP_H_ */
    114