1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef LOW_LEVEL_ACCESS_H
9 #define LOW_LEVEL_ACCESS_H
10 
11 #include <stdint.h>
12 
writeb(uint32_t ads,uint8_t data)13 static inline void writeb(uint32_t ads, uint8_t data)
14 {
15     *((volatile uint8_t *)ads) = data;
16 }
17 
writew(uint32_t ads,uint16_t data)18 static inline void writew(uint32_t ads, uint16_t data)
19 {
20     *((volatile uint16_t *)ads) = data;
21 }
22 
writel(uint32_t ads,uint32_t data)23 static inline void writel(uint32_t ads, uint32_t data)
24 {
25     *((volatile uint32_t *)ads) = data;
26 }
27 
writeq(uint32_t ads,uint64_t data)28 static inline void writeq(uint32_t ads, uint64_t data)
29 {
30     *((volatile uint64_t *)ads) = data;
31 }
32 
readb(uint32_t ads)33 static inline uint8_t readb(uint32_t ads)
34 {
35     return *((volatile uint8_t *)ads);
36 }
37 
readw(uint32_t ads)38 static inline uint16_t readw(uint32_t ads)
39 {
40     return *((volatile uint16_t *)ads);
41 }
42 
readl(uint32_t ads)43 static inline uint32_t readl(uint32_t ads)
44 {
45     return *((volatile uint32_t *)ads);
46 }
47 
readq(uint32_t ads)48 static inline uint64_t readq(uint32_t ads)
49 {
50     return *((volatile uint64_t *)ads);
51 }
52 
53 #endif /* LOW_LEVEL_ACCESS_H */
54