summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve/eve.h
blob: ea4ec717ef4cddc30f61434ca052a94b54ba6763 (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
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <stdint.h>

#include "eve_def.h"
#include "eve_touch.h"
#include "eve_phy.h"
#include "eve_vtrack.h"
#include "eve_platform.h"

#define EVE_OK              0
#define EVE_ERR             -1

#define EVE_ERR_FULL        -10
#define EVE_ERR_EMPTY       -11

#define EVE_ERR_NOMEM       -100

#define EVE_PSTATE_ACTIVE   0
#define EVE_PSTATE_STANDBY  1
#define EVE_PSTATE_SLEEP    3

#define COLOR_RGBC(c)       ((4UL<<24)|((c)&16777215UL))
#define CLEAR_COLOR_RGBC(c) ((2UL<<24)|((c)&16777215UL))

typedef struct EVERect {
    int16_t x;
    int16_t y;
    uint16_t w;
    uint16_t h;
} EVERect;

void eve_command(uint8_t command, uint8_t parameter);

uint8_t eve_read8(uint32_t addr);
uint16_t eve_read16(uint32_t addr);
uint32_t eve_read32(uint32_t addr);
void eve_write8(uint32_t addr, uint8_t data);
void eve_write16(uint32_t addr, uint16_t data);
void eve_write32(uint32_t addr, uint32_t data);

void eve_readb(uint32_t addr, uint8_t *buf, size_t size);
void eve_writeb(uint32_t addr, uint8_t *buf, size_t size);

void eve_dl_start(uint32_t addr, char burst);
void eve_dl_write(uint32_t dl);
void eve_dl_end(void);
void eve_dl_swap(void);
uint32_t eve_dl_get_addr(void);

void eve_cmd(uint32_t cmd, const char *fmt, ...);
void eve_cmd_write(uint8_t *buffer, size_t size);
void eve_cmd_end(void);
uint32_t eve_cmd_result(uint16_t offset);
void eve_cmd_dl(uint32_t dl);
int eve_cmd_done(void);
int eve_cmd_exec(int w);
void eve_cmd_burst_start(void);
void eve_cmd_burst_end(void);

uint16_t eve_handle_intr(void);

int eve_init(void);
void eve_clk_start(void);
void eve_clk_stop(void);
void eve_intr_enable(void);
void eve_intr_disable(void);

void eve_activate(void);
void eve_pwr_standby(void);
void eve_pwr_sleep(void);
void eve_pwr_wake(void);

int eve_gpio_get(int gpio);
void eve_gpio_set(int gpio, int val);
uint8_t eve_gpio_get_dir(void);
void eve_gpio_set_dir(uint8_t dir);

void eve_brightness(uint8_t b);
void eve_lcd_absent(void);
void eve_copro_reset(void);