summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-02-28 18:38:37 +0100
committerUros Majstorovic <majstor@majstor.org>2021-02-28 18:38:37 +0100
commit6a4c8a1f11f6a7bd57b0fd618f455bcdecbfe538 (patch)
tree6d16dbc38b3bac0e91d39f3e86bb6810761ddb84 /fw/fe310/eos/eve
parent468e81e6da66f6dfec3a4857dc6e2f370ab180f1 (diff)
net send will do selected spi dev pause/resume if more is set and netowk is not active
Diffstat (limited to 'fw/fe310/eos/eve')
-rw-r--r--fw/fe310/eos/eve/eve.c4
-rw-r--r--fw/fe310/eos/eve/eve_platform.c12
-rw-r--r--fw/fe310/eos/eve/eve_platform.h17
-rw-r--r--fw/fe310/eos/eve/eve_touch.c11
4 files changed, 33 insertions, 11 deletions
diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c
index 6b3943e..f35ccf7 100644
--- a/fw/fe310/eos/eve/eve.c
+++ b/fw/fe310/eos/eve/eve.c
@@ -103,6 +103,7 @@ void eve_dl_start(uint32_t addr, char burst) {
_dl_addr = addr;
_dl_burst = burst;
if (burst) {
+ eve_spi_lock();
eve_spi_cs_set();
eve_spi_xchg24(addr | EVE_MEM_WRITE, EVE_SPI_FLAG_TX);
}
@@ -121,6 +122,7 @@ void eve_dl_end(void) {
if (_dl_burst) {
eve_spi_flush();
eve_spi_cs_clear();
+ eve_spi_unlock();
_dl_burst = 0;
}
}
@@ -266,6 +268,7 @@ int eve_cmd_exec(int w) {
void eve_cmd_burst_start(void) {
uint32_t addr = EVE_RAM_CMD + _cmd_offset;
+ eve_spi_lock();
eve_spi_cs_set();
eve_spi_xchg24(addr | EVE_MEM_WRITE, EVE_SPI_FLAG_TX);
_cmd_burst = 1;
@@ -274,6 +277,7 @@ void eve_cmd_burst_start(void) {
void eve_cmd_burst_end(void) {
eve_spi_flush();
eve_spi_cs_clear();
+ eve_spi_unlock();
_cmd_burst = 0;
}
diff --git a/fw/fe310/eos/eve/eve_platform.c b/fw/fe310/eos/eve/eve_platform.c
index 7f1b775..cfaf6d5 100644
--- a/fw/fe310/eos/eve/eve_platform.c
+++ b/fw/fe310/eos/eve/eve_platform.c
@@ -11,15 +11,11 @@
#include "irq_def.h"
static void handle_time(unsigned char type) {
- eos_spi_dev_start(EOS_DEV_DISP);
eve_handle_time();
- eos_spi_dev_stop();
}
static void handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) {
- eos_spi_dev_start(EOS_DEV_DISP);
eve_handle_touch();
- eos_spi_dev_stop();
GPIO_REG(GPIO_LOW_IP) = (1 << EVE_PIN_INTR);
GPIO_REG(GPIO_LOW_IE) |= (1 << EVE_PIN_INTR);
@@ -62,6 +58,14 @@ void eve_platform_init(void) {
eos_spi_dev_set_div(EOS_DEV_DISP, 4);
}
+void eve_spi_start(void) {
+ eos_spi_dev_select(EOS_DEV_DISP);
+}
+
+void eve_spi_stop(void) {
+ eos_spi_dev_deselect();
+}
+
#include <stdio.h>
void *eve_malloc(size_t size) {
diff --git a/fw/fe310/eos/eve/eve_platform.h b/fw/fe310/eos/eve/eve_platform.h
index 7d085db..48ea00b 100644
--- a/fw/fe310/eos/eve/eve_platform.h
+++ b/fw/fe310/eos/eve/eve_platform.h
@@ -11,6 +11,15 @@
#define EVE_SPI_FLAG_BSWAP EOS_SPI_FLAG_BSWAP
#define EVE_SPI_FLAG_TX EOS_SPI_FLAG_TX
+void *eve_malloc(size_t);
+void eve_free(void *);
+
+//#define eve_malloc malloc
+//#define eve_free free
+
+void eve_spi_start(void);
+void eve_spi_stop(void);
+
#define eve_spi_cs_set eos_spi_cs_set
#define eve_spi_cs_clear eos_spi_cs_clear
#define eve_spi_flush eos_spi_flush
@@ -18,6 +27,8 @@
#define eve_spi_xchg16 eos_spi_xchg16
#define eve_spi_xchg24 eos_spi_xchg24
#define eve_spi_xchg32 eos_spi_xchg32
+#define eve_spi_lock eos_spi_lock
+#define eve_spi_unlock eos_spi_unlock
void eve_time_sleep(uint32_t ms);
void eve_timer_set(uint32_t ms);
@@ -25,9 +36,3 @@ void eve_timer_clear(void);
uint64_t eve_time_get_tick(void);
void eve_platform_init(void);
-
-//#define eve_malloc malloc
-//#define eve_free free
-
-void *eve_malloc(size_t);
-void eve_free(void *); \ No newline at end of file
diff --git a/fw/fe310/eos/eve/eve_touch.c b/fw/fe310/eos/eve/eve_touch.c
index e3dae58..fff1eec 100644
--- a/fw/fe310/eos/eve/eve_touch.c
+++ b/fw/fe310/eos/eve/eve_touch.c
@@ -69,8 +69,11 @@ void eve_handle_touch(void) {
char int_ccomplete = 0;
uint8_t tag0 = _tag0;
uint8_t touch_last = 0;
- uint8_t flags = eve_read8(REG_INT_FLAGS) & _intr_mask;
+ uint8_t flags;
+ eve_spi_start();
+
+ flags = eve_read8(REG_INT_FLAGS) & _intr_mask;
if (!_multitouch && (flags & EVE_INT_TOUCH)) _multitouch = 1;
for (i=0; i<EVE_MAX_TOUCH; i++) {
uint8_t touch_tag;
@@ -261,9 +264,13 @@ void eve_handle_touch(void) {
_touch_handler(_touch_handler_param, tag0, i);
}
}
+
+ eve_spi_stop();
}
void eve_handle_time(void) {
+ eve_spi_start();
+
if (_touch_handler && _touch_timer.tag) {
EVETouch *touch = &_touch[_touch_timer.idx];
@@ -296,6 +303,8 @@ void eve_handle_time(void) {
_touch_timer_clear();
}
}
+
+ eve_spi_stop();
}
void eve_touch_init(void) {