ddi_dma_segtocookie.9f revision c10c16dec587a0662068f6e2991c29ed3a9db943
te
Copyright (c) 2006, Sun Microsystems, Inc.
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.
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.
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]
ddi_dma_segtocookie 9F "16 Jan 2006" "SunOS 5.11" "Kernel Functions for Drivers"
NAME
ddi_dma_segtocookie - convert a DMA segment to a DMA address cookie
SYNOPSIS

#include <sys/ddi.h> 
#include <sys/sunddi.h>



int ddi_dma_segtocookie(ddi_dma_seg_t seg, off_t *offp, off_t *lenp,
 ddi_dma_cookie_t *cookiep);
INTERFACE LEVEL

This interface is obsolete. ddi_dma_nextcookie(9F) should be used instead.

PARAMETERS

seg

A DMA segment.

offp

A pointer to an off_t. Upon a successful return, it is filled in with the offset. This segment is addressing within the object.

lenp

The byte length. This segment is addressing within the object.

cookiep

A pointer to a DMA cookie (see ddi_dma_cookie(9S)).

DESCRIPTION

The ddi_dma_segtocookie() function takes a DMA segment and fills in the cookie pointed to by cookiep with the appropriate address, length, and bus type to be used to program the DMA engine. ddi_dma_segtocookie() also fills in *offp and *lenp, which specify the range within the object.

RETURN VALUES

The ddi_dma_segtocookie() function returns:

DDI_SUCCESS

Successfully filled in all values.

DDI_FAILURE

Failed to successfully fill in all values.

CONTEXT

The ddi_dma_segtocookie() function can be called from user, interrupt, or kernel context.

EXAMPLES

Example 1 ddi_dma_segtocookie() example

for (win = NULL; (retw = ddi_dma_nextwin(handle, win, &nwin)) !=
 DDI_DMA_DONE; win = nwin) {
 if (retw != DDI_SUCCESS) {
 /* do error handling */
 } else {
 for (seg = NULL; (rets = ddi_dma_nextseg(nwin, seg, &nseg)) !=
 DDI_DMA_DONE; seg = nseg) {
 if (rets != DDI_SUCCESS) {

 /* do error handling */ 
 } else {
 ddi_dma_segtocookie(nseg, &off, &len, &cookie);

 /* program DMA engine */
 }
 }
 }
}
ATTRIBUTES

See attributes(5) for a description of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
Stability LevelObsolete
SEE ALSO

attributes(5), ddi_dma_nextcookie(9F). ddi_dma_nextseg(9F), ddi_dma_nextwin(9F), ddi_dma_sync(9F), ddi_dma_cookie(9S)

Writing Device Drivers