NPAB_Get_Alignment

Called to obtain alignment requirements of the underlying platform.

Thread Context:Non-Blocking

Syntax

    LONG NPAB_Get_Alignment (
       LONG   npaHandle,
       LONG   type
       );
    
    

Parameters

npaHandle
The HAM's handle for using the NPA APIs, assigned during NPA_Register_HAM_Module.
type

Value

Description

0

Alignment requirement

1

Best case alignment

Other

Undefined

Return Values

Power of 2, byte-boundary data alignment requirement.

Remarks

Without this function, a developer cannot write platform-independent Direct Memory Access code, because the code cannot determine what characteristics it must meet.

If type is equal to 0, the function returns the data alignment requirement of a data object of an arbitrary type for the platform to function without exceptions or corrupted data. All operations and “real world” use of these operations should be considered in determining this value. That is, if Direct Memory Addressing into an arbitrary memory location can cause data corruption because of incoherent caching, then the function should return a value equal to at least the cache line size.

If type is equal to 1, the function returns the data alignment requirement for the platform to function at its best performance.

The value returned for type equal to 0 should always be less than or equal to the value returned for type equal to 1.

For most Intel-processor-based platforms, type equal to 0 should return a 0 and type equal to 1 should return the bus width of the processor (4).

An HP-PA-RISC machine should return 32 for both type equal to 0 and type equal to 1, because of the requirements of the memory cache.