-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
41 lines (33 loc) · 844 Bytes
/
common.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
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#define RAM_BASE ((void *)0x90000000)
#define RAM_SIZE 0x08000000
#define DEST_BUF (RAM_BASE + RAM_SIZE - 64)
#define SG_BUF_OFFSET (RAM_SIZE - 0x1000)
#define SG_BUF (RAM_BASE + SG_BUF_OFFSET)
typedef uint32_t u32;
typedef uint8_t u8;
typedef uint8_t uchar;
#define USE_HOSTCC
#include "hash.h"
#include "hw_sha.h"
#define BIT(__x) (1UL << (__x))
extern void writel(u32 val, u32 addr);
extern u32 readl(u32 addr);
#define mdelay(...) do {} while(0);
#define udelay(...) do {} while(0);
#define readl_poll_timeout(addr, val, cond, timeout) \
({ \
while (1) { \
val = readl(addr); \
if (cond) \
break; \
} \
(cond) ? 0 : -ETIMEDOUT; \
})
#define debug(...) printf(__VA_ARGS__)