vmeio(D3)
vmeio_piomap_alloc, vmeio_piomap_addr, vmeio_piomap_done, vmeio_piomap_free, vmeio_pio_bcopyin, vmeio_pio_bcopyout, vmeio_dmamap_alloc, vmeio_dmamap_addr, vmeio_dmamap_list, vmeio_dmamap_done, vmeio_dmamap_free, vmeio_intr_alloc, vmeio_intr_vector_get, vmeio_intr_connect, vmeio_intr_disconnect, vmeio_intr_free, - VMEbus device driver API
As shipped in IRIX 6.5.22. Last changed in IRIX 6.5.15.
NAME vmeio_piomap_alloc, vmeio_piomap_addr, vmeio_piomap_done, vmeio_piomap_free, vmeio_pio_bcopyin, vmeio_pio_bcopyout, vmeio_dmamap_alloc, vmeio_dmamap_addr, vmeio_dmamap_list, vmeio_dmamap_done, vmeio_dmamap_free, vmeio_intr_alloc, vmeio_intr_vector_get, vmeio_intr_connect, vmeio_intr_disconnect, vmeio_intr_free, - VMEbus device driver API SYNOPSIS #include <sys/vme/vmeio.h> Programmed IO vmeio_piomap_t vmeio_piomap_alloc(vertex_hdl_t vme_conn, device_desc_t dev_desc, vmeio_space_t space, iopaddr_t vmeaddr, size_t byte_count, size_t byte_count_max, unsigned flags); caddr_t vmeio_piomap_addr(vmeio_piomap_t piomap, iopaddr_t vmeaddr, size_t byte_count); void vmeio_piomap_done(vmeio_piomap_t piomap); void vmeio_piomap_free(vmeio_piomap_t piomap); size_t vmeio_pio_bcopyin(vmeio_piomap_t piomap, iopaddr_t vmeaddr, caddr_t dest_sys_addr, int byte_count, int itmsz, int flags); int vmeio_pio_bcopyout(vmeio_piomap_t piomap, iopaddr_t vmeaddr, caddr_t src_sys_addr, size_t byte_count, int itmsz, int flags); Arguments vme_conn VMEbus connection point. dev_desc Device descriptor, usually 0. space Type of the VMEbus space. vmeaddr The offset within the space. byte_count Size of the mapping. byte_count_max Maximum size of a single mapping. flags User specifiable options. piomap The mapping acquired by the vmeio_piomap_alloc(). dest_sys_addr The system address which the data is copied to. src_sys_addr The system address which the data is copied from. itmsz The unit of transfer. Direct Memory Access vmeio_dmamap_t vmeio_dmamap_alloc(vertex_hdl_t vme_conn, device_desc_t dev_desc, vmeio_space_t space, size_t byte_count_max, unsigned flags); iopaddr_t vmeio_dmamap_addr(vmeio_dmamap_t dmamap, paddr_t paddr, size_t byte_count); alenlist_t vmeio_dmamap_list(vmeio_dmamap_t dmamap, alenlist_t phys_alenlist, unsigned flags); void vmeio_dmamap_done(vmeio_dmamap_t dmamap); void vmeio_dmamap_free(vmeio_dmamap_t dmamap); Arguments vme_conn VMEbus connection point. dev_desc Device descriptor, usually zero. space Type of the VMEbus space. byte_count_max Maximum size of a single mapping. dmamap The mapping resources aquired through vmeio_dmamap_alloc(). paddr Physical address. byte_count Size of the mapping. phys_alenlist The list of pairs of physical address and length. flags Specifying attributes of the DMA mapping. Interrupt Handling vmeio_intr_t vmeio_intr_alloc(vertex_hdl_t vme_conn, device_desc_t dev_desc, vmeio_intr_vector_t vec, vmeio_intr_level_t level, vertex_hdl_t owner_dev, unsigned flags); vmeio_intr_vector_t vmeio_intr_vector_get(vmeio_intr_t intr) int vmeio_intr_connect(vmeio_intr_t intr, intr_func_t intr_func, intr_arg_t intr_arg, void *thread); void vmeio_intr_disconnect(vmeio_intr_t intr); void vmeio_intr_free(vmeio_intr_t intr); Arguments vme_conn VMEbus connection point. dev_desc Device descriptor, usually zero. vec Interrupt vector number. level VMEbus Interrupt level. owner_dev The vertex used to print messages about this particular interrupt, usually zero. flags User specifiable options. intr Interrupt handle acquired by vmeio_intr_alloc(). intr_func The function used for interrupt service. intr_arg The argument passed to intr_func. DESCRIPTION On Origin and Onyx2 systems, vmeio provides a set of routines for VMEbus kernel device drivers to set up services for their devices. These services include: o registering all instances of the device in the system. o constructing CPU addresses that the device can use to do PIO to the device. o constructing VMEbus addresses that the device can use to do DMA. o arranging for a function to be called when the device requests interrupt service. o arranging for a function to be called when an error occurs during PIO or DMA operations on the device. Programmed IO vmeio_piomap_alloc() allocates the PIO resources for the given requirement. Return the handle of the PIO resources if success, 0 otherwise. The VMEbus specific flags include VME_PIOMAP_FIXED, VME_PIOMAP_UNFIXED, and VME_DEBUG. VME_DEBUG is used to do more integrity checking. Possibly, device driver writers can turn on this mode to sanity check their drivers a bit, with some degree of performance degradation. vmeio_piomap_addr() establishes a mapping from a VME bus address range to a kernel virtual address range using the allocated PIO resources. Return the kernel virtual address if success, 0 if otherwise. vmeio_piomap_done() notifies the system that a driver is done with using the piomap resources obtained by the earlier vmeio_piomap_addr() call. vmeio_piomap_free() frees the PIO mapping resources. vmeio_pio_bcopyin() copies data from the device buffer to the system memory efficiently. The unit of the transfer can be 1 byte, 2 bytes, 4 bytes, and 8 bytes. Return total bytes of successful transfer, -1 if function fails. vmeio_pio_bcopyout() copies data from the system memory to the device buffer efficiently. The unit of the transfer can be 1 byte, 2 bytes, 4 bytes, and 8 bytes. Return total bytes of successful transfer, -1 if function fails. Direct Memory Access vmeio_dmamap_alloc() allocates mapping resources needed for DMA. Return the handle of the new DMA map if success, 0 if failed. As described before, VME_DEBUG can be used as a flag passed to have stronger integrity checking over the life-span of the DMA map. Flags available for this call are: VMEIO_DMA_DATA specifies that the DMA channel will be used for data streams. Prefetch and postwrite are enabled on this mapping. VMEIO_DMA_CMD specifies that the DMA channel will be used for command information. Prefetch and postwrite are disabled on this mapping. vmeio_dmamap_addr() establishes a mapping from a physical address range to a VMEbus address range by using the allocated DMA resources. Return VMEbus address mapped to the physical addr range if success, VMEIO_DMA_INVALID_ADDR otherwise. vmeio_dmamap_list() establishes the mapping from a list of (physical address, length) to a list of (VMEbus address, length). Return the list of (VMEbus address, length) if success, 0 if failed. The returned list should be freed by the caller. Flags avalable for this call are: VMEIO_INPLACE requests that the list be modified in place when list operations are performed. VMEIO_NOSLEEP requests that the VMEbus provider not to sleep in resource allocation and failure should be returned if sleep is necessary for getting the resources. vmeio_dmamap_done() notifies the system that a driver is done with using the DMA mapping resource. vmeio_dmamap_free() frees the DMA resources acquired by vmeio_dmamap_alloc() call. Interrupt Handling vmeio_intr_alloc() allocates interrupt resources. This function is usually called in <drv>_edtinit(). In some cases, users have a VME device which comes with a fixed interrupt vector number, or users like to fix the interrupt vector for their devices. If so, they can specify the vector number on the VECTOR line statement. And they can declare the vector number here. In most of cases, users just need a vector, they can pass VME_INTR_VECTOR_ANY in the vmeio_intr_vector_t field. Here, VME_DEBUG can be specified as a flag to help debugging. vmeio_intr_vector_get() retrieves interrupt vector number from the interrupt object. Usually, people will ask the system dynamically assign an interrupt vector so that they can associate their interrupt handler. They need this function to find out what interrupt vector number is assigned to them so that they can program interrupt registers of their devices. Sometimes, the driver already knows the vector number since they have declared the fixed ones in the configuration file. vmeio_intr_connect() associates a software interrupt handler to the hardware interrupt resources. Return 0 if success, -1 if failure. vmeio_intr_disconnect() disassociates the interrupt handler from the specified interrupt. vmeio_intr_free() frees the interrupt resources. Usually, the interrupt vector allocated for the device is freed here. FILES /var/sysgen/system /var/sysgen/master.d /var/sysgen/boot SEE ALSO "IRIX Device Driver Programmer's Guide"