 |
Index for Section 9 |
|
 |
Alphabetical listing for V |
|
 |
Bottom of page |
|
vba_map_csr(9r)
NAME
vba_map_csr - VMEbus: Maps a VMEbus address CSR area
SYNOPSIS
io_handle_t vba_map_csr(
struct controller *ctlr,
vme_addr_t vme_address,
unsigned int bcnt,
vme_atype_t atype );
ARGUMENTS
ctlr
Specifies a pointer to the VMEbus device's controller data structure.
vme_address
Specifies the VMEbus address to map for programmed I/O (PIO) access.
bcnt
Specifies the size (in bytes) of the device's CSR address region.
Typically, the bus configuration code calls this routine on the
driver's behalf prior to calling the driver's probe() routine. The bus
configuration code obtains the bcnt value, for example, for the first
CSR address from the addr1_size member of the driver's driver data
structure.
atype
A bit encoded argument that specifies the address space, transfer size,
access mode, and swap mode for mapping the device's CSR area. A table
of valid bits appears in the DESCRIPTION section.
DESCRIPTION
The vba_map_csr() routine maps the specified VMEbus address space to an I/O
handle (an io_handle_t data type).
Dense memory access typically maps large memory buffers (for example,
graphics frame buffers) present in the A32 address space. If you map a CSR
area for dense memory access by specifying the VME_DENSE bit in the atype
argument, vba_map_csr() maps the CSR area such that there are read-ahead
side effects. Read accesses to dense memory are implemented as longword
pumps.
As the description for the atype argument stated, you can specify atype as
the bitwise inclusive OR of the valid bits in the following table:
_______________________________________________________________________
Bit Category Value Meaning
_______________________________________________________________________
Swap mode bits VME_BS_NOSWAP Specifies no byte swapping.
VME_BS_BYTE
Specifies byte swapping in
bytes.
VME_BS_WORD
Specifies byte swapping in
words.
VME_BS_LWORD
Specifies byte swapping in
longwords.
VME_BS_QUAD
Specifies byte swapping in
quadwords.
Address space bits VME_A16
Specifies a request for the
16-bit address space.
VME_A24
Specifies a request for the
24-bit address space.
VME_A32
Specifies a request for the
32-bit address space.
Transfer size bits VME_D08
Specifies a request for the
8-bit data size.
VME_D16
Specifies a request for the
16-bit data size.
VME_D32
Specifies a request for the
32-bit data size.
Access mode bits VME_UDATA Specifies user data.
VME_UPROG Specifies a user program.
VME_SDATA Specifies supervisory data.
VME_SPROG
Specifies a supervisory
program.
CPU allocation space bit VME_DENSE
Specifies dense space
mapping on a platform for
which the default CPU
allocation space is sparse.
_______________________________________________________________________
Table Notes
·
Not all bus adapters support hardware byte swapping.
·
Not all bus adapters use the transfer size.
·
Depending on bus adapter implementation, the CPU allocation space
bit may not be applicable.
RETURN VALUES
Upon successful completion, vba_map_csr() returns an I/O handle that the
driver can use as an argument to the routines called to read and write CSRs
and copy buffers between system memory and I/O space. For example, you can
pass this returned I/O handle in calls to read_io_port() and
write_io_port().
If unsuccessful, vba_map_csr() returns an I/O handle of 0 (zero).
EXAMPLE
The following code fragment shows a call to the vba_map_csr() routine to
map a VMEbus window for programmed I/O:
.
.
.
int unit; /* Device unit number */
struct controller *ctlr = mydev_ctlr[unit]; /* mydev controller struct */
struct mydev_softc *sc = &mydev_softc[unit]; /* mydev driver struct */
int ret_val = ESUCCESS; /* Completion status */
vme_addr_t pio_vme_addr = 0x100000; /* VMEbus address to map */
u_int pio_vme_size = 0x10000; /* VMEbus byte count */
vme_atype_t pio_vme_am = VME_A24_UDATA_D32; /* VMEbus addr modifiers */
.
.
.
/*
* Map outbound to VMEbus A24 address 0x100000 for 64 KB bytes (0x10000)
* with an address-modifier access mode of A24 user data. An access
* width of D32 is specified; however, this value may be ignored by
* some VMEbus adapters.
*/
sc->pio_handle = vba_map_csr(ctlr,
pio_vme_addr,
pio_vme_size,
pio_vme_am);
if (!(sc->pio_handle)) {
printf("mycode: vba_map_csr routine failed\n");
printf(" pio_vme_addr = 0x%x pio_vme_size = 0x%x pio_vme_am = 0x%x\n",
pio_vme_addr,
pio_vme_size,
pio_vme_am);
ret_val = EINVAL;
}
.
.
.
The driver example chapter of Writing VMEbus Device Drivers shows how the
dmaex example driver calls vba_map_csr() to map to the VMEbus for
programmed I/O (PIO). See the examples of user-mode I/O to a memory-mapped
VMEbus window and PIO data transfers in the driver example chapter.
SEE ALSO
Data Structures: driver(9s)
Kernel Routines: vba_unmap_csr(9r)
 |
Index for Section 9 |
|
 |
Alphabetical listing for V |
|
 |
Top of page |
|