forked from pulp-platform/debug_bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mem_zynq_apb_spi.h
51 lines (35 loc) · 1.26 KB
/
mem_zynq_apb_spi.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
#ifndef MEM_ZYNQ_APB_SPI_H
#define MEM_ZYNQ_APB_SPI_H
#include "mem.h"
#include <stdint.h>
#include <list>
class ZynqAPBSPIIF : public MemIF {
public:
ZynqAPBSPIIF();
~ZynqAPBSPIIF();
bool access(bool write, unsigned int addr, int size, char* buffer);
private:
bool mem_write(unsigned int addr, int len, char *src);
bool mem_read(unsigned int addr, int len, char *src);
void mem_read_words(unsigned int addr, int len, char *src);
void mem_write_words(unsigned int addr, int len, char *src);
inline void apb_write(uint32_t addr, uint32_t data) { m_virt_apbspi[addr >> 2] = data; }
inline uint32_t apb_read(uint32_t addr) { return m_virt_apbspi[addr >> 2]; }
int mmap_gen(uint32_t mem_address, uint32_t mem_size, volatile uint32_t **return_ptr);
int is_fpga_programmed();
void set_clkdiv(uint32_t clkdiv);
void set_dummycycles(uint32_t dummycycles);
void qpi_enable(bool enable);
bool do_read_check(unsigned int addr, int size);
bool soft_reset();
struct addr_region {
unsigned int start;
unsigned int end;
};
bool m_qpi_enabled;
volatile uint32_t *m_virt_apbspi;
volatile uint32_t *m_virt_status;
int g_mem_dev;
std::list<struct addr_region> m_check_addrs;
};
#endif