Hanna
Sourcecode Batteriemanagementsystem |
Dateien | |
Datei | byteordering.c |
SD-Card Reader Bibliothek von Roland Riegel. | |
Datei | byteordering.h |
SD-Card Reader Bibliothek von Roland Riegel. | |
Makrodefinitionen | |
#define | HTOL16(val) (val) |
#define | htol16(h) (h) |
#define | HTOL32(val) (val) |
#define | htol32(h) (h) |
#define | LTOH16(val) (val) |
#define | ltoh16(l) (l) |
#define | LTOH32(val) (val) |
#define | ltoh32(l) (l) |
#define | SWAP16(val) |
#define | SWAP32(val) |
Funktionen | |
uint16_t | read16 (const uint8_t *p) |
uint32_t | read32 (const uint8_t *p) |
void | write16 (uint8_t *p, uint16_t i) |
void | write32 (uint8_t *p, uint32_t i) |
Architecture-dependent handling of byte-ordering.
#define HTOL16 | ( | val | ) | (val) |
Converts a 16-bit integer from host byte order to little-endian byte order.
Use this macro for compile time constants only. For variable values use the function htol16() instead. This saves code size.
[in] | val | A 16-bit integer in host byte order. |
Definiert in Zeile 113 der Datei byteordering.h.
#define HTOL32 | ( | val | ) | (val) |
Converts a 32-bit integer from host byte order to little-endian byte order.
Use this macro for compile time constants only. For variable values use the function htol32() instead. This saves code size.
[in] | val | A 32-bit integer in host byte order. |
Definiert in Zeile 114 der Datei byteordering.h.
#define LTOH16 | ( | val | ) | (val) |
Converts a 16-bit integer from little-endian byte order to host byte order.
Use this macro for compile time constants only. For variable values use the function ltoh16() instead. This saves code size.
[in] | val | A 16-bit integer in little-endian byte order. |
Definiert in Zeile 115 der Datei byteordering.h.
#define LTOH32 | ( | val | ) | (val) |
Converts a 32-bit integer from little-endian byte order to host byte order.
Use this macro for compile time constants only. For variable values use the function ltoh32() instead. This saves code size.
[in] | val | A 32-bit integer in little-endian byte order. |
Definiert in Zeile 116 der Datei byteordering.h.
#define SWAP16 | ( | val | ) |
Definiert in Zeile 45 der Datei byteordering.h.
#define SWAP32 | ( | val | ) |
Definiert in Zeile 48 der Datei byteordering.h.
uint16_t read16 | ( | const uint8_t * | p | ) |
Reads a 16-bit integer from memory in little-endian byte order.
[in] | p | Pointer from where to read the integer. |
Definiert in Zeile 75 der Datei byteordering.c.
uint32_t read32 | ( | const uint8_t * | p | ) |
Reads a 32-bit integer from memory in little-endian byte order.
[in] | p | Pointer from where to read the integer. |
Definiert in Zeile 87 der Datei byteordering.c.
void write16 | ( | uint8_t * | p, |
uint16_t | i | ||
) |
Writes a 16-bit integer into memory in little-endian byte order.
[in] | p | Pointer where to write the integer to. |
[in] | i | The 16-bit integer to write. |
Definiert in Zeile 101 der Datei byteordering.c.
void write32 | ( | uint8_t * | p, |
uint32_t | i | ||
) |
Writes a 32-bit integer into memory in little-endian byte order.
[in] | p | Pointer where to write the integer to. |
[in] | i | The 32-bit integer to write. |
Definiert in Zeile 113 der Datei byteordering.c.