This is an automated email from the ASF dual-hosted git repository.
raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 724ad008abc ctucanfd: increase rwcnt bitfield width and fix structure
alignment
724ad008abc is described below
commit 724ad008abcc94e1d2308068227d815dc8ae1bfa
Author: xucheng5 <[email protected]>
AuthorDate: Tue Jul 15 21:55:56 2025 +0800
ctucanfd: increase rwcnt bitfield width and fix structure alignment
The rwcnt (read word count) field in ctucanfd_frame_fmt_s was previously
limited to 4 bits, allowing a maximum value of 15. This is insufficient
to correctly represent the frame size (excluding the FRAME_FORMAT word)
for larger CAN FD frames as required by the CTU CAN FD hardware.
Increase the rwcnt bitfield width to support a larger range and adjust
the structure layout so that ctucanfd_frame_fmt_s has a size that is a
multiple of 4 bytes, as required by the hardware interface.
This change improves correctness and robustness when handling larger
CAN FD frames without affecting existing users.
Signed-off-by: xucheng5 <[email protected]>
---
drivers/can/ctucanfd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/can/ctucanfd.h b/drivers/can/ctucanfd.h
index 79873ff1fd0..84b040b308b 100644
--- a/drivers/can/ctucanfd.h
+++ b/drivers/can/ctucanfd.h
@@ -208,7 +208,7 @@ begin_packed_struct struct ctucanfd_frame_fmt_s
uint32_t lbpf:1; /* Loop-back frame */
uint32_t brs:1; /* Bit rate shift */
uint32_t esi_rsv:1; /* Error state indicator */
- uint32_t rwcnt:4; /* Size without FRAME_FORMAT WORD */
+ uint32_t rwcnt:5; /* Size without FRAME_FORMAT WORD */
uint32_t erf_pos:4; /* Error frame position */
uint32_t erf_erp:1; /* Error passive state */
uint32_t erf_type:3; /* Error frame type */