1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>OS_TryLockCartridge</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_TryLockCartridge <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;nitro/os.h&gt;</CODE></PRE>
16  <PRE><CODE>s32 OS_TryLockCartridge( u16 lockID );
17  </CODE></PRE>
18</DL>
19<H2>Arguments</H2>
20<TABLE border="1" width="100%">
21  <TBODY>
22    <TR>
23      <TD width="13%"><EM><STRONG>lockID</STRONG></EM></TD>
24      <TD width="87%">ID used to lock the cartridge</TD>
25    </TR>
26  </TBODY>
27</TABLE>
28<H2>Return Values</H2>
29<P>A positive value indicates the lock is already enabled. The value is the lock ID stored immediately before by another resource. <code>OS_LOCK_SUCCESS</code> indicates the lock was successful. (Defined as <code>0</code>.)</P>
30<H2>Description</H2>
31<P>The spinlock tries only once for exclusive control over resources (for this function, the cartridge) shared between processors or modules.</P>
32<P>When the lock succeeds, it accesses the <code>EXMEMCNT</code> 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.</P>
33<P><em><strong><code>lockID</code></strong></em> is the ID for the lock and should be obtained using <code><a href="OS_GetLockID.html">OS_GetLockID()</a></code> to prevent overlap between processors or modules.</P>
34<H2>Internal Operation</H2>
35<P>Accesses the <code>EXMEMCNT</code> I/O register <code>(0x4000204)</code>.</P>
36<H2>See Also</H2>
37<P><a href="OS_LockCartridge.html">OS_LockCartridge</a></code>, <code><a href="OS_UnlockCartridge.html">OS_UnlockCartridge</a></code>, <code><a href="OS_TryLockCard.html">OS_TryLockCard</a></code>, <code><a href="OS_GetLockID.html">OS_GetLockID</a></code></P>
38<H2>Revision History</H2>
39<P>2004/11/04 Added Internal Operation description. <BR>2004/07/22 Change of argument format from u32 to u16 <BR>2004/06/21 Initial version</P>
40<hr><p>CONFIDENTIAL</p></body>
41</HTML>