Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
9b97b84e
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9b97b84e
编写于
6月 06, 2012
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://gitorious.org/linux-can/linux-can-next
上级
d7ce8a5f
d6e640f9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
27 deletion
+65
-27
Documentation/networking/can.txt
Documentation/networking/can.txt
+16
-16
drivers/net/can/flexcan.c
drivers/net/can/flexcan.c
+38
-0
include/linux/can.h
include/linux/can.h
+4
-4
include/linux/can/error.h
include/linux/can/error.h
+2
-2
net/can/af_can.c
net/can/af_can.c
+5
-5
未找到文件。
Documentation/networking/can.txt
浏览文件 @
9b97b84e
...
...
@@ -232,16 +232,16 @@ solution for a couple of reasons:
arbitration problems and error frames caused by the different
ECUs. The occurrence of detected errors are important for diagnosis
and have to be logged together with the exact timestamp. For this
reason the CAN interface driver can generate so called Error
Frames
that can optionally be passed to the user application in the sam
e
way as other CAN frames. Whenever an error on the physical layer
reason the CAN interface driver can generate so called Error
Message
Frames that can optionally be passed to the user application in th
e
same
way as other CAN frames. Whenever an error on the physical layer
or the MAC layer is detected (e.g. by the CAN controller) the driver
creates an appropriate error
frame. Error frames can be requested by
the user application using the common CAN filter mechanisms. Inside
this filter definition the (interested) type of errors may be
selected. The reception of error frames is disabled by default.
The format of the CAN error frame is briefly described in the Linux
header file "include/linux/can/error.h".
creates an appropriate error
message frame. Error messages frames can
be requested by the user application using the common CAN filter
mechanisms. Inside this filter definition the (interested) type of
errors may be selected. The reception of error messages is disabled
by default. The format of the CAN error message frame is briefly
described in the Linux
header file "include/linux/can/error.h".
4. How to use Socket CAN
------------------------
...
...
@@ -383,7 +383,7 @@ solution for a couple of reasons:
defaults are set at RAW socket binding time:
- The filters are set to exactly one filter receiving everything
- The socket only receives valid data frames (=> no error frames)
- The socket only receives valid data frames (=> no error
message
frames)
- The loopback of sent CAN frames is enabled (see chapter 3.2)
- The socket does not receive its own sent frames (in loopback mode)
...
...
@@ -434,7 +434,7 @@ solution for a couple of reasons:
4.1.2 RAW socket option CAN_RAW_ERR_FILTER
As described in chapter 3.4 the CAN interface driver can generate so
called Error Frames that can optionally be passed to the user
called Error
Message
Frames that can optionally be passed to the user
application in the same way as other CAN frames. The possible
errors are divided into different error classes that may be filtered
using the appropriate error mask. To register for every possible
...
...
@@ -527,7 +527,7 @@ solution for a couple of reasons:
rcvlist_all - list for unfiltered entries (no filter operations)
rcvlist_eff - list for single extended frame (EFF) entries
rcvlist_err - list for error frames masks
rcvlist_err - list for error
message
frames masks
rcvlist_fil - list for mask/value filters
rcvlist_inv - list for mask/value filters (inverse semantic)
rcvlist_sff - list for single standard frame (SFF) entries
...
...
@@ -784,13 +784,13 @@ solution for a couple of reasons:
$ ip link set canX type can restart-ms 100
Alternatively, the application may realize the "bus-off" condition
by monitoring CAN error
frames and do a restart when appropriate with
the command:
by monitoring CAN error
message frames and do a restart when
appropriate with
the command:
$ ip link set canX type can restart
Note that a restart will also create a CAN error
frame (see also
chapter 3.4).
Note that a restart will also create a CAN error
message frame (see
also
chapter 3.4).
6.6 Supported CAN hardware
...
...
drivers/net/can/flexcan.c
浏览文件 @
9b97b84e
...
...
@@ -1056,6 +1056,42 @@ static struct of_device_id flexcan_of_match[] = {
{},
};
#ifdef CONFIG_PM
static
int
flexcan_suspend
(
struct
platform_device
*
pdev
,
pm_message_t
state
)
{
struct
net_device
*
dev
=
platform_get_drvdata
(
pdev
);
struct
flexcan_priv
*
priv
=
netdev_priv
(
dev
);
flexcan_chip_disable
(
priv
);
if
(
netif_running
(
dev
))
{
netif_stop_queue
(
dev
);
netif_device_detach
(
dev
);
}
priv
->
can
.
state
=
CAN_STATE_SLEEPING
;
return
0
;
}
static
int
flexcan_resume
(
struct
platform_device
*
pdev
)
{
struct
net_device
*
dev
=
platform_get_drvdata
(
pdev
);
struct
flexcan_priv
*
priv
=
netdev_priv
(
dev
);
priv
->
can
.
state
=
CAN_STATE_ERROR_ACTIVE
;
if
(
netif_running
(
dev
))
{
netif_device_attach
(
dev
);
netif_start_queue
(
dev
);
}
flexcan_chip_enable
(
priv
);
return
0
;
}
#else
#define flexcan_suspend NULL
#define flexcan_resume NULL
#endif
static
struct
platform_driver
flexcan_driver
=
{
.
driver
=
{
.
name
=
DRV_NAME
,
...
...
@@ -1064,6 +1100,8 @@ static struct platform_driver flexcan_driver = {
},
.
probe
=
flexcan_probe
,
.
remove
=
__devexit_p
(
flexcan_remove
),
.
suspend
=
flexcan_suspend
,
.
resume
=
flexcan_resume
,
};
module_platform_driver
(
flexcan_driver
);
...
...
include/linux/can.h
浏览文件 @
9b97b84e
...
...
@@ -21,7 +21,7 @@
/* special address description flags for the CAN_ID */
#define CAN_EFF_FLAG 0x80000000U
/* EFF/SFF is set in the MSB */
#define CAN_RTR_FLAG 0x40000000U
/* remote transmission request */
#define CAN_ERR_FLAG 0x20000000U
/* error frame */
#define CAN_ERR_FLAG 0x20000000U
/* error
message
frame */
/* valid bits in CAN ID for frame formats */
#define CAN_SFF_MASK 0x000007FFU
/* standard frame format (SFF) */
...
...
@@ -32,14 +32,14 @@
* Controller Area Network Identifier structure
*
* bit 0-28 : CAN identifier (11/29 bit)
* bit 29 : error
frame flag (0 = data frame, 1 = error fram
e)
* bit 29 : error
message frame flag (0 = data frame, 1 = error messag
e)
* bit 30 : remote transmission request flag (1 = rtr frame)
* bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
*/
typedef
__u32
canid_t
;
/*
* Controller Area Network Error Frame Mask structure
* Controller Area Network Error
Message
Frame Mask structure
*
* bit 0-28 : error class mask (see include/linux/can/error.h)
* bit 29-31 : set to zero
...
...
@@ -97,7 +97,7 @@ struct sockaddr_can {
* <received_can_id> & mask == can_id & mask
*
* The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
* filter for error frames (CAN_ERR_FLAG bit set in mask).
* filter for error
message
frames (CAN_ERR_FLAG bit set in mask).
*/
struct
can_filter
{
canid_t
can_id
;
...
...
include/linux/can/error.h
浏览文件 @
9b97b84e
/*
* linux/can/error.h
*
* Definitions of the CAN error
frame
to be filtered and passed to the user.
* Definitions of the CAN error
messages
to be filtered and passed to the user.
*
* Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
...
...
@@ -12,7 +12,7 @@
#ifndef CAN_ERROR_H
#define CAN_ERROR_H
#define CAN_ERR_DLC 8
/* dlc for error frames */
#define CAN_ERR_DLC 8
/* dlc for error
message
frames */
/* error class (mask) in can_id */
#define CAN_ERR_TX_TIMEOUT 0x00000001U
/* TX timeout (by netdevice driver) */
...
...
net/can/af_can.c
浏览文件 @
9b97b84e
...
...
@@ -334,8 +334,8 @@ static struct dev_rcv_lists *find_dev_rcv_lists(struct net_device *dev)
* relevant bits for the filter.
*
* The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
* filter for error
frames (CAN_ERR_FLAG bit set in mask). For error frames
* there is a special filterlist and a special rx path filter handling.
* filter for error
messages (CAN_ERR_FLAG bit set in mask). For error msg
*
frames
there is a special filterlist and a special rx path filter handling.
*
* Return:
* Pointer to optimal filterlist for the given can_id/mask pair.
...
...
@@ -347,7 +347,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,
{
canid_t
inv
=
*
can_id
&
CAN_INV_FILTER
;
/* save flag before masking */
/* filter for error frames in extra filterlist */
/* filter for error
message
frames in extra filterlist */
if
(
*
mask
&
CAN_ERR_FLAG
)
{
/* clear CAN_ERR_FLAG in filter entry */
*
mask
&=
CAN_ERR_MASK
;
...
...
@@ -408,7 +408,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,
* <received_can_id> & mask == can_id & mask
*
* The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
* filter for error frames (CAN_ERR_FLAG bit set in mask).
* filter for error
message
frames (CAN_ERR_FLAG bit set in mask).
*
* The provided pointer to the sk_buff is guaranteed to be valid as long as
* the callback function is running. The callback function must *not* free
...
...
@@ -578,7 +578,7 @@ static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb)
return
0
;
if
(
can_id
&
CAN_ERR_FLAG
)
{
/* check for error frame entries only */
/* check for error
message
frame entries only */
hlist_for_each_entry_rcu
(
r
,
n
,
&
d
->
rx
[
RX_ERR
],
list
)
{
if
(
can_id
&
r
->
mask
)
{
deliver
(
skb
,
r
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录