438c68cce3a0e96471dace3188f010aa90daeaaf
[gram.git] / libgram / include / gram.h
1 #ifndef GRAM_H
2 #define GRAM_H
3
4 #include <stdint.h>
5
6 enum GramError {
7 GRAM_ERR_NONE = 0,
8 GRAM_ERR_UNDOCUMENTED,
9 GRAM_ERR_MEMTEST,
10 };
11
12 struct gramCoreRegs;
13 struct gramPHYRegs;
14 struct gramCtx {
15 volatile void *ddr_base;
16 volatile struct gramCoreRegs *core;
17 volatile struct gramPHYRegs *phy;
18 void *user_data;
19 };
20
21 extern __attribute__((visibility ("default"))) int gram_init(struct gramCtx *ctx, void *ddr_base, void *core_base, void *phy_base);
22 extern __attribute__((visibility ("default"))) int gram_memtest(struct gramCtx *ctx);
23
24 #ifdef GRAM_RW_FUNC
25 extern uint32_t gram_read(struct gramCtx *ctx, void *addr);
26 extern int gram_write(struct gramCtx *ctx, void *addr, uint32_t value);
27 #endif /* GRAM_RW_FUNC */
28
29 #endif /* GRAM_H */