1ddi_dma_segtocookie(9F) Kernel Functions for Drivers ddi_dma_segtocookie(9F)
2
3
4
6 ddi_dma_segtocookie - convert a DMA segment to a DMA address cookie
7
9 #include <sys/ddi.h>
10 #include <sys/sunddi.h>
11
12
13
14 int ddi_dma_segtocookie(ddi_dma_seg_t seg, off_t *offp, off_t *lenp,
15 ddi_dma_cookie_t *cookiep);
16
17
19 This interface is obsolete. ddi_dma_nextcookie(9F) should be used
20 instead.
21
23 seg A DMA segment.
24
25
26 offp A pointer to an off_t. Upon a successful return, it is
27 filled in with the offset. This segment is addressing within
28 the object.
29
30
31 lenp The byte length. This segment is addressing within the
32 object.
33
34
35 cookiep A pointer to a DMA cookie (see ddi_dma_cookie(9S)).
36
37
39 The ddi_dma_segtocookie() function takes a DMA segment and fills in the
40 cookie pointed to by cookiep with the appropriate address, length, and
41 bus type to be used to program the DMA engine. ddi_dma_segtocookie()
42 also fills in *offp and *lenp, which specify the range within the
43 object.
44
46 The ddi_dma_segtocookie() function returns:
47
48 DDI_SUCCESS Successfully filled in all values.
49
50
51 DDI_FAILURE Failed to successfully fill in all values.
52
53
55 The ddi_dma_segtocookie() function can be called from user, interrupt,
56 or kernel context.
57
59 Example 1 ddi_dma_segtocookie() example
60
61 for (win = NULL; (retw = ddi_dma_nextwin(handle, win, &nwin)) !=
62 DDI_DMA_DONE; win = nwin) {
63 if (retw != DDI_SUCCESS) {
64 /* do error handling */
65 } else {
66 for (seg = NULL; (rets = ddi_dma_nextseg(nwin, seg, &nseg)) !=
67 DDI_DMA_DONE; seg = nseg) {
68 if (rets != DDI_SUCCESS) {
69
70 /* do error handling */
71 } else {
72 ddi_dma_segtocookie(nseg, &off, &len, &cookie);
73
74 /* program DMA engine */
75 }
76 }
77 }
78 }
79
80
82 See attributes(5) for a description of the following attributes:
83
84
85
86
87 ┌─────────────────────────────┬─────────────────────────────┐
88 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
89 ├─────────────────────────────┼─────────────────────────────┤
90 │Stability Level │Obsolete │
91 └─────────────────────────────┴─────────────────────────────┘
92
94 attributes(5), ddi_dma_nextcookie(9F). ddi_dma_nextseg(9F),
95 ddi_dma_nextwin(9F), ddi_dma_sync(9F), ddi_dma_cookie(9S)
96
97
98 Writing Device Drivers
99
100
101
102SunOS 5.11 16 Jan 2006 ddi_dma_segtocookie(9F)