Lines Matching full:frame
27 const struct can_frame *frame = user_data; in tx_std_callback_1() local
32 zassert_equal(frame->id, TEST_CAN_STD_ID_1, "ID does not match"); in tx_std_callback_1()
42 const struct can_frame *frame = user_data; in tx_std_callback_2() local
47 zassert_equal(frame->id, TEST_CAN_STD_ID_2, "ID does not match"); in tx_std_callback_2()
57 const struct can_frame *frame = user_data; in tx_ext_callback_1() local
62 zassert_equal(frame->id, TEST_CAN_EXT_ID_1, "ID does not match"); in tx_ext_callback_1()
72 const struct can_frame *frame = user_data; in tx_ext_callback_2() local
77 zassert_equal(frame->id, TEST_CAN_EXT_ID_2, "ID does not match"); in tx_ext_callback_2()
85 static void rx_std_callback_1(const struct device *dev, struct can_frame *frame, in rx_std_callback_1() argument
90 assert_frame_equal(frame, &test_std_frame_1, 0); in rx_std_callback_1()
102 static void rx_std_callback_2(const struct device *dev, struct can_frame *frame, in rx_std_callback_2() argument
107 assert_frame_equal(frame, &test_std_frame_2, 0); in rx_std_callback_2()
119 static void rx_std_mask_callback_1(const struct device *dev, struct can_frame *frame, in rx_std_mask_callback_1() argument
124 assert_frame_equal(frame, &test_std_frame_1, 0x0F); in rx_std_mask_callback_1()
136 static void rx_std_mask_callback_2(const struct device *dev, struct can_frame *frame, in rx_std_mask_callback_2() argument
141 assert_frame_equal(frame, &test_std_frame_2, 0x0F); in rx_std_mask_callback_2()
153 static void rx_ext_callback_1(const struct device *dev, struct can_frame *frame, in rx_ext_callback_1() argument
158 assert_frame_equal(frame, &test_ext_frame_1, 0); in rx_ext_callback_1()
170 static void rx_ext_callback_2(const struct device *dev, struct can_frame *frame, in rx_ext_callback_2() argument
175 assert_frame_equal(frame, &test_ext_frame_2, 0); in rx_ext_callback_2()
187 static void rx_ext_mask_callback_1(const struct device *dev, struct can_frame *frame, in rx_ext_mask_callback_1() argument
192 assert_frame_equal(frame, &test_ext_frame_1, 0x0F); in rx_ext_mask_callback_1()
204 static void rx_ext_mask_callback_2(const struct device *dev, struct can_frame *frame, in rx_ext_mask_callback_2() argument
209 assert_frame_equal(frame, &test_ext_frame_2, 0x0F); in rx_ext_mask_callback_2()
217 * @brief Send a CAN test frame with asserts.
219 * This function will block until the frame is transmitted or a test timeout
223 * @param frame Pointer to the CAN frame to send.
225 static void send_test_frame(const struct device *dev, const struct can_frame *frame) in send_test_frame() argument
229 err = can_send(dev, frame, TEST_SEND_TIMEOUT, NULL, NULL); in send_test_frame()
231 zassert_equal(err, 0, "failed to send frame (err %d)", err); in send_test_frame()
235 * @brief Send a CAN test frame with asserts.
237 * This function will block until the frame is queued or a test timeout
241 * @param frame Pointer to the CAN frame to send.
244 static void send_test_frame_nowait(const struct device *dev, const struct can_frame *frame, in send_test_frame_nowait() argument
249 err = can_send(dev, frame, TEST_SEND_TIMEOUT, callback, (void *)frame); in send_test_frame_nowait()
251 zassert_equal(err, 0, "failed to send frame (err %d)", err); in send_test_frame_nowait()
302 * @param frame1 CAN frame 1
303 * @param frame2 CAN frame 2
393 * @param data_frame CAN data frame
394 * @param rtr_frame CAN RTR frame
400 struct can_frame frame; in send_receive_rtr() local
408 /* Verify that filter matches RTR frame */ in send_receive_rtr()
415 zassert_equal(err, 0, "failed to send RTR frame (err %d)", err); in send_receive_rtr()
417 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in send_receive_rtr()
419 assert_frame_equal(&frame, rtr_frame, 0); in send_receive_rtr()
421 /* Verify that filter matches data frame */ in send_receive_rtr()
423 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in send_receive_rtr()
425 assert_frame_equal(&frame, data_frame, 0); in send_receive_rtr()
608 * therefore ACKs its own frame.
660 * @param frame Pointer to the CAN RX filter.
783 struct can_frame frame; in ZTEST_USER() local
789 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
790 zassert_equal(err, -EAGAIN, "received a frame without sending one"); in ZTEST_USER()
811 * @brief Test sending an invalid CAN frame.
814 * @param frame Pointer to the CAN frame to send.
816 static void send_invalid_frame(const struct device *dev, const struct can_frame *frame) in send_invalid_frame() argument
822 err = can_send(dev, frame, TEST_SEND_TIMEOUT, NULL, NULL); in send_invalid_frame()
823 zassert_equal(err, -EINVAL, "wrong error on sending invalid frame (err %d)", err); in send_invalid_frame()
827 * @brief Test sending NULL frame.
835 * @brief Test sending frame with standard (11-bit) CAN ID out-of-range.
839 struct can_frame frame = { in ZTEST() local
843 send_invalid_frame(can_dev, &frame); in ZTEST()
847 * @brief Test sending frame with extended (29-bit) CAN ID out-of-range.
851 struct can_frame frame = { in ZTEST() local
856 send_invalid_frame(can_dev, &frame); in ZTEST()
860 * @brief Test sending standard (11-bit ID) CAN frame with too big payload.
864 struct can_frame frame = { in ZTEST() local
869 send_invalid_frame(can_dev, &frame); in ZTEST()
873 * @brief Test sending extended (29-bit ID) CAN frame with too big payload.
877 struct can_frame frame = { in ZTEST() local
883 send_invalid_frame(can_dev, &frame); in ZTEST()
900 const struct can_frame frame = { in ZTEST() local
911 err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL); in ZTEST()
912 zassert_equal(err, 0, "failed to send frame without data (err %d)", err); in ZTEST()
917 assert_frame_equal(&frame, &frame_buffer, 0); in ZTEST()
955 struct can_frame frame; in ZTEST_USER() local
971 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
973 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
981 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
983 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
1028 zassert_equal(err, 0, "failed to send RTR frame (err %d)", err); in ZTEST_USER()
1031 zassert_equal(err, -EAGAIN, "received a frame that should be rejected"); in ZTEST_USER()
1055 zassert_equal(err, 0, "failed to send RTR frame (err %d)", err); in ZTEST_USER()
1058 zassert_equal(err, -EAGAIN, "received a frame that should be rejected"); in ZTEST_USER()
1077 zassert_equal(err, -EAGAIN, "received a frame that should not pass the filter"); in ZTEST()
1087 struct can_frame frame = {0}; in ZTEST_USER() local
1090 frame.id = TEST_CAN_STD_ID_1; in ZTEST_USER()
1091 frame.dlc = CAN_MAX_DLC + 1; in ZTEST_USER()
1093 err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL); in ZTEST_USER()
1094 zassert_equal(err, -EINVAL, "sent a frame with an invalid DLC"); in ZTEST_USER()
1102 struct can_frame frame = {0}; in ZTEST_USER() local
1105 frame.id = TEST_CAN_STD_ID_1; in ZTEST_USER()
1106 frame.dlc = 0; in ZTEST_USER()
1107 frame.flags = CAN_FRAME_FDF; in ZTEST_USER()
1109 err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL); in ZTEST_USER()
1110 zassert_equal(err, -ENOTSUP, "sent a CAN FD format frame in non-FD mode"); in ZTEST_USER()
1193 struct can_frame frame; in ZTEST_USER() local
1201 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
1203 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
1225 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
1227 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
1237 struct can_frame frame; in ZTEST_USER() local
1245 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
1247 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
1270 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
1272 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
1282 struct can_frame frame; in ZTEST_USER() local
1296 err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT); in ZTEST_USER()
1298 assert_frame_equal(&frame, &test_std_frame_1, 0); in ZTEST_USER()
1372 zassert_not_equal(err, 0, "sent a frame in stopped state"); in ZTEST_USER()