Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
sys-io-common.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Synopsys.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_ARCH_ARC_SYS_IO_COMMON_H_
8
#define ZEPHYR_INCLUDE_ARCH_ARC_SYS_IO_COMMON_H_
9
10
#ifndef _ASMLANGUAGE
11
12
#include <
toolchain.h
>
13
#include <
sys/sys_io.h
>
14
#include <
arch/arc/v2/aux_regs.h
>
15
16
#include <
zephyr/types.h
>
17
#include <stddef.h>
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
23
static
ALWAYS_INLINE
uint8_t
sys_read8
(
mem_addr_t
addr)
24
{
25
uint8_t
value;
26
27
compiler_barrier();
28
value = *(
volatile
uint8_t
*)addr;
29
compiler_barrier();
30
31
return
value;
32
}
33
34
static
ALWAYS_INLINE
void
sys_write8
(
uint8_t
data
,
mem_addr_t
addr)
35
{
36
compiler_barrier();
37
*(
volatile
uint8_t
*)addr =
data
;
38
compiler_barrier();
39
}
40
41
static
ALWAYS_INLINE
uint16_t
sys_read16
(
mem_addr_t
addr)
42
{
43
uint16_t
value;
44
45
compiler_barrier();
46
value = *(
volatile
uint16_t
*)addr;
47
compiler_barrier();
48
49
return
value;
50
}
51
52
static
ALWAYS_INLINE
void
sys_write16
(
uint16_t
data
,
mem_addr_t
addr)
53
{
54
compiler_barrier();
55
*(
volatile
uint16_t
*)addr =
data
;
56
compiler_barrier();
57
}
58
59
static
ALWAYS_INLINE
uint32_t
sys_read32
(
mem_addr_t
addr)
60
{
61
uint32_t
value;
62
63
compiler_barrier();
64
value = *(
volatile
uint32_t
*)addr;
65
compiler_barrier();
66
67
return
value;
68
}
69
70
static
ALWAYS_INLINE
void
sys_write32
(
uint32_t
data
,
mem_addr_t
addr)
71
{
72
compiler_barrier();
73
*(
volatile
uint32_t
*)addr =
data
;
74
compiler_barrier();
75
}
76
77
#ifdef __cplusplus
78
}
79
#endif
80
81
#endif
/* _ASMLANGUAGE */
82
83
#endif
/* ZEPHYR_INCLUDE_ARCH_ARC_SYS_IO_COMMON_H_ */
aux_regs.h
ARCv2 auxiliary registers definitions.
ALWAYS_INLINE
#define ALWAYS_INLINE
Definition:
common.h:116
types.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition:
stdint.h:60
uint8_t
__UINT8_TYPE__ uint8_t
Definition:
stdint.h:58
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:59
sys_write32
static ALWAYS_INLINE void sys_write32(uint32_t data, mem_addr_t addr)
Definition:
sys-io-common.h:70
sys_read8
static ALWAYS_INLINE uint8_t sys_read8(mem_addr_t addr)
Definition:
sys-io-common.h:23
sys_write16
static ALWAYS_INLINE void sys_write16(uint16_t data, mem_addr_t addr)
Definition:
sys-io-common.h:52
sys_read32
static ALWAYS_INLINE uint32_t sys_read32(mem_addr_t addr)
Definition:
sys-io-common.h:59
sys_read16
static ALWAYS_INLINE uint16_t sys_read16(mem_addr_t addr)
Definition:
sys-io-common.h:41
sys_write8
static ALWAYS_INLINE void sys_write8(uint8_t data, mem_addr_t addr)
Definition:
sys-io-common.h:34
sys_io.h
mem_addr_t
uintptr_t mem_addr_t
Definition:
sys_io.h:21
data
static fdata_t data[2]
Definition:
test_fifo_contexts.c:15
toolchain.h
Macros to abstract toolchain specific capabilities.
include
arch
arc
sys-io-common.h
Generated on Sun Oct 9 2022 09:21:56 for Zephyr API Documentation by
1.9.4