<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dsignt.de/support-wiki/index.php?action=history&amp;feed=atom&amp;title=Writing_interruptible_code_on_C6xxx_DSPs</id>
	<title>Writing interruptible code on C6xxx DSPs - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dsignt.de/support-wiki/index.php?action=history&amp;feed=atom&amp;title=Writing_interruptible_code_on_C6xxx_DSPs"/>
	<link rel="alternate" type="text/html" href="https://dsignt.de/support-wiki/index.php?title=Writing_interruptible_code_on_C6xxx_DSPs&amp;action=history"/>
	<updated>2026-08-14T20:39:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://dsignt.de/support-wiki/index.php?title=Writing_interruptible_code_on_C6xxx_DSPs&amp;diff=626&amp;oldid=prev</id>
		<title>WikiImporter: Pushed from DSignT Issue Database.</title>
		<link rel="alternate" type="text/html" href="https://dsignt.de/support-wiki/index.php?title=Writing_interruptible_code_on_C6xxx_DSPs&amp;diff=626&amp;oldid=prev"/>
		<updated>2011-12-15T14:09:03Z</updated>

		<summary type="html">&lt;p&gt;Pushed from DSignT Issue Database.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Taken from document SPRA534.pdf by Texas Instruments: Writing Interruptible Looped Code for the TMS320C6x DSP&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== compiler option –mi&amp;#039;&amp;#039;n&amp;#039;&amp;#039; ==&lt;br /&gt;
&lt;br /&gt;
The C6x code generation tools provide a high degree of flexibility for interruptibility. The&lt;br /&gt;
compiler option –mi&amp;#039;&amp;#039;n&amp;#039;&amp;#039; specifies an optional interrupt threshold value, &amp;#039;&amp;#039;n&amp;#039;&amp;#039;.  The threshold&lt;br /&gt;
value specifies the maximum number of clock cycles that the compiler can disable&lt;br /&gt;
interrupts. When using the –mi&amp;#039;&amp;#039;n&amp;#039;&amp;#039; option, the compiler and assembly optimizer analyze&lt;br /&gt;
both the loop structure and the number of times the loop will be iterated to determine the&lt;br /&gt;
maximum number of cycles it will take to execute the loop. If the tools can determine that&lt;br /&gt;
the maximum number of cycles is less than the threshold value, the compiler/assembly&lt;br /&gt;
optimizer will create non-interruptible code.  Otherwise, the tools generate interruptible&lt;br /&gt;
looped code that will, in most cases, not degrade the performance of that loop.&lt;br /&gt;
The compiler command line option –mi&amp;#039;&amp;#039;n&amp;#039;&amp;#039; can be used for an entire module.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{pagetop}}&lt;br /&gt;
== pragma FUNC_INTERRUPT_THRESHOLD ==&lt;br /&gt;
&lt;br /&gt;
In addition, a pragma can be used to specify the threshold on a function-by-function basis.  This&lt;br /&gt;
pragma is of the form:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#pragma FUNC_INTERRUPT_THRESHOLD(func, threshold);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or for c++:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#pragma FUNC_INTERRUPT_THRESHOLD(threshold);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The #pragma overrides the –mi&amp;#039;&amp;#039;n&amp;#039;&amp;#039; command line option.  If a threshold of less than 0 is&lt;br /&gt;
specified, it is assumed that the function will never be interrupted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{pagetop}}&lt;br /&gt;
== Examples ==&lt;br /&gt;
===  –mi&amp;#039;&amp;#039;n&amp;#039;&amp;#039;===&lt;br /&gt;
Compiler option -mi50 means, all loops in the current module must be interruptible after 50 cycles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== FUNC_INTERRUPT_THRESHOLD ===&lt;br /&gt;
&lt;br /&gt;
The following examples demonstrate the use of different thresholds:&lt;br /&gt;
* The function foo() must be interruptible at least every 2,000 cycles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#pragma FUNC_INTERRUPT_THRESHOLD(foo,2000)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The function foo() must always be interruptible.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#pragma FUNC_INTERRUPT_THRESHOLD(foo,1)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The function foo() is never interrupted.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#pragma FUNC_INTERRUPT_THRESHOLD(foo,-1)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{pagetop}}&lt;br /&gt;
== Additional Tags ==&lt;br /&gt;
spru187o.pdf, spru425a.pdf&lt;br /&gt;
&lt;br /&gt;
 [[category:Software]]&lt;/div&gt;</summary>
		<author><name>WikiImporter</name></author>
	</entry>
</feed>