Display POST codes during IPL on Arctic Tern alphanumeric display instead of dot points

parent db53e58d
// © 2020 - 2021 Raptor Engineering, LLC
// © 2020 - 2022 Raptor Engineering, LLC
//
// Released under the terms of the GPL v3
// See the LICENSE file for full details
......@@ -358,8 +358,11 @@ static void display_character(char character, int dp)
// Switch display into alphanumeric mode
gpio1_out_write(gpio1_out_read() | (0x1 << 18));
// Write character
gpio2_out_write((gpio2_out_read() & ~0xff) | (character & 0xff));
if (host_power_status != HOST_POWER_STATUS_IPLING)
{
// Write character
gpio2_out_write((gpio2_out_read() & ~0xff) | (character & 0xff));
}
}
static void host_power_status_changed(void)
......@@ -391,6 +394,47 @@ static void set_led_bank_display(uint8_t bitfield)
gpio1_out_write((gpio1_out_read() & ~0xf) | (bitfield & 0xf));
}
static void set_led_post_code_alphanumeric_display(uint16_t value)
{
uint32_t dword;
// Convert POST code to string
unsigned char post_code_string[5];
snprintf(post_code_string, 5, "%02d%02d", (value >> 8) & 0xff, value & 0xff);
if ((host_power_status == HOST_POWER_STATUS_IPLING) && (value != 0x0))
{
// Display value on the alphanumeric LED display
dword = gpio2_out_read();
dword &= ~0xffffffff;
dword |= post_code_string[0] << 24;
dword |= post_code_string[1] << 16;
dword |= post_code_string[2] << 8;
dword |= post_code_string[3];
gpio2_out_write(dword);
// Set decimal point
gpio1_out_write((gpio1_out_read() & ~0xf) | 0x2);
}
else
{
// Clear middle two segments when IPL is not in progress
dword = gpio2_out_read();
dword &= ~0xffffffff;
dword |= (' ' << 24) | (' ' << 16) | (' ' << 8) | ' ';
gpio2_out_write(dword);
// Clear decimal point
gpio1_out_write(gpio1_out_read() & ~0xf);
// Ensure upper power status character is rewritten
host_power_status_changed();
// Ensure lower host status character is rewritten
display_character('0' + 2 + host_power_status, 0); // STATUS CODE
}
}
static void display_post_code(uint16_t post_code)
{
uint8_t host_status_led_post_code;
......@@ -401,12 +445,14 @@ static void display_post_code(uint16_t post_code)
{
// IPL complete!
set_led_bank_display(0);
set_led_post_code_alphanumeric_display(0);
i2c_write_register_byte((uint8_t *)P9PS_I2C_MASTER_BASE_ADDR, HOST_PLATFORM_FPGA_I2C_ADDRESS, HOST_PLATFORM_FPGA_I2C_REG_STA_LED, 0x00);
}
else if (post_code == 0x0)
{
// System offline
set_led_bank_display(0);
set_led_post_code_alphanumeric_display(0);
i2c_write_register_byte((uint8_t *)P9PS_I2C_MASTER_BASE_ADDR, HOST_PLATFORM_FPGA_I2C_ADDRESS, HOST_PLATFORM_FPGA_I2C_REG_STA_LED, 0x00);
}
else {
......@@ -440,7 +486,15 @@ static void display_post_code(uint16_t post_code)
default: host_status_led_post_code = 0;
}
set_led_bank_display(led_post_code);
// Only one way to display the POST codes is strictly necessary...
if (0)
{
set_led_bank_display(led_post_code);
}
else
{
set_led_post_code_alphanumeric_display(post_code);
}
i2c_write_register_byte((uint8_t *)P9PS_I2C_MASTER_BASE_ADDR, HOST_PLATFORM_FPGA_I2C_ADDRESS, HOST_PLATFORM_FPGA_I2C_REG_STA_LED, 0x80 | host_status_led_post_code);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment