|
@@ -68,8 +68,7 @@ struct lpc_device *lpc_setup(struct serial_device *port) {
|
|
void lpc_init(struct lpc_device *dev) {
|
|
void lpc_init(struct lpc_device *dev) {
|
|
char buf[4096];
|
|
char buf[4096];
|
|
|
|
|
|
- lpc_printf(dev, "?");
|
|
|
|
- serial_drain(dev->port);
|
|
|
|
|
|
+ serial_write(dev->port, "?");
|
|
|
|
|
|
if(lpc_await_reply(dev, "Synchronized", NULL)==1) {
|
|
if(lpc_await_reply(dev, "Synchronized", NULL)==1) {
|
|
sprog_info("Synchronization successful\n");
|
|
sprog_info("Synchronization successful\n");
|
|
@@ -80,7 +79,7 @@ void lpc_init(struct lpc_device *dev) {
|
|
if(lpc_await_reply(dev, "OK", NULL)!=1)
|
|
if(lpc_await_reply(dev, "OK", NULL)!=1)
|
|
sprog_error("Expected OK, received '%s'\n", buf);
|
|
sprog_error("Expected OK, received '%s'\n", buf);
|
|
} else {
|
|
} else {
|
|
- lpc_printf(dev, "\r\n");
|
|
|
|
|
|
+ serial_write(dev->port, "\r\n");
|
|
if(lpc_await_reply(dev, "?", NULL)==1)
|
|
if(lpc_await_reply(dev, "?", NULL)==1)
|
|
sprog_info("The device appears to be already synchronized\n");
|
|
sprog_info("The device appears to be already synchronized\n");
|
|
else
|
|
else
|
|
@@ -234,7 +233,7 @@ int lpc_await_reply(struct lpc_device *dev, ...) {
|
|
|
|
|
|
|
|
|
|
int lpc_getline(struct lpc_device *dev, char *buf) {
|
|
int lpc_getline(struct lpc_device *dev, char *buf) {
|
|
- if(sprog_waitdata(dev->port, 500)==0)
|
|
|
|
|
|
+ if(sprog_waitdata(dev->port, 5000)==0)
|
|
return 0;
|
|
return 0;
|
|
fgets(buf, 4096, dev->port->f);
|
|
fgets(buf, 4096, dev->port->f);
|
|
return 1;
|
|
return 1;
|