Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
sys_io.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015, Wind River Systems, Inc.
3
* Copyright (c) 2017, Oticon A/S
4
*
5
* SPDX-License-Identifier: Apache-2.0
6
*/
7
8
/* Memory mapped registers I/O functions in non-arch-specific C code */
9
10
#ifndef ZEPHYR_INCLUDE_ARCH_COMMON_SYS_IO_H_
11
#define ZEPHYR_INCLUDE_ARCH_COMMON_SYS_IO_H_
12
13
#ifndef _ASMLANGUAGE
14
15
#include <
toolchain.h
>
16
#include <
zephyr/types.h
>
17
#include <
sys/sys_io.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
return
*(
volatile
uint8_t
*)addr;
26
}
27
28
static
ALWAYS_INLINE
void
sys_write8
(
uint8_t
data
,
mem_addr_t
addr)
29
{
30
*(
volatile
uint8_t
*)addr =
data
;
31
}
32
33
static
ALWAYS_INLINE
uint16_t
sys_read16
(
mem_addr_t
addr)
34
{
35
return
*(
volatile
uint16_t
*)addr;
36
}
37
38
static
ALWAYS_INLINE
void
sys_write16
(
uint16_t
data
,
mem_addr_t
addr)
39
{
40
*(
volatile
uint16_t
*)addr =
data
;
41
}
42
43
static
ALWAYS_INLINE
uint32_t
sys_read32
(
mem_addr_t
addr)
44
{
45
return
*(
volatile
uint32_t
*)addr;
46
}
47
48
static
ALWAYS_INLINE
void
sys_write32
(
uint32_t
data
,
mem_addr_t
addr)
49
{
50
*(
volatile
uint32_t
*)addr =
data
;
51
}
52
53
#ifdef __cplusplus
54
}
55
#endif
56
57
#endif
/* _ASMLANGUAGE */
58
59
#endif
/* ZEPHYR_INCLUDE_ARCH_COMMON_SYS_IO_H_ */
sys_write32
static ALWAYS_INLINE void sys_write32(uint32_t data, mem_addr_t addr)
Definition:
sys_io.h:48
sys_read8
static ALWAYS_INLINE uint8_t sys_read8(mem_addr_t addr)
Definition:
sys_io.h:23
sys_write16
static ALWAYS_INLINE void sys_write16(uint16_t data, mem_addr_t addr)
Definition:
sys_io.h:38
sys_read32
static ALWAYS_INLINE uint32_t sys_read32(mem_addr_t addr)
Definition:
sys_io.h:43
sys_read16
static ALWAYS_INLINE uint16_t sys_read16(mem_addr_t addr)
Definition:
sys_io.h:33
sys_write8
static ALWAYS_INLINE void sys_write8(uint8_t data, mem_addr_t addr)
Definition:
sys_io.h:28
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_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
common
sys_io.h
Generated on Sun Oct 9 2022 09:21:57 for Zephyr API Documentation by
1.9.4