FDC Updated to recognize disk changes

Major FSYS syscalls (e.g. open, delete, opendir, etc.) updated to query the FDC (if it is the target drive) to update its status register and detect if the disk has changed (which can only be done with the motor spinning). MCP should now handle disk changes appropriately.
This commit is contained in:
Peter Weingartner 2022-05-13 19:29:05 -04:00
parent 3e7f1e9f7f
commit 30e728be14
15 changed files with 10842 additions and 16128 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -4,7 +4,7 @@
# and where the MCP will run (ram or flash)
#
UNIT := a2560k
MEMORY := ram
MEMORY := flash
# CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
# CPU_M68000 0x20 /* CPU code for the Motorola 68000 */

View file

@ -394,10 +394,6 @@ short cmd_dir(short screen, int argc, const char * argv[]) {
path = "";
}
print(0, "Path: ");
print(0, path);
print(0, "\n");
if (pattern != 0) {
// A pattern was provided
dir = sys_fsys_findfirst(path, pattern, &my_file);

View file

@ -20,6 +20,7 @@
#include "fatfs/ff.h"
#include "interrupt.h"
#include "log.h"
#include "fdc_reg.h"
#include "lpt_reg.h"
#include "dev/ps2.h"
#include "rtc_reg.h"
@ -412,7 +413,7 @@ short cli_test_seek(short screen, int argc, const char * argv[]) {
/*
* Test the FDC interface by reading the MBR
*
* TEST FDC [<lba> [WRITE <data>]]
* TEST FDC DSKCHG | [<lba> [WRITE <data>]]
*/
short cli_test_fdc(short screen, int argc, const char * argv[]) {
unsigned char buffer[512];
@ -423,58 +424,80 @@ short cli_test_fdc(short screen, int argc, const char * argv[]) {
short n = 0;
short result;
short is_write = 0;
short is_change_test = 0;
unsigned char data = 0xAA;
if (argc > 1) {
lba = (unsigned long)cli_eval_number(argv[1]);
if (argc > 2) {
print(screen, "Will attempt to write before reading...\n");
is_write = 1;
data = (unsigned long)cli_eval_number(argv[3]);
if ((strcmp(argv[1], "DSKCHG") == 0) || (strcmp(argv[1], "dskchg") == 0)) {
is_change_test = 1;
} else {
lba = (unsigned long)cli_eval_number(argv[1]);
if (argc > 2) {
print(screen, "Will attempt to write before reading...\n");
is_write = 1;
data = (unsigned long)cli_eval_number(argv[3]);
}
}
}
bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_ON, 0, 0);
result = bdev_init(BDEV_FDC);
if (result != 0) {
sprintf(buffer, "Could not initialize FDC: %s\n", sys_err_message(result));
sys_chan_write(screen, buffer, strlen(buffer));
return result;
}
if (is_change_test) {
// long target_jiffies = sys_time_jiffies() + 240;
// while (target_jiffies > sys_time_jiffies()) ;
for (i = 0; i < 512; i++) {
buffer[i] = data;
}
sprintf(message, "FDC_DIR: %02X\n", *FDC_DIR);
print(screen, message);
if (is_write) {
n = bdev_write(BDEV_FDC, lba, buffer, 512);
print(screen, "Recalibrating... ");
fdc_recalibrate();
fdc_seek(1);
print(screen, "done\n");
sprintf(message, "FDC_DIR: %02X\n", *FDC_DIR);
print(screen, message);
} else {
result = bdev_init(BDEV_FDC);
if (result != 0) {
sprintf(buffer, "Could not initialize FDC: %s\n", sys_err_message(result));
sys_chan_write(screen, buffer, strlen(buffer));
return result;
}
for (i = 0; i < 512; i++) {
buffer[i] = data;
}
if (is_write) {
n = bdev_write(BDEV_FDC, lba, buffer, 512);
if (n < 0) {
dump_buffer(screen, buffer, 512, 1);
sprintf(message, "Unable to write sector %d: %s\n", lba, err_message(n));
print(screen, message);
bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_OFF, 0, 0);
return n;
}
}
for (i = 0; i < 512; i++) {
buffer[i] = 0xAA;
}
n = bdev_read(BDEV_FDC, lba, buffer, 512);
if (n < 0) {
dump_buffer(screen, buffer, 512, 1);
sprintf(message, "Unable to write sector %d: %s\n", lba, err_message(n));
sprintf(message, "Unable to read sector %d: %s\n", lba, err_message(n));
print(screen, message);
bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_OFF, 0, 0);
return n;
}
}
for (i = 0; i < 512; i++) {
buffer[i] = 0xAA;
}
n = bdev_read(BDEV_FDC, lba, buffer, 512);
if (n < 0) {
dump_buffer(screen, buffer, 512, 1);
sprintf(message, "Unable to read sector %d: %s\n", lba, err_message(n));
print(screen, message);
bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_OFF, 0, 0);
return n;
print(screen, "\n\n");
}
dump_buffer(screen, buffer, 512, 1);
print(screen, "\n\n");
bdev_ioctrl(BDEV_FDC, FDC_CTRL_MOTOR_OFF, 0, 0);
}
#endif
@ -757,7 +780,7 @@ const t_cli_test_feature cli_test_features[] = {
{"CREATE", "CREATE <path>: test creating a file", cli_test_create},
{"IDE", "IDE: test reading the MBR of the IDE drive", cli_test_ide},
#if MODEL == MODEL_FOENIX_A2560K
{"FDC", "FDC: test reading the MBR from the floppy drive", cli_test_fdc},
{"FDC", "FDC DSKCHG | [<lba> [WRITE <data>]]: test reading/writing the MBR from the floppy drive", cli_test_fdc},
{"GAMEPAD", "GAMEPAD [0 | 1]: test SNES gamepads", cli_test_gamepad},
{"JOY", "JOY: test the joystick", cli_test_joystick},
#endif

View file

@ -64,7 +64,7 @@ enum fdc_trans_direction {
* Device variables
*/
static unsigned char fdc_stat = 0;
short g_fdc_stat = FDC_STAT_NOINIT;
static long fdc_motor_off_time = 0; /* The time (in jiffies) when the motor should turn off */
static short fdc_heads_per_cylinder = 2; /* How many heads are supported? */
static short fdc_sectors_per_track = 18; /* How many sectors per track */
@ -107,7 +107,23 @@ void fdc_set_dma(short dma) {
*/
void fdc_media_change() {
// Indicate that the disk has changed
fdc_stat = FDC_STAT_NOINIT;
g_fdc_stat = FDC_STAT_NOINIT;
}
/**
* Check to see if the media has changed
* If so, recalibrate the drive and flag the change
*/
short fdc_media_check_change() {
// Check for the a disk change
if (*FDC_DIR & 0x80) {
// The disk has changed... recalibrate and set that it's changed
fdc_recalibrate();
fdc_seek(1);
g_fdc_stat = FDC_STAT_NOINIT;
return 1;
}
return 0;
}
/*
@ -264,8 +280,6 @@ short fdc_out(unsigned char x) {
return 0;
}
/*
* Spin up the drive's spindle motor
*/
@ -274,8 +288,8 @@ short fdc_motor_on() {
log_num(LOG_TRACE, "FDC_DOR: ", *FDC_DOR);
// if ((*FDC_DOR & FDC_DOR_MOT0) != FDC_DOR_MOT0) {
// /* Motor is not on... turn it on without DMA or RESET */
if ((*FDC_DOR & FDC_DOR_MOT0) != FDC_DOR_MOT0) {
/* Motor is not on... turn it on without DMA or RESET */
*FDC_DOR = FDC_DOR_MOT0 | FDC_DOR_NRESET;
log_num(LOG_TRACE, "FDC_DOR 2: ", *FDC_DOR);
@ -289,7 +303,7 @@ short fdc_motor_on() {
/* Wait a decent time for the motor to spin up */
long wait_time = timers_jiffies() + fdc_motor_wait;
while (wait_time > timers_jiffies()) ;
// }
}
short needs_handler = 0;
if (fdc_motor_off_time == 0) {
@ -304,8 +318,8 @@ short fdc_motor_on() {
rtc_register_periodic(RTC_RATE_500ms, fdc_motor_watchdog);
}
/* Flag that the motor is on */
fdc_stat |= FDC_STAT_MOTOR_ON;
// /* Flag that the motor is on */
// g_fdc_stat |= FDC_STAT_MOTOR_ON;
ind_set(IND_FDC, IND_ON);
@ -328,8 +342,8 @@ void fdc_motor_off() {
}
}
/* Flag that the motor is off */
fdc_stat &= ~FDC_STAT_MOTOR_ON;
// /* Flag that the motor is off */
// g_fdc_stat &= ~FDC_STAT_MOTOR_ON;
// Reset the motor off time to 0, so we know we need to reinstall the watchdog later
fdc_motor_off_time = 0;
@ -633,6 +647,8 @@ short fdc_reset() {
return DEV_TIMEOUT;
}
g_fdc_stat = 0;
fdc_motor_on();
return 0;
@ -795,10 +811,13 @@ short fdc_command(p_fdc_trans transaction) {
switch (transaction->direction) {
case FDC_TRANS_WRITE:
/* We're writing to the FDC */
for (i = 0; (i < transaction->data_count); i++) {
if ((result = fdc_out(transaction->data[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout writing data");
return result;
fdc_wait_rqm();
if (*FDC_MSR & FDC_MSR_NONDMA) {
for (i = 0; (i < transaction->data_count); i++) {
if ((result = fdc_out(transaction->data[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout writing data");
return result;
}
}
}
break;
@ -1014,7 +1033,9 @@ short fdc_read(long lba, unsigned char * buffer, short size) {
lba_2_chs((unsigned long)lba, &cylinder, &head, &sector);
// Signal that we need the motor on and check if the media has changed
fdc_motor_on();
fdc_media_check_change();
trans.retries = 1; //FDC_DEFAULT_RETRIES;
trans.command = 0x40 | FDC_CMD_READ_DATA; /* MFM read command */
@ -1024,7 +1045,7 @@ short fdc_read(long lba, unsigned char * buffer, short size) {
trans.parameters[2] = head & 0x0001;
trans.parameters[3] = sector & 0x00ff;
trans.parameters[4] = 2;
trans.parameters[5] = fdc_sectors_per_track;
trans.parameters[5] = sector & 0x00ff; /* End of Track... fdc_sectors_per_track; */
trans.parameters[6] = 0x1B; /* GPL = 0x1B */
trans.parameters[7] = 0xFF; /* DTL = 0xFF */
trans.parameter_count = 8; /* Sending 8 parameter bytes */
@ -1046,15 +1067,12 @@ short fdc_read(long lba, unsigned char * buffer, short size) {
if ((result == 0)) { //} && ((trans.results[0] & 0xC0) == 0)) {
sprintf(message, "fdc_read: success? ST0=%02X ST1=%02X ST2=%02X C=%02X H=%02X R=%02X N=%02X",
trans.results[0], trans.results[1], trans.results[2], trans.results[3], trans.results[4], trans.results[5], trans.results[6]);
log(LOG_ERROR, message);
log(LOG_INFO, message);
return size;
} else {
sprintf(message, "fdc_read: retry ST0=%02X ST1=%02X ST2=%02X C=%02X H=%02X R=%02X N=%02X",
trans.results[0], trans.results[1], trans.results[2], trans.results[3], trans.results[4], trans.results[5], trans.results[6]);
log(LOG_ERROR, message);
sprintf(message, "fdc_read: retry EXTRA0=%02X EXTRA1=%02X",
trans.results[7], trans.results[8]);
log(LOG_ERROR, message);
}
fdc_init();
trans.retries--;
@ -1085,7 +1103,9 @@ short fdc_write(long lba, const unsigned char * buffer, short size) {
lba_2_chs((unsigned long)lba, &cylinder, &head, &sector);
// Signal that we need the motor on and check if the media has changed
fdc_motor_on();
fdc_media_check_change();
trans.retries = 1; //FDC_DEFAULT_RETRIES;
trans.command = 0x40 | FDC_CMD_WRITE_DATA; /* MFM read command */
@ -1095,7 +1115,7 @@ short fdc_write(long lba, const unsigned char * buffer, short size) {
trans.parameters[2] = head & 0x0001;
trans.parameters[3] = sector & 0x00ff;
trans.parameters[4] = 2;
trans.parameters[5] = fdc_sectors_per_track;
trans.parameters[5] = sector & 0x00ff; /* End of Track... fdc_sectors_per_track; */
trans.parameters[6] = 0x1B; /* GPL = 0x1B */
trans.parameters[7] = 0xFF; /* DTL = 0xFF */
trans.parameter_count = 8; /* Sending 8 parameter bytes */
@ -1114,18 +1134,21 @@ short fdc_write(long lba, const unsigned char * buffer, short size) {
log_num(LOG_INFO, "fdc_cmd: ", result);
}
if ((trans.results[1] & 0x02) != 0) {
log(LOG_ERROR, "Disk is write protected");
g_fdc_stat |= FDC_STAT_PROTECTED;
return DEV_WRITEPROT;
}
if ((result == 0)) { //} && ((trans.results[0] & 0xC0) == 0)) {
sprintf(message, "fdc_write: success? ST0=%02X ST1=%02X ST2=%02X C=%02X H=%02X R=%02X N=%02X",
trans.results[0], trans.results[1], trans.results[2], trans.results[3], trans.results[4], trans.results[5], trans.results[6]);
log(LOG_ERROR, message);
log(LOG_INFO, message);
return size;
} else {
sprintf(message, "fdc_write: retry ST0=%02X ST1=%02X ST2=%02X C=%02X H=%02X R=%02X N=%02X",
trans.results[0], trans.results[1], trans.results[2], trans.results[3], trans.results[4], trans.results[5], trans.results[6]);
log(LOG_ERROR, message);
sprintf(message, "fdc_write: retry EXTRA0=%02X EXTRA1=%02X",
trans.results[7], trans.results[8]);
log(LOG_ERROR, message);
}
fdc_init();
trans.retries--;
@ -1142,7 +1165,7 @@ short fdc_write(long lba, const unsigned char * buffer, short size) {
* the status of the device
*/
short fdc_status() {
return fdc_stat;
return g_fdc_stat;
}
/*
@ -1179,12 +1202,19 @@ short fdc_flush() {
short fdc_ioctrl(short command, unsigned char * buffer, short size) {
switch (command) {
case FDC_CTRL_MOTOR_ON:
// Turn on the spindle motor
return fdc_motor_on();
case FDC_CTRL_MOTOR_OFF:
// Turn off the spindle motor
fdc_motor_off();
return 0;
case FDC_CTRL_CHECK_CHANGE:
// Check to see if the disk has changed
fdc_motor_on();
return fdc_media_check_change();
default:
return 0;
}
@ -1208,7 +1238,6 @@ short fdc_init() {
return ERR_GENERAL;
}
fdc_stat &= ~FDC_STAT_NOINIT;
return 0;
}
@ -1229,7 +1258,7 @@ short fdc_install() {
bdev.flush = fdc_flush;
bdev.ioctrl = fdc_ioctrl;
fdc_stat = FDC_STAT_PRESENT & FDC_STAT_NOINIT;
g_fdc_stat = FDC_STAT_PRESENT & FDC_STAT_NOINIT;
return bdev_register(&bdev);
}

View file

@ -20,8 +20,9 @@
#define FDC_STAT_PROTECTED 0x04 /* FD is write-protected */
#define FDC_STAT_MOTOR_ON 0x08 /* FDC spindle motor is on */
#define FDC_CTRL_MOTOR_ON 0x0100 /* IOCTRL command to start spinning the motor */
#define FDC_CTRL_MOTOR_OFF 0x0200 /* IOCTRL command to start spinning the motor */
#define FDC_CTRL_MOTOR_ON 0x0001 /* IOCTRL command to start spinning the motor */
#define FDC_CTRL_MOTOR_OFF 0x0002 /* IOCTRL command to start spinning the motor */
#define FDC_CTRL_CHECK_CHANGE 0x0003 /* IOCTRL command to check to see if the disk has changed */
/*
* Structure to keep track of the information about a transaction with the floppy drive

View file

@ -12,6 +12,7 @@
#include <string.h>
#include "dev/channel.h"
#include "dev/fdc.h"
#include "errors.h"
#include "elf.h"
#include "fsys.h"
@ -75,6 +76,38 @@ short fatfs_to_foenix(FRESULT r) {
}
}
/**
* Make sure the status of the drive is up to date for the given path
*
* @param path
*/
void fsys_update_stat(const char * path) {
char buffer[20];
int i;
if (path[0] != '/') {
// The root was not specified... get it from the current working directory
strncpy(buffer, g_current_directory, 20);
} else {
// The root was specified... work with the data in the path
strncpy(buffer, path, 20);
}
// Make sure the path is lower case
for (i = 0; i < strlen(buffer); i++) {
char c = buffer[i];
if ((c >= 'A') && (c <= 'Z')) {
buffer[i] = tolower(c);
}
}
if (strncmp(buffer, "/fd", 3) == 0) {
// If the drive is the floppy drive, force the drive to spin up and check for a disk change
// this will update the fdc_status, which will be seen by FatFS and treated appropriately
sys_bdev_ioctrl(BDEV_FDC, FDC_CTRL_CHECK_CHANGE, 0, 0);
}
}
/**
* Attempt to open a file given the path to the file and the mode.
*
@ -91,6 +124,10 @@ short fsys_open(const char * path, short mode) {
TRACE("fsys_open");
// If the file being opened is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(path);
/* Allocate a file handle */
for (i = 0; i < MAX_FILES; i++) {
@ -175,6 +212,9 @@ short fsys_opendir(const char * path) {
short dir = -1;
FRESULT fres;
// Make sure our status is updated for the drive indicated by the path
fsys_update_stat(path);
/* Allocate a directory handle */
for (i = 0; i < MAX_DIRECTORIES; i++) {
if (g_dir_state[i] == 0) {
@ -278,6 +318,10 @@ short fsys_stat(const char * path, p_file_info file) {
FRESULT fres;
FILINFO finfo;
// If the file being checked is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(path);
fres = f_stat(path, &finfo);
if (fres == FR_OK) {
int i;
@ -320,6 +364,10 @@ short fsys_findfirst(const char * path, const char * pattern, p_file_info file)
short dir = 0;
short i = 0;
// If the path being queried is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(path);
/* Allocate a directory handle */
for (i = 0; i < MAX_DIRECTORIES; i++) {
if (g_dir_state[i] == 0) {
@ -414,6 +462,10 @@ short fsys_mkdir(const char * path) {
TRACE("fsys_mkdir");
// If the directory being created is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(path);
result = f_mkdir(path);
if (result == FR_OK) {
return 0;
@ -435,6 +487,10 @@ short fsys_mkdir(const char * path) {
short fsys_delete(const char * path) {
FRESULT result;
// If the path being deleted is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(path);
result = f_unlink(path);
if (result == FR_OK) {
return 0;
@ -457,6 +513,10 @@ short fsys_delete(const char * path) {
short fsys_rename(const char * old_path, const char * new_path) {
FRESULT fres;
// If the path being renamed is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(old_path);
fres = f_rename(old_path, new_path);
if (fres != 0) {
return fatfs_to_foenix(fres);
@ -758,6 +818,10 @@ short fsys_mount(short bdev) {
short fsys_getlabel(char * path, char * label) {
TRACE("fsys_getlabel");
// If the drive being queried is the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
fsys_update_stat(path);
FRESULT fres = f_getlabel(path, label, 0);
if (fres != FR_OK) {
return fatfs_to_foenix(fres);
@ -777,6 +841,12 @@ short fsys_setlabel(short drive, const char * label) {
FRESULT fres;
char buffer[80];
// If the drive being labeled is on the floppy drive, make sure the FDC status
// is updated correctly for disk change by spinning up the motor and checking the DIR register
if (drive == BDEV_FDC) {
sys_bdev_ioctrl(BDEV_FDC, FDC_CTRL_CHECK_CHANGE, 0, 0);
}
sprintf(buffer, "%d:%s", drive, label);
fres = f_setlabel(buffer);
if (fres != FR_OK) {
@ -1327,7 +1397,7 @@ short fsys_load(const char * path, long destination, long * start) {
strcat(spath, ".*");
// TODO: Iterate through path, and replace "".
fr = f_findfirst(&dj, &fno, "", spath); /* Start to search for executables */
fr = f_findfirst(&dj, &fno, "", spath); /* Start to search for executables */
while (fr == FR_OK && fno.fname[0]) { /* Repeat while an item is found */
get_app_ext(fno.fname, extension);
if (loader_exists(extension)) {

View file

@ -267,11 +267,11 @@ short pata_read(long lba, unsigned char * buffer, short size) {
log_num(LOG_VERBOSE, "pata_read lba: ", lba);
/* Turn on the HDD LED */
// ind_set(IND_HDC, IND_ON);
ind_set(IND_HDC, IND_ON);
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return DEV_TIMEOUT;
}
@ -279,7 +279,7 @@ short pata_read(long lba, unsigned char * buffer, short size) {
*PATA_HEAD = ((lba >> 24) & 0x07) | 0xe0; // Upper 3 bits of LBA, Drive 0, LBA mode.
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return DEV_TIMEOUT;
}
@ -295,14 +295,14 @@ short pata_read(long lba, unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return DEV_TIMEOUT;
}
if (pata_wait_data_request()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return DEV_TIMEOUT;
}
@ -313,7 +313,7 @@ short pata_read(long lba, unsigned char * buffer, short size) {
}
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return i;
}
@ -386,11 +386,11 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
TRACE("pata_write");
/* Turn on the HDD LED */
// ind_set(IND_HDC, IND_ON);
ind_set(IND_HDC, IND_ON);
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
log(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 1");
return DEV_TIMEOUT;
}
@ -399,7 +399,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
log(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 2");
return DEV_TIMEOUT;
}
@ -417,7 +417,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
log(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 3");
return DEV_TIMEOUT;
}
@ -432,7 +432,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
log(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 4");
return DEV_TIMEOUT;
}
@ -445,7 +445,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
log(LOG_ERROR, "pata_write: device fault");
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return -1;
}
@ -454,13 +454,13 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
log(LOG_ERROR, "pata_write: error");
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return -1;
}
/* Turn off the HDD LED */
// ind_set(IND_HDC, IND_OFF);
ind_set(IND_HDC, IND_OFF);
return size;
}

View file

@ -32,7 +32,8 @@ DSTATUS disk_status (
TRACE("disk_status");
return bdev_status(pdrv);
stat = bdev_status(pdrv);
return stat;
}
@ -77,8 +78,10 @@ DRESULT disk_read (
if (result < 0) {
log_num(LOG_ERROR, "disk_read error: ", result);
if (result == ERR_MEDIA_CHANGE) {
log(LOG_ERROR, "disk changed.");
return RES_NOTRDY;
} else {
log(LOG_ERROR, "gerneral error");
return RES_PARERR;
}
} else {

File diff suppressed because it is too large Load diff

21225
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@
#define __VERSION_H
#define VER_MAJOR 0
#define VER_MINOR 60
#define VER_BUILD 2
#define VER_MINOR 75
#define VER_BUILD 1
#endif