Add command to test the bitmap background
This commit is contained in:
parent
8952c193c3
commit
6ded32fc94
|
@ -920,8 +920,34 @@ static short cli_test_textscroll (short screen, int argc, const char * argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static short cli_test_background (short screen, int argc, const char * argv[]) {
|
||||
if (argc != 2) {
|
||||
print (screen, "AARRGGBB color code missing.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t jiffies = sys_time_jiffies() + 60*3;
|
||||
|
||||
uint32_t old_ctrl = *MasterControlReg_A;
|
||||
uint32_t old_rgb = *BackGroundControlReg_A;
|
||||
uint32_t rgb = (uint32_t)cli_eval_number(argv[1]);
|
||||
|
||||
*MasterControlReg_A = (old_ctrl & 0xfffffff0) | (VKY3_MCR_TEXT_EN|VKY3_MCR_TEXT_OVRLY|VKY3_MCR_GRAPH_EN);
|
||||
*BackGroundControlReg_A = rgb;
|
||||
|
||||
// Wait a bit
|
||||
while (sys_time_jiffies() < jiffies);
|
||||
|
||||
*MasterControlReg_A = old_ctrl; // Bitmap+screen overlay
|
||||
*BackGroundControlReg_A = old_rgb;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const t_cli_test_feature cli_test_features[] = {
|
||||
{"ANSI", "ANSI: test the ANSI escape codes", cmd_test_ansi},
|
||||
{"BACKGROUND", "BACKGROUND <0xaarrggbb>: set the background color to the give RGB color", cli_test_background},
|
||||
{"BITMAP", "BITMAP: test the bitmap screen", cli_test_bitmap},
|
||||
{"CREATE", "CREATE <path>: test creating a file", cli_test_create},
|
||||
{"IDE", "IDE: test reading the MBR of the IDE drive", cli_test_ide},
|
||||
|
|
|
@ -132,20 +132,33 @@ static void txt_a2560u_get_sizes(p_extent text_size, p_extent pixel_size) {
|
|||
*/
|
||||
static short txt_a2560u_set_mode(short mode) {
|
||||
/* Turn off anything not set */
|
||||
msr_shadow &= ~(TXT_MODE_SLEEP | TXT_MODE_TEXT);
|
||||
uint32_t old_msr = *MasterControlReg_A;
|
||||
uint32_t new_msr = old_msr & ~(VKY3_MCR_BLANK_EN|VKY3_MCR_TEXT_EN|VKY3_MCR_TEXT_OVRLY|VKY3_MCR_GRAPH_EN|VKY3_MCR_BITMAP_EN); // Mask out bits we'll set here
|
||||
|
||||
if (mode & TXT_MODE_SLEEP) {
|
||||
/* Put the monitor to sleep */
|
||||
msr_shadow |= VKY3_MCR_BLANK_EN;
|
||||
/* Put the monitor to sleep (preserve settings) */
|
||||
new_msr |= VKY3_MCR_BLANK_EN;
|
||||
} else {
|
||||
if (mode & TXT_MODE_TEXT) {
|
||||
new_msr |= VKY3_MCR_TEXT_EN;
|
||||
} else if (mode & TXT_MODE_BITMAP) {
|
||||
new_msr |= VKY3_MCR_BITMAP_EN|VKY3_MCR_GRAPH_EN/*Is this really required?*/;
|
||||
// Disable gamma (as I'm not sure it functional, but I may as well not understand it)
|
||||
new_msr |= VKY3_MCR_GAMMA_EN;
|
||||
new_msr &= ~VKY3_MCR_MANUAL_GAMMA_EN;
|
||||
}
|
||||
|
||||
/* If we want text and graphics, enable the overlay mode */
|
||||
if ((mode & (TXT_MODE_BITMAP|TXT_MODE_TEXT)) == (TXT_MODE_BITMAP|TXT_MODE_TEXT)) {
|
||||
// It seems just doing 'new_msr |= VKY3_MCR_TEXT_OVRLY' doesn't work
|
||||
new_msr |= (VKY3_MCR_TEXT_EN|VKY3_MCR_TEXT_OVRLY|VKY3_MCR_GRAPH_EN|VKY3_MCR_BITMAP_EN);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_msr != old_msr) {
|
||||
msr_shadow = new_msr;
|
||||
*MasterControlReg_A = msr_shadow;
|
||||
return 0;
|
||||
|
||||
} else if (mode & TXT_MODE_TEXT) {
|
||||
/* Put on text mode */
|
||||
msr_shadow |= VKY3_MCR_TEXT_EN;
|
||||
*MasterControlReg_A = msr_shadow;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
/* Unsupported mode */
|
||||
return -1;
|
||||
|
@ -382,14 +395,14 @@ static short txt_a2560u_set_color(unsigned char foreground, unsigned char backgr
|
|||
* (possibly color as well ?) are inverted. Ie if the memory contains AB, A beint on an
|
||||
* even address, then when reading A you'll get B and reading B you'll get A. This
|
||||
* functions can be removed if the FPGA is corrected. */
|
||||
static char read_swapped_byte(char *addr) {
|
||||
static char read_swapped_byte(const uint8_t *addr) {
|
||||
if ((long)addr & 1) {
|
||||
short w = *(short*)(addr-1);
|
||||
uint16_t w = *(uint16_t*)(addr-1);
|
||||
return (char)w;
|
||||
}
|
||||
else {
|
||||
short w = *(short*)(addr);
|
||||
return ((char*)&w)[0];
|
||||
uint16_t w = *(uint16_t*)(addr);
|
||||
return ((uint8_t*)&w)[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,8 +460,8 @@ static void txt_a2560u_scroll(short horizontal, short vertical) {
|
|||
}
|
||||
|
||||
/* Copy the rectangle. We can't copy byte by byte, they get swapped (FPGA bug) */
|
||||
char * const text_mem = (char*)ScreenText_A;
|
||||
char * const color_mem = (char*)ColorText_A;
|
||||
volatile uint8_t * const text_mem = ScreenText_A;
|
||||
volatile uint8_t * const color_mem = ColorText_A;
|
||||
|
||||
int delta_y = dy * a2560u_max_size.width;
|
||||
int row_dst = y0 * a2560u_max_size.width - delta_y;
|
||||
|
|
Loading…
Reference in a new issue