s3c2440 socketcan移植修改sja1000收发CAN数据帧

<pre name="code" class="html">最近花了俩天时间,研究了socketcan,俩天之后驱动调通,欣喜之情,难以言表,特把这俩天的移植过程与大家共分享。<p></p><p>制作CAN相关工具,参考以下博文</p><p><a target=_blank target="_blank" href="http://blog.chinaunix.net/uid-20680966-id-4585059.html" style="font-family: 微软雅黑, 黑体, Verdana; word-wrap: break-word; color: rgb(25, 89, 155); font-size: 20px; text-decoration: none;">交叉编译canutils与libsocketcan</a></p><p>编译过程如果提示<libsocketcan h="">, 终端输入export C_INCLUDE_PATH=$C_INCLUDE_PATH:这里添加<libsocketcan.h目录</libsocketcan></p><p>编译can-util我是用的是如下配置</p><p></p><pre class="plain" name="code">export C_INCLUDE_PATH=:/home/haoyupei/desktop/embeded_linux/yc2440/libsocketcan-0.0.10/include/:/home/haoyupei/desktop/embeded_linux/yc2440/libsocketcan-0.0.10/include/
./configure CC=“arm-none-linux-gnueabi-gcc -march=armv4t” 
--prefix=/home/haoyupei/desktop/embeded_linux/yc2440/canutils
 --host=arm-none-linux-gnueabi 
libsocketcan_LIBS=“-L/home/haoyupei/desktop/embeded_linux/yc2440/libsocketcan-0.0.10/src/.libs -lsocketcan”
 libsocketcan_CFLAGS=“-I/home/haoyupei/desktop/embeded_linux/yc2440/libsocketcan-0.0.10/include/”
 注意把双引号引起来 
 编译出来的canconfig candump cansend ...留着以后验证使用,必须是交叉编译的,因为要在s3c2440中运行。 

接下里就是移植修改sja1000了,这里我就不贴出来,sockcan的层次调用关系了,直接修改,修改之前备份源文件,以便将来恢复使用。

我这里使用的是linux3.2.65,操作IO的一些函数发生变化了,不过好在移植CAN的过程中没有用到

修改linux-3.2.65\drivers\net\can\sja1000\sja1000.h

 /* 
 
 * sja1000.h -  Philips SJA1000 network device driver
 *
 * Copyright (c) 2003 Matthias Brukner, Trajet Gmbh, Rebenring 33,
 * 38106 Braunschweig, GERMANY
 *
 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of Volkswagen nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * Alternatively, provided that this notice is retained in full, this
 * software may be distributed under the terms of the GNU General
 * Public License ("GPL") version 2, in which case the provisions of the
 * GPL apply INSTEAD OF those given above.
 *
 * The provided data structures and external interfaces from this code
 * are not restricted to be used by modules with a GPL compatible license.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, I
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值