More bits for status.
This commit is contained in:
44
menu.cpp
44
menu.cpp
@@ -1023,7 +1023,7 @@ void HandleUI(void)
|
|||||||
if (up)
|
if (up)
|
||||||
{
|
{
|
||||||
if (menusub > 0)
|
if (menusub > 0)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
--menusub;
|
--menusub;
|
||||||
@@ -1272,7 +1272,6 @@ void HandleUI(void)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
char* pos;
|
char* pos;
|
||||||
unsigned long status = user_io_8bit_set_status(0, 0); // 0,0 gets status
|
|
||||||
|
|
||||||
p = user_io_8bit_get_string(i++);
|
p = user_io_8bit_get_string(i++);
|
||||||
//printf("Option %d: %s\n", i-1, p);
|
//printf("Option %d: %s\n", i-1, p);
|
||||||
@@ -1339,7 +1338,7 @@ void HandleUI(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for 'T'oggle and 'R'eset (toggle and then close menu) strings
|
// check for 'T'oggle and 'R'eset (toggle and then close menu) strings
|
||||||
if ((p[0] == 'T') || (p[0] == 'R'))
|
if ((p[0] == 'T') || (p[0] == 'R') || (p[0] == 't') || (p[0] == 'r'))
|
||||||
{
|
{
|
||||||
|
|
||||||
s[0] = ' ';
|
s[0] = ' ';
|
||||||
@@ -1353,12 +1352,15 @@ void HandleUI(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for 'O'ption strings
|
// check for 'O'ption strings
|
||||||
if (p[0] == 'O')
|
if ((p[0] == 'O') || (p[0] == 'o'))
|
||||||
{
|
{
|
||||||
|
int ex = (p[0] == 'o');
|
||||||
|
uint32_t status = user_io_8bit_set_status(0, 0, ex); // 0,0 gets status
|
||||||
|
|
||||||
//option handled by ARM
|
//option handled by ARM
|
||||||
if (p[1] == 'X') p++;
|
if (p[1] == 'X') p++;
|
||||||
|
|
||||||
unsigned long x = getStatus(p, status);
|
uint32_t x = getStatus(p, status);
|
||||||
|
|
||||||
// get currently active option
|
// get currently active option
|
||||||
substrcpy(s, p, 2 + x);
|
substrcpy(s, p, 2 + x);
|
||||||
@@ -1368,7 +1370,7 @@ void HandleUI(void)
|
|||||||
// option's index is outside of available values.
|
// option's index is outside of available values.
|
||||||
// reset to 0.
|
// reset to 0.
|
||||||
x = 0;
|
x = 0;
|
||||||
user_io_8bit_set_status(setStatus(p, status, x), 0xffffffff);
|
//user_io_8bit_set_status(setStatus(p, status, x), 0xffffffff);
|
||||||
substrcpy(s, p, 2 + x);
|
substrcpy(s, p, 2 + x);
|
||||||
l = strlen(s);
|
l = strlen(s);
|
||||||
}
|
}
|
||||||
@@ -1533,8 +1535,10 @@ void HandleUI(void)
|
|||||||
while (strlen(ext) % 3) strcat(ext, " ");
|
while (strlen(ext) % 3) strcat(ext, " ");
|
||||||
SelectFile(ext, SCANO_DIR | SCANO_UMOUNT, MENU_8BIT_MAIN_IMAGE_SELECTED, MENU_8BIT_MAIN1);
|
SelectFile(ext, SCANO_DIR | SCANO_UMOUNT, MENU_8BIT_MAIN_IMAGE_SELECTED, MENU_8BIT_MAIN1);
|
||||||
}
|
}
|
||||||
else if (p[0] == 'O')
|
else if ((p[0] == 'O') || (p[0] == 'o'))
|
||||||
{
|
{
|
||||||
|
int ex = (p[0] == 'o');
|
||||||
|
|
||||||
int byarm = 0;
|
int byarm = 0;
|
||||||
if (p[1] == 'X')
|
if (p[1] == 'X')
|
||||||
{
|
{
|
||||||
@@ -1542,8 +1546,8 @@ void HandleUI(void)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long status = user_io_8bit_set_status(0, 0); // 0,0 gets status
|
uint32_t status = user_io_8bit_set_status(0, 0, ex); // 0,0 gets status
|
||||||
unsigned long x = getStatus(p, status) + 1;
|
uint32_t x = getStatus(p, status) + 1;
|
||||||
|
|
||||||
if (byarm && is_x86_core())
|
if (byarm && is_x86_core())
|
||||||
{
|
{
|
||||||
@@ -1553,14 +1557,16 @@ void HandleUI(void)
|
|||||||
substrcpy(s, p, 2 + x);
|
substrcpy(s, p, 2 + x);
|
||||||
if (!strlen(s)) x = 0;
|
if (!strlen(s)) x = 0;
|
||||||
|
|
||||||
user_io_8bit_set_status(setStatus(p, status, x), 0xffffffff);
|
user_io_8bit_set_status(setStatus(p, status, x), 0xffffffff, ex);
|
||||||
|
|
||||||
menustate = MENU_8BIT_MAIN1;
|
menustate = MENU_8BIT_MAIN1;
|
||||||
}
|
}
|
||||||
else if ((p[0] == 'T') || (p[0] == 'R'))
|
else if ((p[0] == 'T') || (p[0] == 'R') || (p[0] == 't') || (p[0] == 'r'))
|
||||||
{
|
{
|
||||||
|
int ex = (p[0] == 't') || (p[0] == 'r');
|
||||||
|
|
||||||
// determine which status bit is affected
|
// determine which status bit is affected
|
||||||
unsigned long mask = 1 << getIdx(p);
|
uint32_t mask = 1 << getIdx(p);
|
||||||
if (mask == 1 && is_x86_core())
|
if (mask == 1 && is_x86_core())
|
||||||
{
|
{
|
||||||
x86_init();
|
x86_init();
|
||||||
@@ -1568,10 +1574,10 @@ void HandleUI(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned long status = user_io_8bit_set_status(0, 0);
|
uint32_t status = user_io_8bit_set_status(0, 0, ex);
|
||||||
|
|
||||||
user_io_8bit_set_status(status ^ mask, mask);
|
user_io_8bit_set_status(status ^ mask, mask, ex);
|
||||||
user_io_8bit_set_status(status, mask);
|
user_io_8bit_set_status(status, mask, ex);
|
||||||
menustate = MENU_8BIT_MAIN1;
|
menustate = MENU_8BIT_MAIN1;
|
||||||
if (p[0] == 'R') menustate = MENU_NONE1;
|
if (p[0] == 'R') menustate = MENU_NONE1;
|
||||||
}
|
}
|
||||||
@@ -1812,9 +1818,9 @@ void HandleUI(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *filename = user_io_create_config_name();
|
char *filename = user_io_create_config_name();
|
||||||
unsigned long status = user_io_8bit_set_status(0, 0);
|
uint32_t status[2] = { user_io_8bit_set_status(0, 0, 0), user_io_8bit_set_status(0, 0, 1) };
|
||||||
printf("Saving config to %s\n", filename);
|
printf("Saving config to %s\n", filename);
|
||||||
FileSaveConfig(filename, &status, 4);
|
FileSaveConfig(filename, status, 8);
|
||||||
if (is_x86_core()) x86_config_save();
|
if (is_x86_core()) x86_config_save();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3258,9 +3264,9 @@ void HandleUI(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *filename = user_io_create_config_name();
|
char *filename = user_io_create_config_name();
|
||||||
unsigned long status = user_io_8bit_set_status(0, 0xffffffff);
|
uint32_t status[2] = { user_io_8bit_set_status(0, 0xffffffff, 0), user_io_8bit_set_status(0, 0xffffffff, 1) };
|
||||||
printf("Saving config to %s\n", filename);
|
printf("Saving config to %s\n", filename);
|
||||||
FileSaveConfig(filename, &status, 4);
|
FileSaveConfig(filename, status, 8);
|
||||||
menustate = MENU_8BIT_MAIN1;
|
menustate = MENU_8BIT_MAIN1;
|
||||||
menusub = 0;
|
menusub = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
45
user_io.cpp
45
user_io.cpp
@@ -766,19 +766,20 @@ void user_io_init(const char *path)
|
|||||||
OsdCoreNameSet(user_io_get_core_name());
|
OsdCoreNameSet(user_io_get_core_name());
|
||||||
|
|
||||||
printf("Loading config %s\n", name);
|
printf("Loading config %s\n", name);
|
||||||
unsigned long status = 0;
|
uint32_t status[2] = { 0, 0 };
|
||||||
if (FileLoadConfig(name, &status, 4))
|
if (FileLoadConfig(name, status, 8))
|
||||||
{
|
{
|
||||||
printf("Found config\n");
|
printf("Found config: %08X-%08X\n", status[0], status[1]);
|
||||||
status &= ~UIO_STATUS_RESET;
|
status[0] &= ~UIO_STATUS_RESET;
|
||||||
user_io_8bit_set_status(status, 0xffffffff & ~UIO_STATUS_RESET);
|
user_io_8bit_set_status(status[0], ~UIO_STATUS_RESET, 0);
|
||||||
|
user_io_8bit_set_status(status[1], 0xffffffff, 1);
|
||||||
}
|
}
|
||||||
parse_config();
|
parse_config();
|
||||||
|
|
||||||
if (is_menu_core())
|
if (is_menu_core())
|
||||||
{
|
{
|
||||||
user_io_8bit_set_status((cfg.menu_pal) ? 0x10 : 0, 0x10);
|
user_io_8bit_set_status((cfg.menu_pal) ? 0x10 : 0, 0x10);
|
||||||
if (cfg.fb_terminal) video_menu_bg((status >> 1) & 7);
|
if (cfg.fb_terminal) video_menu_bg((status[0] >> 1) & 7);
|
||||||
else user_io_8bit_set_status(0, 0xE);
|
else user_io_8bit_set_status(0, 0xE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1522,10 +1523,11 @@ static void check_status_change()
|
|||||||
if ((stchg & 0xF0) == 0xA0 && last_status_change != (stchg & 0xF))
|
if ((stchg & 0xF0) == 0xA0 && last_status_change != (stchg & 0xF))
|
||||||
{
|
{
|
||||||
last_status_change = (stchg & 0xF);
|
last_status_change = (stchg & 0xF);
|
||||||
uint32_t st = spi32w(0);
|
uint32_t st0 = spi32w(0);
|
||||||
|
uint32_t st1 = spi32w(0);
|
||||||
DisableIO();
|
DisableIO();
|
||||||
user_io_8bit_set_status(st, ~UIO_STATUS_RESET);
|
user_io_8bit_set_status(st0, ~UIO_STATUS_RESET, 0);
|
||||||
//printf("** new status from core: %08X\n", st);
|
user_io_8bit_set_status(st1, 0xFFFFFFFF, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1695,22 +1697,33 @@ char *user_io_8bit_get_string(char index)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t user_io_8bit_set_status(uint32_t new_status, uint32_t mask)
|
uint32_t user_io_8bit_set_status(uint32_t new_status, uint32_t mask, int ex)
|
||||||
{
|
{
|
||||||
static uint32_t status = 0;
|
static uint32_t status[2] = { 0, 0 };
|
||||||
|
if (ex) ex = 1;
|
||||||
|
|
||||||
// if mask is 0 just return the current status
|
// if mask is 0 just return the current status
|
||||||
if (mask) {
|
if (mask) {
|
||||||
// keep everything not masked
|
// keep everything not masked
|
||||||
status &= ~mask;
|
status[ex] &= ~mask;
|
||||||
// updated masked bits
|
// updated masked bits
|
||||||
status |= new_status & mask;
|
status[ex] |= new_status & mask;
|
||||||
|
|
||||||
if(!io_ver) spi_uio_cmd8(UIO_SET_STATUS, status);
|
if (!io_ver)
|
||||||
spi_uio_cmd32(UIO_SET_STATUS2, status, io_ver);
|
{
|
||||||
|
spi_uio_cmd8(UIO_SET_STATUS, status[0]);
|
||||||
|
spi_uio_cmd32(UIO_SET_STATUS2, status[0], 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_uio_cmd_cont(UIO_SET_STATUS2);
|
||||||
|
spi32w(status[0]);
|
||||||
|
spi32w(status[1]);
|
||||||
|
DisableIO();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status[ex];
|
||||||
}
|
}
|
||||||
|
|
||||||
static char cur_btn = 0;
|
static char cur_btn = 0;
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ char user_io_user_button();
|
|||||||
void user_io_osd_key_enable(char);
|
void user_io_osd_key_enable(char);
|
||||||
void user_io_serial_tx(char *, uint16_t);
|
void user_io_serial_tx(char *, uint16_t);
|
||||||
char *user_io_8bit_get_string(char);
|
char *user_io_8bit_get_string(char);
|
||||||
uint32_t user_io_8bit_set_status(uint32_t, uint32_t);
|
uint32_t user_io_8bit_set_status(uint32_t, uint32_t, int ex = 0);
|
||||||
int user_io_file_tx(const char* name, unsigned char index = 0, char opensave = 0, char mute = 0, char composite = 0);
|
int user_io_file_tx(const char* name, unsigned char index = 0, char opensave = 0, char mute = 0, char composite = 0);
|
||||||
uint32_t user_io_get_file_crc();
|
uint32_t user_io_get_file_crc();
|
||||||
int user_io_file_mount(char *name, unsigned char index = 0, char pre = 0);
|
int user_io_file_mount(char *name, unsigned char index = 0, char pre = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user