doc/doxygen/html/canmsg_8h-source.html
author greg
Fri, 06 Jul 2007 10:53:15 +0200
changeset 239 f45fd4cd3832
parent 215 f49e5a6b7804
child 240 34654679f262
permissions -rw-r--r--
add auto-mapping tool (config_utils)
fix little bugs
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>CanFestival: drivers/can_lincan/canmsg.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>Globals</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_d58fb241e647de6212c31ecccf9cbace.html">drivers</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_8cdda103ce035ff7e5ef31864566c615.html">can_lincan</a></div>
<h1>canmsg.h</h1><a href="canmsg_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* canmsg.h - common kernel-space and user-space CAN message structure</span>
<a name="l00002"></a>00002 <span class="comment"> * Linux CAN-bus device driver.</span>
<a name="l00003"></a>00003 <span class="comment"> * Written by Pavel Pisa - OCERA team member</span>
<a name="l00004"></a>00004 <span class="comment"> * email:pisa@cmp.felk.cvut.cz</span>
<a name="l00005"></a>00005 <span class="comment"> * This software is released under the GPL-License.</span>
<a name="l00006"></a>00006 <span class="comment"> * Version lincan-0.3  17 Jun 2004</span>
<a name="l00007"></a>00007 <span class="comment"> */</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef _CANMSG_T_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define _CANMSG_T_H</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#ifdef __KERNEL__</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;linux/time.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;linux/types.h&gt;</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#else </span><span class="comment">/* __KERNEL__ */</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;sys/time.h&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#endif </span><span class="comment">/* __KERNEL__ */</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00026"></a>00026 <span class="preprocessor">#endif</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="comment">/*</span>
<a name="l00029"></a>00029 <span class="comment"> * CAN_MSG_VERSION_2 enables new canmsg_t layout compatible with</span>
<a name="l00030"></a>00030 <span class="comment"> * can4linux project from http://www.port.de/</span>
<a name="l00031"></a>00031 <span class="comment"> *</span>
<a name="l00032"></a>00032 <span class="comment"> */</span>
<a name="l00033"></a><a class="code" href="canmsg_8h.html#6e08f25b3a7951a82cc337505fc3c27a">00033</a> <span class="preprocessor">#define CAN_MSG_VERSION_2</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035 <span class="comment">/* Number of data bytes in one CAN message */</span>
<a name="l00036"></a><a class="code" href="canmsg_8h.html#eb09c576cda35f0ce23882b092679131">00036</a> <span class="preprocessor">#define CAN_MSG_LENGTH 8</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="preprocessor">#ifdef CAN_MSG_VERSION_2</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00040"></a><a class="code" href="canmsg_8h.html#f5a9ea1b33e64787190dccc1ce5419a2">00040</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>timeval canmsg_tstamp_t ;
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="canmsg_8h.html#4df2eff676652dbe67d372e42ccf8aa7">00042</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="canmsg_8h.html#4df2eff676652dbe67d372e42ccf8aa7">canmsg_id_t</a>;
<a name="l00043"></a>00043 
<a name="l00059"></a><a class="code" href="structcanmsg__t.html">00059</a> <span class="keyword">struct </span><a class="code" href="structcanmsg__t.html">canmsg_t</a> {
<a name="l00060"></a><a class="code" href="structcanmsg__t.html#beea8084650640976b9c94257623b735">00060</a>         <span class="keywordtype">int</span>             <a class="code" href="structcanmsg__t.html#beea8084650640976b9c94257623b735">flags</a>;
<a name="l00061"></a><a class="code" href="structcanmsg__t.html#2a9a1988755a4f92d5706f02cf5001f9">00061</a>         <span class="keywordtype">int</span>             <a class="code" href="structcanmsg__t.html#2a9a1988755a4f92d5706f02cf5001f9">cob</a>;
<a name="l00062"></a><a class="code" href="structcanmsg__t.html#9ca617a401250c914820ae4ed2768725">00062</a>         canmsg_id_t     <a class="code" href="structcanmsg__t.html#9ca617a401250c914820ae4ed2768725">id</a>;
<a name="l00063"></a><a class="code" href="structcanmsg__t.html#11568aa34f1851a87de25f6f0d6bbf8f">00063</a>         canmsg_tstamp_t <a class="code" href="structcanmsg__t.html#11568aa34f1851a87de25f6f0d6bbf8f">timestamp</a>;
<a name="l00064"></a><a class="code" href="structcanmsg__t.html#9b2006e54552e02778eea1da3ac52070">00064</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>  <a class="code" href="structcanmsg__t.html#9b2006e54552e02778eea1da3ac52070">length</a>;
<a name="l00065"></a><a class="code" href="structcanmsg__t.html#778d41b22a1ae1f0da4631885239a10c">00065</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>   <a class="code" href="structcanmsg__t.html#778d41b22a1ae1f0da4631885239a10c">data</a>[<a class="code" href="canmsg_8h.html#eb09c576cda35f0ce23882b092679131">CAN_MSG_LENGTH</a>];
<a name="l00066"></a>00066 };
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="preprocessor">#else </span><span class="comment">/*CAN_MSG_VERSION_2*/</span>
<a name="l00069"></a>00069 <span class="preprocessor">#ifndef PACKED</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#define PACKED __attribute__((packed))</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span><span class="comment">/* Old, deprecated version of canmsg_t structure */</span>
<a name="l00073"></a>00073 <span class="keyword">struct </span><a class="code" href="structcanmsg__t.html">canmsg_t</a> {
<a name="l00074"></a>00074         <span class="keywordtype">short</span>           <a class="code" href="structcanmsg__t.html#beea8084650640976b9c94257623b735">flags</a>;
<a name="l00075"></a>00075         <span class="keywordtype">int</span>             <a class="code" href="structcanmsg__t.html#2a9a1988755a4f92d5706f02cf5001f9">cob</a>;
<a name="l00076"></a>00076         canmsg_id_t     <a class="code" href="structcanmsg__t.html#9ca617a401250c914820ae4ed2768725">id</a>;
<a name="l00077"></a>00077         <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>   <a class="code" href="structcanmsg__t.html#11568aa34f1851a87de25f6f0d6bbf8f">timestamp</a>;
<a name="l00078"></a>00078         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>    <a class="code" href="structcanmsg__t.html#9b2006e54552e02778eea1da3ac52070">length</a>;
<a name="l00079"></a>00079         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>   <a class="code" href="structcanmsg__t.html#778d41b22a1ae1f0da4631885239a10c">data</a>[<a class="code" href="canmsg_8h.html#eb09c576cda35f0ce23882b092679131">CAN_MSG_LENGTH</a>];
<a name="l00080"></a>00080 } PACKED;
<a name="l00081"></a>00081 <span class="preprocessor">#endif </span><span class="comment">/*CAN_MSG_VERSION_2*/</span>
<a name="l00082"></a>00082 
<a name="l00083"></a><a class="code" href="canmsg_8h.html#be94973a423090a2a9a1c15a9479a920">00083</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structcanmsg__t.html">canmsg_t</a> <a class="code" href="canmsg_8h.html#be94973a423090a2a9a1c15a9479a920">canmsg_t</a>;
<a name="l00084"></a>00084 
<a name="l00105"></a><a class="code" href="structcanfilt__t.html">00105</a> <span class="keyword">struct </span><a class="code" href="structcanfilt__t.html">canfilt_t</a> {
<a name="l00106"></a><a class="code" href="structcanfilt__t.html#fdcc03f2a187f0b468081815c2f709c3">00106</a>         <span class="keywordtype">int</span>             <a class="code" href="structcanfilt__t.html#fdcc03f2a187f0b468081815c2f709c3">flags</a>;
<a name="l00107"></a><a class="code" href="structcanfilt__t.html#02e22abff78f9bdfb42a957d5beb4130">00107</a>         <span class="keywordtype">int</span>             <a class="code" href="structcanfilt__t.html#02e22abff78f9bdfb42a957d5beb4130">queid</a>;
<a name="l00108"></a><a class="code" href="structcanfilt__t.html#7d6d90e3ba8c36b857306873b1584005">00108</a>         <span class="keywordtype">int</span>             <a class="code" href="structcanfilt__t.html#7d6d90e3ba8c36b857306873b1584005">cob</a>;
<a name="l00109"></a><a class="code" href="structcanfilt__t.html#f53a58f5928e6832631bae811a93b1fb">00109</a>         canmsg_id_t     <a class="code" href="structcanfilt__t.html#f53a58f5928e6832631bae811a93b1fb">id</a>;
<a name="l00110"></a><a class="code" href="structcanfilt__t.html#0b1650e86282ed67271c33475c9aa72a">00110</a>         canmsg_id_t     <a class="code" href="structcanfilt__t.html#0b1650e86282ed67271c33475c9aa72a">mask</a>;
<a name="l00111"></a>00111 };
<a name="l00112"></a>00112 
<a name="l00113"></a><a class="code" href="canmsg_8h.html#d37d8411be50cb86c62113a96b56e120">00113</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structcanfilt__t.html">canfilt_t</a> <a class="code" href="canmsg_8h.html#d37d8411be50cb86c62113a96b56e120">canfilt_t</a>;
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 <span class="comment">/* Definitions to use for canmsg_t and canfilt_t flags */</span>
<a name="l00116"></a><a class="code" href="canmsg_8h.html#a17d9d21b15825ab928d225e6b317d26">00116</a> <span class="preprocessor">#define MSG_RTR   (1&lt;&lt;0)</span>
<a name="l00117"></a><a class="code" href="canmsg_8h.html#8a25d646d69812829a67d88e00245007">00117</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_OVR   (1&lt;&lt;1)</span>
<a name="l00118"></a><a class="code" href="canmsg_8h.html#973182db693bc55d98fafe82ad62f68c">00118</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_EXT   (1&lt;&lt;2)</span>
<a name="l00119"></a><a class="code" href="canmsg_8h.html#8371666c6983526f38115cda79f63d62">00119</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_LOCAL (1&lt;&lt;3)</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="comment">/* If you change above lines, check canque_filtid2internal function */</span>
<a name="l00121"></a>00121 
<a name="l00122"></a>00122 <span class="comment">/* Additional definitions used for canfilt_t only */</span>
<a name="l00123"></a><a class="code" href="canmsg_8h.html#664009574504682c47743d2a3690afa7">00123</a> <span class="preprocessor">#define MSG_FILT_MASK_SHIFT   8</span>
<a name="l00124"></a><a class="code" href="canmsg_8h.html#003ae3d402f58589544d93f02ae5e252">00124</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_RTR_MASK   (MSG_RTR&lt;&lt;MSG_FILT_MASK_SHIFT)</span>
<a name="l00125"></a><a class="code" href="canmsg_8h.html#4796f51e6847235d7fcb74b35a023f9f">00125</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_EXT_MASK   (MSG_EXT&lt;&lt;MSG_FILT_MASK_SHIFT)</span>
<a name="l00126"></a><a class="code" href="canmsg_8h.html#0fa902ccfba692bf3db9782496acc80b">00126</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_LOCAL_MASK (MSG_LOCAL&lt;&lt;MSG_FILT_MASK_SHIFT)</span>
<a name="l00127"></a><a class="code" href="canmsg_8h.html#2b53a66520d29f4df4473fff575ad417">00127</a> <span class="preprocessor"></span><span class="preprocessor">#define MSG_PROCESSLOCAL (MSG_OVR&lt;&lt;MSG_FILT_MASK_SHIFT)</span>
<a name="l00128"></a>00128 <span class="preprocessor"></span>
<a name="l00129"></a>00129 <span class="comment">/* Can message ID mask */</span>
<a name="l00130"></a><a class="code" href="canmsg_8h.html#9a9e40fdca7c76479284ba350e3c8506">00130</a> <span class="preprocessor">#define MSG_ID_MASK ((1l&lt;&lt;29)-1)</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span>
<a name="l00132"></a>00132 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span>} <span class="comment">/* extern "C"*/</span>
<a name="l00134"></a>00134 <span class="preprocessor">#endif</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span>
<a name="l00136"></a>00136 <span class="preprocessor">#endif </span><span class="comment">/*_CANMSG_T_H*/</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 8 08:51:38 2007 for CanFestival by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>