drivers: can: rework zcan_frame and zcan_filter
Reordering of the struct elements to match the Linux format. The __packed() is not necessary anymore. std_id and ext_id is merged to id in the frame and filter. Additionally, the frames are ready for CAN-FD. Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
This commit is contained in:
parent
8b6c1bd4b7
commit
05275ecf6e
17 changed files with 206 additions and 235 deletions
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
#include <drivers/can.h>
|
#include <drivers/can.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
#include <sys/util.h>
|
||||||
|
|
||||||
#define LOG_LEVEL CONFIG_CAN_LOG_LEVEL
|
#define LOG_LEVEL CONFIG_CAN_LOG_LEVEL
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
LOG_MODULE_REGISTER(can_driver);
|
LOG_MODULE_REGISTER(can_driver);
|
||||||
|
|
||||||
#define CAN_CLAMP(val, min, max) MIN(MAX(val, min), max)
|
|
||||||
#define CAN_SYNC_SEG 1
|
#define CAN_SYNC_SEG 1
|
||||||
|
|
||||||
#define WORK_BUF_COUNT_IS_POWER_OF_2 !(CONFIG_CAN_WORKQ_FRAMES_BUF_CNT & \
|
#define WORK_BUF_COUNT_IS_POWER_OF_2 !(CONFIG_CAN_WORKQ_FRAMES_BUF_CNT & \
|
||||||
|
@ -36,9 +36,7 @@ static void can_msgq_put(struct zcan_frame *frame, void *arg)
|
||||||
|
|
||||||
ret = k_msgq_put(msgq, frame, K_NO_WAIT);
|
ret = k_msgq_put(msgq, frame, K_NO_WAIT);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_ERR("Msgq %p overflowed. Frame ID: 0x%x", arg,
|
LOG_ERR("Msgq %p overflowed. Frame ID: 0x%x", arg, frame->id);
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
frame->std_id : frame->ext_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,9 +120,7 @@ static void can_work_isr_put(struct zcan_frame *frame, void *arg)
|
||||||
|
|
||||||
ret = can_work_buffer_put(frame, &work->buf);
|
ret = can_work_buffer_put(frame, &work->buf);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_ERR("Workq buffer overflow. Msg ID: 0x%x",
|
LOG_ERR("Workq buffer overflow. Msg ID: 0x%x", frame->id);
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
frame->std_id : frame->ext_id);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +171,7 @@ static int update_sampling_pnt(uint32_t ts, uint32_t sp, struct can_timing *res,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res->prop_seg = CAN_CLAMP(ts1 / 2, min->prop_seg, max->prop_seg);
|
res->prop_seg = CLAMP(ts1 / 2, min->prop_seg, max->prop_seg);
|
||||||
res->phase_seg1 = ts1 - res->prop_seg;
|
res->phase_seg1 = ts1 - res->prop_seg;
|
||||||
res->phase_seg2 = ts2;
|
res->phase_seg2 = ts2;
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,7 @@ static void dispatch_frame(const struct zcan_frame *frame,
|
||||||
struct zcan_frame frame_tmp = *frame;
|
struct zcan_frame frame_tmp = *frame;
|
||||||
|
|
||||||
LOG_DBG("Receiving %d bytes. Id: 0x%x, ID type: %s %s",
|
LOG_DBG("Receiving %d bytes. Id: 0x%x, ID type: %s %s",
|
||||||
frame->dlc,
|
frame->dlc, frame->id,
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
frame->std_id : frame->ext_id,
|
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
||||||
"standard" : "extended",
|
"standard" : "extended",
|
||||||
frame->rtr == CAN_DATAFRAME ? "" : ", RTR frame");
|
frame->rtr == CAN_DATAFRAME ? "" : ", RTR frame");
|
||||||
|
@ -46,16 +44,8 @@ static void dispatch_frame(const struct zcan_frame *frame,
|
||||||
static inline int check_filter_match(const struct zcan_frame *frame,
|
static inline int check_filter_match(const struct zcan_frame *frame,
|
||||||
const struct zcan_filter *filter)
|
const struct zcan_filter *filter)
|
||||||
{
|
{
|
||||||
uint32_t id, mask, frame_id;
|
return ((filter->id & filter->id_mask) ==
|
||||||
|
(frame->id & filter->id_mask));
|
||||||
frame_id = frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
frame->std_id : frame->ext_id;
|
|
||||||
id = filter->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
filter->std_id : filter->ext_id;
|
|
||||||
mask = filter->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
filter->std_id_mask : filter->ext_id_mask;
|
|
||||||
|
|
||||||
return ((id & mask) == (frame_id & mask));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tx_thread(void *data_arg, void *arg2, void *arg3)
|
void tx_thread(void *data_arg, void *arg2, void *arg3)
|
||||||
|
@ -99,9 +89,7 @@ int can_loopback_send(const struct device *dev,
|
||||||
struct k_sem tx_sem;
|
struct k_sem tx_sem;
|
||||||
|
|
||||||
LOG_DBG("Sending %d bytes on %s. Id: 0x%x, ID type: %s %s",
|
LOG_DBG("Sending %d bytes on %s. Id: 0x%x, ID type: %s %s",
|
||||||
frame->dlc, dev->name,
|
frame->dlc, dev->name, frame->id,
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
|
||||||
frame->std_id : frame->ext_id,
|
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
||||||
"standard" : "extended",
|
"standard" : "extended",
|
||||||
frame->rtr == CAN_DATAFRAME ? "" : ", RTR frame");
|
frame->rtr == CAN_DATAFRAME ? "" : ", RTR frame");
|
||||||
|
@ -153,13 +141,13 @@ int can_loopback_attach_isr(const struct device *dev, can_rx_callback_t isr,
|
||||||
struct can_loopback_filter *loopback_filter;
|
struct can_loopback_filter *loopback_filter;
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
||||||
LOG_DBG("Setting filter ID: 0x%x, mask: 0x%x", filter->ext_id,
|
LOG_DBG("Setting filter ID: 0x%x, mask: 0x%x", filter->id,
|
||||||
filter->ext_id_mask);
|
filter->id_mask);
|
||||||
LOG_DBG("Filter type: %s ID %s mask",
|
LOG_DBG("Filter type: %s ID %s mask",
|
||||||
filter->id_type == CAN_STANDARD_IDENTIFIER ?
|
filter->id_type == CAN_STANDARD_IDENTIFIER ?
|
||||||
"standard" : "extended",
|
"standard" : "extended",
|
||||||
((filter->id_type && (filter->std_id_mask == CAN_STD_ID_MASK)) ||
|
((filter->id_type && (filter->id_mask == CAN_STD_ID_MASK)) ||
|
||||||
(!filter->id_type && (filter->ext_id_mask == CAN_EXT_ID_MASK))) ?
|
(!filter->id_type && (filter->id_mask == CAN_EXT_ID_MASK))) ?
|
||||||
"with" : "without");
|
"with" : "without");
|
||||||
|
|
||||||
k_mutex_lock(&data->mtx, K_FOREVER);
|
k_mutex_lock(&data->mtx, K_FOREVER);
|
||||||
|
|
|
@ -202,16 +202,16 @@ static void mcp2515_convert_zcanframe_to_mcp2515frame(const struct zcan_frame
|
||||||
uint8_t data_idx = 0U;
|
uint8_t data_idx = 0U;
|
||||||
|
|
||||||
if (source->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (source->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
target[MCP2515_FRAME_OFFSET_SIDH] = source->std_id >> 3;
|
target[MCP2515_FRAME_OFFSET_SIDH] = source->id >> 3;
|
||||||
target[MCP2515_FRAME_OFFSET_SIDL] =
|
target[MCP2515_FRAME_OFFSET_SIDL] =
|
||||||
(source->std_id & 0x07) << 5;
|
(source->id & 0x07) << 5;
|
||||||
} else {
|
} else {
|
||||||
target[MCP2515_FRAME_OFFSET_SIDH] = source->ext_id >> 21;
|
target[MCP2515_FRAME_OFFSET_SIDH] = source->id >> 21;
|
||||||
target[MCP2515_FRAME_OFFSET_SIDL] =
|
target[MCP2515_FRAME_OFFSET_SIDL] =
|
||||||
(((source->ext_id >> 18) & 0x07) << 5) | (BIT(3)) |
|
(((source->id >> 18) & 0x07) << 5) | (BIT(3)) |
|
||||||
((source->ext_id >> 16) & 0x03);
|
((source->id >> 16) & 0x03);
|
||||||
target[MCP2515_FRAME_OFFSET_EID8] = source->ext_id >> 8;
|
target[MCP2515_FRAME_OFFSET_EID8] = source->id >> 8;
|
||||||
target[MCP2515_FRAME_OFFSET_EID0] = source->ext_id;
|
target[MCP2515_FRAME_OFFSET_EID0] = source->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtr = (source->rtr == CAN_REMOTEREQUEST) ? BIT(6) : 0;
|
rtr = (source->rtr == CAN_REMOTEREQUEST) ? BIT(6) : 0;
|
||||||
|
@ -232,7 +232,7 @@ static void mcp2515_convert_mcp2515frame_to_zcanframe(const uint8_t *source,
|
||||||
|
|
||||||
if (source[MCP2515_FRAME_OFFSET_SIDL] & BIT(3)) {
|
if (source[MCP2515_FRAME_OFFSET_SIDL] & BIT(3)) {
|
||||||
target->id_type = CAN_EXTENDED_IDENTIFIER;
|
target->id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
target->ext_id =
|
target->id =
|
||||||
(source[MCP2515_FRAME_OFFSET_SIDH] << 21) |
|
(source[MCP2515_FRAME_OFFSET_SIDH] << 21) |
|
||||||
((source[MCP2515_FRAME_OFFSET_SIDL] >> 5) << 18) |
|
((source[MCP2515_FRAME_OFFSET_SIDL] >> 5) << 18) |
|
||||||
((source[MCP2515_FRAME_OFFSET_SIDL] & 0x03) << 16) |
|
((source[MCP2515_FRAME_OFFSET_SIDL] & 0x03) << 16) |
|
||||||
|
@ -240,7 +240,7 @@ static void mcp2515_convert_mcp2515frame_to_zcanframe(const uint8_t *source,
|
||||||
source[MCP2515_FRAME_OFFSET_EID0];
|
source[MCP2515_FRAME_OFFSET_EID0];
|
||||||
} else {
|
} else {
|
||||||
target->id_type = CAN_STANDARD_IDENTIFIER;
|
target->id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
target->std_id = (source[MCP2515_FRAME_OFFSET_SIDH] << 3) |
|
target->id = (source[MCP2515_FRAME_OFFSET_SIDH] << 3) |
|
||||||
(source[MCP2515_FRAME_OFFSET_SIDL] >> 5);
|
(source[MCP2515_FRAME_OFFSET_SIDL] >> 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,15 +556,9 @@ static uint8_t mcp2515_filter_match(struct zcan_frame *msg,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->id_type == CAN_STANDARD_IDENTIFIER) {
|
if ((msg->id ^ filter->id) & filter->id_mask) {
|
||||||
if ((msg->std_id ^ filter->std_id) & filter->std_id_mask) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if ((msg->ext_id ^ filter->ext_id) & filter->ext_id_mask) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,10 +177,10 @@ static void mcux_flexcan_copy_zframe_to_frame(const struct zcan_frame *src,
|
||||||
{
|
{
|
||||||
if (src->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (src->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
dest->format = kFLEXCAN_FrameFormatStandard;
|
dest->format = kFLEXCAN_FrameFormatStandard;
|
||||||
dest->id = FLEXCAN_ID_STD(src->std_id);
|
dest->id = FLEXCAN_ID_STD(src->id);
|
||||||
} else {
|
} else {
|
||||||
dest->format = kFLEXCAN_FrameFormatExtend;
|
dest->format = kFLEXCAN_FrameFormatExtend;
|
||||||
dest->id = FLEXCAN_ID_EXT(src->ext_id);
|
dest->id = FLEXCAN_ID_EXT(src->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->rtr == CAN_DATAFRAME) {
|
if (src->rtr == CAN_DATAFRAME) {
|
||||||
|
@ -199,10 +199,10 @@ static void mcux_flexcan_copy_frame_to_zframe(const flexcan_frame_t *src,
|
||||||
{
|
{
|
||||||
if (src->format == kFLEXCAN_FrameFormatStandard) {
|
if (src->format == kFLEXCAN_FrameFormatStandard) {
|
||||||
dest->id_type = CAN_STANDARD_IDENTIFIER;
|
dest->id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
dest->std_id = FLEXCAN_ID_TO_ZCAN_ID_STD(src->id);
|
dest->id = FLEXCAN_ID_TO_ZCAN_ID_STD(src->id);
|
||||||
} else {
|
} else {
|
||||||
dest->id_type = CAN_EXTENDED_IDENTIFIER;
|
dest->id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
dest->ext_id = FLEXCAN_ID_TO_ZCAN_ID_EXT(src->id);
|
dest->id = FLEXCAN_ID_TO_ZCAN_ID_EXT(src->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->type == kFLEXCAN_FrameTypeData) {
|
if (src->type == kFLEXCAN_FrameTypeData) {
|
||||||
|
@ -225,13 +225,13 @@ static void mcux_flexcan_copy_zfilter_to_mbconfig(const struct zcan_filter *src,
|
||||||
{
|
{
|
||||||
if (src->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (src->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
dest->format = kFLEXCAN_FrameFormatStandard;
|
dest->format = kFLEXCAN_FrameFormatStandard;
|
||||||
dest->id = FLEXCAN_ID_STD(src->std_id);
|
dest->id = FLEXCAN_ID_STD(src->id);
|
||||||
*mask = FLEXCAN_RX_MB_STD_MASK(src->std_id_mask,
|
*mask = FLEXCAN_RX_MB_STD_MASK(src->id_mask,
|
||||||
src->rtr & src->rtr_mask, 1);
|
src->rtr & src->rtr_mask, 1);
|
||||||
} else {
|
} else {
|
||||||
dest->format = kFLEXCAN_FrameFormatExtend;
|
dest->format = kFLEXCAN_FrameFormatExtend;
|
||||||
dest->id = FLEXCAN_ID_EXT(src->ext_id);
|
dest->id = FLEXCAN_ID_EXT(src->id);
|
||||||
*mask = FLEXCAN_RX_MB_EXT_MASK(src->ext_id_mask,
|
*mask = FLEXCAN_RX_MB_EXT_MASK(src->id_mask,
|
||||||
src->rtr & src->rtr_mask, 1);
|
src->rtr & src->rtr_mask, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,16 @@ static inline uint8_t can_get_frame_datalength(struct zcan_frame *frame)
|
||||||
|
|
||||||
static inline uint16_t can_get_lladdr_src(struct zcan_frame *frame)
|
static inline uint16_t can_get_lladdr_src(struct zcan_frame *frame)
|
||||||
{
|
{
|
||||||
return (frame->ext_id >> CAN_NET_IF_ADDR_SRC_POS) &
|
return (frame->id >> CAN_NET_IF_ADDR_SRC_POS) &
|
||||||
CAN_NET_IF_ADDR_MASK;
|
CAN_NET_IF_ADDR_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint16_t can_get_lladdr_dest(struct zcan_frame *frame)
|
static inline uint16_t can_get_lladdr_dest(struct zcan_frame *frame)
|
||||||
{
|
{
|
||||||
uint16_t addr = (frame->ext_id >> CAN_NET_IF_ADDR_DEST_POS) &
|
uint16_t addr = (frame->id >> CAN_NET_IF_ADDR_DEST_POS) &
|
||||||
CAN_NET_IF_ADDR_MASK;
|
CAN_NET_IF_ADDR_MASK;
|
||||||
|
|
||||||
if (frame->ext_id & CAN_NET_IF_ADDR_MCAST_MASK) {
|
if (frame->id & CAN_NET_IF_ADDR_MCAST_MASK) {
|
||||||
addr |= CAN_NET_IF_IS_MCAST_BIT;
|
addr |= CAN_NET_IF_IS_MCAST_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ static void net_can_recv(struct zcan_frame *frame, void *arg)
|
||||||
struct net_pkt *pkt;
|
struct net_pkt *pkt;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
NET_DBG("Frame with ID 0x%x received", frame->ext_id);
|
NET_DBG("Frame with ID 0x%x received", frame->id);
|
||||||
pkt = net_pkt_rx_alloc_with_buffer(ctx->iface, pkt_size, AF_UNSPEC, 0,
|
pkt = net_pkt_rx_alloc_with_buffer(ctx->iface, pkt_size, AF_UNSPEC, 0,
|
||||||
K_NO_WAIT);
|
K_NO_WAIT);
|
||||||
if (!pkt) {
|
if (!pkt) {
|
||||||
|
@ -147,14 +147,14 @@ static inline int attach_mcast_filter(struct net_can_context *ctx,
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_NET_IF_ADDR_MCAST_MASK |
|
.id_mask = CAN_NET_IF_ADDR_MCAST_MASK |
|
||||||
CAN_NET_IF_ADDR_DEST_MASK
|
CAN_NET_IF_ADDR_DEST_MASK
|
||||||
};
|
};
|
||||||
const uint16_t group =
|
const uint16_t group =
|
||||||
sys_be16_to_cpu(UNALIGNED_GET((&addr->s6_addr16[7])));
|
sys_be16_to_cpu(UNALIGNED_GET((&addr->s6_addr16[7])));
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
||||||
filter.ext_id = CAN_NET_IF_ADDR_MCAST_MASK |
|
filter.id = CAN_NET_IF_ADDR_MCAST_MASK |
|
||||||
((group & CAN_NET_IF_ADDR_MASK) <<
|
((group & CAN_NET_IF_ADDR_MASK) <<
|
||||||
CAN_NET_IF_ADDR_DEST_POS);
|
CAN_NET_IF_ADDR_DEST_POS);
|
||||||
|
|
||||||
|
@ -242,13 +242,13 @@ static inline int can_attach_unicast_filter(struct net_can_context *ctx)
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_NET_IF_ADDR_DEST_MASK
|
.id_mask = CAN_NET_IF_ADDR_DEST_MASK
|
||||||
};
|
};
|
||||||
const uint8_t *link_addr = net_if_get_link_addr(ctx->iface)->addr;
|
const uint8_t *link_addr = net_if_get_link_addr(ctx->iface)->addr;
|
||||||
const uint16_t dest = sys_be16_to_cpu(UNALIGNED_GET((uint16_t *) link_addr));
|
const uint16_t dest = sys_be16_to_cpu(UNALIGNED_GET((uint16_t *) link_addr));
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
||||||
filter.ext_id = (dest << CAN_NET_IF_ADDR_DEST_POS);
|
filter.id = (dest << CAN_NET_IF_ADDR_DEST_POS);
|
||||||
|
|
||||||
filter_id = can_attach_isr(ctx->can_dev, net_can_recv,
|
filter_id = can_attach_isr(ctx->can_dev, net_can_recv,
|
||||||
ctx, &filter);
|
ctx, &filter);
|
||||||
|
@ -269,8 +269,8 @@ static inline int can_attach_eth_bridge_filter(struct net_can_context *ctx)
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_NET_IF_ADDR_DEST_MASK,
|
.id_mask = CAN_NET_IF_ADDR_DEST_MASK,
|
||||||
.ext_id = (NET_CAN_ETH_TRANSLATOR_ADDR <<
|
.id = (NET_CAN_ETH_TRANSLATOR_ADDR <<
|
||||||
CAN_NET_IF_ADDR_DEST_POS)
|
CAN_NET_IF_ADDR_DEST_POS)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -294,8 +294,8 @@ static inline int can_attach_all_mcast_filter(struct net_can_context *ctx)
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_NET_IF_ADDR_MCAST_MASK,
|
.id_mask = CAN_NET_IF_ADDR_MCAST_MASK,
|
||||||
.ext_id = CAN_NET_IF_ADDR_MCAST_MASK
|
.id = CAN_NET_IF_ADDR_MCAST_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
|
@ -190,8 +190,7 @@ static void print_frame(struct zcan_frame *frame, void *arg)
|
||||||
const struct shell *shell = (const struct shell *)arg;
|
const struct shell *shell = (const struct shell *)arg;
|
||||||
|
|
||||||
shell_fprintf(shell, SHELL_NORMAL, "|0x%-8x|%s|%s|%d|",
|
shell_fprintf(shell, SHELL_NORMAL, "|0x%-8x|%s|%s|%d|",
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ?
|
frame->id,
|
||||||
frame->std_id : frame->ext_id,
|
|
||||||
frame->id_type == CAN_STANDARD_IDENTIFIER ? "std" : "ext",
|
frame->id_type == CAN_STANDARD_IDENTIFIER ? "std" : "ext",
|
||||||
frame->rtr ? "RTR" : " ", frame->dlc);
|
frame->rtr ? "RTR" : " ", frame->dlc);
|
||||||
|
|
||||||
|
@ -293,7 +292,7 @@ static int cmd_send(const struct shell *shell, size_t argc, char **argv)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.ext_id = id;
|
frame.id = id;
|
||||||
|
|
||||||
pos = read_data(shell, pos, argv, argc, frame.data, &frame.dlc);
|
pos = read_data(shell, pos, argv, argc, frame.data, &frame.dlc);
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
|
@ -301,8 +300,7 @@ static int cmd_send(const struct shell *shell, size_t argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
shell_print(shell, "Send frame with ID 0x%x (%s id) and %d data bytes",
|
shell_print(shell, "Send frame with ID 0x%x (%s id) and %d data bytes",
|
||||||
ext ? frame.ext_id : frame.std_id,
|
frame.id, ext ? "extended" : "standard", frame.dlc);
|
||||||
ext ? "extended" : "standard", frame.dlc);
|
|
||||||
|
|
||||||
ret = can_send(can_dev, &frame, K_FOREVER, NULL, NULL);
|
ret = can_send(can_dev, &frame, K_FOREVER, NULL, NULL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -344,16 +342,16 @@ static int cmd_attach(const struct shell *shell, size_t argc, char **argv)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
filter.ext_id = id;
|
filter.id = id;
|
||||||
|
|
||||||
if (pos != argc) {
|
if (pos != argc) {
|
||||||
pos = read_mask(shell, pos, argv, ext, &mask);
|
pos = read_mask(shell, pos, argv, ext, &mask);
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
filter.ext_id_mask = mask;
|
filter.id_mask = mask;
|
||||||
} else {
|
} else {
|
||||||
filter.ext_id_mask = ext ? CAN_EXT_ID_MASK : CAN_STD_ID_MASK;
|
filter.id_mask = ext ? CAN_EXT_ID_MASK : CAN_STD_ID_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos != argc) {
|
if (pos != argc) {
|
||||||
|
@ -367,9 +365,7 @@ static int cmd_attach(const struct shell *shell, size_t argc, char **argv)
|
||||||
|
|
||||||
shell_print(shell, "Attach filter with ID 0x%x (%s id) and mask 0x%x "
|
shell_print(shell, "Attach filter with ID 0x%x (%s id) and mask 0x%x "
|
||||||
" RTR: %d",
|
" RTR: %d",
|
||||||
ext ? filter.ext_id : filter.std_id,
|
filter.id, ext ? "extended" : "standard", filter.id_mask,
|
||||||
ext ? "extended" : "standard",
|
|
||||||
ext ? filter.ext_id_mask : filter.std_id_mask,
|
|
||||||
filter.rtr_mask);
|
filter.rtr_mask);
|
||||||
|
|
||||||
ret = can_attach_workq(can_dev, &k_sys_work_q, &work, print_frame,
|
ret = can_attach_workq(can_dev, &k_sys_work_q, &work, print_frame,
|
||||||
|
|
|
@ -47,10 +47,10 @@ static void can_stm32_get_msg_fifo(CAN_FIFOMailBox_TypeDef *mbox,
|
||||||
struct zcan_frame *msg)
|
struct zcan_frame *msg)
|
||||||
{
|
{
|
||||||
if (mbox->RIR & CAN_RI0R_IDE) {
|
if (mbox->RIR & CAN_RI0R_IDE) {
|
||||||
msg->ext_id = mbox->RIR >> CAN_RI0R_EXID_Pos;
|
msg->id = mbox->RIR >> CAN_RI0R_EXID_Pos;
|
||||||
msg->id_type = CAN_EXTENDED_IDENTIFIER;
|
msg->id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
} else {
|
} else {
|
||||||
msg->std_id = mbox->RIR >> CAN_RI0R_STID_Pos;
|
msg->id = mbox->RIR >> CAN_RI0R_STID_Pos;
|
||||||
msg->id_type = CAN_STANDARD_IDENTIFIER;
|
msg->id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,8 +603,7 @@ int can_stm32_send(const struct device *dev, const struct zcan_frame *msg,
|
||||||
"ID type: %s, "
|
"ID type: %s, "
|
||||||
"Remote Frame: %s"
|
"Remote Frame: %s"
|
||||||
, msg->dlc, dev->name
|
, msg->dlc, dev->name
|
||||||
, msg->id_type == CAN_STANDARD_IDENTIFIER ?
|
, msg->id
|
||||||
msg->std_id : msg->ext_id
|
|
||||||
, msg->id_type == CAN_STANDARD_IDENTIFIER ?
|
, msg->id_type == CAN_STANDARD_IDENTIFIER ?
|
||||||
"standard" : "extended"
|
"standard" : "extended"
|
||||||
, msg->rtr == CAN_DATAFRAME ? "no" : "yes");
|
, msg->rtr == CAN_DATAFRAME ? "no" : "yes");
|
||||||
|
@ -654,9 +653,9 @@ int can_stm32_send(const struct device *dev, const struct zcan_frame *msg,
|
||||||
mailbox->TIR &= CAN_TI0R_TXRQ;
|
mailbox->TIR &= CAN_TI0R_TXRQ;
|
||||||
|
|
||||||
if (msg->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (msg->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
mailbox->TIR |= (msg->std_id << CAN_TI0R_STID_Pos);
|
mailbox->TIR |= (msg->id << CAN_TI0R_STID_Pos);
|
||||||
} else {
|
} else {
|
||||||
mailbox->TIR |= (msg->ext_id << CAN_TI0R_EXID_Pos)
|
mailbox->TIR |= (msg->id << CAN_TI0R_EXID_Pos)
|
||||||
| CAN_TI0R_IDE;
|
| CAN_TI0R_IDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,14 +835,14 @@ static inline void can_stm32_set_mode_scale(enum can_filter_type filter_type,
|
||||||
|
|
||||||
static inline uint32_t can_generate_std_mask(const struct zcan_filter *filter)
|
static inline uint32_t can_generate_std_mask(const struct zcan_filter *filter)
|
||||||
{
|
{
|
||||||
return (filter->std_id_mask << CAN_FIRX_STD_ID_POS) |
|
return (filter->id_mask << CAN_FIRX_STD_ID_POS) |
|
||||||
(filter->rtr_mask << CAN_FIRX_STD_RTR_POS) |
|
(filter->rtr_mask << CAN_FIRX_STD_RTR_POS) |
|
||||||
(1U << CAN_FIRX_STD_IDE_POS);
|
(1U << CAN_FIRX_STD_IDE_POS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t can_generate_ext_mask(const struct zcan_filter *filter)
|
static inline uint32_t can_generate_ext_mask(const struct zcan_filter *filter)
|
||||||
{
|
{
|
||||||
return (filter->ext_id_mask << CAN_FIRX_EXT_EXT_ID_POS) |
|
return (filter->id_mask << CAN_FIRX_EXT_EXT_ID_POS) |
|
||||||
(filter->rtr_mask << CAN_FIRX_EXT_RTR_POS) |
|
(filter->rtr_mask << CAN_FIRX_EXT_RTR_POS) |
|
||||||
(1U << CAN_FIRX_EXT_IDE_POS);
|
(1U << CAN_FIRX_EXT_IDE_POS);
|
||||||
}
|
}
|
||||||
|
@ -851,14 +850,14 @@ static inline uint32_t can_generate_ext_mask(const struct zcan_filter *filter)
|
||||||
static inline uint32_t can_generate_std_id(const struct zcan_filter *filter)
|
static inline uint32_t can_generate_std_id(const struct zcan_filter *filter)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (filter->std_id << CAN_FIRX_STD_ID_POS) |
|
return (filter->id << CAN_FIRX_STD_ID_POS) |
|
||||||
(filter->rtr << CAN_FIRX_STD_RTR_POS);
|
(filter->rtr << CAN_FIRX_STD_RTR_POS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t can_generate_ext_id(const struct zcan_filter *filter)
|
static inline uint32_t can_generate_ext_id(const struct zcan_filter *filter)
|
||||||
{
|
{
|
||||||
return (filter->ext_id << CAN_FIRX_EXT_EXT_ID_POS) |
|
return (filter->id << CAN_FIRX_EXT_EXT_ID_POS) |
|
||||||
(filter->rtr << CAN_FIRX_EXT_RTR_POS) |
|
(filter->rtr << CAN_FIRX_EXT_RTR_POS) |
|
||||||
(1U << CAN_FIRX_EXT_IDE_POS);
|
(1U << CAN_FIRX_EXT_IDE_POS);
|
||||||
}
|
}
|
||||||
|
@ -882,7 +881,7 @@ static inline int can_stm32_set_filter(const struct zcan_filter *filter,
|
||||||
id = can_generate_std_id(filter);
|
id = can_generate_std_id(filter);
|
||||||
filter_type = CAN_FILTER_STANDARD;
|
filter_type = CAN_FILTER_STANDARD;
|
||||||
|
|
||||||
if (filter->std_id_mask != CAN_STD_ID_MASK) {
|
if (filter->id_mask != CAN_STD_ID_MASK) {
|
||||||
mask = can_generate_std_mask(filter);
|
mask = can_generate_std_mask(filter);
|
||||||
filter_type = CAN_FILTER_STANDARD_MASKED;
|
filter_type = CAN_FILTER_STANDARD_MASKED;
|
||||||
}
|
}
|
||||||
|
@ -890,7 +889,7 @@ static inline int can_stm32_set_filter(const struct zcan_filter *filter,
|
||||||
id = can_generate_ext_id(filter);
|
id = can_generate_ext_id(filter);
|
||||||
filter_type = CAN_FILTER_EXTENDED;
|
filter_type = CAN_FILTER_EXTENDED;
|
||||||
|
|
||||||
if (filter->ext_id_mask != CAN_EXT_ID_MASK) {
|
if (filter->id_mask != CAN_EXT_ID_MASK) {
|
||||||
mask = can_generate_ext_mask(filter);
|
mask = can_generate_ext_mask(filter);
|
||||||
filter_type = CAN_FILTER_EXTENDED_MASKED;
|
filter_type = CAN_FILTER_EXTENDED_MASKED;
|
||||||
}
|
}
|
||||||
|
@ -898,8 +897,8 @@ static inline int can_stm32_set_filter(const struct zcan_filter *filter,
|
||||||
|
|
||||||
register_demand = reg_demand[filter_type];
|
register_demand = reg_demand[filter_type];
|
||||||
|
|
||||||
LOG_DBG("Setting filter ID: 0x%x, mask: 0x%x", filter->ext_id,
|
LOG_DBG("Setting filter ID: 0x%x, mask: 0x%x", filter->id,
|
||||||
filter->ext_id_mask);
|
filter->id_mask);
|
||||||
LOG_DBG("Filter type: %s ID %s mask (%d)",
|
LOG_DBG("Filter type: %s ID %s mask (%d)",
|
||||||
(filter_type == CAN_FILTER_STANDARD ||
|
(filter_type == CAN_FILTER_STANDARD ||
|
||||||
filter_type == CAN_FILTER_STANDARD_MASKED) ?
|
filter_type == CAN_FILTER_STANDARD_MASKED) ?
|
||||||
|
|
|
@ -98,7 +98,7 @@ enum can_mode {
|
||||||
/*Controller is in loopback mode (receive own messages)*/
|
/*Controller is in loopback mode (receive own messages)*/
|
||||||
CAN_LOOPBACK_MODE,
|
CAN_LOOPBACK_MODE,
|
||||||
/*Combination of loopback and silent*/
|
/*Combination of loopback and silent*/
|
||||||
CAN_SILENT_LOOPBACK_MODE,
|
CAN_SILENT_LOOPBACK_MODE
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,34 +167,44 @@ struct can_filter {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct zcan_frame {
|
struct zcan_frame {
|
||||||
/** Indicates the identifier type (standard or extended)
|
/** Message identifier*/
|
||||||
* use can_ide enum for assignment
|
uint32_t id : 29;
|
||||||
*/
|
/** Frame is in the CAN-FD frame format */
|
||||||
uint32_t id_type : 1;
|
uint32_t fd : 1;
|
||||||
/** Set the message to a transmission request instead of data frame
|
/** Set the message to a transmission request instead of data frame
|
||||||
* use can_rtr enum for assignment
|
* use can_rtr enum for assignment
|
||||||
*/
|
*/
|
||||||
uint32_t rtr : 1;
|
uint32_t rtr : 1;
|
||||||
/** Message identifier*/
|
/** Indicates the identifier type (standard or extended)
|
||||||
union {
|
* use can_ide enum for assignment
|
||||||
uint32_t std_id : 11;
|
*/
|
||||||
uint32_t ext_id : 29;
|
uint32_t id_type : 1;
|
||||||
};
|
|
||||||
/** The length of the message (max. 8) in byte */
|
/** The length of the message (max. 8) in byte */
|
||||||
uint8_t dlc;
|
uint8_t dlc;
|
||||||
/** The message data*/
|
/** Baud Rate Switch. Frame transfer with different timing during
|
||||||
union {
|
* the data phase. Only valid for CAN-FD
|
||||||
uint8_t data[8];
|
*/
|
||||||
uint32_t data_32[2];
|
uint8_t brs : 1;
|
||||||
};
|
/** Reserved for future flags */
|
||||||
|
uint8_t res : 7;
|
||||||
#if defined(CONFIG_CAN_RX_TIMESTAMP)
|
#if defined(CONFIG_CAN_RX_TIMESTAMP)
|
||||||
/** Timer value of the CAN free running timer.
|
/** Timer value of the CAN free-running timer.
|
||||||
* The timer is incremented every bit time and captured at the start
|
* The timer is incremented every bit time and captured at the start
|
||||||
* of frame bit (SOF).
|
* of frame bit (SOF).
|
||||||
*/
|
*/
|
||||||
uint16_t timestamp;
|
uint16_t timestamp;
|
||||||
|
#else
|
||||||
|
/** @cond INTERNAL_HIDDEN */
|
||||||
|
uint8_t res0; /* reserved / padding */
|
||||||
|
uint8_t res1; /* reserved / padding */
|
||||||
|
/** @endcond */
|
||||||
#endif
|
#endif
|
||||||
} __packed;
|
/** The frame payload data. */
|
||||||
|
union {
|
||||||
|
uint8_t data[CAN_MAX_DLEN];
|
||||||
|
uint32_t data_32[ceiling_fraction(CAN_MAX_DLEN, sizeof(uint32_t))];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CAN filter structure
|
* @brief CAN filter structure
|
||||||
|
@ -206,25 +216,22 @@ struct zcan_frame {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct zcan_filter {
|
struct zcan_filter {
|
||||||
|
/** target state of the identifier */
|
||||||
|
uint32_t id : 29;
|
||||||
|
uint32_t res0 : 1;
|
||||||
|
/** target state of the rtr bit */
|
||||||
|
uint32_t rtr : 1;
|
||||||
/** Indicates the identifier type (standard or extended)
|
/** Indicates the identifier type (standard or extended)
|
||||||
* use can_ide enum for assignment
|
* use can_ide enum for assignment
|
||||||
*/
|
*/
|
||||||
uint32_t id_type : 1;
|
uint32_t id_type : 1;
|
||||||
/** target state of the rtr bit */
|
/** identifier mask*/
|
||||||
uint32_t rtr : 1;
|
uint32_t id_mask : 29;
|
||||||
/** target state of the identifier */
|
uint32_t res1 : 1;
|
||||||
union {
|
|
||||||
uint32_t std_id : 11;
|
|
||||||
uint32_t ext_id : 29;
|
|
||||||
};
|
|
||||||
/** rtr bit mask */
|
/** rtr bit mask */
|
||||||
uint32_t rtr_mask : 1;
|
uint32_t rtr_mask : 1;
|
||||||
/** identifier mask*/
|
uint32_t res2 : 1;
|
||||||
union {
|
|
||||||
uint32_t std_id_mask : 11;
|
|
||||||
uint32_t ext_id_mask : 29;
|
|
||||||
};
|
};
|
||||||
} __packed;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief can bus error count structure
|
* @brief can bus error count structure
|
||||||
|
@ -445,12 +452,12 @@ static inline int can_write(const struct device *dev, const uint8_t *data,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg.id = id;
|
||||||
|
|
||||||
if (id > CAN_MAX_STD_ID) {
|
if (id > CAN_MAX_STD_ID) {
|
||||||
msg.id_type = CAN_EXTENDED_IDENTIFIER;
|
msg.id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
msg.ext_id = id & CAN_EXT_ID_MASK;
|
|
||||||
} else {
|
} else {
|
||||||
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
msg.std_id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.dlc = length;
|
msg.dlc = length;
|
||||||
|
@ -691,8 +698,11 @@ static inline int z_impl_can_set_timing(const struct device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the bitrate of the CAN-FD controller
|
* @brief Set the bitrate of the CAN controller
|
||||||
*
|
*
|
||||||
|
* The second parameter bitrate_data is only relevant for CAN-FD.
|
||||||
|
* If the controller does not support CAN-FD or the FD mode is not enabled,
|
||||||
|
* this parameter is ignored.
|
||||||
* The sample point is set to the CiA DS 301 reccommended value of 87.5%
|
* The sample point is set to the CiA DS 301 reccommended value of 87.5%
|
||||||
*
|
*
|
||||||
* @param dev Pointer to the device structure for the driver instance.
|
* @param dev Pointer to the device structure for the driver instance.
|
||||||
|
@ -836,7 +846,7 @@ static inline void can_copy_frame_to_zframe(const struct can_frame *frame,
|
||||||
{
|
{
|
||||||
zframe->id_type = (frame->can_id & BIT(31)) >> 31;
|
zframe->id_type = (frame->can_id & BIT(31)) >> 31;
|
||||||
zframe->rtr = (frame->can_id & BIT(30)) >> 30;
|
zframe->rtr = (frame->can_id & BIT(30)) >> 30;
|
||||||
zframe->ext_id = frame->can_id & BIT_MASK(29);
|
zframe->id = frame->can_id & BIT_MASK(29);
|
||||||
zframe->dlc = frame->can_dlc;
|
zframe->dlc = frame->can_dlc;
|
||||||
memcpy(zframe->data, frame->data, sizeof(zframe->data));
|
memcpy(zframe->data, frame->data, sizeof(zframe->data));
|
||||||
}
|
}
|
||||||
|
@ -851,8 +861,7 @@ static inline void can_copy_zframe_to_frame(const struct zcan_frame *zframe,
|
||||||
struct can_frame *frame)
|
struct can_frame *frame)
|
||||||
{
|
{
|
||||||
frame->can_id = (zframe->id_type << 31) | (zframe->rtr << 30) |
|
frame->can_id = (zframe->id_type << 31) | (zframe->rtr << 30) |
|
||||||
(zframe->id_type == CAN_STANDARD_IDENTIFIER ? zframe->std_id :
|
zframe->id;
|
||||||
zframe->ext_id);
|
|
||||||
frame->can_dlc = zframe->dlc;
|
frame->can_dlc = zframe->dlc;
|
||||||
memcpy(frame->data, zframe->data, sizeof(frame->data));
|
memcpy(frame->data, zframe->data, sizeof(frame->data));
|
||||||
}
|
}
|
||||||
|
@ -870,9 +879,9 @@ void can_copy_filter_to_zfilter(const struct can_filter *filter,
|
||||||
{
|
{
|
||||||
zfilter->id_type = (filter->can_id & BIT(31)) >> 31;
|
zfilter->id_type = (filter->can_id & BIT(31)) >> 31;
|
||||||
zfilter->rtr = (filter->can_id & BIT(30)) >> 30;
|
zfilter->rtr = (filter->can_id & BIT(30)) >> 30;
|
||||||
zfilter->ext_id = filter->can_id & BIT_MASK(29);
|
zfilter->id = filter->can_id & BIT_MASK(29);
|
||||||
zfilter->rtr_mask = (filter->can_mask & BIT(30)) >> 30;
|
zfilter->rtr_mask = (filter->can_mask & BIT(30)) >> 30;
|
||||||
zfilter->ext_id_mask = filter->can_mask & BIT_MASK(29);
|
zfilter->id_mask = filter->can_mask & BIT_MASK(29);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -887,9 +896,9 @@ void can_copy_zfilter_to_filter(const struct zcan_filter *zfilter,
|
||||||
struct can_filter *filter)
|
struct can_filter *filter)
|
||||||
{
|
{
|
||||||
filter->can_id = (zfilter->id_type << 31) |
|
filter->can_id = (zfilter->id_type << 31) |
|
||||||
(zfilter->rtr << 30) | zfilter->ext_id;
|
(zfilter->rtr << 30) | zfilter->id;
|
||||||
filter->can_mask = (zfilter->rtr_mask << 30) |
|
filter->can_mask = (zfilter->rtr_mask << 30) |
|
||||||
(zfilter->id_type << 31) | zfilter->ext_id_mask;
|
(zfilter->id_type << 31) | zfilter->id_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -55,9 +55,9 @@ void rx_thread(void *arg1, void *arg2, void *arg3)
|
||||||
const struct zcan_filter filter = {
|
const struct zcan_filter filter = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = COUNTER_MSG_ID,
|
.id = COUNTER_MSG_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_EXT_ID_MASK
|
.id_mask = CAN_EXT_ID_MASK
|
||||||
};
|
};
|
||||||
struct zcan_frame msg;
|
struct zcan_frame msg;
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
@ -177,20 +177,20 @@ void main(void)
|
||||||
const struct zcan_filter change_led_filter = {
|
const struct zcan_filter change_led_filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = LED_MSG_ID,
|
.id = LED_MSG_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
struct zcan_frame change_led_frame = {
|
struct zcan_frame change_led_frame = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = LED_MSG_ID,
|
.id = LED_MSG_ID,
|
||||||
.dlc = 1
|
.dlc = 1
|
||||||
};
|
};
|
||||||
struct zcan_frame counter_frame = {
|
struct zcan_frame counter_frame = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = COUNTER_MSG_ID,
|
.id = COUNTER_MSG_ID,
|
||||||
.dlc = 2
|
.dlc = 2
|
||||||
};
|
};
|
||||||
uint8_t toggle = 1;
|
uint8_t toggle = 1;
|
||||||
|
|
|
@ -32,9 +32,9 @@ static struct k_thread rx_data;
|
||||||
static const struct zcan_filter zfilter = {
|
static const struct zcan_filter zfilter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = 0x1,
|
.id = 0x1,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct can_filter filter;
|
static struct can_filter filter;
|
||||||
|
@ -48,7 +48,7 @@ static void tx(int *can_fd)
|
||||||
|
|
||||||
msg.dlc = 8U;
|
msg.dlc = 8U;
|
||||||
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
msg.std_id = 0x1;
|
msg.id = 0x1;
|
||||||
msg.rtr = CAN_DATAFRAME;
|
msg.rtr = CAN_DATAFRAME;
|
||||||
|
|
||||||
for (i = 0; i < msg.dlc; i++) {
|
for (i = 0; i < msg.dlc; i++) {
|
||||||
|
@ -127,7 +127,7 @@ static void rx(int *can_fd, int *do_close_period,
|
||||||
can_copy_frame_to_zframe(&frame, &msg);
|
can_copy_frame_to_zframe(&frame, &msg);
|
||||||
|
|
||||||
LOG_INF("[%d] CAN msg: type 0x%x RTR 0x%x EID 0x%x DLC 0x%x",
|
LOG_INF("[%d] CAN msg: type 0x%x RTR 0x%x EID 0x%x DLC 0x%x",
|
||||||
fd, msg.id_type, msg.rtr, msg.std_id, msg.dlc);
|
fd, msg.id_type, msg.rtr, msg.id, msg.dlc);
|
||||||
|
|
||||||
if (!msg.rtr) {
|
if (!msg.rtr) {
|
||||||
if (msg.dlc > 8) {
|
if (msg.dlc > 8) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ static void canopen_rx_isr_callback(struct zcan_frame *msg, void *arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rxMsg.ident = msg->std_id;
|
rxMsg.ident = msg->id;
|
||||||
rxMsg.DLC = msg->dlc;
|
rxMsg.DLC = msg->dlc;
|
||||||
memcpy(rxMsg.data, msg->data, msg->dlc);
|
memcpy(rxMsg.data, msg->data, msg->dlc);
|
||||||
buffer->pFunct(buffer->object, &rxMsg);
|
buffer->pFunct(buffer->object, &rxMsg);
|
||||||
|
@ -126,7 +126,7 @@ static void canopen_tx_retry(struct k_work *item)
|
||||||
buffer = &CANmodule->tx_array[i];
|
buffer = &CANmodule->tx_array[i];
|
||||||
if (buffer->bufferFull) {
|
if (buffer->bufferFull) {
|
||||||
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
msg.std_id = buffer->ident;
|
msg.id = buffer->ident;
|
||||||
msg.dlc = buffer->DLC;
|
msg.dlc = buffer->DLC;
|
||||||
msg.rtr = (buffer->rtr ? 1 : 0);
|
msg.rtr = (buffer->rtr ? 1 : 0);
|
||||||
memcpy(msg.data, buffer->data, buffer->DLC);
|
memcpy(msg.data, buffer->data, buffer->DLC);
|
||||||
|
@ -274,8 +274,8 @@ CO_ReturnError_t CO_CANrxBufferInit(CO_CANmodule_t *CANmodule, uint16_t index,
|
||||||
buffer->pFunct = pFunct;
|
buffer->pFunct = pFunct;
|
||||||
|
|
||||||
filter.id_type = CAN_STANDARD_IDENTIFIER;
|
filter.id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
filter.std_id = ident;
|
filter.id = ident;
|
||||||
filter.std_id_mask = mask;
|
filter.id_mask = mask;
|
||||||
filter.rtr = (rtr ? 1 : 0);
|
filter.rtr = (rtr ? 1 : 0);
|
||||||
filter.rtr_mask = 1;
|
filter.rtr_mask = 1;
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
msg.std_id = buffer->ident;
|
msg.id = buffer->ident;
|
||||||
msg.dlc = buffer->DLC;
|
msg.dlc = buffer->DLC;
|
||||||
msg.rtr = (buffer->rtr ? 1 : 0);
|
msg.rtr = (buffer->rtr ? 1 : 0);
|
||||||
memcpy(msg.data, buffer->data, buffer->DLC);
|
memcpy(msg.data, buffer->data, buffer->DLC);
|
||||||
|
|
|
@ -133,7 +133,7 @@ static void receive_send_fc(struct isotp_recv_ctx *ctx, uint8_t fs)
|
||||||
struct zcan_frame frame = {
|
struct zcan_frame frame = {
|
||||||
.id_type = ctx->tx_addr.id_type,
|
.id_type = ctx->tx_addr.id_type,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = ctx->tx_addr.ext_id
|
.id = ctx->tx_addr.ext_id
|
||||||
};
|
};
|
||||||
uint8_t *data = frame.data;
|
uint8_t *data = frame.data;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -532,9 +532,9 @@ static inline int attach_ff_filter(struct isotp_recv_ctx *ctx)
|
||||||
struct zcan_filter filter = {
|
struct zcan_filter filter = {
|
||||||
.id_type = ctx->rx_addr.id_type,
|
.id_type = ctx->rx_addr.id_type,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = ctx->rx_addr.ext_id,
|
.id = ctx->rx_addr.ext_id,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_EXT_ID_MASK
|
.id_mask = CAN_EXT_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx->filter_id = can_attach_isr(ctx->can_dev, receive_can_rx_isr, ctx,
|
ctx->filter_id = can_attach_isr(ctx->can_dev, receive_can_rx_isr, ctx,
|
||||||
|
@ -834,7 +834,7 @@ static inline int send_sf(struct isotp_send_ctx *ctx)
|
||||||
struct zcan_frame frame = {
|
struct zcan_frame frame = {
|
||||||
.id_type = ctx->tx_addr.id_type,
|
.id_type = ctx->tx_addr.id_type,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = ctx->tx_addr.ext_id
|
.id = ctx->tx_addr.ext_id
|
||||||
};
|
};
|
||||||
size_t len = get_ctx_data_length(ctx);
|
size_t len = get_ctx_data_length(ctx);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -866,7 +866,7 @@ static inline int send_ff(struct isotp_send_ctx *ctx)
|
||||||
struct zcan_frame frame = {
|
struct zcan_frame frame = {
|
||||||
.id_type = ctx->tx_addr.id_type,
|
.id_type = ctx->tx_addr.id_type,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = ctx->tx_addr.ext_id,
|
.id = ctx->tx_addr.ext_id,
|
||||||
.dlc = ISOTP_CAN_DL
|
.dlc = ISOTP_CAN_DL
|
||||||
};
|
};
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -908,7 +908,7 @@ static inline int send_cf(struct isotp_send_ctx *ctx)
|
||||||
struct zcan_frame frame = {
|
struct zcan_frame frame = {
|
||||||
.id_type = ctx->tx_addr.id_type,
|
.id_type = ctx->tx_addr.id_type,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = ctx->tx_addr.ext_id,
|
.id = ctx->tx_addr.ext_id,
|
||||||
};
|
};
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1081,9 +1081,9 @@ static inline int attach_fc_filter(struct isotp_send_ctx *ctx)
|
||||||
struct zcan_filter filter = {
|
struct zcan_filter filter = {
|
||||||
.id_type = ctx->rx_addr.id_type,
|
.id_type = ctx->rx_addr.id_type,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = ctx->rx_addr.ext_id,
|
.id = ctx->rx_addr.ext_id,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_EXT_ID_MASK
|
.id_mask = CAN_EXT_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx->filter_id = can_attach_isr(ctx->can_dev, send_can_rx_isr, ctx,
|
ctx->filter_id = can_attach_isr(ctx->can_dev, send_can_rx_isr, ctx,
|
||||||
|
|
|
@ -395,10 +395,10 @@ static void canbus_set_frame_addr(struct zcan_frame *frame,
|
||||||
frame->id_type = CAN_EXTENDED_IDENTIFIER;
|
frame->id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
frame->rtr = CAN_DATAFRAME;
|
frame->rtr = CAN_DATAFRAME;
|
||||||
|
|
||||||
frame->ext_id = canbus_addr_to_id(dest->addr, src->addr);
|
frame->id = canbus_addr_to_id(dest->addr, src->addr);
|
||||||
|
|
||||||
if (mcast) {
|
if (mcast) {
|
||||||
frame->ext_id |= CAN_NET_IF_ADDR_MCAST_MASK;
|
frame->id |= CAN_NET_IF_ADDR_MCAST_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ static int canbus_send_fc(const struct device *net_can_dev,
|
||||||
frame.data[2] = NET_CAN_STMIN;
|
frame.data[2] = NET_CAN_STMIN;
|
||||||
canbus_set_frame_datalength(&frame, 3);
|
canbus_set_frame_datalength(&frame, 3);
|
||||||
|
|
||||||
NET_DBG("Sending FC to ID: 0x%08x", frame.ext_id);
|
NET_DBG("Sending FC to ID: 0x%08x", frame.id);
|
||||||
return api->send(net_can_dev, &frame, canbus_fc_send_cb, NULL,
|
return api->send(net_can_dev, &frame, canbus_fc_send_cb, NULL,
|
||||||
K_FOREVER);
|
K_FOREVER);
|
||||||
}
|
}
|
||||||
|
@ -885,11 +885,11 @@ static inline int canbus_send_ff(struct net_pkt *pkt, size_t len, bool mcast,
|
||||||
if (mcast) {
|
if (mcast) {
|
||||||
NET_DBG("Sending FF (multicast). ID: 0x%08x. PKT len: %zu"
|
NET_DBG("Sending FF (multicast). ID: 0x%08x. PKT len: %zu"
|
||||||
" CTX: %p",
|
" CTX: %p",
|
||||||
frame.ext_id, len, pkt->canbus_tx_ctx);
|
frame.id, len, pkt->canbus_tx_ctx);
|
||||||
} else {
|
} else {
|
||||||
NET_DBG("Sending FF (unicast). ID: 0x%08x. PKT len: %zu"
|
NET_DBG("Sending FF (unicast). ID: 0x%08x. PKT len: %zu"
|
||||||
" CTX: %p",
|
" CTX: %p",
|
||||||
frame.ext_id, len, pkt->canbus_tx_ctx);
|
frame.id, len, pkt->canbus_tx_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_NET_L2_CANBUS_ETH_TRANSLATOR)
|
#if defined(CONFIG_NET_L2_CANBUS_ETH_TRANSLATOR)
|
||||||
|
@ -1506,7 +1506,7 @@ static inline int canbus_send_dad_request(const struct device *net_can_dev,
|
||||||
canbus_set_frame_datalength(&frame, 0);
|
canbus_set_frame_datalength(&frame, 0);
|
||||||
frame.rtr = CAN_REMOTEREQUEST;
|
frame.rtr = CAN_REMOTEREQUEST;
|
||||||
frame.id_type = CAN_EXTENDED_IDENTIFIER;
|
frame.id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
frame.ext_id = canbus_addr_to_id(ll_addr->addr,
|
frame.id = canbus_addr_to_id(ll_addr->addr,
|
||||||
sys_rand32_get() & CAN_NET_IF_ADDR_MASK);
|
sys_rand32_get() & CAN_NET_IF_ADDR_MASK);
|
||||||
|
|
||||||
ret = api->send(net_can_dev, &frame, NULL, NULL, K_FOREVER);
|
ret = api->send(net_can_dev, &frame, NULL, NULL, K_FOREVER);
|
||||||
|
@ -1550,7 +1550,7 @@ static inline void canbus_send_dad_response(struct k_work *item)
|
||||||
canbus_set_frame_datalength(&frame, 0);
|
canbus_set_frame_datalength(&frame, 0);
|
||||||
frame.rtr = CAN_DATAFRAME;
|
frame.rtr = CAN_DATAFRAME;
|
||||||
frame.id_type = CAN_EXTENDED_IDENTIFIER;
|
frame.id_type = CAN_EXTENDED_IDENTIFIER;
|
||||||
frame.ext_id = canbus_addr_to_id(NET_CAN_DAD_ADDR,
|
frame.id = canbus_addr_to_id(NET_CAN_DAD_ADDR,
|
||||||
ntohs(UNALIGNED_GET((uint16_t *) ll_addr->addr)));
|
ntohs(UNALIGNED_GET((uint16_t *) ll_addr->addr)));
|
||||||
|
|
||||||
ret = api->send(net_can_dev, &frame, canbus_send_dad_resp_cb, item,
|
ret = api->send(net_can_dev, &frame, canbus_send_dad_resp_cb, item,
|
||||||
|
@ -1587,11 +1587,11 @@ int canbus_attach_dad_resp_filter(const struct device *net_can_dev,
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_EXT_ID_MASK
|
.id_mask = CAN_EXT_ID_MASK
|
||||||
};
|
};
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
||||||
filter.ext_id = canbus_addr_to_id(NET_CAN_DAD_ADDR, ll_addr->addr);
|
filter.id = canbus_addr_to_id(NET_CAN_DAD_ADDR, ll_addr->addr);
|
||||||
|
|
||||||
filter_id = api->attach_filter(net_can_dev, canbus_dad_resp_cb,
|
filter_id = api->attach_filter(net_can_dev, canbus_dad_resp_cb,
|
||||||
dad_sem, &filter);
|
dad_sem, &filter);
|
||||||
|
@ -1618,11 +1618,11 @@ static inline int canbus_attach_dad_filter(const struct device *net_can_dev,
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_REMOTEREQUEST,
|
.rtr = CAN_REMOTEREQUEST,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = (CAN_NET_IF_ADDR_MASK << CAN_NET_IF_ADDR_DEST_POS)
|
.id_mask = (CAN_NET_IF_ADDR_MASK << CAN_NET_IF_ADDR_DEST_POS)
|
||||||
};
|
};
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
||||||
filter.ext_id = canbus_addr_to_id(ll_addr->addr, 0);
|
filter.id = canbus_addr_to_id(ll_addr->addr, 0);
|
||||||
|
|
||||||
filter_id = api->attach_filter(net_can_dev, canbus_dad_request_cb,
|
filter_id = api->attach_filter(net_can_dev, canbus_dad_request_cb,
|
||||||
dad_work, &filter);
|
dad_work, &filter);
|
||||||
|
|
|
@ -56,7 +56,7 @@ const struct device *can_dev;
|
||||||
struct zcan_frame test_std_msg = {
|
struct zcan_frame test_std_msg = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_STD_ID,
|
.id = TEST_CAN_STD_ID,
|
||||||
.dlc = 8,
|
.dlc = 8,
|
||||||
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ struct zcan_frame test_std_msg = {
|
||||||
struct zcan_frame test_std_mask_msg = {
|
struct zcan_frame test_std_mask_msg = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_STD_MASK_ID,
|
.id = TEST_CAN_STD_MASK_ID,
|
||||||
.dlc = 8,
|
.dlc = 8,
|
||||||
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ struct zcan_frame test_std_mask_msg = {
|
||||||
struct zcan_frame test_ext_msg = {
|
struct zcan_frame test_ext_msg = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = TEST_CAN_EXT_ID,
|
.id = TEST_CAN_EXT_ID,
|
||||||
.dlc = 8,
|
.dlc = 8,
|
||||||
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
};
|
};
|
||||||
|
@ -80,7 +80,7 @@ struct zcan_frame test_ext_msg = {
|
||||||
struct zcan_frame test_ext_mask_msg = {
|
struct zcan_frame test_ext_mask_msg = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = TEST_CAN_EXT_MASK_ID,
|
.id = TEST_CAN_EXT_MASK_ID,
|
||||||
.dlc = 8,
|
.dlc = 8,
|
||||||
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
};
|
};
|
||||||
|
@ -88,41 +88,41 @@ struct zcan_frame test_ext_mask_msg = {
|
||||||
const struct zcan_filter test_std_filter = {
|
const struct zcan_filter test_std_filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_STD_ID,
|
.id = TEST_CAN_STD_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_std_masked_filter = {
|
const struct zcan_filter test_std_masked_filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_STD_ID,
|
.id = TEST_CAN_STD_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = TEST_CAN_STD_MASK
|
.id_mask = TEST_CAN_STD_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_ext_filter = {
|
const struct zcan_filter test_ext_filter = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = TEST_CAN_EXT_ID,
|
.id = TEST_CAN_EXT_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_EXT_ID_MASK
|
.id_mask = CAN_EXT_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_ext_masked_filter = {
|
const struct zcan_filter test_ext_masked_filter = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = TEST_CAN_EXT_ID,
|
.id = TEST_CAN_EXT_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = TEST_CAN_EXT_MASK
|
.id_mask = TEST_CAN_EXT_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_std_some_filter = {
|
const struct zcan_filter test_std_some_filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_SOME_STD_ID,
|
.id = TEST_CAN_SOME_STD_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
struct zcan_work can_work;
|
struct zcan_work can_work;
|
||||||
|
@ -138,13 +138,8 @@ static inline void check_msg(struct zcan_frame *msg1, struct zcan_frame *msg2,
|
||||||
zassert_equal(msg1->rtr, msg2->rtr,
|
zassert_equal(msg1->rtr, msg2->rtr,
|
||||||
"RTR bit does not match");
|
"RTR bit does not match");
|
||||||
|
|
||||||
if (msg2->id_type == CAN_STANDARD_IDENTIFIER) {
|
zassert_equal(msg1->id | mask, msg2->id | mask,
|
||||||
zassert_equal(msg1->std_id | mask, msg2->std_id | mask,
|
|
||||||
"ID does not match");
|
"ID does not match");
|
||||||
} else {
|
|
||||||
zassert_equal(msg1->ext_id | mask, msg2->ext_id | mask,
|
|
||||||
"ID does not match");
|
|
||||||
}
|
|
||||||
|
|
||||||
zassert_equal(msg1->dlc, msg2->dlc,
|
zassert_equal(msg1->dlc, msg2->dlc,
|
||||||
"DLC does not match");
|
"DLC does not match");
|
||||||
|
@ -159,7 +154,7 @@ static void tx_std_isr(uint32_t error_flags, void *arg)
|
||||||
|
|
||||||
k_sem_give(&tx_cb_sem);
|
k_sem_give(&tx_cb_sem);
|
||||||
|
|
||||||
zassert_equal(msg->std_id, TEST_CAN_STD_ID, "Arg does not match");
|
zassert_equal(msg->id, TEST_CAN_STD_ID, "Arg does not match");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tx_std_masked_isr(uint32_t error_flags, void *arg)
|
static void tx_std_masked_isr(uint32_t error_flags, void *arg)
|
||||||
|
@ -168,7 +163,7 @@ static void tx_std_masked_isr(uint32_t error_flags, void *arg)
|
||||||
|
|
||||||
k_sem_give(&tx_cb_sem);
|
k_sem_give(&tx_cb_sem);
|
||||||
|
|
||||||
zassert_equal(msg->std_id, TEST_CAN_STD_MASK_ID, "Arg does not match");
|
zassert_equal(msg->id, TEST_CAN_STD_MASK_ID, "Arg does not match");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tx_ext_isr(uint32_t error_flags, void *arg)
|
static void tx_ext_isr(uint32_t error_flags, void *arg)
|
||||||
|
@ -177,7 +172,7 @@ static void tx_ext_isr(uint32_t error_flags, void *arg)
|
||||||
|
|
||||||
k_sem_give(&tx_cb_sem);
|
k_sem_give(&tx_cb_sem);
|
||||||
|
|
||||||
zassert_equal(msg->ext_id, TEST_CAN_EXT_ID, "Arg does not match");
|
zassert_equal(msg->id, TEST_CAN_EXT_ID, "Arg does not match");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tx_ext_masked_isr(uint32_t error_flags, void *arg)
|
static void tx_ext_masked_isr(uint32_t error_flags, void *arg)
|
||||||
|
@ -186,7 +181,7 @@ static void tx_ext_masked_isr(uint32_t error_flags, void *arg)
|
||||||
|
|
||||||
k_sem_give(&tx_cb_sem);
|
k_sem_give(&tx_cb_sem);
|
||||||
|
|
||||||
zassert_equal(msg->ext_id, TEST_CAN_EXT_MASK_ID, "Arg does not match");
|
zassert_equal(msg->id, TEST_CAN_EXT_MASK_ID, "Arg does not match");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rx_std_isr(struct zcan_frame *msg, void *arg)
|
static void rx_std_isr(struct zcan_frame *msg, void *arg)
|
||||||
|
@ -262,7 +257,7 @@ static void send_test_msg_nowait(const struct device *can_dev,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (msg->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (msg->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
if (msg->std_id == TEST_CAN_STD_ID) {
|
if (msg->id == TEST_CAN_STD_ID) {
|
||||||
ret = can_send(can_dev, msg, TEST_SEND_TIMEOUT,
|
ret = can_send(can_dev, msg, TEST_SEND_TIMEOUT,
|
||||||
tx_std_isr, msg);
|
tx_std_isr, msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -270,7 +265,7 @@ static void send_test_msg_nowait(const struct device *can_dev,
|
||||||
tx_std_masked_isr, msg);
|
tx_std_masked_isr, msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (msg->ext_id == TEST_CAN_EXT_ID) {
|
if (msg->id == TEST_CAN_EXT_ID) {
|
||||||
ret = can_send(can_dev, msg, TEST_SEND_TIMEOUT,
|
ret = can_send(can_dev, msg, TEST_SEND_TIMEOUT,
|
||||||
tx_ext_isr, msg);
|
tx_ext_isr, msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -303,7 +298,7 @@ static inline int attach_workq(const struct device *can_dev,
|
||||||
int filter_id;
|
int filter_id;
|
||||||
|
|
||||||
if (filter->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (filter->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
if (filter->std_id_mask == CAN_STD_ID_MASK) {
|
if (filter->id_mask == CAN_STD_ID_MASK) {
|
||||||
filter_id = can_attach_workq(can_dev, &k_sys_work_q,
|
filter_id = can_attach_workq(can_dev, &k_sys_work_q,
|
||||||
&can_work, rx_std_cb,
|
&can_work, rx_std_cb,
|
||||||
(void *)filter, filter);
|
(void *)filter, filter);
|
||||||
|
@ -313,7 +308,7 @@ static inline int attach_workq(const struct device *can_dev,
|
||||||
(void *)filter, filter);
|
(void *)filter, filter);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (filter->ext_id_mask == CAN_EXT_ID_MASK) {
|
if (filter->id_mask == CAN_EXT_ID_MASK) {
|
||||||
filter_id = can_attach_workq(can_dev, &k_sys_work_q,
|
filter_id = can_attach_workq(can_dev, &k_sys_work_q,
|
||||||
&can_work, rx_ext_cb,
|
&can_work, rx_ext_cb,
|
||||||
(void *)filter, filter);
|
(void *)filter, filter);
|
||||||
|
@ -339,7 +334,7 @@ static inline int attach_isr(const struct device *can_dev,
|
||||||
k_sem_reset(&rx_isr_sem);
|
k_sem_reset(&rx_isr_sem);
|
||||||
|
|
||||||
if (filter->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (filter->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
if (filter->std_id_mask == CAN_STD_ID_MASK) {
|
if (filter->id_mask == CAN_STD_ID_MASK) {
|
||||||
filter_id = can_attach_isr(can_dev, rx_std_isr,
|
filter_id = can_attach_isr(can_dev, rx_std_isr,
|
||||||
(void *)filter, filter);
|
(void *)filter, filter);
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,7 +342,7 @@ static inline int attach_isr(const struct device *can_dev,
|
||||||
(void *)filter, filter);
|
(void *)filter, filter);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (filter->ext_id_mask == CAN_EXT_ID_MASK) {
|
if (filter->id_mask == CAN_EXT_ID_MASK) {
|
||||||
filter_id = can_attach_isr(can_dev, rx_ext_isr,
|
filter_id = can_attach_isr(can_dev, rx_ext_isr,
|
||||||
(void *)filter, filter);
|
(void *)filter, filter);
|
||||||
} else {
|
} else {
|
||||||
|
@ -377,11 +372,11 @@ static void send_receive(const struct zcan_filter *filter, struct zcan_frame *ms
|
||||||
zassert_equal(ret, 0, "Receiving timeout");
|
zassert_equal(ret, 0, "Receiving timeout");
|
||||||
|
|
||||||
if (filter->id_type == CAN_STANDARD_IDENTIFIER) {
|
if (filter->id_type == CAN_STANDARD_IDENTIFIER) {
|
||||||
if (filter->std_id_mask != CAN_STD_ID_MASK) {
|
if (filter->id_mask != CAN_STD_ID_MASK) {
|
||||||
mask = 0x0F;
|
mask = 0x0F;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (filter->ext_id_mask != CAN_EXT_ID_MASK) {
|
if (filter->id_mask != CAN_EXT_ID_MASK) {
|
||||||
mask = 0x0F;
|
mask = 0x0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ CAN_DEFINE_MSGQ(can_msgq, 5);
|
||||||
struct zcan_frame test_std_msg = {
|
struct zcan_frame test_std_msg = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_STD_ID,
|
.id = TEST_CAN_STD_ID,
|
||||||
.dlc = 8,
|
.dlc = 8,
|
||||||
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
.data = {1, 2, 3, 4, 5, 6, 7, 8}
|
||||||
};
|
};
|
||||||
|
@ -55,33 +55,33 @@ struct zcan_frame test_std_msg = {
|
||||||
const struct zcan_filter test_std_filter = {
|
const struct zcan_filter test_std_filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_STD_ID,
|
.id = TEST_CAN_STD_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_ext_filter = {
|
const struct zcan_filter test_ext_filter = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = TEST_CAN_EXT_ID,
|
.id = TEST_CAN_EXT_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = CAN_EXT_ID_MASK
|
.id_mask = CAN_EXT_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_ext_masked_filter = {
|
const struct zcan_filter test_ext_masked_filter = {
|
||||||
.id_type = CAN_EXTENDED_IDENTIFIER,
|
.id_type = CAN_EXTENDED_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.ext_id = TEST_CAN_EXT_ID,
|
.id = TEST_CAN_EXT_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.ext_id_mask = TEST_CAN_EXT_MASK
|
.id_mask = TEST_CAN_EXT_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct zcan_filter test_std_some_filter = {
|
const struct zcan_filter test_std_some_filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = TEST_CAN_SOME_STD_ID,
|
.id = TEST_CAN_SOME_STD_ID,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void check_msg(struct zcan_frame *msg1, struct zcan_frame *msg2)
|
static inline void check_msg(struct zcan_frame *msg1, struct zcan_frame *msg2)
|
||||||
|
@ -94,13 +94,7 @@ static inline void check_msg(struct zcan_frame *msg1, struct zcan_frame *msg2)
|
||||||
zassert_equal(msg1->rtr, msg2->rtr,
|
zassert_equal(msg1->rtr, msg2->rtr,
|
||||||
"RTR bit does not match");
|
"RTR bit does not match");
|
||||||
|
|
||||||
if (msg2->id_type == CAN_STANDARD_IDENTIFIER) {
|
zassert_equal(msg1->id, msg2->id, "ID does not match");
|
||||||
zassert_equal(msg1->std_id, msg2->std_id,
|
|
||||||
"ID does not match");
|
|
||||||
} else {
|
|
||||||
zassert_equal(msg1->ext_id, msg2->ext_id,
|
|
||||||
"ID does not match");
|
|
||||||
}
|
|
||||||
|
|
||||||
zassert_equal(msg1->dlc, msg2->dlc,
|
zassert_equal(msg1->dlc, msg2->dlc,
|
||||||
"DLC does not match");
|
"DLC does not match");
|
||||||
|
|
|
@ -30,7 +30,7 @@ static void test_can_frame_to_zcan_frame(void)
|
||||||
|
|
||||||
expected.rtr = 1U;
|
expected.rtr = 1U;
|
||||||
expected.id_type = 1U;
|
expected.id_type = 1U;
|
||||||
expected.std_id = 1234U;
|
expected.id = 1234U;
|
||||||
expected.dlc = sizeof(data);
|
expected.dlc = sizeof(data);
|
||||||
|
|
||||||
can_copy_frame_to_zframe(&frame, &msg);
|
can_copy_frame_to_zframe(&frame, &msg);
|
||||||
|
@ -41,7 +41,7 @@ static void test_can_frame_to_zcan_frame(void)
|
||||||
|
|
||||||
zassert_equal(msg.rtr, expected.rtr, "RTR bit not set");
|
zassert_equal(msg.rtr, expected.rtr, "RTR bit not set");
|
||||||
zassert_equal(msg.id_type, expected.id_type, "Id-type bit not set");
|
zassert_equal(msg.id_type, expected.id_type, "Id-type bit not set");
|
||||||
zassert_equal(msg.std_id, expected.std_id, "Std CAN id invalid");
|
zassert_equal(msg.id, expected.id, "Std CAN id invalid");
|
||||||
zassert_equal(msg.dlc, expected.dlc, "Msg length invalid");
|
zassert_equal(msg.dlc, expected.dlc, "Msg length invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ static void test_zcan_frame_to_can_frame(void)
|
||||||
|
|
||||||
msg.rtr = 1U;
|
msg.rtr = 1U;
|
||||||
msg.id_type = 1U;
|
msg.id_type = 1U;
|
||||||
msg.std_id = 1234U;
|
msg.id = 1234U;
|
||||||
msg.dlc = sizeof(data);
|
msg.dlc = sizeof(data);
|
||||||
memcpy(msg.data, data, sizeof(data));
|
memcpy(msg.data, data, sizeof(data));
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static void test_invalid_zcan_frame_to_can_frame(void)
|
||||||
memcpy(expected.data, data, sizeof(expected.data));
|
memcpy(expected.data, data, sizeof(expected.data));
|
||||||
|
|
||||||
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
msg.id_type = CAN_STANDARD_IDENTIFIER;
|
||||||
msg.ext_id = 0x12345678U;
|
msg.id = 0x12345678U;
|
||||||
msg.dlc = sizeof(data);
|
msg.dlc = sizeof(data);
|
||||||
memcpy(msg.data, data, sizeof(data));
|
memcpy(msg.data, data, sizeof(data));
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ static void test_can_filter_to_zcan_filter(void)
|
||||||
|
|
||||||
expected.rtr = 1U;
|
expected.rtr = 1U;
|
||||||
expected.id_type = 1U;
|
expected.id_type = 1U;
|
||||||
expected.std_id = 1234U;
|
expected.id = 1234U;
|
||||||
expected.rtr_mask = 1U;
|
expected.rtr_mask = 1U;
|
||||||
expected.std_id_mask = 1234U;
|
expected.id_mask = 1234U;
|
||||||
|
|
||||||
can_copy_filter_to_zfilter(&filter, &msg_filter);
|
can_copy_filter_to_zfilter(&filter, &msg_filter);
|
||||||
|
|
||||||
|
@ -134,11 +134,11 @@ static void test_can_filter_to_zcan_filter(void)
|
||||||
zassert_equal(msg_filter.rtr, expected.rtr, "RTR bit not set");
|
zassert_equal(msg_filter.rtr, expected.rtr, "RTR bit not set");
|
||||||
zassert_equal(msg_filter.id_type, expected.id_type,
|
zassert_equal(msg_filter.id_type, expected.id_type,
|
||||||
"Id-type bit not set");
|
"Id-type bit not set");
|
||||||
zassert_equal(msg_filter.std_id, expected.std_id,
|
zassert_equal(msg_filter.id, expected.id,
|
||||||
"Std CAN id invalid");
|
"Std CAN id invalid");
|
||||||
zassert_equal(msg_filter.rtr_mask, expected.rtr_mask,
|
zassert_equal(msg_filter.rtr_mask, expected.rtr_mask,
|
||||||
"RTR mask bit not set");
|
"RTR mask bit not set");
|
||||||
zassert_equal(msg_filter.std_id_mask, expected.std_id_mask,
|
zassert_equal(msg_filter.id_mask, expected.id_mask,
|
||||||
"Std id mask not set");
|
"Std id mask not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,9 +153,9 @@ static void test_zcan_filter_to_can_filter(void)
|
||||||
|
|
||||||
msg_filter.rtr = 1U;
|
msg_filter.rtr = 1U;
|
||||||
msg_filter.id_type = 1U;
|
msg_filter.id_type = 1U;
|
||||||
msg_filter.std_id = 1234U;
|
msg_filter.id = 1234U;
|
||||||
msg_filter.rtr_mask = 1U;
|
msg_filter.rtr_mask = 1U;
|
||||||
msg_filter.std_id_mask = 1234U;
|
msg_filter.id_mask = 1234U;
|
||||||
|
|
||||||
can_copy_zfilter_to_filter(&msg_filter, &filter);
|
can_copy_zfilter_to_filter(&msg_filter, &filter);
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ static void send_frame_series(struct frame_desired *frames, size_t length,
|
||||||
struct zcan_frame frame = {
|
struct zcan_frame frame = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = id
|
.id = id
|
||||||
};
|
};
|
||||||
struct frame_desired *desired = frames;
|
struct frame_desired *desired = frames;
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@ static int attach_msgq(uint32_t id)
|
||||||
struct zcan_filter filter = {
|
struct zcan_filter filter = {
|
||||||
.id_type = CAN_STANDARD_IDENTIFIER,
|
.id_type = CAN_STANDARD_IDENTIFIER,
|
||||||
.rtr = CAN_DATAFRAME,
|
.rtr = CAN_DATAFRAME,
|
||||||
.std_id = id,
|
.id = id,
|
||||||
.rtr_mask = 1,
|
.rtr_mask = 1,
|
||||||
.std_id_mask = CAN_STD_ID_MASK
|
.id_mask = CAN_STD_ID_MASK
|
||||||
};
|
};
|
||||||
|
|
||||||
filter_id = can_attach_msgq(can_dev, &frame_msgq, &filter);
|
filter_id = can_attach_msgq(can_dev, &frame_msgq, &filter);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue