Changed debug to DEBUGF and panic to panicf.
Also some linking changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@383 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
bca0f0f5ea
commit
697dd70ac4
10 changed files with 123 additions and 129 deletions
|
@ -20,15 +20,11 @@ TARGET = -DARCHOS_PLAYER=1
|
|||
#TARGET = -DARCHOS_PLAYER_OLD=1
|
||||
#TARGET = -DARCHOS_RECORDER=1
|
||||
|
||||
CFLAGS = -Os -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET)
|
||||
CFLAGS = -Os -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) -DDEBUG
|
||||
AFLAGS += -small -relax
|
||||
|
||||
SRC := $(wildcard drivers/*.c common/*.c *.c)
|
||||
OBJS := $(SRC:%.c=%.o)
|
||||
|
||||
%.o: %.s
|
||||
$(CC) -o $@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
|
||||
|
||||
OBJS := $(SRC:%.c=%.o) crt0.o
|
||||
|
||||
all : archos.mod # archos.asm
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ENTRY(_start)
|
||||
ENTRY(start)
|
||||
OUTPUT_FORMAT(elf32-sh)
|
||||
SECTIONS
|
||||
{
|
||||
|
@ -6,14 +6,28 @@ SECTIONS
|
|||
{
|
||||
*(.vectors);
|
||||
. = ALIGN(0x200);
|
||||
*(.text.start)
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
*(.init.text)
|
||||
}
|
||||
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
.bss :
|
||||
{
|
||||
_end = .;
|
||||
_stack = . + 0x1000;
|
||||
_edata = .;
|
||||
}
|
||||
|
||||
.pad 0x0900C800 :
|
||||
|
|
|
@ -167,7 +167,7 @@ static char *mem2hex (char *mem, char *buf, int count)
|
|||
return (buf);
|
||||
}
|
||||
|
||||
void debug(char *msg)
|
||||
static void debug(char *msg)
|
||||
{
|
||||
debugbuf[0] = 'O';
|
||||
|
||||
|
@ -177,29 +177,27 @@ void debug(char *msg)
|
|||
|
||||
void debugf(char *fmt, ...)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(debugmembuf, sizeof(debugmembuf), fmt, ap);
|
||||
va_end(ap);
|
||||
debug(debugmembuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void debug( const char *message )
|
||||
{
|
||||
printf( message );
|
||||
}
|
||||
|
||||
void debugf(char *fmt, ...)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( debugmembuf, sizeof(debugmembuf), fmt, ap );
|
||||
va_end( ap );
|
||||
printf( debugmembuf );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,7 +19,23 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
void debug(char *msg);
|
||||
void debugf(char *fmt, ...);
|
||||
extern void debugf(char* fmt,...);
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* GCC handles ellipses in macros, which
|
||||
means we can avoid the call completely */
|
||||
#ifdef DEBUG
|
||||
#define DEBUGF(fmt,args...) debugf(fmt, ## args)
|
||||
#else
|
||||
#define DEBUGF(fmt,args...)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
void DEBUGF debugf
|
||||
|
||||
#endif /* GCC */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,13 +25,11 @@
|
|||
|
||||
void read_file_into_buffer( char **buf, const char *filename )
|
||||
{
|
||||
/*char debug_message[128]; */
|
||||
int i;
|
||||
FILE *fp;
|
||||
int count = 0;
|
||||
|
||||
/*sprintf( debug_message, "read_file_into_buffer( %s, %s )\n", *buf, filename );
|
||||
debug( debug_message );*/
|
||||
/*DEBUG( "read_file_into_buffer( %s, %s )\n", *buf, filename ); */
|
||||
|
||||
fp = fopen( filename, "r" );
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "fat.h"
|
||||
#include "ata.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define BYTES2INT16(array,pos) \
|
||||
(array[pos] | (array[pos+1] << 8 ))
|
||||
|
@ -134,12 +135,6 @@ static unsigned char lastsector2[SECTOR_SIZE];
|
|||
|
||||
#ifdef TEST_FAT
|
||||
|
||||
#include "debug.h"
|
||||
#define DEBUG(x) printf(x)
|
||||
#define DEBUG1(x,y) printf(x,y)
|
||||
#define DEBUG2(x,y1,y2) printf(x,y1,y2)
|
||||
#define DEBUG3(x,y1,y2,y3) printf(x,y1,y2,y3)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct bpb bpb;
|
||||
|
@ -148,25 +143,20 @@ int main(int argc, char *argv[])
|
|||
memset(fat_cache_dirty, 0, sizeof(fat_cache_dirty));
|
||||
|
||||
if(ata_init())
|
||||
DEBUG("*** Warning! The disk is uninitialized\n");
|
||||
DEBUGF("*** Warning! The disk is uninitialized\n");
|
||||
else
|
||||
fat_mount(&bpb);
|
||||
|
||||
dbg_console(&bpb);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define DEBUG(x);
|
||||
#define DEBUG1(x,y);
|
||||
#define DEBUG2(x,y1,y2);
|
||||
#define DEBUG3(x,y1,y2,y3);
|
||||
#endif
|
||||
|
||||
static int sec2cluster(struct bpb *bpb, unsigned int sec)
|
||||
{
|
||||
if ( sec < bpb->firstdatasector )
|
||||
{
|
||||
DEBUG1( "sec2cluster() - Bad sector number (%d)\n", sec);
|
||||
DEBUGF( "sec2cluster() - Bad sector number (%d)\n", sec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -180,7 +170,7 @@ static int cluster2sec(struct bpb *bpb, unsigned int cluster)
|
|||
|
||||
if(cluster > max_cluster)
|
||||
{
|
||||
DEBUG1( "cluster2sec() - Bad cluster number (%d)\n",
|
||||
DEBUGF( "cluster2sec() - Bad cluster number (%d)\n",
|
||||
cluster);
|
||||
return -1;
|
||||
}
|
||||
|
@ -204,7 +194,7 @@ int fat_mount(struct bpb *bpb)
|
|||
err = ata_read_sectors(0,1,buf);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "fat_mount() - Couldn't read BPB (error code %i)\n",
|
||||
DEBUGF( "fat_mount() - Couldn't read BPB (error code %i)\n",
|
||||
err);
|
||||
return -1;
|
||||
}
|
||||
|
@ -256,7 +246,7 @@ int fat_mount(struct bpb *bpb)
|
|||
if ( countofclusters < 65525 )
|
||||
#endif
|
||||
{
|
||||
DEBUG("This is not FAT32. Go away!\n");
|
||||
DEBUGF("This is not FAT32. Go away!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -277,7 +267,7 @@ int fat_mount(struct bpb *bpb)
|
|||
|
||||
if (bpb_is_sane(bpb) < 0)
|
||||
{
|
||||
DEBUG( "fat_mount() - BPB is not sane\n");
|
||||
DEBUGF( "fat_mount() - BPB is not sane\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -290,55 +280,55 @@ static int bpb_is_sane(struct bpb *bpb)
|
|||
{
|
||||
if(bpb->bpb_bytspersec != 512)
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Error: sector size is not 512 (%i)\n",
|
||||
DEBUGF( "bpb_is_sane() - Error: sector size is not 512 (%i)\n",
|
||||
bpb->bpb_bytspersec);
|
||||
return -1;
|
||||
}
|
||||
if(bpb->bpb_secperclus * bpb->bpb_bytspersec > 32768)
|
||||
{
|
||||
DEBUG3( "bpb_is_sane() - Warning: cluster size is larger than 32K "
|
||||
DEBUGF( "bpb_is_sane() - Warning: cluster size is larger than 32K "
|
||||
"(%i * %i = %i)\n",
|
||||
bpb->bpb_bytspersec, bpb->bpb_secperclus,
|
||||
bpb->bpb_bytspersec * bpb->bpb_secperclus);
|
||||
}
|
||||
if(bpb->bpb_rsvdseccnt != 1)
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Warning: Reserved sectors is not 1 (%i)\n",
|
||||
DEBUGF( "bpb_is_sane() - Warning: Reserved sectors is not 1 (%i)\n",
|
||||
bpb->bpb_rsvdseccnt);
|
||||
}
|
||||
if(bpb->bpb_numfats != 2)
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Warning: NumFATS is not 2 (%i)\n",
|
||||
DEBUGF( "bpb_is_sane() - Warning: NumFATS is not 2 (%i)\n",
|
||||
bpb->bpb_numfats);
|
||||
}
|
||||
if(bpb->bpb_rootentcnt != 512)
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Warning: RootEntCnt is not 512 (%i)\n",
|
||||
DEBUGF( "bpb_is_sane() - Warning: RootEntCnt is not 512 (%i)\n",
|
||||
bpb->bpb_rootentcnt);
|
||||
}
|
||||
if(bpb->bpb_totsec16 < 200)
|
||||
{
|
||||
if(bpb->bpb_totsec16 == 0)
|
||||
{
|
||||
DEBUG( "bpb_is_sane() - Error: TotSec16 is 0\n");
|
||||
DEBUGF( "bpb_is_sane() - Error: TotSec16 is 0\n");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Warning: TotSec16 "
|
||||
DEBUGF( "bpb_is_sane() - Warning: TotSec16 "
|
||||
"is quite small (%i)\n",
|
||||
bpb->bpb_totsec16);
|
||||
}
|
||||
}
|
||||
if(bpb->bpb_media != 0xf0 && bpb->bpb_media < 0xf8)
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Warning: Non-standard "
|
||||
DEBUGF( "bpb_is_sane() - Warning: Non-standard "
|
||||
"media type (0x%02x)\n",
|
||||
bpb->bpb_media);
|
||||
}
|
||||
if(bpb->last_word != 0xaa55)
|
||||
{
|
||||
DEBUG1( "bpb_is_sane() - Error: Last word is not "
|
||||
DEBUGF( "bpb_is_sane() - Error: Last word is not "
|
||||
"0xaa55 (0x%04x)\n", bpb->last_word);
|
||||
return -1;
|
||||
}
|
||||
|
@ -356,12 +346,12 @@ static void *cache_fat_sector(struct bpb *bpb, int secnum)
|
|||
sec = malloc(bpb->bpb_bytspersec);
|
||||
if(!sec)
|
||||
{
|
||||
DEBUG( "cache_fat_sector() - Out of memory\n");
|
||||
DEBUGF( "cache_fat_sector() - Out of memory\n");
|
||||
return NULL;
|
||||
}
|
||||
if(ata_read_sectors(secnum,1,sec))
|
||||
{
|
||||
DEBUG1( "cache_fat_sector() - Could"
|
||||
DEBUGF( "cache_fat_sector() - Could"
|
||||
" not read sector %d\n",
|
||||
secnum);
|
||||
free(sec);
|
||||
|
@ -388,7 +378,7 @@ static int update_entry(struct bpb *bpb, int entry, unsigned int val)
|
|||
sec = cache_fat_sector(bpb, thisfatsecnum);
|
||||
if(!sec)
|
||||
{
|
||||
DEBUG1( "update_entry() - Could not cache sector %d\n",
|
||||
DEBUGF( "update_entry() - Could not cache sector %d\n",
|
||||
thisfatsecnum);
|
||||
return -1;
|
||||
}
|
||||
|
@ -419,7 +409,7 @@ static int read_entry(struct bpb *bpb, int entry)
|
|||
sec = cache_fat_sector(bpb, thisfatsecnum);
|
||||
if(!sec)
|
||||
{
|
||||
DEBUG1( "update_entry() - Could not cache sector %d\n",
|
||||
DEBUGF( "update_entry() - Could not cache sector %d\n",
|
||||
thisfatsecnum);
|
||||
return -1;
|
||||
}
|
||||
|
@ -455,19 +445,19 @@ static int flush_fat(struct bpb *bpb)
|
|||
{
|
||||
if(fat_cache[i] && fat_cache_dirty[i])
|
||||
{
|
||||
DEBUG1("Flushing FAT sector %d\n", i);
|
||||
DEBUGF("Flushing FAT sector %d\n", i);
|
||||
sec = fat_cache[i];
|
||||
err = ata_write_sectors(i + bpb->bpb_rsvdseccnt,1,sec);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "flush_fat() - Couldn't write"
|
||||
DEBUGF( "flush_fat() - Couldn't write"
|
||||
" sector (%d)\n", i + bpb->bpb_rsvdseccnt);
|
||||
return -1;
|
||||
}
|
||||
err = ata_write_sectors(i + bpb->bpb_rsvdseccnt + fatsz,1,sec);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "flush_fat() - Couldn't write"
|
||||
DEBUGF( "flush_fat() - Couldn't write"
|
||||
" sector (%d)\n", i + bpb->bpb_rsvdseccnt + fatsz);
|
||||
return -1;
|
||||
}
|
||||
|
@ -543,7 +533,7 @@ static int add_dir_entry(struct bpb *bpb,
|
|||
}
|
||||
else
|
||||
{
|
||||
DEBUG( "add_dir_entry() -"
|
||||
DEBUGF( "add_dir_entry() -"
|
||||
" Root dir is full\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -554,9 +544,9 @@ static int add_dir_entry(struct bpb *bpb,
|
|||
if(sec_cnt >= bpb->bpb_secperclus)
|
||||
{
|
||||
/* We have reached the end of this cluster */
|
||||
DEBUG("Moving to the next cluster...");
|
||||
DEBUGF("Moving to the next cluster...");
|
||||
currdir = get_next_cluster(bpb, currdir);
|
||||
DEBUG1("new cluster is %d\n", currdir);
|
||||
DEBUGF("new cluster is %d\n", currdir);
|
||||
|
||||
if(!currdir)
|
||||
{
|
||||
|
@ -567,12 +557,12 @@ static int add_dir_entry(struct bpb *bpb,
|
|||
}
|
||||
}
|
||||
|
||||
DEBUG1("Reading sector %d...\n", sec);
|
||||
DEBUGF("Reading sector %d...\n", sec);
|
||||
/* Read the next sector in the current dir */
|
||||
err = ata_read_sectors(sec,1,buf);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "add_dir_entry() - Couldn't read dir sector"
|
||||
DEBUGF( "add_dir_entry() - Couldn't read dir sector"
|
||||
" (error code %i)\n", err);
|
||||
return -1;
|
||||
}
|
||||
|
@ -580,7 +570,7 @@ static int add_dir_entry(struct bpb *bpb,
|
|||
if(need_to_update_last_empty_marker)
|
||||
{
|
||||
/* All we need to do is to set the first entry to 0 */
|
||||
DEBUG1("Clearing the first entry in sector %d\n", sec);
|
||||
DEBUGF("Clearing the first entry in sector %d\n", sec);
|
||||
buf[0] = 0;
|
||||
done = 1;
|
||||
}
|
||||
|
@ -592,7 +582,7 @@ static int add_dir_entry(struct bpb *bpb,
|
|||
firstbyte = buf[i];
|
||||
if(firstbyte == 0xe5 || firstbyte == 0)
|
||||
{
|
||||
DEBUG2("Found free slot at entry %d in sector %d\n",
|
||||
DEBUGF("Found free slot at entry %d in sector %d\n",
|
||||
i/32, sec);
|
||||
eptr = &buf[i];
|
||||
memset(eptr, 0, 32);
|
||||
|
@ -637,7 +627,7 @@ static int add_dir_entry(struct bpb *bpb,
|
|||
err = ata_write_sectors(sec,1,buf);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "add_dir_entry() - "
|
||||
DEBUGF( "add_dir_entry() - "
|
||||
" Couldn't write dir"
|
||||
" sector (error code %i)\n", err);
|
||||
return -1;
|
||||
|
@ -752,11 +742,11 @@ int fat_create_dir(struct bpb *bpb, unsigned int currdir, char *name)
|
|||
struct fat_direntry de;
|
||||
int err;
|
||||
|
||||
DEBUG("fat_create_file()\n");
|
||||
DEBUGF("fat_create_file()\n");
|
||||
memset(&de, 0, sizeof(struct fat_direntry));
|
||||
if(create_dos_name(name, de.name) < 0)
|
||||
{
|
||||
DEBUG1( "fat_create_file() - Illegal file name (%s)\n", name);
|
||||
DEBUGF( "fat_create_file() - Illegal file name (%s)\n", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -775,11 +765,11 @@ int fat_create_file(struct bpb *bpb, unsigned int currdir, char *name)
|
|||
struct fat_direntry de;
|
||||
int err;
|
||||
|
||||
DEBUG("fat_create_file()\n");
|
||||
DEBUGF("fat_create_file()\n");
|
||||
memset(&de, 0, sizeof(struct fat_direntry));
|
||||
if(create_dos_name(name, de.name) < 0)
|
||||
{
|
||||
DEBUG1( "fat_create_file() - Illegal file name (%s)\n", name);
|
||||
DEBUGF( "fat_create_file() - Illegal file name (%s)\n", name);
|
||||
return -1;
|
||||
}
|
||||
getcurrdostime(&de.crtdate, &de.crttime, &de.crttimetenth);
|
||||
|
@ -833,7 +823,7 @@ int fat_read(struct bpb *bpb,
|
|||
for ( i=0; i<sectorcount; i++ ) {
|
||||
err = ata_read_sectors(sector,1,(char*)buf+(i*SECTOR_SIZE));
|
||||
if(err) {
|
||||
DEBUG2( "fat_read() - Couldn't read sector %d"
|
||||
DEBUGF( "fat_read() - Couldn't read sector %d"
|
||||
" (error code %i)\n", sector,err);
|
||||
return -1;
|
||||
}
|
||||
|
@ -911,7 +901,7 @@ int fat_opendir(struct bpb *bpb,
|
|||
err = ata_read_sectors(sec,1,ent->cached_buf);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "fat_getfirst() - Couldn't read dir sector"
|
||||
DEBUGF( "fat_getfirst() - Couldn't read dir sector"
|
||||
" (error code %i)\n", err);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1027,20 +1017,20 @@ int fat_getnext(struct bpb *bpb,
|
|||
{
|
||||
int cluster = sec2cluster(bpb, ent->cached_sec);
|
||||
if ( cluster < 0 ) {
|
||||
DEBUG("sec2cluster failed\n");
|
||||
DEBUGF("sec2cluster failed\n");
|
||||
return -1;
|
||||
}
|
||||
ent->num_sec = 0;
|
||||
cluster = get_next_cluster( bpb, cluster );
|
||||
if(!cluster)
|
||||
{
|
||||
DEBUG("End of cluster chain.\n");
|
||||
DEBUGF("End of cluster chain.\n");
|
||||
return -1;
|
||||
}
|
||||
ent->cached_sec = cluster2sec(bpb,cluster);
|
||||
if ( ent->cached_sec < 0 )
|
||||
{
|
||||
DEBUG1("Invalid cluster: %d\n",cluster);
|
||||
DEBUGF("Invalid cluster: %d\n",cluster);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1040,7 @@ int fat_getnext(struct bpb *bpb,
|
|||
err = ata_read_sectors(ent->cached_sec,1,ent->cached_buf);
|
||||
if(err)
|
||||
{
|
||||
DEBUG1( "fat_getnext() - Couldn't read dir sector"
|
||||
DEBUGF( "fat_getnext() - Couldn't read dir sector"
|
||||
" (error code %i)\n", err);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -20,23 +20,11 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "panic.h"
|
||||
#include "drivers/lcd.h"
|
||||
#include "lcd.h"
|
||||
#include "debug.h"
|
||||
|
||||
char panic_buf[128];
|
||||
|
||||
/*
|
||||
* "Dude. This is pretty fucked-up, right here."
|
||||
*/
|
||||
void panic( char *message )
|
||||
{
|
||||
debug( message );
|
||||
|
||||
/*lcd_string( message ); */
|
||||
|
||||
while( 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
* "Dude. This is pretty fucked-up, right here."
|
||||
*/
|
||||
|
@ -48,5 +36,7 @@ void panicf( char *fmt, ...)
|
|||
vsnprintf( panic_buf, sizeof(panic_buf), fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
panic( panic_buf );
|
||||
lcd_puts(0,0,panic_buf);
|
||||
DEBUGF(panic_buf);
|
||||
while(1);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef __PANIC_H__
|
||||
#define __PANIC_H__
|
||||
|
||||
void panic( char *message );
|
||||
void panicf( char *fmt, ... );
|
||||
|
||||
#endif /* __PANIC_H__ */
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
int reload_playlist_info( playlist_info_t *playlist )
|
||||
{
|
||||
debug( "reload_playlist_info()\n" );
|
||||
DEBUGF( "reload_playlist_info()\n" );
|
||||
|
||||
/* this is a TEMP stub version */
|
||||
|
||||
|
@ -60,22 +60,16 @@ int reload_playlist_info( playlist_info_t *playlist )
|
|||
void load_playlist( playlist_info_t *playlist, const char *filename ) {
|
||||
|
||||
char *m3u_buf = NULL;
|
||||
char debug_message[128];
|
||||
|
||||
snprintf( debug_message, sizeof(debug_message),
|
||||
"load_playlist( %s )\n", filename );
|
||||
debug( debug_message );
|
||||
DEBUGF( "load_playlist( %s )\n", filename );
|
||||
|
||||
/* read file */
|
||||
|
||||
read_file_into_buffer( &m3u_buf, filename );
|
||||
|
||||
/* store playlist filename */
|
||||
|
||||
strncpy( playlist->filename, filename, sizeof(playlist->filename) );
|
||||
|
||||
/* add track indices to playlist data structure */
|
||||
|
||||
add_indices_to_playlist( m3u_buf, playlist );
|
||||
}
|
||||
|
||||
|
@ -84,7 +78,7 @@ void load_playlist( playlist_info_t *playlist, const char *filename ) {
|
|||
*/
|
||||
void empty_playlist( playlist_info_t *playlist ) {
|
||||
|
||||
debug( "empty_playlist()\n" );
|
||||
DEBUGF( "empty_playlist()\n" );
|
||||
|
||||
playlist->filename[0] = '\0';
|
||||
playlist->indices_count = 0;
|
||||
|
@ -101,7 +95,7 @@ void add_indices_to_playlist( char *buf, playlist_info_t *playlist )
|
|||
char *p;
|
||||
int i = 0;
|
||||
|
||||
/*debug( "add_indices_to_playlist()\n" ); */
|
||||
/*DEBUGF( "add_indices_to_playlist()\n" ); */
|
||||
|
||||
p = buf;
|
||||
|
||||
|
@ -141,8 +135,7 @@ void add_indices_to_playlist( char *buf, playlist_info_t *playlist )
|
|||
*/
|
||||
void extend_indices( playlist_info_t *playlist, int new_index )
|
||||
{
|
||||
/*sprintf( debug_message, "extend_indices(%d)\n", new_index );
|
||||
debug( debug_message );*/
|
||||
/*DEBUGF( "extend_indices(%d)\n", new_index ); */
|
||||
|
||||
/* increase array size count */
|
||||
|
||||
|
@ -157,8 +150,8 @@ void extend_indices( playlist_info_t *playlist, int new_index )
|
|||
playlist->indices[ playlist->indices_count - 1 ] = new_index;
|
||||
}
|
||||
|
||||
track_t next_playlist_track( playlist_info_t *playlist ) {
|
||||
|
||||
track_t next_playlist_track( playlist_info_t *playlist )
|
||||
{
|
||||
track_t track;
|
||||
strncpy( track.filename, "boogie", sizeof(track.filename) );
|
||||
return track;
|
||||
|
@ -167,8 +160,8 @@ track_t next_playlist_track( playlist_info_t *playlist ) {
|
|||
/*
|
||||
* randomly rearrange the array of indices for the playlist
|
||||
*/
|
||||
void randomise_playlist( playlist_info_t *playlist ) {
|
||||
|
||||
void randomise_playlist( playlist_info_t *playlist )
|
||||
{
|
||||
unsigned seed;
|
||||
int count = 0;
|
||||
int candidate;
|
||||
|
@ -178,7 +171,7 @@ void randomise_playlist( playlist_info_t *playlist ) {
|
|||
int *randomised_list;
|
||||
int i;
|
||||
|
||||
debug( "randomise_playlist()\n" );
|
||||
DEBUGF( "randomise_playlist()\n" );
|
||||
|
||||
/* create dynamic storage for randomised list so it can be freed later */
|
||||
|
||||
|
@ -279,7 +272,7 @@ int is_unused_random_in_list( int number, int *new_list, int count )
|
|||
*/
|
||||
void display_playlist_track( track_t *track )
|
||||
{
|
||||
debugf( "track: %s\n", track->filename );
|
||||
DEBUGF( "track: %s\n", track->filename );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -290,14 +283,14 @@ void display_current_playlist( playlist_info_t *playlist )
|
|||
char indices[2048];
|
||||
indices[0]='\0';
|
||||
|
||||
/*debug( "\ndisplay_current_playlist()\n" ); */
|
||||
/*DEBUGF( "\ndisplay_current_playlist()\n" ); */
|
||||
|
||||
if( playlist->indices_count != 0 )
|
||||
{
|
||||
get_indices_as_string( indices, playlist );
|
||||
}
|
||||
|
||||
debugf( "\nfilename:\t%s\ntotal:\t\t%d\nindices:\t%s\ncurrent index:\t%d\n\n",
|
||||
DEBUGF( "\nfilename:\t%s\ntotal:\t\t%d\nindices:\t%s\ncurrent index:\t%d\n\n",
|
||||
playlist->filename,
|
||||
playlist->indices_count,
|
||||
indices,
|
||||
|
@ -313,7 +306,7 @@ void get_indices_as_string( char *string, playlist_info_t *playlist )
|
|||
int count = 0;
|
||||
int *p = playlist->indices;
|
||||
|
||||
/*debug( "get_indices_as_string()\n" ); */
|
||||
/*DEBUGF( "get_indices_as_string()\n" ); */
|
||||
|
||||
while( count < playlist->indices_count ) {
|
||||
|
||||
|
|
|
@ -31,57 +31,57 @@ int persist_all_settings( void )
|
|||
{
|
||||
if( ! persist_volume_setting() )
|
||||
{
|
||||
panic( "failed to persist volume setting" );
|
||||
panicf( "failed to persist volume setting" );
|
||||
}
|
||||
|
||||
if( ! persist_balance_setting() )
|
||||
{
|
||||
panic( "failed to persist balance setting" );
|
||||
panicf( "failed to persist balance setting" );
|
||||
}
|
||||
|
||||
if( ! persist_bass_setting() )
|
||||
{
|
||||
panic( "failed to persist bass setting" );
|
||||
panicf( "failed to persist bass setting" );
|
||||
}
|
||||
|
||||
if( ! persist_treble_setting() )
|
||||
{
|
||||
panic( "failed to persist treble setting" );
|
||||
panicf( "failed to persist treble setting" );
|
||||
}
|
||||
|
||||
if( ! persist_loudness_setting() )
|
||||
{
|
||||
panic( "failed to persist loudness setting" );
|
||||
panicf( "failed to persist loudness setting" );
|
||||
}
|
||||
|
||||
if( ! persist_bass_boost_setting() )
|
||||
{
|
||||
panic( "failed to persist bass boost setting" );
|
||||
panicf( "failed to persist bass boost setting" );
|
||||
}
|
||||
|
||||
if( ! persist_contrast_setting() )
|
||||
{
|
||||
panic( "failed to persist contrast setting" );
|
||||
panicf( "failed to persist contrast setting" );
|
||||
}
|
||||
|
||||
if( ! persist_poweroff_setting() )
|
||||
{
|
||||
panic( "failed to persist poweroff setting" );
|
||||
panicf( "failed to persist poweroff setting" );
|
||||
}
|
||||
|
||||
if( ! persist_backlight_setting() )
|
||||
{
|
||||
panic( "failed to persist backlight setting" );
|
||||
panicf( "failed to persist backlight setting" );
|
||||
}
|
||||
|
||||
if( ! persist_poweroff_setting() )
|
||||
{
|
||||
panic( "failed to persist poweroff setting" );
|
||||
panicf( "failed to persist poweroff setting" );
|
||||
}
|
||||
|
||||
if( ! persist_resume_setting() )
|
||||
{
|
||||
panic( "failed to persist resume setting" );
|
||||
panicf( "failed to persist resume setting" );
|
||||
}
|
||||
|
||||
/* by getting here, we had no problems */
|
||||
|
@ -96,22 +96,22 @@ int persist_all_playlist_info( void )
|
|||
{
|
||||
if( ! persist_playlist_filename() )
|
||||
{
|
||||
panic( "failed to persist playlist filename" );
|
||||
panicf( "failed to persist playlist filename" );
|
||||
}
|
||||
|
||||
if( ! persist_playlist_indices() )
|
||||
{
|
||||
panic( "failed to persist playlist indices" );
|
||||
panicf( "failed to persist playlist indices" );
|
||||
}
|
||||
|
||||
if( ! persist_playlist_index() )
|
||||
{
|
||||
panic( "failed to persist playlist index" );
|
||||
panicf( "failed to persist playlist index" );
|
||||
}
|
||||
|
||||
if( ! persist_resume_track_time() )
|
||||
{
|
||||
panic( "failed to persist resume track time" );
|
||||
panicf( "failed to persist resume track time" );
|
||||
}
|
||||
|
||||
/* by getting here, we had no problems */
|
||||
|
@ -124,7 +124,7 @@ int persist_all_playlist_info( void )
|
|||
*/
|
||||
void reload_all_settings( user_settings_t *settings )
|
||||
{
|
||||
debug( "reload_all_settings()\n" );
|
||||
DEBUGF( "reload_all_settings()\n" );
|
||||
|
||||
/* this is a TEMP stub version */
|
||||
|
||||
|
@ -138,7 +138,7 @@ void reload_all_settings( user_settings_t *settings )
|
|||
*/
|
||||
void reset_settings( user_settings_t *settings ) {
|
||||
|
||||
debug( "reset_settings()\n" );
|
||||
DEBUGF( "reset_settings()\n" );
|
||||
|
||||
settings->volume = DEFAULT_VOLUME_SETTING;
|
||||
settings->balance = DEFAULT_BALANCE_SETTING;
|
||||
|
@ -156,9 +156,9 @@ void reset_settings( user_settings_t *settings ) {
|
|||
*/
|
||||
void display_current_settings( user_settings_t *settings )
|
||||
{
|
||||
debug( "\ndisplay_current_settings()\n" );
|
||||
DEBUGF( "\ndisplay_current_settings()\n" );
|
||||
|
||||
debugf( "\nvolume:\t\t%d\nbalance:\t%d\nbass:\t\t%d\ntreble:\t\t%d\nloudness:\t%d\nbass boost:\t%d\n",
|
||||
DEBUGF( "\nvolume:\t\t%d\nbalance:\t%d\nbass:\t\t%d\ntreble:\t\t%d\nloudness:\t%d\nbass boost:\t%d\n",
|
||||
settings->volume,
|
||||
settings->balance,
|
||||
settings->bass,
|
||||
|
@ -166,7 +166,7 @@ void display_current_settings( user_settings_t *settings )
|
|||
settings->loudness,
|
||||
settings->bass_boost );
|
||||
|
||||
debugf( "contrast:\t%d\npoweroff:\t%d\nbacklight:\t%d\n",
|
||||
DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight:\t%d\n",
|
||||
settings->contrast,
|
||||
settings->poweroff,
|
||||
settings->backlight );
|
||||
|
|
Loading…
Reference in a new issue