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)
MI_ReserveWram_A( size, proc )
MI_ReserveWram_B( size, proc )
MI_ReserveWram_C( size, proc )
MI_ReserveWramSlot_A( slot, size, proc )
MI_ReserveWramSlot_B( slot, size, proc )
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 aren't 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 will be 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 will be 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 will be MI_WRAM_ARM9, MI_WRAM_ARM7, or MI_WRAM_DSP.

If WRAM reservations are made with MI_ReserveWram(), the system will start searching through contiguous unused slots in the target WRAM for areas that are of the requested size, starting the search from the lower-order addresses. Once found, the function will return immediately. With MI_ReserveWramSlot(), the location is user-specified. This will fail 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 will 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