summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakimisu <[email protected]>2023-06-21 23:30:44 +0800
committersakimisu <[email protected]>2023-06-21 23:30:44 +0800
commit2ca22deaad5cc95187e6a5341442df90c85f820a (patch)
tree907afa677439a48bf397775b3492d4724557095e
parent340fa4e024e3f2ef38fe32102753388e87e8073b (diff)
remove unused code
-rw-r--r--class/video/usbh_video.c130
-rw-r--r--class/video/usbh_video.h7
-rw-r--r--demo/usb_host.c126
3 files changed, 126 insertions, 137 deletions
diff --git a/class/video/usbh_video.c b/class/video/usbh_video.c
index 372b748d..cb1d7de5 100644
--- a/class/video/usbh_video.c
+++ b/class/video/usbh_video.c
@@ -433,132 +433,6 @@ static int usbh_video_streaming_disconnect(struct usbh_hubport *hport, uint8_t i
return 0;
}
-#if 0
-void usbh_videostreaming_parse_mjpeg(struct usbh_urb *urb, struct usbh_videostreaming *stream)
-{
- struct usbh_iso_frame_packet *iso_packet;
- uint32_t num_of_iso_packets;
- uint8_t data_offset;
- uint32_t data_len;
- uint8_t header_len = 0;
-
- num_of_iso_packets = urb->num_of_iso_packets;
- iso_packet = urb->iso_packet;
-
- for (uint32_t i = 0; i < num_of_iso_packets; i++) {
- /*
- uint8_t frameIdentifier : 1U;
- uint8_t endOfFrame : 1U;
- uint8_t presentationTimeStamp : 1U;
- uint8_t sourceClockReference : 1U;
- uint8_t reserved : 1U;
- uint8_t stillImage : 1U;
- uint8_t errorBit : 1U;
- uint8_t endOfHeader : 1U;
- */
- if (iso_packet[i].actual_length == 0) { /* skip no data */
- continue;
- }
-
- header_len = iso_packet[i].transfer_buffer[0];
-
- if ((header_len > 12) || (header_len == 0)) { /* do not be illegal */
- while (1) {
- }
- }
- if (iso_packet[i].transfer_buffer[1] & (1 << 6)) { /* error bit, re-receive */
- stream->bufoffset = 0;
- continue;
- }
-
- if ((stream->bufoffset == 0) && ((iso_packet[i].transfer_buffer[header_len] != 0xff) || (iso_packet[i].transfer_buffer[header_len + 1] != 0xd8))) {
- stream->bufoffset = 0;
- continue;
- }
-
- data_offset = header_len;
- data_len = iso_packet[i].actual_length - header_len;
-
- /** do something here */
-
- stream->bufoffset += data_len;
-
- if (iso_packet[i].transfer_buffer[1] & (1 << 1)) {
- if ((iso_packet[i].transfer_buffer[iso_packet[i].actual_length - 2] != 0xff) || (iso_packet[i].transfer_buffer[iso_packet[i].actual_length - 1] != 0xd9)) {
- stream->bufoffset = 0;
- continue;
- }
-
- /** do something here */
-
- if (stream->video_one_frame_callback) {
- stream->video_one_frame_callback(stream);
- }
- stream->bufoffset = 0;
- }
- }
- /** do something here */
-}
-
-void usbh_videostreaming_parse_yuyv2(struct usbh_urb *urb, struct usbh_videostreaming *stream)
-{
- struct usbh_iso_frame_packet *iso_packet;
- uint32_t num_of_iso_packets;
- uint8_t data_offset;
- uint32_t data_len;
- uint8_t header_len = 0;
-
- num_of_iso_packets = urb->num_of_iso_packets;
- iso_packet = urb->iso_packet;
-
- for (uint32_t i = 0; i < num_of_iso_packets; i++) {
- /*
- uint8_t frameIdentifier : 1U;
- uint8_t endOfFrame : 1U;
- uint8_t presentationTimeStamp : 1U;
- uint8_t sourceClockReference : 1U;
- uint8_t reserved : 1U;
- uint8_t stillImage : 1U;
- uint8_t errorBit : 1U;
- uint8_t endOfHeader : 1U;
- */
-
- if (iso_packet[i].actual_length == 0) { /* skip no data */
- continue;
- }
-
- header_len = iso_packet[i].transfer_buffer[0];
-
- if ((header_len > 12) || (header_len == 0)) { /* do not be illegal */
- while (1) {
- }
- }
- if (iso_packet[i].transfer_buffer[1] & (1 << 6)) { /* error bit, re-receive */
- stream->bufoffset = 0;
- continue;
- }
-
- data_offset = header_len;
- data_len = iso_packet[i].actual_length - header_len;
-
- /** do something here */
-
- stream->bufoffset += data_len;
-
- if (iso_packet[i].transfer_buffer[1] & (1 << 1)) {
- /** do something here */
-
- if (stream->video_one_frame_callback && (stream->bufoffset == stream->buflen)) {
- stream->video_one_frame_callback(stream);
- }
- stream->bufoffset = 0;
- }
- }
-
- /** do something here */
-}
-#endif
-
__WEAK void usbh_video_run(struct usbh_video *video_class)
{
}
@@ -567,10 +441,6 @@ __WEAK void usbh_video_stop(struct usbh_video *video_class)
{
}
-__WEAK void usbh_videostreaming_output(uint8_t *input, uint32_t input_len)
-{
-}
-
const struct usbh_class_driver video_ctrl_class_driver = {
.driver_name = "video_ctrl",
.connect = usbh_video_ctrl_connect,
diff --git a/class/video/usbh_video.h b/class/video/usbh_video.h
index eacfbb3c..a9df365a 100644
--- a/class/video/usbh_video.h
+++ b/class/video/usbh_video.h
@@ -52,9 +52,6 @@ struct usbh_video {
extern "C" {
#endif
-void usbh_video_inityuyv2rgb_table(void);
-void usbh_video_yuyv2rgb565(void *input, void *output, uint32_t len);
-
int usbh_video_get_cur(struct usbh_video *video_class, uint8_t intf, uint8_t entity_id, uint8_t cs, uint8_t *buf, uint16_t len);
int usbh_video_set_cur(struct usbh_video *video_class, uint8_t intf, uint8_t entity_id, uint8_t cs, uint8_t *buf, uint16_t len);
int usbh_videostreaming_get_cur_probe(struct usbh_video *video_class);
@@ -70,10 +67,6 @@ int usbh_video_close(struct usbh_video *video_class);
void usbh_video_list_info(struct usbh_video *video_class);
-void usbh_videostreaming_parse_mjpeg(struct usbh_urb *urb, struct usbh_videostreaming *stream);
-void usbh_videostreaming_parse_yuyv2(struct usbh_urb *urb, struct usbh_videostreaming *stream);
-void usbh_videostreaming_output(uint8_t *input, uint32_t input_len);
-
void usbh_video_run(struct usbh_video *video_class);
void usbh_video_stop(struct usbh_video *video_class);
diff --git a/demo/usb_host.c b/demo/usb_host.c
index f62670b9..ee842d03 100644
--- a/demo/usb_host.c
+++ b/demo/usb_host.c
@@ -254,6 +254,132 @@ find_class:
}
#endif
+#if 0
+void usbh_videostreaming_parse_mjpeg(struct usbh_urb *urb, struct usbh_videostreaming *stream)
+{
+ struct usbh_iso_frame_packet *iso_packet;
+ uint32_t num_of_iso_packets;
+ uint8_t data_offset;
+ uint32_t data_len;
+ uint8_t header_len = 0;
+
+ num_of_iso_packets = urb->num_of_iso_packets;
+ iso_packet = urb->iso_packet;
+
+ for (uint32_t i = 0; i < num_of_iso_packets; i++) {
+ /*
+ uint8_t frameIdentifier : 1U;
+ uint8_t endOfFrame : 1U;
+ uint8_t presentationTimeStamp : 1U;
+ uint8_t sourceClockReference : 1U;
+ uint8_t reserved : 1U;
+ uint8_t stillImage : 1U;
+ uint8_t errorBit : 1U;
+ uint8_t endOfHeader : 1U;
+ */
+ if (iso_packet[i].actual_length == 0) { /* skip no data */
+ continue;
+ }
+
+ header_len = iso_packet[i].transfer_buffer[0];
+
+ if ((header_len > 12) || (header_len == 0)) { /* do not be illegal */
+ while (1) {
+ }
+ }
+ if (iso_packet[i].transfer_buffer[1] & (1 << 6)) { /* error bit, re-receive */
+ stream->bufoffset = 0;
+ continue;
+ }
+
+ if ((stream->bufoffset == 0) && ((iso_packet[i].transfer_buffer[header_len] != 0xff) || (iso_packet[i].transfer_buffer[header_len + 1] != 0xd8))) {
+ stream->bufoffset = 0;
+ continue;
+ }
+
+ data_offset = header_len;
+ data_len = iso_packet[i].actual_length - header_len;
+
+ /** do something here */
+
+ stream->bufoffset += data_len;
+
+ if (iso_packet[i].transfer_buffer[1] & (1 << 1)) {
+ if ((iso_packet[i].transfer_buffer[iso_packet[i].actual_length - 2] != 0xff) || (iso_packet[i].transfer_buffer[iso_packet[i].actual_length - 1] != 0xd9)) {
+ stream->bufoffset = 0;
+ continue;
+ }
+
+ /** do something here */
+
+ if (stream->video_one_frame_callback) {
+ stream->video_one_frame_callback(stream);
+ }
+ stream->bufoffset = 0;
+ }
+ }
+ /** do something here */
+}
+
+void usbh_videostreaming_parse_yuyv2(struct usbh_urb *urb, struct usbh_videostreaming *stream)
+{
+ struct usbh_iso_frame_packet *iso_packet;
+ uint32_t num_of_iso_packets;
+ uint8_t data_offset;
+ uint32_t data_len;
+ uint8_t header_len = 0;
+
+ num_of_iso_packets = urb->num_of_iso_packets;
+ iso_packet = urb->iso_packet;
+
+ for (uint32_t i = 0; i < num_of_iso_packets; i++) {
+ /*
+ uint8_t frameIdentifier : 1U;
+ uint8_t endOfFrame : 1U;
+ uint8_t presentationTimeStamp : 1U;
+ uint8_t sourceClockReference : 1U;
+ uint8_t reserved : 1U;
+ uint8_t stillImage : 1U;
+ uint8_t errorBit : 1U;
+ uint8_t endOfHeader : 1U;
+ */
+
+ if (iso_packet[i].actual_length == 0) { /* skip no data */
+ continue;
+ }
+
+ header_len = iso_packet[i].transfer_buffer[0];
+
+ if ((header_len > 12) || (header_len == 0)) { /* do not be illegal */
+ while (1) {
+ }
+ }
+ if (iso_packet[i].transfer_buffer[1] & (1 << 6)) { /* error bit, re-receive */
+ stream->bufoffset = 0;
+ continue;
+ }
+
+ data_offset = header_len;
+ data_len = iso_packet[i].actual_length - header_len;
+
+ /** do something here */
+
+ stream->bufoffset += data_len;
+
+ if (iso_packet[i].transfer_buffer[1] & (1 << 1)) {
+ /** do something here */
+
+ if (stream->video_one_frame_callback && (stream->bufoffset == stream->buflen)) {
+ stream->video_one_frame_callback(stream);
+ }
+ stream->bufoffset = 0;
+ }
+ }
+
+ /** do something here */
+}
+#endif
+
void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class)
{
}