2 .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DDI_DMA_GETWIN 9F "Nov 15, 1996"
8 ddi_dma_getwin \- activate a new DMA window
13 #include <sys/sunddi.h>
17 \fBint\fR \fBddi_dma_getwin\fR(\fBddi_dma_handle_t\fR \fIhandle\fR, \fBuint_t\fR \fIwin\fR,
18 \fBoff_t *\fR\fIoffp\fR, \fBsize_t *\fR\fIlenp\fR, \fBddi_dma_cookie_t\fR \fI*cookiep\fR,
19 \fBuint_t *\fR\fIccountp\fR);
25 Solaris DDI specific (Solaris DDI).
33 The \fBDMA\fR handle previously allocated by a call to
34 \fBddi_dma_alloc_handle\fR(9F).
43 Number of the window to activate.
52 Pointer to an offset. Upon a successful return, \fIoffp\fR will contain the
53 new offset indicating the beginning of the window within the object.
62 Upon a successful return, \fIlenp\fR will contain the size, in bytes, of the
72 A pointer to the first \fBddi_dma_cookie\fR(9S) structure.
81 Upon a successful return, \fIccountp\fR will contain the number of cookies for
82 this \fBDMA\fR window.
88 \fBddi_dma_getwin()\fR activates a new \fBDMA\fR window. If a \fBDMA\fR
89 resource allocation request returns \fBDDI_DMA_PARTIAL_MAP\fR indicating that
90 resources for less than the entire object were allocated, the current
91 \fBDMA\fR window can be changed by a call to \fBddi_dma_getwin()\fR.
94 The caller must first determine the number of \fBDMA\fR windows, \fIN\fR,
95 using \fBddi_dma_numwin\fR(9F). \fBddi_dma_getwin()\fR takes a \fBDMA\fR
96 window number from the range \fI[0..N-1]\fR as the parameter \fIwin\fR and
97 makes it the current \fBDMA\fR window.
100 \fBddi_dma_getwin()\fR fills in the first \fBDMA\fR cookie pointed to by
101 \fIcookiep\fR with the appropriate address, length, and bus type.
102 \fB*\fR\fIccountp\fR is set to the number of \fBDMA\fR cookies representing
103 this \fBDMA \fRobject. Subsequent \fBDMA\fR cookies must be retrieved using
104 \fBddi_dma_nextcookie\fR(9F).
107 \fBddi_dma_getwin()\fR takes care of underlying resource synchronizations
108 required to shift the window. However accessing the data prior to or after
109 moving the window requires further synchronization steps using
110 \fBddi_dma_sync\fR(9F).
113 \fBddi_dma_getwin()\fR is normally called from an interrupt routine. The first
114 invocation of the \fBDMA\fR engine is done from the driver. All subsequent
115 invocations of the \fBDMA\fR engine are done from the interrupt routine. The
116 interrupt routine checks to see if the request has been completed. If it has,
117 the interrupt routine returns without invoking another \fBDMA\fR transfer.
118 Otherwise, it calls \fBddi_dma_getwin()\fR to shift the current window and
119 start another \fBDMA\fR transfer.
123 \fBddi_dma_getwin()\fR returns:
127 \fB\fBDDI_SUCCESS\fR \fR
130 Resources for the specified \fBDMA\fR window are allocated.
136 \fB\fBDDI_FAILURE\fR \fR
139 \fIwin\fR is not a valid window index.
145 \fBddi_dma_getwin()\fR can be called from user, kernel, or interrupt context.
149 \fBddi_dma_addr_bind_handle\fR(9F), \fBddi_dma_alloc_handle\fR(9F),
150 \fBddi_dma_buf_bind_handle\fR(9F), \fBddi_dma_nextcookie\fR(9F),
151 \fBddi_dma_numwin\fR(9F), \fBddi_dma_sync\fR(9F),
152 \fBddi_dma_unbind_handle\fR(9F), \fBddi_dma_cookie\fR(9S)
155 \fIWriting Device Drivers\fR