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_SetIrqStackWarningOffset</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_SetIrqStackWarningOffset <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;nitro/os.h&gt;</CODE></PRE>
16  <PRE><CODE>void OS_SetIrqStackWarningOffset( u32 offset );
17  </CODE></PRE>
18</DL>
19<H2>Arguments</H2>
20<TABLE border="1" width="100%">
21  <TBODY>
22    <TR>
23      <TD width="13%"><EM><STRONG>offset</STRONG></EM></TD>
24      <TD width="87%">The warning level offset</TD>
25    </TR>
26  </TBODY>
27</TABLE>
28<H2>Return Values</H2>
29<P>None.</P>
30<H2>Description</H2>
31<P>Sets the warning level used to check the stack overflow of the stack used in IRQ mode.</P>
32<P>This check mechanism involves writing the magic numbers for the top and the bottom of the stack used for IRQ mode in advance and determining whether those magic numbers have been overwritten. In addition to the top and bottom, <code>OS_SetIrqStackWarningOffset()</code> can be used to set the warning level in between the top and bottom, and to write a magic number to be able to check whether the section has been overwritten. The magic numbers at the top and bottom of the stack are written when <CODE><A href="../init/OS_Init.html">OS_Init()</A></CODE> is called.</P>
33<P>The reason for setting a magic number in the middle of the stack is to detect whether a stack overflow may occur before the stack is completely used and operation becomes unstable.</P>
34<P><em><strong><code>offset</code></strong></em> is the number of bytes from the bottom position of the stack and needs to be a multiple of 4. Setting zero cancels this setting.</P>
35<P>A magic number is written in the middle of the stack, so operation might become unstable if the section is currently being used. Therefore, avoid setting this inside the interrupt handler. Normally, you should set this setting immediately after the program has started.</P>
36<BLOCKQUOTE style="background-color:#ffffc0">Example:<br /><CODE>OS_SetIrqStackWarningOffset( 0x100 );</CODE><BR> &#xFF1A;<BR><CODE>OS_CheckIrqStack( void );</CODE></BLOCKQUOTE>
37<H2>See Also</H2>
38<P><CODE><A href="OS_CheckIrqStack.html">OS_CheckIrqStack</A>, <A href="OS_GetIrqStackStatus.html">OS_GetIrqStackStatus</A><BR></CODE></P>
39<H2>Revision History</H2>
40<P>2005/07/15 Initial version.</P>
41<hr><p>CONFIDENTIAL</p></body>
42</HTML>