Beispiel #1
0
unsigned int UsbKey::diskioGetSectorNumber() {
	unsigned long size;
	commandParams.commandState = DISKIO_GETSECTORNUMBER;
	commandParams.commandParam1 = &size;
	usbProcess();
	return size;
}
Beispiel #2
0
void UsbKey::init(struct OneSynthParams*timbre1, struct OneSynthParams*timbre2, struct OneSynthParams*timbre3, struct OneSynthParams*timbre4) {
    Storage::init(timbre1, timbre2, timbre3, timbre4);
    USBH_Init(&usbOTGHost, USB_OTG_HS_CORE_ID, &usbHost, &USBH_MSC_cb, &USR_Callbacks);
    commandParams.commandState = COMMAND_INIT;
    usbProcess();
#ifndef BOOTLOADER
    dx7NumberOfBanks = 0;
    dx7BankInitialized = false;
    for (int k=0; k< NUMBEROFDX7BANKS; k++) {
    	dx7Bank[k].name[0] = '\0';
    	dx7Bank[k].name[12] = '\0';
    	dx7Bank[k].fileType = FILE_EMPTY;
    }
    for (int k=0; k<NUMBEROFPREENFMBANKS; k++) {
    	preenFMBank[k].fileType = FILE_EMPTY;
    }
    for (int k=0; k<NUMBEROFPREENFMCOMBOS; k++) {
    	preenFMCombo[k].fileType = FILE_EMPTY;
    }
    char empty[] = "<Empty>\0";
    for (int k=0; k< 8; k++) {
    	errorDX7Bank.name[k] = empty[k];
    	errorPreenFMBank.name[k] = empty[k];
    	errorPreenFMCombo.name[k] = empty[k];
    }
    errorPreenFMBank.fileType = FILE_EMPTY;
    errorPreenFMCombo.fileType = FILE_EMPTY;
    errorDX7Bank.fileType = FILE_EMPTY;
#endif
}
Beispiel #3
0
int FirmwareFile::diskioRead(uint8_t* buff, int address, int length) {
	commandParams.commandState = DISKIO_READ;
	commandParams.commandParam1 = buff;
	commandParams.commandParam2 = &address;
	commandParams.commandParamSize = length;
	usbProcess();
	return commandParams.commandResult;
}
Beispiel #4
0
int UsbKey::diskioWrite(uint8_t* buff, int address, int length) {
	commandParams.commandState = DISKIO_WRITE;
	commandParams.commandParam1 = buff;
	commandParams.commandParam2 = &address;
	commandParams.commandParamSize = length;
	usbProcess();
	return commandParams.commandResult;
}
Beispiel #5
0
int UsbKey::load(const char* fileName, int seek, void* bytes, int size) {
    commandParams.commandState = COMMAND_LOAD;
    commandParams.commandFileName = fileName;
    commandParams.commandParam1 = (void*)bytes;
    commandParams.commandParamSize = size;
    commandParams.commandSeek = seek;
    usbProcess();
    return commandParams.commandResult;
}
Beispiel #6
0
int UsbKey::readNextFirmwareName(char *name, int *size) {
    do {
        commandParams.commandState = COMMAND_NEXT_FILE_NAME;
        commandParams.commandParam1 = (void*)name;
        commandParams.commandParam2 = (void*)size;
        usbProcess();
    }  while (commandParams.commandResult == COMMAND_SUCCESS && !isFirmwareFile(name));
    return commandParams.commandResult;
}
Beispiel #7
0
int UsbKey::save(FILE_ENUM file, int seek, void* bytes, int size) {
    commandParams.commandState = COMMAND_SAVE;
    commandParams.commandFileName = getFileName(file);
    commandParams.commandParam1 = bytes;
    commandParams.commandParamSize = size;
    commandParams.commandSeek = seek;
    usbProcess();
    return commandParams.commandResult;
}
Beispiel #8
0
int UsbKey::loadFirmwarePart(char *fileName, int seek, void* bytes, int size) {
    char fullName[32];
    commandParams.commandState = COMMAND_LOAD;
    commandParams.commandFileName = getFullName(FIRMWARE_DIR, fileName);
    commandParams.commandParam1 = (void*)bytes;
    commandParams.commandParamSize = size;
    commandParams.commandSeek = seek;
    usbProcess();
    return commandParams.commandResult;
}
Beispiel #9
0
int UsbKey::dx7ReadNextFileName(struct BankFile* bank) {
	unsigned long size;
    do {
        commandParams.commandState = COMMAND_NEXT_FILE_NAME;
        commandParams.commandParam1 = (void*)bank->name;
        commandParams.commandParam2 = (void*)&size;
        usbProcess();
    }  while (commandParams.commandResult == COMMAND_SUCCESS && !isDX7SysexFile((char*)bank->name, size));
	bank->fileType = FILE_OK;
    return commandParams.commandResult;
}
Beispiel #10
0
int UsbKey::renameFile(const struct BankFile* bank, const char* newName) {
	char fullNewBankName[40];
	const char* fullNameTmp = getPreenFMFullName(newName);
	// Don't want the logical drive (two first char)
	for (int k=2; k<40; k++) {
		fullNewBankName[k-2] = fullNameTmp[k];
	}
	commandParams.commandState = COMMAND_RENAME;
	commandParams.commandFileName = getPreenFMFullName(bank->name);
	commandParams.commandParam1 = (void*)fullNewBankName;
	usbProcess();
	return commandParams.commandResult;
}
Beispiel #11
0
int UsbKey::preenFMComboReadNextFileName(struct BankFile* combo) {
	unsigned long size;
    do {
        commandParams.commandState = COMMAND_NEXT_FILE_NAME;
        commandParams.commandParam1 = (void*)combo->name;
        commandParams.commandParam2 = (void*)&size;
        usbProcess();
    }  while (commandParams.commandResult == COMMAND_SUCCESS && !isPreenFMComboFile((char*)combo->name, size));
    if (combo->name[0] == '_') {
    	combo->fileType = FILE_READ_ONLY;
    } else {
    	combo->fileType = FILE_OK;
    }
    return commandParams.commandResult;
}
Beispiel #12
0
int UsbKey::dx7Init() {
	int res;
    commandParams.commandState = COMMAND_OPEN_DIR;
    commandParams.commandFileName = DX7_DIR;
    dx7BankInitialized = true;
    usbProcess();
    if (commandParams.commandResult != COMMAND_SUCCESS) {
    	return commandParams.commandResult;
    }
    int k;
    for (k = 0; k<NUMBEROFDX7BANKS; k++) {
    	res = dx7ReadNextFileName(&dx7Bank[k]);
    	if (res != COMMAND_SUCCESS) {
    		break;
    	}
    }
	dx7NumberOfBanks = k ;
	sortBankFile(dx7Bank, dx7NumberOfBanks);
    return res;
}
Beispiel #13
0
int UsbKey::preenFMComboInit() {
	int res;
    commandParams.commandState = COMMAND_OPEN_DIR;
    commandParams.commandFileName = PREENFM_DIR;
    preenFMComboInitialized = true;
    usbProcess();
    if (commandParams.commandResult != COMMAND_SUCCESS) {
    	return commandParams.commandResult;
    }
    int k;
    for (k=0; k<NUMBEROFPREENFMCOMBOS; k++) {
    	res = preenFMComboReadNextFileName(&preenFMCombo[k]);
    	if (res != COMMAND_SUCCESS) {
    		break;
    	}
    }
	preenFMNumberOfCombos = k;
	sortBankFile(preenFMCombo, preenFMNumberOfCombos);
    return res;
}
Beispiel #14
0
void UsbKey::init(struct OneSynthParams*timbre1, struct OneSynthParams*timbre2, struct OneSynthParams*timbre3, struct OneSynthParams*timbre4) {
    Storage::init(timbre1, timbre2, timbre3, timbre4);
    USBH_Init(&usbOTGHost, USB_OTG_HS_CORE_ID, &usbHost, &USBH_MSC_cb, &USR_Callbacks);
    commandParams.commandState = COMMAND_INIT;
    usbProcess();
}
Beispiel #15
0
int UsbKey::remove(FILE_ENUM file) {
    commandParams.commandState = COMMAND_DELETE;
    commandParams.commandFileName = getFileName(file);
    usbProcess();
    return commandParams.commandResult;
}
Beispiel #16
0
int UsbKey::checkSize(FILE_ENUM file) {
    commandParams.commandState = COMMAND_EXISTS;
    commandParams.commandFileName = getFileName(file);
    usbProcess();
    return commandParams.commandResult;
}
Beispiel #17
0
int UsbKey::firmwareInit() {
    commandParams.commandState = COMMAND_OPEN_DIR;
    commandParams.commandFileName = FIRMWARE_DIR;
    usbProcess();
    return commandParams.commandResult;
}