From bdb53e4c043d089279d9891b68bea77614cb97ee Mon Sep 17 00:00:00 2001 From: yiancar Date: Sun, 16 Aug 2020 01:07:21 +0100 Subject: Added 3rd endpoint (#1) * 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 --- usbdrv/usbdrv.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'usbdrv/usbdrv.h') diff --git a/usbdrv/usbdrv.h b/usbdrv/usbdrv.h index f094120..7a44b6d 100644 --- a/usbdrv/usbdrv.h +++ b/usbdrv/usbdrv.h @@ -268,6 +268,11 @@ USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); #define usbInterruptIsReady3() (usbTxLen3 & 0x10) /* Same as above for endpoint 3 */ #endif +#if USB_CFG_HAVE_INTRIN_ENDPOINT4 +USB_PUBLIC void usbSetInterrupt4(uchar *data, uchar len); +#define usbInterruptIsReady4() (usbTxLen4 & 0x10) +/* Same as above for endpoint 4 */ +#endif #endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ #if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ #define usbHidReportDescriptor usbDescriptorHidReport @@ -408,8 +413,9 @@ extern volatile schar usbRxLen; #define USB_SET_DATATOKEN1(token) usbTxBuf1[0] = token #define USB_SET_DATATOKEN3(token) usbTxBuf3[0] = token +#define USB_SET_DATATOKEN4(token) usbTxBuf4[0] = token /* These two macros can be used by application software to reset data toggling - * for interrupt-in endpoints 1 and 3. Since the token is toggled BEFORE + * for interrupt-in endpoints 1, 3 and 4. Since the token is toggled BEFORE * sending data, you must set the opposite value of the token which should come * first. */ @@ -592,10 +598,18 @@ int usbDescriptorStringSerialNumber[]; #define USB_CFG_EP3_NUMBER 3 #endif +#ifndef USB_CFG_EP4_NUMBER /* if not defined in usbconfig.h */ +#define USB_CFG_EP4_NUMBER 4 +#endif + #ifndef USB_CFG_HAVE_INTRIN_ENDPOINT3 #define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 #endif +#ifndef USB_CFG_HAVE_INTRIN_ENDPOINT4 +#define USB_CFG_HAVE_INTRIN_ENDPOINT4 0 +#endif + #define USB_BUFSIZE 11 /* PID, 8 bytes data, 2 bytes CRC */ /* ----- Try to find registers and bits responsible for ext interrupt 0 ----- */ @@ -683,11 +697,13 @@ typedef struct usbTxStatus{ uchar buffer[USB_BUFSIZE]; }usbTxStatus_t; -extern usbTxStatus_t usbTxStatus1, usbTxStatus3; +extern usbTxStatus_t usbTxStatus1, usbTxStatus3, usbTxStatus4; #define usbTxLen1 usbTxStatus1.len #define usbTxBuf1 usbTxStatus1.buffer #define usbTxLen3 usbTxStatus3.len #define usbTxBuf3 usbTxStatus3.buffer +#define usbTxLen4 usbTxStatus4.len +#define usbTxBuf4 usbTxStatus4.buffer typedef union usbWord{ -- cgit v1.2.3