<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.linux-xtensa.org/index.php?action=history&amp;feed=atom&amp;title=Hifitest.c</id>
	<title>Hifitest.c - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.linux-xtensa.org/index.php?action=history&amp;feed=atom&amp;title=Hifitest.c"/>
	<link rel="alternate" type="text/html" href="http://wiki.linux-xtensa.org/index.php?title=Hifitest.c&amp;action=history"/>
	<updated>2026-05-04T23:59:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>http://wiki.linux-xtensa.org/index.php?title=Hifitest.c&amp;diff=354&amp;oldid=prev</id>
		<title>Marc: Example code in a separate page</title>
		<link rel="alternate" type="text/html" href="http://wiki.linux-xtensa.org/index.php?title=Hifitest.c&amp;diff=354&amp;oldid=prev"/>
		<updated>2009-12-02T03:56:17Z</updated>

		<summary type="html">&lt;p&gt;Example code in a separate page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
   #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
   #include &amp;lt;time.h&amp;gt;&lt;br /&gt;
   #include &amp;lt;xtensa/tie/xt_hifi2.h&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   #define INC 1&lt;br /&gt;
   &lt;br /&gt;
   main(int argc, char **argv)&lt;br /&gt;
   {&lt;br /&gt;
     int inc;&lt;br /&gt;
     int inc2;&lt;br /&gt;
     register ae_p24x2s p24_cnt;&lt;br /&gt;
     register ae_p24x2s p24_inc;&lt;br /&gt;
     register ae_p24x2s p24_pid;&lt;br /&gt;
     int cnt;&lt;br /&gt;
     int cnt2;&lt;br /&gt;
     int pid;&lt;br /&gt;
     int pid2;&lt;br /&gt;
     volatile int i, j, k, l;&lt;br /&gt;
     time_t time0 = time(NULL);&lt;br /&gt;
     time_t time1 = time(NULL);&lt;br /&gt;
   &lt;br /&gt;
   restart:&lt;br /&gt;
     cnt = 0;&lt;br /&gt;
     cnt2 = 0;&lt;br /&gt;
     inc = INC;&lt;br /&gt;
     pid = getpid();&lt;br /&gt;
     p24_cnt = AE_ZEROP48();&lt;br /&gt;
     p24_inc = AE_MOVPA24(inc);&lt;br /&gt;
     p24_pid = AE_MOVPA24(pid);&lt;br /&gt;
   &lt;br /&gt;
     while (1)&lt;br /&gt;
       {&lt;br /&gt;
         int errors = 0;&lt;br /&gt;
   &lt;br /&gt;
         if ((cnt &amp;amp; 0xffffff) == 0) {&lt;br /&gt;
   	time0 = time1;&lt;br /&gt;
   	time1 = time(NULL);&lt;br /&gt;
   	printf(&amp;quot;cnt:0x%x, pid:%d; Eatting cpu; time:%ld\n&amp;quot;, cnt, pid, (time1 - time0));&lt;br /&gt;
   	for(i = 0; i&amp;lt;1000; i++) {&lt;br /&gt;
   	    for(j = 0; j &amp;lt; 1000; j++) {&lt;br /&gt;
   	        for(k = 0; k &amp;lt; 10; k++) {&lt;br /&gt;
   			l++;&lt;br /&gt;
   	    	}&lt;br /&gt;
   	    }&lt;br /&gt;
   	}&lt;br /&gt;
   	time0 = time1;&lt;br /&gt;
   	time1 = time(NULL);&lt;br /&gt;
   	printf(&amp;quot;cnt:0x%x, pid:%d; Eating Tie; time:%ld\n&amp;quot;, cnt, pid, (time1 - time0));&lt;br /&gt;
         }	&lt;br /&gt;
         cnt = (cnt + inc) &amp;amp; 0xffffff;&lt;br /&gt;
         p24_cnt = AE_ADDP24(p24_cnt, p24_inc);&lt;br /&gt;
         cnt2 = AE_MOVAP24S_L(p24_cnt) &amp;amp; 0xffffff;&lt;br /&gt;
         pid2 = AE_MOVAP24S_L(p24_pid) &amp;amp; 0xffffff;&lt;br /&gt;
         inc2 = AE_MOVAP24S_L(p24_inc) &amp;amp; 0xffffff;&lt;br /&gt;
   &lt;br /&gt;
         if (cnt2 != cnt)&lt;br /&gt;
   	{&lt;br /&gt;
   	  swapon(&amp;quot;/tmp/cmt2&amp;quot;, 0);&lt;br /&gt;
   	  printf(&amp;quot;Error: cnt2:0x%x != cnt:0x%x\n&amp;quot;, cnt2, cnt);&lt;br /&gt;
   	  errors++;&lt;br /&gt;
   	}&lt;br /&gt;
         if (inc2 != inc)&lt;br /&gt;
   	{&lt;br /&gt;
   	  swapon(&amp;quot;/tmp/inc2&amp;quot;, 0);&lt;br /&gt;
   	  printf(&amp;quot;Error: inc2:%d != inc:%d\n&amp;quot;, cnt2, cnt);&lt;br /&gt;
   	  errors++;&lt;br /&gt;
   	}&lt;br /&gt;
         if ( pid2 != pid)&lt;br /&gt;
   	{&lt;br /&gt;
   	  swapon(&amp;quot;/tmp/pid2&amp;quot;, 0);&lt;br /&gt;
   	  printf(&amp;quot;Error: pid2:%d != pid:%d\n&amp;quot;, pid2, pid);&lt;br /&gt;
   	  errors++;&lt;br /&gt;
   	}&lt;br /&gt;
   &lt;br /&gt;
   	if (errors) {&lt;br /&gt;
   	    printf(&amp;quot;for...\n&amp;quot;);&lt;br /&gt;
   	    for(i=0; i &amp;lt; 0x3FFFF; i++) &lt;br /&gt;
   		j++;&lt;br /&gt;
   	    printf(&amp;quot;sleep 10\n&amp;quot;);&lt;br /&gt;
   	    sleep(10);	&lt;br /&gt;
   	    printf(&amp;quot;for...\n&amp;quot;);&lt;br /&gt;
   		for(i=0; i &amp;lt; 0x3FFFF; i++)&lt;br /&gt;
   			j++;	&lt;br /&gt;
   	    printf(&amp;quot;restart\n&amp;quot;);	&lt;br /&gt;
   	    goto restart;&lt;br /&gt;
   	}&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;/div&gt;</summary>
		<author><name>Marc</name></author>
	</entry>
</feed>