summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-05-09 16:01:21 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-05-09 16:01:21 +0000
commit20d031f9c70109dae2ea320a4c7264e1e489d8eb (patch)
tree4459bf0a6cbba8e557b60397acfff6f5be3bda10 /firmware
parentaf2b7adefe31839bebbc407083d980a112e7242c (diff)
downloadrockbox-20d031f9c70109dae2ea320a4c7264e1e489d8eb.tar.gz
rockbox-20d031f9c70109dae2ea320a4c7264e1e489d8eb.zip
Configurable dir browser file buffer size. No more 400-file limit. No more whining.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3661 a1c6a512-1295-4272-9138-f99709370657
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 4dc20ac05e..46a6ca70fb 100644
--- a/firmware/app.lds
+++ b/firmware/app.lds
@@ -77,7 +77,7 @@ SECTIONS
77 77
78 .mp3buf : 78 .mp3buf :
79 { 79 {
80 _mp3buf = .; 80 _mp3buffer = .;
81 } > DRAM 81 } > DRAM
82 82
83 .mp3end ENDADDR - 0x300: 83 .mp3end ENDADDR - 0x300:
diff --git a/firmware/buffer.c b/firmware/buffer.c
new file mode 100644
index 0000000000..4db0b94889
--- /dev/null
+++ b/firmware/buffer.c
@@ -0,0 +1,43 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include <stdio.h>
20#include "buffer.h"
21
22#ifdef SIMULATOR
23unsigned char mp3buffer[0x100000];
24unsigned char mp3end[1];
25#else
26/* defined in linker script */
27extern unsigned char mp3buffer[];
28#endif
29
30unsigned char *mp3buf;
31
32void buffer_init(void)
33{
34 mp3buf = mp3buffer;
35}
36
37void *buffer_alloc(size_t size)
38{
39 void *retval = mp3buf;
40
41 mp3buf += size;
42 return retval;
43}
diff --git a/firmware/export/buffer.h b/firmware/export/buffer.h
new file mode 100644
index 0000000000..24b676ad93
--- /dev/null
+++ b/firmware/export/buffer.h
@@ -0,0 +1,30 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef BUFFER_H
20#define BUFFER_H
21
22/* defined in linker script */
23extern unsigned char mp3end[];
24
25extern unsigned char *mp3buf;
26
27void buffer_init(void);
28void *buffer_alloc(size_t size);
29
30#endif
diff --git a/firmware/mp3data.c b/firmware/mp3data.c
index cf9d6832cb..5baa9ec149 100644
--- a/firmware/mp3data.c
+++ b/firmware/mp3data.c
@@ -34,6 +34,7 @@
34#include "debug.h" 34#include "debug.h"
35#include "mp3data.h" 35#include "mp3data.h"
36#include "file.h" 36#include "file.h"
37#include "buffer.h"
37 38
38#define DEBUG_VERBOSE 39#define DEBUG_VERBOSE
39 40
@@ -253,13 +254,6 @@ unsigned long find_next_frame(int fd, int *offset, int max_offset, unsigned long
253 return header; 254 return header;
254} 255}
255 256
256#ifdef SIMULATOR
257unsigned char mp3buf[0x100000];
258unsigned char mp3end[1];
259#else
260extern unsigned char mp3buf[];
261extern unsigned char mp3end[];
262#endif
263static int fnf_read_index; 257static int fnf_read_index;
264static int fnf_buf_len; 258static int fnf_buf_len;
265 259
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index ef65303879..fbdc112f58 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -27,6 +27,7 @@
27#include <kernel.h> 27#include <kernel.h>
28#include "thread.h" 28#include "thread.h"
29#include "mp3data.h" 29#include "mp3data.h"
30#include "buffer.h"
30#ifndef SIMULATOR 31#ifndef SIMULATOR
31#include "i2c.h" 32#include "i2c.h"
32#include "mas.h" 33#include "mas.h"
@@ -460,10 +461,6 @@ static struct event_queue mpeg_queue;
460static char mpeg_stack[DEFAULT_STACK_SIZE + 0x1000]; 461static char mpeg_stack[DEFAULT_STACK_SIZE + 0x1000];
461static char mpeg_thread_name[] = "mpeg"; 462static char mpeg_thread_name[] = "mpeg";
462 463
463/* defined in linker script */
464extern unsigned char mp3buf[];
465extern unsigned char mp3end[];
466
467static int mp3buflen; 464static int mp3buflen;
468static int mp3buf_write; 465static int mp3buf_write;
469static int mp3buf_swapwrite; 466static int mp3buf_swapwrite;
diff --git a/firmware/rolo.c b/firmware/rolo.c
index f8aad52546..7a0eafb79e 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -26,6 +26,7 @@
26#include "system.h" 26#include "system.h"
27#include "i2c.h" 27#include "i2c.h"
28#include "string.h" 28#include "string.h"
29#include "buffer.h"
29 30
30#define IRQ0_EDGE_TRIGGER 0x80 31#define IRQ0_EDGE_TRIGGER 0x80
31 32
@@ -36,6 +37,8 @@ static void rolo_error(char *text)
36 lcd_puts_scroll(0, 1, text); 37 lcd_puts_scroll(0, 1, text);
37 lcd_update(); 38 lcd_update();
38 button_get(true); 39 button_get(true);
40 button_get(true);
41 button_get(true);
39 lcd_stop_scroll(); 42 lcd_stop_scroll();
40} 43}
41/*************************************************************************** 44/***************************************************************************
@@ -49,7 +52,6 @@ int rolo_load(char* filename)
49{ 52{
50 int fd,slen; 53 int fd,slen;
51 unsigned long length,file_length,i; 54 unsigned long length,file_length,i;
52 extern unsigned char mp3buf[],mp3end;
53 unsigned short checksum,file_checksum; 55 unsigned short checksum,file_checksum;
54 unsigned char* ramstart = (void*)0x09000000; 56 unsigned char* ramstart = (void*)0x09000000;
55 void (*start_func)(void) = (void*)ramstart + 0x200; 57 void (*start_func)(void) = (void*)ramstart + 0x200;
@@ -88,7 +90,7 @@ int rolo_load(char* filename)
88 lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET); 90 lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET);
89 91
90 /* verify that file can be read and descrambled */ 92 /* verify that file can be read and descrambled */
91 if ((&mp3buf[0] + (2*length)+4) >= &mp3end) { 93 if ((mp3buf + (2*length)+4) >= &mp3end) {
92 rolo_error("Not enough room to load file"); 94 rolo_error("Not enough room to load file");
93 return -1; 95 return -1;
94 } 96 }