srecord 1.65.0
 
Loading...
Searching...
No Matches
endian.h
Go to the documentation of this file.
1//
2// srecord - Manipulate EPROM load files
3// Copyright (C) 2008, 2010-2012 Peter Miller
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation; either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this program. If not, see
17// <http://www.gnu.org/licenses/>.
18//
19
20#ifndef SRECORD_ENDIAN_H
21#define SRECORD_ENDIAN_H
22
23namespace srecord
24{
25
31
32/**
33 * The endian_to_string function may be used to convert an endian value
34 * into its string equivalent.
35 *
36 * @param x
37 * The value to convert
38 * @returns
39 * a C string
40 */
42
43/**
44 * The decode_word_be function is used to decode a big-endian 2-byte
45 * data buffer into an unsigned short value.
46 *
47 * @param data
48 * The data to be decoded
49 */
50unsigned short decode_word_be(const unsigned char *data);
51
52/**
53 * The decode_word_le function is used to decode a little-endian 2-byte
54 * data buffer into an unsigned short value.
55 *
56 * @param data
57 * The data to be decoded
58 */
59unsigned short decode_word_le(const unsigned char *data);
60
61/**
62 * The decode_word_le function is used to decode a little-endian 2-byte
63 * data buffer into an unsigned short value.
64 *
65 * @param data
66 * The data to be decoded
67 * @param order
68 * The order of the bytes to be decoded.
69 */
70unsigned short endian_decode_word(const unsigned char *data, endian_t order);
71
72};
73
74// vim: set ts=8 sw=4 et :
75#endif // SRECORD_ENDIAN_H
unsigned short decode_word_be(const unsigned char *data)
The decode_word_be function is used to decode a big-endian 2-byte data buffer into an unsigned short ...
unsigned short endian_decode_word(const unsigned char *data, endian_t order)
The decode_word_le function is used to decode a little-endian 2-byte data buffer into an unsigned sho...
endian_t
Definition endian.h:27
@ endian_little
Definition endian.h:29
@ endian_big
Definition endian.h:28
unsigned short decode_word_le(const unsigned char *data)
The decode_word_le function is used to decode a little-endian 2-byte data buffer into an unsigned sho...
const char * endian_to_string(endian_t x)
The endian_to_string function may be used to convert an endian value into its string equivalent.