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>CP_SetSqrtImm*</title>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</head>
10<body>
11<h1 align="left">CP_SetSqrtImm*<img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<dl>
14  <dd>
15<CODE>#include &lt;nitro/cp.h&gt;</CODE><BR>
16  <BR>
17  <CODE>void CP_SetSqrtImm64( u64 param );</CODE><br>
18  <CODE>void CP_SetSqrtImm32( u32 param );</CODE>
19</dd>
20</dl>
21<h2>Arguments</h2>
22<TABLE border="1" width="100%">
23  <TBODY>
24    <TR>
25      <TD width="13%"><EM><STRONG>param</STRONG></EM></TD>
26      <TD width="87%">Value of the square root to be calculated.</TD>
27    </TR>
28  </TBODY>
29</TABLE>
30<h2>Return Values</h2>
31<p>None.</p>
32<H2>Description</H2>
33<P>Sets the parameters for square root calculations. It does not set the square root calculation mode, but merely stores the parameter. Calculation modes are listed below.</P>
34<TABLE border="1">
35  <TBODY>
36    <TR>
37      <TH>Square Root Calculation Mode</TH>
38      <TH>Calculation</TH>
39      <TH>Calculation Cycles</TH>
40      <TH>CPU Cycle Conversion</TH>
41    </TR>
42    <TR>
43      <TD>CP_SQRT_32BIT_MODE</TD>
44      <TD>Square root calculation of 32-bit values</TD>
45      <TD>13 cycles</TD>
46      <TD>26 cycles</TD>
47    </TR>
48    <TR>
49      <TD>CP_SQRT_64BIT_MODE</TD>
50      <TD>Square root calculation of 64-bit values</TD>
51      <TD>13 cycles</TD>
52      <TD>26 cycles</TD>
53    </TR>
54  </TBODY>
55</TABLE>
56<P><B>Note:</B> With the square root calculator, an interrupt may affect data integrity. If the parameters are set and an interrupt occurs during square root calculation, the result may not be accurate. Therefore, to maintain the integrity of an interrupted square root calculation, temporarily store and restore the calculator status using <code><A href="../CP_SaveContext.html">CP_SaveContext()</A></code> and <code><A href="../CP_RestoreContext.html">CP_RestoreContext()</A></code>, respectively. The status of square root calculators is also automatically saved/restored when threads are switched.</FONT></B></P>
57<BLOCKQUOTE><BR>
58<TABLE border="1">
59  <TBODY>
60    <TR>
61      <TD style="background-color : #eeeeee;"><B>Example:</B> Restore the status of the square root calculator.<BR>
62      <BR>
63<PRE>intr_func( void )
64{
65  CPContext context;
66
67  CP_SaveContext( &amp;context );
68  CP_SetSqrt32( 1000 );
69  CP_WaitSqrt();
70  result = CP_GetDqrtResult32();
71  CP_RestoreContext( &amp;context );
72}</PRE></TD>
73    </TR>
74  </TBODY>
75</TABLE>
76</BLOCKQUOTE>
77<h2>Internal Operation</h2>
78<p><CODE>Stores values in <CODE>SQRT_PARAM(0x40002B8)</CODE> of the IO register.<br></CODE></p>
79<h2>See Also</h2>
80<p><A href="CP_SetSqrt.html"><CODE>CP_SetSqrt*</CODE></A><br /> <A href="CP_IsSqrtBusy.html"><CODE>CP_IsSqrtBusy</CODE></A><br /> <A href="CP_WaitSqrt.html"><CODE>CP_WaitSqrt</CODE></A><br /> <A href="CP_GetSqrtResult.html"><CODE>CP_GetSqrtResult*</CODE></A></p>
81<H2>Revision History</H2>
82<P>2006/08/09 Added a note about use inside interrupts.<BR>2004/01/09/ Added content.<BR> 2003/12/01 Initial version.</P>
83<hr><p>CONFIDENTIAL</p></body>
84</html>
85