diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-01-02 11:42:48 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-01-02 14:49:56 +0100 |
commit | 7190005abb07d1142802edde357cfbe0fe07cc54 (patch) | |
tree | 662c03a765885e02720709ae54b1122356cc05d1 /cpukit/score/cpu/sparc/include | |
parent | bsp/mpc55xxevb: Move <bsp/irq.h> (diff) | |
download | rtems-7190005abb07d1142802edde357cfbe0fe07cc54.tar.bz2 |
sparc: Move <libcpu/byteorder.h>
Update #3254.
Update #3260.
Diffstat (limited to 'cpukit/score/cpu/sparc/include')
-rw-r--r-- | cpukit/score/cpu/sparc/include/libcpu/byteorder.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/cpukit/score/cpu/sparc/include/libcpu/byteorder.h b/cpukit/score/cpu/sparc/include/libcpu/byteorder.h new file mode 100644 index 0000000000..10b4239480 --- /dev/null +++ b/cpukit/score/cpu/sparc/include/libcpu/byteorder.h @@ -0,0 +1,66 @@ +/* + * byteorder.h - Endian conversion for SPARC. SPARC is big endian only. + * + * COPYRIGHT (c) 2011 + * Aeroflex Gaisler. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef _LIBCPU_BYTEORDER_H +#define _LIBCPU_BYTEORDER_H + +#include <rtems/system.h> +#include <rtems/score/cpu.h> + +#ifdef __cplusplus +extern "C" { +#endif + +RTEMS_INLINE_ROUTINE uint16_t ld_le16(volatile uint16_t *addr) +{ + return CPU_swap_u16(*addr); +} + +RTEMS_INLINE_ROUTINE void st_le16(volatile uint16_t *addr, uint16_t val) +{ + *addr = CPU_swap_u16(val); +} + +RTEMS_INLINE_ROUTINE uint32_t ld_le32(volatile uint32_t *addr) +{ + return CPU_swap_u32(*addr); +} + +RTEMS_INLINE_ROUTINE void st_le32(volatile uint32_t *addr, uint32_t val) +{ + *addr = CPU_swap_u32(val); +} + +RTEMS_INLINE_ROUTINE uint16_t ld_be16(volatile uint16_t *addr) +{ + return *addr; +} + +RTEMS_INLINE_ROUTINE void st_be16(volatile uint16_t *addr, uint16_t val) +{ + *addr = val; +} + +RTEMS_INLINE_ROUTINE uint32_t ld_be32(volatile uint32_t *addr) +{ + return *addr; +} + +RTEMS_INLINE_ROUTINE void st_be32(volatile uint32_t *addr, uint32_t val) +{ + *addr = val; +} + +#ifdef __cplusplus +} +#endif + +#endif |