From 81d3988ca8af8a763a9fddda0efa1b6f3ddfb251 Mon Sep 17 00:00:00 2001 From: Christian Starkjohann Date: Sat, 18 Oct 2008 15:41:24 +0000 Subject: - added hook for SOF code --- usbdrv/usbconfig-prototype.h | 18 ++++++++++++++++++ usbdrv/usbdrvasm12.inc | 3 +++ usbdrv/usbdrvasm128.inc | 3 +++ usbdrv/usbdrvasm15.inc | 3 +++ usbdrv/usbdrvasm16.inc | 3 +++ usbdrv/usbdrvasm165.inc | 3 +++ usbdrv/usbdrvasm20.inc | 3 +++ 7 files changed, 36 insertions(+) diff --git a/usbdrv/usbconfig-prototype.h b/usbdrv/usbconfig-prototype.h index 5883461..03598c1 100644 --- a/usbdrv/usbconfig-prototype.h +++ b/usbdrv/usbconfig-prototype.h @@ -156,6 +156,24 @@ section at the end of this file). * counts SOF packets. This feature requires that the hardware interrupt is * connected to D- instead of D+. */ +/* #ifdef __ASSEMBLER__ + * macro myAssemblerMacro + * in YL, TCNT0 + * sts timer0Snapshot, YL + * endm + * #endif + * #define USB_SOF_HOOK myAssemblerMacro + * This macro (if defined) is executed in the assembler module when a + * Start Of Frame condition is detected. It is recommended to define it to + * the name of an assembler macro which is defined here as well so that more + * than one assembler instruction can be used. The macro may use registers + * YL and YH and SREG. + * What can you do with this hook? Since the SOF signal occurs exactly every + * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in + * designs running on the internal RC oscillator. + * Please note that Start Of Frame detection works only if D- is wired to the + * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES! + */ #define USB_CFG_CHECK_DATA_TOGGLING 0 /* define this macro to 1 if you want to filter out duplicate data packets * sent by the host. Duplicates occur only as a consequence of communication diff --git a/usbdrv/usbdrvasm12.inc b/usbdrv/usbdrvasm12.inc index 389dbb7..d9da1dc 100644 --- a/usbdrv/usbdrvasm12.inc +++ b/usbdrv/usbdrvasm12.inc @@ -69,6 +69,9 @@ waitForK: inc YL sts usbSofCount, YL #endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif rjmp sofError foundK: ;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] diff --git a/usbdrv/usbdrvasm128.inc b/usbdrv/usbdrvasm128.inc index f300865..effed45 100644 --- a/usbdrv/usbdrvasm128.inc +++ b/usbdrv/usbdrvasm128.inc @@ -128,6 +128,9 @@ waitForK: inc YL sts usbSofCount, YL #endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif rjmp sofError foundK: diff --git a/usbdrv/usbdrvasm15.inc b/usbdrv/usbdrvasm15.inc index d9dd427..689d2a3 100644 --- a/usbdrv/usbdrvasm15.inc +++ b/usbdrv/usbdrvasm15.inc @@ -70,6 +70,9 @@ waitForK: ;- inc YL sts usbSofCount, YL #endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif rjmp sofError ;------------------------------------------------------------------------------ ; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for diff --git a/usbdrv/usbdrvasm16.inc b/usbdrv/usbdrvasm16.inc index 3d1ce5d..44b00fa 100644 --- a/usbdrv/usbdrvasm16.inc +++ b/usbdrv/usbdrvasm16.inc @@ -64,6 +64,9 @@ waitForK: inc YL sts usbSofCount, YL #endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif rjmp sofError foundK: ;[-12] ;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] diff --git a/usbdrv/usbdrvasm165.inc b/usbdrv/usbdrvasm165.inc index 6a9ef7e..b37ac96 100644 --- a/usbdrv/usbdrvasm165.inc +++ b/usbdrv/usbdrvasm165.inc @@ -69,6 +69,9 @@ waitForK: inc YL sts usbSofCount, YL #endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif rjmp sofError foundK: ;[-12] ;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] diff --git a/usbdrv/usbdrvasm20.inc b/usbdrv/usbdrvasm20.inc index a8dee1c..2d4be52 100644 --- a/usbdrv/usbdrvasm20.inc +++ b/usbdrv/usbdrvasm20.inc @@ -86,6 +86,9 @@ waitForK: inc YL sts usbSofCount, YL #endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif rjmp sofError foundK: ;[-16] ;{3, 5} after falling D- edge, average delay: 4 cycles -- cgit v1.2.3