Skip to content

Commit

Permalink
feat(uvc2): supprot bulk trans
Browse files Browse the repository at this point in the history
  • Loading branch information
lijunru-hub committed Aug 19, 2024
1 parent e937840 commit 4cf475f
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 105 deletions.
1 change: 1 addition & 0 deletions host/class/uvc/usb_host_uvc_2/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- [ ] Allow VID and PID to be 0
- [x] 1 CTRL transfer for the driver? of 1 transfer for a device?
- [ ] Mock USB host for descriptor parsing
- [x] Support bulk mode
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void frame_handling_task(void *arg)
vTaskDelay(pdMS_TO_TICKS(5000));
continue;
}
//uvc_host_desc_print(uvc_stream);
// uvc_host_desc_print(uvc_stream);
ESP_LOGI(TAG, "Device 0x%04X:0x%04X-%d OPENED!", stream_config->usb.vid, stream_config->usb.pid, uvc_index);
vTaskDelay(pdMS_TO_TICKS(100));
unsigned count = 0;
Expand Down Expand Up @@ -172,9 +172,9 @@ static const uvc_host_stream_config_t stream_mjpeg_config = {
.vs_format.fps = 15,
.vs_format.format = UVC_VS_FORMAT_MJPEG,
.advanced.number_of_frame_buffers = EXAMPLE_FRAME_COUNT,
.advanced.frame_size = 0,
.advanced.frame_size = 300*1024,
.advanced.number_of_urbs = 6,
.advanced.urb_size = 20 * 1024,
.advanced.urb_size = 8 * 1024,
};

static const uvc_host_stream_config_t stream_h265_config = {
Expand All @@ -189,9 +189,9 @@ static const uvc_host_stream_config_t stream_h265_config = {
.vs_format.fps = 15,
.vs_format.format = UVC_VS_FORMAT_H265,
.advanced.number_of_frame_buffers = EXAMPLE_FRAME_COUNT,
.advanced.frame_size = 0,
.advanced.frame_size = 300*1024,
.advanced.number_of_urbs = 6,
.advanced.urb_size = 20 * 1024,
.advanced.urb_size = 8 * 1024,
};

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32p4"
CONFIG_RTC_CLK_SRC_EXT_CRYS=y
CONFIG_RTC_CLK_CAL_CYCLES=1024
CONFIG_SPIRAM=y
CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=2048
CONFIG_USB_HOST_HW_BUFFER_BIAS_IN=y
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32p4"
CONFIG_RTC_CLK_SRC_EXT_CRYS=y
CONFIG_RTC_CLK_CAL_CYCLES=1024
CONFIG_SPIRAM=y
CONFIG_SPIRAM_SPEED_200M=y
CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=2048
CONFIG_USB_HOST_HW_BUFFER_BIAS_IN=y
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,11 @@ struct uvc_host_stream_s {
uvc_frame_t *current_frame; // Frame that is being written to
bool skip_current_frame; // Flag to skip this frame. An error has occurred during fetch
uint8_t current_frame_id; // Current frame ID. Used for start of frame detection
/*!< Bulk Mode */
uint8_t reassembling; // Indicates whether packet aggregation is occurring in bulk mode.
uint8_t fid;
uint32_t seq, hold_seq;
uint32_t pts, hold_pts;
uint32_t last_scr, hold_last_scr;
size_t got_bytes, hold_bytes;
};
Loading

0 comments on commit 4cf475f

Please sign in to comment.