Page 1 of 1

Port reset in UHCI

Posted: Thu Jun 21, 2012 10:49 am
by bsdero
Hi guys!!

I followed the procedure in this link to perform port reset:
http://forum.osdev.org/viewtopic.php?f=1&t=23318

However I can't get the port connect status change bit back to 0, it ever remains settled to 1.

What would I do here? Somebody has another UHCI reference apart the intel one??

Thank you guys.

Re: Port reset in UHCI

Posted: Fri Jun 22, 2012 11:00 am
by TomT
You may find the following code helpful or look in the tatOS/usb folder for more info.

http://code.google.com/p/tatos/

TomT


;**************************************************
;uhci_portconnect and ehci_portconnect
;checks if a device is connected to a port
;input
;eax=port number starting with 0 (0,1,2,3...)
;return
;CF is set if some device is connected to the port
;**************************************************

uhci_portconnect:
pushad

mov dx,[UHCIBASEADD]
add dx,0x10 ;offset for port0, 0x12 is offset for port1
shl ax,1 ;ax=0 or 2
add dx,ax ;dx=0x10 for port 0 or 0x12 for port 1
in ax,dx ;read the port
;ax contains PORTSC

bt ax,0 ;sets CF if bit0 is set if device is present

popad
ret



ehci_portconnect:
pushad

mov ecx,eax
mov esi,[0x5d4] ;get start of ehci operational regs
mov eax,[esi+44h+ecx*4]
;eax contains PORTSC

bt ax,0 ;sets CF if bit0 is set if device is present

popad
ret

Re: Port reset in UHCI

Posted: Wed Jun 27, 2012 7:08 am
by bsdero
Wow!! Thank you Tom!! The SCS bit is being disabled now and I'm able to enable the port in my UHCI driver :D


My project is not about a OS development, is more a USB stack for SGI Irix, altough that OS/CPU architecture has some things to work on.
Thank you Tom, I will take a look to your project's code, maybe I can adapt a pair o' things into my stack ;)