Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
intelhex.h
00001 /** 00002 * @file intelhex.h 00003 * @brief Parser for the intel hex format 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #ifndef INTELHEX_H 00023 #define INTELHEX_H 00024 00025 /** \ingroup hexfile_parser 00026 * @{ 00027 */ 00028 00029 #include <stdint.h> 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 /** Type of states that the parser can return 00036 * @enum hexfile_parse_status_t 00037 */ 00038 typedef enum { 00039 HEX_PARSE_OK = 0, /*!< The input buffer was complete parsed and converted into the output buffer */ 00040 HEX_PARSE_EOF , /*!< EOF line found in the hex file */ 00041 HEX_PARSE_UNALIGNED , /*!< The address of decoded data isnt consecutive. Need to program what was returned and continue to parse the input buffer */ 00042 HEX_PARSE_LINE_OVERRUN , /*!< Error state when the record length is longer than the record structure */ 00043 HEX_PARSE_CKSUM_FAIL , /*!< Error state when the record checksum doesnt properly compute */ 00044 HEX_PARSE_UNINIT , /*!< Default state. Return of this type is unrecoverable logic error */ 00045 HEX_PARSE_FAILURE /*!< Amount of hex data to decode didnt match the parsing logics count of decoded bytes */ 00046 } hexfile_parse_status_t; 00047 00048 /** Prepare any state that is maintained for the start of a file 00049 * @param none 00050 * @return none 00051 */ 00052 void reset_hex_parser(void); 00053 00054 /** Convert a blob of hex data into its binary equivelant 00055 * @param hex_blob A block of ascii encoded hexfile data 00056 * @param hex_blob_size The amount of valid data in the hex_blob 00057 * @param hex_parse_cnt The amount of hex_blob data from the call that was parsed 00058 * @param bin_buf Buffer the decoded hex file contents goes into 00059 * @param bin_buf_size max size of the buffer 00060 * @param bin_buf_address The start address for data in the bin_buf as decoded from the hex file 00061 * @param bin_buf_cnt The amount of data in the bin_buf 00062 * @return A member of hex_parse_status_t that describes the state of decoding 00063 */ 00064 hexfile_parse_status_t parse_hex_blob(const uint8_t *hex_blob, const uint32_t hex_blob_size, uint32_t *hex_parse_cnt, uint8_t *bin_buf, const uint32_t bin_buf_size, uint32_t *bin_buf_address, uint32_t *bin_buf_cnt); 00065 00066 #ifdef __cplusplus 00067 } 00068 #endif 00069 00070 /** @} */ 00071 00072 #endif
Generated on Tue Jul 12 2022 15:37:19 by
