Some work on the RTC and a splashscreen (not working)

This commit is contained in:
Peter Weingartner 2021-10-22 19:23:05 -04:00
parent 509955ad2a
commit 8d2b294672
9 changed files with 8066 additions and 7872 deletions

View file

@ -19,8 +19,8 @@ export CPU=32
export MODEL=9 export MODEL=9
export VER_MAJOR = 0 export VER_MAJOR = 0
export VER_MINOR = 0 export VER_MINOR = 1
export VER_BUILD = 1 export VER_BUILD = 2
export AS = vasmm68k_mot export AS = vasmm68k_mot
export ASFLAGS = -quiet -Fvobj -nowarn=62 export ASFLAGS = -quiet -Fvobj -nowarn=62

View file

@ -13,7 +13,12 @@
#include "cli/cli.h" #include "cli/cli.h"
#include "cli/dos_cmds.h" #include "cli/dos_cmds.h"
#include "cli/mem_cmds.h" #include "cli/mem_cmds.h"
#include "dev/ps2.h"
#include "dev/rtc.h" #include "dev/rtc.h"
#include "dev/uart.h"
#include "uart_reg.h"
#include "rtc_reg.h"
#include "vicky_general.h"
#define MAX_COMMAND_SIZE 128 #define MAX_COMMAND_SIZE 128
#define MAX_ARGC 32 #define MAX_ARGC 32
@ -35,6 +40,9 @@ extern short cmd_settime(short channel, int argc, char * argv[]);
extern short cmd_sysinfo(short channel, int argc, char * argv[]); extern short cmd_sysinfo(short channel, int argc, char * argv[]);
extern short cmd_cls(short channel, int argc, char * argv[]); extern short cmd_cls(short channel, int argc, char * argv[]);
extern short cmd_showint(short channel, int argc, char * argv[]); extern short cmd_showint(short channel, int argc, char * argv[]);
extern short cmd_testuart(short channel, int argc, char * argv[]);
extern short cmd_get_ticks(short channel, int argc, char * argv[]);
extern short cmd_testrtc(short channel, int argc, char * argv[]);
/* /*
* Variables * Variables
@ -64,12 +72,15 @@ const t_cli_command g_cli_commands[] = {
{ "PWD", "PWD : prints the current directory", cmd_pwd }, { "PWD", "PWD : prints the current directory", cmd_pwd },
// { "REN", "REN <old path> <new path> : rename a file or directory", cmd_rename }, // { "REN", "REN <old path> <new path> : rename a file or directory", cmd_rename },
{ "RUN", "RUN <path> : execute a binary file", cmd_run }, { "RUN", "RUN <path> : execute a binary file", cmd_run },
{ "GETTICKS", "GETTICKS : print number of ticks since reset", cmd_get_ticks },
{ "GETTIME", "GETTIME : prints the current time", cmd_gettime }, { "GETTIME", "GETTIME : prints the current time", cmd_gettime },
{ "SETTIME", "SETTIME yyyy-mm-dd HH:MM:SS : sets the current time", cmd_settime }, { "SETTIME", "SETTIME yyyy-mm-dd HH:MM:SS : sets the current time", cmd_settime },
{ "SHOWINT", "SHOWINT : Show information about the interrupt registers", cmd_showint }, { "SHOWINT", "SHOWINT : Show information about the interrupt registers", cmd_showint },
{ "SYSINFO", "SYSINFO : prints information about the system", cmd_sysinfo }, { "SYSINFO", "SYSINFO : prints information about the system", cmd_sysinfo },
{ "TESTIDE", "TESTIDE : fetches and prints the IDE MBR repeatedly", cmd_testide }, { "TESTIDE", "TESTIDE : fetches and prints the IDE MBR repeatedly", cmd_testide },
{ "TESTCREATE", "TESTCREATE <path> : tries to create a file", cmd_testcreate }, { "TESTCREATE", "TESTCREATE <path> : tries to create a file", cmd_testcreate },
{ "TESTRTC", "TESTRTC : poll the RTC for a periodic interrupt", cmd_testrtc },
{ "TESTUART", "TESTUART : echo key presses between terminal and console", cmd_testuart },
{ "TYPE", "TYPE <path> : print the contents of a text file", cmd_type }, { "TYPE", "TYPE <path> : print the contents of a text file", cmd_type },
{ 0, 0 } { 0, 0 }
}; };
@ -87,6 +98,68 @@ int cmd_help(short channel, int argc, char * argv[]) {
return 0; return 0;
} }
/*
* Try using the RTC periodic interrupt in polled mode
*/
short cmd_testrtc(short channel, int argc, char * argv[]) {
char buffer[80];
char * spinner = "|/-\\";
short count = 0;
int_enable(INT_RTC);
*RTC_RATES = 0xfe; /* Periodic interrupt rate: 0.5 s */
*RTC_ENABLES = RTC_PIE; /* Turn on the periodic interrupt */
while (1) {
if (*RTC_FLAGS & RTC_PF) {
/* We got the periodic interrupt */
ScreenText_A[0] = spinner[count];
ColorText_A[0] = 0x14;
if (count++ >= strlen(spinner) - 1) {
count = 0;
}
}
}
}
/*
* Print the number of ticks since last restart
*/
short cmd_get_ticks(short channel, int argc, char * argv[]) {
char buffer[80];
sprintf(buffer, "%d\n", rtc_get_ticks());
sys_chan_write(channel, buffer, strlen(buffer));
return 0;
}
short cmd_testuart(short channel, int argc, char * argv[]) {
char c;
char buffer[80];
uart_init(0);
uart_setbps(0, UART_115200);
uart_setlcr(0, LCR_DATABITS_8 | LCR_STOPBIT_1 | LCR_PARITY_NONE);
sprintf(buffer, "COM1: 115200, no parity, 1 stop bit, 8 data bits\nPress ESC to finish.\n");
sys_chan_write(0, buffer, strlen(buffer));
while (1) {
c = kbd_getc();
if (c != 0) {
if (c == 0x1b) {
return 0;
}
uart_put(0, c);
} else if (uart_has_bytes(0)) {
c = uart_get(0);
sys_chan_write_b(channel, c);
}
}
}
/* /*
* Clear the screen * Clear the screen
*/ */

