aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-31 12:33:04 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-31 12:33:04 +0000
commit331e8dece66e632ef3f91b052674948fd74e62a1 (patch)
treec530756a8fcb1bb8f497bafff264e6870c9775b8 /Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
parent75d27f8ef0873157c4ca14dc41d1eb4139e0180d (diff)
downloadlufa-331e8dece66e632ef3f91b052674948fd74e62a1.tar.gz
lufa-331e8dece66e632ef3f91b052674948fd74e62a1.tar.bz2
lufa-331e8dece66e632ef3f91b052674948fd74e62a1.zip
Use _delay_us() function in the XPROGTarget.c file to ensure timing requirements are met, rather than a fixed number of NOPs.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c')
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
index 843bf5a7d..e77d77bd5 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -152,11 +152,9 @@ void XPROGTarget_EnableTargetPDI(void)
DDRD |= (1 << 5) | (1 << 3);
DDRD &= ~(1 << 2);
- /* Set DATA line high for at least 90ns to disable /RESET functionality (note: too long will enable it again,
- * so a fixed number of NOPs are used here */
+ /* Set DATA line high for at least 90ns to disable /RESET functionality */
PORTD |= (1 << 3);
- asm volatile ("NOP"::);
- asm volatile ("NOP"::);
+ _delay_us(1);
/* Set up the synchronous USART for XMEGA communications -
8 data bits, even parity, 2 stop bits */
@@ -168,11 +166,9 @@ void XPROGTarget_EnableTargetPDI(void)
BITBANG_PDIDATA_DDR |= BITBANG_PDIDATA_MASK;
BITBANG_PDICLOCK_DDR |= BITBANG_PDICLOCK_MASK;
- /* Set DATA line high for at least 90ns to disable /RESET functionality (note: too long will enable it again,
- * so a fixed number of NOPs are used here */
+ /* Set DATA line high for at least 90ns to disable /RESET functionality */
BITBANG_PDIDATA_PORT |= BITBANG_PDIDATA_MASK;
- asm volatile ("NOP"::);
- asm volatile ("NOP"::);
+ _delay_us(1);
/* Fire timer compare channel A ISR to manage the software USART */
OCR1A = BITS_BETWEEN_USART_CLOCKS;
@@ -193,7 +189,7 @@ void XPROGTarget_EnableTargetTPI(void)
/* Set /RESET line low for at least 400ns to enable TPI functionality */
AUX_LINE_DDR |= AUX_LINE_MASK;
AUX_LINE_PORT &= ~AUX_LINE_MASK;
- _delay_ms(1);
+ _delay_us(1);
#if defined(XPROG_VIA_HARDWARE_USART)
/* Set Tx and XCK as outputs, Rx as input */