RTEMS 5.2
byteorder.h
1/*
2 * byteorder.h - Endian conversion for SPARC. SPARC is big endian only.
3 *
4 * COPYRIGHT (c) 2011
5 * Aeroflex Gaisler.
6 *
7 * The license and distribution terms for this file may be
8 * found in the file LICENSE in this distribution or at
9 * http://www.rtems.org/license/LICENSE.
10 */
11
12#ifndef _LIBCPU_BYTEORDER_H
13#define _LIBCPU_BYTEORDER_H
14
15#include <rtems/score/cpu.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21RTEMS_INLINE_ROUTINE uint16_t ld_le16(volatile uint16_t *addr)
22{
23 return CPU_swap_u16(*addr);
24}
25
26RTEMS_INLINE_ROUTINE void st_le16(volatile uint16_t *addr, uint16_t val)
27{
28 *addr = CPU_swap_u16(val);
29}
30
31RTEMS_INLINE_ROUTINE uint32_t ld_le32(volatile uint32_t *addr)
32{
33 return CPU_swap_u32(*addr);
34}
35
36RTEMS_INLINE_ROUTINE void st_le32(volatile uint32_t *addr, uint32_t val)
37{
38 *addr = CPU_swap_u32(val);
39}
40
41RTEMS_INLINE_ROUTINE uint16_t ld_be16(volatile uint16_t *addr)
42{
43 return *addr;
44}
45
46RTEMS_INLINE_ROUTINE void st_be16(volatile uint16_t *addr, uint16_t val)
47{
48 *addr = val;
49}
50
51RTEMS_INLINE_ROUTINE uint32_t ld_be32(volatile uint32_t *addr)
52{
53 return *addr;
54}
55
56RTEMS_INLINE_ROUTINE void st_be32(volatile uint32_t *addr, uint32_t val)
57{
58 *addr = val;
59}
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define CPU_swap_u16(value)
Definition: cpu.h:642