Remove delays from parport_write

This commit is contained in:
Jeremy Soller 2020-03-14 20:39:47 -06:00
parent abcc8c00e0
commit 6cbc7b3ea1
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
2 changed files with 12 additions and 12 deletions

View File

@ -30,7 +30,7 @@ void parport_init(void) {
// XXX: Needed? Pull-ups, open-drain are always disabled in GPIO mode // XXX: Needed? Pull-ups, open-drain are always disabled in GPIO mode
KSOCTRL = 0; KSOCTRL = 0;
// XXX: Needed? OVRPPK is for KBS mode, pull-ups are always disabled in GPIO mode // 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 // Set all outputs to GPIO mode, low, and inputs
KSOL = 0; KSOL = 0;
@ -93,9 +93,8 @@ int parport_write(uint8_t * data, int length) {
// Assert nDATASTB // Assert nDATASTB
KSIGDAT &= ~CTL_DATA; 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)) { if (!parport_wait_peripheral(STS_WAIT, STS_WAIT)) {
KSIGDAT |= CTL_DATA; KSIGDAT |= CTL_DATA;
break; break;
@ -103,10 +102,11 @@ int parport_write(uint8_t * data, int length) {
// Deassert nDATASTB // Deassert nDATASTB
KSIGDAT |= CTL_DATA; KSIGDAT |= CTL_DATA;
delay_us(1);
// XXX: Arduino takes a while to read? // Wait for peripheral to indicate it's ready for next cycle
delay_us(5); if (!parport_wait_peripheral(STS_WAIT, 0)) {
break;
}
// Reset data lines to high // Reset data lines to high
KSOL = 0xFF; KSOL = 0xFF;

View File

@ -30,7 +30,7 @@ void parport_init(void) {
// XXX: Needed? Pull-ups, open-drain are always disabled in GPIO mode // XXX: Needed? Pull-ups, open-drain are always disabled in GPIO mode
KSOCTRL = 0; KSOCTRL = 0;
// XXX: Needed? OVRPPK is for KBS mode, pull-ups are always disabled in GPIO mode // 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 // Set all outputs to GPIO mode, low, and inputs
KSOL = 0; KSOL = 0;
@ -93,9 +93,8 @@ int parport_write(uint8_t * data, int length) {
// Assert nDATASTB // Assert nDATASTB
KSIGDAT &= ~CTL_DATA; 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)) { if (!parport_wait_peripheral(STS_WAIT, STS_WAIT)) {
KSIGDAT |= CTL_DATA; KSIGDAT |= CTL_DATA;
break; break;
@ -103,10 +102,11 @@ int parport_write(uint8_t * data, int length) {
// Deassert nDATASTB // Deassert nDATASTB
KSIGDAT |= CTL_DATA; KSIGDAT |= CTL_DATA;
delay_us(1);
// XXX: Arduino takes a while to read? // Wait for peripheral to indicate it's ready for next cycle
delay_us(5); if (!parport_wait_peripheral(STS_WAIT, 0)) {
break;
}
// Reset data lines to high // Reset data lines to high
KSOL = 0xFF; KSOL = 0xFF;