sys_get_info

Updated sys_get_info and connections to FPGA registers.
This commit is contained in:
Peter Weingartner 2021-11-12 16:42:24 -05:00
parent 10517ad6ae
commit fc9605a724
17 changed files with 6382 additions and 9597 deletions

2
.gitignore vendored
View file

@ -60,3 +60,5 @@ src/foenixmcp_u_20201020.bin
src/foenixmcp.bin
src/foenixmcp_ram.bin
src/foenixmcp_flash.bin
src/bin/archive/foenixmcp_u_flash_20211111_03.bin
src/bin/archive/foenixmcp_u_flash_20211112_06.bin

View file

@ -63,31 +63,31 @@ def program_flash(port, filename, hex_address):
address = base_address
print("About to upload image to address 0x{:X}".format(address), flush=True)
if os.path.getsize(filename) == FLASH_SIZE:
if confirm("Are you sure you want to reprogram the flash memory? (y/n): "):
with open(filename, "rb") as f:
c256 = foenix.FoenixDebugPort()
#if os.path.getsize(filename) == FLASH_SIZE:
if confirm("Are you sure you want to reprogram the flash memory? (y/n): "):
with open(filename, "rb") as f:
c256 = foenix.FoenixDebugPort()
try:
c256.open(port)
c256.enter_debug()
try:
c256.open(port)
c256.enter_debug()
try:
block = f.read(CHUNK_SIZE)
while block:
c256.write_block(address, block)
address += len(block)
block = f.read(CHUNK_SIZE)
while block:
c256.write_block(address, block)
address += len(block)
block = f.read(CHUNK_SIZE)
print("Binary file uploaded...", flush=True)
c256.erase_flash()
print("Flash memory erased...", flush=True)
c256.program_flash(base_address)
print("Flash memory programmed...")
finally:
c256.exit_debug()
print("Binary file uploaded...", flush=True)
c256.erase_flash()
print("Flash memory erased...", flush=True)
c256.program_flash(base_address)
print("Flash memory programmed...")
finally:
c256.close()
else:
print("The provided flash file is not the right size.")
c256.exit_debug()
finally:
c256.close()
# else:
# print("The provided flash file is not the right size.")
def dereference(port, file, label):
"""Get the address contained in the pointer with the label in the label file."""
@ -140,7 +140,7 @@ def display(base_address, data):
text_buff = text_buff + "."
else:
text_buff = text_buff + "."
sys.stdout.write(' {}\n'.format(text_buff))
def send_wdc(port, filename):
@ -161,7 +161,7 @@ def send_wdc(port, filename):
finally:
infile.close()
finally:
c256.close()
c256.close()
def send_srec(port, filename):
"""Send the data in the SREC hex file 'filename' to the C256 on the given serial port."""
@ -257,7 +257,7 @@ parser.add_argument("--lookup", metavar="LABEL", dest="lookup_name",
help="Display the memory starting at the address indicated by the label.")
parser.add_argument("--revision", action="store_true", dest="revision",
help="Display the revision code of the debug interface.")
help="Display the revision code of the debug interface.")
parser.add_argument("--flash", metavar="BINARY FILE", dest="flash_file",
help="Attempt to reprogram the flash using the binary file provided.")
@ -321,4 +321,3 @@ try:
parser.print_help()
finally:
print

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -27,8 +27,8 @@ export CC = vc
export DEFINES = -DCPU=$(CPU) -DMODEL=$(MODEL) -DVER_MAJOR=$(VER_MAJOR) -DVER_MINOR=$(VER_MINOR) -DVER_BUILD=$(VER_BUILD) # -DKBD_POLLED
ifeq ($(OS),Windows_NT)
export CFLAGS = +$(VBCC)/config/m68k-foenix -I. -I$(CURDIR)/include -I$(CURDIR)
#export CFLAGS = +$(VBCC)/config/a2560u_flash -I. -I$(CURDIR)/include -I$(CURDIR)
# export CFLAGS = +$(VBCC)/config/m68k-foenix -I. -I$(CURDIR)/include -I$(CURDIR)
export CFLAGS = +$(VBCC)/config/a2560u_flash -I. -I$(CURDIR)/include -I$(CURDIR)
export RM = cmd /C del /Q /F
else
export CFLAGS = +$(VBCC)/config/m68k-foenix-linux -I. -I$(CURDIR)/include -I$(CURDIR)

