BeRTOS
Defines | Functions
xmodem.c File Reference

X-Modem serial transmission protocol (implementation) More...

#include "xmodem.h"
#include "cfg/cfg_xmodem.h"
#include <cfg/debug.h>
#include <cfg/log.h>
#include <algo/crc.h>
#include <string.h>

Go to the source code of this file.

Defines

#define XM_BUFSIZE   128
 128 bytes of block buffer
Protocol control codes
#define XM_SOH   0x01
 Start Of Header (128-byte block)
#define XM_STX   0x02
 Start Of Header (1024-byte block)
#define XM_EOT   0x04
 End Of Transmission.
#define XM_ACK   0x06
 Acknowledge block.
#define XM_NAK   0x15
 Negative Acknowledge.
#define XM_C   0x43
 Request CRC-16 transmission.
#define XM_CAN   0x18
 CANcel transmission.

Functions

bool xmodem_recv (KFile *ch, KFile *fd)
 Receive a file using the XModem protocol.
bool xmodem_send (KFile *ch, KFile *fd)
 Transmit some data using the XModem protocol.

Detailed Description

X-Modem serial transmission protocol (implementation)

Supports the CRC-16 and 1K-blocks variants of the standard.

See also:
ymodem.txt for the protocol description.
Author:
Bernie Innocenti <bernie@codewiz.org>
Francesco Sacchi <batt@develer.com>

Definition in file xmodem.c.


Function Documentation

bool xmodem_recv ( KFile ch,
KFile fd 
)

Receive a file using the XModem protocol.

Parameters:
chChannel to use for transfer
fdDestination file
Note:
This function allocates a large amount of stack (
See also:
XM_BUFSIZE).

Definition at line 90 of file xmodem.c.

bool xmodem_send ( KFile ch,
KFile fd 
)

Transmit some data using the XModem protocol.

Parameters:
chChannel to use for transfer
fdSource file
Note:
This function allocates a large amount of stack for the XModem transfer buffer (
See also:
XM_BUFSIZE).

Definition at line 316 of file xmodem.c.