4.115
Last change
on this file since 80d01b3c was
80d01b3c,
checked in by Daniel Hellstrom <daniel@…>, on 02/08/12 at 14:57:03
|
SPARC: added libcpu lowlevel access and byteorder routines/definitions
The low level routines can be used in different occasions, it will be
required when accessing PCI.
Note the difference between byteorder.h (inlined functions) and access.S
where the functions will be declared in the library archive librtemscpu.a.
Function names starting with _ are in library and can be referenced by
function pointers.
Signed-off-by: Daniel Hellstrom <daniel@…>
|
-
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.com/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 |
---|
19 | extern "C" { |
---|
20 | #endif |
---|
21 | |
---|
22 | RTEMS_INLINE_ROUTINE uint16_t ld_le16(volatile uint16_t *addr) |
---|
23 | { |
---|
24 | return CPU_swap_u16(*addr); |
---|
25 | } |
---|
26 | |
---|
27 | RTEMS_INLINE_ROUTINE void st_le16(volatile uint16_t *addr, uint16_t val) |
---|
28 | { |
---|
29 | *addr = CPU_swap_u16(val); |
---|
30 | } |
---|
31 | |
---|
32 | RTEMS_INLINE_ROUTINE uint32_t ld_le32(volatile uint32_t *addr) |
---|
33 | { |
---|
34 | return CPU_swap_u32(*addr); |
---|
35 | } |
---|
36 | |
---|
37 | RTEMS_INLINE_ROUTINE void st_le32(volatile uint32_t *addr, uint32_t val) |
---|
38 | { |
---|
39 | *addr = CPU_swap_u32(val); |
---|
40 | } |
---|
41 | |
---|
42 | RTEMS_INLINE_ROUTINE uint16_t ld_be16(volatile uint16_t *addr) |
---|
43 | { |
---|
44 | return *addr; |
---|
45 | } |
---|
46 | |
---|
47 | RTEMS_INLINE_ROUTINE void st_be16(volatile uint16_t *addr, uint16_t val) |
---|
48 | { |
---|
49 | *addr = val; |
---|
50 | } |
---|
51 | |
---|
52 | RTEMS_INLINE_ROUTINE uint32_t ld_be32(volatile uint32_t *addr) |
---|
53 | { |
---|
54 | return *addr; |
---|
55 | } |
---|
56 | |
---|
57 | RTEMS_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.