forked from len0rd/rockbox
Gained about 128 KB buffer space by removing malloc() and the heap
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1726 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
509b425616
commit
ebb14ca5f9
8 changed files with 20 additions and 33 deletions
|
@ -33,13 +33,9 @@
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#ifndef SIMULATOR
|
|
||||||
#include "dmalloc.h"
|
|
||||||
#include "bmalloc.h"
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
@ -95,8 +91,6 @@ void init(void)
|
||||||
|
|
||||||
settings_reset();
|
settings_reset();
|
||||||
|
|
||||||
dmalloc_initialize();
|
|
||||||
bmalloc_add_pool(poolstart, poolend-poolstart);
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
|
||||||
show_logo();
|
show_logo();
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define STRUCT_PACKED __attribute__((packed))
|
#define STRUCT_PACKED __attribute__((packed))
|
||||||
#else
|
#else
|
||||||
|
@ -585,3 +587,5 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* 0 */
|
||||||
|
|
|
@ -33,7 +33,7 @@ else
|
||||||
CFLAGS += -fomit-frame-pointer -fschedule-insns
|
CFLAGS += -fomit-frame-pointer -fschedule-insns
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SRC := $(wildcard drivers/*.c common/*.c malloc/*.c *.c)
|
SRC := $(wildcard drivers/*.c common/*.c *.c)
|
||||||
|
|
||||||
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/crt0.o
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/crt0.o
|
||||||
DEPS:=.deps
|
DEPS:=.deps
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include <file.h>
|
#include <file.h>
|
||||||
#include "ajf.h"
|
#include "ajf.h"
|
||||||
#include <malloc.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
|
@ -51,13 +51,6 @@ SECTIONS
|
||||||
_end = .;
|
_end = .;
|
||||||
} > DRAM
|
} > DRAM
|
||||||
|
|
||||||
.heap :
|
|
||||||
{
|
|
||||||
_poolstart = .;
|
|
||||||
. = 0x20000;
|
|
||||||
_poolend = .;
|
|
||||||
} > DRAM
|
|
||||||
|
|
||||||
.mp3buf :
|
.mp3buf :
|
||||||
{
|
{
|
||||||
_mp3buf = .;
|
_mp3buf = .;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
#include "malloc.h"
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
|
@ -147,9 +146,11 @@ struct id3tag
|
||||||
{
|
{
|
||||||
struct mp3entry id3;
|
struct mp3entry id3;
|
||||||
int mempos;
|
int mempos;
|
||||||
|
bool used;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct id3tag *id3tags[MAX_ID3_TAGS];
|
static struct id3tag *id3tags[MAX_ID3_TAGS];
|
||||||
|
static struct id3tag _id3tags[MAX_ID3_TAGS];
|
||||||
|
|
||||||
static unsigned int current_track_counter = 0;
|
static unsigned int current_track_counter = 0;
|
||||||
static unsigned int last_track_counter = 0;
|
static unsigned int last_track_counter = 0;
|
||||||
|
@ -202,7 +203,6 @@ static bool append_tag(struct id3tag *tag)
|
||||||
static void remove_current_tag(void)
|
static void remove_current_tag(void)
|
||||||
{
|
{
|
||||||
int oldidx = tag_read_idx;
|
int oldidx = tag_read_idx;
|
||||||
struct id3tag *tag = id3tags[tag_read_idx];
|
|
||||||
|
|
||||||
if(num_tracks_in_memory() > 0)
|
if(num_tracks_in_memory() > 0)
|
||||||
{
|
{
|
||||||
|
@ -210,8 +210,8 @@ static void remove_current_tag(void)
|
||||||
tag_read_idx = (tag_read_idx+1) & MAX_ID3_TAGS_MASK;
|
tag_read_idx = (tag_read_idx+1) & MAX_ID3_TAGS_MASK;
|
||||||
|
|
||||||
/* Now delete it */
|
/* Now delete it */
|
||||||
|
id3tags[oldidx]->used = false;
|
||||||
id3tags[oldidx] = NULL;
|
id3tags[oldidx] = NULL;
|
||||||
free(tag);
|
|
||||||
debug_tags();
|
debug_tags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -578,21 +578,26 @@ void IMIA1(void)
|
||||||
|
|
||||||
static void add_track_to_tag_list(char *filename)
|
static void add_track_to_tag_list(char *filename)
|
||||||
{
|
{
|
||||||
struct id3tag *t;
|
struct id3tag *t = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* grab id3 tag of new file and
|
/* find a free tag */
|
||||||
remember where in memory it starts */
|
for (i=0; i < MAX_ID3_TAGS_MASK; i++ )
|
||||||
t = malloc(sizeof(struct id3tag));
|
if ( !_id3tags[i].used )
|
||||||
|
t = &_id3tags[i];
|
||||||
if(t)
|
if(t)
|
||||||
{
|
{
|
||||||
|
/* grab id3 tag of new file and
|
||||||
|
remember where in memory it starts */
|
||||||
mp3info(&(t->id3), filename);
|
mp3info(&(t->id3), filename);
|
||||||
t->mempos = mp3buf_write;
|
t->mempos = mp3buf_write;
|
||||||
t->id3.elapsed = 0;
|
t->id3.elapsed = 0;
|
||||||
if(!append_tag(t))
|
if(!append_tag(t))
|
||||||
{
|
{
|
||||||
free(t);
|
|
||||||
DEBUGF("Tag list is full\n");
|
DEBUGF("Tag list is full\n");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
t->used = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1411,4 +1416,5 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i
|
||||||
#endif /* !SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
memset(id3tags, sizeof(id3tags), 0);
|
memset(id3tags, sizeof(id3tags), 0);
|
||||||
|
memset(_id3tags, sizeof(id3tags), 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,13 +51,6 @@ SECTIONS
|
||||||
_end = .;
|
_end = .;
|
||||||
} > DRAM
|
} > DRAM
|
||||||
|
|
||||||
.heap :
|
|
||||||
{
|
|
||||||
_poolstart = .;
|
|
||||||
. = 0x20000;
|
|
||||||
_poolend = .;
|
|
||||||
} > DRAM
|
|
||||||
|
|
||||||
.mp3buf :
|
.mp3buf :
|
||||||
{
|
{
|
||||||
_mp3buf = .;
|
_mp3buf = .;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue