首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用SocketCAN编写自定义CAN协议

用SocketCAN编写自定义CAN协议
EN

Stack Overflow用户
提问于 2015-07-28 19:37:37
回答 1查看 1.8K关注 0票数 4

我正在尝试为SocketCAN编写一个稍微修改过的CAN协议。关于这一点,SocketCAN文档有一个简短的部分:

代码语言:javascript
复制
5.3 writing own CAN protocol modules

To implement a new protocol in the protocol family PF_CAN a new
protocol has to be defined in include/linux/can.h .
The prototypes and definitions to use the SocketCAN core can be
accessed by including include/linux/can/core.h .
In addition to functions that register the CAN protocol and the
CAN device notifier chain there are functions to subscribe CAN
frames received by CAN interfaces and to send CAN frames:

can_rx_register   - subscribe CAN frames from a specific interface
can_rx_unregister - unsubscribe CAN frames from a specific interface
can_send          - transmit a CAN frame (optional with local loopback)

For details see the kerneldoc documentation in net/can/af_can.c or
the source code of net/can/raw.c or net/can/bcm.c .

(https://www.kernel.org/doc/Documentation/networking/can.txt)

问题是我找不到这里引用的一些文件。我不太熟悉Linux内核,所以我不知道我是不是找错地方了。我可以找到include/linux/can.h和目录include/linux/can/,但是那里没有core.h文件。此外,我无法找到所引用的net/目录。

其他信息:

  • 我能够发送和接收原始的CAN帧,所以我相信我的SocketCAN设置是正确的。
  • 目录的内容(其中应该是core.h ): beaglebone:~# ls /usr/include/linux/can/ bcm.h错误.h gw.h netlink.h .h raw.h
  • 我在BeagleBone黑上使用Debian (我不确定我的系统的嵌入性是否会产生影响)

如果有人能帮我指出我应该在哪里寻找这些文件,我将非常感激。

非常感谢!

EN

回答 1

Stack Overflow用户

发布于 2020-07-19 16:28:27

CAN协议是在硬件中实现的;试图使不符合标准的数据包与兼容的硬件一起工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31685578

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档