Reshaped doc's
[fw/sdcc] / doc / sdccman.html / node29.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2
3 <!--Converted with LaTeX2HTML 99.1 release (March 30, 1999)
4 original version by:  Nikos Drakos, CBLU, University of Leeds
5 * revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
6 * with significant contributions from:
7   Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8 <HTML>
9 <HEAD>
10 <TITLE>3.10 Functions using private banks</TITLE>
11 <META NAME="description" CONTENT="3.10 Functions using private banks">
12 <META NAME="keywords" CONTENT="sdccman">
13 <META NAME="resource-type" CONTENT="document">
14 <META NAME="distribution" CONTENT="global">
15
16 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
17 <META NAME="Generator" CONTENT="LaTeX2HTML v99.1 release">
18 <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
19
20 <LINK REL="STYLESHEET" HREF="sdccman.css">
21
22 <LINK REL="next" HREF="node30.html">
23 <LINK REL="previous" HREF="node28.html">
24 <LINK REL="up" HREF="node19.html">
25 <LINK REL="next" HREF="node30.html">
26 </HEAD>
27
28 <BODY >
29 <!--Navigation Panel-->
30 <A NAME="tex2html682"
31  HREF="node30.html">
32 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
33 <A NAME="tex2html676"
34  HREF="node19.html">
35 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
36 <A NAME="tex2html670"
37  HREF="node28.html">
38 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> 
39 <A NAME="tex2html678"
40  HREF="node1.html">
41 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A> 
42 <A NAME="tex2html680"
43  HREF="node61.html">
44 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A> 
45 <BR>
46 <B> Next:</B> <A NAME="tex2html683"
47  HREF="node30.html">3.11 Absolute Addressing</A>
48 <B> Up:</B> <A NAME="tex2html677"
49  HREF="node19.html">3. Using SDCC</A>
50 <B> Previous:</B> <A NAME="tex2html671"
51  HREF="node28.html">3.9 Naked Functions</A>
52  &nbsp <B>  <A NAME="tex2html679"
53  HREF="node1.html">Contents</A></B> 
54  &nbsp <B>  <A NAME="tex2html681"
55  HREF="node61.html">Index</A></B> 
56 <BR>
57 <BR>
58 <!--End of Navigation Panel-->
59
60 <H2><A NAME="SECTION000410000000000000000">
61 3.10 Functions using private banks</A>
62 </H2>
63
64 <P>
65 The <I>using</I> attribute (which tells the compiler to use a register
66 bank other than the default bank zero) should only be applied to <I>interrupt</I>
67 functions (see note 1 below). This will in most circumstances make
68 the generated ISR code more efficient since it will not have to save
69 registers on the stack.
70
71 <P>
72 The <I>using</I> attribute will have no effect on the generated code
73 for a <I>non-interrupt</I> function (but may occasionally be useful
74 anyway<A NAME="tex2html1"
75  HREF="footnode.html#foot531"><SUP>1</SUP></A>).
76 <BR>
77 <I>(pending: I don't think this has been done yet)</I>
78
79 <P>
80 An <I>interrupt</I> function using a non-zero bank will assume that
81 it can trash that register bank, and will not save it. Since high-priority
82 interrupts can interrupt low-priority ones on the 8051 and friends,
83 this means that if a high-priority ISR <I>using</I> a particular bank
84 occurs while processing a low-priority ISR <I>using</I> the same bank,
85 terrible and bad things can happen. To prevent this, no single register
86 bank should be <I>used</I> by both a high priority and a low priority
87 ISR. This is probably most easily done by having all high priority
88 ISRs use one bank and all low priority ISRs use another. If you have
89 an ISR which can change priority at runtime, you're on your own: I
90 suggest using the default bank zero and taking the small performance
91 hit.
92
93 <P>
94 It is most efficient if your ISR calls no other functions. If your
95 ISR must call other functions, it is most efficient if those functions
96 use the same bank as the ISR (see note 1 below); the next best is
97 if the called functions use bank zero. It is very inefficient to call
98 a function using a different, non-zero bank from an ISR. 
99
100 <P>
101 <HR>
102 <!--Navigation Panel-->
103 <A NAME="tex2html682"
104  HREF="node30.html">
105 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next_motif.gif"></A> 
106 <A NAME="tex2html676"
107  HREF="node19.html">
108 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up_motif.gif"></A> 
109 <A NAME="tex2html670"
110  HREF="node28.html">
111 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="previous_motif.gif"></A> 
112 <A NAME="tex2html678"
113  HREF="node1.html">
114 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents_motif.gif"></A> 
115 <A NAME="tex2html680"
116  HREF="node61.html">
117 <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index_motif.gif"></A> 
118 <BR>
119 <B> Next:</B> <A NAME="tex2html683"
120  HREF="node30.html">3.11 Absolute Addressing</A>
121 <B> Up:</B> <A NAME="tex2html677"
122  HREF="node19.html">3. Using SDCC</A>
123 <B> Previous:</B> <A NAME="tex2html671"
124  HREF="node28.html">3.9 Naked Functions</A>
125  &nbsp <B>  <A NAME="tex2html679"
126  HREF="node1.html">Contents</A></B> 
127  &nbsp <B>  <A NAME="tex2html681"
128  HREF="node61.html">Index</A></B> 
129 <!--End of Navigation Panel-->
130 <ADDRESS>
131 <I>Johan Knol</I>
132 <BR><I>2001-07-13</I>
133 </ADDRESS>
134 </BODY>
135 </HTML>