Corrected gitignore

Linker script and libraries should be included
This commit is contained in:
Peter Weingartner 2021-10-14 17:20:19 -04:00
parent f94cb333f5
commit 0ad2ff8c6c
16 changed files with 15267 additions and 7593 deletions

5
.gitignore vendored
View file

@ -18,7 +18,6 @@
# Libraries
*.lib
*.a
*.la
*.lo
@ -44,15 +43,11 @@
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
samples/HelloPGX/hello.pgx
samples/HelloPGX/hello.pgx
samples/HelloPGX/hello.lst
src/mapfile
src/mapfile
src/mapfile

View file

@ -14,13 +14,6 @@
#define PS2_RETRY_MAX 20000 /* For timeout purposes when sending a command */
#define PS2_RESEND_MAX 50 /* Number of times we'll repeat a command on receiving a 0xFE reply */
/*
* Controller responses
*/
#define PS2_RESP_OK 0x55 /* Keyboard response: Command was OK */
#define PS2_RESP_ACK 0xFA /* Keyboard response: command acknowledged */
/*
* Modifier bit flags
*/
@ -259,10 +252,9 @@ char g_us_sc_ctrl_shift[] = {
* 0 if successful, -1 if there was no response after PS2_RETRY_MAX tries
*/
short ps2_wait_out() {
volatile unsigned char *status = (unsigned char *)PS2_STATUS;
short count = 0;
while ((*status & PS2_STAT_OBF) == 0) {
while ((*PS2_STATUS & PS2_STAT_OBF) == 0) {
if (count++ > PS2_RETRY_MAX) {
return -1;
}
@ -278,10 +270,9 @@ short ps2_wait_out() {
* 0 if successful, -1 if there was no response after PS2_RETRY_MAX tries
*/
short ps2_wait_in() {
volatile unsigned char *status = (unsigned char *)PS2_STATUS;
short count = 0;
while ((*status & PS2_STAT_IBF) != 0) {
while ((*PS2_STATUS & PS2_STAT_IBF) != 0) {
if (count++ > PS2_RETRY_MAX) {
return -1;
}
@ -297,13 +288,11 @@ short ps2_wait_in() {
* The response from the PS/2 controller, -1 if there was a timeout
*/
short ps2_controller_cmd(unsigned char cmd) {
volatile unsigned char *command = (unsigned char *)PS2_CMD_BUF;
volatile unsigned char *data = (unsigned char *)PS2_DATA_BUF;
if (ps2_wait_in()) return -1;
*command = cmd;
*PS2_CMD_BUF = cmd;
if (ps2_wait_out()) return -1;
return (short)*data;
return (short)*PS2_DATA_BUF;
}
/*
@ -313,14 +302,11 @@ short ps2_controller_cmd(unsigned char cmd) {
* The response from the PS/2 controller, -1 if there was a timeout
*/
short ps2_controller_cmd_param(unsigned char cmd, unsigned char parameter) {
volatile unsigned char *command = (unsigned char *)PS2_CMD_BUF;
volatile unsigned char *data = (unsigned char *)PS2_DATA_BUF;
if (ps2_wait_in()) return -1;
*PS2_CMD_BUF = cmd;
if (ps2_wait_in()) return -1;
*command = cmd;
if (ps2_wait_in()) return -1;
*data = parameter;
*PS2_DATA_BUF = parameter;
return 0;
}
@ -332,16 +318,13 @@ short ps2_controller_cmd_param(unsigned char cmd, unsigned char parameter) {
* The response from the PS/2 controller, -1 if there was a timeout
*/
short ps2_kbd_cmd_p(unsigned char cmd, unsigned char parameter) {
volatile unsigned char *command = (unsigned char *)PS2_CMD_BUF;
volatile unsigned char *data = (unsigned char *)PS2_DATA_BUF;
if (ps2_wait_in()) return -1;
*data = cmd;
*PS2_DATA_BUF = cmd;
// May need a delay here
if (ps2_wait_in()) return -1;
*data = parameter;
*PS2_DATA_BUF = parameter;
// Return 0 by default... maybe read DATA?
return 0;
@ -358,10 +341,8 @@ short ps2_kbd_cmd_p(unsigned char cmd, unsigned char parameter) {
* The response from the PS/2 controller, -1 if there was a timeout
*/
short ps2_kbd_cmd(unsigned char cmd, short delay) {
volatile unsigned char *data = (unsigned char *)PS2_DATA_BUF;
if (ps2_wait_in()) return -1;
*data = cmd;
*PS2_DATA_BUF = cmd;
// A delay may be needed here
while (delay-- > 0) {
@ -369,18 +350,15 @@ short ps2_kbd_cmd(unsigned char cmd, short delay) {
}
if (ps2_wait_out()) return -1;
return (short)*data;
return (short)*PS2_DATA_BUF;
}
/*
* Read from the PS/2 data port until there are no more bytes ready.
*/
void ps2_flush_out() {
volatile unsigned char *status = (unsigned char *)PS2_STATUS;
volatile unsigned char *data = (unsigned char *)PS2_DATA_BUF;
while (*status & PS2_STAT_OBF) {
unsigned char x = *data;
while (*PS2_STATUS & PS2_STAT_OBF) {
unsigned char x = *PS2_DATA_BUF;
}
}
@ -773,15 +751,15 @@ short ps2_mouse_command(unsigned char cmd) {
short result;
if (ps2_wait_in()) return -10;
if (ps2_wait_in()) return -1;
*PS2_CMD_BUF = MOUSE_CMD_PREFIX;
// log_num(LOG_VERBOSE, "ps_mouse_command command: ", cmd);
if (ps2_wait_in()) return -20;
if (ps2_wait_in()) return -1;
*PS2_DATA_BUF = cmd;
if (ps2_wait_out()) return -30;
if (ps2_wait_out()) return -1;
result = *PS2_DATA_BUF;
// log_num(LOG_VERBOSE, "ps_mouse_command result: ", result);
@ -830,6 +808,29 @@ short ps2_mouse_get_packet() {
return 0;
}
/*
* Set the visibility of the VICKY mouse pointer
*
* Input:
* is_visible = 0 for hide, any other value to show
*/
void mouse_set_visible(short is_visible) {
short i;
if (is_visible != 0) {
*MousePtr_A_CTRL_Reg = MousePtr_En;
} else {
*MousePtr_A_CTRL_Reg = 0;
for (i = 0; i < 256; i++) {
short dest_offset = 2*i;
MousePointer_Mem_A[dest_offset] = 0;
MousePointer_Mem_A[dest_offset+1] = 0;
}
}
}
/*
* Attempt to initialize the PS/2 mouse
*
@ -859,7 +860,7 @@ short mouse_init() {
/* Disable streaming for the moment */
result = ps2_mouse_command_repeatable(MOUSE_CMD_DISABLE);
if (result != 0xFA) {
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_DISABLE: ", result);
return result;
}
@ -867,29 +868,29 @@ short mouse_init() {
/* Set the mouse to default settings */
result = ps2_mouse_command_repeatable(MOUSE_CMD_DEFAULTS);
if (result != 0xFA) {
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_DEFAULTS: ", result);
return result;
}
/* Set resolution to be lowest for 640x480 */
// result = ps2_mouse_command_repeatable(MOUSE_CMD_SETRES);
// if (result != 0xFA) {
// log_num(LOG_ERROR, "MOUSE_CMD_SETRES: ", result);
// return result;
// }
//
// result = ps2_mouse_command_repeatable(0x00);
// if (result != 0xFA) {
// log_num(LOG_ERROR, "MOUSE_CMD_SETRES resolution: ", result);
// return result;
// }
result = ps2_mouse_command_repeatable(MOUSE_CMD_SETRES);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_SETRES: ", result);
return result;
}
result = ps2_mouse_command_repeatable(0x00);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_SETRES resolution: ", result);
return result;
}
/* Enable packet streaming */
result = ps2_mouse_command_repeatable(MOUSE_CMD_ENABLE);
if (result != 0xFA) {
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_ENABLE: ", result);
return result;
}
@ -906,8 +907,7 @@ short mouse_init() {
}
/* Enable the mouse pointer on channel A */
*MousePtr_A_CTRL_Reg = MousePtr_En;
mouse_set_visible(1);
return 0;
}
@ -920,9 +920,8 @@ short mouse_init() {
* Status code indicating if either the mouse or the keyboard is missing.
*/
short ps2_init() {
volatile unsigned char *command = (unsigned char *)PS2_CMD_BUF;
volatile unsigned char *data = (unsigned char *)PS2_DATA_BUF;
unsigned char x;
short mouse_present;
short mouse_error;
short res;
@ -963,12 +962,19 @@ short ps2_init() {
; // return PS2_FAIL_KBDTEST;
}
/* Test if the mouse is working */
if (ps2_controller_cmd(PS2_CTRL_MOUSETEST) == 0) {
mouse_present = 1;
} else {
mouse_present = 0;
}
// Set scancode translation to set1, enable interrupts on mouse and keyboard
ps2_controller_cmd_param(PS2_CTRL_WRITECMD, 0x43);
ps2_controller_cmd_param(PS2_CTRL_WRITECMD, 0x43); /* %01000011 */
// Enable the keyboard, don't check response
ps2_wait_in();
*command = PS2_CTRL_ENABLE_1;
*PS2_CMD_BUF = PS2_CTRL_ENABLE_1;
// Reset the keyboard... waiting a bit before we check for a result
ps2_kbd_cmd(KBD_CMD_RESET, 1000);
@ -978,13 +984,15 @@ short ps2_init() {
// TODO: set the keyboard LEDs
/* Initialize the mouse */
if (mouse_error = mouse_init()) {
log_num(LOG_ERROR, "Unable to initialize mouse", res);
if (mouse_present) {
/* Initialize the mouse */
if (mouse_error = mouse_init()) {
log_num(LOG_ERROR, "Unable to initialize mouse", res);
}
}
ps2_wait_in();
*command = PS2_CTRL_ENABLE_2;
*PS2_CMD_BUF = PS2_CTRL_ENABLE_2;
// Make sure everything is read
ps2_flush_out();
@ -998,7 +1006,7 @@ short ps2_init() {
// Enable the keyboard interrupt
int_enable(INT_KBD_PS2);
if (mouse_error == 0) {
if (mouse_present && (mouse_error == 0)) {
log(LOG_TRACE, "mouse enabled");
// Register the interrupt handler for the mouse

View file

@ -54,4 +54,12 @@ extern char kbd_getc_poll();
*/
extern short ps2_mouse_get_packet();
/*
* Set the visibility of the VICKY mouse pointer
*
* Input:
* is_visible = 0 for hide, any other value to show
*/
extern void mouse_set_visible(short is_visible);
#endif

View file

@ -20,11 +20,13 @@
#include "dev/rtc.h"
#include "dev/sdc.h"
#include "dev/uart.h"
#include "vicky_general.h"
#include "snd/codec.h"
#include "snd/psg.h"
#include "snd/sid.h"
#include "fatfs/ff.h"
#include "cli/cli.h"
#include "rsrc/bitmaps/splash_a2560k.h"
const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
@ -81,6 +83,40 @@ const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
*LED2_REG = 0x02;
}
/*
* Load and display the splash screen
*/
void load_splashscreen() {
int i;
/* Turn off the screen */
*MasterControlReg_A = VKY3_MCR_BLANK_EN;
/* Copy the splash screen LUT */
for (i = 0; i < sizeof(splash_screen_cmap); i++) {
LUT_0[i] = splash_screen_cmap[i][0];
LUT_0[i+1] = splash_screen_cmap[i][1];
LUT_0[i+2] = splash_screen_cmap[i][2];
}
/* Copy the bitmap to video RAM */
for (i = 0; i < sizeof(splash_screen_bmap); i++) {
VRAM_Bank0[i] = splash_screen_bmap[i];
}
/* Set up the bitmap */
*BM0_Addy_Pointer_Reg = 0;
*BM0_Control_Reg = 1;
/* Turn off the border */
*BorderControlReg_L_A = 0;
/* Display the splashscreen: 320x200 */
*MasterControlReg_A = VKY3_MCR_BITMAP_EN | VKY3_MCR_GRAPH_EN | VKY3_MCR_DOUBLE_EN;
for (i = 0; i < 4096*1024; i++) ;
}
void print_error(short channel, char * message, short code) {
print(channel, message);
print(channel, ": ");
@ -92,11 +128,21 @@ const char* VolumeStr[FF_VOLUMES] = { "sdc", "fdc", "hdc" };
* Initialize the kernel systems.
*/
void initialize() {
int i;
short res;
text_init(); // Initialize the text channels
/* Set the logging level */
log_setlevel(LOG_ERROR);
/* Hide the mouse */
mouse_set_visible(0);
/* Display the splash screen */
/* load_splashscreen(); */
/* Initialize the text channels */
text_init();
/* Initialize the interrupt system */
int_init();
@ -126,7 +172,7 @@ void initialize() {
log(LOG_INFO, "Block device system ready.");
if (res = con_install()) {
log_num(LOG_ERROR, "FAILED: Console installation", res)
log_num(LOG_ERROR, "FAILED: Console installation", res);
} else {
log(LOG_INFO, "Console installed.");
}

File diff suppressed because it is too large Load diff

View file

@ -13,6 +13,7 @@
#define VKY3_MCR_TEXT_EN 0x00000001 /* Text Mode Enable */
#define VKY3_MCR_TEXT_OVRLY 0x00000002 /* Text Mode overlay */
#define VKY3_MCR_GRAPH_EN 0x00000004 /* Graphic Mode Enable */
#define VKY3_MCR_BITMAP_EN 0x00000008 /* Bitmap Engine Enable */
#define VKY3_MCR_RESOLUTION_MASK 0x00000300 /* Resolution - 00: 640x480, 01:800x600, 10: 1024x768, 11: 640x400 */
#define VKY3_MCR_DOUBLE_EN 0x00000400 /* Doubling Pixel */
#define VKY3_MCR_GAMMA_EN 0x00010000 /* GAMMA Enable */

View file

@ -21,17 +21,26 @@
#define PS2_STAT_RTO 0x40
#define PS2_STAT_PE 0x80
/*
* Controller responses
*/
#define PS2_RESP_OK 0x55 /* Keyboard response: Command was OK */
#define PS2_RESP_ACK 0xFA /* Keyboard response: command acknowledged */
/*
* PS2 and Keyboard Commands
*/
#define PS2_CTRL_WRITECMD 0x60
#define PS2_CTRL_SELFTEST 0xAA
#define PS2_CTRL_KBDTEST 0xAB
#define PS2_CTRL_ENABLE_1 0xAE
#define PS2_CTRL_DISABLE_1 0xAD
#define PS2_CTRL_ENABLE_2 0xA9
#define PS2_CTRL_DISABLE_2 0xA7
#define PS2_CTRL_READCMD 0x20 /* Read the command byte */
#define PS2_CTRL_WRITECMD 0x60 /* Write the command byte */
#define PS2_CTRL_SELFTEST 0xAA /* Test the PS/2 controller */
#define PS2_CTRL_KBDTEST 0xAB /* Test the main (keyboard) port */
#define PS2_CTRL_MOUSETEST 0xA9 /* Test the secondary (mouse) port */
#define PS2_CTRL_ENABLE_1 0xAE /* Enable the first (keyboard) port */
#define PS2_CTRL_DISABLE_1 0xAD /* Disable the first (keyboard) port */
#define PS2_CTRL_ENABLE_2 0xA9 /* Enable the second (mouse) port */
#define PS2_CTRL_DISABLE_2 0xA7 /* Disable the second (mouse) port */
#define KBD_CMD_RESET 0xFF /* Keyboard command: reset the keyboard */
#define KBD_CMD_ENABLE 0xF4 /* Keyboard command: enable to keyboard */

10368
src/mapfile

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,27 @@
RAMSTART = 0x00020000;
RAMSIZE = 0x00040000;
STACKLEN = 0x400;
MEMORY
{
vec : org = 0, len = 0x400
ram : org = RAMSTART, len = RAMSIZE - STACKLEN
}
SECTIONS
{
vectors : { *(VECTORS) } >vec
text ALIGN(0x04) : { *(CODE) } >ram
.dtors ALIGN(0x04) : { *(.dtors) } >ram
.ctors ALIGN(0x04) : { *(.ctors) } >ram
rodata : { *(RODATA) } >ram
data : {*(DATA) } >ram
bss (NOLOAD): {*(BSS)} >ram
___heap = ADDR(bss) + SIZEOF(bss);
___heapend = RAMSTART + RAMSIZE - STACKLEN;
___BSSSTART = ADDR(bss);
___BSSSIZE = SIZEOF(bss);
___STACK = RAMSTART + RAMSIZE;
}

View file

@ -0,0 +1,36 @@
FLASHSTART = 0x00E00000;
FLASHLEN = 0x00200000;
RAMSTART = 0x00001000;
RAMSIZE = 0x003ff000;
STACKLEN = 0x400;
VECTORSIZE = 0x400;
BINFILESTART = 0x00000000;
MEMORY
{
vectors : org = 0x000000, len = VECTORSIZE
ram : org = RAMSTART + VECTORSIZE, len = RAMSIZE - STACKLEN
flash: org = FLASHSTART, len = FLASHLEN
filevecs: org = BINFILESTART, len = VECTORSIZE
filecode: org = BINFILESTART + VECTORSIZE, len = FLASHLEN - VECTORSIZE
}
SECTIONS
{
vectors : { *(VECTORS) } >vectors AT>filevecs
text : {*(CODE)} >flash AT>filecode
.dtors : { *(.dtors) } >flash AT>filecode
.ctors : { *(.ctors) } >flash AT>filecode
rodata : {*(RODATA)} >flash AT>filecode
data: {*(DATA)} >ram
bss (NOLOAD): {*(BSS)} >ram
___heap = ADDR(bss) + SIZEOF(bss);
___heapend = RAMSTART + RAMSIZE - STACKLEN;
___BSSSTART = ADDR(bss);
___BSSSIZE = SIZEOF(bss);
___STACK = RAMSTART + RAMSIZE;
}