cleanup debug code
This commit is contained in:
david
2009-06-08 17:22:37 +02:00
parent 8e1e5ea072
commit f832f0f72b
6 changed files with 77 additions and 60 deletions

View File

@@ -1,6 +1,7 @@
#include "integer.h"
#include "diskio.h"
#include "config.h"
static volatile
DSTATUS Stat = STA_NOINIT; /* Disk status */
@@ -47,7 +48,7 @@ DSTATUS disk_initialize (BYTE drv) {
int fd = open(IMAGE_NAME, O_RDWR);
if (fd == -1) {
perror("DISKIO::disk_initialize: Error opening file for writing");
perror("BSNES::disk_initialize: Error opening file for writing");
exit(EXIT_FAILURE);
}
@@ -55,12 +56,12 @@ DSTATUS disk_initialize (BYTE drv) {
lseek(fd,0,SEEK_SET);
image_addr = (BYTE*)mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
#ifdef MMIO_DEBUG
printf("DISKIO::disk_initialize: Open Image (size %i) %p\n",size,image_addr);
#ifdef DISKIO_DEBUG
printf("BSNES::disk_initialize: Open Image (size %i) %p\n",size,image_addr);
#endif
if (image_addr == MAP_FAILED) {
close(fd);
perror("DISKIO::disk_initialize: Error mmapping the file");
perror("BSNES::disk_initialize: Error mmapping the file");
exit(EXIT_FAILURE);
}
@@ -96,13 +97,13 @@ DRESULT disk_read (
DWORD offset = sector * 512;
int size = count * 512;
//#ifdef MMIO_DEBUG
printf("DISKIO::disk_read: sector=%li count=%i addr=%p off=%li size=%i\n",sector,count,image_addr + offset,offset,size);
//#endif
#ifdef DISKIO_DEBUG
printf("BSNES::disk_read: sector=%li count=%i addr=%p off=%li size=%i\n",sector,count,image_addr + offset,offset,size);
printf("BSNES::disk_read: %02x %02x %02x %02x\n",buff[0],buff[1],buff[2],buff[3]);
#endif
memcpy(buff,image_addr + offset,size);
printf("%x %x %x %x\n",buff[0],buff[1],buff[2],buff[3]);
#ifdef MMIO_DEBUG
printf("DISKIO::disk_read: done\n");
#ifdef DISKIO_DEBUG
printf("BSNES::disk_read: done\n");
#endif
return RES_OK;
}
@@ -125,8 +126,8 @@ DRESULT disk_write (
DWORD offset = sector * 512;
int size = count * 512;
#ifdef MMIO_DEBUG
printf("disk_write: sector=%li count=%i addr=%p off=%li size=%i\n",sector,count,image_addr + offset,offset,size);
#ifdef DISKIO_DEBUG
printf("BSNES::disk_write: sector=%li count=%i addr=%p off=%li size=%i\n",sector,count,image_addr + offset,offset,size);
#endif
memcpy(image_addr + offset,buff,size);
return RES_OK;
@@ -152,22 +153,22 @@ DRESULT disk_ioctl (
switch (ctrl) {
case GET_SECTOR_COUNT : /* Get number of sectors on the disk (DWORD) */
#ifdef MMIO_DEBUG
printf("disk_ioctl: GET_SECTOR_COUNT\n");
#ifdef DISKIO_DEBUG
printf("BSNES::disk_ioctl: GET_SECTOR_COUNT\n");
#endif
ofs = 60; w = 2; n = 0;
break;
case GET_SECTOR_SIZE : /* Get sectors on the disk (WORD) */
#ifdef MMIO_DEBUG
printf("disk_ioctl: GET_SECTOR_SIZE\n");
#ifdef DISKIO_DEBUG
printf("BSNES::disk_ioctl: GET_SECTOR_SIZE\n");
#endif
*(WORD*)buff = 512;
return RES_OK;
case GET_BLOCK_SIZE : /* Get erase block size in sectors (DWORD) */
#ifdef MMIO_DEBUG
printf("disk_ioctl: GET_BLOCK_SIZE\n");
#ifdef DISKIO_DEBUG
printf("BSNES::disk_ioctl: GET_BLOCK_SIZE\n");
#endif
*(DWORD*)buff = 32;
return RES_OK;