CConfigFiles Class Reference

abbreviations used: ihx - Intel Hex xbt - Xilinx Bit More...

#include <config_files.h>


Public Member Functions

 CConfigFiles ()
 Constructor.
virtual ~CConfigFiles ()
 Destructor.
int ihxOpen (string fileName)
 Open an Intel Hex File.
int ihxRead (byte *b)
 Read N bytes (unsigned chars) from the opened file, returns an error if a file hasn't been open.
int ihxClose ()
 Close an Intel Hex File, closes the currently open hex file.
int xbtOpen (string fileName)
int xbtRead (byte *b, int &N)
int xbtClose ()

Data Fields

int ihxLen
int ihxType
int ihxAddress
int xbtTotalBytes
 Xilinx Bit File Data Types and Methods.
int xbtPAddr

Static Public Attributes

static const int MAX_IHX_RECORD_LEN = 16
 Intel Hex File Data Types and Methods.


Detailed Description

abbreviations used: ihx - Intel Hex xbt - Xilinx Bit

TODO: Generate a generic class that can read and write different configuraiton files and store in a common structure. Many different formats to add.

Definition at line 45 of file config_files.h.


Constructor & Destructor Documentation

CConfigFiles::CConfigFiles (  )  [inline]

Constructor.

Definition at line 57 of file config_files.h.

virtual CConfigFiles::~CConfigFiles (  )  [inline, virtual]

Destructor.

Definition at line 59 of file config_files.h.


Member Function Documentation

int CConfigFiles::ihxOpen ( string  fileName  ) 

Open an Intel Hex File.

This function has only been used and tested with .hex files produced by the SDCC compiler for the 8051 microcontrollers.

Returns:
Success or failure 0 = Success, !0 = Failure and fail code.
Parameters:
[in] file string, the hexfiles file name

Todo:
Change to Logging!!

Definition at line 67 of file config_files.cpp.

Referenced by FX2LP_8051::downloadFirmware().

int CConfigFiles::ihxRead ( byte b  ) 

Read N bytes (unsigned chars) from the opened file, returns an error if a file hasn't been open.

Returns:
0 success else error.
Parameters:
[in] b byte buffer at least MAX_RECORD_LEN.
This function will read one record at a time to be send for configuration.

Some infromation about the Intel Hex Record File.

Position Description

  1. 1 Record Marker: The first character of the line is always a colon (ASCII 0x3A) to identify the line as an Intel HEX file

  1. 2 - 3 Record Length: This field contains the number of data bytes in the register represented as a 2-digit hexidecimal number. This is the total number of data bytes, not including the checksum byte nor the first 9 characters of the line.

  1. 4 - 7 Address: This field contains the address where the data should be loaded into the chip. This is a value from 0 to 65,535 represented as a 4-digit hexidecimal value.

  1. 8 - 9 Record Type: This field indicates the type of record for this line. The possible values are: 00=Register contains normal data. 01=End of File. 02=Extended address.

  1. 10 - ? Data Bytes: The following bytes are the actual data that will be burned into the EPROM. The data is represented as 2-digit hexidecimal values.

  1. Last 2 Checksum: The last two characters of the line are a checksum chars for the line. The checksum value is calculated by taking the twos complement of the sum of all the preceeding data bytes, excluding the checksum byte itself and the colon at the beginning of the line

Todo:
Change to Logging!!

Todo:
Change to Logging!!

Todo:
Change to Logging!!

Todo:
Change to Logging!!

Todo:
Change to Logging!!

Todo:
Change to Logging!!

Definition at line 122 of file config_files.cpp.

References ihxAddress, ihxLen, ihxType, and MAX_IHX_RECORD_LEN.

Referenced by FX2LP_8051::downloadFirmware().

int CConfigFiles::ihxClose (  ) 

Close an Intel Hex File, closes the currently open hex file.

Definition at line 190 of file config_files.cpp.

Referenced by FX2LP_8051::downloadFirmware().

int CConfigFiles::xbtOpen ( string  fileName  ) 

Definition at line 244 of file config_files.cpp.

References _VERBOSE_, hexDump(), and xbtTotalBytes.

Referenced by XILINX_XS3::downloadConfigFile().

int CConfigFiles::xbtRead ( byte b,
int &  N 
)

Definition at line 276 of file config_files.cpp.

References _VERBOSE_, hexDump(), and xbtTotalBytes.

Referenced by XILINX_XS3::downloadConfigFile().

int CConfigFiles::xbtClose (  ) 

Definition at line 299 of file config_files.cpp.

References _VERBOSE_, and xbtTotalBytes.

Referenced by XILINX_XS3::downloadConfigFile().


Field Documentation

const int CConfigFiles::MAX_IHX_RECORD_LEN = 16 [static]

Intel Hex File Data Types and Methods.

Definition at line 62 of file config_files.h.

Referenced by FX2LP_8051::downloadFirmware(), and ihxRead().

int CConfigFiles::ihxLen

Definition at line 63 of file config_files.h.

Referenced by FX2LP_8051::downloadFirmware(), and ihxRead().

int CConfigFiles::ihxType

Definition at line 64 of file config_files.h.

Referenced by FX2LP_8051::downloadFirmware(), and ihxRead().

int CConfigFiles::ihxAddress

Definition at line 65 of file config_files.h.

Referenced by FX2LP_8051::downloadFirmware(), and ihxRead().

int CConfigFiles::xbtTotalBytes

Xilinx Bit File Data Types and Methods.

Definition at line 72 of file config_files.h.

Referenced by xbtClose(), xbtOpen(), and xbtRead().

int CConfigFiles::xbtPAddr

Definition at line 73 of file config_files.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 5 20:44:21 2007 for usbp by  doxygen 1.5.1-p1