-
Notifications
You must be signed in to change notification settings - Fork 1.4k
arch/arm64/src/imx9/imx9_flexcan.c: add CAN ID filtering #17172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Can you please add more testing information about what test cases you tried, and some logs? |
arch/arm64/src/imx9/imx9_flexcan.c
Outdated
struct imx9_driver_s *priv = (struct imx9_driver_s *)dev; | ||
struct can_ioctl_filter_s *req = | ||
(struct can_ioctl_filter_s *)((uintptr_t)arg); | ||
ret = imx9_add_filter(priv, req->ftype, 0, req->fid1, req->fid2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you should add a DEBUGASSERT() before using req, to guarantee it is not NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. i added the check instead
arch/arm64/src/imx9/imx9_flexcan.c
Outdated
struct imx9_driver_s *priv = (struct imx9_driver_s *)dev; | ||
struct can_ioctl_filter_s *req = | ||
(struct can_ioctl_filter_s *)((uintptr_t)arg); | ||
ret = imx9_add_filter(priv, req->ftype, 1, req->fid1, req->fid2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. i added the check instead
arch/arm64/src/imx9/imx9_flexcan.c
Outdated
return ERROR; | ||
} | ||
|
||
if (filter_type == CAN_FILTER_MASK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using a switch case instead of if else here.
Arguably easier to read, but the main argument is that it translate to faster assembly construct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. i converted to switch case
arch/arm64/src/imx9/imx9_flexcan.c
Outdated
if (!imx9_setfreeze(priv->base, false)) | ||
{ | ||
canerr("FLEXCAN: unfreeze fail\n"); | ||
return ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change ALL ERROR to reasonable error code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. I removed all the ERROR returns and use the correct ERR code instead
722bb1c
to
7be2ae4
Compare
Add simple single ID mask filter. Only pkts with set CAN ID are accepted. This works for both STD and EXT CAN ID. Signed-off-by: haitomatic <[email protected]>
7be2ae4
to
283ba48
Compare
Summary
Add simple single ID mask filter. Only pkts with set CAN ID are accepted. This works for both STD and EXT CAN ID.
Note that Range Filter is not yet supported.
Impact
ARM64 IMX9 flexcan driver
Testing
Build Host: Ubuntu 22.04
Target: NXP IMX93 custom target