Avoid possible collision between our "log" function and the math function. Disabling all logging now seems to make the "backspace" bug disappear.

This commit is contained in:
Vincent Barrilliot 2023-11-11 14:46:32 +01:00
parent 924d7845ca
commit a3386b4e41
17 changed files with 138 additions and 149 deletions

View file

@ -396,14 +396,14 @@ void boot_from_bdev(short device) {
case 0x0000: case 0x0000:
// Boot from IDE // Boot from IDE
device = BDEV_HDC; device = BDEV_HDC;
log(LOG_INFO, "Boot DIP set for IDE"); logmsg(LOG_INFO, "Boot DIP set for IDE");
strcpy(initial_path, "/hd"); strcpy(initial_path, "/hd");
break; break;
case 0x0001: case 0x0001:
// Boot from SDC // Boot from SDC
device = BDEV_SDC; device = BDEV_SDC;
log(LOG_INFO, "Boot DIP set for SDC"); logmsg(LOG_INFO, "Boot DIP set for SDC");
strcpy(initial_path, "/sd"); strcpy(initial_path, "/sd");
break; break;
@ -411,13 +411,13 @@ void boot_from_bdev(short device) {
case 0x0002: case 0x0002:
// Boot from Floppy // Boot from Floppy
device = BDEV_FDC; device = BDEV_FDC;
log(LOG_INFO, "Boot DIP set for FDC"); logmsg(LOG_INFO, "Boot DIP set for FDC");
strcpy(initial_path, "/fd"); strcpy(initial_path, "/fd");
break; break;
#endif #endif
default: default:
// Boot straight to REPL // Boot straight to REPL
log(LOG_INFO, "Boot DIP set for REPL"); logmsg(LOG_INFO, "Boot DIP set for REPL");
strcpy(initial_path, "/sd"); strcpy(initial_path, "/sd");
device = -1; device = -1;
break; break;

View file

@ -423,9 +423,9 @@ short cmd_type(short screen, int argc, const char * argv[]) {
short n = chan_read(fd, buffer, 128); short n = chan_read(fd, buffer, 128);
log_num(LOG_INFO, "cmd_type chan_read: ", n); log_num(LOG_INFO, "cmd_type chan_read: ", n);
if (n > 0) { if (n > 0) {
log(LOG_INFO, "cmd_type chan_write: "); logmsg(LOG_INFO, "cmd_type chan_write: ");
chan_write(screen, buffer, n); chan_write(screen, buffer, n);
log(LOG_INFO, "/cmd_type chan_write: "); logmsg(LOG_INFO, "/cmd_type chan_write: ");
} else { } else {
break; break;
} }
@ -439,7 +439,7 @@ short cmd_type(short screen, int argc, const char * argv[]) {
return fd; return fd;
} }
} else { } else {
log(LOG_ERROR, "Usage: TYPE <path>"); logmsg(LOG_ERROR, "Usage: TYPE <path>");
return -1; return -1;
} }
} }
@ -460,9 +460,9 @@ short cmd_load(short screen, int argc, const char * argv[]) {
short result = fsys_load(argv[1], destination, &start); short result = fsys_load(argv[1], destination, &start);
if (result == 0) { if (result == 0) {
if (start != 0) { if (start != 0) {
log(LOG_INFO, "Loaded file with a start adddress."); logmsg(LOG_INFO, "Loaded file with a start adddress.");
} else { } else {
log(LOG_INFO, "File loaded."); logmsg(LOG_INFO, "File loaded.");
} }
} else { } else {
err_print(screen, "Unable to open file", result); err_print(screen, "Unable to open file", result);
@ -471,7 +471,7 @@ short cmd_load(short screen, int argc, const char * argv[]) {
return result; return result;
} else { } else {
log(LOG_ERROR, "Usage: LOAD <path> [<destination>]"); logmsg(LOG_ERROR, "Usage: LOAD <path> [<destination>]");
return -1; return -1;
} }
} }

View file

