OS_TryLockCartridge

Syntax

#include <nitro/os.h>
s32 OS_TryLockCartridge( u16 lockID );
  

Arguments

lockID ID used to lock the cartridge

Return Values

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.)

Description

The spinlock tries only once for exclusive control over resources (for this function, the cartridge) 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.

Internal Operation

Accesses the EXMEMCNT I/O register (0x4000204).

See Also

OS_LockCartridge, OS_UnlockCartridge, OS_TryLockCard, OS_GetLockID

Revision History

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


CONFIDENTIAL