summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/app.lds2
-rw-r--r--firmware/buffer.c43
-rw-r--r--firmware/export/buffer.h30
-rw-r--r--firmware/mp3data.c8
-rw-r--r--firmware/mpeg.c5
-rw-r--r--firmware/rolo.c6
6 files changed, 80 insertions, 14 deletions
diff --git a/firmware/app.lds b/firmware/app.lds
index 4dc20ac..46a6ca7 100644
--- a/firmware/app.lds
+++ b/firmware/app.lds
@@ -77,7 +77,7 @@ SECTIONS
.mp3buf :
{
- _mp3buf = .;
+ _mp3buffer = .;
} > DRAM
.mp3end ENDADDR - 0x300:
diff --git a/firmware/buffer.c b/firmware/buffer.c
new file mode 100644
index 0000000..4db0b94
--- /dev/null
+++ b/firmware/buffer.c
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Linus Nielsen Feltzing
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <stdio.h>
+#include "buffer.h"
+
+#ifdef SIMULATOR
+unsigned char mp3buffer[0x100000];
+unsigned char mp3end[1];
+#else
+/* defined in linker script */
+extern unsigned char mp3buffer[];
+#endif
+
+unsigned char *mp3buf;
+
+void buffer_init(void)
+{
+ mp3buf = mp3buffer;
+}
+
+void *buffer_alloc(size_t size)
+{
+ void *retval = mp3buf;
+
+ mp3buf += size;
+ return retval;
+}
diff --git a/firmware/export/buffer.h b/firmware/export/buffer.h
new file mode 100644
index 0000000..24b676a
--- /dev/null
+++ b/firmware/export/buffer.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Linus Nielsen Feltzing
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BUFFER_H
+#define BUFFER_H
+
+/* defined in linker script */
+extern unsigned char mp3end[];
+
+extern unsigned char *mp3buf;
+
+void buffer_init(void);
+void *buffer_alloc(size_t size);
+
+#endif
diff --git a/firmware/mp3data.c b/firmware/mp3data.c
index cf9d683..5baa9ec 100644
--- a/firmware/mp3data.c
+++ b/firmware/mp3data.c
@@ -34,6 +34,7 @@
#include "debug.h"
#include "mp3data.h"
#include "file.h"
+#include "buffer.h"
#define DEBUG_VERBOSE
@@ -253,13 +254,6 @@ unsigned long find_next_frame(int fd, int *offset, int max_offset, unsigned long
return header;
}
-#ifdef SIMULATOR
-unsigned char mp3buf[0x100000];
-unsigned char mp3end[1];
-#else
-extern unsigned char mp3buf[];
-extern unsigned char mp3end[];
-#endif
static int fnf_read_index;
static int fnf_buf_len;
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index ef65303..fbdc112 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -27,6 +27,7 @@
#include <kernel.h>
#include "thread.h"
#include "mp3data.h"
+#include "buffer.h"
#ifndef SIMULATOR
#include "i2c.h"
#include "mas.h"
@@ -460,10 +461,6 @@ static struct event_queue mpeg_queue;
static char mpeg_stack[DEFAULT_STACK_SIZE + 0x1000];
static char mpeg_thread_name[] = "mpeg";
-/* defined in linker script */
-extern unsigned char mp3buf[];
-extern unsigned char mp3end[];
-
static int mp3buflen;
static int mp3buf_write;
static int mp3buf_swapwrite;
diff --git a/firmware/rolo.c b/firmware/rolo.c
index f8aad52..7a0eafb 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -26,6 +26,7 @@
#include "system.h"
#include "i2c.h"
#include "string.h"
+#include "buffer.h"
#define IRQ0_EDGE_TRIGGER 0x80
@@ -36,6 +37,8 @@ static void rolo_error(char *text)
lcd_puts_scroll(0, 1, text);
lcd_update();
button_get(true);
+ button_get(true);
+ button_get(true);
lcd_stop_scroll();
}
/***************************************************************************
@@ -49,7 +52,6 @@ int rolo_load(char* filename)
{
int fd,slen;
unsigned long length,file_length,i;
- extern unsigned char mp3buf[],mp3end;
unsigned short checksum,file_checksum;
unsigned char* ramstart = (void*)0x09000000;
void (*start_func)(void) = (void*)ramstart + 0x200;
@@ -88,7 +90,7 @@ int rolo_load(char* filename)
lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
/* verify that file can be read and descrambled */
- if ((&mp3buf[0] + (2*length)+4) >= &mp3end) {
+ if ((mp3buf + (2*length)+4) >= &mp3end) {
rolo_error("Not enough room to load file");
return -1;
}