View file

@ -10,11 +10,25 @@
#include "simpleio.h" #include "simpleio.h"
static long rtc_ticks; static long rtc_ticks;
static long sof_ticks;
/*
* Handle SOF interrupts... these are assumed to be about 1/60 sec apart
* and will be used to drive the tick counter
*/
void sof_handle_int() {
int_clear(INT_SOF_A);
sof_ticks++;
}
/* /*
* Interrupt handler for the real time clock * Interrupt handler for the real time clock
*/ */
void rtc_handle_int() { void rtc_handle_int() {
char buffer[80];
char * spinner = "|/-\\";
short count = 0;
unsigned char flags; unsigned char flags;
//flags = *RTC_FLAGS; //flags = *RTC_FLAGS;
@ -39,24 +53,25 @@ void rtc_init() {
unsigned char enables; unsigned char enables;
int_disable(INT_RTC); int_disable(INT_RTC);
int_disable(INT_SOF_A);
/* Reset the ticks counter */ /* Reset the ticks counter */
rtc_ticks = 0; sof_ticks = 0;
/* Set the periodic interrupt to 976.5625 microseconds */ /* Set the periodic interrupt to 976.5625 microseconds */
*RTC_RATES = RTC_RATE_976us; *RTC_RATES = 0; // RTC_RATE_976us;
/* Enable the periodic interrupt */ /* Enable the periodic interrupt */
// *RTC_RATES = 0; // *RTC_RATES = 0;
*RTC_ENABLES = RTC_PIE; *RTC_ENABLES = 0; // RTC_PIE;
/* Make sure the RTC is on */ /* Make sure the RTC is on */
*RTC_CTRL = RTC_STOP; *RTC_CTRL = RTC_STOP;
/* Register our interrupt handler and clear out any pending interrupts */ /* Register our interrupt handler and clear out any pending interrupts */
int_register(INT_RTC, rtc_handle_int); int_register(INT_SOF_A, sof_handle_int);
int_clear(INT_RTC); int_clear(INT_SOF_A);
int_enable(INT_RTC); int_enable(INT_SOF_A);
} }
/* /*
@ -212,6 +227,14 @@ void rtc_get_time(p_time time) {
time->second = bcd_to_i(second_bcd); time->second = bcd_to_i(second_bcd);
} }
/*
* Get the number of jiffies since the system last reset.
* A "jiffy" should be considered to be 1/60 second.
*/
long rtc_get_jiffies() {
return sof_ticks;
}
/* /*
* Get the number of ticks since the system last booted. * Get the number of ticks since the system last booted.
* *
@ -226,9 +249,7 @@ void rtc_get_time(p_time time) {
long rtc_get_ticks() { long rtc_get_ticks() {
long result = 0; long result = 0;
int_disable(INT_RTC); /* Make sure we aren't changing the tick counter during the query */ result = sof_ticks;
result = rtc_ticks;
int_enable(INT_RTC);
return rtc_ticks; return rtc_ticks;
} }

View file

@ -50,4 +50,10 @@ extern void rtc_get_time(p_time time);
*/ */
extern long rtc_get_ticks(); extern long rtc_get_ticks();
/*
* Get the number of jiffies since the system last reset.
* A "jiffy" should be considered to be 1/60 second.
*/
extern long rtc_get_jiffies();
#endif #endif

