Sfoglia il codice sorgente

Merge branch 'master' into master

main
Paul Stoffregen 3 anni fa
parent
commit
92f2c33dc5
Nessun account collegato all'indirizzo email del committer
2 ha cambiato i file con 14 aggiunte e 11 eliminazioni
  1. +11
    -9
      MassStorageDriver.cpp
  2. +3
    -2
      USBHost_t36.h

+ 11
- 9
MassStorageDriver.cpp Vedi File

@@ -63,6 +63,8 @@ bool msController::claim(Device_t *dev, int type, const uint8_t *descriptors, ui
if (descriptors[6] != 6) return false; // bInterfaceSubClass, 6 = SCSI transparent command set (SCSI Standards)
if (descriptors[7] != 80) return false; // bInterfaceProtocol, 80 = BULK-ONLY TRANSPORT

bInterfaceNumber = descriptors[2];

uint8_t desc_index = 9;
uint8_t in_index = 0xff, out_index = 0xff;

@@ -198,11 +200,11 @@ uint8_t msController::mscInit(void) {
return MS_NO_MEDIA_ERR; // Not connected Error.
}
yield();
} while(!available());
msReset(0); // Assume bNumInterfaces = 1 for now.
// delay(500); // Not needed any more.
maxLUN = msGetMaxLun(0); // Assume bNumInterfaces = 1 for now
} while(!available());
msReset();
// delay(500); // Not needed any more.
maxLUN = msGetMaxLun();

// msResult = msReportLUNs(&maxLUN);
//println("maxLUN = ");
@@ -234,11 +236,11 @@ uint8_t msController::mscInit(void) {

//---------------------------------------------------------------------------
// Perform Mass Storage Reset
void msController::msReset(uint32_t interfaceNumber) {
void msController::msReset(void) {
#ifdef DBGprint
println("msReset()");
#endif
mk_setup(setup, 0x21, 0xff, 0, interfaceNumber, 0);
mk_setup(setup, 0x21, 0xff, 0, bInterfaceNumber, 0);
queue_Control_Transfer(device, &setup, NULL, this);
while (!msControlCompleted) yield();
msControlCompleted = false;
@@ -246,12 +248,12 @@ void msController::msReset(uint32_t interfaceNumber) {

//---------------------------------------------------------------------------
// Get MAX LUN
uint8_t msController::msGetMaxLun(uint32_t interfaceNumber) {
uint8_t msController::msGetMaxLun(void) {
#ifdef DBGprint
println("msGetMaxLun()");
#endif
report[0] = 0;
mk_setup(setup, 0xa1, 0xfe, 0, interfaceNumber, 1);
mk_setup(setup, 0xa1, 0xfe, 0, bInterfaceNumber, 1);
queue_Control_Transfer(device, &setup, report, this);
while (!msControlCompleted) yield();
msControlCompleted = false;

+ 3
- 2
USBHost_t36.h Vedi File

@@ -2049,8 +2049,8 @@ public:

bool mscTransferComplete = false;
uint8_t mscInit(void);
void msReset(uint32_t interfaceNumber);
uint8_t msGetMaxLun(uint32_t interfaceNumber);
void msReset(void);
uint8_t msGetMaxLun(void);
void msCurrentLun(uint8_t lun) {currentLUN = lun;}
uint8_t msCurrentLun() {return currentLUN;}
bool available() { delay(0); return deviceAvailable; }
@@ -2093,6 +2093,7 @@ private:
uint32_t packetSizeOut;
Pipe_t *datapipeIn;
Pipe_t *datapipeOut;
uint8_t bInterfaceNumber;
uint32_t endpointIn = 0;
uint32_t endpointOut = 0;
setup_t setup;

Loading…
Annulla
Salva