Commit Graph

43 Commits

Author SHA1 Message Date
wdfk-prog
27b2ba5556 fix(CAN): Avoid double counting RX overflow drops 2026-02-10 11:41:41 +08:00
GuEe-GUI
1e82368778 [DM/CAN] Update CAN for DM
1. Kconfig import wtih DM
2. Add DM API for Drivers

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2025-12-04 15:55:33 +08:00
wdfk-prog
44cf90a4ef fix(can): Resolve potential race condition in message transmission
Some checks failed
ToolsCI / Tools (push) Has been cancelled
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
doc_doxygen / doxygen_doc generate (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :components/sal.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
doc_doxygen / deploy (push) Has been cancelled
Weekly CI Scheduler / Trigger and Monitor CIs (push) Has been cancelled
Weekly CI Scheduler / Create Discussion Report (push) Has been cancelled
Setting the send status flag `sndchange` after calling the can->ops->sendmsg function
could lead to a race condition if a transmission timeout occurs, resulting in incorrect state handling.
This patch moves the operation of setting the `sndchange` flag to before the call to can->ops->sendmsg.
This ensures that the mailbox's status is correctly marked as "sending" before the hardware begins transmission,
making the driver's state management more robust and reliable, especially in handling exceptions like timeouts.

Additionally, new macros for CAN filter modes have been added in dev_can.h.
2025-11-08 11:52:25 +08:00
wdfk-prog
11156de0de feat[can]: Implement non-blocking send mechanism and enhance CAN driver functionality
- Added support for non-blocking mode CAN message sending, including software ring buffer management and dynamic memory allocation options.
- Improved related comments and error handling.
- Updated example code to demonstrate the usage of both blocking and non-blocking sending modes, and corrected some structure field naming and macro definitions.
2025-09-28 11:17:21 +08:00
liuyucai
a1c642aa3a [Fix] <components>:drivers/can/dev_can.c 修复CAN底层无法工作时导致调用 _can_int_tx 的线程一直挂起的问题
Solution: 使用 can->status.sndchange 的bit位来表示某个发送邮箱超时
如果超时 底层驱动再通知tx_done或者tx_fail事件时不予处理

Signed-off-by: Yucai Liu <1486344514@qq.com>
2025-07-29 20:18:14 +08:00
wdfk-prog
4c18fa7e21 fix:[CAN][STM32]open时立刻启动can_start,还未完成其他配置,可能导致异常 2024-11-13 22:56:17 -05:00
CXSforHPU
416ec66380 [device] add dev_ prefix for file names 2024-08-23 18:15:09 -04:00
wdfk-prog
15a8ebe0a0 [components][driver][can]Fix possible memory overflow caused by RX
修复RX可能导致的内存溢出情况

#8634
2024-07-09 20:22:37 +08:00
sp-cai
f1832fea24 [components] [drivers ] [Kconfig] 整理 components/drivers 的 Kconfig (#9054)
整理 components/drivers 的 Kconfig
2024-06-16 15:43:27 +08:00
zms123456
be699795f8 [components][drivers]close can irq before release fifo
原来的CAN close中先释放fifo后关闭CAN中断,可能导致释放fifo后且关闭CAN中断前来CAN中断,此时rt_hw_can_isr可能在RT_ASSERT(tx/rx_fifo != RT_NULL)断言失败
2024-04-15 23:17:06 -04:00
zms123456
d5e74be81d [components][drivers][can]fix can warning in 64bit cpu (#8772)
fix can warning
2024-04-12 16:00:49 +08:00
zms123456
cbf316a5f7 [components][drivers]fix compile warning in 64 bits arch cpu (#8739)
fix compile warning in 64 bits arch
2024-04-09 21:38:10 +08:00
cmbjxxiao
6dd3802d0a [components][drivers][can]Init can tx completion flag before tx 2023-08-18 23:33:20 -04:00
7YZ7
501b22aabe [HUST CSE] Fix many abnormal symbols in annotations and format code 2023-04-17 22:26:23 -04:00
Meco Man
f58d3c5200 rt_device_write/read return data type as rt_ssize_t
rt_ssize_t can give negative error code, which follows the unix style correctly
2023-02-07 21:43:57 -05:00
wdfk-prog
569e2ae1e8 [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
2022-11-21 21:45:51 -05:00
gbcwbz
84fe80fbf9 [DeviceDriver] Fix can infinite loop when can driver send error
- in _can_int_tx if can driver sendmsg do not return RT_EOK,
   it will repeat until sendmsg return RT_EOK
 - if error occur on can bus(wire broken or EMI), all threads that
   have lower priority will not be executed
 - we should let application layer to determine if resend is appropriate
   when send fail, besides in data link layer, can already implemented
   auto resend in hardware
2022-08-13 23:07:43 -04:00
Fan Yang
666af5e29d [DeviceDriver] Add CANFD support and correct typos (#5912)
* Add CANFD support and correct typos

- Added CANFD required fields to can.h
- Fixed typos in can.h and can.c
- Corrected all the projects affected by the typo
- Fixed wrong line-ending in some affected can driver files

Signed-off-by: Fan YANG <fan.yang@hpmicro.com>

* update

Signed-off-by: Fan YANG <fan.yang@hpmicro.com>
Co-authored-by: Meco Man <920369182@qq.com>
2022-08-13 22:59:28 -04:00
Meco Man
e18d44940f [finsh] 修复由于移除finsh导致__cmd_xxx命令无法使用的问题 2021-09-05 01:57:26 -04:00
Meco Man
3c05a4e719 [compoenets] auto & manual formatted 2021-03-08 18:19:04 +08:00
Wayne Lin
5bddcd378e Get stuck issue after open-close-open CAN device.
Signed-off-by: Wayne Lin <wosayttn@gmail.com>
2020-04-27 16:01:05 +08:00
tyustli
363c9b1460 [bsp] [stm32] fix drv_can.c and can.c bug 2019-08-23 20:40:09 +08:00
tyustli
c81eebcd5d [bsp] [stm32] fix drv_can.c 2019-08-16 12:14:30 +08:00
yaomo718
b67a8152a5 [components][drivers][can] can.c bug修复:
在RT_CAN_USING_HDR宏关闭的时候,接收数据大小的计算应该是:已使用链表数*sizeof(struct rt_can_msg)。
2019-04-25 11:18:28 +08:00
杨连钊
afe802733f [components][drivers][can] can.c fix bug. 2019-03-14 17:12:27 +08:00
Noe Xu
52729bb62d Fix rtthread CAN driver issue.
Reset rx tx handler when closing CAN device, Or it will not work after
reopening.

Change-Id: I43482c21263a989322f8df2ac9349128f7cb630a
2019-01-13 23:37:15 -08:00
Bernard Xiong
2c0640a178 [license] Change license to Apache. 2018-10-14 19:37:18 +08:00
Bernard Xiong
884fb70fe9 [Kernel] Add device ops feature. 2018-06-10 17:59:17 +08:00
Bernard Xiong
8b2919aff1 [DeviceDrivers] change the type of cmd to 'int' 2017-11-01 13:39:36 +08:00
Aubr.Cool
44bac92a93 [Components]drivers can change txcompletion to sem 2017-08-30 08:00:36 +08:00
aozima
3ad3066c4b fixed rt_can_close issues. 2015-07-21 17:04:22 +08:00
Aubr.Cool
7051f01f48 [DeviceDriver]can add bus_hook 2015-07-07 12:06:24 +08:00
Aubr.Cool
5f860e8f94 [DeviceDriver]add missing hdr define 2015-07-07 12:01:56 +08:00
Aubr.Cool
0f20bf12fd [DeviceDriver]correct can critical problems 2015-07-07 11:50:39 +08:00
BernardXiong
2ca3ceab70 [DeviceDrivers] code cleanup for CAN 2015-07-06 18:24:56 +08:00
BernardXiong
91d866d81a [DeviceDrivers] Use mutex to lock can_open/close 2015-07-06 18:11:46 +08:00
BernardXiong
1488568801 [DeviceDrivers] code cleanup for CAN driver and fix some critical issue 2015-07-06 10:38:07 +08:00
Aubr.Cool
b3f0737a99 correct can compiler error and warnings 2015-06-30 14:12:30 +08:00
Aubr.Cool
c3e4fd079c correct can hdr read error 2015-06-16 08:49:25 +08:00
Aubr.Cool
9ea3219ab7 Add can driver doc 2015-05-15 11:34:43 +08:00
Aubr.Cool
c7d703158a Add SConscript for can 2015-05-15 08:00:14 +08:00
Aubr.Cool
8e29e3d98b add author information 2015-05-15 07:58:21 +08:00
Aubr.Cool
eb56b832ef Add Can Drv 2015-05-14 16:52:48 +08:00