SIO2Arduino ( microSD )
Modérateur : Politburo
-
- Fonctionne à 75 bauds
- Messages : 23
- Enregistré le : 30 déc. 2015 21:20
- Localisation : Bouches du Rhone
Re: SIO2Arduino ( microSD )
Salut
Tous mes vœux pour cette nouvelle année
Merci pour ta réponse [antique]
j'ai bien vérifié ou est mon dossier de travail
mes documents \SIO2Arduino\SIO2arduino.ino
la librairie Sdfat et son dossier est bien celle que j'avais téléchargée et installée dans le dossier C:\Program Files (x86)\Arduino\libraries
je viens d'essayer en deplacant le tout dans C:\Users\-\Documents\Arduino\libraries\SdFat
même problème
Tous mes vœux pour cette nouvelle année
Merci pour ta réponse [antique]
j'ai bien vérifié ou est mon dossier de travail
mes documents \SIO2Arduino\SIO2arduino.ino
la librairie Sdfat et son dossier est bien celle que j'avais téléchargée et installée dans le dossier C:\Program Files (x86)\Arduino\libraries
je viens d'essayer en deplacant le tout dans C:\Users\-\Documents\Arduino\libraries\SdFat
même problème
-
- Fonctionne à 75 bauds
- Messages : 23
- Enregistré le : 30 déc. 2015 21:20
- Localisation : Bouches du Rhone
Re: SIO2Arduino ( microSD )
Je suis reparti de 0
mon fichier projet:
contenu du dossier
C:\Users\-\Documents\Arduino\SIO2Arduino\SIO2Arduino.ino
Modif effectuées dans C:\Users\-\Documents\Arduino\SIO2Arduino\disk_image.cpp
Et toujour meme erreur
[/color]
pas moyen de comprendre pourquoi.
mon fichier projet:
contenu du dossier
Code : Tout sélectionner
R‚pertoire de C:\Users\-\Documents\Arduino\SIO2Arduino
01/01/2016 09:49 <REP> .
01/01/2016 09:49 <REP> ..
02/04/2013 21:48 1ÿ316 atari.h
02/04/2013 21:48 4ÿ949 config.h
02/04/2013 21:48 12ÿ488 COPYING
02/04/2013 21:48 3ÿ247 disk_drive.cpp
02/04/2013 21:48 614 disk_drive.h
30/12/2015 21:12 14ÿ433 disk_image.cpp
02/04/2013 21:48 2ÿ534 disk_image.h
02/04/2013 21:48 1ÿ208 drive_access.cpp
02/04/2013 21:48 570 drive_access.h
02/04/2013 21:48 1ÿ097 drive_control.cpp
02/04/2013 21:48 350 drive_control.h
01/01/2016 09:49 0 lst.txt
02/04/2013 21:48 506 readme.txt
02/04/2013 21:48 7ÿ966 sdrive.cpp
02/04/2013 21:48 1ÿ590 sdrive.h
30/12/2015 21:13 8ÿ497 SIO2Arduino.ino
02/04/2013 21:48 11ÿ534 sio_channel.cpp
02/04/2013 21:48 2ÿ386 sio_channel.h
Code : Tout sélectionner
/*
/*
* sio2arduino.ino - An Atari 8-bit device emulator for Arduino.
*
* Copyright (c) 2012 Whizzo Software LLC (Daniel Noguerol)
*
* This file is part of the SIO2Arduino project which emulates
* Atari 8-bit SIO devices on Arduino hardware.
*
* SIO2Arduino is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SIO2Arduino is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SIO2Arduino; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#define USE_SD_VOLUME
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SdVolume.h>
#include "atari.h"
#include "sio_channel.h"
#include "disk_drive.h"
#ifdef LCD_DISPLAY
#include <LiquidCrystal.h>
#endif
/**
* Global variables
*/
DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);
DriveControl driveControl(getFileList, mountFileIndex, changeDirectory);
SIOChannel sioChannel(PIN_ATARI_CMD, &SIO_UART, &driveAccess, &driveControl);
Sd2Card card;
SdVolume volume;
SdFile currDir;
SdFile file; // TODO: make this unnecessary
DiskDrive drive1;
#ifdef SELECTOR_BUTTON
boolean isSwitchPressed = false;
unsigned long lastSelectionPress;
boolean isFileOpened;
#endif
#ifdef RESET_BUTTON
unsigned long lastResetPress;
#endif
#ifdef LCD_DISPLAY
LiquidCrystal lcd(PIN_LCD_RD,PIN_LCD_ENABLE,PIN_LCD_DB4,PIN_LCD_DB5,PIN_LCD_DB6,PIN_LCD_DB7);
#endif
void setup() {
#ifdef DEBUG
// set up logging serial port
LOGGING_UART.begin(115200);
#endif
// initialize serial port to Atari
SIO_UART.begin(19200);
// set pin modes
#ifdef SELECTOR_BUTTON
pinMode(PIN_SELECTOR, INPUT);
#endif
#ifdef RESET_BUTTON
pinMode(PIN_RESET, INPUT);
#endif
#ifdef LCD_DISPLAY
// set up LCD if appropriate
lcd.begin(16, 2);
lcd.print("SIO2Arduino");
lcd.setCursor(0,1);
#endif
// initialize SD card
LOG_MSG("Initializing SD card...");
pinMode(PIN_SD_CS, OUTPUT);
if (!card.init(SPI_HALF_SPEED, PIN_SD_CS)) {
LOG_MSG_CR(" failed.");
#ifdef LCD_DISPLAY
lcd.print("SD Init Error");
#endif
return;
}
if (!volume.init(&card)) {
LOG_MSG_CR(" failed.");
#ifdef LCD_DISPLAY
lcd.print("SD Volume Error");
#endif
return;
}
if (!currDir.openRoot(&volume)) {
LOG_MSG_CR(" failed.");
#ifdef LCD_DISPLAY
lcd.print("SD Root Error");
#endif
return;
}
LOG_MSG_CR(" done.");
#ifdef LCD_DISPLAY
lcd.print("READY");
#endif
}
void loop() {
// let the SIO channel do its thing
sioChannel.runCycle();
#ifdef SELECTOR_BUTTON
// watch the selector button (accounting for debounce)
if (digitalRead(PIN_SELECTOR) == HIGH && millis() - lastSelectionPress > 250) {
lastSelectionPress = millis();
changeDisk(0);
}
#endif
#ifdef RESET_BUTTON
// watch the reset button
if (digitalRead(PIN_RESET) == HIGH && millis() - lastResetPress > 250) {
lastResetPress = millis();
mountFilename(0, "AUTORUN.ATR");
}
#endif
#ifdef ARDUINO_TEENSY
if (SIO_UART.available())
SIO_CALLBACK();
#endif
}
void SIO_CALLBACK() {
// inform the SIO channel that an incoming byte is available
sioChannel.processIncomingByte();
}
DriveStatus* getDeviceStatus(int deviceId) {
return drive1.getStatus();
}
SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data) {
if (drive1.hasImage()) {
return drive1.getSectorData(sector, data);
} else {
return NULL;
}
}
boolean writeSector(int deviceId, unsigned long sector, byte* data, unsigned long length) {
return (drive1.writeSectorData(sector, data, length) == length);
}
boolean format(int deviceId, int density) {
char name[13];
// get current filename
file.getName(name,13);
// close and delete the current file
file.close();
file.remove();
LOG_MSG("Remove old file: ");
LOG_MSG_CR(name);
// open new file for writing
file.open(&currDir, name, O_RDWR | O_SYNC | O_CREAT);
LOG_MSG("Created new file: ");
LOG_MSG_CR(name);
// allow the virtual drive to format the image (and possibly alter its size)
if (drive1.formatImage(&file, density)) {
// set the new image file for the drive
drive1.setImageFile(&file);
return true;
} else {
return false;
}
}
void changeDisk(int deviceId) {
dir_t dir;
char name[13];
boolean imageChanged = false;
while (!imageChanged) {
// get next dir entry
int8_t result = currDir.readDir((dir_t*)&dir);
// if we got back a 0, rewind the directory and get the first dir entry
if (!result) {
currDir.rewind();
result = currDir.readDir((dir_t*)&dir);
}
// if we have a valid file response code, open it
if (result > 0 && isValidFilename((char*)&dir.name)) {
createFilename(name, (char*)dir.name);
imageChanged = mountFilename(deviceId, name);
}
}
}
boolean isValidFilename(char *s) {
return ( s[0] != '.' && // ignore hidden files
s[0] != '_' && ( // ignore bogus files created by OS X
(s[8] == 'A' && s[9] == 'T' && s[10] == 'R')
|| (s[8] == 'X' && s[9] == 'F' && s[10] == 'D')
#ifdef PRO_IMAGES
|| (s[8] == 'P' && s[9] == 'R' && s[10] == 'O')
#endif
#ifdef ATX_IMAGES
|| (s[8] == 'A' && s[9] == 'T' && s[10] == 'X')
#endif
#ifdef XEX_IMAGES
|| (s[8] == 'X' && s[9] == 'E' && s[10] == 'X')
#endif
)
);
}
void createFilename(char* filename, char* name) {
for (int i=0; i < 8; i++) {
if (name[i] != ' ') {
*(filename++) = name[i];
}
}
if (name[8] != ' ') {
*(filename++) = '.';
*(filename++) = name[8];
*(filename++) = name[9];
*(filename++) = name[10];
}
*(filename++) = '\0';
}
/**
* Returns a list of files in the current directory.
*
* startIndex = the first valid file in the directory to start from
* count = how many files to return
* entries = a pointer to the a FileEntry array to hold the returned data
*/
int getFileList(int startIndex, int count, FileEntry *entries) {
dir_t dir;
int currentEntry = 0;
currDir.rewind();
int ix = 0;
while (ix < count) {
if (currDir.readDir((dir_t*)&dir) < 1) {
break;
}
if (isValidFilename((char*)&dir.name) || (DIR_IS_SUBDIR(&dir) && dir.name[0] != '.')) {
if (currentEntry >= startIndex) {
memcpy(entries[ix].name, dir.name, 11);
if (DIR_IS_SUBDIR(&dir)) {
entries[ix].isDirectory = true;
} else {
entries[ix].isDirectory = false;
}
ix++;
}
currentEntry++;
}
}
return ix;
}
/**
* Changes the SD card directory.
*
* ix = index number (or -1 to go to parent directory)
*/
void changeDirectory(int ix) {
FileEntry entries[1];
char name[13];
SdFile subDir;
if (ix > -1) {
getFileList(ix, 1, entries);
createFilename(name, entries[0].name);
if (subDir.open(&currDir, name, O_READ)) {
currDir = subDir;
}
} else {
if (subDir.openRoot(&volume)) {
currDir = subDir;
}
}
}
/**
* Mount a file with the given index number.
*
* deviceId = the drive ID
* ix = the index of the file to mount
*/
void mountFileIndex(int deviceId, int ix) {
FileEntry entries[1];
char name[13];
// figure out what filename is associated with the index
getFileList(ix, 1, entries);
// build a full 8.3 filename
createFilename(name, entries[0].name);
// mount the image
mountFilename(deviceId, name);
}
/**
* Mount a file with the given name.
*
* deviceId = the drive ID
* name = the name of the file to mount
*/
boolean mountFilename(int deviceId, char *name) {
// close previously open file
if (file.isOpen()) {
file.close();
}
if (file.open(&currDir, name, O_RDWR | O_SYNC) && drive1.setImageFile(&file)) {
LOG_MSG_CR(name);
#ifdef LCD_DISPLAY
lcd.clear();
lcd.print(name);
lcd.setCursor(0,1);
#endif
return true;
}
return false;
}
Code : Tout sélectionner
/*
* disk_image.cpp - Handles disk images in various formats.
*
* Copyright (c) 2012 Whizzo Software LLC (Daniel Noguerol)
*
* This file is part of the SIO2Arduino project which emulates
* Atari 8-bit SIO devices on Arduino hardware.
*
* SIO2Arduino is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* SIO2Arduino is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SIO2Arduino; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "disk_image.h"
#include "config.h"
#ifdef XEX_IMAGES
// The KBoot loader was written by Ken Siders (atari@columbus.rr.com)
byte KBOOT_LOADER[] = {
0x00,0x03,0x00,0x07,0x14,0x07,0x4c,0x14,0x07,0xAA,0xBB,0x00,0x00,0xa9,0x46,0x8d,0xc6,0x02,0xd0,0xfe,0xa0,0x00,0xa9,0x6b,
0x91,0x58,0x20,0xd9,0x07,0xb0,0xee,0x20,0xc4,0x07,0xad,0x7a,0x08,0x0d,0x76,0x08,0xd0,0xe3,0xa5,0x80,0x8d,0xe0,0x02,0xa5,
0x81,0x8d,0xe1,0x02,0xa9,0x00,0x8d,0xe2,0x02,0x8d,0xe3,0x02,0x20,0xeb,0x07,0xb0,0xcc,0xa0,0x00,0x91,0x80,0xa5,0x80,0xc5,
0x82,0xd0,0x06,0xa5,0x81,0xc5,0x83,0xf0,0x08,0xe6,0x80,0xd0,0x02,0xe6,0x81,0xd0,0xe3,0xad,0x76,0x08,0xd0,0xaf,0xad,0xe2,
0x02,0x8d,0x70,0x07,0x0d,0xe3,0x02,0xf0,0x0e,0xad,0xe3,0x02,0x8d,0x71,0x07,0x20,0xff,0xff,0xad,0x7a,0x08,0xd0,0x13,0xa9,
0x00,0x8d,0xe2,0x02,0x8d,0xe3,0x02,0x20,0xae,0x07,0xad,0x7a,0x08,0xd0,0x03,0x4c,0x3c,0x07,0xa9,0x00,0x85,0x80,0x85,0x81,
0x85,0x82,0x85,0x83,0xad,0xe0,0x02,0x85,0x0a,0x85,0x0c,0xad,0xe1,0x02,0x85,0x0b,0x85,0x0d,0xa9,0x01,0x85,0x09,0xa9,0x00,
0x8d,0x44,0x02,0x6c,0xe0,0x02,0x20,0xeb,0x07,0x85,0x80,0x20,0xeb,0x07,0x85,0x81,0xa5,0x80,0xc9,0xff,0xd0,0x10,0xa5,0x81,
0xc9,0xff,0xd0,0x0a,0x20,0xeb,0x07,0x85,0x80,0x20,0xeb,0x07,0x85,0x81,0x20,0xeb,0x07,0x85,0x82,0x20,0xeb,0x07,0x85,0x83,
0x60,0x20,0xeb,0x07,0xc9,0xff,0xd0,0x09,0x20,0xeb,0x07,0xc9,0xff,0xd0,0x02,0x18,0x60,0x38,0x60,0xad,0x09,0x07,0x0d,0x0a,
0x07,0x0d,0x0b,0x07,0xf0,0x79,0xac,0x79,0x08,0x10,0x50,0xee,0x77,0x08,0xd0,0x03,0xee,0x78,0x08,0xa9,0x31,0x8d,0x00,0x03,
0xa9,0x01,0x8d,0x01,0x03,0xa9,0x52,0x8d,0x02,0x03,0xa9,0x40,0x8d,0x03,0x03,0xa9,0x80,0x8d,0x04,0x03,0xa9,0x08,0x8d,0x05,
0x03,0xa9,0x1f,0x8d,0x06,0x03,0xa9,0x80,0x8d,0x08,0x03,0xa9,0x00,0x8d,0x09,0x03,0xad,0x77,0x08,0x8d,0x0a,0x03,0xad,0x78,
0x08,0x8d,0x0b,0x03,0x20,0x59,0xe4,0xad,0x03,0x03,0xc9,0x02,0xb0,0x22,0xa0,0x00,0x8c,0x79,0x08,0xb9,0x80,0x08,0xaa,0xad,
0x09,0x07,0xd0,0x0b,0xad,0x0a,0x07,0xd0,0x03,0xce,0x0b,0x07,0xce,0x0a,0x07,0xce,0x09,0x07,0xee,0x79,0x08,0x8a,0x18,0x60,
0xa0,0x01,0x8c,0x76,0x08,0x38,0x60,0xa0,0x01,0x8c,0x7a,0x08,0x38,0x60,0x00,0x03,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00
};
#endif
DiskImage::DiskImage() {
m_fileRef = NULL;
}
boolean DiskImage::setFile(SdFile* file) {
m_fileRef = file;
m_fileSize = file->fileSize();
// if image is valid...
if (loadFile(file)) {
return true;
} else {
m_fileRef = NULL;
return false;
}
}
byte DiskImage::getType() {
return m_type;
}
unsigned long DiskImage::getSectorSize() {
return m_sectorSize;
}
/**
* Read data from drive image.
*/
SectorDataInfo* DiskImage::getSectorData(unsigned long sector, byte *data) {
m_sectorInfo.length = m_sectorSize;
m_sectorInfo.error = false;
m_sectorInfo.validStatusFrame = false;
// delay if necessary
if (m_sectorReadDelay) {
delay(m_sectorReadDelay);
}
// seek to proper offset in file
switch (m_type) {
#ifdef XEX_IMAGES
case TYPE_XEX: {
if (sector < 4) {
unsigned long ix = (sector - 1) * m_sectorSize;
for (int i=0; i < m_sectorSize; i++) {
data[i] = KBOOT_LOADER[ix+i];
}
return &m_sectorInfo;
} else {
m_fileRef->seekSet((sector - 4) * m_sectorSize);
}
}
break;
#endif
#ifdef PRO_IMAGES
case TYPE_PRO: {
// if this is a PRO image, we seek based on the sector number + the sector header size (omitting the header)
m_fileRef->seekSet(m_headerSize + ((sector - 1) * (m_sectorSize + sizeof(PROSectorHeader))));
// then we read the sector header
for (int i=0; i < sizeof(PROSectorHeader); i++) {
((byte*)&m_proSectorHeader)[i] = (byte)m_fileRef->read();
}
// return the status frame so the drive can return it on a subsequent status command
memcpy(&m_sectorInfo.statusFrame, &m_proSectorHeader, sizeof(m_sectorInfo.statusFrame));
m_sectorInfo.validStatusFrame = true;
// if the header shows there was an error in this sector, return an error
if (!m_proSectorHeader.statusFrame.hardwareStatus.crcError || !m_proSectorHeader.statusFrame.hardwareStatus.dataLostOrTrack0 || !m_proSectorHeader.statusFrame.hardwareStatus.recordNotFound) {
m_sectorInfo.error = true;
} else {
// if there are phantom sector(s) associated with this sector, decide what to return
if (m_usePhantoms && m_proSectorHeader.totalPhantoms > 0 && m_phantomFlip) {
m_fileRef->seekSet(m_headerSize + (((720 + m_proSectorHeader.phantom1) - 1) * (m_sectorSize + sizeof(PROSectorHeader))) + sizeof(PROSectorHeader));
}
}
m_phantomFlip = !m_phantomFlip; // TODO: do bad sectors cause this to flip?
}
break;
#endif
#ifdef ATX_IMAGES
case TYPE_ATX: {
int ix = -1;
for (int i=0; i < 720; i++) {
if (m_sectorHeaders[i].sectorNumber == (sector-1)) {
ix = i;
if (!m_phantomFlip) {
break;
}
}
}
m_sectorInfo.validStatusFrame = true;
if (ix > -1) {
m_fileRef->seekSet(m_sectorHeaders[ix].fileIndex);
if (m_sectorHeaders[ix].sstatus > 0) {
m_sectorInfo.error = true;
}
// hardware status bits for floppy controller are active low, so bit flip
*((byte*)&m_sectorInfo.statusFrame.hardwareStatus) = ~(m_sectorHeaders[ix].sstatus);
*((byte*)&m_sectorInfo.statusFrame.commandStatus) = 0x10;
*(&m_sectorInfo.statusFrame.timeout_lsb) = 0xE0;
} else {
// TODO: right now we just send back a random data frame -- is this correct?
m_fileRef->seekSet(0);
m_sectorInfo.error = true;
// set the missing sector data bit (active low)
*((byte*)&m_sectorInfo.statusFrame.hardwareStatus) = 0xF7;
*((byte*)&m_sectorInfo.statusFrame.commandStatus) = 0x10;
*(&m_sectorInfo.statusFrame.timeout_lsb) = 0xE0;
}
// for now, do the same global flip of duplicate sector data as PRO
// (alternate between first/last duplicate sectors on successive reads)
// TODO: this should be based on timing of sector angular position
m_phantomFlip = !m_phantomFlip;
}
break;
#endif
default:
m_fileRef->seekSet(m_headerSize + ((sector - 1) * m_sectorSize));
break;
}
// read sector data into buffer
int b;
for (int i=0; i < m_sectorSize; i++) {
b = m_fileRef->read();
if (b != -1) {
data[i] = (byte)b;
} else {
data[i] = 0;
}
}
return &m_sectorInfo;
}
/**
* Write data to drive image.
*/
unsigned long DiskImage::writeSectorData(unsigned long sector, byte* data, unsigned long len) {
if (!m_readOnly) {
// seek to proper offset in file
unsigned long offset = m_headerSize + ((sector - 1) * m_sectorSize);
m_fileRef->seekSet(offset);
// write the data
return m_fileRef->write(data, len);
}
return false;
}
/**
* Format drive image.
*/
boolean DiskImage::format(SdFile *file, int density) {
if (!m_readOnly) {
// determine file length
unsigned long length = FORMAT_SS_SD_40;
// make sure we're at beginning of file
file->seekSet(0);
// if disk is an ATR, write the header
if (m_type == TYPE_ATR) {
ATRHeader header;
memset(&header, 0, sizeof(header));
header.signature = ATR_SIGNATURE;
header.pars = length / 0x10;
header.secSize = SECTOR_SIZE_SD;
file->write((byte*)&header, sizeof(header));
}
// create empty byte buffer
for (unsigned long i=0; i < length; i++) {
file->write((byte)0);
}
return true;
}
return false;
}
boolean DiskImage::loadFile(SdFile *file) {
char filename[13];
// make sure we're at the beginning of file
file->seekSet(0);
// read first 16 bytes of file & rewind again
byte header[16];
for (int i=0; i < 16; i++) {
header[i] = (byte)file->read();
}
file->seekSet(0);
// check if it's an ATR
ATRHeader* atrHeader = (ATRHeader*)&header;
if (atrHeader->signature == ATR_SIGNATURE) {
m_type = TYPE_ATR;
m_headerSize = 16;
m_readOnly = false;
m_sectorSize = atrHeader->secSize;
m_sectorReadDelay = 0;
LOG_MSG("Loaded ATR with sector size ");
LOG_MSG(atrHeader->secSize);
LOG_MSG(": ");
return true;
}
#ifdef PRO_IMAGES
// check if it's an APE PRO image
PROFileHeader* proHeader = (PROFileHeader*)&header;
if (proHeader->sectorCountHi * 256 + proHeader->sectorCountLo == ((m_fileSize-16)/(SECTOR_SIZE_SD+sizeof(PROSectorHeader))) && proHeader->magic == 'P') {
m_type = TYPE_PRO;
m_readOnly = true;
m_headerSize = 16;
m_sectorSize = SECTOR_SIZE_SD;
m_sectorReadDelay = proHeader->sectorReadDelay * (1000/60);
// set the phantom emulation mode
switch (proHeader->phantomSectorMode) {
case PSM_SIMPLE:
case PSM_MINDSCAPE_SPECIAL:
case PSM_STICKY:
case PSM_SHIMMERING:
case PSM_REVERSE_SHIMMER:
m_usePhantoms = false;
break;
case PSM_GLOBAL_FLIP_FLOP:
m_usePhantoms = true;
m_phantomFlip = false;
break;
case PSM_GLOBAL_FLOP_FLIP:
m_usePhantoms = true;
m_phantomFlip = true;
break;
}
LOG_MSG("Loaded PRO with sector size 128: ");
return true;
}
#endif
#ifdef ATX_IMAGES
// check if it's an ATX
if (header[0] == 'A' && header[1] == 'T' && header[2] == '8' && header[3] == 'X') {
m_type = TYPE_ATX;
m_readOnly = true;
m_sectorReadDelay = 0;
m_sectorSize = 128;
m_phantomFlip = false;
unsigned long trackRecordSize;
unsigned long l2;
unsigned long fileIndex;
// start with all sector numbers impossibly high (for a floppy disk)
for (int i=0; i < 720; i++) {
m_sectorHeaders[i].sectorNumber = 60000;
}
// read header size
file->seekSet(28);
fileIndex = file->read() + file->read() * 256 + file->read() * 512 + file->read() * 768;
// skip to first track record
file->seekSet(fileIndex);
// NOTE: we're doing multiple file->read() statements to avoid creating any additional
// heap variables (we have a lot more available program space than heap space)
for (int i=0; i < 40; i++) {
// read track header
trackRecordSize = file->read();
trackRecordSize += file->read() * 256;
trackRecordSize += file->read() * 512;
trackRecordSize += file->read() * 768;
file->read();
file->read();
file->read();
file->read();
byte trackNumber = file->read();
file->read();
int sectorCount = file->read();
sectorCount += file->read() * 256;
file->read();
file->read();
file->read();
file->read();
file->read();
file->read();
file->read();
file->read();
l2 = file->read();
l2 += file->read() * 256;
l2 += file->read() * 512;
l2 += file->read() * 768;
// seek to beginning of sector list
file->seekSet(fileIndex + l2);
// skip sector list header
file->read();
file->read();
file->read();
file->read();
file->read();
file->read();
file->read();
file->read();
// read each sector
for (int i2=0; i2< sectorCount; i2++) {
byte sectorNum = file->read();
byte sectorStatus = file->read();
// skip sector position
file->read();
file->read();
// read start data pos
l2 = file->read();
l2 += file->read() * 256;
l2 += file->read() * 512;
l2 += file->read() * 768;
m_sectorHeaders[trackNumber * 18 + i2].sectorNumber = (trackNumber * 18) + (sectorNum - 1);
m_sectorHeaders[trackNumber * 18 + i2].sstatus = sectorStatus;
m_sectorHeaders[trackNumber * 18 + i2].fileIndex = fileIndex + l2;
}
// move to next track record
fileIndex += trackRecordSize;
file->seekSet(fileIndex);
}
LOG_MSG("Loaded ATX with sector size 128: ");
return true;
}
#endif
file->getName((char*)&filename,13);
int len = strlen(filename);
char *extension = filename + len - 4;
// check if it's an XFD
// (since an XFD is just a raw data dump, we can only determine this by file name and size)
if ((!strcmp(".XFD", extension) || !strcmp(".xfd", extension)) && (m_fileSize == FORMAT_SS_SD_40)) {
m_type = TYPE_XFD;
m_readOnly = false;
m_headerSize = 0;
m_sectorSize = SECTOR_SIZE_SD;
m_sectorReadDelay = 0;
LOG_MSG("Loaded XFD with sector size 128: ");
return true;
#ifdef XEX_IMAGES
} else if ((!strcmp(".XEX", extension) || !strcmp(".xex", extension))) {
m_type = TYPE_XEX;
m_readOnly = true;
m_headerSize = 0;
m_sectorSize = SECTOR_SIZE_SD;
m_sectorReadDelay = 0;
// set the size of the XEX in the correct bootloader location
KBOOT_LOADER[9] = m_fileSize & 0xFF;
KBOOT_LOADER[10] = m_fileSize >> 8;
LOG_MSG("Loaded XEX with sector size 128: ");
return true;
#endif
}
return false;
}
boolean DiskImage::hasImage() {
return (m_fileRef != NULL);
}
boolean DiskImage::hasCopyProtection() {
return (0 ||
#ifdef PRO_IMAGES
m_type == TYPE_PRO ||
#endif
#ifdef ATX_IMAGES
m_type == TYPE_ATX ||
#endif
0);
}
boolean DiskImage::isEnhancedDensity() {
return false;
}
boolean DiskImage::isDoubleDensity() {
return false;
}
boolean DiskImage::isReadOnly() {
return m_readOnly;
}
Code : Tout sélectionner
SIO2Arduino:39: error: 'getDeviceStatus' was not declared in this scope
DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);
^
SIO2Arduino:39: error: 'readSector' was not declared in this scope
DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);
^
SIO2Arduino:39: error: 'writeSector' was not declared in this scope
DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);
^
SIO2Arduino:39: error: 'format' was not declared in this scope
DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);
^
SIO2Arduino:40: error: 'getFileList' was not declared in this scope
DriveControl driveControl(getFileList, mountFileIndex, changeDirectory);
^
SIO2Arduino:40: error: 'mountFileIndex' was not declared in this scope
DriveControl driveControl(getFileList, mountFileIndex, changeDirectory);
^
SIO2Arduino:40: error: 'changeDirectory' was not declared in this scope
DriveControl driveControl(getFileList, mountFileIndex, changeDirectory);
^
Using library SdFat in folder: C:\Users\-\Documents\Arduino\libraries\SdFat (legacy)
exit status 1
'getDeviceStatus' was not declared in this scope
pas moyen de comprendre pourquoi.
- Sir thierry
- Fonctionne à 2400 bauds
- Messages : 1409
- Enregistré le : 14 mai 2006 11:42
Re: SIO2Arduino ( microSD )
Pour l'instant je suis en mode grosse flemme.
Par contre, moi je vais partir sur le SIO2microSD sur l'arduino.
Par contre, moi je vais partir sur le SIO2microSD sur l'arduino.
-
- Fonctionne à 75 bauds
- Messages : 23
- Enregistré le : 30 déc. 2015 21:20
- Localisation : Bouches du Rhone
Re: SIO2Arduino ( microSD )
Apparemment c'est sur la même base ATmega mais là il n'y a pas le source pour adapter à sa sauce ...Sir thierry a écrit :Pour l'instant je suis en mode grosse flemme.
Par contre, moi je vais partir sur le SIO2microSD sur l'arduino.
- Antique
- Fonctionne à 300 bauds
- Messages : 240
- Enregistré le : 05 sept. 2011 10:09
- Localisation : 73- Savoie
Re: SIO2Arduino ( microSD )
j'ai jeté un coup d’œil sur ton listing, il est bon et au vu de ton rapport d'erreur, c'est bien celui qui correspond à l'erreur de départ (avant les modifs) du coup c'est au niveau de ta compilation que ça semble déconner ...
ce qui m’amène à penser que tu ne dois pas installer correctement ta librairie, il faudrait que tu retire ta lib sdfat de ton dossier librairies, que tu décompresse la sdfat que tu as chargé et que tu la renomme en sdfat après l'avoir recopier dans le dossier librairies le reste à bien l'air d’être correct.
ce qui m’amène à penser que tu ne dois pas installer correctement ta librairie, il faudrait que tu retire ta lib sdfat de ton dossier librairies, que tu décompresse la sdfat que tu as chargé et que tu la renomme en sdfat après l'avoir recopier dans le dossier librairies le reste à bien l'air d’être correct.
-
- Fonctionne à 75 bauds
- Messages : 23
- Enregistré le : 30 déc. 2015 21:20
- Localisation : Bouches du Rhone
Re: SIO2Arduino ( microSD )
Merci [antique de te pencher sur mon problème]
ça dois fair 10 fois que je redecompresse la librairie , la renomme et le colle dans dossier librairies
j'ai essayé
C:\Users\-\Documents\Arduino\libraries\SdFat
et
C:\Program Files (x86)\Arduino\libraries
voici le contenu du dossier
dans le log de compilation à la derniere ligne il me dit que la librairie est bien trouvée
peux-tu m'envoyer stp par MP ton dossier sdfat et ton .INO
ça dois fair 10 fois que je redecompresse la librairie , la renomme et le colle dans dossier librairies
j'ai essayé
C:\Users\-\Documents\Arduino\libraries\SdFat
et
C:\Program Files (x86)\Arduino\libraries
voici le contenu du dossier
Code : Tout sélectionner
R‚pertoire de C:\Users\-\Documents\Arduino\libraries\SdFat
01/01/2016 17:02 <REP> .
01/01/2016 17:02 <REP> ..
24/03/2015 08:26 <REP> examples
01/01/2016 17:02 0 lst.txt
24/03/2015 08:26 2ÿ188 MinimumSerial.cpp
24/03/2015 08:26 1ÿ562 MinimumSerial.h
24/03/2015 08:26 10ÿ425 SdFat.h
24/03/2015 08:26 3ÿ575 SdFatBase.cpp
24/03/2015 08:26 7ÿ034 SdFatConfig.h
24/03/2015 08:26 14ÿ526 SdFatmainpage.h
24/03/2015 08:26 1ÿ687 SdFatUtil.cpp
24/03/2015 08:26 2ÿ295 SdFatUtil.h
24/03/2015 08:26 13ÿ120 SdInfo.h
24/03/2015 08:26 10ÿ115 SdSpi.h
24/03/2015 08:26 18ÿ421 SdSpiCard.cpp
24/03/2015 08:26 9ÿ919 SdSpiCard.h
24/03/2015 08:26 7ÿ775 SdSpiSAM3X.cpp
24/03/2015 08:26 5ÿ518 SdSpiSTM32F1.cpp
24/03/2015 08:26 8ÿ695 SdSpiTeensy3.cpp
24/03/2015 08:26 2ÿ350 SdVolume.h
24/03/2015 08:26 <REP> utility
Code : Tout sélectionner
Using library SdFat in folder: C:\Users\-\Documents\Arduino\libraries\SdFat (legacy)
- Antique
- Fonctionne à 300 bauds
- Messages : 240
- Enregistré le : 05 sept. 2011 10:09
- Localisation : 73- Savoie
Re: SIO2Arduino ( microSD )
ok, j'essaye de te faire passer ça ...
Re: SIO2Arduino ( microSD )
Une piste sans avoir tous les éléments...
Le message d'erreur indique que les variables "getDeviceStatus", "readSector", etc... Ne sont pas déclarées au moment où tu les utilises.
Je suppose que leur déclaration doit être faite dans un autre fichier. Logiquement dans drive_access.h et drive_control.h.
Il doit manquer l'include pour les librairies drive_access et drive_control au début de ton fichier ino.
Essaye d'ajouter les lignes suivantes juste après #include "disk_drive.h"
Le message d'erreur indique que les variables "getDeviceStatus", "readSector", etc... Ne sont pas déclarées au moment où tu les utilises.
Je suppose que leur déclaration doit être faite dans un autre fichier. Logiquement dans drive_access.h et drive_control.h.
Il doit manquer l'include pour les librairies drive_access et drive_control au début de ton fichier ino.
Essaye d'ajouter les lignes suivantes juste après #include "disk_drive.h"
Code : Tout sélectionner
#include "drive_access.h"
#include "drive_control.h"
- Antique
- Fonctionne à 300 bauds
- Messages : 240
- Enregistré le : 05 sept. 2011 10:09
- Localisation : 73- Savoie
Re: SIO2Arduino ( microSD )
salut keeper, en fait le problème est dans la lib de sdfat, les dernières versions n'inclut plus le getDeviceStatus, du coup ça crée l'erreur à la compil. c'est cette erreur que j'avais avant de trouver les modifs à faire (le lien est vers le début de ce post).
c'est pour ça que je pense plus à un soucis d’accès a la lib qui doit être la sdfat d'origine de l'arduino et pas celle de github
c'est pour ça que je pense plus à un soucis d’accès a la lib qui doit être la sdfat d'origine de l'arduino et pas celle de github
Re: SIO2Arduino ( microSD )
Ah ok. C'est vrai que c'est un peu galère les librairies avec Arduino.
Je l'ai très peu utilisé il y a quelques années, depuis je fais mes développements directement avec Avr Studio. Certes il faut avoir l'outil de flash mais ça ne coûte rien chez les chinois
Je l'ai très peu utilisé il y a quelques années, depuis je fais mes développements directement avec Avr Studio. Certes il faut avoir l'outil de flash mais ça ne coûte rien chez les chinois
- Antique
- Fonctionne à 300 bauds
- Messages : 240
- Enregistré le : 05 sept. 2011 10:09
- Localisation : 73- Savoie
Re: SIO2Arduino ( microSD )
oupss, effectivement les erreurs ne correspondes pas à ce que j'attendais, l'erreur ne provient pas de la lib, mais plutôt du source il doit manquer un include quelque part ...
j'ai un truc à aller faire, j'essaye de rejeter un coup d'oeil des que je peux ...
j'ai un truc à aller faire, j'essaye de rejeter un coup d'oeil des que je peux ...
-
- Fonctionne à 75 bauds
- Messages : 23
- Enregistré le : 30 déc. 2015 21:20
- Localisation : Bouches du Rhone
Re: SIO2Arduino ( microSD )
merci les gars
je vais tester tous ça et faire tourner mes méninges
Bon ap
je vais tester tous ça et faire tourner mes méninges
Bon ap
- Antique
- Fonctionne à 300 bauds
- Messages : 240
- Enregistré le : 05 sept. 2011 10:09
- Localisation : 73- Savoie
Re: SIO2Arduino ( microSD )
bon je viens de compiler ton code sur mon poste, j'ai pas eu d'erreur à la compilation, donc de ce coté là c'est bon
- Antique
- Fonctionne à 300 bauds
- Messages : 240
- Enregistré le : 05 sept. 2011 10:09
- Localisation : 73- Savoie
Re: SIO2Arduino ( microSD )
j'ai compilé avec l'autre fichier (et ton code source) tout est bien passé, donc je penche encore pour la librairie (tu as bien pris celle que je t'ai indiqué plus haut ?)
il te reste à vérifier les options (chemin des librairies entre autre)
il te reste à vérifier les options (chemin des librairies entre autre)
-
- Fonctionne à 75 bauds
- Messages : 23
- Enregistré le : 30 déc. 2015 21:20
- Localisation : Bouches du Rhone
Re: SIO2Arduino ( microSD )
surement encore un problème de Windaube.
je bosse actuellement sur un portable win7 64 bits je vais désinstaller l'IDE et réinstaller proprement.
Merci de votre patience. Je vous tiens au jus dans une dizaine de minutes
je bosse actuellement sur un portable win7 64 bits je vais désinstaller l'IDE et réinstaller proprement.
Merci de votre patience. Je vous tiens au jus dans une dizaine de minutes