From 288a00688bd1ef5ffad268212df3c54c7c8c4e30 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 11 Dec 2013 01:13:59 +0100 Subject: [PATCH] dol: fix shm_t contain the shm-buffers The shared.h file contained the typedefs for all buffers, but did not include the buffers themselves in the shared shm_t structure. --- dol/src/dol/visitor/epiphany/EpiphanyVisitor.java | 12 +++++++++--- dol/src/dol/visitor/epiphany/template/shared.h | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java b/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java index 2c0c642..5a053ca 100644 --- a/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java +++ b/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java @@ -264,23 +264,29 @@ public class EpiphanyVisitor extends PNVisitor { File fTemplate = new File(template); copyFile(fTemplate, fFilename); - /* generate replacement string */ + /* generate replacement strings */ + String shmBufTypes = ""; String shmBufs = ""; for(EpiphanyBuffer buf : _buffers) { if("shm".equals(buf.type)) { - shmBufs += + shmBufTypes += "\ntypedef struct {\n" + "\tuint32_t rp;\n" + "\tuint32_t wp;\n" + "\tuint32_t size;\n" + "\tchar buf[" + buf.size + "];\n" + "} PACKED buf" + buf.shmIndex + "_t;\n"; + + shmBufs += + "\tbuf" + buf.shmIndex + "_t" + + "\tbuf" + buf.shmIndex + ";\n"; } } /* do the replace */ Sed sed = new Sed(); - sed.sed(filename, "@@SHM_BUF_STRUCTS@@", shmBufs); + sed.sed(filename, "@@SHM_BUF_STRUCTS@@", shmBufTypes); + sed.sed(filename, "@@SHM_BUFS@@", shmBufs); System.out.println("done!"); } diff --git a/dol/src/dol/visitor/epiphany/template/shared.h b/dol/src/dol/visitor/epiphany/template/shared.h index 467b09f..1eb893d 100644 --- a/dol/src/dol/visitor/epiphany/template/shared.h +++ b/dol/src/dol/visitor/epiphany/template/shared.h @@ -26,8 +26,7 @@ typedef struct { typedef struct { int32_t states[NUM_CORES]; coredata_t cores[NUM_CORES]; - buf0_t buf0; - buf1_t buf1; +@@SHM_BUFS@@ } PACKED shm_t; #endif /* _SHARED_H_ */ -- 2.30.2