doc/doxygen/html/canOpenDriver_8c-source.html
changeset 240 34654679f262
parent 215 f49e5a6b7804
equal deleted inserted replaced
239:f45fd4cd3832 240:34654679f262
    16   <ul>
    16   <ul>
    17     <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    17     <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    18     <li><a href="globals.html"><span>Globals</span></a></li>
    18     <li><a href="globals.html"><span>Globals</span></a></li>
    19   </ul></div>
    19   </ul></div>
    20 <div class="nav">
    20 <div class="nav">
    21 <a class="el" href="dir_d58fb241e647de6212c31ecccf9cbace.html">drivers</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_db1ed8bc1b9755aa465fb1d5c578dab2.html">hcs12</a></div>
    21 <a class="el" href="dir_65dd258ff9b9ef4cd7bd0d22f5e58dba.html">drivers</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_2d4bff0e9225ea81eb175e376cee668f.html">hcs12</a></div>
    22 <h1>canOpenDriver.c</h1><a href="canOpenDriver_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
    22 <h1>canOpenDriver.c</h1><a href="canOpenDriver_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
    23 <a name="l00002"></a>00002 <span class="comment">This file is part of CanFestival, a library implementing CanOpen Stack. </span>
    23 <a name="l00002"></a>00002 <span class="comment">This file is part of CanFestival, a library implementing CanOpen Stack. </span>
    24 <a name="l00003"></a>00003 <span class="comment"></span>
    24 <a name="l00003"></a>00003 <span class="comment"></span>
    25 <a name="l00004"></a>00004 <span class="comment">Copyright (C): Edouard TISSERANT and Francis DUPIN</span>
    25 <a name="l00004"></a>00004 <span class="comment">Copyright (C): Edouard TISSERANT and Francis DUPIN</span>
    26 <a name="l00005"></a>00005 <span class="comment"></span>
    26 <a name="l00005"></a>00005 <span class="comment"></span>
    39 <a name="l00018"></a>00018 <span class="comment">You should have received a copy of the GNU Lesser General Public</span>
    39 <a name="l00018"></a>00018 <span class="comment">You should have received a copy of the GNU Lesser General Public</span>
    40 <a name="l00019"></a>00019 <span class="comment">License along with this library; if not, write to the Free Software</span>
    40 <a name="l00019"></a>00019 <span class="comment">License along with this library; if not, write to the Free Software</span>
    41 <a name="l00020"></a>00020 <span class="comment">Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
    41 <a name="l00020"></a>00020 <span class="comment">Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
    42 <a name="l00021"></a>00021 <span class="comment">*/</span>
    42 <a name="l00021"></a>00021 <span class="comment">*/</span>
    43 <a name="l00022"></a>00022 
    43 <a name="l00022"></a>00022 
    44 <a name="l00023"></a><a class="code" href="canOpenDriver_8c.html#4f52c00ab0d519e2965ebaa533975904">00023</a> <span class="preprocessor">#define DEBUG_WAR_CONSOLE_ON</span>
    44 <a name="l00023"></a><a class="code" href="canOpenDriver_8c.html#46f4d451cd14848ea37fa13729a473ef">00023</a> <span class="preprocessor">#define DEBUG_WAR_CONSOLE_ON</span>
    45 <a name="l00024"></a><a class="code" href="canOpenDriver_8c.html#bb416887a32f7e4333e095356774f07f">00024</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_ERR_CONSOLE_ON</span>
    45 <a name="l00024"></a><a class="code" href="canOpenDriver_8c.html#4352bb532729a0ef6576e3b8a8409bbc">00024</a> <span class="preprocessor"></span><span class="preprocessor">#define DEBUG_ERR_CONSOLE_ON</span>
    46 <a name="l00025"></a>00025 <span class="preprocessor"></span>
    46 <a name="l00025"></a>00025 <span class="preprocessor"></span>
    47 <a name="l00026"></a>00026 <span class="preprocessor">#include &lt;stddef.h&gt;</span> <span class="comment">/* for NULL */</span>
    47 <a name="l00026"></a>00026 <span class="preprocessor">#include &lt;stddef.h&gt;</span> <span class="comment">/* for NULL */</span>
    48 <a name="l00027"></a>00027 
    48 <a name="l00027"></a>00027 
    49 <a name="l00028"></a>00028 <span class="preprocessor">#include "../include/hcs12/asm-m68hc12/portsaccess.h"</span>
    49 <a name="l00028"></a>00028 <span class="preprocessor">#include "../include/hcs12/asm-m68hc12/portsaccess.h"</span>
    50 <a name="l00029"></a>00029 <span class="preprocessor">#include "../include/hcs12/asm-m68hc12/ports_def.h"</span>
    50 <a name="l00029"></a>00029 <span class="preprocessor">#include "../include/hcs12/asm-m68hc12/ports_def.h"</span>
    61 <a name="l00040"></a>00040 
    61 <a name="l00040"></a>00040 
    62 <a name="l00041"></a>00041 
    62 <a name="l00041"></a>00041 
    63 <a name="l00042"></a>00042 
    63 <a name="l00042"></a>00042 
    64 <a name="l00043"></a>00043 
    64 <a name="l00043"></a>00043 
    65 <a name="l00044"></a>00044 
    65 <a name="l00044"></a>00044 
    66 <a name="l00045"></a>00045 <span class="keyword">volatile</span> <span class="keyword">static</span> <a class="code" href="structMessage.html">Message</a> stackMsgRcv[<a class="code" href="candriver_8h.html#08b16baaf10a1b7fb8a3569a6c0f67ff">NB_LINE_CAN</a>][<a class="code" href="candriver_8h.html#604df069233e19d5960b444524a43042">MAX_STACK_MSG_RCV</a>]; 
    66 <a name="l00045"></a>00045 <span class="keyword">volatile</span> <span class="keyword">static</span> <a class="code" href="structMessage.html">Message</a> stackMsgRcv[<a class="code" href="candriver_8h.html#e815437e20b35852b381f41b5b3feca3">NB_LINE_CAN</a>][<a class="code" href="candriver_8h.html#12ae319363148d264184861475351e3c">MAX_STACK_MSG_RCV</a>]; 
    67 <a name="l00046"></a>00046 <span class="keyword">volatile</span> <span class="keyword">static</span> <a class="code" href="structt__pointerStack.html">t_pointerStack</a> ptrMsgRcv[<a class="code" href="candriver_8h.html#08b16baaf10a1b7fb8a3569a6c0f67ff">NB_LINE_CAN</a>];
    67 <a name="l00046"></a>00046 <span class="keyword">volatile</span> <span class="keyword">static</span> <a class="code" href="structt__pointerStack.html">t_pointerStack</a> ptrMsgRcv[<a class="code" href="candriver_8h.html#e815437e20b35852b381f41b5b3feca3">NB_LINE_CAN</a>];
    68 <a name="l00047"></a>00047  
    68 <a name="l00047"></a>00047  
    69 <a name="l00048"></a>00048 <span class="keyword">volatile</span> <span class="keyword">static</span> <a class="code" href="hcs12_2applicfg_8h.html#6ae11f09e1ebf40f3562857272fab8bf">TIMEVAL</a> last_time_set = <a class="code" href="hcs12_2applicfg_8h.html#35b2fd1a5f6b88bf3842ba3663e6f85e">TIMEVAL_MAX</a>;
    69 <a name="l00048"></a>00048 <span class="keyword">volatile</span> <span class="keyword">static</span> <a class="code" href="hcs12_2applicfg_8h.html#dea5fb459bddd6fd539cdf665dd657e6">TIMEVAL</a> last_time_set = <a class="code" href="hcs12_2applicfg_8h.html#9b8b68779cc690a9f699155420328d0f">TIMEVAL_MAX</a>;
    70 <a name="l00049"></a>00049 <span class="keyword">static</span> <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> timer_is_set = 0;
    70 <a name="l00049"></a>00049 <span class="keyword">static</span> <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> timer_is_set = 0;
    71 <a name="l00050"></a>00050 
    71 <a name="l00050"></a>00050 
    72 <a name="l00051"></a>00051 <span class="comment">/* Prototypes */</span>
    72 <a name="l00051"></a>00051 <span class="comment">/* Prototypes */</span>
    73 <a name="l00052"></a>00052 <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> <a class="code" href="canOpenDriver_8c.html#0bf58f014d47581c9ffd1b2db9a858d7">f_can_receive</a>(<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *m);
    73 <a name="l00052"></a>00052 <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> <a class="code" href="canOpenDriver_8c.html#e9619ed76d03ed5c17ec07267bb61f4a">f_can_receive</a>(<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *m);
    74 <a name="l00053"></a>00053 <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> <a class="code" href="canOpenDriver_8c.html#b57b4b3c000e9f61135175495e874977">canSend</a>(<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *m);
    74 <a name="l00053"></a>00053 <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> <a class="code" href="canOpenDriver_8c.html#fab789b9b2ee0ab6c6f27e67d6c03661">canSend</a>(<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *m);
    75 <a name="l00054"></a><a class="code" href="interrupt_8h.html#efecbc6bd7cf74b7c63f446283749344">00054</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) timer4Hdl (<span class="keywordtype">void</span>);
    75 <a name="l00054"></a><a class="code" href="interrupt_8h.html#65ceb3acb7311d7c20d54038d2ef2226">00054</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) timer4Hdl (<span class="keywordtype">void</span>);
    76 <a name="l00055"></a>00055 
    76 <a name="l00055"></a>00055 
    77 <a name="l00056"></a>00056 <span class="preprocessor">#define max(a,b) a&gt;b?a:b</span>
    77 <a name="l00056"></a>00056 <span class="preprocessor">#define max(a,b) a&gt;b?a:b</span>
    78 <a name="l00057"></a>00057 <span class="preprocessor"></span>
    78 <a name="l00057"></a>00057 <span class="preprocessor"></span>
    79 <a name="l00058"></a>00058 <span class="comment">/******************************************************************************/</span>
    79 <a name="l00058"></a>00058 <span class="comment">/******************************************************************************/</span>
    80 <a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="timers__unix_8c.html#b8d05dee70f04b5c5190ab00e84da106">setTimer</a>(<a class="code" href="hcs12_2applicfg_8h.html#6ae11f09e1ebf40f3562857272fab8bf">TIMEVAL</a> value)
    80 <a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="timers__unix_8c.html#7996006c628d2df030b9684d7a86acd1">setTimer</a>(<a class="code" href="hcs12_2applicfg_8h.html#dea5fb459bddd6fd539cdf665dd657e6">TIMEVAL</a> value)
    81 <a name="l00060"></a>00060 {
    81 <a name="l00060"></a>00060 {
    82 <a name="l00061"></a>00061   <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#0574d848e9f01b848bef1ac914c73d9b">TC4H</a>) += value;
    82 <a name="l00061"></a>00061   <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#9860b324bb905089251d8dcc3d8f2549">TC4H</a>) += value;
    83 <a name="l00062"></a>00062   timer_is_set = 1; 
    83 <a name="l00062"></a>00062   timer_is_set = 1; 
    84 <a name="l00063"></a>00063 }
    84 <a name="l00063"></a>00063 }
    85 <a name="l00064"></a>00064 
    85 <a name="l00064"></a>00064 
    86 <a name="l00065"></a>00065 <span class="comment">/******************************************************************************/</span>
    86 <a name="l00065"></a>00065 <span class="comment">/******************************************************************************/</span>
    87 <a name="l00066"></a><a class="code" href="timer_8h.html#4dccc204d52176bd547ab34d6858f5ba">00066</a> <a class="code" href="hcs12_2applicfg_8h.html#6ae11f09e1ebf40f3562857272fab8bf">TIMEVAL</a> <a class="code" href="canOpenDriver_8c.html#24dbe63e88d184388542037d16a8208d">getElapsedTime</a>()
    87 <a name="l00066"></a><a class="code" href="timer_8h.html#75efe30105165658d05d871255f8c0a2">00066</a> <a class="code" href="hcs12_2applicfg_8h.html#dea5fb459bddd6fd539cdf665dd657e6">TIMEVAL</a> <a class="code" href="canOpenDriver_8c.html#38b23a8ee3748bca3415967b90df1e15">getElapsedTime</a>()
    88 <a name="l00067"></a>00067 {
    88 <a name="l00067"></a>00067 {
    89 <a name="l00068"></a>00068   <span class="keywordflow">return</span> (<a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#0574d848e9f01b848bef1ac914c73d9b">TC4H</a>) &gt; last_time_set ? <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#0574d848e9f01b848bef1ac914c73d9b">TC4H</a>) - last_time_set : last_time_set - <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(TC4H));
    89 <a name="l00068"></a>00068   <span class="keywordflow">return</span> (<a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#9860b324bb905089251d8dcc3d8f2549">TC4H</a>) &gt; last_time_set ? <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#9860b324bb905089251d8dcc3d8f2549">TC4H</a>) - last_time_set : last_time_set - <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(TC4H));
    90 <a name="l00069"></a>00069 }
    90 <a name="l00069"></a>00069 }
    91 <a name="l00070"></a>00070 
    91 <a name="l00070"></a>00070 
    92 <a name="l00071"></a>00071 
    92 <a name="l00071"></a>00071 
    93 <a name="l00072"></a>00072 <span class="comment">/******************************************************************************/</span>
    93 <a name="l00072"></a>00072 <span class="comment">/******************************************************************************/</span>
    94 <a name="l00073"></a><a class="code" href="canOpenDriver_8h.html#339b24f4eee897d3c45d88de9a4901e8">00073</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#339b24f4eee897d3c45d88de9a4901e8">resetTimer</a>(<span class="keywordtype">void</span>)
    94 <a name="l00073"></a><a class="code" href="canOpenDriver_8h.html#bf5784dcd21f08822e6c0f39d363e77c">00073</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#bf5784dcd21f08822e6c0f39d363e77c">resetTimer</a>(<span class="keywordtype">void</span>)
    95 <a name="l00074"></a>00074 {
    95 <a name="l00074"></a>00074 {
    96 <a name="l00075"></a>00075 
    96 <a name="l00075"></a>00075 
    97 <a name="l00076"></a>00076 }
    97 <a name="l00076"></a>00076 }
    98 <a name="l00077"></a>00077 
    98 <a name="l00077"></a>00077 
    99 <a name="l00078"></a>00078 <span class="comment">/******************************************************************************/</span>
    99 <a name="l00078"></a>00078 <span class="comment">/******************************************************************************/</span>
   100 <a name="l00079"></a><a class="code" href="canOpenDriver_8h.html#02922529b60419a94afe8f369dda070b">00079</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#02922529b60419a94afe8f369dda070b">initTimer</a>(<span class="keywordtype">void</span>)
   100 <a name="l00079"></a><a class="code" href="canOpenDriver_8h.html#607bd2711b85a87fce51334bb36bad1a">00079</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#607bd2711b85a87fce51334bb36bad1a">initTimer</a>(<span class="keywordtype">void</span>)
   101 <a name="l00080"></a>00080 {
   101 <a name="l00080"></a>00080 {
   102 <a name="l00081"></a>00081   <a class="code" href="interrupt_8c.html#eb99ff49b4a6d5157416f9b5bd0d9c2c">lock</a>();   <span class="comment">// Inhibition of interruptions</span>
   102 <a name="l00081"></a>00081   <a class="code" href="interrupt_8c.html#a86d31d31831be20de69b1533b4acc5b">lock</a>();   <span class="comment">// Inhibition of interruptions</span>
   103 <a name="l00082"></a>00082  
   103 <a name="l00082"></a>00082  
   104 <a name="l00083"></a>00083   <span class="comment">// Configure the timer channel 4</span>
   104 <a name="l00083"></a>00083   <span class="comment">// Configure the timer channel 4</span>
   105 <a name="l00084"></a>00084   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#28fcfc6a7695ab5b61f4d7a2befcc184">TIOS</a>) |= 0x10; <span class="comment">// Canal 4 in output</span>
   105 <a name="l00084"></a>00084   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#10dcf7ac56e4b31bedd1cc5d1eec4b21">TIOS</a>) |= 0x10; <span class="comment">// Canal 4 in output</span>
   106 <a name="l00085"></a>00085   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#0a69f683a8ad4e238e8f259c58dffc12">TCTL1</a>) &amp;= ~(0x01 + 0x02); <span class="comment">// Canal 4 unconnected to pin output</span>
   106 <a name="l00085"></a>00085   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#5aefe8417e558849ca0bd872719595ea">TCTL1</a>) &amp;= ~(0x01 + 0x02); <span class="comment">// Canal 4 unconnected to pin output</span>
   107 <a name="l00086"></a>00086   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#047b752526fa845a214fbd2dda59bdaa">TIE</a>) |= 0x10; <span class="comment">// allow interruption channel 4</span>
   107 <a name="l00086"></a>00086   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#d08c02a4207f45c760524ed2868d273c">TIE</a>) |= 0x10; <span class="comment">// allow interruption channel 4</span>
   108 <a name="l00087"></a>00087   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#22fb74e7419c4c4b208c3de49dd10499">TSCR2</a>) |= 0X05; <span class="comment">// Pre-scaler = 32 </span>
   108 <a name="l00087"></a>00087   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#f085a1593205cd8aad540234c4349ed3">TSCR2</a>) |= 0X05; <span class="comment">// Pre-scaler = 32 </span>
   109 <a name="l00088"></a>00088                              <span class="comment">// If this value is changed, change must be done also</span>
   109 <a name="l00088"></a>00088                              <span class="comment">// If this value is changed, change must be done also</span>
   110 <a name="l00089"></a>00089                              <span class="comment">// in void __attribute__((interrupt)) timer4Hdl (void)</span>
   110 <a name="l00089"></a>00089                              <span class="comment">// in void __attribute__((interrupt)) timer4Hdl (void)</span>
   111 <a name="l00090"></a>00090 
   111 <a name="l00090"></a>00090 
   112 <a name="l00091"></a>00091   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#f2b3ab08ef5f8919912316e8906c1cf6">TSCR1</a>) |= 0x80; <span class="comment">// Start timer</span>
   112 <a name="l00091"></a>00091   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#12badb6c654787da20118f8926ea18a1">TSCR1</a>) |= 0x80; <span class="comment">// Start timer</span>
   113 <a name="l00092"></a>00092   <a class="code" href="interrupt_8c.html#987ce601d6d4c8eedd68b58db3b7811a">unlock</a>(); <span class="comment">// Allow interruptions</span>
   113 <a name="l00092"></a>00092   <a class="code" href="interrupt_8c.html#8704c06a2936e68f7c25dc0c1d335cca">unlock</a>(); <span class="comment">// Allow interruptions</span>
   114 <a name="l00093"></a>00093 }
   114 <a name="l00093"></a>00093 }
   115 <a name="l00094"></a>00094 
   115 <a name="l00094"></a>00094 
   116 <a name="l00095"></a>00095 <span class="comment">/******************************************************************************/</span>
   116 <a name="l00095"></a>00095 <span class="comment">/******************************************************************************/</span>
   117 <a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) timer4Hdl (<span class="keywordtype">void</span>)
   117 <a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) timer4Hdl (<span class="keywordtype">void</span>)
   118 <a name="l00097"></a>00097 {
   118 <a name="l00097"></a>00097 {
   119 <a name="l00098"></a>00098   <a class="code" href="interrupt_8c.html#eb99ff49b4a6d5157416f9b5bd0d9c2c">lock</a>();
   119 <a name="l00098"></a>00098   <a class="code" href="interrupt_8c.html#a86d31d31831be20de69b1533b4acc5b">lock</a>();
   120 <a name="l00099"></a>00099   last_time_set = <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#0574d848e9f01b848bef1ac914c73d9b">TC4H</a>);
   120 <a name="l00099"></a>00099   last_time_set = <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#9860b324bb905089251d8dcc3d8f2549">TC4H</a>);
   121 <a name="l00100"></a>00100   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#2403d0779edcb7a67ea56dd0d67a415e">TFLG1</a>) = 0x10; <span class="comment">// RAZ flag interruption timer channel 4</span>
   121 <a name="l00100"></a>00100   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#e52a2610689d54547a1a4dff635add96">TFLG1</a>) = 0x10; <span class="comment">// RAZ flag interruption timer channel 4</span>
   122 <a name="l00101"></a>00101   <span class="comment">// Compute the next event : When the timer reach the value of TC4, an interrupt is</span>
   122 <a name="l00101"></a>00101   <span class="comment">// Compute the next event : When the timer reach the value of TC4, an interrupt is</span>
   123 <a name="l00102"></a>00102   <span class="comment">// started </span>
   123 <a name="l00102"></a>00102   <span class="comment">// started </span>
   124 <a name="l00103"></a>00103   <span class="comment">//IO_PORTS_16(TC4H) += 250; // To have an interruption every 1 ms</span>
   124 <a name="l00103"></a>00103   <span class="comment">//IO_PORTS_16(TC4H) += 250; // To have an interruption every 1 ms</span>
   125 <a name="l00104"></a>00104   <span class="comment">//timerInterrupt(0);</span>
   125 <a name="l00104"></a>00104   <span class="comment">//timerInterrupt(0);</span>
   126 <a name="l00105"></a>00105   <span class="comment">//MSG_WAR(0xFFFF, "timer4 IT", 0);</span>
   126 <a name="l00105"></a>00105   <span class="comment">//MSG_WAR(0xFFFF, "timer4 IT", 0);</span>
   127 <a name="l00106"></a>00106   {
   127 <a name="l00106"></a>00106   {
   128 <a name="l00107"></a>00107     <span class="comment">//MSG_WAR(0xFFFF, "t4 ", IO_PORTS_16(TCNTH) - IO_PORTS_16(TC4H));</span>
   128 <a name="l00107"></a>00107     <span class="comment">//MSG_WAR(0xFFFF, "t4 ", IO_PORTS_16(TCNTH) - IO_PORTS_16(TC4H));</span>
   129 <a name="l00108"></a>00108   }
   129 <a name="l00108"></a>00108   }
   130 <a name="l00109"></a>00109   <a class="code" href="timer_8c.html#fa75192a3238525618f8cb83004930cc">TimeDispatch</a>();
   130 <a name="l00109"></a>00109   <a class="code" href="timer_8c.html#7a5a515821c2e4fb2f66bac72389da00">TimeDispatch</a>();
   131 <a name="l00110"></a>00110   <a class="code" href="interrupt_8c.html#987ce601d6d4c8eedd68b58db3b7811a">unlock</a>();
   131 <a name="l00110"></a>00110   <a class="code" href="interrupt_8c.html#8704c06a2936e68f7c25dc0c1d335cca">unlock</a>();
   132 <a name="l00111"></a>00111 }
   132 <a name="l00111"></a>00111 }
   133 <a name="l00112"></a>00112 
   133 <a name="l00112"></a>00112 
   134 <a name="l00113"></a>00113 
   134 <a name="l00113"></a>00113 
   135 <a name="l00114"></a>00114 <span class="comment">/******************************************************************************/</span>
   135 <a name="l00114"></a>00114 <span class="comment">/******************************************************************************/</span>
   136 <a name="l00115"></a><a class="code" href="hcs12_2applicfg_8h.html#f86db4b817c1a59a819cbdd51779bfaa">00115</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#f86db4b817c1a59a819cbdd51779bfaa">initSCI_0</a>(<span class="keywordtype">void</span>)
   136 <a name="l00115"></a><a class="code" href="hcs12_2applicfg_8h.html#7baae9f015325b2f367c53dacb4b4f96">00115</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#7baae9f015325b2f367c53dacb4b4f96">initSCI_0</a>(<span class="keywordtype">void</span>)
   137 <a name="l00116"></a>00116 {
   137 <a name="l00116"></a>00116 {
   138 <a name="l00117"></a>00117   <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#ce4d0e3ad518ef6a5657d7c63c907fca">SCI0</a> + <a class="code" href="ports__def_8h.html#652f96d37614999df43e03ff58626188">SCIBDH</a>) = 
   138 <a name="l00117"></a>00117   <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#267a2608a7a02aab01b73a5c28a98a28">SCI0</a> + <a class="code" href="ports__def_8h.html#3d254a2eaa98dce94e4be4fae021e51d">SCIBDH</a>) = 
   139 <a name="l00118"></a>00118     ((1000000 / <a class="code" href="hcs12_2applicfg_8h.html#759dabd0f6ef66964bb0b0bf8c426398">SERIAL_SCI0_BAUD_RATE</a>) * <a class="code" href="hcs12_2applicfg_8h.html#1caba0e524eb249e9f6bf160b74aa14e">BUS_CLOCK</a>) &gt;&gt; 4 ;  
   139 <a name="l00118"></a>00118     ((1000000 / <a class="code" href="hcs12_2applicfg_8h.html#80430587549835e289ba2ca68874ea1d">SERIAL_SCI0_BAUD_RATE</a>) * <a class="code" href="hcs12_2applicfg_8h.html#c57c66da4348fe0a7bb06bbe32a0ab42">BUS_CLOCK</a>) &gt;&gt; 4 ;  
   140 <a name="l00119"></a>00119   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#ce4d0e3ad518ef6a5657d7c63c907fca">SCI0</a>  + <a class="code" href="ports__def_8h.html#8ff8f788cb324d81ebd4d429cabf5e23">SCICR1</a>) = 0;    <span class="comment">// format 8N1</span>
   140 <a name="l00119"></a>00119   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#267a2608a7a02aab01b73a5c28a98a28">SCI0</a>  + <a class="code" href="ports__def_8h.html#3c40fdd2d2a0ddb828a2ea65bb6b7267">SCICR1</a>) = 0;    <span class="comment">// format 8N1</span>
   141 <a name="l00120"></a>00120   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#ce4d0e3ad518ef6a5657d7c63c907fca">SCI0</a>  + <a class="code" href="ports__def_8h.html#3e70365f6555966aa967d0bc56c71380">SCICR2</a>) = 0x08; <span class="comment">// Transmit enable only</span>
   141 <a name="l00120"></a>00120   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#267a2608a7a02aab01b73a5c28a98a28">SCI0</a>  + <a class="code" href="ports__def_8h.html#e89dad44646d6b62e5c2a11d24fe59d5">SCICR2</a>) = 0x08; <span class="comment">// Transmit enable only</span>
   142 <a name="l00121"></a>00121 }
   142 <a name="l00121"></a>00121 }
   143 <a name="l00122"></a>00122 
   143 <a name="l00122"></a>00122 
   144 <a name="l00123"></a>00123 <span class="comment">/******************************************************************************/</span>
   144 <a name="l00123"></a>00123 <span class="comment">/******************************************************************************/</span>
   145 <a name="l00124"></a><a class="code" href="hcs12_2applicfg_8h.html#b56fa1754706a57059103710178bdb68">00124</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#b56fa1754706a57059103710178bdb68">initSCI_1</a>(<span class="keywordtype">void</span>)
   145 <a name="l00124"></a><a class="code" href="hcs12_2applicfg_8h.html#ceb141ec8f50c63115477e5bc2d009d3">00124</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#ceb141ec8f50c63115477e5bc2d009d3">initSCI_1</a>(<span class="keywordtype">void</span>)
   146 <a name="l00125"></a>00125 {
   146 <a name="l00125"></a>00125 {
   147 <a name="l00126"></a>00126   <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#a97eca5571fe1a418a94018204d2f346">SCI1</a> + <a class="code" href="ports__def_8h.html#652f96d37614999df43e03ff58626188">SCIBDH</a>) = 
   147 <a name="l00126"></a>00126   <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#2b66652d91401d80103a23395c0342d2">SCI1</a> + <a class="code" href="ports__def_8h.html#3d254a2eaa98dce94e4be4fae021e51d">SCIBDH</a>) = 
   148 <a name="l00127"></a>00127     ((1000000 / <a class="code" href="hcs12_2applicfg_8h.html#2831f0cbcc1686e98815825dba49c7f5">SERIAL_SCI1_BAUD_RATE</a>) * <a class="code" href="hcs12_2applicfg_8h.html#1caba0e524eb249e9f6bf160b74aa14e">BUS_CLOCK</a>) &gt;&gt; 4 ;  
   148 <a name="l00127"></a>00127     ((1000000 / <a class="code" href="hcs12_2applicfg_8h.html#4f40623ef7b0e329b8cb6346cf5bffd5">SERIAL_SCI1_BAUD_RATE</a>) * <a class="code" href="hcs12_2applicfg_8h.html#c57c66da4348fe0a7bb06bbe32a0ab42">BUS_CLOCK</a>) &gt;&gt; 4 ;  
   149 <a name="l00128"></a>00128   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#a97eca5571fe1a418a94018204d2f346">SCI1</a>  + <a class="code" href="ports__def_8h.html#8ff8f788cb324d81ebd4d429cabf5e23">SCICR1</a>) = 0;    <span class="comment">// format 8N1</span>
   149 <a name="l00128"></a>00128   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#2b66652d91401d80103a23395c0342d2">SCI1</a>  + <a class="code" href="ports__def_8h.html#3c40fdd2d2a0ddb828a2ea65bb6b7267">SCICR1</a>) = 0;    <span class="comment">// format 8N1</span>
   150 <a name="l00129"></a>00129   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#a97eca5571fe1a418a94018204d2f346">SCI1</a>  + <a class="code" href="ports__def_8h.html#3e70365f6555966aa967d0bc56c71380">SCICR2</a>) = 0x08; <span class="comment">// Transmit enable only</span>
   150 <a name="l00129"></a>00129   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#2b66652d91401d80103a23395c0342d2">SCI1</a>  + <a class="code" href="ports__def_8h.html#e89dad44646d6b62e5c2a11d24fe59d5">SCICR2</a>) = 0x08; <span class="comment">// Transmit enable only</span>
   151 <a name="l00130"></a>00130 }
   151 <a name="l00130"></a>00130 }
   152 <a name="l00131"></a>00131 
   152 <a name="l00131"></a>00131 
   153 <a name="l00132"></a>00132 
   153 <a name="l00132"></a>00132 
   154 <a name="l00133"></a>00133 <span class="comment">/******************************************************************************/</span>
   154 <a name="l00133"></a>00133 <span class="comment">/******************************************************************************/</span>
   155 <a name="l00134"></a>00134 <span class="keywordtype">char</span> *
   155 <a name="l00134"></a>00134 <span class="keywordtype">char</span> *
   156 <a name="l00135"></a><a class="code" href="hcs12_2applicfg_8h.html#2a9aef0efc98c5b41ef97ef91ad403e5">00135</a> <a class="code" href="canOpenDriver_8c.html#2a9aef0efc98c5b41ef97ef91ad403e5">hex_convert</a> (<span class="keywordtype">char</span> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> value, <span class="keywordtype">char</span> lastCar)
   156 <a name="l00135"></a><a class="code" href="hcs12_2applicfg_8h.html#a6dee6d8af8f3db1ce33d48ec4f2d8d0">00135</a> <a class="code" href="canOpenDriver_8c.html#a6dee6d8af8f3db1ce33d48ec4f2d8d0">hex_convert</a> (<span class="keywordtype">char</span> *buf, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> value, <span class="keywordtype">char</span> lastCar)
   157 <a name="l00136"></a>00136 {
   157 <a name="l00136"></a>00136 {
   158 <a name="l00137"></a>00137   <span class="comment">//Thanks to Stéphane Carrez for this function</span>
   158 <a name="l00137"></a>00137   <span class="comment">//Thanks to Stéphane Carrez for this function</span>
   159 <a name="l00138"></a>00138   <span class="keywordtype">char</span> num[32];
   159 <a name="l00138"></a>00138   <span class="keywordtype">char</span> num[32];
   160 <a name="l00139"></a>00139   <span class="keywordtype">int</span> pos;
   160 <a name="l00139"></a>00139   <span class="keywordtype">int</span> pos;
   161 <a name="l00140"></a>00140 
   161 <a name="l00140"></a>00140 
   178 <a name="l00157"></a>00157   *buf = 0;
   178 <a name="l00157"></a>00157   *buf = 0;
   179 <a name="l00158"></a>00158   <span class="keywordflow">return</span> buf;
   179 <a name="l00158"></a>00158   <span class="keywordflow">return</span> buf;
   180 <a name="l00159"></a>00159 }
   180 <a name="l00159"></a>00159 }
   181 <a name="l00160"></a>00160 
   181 <a name="l00160"></a>00160 
   182 <a name="l00161"></a>00161 <span class="comment">/******************************************************************************/</span>
   182 <a name="l00161"></a>00161 <span class="comment">/******************************************************************************/</span>
   183 <a name="l00162"></a><a class="code" href="hcs12_2applicfg_8h.html#6e3075ae435e83aefc018e5218c197d0">00162</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#6e3075ae435e83aefc018e5218c197d0">printSCI_str</a>(<span class="keywordtype">char</span> sci, <span class="keyword">const</span> <span class="keywordtype">char</span> * str) 
   183 <a name="l00162"></a><a class="code" href="hcs12_2applicfg_8h.html#c25a324480b0d958f256e3844f839ce8">00162</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#c25a324480b0d958f256e3844f839ce8">printSCI_str</a>(<span class="keywordtype">char</span> sci, <span class="keyword">const</span> <span class="keywordtype">char</span> * str) 
   184 <a name="l00163"></a>00163 {
   184 <a name="l00163"></a>00163 {
   185 <a name="l00164"></a>00164   <span class="keywordtype">char</span> i = 0;
   185 <a name="l00164"></a>00164   <span class="keywordtype">char</span> i = 0;
   186 <a name="l00165"></a>00165   
   186 <a name="l00165"></a>00165   
   187 <a name="l00166"></a>00166   <span class="keywordflow">while</span> ((*(str + i) != 0) &amp;&amp; (i &lt; 0xFF)) {
   187 <a name="l00166"></a>00166   <span class="keywordflow">while</span> ((*(str + i) != 0) &amp;&amp; (i &lt; 0xFF)) {
   188 <a name="l00167"></a>00167     <span class="keywordflow">if</span> (*(str + i) == <span class="charliteral">'\n'</span>)
   188 <a name="l00167"></a>00167     <span class="keywordflow">if</span> (*(str + i) == <span class="charliteral">'\n'</span>)
   189 <a name="l00168"></a>00168       {
   189 <a name="l00168"></a>00168       {
   190 <a name="l00169"></a>00169         <span class="keywordflow">while</span> ((<a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#157429033d11aa5ff7e3fc6e581efdb4">SCISR1</a>) &amp; 0X80) == 0); <span class="comment">// wait if buffer not empty     </span>
   190 <a name="l00169"></a>00169         <span class="keywordflow">while</span> ((<a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#a167664f6e660189c51e8a3a0e9911b8">SCISR1</a>) &amp; 0X80) == 0); <span class="comment">// wait if buffer not empty     </span>
   191 <a name="l00170"></a>00170         <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#ca0217e74eef8399b0d4429e236bfdc4">SCIDRL</a>) = 13; <span class="comment">// return to start of line</span>
   191 <a name="l00170"></a>00170         <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#d009df9b899e4dbf8b4ccf4047f8c640">SCIDRL</a>) = 13; <span class="comment">// return to start of line</span>
   192 <a name="l00171"></a>00171       }
   192 <a name="l00171"></a>00171       }
   193 <a name="l00172"></a>00172     <span class="keywordflow">while</span> ((<a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#157429033d11aa5ff7e3fc6e581efdb4">SCISR1</a>) &amp; 0X80) == 0); <span class="comment">// wait if buffer not empty</span>
   193 <a name="l00172"></a>00172     <span class="keywordflow">while</span> ((<a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#a167664f6e660189c51e8a3a0e9911b8">SCISR1</a>) &amp; 0X80) == 0); <span class="comment">// wait if buffer not empty</span>
   194 <a name="l00173"></a>00173     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#ca0217e74eef8399b0d4429e236bfdc4">SCIDRL</a>) = *(str + i++);
   194 <a name="l00173"></a>00173     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(sci + <a class="code" href="ports__def_8h.html#d009df9b899e4dbf8b4ccf4047f8c640">SCIDRL</a>) = *(str + i++);
   195 <a name="l00174"></a>00174   }
   195 <a name="l00174"></a>00174   }
   196 <a name="l00175"></a>00175 
   196 <a name="l00175"></a>00175 
   197 <a name="l00176"></a>00176 }
   197 <a name="l00176"></a>00176 }
   198 <a name="l00177"></a>00177 
   198 <a name="l00177"></a>00177 
   199 <a name="l00178"></a>00178 <span class="comment">/******************************************************************************/</span>
   199 <a name="l00178"></a>00178 <span class="comment">/******************************************************************************/</span>
   200 <a name="l00179"></a><a class="code" href="hcs12_2applicfg_8h.html#80f5dbbc046cba0e5e9cf2bcc4c1e78e">00179</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#80f5dbbc046cba0e5e9cf2bcc4c1e78e">printSCI_nbr</a>(<span class="keywordtype">char</span> sci, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbr, <span class="keywordtype">char</span> lastCar) 
   200 <a name="l00179"></a><a class="code" href="hcs12_2applicfg_8h.html#0f465bf86b85e2517730092ad24286b1">00179</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#0f465bf86b85e2517730092ad24286b1">printSCI_nbr</a>(<span class="keywordtype">char</span> sci, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbr, <span class="keywordtype">char</span> lastCar) 
   201 <a name="l00180"></a>00180 {
   201 <a name="l00180"></a>00180 {
   202 <a name="l00181"></a>00181   <span class="keywordtype">char</span> strNbr[12];
   202 <a name="l00181"></a>00181   <span class="keywordtype">char</span> strNbr[12];
   203 <a name="l00182"></a>00182   <a class="code" href="canOpenDriver_8c.html#2a9aef0efc98c5b41ef97ef91ad403e5">hex_convert</a>(strNbr, nbr, lastCar);
   203 <a name="l00182"></a>00182   <a class="code" href="canOpenDriver_8c.html#a6dee6d8af8f3db1ce33d48ec4f2d8d0">hex_convert</a>(strNbr, nbr, lastCar);
   204 <a name="l00183"></a>00183   <a class="code" href="canOpenDriver_8c.html#6e3075ae435e83aefc018e5218c197d0">printSCI_str</a>(sci, strNbr);
   204 <a name="l00183"></a>00183   <a class="code" href="canOpenDriver_8c.html#c25a324480b0d958f256e3844f839ce8">printSCI_str</a>(sci, strNbr);
   205 <a name="l00184"></a>00184 }
   205 <a name="l00184"></a>00184 }
   206 <a name="l00185"></a>00185 
   206 <a name="l00185"></a>00185 
   207 <a name="l00186"></a>00186 <span class="comment">/******************************************************************************/</span>
   207 <a name="l00186"></a>00186 <span class="comment">/******************************************************************************/</span>
   208 <a name="l00187"></a>00187 <span class="comment">// PLL 24 MHZ if quartz on board is 16 MHZ</span>
   208 <a name="l00187"></a>00187 <span class="comment">// PLL 24 MHZ if quartz on board is 16 MHZ</span>
   209 <a name="l00188"></a><a class="code" href="hcs12_2applicfg_8h.html#51e71c727eb7a49e2fde962a3d190a6b">00188</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#51e71c727eb7a49e2fde962a3d190a6b">initPLL</a>(<span class="keywordtype">void</span>)
   209 <a name="l00188"></a><a class="code" href="hcs12_2applicfg_8h.html#dc9e47be663af9d60b9844df30cd2057">00188</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#dc9e47be663af9d60b9844df30cd2057">initPLL</a>(<span class="keywordtype">void</span>)
   210 <a name="l00189"></a>00189 {
   210 <a name="l00189"></a>00189 {
   211 <a name="l00190"></a>00190   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#7b3c436d31b2305ed9be91f5131d4e5f">CLKSEL</a>) &amp;= ~0x80; <span class="comment">// unselect the PLL</span>
   211 <a name="l00190"></a>00190   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#a190d61f03a33a507491451d8eb5c3b4">CLKSEL</a>) &amp;= ~0x80; <span class="comment">// unselect the PLL</span>
   212 <a name="l00191"></a>00191   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#c5c4a1f05b54f73904b0c0aa7063a063">PLLCTL</a>) |= 0X60;  <span class="comment">// PLL ON and bandwidth auto</span>
   212 <a name="l00191"></a>00191   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#d591bb30e5c21025462a2d7f989da8b6">PLLCTL</a>) |= 0X60;  <span class="comment">// PLL ON and bandwidth auto</span>
   213 <a name="l00192"></a>00192   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#f89364e5f6f6b510b1a1d0019ed18457">SYNR</a>) = 0x02;
   213 <a name="l00192"></a>00192   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#8d25c49ab657533d37a94ae9148e2d63">SYNR</a>) = 0x02;
   214 <a name="l00193"></a>00193   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#c977bdfc9a47c2c122b24c109b2ca1d2">REFDV</a>) = 0x01;
   214 <a name="l00193"></a>00193   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#a96e21600d37d8201fddd2ea6c1cfb08">REFDV</a>) = 0x01;
   215 <a name="l00194"></a>00194   <span class="keywordflow">while</span> ((<a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#deed7374b4301e74bdde3ae8bc5e2e06">CRGFLG</a>) &amp; 0x08) == 0);
   215 <a name="l00194"></a>00194   <span class="keywordflow">while</span> ((<a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#9425e8b4574e2ff95db17da35853541d">CRGFLG</a>) &amp; 0x08) == 0);
   216 <a name="l00195"></a>00195   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#7b3c436d31b2305ed9be91f5131d4e5f">CLKSEL</a>) |= 0x80;
   216 <a name="l00195"></a>00195   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#a190d61f03a33a507491451d8eb5c3b4">CLKSEL</a>) |= 0x80;
   217 <a name="l00196"></a>00196 }
   217 <a name="l00196"></a>00196 }
   218 <a name="l00197"></a>00197 
   218 <a name="l00197"></a>00197 
   219 <a name="l00198"></a>00198 <span class="comment">/******************************************************************************/</span>
   219 <a name="l00198"></a>00198 <span class="comment">/******************************************************************************/</span>
   220 <a name="l00199"></a><a class="code" href="hcs12_2applicfg_8h.html#c71399958d35a7f703416f025603ee26">00199</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#c71399958d35a7f703416f025603ee26">initHCS12</a>(<span class="keywordtype">void</span>)
   220 <a name="l00199"></a><a class="code" href="hcs12_2applicfg_8h.html#be976c0f99ffecc3b40fbbeefdc53578">00199</a> <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#be976c0f99ffecc3b40fbbeefdc53578">initHCS12</a>(<span class="keywordtype">void</span>)
   221 <a name="l00200"></a>00200 {
   221 <a name="l00200"></a>00200 {
   222 <a name="l00201"></a>00201 
   222 <a name="l00201"></a>00201 
   223 <a name="l00202"></a>00202 <span class="preprocessor"># ifdef USE_PLL</span>
   223 <a name="l00202"></a>00202 <span class="preprocessor"># ifdef USE_PLL</span>
   224 <a name="l00203"></a>00203 <span class="preprocessor"></span>  <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0x3620, <span class="stringliteral">"Use the PLL "</span>, 0);
   224 <a name="l00203"></a>00203 <span class="preprocessor"></span>  <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0x3620, <span class="stringliteral">"Use the PLL "</span>, 0);
   225 <a name="l00204"></a>00204   <a class="code" href="canOpenDriver_8c.html#51e71c727eb7a49e2fde962a3d190a6b">initPLL</a>();
   225 <a name="l00204"></a>00204   <a class="code" href="canOpenDriver_8c.html#dc9e47be663af9d60b9844df30cd2057">initPLL</a>();
   226 <a name="l00205"></a>00205 <span class="preprocessor"># endif</span>
   226 <a name="l00205"></a>00205 <span class="preprocessor"># endif</span>
   227 <a name="l00206"></a>00206 <span class="preprocessor"></span>
   227 <a name="l00206"></a>00206 <span class="preprocessor"></span>
   228 <a name="l00207"></a>00207 }
   228 <a name="l00207"></a>00207 }
   229 <a name="l00208"></a>00208 
   229 <a name="l00208"></a>00208 
   230 <a name="l00209"></a>00209 <span class="comment">/***************************************************************************/</span>
   230 <a name="l00209"></a>00209 <span class="comment">/***************************************************************************/</span>
   231 <a name="l00210"></a><a class="code" href="candriver_8h.html#acfd181d5b055d1403930442e28ac643">00210</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#acfd181d5b055d1403930442e28ac643">canAddIdToFilter</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> nFilter, <a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> <span class="keywordtype">id</span>)
   231 <a name="l00210"></a><a class="code" href="candriver_8h.html#9579ae456a8ee9cee1ae777a4a0ee3ac">00210</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#9579ae456a8ee9cee1ae777a4a0ee3ac">canAddIdToFilter</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> nFilter, <a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> <span class="keywordtype">id</span>)
   232 <a name="l00211"></a>00211 {
   232 <a name="l00211"></a>00211 {
   233 <a name="l00212"></a>00212   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> fiMsb;
   233 <a name="l00212"></a>00212   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> fiMsb;
   234 <a name="l00213"></a>00213   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> fiLsb;
   234 <a name="l00213"></a>00213   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> fiLsb;
   235 <a name="l00214"></a>00214   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> idMsb = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>) (<span class="keywordtype">id</span> &gt;&gt; 3);
   235 <a name="l00214"></a>00214   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> idMsb = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>) (<span class="keywordtype">id</span> &gt;&gt; 3);
   236 <a name="l00215"></a>00215   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> idLsb = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>) (<span class="keywordtype">id</span> &lt;&lt; 5);
   236 <a name="l00215"></a>00215   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> idLsb = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>) (<span class="keywordtype">id</span> &lt;&lt; 5);
   237 <a name="l00216"></a>00216 
   237 <a name="l00216"></a>00216 
   238 <a name="l00217"></a>00217   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   238 <a name="l00217"></a>00217   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   239 <a name="l00218"></a>00218     <span class="comment">/* Error because not init mode */</span>
   239 <a name="l00218"></a>00218     <span class="comment">/* Error because not init mode */</span>
   240 <a name="l00219"></a>00219     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2600, <span class="stringliteral">"Not in init mode "</span>, 0);
   240 <a name="l00219"></a>00219     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2600, <span class="stringliteral">"Not in init mode "</span>, 0);
   241 <a name="l00220"></a>00220     <span class="keywordflow">return</span> 1;   
   241 <a name="l00220"></a>00220     <span class="keywordflow">return</span> 1;   
   242 <a name="l00221"></a>00221   }
   242 <a name="l00221"></a>00221   }
   243 <a name="l00222"></a>00222   <span class="keywordflow">switch</span> (nFilter) {
   243 <a name="l00222"></a>00222   <span class="keywordflow">switch</span> (nFilter) {
   244 <a name="l00223"></a>00223     <span class="keywordflow">case</span> 0:
   244 <a name="l00223"></a>00223     <span class="keywordflow">case</span> 0:
   245 <a name="l00224"></a>00224       nFilter = <a class="code" href="ports__def_8h.html#4ea6fce7126601177783202e9bbb7f6e">CANIDAR0</a>; <span class="comment">/* First  bank */</span>
   245 <a name="l00224"></a>00224       nFilter = <a class="code" href="ports__def_8h.html#3dbef24df28b286c0f082f1d13acb7dd">CANIDAR0</a>; <span class="comment">/* First  bank */</span>
   246 <a name="l00225"></a>00225       <span class="keywordflow">break</span>;
   246 <a name="l00225"></a>00225       <span class="keywordflow">break</span>;
   247 <a name="l00226"></a>00226     <span class="keywordflow">case</span> 1:
   247 <a name="l00226"></a>00226     <span class="keywordflow">case</span> 1:
   248 <a name="l00227"></a>00227       nFilter = <a class="code" href="ports__def_8h.html#b471d0faf75a4e68046160828b887d51">CANIDAR2</a>; <span class="comment">/* First  bank */</span>
   248 <a name="l00227"></a>00227       nFilter = <a class="code" href="ports__def_8h.html#797d179578bfa2f8b1c1a935eaf5623d">CANIDAR2</a>; <span class="comment">/* First  bank */</span>
   249 <a name="l00228"></a>00228       <span class="keywordflow">break</span>;
   249 <a name="l00228"></a>00228       <span class="keywordflow">break</span>;
   250 <a name="l00229"></a>00229     <span class="keywordflow">case</span> 2:
   250 <a name="l00229"></a>00229     <span class="keywordflow">case</span> 2:
   251 <a name="l00230"></a>00230       nFilter = <a class="code" href="ports__def_8h.html#c84502ad2ee270b91a50128888db9950">CANIDAR4</a>; <span class="comment">/* Second bank */</span>
   251 <a name="l00230"></a>00230       nFilter = <a class="code" href="ports__def_8h.html#b604e6ea87ce0bfaaa6a086b5721d002">CANIDAR4</a>; <span class="comment">/* Second bank */</span>
   252 <a name="l00231"></a>00231       <span class="keywordflow">break</span>;
   252 <a name="l00231"></a>00231       <span class="keywordflow">break</span>;
   253 <a name="l00232"></a>00232     <span class="keywordflow">case</span> 3:
   253 <a name="l00232"></a>00232     <span class="keywordflow">case</span> 3:
   254 <a name="l00233"></a>00233       nFilter = <a class="code" href="ports__def_8h.html#337dd0bc9f36b48b0e35f4113807f975">CANIDAR6</a>; <span class="comment">/* Second bank */</span>   
   254 <a name="l00233"></a>00233       nFilter = <a class="code" href="ports__def_8h.html#f82e4a8ab50e2d2f349e362a76ccb2e1">CANIDAR6</a>; <span class="comment">/* Second bank */</span>   
   255 <a name="l00234"></a>00234   }
   255 <a name="l00234"></a>00234   }
   256 <a name="l00235"></a>00235   <span class="keywordflow">if</span> (! <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(adrCAN + nFilter)) {
   256 <a name="l00235"></a>00235   <span class="keywordflow">if</span> (! <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(adrCAN + nFilter)) {
   257 <a name="l00236"></a>00236     <span class="comment">/* if CANIDARx = 0 */</span>
   257 <a name="l00236"></a>00236     <span class="comment">/* if CANIDARx = 0 */</span>
   258 <a name="l00237"></a>00237     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter) = idMsb;
   258 <a name="l00237"></a>00237     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter) = idMsb;
   259 <a name="l00238"></a>00238     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 1) = idLsb;
   259 <a name="l00238"></a>00238     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 1) = idLsb;
   260 <a name="l00239"></a>00239   }
   260 <a name="l00239"></a>00239   }
   261 <a name="l00240"></a>00240   fiMsb = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter) ^ idMsb;
   261 <a name="l00240"></a>00240   fiMsb = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter) ^ idMsb;
   262 <a name="l00241"></a>00241   fiLsb = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 1) ^ idLsb;
   262 <a name="l00241"></a>00241   fiLsb = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 1) ^ idLsb;
   263 <a name="l00242"></a>00242   <span class="comment">/* address of CANIDMRx */</span>
   263 <a name="l00242"></a>00242   <span class="comment">/* address of CANIDMRx */</span>
   264 <a name="l00243"></a>00243   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 4) = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 4) | fiMsb;
   264 <a name="l00243"></a>00243   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 4) = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 4) | fiMsb;
   265 <a name="l00244"></a>00244   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 5) = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 5) | fiLsb;
   265 <a name="l00244"></a>00244   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 5) = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 5) | fiLsb;
   266 <a name="l00245"></a>00245   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 5) |= 0x10; <span class="comment">/* Not filtering on rtr value */</span>
   266 <a name="l00245"></a>00245   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 5) |= 0x10; <span class="comment">/* Not filtering on rtr value */</span>
   267 <a name="l00246"></a>00246   <span class="keywordflow">return</span> 0;
   267 <a name="l00246"></a>00246   <span class="keywordflow">return</span> 0;
   268 <a name="l00247"></a>00247 }
   268 <a name="l00247"></a>00247 }
   269 <a name="l00248"></a>00248 
   269 <a name="l00248"></a>00248 
   270 <a name="l00249"></a>00249 <span class="comment">/***************************************************************************/</span>
   270 <a name="l00249"></a>00249 <span class="comment">/***************************************************************************/</span>
   271 <a name="l00250"></a><a class="code" href="candriver_8h.html#751a41c9747b96ab400b5599370cea83">00250</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#751a41c9747b96ab400b5599370cea83">canChangeFilter</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="structcanBusFilterInit.html">canBusFilterInit</a> fi)
   271 <a name="l00250"></a><a class="code" href="candriver_8h.html#7fd72f38fd09b6e79a50ac32d8cc0629">00250</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#7fd72f38fd09b6e79a50ac32d8cc0629">canChangeFilter</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="structcanBusFilterInit.html">canBusFilterInit</a> fi)
   272 <a name="l00251"></a>00251 {
   272 <a name="l00251"></a>00251 {
   273 <a name="l00252"></a>00252   <span class="comment">/* If not in init mode, go to sleep before going in init mode*/</span>
   273 <a name="l00252"></a>00252   <span class="comment">/* If not in init mode, go to sleep before going in init mode*/</span>
   274 <a name="l00253"></a>00253   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   274 <a name="l00253"></a>00253   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   275 <a name="l00254"></a>00254     <a class="code" href="canOpenDriver_8c.html#c7773223579ec7e0fab5238df214da89">canSleepMode</a>(adrCAN);
   275 <a name="l00254"></a>00254     <a class="code" href="canOpenDriver_8c.html#ce25028cdf7de7a16b2762cb3846ddd4">canSleepMode</a>(adrCAN);
   276 <a name="l00255"></a>00255     <a class="code" href="canOpenDriver_8c.html#0b98e4800c82d99981833aa4207f1eb9">canInitMode</a>(adrCAN); 
   276 <a name="l00255"></a>00255     <a class="code" href="canOpenDriver_8c.html#daff5eaa25245bff93a854283e2e0cb2">canInitMode</a>(adrCAN); 
   277 <a name="l00256"></a>00256   }
   277 <a name="l00256"></a>00256   }
   278 <a name="l00257"></a>00257   <span class="comment">//update the filters configuration</span>
   278 <a name="l00257"></a>00257   <span class="comment">//update the filters configuration</span>
   279 <a name="l00258"></a>00258   <a class="code" href="canOpenDriver_8c.html#b4502eef7616b25c74b1ac5a2245b085">canInitFilter</a>(adrCAN, fi);
   279 <a name="l00258"></a>00258   <a class="code" href="canOpenDriver_8c.html#437cf0f7cee6930bc4d6f4743999e4f2">canInitFilter</a>(adrCAN, fi);
   280 <a name="l00259"></a>00259   <a class="code" href="canOpenDriver_8c.html#00ffb46abacfdfa56ebc70e15164113e">canInitModeQ</a>(adrCAN);
   280 <a name="l00259"></a>00259   <a class="code" href="canOpenDriver_8c.html#a619f965cc88e08dec28de4833bfe50a">canInitModeQ</a>(adrCAN);
   281 <a name="l00260"></a>00260   <a class="code" href="canOpenDriver_8c.html#a89f28005eea54f5b216eb72a18d45f3">canSleepModeQ</a>(adrCAN);
   281 <a name="l00260"></a>00260   <a class="code" href="canOpenDriver_8c.html#e147ca22aacafc3fa806f32f3f3577cb">canSleepModeQ</a>(adrCAN);
   282 <a name="l00261"></a>00261   <a class="code" href="canOpenDriver_8c.html#5ad8616a3276f7f40149b551f09aa6a1">canSetInterrupt</a>(adrCAN);
   282 <a name="l00261"></a>00261   <a class="code" href="canOpenDriver_8c.html#946843a5bc1823243b5120d57785f0ec">canSetInterrupt</a>(adrCAN);
   283 <a name="l00262"></a>00262   <span class="keywordflow">return</span> 0;
   283 <a name="l00262"></a>00262   <span class="keywordflow">return</span> 0;
   284 <a name="l00263"></a>00263 }
   284 <a name="l00263"></a>00263 }
   285 <a name="l00264"></a>00264 
   285 <a name="l00264"></a>00264 
   286 <a name="l00265"></a>00265 <span class="comment">/***************************************************************************/</span>
   286 <a name="l00265"></a>00265 <span class="comment">/***************************************************************************/</span>
   287 <a name="l00266"></a><a class="code" href="candriver_8h.html#5a53a89d2e348d70331e6ebe269d155a">00266</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#5a53a89d2e348d70331e6ebe269d155a">canEnable</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   287 <a name="l00266"></a><a class="code" href="candriver_8h.html#bf55daf34be2503cf0414e15abf2c69c">00266</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#bf55daf34be2503cf0414e15abf2c69c">canEnable</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   288 <a name="l00267"></a>00267 {
   288 <a name="l00267"></a>00267 {
   289 <a name="l00268"></a>00268   <span class="comment">/* Register CANCTL1</span>
   289 <a name="l00268"></a>00268   <span class="comment">/* Register CANCTL1</span>
   290 <a name="l00269"></a>00269 <span class="comment">  bit 7 : 1 MSCAN enabled</span>
   290 <a name="l00269"></a>00269 <span class="comment">  bit 7 : 1 MSCAN enabled</span>
   291 <a name="l00270"></a>00270 <span class="comment">  Other bits : default reset values</span>
   291 <a name="l00270"></a>00270 <span class="comment">  Other bits : default reset values</span>
   292 <a name="l00271"></a>00271 <span class="comment">  */</span>
   292 <a name="l00271"></a>00271 <span class="comment">  */</span>
   293 <a name="l00272"></a>00272   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) = 0X80;
   293 <a name="l00272"></a>00272   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) = 0X80;
   294 <a name="l00273"></a>00273   <span class="keywordflow">return</span> 0;
   294 <a name="l00273"></a>00273   <span class="keywordflow">return</span> 0;
   295 <a name="l00274"></a>00274 }
   295 <a name="l00274"></a>00274 }
   296 <a name="l00275"></a>00275 
   296 <a name="l00275"></a>00275 
   297 <a name="l00276"></a>00276 <span class="comment">/***************************************************************************/</span>
   297 <a name="l00276"></a>00276 <span class="comment">/***************************************************************************/</span>
   298 <a name="l00277"></a><a class="code" href="candriver_8h.html#3c4f7a31d94e5e7c7322535467b806de">00277</a> <span class="keywordtype">char</span> <a class="code" href="can__peak__win32_8c.html#9f623ce2d3a68e90dfdb1ff0d54a9b57">canInit</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="structcanBusInit.html">canBusInit</a> bi)
   298 <a name="l00277"></a><a class="code" href="candriver_8h.html#2096ee596caa9bc31be5e100b383b9f8">00277</a> <span class="keywordtype">char</span> <a class="code" href="can__peak__win32_8c.html#cd636af61207be14f372fcbe0785f59d">canInit</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="structcanBusInit.html">canBusInit</a> bi)
   299 <a name="l00278"></a>00278 {
   299 <a name="l00278"></a>00278 {
   300 <a name="l00279"></a>00279   <span class="comment">/* If not in init mode, go to sleep before going in init mode*/</span>
   300 <a name="l00279"></a>00279   <span class="comment">/* If not in init mode, go to sleep before going in init mode*/</span>
   301 <a name="l00280"></a>00280   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   301 <a name="l00280"></a>00280   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   302 <a name="l00281"></a>00281     <a class="code" href="canOpenDriver_8c.html#c7773223579ec7e0fab5238df214da89">canSleepMode</a>(adrCAN);
   302 <a name="l00281"></a>00281     <a class="code" href="canOpenDriver_8c.html#ce25028cdf7de7a16b2762cb3846ddd4">canSleepMode</a>(adrCAN);
   303 <a name="l00282"></a>00282     <a class="code" href="canOpenDriver_8c.html#0b98e4800c82d99981833aa4207f1eb9">canInitMode</a>(adrCAN); 
   303 <a name="l00282"></a>00282     <a class="code" href="canOpenDriver_8c.html#daff5eaa25245bff93a854283e2e0cb2">canInitMode</a>(adrCAN); 
   304 <a name="l00283"></a>00283   }
   304 <a name="l00283"></a>00283   }
   305 <a name="l00284"></a>00284   
   305 <a name="l00284"></a>00284   
   306 <a name="l00285"></a>00285   <a class="code" href="canOpenDriver_8c.html#5a53a89d2e348d70331e6ebe269d155a">canEnable</a>(adrCAN);                  <span class="comment">/* Does nothing if already enable */</span>
   306 <a name="l00285"></a>00285   <a class="code" href="canOpenDriver_8c.html#bf55daf34be2503cf0414e15abf2c69c">canEnable</a>(adrCAN);                  <span class="comment">/* Does nothing if already enable */</span>
   307 <a name="l00286"></a>00286      <span class="comment">/* The most secure way to go in init mode : put before MSCAN in sleep mode */</span>
   307 <a name="l00286"></a>00286      <span class="comment">/* The most secure way to go in init mode : put before MSCAN in sleep mode */</span>
   308 <a name="l00287"></a>00287       <span class="comment">//canSleepMode(adrCAN);</span>
   308 <a name="l00287"></a>00287       <span class="comment">//canSleepMode(adrCAN);</span>
   309 <a name="l00288"></a>00288      <span class="comment">/* Put MSCAN in Init mode */</span> 
   309 <a name="l00288"></a>00288      <span class="comment">/* Put MSCAN in Init mode */</span> 
   310 <a name="l00289"></a>00289      <span class="comment">//canInitMode(adrCAN);</span>
   310 <a name="l00289"></a>00289      <span class="comment">//canInitMode(adrCAN);</span>
   311 <a name="l00290"></a>00290   <a class="code" href="canOpenDriver_8c.html#6ec3ce6d79012dd8a08fa5aeb6a0489f">canInitClock</a>(adrCAN, bi.<a class="code" href="structcanBusInit.html#fc9eb7ca2f89001dca552e3f956beb73">clk</a>); 
   311 <a name="l00290"></a>00290   <a class="code" href="canOpenDriver_8c.html#83ad789afb5a949c85f8998b40d651c3">canInitClock</a>(adrCAN, bi.<a class="code" href="structcanBusInit.html#3416d1e391b6ced43c74c1a28d473b7c">clk</a>); 
   312 <a name="l00291"></a>00291   <span class="comment">/* Init CANCTL1 register. Must be in init mode */</span>
   312 <a name="l00291"></a>00291   <span class="comment">/* Init CANCTL1 register. Must be in init mode */</span>
   313 <a name="l00292"></a>00292   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) &amp;=0xC4;<span class="comment">// 0xCB; /* Clr the bits that may be modified */</span>
   313 <a name="l00292"></a>00292   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) &amp;=0xC4;<span class="comment">// 0xCB; /* Clr the bits that may be modified */</span>
   314 <a name="l00293"></a>00293   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) = (bi.<a class="code" href="structcanBusInit.html#89208e27db0d71c7b4c34b396d8e4494">cane</a> &lt;&lt; 7) | (bi.<a class="code" href="structcanBusInit.html#b12f39cd4161fdc5ad130b4bb8e4a484">loopb</a> &lt;&lt; 5 ) | 
   314 <a name="l00293"></a>00293   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) = (bi.<a class="code" href="structcanBusInit.html#94b6d65fade44b397c1e48e658e7bffe">cane</a> &lt;&lt; 7) | (bi.<a class="code" href="structcanBusInit.html#c8a539634dabd6c10519a59480cb250c">loopb</a> &lt;&lt; 5 ) | 
   315 <a name="l00294"></a>00294     (bi.<a class="code" href="structcanBusInit.html#9b6d43ba9be72e1f21e234d50a1676d6">listen</a> &lt;&lt; 4) | (bi.<a class="code" href="structcanBusInit.html#ae0d3c3a91c165a0d782ff40be2e8e29">wupm</a> &lt;&lt; 2);
   315 <a name="l00294"></a>00294     (bi.<a class="code" href="structcanBusInit.html#3576034b380091818fc88fb22aa408f2">listen</a> &lt;&lt; 4) | (bi.<a class="code" href="structcanBusInit.html#acf29b4229abadb3f5ab7a6524b406e7">wupm</a> &lt;&lt; 2);
   316 <a name="l00295"></a>00295   <span class="comment">/* Initialize the filters for received msgs */</span>
   316 <a name="l00295"></a>00295   <span class="comment">/* Initialize the filters for received msgs */</span>
   317 <a name="l00296"></a>00296   <span class="comment">/* We should decide to accept all the msgs  */</span>
   317 <a name="l00296"></a>00296   <span class="comment">/* We should decide to accept all the msgs  */</span>
   318 <a name="l00297"></a>00297   <a class="code" href="canOpenDriver_8c.html#b4502eef7616b25c74b1ac5a2245b085">canInitFilter</a>(adrCAN, bi.<a class="code" href="structcanBusInit.html#ea84b860ae3e0e636b78d1c83e916ea0">fi</a>);
   318 <a name="l00297"></a>00297   <a class="code" href="canOpenDriver_8c.html#437cf0f7cee6930bc4d6f4743999e4f2">canInitFilter</a>(adrCAN, bi.<a class="code" href="structcanBusInit.html#3311c0959bc93dedb5bd13fb653eab7c">fi</a>);
   319 <a name="l00298"></a>00298   <span class="comment">/* Before to modify CANCTL0, we must leave the init mode */</span>
   319 <a name="l00298"></a>00298   <span class="comment">/* Before to modify CANCTL0, we must leave the init mode */</span>
   320 <a name="l00299"></a>00299   <a class="code" href="canOpenDriver_8c.html#00ffb46abacfdfa56ebc70e15164113e">canInitModeQ</a>(adrCAN);
   320 <a name="l00299"></a>00299   <a class="code" href="canOpenDriver_8c.html#a619f965cc88e08dec28de4833bfe50a">canInitModeQ</a>(adrCAN);
   321 <a name="l00300"></a>00300   <span class="comment">/* Init CANCTL0 register. MSCAN must not be in init mode */</span>
   321 <a name="l00300"></a>00300   <span class="comment">/* Init CANCTL0 register. MSCAN must not be in init mode */</span>
   322 <a name="l00301"></a>00301   <span class="comment">/* Do not change the value of wupe (should be 0) and slprq (should be 1) */</span>
   322 <a name="l00301"></a>00301   <span class="comment">/* Do not change the value of wupe (should be 0) and slprq (should be 1) */</span>
   323 <a name="l00302"></a>00302   <span class="comment">/* Do not change the value of initrq (should be 0) */</span> 
   323 <a name="l00302"></a>00302   <span class="comment">/* Do not change the value of initrq (should be 0) */</span> 
   324 <a name="l00303"></a>00303   <span class="comment">/* rxfrm is cleared, mupe also (should be before)*/</span>
   324 <a name="l00303"></a>00303   <span class="comment">/* rxfrm is cleared, mupe also (should be before)*/</span>
   325 <a name="l00304"></a>00304     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) &amp;= 0x53; <span class="comment">/* Clr the bits that may be modified */</span>
   325 <a name="l00304"></a>00304     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) &amp;= 0x53; <span class="comment">/* Clr the bits that may be modified */</span>
   326 <a name="l00305"></a>00305     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) = (bi.<a class="code" href="structcanBusInit.html#28a919ea372601ea997ffd7665a31300">cswai</a> &lt;&lt; 5) | (bi.<a class="code" href="structcanBusInit.html#85a64136e89c9106116e635487c8dbf8">time</a> &lt;&lt; 3);
   326 <a name="l00305"></a>00305     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) = (bi.<a class="code" href="structcanBusInit.html#e55fa49debf408530d0e02e046c78fc2">cswai</a> &lt;&lt; 5) | (bi.<a class="code" href="structcanBusInit.html#b2d867e2d4c69932e82294affc065529">time</a> &lt;&lt; 3);
   327 <a name="l00306"></a>00306     <a class="code" href="canOpenDriver_8c.html#5ad8616a3276f7f40149b551f09aa6a1">canSetInterrupt</a>(adrCAN);
   327 <a name="l00306"></a>00306     <a class="code" href="canOpenDriver_8c.html#946843a5bc1823243b5120d57785f0ec">canSetInterrupt</a>(adrCAN);
   328 <a name="l00307"></a>00307     <a class="code" href="canOpenDriver_8c.html#00ffb46abacfdfa56ebc70e15164113e">canInitModeQ</a>(adrCAN); <span class="comment">/* Leave the init mode */</span>
   328 <a name="l00307"></a>00307     <a class="code" href="canOpenDriver_8c.html#a619f965cc88e08dec28de4833bfe50a">canInitModeQ</a>(adrCAN); <span class="comment">/* Leave the init mode */</span>
   329 <a name="l00308"></a>00308     <a class="code" href="canOpenDriver_8c.html#a89f28005eea54f5b216eb72a18d45f3">canSleepModeQ</a>(adrCAN); <span class="comment">/* Leave the sleep mode */</span>    
   329 <a name="l00308"></a>00308     <a class="code" href="canOpenDriver_8c.html#e147ca22aacafc3fa806f32f3f3577cb">canSleepModeQ</a>(adrCAN); <span class="comment">/* Leave the sleep mode */</span>    
   330 <a name="l00309"></a>00309   <span class="keywordflow">return</span> 0;
   330 <a name="l00309"></a>00309   <span class="keywordflow">return</span> 0;
   331 <a name="l00310"></a>00310 }
   331 <a name="l00310"></a>00310 }
   332 <a name="l00311"></a>00311 
   332 <a name="l00311"></a>00311 
   333 <a name="l00312"></a>00312 <span class="comment">/***************************************************************************/</span>
   333 <a name="l00312"></a>00312 <span class="comment">/***************************************************************************/</span>
   334 <a name="l00313"></a><a class="code" href="candriver_8h.html#6ec3ce6d79012dd8a08fa5aeb6a0489f">00313</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#6ec3ce6d79012dd8a08fa5aeb6a0489f">canInitClock</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="structcanBusTime.html">canBusTime</a> clk)
   334 <a name="l00313"></a><a class="code" href="candriver_8h.html#83ad789afb5a949c85f8998b40d651c3">00313</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#83ad789afb5a949c85f8998b40d651c3">canInitClock</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="structcanBusTime.html">canBusTime</a> clk)
   335 <a name="l00314"></a>00314 {
   335 <a name="l00314"></a>00314 {
   336 <a name="l00315"></a>00315   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   336 <a name="l00315"></a>00315   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   337 <a name="l00316"></a>00316     <span class="comment">/* Not in Init mode */</span>
   337 <a name="l00316"></a>00316     <span class="comment">/* Not in Init mode */</span>
   338 <a name="l00317"></a>00317     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2601, <span class="stringliteral">"not in init mode "</span>, 0);
   338 <a name="l00317"></a>00317     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2601, <span class="stringliteral">"not in init mode "</span>, 0);
   339 <a name="l00318"></a>00318     <span class="keywordflow">return</span> 1;   
   339 <a name="l00318"></a>00318     <span class="keywordflow">return</span> 1;   
   340 <a name="l00319"></a>00319   }
   340 <a name="l00319"></a>00319   }
   341 <a name="l00320"></a>00320   <span class="comment">/* Set or reset CLKSRC (register CANCTL1). Does not change the other bits*/</span>
   341 <a name="l00320"></a>00320   <span class="comment">/* Set or reset CLKSRC (register CANCTL1). Does not change the other bits*/</span>
   342 <a name="l00321"></a>00321   clk.<a class="code" href="structcanBusTime.html#04e7cf483b29918f0da5c562400e6071">clksrc</a> = clk.<a class="code" href="structcanBusTime.html#04e7cf483b29918f0da5c562400e6071">clksrc</a> &lt;&lt; 6;
   342 <a name="l00321"></a>00321   clk.<a class="code" href="structcanBusTime.html#97e1ad879dbd38f6726eacb704121930">clksrc</a> = clk.<a class="code" href="structcanBusTime.html#97e1ad879dbd38f6726eacb704121930">clksrc</a> &lt;&lt; 6;
   343 <a name="l00322"></a>00322   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) &amp;= 0xBF;
   343 <a name="l00322"></a>00322   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) &amp;= 0xBF;
   344 <a name="l00323"></a>00323   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) |= clk.<a class="code" href="structcanBusTime.html#04e7cf483b29918f0da5c562400e6071">clksrc</a>;
   344 <a name="l00323"></a>00323   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) |= clk.<a class="code" href="structcanBusTime.html#97e1ad879dbd38f6726eacb704121930">clksrc</a>;
   345 <a name="l00324"></a>00324   <span class="comment">/* Build the CANBTR0 register */</span>
   345 <a name="l00324"></a>00324   <span class="comment">/* Build the CANBTR0 register */</span>
   346 <a name="l00325"></a>00325   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#cad90fa39413a921ae2a0070cda37fb8">CANBTR0</a>) = 0x00;        <span class="comment">/* Clear before changes */</span>
   346 <a name="l00325"></a>00325   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#337499c2d4f4e1a0d5aceee15f608661">CANBTR0</a>) = 0x00;        <span class="comment">/* Clear before changes */</span>
   347 <a name="l00326"></a>00326   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#cad90fa39413a921ae2a0070cda37fb8">CANBTR0</a>) = (clk.<a class="code" href="structcanBusTime.html#deeefef09ef47dba2df92b45e563368f">sjw</a> &lt;&lt; 6) | (clk.<a class="code" href="structcanBusTime.html#f2230f4eeb1d12dd051e7f6369cb1ebb">brp</a>);
   347 <a name="l00326"></a>00326   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#337499c2d4f4e1a0d5aceee15f608661">CANBTR0</a>) = (clk.<a class="code" href="structcanBusTime.html#71915957851eb44a3dbdb5fb0cad45ff">sjw</a> &lt;&lt; 6) | (clk.<a class="code" href="structcanBusTime.html#f0662795b937b5c54451aa845a980c0d">brp</a>);
   348 <a name="l00327"></a>00327   <span class="comment">/* Build the CANBTR1 register */</span>
   348 <a name="l00327"></a>00327   <span class="comment">/* Build the CANBTR1 register */</span>
   349 <a name="l00328"></a>00328   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1b222f5b3e445f867728b8b77b5747c0">CANBTR1</a>) = 0x00;        <span class="comment">/* Clear before changes */</span>
   349 <a name="l00328"></a>00328   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#5d6a3951845c1580f5e949c9a0d125f9">CANBTR1</a>) = 0x00;        <span class="comment">/* Clear before changes */</span>
   350 <a name="l00329"></a>00329   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1b222f5b3e445f867728b8b77b5747c0">CANBTR1</a>) = (clk.<a class="code" href="structcanBusTime.html#a14822cbe84c152c1c79901f0c4fd0f1">samp</a> &lt;&lt; 7) | (clk.<a class="code" href="structcanBusTime.html#7bafebcf05024a19e463f29b1c09c390">tseg2</a> &lt;&lt; 4) | 
   350 <a name="l00329"></a>00329   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#5d6a3951845c1580f5e949c9a0d125f9">CANBTR1</a>) = (clk.<a class="code" href="structcanBusTime.html#14a31c3c0d6d2ea48ce1c0d00db2724c">samp</a> &lt;&lt; 7) | (clk.<a class="code" href="structcanBusTime.html#1dfb7aa14ba56f5a73715f4d8c6befc9">tseg2</a> &lt;&lt; 4) | 
   351 <a name="l00330"></a>00330     (clk.<a class="code" href="structcanBusTime.html#3532d6d7cd2b1f3980b82dfce78f0fe9">tseg1</a>);  
   351 <a name="l00330"></a>00330     (clk.<a class="code" href="structcanBusTime.html#6187a598266f497d7ecd897af3fd0139">tseg1</a>);  
   352 <a name="l00331"></a>00331   <span class="keywordflow">return</span> 0;
   352 <a name="l00331"></a>00331   <span class="keywordflow">return</span> 0;
   353 <a name="l00332"></a>00332 }
   353 <a name="l00332"></a>00332 }
   354 <a name="l00333"></a>00333 
   354 <a name="l00333"></a>00333 
   355 <a name="l00334"></a>00334 <span class="comment">/***************************************************************************/</span>
   355 <a name="l00334"></a>00334 <span class="comment">/***************************************************************************/</span>
   356 <a name="l00335"></a><a class="code" href="candriver_8h.html#5fb549697afb7918607aa113e01c543d">00335</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#5fb549697afb7918607aa113e01c543d">canInit1Filter</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> nFilter, <a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> ar, <a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> mr)
   356 <a name="l00335"></a><a class="code" href="candriver_8h.html#d5f0fc801fc795c7911fb7dc4f403428">00335</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#d5f0fc801fc795c7911fb7dc4f403428">canInit1Filter</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> nFilter, <a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> ar, <a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> mr)
   357 <a name="l00336"></a>00336 {
   357 <a name="l00336"></a>00336 {
   358 <a name="l00337"></a>00337   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   358 <a name="l00337"></a>00337   <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   359 <a name="l00338"></a>00338     <span class="comment">/* Error because not init mode */</span>
   359 <a name="l00338"></a>00338     <span class="comment">/* Error because not init mode */</span>
   360 <a name="l00339"></a>00339     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2602, <span class="stringliteral">"not in init mode "</span>, 0);
   360 <a name="l00339"></a>00339     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2602, <span class="stringliteral">"not in init mode "</span>, 0);
   361 <a name="l00340"></a>00340     <span class="keywordflow">return</span> 1;   
   361 <a name="l00340"></a>00340     <span class="keywordflow">return</span> 1;   
   362 <a name="l00341"></a>00341   }
   362 <a name="l00341"></a>00341   }
   363 <a name="l00342"></a>00342   <span class="keywordflow">switch</span> (nFilter) {
   363 <a name="l00342"></a>00342   <span class="keywordflow">switch</span> (nFilter) {
   364 <a name="l00343"></a>00343     <span class="keywordflow">case</span> 0:
   364 <a name="l00343"></a>00343     <span class="keywordflow">case</span> 0:
   365 <a name="l00344"></a>00344       nFilter = <a class="code" href="ports__def_8h.html#4ea6fce7126601177783202e9bbb7f6e">CANIDAR0</a>; <span class="comment">/* First  bank */</span>
   365 <a name="l00344"></a>00344       nFilter = <a class="code" href="ports__def_8h.html#3dbef24df28b286c0f082f1d13acb7dd">CANIDAR0</a>; <span class="comment">/* First  bank */</span>
   366 <a name="l00345"></a>00345       <span class="keywordflow">break</span>; 
   366 <a name="l00345"></a>00345       <span class="keywordflow">break</span>; 
   367 <a name="l00346"></a>00346     <span class="keywordflow">case</span> 1:
   367 <a name="l00346"></a>00346     <span class="keywordflow">case</span> 1:
   368 <a name="l00347"></a>00347       nFilter = <a class="code" href="ports__def_8h.html#b471d0faf75a4e68046160828b887d51">CANIDAR2</a>; <span class="comment">/* First  bank */</span>
   368 <a name="l00347"></a>00347       nFilter = <a class="code" href="ports__def_8h.html#797d179578bfa2f8b1c1a935eaf5623d">CANIDAR2</a>; <span class="comment">/* First  bank */</span>
   369 <a name="l00348"></a>00348       <span class="keywordflow">break</span>;
   369 <a name="l00348"></a>00348       <span class="keywordflow">break</span>;
   370 <a name="l00349"></a>00349     <span class="keywordflow">case</span> 2:
   370 <a name="l00349"></a>00349     <span class="keywordflow">case</span> 2:
   371 <a name="l00350"></a>00350       nFilter = <a class="code" href="ports__def_8h.html#c84502ad2ee270b91a50128888db9950">CANIDAR4</a>; <span class="comment">/* Second bank */</span>
   371 <a name="l00350"></a>00350       nFilter = <a class="code" href="ports__def_8h.html#b604e6ea87ce0bfaaa6a086b5721d002">CANIDAR4</a>; <span class="comment">/* Second bank */</span>
   372 <a name="l00351"></a>00351       <span class="keywordflow">break</span>;
   372 <a name="l00351"></a>00351       <span class="keywordflow">break</span>;
   373 <a name="l00352"></a>00352     <span class="keywordflow">case</span> 3:
   373 <a name="l00352"></a>00352     <span class="keywordflow">case</span> 3:
   374 <a name="l00353"></a>00353       nFilter = <a class="code" href="ports__def_8h.html#337dd0bc9f36b48b0e35f4113807f975">CANIDAR6</a>; <span class="comment">/* Second bank */</span>   
   374 <a name="l00353"></a>00353       nFilter = <a class="code" href="ports__def_8h.html#f82e4a8ab50e2d2f349e362a76ccb2e1">CANIDAR6</a>; <span class="comment">/* Second bank */</span>   
   375 <a name="l00354"></a>00354   }
   375 <a name="l00354"></a>00354   }
   376 <a name="l00355"></a>00355   <span class="comment">/* address of CANIDARx */</span>
   376 <a name="l00355"></a>00355   <span class="comment">/* address of CANIDARx */</span>
   377 <a name="l00356"></a>00356   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter)     = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>) (ar &gt;&gt; 8);
   377 <a name="l00356"></a>00356   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter)     = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>) (ar &gt;&gt; 8);
   378 <a name="l00357"></a>00357   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 1) = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>) (ar);
   378 <a name="l00357"></a>00357   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 1) = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>) (ar);
   379 <a name="l00358"></a>00358   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 4) = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>) (mr &gt;&gt; 8);
   379 <a name="l00358"></a>00358   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 4) = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>) (mr &gt;&gt; 8);
   380 <a name="l00359"></a>00359   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + nFilter + 5) = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>) (mr);
   380 <a name="l00359"></a>00359   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + nFilter + 5) = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>) (mr);
   381 <a name="l00360"></a>00360   <span class="keywordflow">return</span> 0;
   381 <a name="l00360"></a>00360   <span class="keywordflow">return</span> 0;
   382 <a name="l00361"></a>00361 }
   382 <a name="l00361"></a>00361 }
   383 <a name="l00362"></a>00362 
   383 <a name="l00362"></a>00362 
   384 <a name="l00363"></a>00363 <span class="comment">/***************************************************************************/</span>
   384 <a name="l00363"></a>00363 <span class="comment">/***************************************************************************/</span>
   385 <a name="l00364"></a><a class="code" href="candriver_8h.html#b4502eef7616b25c74b1ac5a2245b085">00364</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#b4502eef7616b25c74b1ac5a2245b085">canInitFilter</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="structcanBusFilterInit.html">canBusFilterInit</a> fi)
   385 <a name="l00364"></a><a class="code" href="candriver_8h.html#437cf0f7cee6930bc4d6f4743999e4f2">00364</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#437cf0f7cee6930bc4d6f4743999e4f2">canInitFilter</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="structcanBusFilterInit.html">canBusFilterInit</a> fi)
   386 <a name="l00365"></a>00365 {
   386 <a name="l00365"></a>00365 {
   387 <a name="l00366"></a>00366 <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   387 <a name="l00366"></a>00366 <span class="keywordflow">if</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   388 <a name="l00367"></a>00367     <span class="comment">/* Error because not init mode */</span>
   388 <a name="l00367"></a>00367     <span class="comment">/* Error because not init mode */</span>
   389 <a name="l00368"></a>00368     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2603, <span class="stringliteral">"not in init mode "</span>, 0);
   389 <a name="l00368"></a>00368     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2603, <span class="stringliteral">"not in init mode "</span>, 0);
   390 <a name="l00369"></a>00369     <span class="keywordflow">return</span> 1;   
   390 <a name="l00369"></a>00369     <span class="keywordflow">return</span> 1;   
   391 <a name="l00370"></a>00370   }
   391 <a name="l00370"></a>00370   }
   392 <a name="l00371"></a>00371   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#d4df031fb910865881e20f7c6b2fe471">CANIDAC</a>)  = fi.<a class="code" href="structcanBusFilterInit.html#bd65e55b40839cc85917717124ba8ff7">idam</a> &lt;&lt; 4;
   392 <a name="l00371"></a>00371   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#a6f1271f7cb1a571455325bd5c1faf75">CANIDAC</a>)  = fi.<a class="code" href="structcanBusFilterInit.html#5da0d810ad7e2e35a34737ba969caf39">idam</a> &lt;&lt; 4;
   393 <a name="l00372"></a>00372   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#4ea6fce7126601177783202e9bbb7f6e">CANIDAR0</a>) = fi.<a class="code" href="structcanBusFilterInit.html#e73e4472088781055b2c634529a6c91e">canidar0</a>;
   393 <a name="l00372"></a>00372   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#3dbef24df28b286c0f082f1d13acb7dd">CANIDAR0</a>) = fi.<a class="code" href="structcanBusFilterInit.html#f999163cff995179c6ff8d24e0278fac">canidar0</a>;
   394 <a name="l00373"></a>00373   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#ad7580fe4fc28e38fa4f992c6376fd55">CANIDMR0</a>) = fi.<a class="code" href="structcanBusFilterInit.html#73219612204df8b0eece12ebf4fbb491">canidmr0</a>;
   394 <a name="l00373"></a>00373   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f25689a480f5005ad77df08c267e74a5">CANIDMR0</a>) = fi.<a class="code" href="structcanBusFilterInit.html#02ae05657cd22560f8a41a491f57d204">canidmr0</a>;
   395 <a name="l00374"></a>00374   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#552073c8d5ec6b4878ca29c9c14f9e5f">CANIDAR1</a>) = fi.<a class="code" href="structcanBusFilterInit.html#c78d28e662944187916a14991d118dda">canidar1</a>;
   395 <a name="l00374"></a>00374   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#477013d5cec2a66850e15832e298d0f4">CANIDAR1</a>) = fi.<a class="code" href="structcanBusFilterInit.html#08dcbd19479f3a54e2a42a3d9ec9a255">canidar1</a>;
   396 <a name="l00375"></a>00375   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#6e4be06c891b6999ad8c3ffe931e87a8">CANIDMR1</a>) = fi.<a class="code" href="structcanBusFilterInit.html#612d35c1dda338351f6da31935ff95fd">canidmr1</a>;
   396 <a name="l00375"></a>00375   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#6de09487a770c9cb36b6faa478cf7f1e">CANIDMR1</a>) = fi.<a class="code" href="structcanBusFilterInit.html#ced1e6e7a19564d3ea5228bd61b6f235">canidmr1</a>;
   397 <a name="l00376"></a>00376   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#b471d0faf75a4e68046160828b887d51">CANIDAR2</a>) = fi.<a class="code" href="structcanBusFilterInit.html#a16d44afd060e1c3ebf5cf66b2e8f9c4">canidar2</a>;
   397 <a name="l00376"></a>00376   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#797d179578bfa2f8b1c1a935eaf5623d">CANIDAR2</a>) = fi.<a class="code" href="structcanBusFilterInit.html#c124ee6cf0d365b7b4a36b60a7527191">canidar2</a>;
   398 <a name="l00377"></a>00377   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#e5aa4334289b65b624b4cc06f7aac76d">CANIDMR2</a>) = fi.<a class="code" href="structcanBusFilterInit.html#c5f7826dc1ec90e292f04ab1cb073a38">canidmr2</a>;
   398 <a name="l00377"></a>00377   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1cbb6468639d9ec26af7cc87ff4c450f">CANIDMR2</a>) = fi.<a class="code" href="structcanBusFilterInit.html#49dc105feb71df50a0af58069789f886">canidmr2</a>;
   399 <a name="l00378"></a>00378   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#41d16af61b06d38a97839682fb32fa05">CANIDAR3</a>) = fi.<a class="code" href="structcanBusFilterInit.html#0fd991a6f82c304f53acf589d4057133">canidar3</a>;
   399 <a name="l00378"></a>00378   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#7ce2e5be60fad5bee375577ed386d2f7">CANIDAR3</a>) = fi.<a class="code" href="structcanBusFilterInit.html#c72887349184517379bb501c5f554c96">canidar3</a>;
   400 <a name="l00379"></a>00379   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#4b3674e7abe7e40fddb90734d8db94a7">CANIDMR3</a>) = fi.<a class="code" href="structcanBusFilterInit.html#b4edcd131fa7b019f6dff0c1a5b68ce3">canidmr3</a>;
   400 <a name="l00379"></a>00379   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1595d4498f6fb3c1ca694893a635c125">CANIDMR3</a>) = fi.<a class="code" href="structcanBusFilterInit.html#08039c51e6ced8e7f58de19092126158">canidmr3</a>;
   401 <a name="l00380"></a>00380   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c84502ad2ee270b91a50128888db9950">CANIDAR4</a>) = fi.<a class="code" href="structcanBusFilterInit.html#083024dc3a47331c1d8914d863fa6d87">canidar4</a>;
   401 <a name="l00380"></a>00380   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#b604e6ea87ce0bfaaa6a086b5721d002">CANIDAR4</a>) = fi.<a class="code" href="structcanBusFilterInit.html#464b3b7f0e07f2ffc00becab1455a427">canidar4</a>;
   402 <a name="l00381"></a>00381   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1fd254d1f8422e3913232bf02ac7b2c3">CANIDMR4</a>) = fi.<a class="code" href="structcanBusFilterInit.html#a8615d16f68111163e5175543135b896">canidmr4</a>;
   402 <a name="l00381"></a>00381   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#9bcdc0123f160670c8710d3b5d2b8db2">CANIDMR4</a>) = fi.<a class="code" href="structcanBusFilterInit.html#b9a81efcfccd87a948d62bd769b26b61">canidmr4</a>;
   403 <a name="l00382"></a>00382   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#55febe15b73d53fc9fb77ee18da2ac61">CANIDAR5</a>) = fi.<a class="code" href="structcanBusFilterInit.html#8498a6166aa348baa5d5cc32e07bffb9">canidar5</a>;
   403 <a name="l00382"></a>00382   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#a3c7bd30f946d41e56ffd8f96da85801">CANIDAR5</a>) = fi.<a class="code" href="structcanBusFilterInit.html#1279a3436781a76dabb1258b53a83e6c">canidar5</a>;
   404 <a name="l00383"></a>00383   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#d7b533b251c9cca32c799be49e4631ee">CANIDMR5</a>) = fi.<a class="code" href="structcanBusFilterInit.html#5f0904c30b658b4a4ad59a8414df2e93">canidmr5</a>;
   404 <a name="l00383"></a>00383   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c3cbf3300f1dcfde7331ddcf4da9e007">CANIDMR5</a>) = fi.<a class="code" href="structcanBusFilterInit.html#afce7265d09631e57c049f90437f5708">canidmr5</a>;
   405 <a name="l00384"></a>00384   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#337dd0bc9f36b48b0e35f4113807f975">CANIDAR6</a>) = fi.<a class="code" href="structcanBusFilterInit.html#2194ca3ae6d6613b4f9a0db939661f0b">canidar6</a>;
   405 <a name="l00384"></a>00384   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f82e4a8ab50e2d2f349e362a76ccb2e1">CANIDAR6</a>) = fi.<a class="code" href="structcanBusFilterInit.html#3bb15152e7d9411fa8af42e856901670">canidar6</a>;
   406 <a name="l00385"></a>00385   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1240a26636e314e734c6c003ad20b09d">CANIDMR6</a>) = fi.<a class="code" href="structcanBusFilterInit.html#590926f6af0adac2fdce41d43d77fc61">canidmr6</a>;
   406 <a name="l00385"></a>00385   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c6551f48a876990b4a28604da2750bc9">CANIDMR6</a>) = fi.<a class="code" href="structcanBusFilterInit.html#544b671460d71c1cdf601cc5c357d43c">canidmr6</a>;
   407 <a name="l00386"></a>00386   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#472536c4281754452f359e467617e04e">CANIDAR7</a>) = fi.<a class="code" href="structcanBusFilterInit.html#5c00e7405a498d9eb55816573f12c125">canidar7</a>;
   407 <a name="l00386"></a>00386   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#523f1b8705f414b52fda63a0676f0418">CANIDAR7</a>) = fi.<a class="code" href="structcanBusFilterInit.html#10efad1ba33abe4fbc25f36abc169364">canidar7</a>;
   408 <a name="l00387"></a>00387   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1e2c3dfa167c21d6e7809162fe46b4fb">CANIDMR7</a>) = fi.<a class="code" href="structcanBusFilterInit.html#cde13291ed4cd72f9818efeb50a254fd">canidmr7</a>;
   408 <a name="l00387"></a>00387   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#a7fbd3471aa343d3222e8b94f3192d8c">CANIDMR7</a>) = fi.<a class="code" href="structcanBusFilterInit.html#56f25088d33f0cb1c0e305683c8235e1">canidmr7</a>;
   409 <a name="l00388"></a>00388   <span class="keywordflow">return</span> 0;
   409 <a name="l00388"></a>00388   <span class="keywordflow">return</span> 0;
   410 <a name="l00389"></a>00389 }
   410 <a name="l00389"></a>00389 }
   411 <a name="l00390"></a>00390 
   411 <a name="l00390"></a>00390 
   412 <a name="l00391"></a>00391 <span class="comment">/***************************************************************************/</span>
   412 <a name="l00391"></a>00391 <span class="comment">/***************************************************************************/</span>
   413 <a name="l00392"></a><a class="code" href="candriver_8h.html#0b98e4800c82d99981833aa4207f1eb9">00392</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#0b98e4800c82d99981833aa4207f1eb9">canInitMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   413 <a name="l00392"></a><a class="code" href="candriver_8h.html#daff5eaa25245bff93a854283e2e0cb2">00392</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#daff5eaa25245bff93a854283e2e0cb2">canInitMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   414 <a name="l00393"></a>00393 {
   414 <a name="l00393"></a>00393 {
   415 <a name="l00394"></a>00394   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) |= 0x01; <span class="comment">/* Set the bit INITRQ */</span> 
   415 <a name="l00394"></a>00394   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) |= 0x01; <span class="comment">/* Set the bit INITRQ */</span> 
   416 <a name="l00395"></a>00395   <span class="keywordflow">while</span> (! <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   416 <a name="l00395"></a>00395   <span class="keywordflow">while</span> (! <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   417 <a name="l00396"></a>00396   }
   417 <a name="l00396"></a>00396   }
   418 <a name="l00397"></a>00397   <span class="keywordflow">return</span> 0;
   418 <a name="l00397"></a>00397   <span class="keywordflow">return</span> 0;
   419 <a name="l00398"></a>00398 }
   419 <a name="l00398"></a>00398 }
   420 <a name="l00399"></a>00399 
   420 <a name="l00399"></a>00399 
   421 <a name="l00400"></a>00400 <span class="comment">/***************************************************************************/</span>
   421 <a name="l00400"></a>00400 <span class="comment">/***************************************************************************/</span>
   422 <a name="l00401"></a><a class="code" href="candriver_8h.html#00ffb46abacfdfa56ebc70e15164113e">00401</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#00ffb46abacfdfa56ebc70e15164113e">canInitModeQ</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   422 <a name="l00401"></a><a class="code" href="candriver_8h.html#a619f965cc88e08dec28de4833bfe50a">00401</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#a619f965cc88e08dec28de4833bfe50a">canInitModeQ</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   423 <a name="l00402"></a>00402 {
   423 <a name="l00402"></a>00402 {
   424 <a name="l00403"></a>00403   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) &amp;= 0xFE; <span class="comment">/* Clear the bit INITRQ */</span> 
   424 <a name="l00403"></a>00403   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) &amp;= 0xFE; <span class="comment">/* Clear the bit INITRQ */</span> 
   425 <a name="l00404"></a>00404   <span class="keywordflow">while</span> (<a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   425 <a name="l00404"></a>00404   <span class="keywordflow">while</span> (<a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   426 <a name="l00405"></a>00405   }
   426 <a name="l00405"></a>00405   }
   427 <a name="l00406"></a>00406   <span class="keywordflow">return</span> 0;
   427 <a name="l00406"></a>00406   <span class="keywordflow">return</span> 0;
   428 <a name="l00407"></a>00407 }
   428 <a name="l00407"></a>00407 }
   429 <a name="l00408"></a>00408 
   429 <a name="l00408"></a>00408 
   430 <a name="l00409"></a>00409 <span class="comment">/***************************************************************************/</span>
   430 <a name="l00409"></a>00409 <span class="comment">/***************************************************************************/</span>
   431 <a name="l00410"></a><a class="code" href="candriver_8h.html#2f2d1ed55cfd9d7f85883f8d70d318ba">00410</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#2f2d1ed55cfd9d7f85883f8d70d318ba">canMsgTransmit</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN, <a class="code" href="structMessage.html">Message</a> msg)
   431 <a name="l00410"></a><a class="code" href="candriver_8h.html#cd855997446329e6b6338fe8644edf11">00410</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#cd855997446329e6b6338fe8644edf11">canMsgTransmit</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN, <a class="code" href="structMessage.html">Message</a> msg)
   432 <a name="l00411"></a>00411 {
   432 <a name="l00411"></a>00411 {
   433 <a name="l00412"></a>00412   <span class="comment">/* Remind : only CAN A msg implemented. ie id on 11 bits, not 29 */</span>
   433 <a name="l00412"></a>00412   <span class="comment">/* Remind : only CAN A msg implemented. ie id on 11 bits, not 29 */</span>
   434 <a name="l00413"></a>00413   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> cantflg;
   434 <a name="l00413"></a>00413   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> cantflg;
   435 <a name="l00414"></a>00414   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> i;
   435 <a name="l00414"></a>00414   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> i;
   436 <a name="l00415"></a>00415   <span class="comment">/* Looking for a free buffer */</span>
   436 <a name="l00415"></a>00415   <span class="comment">/* Looking for a free buffer */</span>
   437 <a name="l00416"></a>00416   cantflg = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#8f7285c2e876851969acd7742776bb3a">CANTFLG</a>);
   437 <a name="l00416"></a>00416   cantflg = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0d4bda8f38a51aa06ed33a6d4979b628">CANTFLG</a>);
   438 <a name="l00417"></a>00417   <span class="keywordflow">if</span> ( cantflg == 0) { <span class="comment">/* all the TXEx are set */</span>
   438 <a name="l00417"></a>00417   <span class="keywordflow">if</span> ( cantflg == 0) { <span class="comment">/* all the TXEx are set */</span>
   439 <a name="l00418"></a>00418     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2604, <span class="stringliteral">"No buffer free. Msg to transmit is losted "</span>, 0);
   439 <a name="l00418"></a>00418     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2604, <span class="stringliteral">"No buffer free. Msg to transmit is losted "</span>, 0);
   440 <a name="l00419"></a>00419     <span class="keywordflow">return</span> 1; <span class="comment">/* No buffer free */</span>
   440 <a name="l00419"></a>00419     <span class="keywordflow">return</span> 1; <span class="comment">/* No buffer free */</span>
   441 <a name="l00420"></a>00420   }
   441 <a name="l00420"></a>00420   }
   442 <a name="l00421"></a>00421   <span class="keywordflow">else</span>{
   442 <a name="l00421"></a>00421   <span class="keywordflow">else</span>{
   443 <a name="l00422"></a>00422     <span class="comment">/* Selecting a buffer */</span>
   443 <a name="l00422"></a>00422     <span class="comment">/* Selecting a buffer */</span>
   444 <a name="l00423"></a>00423     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c074e4e6d925bb56de07c496125396f1">CANTBSEL</a>) = cantflg;
   444 <a name="l00423"></a>00423     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0816c00dc3a3c061ca02f33694066bae">CANTBSEL</a>) = cantflg;
   445 <a name="l00424"></a>00424     <span class="comment">/* We put ide = 0 because id is on 11 bits only */</span>
   445 <a name="l00424"></a>00424     <span class="comment">/* We put ide = 0 because id is on 11 bits only */</span>
   446 <a name="l00425"></a>00425      <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fb97dce806f082b839d90b94748f438f">CANTRSID</a>) = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>)(msg.<a class="code" href="structMessage.html#c5d40bde75d015beb48293c052a218b5">cob_id</a>.<a class="code" href="structSHORT__CAN.html#614e1c6a40f1261e2b15ad69b19e9698">w</a> &gt;&gt; 3);
   446 <a name="l00425"></a>00425      <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0a413814b056563ac46e1ce4675ea4bb">CANTRSID</a>) = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>)(msg.<a class="code" href="structMessage.html#21cda7edcf0800d296151c83e7f9948e">cob_id</a>.<a class="code" href="structSHORT__CAN.html#e77854035fa72dc0769724a2d056bc9d">w</a> &gt;&gt; 3);
   447 <a name="l00426"></a>00426     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fb97dce806f082b839d90b94748f438f">CANTRSID</a> + 1) = (<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a>)((msg.<a class="code" href="structMessage.html#c5d40bde75d015beb48293c052a218b5">cob_id</a>.<a class="code" href="structSHORT__CAN.html#614e1c6a40f1261e2b15ad69b19e9698">w</a> &lt;&lt; 5)|
   447 <a name="l00426"></a>00426     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0a413814b056563ac46e1ce4675ea4bb">CANTRSID</a> + 1) = (<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a>)((msg.<a class="code" href="structMessage.html#21cda7edcf0800d296151c83e7f9948e">cob_id</a>.<a class="code" href="structSHORT__CAN.html#e77854035fa72dc0769724a2d056bc9d">w</a> &lt;&lt; 5)|
   448 <a name="l00427"></a>00427     (msg.<a class="code" href="structMessage.html#41c5a4e7eaeb2c2ae1af2b2c83129615">rtr</a> &lt;&lt; 4));
   448 <a name="l00427"></a>00427     (msg.<a class="code" href="structMessage.html#4fea58e2ceec365228be253ba3d8bdba">rtr</a> &lt;&lt; 4));
   449 <a name="l00428"></a>00428    
   449 <a name="l00428"></a>00428    
   450 <a name="l00429"></a>00429     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#12905724f8db152e59625974ef95ab92">CANTRSLEN</a>) = msg.<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> &amp; 0X0F;
   450 <a name="l00429"></a>00429     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#d8f0f7ccd5cf8481e80c3b47f31fc5be">CANTRSLEN</a>) = msg.<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> &amp; 0X0F;
   451 <a name="l00430"></a>00430     <span class="comment">/* For the priority, we put the highter bits of the cob_id */</span>
   451 <a name="l00430"></a>00430     <span class="comment">/* For the priority, we put the highter bits of the cob_id */</span>
   452 <a name="l00431"></a>00431     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c5c8c8420c09b43f3493eb3bd4e3028a">CANTRSPRI</a>) = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fb97dce806f082b839d90b94748f438f">CANTRSID</a>);
   452 <a name="l00431"></a>00431     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#d93caa5ad078e519d8a6eec3a02e8701">CANTRSPRI</a>) = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0a413814b056563ac46e1ce4675ea4bb">CANTRSID</a>);
   453 <a name="l00432"></a>00432     <span class="keywordflow">for</span> (i = 0 ; i &lt; msg.<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> ; i++) {
   453 <a name="l00432"></a>00432     <span class="keywordflow">for</span> (i = 0 ; i &lt; msg.<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> ; i++) {
   454 <a name="l00433"></a>00433       <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#000be7a71981a5cceeb1fb12eb94c83a">CANTRSDTA</a> + i) = msg.<a class="code" href="structMessage.html#229865b09691e658677ba76f2d82ce89">data</a>[i];
   454 <a name="l00433"></a>00433       <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#500debcf90a527e67ef992a0c9bd2d60">CANTRSDTA</a> + i) = msg.<a class="code" href="structMessage.html#9f53ff2fea190c14dd66e2c92a32ec45">data</a>[i];
   455 <a name="l00434"></a>00434     } 
   455 <a name="l00434"></a>00434     } 
   456 <a name="l00435"></a>00435     <span class="comment">/* Transmitting the message */</span> 
   456 <a name="l00435"></a>00435     <span class="comment">/* Transmitting the message */</span> 
   457 <a name="l00436"></a>00436     cantflg = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c074e4e6d925bb56de07c496125396f1">CANTBSEL</a>);<span class="comment">/* to know which buf is selected */</span>
   457 <a name="l00436"></a>00436     cantflg = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0816c00dc3a3c061ca02f33694066bae">CANTBSEL</a>);<span class="comment">/* to know which buf is selected */</span>
   458 <a name="l00437"></a>00437     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#c074e4e6d925bb56de07c496125396f1">CANTBSEL</a>) = 0x00;  
   458 <a name="l00437"></a>00437     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0816c00dc3a3c061ca02f33694066bae">CANTBSEL</a>) = 0x00;  
   459 <a name="l00438"></a>00438     <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#8f7285c2e876851969acd7742776bb3a">CANTFLG</a>) = cantflg;  <span class="comment">/* Ready to transmit ! */</span>  
   459 <a name="l00438"></a>00438     <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#0d4bda8f38a51aa06ed33a6d4979b628">CANTFLG</a>) = cantflg;  <span class="comment">/* Ready to transmit ! */</span>  
   460 <a name="l00439"></a>00439   
   460 <a name="l00439"></a>00439   
   461 <a name="l00440"></a>00440  }
   461 <a name="l00440"></a>00440  }
   462 <a name="l00441"></a>00441   <span class="keywordflow">return</span> 0;
   462 <a name="l00441"></a>00441   <span class="keywordflow">return</span> 0;
   463 <a name="l00442"></a>00442 }
   463 <a name="l00442"></a>00442 }
   464 <a name="l00443"></a>00443 
   464 <a name="l00443"></a>00443 
   465 <a name="l00444"></a>00444 <span class="comment">/***************************************************************************/</span>
   465 <a name="l00444"></a>00444 <span class="comment">/***************************************************************************/</span>
   466 <a name="l00445"></a><a class="code" href="candriver_8h.html#5ad8616a3276f7f40149b551f09aa6a1">00445</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#5ad8616a3276f7f40149b551f09aa6a1">canSetInterrupt</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN) 
   466 <a name="l00445"></a><a class="code" href="candriver_8h.html#946843a5bc1823243b5120d57785f0ec">00445</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#946843a5bc1823243b5120d57785f0ec">canSetInterrupt</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN) 
   467 <a name="l00446"></a>00446 {
   467 <a name="l00446"></a>00446 {
   468 <a name="l00447"></a>00447   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#1b668ea916ba976c2dca30d5899c6b76">CANRIER</a>) = 0X01; <span class="comment">/* Allow interruptions on receive */</span>
   468 <a name="l00447"></a>00447   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#5afdf13c92c512f02a1051a5a6e18825">CANRIER</a>) = 0X01; <span class="comment">/* Allow interruptions on receive */</span>
   469 <a name="l00448"></a>00448   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f90f32e22218770bdac62099d0833f5c">CANTIER</a>) = 0X00; <span class="comment">/* disallow  interruptions on transmit */</span>
   469 <a name="l00448"></a>00448   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#4394bb307317dde2322fcc2103455a99">CANTIER</a>) = 0X00; <span class="comment">/* disallow  interruptions on transmit */</span>
   470 <a name="l00449"></a>00449   <span class="keywordflow">return</span> 0;  
   470 <a name="l00449"></a>00449   <span class="keywordflow">return</span> 0;  
   471 <a name="l00450"></a>00450 }
   471 <a name="l00450"></a>00450 }
   472 <a name="l00451"></a>00451 <span class="comment">/***************************************************************************/</span>
   472 <a name="l00451"></a>00451 <span class="comment">/***************************************************************************/</span>
   473 <a name="l00452"></a><a class="code" href="candriver_8h.html#c7773223579ec7e0fab5238df214da89">00452</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#c7773223579ec7e0fab5238df214da89">canSleepMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   473 <a name="l00452"></a><a class="code" href="candriver_8h.html#ce25028cdf7de7a16b2762cb3846ddd4">00452</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#ce25028cdf7de7a16b2762cb3846ddd4">canSleepMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   474 <a name="l00453"></a>00453 {
   474 <a name="l00453"></a>00453 {
   475 <a name="l00454"></a>00454   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) &amp;= 0xFB;   <span class="comment">/* clr the bit WUPE  to avoid a wake-up*/</span> 
   475 <a name="l00454"></a>00454   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) &amp;= 0xFB;   <span class="comment">/* clr the bit WUPE  to avoid a wake-up*/</span> 
   476 <a name="l00455"></a>00455   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) |= 0x02;   <span class="comment">/* Set the bit SLPRQ. go to Sleep !*/</span> 
   476 <a name="l00455"></a>00455   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) |= 0x02;   <span class="comment">/* Set the bit SLPRQ. go to Sleep !*/</span> 
   477 <a name="l00456"></a>00456 
   477 <a name="l00456"></a>00456 
   478 <a name="l00457"></a>00457    <span class="comment">// IO_PORTS_8(adrCAN + CANCTL1) |= 0x04;</span>
   478 <a name="l00457"></a>00457    <span class="comment">// IO_PORTS_8(adrCAN + CANCTL1) |= 0x04;</span>
   479 <a name="l00458"></a>00458    <span class="comment">// IO_PORTS_8(adrCAN + CANCTL0) |= 0x02;   /* Set the bit SLPRQ */ </span>
   479 <a name="l00458"></a>00458    <span class="comment">// IO_PORTS_8(adrCAN + CANCTL0) |= 0x02;   /* Set the bit SLPRQ */ </span>
   480 <a name="l00459"></a>00459    <span class="keywordflow">while</span> ( ! <a class="code" href="canOpenDriver_8c.html#fa79f2ac95a8143c2fb087260df39820">canTestSleepMode</a>(adrCAN)) {
   480 <a name="l00459"></a>00459    <span class="keywordflow">while</span> ( ! <a class="code" href="canOpenDriver_8c.html#008cc4a90d79b5ef1169d32a83947142">canTestSleepMode</a>(adrCAN)) {
   481 <a name="l00460"></a>00460      }
   481 <a name="l00460"></a>00460      }
   482 <a name="l00461"></a>00461 
   482 <a name="l00461"></a>00461 
   483 <a name="l00462"></a>00462   <span class="keywordflow">return</span> 0;
   483 <a name="l00462"></a>00462   <span class="keywordflow">return</span> 0;
   484 <a name="l00463"></a>00463 }
   484 <a name="l00463"></a>00463 }
   485 <a name="l00464"></a>00464 
   485 <a name="l00464"></a>00464 
   486 <a name="l00465"></a>00465 <span class="comment">/***************************************************************************/</span>
   486 <a name="l00465"></a>00465 <span class="comment">/***************************************************************************/</span>
   487 <a name="l00466"></a><a class="code" href="candriver_8h.html#a89f28005eea54f5b216eb72a18d45f3">00466</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#a89f28005eea54f5b216eb72a18d45f3">canSleepModeQ</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   487 <a name="l00466"></a><a class="code" href="candriver_8h.html#e147ca22aacafc3fa806f32f3f3577cb">00466</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#e147ca22aacafc3fa806f32f3f3577cb">canSleepModeQ</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   488 <a name="l00467"></a>00467 {
   488 <a name="l00467"></a>00467 {
   489 <a name="l00468"></a>00468   <span class="keywordflow">if</span> (<a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   489 <a name="l00468"></a>00468   <span class="keywordflow">if</span> (<a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   490 <a name="l00469"></a>00469     <span class="comment">/* Error because in init mode */</span>
   490 <a name="l00469"></a>00469     <span class="comment">/* Error because in init mode */</span>
   491 <a name="l00470"></a>00470     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2606, <span class="stringliteral">"not in init mode "</span>, 0);
   491 <a name="l00470"></a>00470     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2606, <span class="stringliteral">"not in init mode "</span>, 0);
   492 <a name="l00471"></a>00471     <span class="keywordflow">return</span> 1;   
   492 <a name="l00471"></a>00471     <span class="keywordflow">return</span> 1;   
   493 <a name="l00472"></a>00472   }
   493 <a name="l00472"></a>00472   }
   494 <a name="l00473"></a>00473   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) &amp;= 0xFD;   <span class="comment">/* clr the bit SLPRQ */</span> 
   494 <a name="l00473"></a>00473   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) &amp;= 0xFD;   <span class="comment">/* clr the bit SLPRQ */</span> 
   495 <a name="l00474"></a>00474     <span class="keywordflow">while</span> ( <a class="code" href="canOpenDriver_8c.html#fa79f2ac95a8143c2fb087260df39820">canTestSleepMode</a>(adrCAN)) {
   495 <a name="l00474"></a>00474     <span class="keywordflow">while</span> ( <a class="code" href="canOpenDriver_8c.html#008cc4a90d79b5ef1169d32a83947142">canTestSleepMode</a>(adrCAN)) {
   496 <a name="l00475"></a>00475     }
   496 <a name="l00475"></a>00475     }
   497 <a name="l00476"></a>00476   <span class="keywordflow">return</span> 0;
   497 <a name="l00476"></a>00476   <span class="keywordflow">return</span> 0;
   498 <a name="l00477"></a>00477 }
   498 <a name="l00477"></a>00477 }
   499 <a name="l00478"></a>00478  
   499 <a name="l00478"></a>00478  
   500 <a name="l00479"></a>00479 <span class="comment">/***************************************************************************/</span>
   500 <a name="l00479"></a>00479 <span class="comment">/***************************************************************************/</span>
   501 <a name="l00480"></a><a class="code" href="candriver_8h.html#1ae1ad5d66ac87085baf5b9d0a4e62ca">00480</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#1ae1ad5d66ac87085baf5b9d0a4e62ca">canSleepWupMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   501 <a name="l00480"></a><a class="code" href="candriver_8h.html#bb8b891e76257224f7c2e20d273c72a5">00480</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#bb8b891e76257224f7c2e20d273c72a5">canSleepWupMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   502 <a name="l00481"></a>00481 {
   502 <a name="l00481"></a>00481 {
   503 <a name="l00482"></a>00482   <span class="keywordflow">if</span> (<a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(adrCAN)) {
   503 <a name="l00482"></a>00482   <span class="keywordflow">if</span> (<a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(adrCAN)) {
   504 <a name="l00483"></a>00483     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2607, <span class="stringliteral">"not in init mode "</span>, 0);
   504 <a name="l00483"></a>00483     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2607, <span class="stringliteral">"not in init mode "</span>, 0);
   505 <a name="l00484"></a>00484     <span class="keywordflow">return</span> 1;   
   505 <a name="l00484"></a>00484     <span class="keywordflow">return</span> 1;   
   506 <a name="l00485"></a>00485   }
   506 <a name="l00485"></a>00485   }
   507 <a name="l00486"></a>00486   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) |= 0x06;   <span class="comment">/* Set the bits WUPE &amp; SLPRQ */</span> 
   507 <a name="l00486"></a>00486   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) |= 0x06;   <span class="comment">/* Set the bits WUPE &amp; SLPRQ */</span> 
   508 <a name="l00487"></a>00487   <span class="keywordflow">while</span> ( ! <a class="code" href="canOpenDriver_8c.html#fa79f2ac95a8143c2fb087260df39820">canTestSleepMode</a>(adrCAN)) {
   508 <a name="l00487"></a>00487   <span class="keywordflow">while</span> ( ! <a class="code" href="canOpenDriver_8c.html#008cc4a90d79b5ef1169d32a83947142">canTestSleepMode</a>(adrCAN)) {
   509 <a name="l00488"></a>00488   }
   509 <a name="l00488"></a>00488   }
   510 <a name="l00489"></a>00489   <span class="keywordflow">return</span> 0;
   510 <a name="l00489"></a>00489   <span class="keywordflow">return</span> 0;
   511 <a name="l00490"></a>00490 }
   511 <a name="l00490"></a>00490 }
   512 <a name="l00491"></a>00491 
   512 <a name="l00491"></a>00491 
   513 <a name="l00492"></a>00492 <span class="comment">/***************************************************************************/</span>
   513 <a name="l00492"></a>00492 <span class="comment">/***************************************************************************/</span>
   514 <a name="l00493"></a><a class="code" href="candriver_8h.html#6beefe951b3c9de786c585257488fa82">00493</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#6beefe951b3c9de786c585257488fa82">canTestInitMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   514 <a name="l00493"></a><a class="code" href="candriver_8h.html#101ff5d32d811e558e601083c84989fc">00493</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#101ff5d32d811e558e601083c84989fc">canTestInitMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   515 <a name="l00494"></a>00494 {
   515 <a name="l00494"></a>00494 {
   516 <a name="l00495"></a>00495   <span class="keywordflow">return</span> <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) &amp; 0x01; <span class="comment">/* Test the bit INITAK */</span>
   516 <a name="l00495"></a>00495   <span class="keywordflow">return</span> <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) &amp; 0x01; <span class="comment">/* Test the bit INITAK */</span>
   517 <a name="l00496"></a>00496 }
   517 <a name="l00496"></a>00496 }
   518 <a name="l00497"></a>00497 
   518 <a name="l00497"></a>00497 
   519 <a name="l00498"></a>00498 <span class="comment">/***************************************************************************/</span>
   519 <a name="l00498"></a>00498 <span class="comment">/***************************************************************************/</span>
   520 <a name="l00499"></a><a class="code" href="candriver_8h.html#fa79f2ac95a8143c2fb087260df39820">00499</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#fa79f2ac95a8143c2fb087260df39820">canTestSleepMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#5528eeccf214bfe021532622d78c6a96">UNS16</a> adrCAN)
   520 <a name="l00499"></a><a class="code" href="candriver_8h.html#008cc4a90d79b5ef1169d32a83947142">00499</a> <span class="keywordtype">char</span> <a class="code" href="canOpenDriver_8c.html#008cc4a90d79b5ef1169d32a83947142">canTestSleepMode</a>(<a class="code" href="hcs12_2applicfg_8h.html#14fad477a4a001f547db2731eaaaa1dc">UNS16</a> adrCAN)
   521 <a name="l00500"></a>00500 {
   521 <a name="l00500"></a>00500 {
   522 <a name="l00501"></a>00501   <span class="keywordflow">return</span> <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#240dfdca4d2f0ba1a1243fad55d96961">CANCTL1</a>) &amp; 0x02; <span class="comment">/* Test the bit SLPAK */</span>
   522 <a name="l00501"></a>00501   <span class="keywordflow">return</span> <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(adrCAN + <a class="code" href="ports__def_8h.html#dc473fd8956dd241e70312f35c6d8a6a">CANCTL1</a>) &amp; 0x02; <span class="comment">/* Test the bit SLPAK */</span>
   523 <a name="l00502"></a>00502 }
   523 <a name="l00502"></a>00502 }
   524 <a name="l00503"></a>00503 
   524 <a name="l00503"></a>00503 
   525 <a name="l00504"></a>00504 <span class="comment">/***************************************************************************/</span>
   525 <a name="l00504"></a>00504 <span class="comment">/***************************************************************************/</span>
   526 <a name="l00505"></a><a class="code" href="canOpenDriver_8c.html#b57b4b3c000e9f61135175495e874977">00505</a> <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> <a class="code" href="canOpenDriver_8c.html#b57b4b3c000e9f61135175495e874977">canSend</a>(<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *m)
   526 <a name="l00505"></a><a class="code" href="canOpenDriver_8c.html#fab789b9b2ee0ab6c6f27e67d6c03661">00505</a> <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> <a class="code" href="canOpenDriver_8c.html#fab789b9b2ee0ab6c6f27e67d6c03661">canSend</a>(<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *m)
   527 <a name="l00506"></a>00506 {
   527 <a name="l00506"></a>00506 {
   528 <a name="l00507"></a>00507   <a class="code" href="canOpenDriver_8c.html#2f2d1ed55cfd9d7f85883f8d70d318ba">canMsgTransmit</a>(<a class="code" href="candriver_8h.html#aec12501ba547723b21fd74636ea045a">CANOPEN_LINE_NUMBER_USED</a>, *m);
   528 <a name="l00507"></a>00507   <a class="code" href="canOpenDriver_8c.html#cd855997446329e6b6338fe8644edf11">canMsgTransmit</a>(<a class="code" href="candriver_8h.html#b790d6b6969e61da0bab8965d9b2a59e">CANOPEN_LINE_NUMBER_USED</a>, *m);
   529 <a name="l00508"></a>00508   <span class="keywordflow">return</span> 0;
   529 <a name="l00508"></a>00508   <span class="keywordflow">return</span> 0;
   530 <a name="l00509"></a>00509 }
   530 <a name="l00509"></a>00509 }
   531 <a name="l00510"></a>00510 
   531 <a name="l00510"></a>00510 
   532 <a name="l00511"></a>00511 
   532 <a name="l00511"></a>00511 
   533 <a name="l00512"></a>00512 <span class="comment">/**************************************************************************/</span>
   533 <a name="l00512"></a>00512 <span class="comment">/**************************************************************************/</span>
   534 <a name="l00513"></a><a class="code" href="canOpenDriver_8c.html#0bf58f014d47581c9ffd1b2db9a858d7">00513</a> <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> <a class="code" href="canOpenDriver_8c.html#0bf58f014d47581c9ffd1b2db9a858d7">f_can_receive</a>(<a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *msgRcv)
   534 <a name="l00513"></a><a class="code" href="canOpenDriver_8c.html#e9619ed76d03ed5c17ec07267bb61f4a">00513</a> <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> <a class="code" href="canOpenDriver_8c.html#e9619ed76d03ed5c17ec07267bb61f4a">f_can_receive</a>(<a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> notused, <a class="code" href="structMessage.html">Message</a> *msgRcv)
   535 <a name="l00514"></a>00514 { 
   535 <a name="l00514"></a>00514 { 
   536 <a name="l00515"></a>00515   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> i, j;
   536 <a name="l00515"></a>00515   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> i, j;
   537 <a name="l00516"></a>00516 
   537 <a name="l00516"></a>00516 
   538 <a name="l00517"></a>00517   <span class="keywordflow">switch</span> (<a class="code" href="candriver_8h.html#aec12501ba547723b21fd74636ea045a">CANOPEN_LINE_NUMBER_USED</a>) {
   538 <a name="l00517"></a>00517   <span class="keywordflow">switch</span> (<a class="code" href="candriver_8h.html#b790d6b6969e61da0bab8965d9b2a59e">CANOPEN_LINE_NUMBER_USED</a>) {
   539 <a name="l00518"></a>00518   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> : j = 0; <span class="keywordflow">break</span>;
   539 <a name="l00518"></a>00518   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> : j = 0; <span class="keywordflow">break</span>;
   540 <a name="l00519"></a>00519   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> : j = 1; <span class="keywordflow">break</span>;
   540 <a name="l00519"></a>00519   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> : j = 1; <span class="keywordflow">break</span>;
   541 <a name="l00520"></a>00520   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#c5e4c86ed487dc91418b156e24808033">CAN2</a> : j = 2; <span class="keywordflow">break</span>;
   541 <a name="l00520"></a>00520   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#c4d34af5dc6d4734591c6add92b92bd9">CAN2</a> : j = 2; <span class="keywordflow">break</span>;
   542 <a name="l00521"></a>00521   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#7f7e6a91346348125edf55235dd7b36a">CAN3</a> : j = 3; <span class="keywordflow">break</span>;
   542 <a name="l00521"></a>00521   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#b9cead8784df02e54b8f0b93efc68d20">CAN3</a> : j = 3; <span class="keywordflow">break</span>;
   543 <a name="l00522"></a>00522   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#0f0e1d717b051eb8002c096a58bdedad">CAN4</a> : j = 4; <span class="keywordflow">break</span>;
   543 <a name="l00522"></a>00522   <span class="keywordflow">case</span> <a class="code" href="ports__def_8h.html#b2e2f5ff1a49a5f6718493b39d11df3d">CAN4</a> : j = 4; <span class="keywordflow">break</span>;
   544 <a name="l00523"></a>00523   }
   544 <a name="l00523"></a>00523   }
   545 <a name="l00524"></a>00524 
   545 <a name="l00524"></a>00524 
   546 <a name="l00525"></a>00525   <span class="comment">/* See if a message is pending in the stack */</span>
   546 <a name="l00525"></a>00525   <span class="comment">/* See if a message is pending in the stack */</span>
   547 <a name="l00526"></a>00526   <span class="keywordflow">if</span> (ptrMsgRcv[j].r == ptrMsgRcv[j].w)
   547 <a name="l00526"></a>00526   <span class="keywordflow">if</span> (ptrMsgRcv[j].r == ptrMsgRcv[j].w)
   548 <a name="l00527"></a>00527     <span class="keywordflow">return</span> 0x0; <span class="comment">// No new message</span>
   548 <a name="l00527"></a>00527     <span class="keywordflow">return</span> 0x0; <span class="comment">// No new message</span>
   549 <a name="l00528"></a>00528 
   549 <a name="l00528"></a>00528 
   550 <a name="l00529"></a>00529   <span class="comment">/* Increment the reading pointer of the stack */</span>
   550 <a name="l00529"></a>00529   <span class="comment">/* Increment the reading pointer of the stack */</span>
   551 <a name="l00530"></a>00530   <span class="keywordflow">if</span> (ptrMsgRcv[j].r == (<a class="code" href="candriver_8h.html#604df069233e19d5960b444524a43042">MAX_STACK_MSG_RCV</a> - 1)) 
   551 <a name="l00530"></a>00530   <span class="keywordflow">if</span> (ptrMsgRcv[j].r == (<a class="code" href="candriver_8h.html#12ae319363148d264184861475351e3c">MAX_STACK_MSG_RCV</a> - 1)) 
   552 <a name="l00531"></a>00531      ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a> = 0;
   552 <a name="l00531"></a>00531      ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a> = 0;
   553 <a name="l00532"></a>00532   <span class="keywordflow">else</span>
   553 <a name="l00532"></a>00532   <span class="keywordflow">else</span>
   554 <a name="l00533"></a>00533     ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a> ++;
   554 <a name="l00533"></a>00533     ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a> ++;
   555 <a name="l00534"></a>00534 
   555 <a name="l00534"></a>00534 
   556 <a name="l00535"></a>00535   <span class="comment">/* Store the message from the stack*/</span>
   556 <a name="l00535"></a>00535   <span class="comment">/* Store the message from the stack*/</span>
   557 <a name="l00536"></a>00536   msgRcv-&gt;<a class="code" href="structMessage.html#c5d40bde75d015beb48293c052a218b5">cob_id</a>.<a class="code" href="structSHORT__CAN.html#614e1c6a40f1261e2b15ad69b19e9698">w</a> = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a>].<a class="code" href="structMessage.html#c5d40bde75d015beb48293c052a218b5">cob_id</a>.<a class="code" href="structSHORT__CAN.html#614e1c6a40f1261e2b15ad69b19e9698">w</a>;
   557 <a name="l00536"></a>00536   msgRcv-&gt;<a class="code" href="structMessage.html#21cda7edcf0800d296151c83e7f9948e">cob_id</a>.<a class="code" href="structSHORT__CAN.html#e77854035fa72dc0769724a2d056bc9d">w</a> = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a>].<a class="code" href="structMessage.html#21cda7edcf0800d296151c83e7f9948e">cob_id</a>.<a class="code" href="structSHORT__CAN.html#e77854035fa72dc0769724a2d056bc9d">w</a>;
   558 <a name="l00537"></a>00537   msgRcv-&gt;<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a>].<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a>;
   558 <a name="l00537"></a>00537   msgRcv-&gt;<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a>].<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a>;
   559 <a name="l00538"></a>00538   msgRcv-&gt;<a class="code" href="structMessage.html#41c5a4e7eaeb2c2ae1af2b2c83129615">rtr</a> = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a>].<a class="code" href="structMessage.html#41c5a4e7eaeb2c2ae1af2b2c83129615">rtr</a>;
   559 <a name="l00538"></a>00538   msgRcv-&gt;<a class="code" href="structMessage.html#4fea58e2ceec365228be253ba3d8bdba">rtr</a> = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a>].<a class="code" href="structMessage.html#4fea58e2ceec365228be253ba3d8bdba">rtr</a>;
   560 <a name="l00539"></a>00539   <span class="keywordflow">for</span> (i = 0 ; i &lt; stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a>].<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> ; i++)
   560 <a name="l00539"></a>00539   <span class="keywordflow">for</span> (i = 0 ; i &lt; stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a>].<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> ; i++)
   561 <a name="l00540"></a>00540     msgRcv-&gt;<a class="code" href="structMessage.html#229865b09691e658677ba76f2d82ce89">data</a>[i] = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#828854582cfd2d911935d50deec2f89e">r</a>].<a class="code" href="structMessage.html#229865b09691e658677ba76f2d82ce89">data</a>[i];
   561 <a name="l00540"></a>00540     msgRcv-&gt;<a class="code" href="structMessage.html#9f53ff2fea190c14dd66e2c92a32ec45">data</a>[i] = stackMsgRcv[j][ptrMsgRcv[j].<a class="code" href="structt__pointerStack.html#a276e252993440068b1bc44faaa53fd7">r</a>].<a class="code" href="structMessage.html#9f53ff2fea190c14dd66e2c92a32ec45">data</a>[i];
   562 <a name="l00541"></a>00541   <span class="keywordflow">return</span> 0xFF;
   562 <a name="l00541"></a>00541   <span class="keywordflow">return</span> 0xFF;
   563 <a name="l00542"></a>00542 }
   563 <a name="l00542"></a>00542 }
   564 <a name="l00543"></a>00543 
   564 <a name="l00543"></a>00543 
   565 <a name="l00544"></a>00544 
   565 <a name="l00544"></a>00544 
   566 <a name="l00545"></a>00545 <span class="comment">/******************************************************************************</span>
   566 <a name="l00545"></a>00545 <span class="comment">/******************************************************************************</span>
   567 <a name="l00546"></a>00546 <span class="comment"> ******************************* CAN INTERRUPT  *******************************/</span>
   567 <a name="l00546"></a>00546 <span class="comment"> ******************************* CAN INTERRUPT  *******************************/</span>
   568 <a name="l00547"></a>00547 
   568 <a name="l00547"></a>00547 
   569 <a name="l00548"></a>00548 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can0HdlTra (<span class="keywordtype">void</span>)
   569 <a name="l00548"></a>00548 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can0HdlTra (<span class="keywordtype">void</span>)
   570 <a name="l00549"></a>00549 {
   570 <a name="l00549"></a>00549 {
   571 <a name="l00550"></a>00550  
   571 <a name="l00550"></a>00550  
   572 <a name="l00551"></a>00551 }
   572 <a name="l00551"></a>00551 }
   573 <a name="l00552"></a>00552 
   573 <a name="l00552"></a>00552 
   574 <a name="l00553"></a>00553 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can0HdlRcv (<span class="keywordtype">void</span>)
   574 <a name="l00553"></a>00553 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can0HdlRcv (<span class="keywordtype">void</span>)
   575 <a name="l00554"></a>00554 { 
   575 <a name="l00554"></a>00554 { 
   576 <a name="l00555"></a>00555   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> i;
   576 <a name="l00555"></a>00555   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> i;
   577 <a name="l00556"></a>00556   <a class="code" href="interrupt_8c.html#eb99ff49b4a6d5157416f9b5bd0d9c2c">lock</a>();
   577 <a name="l00556"></a>00556   <a class="code" href="interrupt_8c.html#a86d31d31831be20de69b1533b4acc5b">lock</a>();
   578 <a name="l00557"></a>00557   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#09a0c85cd3da09d9cdf63a5ac4c39f77">PORTB</a>) &amp;= ~ 0x40; <span class="comment">// led 6 port B : ON</span>
   578 <a name="l00557"></a>00557   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#fce1812cd48acadd667a2f8f27f2ee8f">PORTB</a>) &amp;= ~ 0x40; <span class="comment">// led 6 port B : ON</span>
   579 <a name="l00558"></a>00558   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> NewPtrW; 
   579 <a name="l00558"></a>00558   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> NewPtrW; 
   580 <a name="l00559"></a>00559   <span class="comment">/* We are obliged to save the message while the interruption is pending */</span>
   580 <a name="l00559"></a>00559   <span class="comment">/* We are obliged to save the message while the interruption is pending */</span>
   581 <a name="l00560"></a>00560   <span class="comment">/* Increment the writing stack pointer before writing the msg */</span>
   581 <a name="l00560"></a>00560   <span class="comment">/* Increment the writing stack pointer before writing the msg */</span>
   582 <a name="l00561"></a>00561   <span class="keywordflow">if</span> (ptrMsgRcv[0].w == (<a class="code" href="candriver_8h.html#604df069233e19d5960b444524a43042">MAX_STACK_MSG_RCV</a> - 1)) 
   582 <a name="l00561"></a>00561   <span class="keywordflow">if</span> (ptrMsgRcv[0].w == (<a class="code" href="candriver_8h.html#12ae319363148d264184861475351e3c">MAX_STACK_MSG_RCV</a> - 1)) 
   583 <a name="l00562"></a>00562     NewPtrW = 0;
   583 <a name="l00562"></a>00562     NewPtrW = 0;
   584 <a name="l00563"></a>00563   <span class="keywordflow">else</span>
   584 <a name="l00563"></a>00563   <span class="keywordflow">else</span>
   585 <a name="l00564"></a>00564     NewPtrW = ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a> + 1;
   585 <a name="l00564"></a>00564     NewPtrW = ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a> + 1;
   586 <a name="l00565"></a>00565   
   586 <a name="l00565"></a>00565   
   587 <a name="l00566"></a>00566   <span class="keywordflow">if</span> (NewPtrW == ptrMsgRcv[0].r) {
   587 <a name="l00566"></a>00566   <span class="keywordflow">if</span> (NewPtrW == ptrMsgRcv[0].r) {
   588 <a name="l00567"></a>00567     <span class="comment">/* The stack is full. The last msg received before this one is lost */</span>
   588 <a name="l00567"></a>00567     <span class="comment">/* The stack is full. The last msg received before this one is lost */</span>
   589 <a name="l00568"></a>00568     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X1620, <span class="stringliteral">"Stack for received msg is full"</span>, 0);
   589 <a name="l00568"></a>00568     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X1620, <span class="stringliteral">"Stack for received msg is full"</span>, 0);
   590 <a name="l00569"></a>00569     <span class="comment">//IO_PORTS_8(PORTB) &amp;= ~0x40; // led  6         : ON (for debogue)</span>
   590 <a name="l00569"></a>00569     <span class="comment">//IO_PORTS_8(PORTB) &amp;= ~0x40; // led  6         : ON (for debogue)</span>
   591 <a name="l00570"></a>00570   }
   591 <a name="l00570"></a>00570   }
   592 <a name="l00571"></a>00571   <span class="keywordflow">else</span>
   592 <a name="l00571"></a>00571   <span class="keywordflow">else</span>
   593 <a name="l00572"></a>00572     ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a> = NewPtrW;
   593 <a name="l00572"></a>00572     ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a> = NewPtrW;
   594 <a name="l00573"></a>00573   
   594 <a name="l00573"></a>00573   
   595 <a name="l00574"></a>00574   <span class="comment">/* Store the message */</span>
   595 <a name="l00574"></a>00574   <span class="comment">/* Store the message */</span>
   596 <a name="l00575"></a>00575   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#c5d40bde75d015beb48293c052a218b5">cob_id</a>.<a class="code" href="structSHORT__CAN.html#614e1c6a40f1261e2b15ad69b19e9698">w</a> = <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> + <a class="code" href="ports__def_8h.html#bb97220e736e258a77d5fb130bab7e28">CANRCVID</a>) &gt;&gt; 5;
   596 <a name="l00575"></a>00575   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#21cda7edcf0800d296151c83e7f9948e">cob_id</a>.<a class="code" href="structSHORT__CAN.html#e77854035fa72dc0769724a2d056bc9d">w</a> = <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> + <a class="code" href="ports__def_8h.html#e6fccb26506e93da78ca409166ba984f">CANRCVID</a>) &gt;&gt; 5;
   597 <a name="l00576"></a>00576   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> + <a class="code" href="ports__def_8h.html#6ca4999d30f20b2d4fb3b830062cbdc9">CANRCVLEN</a>) &amp; 0x0F;
   597 <a name="l00576"></a>00576   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> + <a class="code" href="ports__def_8h.html#b150ea9c99a1703e1de51fa998809724">CANRCVLEN</a>) &amp; 0x0F;
   598 <a name="l00577"></a>00577   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#41c5a4e7eaeb2c2ae1af2b2c83129615">rtr</a> = (<a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> + <a class="code" href="ports__def_8h.html#bb97220e736e258a77d5fb130bab7e28">CANRCVID</a> + 1) &gt;&gt; 4) &amp; 0x01;
   598 <a name="l00577"></a>00577   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#4fea58e2ceec365228be253ba3d8bdba">rtr</a> = (<a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> + <a class="code" href="ports__def_8h.html#e6fccb26506e93da78ca409166ba984f">CANRCVID</a> + 1) &gt;&gt; 4) &amp; 0x01;
   599 <a name="l00578"></a>00578   <span class="keywordflow">for</span> (i = 0 ; i &lt; stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> ; i++)
   599 <a name="l00578"></a>00578   <span class="keywordflow">for</span> (i = 0 ; i &lt; stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> ; i++)
   600 <a name="l00579"></a>00579     stackMsgRcv[0][ptrMsgRcv[0].w].data[i] = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> + <a class="code" href="ports__def_8h.html#6b3563b008d40f60625c78849f9d9db5">CANRCVDTA</a> + i);
   600 <a name="l00579"></a>00579     stackMsgRcv[0][ptrMsgRcv[0].w].data[i] = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> + <a class="code" href="ports__def_8h.html#1e1c356434eb7ac633c5926fc9460ee7">CANRCVDTA</a> + i);
   601 <a name="l00580"></a>00580   
   601 <a name="l00580"></a>00580   
   602 <a name="l00581"></a>00581   <span class="comment">// The message is stored , so</span>
   602 <a name="l00581"></a>00581   <span class="comment">// The message is stored , so</span>
   603 <a name="l00582"></a>00582   <span class="comment">// we can now release the receive foreground buffer</span>
   603 <a name="l00582"></a>00582   <span class="comment">// we can now release the receive foreground buffer</span>
   604 <a name="l00583"></a>00583   <span class="comment">// and acknowledge the interruption</span>
   604 <a name="l00583"></a>00583   <span class="comment">// and acknowledge the interruption</span>
   605 <a name="l00584"></a>00584   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> + <a class="code" href="ports__def_8h.html#30e056d80073eebadfff9ba800b086f8">CANRFLG</a>) |= 0x01;
   605 <a name="l00584"></a>00584   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> + <a class="code" href="ports__def_8h.html#d8589b8a3435c835c3eec0e7917840e0">CANRFLG</a>) |= 0x01;
   606 <a name="l00585"></a>00585   <span class="comment">// Not very usefull</span>
   606 <a name="l00585"></a>00585   <span class="comment">// Not very usefull</span>
   607 <a name="l00586"></a>00586   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#8882ee5d18ec64b8193396ec6bc66fe5">CAN0</a> + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) |= 0x80;
   607 <a name="l00586"></a>00586   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#60f7f1ec9cb65946a45667f0ee19df87">CAN0</a> + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) |= 0x80;
   608 <a name="l00587"></a>00587   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#09a0c85cd3da09d9cdf63a5ac4c39f77">PORTB</a>) |= 0x40; <span class="comment">// led 6 port B : OFF</span>
   608 <a name="l00587"></a>00587   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#fce1812cd48acadd667a2f8f27f2ee8f">PORTB</a>) |= 0x40; <span class="comment">// led 6 port B : OFF</span>
   609 <a name="l00588"></a>00588   <a class="code" href="interrupt_8c.html#987ce601d6d4c8eedd68b58db3b7811a">unlock</a>();
   609 <a name="l00588"></a>00588   <a class="code" href="interrupt_8c.html#8704c06a2936e68f7c25dc0c1d335cca">unlock</a>();
   610 <a name="l00589"></a>00589 }
   610 <a name="l00589"></a>00589 }
   611 <a name="l00590"></a>00590 
   611 <a name="l00590"></a>00590 
   612 <a name="l00591"></a>00591 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can0HdlWup (<span class="keywordtype">void</span>)
   612 <a name="l00591"></a>00591 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can0HdlWup (<span class="keywordtype">void</span>)
   613 <a name="l00592"></a>00592 {
   613 <a name="l00592"></a>00592 {
   614 <a name="l00593"></a>00593 
   614 <a name="l00593"></a>00593 
   615 <a name="l00594"></a>00594 }
   615 <a name="l00594"></a>00594 }
   616 <a name="l00595"></a>00595 
   616 <a name="l00595"></a>00595 
   617 <a name="l00596"></a>00596 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can0HdlErr (<span class="keywordtype">void</span>)
   617 <a name="l00596"></a>00596 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can0HdlErr (<span class="keywordtype">void</span>)
   618 <a name="l00597"></a>00597 {
   618 <a name="l00597"></a>00597 {
   619 <a name="l00598"></a>00598 
   619 <a name="l00598"></a>00598 
   620 <a name="l00599"></a>00599 }
   620 <a name="l00599"></a>00599 }
   621 <a name="l00600"></a>00600 
   621 <a name="l00600"></a>00600 
   622 <a name="l00601"></a>00601 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can1HdlTra (<span class="keywordtype">void</span>)
   622 <a name="l00601"></a>00601 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can1HdlTra (<span class="keywordtype">void</span>)
   623 <a name="l00602"></a>00602 {
   623 <a name="l00602"></a>00602 {
   624 <a name="l00603"></a>00603  
   624 <a name="l00603"></a>00603  
   625 <a name="l00604"></a>00604 }
   625 <a name="l00604"></a>00604 }
   626 <a name="l00605"></a>00605 
   626 <a name="l00605"></a>00605 
   627 <a name="l00606"></a>00606 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can1HdlRcv (<span class="keywordtype">void</span>)
   627 <a name="l00606"></a>00606 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can1HdlRcv (<span class="keywordtype">void</span>)
   628 <a name="l00607"></a>00607 {
   628 <a name="l00607"></a>00607 {
   629 <a name="l00608"></a>00608   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> i;
   629 <a name="l00608"></a>00608   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> i;
   630 <a name="l00609"></a>00609   <a class="code" href="interrupt_8c.html#eb99ff49b4a6d5157416f9b5bd0d9c2c">lock</a>();
   630 <a name="l00609"></a>00609   <a class="code" href="interrupt_8c.html#a86d31d31831be20de69b1533b4acc5b">lock</a>();
   631 <a name="l00610"></a>00610   <a class="code" href="hcs12_2applicfg_8h.html#539234687760592d01a8b0d3357bc00e">UNS8</a> NewPtrW; 
   631 <a name="l00610"></a>00610   <a class="code" href="hcs12_2applicfg_8h.html#c2e754635928189b98cf3f5b7e6dbffb">UNS8</a> NewPtrW; 
   632 <a name="l00611"></a>00611   <span class="comment">/* We are obliged to save the message while the interruption is pending */</span>
   632 <a name="l00611"></a>00611   <span class="comment">/* We are obliged to save the message while the interruption is pending */</span>
   633 <a name="l00612"></a>00612   <span class="comment">/* Increment the writing stack pointer before writing the msg */</span>
   633 <a name="l00612"></a>00612   <span class="comment">/* Increment the writing stack pointer before writing the msg */</span>
   634 <a name="l00613"></a>00613   <span class="keywordflow">if</span> (ptrMsgRcv[1].w == (<a class="code" href="candriver_8h.html#604df069233e19d5960b444524a43042">MAX_STACK_MSG_RCV</a> - 1)) 
   634 <a name="l00613"></a>00613   <span class="keywordflow">if</span> (ptrMsgRcv[1].w == (<a class="code" href="candriver_8h.html#12ae319363148d264184861475351e3c">MAX_STACK_MSG_RCV</a> - 1)) 
   635 <a name="l00614"></a>00614     NewPtrW = 0;
   635 <a name="l00614"></a>00614     NewPtrW = 0;
   636 <a name="l00615"></a>00615   <span class="keywordflow">else</span>
   636 <a name="l00615"></a>00615   <span class="keywordflow">else</span>
   637 <a name="l00616"></a>00616     NewPtrW = ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a> + 1;
   637 <a name="l00616"></a>00616     NewPtrW = ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a> + 1;
   638 <a name="l00617"></a>00617   
   638 <a name="l00617"></a>00617   
   639 <a name="l00618"></a>00618   <span class="keywordflow">if</span> (NewPtrW == ptrMsgRcv[1].r) {
   639 <a name="l00618"></a>00618   <span class="keywordflow">if</span> (NewPtrW == ptrMsgRcv[1].r) {
   640 <a name="l00619"></a>00619     <span class="comment">/* The stack is full. The last msg received before this one is lost */</span>
   640 <a name="l00619"></a>00619     <span class="comment">/* The stack is full. The last msg received before this one is lost */</span>
   641 <a name="l00620"></a>00620     <a class="code" href="hcs12_2applicfg_8h.html#5f4e5133c4c3113931684d3aba518bba">MSG_WAR</a>(0X2620, <span class="stringliteral">"Stack for received msg is full"</span>, 0);
   641 <a name="l00620"></a>00620     <a class="code" href="hcs12_2applicfg_8h.html#d5dffc889e623fbc4f635e69276cdf20">MSG_WAR</a>(0X2620, <span class="stringliteral">"Stack for received msg is full"</span>, 0);
   642 <a name="l00621"></a>00621   }
   642 <a name="l00621"></a>00621   }
   643 <a name="l00622"></a>00622   <span class="keywordflow">else</span>
   643 <a name="l00622"></a>00622   <span class="keywordflow">else</span>
   644 <a name="l00623"></a>00623     ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a> = NewPtrW;
   644 <a name="l00623"></a>00623     ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a> = NewPtrW;
   645 <a name="l00624"></a>00624   
   645 <a name="l00624"></a>00624   
   646 <a name="l00625"></a>00625   <span class="comment">/* Store the message */</span>
   646 <a name="l00625"></a>00625   <span class="comment">/* Store the message */</span>
   647 <a name="l00626"></a>00626   stackMsgRcv[1][ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#c5d40bde75d015beb48293c052a218b5">cob_id</a>.<a class="code" href="structSHORT__CAN.html#614e1c6a40f1261e2b15ad69b19e9698">w</a> = <a class="code" href="portsaccess_8h.html#05c3e46f52e97cb343d4a18d3dbe2eba">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> + <a class="code" href="ports__def_8h.html#bb97220e736e258a77d5fb130bab7e28">CANRCVID</a>) &gt;&gt; 5;
   647 <a name="l00626"></a>00626   stackMsgRcv[1][ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#21cda7edcf0800d296151c83e7f9948e">cob_id</a>.<a class="code" href="structSHORT__CAN.html#e77854035fa72dc0769724a2d056bc9d">w</a> = <a class="code" href="portsaccess_8h.html#211ed1d0a2f0d5a31298728d8241fe08">IO_PORTS_16</a>(<a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> + <a class="code" href="ports__def_8h.html#e6fccb26506e93da78ca409166ba984f">CANRCVID</a>) &gt;&gt; 5;
   648 <a name="l00627"></a>00627   stackMsgRcv[1][ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> + <a class="code" href="ports__def_8h.html#6ca4999d30f20b2d4fb3b830062cbdc9">CANRCVLEN</a>) &amp; 0x0F;
   648 <a name="l00627"></a>00627   stackMsgRcv[1][ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> + <a class="code" href="ports__def_8h.html#b150ea9c99a1703e1de51fa998809724">CANRCVLEN</a>) &amp; 0x0F;
   649 <a name="l00628"></a>00628   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#41c5a4e7eaeb2c2ae1af2b2c83129615">rtr</a> = (<a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> + <a class="code" href="ports__def_8h.html#bb97220e736e258a77d5fb130bab7e28">CANRCVID</a> + 1) &gt;&gt; 4) &amp; 0x01;
   649 <a name="l00628"></a>00628   stackMsgRcv[0][ptrMsgRcv[0].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#4fea58e2ceec365228be253ba3d8bdba">rtr</a> = (<a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> + <a class="code" href="ports__def_8h.html#e6fccb26506e93da78ca409166ba984f">CANRCVID</a> + 1) &gt;&gt; 4) &amp; 0x01;
   650 <a name="l00629"></a>00629   <span class="keywordflow">for</span> (i = 0 ; i &lt; stackMsgRcv[1][ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#2932da8af07722bab7bb70042bca9e55">w</a>].<a class="code" href="structMessage.html#d1dd9a88dda088ff4c7073d49613613d">len</a> ; i++)
   650 <a name="l00629"></a>00629   <span class="keywordflow">for</span> (i = 0 ; i &lt; stackMsgRcv[1][ptrMsgRcv[1].<a class="code" href="structt__pointerStack.html#b07f5d836a93a8aabc84ce62b55d8aeb">w</a>].<a class="code" href="structMessage.html#a8c32de83f67079897508203c8e2198c">len</a> ; i++)
   651 <a name="l00630"></a>00630     stackMsgRcv[1][ptrMsgRcv[1].w].data[i] = <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> + <a class="code" href="ports__def_8h.html#6b3563b008d40f60625c78849f9d9db5">CANRCVDTA</a> + i);
   651 <a name="l00630"></a>00630     stackMsgRcv[1][ptrMsgRcv[1].w].data[i] = <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> + <a class="code" href="ports__def_8h.html#1e1c356434eb7ac633c5926fc9460ee7">CANRCVDTA</a> + i);
   652 <a name="l00631"></a>00631   
   652 <a name="l00631"></a>00631   
   653 <a name="l00632"></a>00632   <span class="comment">// The message is stored , so</span>
   653 <a name="l00632"></a>00632   <span class="comment">// The message is stored , so</span>
   654 <a name="l00633"></a>00633   <span class="comment">// we can now release the receive foreground buffer</span>
   654 <a name="l00633"></a>00633   <span class="comment">// we can now release the receive foreground buffer</span>
   655 <a name="l00634"></a>00634   <span class="comment">// and acknowledge the interruption</span>
   655 <a name="l00634"></a>00634   <span class="comment">// and acknowledge the interruption</span>
   656 <a name="l00635"></a>00635   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> + <a class="code" href="ports__def_8h.html#30e056d80073eebadfff9ba800b086f8">CANRFLG</a>) |= 0x01;
   656 <a name="l00635"></a>00635   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> + <a class="code" href="ports__def_8h.html#d8589b8a3435c835c3eec0e7917840e0">CANRFLG</a>) |= 0x01;
   657 <a name="l00636"></a>00636   <span class="comment">// Not very usefull</span>
   657 <a name="l00636"></a>00636   <span class="comment">// Not very usefull</span>
   658 <a name="l00637"></a>00637   <a class="code" href="portsaccess_8h.html#cdf97ea78c88c125dbbe6f2409de6ec1">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#4964ecb6a5c689aaf8ee2832b8093aac">CAN1</a> + <a class="code" href="ports__def_8h.html#fbdb48aab5af9bc4e1c286db2f4030f2">CANCTL0</a>) |= 0x80;
   658 <a name="l00637"></a>00637   <a class="code" href="portsaccess_8h.html#404819ab4502022c4943f130d7756ab8">IO_PORTS_8</a>(<a class="code" href="ports__def_8h.html#08dc9c08183160c51923e1f6fca78471">CAN1</a> + <a class="code" href="ports__def_8h.html#f9d979a53ab302013c59012f8d07c32d">CANCTL0</a>) |= 0x80;
   659 <a name="l00638"></a>00638   <a class="code" href="interrupt_8c.html#987ce601d6d4c8eedd68b58db3b7811a">unlock</a>();
   659 <a name="l00638"></a>00638   <a class="code" href="interrupt_8c.html#8704c06a2936e68f7c25dc0c1d335cca">unlock</a>();
   660 <a name="l00639"></a>00639 }
   660 <a name="l00639"></a>00639 }
   661 <a name="l00640"></a>00640 
   661 <a name="l00640"></a>00640 
   662 <a name="l00641"></a>00641 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can1HdlWup (<span class="keywordtype">void</span>)
   662 <a name="l00641"></a>00641 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can1HdlWup (<span class="keywordtype">void</span>)
   663 <a name="l00642"></a>00642 {
   663 <a name="l00642"></a>00642 {
   664 <a name="l00643"></a>00643 
   664 <a name="l00643"></a>00643 
   665 <a name="l00644"></a>00644 }
   665 <a name="l00644"></a>00644 }
   666 <a name="l00645"></a>00645 
   666 <a name="l00645"></a>00645 
   667 <a name="l00646"></a>00646 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can1HdlErr (<span class="keywordtype">void</span>)
   667 <a name="l00646"></a>00646 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can1HdlErr (<span class="keywordtype">void</span>)
   668 <a name="l00647"></a>00647 {
   668 <a name="l00647"></a>00647 {
   669 <a name="l00648"></a>00648 
   669 <a name="l00648"></a>00648 
   670 <a name="l00649"></a>00649 }
   670 <a name="l00649"></a>00649 }
   671 <a name="l00650"></a>00650 
   671 <a name="l00650"></a>00650 
   672 <a name="l00651"></a>00651 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can2HdlTra (<span class="keywordtype">void</span>)
   672 <a name="l00651"></a>00651 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can2HdlTra (<span class="keywordtype">void</span>)
   673 <a name="l00652"></a>00652 {
   673 <a name="l00652"></a>00652 {
   674 <a name="l00653"></a>00653 
   674 <a name="l00653"></a>00653 
   675 <a name="l00654"></a>00654 }
   675 <a name="l00654"></a>00654 }
   676 <a name="l00655"></a>00655 
   676 <a name="l00655"></a>00655 
   677 <a name="l00656"></a>00656 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can2HdlRcv (<span class="keywordtype">void</span>)
   677 <a name="l00656"></a>00656 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can2HdlRcv (<span class="keywordtype">void</span>)
   678 <a name="l00657"></a>00657 {
   678 <a name="l00657"></a>00657 {
   679 <a name="l00658"></a>00658 
   679 <a name="l00658"></a>00658 
   680 <a name="l00659"></a>00659 }
   680 <a name="l00659"></a>00659 }
   681 <a name="l00660"></a>00660 
   681 <a name="l00660"></a>00660 
   682 <a name="l00661"></a>00661 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can2HdlWup (<span class="keywordtype">void</span>)
   682 <a name="l00661"></a>00661 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can2HdlWup (<span class="keywordtype">void</span>)
   683 <a name="l00662"></a>00662 {
   683 <a name="l00662"></a>00662 {
   684 <a name="l00663"></a>00663 
   684 <a name="l00663"></a>00663 
   685 <a name="l00664"></a>00664 }
   685 <a name="l00664"></a>00664 }
   686 <a name="l00665"></a>00665 
   686 <a name="l00665"></a>00665 
   687 <a name="l00666"></a>00666 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can2HdlErr (<span class="keywordtype">void</span>)
   687 <a name="l00666"></a>00666 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can2HdlErr (<span class="keywordtype">void</span>)
   688 <a name="l00667"></a>00667 {
   688 <a name="l00667"></a>00667 {
   689 <a name="l00668"></a>00668 
   689 <a name="l00668"></a>00668 
   690 <a name="l00669"></a>00669 }
   690 <a name="l00669"></a>00669 }
   691 <a name="l00670"></a>00670 
   691 <a name="l00670"></a>00670 
   692 <a name="l00671"></a>00671 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can3HdlTra (<span class="keywordtype">void</span>)
   692 <a name="l00671"></a>00671 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can3HdlTra (<span class="keywordtype">void</span>)
   693 <a name="l00672"></a>00672 {
   693 <a name="l00672"></a>00672 {
   694 <a name="l00673"></a>00673 
   694 <a name="l00673"></a>00673 
   695 <a name="l00674"></a>00674 }
   695 <a name="l00674"></a>00674 }
   696 <a name="l00675"></a>00675 
   696 <a name="l00675"></a>00675 
   697 <a name="l00676"></a>00676 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can3HdlRcv (<span class="keywordtype">void</span>)
   697 <a name="l00676"></a>00676 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can3HdlRcv (<span class="keywordtype">void</span>)
   698 <a name="l00677"></a>00677 {
   698 <a name="l00677"></a>00677 {
   699 <a name="l00678"></a>00678 
   699 <a name="l00678"></a>00678 
   700 <a name="l00679"></a>00679 }
   700 <a name="l00679"></a>00679 }
   701 <a name="l00680"></a>00680 
   701 <a name="l00680"></a>00680 
   702 <a name="l00681"></a>00681 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can3HdlWup (<span class="keywordtype">void</span>)
   702 <a name="l00681"></a>00681 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can3HdlWup (<span class="keywordtype">void</span>)
   703 <a name="l00682"></a>00682 {
   703 <a name="l00682"></a>00682 {
   704 <a name="l00683"></a>00683 
   704 <a name="l00683"></a>00683 
   705 <a name="l00684"></a>00684 }
   705 <a name="l00684"></a>00684 }
   706 <a name="l00685"></a>00685 
   706 <a name="l00685"></a>00685 
   707 <a name="l00686"></a>00686 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can3HdlErr (<span class="keywordtype">void</span>)
   707 <a name="l00686"></a>00686 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can3HdlErr (<span class="keywordtype">void</span>)
   708 <a name="l00687"></a>00687 {
   708 <a name="l00687"></a>00687 {
   709 <a name="l00688"></a>00688 
   709 <a name="l00688"></a>00688 
   710 <a name="l00689"></a>00689 }
   710 <a name="l00689"></a>00689 }
   711 <a name="l00690"></a>00690 
   711 <a name="l00690"></a>00690 
   712 <a name="l00691"></a>00691 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can4HdlTra (<span class="keywordtype">void</span>)
   712 <a name="l00691"></a>00691 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can4HdlTra (<span class="keywordtype">void</span>)
   713 <a name="l00692"></a>00692 {
   713 <a name="l00692"></a>00692 {
   714 <a name="l00693"></a>00693 
   714 <a name="l00693"></a>00693 
   715 <a name="l00694"></a>00694 }
   715 <a name="l00694"></a>00694 }
   716 <a name="l00695"></a>00695 
   716 <a name="l00695"></a>00695 
   717 <a name="l00696"></a>00696 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can4HdlRcv (<span class="keywordtype">void</span>)
   717 <a name="l00696"></a>00696 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can4HdlRcv (<span class="keywordtype">void</span>)
   718 <a name="l00697"></a>00697 {
   718 <a name="l00697"></a>00697 {
   719 <a name="l00698"></a>00698 
   719 <a name="l00698"></a>00698 
   720 <a name="l00699"></a>00699 }
   720 <a name="l00699"></a>00699 }
   721 <a name="l00700"></a>00700 
   721 <a name="l00700"></a>00700 
   722 <a name="l00701"></a>00701 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can4HdlWup (<span class="keywordtype">void</span>)
   722 <a name="l00701"></a>00701 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can4HdlWup (<span class="keywordtype">void</span>)
   723 <a name="l00702"></a>00702 {
   723 <a name="l00702"></a>00702 {
   724 <a name="l00703"></a>00703 
   724 <a name="l00703"></a>00703 
   725 <a name="l00704"></a>00704 }
   725 <a name="l00704"></a>00704 }
   726 <a name="l00705"></a>00705 
   726 <a name="l00705"></a>00705 
   727 <a name="l00706"></a>00706 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#445500277ba0e363873b34cffc015745">__attribute__</a>((interrupt)) can4HdlErr (<span class="keywordtype">void</span>)
   727 <a name="l00706"></a>00706 <span class="keywordtype">void</span> <a class="code" href="canOpenDriver_8c.html#9d1d38ef63c4a40d5e7eabf64f332590">__attribute__</a>((interrupt)) can4HdlErr (<span class="keywordtype">void</span>)
   728 <a name="l00707"></a>00707 {
   728 <a name="l00707"></a>00707 {
   729 <a name="l00708"></a>00708 
   729 <a name="l00708"></a>00708 
   730 <a name="l00709"></a>00709 }
   730 <a name="l00709"></a>00709 }
   731 <a name="l00710"></a>00710 
   731 <a name="l00710"></a>00710 
   732 <a name="l00711"></a>00711 
   732 <a name="l00711"></a>00711 
   733 <a name="l00712"></a>00712 
   733 <a name="l00712"></a>00712 
   734 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 8 08:51:38 2007 for CanFestival by&nbsp;
   734 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Jul 2 19:10:16 2007 for CanFestival by&nbsp;
   735 <a href="http://www.doxygen.org/index.html">
   735 <a href="http://www.doxygen.org/index.html">
   736 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
   736 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
   737 </body>
   737 </body>
   738 </html>
   738 </html>