projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor countFileSize to return the size directly.
[bertos.git]
/
bertos
/
net
/
xmodem.c
diff --git
a/bertos/net/xmodem.c
b/bertos/net/xmodem.c
index d6653a49d6c37d635a87af142685063599e20e23..ec899cb130b8f59ad2802817dbddcce4d8a40f3e 100644
(file)
--- a/
bertos/net/xmodem.c
+++ b/
bertos/net/xmodem.c
@@
-27,9
+27,10
@@
* the GNU General Public License.
*
* Copyright 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
* the GNU General Public License.
*
* Copyright 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
- * Copyright 1999, 2001 Bern
ardo Innocenti <bernie@develer.com
>
+ * Copyright 1999, 2001 Bern
ie Innocenti <bernie@codewiz.org
>
*
* -->
*
* -->
+ *
* \brief X-Modem serial transmission protocol (implementation)
*
* Supports the CRC-16 and 1K-blocks variants of the standard.
* \brief X-Modem serial transmission protocol (implementation)
*
* Supports the CRC-16 and 1K-blocks variants of the standard.
@@
-38,21
+39,22
@@
* \todo Break xmodem_send() and xmodem_recv() in smaller functions.
*
* \version $Id$
* \todo Break xmodem_send() and xmodem_recv() in smaller functions.
*
* \version $Id$
- * \author Bernardo Innocenti <bernie@develer.com>
+ *
+ * \author Bernie Innocenti <bernie@codewiz.org>
* \author Francesco Sacchi <batt@develer.com>
*/
#include "xmodem.h"
* \author Francesco Sacchi <batt@develer.com>
*/
#include "xmodem.h"
-#include <appconfig.h>
-#include <string.h> /* for memset() */
-#include <drv/ser.h>
-#include <algo/crc.h>
#include <cfg/debug.h>
#include <cfg/debug.h>
+#include "cfg/cfg_xmodem.h"
+#include <drv/ser.h>
+#include <algo/crc.h>
+#include <string.h> /* for memset() */
/**
* \name Protocol control codes
/**
* \name Protocol control codes
@@
-86,7
+88,7
@@
*
* \note This function allocates a large amount of stack (\see XM_BUFSIZE).
*/
*
* \note This function allocates a large amount of stack (\see XM_BUFSIZE).
*/
-bool xmodem_recv(struct
KFile
Serial *port, KFile *fd)
+bool xmodem_recv(struct Serial *port, KFile *fd)
{
char block_buffer[XM_BUFSIZE]; /* Buffer to hold a block of data */
int c, i, blocksize;
{
char block_buffer[XM_BUFSIZE]; /* Buffer to hold a block of data */
int c, i, blocksize;
@@
-100,7
+102,7
@@
bool xmodem_recv(struct KFileSerial *port, KFile *fd)
XMODEM_PROGRESS("Starting Transfer...\n");
purge = true;
XMODEM_PROGRESS("Starting Transfer...\n");
purge = true;
-
ser_clearerr(port
);
+
kfile_clearerr(&port->fd
);
/* Send initial NAK to start transmission */
for(;;)
/* Send initial NAK to start transmission */
for(;;)
@@
-278,7
+280,7
@@
bool xmodem_recv(struct KFileSerial *port, KFile *fd)
break;
case XM_EOT: /* End of transmission */
break;
case XM_EOT: /* End of transmission */
- kfile_putc
har
(XM_ACK, &port->fd);
+ kfile_putc(XM_ACK, &port->fd);
XMODEM_PROGRESS("Transfer completed\n");
return true;
XMODEM_PROGRESS("Transfer completed\n");
return true;
@@
-306,7
+308,7
@@
bool xmodem_recv(struct KFileSerial *port, KFile *fd)
* \note This function allocates a large amount of stack for
* the XModem transfer buffer (\see XM_BUFSIZE).
*/
* \note This function allocates a large amount of stack for
* the XModem transfer buffer (\see XM_BUFSIZE).
*/
-bool xmodem_send(struct
KFile
Serial *port, KFile *fd)
+bool xmodem_send(struct Serial *port, KFile *fd)
{
char block_buffer[XM_BUFSIZE]; /* Buffer to hold a block of data */
size_t size = -1;
{
char block_buffer[XM_BUFSIZE]; /* Buffer to hold a block of data */
size_t size = -1;
@@
-420,8
+422,8
@@
bool xmodem_send(struct KFileSerial *port, KFile *fd)
{
crc = UPDCRC16(0, crc);
crc = UPDCRC16(0, crc);
{
crc = UPDCRC16(0, crc);
crc = UPDCRC16(0, crc);
-
ser_putchar(crc >> 8, port
);
-
ser_putchar(crc & 0xFF, port
);
+
kfile_putc(crc >> 8, &port->fd
);
+
kfile_putc(crc & 0xFF, &port->fd
);
}
else
kfile_putc(sum, &port->fd);
}
else
kfile_putc(sum, &port->fd);