# OS_LockCard

## C Specification

      #include <nitro/os.h>

      s32 OS_LockCard( u16 lockID );

## Arguments

lockID | ID used to lock the card

## Return Values

Succeeds if `OS_LOCK_SUCCESS` is returned. (Defined as 0.) It will continue trying until it succeeds, so this will always be the return value.

## Description

Spinlocks are employed to allow exclusive control of resources (for this function, the card) that are shared between processors or modules.

This function keeps trying until the lock is successful. 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_UnlockCard`, `OS_TryLockCard`, `OS_LockCartridge`, `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