/
ivory_hw_prim.h
52 lines (41 loc) · 1.07 KB
/
ivory_hw_prim.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* ivory_hw_prim.h --- Ivory HW primitives for I/O register access.
*
* Copyright (C) 2013, Galois, Inc.
* All Rights Reserved.
*/
#ifndef __SMACCMPILOT_IVORY_HW_PRIM_H__
#define __SMACCMPILOT_IVORY_HW_PRIM_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
static inline uint8_t ivory_hw_io_read_u8(uint32_t addr)
{
return *((volatile uint8_t *)addr);
}
static inline void ivory_hw_io_write_u8(uint32_t addr, uint8_t value)
{
*((volatile uint8_t *)addr) = value;
}
static inline uint16_t ivory_hw_io_read_u16(uint32_t addr)
{
return *((volatile uint16_t *)addr);
}
static inline void ivory_hw_io_write_u16(uint32_t addr, uint16_t value)
{
*((volatile uint16_t *)addr) = value;
}
static inline uint32_t ivory_hw_io_read_u32(uint32_t addr)
{
return *((volatile uint32_t *)addr);
}
static inline void ivory_hw_io_write_u32(uint32_t addr, uint32_t value)
{
*((volatile uint32_t *)addr) = value;
}
#ifdef __cplusplus
}
#endif
#endif /* !defined __SMACCMPILOT_IVORY_HW_PRIM_H__ */