From 6cbc7b3ea105e935c703d1a3156d19791aecedeb Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 14 Mar 2020 20:39:47 -0600 Subject: [PATCH] Remove delays from parport_write --- src/ec/it5570e/parallel.c | 12 ++++++------ src/ec/it8587e/parallel.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ec/it5570e/parallel.c b/src/ec/it5570e/parallel.c index b744beb..0094653 100644 --- a/src/ec/it5570e/parallel.c +++ b/src/ec/it5570e/parallel.c @@ -30,7 +30,7 @@ void parport_init(void) { // XXX: Needed? Pull-ups, open-drain are always disabled in GPIO mode KSOCTRL = 0; // XXX: Needed? OVRPPK is for KBS mode, pull-ups are always disabled in GPIO mode - KSICTRLR = (1 << 4); + KSICTRLR = 0; // Set all outputs to GPIO mode, low, and inputs KSOL = 0; @@ -93,9 +93,8 @@ int parport_write(uint8_t * data, int length) { // Assert nDATASTB KSIGDAT &= ~CTL_DATA; - delay_us(1); - // Wait for peripheral to indicate it's ready + // Wait for peripheral to indicate it's processing if (!parport_wait_peripheral(STS_WAIT, STS_WAIT)) { KSIGDAT |= CTL_DATA; break; @@ -103,10 +102,11 @@ int parport_write(uint8_t * data, int length) { // Deassert nDATASTB KSIGDAT |= CTL_DATA; - delay_us(1); - // XXX: Arduino takes a while to read? - delay_us(5); + // Wait for peripheral to indicate it's ready for next cycle + if (!parport_wait_peripheral(STS_WAIT, 0)) { + break; + } // Reset data lines to high KSOL = 0xFF; diff --git a/src/ec/it8587e/parallel.c b/src/ec/it8587e/parallel.c index b744beb..0094653 100644 --- a/src/ec/it8587e/parallel.c +++ b/src/ec/it8587e/parallel.c @@ -30,7 +30,7 @@ void parport_init(void) { // XXX: Needed? Pull-ups, open-drain are always disabled in GPIO mode KSOCTRL = 0; // XXX: Needed? OVRPPK is for KBS mode, pull-ups are always disabled in GPIO mode - KSICTRLR = (1 << 4); + KSICTRLR = 0; // Set all outputs to GPIO mode, low, and inputs KSOL = 0; @@ -93,9 +93,8 @@ int parport_write(uint8_t * data, int length) { // Assert nDATASTB KSIGDAT &= ~CTL_DATA; - delay_us(1); - // Wait for peripheral to indicate it's ready + // Wait for peripheral to indicate it's processing if (!parport_wait_peripheral(STS_WAIT, STS_WAIT)) { KSIGDAT |= CTL_DATA; break; @@ -103,10 +102,11 @@ int parport_write(uint8_t * data, int length) { // Deassert nDATASTB KSIGDAT |= CTL_DATA; - delay_us(1); - // XXX: Arduino takes a while to read? - delay_us(5); + // Wait for peripheral to indicate it's ready for next cycle + if (!parport_wait_peripheral(STS_WAIT, 0)) { + break; + } // Reset data lines to high KSOL = 0xFF;