<br><br><div class="gmail_quote">2010/6/28 Troy Kisky <span dir="ltr">&lt;<a href="mailto:troy.kisky@boundarydevices.com">troy.kisky@boundarydevices.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">Raffaele Recalcati wrote:<br>
&gt; +             if (dev-&gt;i2s_fast_clock) {<br>
&gt; +                     clk_div = 256;<br>
</div>can you have<br>
   f = (freq / params-&gt;rate_num) * params-&gt;rate_den;<br>
<div class="im">&gt; +                     do {<br>
&gt; +                             framesize = (freq / (--clk_div)) /<br>
&gt; +                                         params-&gt;rate_num *<br>
&gt; +                                         params-&gt;rate_den;<br>
</div>and<br>
                                framesize = f / (--clk_div);<br>
<div class="im">&gt; +                     } while (((framesize &lt; 33) || (framesize &gt; 4095)) &amp;&amp;<br>
&gt; +                              (clk_div));<br>
&gt; +                     clk_div--;<br>
</div>looks like clk_div can go negative here, should the above while say (clk_div &gt; 1)<br></blockquote><div><br>&gt; +                     } while (((framesize &lt; 33) || (framesize 
&gt; 4095)) &amp;&amp;<br>
&gt; +                              (clk_div));<br><br>only if clk_div not null stay inside the while.<br><br>
&gt; +                     clk_div--;<br><br>and here can at minumum be 0, not negative.<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div></div><div class="h5">&gt; +                     srgr |= DAVINCI_MCBSP_SRGR_FPER(framesize - 1);<br>
&gt; +             } else {<br>
&gt; +                     /* symmetric waveforms */<br>
&gt; +                     clk_div = freq / (mcbsp_word_length * 16) /<br>
&gt; +                               params-&gt;rate_num * params-&gt;rate_den;<br>
&gt; +                     srgr |= DAVINCI_MCBSP_SRGR_FPER(mcbsp_word_length *<br>
&gt; +                                                     16 - 1);<br>
&gt; +             }<br>
&gt; +             clk_div &amp;= 0xFF;<br>
&gt; +             srgr |= clk_div;<br>
</div></div></blockquote></div><br><br clear="all">so, dividing for (CLKGDV + 1) it is ok.<br>

<br>Raffaele<br><br>