aboutsummaryrefslogtreecommitdiffstats
path: root/src/pru/internal.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-05-16 13:41:44 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-05-17 10:46:38 -0400
commitb85755c0ff4cb31aeafc9fd0abd63094508d731b (patch)
tree984acee6d40d68c49e95894ac28dbbe670d4daec /src/pru/internal.h
parentb6f24e78ac2afd736102b8730b9addf53f80dc3b (diff)
downloadkutter-b85755c0ff4cb31aeafc9fd0abd63094508d731b.tar.gz
kutter-b85755c0ff4cb31aeafc9fd0abd63094508d731b.tar.xz
kutter-b85755c0ff4cb31aeafc9fd0abd63094508d731b.zip
pru: Move communication code to second PRU
Perform input and output in the second PRU so that more space is available in the primary PRU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/pru/internal.h')
-rw-r--r--src/pru/internal.h37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/pru/internal.h b/src/pru/internal.h
index b279f3d0..8556eed7 100644
--- a/src/pru/internal.h
+++ b/src/pru/internal.h
@@ -2,17 +2,38 @@
#define __PRU_INTERNAL_H
// Local definitions for PRU code
-#define IEP_IRQ 0
-#define GOT_ARM_IRQ 1
-#define WAKE_ARM_IRQ 2
+#include <stdint.h> // uint32_t
+
+#define IEP_EVENT 7
+#define KICK_ARM_EVENT 16
+#define KICK_PRU0_FROM_ARM_EVENT 17
+#define KICK_PRU0_EVENT 18
+#define KICK_PRU1_EVENT 19
-#define IEP_EVENT 7
-#define GOT_ARM_EVENT 17
-#define WAKE_ARM_EVENT 16
+#define WAKE_PRU0_IRQ 0
+#define WAKE_PRU1_IRQ 1
+#define WAKE_ARM_IRQ 2
#define R31_IRQ_OFFSET 30
-// console.c
-void console_init(void);
+#define R31_WRITE_IRQ_SELECT (1<<5)
+#define R31_WRITE_IRQ_OFFSET 16
+
+// Layout of shared memory
+struct shared_mem {
+ uint32_t signal;
+ uint32_t read_pos, read_count;
+ char read_data[512];
+ uint32_t send_push_pos, send_pop_pos;
+ struct {
+ uint32_t count;
+ char data[64];
+ } send_data[4];
+};
+
+#define SIGNAL_PRU0_WAITING 0xefefefef
+#define SIGNAL_PRU1_READY 0xabababab
+
+static struct shared_mem *SHARED_MEM = (void*)0x10000;
#endif // internal.h