Sun Oct 21 11:24:37 EDT 2012
Serial port echo
So, service-usb is run from interrupt. Next is to make an echo app in
"userspace". To avoid double buffering, this approach can be used:
If IN1 is empty and owned by the UC, it's possible to send out a
packet by locking the usb interrupt, filling the buffer, and sending
it out. Otherwise, just wait until it is.
Trying a bit, I can get it to work without interrupts but once I start
playing with the interrupt enable/disable it goes wrong. Is there a
simpler way to synchronize?
The thing is this: if we're not currently sending, the IN1 buffer is
owned by the uC. The ISR will not touch it until the flags are set,
so can that be used?
EDIT: Might be actually that it never leaves the ISR because some flag
is not acknowledged. Maybe something else is triggering the interrupt?