From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-08-23 16:16:29
I'm currently redesigning a 6551 driver and have some questions. The base code for the old driver was taken from Craig Bruce ACE operating system. It uses interrupt driven receive, polled transmit, and features hardware handshake for the receiver side. I want to add interrupt driven send to this list - however this seems to be impossible because of the 6551 design. The problem is, that the 6551 command register is used for several functions at once: 1. enabling/disabling receive interrupts 2. enabling/disabling transmit interrupts 3. enable 6551 interrupts as a whole 4. drive the RTS handshake line use for h/w handshake Because part of these functions must be controlled from the interrupt handler, and others from outside the interrupt handler, there's a race condition when accessing the register. Since the 6551 is connected to the NMI , it is not possible to just sei/cli to disable interrupts while modifying the register from outside the interrupt handler. Unfortunately, disabling the interrupt at the source (the 6551) needs the same register, and - even worse - disabling interrupts means always driving the RTS line inactive, because of limitations of the 6551 chip. Since most RS232 drivers on "bigger" machines generate interrupts on state changes of CTS (which is connected to RTS of the remote), disabling and reenabling 6551 interrupts this way would toggle the RTS line high and low again, generating two(!) interrupts on the remote side. So I'm out of ideas how to solve this. Craig wrote in his ACE docs that using transmit interrupts is "ugly", so he didn't do it, but I would even say it is almost impossible to come up with a reasonable solution. Or is anyone able to prove me wrong? Another question: I think it would be ok to accept a 19200 baud limit for the C64. Would it be possible to use the IRQ line instead of the NMI at this speed? 19200 baud means a receive interrupt is generated roughly every 500us. How long does the C64 ROM interrupt handler take to execute? Does the C64 ROM contain code blocks that run with interrupts disabled for more than 500 cycles? Using the IRQ line would have the advantage of not interfering with the disk routines (doing disk I/O with NMIs in the background is impossible). Regards Uz -- Ullrich von Bassewitz uz@musoftware.de Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.