Page 1 of 1

USB Communication

Posted: Thu Jan 26, 2017 8:26 pm
by jtn0514
Just curious if anyone has been able to send data outa via the high speed USB port yet. Any examples or even a hardware register list perhaps or read/write rules when accessing the USB port?

Re: USB Communication

Posted: Fri Jan 27, 2017 3:43 pm
by prophet36
jtn0514 wrote:Just curious if anyone has been able to send data outa via the high speed USB port yet. Any examples or even a hardware register list perhaps or read/write rules when accessing the USB port?
All the MD-accessible hardware registers are described here. Architecturally, there is no way to directly send data over USB from the MD side, because USB itself is a master-initiated protocol: in order to simulate device-initiated requests, the host has to poll each device. All the existing MD<->host communication is orchestrated using a simple semaphore (this is possible because the SDRAM controller effectively makes the cart RAM dual-ported; it's accessible from the host side and from the MD side). You could do the same thing in reverse, i.e the MD writes an address and length at some agreed-upon memory location whereupon writing the length triggers a host read from the specified block of memory. The host side would need to periodically poll this agreed-upon location, waiting for these "memory transfer" commands from the MD. Does that make sense?

Re: USB Communication

Posted: Fri Jan 27, 2017 4:00 pm
by prophet36
Ooops, sorry about the magic numbers! I should fix that. Basically,

CMD_RUNNING=0 --> MD is busy executing a command
CMD_READY=1 --> MD is ready to accept a new command
CMD_REQUEST=2 --> Host has written a new command for the MD to execute

Code: Select all

commandLoop:
	cmp.w	#2, cmdFlag		/* see if host has left us... */
	bne.s	commandLoop		/* ...a command to execute */