MI_ReserveWram*

Syntax

#include <twl/mi.h>

u32 MI_ReserveWram( MIWramPos wram, MIWramSize size, MIWramProc proc )
u32 MI_ReserveWramSlot( MIWramPos wram, int slot, MIWramSize size, MIWramProc proc )

(#define)
#define MI_ReserveWram_A( size, proc )
#define MI_ReserveWram_B( size, proc )
#define MI_ReserveWram_C( size, proc )
#define MI_ReserveWramSlot_A( slot, size, proc )
#define MI_ReserveWramSlot_B( slot, size, proc )
#define MI_ReserveWramSlot_C( slot, size, proc )

Arguments

wram WRAM to reserve.
slot Slot number.
size Size to reserve.
proc Processor to reserve for.

Return Values

Returns the starting address if the reservation was successful.
Returns 0 if the reservation failed.

Description

Reserves WRAM for the specified processor.

Call this function if you are not quite ready to actually allocate and use WRAM, but you want to reserve the WRAM for a certain processor. It is acceptable to reserve WRAM for a processor other than the one this function is called from. In other words, reservations for the ARM7 can be made from the ARM9.

The wram argument indicates the target WRAM. This is of type MIWramPos and is MI_WRAM_A, MI_WRAM_B, or MI_WRAM_C.

The slot argument is the starting slot number when specifying the location.

The size argument indicates the size to reserve. This is of type MIWramSize and is between MI_WRAM_SIZE_32KB and MI_WRAM_SIZE_256KB. WRAM can have a separate reservation for each slot: that is, 64 KB for WRAM-A, and 32 KB for WRAM-B and WRAM-C.

The proc argument indicates which processor the reservation is for. This is of type MIWramProc and is MI_WRAM_ARM9, MI_WRAM_ARM7, or MI_WRAM_DSP.

If WRAM reservations are made with the MI_ReserveWram function, the system starts searching through contiguous unused slots in the target WRAM for areas that are of the requested size, starting from the lower-order addresses. Once found, the function returns immediately. With the MI_ReserveWramSlot function, the location is user-specified. This fails if there is a region for which even one slot cannot be reserved.

If the reservation was successful, the starting address is returned by the function. If it failed, 0 is returned.

A reserved region can only be allocated by the processor for which it was reserved. No other processors can allocate the region.

MI_ReserveWram_A is the #define directive of MI_ReserveWram( MI_WRAM_A, ... ).
MI_ReserveWram_B is the #define directive of MI_ReserveWram( MI_WRAM_B, ... ).
MI_ReserveWram_C is the #define directive of MI_ReserveWram( MI_WRAM_C, ... ).
MI_ReserveWramSlot_A is the #define directive of MI_ReserveWramSlot( MI_WRAM_A, ... ).
MI_ReserveWramSlot_B is the #define directive of MI_ReserveWramSlot( MI_WRAM_B, ... ).
MI_ReserveWramSlot_C is the #define directive of MI_ReserveWramSlot( MI_WRAM_C, ... ).

To cancel a reservation, call one of the MI_CancelWram* functions.


Example: Here, we reserve 64 KB from WRAM-C for the DSP.

MI_ReserveWram( MI_WRAM_C, MI_WRAM_SIZE_64KB, MI_WRAM_DSP );
OR
MI_ReserveWram_C( MI_WRAM_SIZE_64KB, MI_WRAM_DSP );

See Also

Overview: Work RAM
MI-Related Constants

Revision History

2007/08/20 Initial version.


CONFIDENTIAL