Offline V-USB data processing
Posted: Wed Jan 29, 2014 9:39 am
A lot of the complexity of V-USB comes from the requirement to do de-stuffing and xoring of the USB datalines in real time. I have been wondering - is this really necessary?
V-USB does not process most of the packet contents in realtime, so why not move some more processing off-line? Basically only the PID, address and endpoint number is used in the interrupt routine.
- The PID is never bit-stuffed due to it's encoding
- The address may see one stuffed bit, but it is 7 bit only, so it will only expand to 8 bits in the worst case. The correct addressee can still be identified by a simple byte comparison.
- The endpoint number may be shifted by one bit.
That means, that if we are limiting ourselves to a single endpoint, it is easily possible to perform all the necessary "link-layer" data processing on xored and bitstuffed data.
This would allow reducing the receiver routine to a simple loop and would also enable 8 MHz V-USB.
Any thoughts?
V-USB does not process most of the packet contents in realtime, so why not move some more processing off-line? Basically only the PID, address and endpoint number is used in the interrupt routine.
- The PID is never bit-stuffed due to it's encoding
- The address may see one stuffed bit, but it is 7 bit only, so it will only expand to 8 bits in the worst case. The correct addressee can still be identified by a simple byte comparison.
- The endpoint number may be shifted by one bit.
That means, that if we are limiting ourselves to a single endpoint, it is easily possible to perform all the necessary "link-layer" data processing on xored and bitstuffed data.
This would allow reducing the receiver routine to a simple loop and would also enable 8 MHz V-USB.
Any thoughts?