Instances of this class may be used to parse an Intel HEX file into an application-provided buffer. More...
#include <core/DspParseIHex.h>
Public Member Functions | |
tcDspParseIHex (void *apOutBuf=NULL, int anOutBufLen=4096) | |
This constructor is used to create an instance of an Intel HEX record parser. | |
~tcDspParseIHex () | |
This destructor is used to close up and free the resources tied to the associated parser. | |
bool | ResetParser (void *apOutBuf=NULL, int anOutBufLen=0) |
This routine is used to reset a parser to an initialized state. | |
int | AddData (void *apData, int anLength) |
This routine is used to add data to the parser. | |
void | DisableOutput (bool abDisable) |
This method allows writing to the output buffer to be disabled (for instance, when performing only a validation of a file). | |
void | ResetOutputBuffer (char anBlank) |
This method clears the output buffer using the provided character. |
Instances of this class may be used to parse an Intel HEX file into an application-provided buffer.
tcDspParseIHex::tcDspParseIHex | ( | void * | apOutBuf = NULL , |
|
int | anOutBufLen = 4096 | |||
) |
This constructor is used to create an instance of an Intel HEX record parser.
Storage for parser output, and the maximum size of the output, may be optionally provided. If no buffer is provided, the class attempts to create one.
[in] | apOutBuf | - Address of parser output buffer (default: NULL) |
[in] | anOutBufLen | - Lngth of output buffer (default: 4K) |
tcDspParseIHex::~tcDspParseIHex | ( | ) |
This destructor is used to close up and free the resources tied to the associated parser.
bool tcDspParseIHex::ResetParser | ( | void * | apOutBuf = NULL , |
|
int | anOutBufLen = 0 | |||
) | [virtual] |
This routine is used to reset a parser to an initialized state.
A new output buffer may optionally be provided.
[in] | apOutBuf | - Address of new parser output buffer (default: NULL) |
[in] | anOutBufLen | - Length of new output buffer (default: 0) |
Reimplemented from MityDSP::tcDspParserBase.
int tcDspParseIHex::AddData | ( | void * | apData, | |
int | anLength | |||
) | [virtual] |
This routine is used to add data to the parser.
In this class, the parse finds a start record, and then decodes data records, until an end record is reached. At this point the registered callback is activated with a status of eeParseOK.
Errors are generated if the start record is not found when expected, if any of the decoded data falls outside the provided output buffer, or if any of the individual record checksums are incorrect.
A running 32-bit checksum is maintained for the entire file, and is passed to the callback upon completion.
[in] | apData | - Pointer to new data |
[in] | anLength | - Length of new data |
Reimplemented from MityDSP::tcDspParserBase.
void tcDspParseIHex::DisableOutput | ( | bool | abDisable | ) |
This method allows writing to the output buffer to be disabled (for instance, when performing only a validation of a file).
[in] | abDisable | True to disable writing to the output buffer. |
void tcDspParseIHex::ResetOutputBuffer | ( | char | anBlank | ) |
This method clears the output buffer using the provided character.
[in] | anBlank | The character to use to clear the buffer. |