Skip to content

Commit

Permalink
tests/drivers/candev: minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
firas-hamdi committed Mar 26, 2024
1 parent dcb8865 commit e39c6c9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/drivers/candev/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int _set_can_filter(int argc, char **argv)
struct can_filter filter = {
.can_mask = 0x7FF,
.can_id = 0x1aa,
#if !defined(__linux__)
#if (MODULE_CAN_RX_MAILBOX)
.target_mailbox = 1,
#endif
};
Expand Down Expand Up @@ -308,34 +308,35 @@ if (IS_ACTIVE(CONFIG_USE_LOOPBACK_MODE)) {
}

/* Depending from the CAN controller used, this test example will provide different results.
For MCP2515 standalone CAN controller, the last filter won't be applied as the first reception mailbox supports up to two filters
For SAMD5x/E5x CAN controller, and with keeping the default parameters in candev_samd5x.h, the last filter won't be applied
as the CAN controller supports up to 3 standard filters
For SAMD5x/E5x CAN controller, if you increase the maximum capacity of the standard filters (as mentioned in Makefile.board.dep),
the last filter can be applied correctly. */
- For MCP2515 standalone CAN controller, the last filter won't be applied
as the first reception mailbox supports up to two filters
- For SAMD5x/E5x CAN controller, and with keeping the default parameters in candev_samd5x.h,
the last filter won't be applied as the CAN controller supports up to 3 standard filters
- For SAMD5x/E5x CAN controller, if you increase the maximum capacity of the standard
filters (check Makefile.board.dep), the last filter can be applied correctly. */
#if defined(MODULE_MCP2515)
if (IS_ACTIVE(MCP2515_RECV_FILTER_EN)) {
#endif
/* CAN filters examples */
struct can_filter filter[4];
filter[0].can_mask = 0x7FF;
filter[0].can_id = 0x001;
#if !defined(__linux__)
#if (MODULE_CAN_RX_MAILBOX)
filter[0].target_mailbox = 0;
#endif
filter[1].can_mask = 0x7FF;
filter[1].can_id = 0x002;
#if !defined(__linux__)
#if (MODULE_CAN_RX_MAILBOX)
filter[1].target_mailbox = 1;
#endif
filter[2].can_mask = 0x7FF;
filter[2].can_id = 0x003;
#if !defined(__linux__)
#if (MODULE_CAN_RX_MAILBOX)
filter[2].target_mailbox = 0;
#endif
filter[3].can_mask = 0x7FF;
filter[3].can_id = 0x004;
#if !defined(__linux__)
#if (MODULE_CAN_RX_MAILBOX)
filter[3].target_mailbox = 1;
#endif
for (uint8_t i = 0; i < 4; i++) {
Expand Down

0 comments on commit e39c6c9

Please sign in to comment.