Sourcecode Fortschritt


  • Mod

    Rev. 402:

    - Rechtschreibfehler beseitigt (thx to +gjm+)
    - auskommentierten Code in pci.c gestrichen


  • Mod

    Rev. 403:

    - void usbTransferSetConfiguration(uint32_t device, uint32_t configuration);
    - uint8_t usbTransferGetConfiguration(uint32_t device);
    - endpoint aus der Parameterliste der usb-Funktionen genommen, wenn sinnlos (z.B. wenn endpoint=0)

    Test bezüglich Konfigurationen (code auszugsweise):
    abfragen, auf 2 setzen, abfragen, auf 1 setzen, abfragen

    if (USBtransferFlag && enabledPortFlag && (pOpRegs->PORTSC[j] & (PSTS_POWERON | PSTS_ENABLED | PSTS_CONNECTED)))
    {
        uint8_t devAddr = usbTransferEnumerate(j);
        usbTransferDevice(devAddr); // device address, endpoint=0
        usbTransferConfig(devAddr); // device address, endpoint 0
        usbTransferString(devAddr); // device address, endpoint 0
    
        for(int k=1; k<4;k++) // fetch 3 strings
        {
            usbTransferStringUnicode(devAddr,k);
        }
    
        printf("\nconfig: %d",usbTransferGetConfiguration(devAddr));
    
        usbTransferSetConfiguration(devAddr, 2);
    
        printf("\nconfig: %d",usbTransferGetConfiguration(devAddr));
    
        usbTransferSetConfiguration(devAddr, 1);
    
        printf("\nconfig: %d",usbTransferGetConfiguration(devAddr));
    }
    

    Anmerkung: Dieses printf("\n\n\n") ist leider notwendig weil die Konsole auch in den Info-Bereich schreibt.


  • Mod

    Rev. 404:

    - Kleine Korrektur: Konsolenbereich und Info area gegen einander geschützt (thx to MrX)



  • Revision 405:

    - Infobereich ausgebaut: Fkt. writeInfo zum beschreiben, showInfo um festzulegen, ob der Infobereich in der Konsole angezeigt werden soll


  • Mod

    Rev. 406

    Bulk-Only Mass Storage Reset eingefügt
    (siehe: Universal Serial Bus Mass Storage Class Bulk-Only Transport, rev. 1.0, 1999)

    PrettyOS [Version 0.0.0.406]                               Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    numInterfaceMSD:   0                                                            
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    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                                                            
    
    >>> Press key to go on with data analysis from config descriptor. <<<           
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    endpoint in/out:   out          endpoint number:   2                            
    attributes:        02h          max packet size:   512                          
    interval:          0                                                            
    
    length: 0 type: 0 unknown                                                       
    
    >>> Press key to go on with data analysis from config descriptor. <<<           
    
    language: German                                                                
    memory                                                                          
    USB2.0                                                                          
    110                                                                             
    
    USB2: SET_CONFIGURATION 1                                                       
    USB2: GET_CONFIGURATION                                                         
    config: 1                                                                       
    dev: 1 MSDinterface: 0 ==> BulkOnlyMassStorageReset                             
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    USB status: 00000000h                                                           
    >>> Press key to close this console. <<<                                        
    --------------------------------------------------------------------------------
    Port: 1, device attached
    

  • Mod

    Rev. 407:

    - uint8_t usbTransferBulkOnlyGetMaxLUN(uint32_t device, uint8_t numInterface)


  • Mod

    Rev. 408:

    Fehler korrigiert in usb2.c

    3 getestete USB-Sticks haben LUN = 0, während mein card reader LUN = 3 zeigt.


  • Mod

    Rev. 409:

    Zwischenschritt
    ehci/usb: SCSI Command: "test unit ready" (0x00) und Antwort im Statusword

    realPC:

    PrettyOS [Version 0.0.0.409]                               Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    endpoint in/out:   out          endpoint number:   2                            
    attributes:        02h          max packet size:   512                          
    interval:          0                                                            
    
    length: 0 type: 0 unknown                                                       
    
    >>> Press key to go on with data analysis from config descriptor. <<<           
    
    language: German                                                                
    memory                                                                          
    USB2.0                                                                          
    110                                                                             
    
    USB2: SET_CONFIGURATION 1                                                       
    USB2: GET_CONFIGURATION 1                                                       
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    Max. Logical Unit Numbers: 0                                                    
    USB status: 00000000h                                                           
    dev: 1 MSDinterface: 0 ==> BulkOnlyMassStorageReset                             
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    USB status: 00000000h                                                           
    55h 53h 42h 43h 42h 42h 42h 42h 00h 00h 00h 00h 00h 00h 06h 00h 00h 00h 00h 00h 
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h                                     
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    IO:     qTD Status: 01h                                                         
    qTD Status: Do Ping                                                             
    USB status: 00002000h                                                           
    Reclamation                                                                     
    >>> Press key to go on with USB-Test. <<<                                       
    
    timeout - no STS_USBINT set!                                                    
    55h 53h 42h 53h 00h 00h 00h 00h 00h 00h 00h 00h 00h                             
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
    IO:     qTD Status: 80h                                                         
    qTD Status: Active - HC transactions enabled                                    
    USB status: 00002000h                                                           
    Reclamation                                                                     
    >>> Press key to go on with USB-Test. <<<                                       
    
    >>> Press key to close this console. <<<                                        
    --------------------------------------------------------------------------------
    Port: 1, device attached
    

    Do Ping <--- TODO

    Auch bei VMWare noch "timeout - no STS_USBINT set!"
    Erfolg wird sichtbar, wenn das von uns im Kommando gewählte Tag "42424242h" im Statusword an gleicher Stelle wiederholt wird. 😉


  • Mod

    Rev. 410:

    ... es klappt!

    PrettyOS [Version 0.0.0.410] Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    attributes: 02h max packet size: 512
    interval: 0

    > Press key to go on with data analysis from config descriptor. <<<

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    endpoint in/out: out endpoint number: 2
    attributes: 02h max packet size: 512
    interval: 0

    length: 0 type: 0 unknown

    > Press key to go on with data analysis from config descriptor. <<<

    language: German
    memory
    USB2.0
    110

    USB2: SET_CONFIGURATION 1
    USB2: GET_CONFIGURATION 1
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Max. Logical Unit Numbers: 0
    USB status: 00000000h
    dev: 2 MSDinterface: 0 ==> BulkOnlyMassStorageReset
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    USB status: 00000000h
    endpOUT: 2 endpIN: 1
    55h 53h 42h 43h 42h 42h 42h 42h 00h 00h 00h 00h 00h 00h 06h 00h 00h 00h 00h 00h
    00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    IO: qTD Status: 01h
    qTD Status: Do Ping
    USB status: 00000000h

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

    55h 53h 42h 53h 42h 42h 42h 42h 00h 00h 00h 00h 00h FFh FFh FFh
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    IO: qTD Status: 00h

    USB status: 00000000h

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

    Tag 42424242h wird wiederholt! Command Block Status Value: 00h 👍

    00h Command Passed ("good status")
    01h Command Failed
    02h Phase Error

    Die passende Spezifikation ist "USB Mass Storage Class - Bulk Only Transport"


  • Mod

    Rev. 411:

    http://en.wikipedia.org/wiki/SCSI_Read_Commands#Read_.2810.29 (SCSI-command: read(10), Opcode 0x28)

    USB-Stick read LBA 0 (512 byte)

    PrettyOS [Version 0.0.0.411] Console 1: EHCI Ports
    --------------------------------------------------------------------------------
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    USB status: 00000000h
    endpOUT: 2 endpIN: 1
    55h 53h 42h 43h 42h 42h 42h 42h 00h 02h 00h 00h 00h 00h 0Ah 28h 00h 00h 00h 00h
    00h 00h 00h 02h 00h 00h 00h 00h 00h 00h 00h
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    IO: qTD Status: 01h
    qTD Status: Do Ping
    USB status: 00000000h

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

    F8h FFh FFh 7Fh FFh FFh FFh FFh FFh FFh FFh FFh FFh FFh FFh FFh 09h 00h 0Ah 00h
    0Bh 00h 0Ch 00h 0Dh 00h 0Eh 00h 0Fh 00h 10h 00h 11h 00h 12h 00h 13h 00h 14h 00h
    15h 00h 16h 00h 17h 00h 18h 00h 19h 00h 1Ah 00h 1Bh 00h 0Fh FFh 0Fh 00h 0Fh FFh
    0Fh FFh 0Fh FFh 21h 00h 22h 00h 23h 00h 24h 00h 25h 00h 26h 00h 27h 00h 28h 00h
    29h 00h 2Ah 00h 2Bh 00h 2Ch 00h 2Dh 00h 2Eh 00h 2Fh 00h 30h 00h 31h 00h 32h 00h
    33h 00h 34h 00h 35h 00h 36h 00h 37h 00h 38h 00h 39h 00h 3Ah 00h 3Bh 00h 3Ch 00h
    3Dh 00h 3Eh 00h 3Fh 00h 40h 00h 41h 00h 42h 00h 43h 00h 44h 00h 45h 00h 46h 00h
    47h 00h 48h 00h 49h 00h 4Ah 00h 4Bh 00h 4Ch 00h 4Dh 00h 4Eh 00h 4Fh 00h 50h 00h
    51h 00h 52h 00h 53h 00h 54h 00h 55h 00h 56h 00h 57h 00h 58h 00h 59h 00h 5Ah 00h
    5Bh 00h 5Ch 00h 5Dh 00h 5Eh 00h 5Fh 00h 60h 00h 61h 00h 62h 00h 63h 00h 64h 00h
    65h 00h 66h 00h 67h 00h 68h 00h 69h 00h 6Ah 00h 6Bh 00h 6Ch 00h 6Dh 00h 6Eh 00h
    6Fh 00h 70h 00h 71h 00h 72h 00h 73h 00h 74h 00h 75h 00h 76h 00h 77h 00h 78h 00h
    79h 00h 7Ah 00h 7Bh 00h 7Ch 00h 7Dh 00h 7Eh 00h 7Fh 00h 80h 00h 81h 00h 82h 00h
    83h 00h 84h 00h 85h 00h 86h 00h 87h 00h 88h 00h 89h 00h 8Ah 00h 8Bh 00h 8Ch 00h
    8Dh 00h 8Eh 00h 8Fh 00h 90h 00h 91h 00h 92h 00h 93h 00h 94h 00h 95h 00h 96h 00h
    97h 00h 98h 00h 99h 00h 9Ah 00h 9Bh 00h 9Ch 00h 9Dh 00h 9Eh 00h 9Fh 00h A0h 00h
    A1h 00h A2h 00h A3h 00h A4h 00h A5h 00h A6h 00h A7h 00h A8h 00h A9h 00h AAh 00h
    ABh 00h ACh 00h ADh 00h AEh 00h AFh 00h B0h 00h B1h 00h B2h 00h B3h 00h B4h 00h
    B5h 00h B6h 00h B7h 00h B8h 00h B9h 00h BAh 00h BBh 00h BCh 00h BDh 00h BEh 00h
    BFh 00h C0h 00h C1h 00h C2h 00h C3h 00h C4h 00h C5h 00h FFh FFh 00h 00h FFh FFh
    00h 00h 00h 00h FFh FFh FFh FFh CDh 00h CEh 00h CFh 00h D0h 00h D1h 00h D2h 00h
    D3h 00h D4h 00h FFh FFh 00h 00h FFh FFh FFh FFh FFh FFh FFh FFh DBh 00h DCh 00h
    DDh 00h DEh 00h DFh 00h E0h 00h E1h 00h E2h 00h E3h 00h E4h 00h E5h 00h E6h 00h
    E7h 00h E8h 00h E9h 00h EAh 00h EBh 00h ECh 00h EDh 00h EEh 00h EFh 00h F0h 00h
    F1h 00h F2h 00h F3h 00h F4h 00h F5h 00h F6h 00h F7h 00h F8h 00h F9h 00h FAh 00h
    FBh 00h FCh 00h FDh 00h FEh 00h FFh 00h 00h 01h
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    IO: qTD Status: 00h

    USB status: 00000000h

    > Press key to go on with USB-Test. <<<
    --------------------------------------------------------------------------------
    55h 53h 42h 53h 42h 42h 42h 42h 00h 00h 00h 00h 00h FFh FFh FFh
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    IO: qTD Status: 00h

    USB status: 00000000h

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

    Kontrolle mit dem Hex-Editor auf dem USB_Stick:
    http://www.henkessoft.de/OS_Dev/Bilder/rev290_read_LBA0_from_USB_Stick.PNG

    👍 👍 👍


  • Mod

    Läuft z.Z. leider lediglich auf einem PC mit einem USB-Stick. 🙄

    Ideen für Verbesserungen (aber leider noch nicht durchschlagend):

    für read(10):
    cbw->CBWFlags = 0x80; // Out: 0x00 In: 0x80 (anstelle "Out")

    memset(cbw,0,sizeof(struct usb2_CommandBlockWrapper)); // zero of cbw

    DPO und FUA setzen:

    Disable Page Out (DPO) allows the initiator to warn the target that the data being read is unlikely to be requested again soon and so is not worth keeping in the target's data cache. Force Unit Access (FUA) tells the target to fetch the data from the media surface and to not use a cached copy.

    Evtl. auch Handshake-Problem, IN/OUT-Problem, toggle-Problem 😕


  • Mod

    Rev. 412: Zwischenschritt USB MSD (SCSI)


  • Mod

    Rev. 413: Zwischenschritt USB MSD (SCSI)


  • Mod

    Rev. 414: Zwischenschritt USB MSD (SCSI)
    Danke an Tobiking für die Unterstützung, allerdings noch nicht ausreichend.
    Das Thema ist leider nicht leicht zu durchschauen.


  • Mod

    Rev. 415:
    ... zunächst der bisher stabile OUT/IN SCSI-Command-Transfer mit 0x00.

    ///////// Test Suite 1: send SCSI comamnd "test unit ready(6)"
    
                         settextcolor(9,0); printf("\n>>> SCSI: test unit ready"); settextcolor(15,0);
    				     usbTransferSCSIcommandToMSD(devAddr, usbDevices[devAddr].numEndpointOutMSD, 0x00);
    
                         // #ifdef _USB_DIAGNOSIS_
    				     printf("\nIO:    "); showStatusbyteQTD(DataQTD); waitForKeyStroke();
                         // #endif
    
                         settextcolor(9,0); printf("\n>>> get status"); settextcolor(15,0);
    				     usbTransferGetAnswerToCommandMSD(devAddr, usbDevices[devAddr].numEndpointInMSD);
    
                         // #ifdef _USB_DIAGNOSIS_
    				     printf("\nIO:    "); showStatusbyteQTD(DataQTD); waitForKeyStroke();
                         // #endif
    

  • Mod

    rev. 416:

    mit VMWare läuft diese Version

    Wichtige Erkenntnisse: 1) handshakes stören 2) in SCSI: Big Endian!

    Warum hardware damit noch nicht störungsfrei läuft, das liegt an qTD/QH.


  • Mod

    rev. 417:

    Version läuft mit VMWare, VBox, real PC. Erfolgreiche Übetragungen leider noch nicht überall.

    Leider noch Fehlermeldungen, deren Ursache heraus gefunden werden muss.

    a) USB-Interrupt kommt nicht (USB-Übertragung nicht vollständig)
    b) halted - serious error (qTD status)


  • Mod

    rev. 418:

    leider spielt die wartezeit am ende von performAsyncScheduler() eine Rolle. Zu kurz oder zu lang führt zu "command failed" bei "test unit ready" bzw. zu einem nicht vollständigen USB-Transfer (kein USB-Interrupt). Ich habe jetzt mal auf 80 ms eingestellt.

    Aber hier ist wohl ein Komplettumbau unseres async-Schedulers notwendig.


  • Mod

    rev. 419: zwischenschritt: Umbau auf zwei QH (für den IN and OUT endpoint) mit jeweils angehängten qTD-Ketten.


  • Mod

    Rev. 420:

    läuft mit 1GB stick (FAT16) und real PC

    Probleme:
    a) liest nicht mit VMWare
    b) man kann die CBW nur einzeln durchführen (also reset CBW3 oder reset CBW1, aber nicht reset CBW1, reset CBW2, reset CBW3 ..., da fehlt leider noch etwas)

    bitte mal mit hardware testen, also real PC + real USB-MSD (sticks, card reader, usb-festplatten, ...)

    Anm.: manche haben drei endpoints, also zwei IN, da wird noch evlt. der falsche endpointIN verwendet durch das parsen, da brauchen wir noch ein weiteres auswahl-kriterium, wahrscheinlich packetsize 512)

    so wie es aussieht, benötigen wir doch handshakes: http://www.beyondlogic.org/usbnutshell/usb4.htm#Bulk 😉


Anmelden zum Antworten