Enabled high res DIP switch

Kernel now sets display resolution based on the DIP switches.
This commit is contained in:
Peter Weingartner 2022-05-02 22:23:37 -04:00
parent 9a6af9bbe7
commit 82f6864c8d
9 changed files with 9489 additions and 9402 deletions

Binary file not shown.

View file

@ -1 +0,0 @@
,RYOKO/pjw,Ryoko,02.05.2022 19:18,file:///C:/Users/pjw/AppData/Roaming/LibreOffice/4;

View file

@ -321,6 +321,8 @@ short boot_screen() {
}
txt_init_screen(screen);
txt_set_resolution(0, 0, 0); // Set the resolution based on the DIP switch
txt_set_resolution(1, 0, 0); // Set the resolution based on the DIP switch
print(screen, buffer);
#if MODEL == MODEL_FOENIX_A2560K

View file

@ -9,6 +9,7 @@
#include "log.h"
#include "utilities.h"
#include "A2560K/vky_chan_a.h"
#include "A2560K/vky_chan_b.h"
#include "dev/txt_screen.h"
#include "dev/txt_a2560k_a.h"
@ -153,6 +154,26 @@ short txt_a2560k_a_set_mode(short mode) {
* @return 0 on success, any other number means the resolution is unsupported
*/
short txt_a2560k_a_set_resolution(short width, short height) {
// If no size specified, set it based on the DIP switch
if ((width == 0) || (height == 0)) {
if ((*VKY3_B_MCR & VKY3_B_HIRES) == 0) {
width = 1024;
height = 768;
} else {
width = 800;
height = 600;
}
}
// Kick the PLL
// If VICKY is generating a 40MHz signal, we need to switch the bit to go to 40MHz before
// clearing it to go back to 25MHz.
if (*VKY3_A_MCR & VKY3_A_CLK40) {
*VKY3_A_MCR |= VKY3_A_1024x768;
*VKY3_A_MCR &= ~(VKY3_A_1024x768);
}
/* Turn off resolution bits */
msr_shadow &= ~(VKY3_A_1024x768);
@ -524,6 +545,14 @@ void txt_a2560k_a_init() {
t_rect region;
int i;
// Kick the PLL
// If VICKY is generating a 40MHz signal, we need to switch the bit to go to 40MHz before
// clearing it to go back to 25MHz.
if (*VKY3_A_MCR & VKY3_A_CLK40) {
*VKY3_A_MCR |= VKY3_A_1024x768;
*VKY3_A_MCR &= ~(VKY3_A_1024x768);
}
a2560k_a_resolution.width = 0;
a2560k_a_resolution.height = 0;
a2560k_a_font_size.width = 0;

View file

@ -7,6 +7,7 @@
#include <stdio.h>
#include "log.h"
#include "utilities.h"
#include "A2560K/vky_chan_a.h"
#include "A2560K/vky_chan_b.h"
#include "dev/txt_screen.h"
#include "dev/txt_a2560k_b.h"
@ -166,6 +167,25 @@ short txt_a2560k_b_set_mode(short mode) {
short txt_a2560k_b_set_resolution(short width, short height) {
int i;
// If no size specified, set it based on the DIP switch
if ((width == 0) || (height == 0)) {
if ((*VKY3_B_MCR & VKY3_B_HIRES) == 0) {
width = 800;
height = 600;
} else {
width = 640;
height = 480;
}
}
// Kick the PLL
// If VICKY is generating a 40MHz signal, we need to switch the bit to go to 40MHz before
// clearing it to go back to 25MHz.
if (*VKY3_B_MCR & VKY3_B_CLK40) {
*VKY3_B_MCR |= VKY3_B_PLL | VKY3_B_MODE1;
*VKY3_B_MCR &= ~(VKY3_B_PLL | VKY3_B_MODE1);
}
for (i = 0; i < a2560k_b_caps.resolution_count; i++) {
if ((a2560k_b_caps.resolutions[i].width == width) && (a2560k_b_caps.resolutions[i].height == height)) {
msr_shadow_b &= ~(VKY3_B_DOUBLE | VKY3_B_MODE0 | VKY3_B_MODE1);
@ -180,14 +200,14 @@ short txt_a2560k_b_set_resolution(short width, short height) {
// Use the height to determine the resolution we should set
switch (height) {
case 400: // 640x400 or 320x200 (mode = 11)
msr_shadow_b |= VKY3_B_MODE0 | VKY3_B_MODE1;
msr_shadow_b |= VKY3_B_MODE0;
break;
case 480: // 640x480 or 320x240 (mode = 00)
break;
case 800: // 800x600 or 400x300 (mode = 01)
msr_shadow_b |= VKY3_B_MODE0;
case 600: // 800x600 or 400x300 (mode = 01)
msr_shadow_b |= VKY3_B_PLL | VKY3_B_MODE1;
break;
default:
@ -202,6 +222,13 @@ short txt_a2560k_b_set_resolution(short width, short height) {
// Recalculate the size of the screen
txt_a2560k_b_set_sizes();
// Kick the PLL
if (*VKY3_B_MCR & VKY3_B_PLL) {
*VKY3_B_MCR &= ~(VKY3_B_PLL | VKY3_B_MODE0 | VKY3_B_MODE1);
*VKY3_B_MCR |= (VKY3_B_PLL | VKY3_B_MODE1);
}
*VKY3_B_MCR &= ~(VKY3_B_PLL | VKY3_B_MODE0 | VKY3_B_MODE1);
// Update the register
*VKY3_B_MCR = msr_shadow_b;
return 0;
@ -546,6 +573,14 @@ void txt_a2560k_b_init() {
t_rect region;
int i;
// Kick the PLL
// If VICKY is generating a 40MHz signal, we need to switch the bit to go to 40MHz before
// clearing it to go back to 25MHz.
if (*VKY3_B_MCR & VKY3_B_CLK40) {
*VKY3_B_MCR |= VKY3_B_PLL | VKY3_B_MODE1;
*VKY3_B_MCR &= ~(VKY3_B_PLL | VKY3_B_MODE1);
}
a2560k_b_resolution.width = 0;
a2560k_b_resolution.height = 0;
a2560k_b_font_size.width = 0;

View file

@ -12,6 +12,8 @@
#define VKY3_A_MCR_TEXT 0x00000001 /**< Text mode enable bit */
#define VKY3_A_MCR_SLEEP 0x00040000 /**< Monitor sleep (synch disable) bit */
#define VKY3_A_1024x768 0x00000800 /**< Bit to select 1024x768 screen resolution */
#define VKY3_A_HIRES 0x40000000 /**< Bit to indicate on read if hi-res display is requested on the DIP switches */
#define VKY3_A_CLK40 0x80000000 /**< Indicate if PLL is 25MHz (0) or 40MHz (1) */
/** Border control register for Channel A */
#define VKY3_A_BCR ((volatile unsigned long *)0xFEC40004)

View file

@ -19,7 +19,10 @@
#define VKY3_B_MODE0 0x00000100 /**< Video Mode Bit 0 */
#define VKY3_B_MODE1 0x00000200 /**< Video Mode Bit 1 */
#define VKY3_B_DOUBLE 0x00000400 /**< Pixel Double Enable bit */
#define VKY3_B_HIRES 0x40000000 /**< DIP switch for hires mode */
#define VKY3_B_PLL 0x00000800 /**< Controls dot clock */
#define VKY3_B_MCR_SLEEP 0x00040000 /**< Monitor sleep (synch disable) bit */
#define VKY3_B_CLK40 0x80000000 /**< Indicate if PLL is 25MHz (0) or 40MHz (1) */
/** Border control register for Channel B */
#define VKY3_B_BCR ((volatile unsigned long *)0xFEC80004)

18811
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,6 @@
#define VER_MAJOR 0
#define VER_MINOR 53
#define VER_BUILD 2
#define VER_BUILD 4
#endif