| CARDBUS(9) | Kernel Developer's Manual | CARDBUS(9) | 
Cardbus, cardbus_attach_card,
  cardbus_detach_card,
  cardbus_function_enable,
  cardbus_function_disable,
  cardbus_mapreg_map,
  cardbus_mapreg_unmap,
  cardbus_get_capability,
  cardbus_make_tag,
  cardbus_conf_read,
  cardbus_conf_write,
  cardbus_intr_establish,
  cardbus_intr_disestablish,
  CARDBUS_VENDOR,
  CARDBUS_PRODUCT,
  Cardbus_function_enable,
  Cardbus_function_disable,
  Cardbus_mapreg_map,
  Cardbus_mapreg_unmap,
  Cardbus_make_tag,
  Cardbus_conf_read,
  Cardbus_conf_write —
#include <sys/bus.h>
#include
  <dev/cardbus/cardbusvar.h>
#include
  <dev/cardbus/cardbusreg.h>
#include
  <dev/cardbus/cardbusdevs.h>
int
  
  cardbus_attach_card(struct
    cardbus_softc *csc);
void
  
  cardbus_detach_card(struct
    cardbus_softc *csc);
int
  
  cardbus_function_enable(struct
    cardbus_softc *csc, int
    function);
int
  
  cardbus_function_disable(struct
    cardbus_softc *csc, int
    function);
int
  
  cardbus_mapreg_map(struct
    cardbus_softc *csc, int cf, int
    reg, pcireg_t type, int
    busflags, bus_space_tag_t *tagp,
    bus_space_handle_t *handlep,
    bus_addr_t *basep, bus_size_t
    *sizep);
int
  
  cardbus_mapreg_unmap(struct
    cardbus_softc *csc, int
    cf, int reg,
    bus_space_tag_t tag,
    bus_space_handle_t
    handle, bus_size_t
    size);
int
  
  cardbus_get_capability(cardbus_chipset_tag_t
    cc,
    cardbus_function_tag_t
    cf, pcitag_t tag,
    int capid,
    int *offsetp,
    pcireg_t *valuep);
pcitag_t
  
  cardbus_make_tag(cardbus_chipset_tag_t
    cc, int cf,
    int bus,
    int device,
    int function);
pcireg_t
  
  cardbus_conf_read(cardbus_chipset_tag_t
    cc, int cf,
    pcitag_t tag,
    int offs);
void
  
  cardbus_conf_write(cardbus_chipset_tag_t
    cc, int cf,
    pcitag_t tag,
    int offs,
    busreg_t val);
void *
  
  cardbus_intr_establish(cardbus_chipset_tag_t
    cc,
    cardbus_function_tag_t
    cf, cardbus_intr_handle_t
    irq, int level,
    int (*handler)(void *),
    void *arg);
void
  
  cardbus_intr_disestablish(cardbus_chipset_tag_t
    cc,
    cardbus_function_tag_t
    cf, void *ih);
int
  
  CARDBUS_VENDOR(pcireg_t
    id);
int
  
  CARDBUS_PRODUCT(pcireg_t
    id);
int
  
  Cardbus_function_enable(cardbus_devfunc_t
    ct);
int
  
  Cardbus_function_disable(cardbus_devfunc_t
    ct);
int
  
  Cardbus_mapreg_map(cardbus_devfunc_t
    ct, int reg,
    pcireg_t type,
    int busflags,
    bus_space_tag_t *tagp,
    bus_space_handle_t
    *handlep, bus_addr_t
    *basep, bus_size_t
    *sizep);
int
  
  Cardbus_mapreg_unmap(cardbus_devfunc_t
    ct, int reg,
    bus_space_tag_t tag,
    bus_space_handle_t
    handle, bus_size_t
    size);
pcitag_t
  
  Cardbus_make_tag(cardbus_devfunc_t
    ct);
pcireg_t
  
  Cardbus_conf_read(cardbus_devfunc_t
    ct, pcitag_t tag,
    int offs);
void
  
  Cardbus_conf_write(cardbus_devfunc_t
    ct, pcitag_t tag,
    int offs,
    busreg_t val);
Cardbus subsystem provides
  support for CardBus devices.
The CardBus interface is an improvement to the PC-Card interface supported by pcmcia(9). It introduces several new capabilities such as 32-bit addressing, 33MHz operation, busmaster operation and 3.3 volt low-voltage power. It remains compatible with all features of the PC-Card standard.
The CardBus interface signaling protocol is derived from the PCI
    signaling protocol. There are some differences between PCI and CardBus,
    however operations are identical for most functions implemented. Since a
    32-bit CardBus interface is also defined for 16-bit PC-Cards, the same Card
    Services client to be used to manage both CardBus and PCMCIA PC-Cards. By
    interrogating the card upon detection of an insertion event,
    NetBSD determines whether the card requires
    Cardbus support or not, and then applies the
    appropriate power and signaling protocol requirements.
	cardbus_devfunc_t ca_ct;
	bus_space_tag_t ca_iot;       /* CardBus I/O space tag */
	bus_space_tag_t ca_memt;      /* CardBus MEM space tag */
	bus_dma_tag_t ca_dmat;        /* DMA tag */
	u_int ca_device;
	pcitag_t ca_tag;
	pcireg_t ca_id;
	pcireg_t ca_class;
	cardbus_intr_line_t ca_intrline; /* interrupt info */
	struct cardbus_cis_info ca_cis;
    
    cardbus_attach_card(csc)cardbus_detach_card(csc)cardbus_function_enable(csc,
    function)cardbus_function_disable(csc,
    function)cardbus_mapreg_map(csc,
    cf, reg,
    type, busflags,
    tagp, handlep,
    basep, sizep)cardbus_mapreg_unmap(csc,
    cf, reg,
    tag, handle,
    bus_size_t size)cardbus_get_capability(cc,
    cf, tag,
    capid, offsetp,
    valuep)cardbus_make_tag(cc,
    cf, bus,
    device, function)pci_make_tag().cardbus_conf_read(cc,
    cf, tag,
    offs)pci_conf_read().cardbus_conf_write(cc,
    cf, tag,
    offs, val)pci_conf_write().cardbus_intr_establish(cc,
    cf, irq,
    level, handler,
    arg)cardbus_intr_establish() returns an
      opaque handle to an event descriptor if it succeeds, and returns NULL on
      failure.cardbus_intr_disestablish(cc,
    cf, ih)cardbus_intr_establish().CARDBUS_VENDOR(id)CARDBUS_PRODUCT(id)The Cardbus_*() functions are convenience
    functions taking a cardbus_devfunc_t argument and
    perform the same operation as their namesake described above.
Cardbus driver will receive
  a pointer to struct cardbus_attach_args describing the
  device attaches to the CardBus. Drivers match the device using the
  ca_id member using
  CARDBUS_VENDOR() and
  CARDBUS_PRODUCT().
During the driver attach step, drivers should initially map the
    device I/O and memory resources using
    cardbus_mapreg_map() or
    Cardbus_mapreg_map(). Upon successful allocation of
    resources, power can be applied to the device with
    cardbus_function_enable() or
    Cardbus_function_enable(). so that device-specific
    interrogation can be performed. Finally, power should be removed from the
    device using cardbus_function_disable() or
    Cardbus_function_disable().
Since CardBus devices support dynamic configuration, drivers
    should make use of pmf(9)
    framework. Power can be applied and the interrupt handler should be
    established through this interface.
Cardbus subsystem appeared in
  NetBSD 1.5.
| July 13, 2014 | NetBSD 9.3 |