4 #ifndef OPENTITAN_SW_HOST_TESTS_USBDEV_USBDEV_STREAM_USBDEV_STREAM_H_
5 #define OPENTITAN_SW_HOST_TESTS_USBDEV_USBDEV_STREAM_USBDEV_STREAM_H_
15 typedef struct __attribute__((packed)) usbdev_stream_sig {
48 } usbdev_stream_sig_t;
53 USBDevStream(
unsigned id, uint32_t num_bytes,
bool retrieve,
bool check,
54 bool send,
bool verbose);
66 StreamType_Isochronous,
98 unsigned ID()
const {
return id_; }
104 s += std::to_string(
id_);
116 bool verbose =
false)
const = 0;
164 case StreamType_Serial:
166 case StreamType_Bulk:
168 case StreamType_Interrupt:
170 case StreamType_Isochronous:
171 return "Isochronous";
172 case StreamType_Control:
208 bool AddData(
const uint8_t *data, uint32_t len);
257 void SigProcess(
const usbdev_stream_sig_t &sig);
264 uint32_t
SigDetect(usbdev_stream_sig_t *sig,
const uint8_t *sp,
272 void SigReport(
const usbdev_stream_sig_t &sig);
315 inline uint8_t sig_read8(
size_t offset) {
316 uint32_t rd_idx =
buf_.rd_idx + offset;
320 return buf_.data[rd_idx];
325 inline uint16_t sig_read16(
size_t offset) {
326 uint32_t rd_idx =
buf_.rd_idx + offset;
330 uint16_t d =
buf_.data[rd_idx++];
334 return d | (
buf_.data[rd_idx++] << 8);
339 inline uint32_t sig_read32(
size_t offset) {
340 uint32_t rd_idx =
buf_.rd_idx + offset;
348 d = (d >> 8) | (
buf_.data[rd_idx++] << 24);