OS_TryLockCard


C Specification

#include <nitro/os.h>

s32 OS_TryLockCard( u16 lockID );

Description

The spinlock tries only once for exclusive control over resources (for this function, the card) shared between processors or modules.

When the lock succeeds, it accesses the EXMEMCNT register and obtains access rights to the card bus. Please be sure to use this function for resources shared between processors after the lock. If the timing of an exclusive resource of a processor can be adjusted, then a lock is not necessary.

lockID is the ID for the lock and should be obtained using OS_GetLockID() to prevent overlap between processors or modules.

Arguments

lockID ID used to lock a cartridge.

Return Value

A positive value indicates the lock is already enabled. The value is the lock ID stored immediately before by another resource.

OS_LOCK_SUCCESS indicates the lock was successful. (Defined as 0.)

Internal Operation

Accesses EXMEMCNT(0x4000204) of the IO register.

See Also

OS_LockCard, OS_UnlockCard, OS_TryLockCartridge, OS_GetLockID

Revision History

11/04/2004 Added Internal Operation description.
07/22/2004 Change of argument format from u32 to u16
06/21/2004 Initial version