mirror of
https://github.com/array-in-a-matrix/SAROO.git
synced 2025-04-02 10:31:43 -04:00
DEBUG output to MCU
This commit is contained in:
parent
7ee3544fe4
commit
f38e48b526
10 changed files with 55 additions and 24 deletions
|
@ -873,6 +873,9 @@ int my_bios_loadcd_read(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern int to_stm32;
|
||||
extern int gets_from_stm32;
|
||||
|
||||
int read_1st(void)
|
||||
{
|
||||
printk("Read main ...\n");
|
||||
|
@ -882,6 +885,14 @@ int read_1st(void)
|
|||
go();
|
||||
|
||||
patch_game((char*)0x06002020);
|
||||
|
||||
if(game_break_pc){
|
||||
set_break_pc(game_break_pc, 0);
|
||||
install_ubr_isr();
|
||||
to_stm32 = 1;
|
||||
gets_from_stm32 = 1;
|
||||
*(u32*)(0x22820000) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,25 +87,22 @@ int smpc_cmd(int cmd)
|
|||
|
||||
/**********************************************************/
|
||||
|
||||
|
||||
void stm32_puts(char *str)
|
||||
{
|
||||
u32 stm32_base = 0x22820000;
|
||||
int i, len;
|
||||
|
||||
//len = strlen(str);
|
||||
//len += 1;
|
||||
len = 32;
|
||||
*(u16*)(stm32_base+0x00) = len;
|
||||
len = strlen(str);
|
||||
LE32W((void*)(stm32_base+0), len);
|
||||
|
||||
for(i=0; i<len; i+=2)
|
||||
*(u16*)(stm32_base+0x10+i) = *(u16*)(str+i);
|
||||
memcpy((void*)stm32_base+0x10, str, len+1);
|
||||
|
||||
SS_CMD = 0x0001;
|
||||
//while(SS_CMD);
|
||||
while(SS_CMD);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
|
||||
const int HZ = 1000000;
|
||||
|
|
|
@ -188,6 +188,8 @@ void install_ubr_isr(void);
|
|||
void set_break_pc(u32 addr, u32 mask);
|
||||
void set_break_rw(u32 addr, u32 mask, int rw);
|
||||
|
||||
extern int game_break_pc;
|
||||
|
||||
#define BRK_READ 0x04
|
||||
#define BRK_WRITE 0x08
|
||||
#define BRK_RW 0x0c
|
||||
|
|
|
@ -257,6 +257,7 @@ int vsnprintf(char *buf, int size, char *fmt, va_list args)
|
|||
|
||||
void (*printk_putc)(int ch) = NULL;
|
||||
void stm32_puts(char *str);
|
||||
int to_stm32 = 0;
|
||||
|
||||
|
||||
int printk(char *fmt, ...)
|
||||
|
@ -275,20 +276,20 @@ int printk(char *fmt, ...)
|
|||
printed_len = vsnprintf(printk_buf, sizeof(printk_buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
|
||||
if(to_stm32){
|
||||
stm32_puts(printk_buf);
|
||||
}else{
|
||||
#if 1
|
||||
for (p = printk_buf; *p; p++) {
|
||||
printk_putc(*p);
|
||||
for (p = printk_buf; *p; p++) {
|
||||
printk_putc(*p);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
stm32_puts(printk_buf);
|
||||
#endif
|
||||
|
||||
return printed_len;
|
||||
}
|
||||
|
||||
|
||||
int snprintf(char *buf, int size, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
/**********************************************************/
|
||||
|
||||
int gets_from_stm32 = 0;
|
||||
|
||||
static char hbuf[128];
|
||||
static int hblen = 0;
|
||||
#define PROMPT "SS"
|
||||
|
@ -12,6 +14,18 @@ int gets(char *buf, int len)
|
|||
{
|
||||
int n, ch, esc;
|
||||
|
||||
if(gets_from_stm32){
|
||||
while(1){
|
||||
n = *(volatile u8*)0x22820000;
|
||||
if(n)
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy(buf, (u8*)0x22820010);
|
||||
buf[n] = 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
printk(PROMPT "> ");
|
||||
n = 0;
|
||||
esc = 0;
|
||||
|
@ -309,8 +323,7 @@ void sci_shell(void)
|
|||
u32 addr = 0;
|
||||
if(argc>0) addr = arg[0];
|
||||
if(addr){
|
||||
skip_patch = 1;
|
||||
break_in_game(addr, NULL);
|
||||
game_break_pc = addr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ void debug_shell(void *arg);
|
|||
|
||||
|
||||
static int auto_break;
|
||||
static int game_break_pc;
|
||||
static void (*game_break_handle)(REGS *reg);
|
||||
int game_break_pc;
|
||||
void (*game_break_handle)(REGS *reg);
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
|
|
|
@ -205,6 +205,13 @@ void simple_shell(void)
|
|||
|
||||
while(1){
|
||||
gets(cmd, 128);
|
||||
if(strncmp(cmd, "ss ", 3)==0){
|
||||
int len = strlen(cmd+3);
|
||||
strcpy((u8*)0x61820010, cmd+3);
|
||||
*(u8*)0x61820000 = len;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *sp = strchr(cmd, ' ');
|
||||
if(sp){
|
||||
*sp = 0;
|
||||
|
|
|
@ -216,8 +216,8 @@ void uart4_init(void)
|
|||
UART4->CR2 = 0;
|
||||
UART4->CR3 = 0x64000000;
|
||||
UART4->BRR = 0x0; // Reset
|
||||
UART4->BRR = 0x0364; // 设置波特比率寄存器为115200(100M/115200)
|
||||
// UART4->BRR = 0x0064; // 设置波特比率寄存器为1M(100M/1M)
|
||||
// UART4->BRR = 0x0364; // 设置波特比率寄存器为115200(100M/115200)
|
||||
UART4->BRR = 0x0064; // 设置波特比率寄存器为1M(100M/1M)
|
||||
UART4->RQR = 0x0018;
|
||||
UART4->CR1 |= 0x0001; // Enable UART4
|
||||
|
||||
|
|
|
@ -804,7 +804,7 @@ int get_subcode(void)
|
|||
}
|
||||
|
||||
type = cdb.cr1&0xff;
|
||||
SSLOG(_INFO, "get_subcode: type=%d\n", type);
|
||||
//SSLOG(_INFO, "get_subcode: type=%d\n", type);
|
||||
|
||||
if(type==0){
|
||||
// Get Q Channel
|
||||
|
|
|
@ -402,7 +402,7 @@ void ss_cmd_handle(void)
|
|||
int retv;
|
||||
u32 cmd = SS_CMD;
|
||||
|
||||
SSLOG(_INFO, "scmd_task: %04x\n", SS_CMD);
|
||||
//SSLOG(_INFO, "scmd_task: %04x\n", SS_CMD);
|
||||
|
||||
switch(cmd){
|
||||
case SSCMD_PRINTF:
|
||||
|
|
Loading…
Add table
Reference in a new issue