various logging cleanups

- remove all the INFOx, ERRORn, etc style faux-variadic logging macros
  and replace with real variadic macro equivalents
- switch all direct usages of trace(), log2(), log3() and log_num() to
  use the equivalent logging macros instead. i guess that these logging
  macros were added later on at some point but not all code was switched
  over to use them at that time?
- remove trace(), log2(), log3() and lognum() functions
- some formatting cleanups
- rename log() to log_msg() so as to not ever risk conflicting with
  log() from math.h
- use snprintf() instead of sprintf() in log.c
This commit is contained in:
Gered 2025-02-09 18:11:09 -05:00
parent 44bf82cfb1
commit 6fddecb577
19 changed files with 216 additions and 352 deletions

View file

@ -34,7 +34,7 @@ void bdev_init_system() {
SYSTEMCALL short bdev_register(p_dev_block device) { SYSTEMCALL short bdev_register(p_dev_block device) {
short dev; short dev;
TRACE1("bdev_register(%s)", device->name); TRACE("bdev_register(%s)", device->name);
dev = device->number; dev = device->number;
if (dev < BDEV_DEVICES_MAX) { if (dev < BDEV_DEVICES_MAX) {
@ -68,7 +68,7 @@ SYSTEMCALL short bdev_register(p_dev_block device) {
// 0 on success, any negative number is an error code // 0 on success, any negative number is an error code
// //
short bdev_init(short dev) { short bdev_init(short dev) {
TRACE1("bdev_init(%d)", (int)dev); TRACE("bdev_init(%d)", (int)dev);
short ret = DEV_ERR_BADDEV; short ret = DEV_ERR_BADDEV;
@ -79,7 +79,7 @@ short bdev_init(short dev) {
} }
} }
TRACE1("bdev_init returning %d", (int)ret); TRACE("bdev_init returning %d", (int)ret);
return ret; return ret;
} }
@ -96,7 +96,7 @@ short bdev_init(short dev) {
// number of bytes read, any negative number is an error code // number of bytes read, any negative number is an error code
// //
SYSTEMCALL short bdev_read(short dev, long lba, unsigned char * buffer, short size) { SYSTEMCALL short bdev_read(short dev, long lba, unsigned char * buffer, short size) {
TRACE4("bdev_read(%d,%ld,%p,%d)", (int)dev, lba, buffer, (int)size); TRACE("bdev_read(%d,%ld,%p,%d)", (int)dev, lba, buffer, (int)size);
short ret = DEV_ERR_BADDEV; short ret = DEV_ERR_BADDEV;
@ -106,7 +106,7 @@ SYSTEMCALL short bdev_read(short dev, long lba, unsigned char * buffer, short si
ret = bdev->read(bdev, lba, buffer, size); ret = bdev->read(bdev, lba, buffer, size);
} }
TRACE1("bdev_read returning %d", (int)ret); TRACE("bdev_read returning %d", (int)ret);
return ret; return ret;
} }
@ -123,7 +123,7 @@ SYSTEMCALL short bdev_read(short dev, long lba, unsigned char * buffer, short si
// number of bytes written, any negative number is an error code // number of bytes written, any negative number is an error code
// //
SYSTEMCALL short bdev_write(short dev, long lba, const unsigned char * buffer, short size) { SYSTEMCALL short bdev_write(short dev, long lba, const unsigned char * buffer, short size) {
TRACE4("bdev_write(%d,%ld,%p,%d)", (int)dev, lba, buffer, (int)size); TRACE("bdev_write(%d,%ld,%p,%d)", (int)dev, lba, buffer, (int)size);
short ret = DEV_ERR_BADDEV; short ret = DEV_ERR_BADDEV;
@ -133,7 +133,7 @@ SYSTEMCALL short bdev_write(short dev, long lba, const unsigned char * buffer, s
ret = bdev->write(bdev, lba, buffer, size); ret = bdev->write(bdev, lba, buffer, size);
} }
TRACE1("bdev_write returning %d", (int)ret); TRACE("bdev_write returning %d", (int)ret);
return ret; return ret;
} }
@ -147,7 +147,7 @@ SYSTEMCALL short bdev_write(short dev, long lba, const unsigned char * buffer, s
// the status of the device // the status of the device
// //
SYSTEMCALL short bdev_status(short dev) { SYSTEMCALL short bdev_status(short dev) {
TRACE1("bdev_status(%d)", dev); TRACE("bdev_status(%d)", dev);
short ret = DEV_ERR_BADDEV; short ret = DEV_ERR_BADDEV;
@ -157,7 +157,7 @@ SYSTEMCALL short bdev_status(short dev) {
ret = bdev->status(bdev); ret = bdev->status(bdev);
} }
TRACE1("bdev_status returning %d", (int)ret); TRACE("bdev_status returning %d", (int)ret);
return ret; return ret;
} }
@ -171,7 +171,7 @@ SYSTEMCALL short bdev_status(short dev) {
// 0 on success, any negative number is an error code // 0 on success, any negative number is an error code
// //
SYSTEMCALL short bdev_flush(short dev) { SYSTEMCALL short bdev_flush(short dev) {
TRACE1("bdev_flush(%d)", (int)dev); TRACE("bdev_flush(%d)", (int)dev);
short ret = DEV_ERR_BADDEV; short ret = DEV_ERR_BADDEV;
@ -181,7 +181,7 @@ SYSTEMCALL short bdev_flush(short dev) {
return bdev->flush(bdev); return bdev->flush(bdev);
} }
TRACE1("bdev_flush returning %d", (int)ret); TRACE("bdev_flush returning %d", (int)ret);
return ret; return ret;
} }
@ -198,7 +198,7 @@ SYSTEMCALL short bdev_flush(short dev) {
// 0 on success, any negative number is an error code // 0 on success, any negative number is an error code
// //
SYSTEMCALL short bdev_ioctrl(short dev, short command, unsigned char * buffer, short size) { SYSTEMCALL short bdev_ioctrl(short dev, short command, unsigned char * buffer, short size) {
TRACE4("bdev_ioctrl(%d, %d, %p, %d)", (int)dev, command, buffer, (int)size); TRACE("bdev_ioctrl(%d, %d, %p, %d)", (int)dev, command, buffer, (int)size);
short ret = DEV_ERR_BADDEV; short ret = DEV_ERR_BADDEV;
@ -208,6 +208,6 @@ SYSTEMCALL short bdev_ioctrl(short dev, short command, unsigned char * buffer, s
ret = bdev->ioctrl(bdev, command, buffer, size); ret = bdev->ioctrl(bdev, command, buffer, size);
} }
TRACE1("bdev_ioctrl returning %d", (int)ret); TRACE("bdev_ioctrl returning %d", (int)ret);
return ret; return ret;
} }

View file

@ -48,7 +48,7 @@ void cdev_init_system() {
// //
short cdev_register(const p_dev_chan device) { short cdev_register(const p_dev_chan device) {
TRACE1("cdev_register %s", device->name); TRACE("cdev_register %s", device->name);
short dev; short dev;
dev = device->number; dev = device->number;
@ -73,7 +73,7 @@ short cdev_register(const p_dev_chan device) {
p_channel chan_alloc(short dev) { p_channel chan_alloc(short dev) {
int i; int i;
TRACE1("chan_alloc(%d)", (int)dev); TRACE("chan_alloc(%d)", (int)dev);
if ((dev >= CDEV_CONSOLE) && (dev < CDEV_FILE)) { if ((dev >= CDEV_CONSOLE) && (dev < CDEV_FILE)) {
/* For most devices (all but files): the channel is always the same number as the device */ /* For most devices (all but files): the channel is always the same number as the device */
@ -114,7 +114,7 @@ p_channel chan_get_record(short c) {
// chan = a pointer to the channel record to return to the kernel // chan = a pointer to the channel record to return to the kernel
// //
void chan_free(p_channel chan) { void chan_free(p_channel chan) {
log_num(LOG_INFO, "chan_free: ", chan->number); INFO("chan_free: %d", chan->number);
chan->number = -1; chan->number = -1;
chan->dev = -1; chan->dev = -1;
@ -139,12 +139,12 @@ short chan_get_records(short channel, p_channel * chan, p_dev_chan * cdev) {
*cdev = &g_channel_devs[(*chan)->dev]; *cdev = &g_channel_devs[(*chan)->dev];
return 0; return 0;
} else { } else {
log_num(LOG_ERROR, "chan_get_records 1: ", (*chan)->dev); ERROR("chan_get_records 1: %d", (*chan)->dev);
return DEV_ERR_BADDEV; return DEV_ERR_BADDEV;
} }
} else { } else {
log_num(LOG_ERROR, "chan_get_records 2: ", channel); ERROR("chan_get_records 2: %d", channel);
return DEV_ERR_BADDEV; return DEV_ERR_BADDEV;
} }
@ -189,7 +189,7 @@ SYSTEMCALL short chan_open(short dev, const uint8_t * path, short mode) {
p_dev_chan cdev; p_dev_chan cdev;
TRACE("chan_open"); TRACE("chan_open");
log_num(LOG_DEBUG, "dev = ", dev); DEBUG("dev = %d", dev);
if (dev < CDEV_DEVICES_MAX) { if (dev < CDEV_DEVICES_MAX) {
/* Get the device record */ /* Get the device record */
@ -236,7 +236,7 @@ SYSTEMCALL short chan_open(short dev, const uint8_t * path, short mode) {
* nothing useful * nothing useful
*/ */
SYSTEMCALL short chan_close(short channel) { SYSTEMCALL short chan_close(short channel) {
TRACE1("chan_close(%d)", channel); TRACE("chan_close(%d)", channel);
p_channel chan; p_channel chan;
p_dev_chan cdev; p_dev_chan cdev;
if (chan_get_records(channel, &chan, &cdev) == 0) { if (chan_get_records(channel, &chan, &cdev) == 0) {
@ -265,14 +265,14 @@ SYSTEMCALL short chan_read(short channel, uint8_t * buffer, short size) {
p_dev_chan cdev; p_dev_chan cdev;
short res; short res;
TRACE3("chan_read(%d,%p,%d)", (int)channel, buffer, (int)size); TRACE("chan_read(%d,%p,%d)", (int)channel, buffer, (int)size);
res = chan_get_records(channel, &chan, &cdev); res = chan_get_records(channel, &chan, &cdev);
if (res == 0) { if (res == 0) {
DEBUG1("chan_read: %s", cdev->name); DEBUG("chan_read: %s", cdev->name);
res = cdev->read ? cdev->read(chan, buffer, size) : 0; res = cdev->read ? cdev->read(chan, buffer, size) : 0;
} else { } else {
DEBUG1("Couldn't get channel: %d", (int)res); DEBUG("Couldn't get channel: %d", (int)res);
} }
return res; return res;
} }
@ -347,13 +347,13 @@ SYSTEMCALL 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); 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)
res = cdev->write ? cdev->write(chan, buffer, size) : 0; res = cdev->write ? cdev->write(chan, buffer, size) : 0;
else else
ERROR1("chan_write error: %d", res); ERROR("chan_write error: %d", res);
return res; return res;
} }
@ -378,7 +378,7 @@ SYSTEMCALL short chan_write_b(short channel, uint8_t b) {
if (res == 0) if (res == 0)
res = cdev->write_b ? cdev->write_b(chan, b) : 0; res = cdev->write_b ? cdev->write_b(chan, b) : 0;
else else
ERROR1("chan_write_b error: %d", res); ERROR("chan_write_b error: %d", res);
return res; return res;
} }
@ -402,7 +402,7 @@ SYSTEMCALL short chan_status(short channel) {
if (res == 0) if (res == 0)
res = cdev->status ? cdev->status(chan) : 0; res = cdev->status ? cdev->status(chan) : 0;
else else
ERROR1("chan_status error: %d", res); ERROR("chan_status error: %d", res);
return res; return res;
} }
@ -425,7 +425,7 @@ SYSTEMCALL short chan_flush(short channel) {
if (res == 0) if (res == 0)
res = cdev->flush ? cdev->flush(chan) : 0; res = cdev->flush ? cdev->flush(chan) : 0;
else else
ERROR1("flush error: %d", res); ERROR("flush error: %d", res);
return res; return res;
} }
@ -451,7 +451,7 @@ SYSTEMCALL short chan_seek(short channel, long position, short base) {
if (res == 0) if (res == 0)
res = cdev->seek ? cdev->seek(chan, position, base) : 0; res = cdev->seek ? cdev->seek(chan, position, base) : 0;
else else
ERROR1("chan_seek error: %d", res); ERROR("chan_seek error: %d", res);
return res; return res;
} }
@ -477,7 +477,7 @@ SYSTEMCALL short chan_ioctrl(short channel, short command, uint8_t * buffer, sho
if (res == 0) if (res == 0)
res = cdev->ioctrl ? cdev->ioctrl(chan, command, buffer, size) : 0; res = cdev->ioctrl ? cdev->ioctrl(chan, command, buffer, size) : 0;
else else
ERROR1("chan_seek error: %d", res); ERROR("chan_seek error: %d", res);
return res; return res;
} }

View file

@ -134,7 +134,7 @@ SYSTEMCALL short fsys_open(const char * path, short mode) {
p_channel chan = 0; p_channel chan = 0;
short i, fd = -1; short i, fd = -1;
TRACE2("fsys_open(\"%s\",%d)", path, (int)mode); TRACE("fsys_open(\"%s\",%d)", path, (int)mode);
// If the file being opened is on the floppy drive, make sure the FDC status // 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 // is updated correctly for disk change by spinning up the motor and checking the DIR register
@ -159,7 +159,7 @@ SYSTEMCALL short fsys_open(const char * path, short mode) {
chan = chan_alloc(CDEV_FILE); chan = chan_alloc(CDEV_FILE);
if (chan) { if (chan) {
INFO1("chan_alloc: %d", (int)chan->number); INFO("chan_alloc: %d", (int)chan->number);
chan->dev = CDEV_FILE; chan->dev = CDEV_FILE;
FRESULT result = f_open(&g_file[fd], path, mode); FRESULT result = f_open(&g_file[fd], path, mode);
if (result == 0) { if (result == 0) {
@ -167,7 +167,7 @@ SYSTEMCALL short fsys_open(const char * path, short mode) {
return chan->number; return chan->number;
} else { } else {
/* There was an error... deallocate the channel and file descriptor */ /* There was an error... deallocate the channel and file descriptor */
ERROR1("fsys_open error: %d", result); ERROR("fsys_open error: %d", result);
g_fil_state[fd] = 0; g_fil_state[fd] = 0;
chan_free(chan); chan_free(chan);
return fatfs_to_foenix(result); return fatfs_to_foenix(result);
@ -249,7 +249,7 @@ SYSTEMCALL short fsys_opendir(const char * path) {
} }
if (fres != FR_OK) { if (fres != FR_OK) {
/* If there was a problem, return an error number */ /* If there was a problem, return an error number */
ERROR1("FATFS Error: %d", fres); ERROR("FATFS Error: %d", fres);
return fatfs_to_foenix(fres); return fatfs_to_foenix(fres);
} else { } else {
/* Otherwise, allocate and return the handle */ /* Otherwise, allocate and return the handle */
@ -506,7 +506,7 @@ SYSTEMCALL short fsys_mkdir(const char * path) {
if (result == FR_OK) { if (result == FR_OK) {
return 0; return 0;
} else { } else {
log_num(LOG_ERROR, "fsys_mkdir error: ", result); ERROR("fsys_mkdir error: %d", result);
return fatfs_to_foenix(result); return fatfs_to_foenix(result);
} }
} }
@ -531,7 +531,7 @@ SYSTEMCALL short fsys_delete(const char * path) {
if (result == FR_OK) { if (result == FR_OK) {
return 0; return 0;
} else { } else {
log_num(LOG_ERROR, "fsys_delete error: ", result); ERROR("fsys_delete error: %d", result);
return fatfs_to_foenix(result); return fatfs_to_foenix(result);
} }
} }
@ -580,7 +580,7 @@ SYSTEMCALL short fsys_set_cwd(const char * path) {
f_getcwd(g_current_directory, MAX_PATH_LEN); f_getcwd(g_current_directory, MAX_PATH_LEN);
return 0; return 0;
} else { } else {
log_num(LOG_ERROR, "fsys_set_cwd error: ", result); ERROR("fsys_set_cwd error: %d", result);
return fatfs_to_foenix(result); return fatfs_to_foenix(result);
} }
} }
@ -627,7 +627,7 @@ short fchan_read(t_channel * chan, unsigned char * buffer, short size) {
FRESULT result; FRESULT result;
unsigned total_read; unsigned total_read;
log(LOG_TRACE, "fchan_read"); TRACE("fchan_read");
file = fchan_to_file(chan); file = fchan_to_file(chan);
if (file) { if (file) {
@ -673,7 +673,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"); TRACE("fchan_read_b");
file = fchan_to_file(chan); file = fchan_to_file(chan);
if (file) { if (file) {
@ -704,7 +704,7 @@ short fchan_write(p_channel chan, const unsigned char * buffer, short size) {
if (result == FR_OK) { if (result == FR_OK) {
return (short)total_written; return (short)total_written;
} else { } else {
log_num(LOG_ERROR, "fchan_write error: ", result); ERROR("fchan_write error: %d", result);
return fatfs_to_foenix(result); return fatfs_to_foenix(result);
} }
} }
@ -838,9 +838,9 @@ short fsys_mount(short bdev) {
drive[2] = 0; drive[2] = 0;
fres = f_mount(&g_drive[bdev], drive, 0); fres = f_mount(&g_drive[bdev], drive, 0);
INFO1("fsys_mount called f_mount: %d", fres); INFO("fsys_mount called f_mount: %d", fres);
if (fres != FR_OK) { if (fres != FR_OK) {
ERROR2("Unable to mount drive %s, FatFS Error: %d", drive, fres); ERROR("Unable to mount drive %s, FatFS Error: %d", drive, fres);
return fatfs_to_foenix(fres); return fatfs_to_foenix(fres);
} else { } else {
return 0; return 0;
@ -891,7 +891,7 @@ SYSTEMCALL short fsys_set_label(short drive, const char * label) {
sprintf(buffer, "%d:%s", drive, label); sprintf(buffer, "%d:%s", drive, label);
fres = f_setlabel(buffer); fres = f_setlabel(buffer);
if (fres != FR_OK) { if (fres != FR_OK) {
log_num(LOG_ERROR, "fsys_setlabel: ", fres); ERROR("fsys_setlabel: %d", fres);
return fatfs_to_foenix(fres); return fatfs_to_foenix(fres);
} else { } else {
return 0; return 0;
@ -914,7 +914,7 @@ SYSTEMCALL short fsys_mkfs(short drive, char * label) {
sprintf(buffer, "%d:", drive); sprintf(buffer, "%d:", drive);
fres = f_mkfs(buffer, 0, workspace, FF_MAX_SS * 4); fres = f_mkfs(buffer, 0, workspace, FF_MAX_SS * 4);
if (fres != FR_OK) { if (fres != FR_OK) {
log_num(LOG_ERROR, "fsys_mkfs: ", fres); ERROR("fsys_mkfs: %d", fres);
return fatfs_to_foenix(fres); return fatfs_to_foenix(fres);
} else { } else {
return 0; return 0;
@ -941,7 +941,7 @@ short fsys_default_loader(short chan, long destination, long * start) {
unsigned char * dest = (unsigned char *)destination; unsigned char * dest = (unsigned char *)destination;
TRACE("fsys_default_loader"); TRACE("fsys_default_loader");
log_num(LOG_DEBUG, "Channel: ", chan); DEBUG("Channel: %d", chan);
/* The default loader cannot be used to load executable files, so clear the start address */ /* The default loader cannot be used to load executable files, so clear the start address */
*start = 0; *start = 0;
@ -1074,11 +1074,11 @@ short fsys_pgz_loader(short chan, long destination, long * start) {
break; break;
case 2: case 2:
address = address | ((uint32_t)chunk[i]) << 16; address = address | ((uint32_t)chunk[i]) << 16;
INFO1("PGZ 24-bit address: %06lx", address); INFO("PGZ 24-bit address: %06lx", address);
break; break;
case 3: case 3:
address = address | ((uint32_t)chunk[i]) << 24; address = address | ((uint32_t)chunk[i]) << 24;
INFO1("PGZ 32-bit address: %08lx", address); INFO("PGZ 32-bit address: %08lx", address);
break; break;
} }
@ -1096,17 +1096,17 @@ short fsys_pgz_loader(short chan, long destination, long * start) {
count = count | ((uint32_t)chunk[i]) << 16; count = count | ((uint32_t)chunk[i]) << 16;
if (!use_32bits && count == 0) { if (!use_32bits && count == 0) {
*start = address; *start = address;
INFO1("PGZ 24-bit start address: %06lx", start); INFO("PGZ 24-bit start address: %06lx", start);
} }
INFO1("PGZ 24-bit count: %06lx", count); INFO("PGZ 24-bit count: %06lx", count);
break; break;
case 3: case 3:
count = count | ((uint32_t)chunk[i]) << 24; count = count | ((uint32_t)chunk[i]) << 24;
if (use_32bits && count == 0) { if (use_32bits && count == 0) {
*start = address; *start = address;
INFO1("PGZ 32-bit start address: %08lx", start); INFO("PGZ 32-bit start address: %08lx", start);
} }
INFO1("PGZ 32-bit count: %08lx", count); INFO("PGZ 32-bit count: %08lx", count);
break; break;
} }
} else { } else {
@ -1140,7 +1140,6 @@ short fsys_pgz_loader(short chan, long destination, long * start) {
} }
short fsys_elf_loader(short chan, long destination, long * start) { short fsys_elf_loader(short chan, long destination, long * start) {
char log_buffer[100];
size_t numBytes, highMem = 0, progIndex = 0, lowMem = ~0; size_t numBytes, highMem = 0, progIndex = 0, lowMem = ~0;
elf32_header header; elf32_header header;
elf32_program_header progHeader; elf32_program_header progHeader;
@ -1157,8 +1156,7 @@ short fsys_elf_loader(short chan, long destination, long * start) {
} }
if (header.machine != CPU_ARCH) { if (header.machine != CPU_ARCH) {
sprintf((char*)&log_buffer, "[!] Incompatible CPU arch: expected %s, but found %s\n", (char*)elf_cpu_desc[CPU_ARCH], (char*)elf_cpu_desc[header.machine]); DEBUG("[!] Incompatible CPU arch: expected %s, but found %s\n", (char*)elf_cpu_desc[CPU_ARCH], (char*)elf_cpu_desc[header.machine]);
DEBUG(log_buffer);
return ERR_BAD_BINARY; return ERR_BAD_BINARY;
} }
@ -1334,7 +1332,7 @@ static short fsys_load_ext(const char * path, const char * extension, long desti
TRACE("fsys_load_ext"); TRACE("fsys_load_ext");
log2(LOG_VERBOSE, "fsys_load_ext ext: ", extension); VERBOSE("fsys_load_ext ext: %s", extension);
if (extension[0] == 0) { if (extension[0] == 0) {
if (destination != 0) { if (destination != 0) {
@ -1353,7 +1351,7 @@ static short fsys_load_ext(const char * path, const char * extension, long desti
if (strcmp(g_file_loader[i].extension, extension) == 0) { if (strcmp(g_file_loader[i].extension, extension) == 0) {
/* If the extensions match, pass back the loader */ /* If the extensions match, pass back the loader */
loader = g_file_loader[i].loader; loader = g_file_loader[i].loader;
log2(LOG_DEBUG, "loader found: ", g_file_loader[i].extension); DEBUG("loader found: %s", g_file_loader[i].extension);
} }
} }
} }
@ -1363,11 +1361,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."); DEBUG("Setting default loader.");
loader = fsys_default_loader; loader = fsys_default_loader;
} else { } else {
log(LOG_DEBUG, "Returning a bad extension."); DEBUG("Returning a bad extension.");
/* Return bad extension */ /* Return bad extension */
return ERR_BAD_EXTENSION; return ERR_BAD_EXTENSION;
} }
@ -1387,13 +1385,13 @@ static short fsys_load_ext(const char * path, const char * extension, long desti
fsys_close(chan); fsys_close(chan);
if (result != 0) { if (result != 0) {
log_num(LOG_ERROR, "Could not load file: ", result); ERROR("Could not load file: %d", result);
} }
return result; return result;
} else { } else {
/* File open returned an error... pass it along */ /* File open returned an error... pass it along */
log_num(LOG_ERROR, "Could not open file: ", chan); ERROR("Could not open file: %d", chan);
return chan; return chan;
} }
} }
@ -1459,7 +1457,7 @@ SYSTEMCALL short fsys_load(const char * path, long destination, long * start) {
f_closedir(&dj); f_closedir(&dj);
if (fr != FR_OK && fr != FR_NO_FILE) { if (fr != FR_OK && fr != FR_NO_FILE) {
log_num(LOG_ERROR, "File system error: ", fr); ERROR("File system error: %d", fr);
return FSYS_ERR_DISK_ERR; return FSYS_ERR_DISK_ERR;
} }
@ -1467,7 +1465,7 @@ SYSTEMCALL 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."); ERROR("Command not found.");
return ERR_NOT_FOUND; return ERR_NOT_FOUND;
} }
} }
@ -1549,10 +1547,10 @@ short fsys_init() {
for (i = 0; i < MAX_DRIVES; i++) { for (i = 0; i < MAX_DRIVES; i++) {
short res = sys_bdev_status((short)i); short res = sys_bdev_status((short)i);
if (res >= 0) { if (res >= 0) {
INFO1("Mounting drive #%d", i); INFO("Mounting drive #%d", i);
short result = fsys_mount(i); short result = fsys_mount(i);
if (result < 0) { if (result < 0) {
ERROR2("Could not mount device %d: %d", i, result); ERROR("Could not mount device %d: %d", i, result);
} }
} }
} }

View file

@ -483,7 +483,7 @@ short kbd_sc_init() {
// Reset the keyboard // Reset the keyboard
result = kbd_send_cmd(0xff); result = kbd_send_cmd(0xff);
if (result < 0) { if (result < 0) {
INFO1("PS/2: unable to reset the keyboard: %s", err_message(ressult)); INFO("PS/2: unable to reset the keyboard: %s", err_message(ressult));
return result; return result;
} }
INFO("kbd_sc_init: ps/2 keyboard reset"); INFO("kbd_sc_init: ps/2 keyboard reset");
@ -493,7 +493,7 @@ short kbd_sc_init() {
// Disable scanning // Disable scanning
result = kbd_send_cmd(0xf5); result = kbd_send_cmd(0xf5);
if (result < 0) { if (result < 0) {
INFO1("PS/2: unable to disable keyboard scanning: %s", err_message(ressult)); INFO("PS/2: unable to disable keyboard scanning: %s", err_message(ressult));
return result; return result;
} }
INFO("kbd_sc_init: ps/2 scanning disabled"); INFO("kbd_sc_init: ps/2 scanning disabled");
@ -501,12 +501,12 @@ short kbd_sc_init() {
// Set scan code set #2 // Set scan code set #2
result = kbd_send_cmd(0xf0); result = kbd_send_cmd(0xf0);
if (result < 0) { if (result < 0) {
INFO1("PS/2: unable to set scan code: %s", err_message(ressult)); INFO("PS/2: unable to set scan code: %s", err_message(ressult));
return result; return result;
} }
result = kbd_send_cmd(0x02); result = kbd_send_cmd(0x02);
if (result < 0) { if (result < 0) {
INFO1("PS/2: unable to send scan code set: %s", err_message(ressult)); INFO("PS/2: unable to send scan code set: %s", err_message(ressult));
return result; return result;
} }
INFO("kbd_sc_init: ps/2 scan code set #2 selected"); INFO("kbd_sc_init: ps/2 scan code set #2 selected");
@ -514,7 +514,7 @@ short kbd_sc_init() {
// Enable scanning // Enable scanning
result = kbd_send_cmd(0xf4); result = kbd_send_cmd(0xf4);
if (result < 0) { if (result < 0) {
INFO1("PS/2: unable to restart keyboard scanning: %s", err_message(ressult)); INFO("PS/2: unable to restart keyboard scanning: %s", err_message(ressult));
return result; return result;
} }
INFO("kbd_sc_init: ps/2 scanning enabled"); INFO("kbd_sc_init: ps/2 scanning enabled");
@ -526,4 +526,4 @@ short kbd_sc_init() {
return result; return result;
} }
#endif #endif

View file

@ -388,7 +388,7 @@ short ps2_controller_cmd(unsigned char cmd) {
} }
short result = (short)*PS2_DATA_BUF; short result = (short)*PS2_DATA_BUF;
// DEBUG2("PS/2: ps2_controller_cmd(%02X) = %02X", cmd, result); // DEBUG("PS/2: ps2_controller_cmd(%02X) = %02X", cmd, result);
return result; return result;
} }
@ -947,7 +947,7 @@ short ps2_mouse_command(unsigned char cmd) {
if (ps2_wait_in()) return -1; if (ps2_wait_in()) return -1;
*PS2_CMD_BUF = MOUSE_CMD_PREFIX; *PS2_CMD_BUF = MOUSE_CMD_PREFIX;
// log_num(LOG_VERBOSE, "ps_mouse_command command: ", cmd); // VERBOSE("ps_mouse_command command: %d", cmd);
if (ps2_wait_in()) return -1; if (ps2_wait_in()) return -1;
*PS2_DATA_BUF = cmd; *PS2_DATA_BUF = cmd;
@ -955,7 +955,7 @@ short ps2_mouse_command(unsigned char cmd) {
if (ps2_wait_out()) return -1; if (ps2_wait_out()) return -1;
result = *PS2_DATA_BUF; result = *PS2_DATA_BUF;
// log_num(LOG_VERBOSE, "ps_mouse_command result: ", result); // VERBOSE("ps_mouse_command result: %d", result);
return (short)result; return (short)result;
} }
@ -986,7 +986,7 @@ short ps2_mouse_get_packet() {
result = ps2_mouse_command(MOUSE_CMD_REQPACK); result = ps2_mouse_command(MOUSE_CMD_REQPACK);
if (result == -1) { if (result == -1) {
log_num(LOG_INFO, "MOUSE_CMD_REQPACK: ", result); INFO("MOUSE_CMD_REQPACK: %d", result);
return result; return result;
} }
@ -1046,7 +1046,7 @@ short mouse_init() {
result = ps2_mouse_command(MOUSE_CMD_RESET); result = ps2_mouse_command(MOUSE_CMD_RESET);
if (result == -1) { if (result == -1) {
log_num(LOG_INFO, "MOUSE_CMD_RESET: ", result); INFO("MOUSE_CMD_RESET: %d", result);
return result; return result;
} }
@ -1054,7 +1054,7 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_DISABLE); result = ps2_mouse_command_repeatable(MOUSE_CMD_DISABLE);
if (result != PS2_RESP_ACK) { if (result != PS2_RESP_ACK) {
log_num(LOG_INFO, "MOUSE_CMD_DISABLE: ", result); INFO("MOUSE_CMD_DISABLE: %d", result);
return result; return result;
} }
@ -1062,7 +1062,7 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_DEFAULTS); result = ps2_mouse_command_repeatable(MOUSE_CMD_DEFAULTS);
if (result != PS2_RESP_ACK) { if (result != PS2_RESP_ACK) {
log_num(LOG_INFO, "MOUSE_CMD_DEFAULTS: ", result); INFO("MOUSE_CMD_DEFAULTS: %d", result);
return result; return result;
} }
@ -1070,13 +1070,13 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_SETRES); result = ps2_mouse_command_repeatable(MOUSE_CMD_SETRES);
if (result != PS2_RESP_ACK) { if (result != PS2_RESP_ACK) {
log_num(LOG_INFO, "MOUSE_CMD_SETRES: ", result); INFO("MOUSE_CMD_SETRES: %d", result);
return result; return result;
} }
result = ps2_mouse_command_repeatable(0x00); result = ps2_mouse_command_repeatable(0x00);
if (result != PS2_RESP_ACK) { if (result != PS2_RESP_ACK) {
log_num(LOG_INFO, "MOUSE_CMD_SETRES resolution: ", result); INFO("MOUSE_CMD_SETRES resolution: %d", result);
return result; return result;
} }
@ -1084,7 +1084,7 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_ENABLE); result = ps2_mouse_command_repeatable(MOUSE_CMD_ENABLE);
if (result != PS2_RESP_ACK) { if (result != PS2_RESP_ACK) {
log_num(LOG_INFO, "MOUSE_CMD_ENABLE: ", result); INFO("MOUSE_CMD_ENABLE: %d", result);
return result; return result;
} }
@ -1211,9 +1211,9 @@ void ps2_identify(short port) {
} }
if (byte1 >= 0) { if (byte1 >= 0) {
INFO2("PS/2: ps2_identification: %02X %02X.", byte0, byte1); INFO("PS/2: ps2_identification: %02X %02X.", byte0, byte1);
} else { } else {
INFO1("PS/2: ps2_identification: %02X.", byte0); INFO("PS/2: ps2_identification: %02X.", byte0);
} }
res = ps2_kbd_cmd(KBD_CMD_ENABLE, 0); res = ps2_kbd_cmd(KBD_CMD_ENABLE, 0);
@ -1315,7 +1315,7 @@ short ps2_init() {
// if (mouse_present) { // if (mouse_present) {
// /* Initialize the mouse */ // /* Initialize the mouse */
// if ((mouse_error = mouse_init())) { // if ((mouse_error = mouse_init())) {
// log_num(LOG_INFO, "Unable to initialize mouse", mouse_error); // INFO("Unable to initialize mouse: %d", mouse_error);
// } // }
// } // }

View file

@ -34,7 +34,7 @@ void rtc_init() {
unsigned char rates; unsigned char rates;
unsigned char enables; unsigned char enables;
log(LOG_TRACE, "rtc_init"); TRACE("rtc_init");
int_disable(INT_RTC); int_disable(INT_RTC);
@ -124,13 +124,13 @@ SYSTEMCALL void rtc_set_time(p_time time) {
minute_bcd = i_to_bcd(time->minute); minute_bcd = i_to_bcd(time->minute);
second_bcd = i_to_bcd(time->second); second_bcd = i_to_bcd(time->second);
INFO1("Century: %02d", century_bcd); INFO("Century: %02d", century_bcd);
INFO1("Year: %04d", year_bcd); INFO("Year: %04d", year_bcd);
INFO1("Month: %02d", month_bcd); INFO("Month: %02d", month_bcd);
INFO1("Day: %02d", day_bcd); INFO("Day: %02d", day_bcd);
INFO1("Hour: %02d", hour_bcd); INFO("Hour: %02d", hour_bcd);
INFO1("Minute: %02d", minute_bcd); INFO("Minute: %02d", minute_bcd);
INFO1("Second: %02d", second_bcd); INFO("Second: %02d", second_bcd);
if (!time->is_24hours) { if (!time->is_24hours) {
if (time->is_pm) { if (time->is_pm) {
@ -144,10 +144,10 @@ SYSTEMCALL void rtc_set_time(p_time time) {
ctrl = *RTC_CTRL; ctrl = *RTC_CTRL;
*RTC_CTRL = ctrl | RTC_UTI; *RTC_CTRL = ctrl | RTC_UTI;
INFO("RTC Disabled"); INFO("RTC Disabled");
INFO1("RTC Rates: %02x", *RTC_RATES); INFO("RTC Rates: %02x", *RTC_RATES);
INFO1("RTC Enables: %02x", *RTC_ENABLES); INFO("RTC Enables: %02x", *RTC_ENABLES);
INFO1("RTC Flags: %02x", *RTC_FLAGS); INFO("RTC Flags: %02x", *RTC_FLAGS);
INFO1("RTC Control: %02x", *RTC_CTRL); INFO("RTC Control: %02x", *RTC_CTRL);
/* Set the time in the RTC */ /* Set the time in the RTC */
@ -168,13 +168,13 @@ SYSTEMCALL void rtc_set_time(p_time time) {
hour_bcd = *RTC_HOUR; hour_bcd = *RTC_HOUR;
minute_bcd = *RTC_MIN; minute_bcd = *RTC_MIN;
second_bcd = *RTC_SEC; second_bcd = *RTC_SEC;
INFO1("REG Century: %02d", century_bcd); INFO("REG Century: %02d", century_bcd);
INFO1("REG Year: %02d", year_bcd); INFO("REG Year: %02d", year_bcd);
INFO1("REG Month: %02d", month_bcd); INFO("REG Month: %02d", month_bcd);
INFO1("REG Day: %02d", day_bcd); INFO("REG Day: %02d", day_bcd);
INFO1("REG Hour: %02d", hour_bcd); INFO("REG Hour: %02d", hour_bcd);
INFO1("REG Minute: %02d", minute_bcd); INFO("REG Minute: %02d", minute_bcd);
INFO1("REG Second: %02d", second_bcd); INFO("REG Second: %02d", second_bcd);
/* Set the 24/12 hour control bit if needed */ /* Set the 24/12 hour control bit if needed */
if (time->is_24hours) { if (time->is_24hours) {
@ -184,10 +184,10 @@ SYSTEMCALL 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;
INFO("RTC Enabled"); INFO("RTC Enabled");
INFO1("RTC Rates: %02x", *RTC_RATES); INFO("RTC Rates: %02x", *RTC_RATES);
INFO1("RTC Enables: %02x", *RTC_ENABLES); INFO("RTC Enables: %02x", *RTC_ENABLES);
INFO1("RTC Flags: %02x", *RTC_FLAGS); INFO("RTC Flags: %02x", *RTC_FLAGS);
INFO1("RTC Control: %02x", *RTC_CTRL); INFO("RTC Control: %02x", *RTC_CTRL);
} }
/* /*
@ -205,10 +205,10 @@ SYSTEMCALL void rtc_get_time(p_time time) {
ctrl = *RTC_CTRL; ctrl = *RTC_CTRL;
*RTC_CTRL = ctrl | RTC_UTI; *RTC_CTRL = ctrl | RTC_UTI;
INFO("RTC Disabled"); INFO("RTC Disabled");
INFO1("RTC Rates: %02x", *RTC_RATES); INFO("RTC Rates: %02x", *RTC_RATES);
INFO1("RTC Enables: %02x", *RTC_ENABLES); INFO("RTC Enables: %02x", *RTC_ENABLES);
INFO1("RTC Flags: %02x", *RTC_FLAGS); INFO("RTC Flags: %02x", *RTC_FLAGS);
INFO1("RTC Control: %02x", *RTC_CTRL); INFO("RTC Control: %02x", *RTC_CTRL);
if (*RTC_CTRL & RTC_2412) { if (*RTC_CTRL & RTC_2412) {
time->is_24hours = 1; time->is_24hours = 1;
@ -227,18 +227,18 @@ SYSTEMCALL 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;
INFO("RTC Enabled"); INFO("RTC Enabled");
INFO1("RTC Rates: %02x", *RTC_RATES); INFO("RTC Rates: %02x", *RTC_RATES);
INFO1("RTC Enables: %02x", *RTC_ENABLES); INFO("RTC Enables: %02x", *RTC_ENABLES);
INFO1("RTC Flags: %02x", *RTC_FLAGS); INFO("RTC Flags: %02x", *RTC_FLAGS);
INFO1("RTC Control: %02x", *RTC_CTRL); INFO("RTC Control: %02x", *RTC_CTRL);
INFO1("Century: %02d", century_bcd); INFO("Century: %02d", century_bcd);
INFO1("Year: %02d", year_bcd); INFO("Year: %02d", year_bcd);
INFO1("Month: %02d", month_bcd); INFO("Month: %02d", month_bcd);
INFO1("Day: %02d", day_bcd); INFO("Day: %02d", day_bcd);
INFO1("Hour: %02d", hour_bcd); INFO("Hour: %02d", hour_bcd);
INFO1("Minute: %02d", minute_bcd); INFO("Minute: %02d", minute_bcd);
INFO1("Second: %02d", second_bcd); INFO("Second: %02d", second_bcd);
/* Fill out the time record */ /* Fill out the time record */

View file

@ -152,7 +152,7 @@ short sdc_init() {
short sdc_read(long lba, unsigned char * buffer, short size) { short sdc_read(long lba, unsigned char * buffer, short size) {
long adjusted_lba; long adjusted_lba;
TRACE3("sdc_read(%ld,%p,%d)", lba, buffer, (int)size); TRACE("sdc_read(%ld,%p,%d)", lba, buffer, (int)size);
// Check for presence of the card // Check for presence of the card
@ -218,7 +218,7 @@ short sdc_read(long lba, unsigned char * buffer, short size) {
ind_set(IND_SDC, IND_OFF); ind_set(IND_SDC, IND_OFF);
// Success: return the byte count // Success: return the byte count
TRACE1("sdc_read: returning %d", count); TRACE("sdc_read: returning %d", count);
return count; return count;
} }
} }
@ -326,7 +326,7 @@ short sdc_write(long lba, const unsigned char * buffer, short size) {
short sdc_status() { short sdc_status() {
short status = g_sdc_status; short status = g_sdc_status;
TRACE1("sdc_status, status=0x%x",(int)status); TRACE("sdc_status, status=0x%x",(int)status);
if (sdc_detected()) { if (sdc_detected()) {
// Add the PRESENT flag, if the card is inserted // Add the PRESENT flag, if the card is inserted
@ -338,7 +338,7 @@ short sdc_status() {
status |= SDC_STAT_PROTECTED; status |= SDC_STAT_PROTECTED;
} }
TRACE1("sdc_status: %x", (short)status); TRACE("sdc_status: %x", (short)status);
return status; return status;
} }

View file

@ -359,8 +359,8 @@ static short sdc_init(p_dev_block dev) {
sd->ctrl &= ~SDx_SLOW; // Bring back the Fast Mode - 25Mhz sd->ctrl &= ~SDx_SLOW; // Bring back the Fast Mode - 25Mhz
card->status = card->type ? 0 : SDC_STAT_NOINIT; card->status = card->type ? 0 : SDC_STAT_NOINIT;
INFO1("SD0_CardType: %x", card->type); INFO("SD0_CardType: %x", card->type);
INFO1("SD0_Stat: %x", card->status); INFO("SD0_Stat: %x", card->status);
SD0_deselect(sd); SD0_deselect(sd);

View file

@ -104,7 +104,7 @@ static void txt_c256_set_sizes() {
c256_visible_size.height = c256_max_size.height; c256_visible_size.height = c256_max_size.height;
} }
DEBUG4("txt_c256_set_sizes max:%d,%d, visible:%d,%d", c256_max_size.width, c256_max_size.height, c256_visible_size.width, c256_visible_size.height); DEBUG("txt_c256_set_sizes max:%d,%d, visible:%d,%d", c256_max_size.width, c256_max_size.height, c256_visible_size.width, c256_visible_size.height);
} }
} }
@ -327,11 +327,7 @@ static short txt_c256_get_region(p_rect region) {
region->size.width = c256_region.size.width; region->size.width = c256_region.size.width;
region->size.height = c256_region.size.height; region->size.height = c256_region.size.height;
{ DEBUG("txt_c256_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_c256_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;
} }

View file

@ -141,7 +141,7 @@ static void txt_evid_set_sizes() {
evid_visible_size.height = evid_max_size.height; evid_visible_size.height = evid_max_size.height;
} }
DEBUG4("txt_evid_set_sizes max:%d,%d, visible:%d,%d", evid_max_size.width, evid_max_size.height, evid_visible_size.width, evid_visible_size.height); DEBUG("txt_evid_set_sizes max:%d,%d, visible:%d,%d", evid_max_size.width, evid_max_size.height, evid_visible_size.width, evid_visible_size.height);
} }
} }

View file

@ -110,7 +110,7 @@ static void txt_f256_set_sizes() {
f256_visible_size.height = f256_max_size.height; f256_visible_size.height = f256_max_size.height;
} }
// DEBUG4("txt_f256_set_sizes max:%d,%d, visible:%d,%d", f256_max_size.width, f256_max_size.height, f256_visible_size.width, f256_visible_size.height); // DEBUG("txt_f256_set_sizes max:%d,%d, visible:%d,%d", f256_max_size.width, f256_max_size.height, f256_visible_size.width, f256_visible_size.height);
} }
} }
@ -177,7 +177,7 @@ static short txt_f256_set_mode(short mode) {
} }
*tvky_mstr_ctrl = mcr_shadow; *tvky_mstr_ctrl = mcr_shadow;
INFO1("Setting Vicky MCR: 0x%04x", mcr_shadow); INFO("Setting Vicky MCR: 0x%04x", mcr_shadow);
return 0; return 0;
} }
} }

View file

@ -47,7 +47,7 @@ void txt_init() {
* @return 0 on success, any other number is an error * @return 0 on success, any other number is an error
*/ */
short txt_register(p_txt_device device) { short txt_register(p_txt_device device) {
DEBUG1("txt_register(%s)", device->name); DEBUG("txt_register(%s)", device->name);
if (device->number < TXT_CNT_SCREENS) { if (device->number < TXT_CNT_SCREENS) {
int i = device->number; int i = device->number;
@ -95,7 +95,7 @@ p_txt_device txt_get_device(short screen) {
if (device->number == screen) { if (device->number == screen) {
return device; return device;
} else { } else {
ERROR1("txt_get_device: number mismatch %d", screen); ERROR("txt_get_device: number mismatch %d", screen);
} }
} }
@ -108,14 +108,14 @@ p_txt_device txt_get_device(short screen) {
* @param screen the number of the text device * @param screen the number of the text device
*/ */
void txt_init_screen(short screen) { void txt_init_screen(short screen) {
TRACE1("txt_init_screen(%d)", (int)screen); TRACE("txt_init_screen(%d)", (int)screen);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->init) { if (device->init) {
device->init(); device->init();
} }
} else { } else {
ERROR1("Could not find screen %d", screen); ERROR("Could not find screen %d", screen);
} }
} }
@ -289,7 +289,7 @@ SYSTEMCALL void txt_set_cursor_visible(short screen, short enable) {
* @return 0 on success, any other number means the region was invalid * @return 0 on success, any other number means the region was invalid
*/ */
SYSTEMCALL short txt_get_region(short screen, p_rect region) { SYSTEMCALL short txt_get_region(short screen, p_rect region) {
DEBUG2("txt_get_region screen:%d region:%p", screen, region); DEBUG("txt_get_region screen:%d region:%p", screen, region);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->get_region) { if (device->get_region) {
@ -309,7 +309,7 @@ SYSTEMCALL short txt_get_region(short screen, 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
*/ */
SYSTEMCALL short txt_set_region(short screen, p_rect region) { SYSTEMCALL short txt_set_region(short screen, p_rect region) {
TRACE5("txt_set_region(%d,{x:%d; y:%d w:%d, h:%d})", (int)screen, (int)region->origin.x, (int)region->origin.y, (int)region->size.width, (int)region->size.height); TRACE("txt_set_region(%d,{x:%d; y:%d w:%d, h:%d})", (int)screen, (int)region->origin.x, (int)region->origin.y, (int)region->size.width, (int)region->size.height);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->set_region) { if (device->set_region) {
@ -327,7 +327,7 @@ SYSTEMCALL short txt_set_region(short screen, p_rect region) {
* @param background the Text LUT index of the new current background color (0 - 15) * @param background the Text LUT index of the new current background color (0 - 15)
*/ */
SYSTEMCALL short txt_set_color(short screen, unsigned char foreground, unsigned char background) { SYSTEMCALL short txt_set_color(short screen, unsigned char foreground, unsigned char background) {
TRACE3("txt_get_color(%d,%d,%d)", (int)screen, (int)foreground, (int)background); TRACE("txt_get_color(%d,%d,%d)", (int)screen, (int)foreground, (int)background);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->set_color) { if (device->set_color) {
@ -346,7 +346,7 @@ SYSTEMCALL short txt_set_color(short screen, unsigned char foreground, unsigned
* background = pointer to the background color number * background = pointer to the background color number
*/ */
SYSTEMCALL void txt_get_color(short screen, unsigned char * foreground, unsigned char * background) { SYSTEMCALL void txt_get_color(short screen, unsigned char * foreground, unsigned char * background) {
TRACE3("txt_get_color(%d,%p,%p)", (int)screen, foreground, background); TRACE("txt_get_color(%d,%p,%p)", (int)screen, foreground, background);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->get_color) { if (device->get_color) {
@ -366,7 +366,7 @@ SYSTEMCALL void txt_get_color(short screen, unsigned char * foreground, unsigned
* @param y the row for the cursor * @param y the row for the cursor
*/ */
SYSTEMCALL void txt_set_xy(short screen, short x, short y) { SYSTEMCALL void txt_set_xy(short screen, short x, short y) {
DEBUG3("txt_set_xy(%d,%d,%d)", screen, (int)x, (int)y); DEBUG("txt_set_xy(%d,%d,%d)", screen, (int)x, (int)y);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->set_xy) { if (device->set_xy) {
@ -480,7 +480,7 @@ SYSTEMCALL void txt_print(short screen, const char * message) {
* @param vertical the number of rows to scroll (negative is down, positive is up) * @param vertical the number of rows to scroll (negative is down, positive is up)
*/ */
void txt_scroll(short screen, short horizontal, short vertical) { void txt_scroll(short screen, short horizontal, short vertical) {
TRACE3("txt_scroll(%d,%d,%d)", screen, horizontal, vertical); TRACE("txt_scroll(%d,%d,%d)", screen, horizontal, vertical);
p_txt_device device = txt_get_device(screen); p_txt_device device = txt_get_device(screen);
if (device) { if (device) {
if (device->scroll) { if (device->scroll) {
@ -517,8 +517,8 @@ void txt_clear(short screen, short mode) {
t_point cursor; t_point cursor;
t_rect old_region, region; t_rect old_region, region;
TRACE2("txt_clear(%d,%d)", (int)screen, (int)mode); TRACE("txt_clear(%d,%d)", (int)screen, (int)mode);
txt_get_xy(screen, &cursor); txt_get_xy(screen, &cursor);
txt_get_region(screen, &old_region); txt_get_region(screen, &old_region);
@ -592,8 +592,8 @@ void txt_clear_line(short screen, short mode) {
t_point cursor; t_point cursor;
t_rect old_region, region; t_rect old_region, region;
TRACE2("txt_clear_line(%d,%d)", (int)screen, (int)mode); TRACE("txt_clear_line(%d,%d)", (int)screen, (int)mode);
txt_get_xy(screen, &cursor); txt_get_xy(screen, &cursor);
txt_get_region(screen, &old_region); txt_get_region(screen, &old_region);
@ -657,8 +657,8 @@ void txt_insert(short screen, short count) {
t_point cursor; t_point cursor;
t_rect old_region, region; t_rect old_region, region;
TRACE2("txt_clear_line(%d,%d)", (int)screen, (int)count); TRACE("txt_clear_line(%d,%d)", (int)screen, (int)count);
if (count > 0) { if (count > 0) {
txt_get_xy(screen, &cursor); txt_get_xy(screen, &cursor);
txt_get_region(screen, &old_region); txt_get_region(screen, &old_region);
@ -685,8 +685,8 @@ void txt_delete(short screen, short count) {
t_rect old_region, region; t_rect old_region, region;
short left; short left;
TRACE2("txt_delete(%d,%d)", screen, count); TRACE("txt_delete(%d,%d)", screen, count);
if (count > 0) { if (count > 0) {
txt_get_xy(screen, &cursor); txt_get_xy(screen, &cursor);
txt_get_region(screen, &old_region); txt_get_region(screen, &old_region);

View file

@ -315,7 +315,7 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
break; break;
default: default:
log(LOG_ERROR, "uart_open: Bad data word length"); ERROR("uart_open: Bad data word length");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
@ -329,7 +329,7 @@ short uart_open(p_channel chan, const unsigned 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"); ERROR("uart_open: Bad stop bits");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
@ -348,7 +348,7 @@ short uart_open(p_channel chan, const unsigned 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"); ERROR("uart_open: Bad parity");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }
@ -357,19 +357,19 @@ short uart_open(p_channel chan, const unsigned char * spec, short mode) {
return 0; return 0;
} else { } else {
log(LOG_ERROR, "uart_open: no parity token"); 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"); 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"); 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"); ERROR("uart_open: no BPS token");
return ERR_BAD_ARGUMENT; return ERR_BAD_ARGUMENT;
} }

View file

@ -54,7 +54,7 @@ DSTATUS disk_initialize(BYTE pdrv) {
DSTATUS disk_status(BYTE pdrv) { DSTATUS disk_status(BYTE pdrv) {
DSTATUS result = (DSTATUS)bdev_status(pdrv); DSTATUS result = (DSTATUS)bdev_status(pdrv);
INFO1("disk_status: %02X", result); INFO("disk_status: %02X", result);
return result; return result;
} }
@ -77,7 +77,7 @@ static void sector_dump(uint8_t * buffer, int count) {
DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) { DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) {
short result = bdev_read(pdrv, sector, buff, 512 * count); short result = bdev_read(pdrv, sector, buff, 512 * count);
INFO2("disk_read: sector #%u result %d", sector, result); INFO("disk_read: sector #%u result %d", sector, result);
// sector_dump(buff, 512); // sector_dump(buff, 512);
return bdev_to_fatfs(result); return bdev_to_fatfs(result);
@ -85,13 +85,13 @@ DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) {
DRESULT disk_write(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) { DRESULT disk_write(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) {
short result = bdev_write(pdrv, sector, buff, 512 * count); short result = bdev_write(pdrv, sector, buff, 512 * count);
INFO2("disk_write: sector #%u result %d", sector, result); INFO("disk_write: sector #%u result %d", sector, result);
return bdev_to_fatfs(result); return bdev_to_fatfs(result);
} }
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) { DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
short result = bdev_ioctrl(pdrv, cmd, buff, 0); short result = bdev_ioctrl(pdrv, cmd, buff, 0);
INFO1("disk_ioctl: %d", result); INFO("disk_ioctl: %d", result);
return bdev_to_fatfs(result); return bdev_to_fatfs(result);
} }
@ -106,7 +106,7 @@ DWORD get_fattime(void) {
(DWORD)time.minute << 5 | (DWORD)time.minute << 5 |
(DWORD)time.second >> 1; (DWORD)time.second >> 1;
INFO1("get_fattime %08lX", timestamp); INFO("get_fattime %08lX", timestamp);
return timestamp; return timestamp;
} }

View file

@ -47,7 +47,7 @@ void log_init(void) {
// if (log_channel == LOG_CHANNEL_UART0) { // if (log_channel == LOG_CHANNEL_UART0) {
uart_init(UART_COM1); uart_init(UART_COM1);
do_log = log_to_uart; do_log = log_to_uart;
log(LOG_INFO,"FOENIX DEBUG OUTPUT------------"); INFO("FOENIX DEBUG OUTPUT------------");
// } // }
// else { // else {
// do_log = log_to_screen; // do_log = log_to_screen;
@ -101,6 +101,8 @@ const char * err_messages[] = {
"media changed" "media changed"
}; };
#define LOG_BUFFER_SIZE 80
/* /*
* Return human readable message for an error number * Return human readable message for an error number
*/ */
@ -123,12 +125,12 @@ const char * err_message(short err_number) {
* err_number = the number of the error * err_number = the number of the error
*/ */
void err_print(short channel, const char * message, short err_number) { void err_print(short channel, const char * message, short err_number) {
char buffer[80]; char buffer[LOG_BUFFER_SIZE];
if ((err_number < 0) && (err_number > -40)) { if ((err_number < 0) && (err_number > -40)) {
sprintf(buffer, "%s: %s\n", message, err_message(err_number)); snprintf(buffer, LOG_BUFFER_SIZE, "%s: %s\n", message, err_message(err_number));
} else { } else {
sprintf(buffer, "%s: #%d\n", message, err_number); snprintf(buffer, LOG_BUFFER_SIZE, "%s: #%d\n", message, err_number);
} }
// TODO: bring back // TODO: bring back
@ -142,7 +144,7 @@ void err_print(short channel, const char * message, short err_number) {
* Display a panic screen * Display a panic screen
*/ */
void panic(void) { void panic(void) {
char buffer[80]; char buffer[LOG_BUFFER_SIZE];
short column = 2; short column = 2;
short row = 2; short row = 2;
short address_expected = 0; short address_expected = 0;
@ -214,11 +216,11 @@ TRACE("PANIC------------------------------------------");
if (address_expected) { if (address_expected) {
txt_set_xy(0, column, row++); txt_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X Address: %08X \xB3", (unsigned int)panic_pc, (unsigned int)panic_address); snprintf(buffer, LOG_BUFFER_SIZE, "\xB3 PC: %08X Address: %08X \xB3", (unsigned int)panic_pc, (unsigned int)panic_address);
txt_print(0, buffer); txt_print(0, buffer);
} else { } else {
txt_set_xy(0, column, row++); txt_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X \xB3", (unsigned int)panic_pc); snprintf(buffer, LOG_BUFFER_SIZE, "\xB3 PC: %08X \xB3", (unsigned int)panic_pc);
txt_print(0, buffer); txt_print(0, buffer);
} }
@ -266,17 +268,17 @@ static void log_to_screen(const char *message) {
* message/args = like printf. * message/args = like printf.
* *
* Caveat: * Caveat:
* The total length should not exceed 512 chars. * The total length should not exceed 80 chars.
*/ */
void log(short level, const char * message, ...) { void log_msg(short level, const char * message, ...) {
if (level > log_level) if (level > log_level)
return; return;
char buf[80]; // Should hopefully be long enough ! char buf[LOG_BUFFER_SIZE]; // Should hopefully be long enough !
va_list args; va_list args;
va_start(args, message); va_start(args, message);
vsprintf(buf, message, args); vsnprintf(buf, LOG_BUFFER_SIZE, message, args);
va_end(args); va_end(args);
(*do_log)(buf); (*do_log)(buf);
@ -284,70 +286,6 @@ void log(short level, const char * message, ...) {
// txt_print(0, "\n"); // txt_print(0, "\n");
} }
void trace(const char * message, ...) {
if (LOG_TRACE > log_level)
return;
char buf[80]; // Should hopefully be long enough !
va_list args;
va_start(args, message);
vsprintf(buf, message, args);
va_end(args);
(*do_log)(buf);
}
/*
* Log a message to the console
*
* Inputs:
* level = the severity of the message... the logging level will filter messages displayed
* message1 = the first part of the message to log
* message2 = the second part of the message to log
*/
void log2(short level, const char * message1, const char * message2) {
if (level <= log_level) {
char line[80];
sprintf(line, "%s%s\n", message1, message2);
log(level, line);
}
}
/*
* Log a message to the console
*
* Inputs:
* level = the severity of the message... the logging level will filter messages displayed
* message1 = the first part of the message to log
* message2 = the second part of the message to log
* message3 = the third part of the message to log
*/
void log3(short level, const char * message1, const char * message2, const char * message3) {
if (level <= log_level) {
char line[80];
sprintf(line, "%s%s%s\n", message1, message2, message3);
log(level, line);
}
}
/*
* Log a message with a number
*
* Inputs:
* level = the severity of the message... the logging level will filter messages displayed
* message1 = the first part of the message to log
* n = the number to log
*/
void log_num(short level, char * message, int n) {
char line[80];
if (level <= log_level) {
sprintf(line, "%s%08X", message, n);
log(level, line);
}
}
/* /*
* Send a single character to the debugging channel * Send a single character to the debugging channel
*/ */
@ -355,5 +293,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); log_msg(level, line);
} }

102
src/log.h
View file

@ -68,38 +68,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 log_msg(short level, const char * message, ...);
extern void trace(const char * message, ...);
/*
* Log a message to the console
*
* Inputs:
* level = the severity of the message... the logging level will filter messages displayed
* message1 = the first part of the message to log
* message2 = the second part of the message to log
*/
extern void log2(short level, const char * message1, const char * message2);
/*
* Log a message to the console
*
* Inputs:
* level = the severity of the message... the logging level will filter messages displayed
* message1 = the first part of the message to log
* message2 = the second part of the message to log
* message3 = the third part of the message to log
*/
extern void log3(short level, const char * message1, const char * message2, const char * message3);
/*
* Log a message with a number
*
* Inputs:
* level = the severity of the message... the logging level will filter messages displayed
* message1 = the first part of the message to log
* n = the number to log
*/
extern void log_num(short level, char * message, int n);
/* /*
* Log a single character * Log a single character
@ -111,73 +80,36 @@ 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, ...) log_msg(LOG_ERROR, m, ##__VA_ARGS__)
# define ERROR1(a,b) log(LOG_ERROR, a, b)
# define ERROR2(a,b,c) log(LOG_ERROR, a, b, c)
# define ERROR3(a,b,c,d) log(LOG_ERROR, a, b, c, d)
# define ERROR4(a,b,c,d,e) log(LOG_ERROR, a, b, c, d, e)
# define ERROR5(a,b,c,d,e,f) log(LOG_ERROR, a, b, c, d, e, f)
#else #else
# define ERROR(m) # define ERROR(m, ...)
# define ERROR1(a,b)
# define ERROR2(a,b,c)
# define ERROR3(a,b,c,d)
# define ERROR4(a,b,c,d,e)
# define ERROR5(a,b,c,d,e,f)
#endif #endif
#if DEFAULT_LOG_LEVEL >= LOG_INFO #if DEFAULT_LOG_LEVEL >= LOG_INFO
# define INFO(m) log(LOG_INFO, m); # define INFO(m, ...) log_msg(LOG_INFO, m, ##__VA_ARGS__);
# define INFO1(a,b) log(LOG_INFO, a, b);
# define INFO2(a,b,c) log(LOG_INFO, a, b, c);
# define INFO3(a,b,c,d) log(LOG_INFO, a, b, c, d);
# define INFO4(a,b,c,d,e) log(LOG_INFO, a, b, c, d, e);
# define INFO5(a,b,c,d,e,f) log(LOG_INFO, a, b, c, d, e, f);
#else #else
# define INFO(m) # define INFO(m, ...)
# define INFO1(a,b)
# define INFO2(a,b,c)
# define INFO3(a,b,c,d)
# define INFO4(a,b,c,d,e)
# define INFO5(a,b,c,d,e,f)
#endif #endif
#if DEFAULT_LOG_LEVEL >= LOG_DEBUG #if DEFAULT_LOG_LEVEL >= LOG_DEBUG
# define DEBUG(m) log(LOG_DEBUG, m) # define DEBUG(m, ...) log_msg(LOG_DEBUG, m, ##__VA_ARGS__)
# define DEBUG1(a,b) log(LOG_DEBUG, a, b)
# define DEBUG2(a,b,c) log(LOG_DEBUG, a, b, c)
# define DEBUG3(a,b,c,d) log(LOG_DEBUG, a, b, c, d)
# define DEBUG4(a,b,c,d,e) log(LOG_DEBUG, a, b, c, d, e)
# define DEBUG5(a,b,c,d,e,f) log(LOG_DEBUG, a, b, c, d, e, f)
#else #else
# define DEBUG(m) # define DEBUG(m, ...)
# define DEBUG1(a,b)
# define DEBUG2(a,b,c)
# define DEBUG3(a,b,c,d)
# define DEBUG4(a,b,c,d,e)
# define DEBUG5(a,b,c,d,e,f)
#endif #endif
#if DEFAULT_LOG_LEVEL >= LOG_TRACE #if DEFAULT_LOG_LEVEL >= LOG_TRACE
# define TRACE(m) trace(m) # define TRACE(m, ...) log_msg(LOG_TRACE, m, ##__VA_ARGS__)
# define TRACE1(a,b) trace(a, b)
# define TRACE2(a,b,c) trace(a, b, c)
# define TRACE3(a,b,c,d) trace(a, b, c, d)
# define TRACE4(a,b,c,d,e) trace(a, b, c, d, e)
# define TRACE5(a,b,c,d,e,f) trace(a, b, c, d, e, f)
# define TRACE6(a,b,c,d,e,f,g) trace(a, b, c, d, e, f, g)
# define TRACE7(a,b,c,d,e,f,g,h) trace(a, b, c, d, e, f, g, h)
#else #else
# define TRACE(m) # define TRACE(m, ...)
# define TRACE1(a,b)
# define TRACE2(a,b,c)
# define TRACE3(a,b,c,d)
# define TRACE4(a,b,c,d,e)
# define TRACE5(a,b,c,d,e,f)
# define TRACE6(a,b,c,d,e,f,g)
# define TRACE7(a,b,c,d,e,f,g,h)
#endif #endif
#define TRACEC(c) log_c(LOG_TRACE, c); #define TRACEC(c) log_c(LOG_TRACE, c);
#if DEFAULT_LOG_LEVEL >= LOG_VERBOSE
# define VERBOSE(m, ...) log_msg(LOG_VERBOSE, m, ##__VA_ARGS__)
#else
# define VERBOSE(m, ...)
#endif
#define VERBOSEC(c) log_c(LOG_VERBOSE, c);
#endif #endif

View file

@ -49,8 +49,8 @@ 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); INFO("proc_exec start: %d", start);
log_num(LOG_INFO, "proc_exec stack: ", stack); INFO("proc_exec stack: %d", stack);
g_proc_result = 0; g_proc_result = 0;
call_user(start, stack, argc, argv); call_user(start, stack, argc, argv);
@ -68,7 +68,7 @@ typedef void (*thunk)();
* Inputs: * Inputs:
*/ */
SYSTEMCALL void proc_exit(int result) { SYSTEMCALL void proc_exit(int result) {
INFO1("proc_exit: %d", result); INFO("proc_exit: %d", result);
g_proc_result = result; g_proc_result = result;
if (proc_shell_address != 0) { if (proc_shell_address != 0) {
INFO("proc_exit: Attempting to call into shell"); INFO("proc_exit: Attempting to call into shell");
@ -118,7 +118,7 @@ SYSTEMCALL int proc_get_result() {
*/ */
SYSTEMCALL short proc_run(const char * path, int argc, char * argv[]) { SYSTEMCALL short proc_run(const char * path, int argc, char * argv[]) {
TRACE1("proc_run(\"%s\")", path); TRACE("proc_run(\"%s\")", path);
/* TODO: allow for commands without extensions */ /* TODO: allow for commands without extensions */
/* TODO: allow for a search PATH */ /* TODO: allow for a search PATH */
@ -131,11 +131,11 @@ SYSTEMCALL short proc_run(const char * path, int argc, char * argv[]) {
proc_exec(start, k_default_stack, argc, argv); proc_exec(start, k_default_stack, argc, argv);
return 0; return 0;
} else { } else {
ERROR1("Couldn't execute file: %d", result); ERROR("Couldn't execute file: %d", result);
return ERR_NOT_EXECUTABLE; return ERR_NOT_EXECUTABLE;
} }
} else { } else {
ERROR1("Couldn't load file: %d", result); ERROR("Couldn't load file: %d", result);
return result; return result;
} }
} }

View file

@ -36,11 +36,11 @@ void print_c(short channel, char c) {
* message = the ASCII-Z string to print * message = the ASCII-Z string to print
*/ */
void print(short channel, const char * message) { void print(short channel, const char * message) {
TRACE1("print(%d,..)", channel); TRACE("print(%d,..)", channel);
short ret = sys_chan_write(channel, (const unsigned char *)message, strlen(message)); short ret = sys_chan_write(channel, (const unsigned char *)message, strlen(message));
if (ret < 0) if (ret < 0)
ERROR1("Error while printing: %d", ret); ERROR("Error while printing: %d", ret);
} }
/** /**

View file

@ -84,7 +84,7 @@ void initialize() {
/* Setup logging early */ /* Setup logging early */
log_init(); log_init();
log_setlevel(DEFAULT_LOG_LEVEL); log_setlevel(DEFAULT_LOG_LEVEL);
INFO5("\n\rFoenix Toolbox v%d.%02d.%04d built on %s %s starting up...", VER_MAJOR, VER_MINOR, VER_BUILD, __DATE__, __TIME__); INFO("\n\rFoenix Toolbox v%d.%02d.%04d built on %s %s starting up...", VER_MAJOR, VER_MINOR, VER_BUILD, __DATE__, __TIME__);
/* Fill out the system information */ /* Fill out the system information */
sys_get_information(&info); sys_get_information(&info);
@ -133,7 +133,7 @@ void initialize() {
INFO("Text system initialized."); INFO("Text system initialized.");
INFO1("Top of memory: %lx", mem_get_ramtop()); INFO("Top of memory: %lx", mem_get_ramtop());
/* Initialize the indicators */ /* Initialize the indicators */
ind_init(); ind_init();
@ -164,7 +164,7 @@ void initialize() {
INFO("Block device system ready."); INFO("Block device system ready.");
if ((res = con_install())) { if ((res = con_install())) {
log_num(LOG_ERROR, "FAILED: Console installation", res); ERROR("FAILED: Console installation: %d", res);
} else { } else {
INFO("Console installed."); INFO("Console installed.");
} }
@ -190,21 +190,21 @@ void initialize() {
#if HAS_PATA #if HAS_PATA
if ((res = pata_install())) { if ((res = pata_install())) {
log_num(LOG_ERROR, "FAILED: PATA driver installation", res); ERROR("FAILED: PATA driver installation: %d", res);
} else { } else {
INFO("PATA driver installed."); INFO("PATA driver installed.");
} }
#endif #endif
if ((res = sdc_install())) { if ((res = sdc_install())) {
ERROR1("FAILED: SDC driver installation %d", res); ERROR("FAILED: SDC driver installation %d", res);
} else { } else {
INFO("SDC driver installed."); INFO("SDC driver installed.");
} }
#if HAS_FLOPPY #if HAS_FLOPPY
if ((res = fdc_install())) { if ((res = fdc_install())) {
ERROR1("FAILED: Floppy drive initialization %d", res); ERROR("FAILED: Floppy drive initialization %d", res);
} else { } else {
INFO("Floppy drive initialized."); INFO("Floppy drive initialized.");
} }
@ -213,9 +213,9 @@ void initialize() {
// At this point, we should be able to call into to console to print to the screens // At this point, we should be able to call into to console to print to the screens
// if ((res = ps2_init())) { // if ((res = ps2_init())) {
// ERROR1("FAILED: PS/2 keyboard initialization", res); // ERROR("FAILED: PS/2 keyboard initialization: %d", res);
// } else { // } else {
// log(LOG_INFO, "PS/2 keyboard initialized."); // INFO("PS/2 keyboard initialized.");
// } // }
// Initialize the keyboard // Initialize the keyboard
@ -224,36 +224,36 @@ void initialize() {
#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); ERROR("FAILED: A2560K built-in keyboard initialization: %d", res);
} else { } else {
log(LOG_INFO, "A2560K built-in keyboard initialized."); INFO("A2560K built-in keyboard initialized.");
} }
#endif #endif
#if HAS_PARALLEL_PORT #if HAS_PARALLEL_PORT
if ((res = lpt_install())) { if ((res = lpt_install())) {
log_num(LOG_ERROR, "FAILED: LPT installation", res); ERROR("FAILED: LPT installation: %d", res);
} else { } else {
log(LOG_INFO, "LPT installed."); INFO("LPT installed.");
} }
#endif #endif
#if HAS_MIDI_PORTS #if HAS_MIDI_PORTS
if ((res = midi_install())) { if ((res = midi_install())) {
log_num(LOG_ERROR, "FAILED: MIDI installation", res); ERROR("FAILED: MIDI installation: %d", res);
} else { } else {
log(LOG_INFO, "MIDI installed."); INFO("MIDI installed.");
} }
#endif #endif
if ((res = uart_install())) { if ((res = uart_install())) {
log_num(LOG_ERROR, "FAILED: serial port initialization", res); ERROR("FAILED: serial port initialization: %d", res);
} else { } else {
log(LOG_INFO, "Serial ports initialized."); INFO("Serial ports initialized.");
} }
if ((res = fsys_init())) { if ((res = fsys_init())) {
log_num(LOG_ERROR, "FAILED: file system initialization", res); ERROR("FAILED: file system initialization: %d", res);
} else { } else {
INFO("File system initialized."); INFO("File system initialized.");
} }