Lines Matching full:a
3 * Firmware for the Keyspan PDA Serial Adapter, a USB serial port based on
13 * "Keyspan PDA Serial Adapter" is probably a copyright of Keyspan, the
17 * in a little widget that has a DB-9 on one end and a USB plug on the other.
19 * as a baud-rate generator. The wiring is:
31 * into a separate .h file.
41 * it will request a "tx unthrottle" interrupt. If sending a serial character
42 * empties the ring below the desired threshold, we set a bit that will send
72 * simulating a bus disconnect, then reconnect with a different device ID
89 * a bit to make it build.
94 * KeySpan, for making a handy, cheap ($40) widget that was so easy to take
100 * Need to find a safe device id to use (the one used by the Keyspan firmware
187 .org 0x100H ; wants to be on a page boundary
219 clr a
220 mov tx_ring_in, a
221 mov tx_ring_out, a
222 mov rx_ring_in, a
223 mov rx_ring_out, a
224 mov tx_unthrottle_threshold, a
230 mov a, #0xfe
233 movx @dptr, a
237 mov a, #0xfd
240 movx @dptr, a
246 mov a, #02H
248 movx @dptr,a
250 mov a, #00H
252 movx @dptr,a
254 mov a, #0x86
256 movx @dptr,a
259 mov a, #0x03
260 movx @dptr, a
264 movx a,@dptr
266 movx @dptr, a
268 mov a,#0x01 ; enable SUDAV: setup data available (for ep0)
270 movx @dptr, a ; clear SUDAVI
272 movx @dptr, a
275 mov a,#0x04 ; enable IN2 int
276 movx @dptr, a
279 mov a,#0x04 ; enable OUT2 int
280 movx @dptr, a
282 movx @dptr, a ; arm OUT2
284 mov a, #0x84 ; turn on RTS, DTR
286 movx @dptr, a
288 mov a,#01010011 ; mode 1, enable rx, clear int
289 mov SCON, a
309 mov a, #0x41
311 mov SBUF, a
312 inc a
313 anl a, #0x3F
314 orl a, #0x40
315 ; xrl a, #0x02
330 mov a, #0
331 mov dps, a
333 mov a, #0x02 ; DISCON=0, DISCOE=0, RENUM=1
334 movx @dptr, a
345 mov a, #0x06 ; DISCON=0, DISCOE=1, RENUM=1
346 movx @dptr, a
361 mov a,EXIF
363 mov EXIF,a ; clear INT2 first
365 mov a,#01h
366 movx @dptr,a
370 movx a, @dptr
371 mov r1, a ; r1 = bmRequestType
373 movx a, @dptr
374 mov r2, a ; r2 = bRequest
376 movx a, @dptr
377 mov r3, a ; r3 = wValueL
379 movx a, @dptr
380 mov r4, a ; r4 = wValueH
383 mov a, r1
384 anl a, #0x60
385 cjne a, #0x00, setup_bmreq_type_not_standard
390 ;; a still has bmreq&0x60
391 cjne a, #0x40, setup_bmreq_type_not_vendor
420 movx a, @dptr
421 orl a, #0x02
422 movx @dptr, a
427 movx a, @dptr
428 anl a, #0xfd ; ~0x02
429 movx @dptr, a
431 movx a, @dptr
432 anl a, #0xfd ; ~0x02
433 movx @dptr, a
444 mov a, tx_ring_out
446 subb a, tx_ring_in ; out-1-in = 255 - (in-out)
451 mov a, tx_ring_in
453 subb a, tx_ring_out ; in-out
478 clr a
479 movx @dptr, a
481 movx @dptr, a
483 mov a, #2
484 movx @dptr, a
503 ;; Clear_Feature(stall). should clear a stall bit. TODO
516 ;; Set_Feature(stall). Should set a stall bit. TODO
531 mov a, #HIGH(desc_device)
532 movx @dptr, a
534 mov a, #LOW(desc_device)
535 movx @dptr, a
543 mov a, #HIGH(desc_config1)
544 movx @dptr, a
546 mov a, #LOW(desc_config1)
547 movx @dptr, a
553 mov a, #((desc_strings_end-desc_strings)/2)
555 subb a,r3 ; a=4, r3 = 0..3 . if a<=0 then stall
558 mov a, r3
559 add a, r3 ; a = 2*wValueL
561 add a, dpl
562 mov dpl, a
563 mov a, #0
564 addc a, dph
565 mov dph, a ; dph = desc_strings[a]. big endian! (handy)
566 ;; it looks like my adapter uses a revision of the EZUSB that
575 ;; leftover strings). Writing this out by hand is a nuisance, so for
577 movx a, @dptr
578 mov r1, a
580 movx a, @dptr
581 mov r2, a
583 mov a, r1
584 movx @dptr, a
586 mov a, r2
587 movx @dptr, a
598 mov a, #1
601 movx @dptr, a
602 mov a, #1
604 movx @dptr, a
612 ;; 0a: Get_Interface. get the current altsetting for int[wIndexL]
613 ;; since we only have one interface, ignore wIndexL, return a 0
614 mov a, #0
627 mov a, #0x02
628 movx @dptr, a
634 movx a, @dptr
635 orl a, EP0STALLbit
636 movx @dptr, a
651 ;; verify a < 10
652 mov a, r3
655 subb a, #10
657 mov a, r3
658 rl a ; a = index*2
659 add a, #LOW(baud_table)
660 mov dpl, a
661 mov a, #HIGH(baud_table)
662 addc a, #0
663 mov dph, a
667 movx a,@dptr ; BAUD_HIGH
668 mov RCAP2H, a
669 mov TH2, a
671 movx a,@dptr ; BAUD_LOW
672 mov RCAP2L, a
673 mov TL2, a
686 mov a, r3 ; wValue[0] holds new bits: b7 is new DTR, b2 is new RTS
687 xrl a, #0xff ; 1 means active, 0V, +12V ?
688 anl a, #0x84
689 mov r3, a
691 movx a, @dptr ; only change bits 7 and 2
692 anl a, #0x7b ; ~0x84
693 orl a, r3
694 movx @dptr, a ; other pins are inputs, bits ignored
698 movx a, @dptr
699 xrl a, #0xff
711 mov a,EXIF
713 mov EXIF,a ; clear INT2 first
715 mov a,#04h
716 movx @dptr,a
736 mov a,EXIF
738 mov EXIF,a ; clear INT2 first
740 mov a,#04h
741 movx @dptr,a
747 movx a,@dptr
748 mov r1, a
749 clr a
750 mov dps, a
755 movx a,@dptr ; read
758 movx @dptr,a ; store
759 mov a,dpl1
760 cjne a, tx_ring_out, OUT_no_overflow
774 movx @dptr,a
789 ;; fill in EP4in with a debugging message:
795 clr a
796 mov dps, a
799 movx a, @dptr
803 mov a, tx_ring_in
804 movx @dptr, a
806 mov a, tx_ring_out
807 movx @dptr, a
810 mov a, rx_ring_in
811 movx @dptr, a
813 mov a, rx_ring_out
814 movx @dptr, a
817 clr a
819 inc a
821 movx @dptr, a
828 movx a, @dptr
831 movx @dptr, a
837 mov a, #0xfc
838 movx @dptr, a
846 movx a, @dptr
849 movx @dptr, a
855 clr a
856 mov dps, a
858 mov a, #38
859 movx @dptr, a
870 mov a, tx_ring_in
871 cjne a,tx_ring_out, start_tx__work
878 movx a, @dptr
879 mov sbuf, a
884 mov a, #0
885 cjne a, tx_unthrottle_threshold, start_tx__maybe_unthrottle_tx
891 mov a, tx_ring_out
893 subb a, tx_ring_in
894 ;; a is now write_room. If thresh >= a, we can unthrottle
896 subb a, tx_unthrottle_threshold
898 ;; yes, we can unthrottle. remove the threshold and mark a request
935 mov a, sbuf
936 movx @dptr, a
938 mov a, dpl
939 cjne a, rx_ring_out, get_rx_char__no_overflow
951 movx a, @dptr
954 ;; see if there is any work to do. a serial interrupt might occur
956 mov a, rx_ring_in
957 cjne a, rx_ring_out, start_in__have_work
961 clr a
962 mov dps, a
966 movx @dptr, a ; in[0] signals that rest of IN is rx data
972 mov a, rx_ring_in
973 cjne a, rx_ring_out, start_inlocal_irq_enablell_copying
978 movx a, @dptr
980 movx @dptr, a ; write into IN buffer
989 mov a, r1
991 movx @dptr, a
997 ;; special sequence: send a tx unthrottle message
999 clr a
1000 mov dps, a
1002 mov a, #1
1003 movx @dptr, a
1005 mov a, #2
1006 movx @dptr, a
1008 movx @dptr, a
1013 mov SBUF, a
1074 ;; *that* is a pain in the ass to encode. And they are little-endian