Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

intelhex.c File Reference

intelhex.c File Reference

Implementation of intelhex.h. More...

Go to the source code of this file.

Functions

static uint16_t swap16 (uint16_t a)
 Swap 16bit value - let compiler figure out the best way.
static uint8_t ctoh (char c)
 Converts a character representation of a hex to real value.
static uint8_t validate_checksum (hex_line_t *record)
 Calculate checksum on a hex record.
void reset_hex_parser (void)
 Prepare any state that is maintained for the start of a file.
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)
 Convert a blob of hex data into its binary equivelant.

Detailed Description

Implementation of intelhex.h.

DAPLink Interface Firmware Copyright (c) 2009-2016, ARM Limited, All Rights Reserved SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file intelhex.c.


Function Documentation

static uint8_t ctoh ( char  c ) [static]

Converts a character representation of a hex to real value.

Parameters:
cis the hex value in char format
Returns:
the value of the hex

Definition at line 61 of file intelhex.c.

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 
)

Convert a blob of hex data into its binary equivelant.

Parameters:
hex_blobA block of ascii encoded hexfile data
hex_blob_sizeThe amount of valid data in the hex_blob
hex_parse_cntThe amount of hex_blob data from the call that was parsed
bin_bufBuffer the decoded hex file contents goes into
bin_buf_sizemax size of the buffer
bin_buf_addressThe start address for data in the bin_buf as decoded from the hex file
bin_buf_cntThe amount of data in the bin_buf
Returns:
A member of hex_parse_status_t that describes the state of decoding

Definition at line 97 of file intelhex.c.

void reset_hex_parser ( void   )

Prepare any state that is maintained for the start of a file.

Parameters:
none
Returns:
none

Definition at line 86 of file intelhex.c.

static uint16_t swap16 ( uint16_t  a ) [static]

Swap 16bit value - let compiler figure out the best way.

Parameters:
vala variable of size uint16_t to be swapped
Returns:
the swapped value

Definition at line 52 of file intelhex.c.

static uint8_t validate_checksum ( hex_line_t *  record ) [static]

Calculate checksum on a hex record.

Parameters:
datais the line of hex record
sizeis the length of the data array
Returns:
1 if the data provided is a valid hex record otherwise 0

Definition at line 71 of file intelhex.c.