Sourcecode Fortschritt


  • Mod

    Rev. 380:

    - jetzt nur bei attached device (also 0x1005), klappte bei einem ersten real PC Test noch nicht

    Tests mit real PC:
    anschließend noch mit device 0 getestet, ob SET_ADDRESS überhaupt geklappt hat:
    brachte auch nur Nullen, das Adresse setzen könnte also auch dort geklappt haben! 🙂


  • Mod

    Rev. 381:

    PCI Command Register, Bit 2 (Bus Master) zusätzlich gesetzt

    // pci bus data
    	uint32_t num = ODA.pciEHCInumber;
    	uint8_t bus  = pciDev_Array[num].bus;
        uint8_t dev  = pciDev_Array[num].device;
        uint8_t func = pciDev_Array[num].func;
    	uint8_t irq  = pciDev_Array[num].irq;
    	// prepare PCI command register // offset 0x04
    	// bit 9 (0x0200): Fast Back-to-Back Enable // not necessary
        // bit 2 (0x0004): Bus Master               // cf. http://forum.osdev.org/viewtopic.php?f=1&t=20255&start=0
    	uint16_t pciCommandRegister = pci_config_read(bus, dev, func, 0x0204);
    	printf("\nPCI Command Register before:          %x", pciCommandRegister);
    	pci_config_write_dword(bus, dev, func, 0x04, pciCommandRegister /*already set*/ | 1<<2 /* bus master */); // resets status register, sets command register 
        printf("\nPCI Command Register plus bus master: %x", pci_config_read(bus, dev, func, 0x0204));
    
        irq_install_handler(32 + irq,   ehci_handler);
        /// irq_install_handler(32 + irq-1, ehci_handler); /// work-around for VirtualBox Bug!
    

    Tobiking und Cuervo haben schon vollständige Transfers (set_address, device 18 byte, config 9+9+7+7 byte) gesehen, allerdings erst beim zweiten Hochfahren. Bei mir blieb es stabil negativ auf einem Test-PC.

    Ob und inweiweit die sogenannten PCI Capabilities List (angezeigt beo 0x34) eine Rolle spielen, ist mir unklar.

    capabilities list: 0x50
    eecp: 0x68 (das haben wir zum BIOS/OS-Umschalten verwendet)

    Weiß jemand mehr über diese "pci capabilities list" bei EHCI (unterhalb eecp)?


  • Mod

    Rev. 382:

    code review usb.c

    TODO:
    - abwarten bis Transfer wirklich beendet (USB-Status abfragen)
    - array anlegen für adressen/infos von usb-devices
    - neue Adresse vergeben: erste frei Adresse verwenden


  • Mod

    Rev. 383:

    Testvariante für USB_Transfer bezüglich dem ersten TODO topic (s. Rev. 382):

    1. Adresse ändern
    2. device abfragen
    3. config abfragen (statisch aufgebaut: 1 interface mit 2 endpoints)

    Technik für warten:
    USBINT (wird gesetzt bei complete transfer) setzt USBINTflag, erst dann weiter (mit timeout).

    Nach SET_ADDRESS wird 1 sec gewartet (war nicht sicher, ob da STS_USBINT überhaupt kommt, da kein Datentransfer)

    Nun sieht man, wie lange der erfolgreiche Transfer dauert (#-zeichen * 20 ms)


  • Mod


  • Mod

    Rev. 385: (ohne FloppyImage.img, weil SVN das nicht wollte)

    jetzt auch SET_ADDRESS mit abwarten auf STS_USBINT

    hier der Host Sytem Error bei meinem Development PC:

    PrettyOS [Version 0.0.0.385]                               Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    
    >>> >>> function: resetPort 4                                                   
    
    >>> Status of USB Ports <<<                                                     
    port 4: 00001005h, line: 00h  SE0,power on, enabled, EHCI owned                 
    >>> Press key to start USB-Test. <<<                                            
    
    USB2: SET_ADDRESS                                                               
    Reset STS_USBINT and enable Async Schedule                                      
    .#                                                                              
    SETUP:                                                                          
    QTD: C0217000h Statusbyte: 00h                                                  
    
    USB2: GET_DESCRIPTOR device, dev: 4 endpoint: 0                                 
    
    ehci_handler: Host System Error                                                 
    PCI status word: 2290h                                                          
    Capabilities List                                                               
    Fast Back-to-Back Transactions Capable                                          
    Received Master-Abort                                                           
    
    >>> Init EHCI after fatal error:           <<<                                  
    >>> Press key for EHCI (re)initialization. <<<
    

    Man sieht aber, dass der SET_ADDRESS sauber durchgeht:

    USB2: SET_ADDRESS
    Reset STS_USBINT and enable Async Schedule
    .#
    SETUP:
    QTD: C0217000h Statusbyte: 00h

    Der Punkt stammt vom interrupt, der das USBINTflag setzt, und nach 20 ms (ein 😵 ist der USB-Transfer erledigt.

    Der nachfolgende pci master abort error bei GET_DESCRIPTOR device sollte von einem fehlerhaften Speicherzugriff herrühren. Ursache unklar. Wir sind für jeden Hinweis dankbar, da dieses Problem die Weiterentwicklung der EHCI/USB2-Treiber im Hardwarebereich behindert. Bei Qemu, VMWare und VBox kein Problem.

    Wie sieht das bei Cuervo und Tobiking aus? Auch dieses 0Ah?
    PCI Capabilities List: first Pointer: 0050h
    PCI Capabilities List: ID: 01h, next Pointer: 58h
    PCI Capabilities List: ID: 0Ah, next Pointer: 00h



  • Revision 386:

    - Definition von bool in userlib.h nun identisch zu types.h
    - user_program_c heißt nun shell
    - kdebug nun als inline-fkt. mit Farb-Funktionalität
    - Aufräumarbeiten (u.a. rtl8139.c ...)


  • Mod

    Rev. 387:

    page in createQTD_...:

    void* data = malloc(PAGESIZE, PAGESIZE); // Enough for a full page
        memset(data,0,PAGESIZE);
    

    vorsichtshalber, sollte aber tokenBytes reichen


  • Mod

    Rev. 388: (versehentlich 387 in ckernel.c)

    auf einen QH reduziert

    bleibt die async. List stehen? das ist die frage. 😃


  • Mod

    Rev. 389:

    Asynchrone Liste wird nach USB-Transfer im USBCMD ausgeschaltet, da das H-Bit offenbar noch unzuverlässig arbeitet.

    pOpRegs->USBCMD &= ~CMD_ASYNCH_ENABLE;
    

    Bitte testen.
    EDIT: sieht sehr gut aus (positive Tests bei Cuervo, Tobiking, Erhard Henkes)! Ursache gefunden, wenn auch noch nicht verstanden. 😉

    Wir haben festgestellt, dass die asynchrone Liste einfach das H-Bit ignoriert im QH und weiter läuft. Beim nächsten Transfer haben wir dann dem laufenden Asynchronen Scheduler die Basisadresse weg gezogen. 😃

    Von nun an können wir uns hoffentlich auf USB 2.0 konzentrieren. 🙂


  • Mod

    Rev. 390:

    ehci.h/c u. usb.c: Umbenennungen und ein Ausgabefehler (Rev. 389: ein Statusbyte ausgewiesen, dass es gar nicht gibt) beseitigt

    Jetzt sieht das alles gut aus.


  • Mod

    Rev. 391:

    nur geringe Veränderungen in ehci/usb.c


  • Mod

    Rev. 392:

    ehci.c, usb.h/c: testweise Stringausgabe bei USB-Transfer
    ckernel.c: deskriptoren zuerst (Dank an +gjm+ für diesen Hinweis)

    http://www.lowlevel.eu/wiki/USB#Stringdescriptor

    Beispiele für Stringausgaben:

    Chico QEye (web cam)

    PrettyOS [Version 0.0.0.392]                               Console 6: EHCI Ports
    --------------------------------------------------------------------------------
    lang: 0409h                                                                     
    
    SETUP:  qTD Status: 00h                                                         
    
    IO   :  qTD Status: 00h                                                         
    
    USB status: 00000000h                                                           
    >>> Press key to go on with USB-Test. <<<                                       
    
    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 1#                 
    1Ch 03h 43h 00h 68h 00h 69h 00h 63h 00h 6Fh 00h 00h 00h 00h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                         
    length:            28           descriptor type:   3                            
    string: Chico                                                                   
    
    SETUP:  qTD Status: 00h                                                         
    
    IO   :  qTD Status: 50h                                                         
    qTD Status: Halted - serious error at the device/endpoint                       
    qTD Status: Babble (fatal error leads to Halted)                                
    USB status: 00000000h                                                           
    >>> Press key to go on with USB-Test. <<<                                       
    
    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 2#                 
    20h 03h 51h 00h 45h 00h 79h 00h 65h 00h 20h 00h 00h 00h 00h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                         
    length:            32           descriptor type:   3                            
    string: QEye                                                                    
    
    SETUP:  qTD Status: 00h                                                         
    
    IO   :  qTD Status: 50h                                                         
    qTD Status: Halted - serious error at the device/endpoint                       
    qTD Status: Babble (fatal error leads to Halted)                                
    USB status: 00000000h                                                           
    >>> Press key to go on with USB-Test. <<<                                       
    
    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 3#                 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                         
    SETUP:  qTD Status: 00h
    

    Memor USB2. 110 (USB Memory Stick)

    PrettyOS [Version 0.0.0.392]                               Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    
    IO   :  qTD Status: 00h                                                         
    
    USB status: 00000000h                                                           
    >>> Press key to go on with USB-Test. <<<                                       
    
    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 1                  
    0Eh 03h 6Dh 00h 65h 00h 6Dh 00h 6Fh 00h 72h 00h 00h 00h 00h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                         
    length:            14           descriptor type:   3                            
    string: memor                                                                   
    
    SETUP:  qTD Status: 00h                                                         
    
    IO   :  qTD Status: 50h                                                         
    qTD Status: Halted - serious error at the device/endpoint                       
    qTD Status: Babble (fatal error leads to Halted)                                
    USB status: 00000000h                                                           
    >>> Press key to go on with USB-Test. <<<                                       
    
    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 2                  
    0Eh 03h 55h 00h 53h 00h 42h 00h 32h 00h 2Eh 00h 00h 00h 00h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                         
    length:            14           descriptor type:   3                            
    string: USB2.                                                                   
    
    SETUP:  qTD Status: 00h                                                         
    
    IO   :  qTD Status: 50h                                                         
    qTD Status: Halted - serious error at the device/endpoint                       
    qTD Status: Babble (fatal error leads to Halted)                                
    USB status: 00000000h                                                           
    >>> Press key to go on with USB-Test. <<<                                       
    
    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 3                  
    08h 03h 31h 00h 31h 00h 30h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                         
    length:            8            descriptor type:   3                            
    string: 110                                                                     
    
    SETUP:  qTD Status: 00h                                                         
    
    Port: 1, device attached
    

    EDIT: Strings werden noch abgeschnitten!


  • Mod

    Rev. 393:

    - #define _SOUND_ (nur dann ertönt beep)
    - usbDevices als Array zum Festhalten der abgefragten Infos



  • Revision 394:

    - shell verbessert (Intern)
    - VC++-Projektfile repariert und Dateien etwas umsortiert
    - Sound per Default aktiviert
    - cdi-Header: Ein paar Kommentare umformatiert/übersetzt
    - Ein Zeichen am Bootscreen geändert für schönere Zentrierung
    - Verbesserungen im Userspace
    -- C und C++ Dummieprogramme vereinheitlicht
    -- neues Usermakefile: Erster Schritt analog zum Hauptmakefile
    -- userlib.hpp und userlib.h "synchronisiert"


  • Mod

    Rev. 395:

    USB-Device-Strings wurden noch abgeschnitten, jetzt werden 64 Byte transferiert, damit können Strings (64-2)/2 = 31 Zeichen lang sein.

    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 1#
    12h 03h 4Ah 00h 65h 00h 74h 00h 46h 00h 6Ch 00h 61h 00h 73h 00h 68h 00h 00h 00h
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h
    00h 00h 00h 00h
    length: 18 descriptor type: 3
    string: JetFlash

    SETUP: qTD Status: 00h

    IO : qTD Status: 00h

    USB status: 00000000h

    > Press key to go on with USB-Test. <<<

    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 2#
    28h 03h 4Dh 00h 61h 00h 73h 00h 73h 00h 20h 00h 53h 00h 74h 00h 6Fh 00h 72h 00h
    61h 00h 67h 00h 65h 00h 20h 00h 44h 00h 65h 00h 76h 00h 69h 00h 63h 00h 65h 00h
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h
    00h 00h 00h 00h
    length: 40 descriptor type: 3
    string: Mass Storage Device

    SETUP: qTD Status: 00h

    IO : qTD Status: 00h

    USB status: 00000000h

    > Press key to go on with USB-Test. <<<

    USB2: GET_DESCRIPTOR string, dev: 1 endpoint: 0 stringIndex: 3#
    12h 03h 4Eh 00h 30h 00h 31h 00h 34h 00h 49h 00h 4Dh 00h 37h 00h 35h 00h 00h 00h
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h
    00h 00h 00h 00h
    length: 18 descriptor type: 3
    string: N014IM75

    Jetzt kommt auch kein Babbling mehr.

    Babbling: When a device transmits more data on the USB than the host controller is expecting for this transaction, it is defined to be babbling. In general, this is called a Packet Babble. When a device sends more data than the Maximum Length number of bytes, the host controller sets the Babble Detected bit to a one and halts the endpoint if it is using a queue head


  • Mod

    Rev. 396:

    _USB_DIAGNOSIS_ eingeführt, um die Übersichtlichkeit zu erhöhren

    Allerdings inzwischen wieder USB-Transfer-Probleme auf real hardware, aber keine error. Dürfte an der beschleunigten Ausführung liegen.

    In VMWare ist noch alles ok:

    PrettyOS [Version 0.0.0.396]                               Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    
    >>> >>> function: resetPort 1                                                   
    
    >>> Status of USB Ports <<<                                                     
    port 1: 00001005h, line: 00h  SE0,power on, enabled, EHCI owned                 
    USB specification: 2.0          USB class:         0000h                        
    USB subclass:      0000h        USB protocol       0000h                        
    max packet size:   64           vendor:            1516h                        
    product:           8628h        release number:    2.0                          
    manufacturer:      0001h        product:           0002h                        
    serial number:     0003h        number of config.: 1                            
    
    total length:         32        number of interfaces: 1                         
    ID of config:         0001h     ID of config name     0000h                     
    remote wakeup:        no        self-powered:         no                        
    max power (mA):       100                                                       
    interface number:     0         alternate Setting:    0                         
    number of endpoints:  2         interface class:      8                         
    interface subclass:   6         interface protocol:   80                        
    interface:            0000h                                                     
    endpoint in/out:   in           endpoint number:   1                            
    attributes:        02h          max packet size:   512                          
    interval:          0                                                            
    endpoint in/out:   out          endpoint number:   2                            
    attributes:        02h          max packet size:   512                          
    interval:          0                                                            
    
    language code: 0409h                                                            
    
    memory                                                                          
    
    USB2.0                                                                          
    
    110
    

  • Mod

    Rev. 397:

    - Optische Darstellung von device, config, interface, endpoint besser strukturiert
    - Warteschleife am Ende eines USB-Transfers eingefügt für real Hardware


  • Mod

    Rev. 398:

    - config descriptor wird nun komplett durchkämmt, teilweise sind noch unbekannte
    Descriptoren enthalten


  • Mod

    Rev. 399:

    ehci_install geschaffen (aus pci.c ausgelagert nach ehci.c)


Anmelden zum Antworten