View file

@ -134,29 +134,30 @@ short cmd_sysinfo(short channel, int argc, char * argv[]) {
char buffer[80];
sys_get_info(&info);
print(channel, "System information:\nModel: ");
print(channel, info.model_name);
print(channel, "\nCPU: ");
print(channel, info.cpu_name);
sprintf(buffer, "System information:\nModel: %s", info.model_name);
sys_chan_write(channel, buffer, strlen(buffer));
print(channel, "\nMemory: ");
print_hex_32(channel, info.system_ram_size);
sprintf(buffer, "\nCPU: %s", info.cpu_name);
sys_chan_write(channel, buffer, strlen(buffer));
print(channel, "\nGABE version: ");
print_hex_16(channel, info.gabe_number);
print(channel, ".");
print_hex_16(channel, info.gabe_version);
print(channel, ".");
print_hex_16(channel, info.gabe_subrev);
sprintf(buffer, "\nSystem Memory: 0x%X", info.system_ram_size);
sys_chan_write(channel, buffer, strlen(buffer));
print(channel, "\nVICKY version: ");
print_hex_16(channel, info.vicky_rev);
sprintf(buffer, "\nPCB version: %s", &info.pcb_version);
sys_chan_write(channel, buffer, strlen(buffer));
sprintf(buffer, "\nMCP version: v%02d.%02d.%04d", info.mcp_version, info.mcp_rev, info.mcp_build);
print(channel, buffer);
sprintf(buffer, "\nFPGA Date: %08X", info.fpga_date);
sys_chan_write(channel, buffer, strlen(buffer));
print(channel, "\n");
sprintf(buffer, "\nFPGA Model: %08X", info.fpga_model);
sys_chan_write(channel, buffer, strlen(buffer));
sprintf(buffer, "\nFPGA Version: %04X.%04X", info.fpga_version, info.fpga_subver);
sys_chan_write(channel, buffer, strlen(buffer));
sprintf(buffer, "\nMCP version: v%02d.%02d.%04d\n", info.mcp_version, info.mcp_rev, info.mcp_build);
sys_chan_write(channel, buffer, strlen(buffer));
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,21 @@
#define GABE_LFSR_DATA ((volatile unsigned short *)0x00B00008) // Read Only
#define GABE_LFSR_STAT ((volatile unsigned short *)0x00B0000A) // Read Only
#define GABE_MACHINE_ID ((volatile unsigned short *)0x00B0000C) // Machine ID - Read Only
#define GABE_MACH_ID_MASK 0x0003 // 1001 = A2560U and U+
#define GABE_MEMORY_BANKS 0x00C0 // 10 = 2 MB, 11 = 4 MB
#define GABE_CPU_SPEED 0x0F00
#define GABE_CPU_ID 0xF000 // 0000 = MC68SEC000 @ 20MHz
#define FPGA_DATE_YEAR ((volatile unsigned short *)0x00B40030) // YYYY
#define FPGA_DATE_MONTHDAY ((volatile unsigned short *)0x00B40032) // MMDD
#define PCB_REV_1 ((volatile unsigned short *)0x00B40034) // Null terminated string describing the PCB
#define PCB_REV_2 ((volatile unsigned short *)0x00B40036)
#define FPGA_SUBVER ((volatile unsigned short *)0x00B40038)
#define FPGA_VER ((volatile unsigned short *)0x00B4003A)
#define FPGA_MODEL_L ((volatile unsigned short *)0x00B4003C)
#define FPGA_MODEL_H ((volatile unsigned short *)0x00B4003E)
#define GABE_CHIP_SUBREV ((volatile unsigned short *)0x00B0000E)
#define GABE_CHIP_VERSION ((volatile unsigned short *)0x00B00010)

View file

@ -31,6 +31,7 @@
#define KFN_INT_DISABLE_ALL 0x06 /* Disable all interrupts */
#define KFN_INT_CLEAR 0x07 /* Clear (acknowledge) an interrupt */
#define KFN_INT_PENDING 0x08 /* Return true if the interrupt is pending */
#define KFN_SYS_GET_INFO 0x09 /* Get information about the computer */
/* Channel system calls */
@ -164,6 +165,14 @@ extern p_int_handler sys_int_register(unsigned short n, p_int_handler handler);
*/
extern short sys_int_pending(unsigned short n);
/*
* Fill out a s_sys_info structure with the information about the current system
*
* Inputs:
* info = pointer to a s_sys_info structure to fill out
*/
extern void sys_get_info(p_sys_info info);
/*
* Acknowledge an interrupt (clear out its pending flag)
*

View file

@ -60,6 +60,10 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
case KFN_INT_PENDING:
return int_pending((unsigned short)param0);
case KFN_SYS_GET_INFO:
sys_get_information((p_sys_info)param0);
return;
default:
break;
}

View file

@ -126,9 +126,9 @@ coldboot: lea ___STACK,sp
move.l #___BSSSIZE,d0
beq callmain
clrloop: clr.l (a0)+
subq.l #4,d0
bne clrloop
; clrloop: clr.l (a0)+
; subq.l #4,d0
; bne clrloop
; Set TRAP #15 vector handler
lea h_trap_15,a0 ; Address of the handler

12490
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@
* Inputs:
* info = pointer to a s_MODEL_info structure to fill out
*/
void sys_get_info(p_sys_info info) {
void sys_get_information(p_sys_info info) {
unsigned short machine_id = *GABE_MACHINE_ID;
info->mcp_version = VER_MAJOR;
@ -16,6 +16,8 @@ void sys_get_info(p_sys_info info) {
info->has_floppy = 0;
info->system_ram_size = 0x200000;
#if MODEL == MODEL_FOENIX_A2560K
info->model = MODEL_FOENIX_A2560K;
info->model_name = "Foenix A2560K";
@ -45,9 +47,16 @@ void sys_get_info(p_sys_info info) {
break;
case 0x09:
info->model = MODEL_FOENIX_A2560U;
info->model_name = "Foenix A2560U";
info->cpu_name = "m68000";
info->cpu_name = "MC68SEC000";
if ((machine_id & GABE_MEMORY_BANKS) == 0xC0) {
info->system_ram_size = 0x400000;
info->model_name = "Foenix A2560U+";
info->model = MODEL_FOENIX_A2560U;
} else {
info->system_ram_size = 0x200000;
info->model_name = "Foenix A2560U";
info->model = MODEL_FOENIX_A2560U_PLUS;
}
break;
default:
@ -61,24 +70,29 @@ void sys_get_info(p_sys_info info) {
switch ((machine_id & 0xf000) >> 12) {
case 0x00:
info->cpu = CPU_M68000;
info->cpu_name = "m68000";
info->cpu_name = "MC68SEC000";
break;
default:
/* Unknown CPU */
info->cpu = 0xffff;
info->cpu_name = "Unknown";
break;
}
#endif
info->gabe_number = *GABE_CHIP_NUMBER;
info->gabe_version = *GABE_CHIP_VERSION;
info->gabe_subrev = *GABE_CHIP_SUBREV;
info->fpga_date = *FPGA_DATE_YEAR << 16 | *FPGA_DATE_MONTHDAY;
info->fpga_model = *FPGA_MODEL_H << 16 | *FPGA_MODEL_L;
info->fpga_version = *FPGA_VER;
info->fpga_subver = *FPGA_SUBVER;
info->pcb_version[0] = (*PCB_REV_1 & 0xFF00) >> 8;
info->pcb_version[1] = *PCB_REV_1 & 0xFF;
info->pcb_version[2] = (*PCB_REV_2 & 0xFF00) >> 8;
info->pcb_version[3] = 0;
info->vicky_rev = 0x0000; /* TODO: get this from VICKY */
info->system_ram_size = 0; /* TODO: compute this by testing RAM */
info->has_expansion_card = 0; /* TODO: figure this out by checking with GABE */
info->has_hard_drive = 0; /* TODO: figure this out by checking with GABE */
@ -104,20 +118,4 @@ void sys_get_info(p_sys_info info) {
// }
break;
}
/* Set the memory */
switch (info->model) {
case MODEL_FOENIX_A2560K:
info->system_ram_size = 0x800000;
break;
case MODEL_FOENIX_A2560U_PLUS:
case MODEL_FOENIX_C256U_PLUS:
info->system_ram_size = 0x400000;
break;
default:
info->system_ram_size = 0x200000;
break;
}
}

View file

@ -32,23 +32,25 @@
* Structure to describe the hardware
*/
typedef struct s_sys_info {
unsigned short mcp_version; /* Current version of the MCP kernel */
unsigned short mcp_rev; /* Current revision, or sub-version of the MCP kernel */
unsigned short mcp_build; /* Current vuild # of the MCP kernel */
unsigned short model; /* Code to say what model of machine this is */
const char * model_name; /* Human readable name of the model of the computer */
unsigned short cpu; /* Code to say which CPU is running */
const char * cpu_name; /* Human readable name for the CPU */
unsigned short gabe_number; /* GABE revision information */
unsigned short gabe_version;
unsigned short gabe_subrev;
unsigned short vicky_rev; /* Code for the VICKY revision number */
long system_ram_size; /* The number of bytes of system RAM on the board */
bool has_floppy; /* TRUE if the board has a floppy drive installed */
bool has_hard_drive; /* TRUE if the board has a PATA device installed */
bool has_expansion_card; /* TRUE if an expansion card is installed on the device */
bool has_ethernet; /* TRUE if an ethernet port is present */
unsigned short screens; /* How many screens are on this computer */
unsigned short mcp_version; /* Current version of the MCP kernel */
unsigned short mcp_rev; /* Current revision, or sub-version of the MCP kernel */
unsigned short mcp_build; /* Current vuild # of the MCP kernel */
unsigned short model; /* Code to say what model of machine this is */
const char * model_name; /* Human readable name of the model of the computer */
unsigned short cpu; /* Code to say which CPU is running */
const char * cpu_name; /* Human readable name for the CPU */
unsigned long fpga_date; /* BCD date describing the date of the FPGA built: YYYYMMDD */
char pcb_version[4]; /* PCB version (string) */
unsigned long fpga_model; /* FPGA model number */
unsigned short fpga_version; /* FPGA version */
unsigned short fpga_subver; /* FPGA sub-version */
unsigned short vicky_rev; /* Code for the VICKY revision number */
long system_ram_size; /* The number of bytes of system RAM on the board */
bool has_floppy; /* TRUE if the board has a floppy drive installed */
bool has_hard_drive; /* TRUE if the board has a PATA device installed */
bool has_expansion_card; /* TRUE if an expansion card is installed on the device */
bool has_ethernet; /* TRUE if an ethernet port is present */
unsigned short screens; /* How many screens are on this computer */
} t_sys_info, *p_sys_info;
/*
@ -57,6 +59,6 @@ typedef struct s_sys_info {
* Inputs:
* info = pointer to a s_sys_info structure to fill out
*/
extern void sys_get_info(p_sys_info info);
extern void sys_get_information(p_sys_info info);
#endif

View file

@ -56,6 +56,16 @@ void sys_int_enable(unsigned short n) {
syscall(KFN_INT_ENABLE, n);
}
/*
* Fill out a s_sys_info structure with the information about the current system
*
* Inputs:
* info = pointer to a s_sys_info structure to fill out
*/
void sys_get_info(p_sys_info info) {
syscall(KFN_SYS_GET_INFO, info);
}
/*
* Register a handler for a given interrupt.
*

View file

@ -20,8 +20,8 @@ SECTIONS
{
vectors : { *(VECTORS) } >vectors AT>binpage0
text : {*(CODE)} >flash AT>binpages
.dtors : { *(.dtors) } >flash AT>binpages
.ctors : { *(.ctors) } >flash AT>binpages
.dtors : { *(.dtors) } >ram AT>binpage0
.ctors : { *(.ctors) } >ram AT>binpage0
rodata : {*(RODATA)} >flash AT>binpages
data: {*(DATA)} >ram
bss (NOLOAD): {*(BSS)} >ram