@ -37,13 +37,13 @@ short mem_cmd_dump(short channel, int argc, const char * argv[]) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "USAGE: DUMP <address> <count>"); logmsg(LOG_ERROR, "USAGE: DUMP <address> <count>");
return -1; return -1;
} }
} }
void test_thunk() { void test_thunk() {
log(LOG_ERROR, "CALL is working."); logmsg(LOG_ERROR, "CALL is working.");
} }
/* /*
@ -83,11 +83,11 @@ short mem_cmd_dasm(short channel, int argc, const char * argv[]) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "USAGE: DASM <address> <count>"); logmsg(LOG_ERROR, "USAGE: DASM <address> <count>");
return -1; return -1;
} }
#else #else
log(LOG_ERROR, "DASM only available on m68k machines"); logmsg(LOG_ERROR, "DASM only available on m68k machines");
return -1; return -1;
#endif #endif
@ -108,7 +108,7 @@ short mem_cmd_poke8(short channel, int argc, const char * argv[]) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "USAGE: POKE8 <address> <value>"); logmsg(LOG_ERROR, "USAGE: POKE8 <address> <value>");
return -1; return -1;
} }
} }
@ -129,7 +129,7 @@ short mem_cmd_peek8(short channel, int argc, const char * argv[]) {
return c; return c;
} else { } else {
log(LOG_ERROR, "USAGE: PEEK8 <address>"); logmsg(LOG_ERROR, "USAGE: PEEK8 <address>");
return -1; return -1;
} }
} }
@ -149,7 +149,7 @@ short mem_cmd_poke16(short channel, int argc, const char * argv[]) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "USAGE: POKE16 <address> <value>"); logmsg(LOG_ERROR, "USAGE: POKE16 <address> <value>");
return -1; return -1;
} }
} }
@ -169,7 +169,7 @@ short mem_cmd_peek16(short channel, int argc, const char * argv[]) {
return c; return c;
} else { } else {
log(LOG_ERROR, "USAGE: PEEK16 <address>"); logmsg(LOG_ERROR, "USAGE: PEEK16 <address>");
return -1; return -1;
} }
} }
@ -189,7 +189,7 @@ short mem_cmd_poke32(short channel, int argc, const char * argv[]) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "USAGE: POKE32 <address> <value>"); logmsg(LOG_ERROR, "USAGE: POKE32 <address> <value>");
return -1; return -1;
} }
} }
@ -209,7 +209,7 @@ short mem_cmd_peek32(short channel, int argc, const char * argv[]) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "USAGE: PEEK32 <address>"); logmsg(LOG_ERROR, "USAGE: PEEK32 <address>");
return -1; return -1;
} }
} }

View file

@ -350,7 +350,7 @@ short chan_write(short channel, const uint8_t * buffer, short size) {
p_channel chan; p_channel chan;
p_dev_chan cdev; p_dev_chan cdev;
short res; short res;
log(LOG_TRACE,"chan_write(%d,%p,%x)", channel, buffer, (int)size); logmsg(LOG_TRACE,"chan_write(%d,%p,%x)", channel, buffer, (int)size);
res = chan_get_records(channel, &chan, &cdev); res = chan_get_records(channel, &chan, &cdev);
if (res == 0) if (res == 0)

View file

@ -252,7 +252,7 @@ short fdc_in(unsigned char *ptr) {
long target_ticks = timers_jiffies() + fdc_timeout; long target_ticks = timers_jiffies() + fdc_timeout;
while ((*FDC_MSR & FDC_MSR_RQM) != FDC_MSR_RQM) { while ((*FDC_MSR & FDC_MSR_RQM) != FDC_MSR_RQM) {
if (timers_jiffies() >= target_ticks) { if (timers_jiffies() >= target_ticks) {
log(LOG_ERROR, "fdc_in: timeout waiting for RQM"); logmsg(LOG_ERROR, "fdc_in: timeout waiting for RQM");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
} }
@ -272,7 +272,7 @@ short fdc_out(unsigned char x) {
long target_ticks = timers_jiffies() + fdc_timeout; long target_ticks = timers_jiffies() + fdc_timeout;
while ((*FDC_MSR & FDC_MSR_RQM) != FDC_MSR_RQM) { while ((*FDC_MSR & FDC_MSR_RQM) != FDC_MSR_RQM) {
if (timers_jiffies() >= target_ticks) { if (timers_jiffies() >= target_ticks) {
log(LOG_ERROR, "fdc_out: timeout waiting for RQM"); logmsg(LOG_ERROR, "fdc_out: timeout waiting for RQM");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
} }
@ -296,7 +296,7 @@ short fdc_motor_on() {
if (fdc_wait_rqm()) { if (fdc_wait_rqm()) {
/* Got a timeout after trying to turn on the motor */ /* Got a timeout after trying to turn on the motor */
log(LOG_ERROR, "fdc_motor_on timeout"); logmsg(LOG_ERROR, "fdc_motor_on timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -384,13 +384,13 @@ short fdc_sense_interrupt_status(unsigned char *st0, unsigned char *pcn) {
if (fdc_wait_while_busy()) { if (fdc_wait_while_busy()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_while_busy timeout"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_while_busy timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for permission to write a command byte */ /* Timed out waiting for permission to write a command byte */
log(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_write timeout"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_write timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -399,13 +399,13 @@ short fdc_sense_interrupt_status(unsigned char *st0, unsigned char *pcn) {
if (fdc_wait_rqm()) { if (fdc_wait_rqm()) {
/* Timed out waiting to receive data */ /* Timed out waiting to receive data */
log(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_rqm timeout 1"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_rqm timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
if (fdc_wait_read()) { if (fdc_wait_read()) {
/* Timed out waiting to receive data */ /* Timed out waiting to receive data */
log(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_read timeout 1"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_read timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -415,13 +415,13 @@ short fdc_sense_interrupt_status(unsigned char *st0, unsigned char *pcn) {
if (fdc_wait_rqm()) { if (fdc_wait_rqm()) {
/* Timed out waiting to receive data */ /* Timed out waiting to receive data */
log(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_rqm timeout 1"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_rqm timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
if (fdc_wait_read()) { if (fdc_wait_read()) {
/* Timed out waiting for permission to transfer another byte */ /* Timed out waiting for permission to transfer another byte */
log(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_read timeout 2"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status: fdc_wait_read timeout 2");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -444,13 +444,13 @@ short fdc_specify() {
if (fdc_wait_while_busy()) { if (fdc_wait_while_busy()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_specify: fdc_wait_while_busy timeout"); logmsg(LOG_ERROR, "fdc_specify: fdc_wait_while_busy timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
if (fdc_wait_write() < 0) { if (fdc_wait_write() < 0) {
/* Timed out waiting for permission to write a command byte */ /* Timed out waiting for permission to write a command byte */
log(LOG_ERROR, "fdc_specify: fdc_wait_write timeout 1"); logmsg(LOG_ERROR, "fdc_specify: fdc_wait_write timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -459,7 +459,7 @@ short fdc_specify() {
if (fdc_wait_write() < 0) { if (fdc_wait_write() < 0) {
/* Timed out waiting for permission to write a command byte */ /* Timed out waiting for permission to write a command byte */
log(LOG_ERROR, "fdc_specify: fdc_wait_write timeout 2"); logmsg(LOG_ERROR, "fdc_specify: fdc_wait_write timeout 2");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -468,7 +468,7 @@ short fdc_specify() {
if (fdc_wait_write() < 0) { if (fdc_wait_write() < 0) {
/* Timed out waiting for permission to write a command byte */ /* Timed out waiting for permission to write a command byte */
log(LOG_ERROR, "fdc_specify: fdc_wait_write timeout 3"); logmsg(LOG_ERROR, "fdc_specify: fdc_wait_write timeout 3");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -498,13 +498,13 @@ short fdc_configure() {
if (fdc_wait_while_busy()) { if (fdc_wait_while_busy()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_configure: fdc_wait_while_busy timeout"); logmsg(LOG_ERROR, "fdc_configure: fdc_wait_while_busy timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 1"); logmsg(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -513,7 +513,7 @@ short fdc_configure() {
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 2"); logmsg(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 2");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -522,7 +522,7 @@ short fdc_configure() {
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 3"); logmsg(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 3");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -531,7 +531,7 @@ short fdc_configure() {
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 4"); logmsg(LOG_ERROR, "fdc_configure: fdc_wait_write timeout 4");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -555,13 +555,13 @@ short fdc_version(unsigned char *version) {
if (fdc_wait_while_busy()) { if (fdc_wait_while_busy()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_version: fdc_wait_while_busy timeout"); logmsg(LOG_ERROR, "fdc_version: fdc_wait_while_busy timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_version: fdc_wait_write timeout 1"); logmsg(LOG_ERROR, "fdc_version: fdc_wait_write timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -570,7 +570,7 @@ short fdc_version(unsigned char *version) {
if (fdc_wait_write()) { if (fdc_wait_write()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_version: fdc_wait_write timeout 2"); logmsg(LOG_ERROR, "fdc_version: fdc_wait_write timeout 2");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -621,7 +621,7 @@ short fdc_reset() {
pcn = 0; pcn = 0;
if (fdc_sense_interrupt_status(&st0, &pcn) < 0) { if (fdc_sense_interrupt_status(&st0, &pcn) < 0) {
/* Time out on sense interrupt */ /* Time out on sense interrupt */
log(LOG_ERROR, "fdc_sense_interrupt_status timeout"); logmsg(LOG_ERROR, "fdc_sense_interrupt_status timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -636,14 +636,14 @@ short fdc_reset() {
/* Configure the FDC */ /* Configure the FDC */
if (fdc_configure() < 0) { if (fdc_configure() < 0) {
/* Timeout on sense interrupt */ /* Timeout on sense interrupt */
log(LOG_ERROR, "fdc_configure timeout"); logmsg(LOG_ERROR, "fdc_configure timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
/* Specify seek and head times, and turn off DMA */ /* Specify seek and head times, and turn off DMA */
if (fdc_specify() < 0) { if (fdc_specify() < 0) {
/* Timeout on sense interrupt */ /* Timeout on sense interrupt */
log(LOG_ERROR, "fdc_specify timeout"); logmsg(LOG_ERROR, "fdc_specify timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -698,19 +698,19 @@ short fdc_command_dma(p_fdc_trans transaction) {
if (fdc_wait_while_busy()) { if (fdc_wait_while_busy()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_command: fdc_wait_while_busy timeout"); logmsg(LOG_ERROR, "fdc_command: fdc_wait_while_busy timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
result = fdc_out(transaction->command); /* Send the command byte */ result = fdc_out(transaction->command); /* Send the command byte */
if (result < 0) { if (result < 0) {
log(LOG_ERROR, "fdc_command: timeout sending command"); logmsg(LOG_ERROR, "fdc_command: timeout sending command");
return result; return result;
} }
for (i = 0; i < transaction->parameter_count; i++) { for (i = 0; i < transaction->parameter_count; i++) {
if ((result = fdc_out(transaction->parameters[i])) < 0) { if ((result = fdc_out(transaction->parameters[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout sending parameters"); logmsg(LOG_ERROR, "fdc_command: timeout sending parameters");
return result; return result;
} }
} }
@ -749,7 +749,7 @@ short fdc_command_dma(p_fdc_trans transaction) {
for (i = 0; i < transaction->result_count; i++) { for (i = 0; i < transaction->result_count; i++) {
if ((result = fdc_in(&transaction->results[i])) < 0) { if ((result = fdc_in(&transaction->results[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout getting results"); logmsg(LOG_ERROR, "fdc_command: timeout getting results");
return result; return result;
} }
} }
@ -788,19 +788,19 @@ short fdc_command(p_fdc_trans transaction) {
if (fdc_wait_while_busy()) { if (fdc_wait_while_busy()) {
/* Timed out waiting for the FDC to be free */ /* Timed out waiting for the FDC to be free */
log(LOG_ERROR, "fdc_command: fdc_wait_while_busy timeout"); logmsg(LOG_ERROR, "fdc_command: fdc_wait_while_busy timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
result = fdc_out(transaction->command); /* Send the command byte */ result = fdc_out(transaction->command); /* Send the command byte */
if (result < 0) { if (result < 0) {
log(LOG_ERROR, "fdc_command: timeout sending command"); logmsg(LOG_ERROR, "fdc_command: timeout sending command");
return result; return result;
} }
for (i = 0; i < transaction->parameter_count; i++) { for (i = 0; i < transaction->parameter_count; i++) {
if ((result = fdc_out(transaction->parameters[i])) < 0) { if ((result = fdc_out(transaction->parameters[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout sending parameters"); logmsg(LOG_ERROR, "fdc_command: timeout sending parameters");
return result; return result;
} }
} }
@ -815,7 +815,7 @@ short fdc_command(p_fdc_trans transaction) {
if (*FDC_MSR & FDC_MSR_NONDMA) { if (*FDC_MSR & FDC_MSR_NONDMA) {
for (i = 0; (i < transaction->data_count); i++) { for (i = 0; (i < transaction->data_count); i++) {
if ((result = fdc_out(transaction->data[i])) < 0) { if ((result = fdc_out(transaction->data[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout writing data"); logmsg(LOG_ERROR, "fdc_command: timeout writing data");
return result; return result;
} }
} }
@ -826,7 +826,7 @@ short fdc_command(p_fdc_trans transaction) {
/* We're reading from the FDC */ /* We're reading from the FDC */
for (i = 0; (i < transaction->data_count); i++) { for (i = 0; (i < transaction->data_count); i++) {
if ((result = fdc_in(&transaction->data[i])) < 0) { if ((result = fdc_in(&transaction->data[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout getting data"); logmsg(LOG_ERROR, "fdc_command: timeout getting data");
return result; return result;
} }
} }
@ -842,7 +842,7 @@ short fdc_command(p_fdc_trans transaction) {
for (i = 0; i < transaction->result_count; i++) { for (i = 0; i < transaction->result_count; i++) {
if ((result = fdc_in(&transaction->results[i])) < 0) { if ((result = fdc_in(&transaction->results[i])) < 0) {
log(LOG_ERROR, "fdc_command: timeout getting results"); logmsg(LOG_ERROR, "fdc_command: timeout getting results");
return result; return result;
} }
} }
@ -1067,12 +1067,12 @@ short fdc_read(long lba, unsigned char * buffer, short size) {
if ((result == 0)) { //} && ((trans.results[0] & 0xC0) == 0)) { 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", 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]); trans.results[0], trans.results[1], trans.results[2], trans.results[3], trans.results[4], trans.results[5], trans.results[6]);
log(LOG_INFO, message); logmsg(LOG_INFO, message);
return size; return size;
} else { } else {
sprintf(message, "fdc_read: retry ST0=%02X ST1=%02X ST2=%02X C=%02X H=%02X R=%02X N=%02X", 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]); 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); logmsg(LOG_ERROR, message);
} }
fdc_init(); fdc_init();
trans.retries--; trans.retries--;
@ -1135,7 +1135,7 @@ short fdc_write(long lba, const unsigned char * buffer, short size) {
} }
if ((trans.results[1] & 0x02) != 0) { if ((trans.results[1] & 0x02) != 0) {
log(LOG_ERROR, "Disk is write protected"); logmsg(LOG_ERROR, "Disk is write protected");
g_fdc_stat |= FDC_STAT_PROTECTED; g_fdc_stat |= FDC_STAT_PROTECTED;
return DEV_WRITEPROT; return DEV_WRITEPROT;
} }
@ -1143,12 +1143,12 @@ short fdc_write(long lba, const unsigned char * buffer, short size) {
if ((result == 0)) { //} && ((trans.results[0] & 0xC0) == 0)) { 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", 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]); trans.results[0], trans.results[1], trans.results[2], trans.results[3], trans.results[4], trans.results[5], trans.results[6]);
log(LOG_INFO, message); logmsg(LOG_INFO, message);
return size; return size;
} else { } else {
sprintf(message, "fdc_write: retry ST0=%02X ST1=%02X ST2=%02X C=%02X H=%02X R=%02X N=%02X", 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]); 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); logmsg(LOG_ERROR, message);
} }
fdc_init(); fdc_init();
trans.retries--; trans.retries--;
@ -1228,13 +1228,13 @@ short fdc_ioctrl(short command, unsigned char * buffer, short size) {
*/ */
short fdc_init() { short fdc_init() {
if (fdc_reset() < 0) { if (fdc_reset() < 0) {
log(LOG_ERROR, "Unable to reset the FDC"); logmsg(LOG_ERROR, "Unable to reset the FDC");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
// Recalibrate the drive // Recalibrate the drive
if (fdc_recalibrate()) { if (fdc_recalibrate()) {
log(LOG_ERROR, "Unable to recalibrate the drive"); logmsg(LOG_ERROR, "Unable to recalibrate the drive");
return ERR_GENERAL; return ERR_GENERAL;
} }

View file

@ -615,7 +615,7 @@ short fchan_read(t_channel * chan, unsigned char * buffer, short size) {
FRESULT result; FRESULT result;
int total_read; int total_read;
log(LOG_TRACE, "fchan_read"); logmsg(LOG_TRACE, "fchan_read");
file = fchan_to_file(chan); file = fchan_to_file(chan);
if (file) { if (file) {
@ -660,7 +660,7 @@ short fchan_read_b(t_channel * chan) {
short total_read; short total_read;
char buffer[2]; char buffer[2];
log(LOG_TRACE, "fchan_read_b"); logmsg(LOG_TRACE, "fchan_read_b");
file = fchan_to_file(chan); file = fchan_to_file(chan);
if (file) { if (file) {
@ -1339,11 +1339,11 @@ static short fsys_load_ext(const char * path, const char * extension, long desti
if (loader == 0) { if (loader == 0) {
if (destination != 0) { if (destination != 0) {
/* If a destination was specified, just load it into memory without interpretation */ /* If a destination was specified, just load it into memory without interpretation */
log(LOG_DEBUG, "Setting default loader."); logmsg(LOG_DEBUG, "Setting default loader.");
loader = fsys_default_loader; loader = fsys_default_loader;
} else { } else {
log(LOG_DEBUG, "Returning a bad extension."); logmsg(LOG_DEBUG, "Returning a bad extension.");
/* Return bad extension */ /* Return bad extension */
return ERR_BAD_EXTENSION; return ERR_BAD_EXTENSION;
} }
@ -1443,7 +1443,7 @@ short fsys_load(const char * path, long destination, long * start) {
// Found path with valid loader // Found path with valid loader
fsys_load_ext(spath, extension, destination, start); fsys_load_ext(spath, extension, destination, start);
} else { } else {
log(LOG_ERROR, "Command not found."); logmsg(LOG_ERROR, "Command not found.");
return ERR_NOT_FOUND; return ERR_NOT_FOUND;
} }
} }

View file

@ -51,7 +51,7 @@ short pata_wait_not_busy() {
} while ((status & PATA_STAT_BSY) && (target_ticks > ticks)); } while ((status & PATA_STAT_BSY) && (target_ticks > ticks));
if (target_ticks <= ticks) { if (target_ticks <= ticks) {
log(LOG_ERROR, "pata_wait_not_busy: timeout"); logmsg(LOG_ERROR, "pata_wait_not_busy: timeout");
log_num(LOG_ERROR, "target_ticks: ", (int)target_ticks); log_num(LOG_ERROR, "target_ticks: ", (int)target_ticks);
log_num(LOG_ERROR, "ticks: ", (int)ticks); log_num(LOG_ERROR, "ticks: ", (int)ticks);
return DEV_TIMEOUT; return DEV_TIMEOUT;
@ -80,7 +80,7 @@ short pata_wait_ready() {
} while (((status & PATA_STAT_DRDY) == 0) && (target_ticks > ticks)); } while (((status & PATA_STAT_DRDY) == 0) && (target_ticks > ticks));
if (target_ticks <= ticks) { if (target_ticks <= ticks) {
log(LOG_ERROR, "pata_wait_ready: timeout"); logmsg(LOG_ERROR, "pata_wait_ready: timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} else { } else {
return 0; return 0;
@ -112,7 +112,7 @@ short pata_wait_ready_not_busy() {
} while (((*PATA_CMD_STAT & PATA_STAT_BSY) == PATA_STAT_BSY) && (target_ticks > ticks)); } while (((*PATA_CMD_STAT & PATA_STAT_BSY) == PATA_STAT_BSY) && (target_ticks > ticks));
if (target_ticks <= ticks) { if (target_ticks <= ticks) {
log(LOG_ERROR, "pata_wait_ready_not_busy: timeout"); logmsg(LOG_ERROR, "pata_wait_ready_not_busy: timeout");
log_num(LOG_ERROR, "target_ticks: ", (int)target_ticks); log_num(LOG_ERROR, "target_ticks: ", (int)target_ticks);
log_num(LOG_ERROR, "ticks: ", (int)ticks); log_num(LOG_ERROR, "ticks: ", (int)ticks);
@ -142,7 +142,7 @@ short pata_wait_data_request() {
} while (((status & PATA_STAT_DRQ) != PATA_STAT_DRQ) && (target_ticks > ticks)); } while (((status & PATA_STAT_DRQ) != PATA_STAT_DRQ) && (target_ticks > ticks));
if (target_ticks <= ticks) { if (target_ticks <= ticks) {
log(LOG_ERROR, "pata_wait_data_request: timeout"); logmsg(LOG_ERROR, "pata_wait_data_request: timeout");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} else { } else {
return 0; return 0;
@ -354,12 +354,12 @@ short pata_flush_cache() {
status = *PATA_CMD_STAT; status = *PATA_CMD_STAT;
if ((status & PATA_STAT_DF) != 0){ if ((status & PATA_STAT_DF) != 0){
log(LOG_ERROR, "pata_flush_cache: device fault"); logmsg(LOG_ERROR, "pata_flush_cache: device fault");
return -1; return -1;
} }
if ((status & PATA_STAT_ERR) != 0) { if ((status & PATA_STAT_ERR) != 0) {
log(LOG_ERROR, "pata_flush_cache: error"); logmsg(LOG_ERROR, "pata_flush_cache: error");
return -1; return -1;
} }
@ -390,7 +390,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) { if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */ /* 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"); logmsg(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 1");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -399,7 +399,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) { if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */ /* 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"); logmsg(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 2");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -417,7 +417,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) { if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */ /* 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"); logmsg(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 3");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -432,7 +432,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
if (pata_wait_ready_not_busy()) { if (pata_wait_ready_not_busy()) {
/* Turn off the HDD LED */ /* 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"); logmsg(LOG_ERROR, "pata_write: pata_wait_ready_not_busy timeout 4");
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }
@ -441,7 +441,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
status = *PATA_CMD_STAT; status = *PATA_CMD_STAT;
if ((status & PATA_STAT_DF) != 0){ if ((status & PATA_STAT_DF) != 0){
log(LOG_ERROR, "pata_write: device fault"); logmsg(LOG_ERROR, "pata_write: device fault");
/* Turn off the HDD LED */ /* Turn off the HDD LED */
ind_set(IND_HDC, IND_OFF); ind_set(IND_HDC, IND_OFF);
@ -450,7 +450,7 @@ short pata_write(long lba, const unsigned char * buffer, short size) {
} }
if ((status & PATA_STAT_ERR) != 0) { if ((status & PATA_STAT_ERR) != 0) {
log(LOG_ERROR, "pata_write: error"); logmsg(LOG_ERROR, "pata_write: error");
/* Turn off the HDD LED */ /* Turn off the HDD LED */
ind_set(IND_HDC, IND_OFF); ind_set(IND_HDC, IND_OFF);

View file

@ -335,7 +335,7 @@ const char g_us_sc_alt_shift[] = {
short ps2_wait_out() { short ps2_wait_out() {
long target_ticks; long target_ticks;
// log(LOG_TRACE, "ps2_wait_out"); // logmsg(LOG_TRACE, "ps2_wait_out");
target_ticks = rtc_get_jiffies() + PS2_TIMEOUT_JF; target_ticks = rtc_get_jiffies() + PS2_TIMEOUT_JF;
while ((*PS2_STATUS & PS2_STAT_OBF) == 0) { while ((*PS2_STATUS & PS2_STAT_OBF) == 0) {
@ -356,7 +356,7 @@ short ps2_wait_out() {
short ps2_wait_in() { short ps2_wait_in() {
long target_ticks; long target_ticks;
// log(LOG_TRACE, "ps2_wait_in"); // logmsg(LOG_TRACE, "ps2_wait_in");
target_ticks = rtc_get_jiffies() + PS2_TIMEOUT_JF; target_ticks = rtc_get_jiffies() + PS2_TIMEOUT_JF;
while ((*PS2_STATUS & PS2_STAT_IBF) != 0) { while ((*PS2_STATUS & PS2_STAT_IBF) != 0) {

View file

@ -138,7 +138,7 @@ void rtc_set_time(p_time time) {
/* Temporarily disable updates to the clock */ /* Temporarily disable updates to the clock */
ctrl = *RTC_CTRL; ctrl = *RTC_CTRL;
*RTC_CTRL = ctrl | RTC_UTI; *RTC_CTRL = ctrl | RTC_UTI;
log(LOG_INFO, "RTC Disabled"); logmsg(LOG_INFO, "RTC Disabled");
log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES); log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES);
log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES); log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES);
log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS); log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS);
@ -178,7 +178,7 @@ void rtc_set_time(p_time time) {
/* Re-enable updates to the clock */ /* Re-enable updates to the clock */
*RTC_CTRL = (ctrl & 0x07) | RTC_STOP; *RTC_CTRL = (ctrl & 0x07) | RTC_STOP;
log(LOG_INFO, "RTC Enabled"); logmsg(LOG_INFO, "RTC Enabled");
log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES); log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES);
log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES); log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES);
log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS); log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS);
@ -199,7 +199,7 @@ void rtc_get_time(p_time time) {
/* Temporarily disable updates to the clock */ /* Temporarily disable updates to the clock */
ctrl = *RTC_CTRL; ctrl = *RTC_CTRL;
*RTC_CTRL = ctrl | RTC_UTI; *RTC_CTRL = ctrl | RTC_UTI;
log(LOG_INFO, "RTC Disabled"); logmsg(LOG_INFO, "RTC Disabled");
log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES); log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES);
log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES); log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES);
log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS); log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS);
@ -221,7 +221,7 @@ void rtc_get_time(p_time time) {
/* Re-enable updates to the clock */ /* Re-enable updates to the clock */
*RTC_CTRL = (ctrl & 0x07) | RTC_STOP; *RTC_CTRL = (ctrl & 0x07) | RTC_STOP;
log(LOG_INFO, "RTC Enabled"); logmsg(LOG_INFO, "RTC Enabled");
log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES); log_num(LOG_INFO, "RTC Rates: ", *RTC_RATES);
log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES); log_num(LOG_INFO, "RTC Enables: ", *RTC_ENABLES);
log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS); log_num(LOG_INFO, "RTC Flags: ", *RTC_FLAGS);

View file

@ -121,18 +121,18 @@ short sdc_init() {
if (sdc_wait_busy() == 0) { // Wait for it to complete if (sdc_wait_busy() == 0) { // Wait for it to complete
g_sdc_error = *SDC_TRANS_ERROR_REG; // Check for any error condition g_sdc_error = *SDC_TRANS_ERROR_REG; // Check for any error condition
if (g_sdc_error == 0) { if (g_sdc_error == 0) {
log(LOG_INFO, "sdc_init: SUCCESS"); logmsg(LOG_INFO, "sdc_init: SUCCESS");
g_sdc_status = 0; // Flag that the SD has been initialized g_sdc_status = 0; // Flag that the SD has been initialized
return 0; return 0;
} else { } else {
log(LOG_ERROR, "sdc_init: DEV_CANNOT_INIT"); logmsg(LOG_ERROR, "sdc_init: DEV_CANNOT_INIT");
g_sdc_status = SDC_STAT_NOINIT; g_sdc_status = SDC_STAT_NOINIT;
return DEV_CANNOT_INIT; return DEV_CANNOT_INIT;
} }
} else { } else {
log(LOG_ERROR, "sdc_init: DEV_TIMEOUT"); logmsg(LOG_ERROR, "sdc_init: DEV_TIMEOUT");
g_sdc_status = SDC_STAT_NOINIT; g_sdc_status = SDC_STAT_NOINIT;
return DEV_TIMEOUT; return DEV_TIMEOUT;
} }

View file

@ -172,11 +172,7 @@ static short txt_a2560u_set_resolution(short width, short height) {
} }
} }
{ DEBUG2("Setting resolution %dx%d", width, height);
char msg[80];
sprintf(msg, "Setting resolution %dx%d", width, height);
DEBUG(msg);
}
/* Turn off resolution bits */ /* Turn off resolution bits */
/* TODO: there gotta be a better way to do that */ /* TODO: there gotta be a better way to do that */
@ -239,7 +235,7 @@ static void txt_a2560u_set_border(short width, short height) {
} }
// Recalculate the size of the screen // Recalculate the size of the screen
txt_a2560u_set_sizes(); txt_a2560u_set_sizes();
} }
/** /**
@ -321,11 +317,7 @@ static short txt_a2560u_get_region(p_rect region) {
region->size.width = a2560u_region.size.width; region->size.width = a2560u_region.size.width;
region->size.height = a2560u_region.size.height; region->size.height = a2560u_region.size.height;
{ DEBUG5("txt_a2560u_get_region %p: x:%d, y:%d, w:%d, h:%d", region, region->origin.x, region->origin.y, region->size.width, region->size.height);
char msg[80];
sprintf(msg,"txt_a2560u_get_region %p: x:%d, y:%d, w:%d, h:%d", region, region->origin.x, region->origin.y, region->size.width, region->size.height);
DEBUG(msg);
}
return 0; return 0;
} }
@ -339,10 +331,7 @@ static short txt_a2560u_get_region(p_rect region) {
* @return 0 on success, any other number means the region was invalid * @return 0 on success, any other number means the region was invalid
*/ */
static short txt_a2560u_set_region(const p_rect region) { static short txt_a2560u_set_region(const p_rect region) {
char msg[80]; DEBUG7("SET REGION %p x:%d, y:%d, w:%d, h:%d (visible:%d,%d)", region, region->origin.x, region->origin.y, region->size.width, region->size.height, a2560u_visible_size.width, a2560u_visible_size.height);
sprintf(msg,"SET REGION %p x:%d, y:%d, w:%d, h:%d (visible:%d,%d)",
region, region->origin.x, region->origin.y, region->size.width, region->size.height, a2560u_visible_size.width, a2560u_visible_size.height);
DEBUG(msg);
if ((region->size.width == 0) || (region->size.height == 0)) { if ((region->size.width == 0) || (region->size.height == 0)) {
/* Set the region to the default (full screen) */ /* Set the region to the default (full screen) */
@ -360,11 +349,7 @@ static short txt_a2560u_set_region(const p_rect region) {
//DEBUG(msg); //DEBUG(msg);
} }
{ DEBUG7("txt_a2560u_set_region: NEW REGION %p x:%d, y:%d, w:%d, h:%d (visible:%d,%d)", region, region->origin.x, region->origin.y, region->size.width, region->size.height, a2560u_visible_size.width, a2560u_visible_size.height);
sprintf(msg,"txt_a2560u_set_region: NEW REGION %p x:%d, y:%d, w:%d, h:%d (visible:%d,%d)",
region, region->origin.x, region->origin.y, region->size.width, region->size.height, a2560u_visible_size.width, a2560u_visible_size.height);
//DEBUG(msg);
}
return 0; return 0;
} }

View file

@ -297,7 +297,7 @@ short uart_open(p_channel chan, const char * spec, short mode) {
break; break;
default: default:
log(LOG_ERROR, "uart_open: Bad data word length"); logmsg(LOG_ERROR, "uart_open: Bad data word length");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
@ -311,7 +311,7 @@ short uart_open(p_channel chan, const char * spec, short mode) {
} else if (i == 2) { } else if (i == 2) {
lcr_code |= LCR_STOPBIT_2; lcr_code |= LCR_STOPBIT_2;
} else { } else {
log(LOG_ERROR, "uart_open: Bad stop bits"); logmsg(LOG_ERROR, "uart_open: Bad stop bits");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
@ -330,7 +330,7 @@ short uart_open(p_channel chan, const char * spec, short mode) {
} else if (strcmp(token, "SPACE") == 0) { } else if (strcmp(token, "SPACE") == 0) {
lcr_code |= LCR_PARITY_SPACE; lcr_code |= LCR_PARITY_SPACE;
} else { } else {
log(LOG_ERROR, "uart_open: Bad parity"); logmsg(LOG_ERROR, "uart_open: Bad parity");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
@ -339,19 +339,19 @@ short uart_open(p_channel chan, const char * spec, short mode) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "uart_open: no parity token"); logmsg(LOG_ERROR, "uart_open: no parity token");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
} else { } else {
log(LOG_ERROR, "uart_open: no stop bit token"); logmsg(LOG_ERROR, "uart_open: no stop bit token");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
} else { } else {
log(LOG_ERROR, "uart_open: no data length token"); logmsg(LOG_ERROR, "uart_open: no data length token");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
} else { } else {
log(LOG_ERROR, "uart_open: no BPS token"); logmsg(LOG_ERROR, "uart_open: no BPS token");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }

View file

@ -78,10 +78,10 @@ DRESULT disk_read (
if (result < 0) { if (result < 0) {
log_num(LOG_ERROR, "disk_read error: ", result); log_num(LOG_ERROR, "disk_read error: ", result);
if (result == ERR_MEDIA_CHANGE) { if (result == ERR_MEDIA_CHANGE) {
log(LOG_ERROR, "disk changed."); logmsg(LOG_ERROR, "disk changed.");
return RES_NOTRDY; return RES_NOTRDY;
} else { } else {
log(LOG_ERROR, "gerneral error"); logmsg(LOG_ERROR, "gerneral error");
return RES_PARERR; return RES_PARERR;
} }
} else { } else {

View file

@ -460,14 +460,14 @@ void initialize() {
if ((res = ps2_init())) { if ((res = ps2_init())) {
print_error(0, "FAILED: PS/2 keyboard initialization", res); print_error(0, "FAILED: PS/2 keyboard initialization", res);
} else { } else {
log(LOG_INFO, "PS/2 keyboard initialized."); logmsg(LOG_INFO, "PS/2 keyboard initialized.");
} }
#if MODEL == MODEL_FOENIX_A2560K #if MODEL == MODEL_FOENIX_A2560K
if ((res = kbdmo_init())) { if ((res = kbdmo_init())) {
log_num(LOG_ERROR, "FAILED: A2560K built-in keyboard initialization", res); log_num(LOG_ERROR, "FAILED: A2560K built-in keyboard initialization", res);
} else { } else {
log(LOG_INFO, "A2560K built-in keyboard initialized."); logmsg(LOG_INFO, "A2560K built-in keyboard initialized.");
} }
#endif #endif
@ -475,7 +475,7 @@ void initialize() {
if ((res = lpt_install())) { if ((res = lpt_install())) {
log_num(LOG_ERROR, "FAILED: LPT installation", res); log_num(LOG_ERROR, "FAILED: LPT installation", res);
} else { } else {
log(LOG_INFO, "LPT installed."); logmsg(LOG_INFO, "LPT installed.");
} }
#endif #endif
@ -483,14 +483,14 @@ void initialize() {
if ((res = midi_install())) { if ((res = midi_install())) {
log_num(LOG_ERROR, "FAILED: MIDI installation", res); log_num(LOG_ERROR, "FAILED: MIDI installation", res);
} else { } else {
log(LOG_INFO, "MIDI installed."); logmsg(LOG_INFO, "MIDI installed.");
} }
#endif #endif
if (res = uart_install()) { if (res = uart_install()) {
log_num(LOG_ERROR, "FAILED: serial port initialization", res); log_num(LOG_ERROR, "FAILED: serial port initialization", res);
} else { } else {
log(LOG_INFO, "Serial ports initialized."); logmsg(LOG_INFO, "Serial ports initialized.");
} }
if (res = cli_init()) { if (res = cli_init()) {
@ -525,7 +525,7 @@ TRACE1("Booting from device %d",boot_dev);
// Start the boot process // Start the boot process
boot_from_bdev(boot_dev); boot_from_bdev(boot_dev);
log(LOG_INFO, "Stopping."); logmsg(LOG_INFO, "Stopping.");
#elif MODEL == MODEL_FOENIX_C256U || MODEL == MODEL_FOENIX_C256U_PLUS || MODEL == MODEL_FOENIX_FMX #elif MODEL == MODEL_FOENIX_C256U || MODEL == MODEL_FOENIX_C256U_PLUS || MODEL == MODEL_FOENIX_FMX
printf("\n\nSDC directory:\n"); printf("\n\nSDC directory:\n");
int directory = fsys_opendir("/sd/"); int directory = fsys_opendir("/sd/");

View file

@ -290,7 +290,7 @@ static void log_to_channel_A_low_level(const char *message) {
* Caveat: * Caveat:
* The total length should not exceed 512 chars. * The total length should not exceed 512 chars.
*/ */
void log(short level, const char * message, ...) { void logmsg(short level, const char * message, ...) {
if (level > log_level) if (level > log_level)
return; return;
@ -330,7 +330,7 @@ void log2(short level, const char * message1, const char * message2) {
if (level <= log_level) { if (level <= log_level) {
char line[80]; char line[80];
sprintf(line, "%s%s\n", message1, message2); sprintf(line, "%s%s\n", message1, message2);
log(level, line); logmsg(level, line);
} }
} }
@ -347,7 +347,7 @@ void log3(short level, const char * message1, const char * message2, const char
if (level <= log_level) { if (level <= log_level) {
char line[80]; char line[80];
sprintf(line, "%s%s%s\n", message1, message2, message3); sprintf(line, "%s%s%s\n", message1, message2, message3);
log(level, line); logmsg(level, line);
} }
} }
@ -364,7 +364,7 @@ void log_num(short level, char * message, int n) {
if (level <= log_level) { if (level <= log_level) {
sprintf(line, "%s%08X", message, n); sprintf(line, "%s%08X", message, n);
log(level, line); logmsg(level, line);
} }
} }
@ -375,5 +375,5 @@ void log_c(short level, char c) {
char line[2]; char line[2];
line[0] = c; line[0] = c;
line[1] = '\0'; line[1] = '\0';
log(level, line); logmsg(level, line);
} }

View file

@ -80,7 +80,7 @@ extern void log_setlevel(short level);
* level = the severity of the message... the logging level will filter messages displayed * level = the severity of the message... the logging level will filter messages displayed
* message = the message to log * message = the message to log
*/ */
extern void log(short level, const char * message, ...); extern void logmsg(short level, const char * message, ...);
extern void trace(const char * message, ...); extern void trace(const char * message, ...);
/* /*
* Log a message to the console * Log a message to the console
@ -123,12 +123,12 @@ extern void log_c(short log_level, char c);
*/ */
#if DEFAULT_LOG_LEVEL >= LOG_ERROR #if DEFAULT_LOG_LEVEL >= LOG_ERROR
# define ERROR(m) log(LOG_ERROR, m) # define ERROR(m) logmsg(LOG_ERROR, m)
# define ERROR1(a,b) log(LOG_ERROR, a, b) # define ERROR1(a,b) logmsg(LOG_ERROR, a, b)
# define ERROR2(a,b,c) log(LOG_ERROR, a, b, c) # define ERROR2(a,b,c) logmsg(LOG_ERROR, a, b, c)
# define ERROR3(a,b,c,d) log(LOG_ERROR, a, b, c, d) # define ERROR3(a,b,c,d) logmsg(LOG_ERROR, a, b, c, d)
# define ERROR4(a,b,c,d,e) log(LOG_ERROR, a, b, c, d, e) # define ERROR4(a,b,c,d,e) logmsg(LOG_ERROR, a, b, c, d, e)
# define ERROR5(a,b,c,d,e,f) log(LOG_ERROR, a, b, c, d, e, f) # define ERROR5(a,b,c,d,e,f) logmsg(LOG_ERROR, a, b, c, d, e, f)
#else #else
# define ERROR(m) # define ERROR(m)
# define ERROR1(a,b) # define ERROR1(a,b)
@ -140,12 +140,12 @@ extern void log_c(short log_level, char c);
#if DEFAULT_LOG_LEVEL >= LOG_INFO #if DEFAULT_LOG_LEVEL >= LOG_INFO
# define INFO(m) log(LOG_INFO, m); # define INFO(m) logmsg(LOG_INFO, m);
# define INFO1(a,b) log(LOG_INFO, a, b); # define INFO1(a,b) logmsg(LOG_INFO, a, b);
# define INFO2(a,b,c) log(LOG_INFO, a, b, c); # define INFO2(a,b,c) logmsg(LOG_INFO, a, b, c);
# define INFO3(a,b,c,d) log(LOG_INFO, a, b, c, d); # define INFO3(a,b,c,d) logmsg(LOG_INFO, a, b, c, d);
# define INFO4(a,b,c,d,e) log(LOG_INFO, a, b, c, d, e); # define INFO4(a,b,c,d,e) logmsg(LOG_INFO, a, b, c, d, e);
# define INFO5(a,b,c,d,e,f) log(LOG_INFO, a, b, c, d, e, f); # define INFO5(a,b,c,d,e,f) logmsg(LOG_INFO, a, b, c, d, e, f);
#else #else
# define INFO(m) # define INFO(m)
# define INFO1(a,b) # define INFO1(a,b)
@ -156,12 +156,14 @@ extern void log_c(short log_level, char c);
#endif #endif
#if DEFAULT_LOG_LEVEL >= LOG_DEBUG #if DEFAULT_LOG_LEVEL >= LOG_DEBUG
# define DEBUG(m) log(LOG_DEBUG, m) # define DEBUG(m) logmsg(LOG_DEBUG, m)
# define DEBUG1(a,b) log(LOG_DEBUG, a, b) # define DEBUG1(a,b) logmsg(LOG_DEBUG, a, b)
# define DEBUG2(a,b,c) log(LOG_DEBUG, a, b, c) # define DEBUG2(a,b,c) logmsg(LOG_DEBUG, a, b, c)
# define DEBUG3(a,b,c,d) log(LOG_DEBUG, a, b, c, d) # define DEBUG3(a,b,c,d) logmsg(LOG_DEBUG, a, b, c, d)
# define DEBUG4(a,b,c,d,e) log(LOG_DEBUG, a, b, c, d, e) # define DEBUG4(a,b,c,d,e) logmsg(LOG_DEBUG, a, b, c, d, e)
# define DEBUG5(a,b,c,d,e,f) log(LOG_DEBUG, a, b, c, d, e, f) # define DEBUG5(a,b,c,d,e,f) logmsg(LOG_DEBUG, a, b, c, d, e, f)
# define DEBUG6(a,b,c,d,e,f,g) logmsg(LOG_DEBUG, a, b, c, d, e, f, g)
# define DEBUG7(a,b,c,d,e,f,g,h) logmsg(LOG_DEBUG, a, b, c, d, e, f, g, h)
#else #else
# define DEBUG(m) # define DEBUG(m)
# define DEBUG1(a,b) # define DEBUG1(a,b)
@ -169,6 +171,8 @@ extern void log_c(short log_level, char c);
# define DEBUG3(a,b,c,d) # define DEBUG3(a,b,c,d)
# define DEBUG4(a,b,c,d,e) # define DEBUG4(a,b,c,d,e)
# define DEBUG5(a,b,c,d,e,f) # define DEBUG5(a,b,c,d,e,f)
# define DEBUG6(a,b,c,d,e,f,g)
# define DEBUG7(a,b,c,d,e,f,g,h)
#endif #endif
#if DEFAULT_LOG_LEVEL >= LOG_TRACE #if DEFAULT_LOG_LEVEL >= LOG_TRACE

View file

@ -37,8 +37,8 @@ extern void call_user(long start, long stack, int argc, char * argv[]);
void proc_exec(long start, long stack, int argc, char * argv[]) { void proc_exec(long start, long stack, int argc, char * argv[]) {
TRACE("proc_exec"); TRACE("proc_exec");
log_num(LOG_INFO, "proc_exec start: ", start); INFO1(LOG_INFO, "proc_exec start: %d");
log_num(LOG_INFO, "proc_exec stack: ", stack); INFO1(LOG_INFO, "proc_exec stack: %d");
g_proc_result = 0; g_proc_result = 0;
call_user(start, stack, argc, argv); call_user(start, stack, argc, argv);