diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-06-16 15:43:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-06-16 15:43:23 -0600 |
commit | 2d4eb806259e4c25892ee0a9f882654d49a5cec6 (patch) | |
tree | 0cb4eead31837bb0dc42a4428f817e52d0ac8bb9 /apps/include | |
parent | 656b350aa0222f1555978837532e537f6dd4f14c (diff) | |
download | nuttx-2d4eb806259e4c25892ee0a9f882654d49a5cec6.tar.gz nuttx-2d4eb806259e4c25892ee0a9f882654d49a5cec6.tar.bz2 nuttx-2d4eb806259e4c25892ee0a9f882654d49a5cec6.zip |
hex2bin: Add alternative interface layers to illustrate how to load programs
Diffstat (limited to 'apps/include')
-rw-r--r-- | apps/include/hex2bin.h | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/apps/include/hex2bin.h b/apps/include/hex2bin.h index aafcd10b6..73512a3c3 100644 --- a/apps/include/hex2bin.h +++ b/apps/include/hex2bin.h @@ -164,7 +164,7 @@ extern "C" * Returned Value * Zero (OK) is returned on success; a negated errno value is returned on * failure. - * + * ****************************************************************************/ struct lib_instream_s; @@ -174,6 +174,60 @@ int hex2bin(FAR struct lib_instream_s *instream, uint32_t endpaddr, enum hex2bin_swap_e swap); /**************************************************************************** + * Name hex2mem + * + * Description: + * Read the Intel HEX ASCII data provided on the file descriptor 'fd' and + * write the binary to memory. + * + * If, for example, fd is zero (corresponding to stdin), then the HEX + * ASCII data would be taken from the console and written to memory. + * + * Input Parameters: + * fd - The file descriptor from which Intel HEX data will be + * received. + * baseaddr - The base address of the memory region stream. + * endpaddr - The end address (plus 1) of the memory region. + * swap - Controls byte ordering. See enum hex2bin_swap_e for + * description of the values. + * + * Returned Value + * Zero (OK) is returned on success; a negated errno value is returned on + * failure. + * + ****************************************************************************/ + +int hex2mem(int fd, uint32_t baseaddr, uint32_t endpaddr, + enum hex2bin_swap_e swap); + +/**************************************************************************** + * Name fhex2mem + * + * Description: + * Read the Intel HEX ASCII data provided on the standard stream + * 'instream' and write the binary to memory. + * + * If, for example, instream is stdin, then the HEX ASCII data would be + * taken from the console and written to memory. + * + * Input Parameters: + * instream - The incoming standard stream from which Intel HEX data + * will be received. + * baseaddr - The base address of the memory region stream. + * endpaddr - The end address (plus 1) of the memory region. + * swap - Controls byte ordering. See enum hex2bin_swap_e for + * description of the values. + * + * Returned Value + * Zero (OK) is returned on success; a negated errno value is returned on + * failure. + * + ****************************************************************************/ + +int fhex2mem(FAR FILE *instream, uint32_t baseaddr, uint32_t endpaddr, + enum hex2bin_swap_e swap); + +/**************************************************************************** * Name: hex2bin_main * * Description: @@ -184,15 +238,31 @@ int hex2bin(FAR struct lib_instream_s *instream, * * Returned Value * EXIT_SUCESS on success; EXIT_FAILURE on failure - * + * ****************************************************************************/ #ifdef CONFIG_SYSTEM_HEX2BIN_BUILTIN - int hex2bin_main(int argc, char **argv); - #endif /* CONFIG_SYSTEM_HEX2BIN_BUILTIN */ +/**************************************************************************** + * Name: hex2mem_main + * + * Description: + * Main entry point when hex2mem is built as an NSH built-in task. + * + * Input Parameters: + * Standard task inputs + * + * Returned Value + * EXIT_SUCESS on success; EXIT_FAILURE on failure + * + ****************************************************************************/ + +#ifdef CONFIG_SYSTEM_HEX2MEM_BUILTIN +int hex2mem_main(int argc, char **argv); +#endif /* CONFIG_SYSTEM_HEX2MEM_BUILTIN */ + #undef EXTERN #ifdef __cplusplus } |