Lines Matching +full:read +full:- +full:strobe +full:- +full:delay
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
33 * General purpose routines for the IEEE1284-1994 Standard
82 ppb->error = PPB_NO_ERROR; in ppb_1284_reset_error()
83 ppb->state = state; in ppb_1284_reset_error()
98 mtx_assert(ppb->ppc_lock, MA_OWNED); in ppb_1284_get_state()
99 return (ppb->state); in ppb_1284_get_state()
114 mtx_assert(ppb->ppc_lock, MA_OWNED); in ppb_1284_set_state()
115 if ((ppb->state != PPB_ERROR) && in ppb_1284_set_state()
116 (ppb->error == PPB_NO_ERROR)) { in ppb_1284_set_state()
117 ppb->state = state; in ppb_1284_set_state()
118 ppb->error = PPB_NO_ERROR; in ppb_1284_set_state()
130 if ((ppb->error == PPB_NO_ERROR) && in ppb_1284_set_error()
131 (ppb->state != PPB_ERROR)) { in ppb_1284_set_error()
132 ppb->error = error; in ppb_1284_set_error()
133 ppb->state = PPB_ERROR; in ppb_1284_set_error()
209 while (spin-- && (ppb_rstr(bus) & nBUSY)) in ppb_peripheral_negociate()
210 DELAY(1); in ppb_peripheral_negociate()
218 /* Event 4 - read ext. value */ in ppb_peripheral_negociate()
224 /* Event 5 - restore direction bit, no data avail */ in ppb_peripheral_negociate()
225 ppb_wctr(bus, (STROBE | nINIT) & ~(SELECTIN)); in ppb_peripheral_negociate()
226 DELAY(1); in ppb_peripheral_negociate()
229 ppb_wctr(bus, (nINIT) & ~(SELECTIN | STROBE)); in ppb_peripheral_negociate()
253 /* Event 5 - mode not supported */ in ppb_peripheral_negociate()
255 DELAY(1); in ppb_peripheral_negociate()
258 ppb_wctr(bus, (SELECTIN) & ~(STROBE | nINIT)); in ppb_peripheral_negociate()
293 /* Event 22 - wait up to host response time (1s) */ in ppb_peripheral_terminate()
300 ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); in ppb_peripheral_terminate()
302 /* Event 25 - wait up to host response time (1s) */ in ppb_peripheral_terminate()
309 ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED)); in ppb_peripheral_terminate()
310 DELAY(1); in ppb_peripheral_terminate()
312 ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED)); in ppb_peripheral_terminate()
314 /* Event 28 - wait up to host response time (1s) */ in ppb_peripheral_terminate()
349 /* Event 15 - put byte on data lines */ in byte_peripheral_outbyte()
356 ppb_wctr(bus, (AUTOFEED | STROBE) & ~(nINIT | SELECTIN)); in byte_peripheral_outbyte()
358 /* Event 10 - wait data read */ in byte_peripheral_outbyte()
366 ppb_wctr(bus, (AUTOFEED) & ~(nINIT | STROBE | SELECTIN)); in byte_peripheral_outbyte()
368 ppb_wctr(bus, (nINIT) & ~(STROBE | SELECTIN | AUTOFEED)); in byte_peripheral_outbyte()
372 /* Event 16 - wait strobe */ in byte_peripheral_outbyte()
425 if ((error = byte_peripheral_outbyte(bus, buffer+i, (i == len-1)))) in byte_peripheral_write()
439 * Read 1 byte in BYTE mode
446 /* Event 7 - ready to take data (nAUTO low) */ in byte_1284_inbyte()
447 ppb_wctr(bus, (PCD | nINIT | AUTOFEED) & ~(STROBE | SELECTIN)); in byte_1284_inbyte()
449 /* Event 9 - peripheral set nAck low */ in byte_1284_inbyte()
455 /* read the byte */ in byte_1284_inbyte()
458 /* Event 10 - data received, can't accept more */ in byte_1284_inbyte()
459 ppb_wctr(bus, (nINIT) & ~(AUTOFEED | STROBE | SELECTIN)); in byte_1284_inbyte()
461 /* Event 11 - peripheral ack */ in byte_1284_inbyte()
467 /* Event 16 - strobe */ in byte_1284_inbyte()
468 ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); in byte_1284_inbyte()
469 DELAY(3); in byte_1284_inbyte()
470 ppb_wctr(bus, (nINIT) & ~(AUTOFEED | STROBE | SELECTIN)); in byte_1284_inbyte()
479 * Read 1 byte in NIBBLE mode
488 /* Event 7 - ready to take data (nAUTO low) */ in nibble_1284_inbyte()
489 ppb_wctr(bus, (nINIT | AUTOFEED) & ~(STROBE | SELECTIN)); in nibble_1284_inbyte()
491 /* Event 8 - peripheral writes the first nibble */ in nibble_1284_inbyte()
493 /* Event 9 - peripheral set nAck low */ in nibble_1284_inbyte()
499 /* read nibble */ in nibble_1284_inbyte()
502 /* Event 10 - ack, nibble received */ in nibble_1284_inbyte()
503 ppb_wctr(bus, nINIT & ~(AUTOFEED | STROBE | SELECTIN)); in nibble_1284_inbyte()
505 /* Event 11 - wait ack from peripherial */ in nibble_1284_inbyte()
522 * Read in IEEE1284 NIBBLE/BYTE mode
525 spp_1284_read(device_t bus, int mode, char *buffer, int max, int *read) in spp_1284_read() argument
531 *read = len = 0; in spp_1284_read()
561 /* read a byte, error means no more data */ in spp_1284_read()
580 *read = len; in spp_1284_read()
594 int max, int *read) in ppb_1284_read_id() argument
606 error = spp_1284_read(bus, PPB_NIBBLE, buffer, max, read); in ppb_1284_read_id()
611 error = spp_1284_read(bus, PPB_BYTE, buffer, max, read); in ppb_1284_read_id()
624 * IEEE1284 read
628 int max, int *read) in ppb_1284_read() argument
635 error = spp_1284_read(bus, mode, buffer, max, read); in ppb_1284_read()
683 ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED)); in ppb_1284_negociate()
684 DELAY(1); in ppb_1284_negociate()
689 /* Event 0 - put the exten. value on the data lines */ in ppb_1284_negociate()
694 ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN)); in ppb_1284_negociate()
695 DELAY(1); in ppb_1284_negociate()
696 ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN)); in ppb_1284_negociate()
698 DELAY(1); in ppb_1284_negociate()
702 /* Event 1 - enter IEEE1284 mode */ in ppb_1284_negociate()
703 ppb_wctr(bus, (nINIT | AUTOFEED) & ~(STROBE | SELECTIN)); in ppb_1284_negociate()
715 /* Event 2 - trying IEEE1284 dialog */ in ppb_1284_negociate()
724 /* Event 3 - latch the ext. value to the peripheral */ in ppb_1284_negociate()
725 ppb_wctr(bus, (nINIT | STROBE | AUTOFEED) & ~SELECTIN); in ppb_1284_negociate()
726 DELAY(1); in ppb_1284_negociate()
728 /* Event 4 - IEEE1284 device recognized */ in ppb_1284_negociate()
729 ppb_wctr(bus, nINIT & ~(SELECTIN | AUTOFEED | STROBE)); in ppb_1284_negociate()
731 /* Event 6 - waiting for status lines */ in ppb_1284_negociate()
738 /* Event 7 - querying result consider nACK not to misunderstand in ppb_1284_negociate()
768 ppb_wctr(bus, (nINIT | AUTOFEED) & ~(SELECTIN | STROBE)); in ppb_1284_negociate()
827 ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED)); in ppb_1284_terminate()
828 DELAY(1); in ppb_1284_terminate()
831 /* Event 22 - set nSelectin low and nAutoFeed high */ in ppb_1284_terminate()
832 ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED)); in ppb_1284_terminate()
834 /* Event 24 - waiting for peripheral, Xflag ignored */ in ppb_1284_terminate()
840 /* Event 25 - set nAutoFd low */ in ppb_1284_terminate()
841 ppb_wctr(bus, (nINIT | SELECTIN | AUTOFEED) & ~STROBE); in ppb_1284_terminate()
843 /* Event 26 - compatible mode status is set */ in ppb_1284_terminate()
845 /* Event 27 - peripheral set nAck high */ in ppb_1284_terminate()
850 /* Event 28 - end termination, return to idle phase */ in ppb_1284_terminate()
851 ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED)); in ppb_1284_terminate()