Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page   Data Structures   File List   Data Fields   Globals  

rom400_tftp.h File Reference


Detailed Description

TFTP Client functions in the DS80C400 ROM.

This library contains functions for downloading files from a TFTP server. Note that the function settftpserver from the socket library must be used to initialize the IP address of the TFTP server before communication can begin.

For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.

Warning:
The functions in this library are multi-process safe--that is, if you call the same method from two different processes at the same time, the parameters to the function will not be destroyed. However, only one TFTP client is a available, and it uses system-wide resources. Therefore, it is recommended that one process manage the TFTP client.

Go to the source code of this file.

Defines

#define ROM400_TFTP_VERSION   5
#define TFTP_MORE_DATA   0
#define TFTP_LAST_SEGMENT   1

Functions

unsigned int tftp_init (void)
 Initialize the TFTP client.

unsigned int tftp_first (unsigned char *filename)
 Requests a file from the TFTP server.

unsigned int tftp_next (unsigned int ack_only)
 Read subsequent blocks of a file from a TFTP server.

void * tftp_getdata (void)
 Get the pointer to the TFTP client's read buffer.

void tftp_close (void)
 Closes the socket used by the TFTP library.

unsigned int tftp_version (void)
 Returns the version number of this TFTP library.


Define Documentation

#define ROM400_TFTP_VERSION   5
 

Version number associated with this header file. Should be the same as the version number returned by the tftp_version function.

See also:
tftp_version

#define TFTP_LAST_SEGMENT   1
 

Agrument to function tftp_next requesting the connection be closed.

See also:
tftp_next

#define TFTP_MORE_DATA   0
 

Agrument to function tftp_next requesting more data.

See also:
tftp_next


Function Documentation

void tftp_close void   
 

Closes the socket used by the TFTP library.

Closes the socket used by the TFTP library. Every call to tftp_first creates a new socket, and must be balanced by a call to tftp_close or the system will have lingering, inaccessible sockets.

See also:
tftp_first

tftp_next

unsigned int tftp_first unsigned char *    filename
 

Requests a file from the TFTP server.

Requests the specified file from the TFTP server. As long as the file exists and this function returns successfully, use the buffer pointer returned from tftp_getdata to read the first block of the requested file. Use tftp_next to read subsequent blocks of data. After the TFTP transaction is complete (or an error has occurred and the TFTP transaction will be abandoned), use tftp_close to clean up the transmission socket.

Parameters:
filename pointer to a null-terminated string that is the file to be requested from the TFTP server
Returns:
0x0FFFF on failure, else the number of bytes read this time
See also:
tftp_next

tftp_close

tftp_getdata

void* tftp_getdata void   
 

Get the pointer to the TFTP client's read buffer.

Applications should read the TFTP data after every call to tftp_first or tftp_next. This function only needs to be called once after tftp_init has been called (the buffer pointer does not change).

Returns:
Pointer to the area that the TFTP client is writing to
See also:
tftp_first

tftp_next

unsigned int tftp_init void   
 

Initialize the TFTP client.

Initializes the TFTP client. Note that the IP address of the TFTP server must be set using the settftpserver function from the socket library. After the TFTP Client is initialized, call the tftp_getdata function to request a pointer to the TFTP client's buffer.

Returns:
0 for success, non-zero for failure
See also:
tftp_getdata

unsigned int tftp_next unsigned int    ack_only
 

Read subsequent blocks of a file from a TFTP server.

Requests the next block of a file be read from the TFTP server. Use the buffer pointer returned from tftp_getdata to read the block read from the TFTP server. If this function returns less than 512 bytes read, it means this is the last block of data. Call tftp_next one more time with the argument TFTP_LAST_SEGMENT to clean up. After the TFTP transaction is complete (or an error has occurred and the TFTP transaction will be abandoned), use tftp_close to clean up the transmission socket.

Parameters:
ack_only Use TFTP_MORE_DATA to request more data until the amount returned is less than 512 bytes. Use TFTP_LAST_SEGMENT to acknowledge the last segment was recieved.
Returns:
0x0FFFF on failure, or the number of bytes read.
See also:
tftp_first

tftp_close

tftp_getdata

TFTP_MORE_DATA

TFTP_LAST_SEGMENT

unsigned int tftp_version void   
 

Returns the version number of this TFTP library.

Returns:
Version number of this TFTP library.


Copyright 2004 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.