[tuxdroid-svn] r382 - firmware/tuxup/trunk
Status: Beta
Brought to you by:
ks156
From: neimad <c2m...@c2...> - 2007-06-17 09:50:22
|
Author: neimad Date: 2007-06-17 11:50:17 +0200 (Sun, 17 Jun 2007) New Revision: 382 Modified: firmware/tuxup/trunk/bootloader.c Log: * Deleted unused variable "hexFile". * Made most functions static. * Merged doxygen comments of those functions who had separate doxygen comments for function description and parameter descriptions. Also fixed these comments: they were all taking about nibbles, while some actually parsed bytes or words. Copy/paste jobs suck ;-) Modified: firmware/tuxup/trunk/bootloader.c =================================================================== --- firmware/tuxup/trunk/bootloader.c 2007-06-17 09:31:19 UTC (rev 381) +++ firmware/tuxup/trunk/bootloader.c 2007-06-17 09:50:17 UTC (rev 382) @@ -56,8 +56,6 @@ #define BOOT_FILLPAGE 2 #define BOOT_EXIT 2 -static const char *hexFile = NULL; - typedef uint32_t FILE_Addr_t; typedef uint32_t FILE_SegmentLen_t; typedef unsigned FILE_LineNum_t; @@ -92,7 +90,7 @@ * Clears any data stored in the parsed data */ -void ClearData(FILE_ParsedData_t * parsedData) +static void ClearData(FILE_ParsedData_t * parsedData) { if (parsedData->dataAlloc > 0) { @@ -105,7 +103,7 @@ * Releases any allocated data in the parsed data buffer. */ -void FreeData(FILE_ParsedData_t * parsedData) +static void FreeData(FILE_ParsedData_t * parsedData) { if (parsedData->dataAlloc > 0) { @@ -120,7 +118,7 @@ * Allocates (or reallocates) the data buffer */ -uint8_t *AllocData(FILE_ParsedData_t * parsedData, FILE_ParsedLen_t reqLen) +static uint8_t *AllocData(FILE_ParsedData_t * parsedData, FILE_ParsedLen_t reqLen) { if (reqLen <= parsedData->dataAlloc) { @@ -141,16 +139,17 @@ } // AllocData /** - * Parses a single nibble from a string containing ASCII Hex characters. + * Parses a single nibble from a string containing ASCII Hex characters. * - * @return TRUE, if a nibble was parsed successfully, FALSE otherwise. + * @param[in,out] parser Parser object that we're reporting about + * @param[in,out] s Pointer to string; will be advanced. + * @param[out] b Nibble that was parsed + * @param[int] label Error string (used for reporting errors) + * + * @return TRUE, if a nibble was parsed successfully, FALSE otherwise. */ - -int GetNibble(Parser_t * parser, ///< (mod) Parser object that we're reporting about. - const char **s, ///< (mod) Pointer to string. Will be advanced. - unsigned char *b, ///< (out) nibble that was parsed. - const char *label ///< (in) Error string (used for reporting errors). - ) +static int GetNibble(Parser_t * parser, const char **s, unsigned char *b, + const char *label) { char ch = **s; @@ -180,16 +179,17 @@ } // GetNibble /** - * Parses a single byte from a string containing ASCII Hex characters. + * Parses a single byte from a string containing ASCII Hex characters. * - * @return TRUE, if a byte was parsed successfully, FALSE otherwise. + * @param[in,out] parser Parser object that we're reporting about + * @param[in,out] s Pointer to string; will be advanced + * @param[out] b Byte that was parsed + * @param[in] label Error string (used for reporting errors) + * + * @return TRUE, if a byte was parsed successfully, FALSE otherwise. */ - -int GetByte(Parser_t * parser, ///< (mod) Parser object that we're reporting about. - const char **s, ///< (mod) Pointer to string. Will be advanced. - unsigned char *b, ///< (out) nibble that was parsed. - const char *label ///< (in) Error string (used for reporting errors). - ) +static int GetByte(Parser_t * parser, const char **s, unsigned char *b, + const char *label) { unsigned char b1, b2; @@ -204,16 +204,17 @@ } // GetByte /** - * Parses two bytes from a string containing ASCII Hex characters. + * Parses two bytes from a string containing ASCII Hex characters. * - * @return TRUE, if a byte was parsed successfully, FALSE otherwise. + * @param[in,out] parser Parser object that we're reporting about + * @param[in,out] s Pointer to string; will be advanced + * @param[out] b Word that was parsed + * @param[in] label Error string (used for reporting errors) + * + * @return TRUE, if a byte was parsed successfully, FALSE otherwise. */ - -int GetWord(Parser_t * parser, ///< (mod) Parser object that we're reporting about. - const char **s, ///< (mod) Pointer to string. Will be advanced. - unsigned short *b, ///< (out) nibble that was parsed. - const char *label ///< (in) Error string (used for reporting errors). - ) +static int GetWord(Parser_t * parser, const char **s, unsigned short *b, + const char *label) { unsigned char b1, b2; @@ -227,7 +228,7 @@ } // GetWord -int startSegment(Parser_t * parser) +static int startSegment(Parser_t * parser) { parser->segmentDataIdx = 0; /* set segment address */ @@ -246,7 +247,7 @@ /** * Put one byte of data in the segmentData */ -int fillSegment(Parser_t * parser, uint8_t data) +static int fillSegment(Parser_t * parser, uint8_t data) { parser->segmentData[parser->segmentDataIdx++] = data; parser->currAddr++; @@ -324,7 +325,7 @@ * @return TRUE if parsing should continue, FALSE if it should stop. */ -int ParsedData(Parser_t * parser, int lastSeg) +static int ParsedData(Parser_t * parser, int lastSeg) { FILE_ParsedData_t *parsedData = &parser->parsedData; @@ -414,7 +415,7 @@ * See: http://www.xess.com/faq/intelhex.pdf for the complete spec */ -int parseIHexLine(Parser_t * parser, const char *line) +static int parseIHexLine(Parser_t * parser, const char *line) { int i; FILE_ParsedData_t *parsedData = &parser->parsedData; @@ -513,7 +514,7 @@ * Parses an intel hex file, calling the appropriate callbacks along the way */ -int FILE_ParseFile(usb_dev_handle * dev_h, const char *fileName) +static int FILE_ParseFile(usb_dev_handle * dev_h, const char *fileName) { FILE *fs = NULL; Parser_t parser; |