1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2025-04-21 12:27:27 +03:00

start wrapper; proper serial port baudrate

This commit is contained in:
Bas Wijnen
2010-08-05 22:19:58 +02:00
parent a2add9a1d6
commit 7659673f33
11 changed files with 250 additions and 78 deletions

View File

@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = usb-server
usb_server_SOURCES = usb-server.cc
usb_server_CPPFLAGS = $(SHEVEK_CFLAGS) -DSTAGE1_FILE=\"mips/nanonote/sdram-setup.raw\" -DSTAGE2_FILE=\"iris.raw\" -I../../..
usb_server_CPPFLAGS = $(SHEVEK_CFLAGS) -DSTAGE1_FILE=\"mips/nanonote/sdram-setup.raw\" -DSTAGE2_FILE=\"mips/start.raw\" -I../../..
usb_server_LDFLAGS = $(SHEVEK_LIBS) -lusb
PYPP = /usr/bin/pypp

View File

@@ -40,7 +40,7 @@ struct data:
static int const run_vendor = 0xfffe
static int const run_product = 0x0002
static unsigned const timeout = 10000
void boot (unsigned entry)
void boot (std::string const &filename, unsigned load, unsigned entry)
data (std::string const &port):
handle = NULL
server = shevek::server <client, data *>::create ()
@@ -49,7 +49,6 @@ struct data:
private:
static unsigned const STAGE1_LOAD = 0x80002000
static unsigned const STAGE2_LOAD = 0x80000000
static unsigned const STAGE1_ENTRY = STAGE1_LOAD
enum requests:
VR_GET_CPU_INFO = 0
@@ -212,9 +211,10 @@ struct client : public shevek::server <client, data *>::connection:
keep = is_stdio
void read (std::string const &line):
shevek::istring l (line)
unsigned entry
if l ("reboot %x%", entry):
get_server ()->data ()->boot (entry)
unsigned load, entry
std::string filename
if l ("reboot %x %x %r%", load, entry, filename):
get_server ()->data ()->boot (filename, load, entry)
else if l ("shutdown%"):
std::cerr << "shutting down\n"
shevek::end_loop ()
@@ -266,8 +266,8 @@ void data::get_device (unsigned vendor, unsigned product, unsigned tries):
sleep (1)
std::cerr << shevek::ostring ("giving up finding device %04x:%04x\n", vendor, product)
void data::boot (unsigned entry):
std::cerr << "booting " << shevek::ostring ("%x", entry) << "\n"
void data::boot (std::string const &filename, unsigned load, unsigned entry):
std::cerr << "booting " << shevek::ostring ("%s from %x@%x", Glib::ustring (filename), load, entry) << "\n"
if handle:
usb_release_interface (handle, 0)
usb_close (handle)
@@ -294,10 +294,10 @@ void data::boot (unsigned entry):
std::ostringstream stage2
usb_release_interface (handle, 0)
file.close ()
file.open (STAGE2_FILE)
file.open (filename.c_str ())
stage2 << file.rdbuf ()
std::cerr << "sending Iris\n"
send_file (STAGE2_LOAD, stage2.str ().size (), stage2.str ().data ())
std::cerr << shevek::ostring ("sending Iris (size 0x%x)\n", stage2.str ().size ())
send_file (load, stage2.str ().size (), stage2.str ().data ())
std::cerr << "flushing caches\n"
request (VR_FLUSH_CACHES)
std::cerr << "running Iris\n"