diff options
author | Christian Starkjohann <cs+github@obdev.at> | 2008-10-21 16:13:07 +0000 |
---|---|---|
committer | Christian Starkjohann <cs+github@obdev.at> | 2008-10-21 16:13:07 +0000 |
commit | d12a1700cd3ddefd7a3bcfcff2238ec6ec6d1234 (patch) | |
tree | e4364b16786037864b3f778ab687fd1d75953ebb /usbdrv | |
parent | ae840220bb1cc546e81992ea3e6e22f7b2a543d2 (diff) | |
download | v-usb-d12a1700cd3ddefd7a3bcfcff2238ec6ec6d1234.tar.gz v-usb-d12a1700cd3ddefd7a3bcfcff2238ec6ec6d1234.tar.bz2 v-usb-d12a1700cd3ddefd7a3bcfcff2238ec6ec6d1234.zip |
- implemented option USB_CFG_SUPPRESS_INTR_CODE
Diffstat (limited to 'usbdrv')
-rw-r--r-- | usbdrv/asmcommon.inc | 6 | ||||
-rw-r--r-- | usbdrv/usbconfig-prototype.h | 8 | ||||
-rw-r--r-- | usbdrv/usbdrv.c | 10 |
3 files changed, 20 insertions, 4 deletions
diff --git a/usbdrv/asmcommon.inc b/usbdrv/asmcommon.inc index febfeb0..22ee3b0 100644 --- a/usbdrv/asmcommon.inc +++ b/usbdrv/asmcommon.inc @@ -153,6 +153,7 @@ handleIn: ; RAM this way and avoid potential problems with endless retries. The rest of ; the driver assumes error-free transfers anyway. +#if !USB_CFG_SUPPRESS_INTR_CODE #if USB_CFG_HAVE_INTRIN_ENDPOINT /* placed here due to relative jump range */ handleIn1: ;[38] #if USB_CFG_HAVE_INTRIN_ENDPOINT3 @@ -179,3 +180,8 @@ handleIn3: ldi YH, hi8(usbTxBuf3) ;[48] rjmp usbSendAndReti ;[49] 51 + 12 = 63 until SOP #endif +#else /* USB_CFG_SUPPRESS_INTR_CODE */ +handleIn1: + ldi cnt, USBPID_NAK + rjmp sendCntAndReti +#endif /* USB_CFG_SUPPRESS_INTR_CODE */ diff --git a/usbdrv/usbconfig-prototype.h b/usbdrv/usbconfig-prototype.h index 488d776..79fe346 100644 --- a/usbdrv/usbconfig-prototype.h +++ b/usbdrv/usbconfig-prototype.h @@ -94,6 +94,14 @@ section at the end of this file). * it is required by the standard. We have made it a config option because it * bloats the code considerably. */ +#define USB_CFG_SUPPRESS_INTR_CODE 0 +/* Define this to 1 if you want to declare interrupt-in endpoints, but don't + * want to send any data over them. If this macro is defined to 1, functions + * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if + * you need the interrupt-in endpoints in order to comply to an interface + * (e.g. HID), but never want to send any data. This option saves a couple + * of bytes in flash memory and the transmit buffers in RAM. + */ #define USB_CFG_INTR_POLL_INTERVAL 10 /* If you compile a version with endpoint 1 (interrupt-in), this is the poll * interval. The value is in milliseconds and must not be less than 10 ms for diff --git a/usbdrv/usbdrv.c b/usbdrv/usbdrv.c index 583d53a..2df6ad7 100644 --- a/usbdrv/usbdrv.c +++ b/usbdrv/usbdrv.c @@ -34,7 +34,7 @@ uchar usbTxBuf[USB_BUFSIZE];/* data to transmit with next IN, free if usbT #if USB_COUNT_SOF volatile uchar usbSofCount; /* incremented by assembler module every SOF */ #endif -#if USB_CFG_HAVE_INTRIN_ENDPOINT +#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE usbTxStatus_t usbTxStatus1; # if USB_CFG_HAVE_INTRIN_ENDPOINT3 usbTxStatus_t usbTxStatus3; @@ -196,7 +196,7 @@ PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor static inline void usbResetDataToggling(void) { -#if USB_CFG_HAVE_INTRIN_ENDPOINT +#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE USB_SET_DATATOKEN1(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ # if USB_CFG_HAVE_INTRIN_ENDPOINT3 USB_SET_DATATOKEN3(USB_INITIAL_DATATOKEN); /* reset data toggling for interrupt endpoint */ @@ -216,6 +216,7 @@ static inline void usbResetStall(void) /* ------------------------------------------------------------------------- */ +#if !USB_CFG_SUPPRESS_INTR_CODE #if USB_CFG_HAVE_INTRIN_ENDPOINT static void usbGenericSetInterrupt(uchar *data, uchar len, usbTxStatus_t *txStatus) { @@ -253,6 +254,7 @@ USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) usbGenericSetInterrupt(data, len, &usbTxStatus3); } #endif +#endif /* USB_CFG_SUPPRESS_INTR_CODE */ /* ------------------ utilities for code following below ------------------- */ @@ -398,7 +400,7 @@ uchar index = rq->wIndex.bytes[0]; usbResetStall(); SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */ len = 1; -#if USB_CFG_HAVE_INTRIN_ENDPOINT +#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */ usbResetDataToggling(); usbResetStall(); @@ -612,7 +614,7 @@ USB_PUBLIC void usbInit(void) #endif USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); usbResetDataToggling(); -#if USB_CFG_HAVE_INTRIN_ENDPOINT +#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE usbTxLen1 = USBPID_NAK; #if USB_CFG_HAVE_INTRIN_ENDPOINT3 usbTxLen3 = USBPID_NAK; |