xyzModem.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. // SPDX-License-Identifier: eCos-2.0
  2. /*
  3. *==========================================================================
  4. *
  5. * xyzModem.c
  6. *
  7. * RedBoot stream handler for xyzModem protocol
  8. *
  9. *==========================================================================
  10. *#####DESCRIPTIONBEGIN####
  11. *
  12. * Author(s): gthomas
  13. * Contributors: gthomas, tsmith, Yoshinori Sato
  14. * Date: 2000-07-14
  15. * Purpose:
  16. * Description:
  17. *
  18. * This code is part of RedBoot (tm).
  19. *
  20. *####DESCRIPTIONEND####
  21. *
  22. *==========================================================================
  23. */
  24. #include <common.h>
  25. #include <xyzModem.h>
  26. #include <stdarg.h>
  27. #include <crc.h>
  28. /* Assumption - run xyzModem protocol over the console port */
  29. /* Values magic to the protocol */
  30. #define SOH 0x01
  31. #define STX 0x02
  32. #define EOT 0x04
  33. #define ACK 0x06
  34. #define BSP 0x08
  35. #define NAK 0x15
  36. #define CAN 0x18
  37. #define EOF 0x1A /* ^Z for DOS officionados */
  38. /* Data & state local to the protocol */
  39. static struct
  40. {
  41. int *__chan;
  42. unsigned char pkt[1024], *bufp;
  43. unsigned char blk, cblk, crc1, crc2;
  44. unsigned char next_blk; /* Expected block */
  45. int len, mode, total_retries;
  46. int total_SOH, total_STX, total_CAN;
  47. bool crc_mode, at_eof, tx_ack;
  48. unsigned long file_length, read_length;
  49. } xyz;
  50. #define xyzModem_CHAR_TIMEOUT 2000 /* 2 seconds */
  51. #define xyzModem_MAX_RETRIES 20
  52. #define xyzModem_MAX_RETRIES_WITH_CRC 10
  53. #define xyzModem_CAN_COUNT 3 /* Wait for 3 CAN before quitting */
  54. typedef int cyg_int32;
  55. static int
  56. CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
  57. {
  58. ulong now = get_timer(0);
  59. while (!tstc ())
  60. {
  61. if (get_timer(now) > xyzModem_CHAR_TIMEOUT)
  62. break;
  63. }
  64. if (tstc ())
  65. {
  66. *c = getc ();
  67. return 1;
  68. }
  69. return 0;
  70. }
  71. static void
  72. CYGACC_COMM_IF_PUTC (char x, char y)
  73. {
  74. putc (y);
  75. }
  76. /* Validate a hex character */
  77. __inline__ static bool
  78. _is_hex (char c)
  79. {
  80. return (((c >= '0') && (c <= '9')) ||
  81. ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f')));
  82. }
  83. /* Convert a single hex nibble */
  84. __inline__ static int
  85. _from_hex (char c)
  86. {
  87. int ret = 0;
  88. if ((c >= '0') && (c <= '9'))
  89. {
  90. ret = (c - '0');
  91. }
  92. else if ((c >= 'a') && (c <= 'f'))
  93. {
  94. ret = (c - 'a' + 0x0a);
  95. }
  96. else if ((c >= 'A') && (c <= 'F'))
  97. {
  98. ret = (c - 'A' + 0x0A);
  99. }
  100. return ret;
  101. }
  102. /* Convert a character to lower case */
  103. __inline__ static char
  104. _tolower (char c)
  105. {
  106. if ((c >= 'A') && (c <= 'Z'))
  107. {
  108. c = (c - 'A') + 'a';
  109. }
  110. return c;
  111. }
  112. /* Parse (scan) a number */
  113. static bool
  114. parse_num (char *s, unsigned long *val, char **es, char *delim)
  115. {
  116. bool first = true;
  117. int radix = 10;
  118. char c;
  119. unsigned long result = 0;
  120. int digit;
  121. while (*s == ' ')
  122. s++;
  123. while (*s)
  124. {
  125. if (first && (s[0] == '0') && (_tolower (s[1]) == 'x'))
  126. {
  127. radix = 16;
  128. s += 2;
  129. }
  130. first = false;
  131. c = *s++;
  132. if (_is_hex (c) && ((digit = _from_hex (c)) < radix))
  133. {
  134. /* Valid digit */
  135. result = (result * radix) + digit;
  136. }
  137. else
  138. {
  139. if (delim != (char *) 0)
  140. {
  141. /* See if this character is one of the delimiters */
  142. char *dp = delim;
  143. while (*dp && (c != *dp))
  144. dp++;
  145. if (*dp)
  146. break; /* Found a good delimiter */
  147. }
  148. return false; /* Malformatted number */
  149. }
  150. }
  151. *val = result;
  152. if (es != (char **) 0)
  153. {
  154. *es = s;
  155. }
  156. return true;
  157. }
  158. #ifdef DEBUG
  159. /*
  160. * Note: this debug setup works by storing the strings in a fixed buffer
  161. */
  162. static char zm_debug_buf[8192];
  163. static char *zm_out = zm_debug_buf;
  164. static char *zm_out_start = zm_debug_buf;
  165. static int
  166. zm_dprintf (char *fmt, ...)
  167. {
  168. int len;
  169. va_list args;
  170. va_start (args, fmt);
  171. len = diag_vsprintf (zm_out, fmt, args);
  172. zm_out += len;
  173. return len;
  174. }
  175. static void
  176. zm_flush (void)
  177. {
  178. zm_out = zm_out_start;
  179. }
  180. static void
  181. zm_dump_buf (void *buf, int len)
  182. {
  183. }
  184. static unsigned char zm_buf[2048];
  185. static unsigned char *zm_bp;
  186. static void
  187. zm_new (void)
  188. {
  189. zm_bp = zm_buf;
  190. }
  191. static void
  192. zm_save (unsigned char c)
  193. {
  194. *zm_bp++ = c;
  195. }
  196. static void
  197. zm_dump (int line)
  198. {
  199. zm_dprintf ("Packet at line: %d\n", line);
  200. zm_dump_buf (zm_buf, zm_bp - zm_buf);
  201. }
  202. #define ZM_DEBUG(x) x
  203. #else
  204. #define ZM_DEBUG(x)
  205. #endif
  206. /* Wait for the line to go idle */
  207. static void
  208. xyzModem_flush (void)
  209. {
  210. int res;
  211. char c;
  212. while (true)
  213. {
  214. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, &c);
  215. if (!res)
  216. return;
  217. }
  218. }
  219. static int
  220. xyzModem_get_hdr (void)
  221. {
  222. char c;
  223. int res;
  224. bool hdr_found = false;
  225. int i, can_total, hdr_chars;
  226. unsigned short cksum;
  227. ZM_DEBUG (zm_new ());
  228. /* Find the start of a header */
  229. can_total = 0;
  230. hdr_chars = 0;
  231. if (xyz.tx_ack)
  232. {
  233. CYGACC_COMM_IF_PUTC (*xyz.__chan, ACK);
  234. xyz.tx_ack = false;
  235. }
  236. while (!hdr_found)
  237. {
  238. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, &c);
  239. ZM_DEBUG (zm_save (c));
  240. if (res)
  241. {
  242. hdr_chars++;
  243. switch (c)
  244. {
  245. case SOH:
  246. xyz.total_SOH++;
  247. case STX:
  248. if (c == STX)
  249. xyz.total_STX++;
  250. hdr_found = true;
  251. break;
  252. case CAN:
  253. xyz.total_CAN++;
  254. ZM_DEBUG (zm_dump (__LINE__));
  255. if (++can_total == xyzModem_CAN_COUNT)
  256. {
  257. return xyzModem_cancel;
  258. }
  259. else
  260. {
  261. /* Wait for multiple CAN to avoid early quits */
  262. break;
  263. }
  264. case EOT:
  265. /* EOT only supported if no noise */
  266. if (hdr_chars == 1)
  267. {
  268. CYGACC_COMM_IF_PUTC (*xyz.__chan, ACK);
  269. ZM_DEBUG (zm_dprintf ("ACK on EOT #%d\n", __LINE__));
  270. ZM_DEBUG (zm_dump (__LINE__));
  271. return xyzModem_eof;
  272. }
  273. default:
  274. /* Ignore, waiting for start of header */
  275. ;
  276. }
  277. }
  278. else
  279. {
  280. /* Data stream timed out */
  281. xyzModem_flush (); /* Toss any current input */
  282. ZM_DEBUG (zm_dump (__LINE__));
  283. CYGACC_CALL_IF_DELAY_US ((cyg_int32) 250000);
  284. return xyzModem_timeout;
  285. }
  286. }
  287. /* Header found, now read the data */
  288. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, (char *) &xyz.blk);
  289. ZM_DEBUG (zm_save (xyz.blk));
  290. if (!res)
  291. {
  292. ZM_DEBUG (zm_dump (__LINE__));
  293. return xyzModem_timeout;
  294. }
  295. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, (char *) &xyz.cblk);
  296. ZM_DEBUG (zm_save (xyz.cblk));
  297. if (!res)
  298. {
  299. ZM_DEBUG (zm_dump (__LINE__));
  300. return xyzModem_timeout;
  301. }
  302. xyz.len = (c == SOH) ? 128 : 1024;
  303. xyz.bufp = xyz.pkt;
  304. for (i = 0; i < xyz.len; i++)
  305. {
  306. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, &c);
  307. ZM_DEBUG (zm_save (c));
  308. if (res)
  309. {
  310. xyz.pkt[i] = c;
  311. }
  312. else
  313. {
  314. ZM_DEBUG (zm_dump (__LINE__));
  315. return xyzModem_timeout;
  316. }
  317. }
  318. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, (char *) &xyz.crc1);
  319. ZM_DEBUG (zm_save (xyz.crc1));
  320. if (!res)
  321. {
  322. ZM_DEBUG (zm_dump (__LINE__));
  323. return xyzModem_timeout;
  324. }
  325. if (xyz.crc_mode)
  326. {
  327. res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, (char *) &xyz.crc2);
  328. ZM_DEBUG (zm_save (xyz.crc2));
  329. if (!res)
  330. {
  331. ZM_DEBUG (zm_dump (__LINE__));
  332. return xyzModem_timeout;
  333. }
  334. }
  335. ZM_DEBUG (zm_dump (__LINE__));
  336. /* Validate the message */
  337. if ((xyz.blk ^ xyz.cblk) != (unsigned char) 0xFF)
  338. {
  339. ZM_DEBUG (zm_dprintf
  340. ("Framing error - blk: %x/%x/%x\n", xyz.blk, xyz.cblk,
  341. (xyz.blk ^ xyz.cblk)));
  342. ZM_DEBUG (zm_dump_buf (xyz.pkt, xyz.len));
  343. xyzModem_flush ();
  344. return xyzModem_frame;
  345. }
  346. /* Verify checksum/CRC */
  347. if (xyz.crc_mode)
  348. {
  349. cksum = crc16_ccitt(0, xyz.pkt, xyz.len);
  350. if (cksum != ((xyz.crc1 << 8) | xyz.crc2))
  351. {
  352. ZM_DEBUG (zm_dprintf ("CRC error - recvd: %02x%02x, computed: %x\n",
  353. xyz.crc1, xyz.crc2, cksum & 0xFFFF));
  354. return xyzModem_cksum;
  355. }
  356. }
  357. else
  358. {
  359. cksum = 0;
  360. for (i = 0; i < xyz.len; i++)
  361. {
  362. cksum += xyz.pkt[i];
  363. }
  364. if (xyz.crc1 != (cksum & 0xFF))
  365. {
  366. ZM_DEBUG (zm_dprintf
  367. ("Checksum error - recvd: %x, computed: %x\n", xyz.crc1,
  368. cksum & 0xFF));
  369. return xyzModem_cksum;
  370. }
  371. }
  372. /* If we get here, the message passes [structural] muster */
  373. return 0;
  374. }
  375. int
  376. xyzModem_stream_open (connection_info_t * info, int *err)
  377. {
  378. int stat = 0;
  379. int retries = xyzModem_MAX_RETRIES;
  380. int crc_retries = xyzModem_MAX_RETRIES_WITH_CRC;
  381. /* ZM_DEBUG(zm_out = zm_out_start); */
  382. #ifdef xyzModem_zmodem
  383. if (info->mode == xyzModem_zmodem)
  384. {
  385. *err = xyzModem_noZmodem;
  386. return -1;
  387. }
  388. #endif
  389. /* TODO: CHECK ! */
  390. int dummy = 0;
  391. xyz.__chan = &dummy;
  392. xyz.len = 0;
  393. xyz.crc_mode = true;
  394. xyz.at_eof = false;
  395. xyz.tx_ack = false;
  396. xyz.mode = info->mode;
  397. xyz.total_retries = 0;
  398. xyz.total_SOH = 0;
  399. xyz.total_STX = 0;
  400. xyz.total_CAN = 0;
  401. xyz.read_length = 0;
  402. xyz.file_length = 0;
  403. CYGACC_COMM_IF_PUTC (*xyz.__chan, (xyz.crc_mode ? 'C' : NAK));
  404. if (xyz.mode == xyzModem_xmodem)
  405. {
  406. /* X-modem doesn't have an information header - exit here */
  407. xyz.next_blk = 1;
  408. return 0;
  409. }
  410. while (retries-- > 0)
  411. {
  412. stat = xyzModem_get_hdr ();
  413. if (stat == 0)
  414. {
  415. /* Y-modem file information header */
  416. if (xyz.blk == 0)
  417. {
  418. /* skip filename */
  419. while (*xyz.bufp++);
  420. /* get the length */
  421. parse_num ((char *) xyz.bufp, &xyz.file_length, NULL, " ");
  422. /* The rest of the file name data block quietly discarded */
  423. xyz.tx_ack = true;
  424. }
  425. xyz.next_blk = 1;
  426. xyz.len = 0;
  427. return 0;
  428. }
  429. else if (stat == xyzModem_timeout)
  430. {
  431. if (--crc_retries <= 0)
  432. xyz.crc_mode = false;
  433. CYGACC_CALL_IF_DELAY_US (5 * 100000); /* Extra delay for startup */
  434. CYGACC_COMM_IF_PUTC (*xyz.__chan, (xyz.crc_mode ? 'C' : NAK));
  435. xyz.total_retries++;
  436. ZM_DEBUG (zm_dprintf ("NAK (%d)\n", __LINE__));
  437. }
  438. if (stat == xyzModem_cancel)
  439. {
  440. break;
  441. }
  442. }
  443. *err = stat;
  444. ZM_DEBUG (zm_flush ());
  445. return -1;
  446. }
  447. int
  448. xyzModem_stream_read (char *buf, int size, int *err)
  449. {
  450. int stat, total, len;
  451. int retries;
  452. total = 0;
  453. stat = xyzModem_cancel;
  454. /* Try and get 'size' bytes into the buffer */
  455. while (!xyz.at_eof && (size > 0))
  456. {
  457. if (xyz.len == 0)
  458. {
  459. retries = xyzModem_MAX_RETRIES;
  460. while (retries-- > 0)
  461. {
  462. stat = xyzModem_get_hdr ();
  463. if (stat == 0)
  464. {
  465. if (xyz.blk == xyz.next_blk)
  466. {
  467. xyz.tx_ack = true;
  468. ZM_DEBUG (zm_dprintf
  469. ("ACK block %d (%d)\n", xyz.blk, __LINE__));
  470. xyz.next_blk = (xyz.next_blk + 1) & 0xFF;
  471. if (xyz.mode == xyzModem_xmodem || xyz.file_length == 0)
  472. {
  473. /* Data blocks can be padded with ^Z (EOF) characters */
  474. /* This code tries to detect and remove them */
  475. if ((xyz.bufp[xyz.len - 1] == EOF) &&
  476. (xyz.bufp[xyz.len - 2] == EOF) &&
  477. (xyz.bufp[xyz.len - 3] == EOF))
  478. {
  479. while (xyz.len
  480. && (xyz.bufp[xyz.len - 1] == EOF))
  481. {
  482. xyz.len--;
  483. }
  484. }
  485. }
  486. /*
  487. * See if accumulated length exceeds that of the file.
  488. * If so, reduce size (i.e., cut out pad bytes)
  489. * Only do this for Y-modem (and Z-modem should it ever
  490. * be supported since it can fall back to Y-modem mode).
  491. */
  492. if (xyz.mode != xyzModem_xmodem && 0 != xyz.file_length)
  493. {
  494. xyz.read_length += xyz.len;
  495. if (xyz.read_length > xyz.file_length)
  496. {
  497. xyz.len -= (xyz.read_length - xyz.file_length);
  498. }
  499. }
  500. break;
  501. }
  502. else if (xyz.blk == ((xyz.next_blk - 1) & 0xFF))
  503. {
  504. /* Just re-ACK this so sender will get on with it */
  505. CYGACC_COMM_IF_PUTC (*xyz.__chan, ACK);
  506. continue; /* Need new header */
  507. }
  508. else
  509. {
  510. stat = xyzModem_sequence;
  511. }
  512. }
  513. if (stat == xyzModem_cancel)
  514. {
  515. break;
  516. }
  517. if (stat == xyzModem_eof)
  518. {
  519. CYGACC_COMM_IF_PUTC (*xyz.__chan, ACK);
  520. ZM_DEBUG (zm_dprintf ("ACK (%d)\n", __LINE__));
  521. if (xyz.mode == xyzModem_ymodem)
  522. {
  523. CYGACC_COMM_IF_PUTC (*xyz.__chan,
  524. (xyz.crc_mode ? 'C' : NAK));
  525. xyz.total_retries++;
  526. ZM_DEBUG (zm_dprintf ("Reading Final Header\n"));
  527. stat = xyzModem_get_hdr ();
  528. CYGACC_COMM_IF_PUTC (*xyz.__chan, ACK);
  529. ZM_DEBUG (zm_dprintf ("FINAL ACK (%d)\n", __LINE__));
  530. }
  531. xyz.at_eof = true;
  532. break;
  533. }
  534. CYGACC_COMM_IF_PUTC (*xyz.__chan, (xyz.crc_mode ? 'C' : NAK));
  535. xyz.total_retries++;
  536. ZM_DEBUG (zm_dprintf ("NAK (%d)\n", __LINE__));
  537. }
  538. if (stat < 0)
  539. {
  540. *err = stat;
  541. xyz.len = -1;
  542. return total;
  543. }
  544. }
  545. /* Don't "read" data from the EOF protocol package */
  546. if (!xyz.at_eof)
  547. {
  548. len = xyz.len;
  549. if (size < len)
  550. len = size;
  551. memcpy (buf, xyz.bufp, len);
  552. size -= len;
  553. buf += len;
  554. total += len;
  555. xyz.len -= len;
  556. xyz.bufp += len;
  557. }
  558. }
  559. return total;
  560. }
  561. void
  562. xyzModem_stream_close (int *err)
  563. {
  564. diag_printf
  565. ("xyzModem - %s mode, %d(SOH)/%d(STX)/%d(CAN) packets, %d retries\n",
  566. xyz.crc_mode ? "CRC" : "Cksum", xyz.total_SOH, xyz.total_STX,
  567. xyz.total_CAN, xyz.total_retries);
  568. ZM_DEBUG (zm_flush ());
  569. }
  570. /* Need to be able to clean out the input buffer, so have to take the */
  571. /* getc */
  572. void
  573. xyzModem_stream_terminate (bool abort, int (*getc) (void))
  574. {
  575. int c;
  576. if (abort)
  577. {
  578. ZM_DEBUG (zm_dprintf ("!!!! TRANSFER ABORT !!!!\n"));
  579. switch (xyz.mode)
  580. {
  581. case xyzModem_xmodem:
  582. case xyzModem_ymodem:
  583. /* The X/YMODEM Spec seems to suggest that multiple CAN followed by an equal */
  584. /* number of Backspaces is a friendly way to get the other end to abort. */
  585. CYGACC_COMM_IF_PUTC (*xyz.__chan, CAN);
  586. CYGACC_COMM_IF_PUTC (*xyz.__chan, CAN);
  587. CYGACC_COMM_IF_PUTC (*xyz.__chan, CAN);
  588. CYGACC_COMM_IF_PUTC (*xyz.__chan, CAN);
  589. CYGACC_COMM_IF_PUTC (*xyz.__chan, BSP);
  590. CYGACC_COMM_IF_PUTC (*xyz.__chan, BSP);
  591. CYGACC_COMM_IF_PUTC (*xyz.__chan, BSP);
  592. CYGACC_COMM_IF_PUTC (*xyz.__chan, BSP);
  593. /* Now consume the rest of what's waiting on the line. */
  594. ZM_DEBUG (zm_dprintf ("Flushing serial line.\n"));
  595. xyzModem_flush ();
  596. xyz.at_eof = true;
  597. break;
  598. #ifdef xyzModem_zmodem
  599. case xyzModem_zmodem:
  600. /* Might support it some day I suppose. */
  601. #endif
  602. break;
  603. }
  604. }
  605. else
  606. {
  607. ZM_DEBUG (zm_dprintf ("Engaging cleanup mode...\n"));
  608. /*
  609. * Consume any trailing crap left in the inbuffer from
  610. * previous received blocks. Since very few files are an exact multiple
  611. * of the transfer block size, there will almost always be some gunk here.
  612. * If we don't eat it now, RedBoot will think the user typed it.
  613. */
  614. ZM_DEBUG (zm_dprintf ("Trailing gunk:\n"));
  615. while ((c = (*getc) ()) > -1)
  616. ;
  617. ZM_DEBUG (zm_dprintf ("\n"));
  618. /*
  619. * Make a small delay to give terminal programs like minicom
  620. * time to get control again after their file transfer program
  621. * exits.
  622. */
  623. CYGACC_CALL_IF_DELAY_US ((cyg_int32) 250000);
  624. }
  625. }
  626. char *
  627. xyzModem_error (int err)
  628. {
  629. switch (err)
  630. {
  631. case xyzModem_access:
  632. return "Can't access file";
  633. break;
  634. case xyzModem_noZmodem:
  635. return "Sorry, zModem not available yet";
  636. break;
  637. case xyzModem_timeout:
  638. return "Timed out";
  639. break;
  640. case xyzModem_eof:
  641. return "End of file";
  642. break;
  643. case xyzModem_cancel:
  644. return "Cancelled";
  645. break;
  646. case xyzModem_frame:
  647. return "Invalid framing";
  648. break;
  649. case xyzModem_cksum:
  650. return "CRC/checksum error";
  651. break;
  652. case xyzModem_sequence:
  653. return "Block sequence error";
  654. break;
  655. default:
  656. return "Unknown error";
  657. break;
  658. }
  659. }
  660. /*
  661. * RedBoot interface
  662. */