mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 20:57:20 +08:00
[CAN]update struct can_filter_item and rt_can_msg (#6556)
* 修改ry命令,已便于自定义保存路径 * modified: components/utilities/ymodem/ry_sy.c * 修复从被动错误恢复后发送返回异常 * 修复在自动重传模式下,ACK异常阻塞线程 - 删除TX中断函数else分支。仅当RQCP位 置一才进入该中断 - 添加SCE中断函数中关于ACK_ERR的else判断。自动重传模式下会进入该判断,打断自动重传释放完成量。 * 增加对于CAN1与CAN2的SCE中断和TX中断的公共处理函数 * formatting格式化代码 * update struct can_filter_item and rt_can_msg 1. 对过滤器号和索引号结构体定义中同一名称hdr进行重命名hdr_bank和hdr_index, 以便准确区分.采用宏定义兼容以前变量名. 2. 添加接收标识rxfifo,已指明是哪个RXFIFO. * 更正42M下的波特率 * 修复接收获取索引号错误 * 添加接收标识 * 更新注释 * 取消CANFD限制 * update struct can_filter_item and rt_can_msg
This commit is contained in:
@@ -65,7 +65,7 @@ rt_inline int _can_int_rx(struct rt_can_device *can, struct rt_can_msg *data, in
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
#ifdef RT_CAN_USING_HDR
|
||||
hdr = data->hdr;
|
||||
hdr = data->hdr_index;
|
||||
|
||||
if (hdr >= 0 && can->hdr && hdr < can->config.maxhdr && !rt_list_isempty(&can->hdr[hdr].list))
|
||||
{
|
||||
@@ -581,7 +581,7 @@ static rt_err_t rt_can_control(struct rt_device *dev,
|
||||
{
|
||||
while (count)
|
||||
{
|
||||
if (pitem->hdr >= can->config.maxhdr || pitem->hdr < 0)
|
||||
if (pitem->hdr_bank >= can->config.maxhdr || pitem->hdr_bank < 0)
|
||||
{
|
||||
count--;
|
||||
pitem++;
|
||||
@@ -589,15 +589,15 @@ static rt_err_t rt_can_control(struct rt_device *dev,
|
||||
}
|
||||
|
||||
level = rt_hw_interrupt_disable();
|
||||
if (!can->hdr[pitem->hdr].connected)
|
||||
if (!can->hdr[pitem->hdr_bank].connected)
|
||||
{
|
||||
rt_hw_interrupt_enable(level);
|
||||
rt_memcpy(&can->hdr[pitem->hdr].filter, pitem,
|
||||
rt_memcpy(&can->hdr[pitem->hdr_bank].filter, pitem,
|
||||
sizeof(struct rt_can_filter_item));
|
||||
level = rt_hw_interrupt_disable();
|
||||
can->hdr[pitem->hdr].connected = 1;
|
||||
can->hdr[pitem->hdr].msgs = 0;
|
||||
rt_list_init(&can->hdr[pitem->hdr].list);
|
||||
can->hdr[pitem->hdr_bank].connected = 1;
|
||||
can->hdr[pitem->hdr_bank].msgs = 0;
|
||||
rt_list_init(&can->hdr[pitem->hdr_bank].list);
|
||||
}
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
@@ -609,7 +609,7 @@ static rt_err_t rt_can_control(struct rt_device *dev,
|
||||
{
|
||||
while (count)
|
||||
{
|
||||
if (pitem->hdr >= can->config.maxhdr || pitem->hdr < 0)
|
||||
if (pitem->hdr_bank >= can->config.maxhdr || pitem->hdr_bank < 0)
|
||||
{
|
||||
count--;
|
||||
pitem++;
|
||||
@@ -617,16 +617,16 @@ static rt_err_t rt_can_control(struct rt_device *dev,
|
||||
}
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
if (can->hdr[pitem->hdr].connected)
|
||||
if (can->hdr[pitem->hdr_bank].connected)
|
||||
{
|
||||
can->hdr[pitem->hdr].connected = 0;
|
||||
can->hdr[pitem->hdr].msgs = 0;
|
||||
if (!rt_list_isempty(&can->hdr[pitem->hdr].list))
|
||||
can->hdr[pitem->hdr_bank].connected = 0;
|
||||
can->hdr[pitem->hdr_bank].msgs = 0;
|
||||
if (!rt_list_isempty(&can->hdr[pitem->hdr_bank].list))
|
||||
{
|
||||
rt_list_remove(can->hdr[pitem->hdr].list.next);
|
||||
rt_list_remove(can->hdr[pitem->hdr_bank].list.next);
|
||||
}
|
||||
rt_hw_interrupt_enable(level);
|
||||
rt_memset(&can->hdr[pitem->hdr].filter, 0,
|
||||
rt_memset(&can->hdr[pitem->hdr_bank].filter, 0,
|
||||
sizeof(struct rt_can_filter_item));
|
||||
}
|
||||
else
|
||||
@@ -829,7 +829,7 @@ void rt_hw_can_isr(struct rt_can_device *can, int event)
|
||||
level = rt_hw_interrupt_disable();
|
||||
rt_list_insert_before(&rx_fifo->uselist, &listmsg->list);
|
||||
#ifdef RT_CAN_USING_HDR
|
||||
hdr = tmpmsg.hdr;
|
||||
hdr = tmpmsg.hdr_index;
|
||||
if (can->hdr != RT_NULL)
|
||||
{
|
||||
RT_ASSERT(hdr < can->config.maxhdr && hdr >= 0);
|
||||
|
||||
Reference in New Issue
Block a user