/** * @brief Post upload testing stage * @param handle The serial socket handle * @return -1 if failure, 0 if successful */ static int serial_cmd_post(int handle) { int result = -1; /* wait for upload to finish */ if (!serial_wait(handle, ">")) { sleep(5); /* give it some time to copy */ result = serial_wait(handle, "reset"); } return result; }
void fb_scroll() { u16 i; // Copy each row up for (i = FB_COLS; i <= FB_LASTCELL; i++) { serial_wait(); fb.p[i - FB_COLS] = fb.p[i]; } // Clear the bottom row for (i = FB_BOTTOMROW; i <= FB_LASTCELL; i++) { serial_wait(); fb.p[i] = fb_mkchar(FB_BLACK, FB_WHITE, ' '); } fb.pos = FB_BOTTOMROW; fb_mov(); }
/** * @brief Pre upload testing stage * @param handle The serial socket handle * @return -1 if failure, 0 if successful */ static int serial_cmd_pre(int handle) { char *cmd = "UpLoad1\n"; write(handle, cmd, sizeof(cmd)); if (serial_wait(handle, ">")) return -1; return 0; }
/** * @brief Issues the reset command and waits for result * @param handle The serial socket handle * @return -1 if failure, 0 if successful */ static int serial_cmd_reset(int handle) { static char *skip = "\n"; static char *cmd = "reset\n"; write(handle, skip, strlen(skip)); /* to clear old command */ usleep(500000); /* allow serial to catch up */ write(handle, cmd, strlen(cmd)); /* to issue reset */ sleep(5); /* allow boot menu to run */ if (serial_wait(handle, "the Service menu")) return -1; sleep(6); /* wait for menu to time out */ return 0; }