serial_transfer: increase serial line speed to 312500 bps

Interestingly, this did not cause a perceptible improvement in the
overall data transfer rate.
This commit is contained in:
Zack Buhman 2024-03-04 16:44:03 +08:00
parent 0ff0aa5346
commit 0deedb9858
3 changed files with 9 additions and 15 deletions

View File

@ -8,7 +8,7 @@ dest = 0xac02_0000
ret = [] ret = []
def sync(ser, b, wait=0.5): def sync(ser, b, wait=0.1):
l = [] l = []
for i, c in enumerate(b): for i, c in enumerate(b):
if i % 32 == 0 and i != 0: if i % 32 == 0 and i != 0:
@ -17,11 +17,11 @@ def sync(ser, b, wait=0.5):
ser.write(bytes([c])) ser.write(bytes([c]))
time.sleep(1000 / 1000000) time.sleep(1000 / 1000000)
if ser.in_waiting == 0: if ser.in_waiting == 0:
time.sleep(0.01) time.sleep(0.001)
while ser.in_waiting > 0: while ser.in_waiting > 0:
res = ser.read(ser.in_waiting) res = ser.read(ser.in_waiting)
l.extend(res) l.extend(res)
time.sleep(0.01) time.sleep(0.001)
time.sleep(wait) time.sleep(wait)
res = ser.read(ser.in_waiting) res = ser.read(ser.in_waiting)
@ -42,7 +42,7 @@ def symmetric(ser, b):
if len(l) + 8 >= i: if len(l) + 8 >= i:
break break
else: else:
time.sleep(0.001) time.sleep(0.0001)
ser.write(bytes([c])) ser.write(bytes([c]))
@ -98,7 +98,8 @@ def console(ser):
with open(sys.argv[1], 'rb') as f: with open(sys.argv[1], 'rb') as f:
b = f.read() b = f.read()
with serial.Serial('/dev/ttyUSB0', 120192, timeout=1) as ser: #with serial.Serial('/dev/ttyUSB0', 120192, timeout=1) as ser:
with serial.Serial('/dev/ttyUSB0', 312500, timeout=1) as ser:
#console(ser) #console(ser)
print("waiting: ", end=' ') print("waiting: ", end=' ')
sys.stdout.flush() sys.stdout.flush()

View File

@ -2,7 +2,7 @@
#include "sh7091/sh7091.hpp" #include "sh7091/sh7091.hpp"
#include "sh7091/sh7091_bits.hpp" #include "sh7091/sh7091_bits.hpp"
#include "sh7091/cache.hpp" #include "sh7091/serial.hpp"
#include "serial_load.hpp" #include "serial_load.hpp"
@ -11,14 +11,7 @@ extern uint32_t __bss_link_end __asm("__bss_link_end");
void main() void main()
{ {
cache::init(); serial::init(4);
uint32_t * start = &__bss_link_start;
uint32_t * end = &__bss_link_end;
while (start < end) {
*start++ = 0;
}
load_init(); load_init();
while (1) { while (1) {

View File

@ -120,8 +120,8 @@ void load_recv(uint8_t c)
debug("prejump\n"); debug("prejump\n");
holly.VO_BORDER_COL = (31 << 11); holly.VO_BORDER_COL = (31 << 11);
void (*fptr)(void) = (void (*)(void))state.addr1; void (*fptr)(void) = (void (*)(void))state.addr1;
holly.VO_BORDER_COL = (63 << 5) | (31 << 0);
fptr(); fptr();
holly.VO_BORDER_COL = (63 << 5) | (31 << 0);
debug("postjump\n"); debug("postjump\n");
return; return;
break; break;