aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/x300/include/wb_utils.h
blob: 34be51b8fd516203400bc9c4d4088eb302fabdaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2012 Ettus Research LLC

#ifndef INCLUDED_WB_UTILS_H
#define INCLUDED_WB_UTILS_H

#include <stdint.h>

#define localparam static const int

static inline void wb_poke32(const uint32_t addr, const uint32_t data)
{
    *((volatile uint32_t *)addr) = data;
}

static inline uint32_t wb_peek32(const uint32_t addr)
{
    const uint32_t data = *((volatile uint32_t *)addr);
    return data;
}

#define SR_ADDR(base, offset) ((base) + (offset)*4)

#endif /* INCLUDED_WB_UTILS_H */