DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

udi_mem_alloc(3udi)


Allocate memory for a virtually-contiguous object

SYNOPSIS

#include <udi.h>

void udi_mem_alloc (

	udi_mem_alloc_call_t *callback,

	udi_cb_t *gcb,

	udi_size_t size,

	udi_ubit8_t flags );
 
typedef void udi_mem_alloc_call_t (

	udi_cb_t *gcb,

	void *new_mem );
 
/* Values for flags */
 
#define  UDI_MEM_NOZERO				(1U<<0)
 
#define  UDI_MEM_MOVABLE				(1U<<1)
 

ARGUMENTS callback, gcb are standard arguments described in the "Asynchronous Service Calls" section of "Calling Sequence and Naming Conventions".

size is the number of bytes of space requested. See udi_limits_t for limits on allocation sizes.

flags is a bitmask of optional flags, which may include zero or more of the following:

UDI_MEM_NOZERO - Don't zero memory contents.

UDI_MEM_MOVABLE - Allocate movable memory.

new_mem is a pointer to the new memory object. The driver is expected to cast this to the appropriate type of struct, array, etc. If size is zero, new_mem will be NULL.

DESCRIPTION udi_mem_alloc allocates memory for a new virtually-contiguous object capable of storing at least size bytes. The newly allocated memory will be zeroed unless UDI_MEM_NOZERO is set, in which case the initial values are undefined.

The newly allocated memory will be aligned on the most restrictive alignment of the platform's natural alignments for long and pointer data types, allowing the allocated memory to be directly accessed as C structures.

If the UDI_MEM_MOVABLE flag is set, the memory will be allocated as movable memory. This means that it can be passed outside of the region from which it was allocated. Only movable memory may be pointed to by control block fields or channel operation parameters. UDI_MEM_MOVABLE should be used only if needed, as movable memory may be a more limited resource.

WARNINGS The memory allocated by this routine has no particular physical or I/O bus-related properties. It is intended only for access by driver software.

Control block usage must follow the rules described in the "Asynchronous Service Calls" section of "Calling Sequence and Naming Conventions".

The usage of memory allocated by this routine must follow the rules described in the "Memory Objects" section of "Data Model".

REFERENCES udi_mem_free, udi_cancel, udi_limits_t


UDI Core Specification Contents