Lines Matching refs:command
74 static int nos_device_read(const struct nos_device *dev, uint32_t command, in nos_device_read() argument
78 int err = dev->ops.read(dev->ctx, command, reinterpret_cast<uint8_t *>(buf), len); in nos_device_read()
96 static int nos_device_write(const struct nos_device *dev, uint32_t command, in nos_device_write() argument
100 int err = dev->ops.write(dev->ctx, command, reinterpret_cast<const uint8_t *>(buf), len); in nos_device_write()
240 void SetCommandInfoCrc(const void* arg, uint16_t arg_len, uint32_t command, in SetCommandInfoCrc() argument
244 crc = crc16_update(&command, sizeof(command), crc); in SetCommandInfoCrc()
250 void SetCommandInfoCrc(const void* arg, uint16_t arg_len, uint32_t command, in SetCommandInfoCrc() argument
252 SetCommandInfoCrc(arg, arg_len, command, info, sizeof(*info)); in SetCommandInfoCrc()
258 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
259 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
267 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(0); in TEST_F() local
268 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
272 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
273 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
283 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(0); in TEST_F() local
284 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
290 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
291 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
299 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
300 CMD_SET_PARAM(command, sizeof(data)); in TEST_F()
301 ASSERT_EQ(nos_device_write(dev, command, data, sizeof(data)), 0); in TEST_F()
306 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(0); in TEST_F() local
307 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
311 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
312 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
323 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_HANG); in TEST_F() local
324 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
325 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
329 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
330 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
337 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
338 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
345 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
346 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
356 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_HANG); in TEST_F() local
357 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
358 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
361 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_TRANSPORT; in TEST_F() local
362 ASSERT_EQ(nos_device_write(dev, command, nullptr, 0), 0); in TEST_F()
366 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
367 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
378 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_HANG); in TEST_F() local
379 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
380 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
386 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_1234); in TEST_F() local
387 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
388 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
395 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
396 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
406 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_NOP); in TEST_F() local
407 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
408 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
414 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
415 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
427 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_1234); in TEST_F() local
428 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
429 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
435 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
436 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
454 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_1234); in TEST_F() local
455 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
456 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
463 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
464 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
483 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_1234); in TEST_F() local
484 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
485 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
491 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
492 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
510 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_NOP); in TEST_F() local
511 SetCommandInfoCrc(nullptr, 0, command, &command_info); in TEST_F()
512 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
517 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_TRANSPORT; in TEST_F() local
518 ASSERT_EQ(nos_device_write(dev, command, nullptr, 0), 0); in TEST_F()
522 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
523 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
533 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(0); in TEST_F() local
534 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
539 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_TRANSPORT; in TEST_F() local
540 ASSERT_EQ(nos_device_write(dev, command, nullptr, 0), 0); in TEST_F()
544 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
545 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
553 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
554 CMD_SET_PARAM(command, sizeof(data)); in TEST_F()
555 ASSERT_EQ(nos_device_write(dev, command, &data, sizeof(data)), 0); in TEST_F()
561 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_9876); in TEST_F() local
562 SetCommandInfoCrc(&data, sizeof(data), command, &command_info); in TEST_F()
563 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
569 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
570 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
580 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
581 CMD_SET_PARAM(command, sizeof(data1)); in TEST_F()
582 ASSERT_EQ(nos_device_write(dev, command, &data1, sizeof(data1)), 0); in TEST_F()
586 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) in TEST_F() local
588 CMD_SET_PARAM(command, sizeof(data2)); in TEST_F()
589 ASSERT_EQ(nos_device_write(dev, command, &data2, sizeof(data2)), 0); in TEST_F()
595 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_9876); in TEST_F() local
596 SetCommandInfoCrc(&data, sizeof(data), command, &command_info); in TEST_F()
597 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
603 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
604 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
614 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
615 CMD_SET_PARAM(command, sizeof(data1)); in TEST_F()
616 ASSERT_EQ(nos_device_write(dev, command, &data1, sizeof(data1)), 0); in TEST_F()
620 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
621 CMD_SET_PARAM(command, sizeof(data2)); in TEST_F()
622 ASSERT_EQ(nos_device_write(dev, command, &data2, sizeof(data2)), 0); in TEST_F()
628 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_9876); in TEST_F() local
629 SetCommandInfoCrc(&data, sizeof(data), command, &command_info); in TEST_F()
630 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
636 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
637 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
647 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
648 CMD_SET_PARAM(command, sizeof(spam)); in TEST_F()
649 ASSERT_EQ(nos_device_write(dev, command, spam, sizeof(spam)), 0); in TEST_F()
653 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
654 CMD_SET_PARAM(command, sizeof(data1)); in TEST_F()
655 ASSERT_EQ(nos_device_write(dev, command, &data1, sizeof(data1)), 0); in TEST_F()
659 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) in TEST_F() local
661 CMD_SET_PARAM(command, sizeof(data2)); in TEST_F()
662 ASSERT_EQ(nos_device_write(dev, command, &data2, sizeof(data2)), 0); in TEST_F()
668 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_9876); in TEST_F() local
669 SetCommandInfoCrc(&data, sizeof(data), command, &command_info); in TEST_F()
670 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
676 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
677 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
696 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_NOP); in TEST_F() local
698 SetCommandInfoCrc(nullptr, 0, command, &command_info, sizeof(command_info)); in TEST_F()
699 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
705 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
706 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
722 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(0); in TEST_F() local
723 SetCommandInfoCrc(nullptr, 0, command, &command_info, sizeof(command_info)); in TEST_F()
724 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
730 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
731 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
753 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_NOP); in TEST_F() local
755 SetCommandInfoCrc(nullptr, 0, command, &command_info, sizeof(command_info)); in TEST_F()
756 ASSERT_EQ(nos_device_write(dev, command, &command_info, sizeof(command_info)), 0); in TEST_F()
762 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
763 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
774 uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_DATA | CMD_TRANSPORT; in TEST_F() local
775 CMD_SET_PARAM(command, sizeof(data)); in TEST_F()
776 ASSERT_EQ(nos_device_write(dev, command, &data, sizeof(data)), 0); in TEST_F()
780 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
781 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()
785 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_PARAM(TRANSPORT_TEST_NOP); in TEST_F() local
786 ASSERT_EQ(nos_device_write(dev, command, nullptr, 0), 0); in TEST_F()
792 const uint32_t command = CMD_ID(APP_ID_TRANSPORT_TEST) | CMD_IS_READ | CMD_TRANSPORT; in TEST_F() local
793 ASSERT_EQ(nos_device_read(dev, command, &status, sizeof(transport_status)), 0); in TEST_F()