Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pawel Zarembski 0:01f31e923fe2 1 /**
Pawel Zarembski 0:01f31e923fe2 2 * @file intelhex.h
Pawel Zarembski 0:01f31e923fe2 3 * @brief Parser for the intel hex format
Pawel Zarembski 0:01f31e923fe2 4 *
Pawel Zarembski 0:01f31e923fe2 5 * DAPLink Interface Firmware
Pawel Zarembski 0:01f31e923fe2 6 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
Pawel Zarembski 0:01f31e923fe2 7 * SPDX-License-Identifier: Apache-2.0
Pawel Zarembski 0:01f31e923fe2 8 *
Pawel Zarembski 0:01f31e923fe2 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Pawel Zarembski 0:01f31e923fe2 10 * not use this file except in compliance with the License.
Pawel Zarembski 0:01f31e923fe2 11 * You may obtain a copy of the License at
Pawel Zarembski 0:01f31e923fe2 12 *
Pawel Zarembski 0:01f31e923fe2 13 * http://www.apache.org/licenses/LICENSE-2.0
Pawel Zarembski 0:01f31e923fe2 14 *
Pawel Zarembski 0:01f31e923fe2 15 * Unless required by applicable law or agreed to in writing, software
Pawel Zarembski 0:01f31e923fe2 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Pawel Zarembski 0:01f31e923fe2 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Pawel Zarembski 0:01f31e923fe2 18 * See the License for the specific language governing permissions and
Pawel Zarembski 0:01f31e923fe2 19 * limitations under the License.
Pawel Zarembski 0:01f31e923fe2 20 */
Pawel Zarembski 0:01f31e923fe2 21
Pawel Zarembski 0:01f31e923fe2 22 #ifndef INTELHEX_H
Pawel Zarembski 0:01f31e923fe2 23 #define INTELHEX_H
Pawel Zarembski 0:01f31e923fe2 24
Pawel Zarembski 0:01f31e923fe2 25 /** \ingroup hexfile_parser
Pawel Zarembski 0:01f31e923fe2 26 * @{
Pawel Zarembski 0:01f31e923fe2 27 */
Pawel Zarembski 0:01f31e923fe2 28
Pawel Zarembski 0:01f31e923fe2 29 #include <stdint.h>
Pawel Zarembski 0:01f31e923fe2 30
Pawel Zarembski 0:01f31e923fe2 31 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 32 extern "C" {
Pawel Zarembski 0:01f31e923fe2 33 #endif
Pawel Zarembski 0:01f31e923fe2 34
Pawel Zarembski 0:01f31e923fe2 35 /** Type of states that the parser can return
Pawel Zarembski 0:01f31e923fe2 36 * @enum hexfile_parse_status_t
Pawel Zarembski 0:01f31e923fe2 37 */
Pawel Zarembski 0:01f31e923fe2 38 typedef enum {
Pawel Zarembski 0:01f31e923fe2 39 HEX_PARSE_OK = 0, /*!< The input buffer was complete parsed and converted into the output buffer */
Pawel Zarembski 0:01f31e923fe2 40 HEX_PARSE_EOF, /*!< EOF line found in the hex file */
Pawel Zarembski 0:01f31e923fe2 41 HEX_PARSE_UNALIGNED, /*!< The address of decoded data isnt consecutive. Need to program what was returned and continue to parse the input buffer */
Pawel Zarembski 0:01f31e923fe2 42 HEX_PARSE_LINE_OVERRUN, /*!< Error state when the record length is longer than the record structure */
Pawel Zarembski 0:01f31e923fe2 43 HEX_PARSE_CKSUM_FAIL, /*!< Error state when the record checksum doesnt properly compute */
Pawel Zarembski 0:01f31e923fe2 44 HEX_PARSE_UNINIT, /*!< Default state. Return of this type is unrecoverable logic error */
Pawel Zarembski 0:01f31e923fe2 45 HEX_PARSE_FAILURE /*!< Amount of hex data to decode didnt match the parsing logics count of decoded bytes */
Pawel Zarembski 0:01f31e923fe2 46 } hexfile_parse_status_t;
Pawel Zarembski 0:01f31e923fe2 47
Pawel Zarembski 0:01f31e923fe2 48 /** Prepare any state that is maintained for the start of a file
Pawel Zarembski 0:01f31e923fe2 49 * @param none
Pawel Zarembski 0:01f31e923fe2 50 * @return none
Pawel Zarembski 0:01f31e923fe2 51 */
Pawel Zarembski 0:01f31e923fe2 52 void reset_hex_parser(void);
Pawel Zarembski 0:01f31e923fe2 53
Pawel Zarembski 0:01f31e923fe2 54 /** Convert a blob of hex data into its binary equivelant
Pawel Zarembski 0:01f31e923fe2 55 * @param hex_blob A block of ascii encoded hexfile data
Pawel Zarembski 0:01f31e923fe2 56 * @param hex_blob_size The amount of valid data in the hex_blob
Pawel Zarembski 0:01f31e923fe2 57 * @param hex_parse_cnt The amount of hex_blob data from the call that was parsed
Pawel Zarembski 0:01f31e923fe2 58 * @param bin_buf Buffer the decoded hex file contents goes into
Pawel Zarembski 0:01f31e923fe2 59 * @param bin_buf_size max size of the buffer
Pawel Zarembski 0:01f31e923fe2 60 * @param bin_buf_address The start address for data in the bin_buf as decoded from the hex file
Pawel Zarembski 0:01f31e923fe2 61 * @param bin_buf_cnt The amount of data in the bin_buf
Pawel Zarembski 0:01f31e923fe2 62 * @return A member of hex_parse_status_t that describes the state of decoding
Pawel Zarembski 0:01f31e923fe2 63 */
Pawel Zarembski 0:01f31e923fe2 64 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);
Pawel Zarembski 0:01f31e923fe2 65
Pawel Zarembski 0:01f31e923fe2 66 #ifdef __cplusplus
Pawel Zarembski 0:01f31e923fe2 67 }
Pawel Zarembski 0:01f31e923fe2 68 #endif
Pawel Zarembski 0:01f31e923fe2 69
Pawel Zarembski 0:01f31e923fe2 70 /** @} */
Pawel Zarembski 0:01f31e923fe2 71
Pawel Zarembski 0:01f31e923fe2 72 #endif