View file

@ -90,43 +90,50 @@ const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
*LED2_REG = 0x02; *LED2_REG = 0x02;
} }
#endif #endif
//
// /* /*
// * Load and display the splash screen * Load and display the splash screen
// */ */
// void load_splashscreen() { void load_splashscreen() {
// int i; int i;
//
// /* Turn off the screen */ /* Turn off the screen */
// *MasterControlReg_A = VKY3_MCR_BLANK_EN; *MasterControlReg_A = VKY3_MCR_BLANK_EN;
//
// /* Copy the splash screen LUT */ for (i = 0; i < 256; i++) {
// for (i = 0; i < sizeof(splash_screen_cmap); i++) { LUT_0[4*i] = 0;
// LUT_0[i] = splash_screen_cmap[i][0]; LUT_0[4*i+1] = i;
// LUT_0[i+1] = splash_screen_cmap[i][1]; LUT_0[4*i+2] = i;
// LUT_0[i+2] = splash_screen_cmap[i][2]; LUT_0[4*i+3] = 0;
// } }
//
// /* Copy the bitmap to video RAM */
// for (i = 0; i < sizeof(splash_screen_bmap); i++) { /* Copy the bitmap to video RAM */
// VRAM_Bank0[i] = i * 0xff; // splash_screen_bmap[i]; for (i = 0; i < 320*240; i++) {
// } VRAM_Bank0[i] = i * 0xff; // splash_screen_bmap[i];
// }
// /* Set up the bitmap */
// *BM0_Addy_Pointer_Reg = 0; /* Set up the bitmap */
// *BM0_Control_Reg = 1; *BM0_Addy_Pointer_Reg = 0;
// *BM0_Control_Reg = 1;
// /* Turn off the border */
// *BorderControlReg_L_A = 0; /* Turn off the border */
// *BorderControlReg_L_A = 0;
// /* Set a background color for the bitmap mode */
// *BackGroundControlReg_A = 0x00800080; /* Set a background color for the bitmap mode */
// *BackGroundControlReg_A = 0x00800000;
// /* Display the splashscreen: 320x200 */
// *MasterControlReg_A = 0x000000fD | VKY3_MCR_DOUBLE_EN; /* Display the splashscreen: 320x200 */
// *MasterControlReg_A = 0x000000fD | VKY3_MCR_DOUBLE_EN;
// for (i = 0; i < 4096*1024; i++) ;
// } /* Play the SID test bong on the Gideon SID implementation */
sid_test_internal();
for (i = 0; i < 2048*1024; i++) ;
/* Initialize the text channels */
text_init();
}
void print_error(short channel, char * message, short code) { void print_error(short channel, char * message, short code) {
print(channel, message); print(channel, message);
@ -148,9 +155,6 @@ void initialize() {
// /* Hide the mouse */ // /* Hide the mouse */
mouse_set_visible(0); mouse_set_visible(0);
/* Display the splash screen */
// load_splashscreen();
/* Initialize the text channels */ /* Initialize the text channels */
text_init(); text_init();
@ -176,8 +180,8 @@ void initialize() {
/* Initialize the SID chips */ /* Initialize the SID chips */
sid_init_all(); sid_init_all();
/* Play the SID test bong on the Gideon SID implementation */ /* Display the splash screen */
sid_test_internal(); load_splashscreen();
cdev_init_system(); // Initialize the channel device system cdev_init_system(); // Initialize the channel device system
log(LOG_INFO, "Channel device system ready."); log(LOG_INFO, "Channel device system ready.");
@ -192,7 +196,7 @@ void initialize() {
} }
/* Initialize the real time clock */ /* Initialize the real time clock */
rtc_init(); // rtc_init();
if (res = pata_install()) { if (res = pata_install()) {
log_num(LOG_ERROR, "FAILED: PATA driver installation", res); log_num(LOG_ERROR, "FAILED: PATA driver installation", res);

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -12,8 +12,8 @@
#define UART2_BASE 0x00C022F8 /* Base address for UART 2 (COM2) */ #define UART2_BASE 0x00C022F8 /* Base address for UART 2 (COM2) */
#elif MODEL == MODEL_FOENIX_A2560U || MODEL == MODEL_FOENIX_A2560U_PLUS #elif MODEL == MODEL_FOENIX_A2560U || MODEL == MODEL_FOENIX_A2560U_PLUS
#define UART1_BASE 0x00B02808 /* Base address for UART 1 (COM1) */ #define UART1_BASE 0x00B028F8 /* Base address for UART 1 (COM1) */
#define UART2_BASE 0x00B02809 /* Base address for UART 2 (COM2) */ #define UART2_BASE 0x00B028F9 /* Base address for UART 2 (COM2) */
#endif #endif

10734
src/mapfile

File diff suppressed because it is too large Load diff