Update UART settings.
This commit is contained in:
15
menu.cpp
15
menu.cpp
@@ -2239,8 +2239,7 @@ void HandleUI(void)
|
||||
uint mode = GetUARTMode() + 1;
|
||||
if (mode > sizeof(config_uart_msg) / sizeof(config_uart_msg[0])) mode = 0;
|
||||
|
||||
sprintf(s, "uartmode %d", mode);
|
||||
system(s);
|
||||
SetUARTMode(mode);
|
||||
menustate = MENU_UART1;
|
||||
}
|
||||
break;
|
||||
@@ -2251,10 +2250,8 @@ void HandleUI(void)
|
||||
{
|
||||
int mode = GetUARTMode();
|
||||
SetMidiLinkMode(GetMidiLinkMode() ^ ((menusub == 1) ? 2 : 1));
|
||||
sprintf(s, "uartmode %d", 0);
|
||||
system(s);
|
||||
sprintf(s, "uartmode %d", mode);
|
||||
system(s);
|
||||
SetUARTMode(0);
|
||||
SetUARTMode(mode);
|
||||
menustate = MENU_UART1;
|
||||
}
|
||||
break;
|
||||
@@ -2263,10 +2260,8 @@ void HandleUI(void)
|
||||
int mode = GetUARTMode();
|
||||
if(mode != 0)
|
||||
{
|
||||
sprintf(s, "uartmode %d", 0);
|
||||
system(s);
|
||||
sprintf(s, "uartmode %d", mode);
|
||||
system(s);
|
||||
SetUARTMode(0);
|
||||
SetUARTMode(mode);
|
||||
menustate = MENU_8BIT_SYSTEM1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,11 @@ static const char *acsi_cmd_name(int cmd) {
|
||||
return cmdname[cmd];
|
||||
}
|
||||
|
||||
static int uart_mode = 0;
|
||||
static void set_control(uint32_t ctrl)
|
||||
{
|
||||
ctrl = uart_mode ? (ctrl | TOS_CONTROL_REDIR0) : (ctrl & ~TOS_CONTROL_REDIR0);
|
||||
|
||||
spi_uio_cmd_cont(UIO_SET_STATUS2);
|
||||
spi32w(ctrl);
|
||||
DisableIO();
|
||||
@@ -73,6 +76,12 @@ unsigned long tos_system_ctrl()
|
||||
return config.system_ctrl;
|
||||
}
|
||||
|
||||
void tos_uart_mode(int enable)
|
||||
{
|
||||
uart_mode = enable;
|
||||
set_control(config.system_ctrl);
|
||||
}
|
||||
|
||||
static void memory_read(uint8_t *data, uint32_t words)
|
||||
{
|
||||
EnableIO();
|
||||
|
||||
@@ -92,4 +92,6 @@ void tos_config_load(int slot); // slot -1 == last config
|
||||
void tos_config_save(int slot);
|
||||
int tos_config_exists(int slot);
|
||||
|
||||
void tos_uart_mode(int enable);
|
||||
|
||||
#endif
|
||||
|
||||
19
user_io.cpp
19
user_io.cpp
@@ -556,6 +556,17 @@ int GetUARTMode()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SetUARTMode(int mode)
|
||||
{
|
||||
if (is_st()) tos_uart_mode(mode != 3);
|
||||
MakeFile("/tmp/CORENAME", user_io_get_core_name_ex());
|
||||
MakeFile("/tmp/UART_SPEED", is_st() ? "19200" : "115200");
|
||||
|
||||
char cmd[32];
|
||||
sprintf(cmd, "uartmode %d", mode & 0xFF);
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
int GetMidiLinkMode()
|
||||
{
|
||||
struct stat filestat;
|
||||
@@ -568,7 +579,6 @@ int GetMidiLinkMode()
|
||||
|
||||
void SetMidiLinkMode(int mode)
|
||||
{
|
||||
MakeFile("/tmp/CORENAME", user_io_get_core_name_ex());
|
||||
remove("/tmp/ML_FSYNTH");
|
||||
remove("/tmp/ML_MUNT");
|
||||
remove("/tmp/ML_UDP");
|
||||
@@ -932,12 +942,9 @@ void user_io_init(const char *path, const char *xml)
|
||||
FileLoadConfig(mainpath, &mode, 4);
|
||||
}
|
||||
|
||||
char cmd[32];
|
||||
system("uartmode 0");
|
||||
|
||||
SetUARTMode(0);
|
||||
SetMidiLinkMode((mode >> 8) & 0xFF);
|
||||
sprintf(cmd, "uartmode %d", mode & 0xFF);
|
||||
system(cmd);
|
||||
SetUARTMode(mode);
|
||||
}
|
||||
|
||||
static int joyswap = 0;
|
||||
|
||||
Reference in New Issue
Block a user