aboutsummaryrefslogtreecommitdiffstats
path: root/usbdrv/usbdrv.c
diff options
context:
space:
mode:
authoryiancar <yiangosyiangou@cytanet.com.cy>2020-08-16 01:07:21 +0100
committerGitHub <noreply@github.com>2020-08-15 17:07:21 -0700
commitbdb53e4c043d089279d9891b68bea77614cb97ee (patch)
treee9a7ba50a29ae7f45c941d89f2578981cee6a0f4 /usbdrv/usbdrv.c
parent9a42d205eb60faca494ff4eabce8d59f0ec0fc7f (diff)
downloadv-usb-bdb53e4c043d089279d9891b68bea77614cb97ee.tar.gz
v-usb-bdb53e4c043d089279d9891b68bea77614cb97ee.tar.bz2
v-usb-bdb53e4c043d089279d9891b68bea77614cb97ee.zip
Added 3rd endpoint (#1)HEADmaster
* Added 3rd endpoint - Added 3rd endpoint check in asmcommon. This adds 2 extra cycles to the USB routine when enabled. With 16MHz clock (most if not all qmk build use that) the routine is still within spec. - Updated prototype.h file to add additional options. - Simulatanius changes in QMK to follow soon * Update usbdrv/usbdrv.c * Update usbdrv/usbdrv.c * Update usbdrv/usbdrv.c * Update usbdrv/usbdrv.c * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal * Update usbdrv/usbdrvasm.S Accepted to keep changes minimal
Diffstat (limited to 'usbdrv/usbdrv.c')
-rw-r--r--usbdrv/usbdrv.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/usbdrv/usbdrv.c b/usbdrv/usbdrv.c
index 1d80ac6..b0cb565 100644
--- a/usbdrv/usbdrv.c
+++ b/usbdrv/usbdrv.c
@@ -37,6 +37,9 @@ usbTxStatus_t usbTxStatus1;
# if USB_CFG_HAVE_INTRIN_ENDPOINT3
usbTxStatus_t usbTxStatus3;
# endif
+# if USB_CFG_HAVE_INTRIN_ENDPOINT4
+usbTxStatus_t usbTxStatus4;
+# endif
#endif
#if USB_CFG_CHECK_DATA_TOGGLING
uchar usbCurrentDataToken;/* when we check data toggling to ignore duplicate packets */
@@ -139,7 +142,7 @@ PROGMEM const char usbDescriptorDevice[] = { /* USB device descriptor */
PROGMEM const char usbDescriptorConfiguration[] = { /* USB configuration descriptor */
9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
USBDESCR_CONFIG, /* descriptor type */
- 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 +
+ 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT4 +
(USB_CFG_DESCR_PROPS_HID & 0xff), 0,
/* total length of data returned (including inlined descriptors) */
1, /* number of interfaces in this configuration */
@@ -187,6 +190,14 @@ PROGMEM const char usbDescriptorConfiguration[] = { /* USB configuration desc
8, 0, /* maximum packet size */
USB_CFG_INTR_POLL_INTERVAL, /* in ms */
#endif
+#if USB_CFG_HAVE_INTRIN_ENDPOINT4 /* endpoint descriptor for endpoint 4 */
+ 7, /* sizeof(usbDescrEndpoint) */
+ USBDESCR_ENDPOINT, /* descriptor type = endpoint */
+ (char)(0x80 | USB_CFG_EP4_NUMBER), /* IN endpoint number 4 */
+ 0x03, /* attrib: Interrupt endpoint */
+ 8, 0, /* maximum packet size */
+ USB_CFG_INTR_POLL_INTERVAL, /* in ms */
+#endif
};
#endif
@@ -199,6 +210,9 @@ static inline void usbResetDataToggling(void)
# if USB_CFG_HAVE_INTRIN_ENDPOINT3
USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */
# endif
+# if USB_CFG_HAVE_INTRIN_ENDPOINT4
+ USB_SET_DATATOKEN4(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */
+# endif
#endif
}
@@ -209,6 +223,9 @@ static inline void usbResetStall(void)
#if USB_CFG_HAVE_INTRIN_ENDPOINT3
usbTxLen3 = USBPID_NAK;
#endif
+#if USB_CFG_HAVE_INTRIN_ENDPOINT4
+ usbTxLen4 = USBPID_NAK;
+#endif
#endif
}
@@ -252,6 +269,13 @@ USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len)
usbGenericSetInterrupt(data, len, &usbTxStatus3);
}
#endif
+
+#if USB_CFG_HAVE_INTRIN_ENDPOINT4
+USB_PUBLIC void usbSetInterrupt4(uchar *data, uchar len)
+{
+ usbGenericSetInterrupt(data, len, &usbTxStatus4);
+}
+#endif
#endif /* USB_CFG_SUPPRESS_INTR_CODE */
/* ------------------ utilities for code following below ------------------- */
@@ -628,6 +652,9 @@ USB_PUBLIC void usbInit(void)
#if USB_CFG_HAVE_INTRIN_ENDPOINT3
usbTxLen3 = USBPID_NAK;
#endif
+#if USB_CFG_HAVE_INTRIN_ENDPOINT4
+ usbTxLen4 = USBPID_NAK;
+#endif
#endif
}