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_SpinWait</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">OS_SpinWait* <img src="../../image/NTR.gif" align="middle"><img src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14<DD><CODE>#include <nitro/os.h></CODE><BR> <BR> <CODE>void OS_SpinWait( u32 cycles );<BR> <BR> void OS_SpinWaitCpuCycles( u32 cycles );<BR> void OS_SpinWaitSysCycles( u32 cycles );</CODE> 15</DL> 16<H2>Arguments</H2> 17<TABLE border="1" width="100%"> 18 <TBODY> 19 <TR> 20<TD width="13%"><CODE>cycles</CODE></TD> 21<TD width="87%">Number of cycles to wait.<BR><BR> With the <CODE>OS_SpinWait</CODE> function, this is based on a <FONT color="#ff0000">2x multiplier of the base cycle</FONT>.<BR>With the <CODE>OS_SpinWaitCpuCycles</CODE> function, this is based on <FONT color="#ff0000">CPU cycles</FONT>.<BR>With the <CODE>OS_SpinWaitSysCycles</CODE> function, this is based on the <FONT color="#ff0000">base cycles</FONT>.<BR> 22 </TD> 23 </TR> 24 </TBODY> 25</TABLE> 26<H2>Return Values</H2> 27<P>None.</P> 28<H2>Description</H2> 29<P>Makes the CPU run empty loops for at least the number of cycles specified by <CODE>cycles</CODE>.</P> 30<P>This function only causes empty loop processing. Therefore, be aware that the return time from this function may be greatly delayed by interrupts that are generated during the loops.</P> 31<P>Because of function calls and other overhead, return from this function might be delayed slightly more than the specified number of cycles.</P> 32<P>The <CODE>OS_SpinWaitCpuCycles</CODE> function is based on the <FONT color="#ff0000">CPU cycles</FONT>.<BR></P> 33<P>The <CODE>OS_SpinWaitSysCycles</CODE> function is based on <FONT color="#ff0000">base cycles</FONT>. This is independent of mode (NITRO or TWL) or changes to the CPU frequency.</P> 34<P>The <CODE>OS_SpinWait</CODE> function is based on a fixed value that is unrelated to the operating frequency of the CPU. It was created for the sake of compatibility with NITRO. For the ARM9, it is based on a <FONT color="#ff0000">2x multiplier of the base cycle</FONT>. For the ARM7, it is based on the base cycles. On NITRO, the <CODE>OS_SpinWait</CODE> function was used as <I>empty looping based on CPU cycles</I>. Because the CPU frequency can be changed on TWL, however, it is set up this way for convenience when NITRO source code is used.</P> 35<P>The frequencies used as the basis for the the number of cycles (<CODE>cycles</CODE>) are shown below.</P> 36<BLOCKQUOTE><CODE><B>OS_SpinWait</B></CODE> 37<TABLE border="1"> 38 <TBODY> 39 <TR> 40<TH rowspan="2" width="50%">Platform</TH> 41<TH colspan="2" width="50%">Frequency Used as the Basis for <CODE>cycles</CODE></TH> 42 </TR> 43 <TR> 44<TH width="25%">ARM9</TH> 45<TH width="25%">ARM7</TH> 46 </TR> 47 <TR> 48<TD>NITRO <img src="../../image/NTR.gif" align="middle"></TD> 49<TD rowspan="2"><center>67.03 MHz</center></TD> 50<TD rowspan="2"><center>33.51 MHz</center></TD> 51 </TR> 52 <TR> 53<TD>TWL <img src="../../image/TWL.gif" align="middle"></TD> 54 </TR> 55 </TBODY> 56</TABLE> 57<BR> <CODE><B>OS_SpinWaitCpuCycles</B></CODE> 58<TABLE border="1"> 59 <TBODY> 60 <TR> 61<TH rowspan="2" width="50%">Platform</TH> 62<TH colspan="2" width="50%">Frequency Used as the Basis for <CODE>cycles</CODE></TH> 63 </TR> 64 <TR> 65<TH width="25%">ARM9</TH> 66<TH width="25%">ARM7</TH> 67 </TR> 68 <TR> 69<TD>NITRO <img src="../../image/NTR.gif" align="middle"></TD> 70<TD><center>67.03 MHz</center></TD> 71<TD rowspan="2"><center>33.51 MHz</center></TD> 72 </TR> 73 <TR> 74<TD>TWL <img src="../../image/TWL.gif" align="middle"></TD> 75<TD><center>67.03 MHz (When running at standard speed)<br>134.06 MHz (When running at 2x speed)</center></TD> 76 </TR> 77 </TBODY> 78</TABLE> 79<BR> <B><CODE>OS_SpinWaitSysCycles</CODE></B><BR> 80<TABLE border="1"> 81 <TBODY> 82 <TR> 83<TH rowspan="2" width="50%">Platform</TH> 84<TH colspan="2" width="50%">Frequency Used as the Basis for <CODE>cycles</CODE></TH> 85 </TR> 86 <TR> 87<TH width="25%">ARM9</TH> 88<TH width="25%">ARM7</TH> 89 </TR> 90 <TR> 91<TD>NITRO <img src="../../image/NTR.gif" align="middle"></TD> 92<TD colspan="2" rowspan="2"> <center>33.51 MHz</center></TD> 93 </TR> 94 <TR> 95<TD>TWL <img src="../../image/TWL.gif" align="middle"></TD> 96 </TR> 97 </TBODY> 98</TABLE> 99</BLOCKQUOTE> 100<H2>See Also</H2> 101<P><A href="../../svc/SVC_WaitByLoop.html"><CODE>SVC_WaitByLoop</CODE></A></P> 102<H2>Revision History</H2> 103<P>2007/09/27 Added descriptions of the <CODE>OS_SpinWaitCpuCycles</CODE> and <CODE>OS_SpinWaitSysCycles</CODE> functions.<BR>2004/02/27 Initial version.</P> 104<hr><p>CONFIDENTIAL</p></body> 105</HTML>