L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
asm_access.h
1
/* SPDX-License-Identifier: GPL-2.0-only or License-Ref-kk-custom */
2
/*
3
* Copyright (C) 2021 Kernkonzept GmbH.
4
* Author(s): Jakub Jermar <jakub.jermar@kernkonzept.com>
5
*/
6
7
#pragma once
8
9
#include <l4/sys/l4int.h>
10
11
namespace
Asm_access {
12
13
inline
14
l4_uint8_t
15
read(
l4_uint8_t
const
*mem)
16
{
17
l4_uint8_t
val;
18
19
asm
volatile
(
"ldrb %w[val], %[mem]"
: [val]
"=r"
(val) : [mem]
"m"
(*mem));
20
21
return
val;
22
}
23
24
inline
25
l4_uint16_t
26
read(
l4_uint16_t
const
*mem)
27
{
28
l4_uint16_t
val;
29
30
asm
volatile
(
"ldrh %w[val], %[mem]"
: [val]
"=r"
(val) : [mem]
"m"
(*mem));
31
32
return
val;
33
}
34
35
inline
36
l4_uint32_t
37
read(
l4_uint32_t
const
*mem)
38
{
39
l4_uint32_t
val;
40
41
asm
volatile
(
"ldr %w[val], %[mem]"
: [val]
"=r"
(val) : [mem]
"m"
(*mem));
42
43
return
val;
44
}
45
46
inline
47
l4_uint64_t
48
read(
l4_uint64_t
const
*mem)
49
{
50
l4_uint64_t
val;
51
52
asm
volatile
(
"ldr %[val], %[mem]"
: [val]
"=r"
(val) : [mem]
"m"
(*mem));
53
54
return
val;
55
}
56
57
inline
58
void
59
write(
l4_uint8_t
val,
l4_uint8_t
*mem)
60
{
61
asm
volatile
(
"strb %w[val], %[mem]"
:[mem]
"=m"
(*mem) : [val]
"r"
(val));
62
}
63
64
inline
65
void
66
write(
l4_uint16_t
val,
l4_uint16_t
*mem)
67
{
68
asm
volatile
(
"strh %w[val], %[mem]"
: [mem]
"=m"
(*mem) : [val]
"r"
(val));
69
}
70
71
inline
72
void
73
write(
l4_uint32_t
val,
l4_uint32_t
*mem)
74
{
75
asm
volatile
(
"str %w[val], %[mem]"
: [mem]
"=m"
(*mem) : [val]
"r"
(val));
76
}
77
78
inline
79
void
80
write(
l4_uint64_t
val,
l4_uint64_t
*mem)
81
{
82
asm
volatile
(
"str %[val], %[mem]"
: [mem]
"=m"
(*mem) : [val]
"r"
(val));
83
}
84
85
}
l4_uint8_t
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition
l4int.h:36
l4_uint32_t
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition
l4int.h:40
l4_uint16_t
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition
l4int.h:38
l4_uint64_t
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition
l4int.h:42
pkg
drivers-frst
include
ARCH-arm64
asm_access.h
Generated on Sat Aug 24 2024 16:07:21 for L4Re Operating System Framework by
1.9.8