o mount and getfree working
This commit is contained in:
@@ -47,18 +47,18 @@ DSTATUS disk_initialize (BYTE drv) {
|
||||
|
||||
int fd = open(IMAGE_NAME, O_RDWR);
|
||||
if (fd == -1) {
|
||||
perror("Error opening file for writing");
|
||||
perror("DISKIO::disk_initialize: Error opening file for writing");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int size = lseek(fd,0,SEEK_END);
|
||||
lseek(fd,0,SEEK_SET);
|
||||
printf("Open Image (size %i)\n",size);
|
||||
|
||||
image_addr = (BYTE*)mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
printf("DISKIO::disk_initialize: Open Image (size %i) %p\n",size,image_addr);
|
||||
if (image_addr == MAP_FAILED) {
|
||||
close(fd);
|
||||
perror("Error mmapping the file");
|
||||
perror("DISKIO::disk_initialize: Error mmapping the file");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -94,8 +94,9 @@ DRESULT disk_read (
|
||||
|
||||
DWORD offset = sector * 512;
|
||||
int size = count * 512;
|
||||
printf("disk_read: sector=%li count=%i addr=%p off=%li size=%i\n",sector,count,image_addr + offset,offset,size);
|
||||
printf("DISKIO::disk_read: sector=%li count=%i addr=%p off=%li size=%i\n",sector,count,image_addr + offset,offset,size);
|
||||
memcpy(buff,image_addr + offset,size);
|
||||
printf("DISKIO::disk_read: done\n");
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ void FATFS::init() {
|
||||
sector = 0;
|
||||
count = 0;
|
||||
retval = -1;
|
||||
scratch_buffer = (char*)malloc(SHARED_SIZE);
|
||||
scratch_buffer = (unsigned char*)malloc(SHARED_SIZE);
|
||||
}
|
||||
|
||||
void FATFS::enable() {
|
||||
@@ -47,7 +47,10 @@ void FATFS::fetchMem() {
|
||||
void FATFS::pushMem() {
|
||||
for ( int i=0;i<SHARED_SIZE;i++){
|
||||
bus.write(SHARED_ADDR + i,scratch_buffer[i]);
|
||||
if ( i < 8)
|
||||
printf("0x%02x ",scratch_buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
uint8 FATFS::mmio_read(unsigned addr) {
|
||||
@@ -90,7 +93,7 @@ void FATFS::mmio_write(unsigned addr, uint8 data) {
|
||||
}
|
||||
if (addr == MMIO_COUNT){
|
||||
count = data;
|
||||
printf("FATFS::mmio_write set count: countr=%i \n",count);
|
||||
printf("FATFS::mmio_write set count: count=%i \n",count);
|
||||
if (command == CMD_READ) {
|
||||
retval = disk_read (0, (BYTE*)scratch_buffer, sector, count);
|
||||
if (!retval)
|
||||
|
||||
@@ -20,7 +20,7 @@ private:
|
||||
int sector;
|
||||
char count;
|
||||
char retval;
|
||||
char *scratch_buffer;
|
||||
unsigned char *scratch_buffer;
|
||||
};
|
||||
|
||||
extern FATFS fatfs;
|
||||
|
||||
@@ -78,6 +78,7 @@ void SNES::power() {
|
||||
}
|
||||
|
||||
scheduler.init();
|
||||
fatfs.init();
|
||||
|
||||
ppu.PPUcounter::reset();
|
||||
cpu.power();
|
||||
@@ -86,6 +87,7 @@ void SNES::power() {
|
||||
ppu.power();
|
||||
bus.power();
|
||||
|
||||
|
||||
if(expansion() == ExpansionBSX) bsxbase.power();
|
||||
if(cartridge.mode() == Cartridge::ModeBsx) bsxcart.power();
|
||||
if(cartridge.bsx_flash_loaded()) bsxflash.power();
|
||||
|
||||
@@ -44,7 +44,7 @@ image_not_parted:
|
||||
|
||||
image:
|
||||
rm -fv disk00.vfat
|
||||
mkfs.vfat -I -F 16 -v -C disk00.vfat 256000
|
||||
mkfs.vfat -I -F 16 -v -C disk00.vfat 4000
|
||||
sudo mount -o loop disk00.vfat disk
|
||||
sudo cp -v /var/log/*.log disk/
|
||||
sudo umount disk
|
||||
|
||||
Reference in New Issue
Block a user