tests: drivers: can: canfd: add support filter type frame
Add new filter to configure correctly FD frame.
@@ -113,6 +113,24 @@ const struct can_filter test_std_filter_2 = {
.mask = CAN_STD_ID_MASK
};
+/**
+ * @brief Standard (11-bit) CAN-FD ID filter 1.
+ */
+const struct can_filter test_std_filter_fd_1 = {
+ .flags = CAN_FILTER_DATA | CAN_FILTER_FDF,
+ .id = TEST_CAN_STD_ID_1,
+ .mask = CAN_STD_ID_MASK
+};
+
+/**
+ * @brief Standard (11-bit) CAN-FD ID filter 2.
+ */
+const struct can_filter test_std_filter_fd_2 = {
+ .flags = CAN_FILTER_DATA | CAN_FILTER_FDF,
+ .id = TEST_CAN_STD_ID_2,
+ .mask = CAN_STD_ID_MASK
+};
+
/**
* @brief Assert that two CAN frames are equal.
*
@@ -177,7 +195,7 @@ static void rx_std_callback_fd_1(const struct device *dev, struct can_frame *fra
assert_frame_equal(frame, &test_std_frame_fd_1);
zassert_equal(dev, can_dev, "CAN device does not match");
- zassert_equal_ptr(filter, &test_std_filter_1, "filter does not match");
+ zassert_equal_ptr(filter, &test_std_filter_fd_1, "filter does not match");
k_sem_give(&rx_callback_sem);
}
@@ -189,7 +207,7 @@ static void rx_std_callback_fd_2(const struct device *dev, struct can_frame *fra
assert_frame_equal(frame, &test_std_frame_fd_2);
zassert_equal(dev, can_dev, "CAN device does not match");
- zassert_equal_ptr(filter, &test_std_filter_2, "filter does not match");
+ zassert_equal_ptr(filter, &test_std_filter_fd_2, "filter does not match");
k_sem_give(&rx_callback_sem);
}
@@ -363,7 +381,7 @@ ZTEST(canfd, test_send_receive_classic)
*/
ZTEST(canfd, test_send_receive_fd)
{
- send_receive(&test_std_filter_1, &test_std_filter_2,
+ send_receive(&test_std_filter_fd_1, &test_std_filter_fd_2,
&test_std_frame_fd_1, &test_std_frame_fd_2);
}
@@ -372,7 +390,7 @@ ZTEST(canfd, test_send_receive_fd)
*/
ZTEST(canfd, test_send_receive_mixed)
{
- send_receive(&test_std_filter_1, &test_std_filter_2,
+ send_receive(&test_std_filter_fd_1, &test_std_filter_2,
&test_std_frame_fd_1, &test_std_frame_2);
}
