source: rtems/c/src/lib/libcpu/sparc/include/libcpu/byteorder.h @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.2 KB
Line 
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/system.h>
16#include <rtems/score/cpu.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22RTEMS_INLINE_ROUTINE uint16_t ld_le16(volatile uint16_t *addr)
23{
24        return CPU_swap_u16(*addr);
25}
26
27RTEMS_INLINE_ROUTINE void st_le16(volatile uint16_t *addr, uint16_t val)
28{
29        *addr = CPU_swap_u16(val);
30}
31
32RTEMS_INLINE_ROUTINE uint32_t ld_le32(volatile uint32_t *addr)
33{
34        return CPU_swap_u32(*addr);
35}
36
37RTEMS_INLINE_ROUTINE void st_le32(volatile uint32_t *addr, uint32_t val)
38{
39        *addr = CPU_swap_u32(val);
40}
41
42RTEMS_INLINE_ROUTINE uint16_t ld_be16(volatile uint16_t *addr)
43{
44        return *addr;
45}
46
47RTEMS_INLINE_ROUTINE void st_be16(volatile uint16_t *addr, uint16_t val)
48{
49        *addr = val;
50}
51
52RTEMS_INLINE_ROUTINE uint32_t ld_be32(volatile uint32_t *addr)
53{
54        return *addr;
55}
56
57RTEMS_INLINE_ROUTINE void st_be32(volatile uint32_t *addr, uint32_t val)
58{
59        *addr = val;
60}
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif
Note: See TracBrowser for help on using the repository browser.