Kernel Functions for Drivers ddimemalloc(9F)
NAME
ddimemalloc, ddimemfree - allocate and free sequentially
accessed memory
SYNOPSIS
#include
#include
int ddimemalloc(devinfot *dip, ddidmalimt *limits,
uintt length, uintt flags, caddrt *kaddrp,
uintt *reallength);
void ddimemfree(caddrt kaddr);
INTERFACE LEVEL
These interfaces are obsolete. ddidmamemalloc(9F) and
ddidmamemfree(9F) should be used instead.
PARAMETERS
ddimemalloc()
dip A pointer to the device's devinfo structure.
limits A pointer to a DMA limits structure for this
device (see ddidmalimsparc(9S) or
ddidmalimx86(9S)). If this pointer is
NUL, a default set of DMA limits is assumed.
length The length in bytes of the desired alloca-
tion.
flags The possible flags 1 and 0 are taken to mean,
respectively, wait until memory is available,
or do not wait.
kaddrp On a successful return, *kaddrp points to the
allocated memory.
reallength The length in bytes that was allocated.
Alignment and padding requirements may cause
ddimemalloc() to allocate more memory than
requested in length.
ddimemfree()
SunOS 5.11 Last change: 04 Apr 2006 1
Kernel Functions for Drivers ddimemalloc(9F)
kaddr The memory returned from a successful call to
ddimemalloc().
DESCRIPTION
The ddimemalloc() function allocates memory for DMA
transfers and should be used if the device is performing
sequential, unidirectional, block-sized and block-aligned
transfers to or from memory. This type of access is commonly
known as streaming access. The allocation will obey the
alignment and padding constraints as specified by the limits
argument and other limits imposed by the system.
Note that you must still use DMA resource allocation func-
tions (see ddidmasetup(9F)) to establish DMA resources for
the memory allocated using ddimemalloc(). ddimemalloc()
returns the actual size of the allocated memory object.
Because of padding and alignment requirements, the actual
size might be larger than the requested size.
ddidmasetup(9F) requires the actual length.
In order to make the view of a memory object shared between
a CPU and a DMA device consistent, explicit synchronization
steps using ddidmasync(9F) or ddidmafree(9F) are
required.
The ddimemfree() function frees up memory allocated by
ddimemalloc().
RETURN VALUES
The ddimemalloc() function returns:
DISUCES Memory successfully allocated.
DIFAILURE Allocation failed.
CONTEXT
The ddimemalloc() function can be called from user, inter-
rupt, or kernel context, except when flags is set to 1, in
which case it cannot be called from interrupt context.
ATRIBUTES
See attributes(5) for a description of the following attri-
butes:
SunOS 5.11 Last change: 04 Apr 2006 2
Kernel Functions for Drivers ddimemalloc(9F)
ATRIBUTE TYPE ATRIBUTE VALUE
Stability Level Obsolete
SEE ALSO
attributes(5), ddidmafree(9F), ddidmamemalloc(9F),
ddidmamemfree(9F), ddidmasetup(9F), ddidmasync(9F),
ddiiopballoc(9F), ddidmalimsparc(9S),
ddidmalimx86(9S), ddidmareq(9S)
Writing Device Drivers
SunOS 5.11 Last change: 04 Apr 2006 3
|