Change in osmo-ccid-firmware[master]: debug usb-cdc uart: disable it.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Nov 30 07:37:06 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/26398 )

Change subject: debug usb-cdc uart: disable it.
......................................................................

debug usb-cdc uart: disable it.

Currently unused.

Change-Id: I5f39c0fe82cbfa6f2bc4b84784a7142b461b64fb
---
M sysmoOCTSIM/main.c
M sysmoOCTSIM/usb_descriptors.c
M sysmoOCTSIM/usb_descriptors.h
M sysmoOCTSIM/usb_start.c
4 files changed, 27 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 101af30..bf145cd 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -506,8 +506,10 @@
 	usb_start();
 
 	board_init();
-	command_init("sysmoOCTSIM> ");
 
+#ifdef WITH_DEBUG_CDC
+	command_init("sysmoOCTSIM> ");
+#endif
 	/* boost uart priority by setting all other irqs to uartprio+1 */
 	for(int i = 0; i < PERIPH_COUNT_IRQn; i++)
 		NVIC_SetPriority(i, 2);
diff --git a/sysmoOCTSIM/usb_descriptors.c b/sysmoOCTSIM/usb_descriptors.c
index 7652bf6..94a473e 100644
--- a/sysmoOCTSIM/usb_descriptors.c
+++ b/sysmoOCTSIM/usb_descriptors.c
@@ -46,17 +46,24 @@
 		.bLength = sizeof(struct usb_config_desc),
 		.bDescriptorType = USB_DT_CONFIG,
 		.wTotalLength = sizeof(usb_fs_descs.cfg) +
+#ifdef WITH_DEBUG_CDC
 				sizeof(usb_fs_descs.cdc) +
+#endif
 				sizeof(usb_fs_descs.ccid) +
 				sizeof(usb_fs_descs.dfu_rt) +
 				sizeof(usb_fs_descs.func_dfu),
+#ifdef WITH_DEBUG_CDC
 		.bNumInterfaces = 4,
+#else
+		.bNumInterfaces = 2,
+#endif
 		.bConfigurationValue = CONF_USB_CDCD_ACM_BCONFIGVAL,
 		.iConfiguration = STR_DESC_CONFIG,
 		.bmAttributes = CONF_USB_CDCD_ACM_BMATTRI,
 		/* FIXME: The device should offer at least one 100mA configuration. */
 		.bMaxPower = 250, /* request 500mA */
 	},
+#ifdef WITH_DEBUG_CDC
 	.cdc = {
 		.comm = {
 			.iface = {
@@ -139,6 +146,7 @@
 			},
 		},
 	},
+#endif
 	.ccid = {
 		.iface = {
 			.bLength = sizeof(struct usb_iface_desc),
@@ -208,7 +216,11 @@
 			},
 		},
 	},
+#ifdef WITH_DEBUG_CDC
 	DFURT_IF_DESCRIPTOR(3, STR_DESC_INTF_DFURT),
+#else
+	DFURT_IF_DESCRIPTOR(1, STR_DESC_INTF_DFURT),
+#endif
 	.str = {
 #if 0
 		CDCD_ACM_STR_DESCES
diff --git a/sysmoOCTSIM/usb_descriptors.h b/sysmoOCTSIM/usb_descriptors.h
index ba879f7..8733b2c 100644
--- a/sysmoOCTSIM/usb_descriptors.h
+++ b/sysmoOCTSIM/usb_descriptors.h
@@ -43,6 +43,7 @@
 	struct usb_dev_desc dev;
 	struct usb_config_desc cfg;
 
+#ifdef WITH_DEBUG_CDC
 	/* CDC-ACM: Two interfaces, one with IRQ EP and one with BULK IN + OUT */
 	struct {
 		struct {
@@ -59,6 +60,7 @@
 		} data;
 	} cdc;
 
+#endif
 	/* CCID: One interface with CCID class descriptor and three endpoints */
 	struct {
 		struct usb_iface_desc iface;
diff --git a/sysmoOCTSIM/usb_start.c b/sysmoOCTSIM/usb_start.c
index a4b787e..d4057be 100644
--- a/sysmoOCTSIM/usb_start.c
+++ b/sysmoOCTSIM/usb_start.c
@@ -132,14 +132,14 @@
 	usbdc_init(ctrl_buffer);
 	usbdc_register_handler(USBDC_HDL_REQ, &string_req_h);
 
+#ifdef WITH_DEBUG_CDC
 	/* usbdc_register_funcion inside */
 	cdcdf_acm_init();
-
+#endif
 	dfudf_init();
 
 	printf("usb_descs_size=%u\r\n", usb_descs[0].eod - usb_descs[0].sod);
-	usbdc_start((struct usbd_descriptors *) usb_descs);
-	usbdc_attach();
+
 }
 
 /**
@@ -147,15 +147,22 @@
  */
 void usb_start(void)
 {
+
+#ifdef WITH_DEBUG_CDC
 	while (!cdcdf_acm_is_enabled()) {
 		// wait cdc acm to be installed
 	};
 
 	cdcdf_acm_register_callback(CDCDF_ACM_CB_STATE_C, (FUNC_PTR)usb_device_cb_state_c);
+#endif
+	while (!ccid_df_is_enabled());
 }
 
 void usb_init(void)
 {
 	cdc_device_acm_init();
 	ccid_df_init();
+	usbdc_start((struct usbd_descriptors *) usb_descs);
+	usbdc_attach();
+
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/26398
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I5f39c0fe82cbfa6f2bc4b84784a7142b461b64fb
Gerrit-Change-Number: 26398
Gerrit-PatchSet: 4
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211130/7bb08aaf/attachment.htm>


More information about the gerrit-log mailing list