More static'ing, and a few fixes resulting from that.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11737 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-12-12 22:22:21 +00:00
parent 819712f118
commit 314f3b58f1
12 changed files with 67 additions and 108 deletions

View file

@ -78,6 +78,7 @@ void ab_repeat_init(void)
} }
} }
#if 0 /* Currently unused */
unsigned int ab_get_A_marker(void) unsigned int ab_get_A_marker(void)
{ {
return ab_A_marker; return ab_A_marker;
@ -87,6 +88,7 @@ unsigned int ab_get_B_marker(void)
{ {
return ab_B_marker; return ab_B_marker;
} }
#endif /* if 0 */
/* determines if the given song position is earlier than the A mark; /* determines if the given song position is earlier than the A mark;
intended for use in handling the jump NEXT and PREV commands */ intended for use in handling the jump NEXT and PREV commands */

View file

@ -32,9 +32,11 @@
#include "settings.h" #include "settings.h"
#endif #endif
void ab_repeat_init(void); void ab_repeat_init(void);
#if 0 /* Currently unused */
unsigned int ab_get_A_marker(void); unsigned int ab_get_A_marker(void);
unsigned int ab_get_B_marker(void); unsigned int ab_get_B_marker(void);
#endif /* if 0 */
bool ab_before_A_marker(unsigned int song_position); bool ab_before_A_marker(unsigned int song_position);
bool ab_after_A_marker(unsigned int song_position); bool ab_after_A_marker(unsigned int song_position);
void ab_jump_to_A_marker(void); void ab_jump_to_A_marker(void);

View file

@ -90,7 +90,9 @@ extern int ata_device;
extern int ata_io_address; extern int ata_io_address;
extern struct core_entry cores[NUM_CORES]; extern struct core_entry cores[NUM_CORES];
char thread_status_char(int status) #ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP
static char thread_status_char(int status)
{ {
switch (status) switch (status)
{ {
@ -102,10 +104,9 @@ char thread_status_char(int status)
return '?'; return '?';
} }
#ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP
/* Test code!!! */ /* Test code!!! */
bool dbg_os(void) static bool dbg_os(void)
{ {
struct thread_entry *thread; struct thread_entry *thread;
char buf[32]; char buf[32];
@ -168,7 +169,7 @@ bool dbg_os(void)
# else # else
snprintf(buf, 32, "%c%c %s: %d%%", snprintf(buf, 32, "%c%c %s: %d%%",
(status == STATE_RUNNING) ? '*' : ' ', (status == STATE_RUNNING) ? '*' : ' ',
(status == STATE_BLOCKED) ? 'B' : ' ', thread_status_char(status),
cores[CURRENT_CORE].threads[i].name, usage); cores[CURRENT_CORE].threads[i].name, usage);
# endif # endif
lcd_puts(0, 1+i, buf); lcd_puts(0, 1+i, buf);
@ -183,7 +184,7 @@ bool dbg_os(void)
return false; return false;
} }
#else /* !HAVE_LCD_BITMAP */ #else /* !HAVE_LCD_BITMAP */
bool dbg_os(void) static bool dbg_os(void)
{ {
char buf[32]; char buf[32];
int button; int button;
@ -229,7 +230,7 @@ bool dbg_os(void)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
#ifndef SIMULATOR #ifndef SIMULATOR
bool dbg_audio_thread(void) static bool dbg_audio_thread(void)
{ {
char buf[32]; char buf[32];
struct audio_debug d; struct audio_debug d;
@ -282,7 +283,7 @@ extern size_t filebuflen;
static unsigned int ticks, boost_ticks; static unsigned int ticks, boost_ticks;
void dbg_audio_task(void) static void dbg_audio_task(void)
{ {
#ifndef SIMULATOR #ifndef SIMULATOR
if(FREQ > CPUFREQ_NORMAL) if(FREQ > CPUFREQ_NORMAL)
@ -292,7 +293,7 @@ void dbg_audio_task(void)
ticks++; ticks++;
} }
bool dbg_audio_thread(void) static bool dbg_audio_thread(void)
{ {
char buf[32]; char buf[32];
int button; int button;
@ -373,37 +374,18 @@ bool dbg_audio_thread(void)
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#ifndef SIMULATOR #if (CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)) && !defined(SIMULATOR)
/* Tool function to read the flash manufacturer and type, if available. /* Tool function to read the flash manufacturer and type, if available.
Only chips which could be reprogrammed in system will return values. Only chips which could be reprogrammed in system will return values.
(The mode switch addresses vary between flash manufacturers, hence addr1/2) */ (The mode switch addresses vary between flash manufacturers, hence addr1/2) */
/* In IRAM to avoid problems when running directly from Flash */ /* In IRAM to avoid problems when running directly from Flash */
bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
unsigned addr1, unsigned addr2) unsigned addr1, unsigned addr2)
ICODE_ATTR; ICODE_ATTR __attribute__((noinline));
bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, static bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
unsigned addr1, unsigned addr2) unsigned addr1, unsigned addr2)
{ {
#ifdef CPU_PP
/* TODO: Implement for PortalPlayer */
(void)p_manufacturer;
(void)p_device;
(void)addr1;
(void)addr2;
#elif CONFIG_CPU == PNX0101
/* TODO: Implement for iFP7xx */
(void)p_manufacturer;
(void)p_device;
(void)addr1;
(void)addr2;
#elif CONFIG_CPU == S3C2440
/* TODO: Implement for Gigabeat */
(void)p_manufacturer;
(void)p_device;
(void)addr1;
(void)addr2;
#else
unsigned not_manu, not_id; /* read values before switching to ID mode */ unsigned not_manu, not_id; /* read values before switching to ID mode */
unsigned manu, id; /* read values when in ID mode */ unsigned manu, id; /* read values when in ID mode */
@ -444,14 +426,13 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device,
*p_device = id; *p_device = id;
return true; /* success */ return true; /* success */
} }
#endif
return false; /* fail */ return false; /* fail */
} }
#endif /* !SIMULATOR */ #endif /* (CONFIG_CPU == SH7034 || CPU_COLDFIRE) && !SIMULATOR */
#ifndef SIMULATOR #ifndef SIMULATOR
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
bool dbg_hw_info(void) static bool dbg_hw_info(void)
{ {
#if CONFIG_CPU == SH7034 #if CONFIG_CPU == SH7034
char buf[32]; char buf[32];
@ -602,7 +583,7 @@ bool dbg_hw_info(void)
return false; return false;
} }
#else /* !HAVE_LCD_BITMAP */ #else /* !HAVE_LCD_BITMAP */
bool dbg_hw_info(void) static bool dbg_hw_info(void)
{ {
char buf[32]; char buf[32];
int button; int button;
@ -765,7 +746,7 @@ bool dbg_partitions(void)
#endif #endif
#if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT) #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT)
bool dbg_spdif(void) static bool dbg_spdif(void)
{ {
char buf[128]; char buf[128];
int line; int line;
@ -1261,7 +1242,7 @@ bool dbg_ports(void)
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
bool dbg_cpufreq(void) static bool dbg_cpufreq(void)
{ {
char buf[128]; char buf[128];
int line; int line;
@ -1323,7 +1304,7 @@ bool dbg_cpufreq(void)
#define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN) #define BAT_LAST_VAL MIN(LCD_WIDTH, POWER_HISTORY_LEN)
#define BAT_YSPACE (LCD_HEIGHT - 20) #define BAT_YSPACE (LCD_HEIGHT - 20)
bool view_battery(void) static bool view_battery(void)
{ {
int view = 0; int view = 0;
int i, x, y; int i, x, y;
@ -1590,7 +1571,7 @@ static bool view_runtime(void)
#ifndef SIMULATOR #ifndef SIMULATOR
#ifdef HAVE_MMC #ifdef HAVE_MMC
bool dbg_mmc_info(void) static bool dbg_mmc_info(void)
{ {
bool done = false; bool done = false;
int currval = 0; int currval = 0;
@ -1970,7 +1951,7 @@ static bool dbg_tagcache_info(void)
#endif #endif
#if CONFIG_CPU == SH7034 #if CONFIG_CPU == SH7034
bool dbg_save_roms(void) static bool dbg_save_roms(void)
{ {
int fd; int fd;
int oldmode = system_memory_guard(MEMGUARD_NONE); int oldmode = system_memory_guard(MEMGUARD_NONE);
@ -1993,7 +1974,7 @@ bool dbg_save_roms(void)
return false; return false;
} }
#elif defined CPU_COLDFIRE #elif defined CPU_COLDFIRE
bool dbg_save_roms(void) static bool dbg_save_roms(void)
{ {
int fd; int fd;
int oldmode = system_memory_guard(MEMGUARD_NONE); int oldmode = system_memory_guard(MEMGUARD_NONE);
@ -2042,7 +2023,7 @@ bool dbg_save_roms(void)
#ifndef SIMULATOR #ifndef SIMULATOR
#ifdef CONFIG_TUNER #ifdef CONFIG_TUNER
bool dbg_fm_radio(void) static bool dbg_fm_radio(void)
{ {
char buf[32]; char buf[32];
bool fm_detected; bool fm_detected;
@ -2086,7 +2067,7 @@ bool dbg_fm_radio(void)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
extern bool do_screendump_instead_of_usb; extern bool do_screendump_instead_of_usb;
bool dbg_screendump(void) static bool dbg_screendump(void)
{ {
do_screendump_instead_of_usb = !do_screendump_instead_of_usb; do_screendump_instead_of_usb = !do_screendump_instead_of_usb;
gui_syncsplash(HZ, true, "Screendump %s", gui_syncsplash(HZ, true, "Screendump %s",
@ -2096,7 +2077,7 @@ bool dbg_screendump(void)
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) #if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
bool dbg_set_memory_guard(void) static bool dbg_set_memory_guard(void)
{ {
static const struct opt_items names[MAXMEMGUARD] = { static const struct opt_items names[MAXMEMGUARD] = {
{ "None", -1 }, { "None", -1 },
@ -2113,7 +2094,7 @@ bool dbg_set_memory_guard(void)
#endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */ #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
bool dbg_write_eeprom(void) static bool dbg_write_eeprom(void)
{ {
int fd; int fd;
int rc; int rc;

View file

@ -24,9 +24,6 @@ bool debug_menu(void);
#ifndef SIMULATOR #ifndef SIMULATOR
extern bool dbg_ports(void); extern bool dbg_ports(void);
extern bool dbg_partitions(void); extern bool dbg_partitions(void);
#ifdef CONFIG_RTC
extern bool dbg_rtc(void);
#endif
#endif #endif
#endif #endif

View file

@ -226,7 +226,7 @@ static int channels_mode = 0;
static int32_t sw_gain, sw_cross; static int32_t sw_gain, sw_cross;
extern int current_codec; extern int current_codec;
struct dsp_config *dsp; static struct dsp_config *dsp;
/* The internal format is 32-bit samples, non-interleaved, stereo. This /* The internal format is 32-bit samples, non-interleaved, stereo. This
* format is similar to the raw output from several codecs, so the amount * format is similar to the raw output from several codecs, so the amount
@ -563,7 +563,7 @@ void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, long cutoff)
* to listen to on headphones with no crossfeed. * to listen to on headphones with no crossfeed.
*/ */
#ifndef DSP_HAVE_ASM_CROSSFEED #ifndef DSP_HAVE_ASM_CROSSFEED
void apply_crossfeed(int32_t* src[], int count) static void apply_crossfeed(int32_t* src[], int count)
{ {
int32_t *hist_l = &crossfeed_data.history[0]; int32_t *hist_l = &crossfeed_data.history[0];
int32_t *hist_r = &crossfeed_data.history[2]; int32_t *hist_r = &crossfeed_data.history[2];

View file

@ -101,7 +101,7 @@ static const unsigned long atan_table[] = {
* @return sin of phase, value is a signed value from LONG_MIN to LONG_MAX, * @return sin of phase, value is a signed value from LONG_MIN to LONG_MAX,
* representing -1 and 1 respectively. * representing -1 and 1 respectively.
*/ */
long fsincos(unsigned long phase, long *cos) { static long fsincos(unsigned long phase, long *cos) {
int32_t x, x1, y, y1; int32_t x, x1, y, y1;
unsigned long z, z1; unsigned long z, z1;
int i; int i;
@ -164,7 +164,7 @@ static long fsqrt(long a, unsigned int fracbits)
return b; return b;
} }
short dbtoatab[49] = { static const short dbtoatab[49] = {
2058, 2180, 2309, 2446, 2591, 2744, 2907, 3079, 3261, 3455, 3659, 3876, 2058, 2180, 2309, 2446, 2591, 2744, 2907, 3079, 3261, 3455, 3659, 3876,
4106, 4349, 4607, 4880, 5169, 5475, 5799, 6143, 6507, 6893, 7301, 7734, 4106, 4349, 4607, 4880, 5169, 5475, 5799, 6143, 6507, 6893, 7301, 7734,
8192, 8677, 9192, 9736, 10313, 10924, 11572, 12257, 12983, 13753, 14568, 8192, 8677, 9192, 9736, 10313, 10924, 11572, 12257, 12983, 13753, 14568,

View file

@ -537,7 +537,7 @@ static int add_plugin(char *plugin)
} }
/* read config file (or cahe file) */ /* read config file (or cahe file) */
bool read_config(const char* file) static bool read_config(const char* file)
{ {
enum {extension, enum {extension,
plugin, plugin,

View file

@ -104,15 +104,19 @@
const char appsversion[]=APPSVERSION; const char appsversion[]=APPSVERSION;
void init(void); static void init(void);
#ifdef SIMULATOR
void app_main(void) void app_main(void)
#else
static void app_main(void)
#endif
{ {
init(); init();
browse_root(); browse_root();
} }
int init_dircache(bool preinit) static int init_dircache(bool preinit)
{ {
#ifdef HAVE_DIRCACHE #ifdef HAVE_DIRCACHE
int result = 0; int result = 0;
@ -174,7 +178,7 @@ int init_dircache(bool preinit)
} }
#ifdef HAVE_TAGCACHE #ifdef HAVE_TAGCACHE
void init_tagcache(void) static void init_tagcache(void)
{ {
bool clear = false; bool clear = false;
@ -213,7 +217,7 @@ void init_tagcache(void)
#ifdef SIMULATOR #ifdef SIMULATOR
void init(void) static void init(void)
{ {
init_threads(); init_threads();
buffer_init(); buffer_init();
@ -273,7 +277,7 @@ void init(void)
#else #else
void init(void) static void init(void)
{ {
int rc; int rc;
bool mounted = false; bool mounted = false;

View file

@ -56,7 +56,7 @@
#include "recording.h" #include "recording.h"
#endif #endif
bool show_credits(void) static bool show_credits(void)
{ {
plugin_load("/.rockbox/rocks/credits.rock",NULL); plugin_load("/.rockbox/rocks/credits.rock",NULL);
return false; return false;
@ -72,7 +72,7 @@ extern bool simulate_usb(void);
#define SIZE_FMT "%s %s" #define SIZE_FMT "%s %s"
#endif #endif
bool show_info(void) static bool show_info(void)
{ {
char s[64], s1[32]; char s[64], s1[32];
unsigned long size, free; unsigned long size, free;
@ -340,7 +340,7 @@ bool rec_menu(void)
} }
#endif #endif
bool info_menu(void) static bool info_menu(void)
{ {
int m; int m;
bool result; bool result;
@ -374,7 +374,7 @@ static bool do_shutdown(void)
return false; return false;
} }
#endif #endif
bool main_menu(void) bool main_menu(void)
{ {
int m; int m;

View file

@ -65,14 +65,14 @@ struct menu {
static struct menu menus[MAX_MENUS]; static struct menu menus[MAX_MENUS];
static bool inuse[MAX_MENUS] = { false }; static bool inuse[MAX_MENUS] = { false };
char * menu_get_itemname(int selected_item, void * data, char *buffer) static char * menu_get_itemname(int selected_item, void * data, char *buffer)
{ {
struct menu *local_menus=(struct menu *)data; struct menu *local_menus=(struct menu *)data;
(void)buffer; (void)buffer;
return(P2STR(local_menus->items[selected_item].desc)); return(P2STR(local_menus->items[selected_item].desc));
} }
int menu_find_free(void) static int menu_find_free(void)
{ {
int i; int i;
/* Tries to find an unused slot to put the new menu */ /* Tries to find an unused slot to put the new menu */

View file

@ -194,11 +194,12 @@ static void convert_endian(void *data, const char *format)
} }
} }
#if 0 /* not needed atm */
/* Read an unsigned 16-bit integer from a big-endian file. */ /* Read an unsigned 16-bit integer from a big-endian file. */
#ifdef ROCKBOX_BIG_ENDIAN #ifdef ROCKBOX_BIG_ENDIAN
#define read_uint16be(fd, buf) read((fd), (buf), 2) #define read_uint16be(fd, buf) read((fd), (buf), 2)
#else #else
int read_uint16be(int fd, unsigned short* buf) static int read_uint16be(int fd, unsigned short* buf)
{ {
size_t n; size_t n;
@ -207,12 +208,13 @@ int read_uint16be(int fd, unsigned short* buf)
return n; return n;
} }
#endif #endif
#endif /* if 0 */
/* Read an unsigned 32-bit integer from a big-endian file. */ /* Read an unsigned 32-bit integer from a big-endian file. */
#ifdef ROCKBOX_BIG_ENDIAN #ifdef ROCKBOX_BIG_ENDIAN
#define read_uint32be(fd,buf) read((fd), (buf), 4) #define read_uint32be(fd,buf) read((fd), (buf), 4)
#else #else
int read_uint32be(int fd, unsigned int* buf) static int read_uint32be(int fd, unsigned int* buf)
{ {
size_t n; size_t n;
@ -238,35 +240,6 @@ static unsigned long get_long_be(void* buf)
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
} }
/* Read a string tag from an M4A file */
void read_m4a_tag_string(int fd, int len,char** bufptr,size_t* bytes_remaining, char** dest)
{
int data_length;
if (bytes_remaining==0) {
lseek(fd,len,SEEK_CUR); /* Skip everything */
} else {
/* Skip the data tag header - maybe we should parse it properly? */
lseek(fd,16,SEEK_CUR);
len-=16;
*dest=*bufptr;
if ((size_t)len+1 > *bytes_remaining) {
read(fd,*bufptr,*bytes_remaining-1);
lseek(fd,len-(*bytes_remaining-1),SEEK_CUR);
*bufptr+=(*bytes_remaining-1);
} else {
read(fd,*bufptr,len);
*bufptr+=len;
}
**bufptr=(char)0;
data_length = strlen(*dest)+1;
*bufptr=(*dest)+data_length;
*bytes_remaining-=data_length;
}
}
/* Parse the tag (the name-value pair) and fill id3 and buffer accordingly. /* Parse the tag (the name-value pair) and fill id3 and buffer accordingly.
* String values to keep are written to buf. Returns number of bytes written * String values to keep are written to buf. Returns number of bytes written
* to buf (including end nil). * to buf (including end nil).
@ -953,8 +926,8 @@ static bool get_wave_metadata(int fd, struct mp3entry* id3)
/* Read the tag data from an MP4 file, storing up to buffer_size bytes in /* Read the tag data from an MP4 file, storing up to buffer_size bytes in
* buffer. * buffer.
*/ */
unsigned long read_mp4_tag(int fd, unsigned int size_left, char* buffer, static unsigned long read_mp4_tag(int fd, unsigned int size_left, char* buffer,
unsigned int buffer_left) unsigned int buffer_left)
{ {
unsigned int bytes_read = 0; unsigned int bytes_read = 0;
@ -985,8 +958,8 @@ unsigned long read_mp4_tag(int fd, unsigned int size_left, char* buffer,
} }
/* Read a string tag from an MP4 file */ /* Read a string tag from an MP4 file */
unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer, static unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer,
unsigned int* buffer_left, char** dest) unsigned int* buffer_left, char** dest)
{ {
unsigned int bytes_read = read_mp4_tag(fd, size_left, *buffer, unsigned int bytes_read = read_mp4_tag(fd, size_left, *buffer,
*buffer_left - 1); *buffer_left - 1);
@ -1009,7 +982,7 @@ unsigned int read_mp4_tag_string(int fd, int size_left, char** buffer,
} }
static unsigned int read_mp4_atom(int fd, unsigned int* size, static unsigned int read_mp4_atom(int fd, unsigned int* size,
unsigned int* type, unsigned int size_left) unsigned int* type, unsigned int size_left)
{ {
read_uint32be(fd, size); read_uint32be(fd, size);
read_uint32be(fd, type); read_uint32be(fd, type);
@ -1177,7 +1150,7 @@ static bool read_mp4_esds(int fd, struct mp3entry* id3,
} }
static bool read_mp4_tags(int fd, struct mp3entry* id3, static bool read_mp4_tags(int fd, struct mp3entry* id3,
unsigned int size_left) unsigned int size_left)
{ {
unsigned int size; unsigned int size;
unsigned int type; unsigned int type;
@ -1300,7 +1273,7 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
} }
static bool read_mp4_container(int fd, struct mp3entry* id3, static bool read_mp4_container(int fd, struct mp3entry* id3,
unsigned int size_left) unsigned int size_left)
{ {
unsigned int size; unsigned int size;
unsigned int type; unsigned int type;
@ -1858,7 +1831,7 @@ unsigned int probe_file_format(const char *filename)
* file that would prevent playback. * file that would prevent playback.
*/ */
bool get_metadata(struct track_info* track, int fd, const char* trackname, bool get_metadata(struct track_info* track, int fd, const char* trackname,
bool v1first) bool v1first)
{ {
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
unsigned char* buf; unsigned char* buf;

View file

@ -703,7 +703,7 @@ void car_adapter_mode_init(void)
#endif #endif
#ifdef HAVE_HEADPHONE_DETECTION #ifdef HAVE_HEADPHONE_DETECTION
void unplug_change(bool inserted) static void unplug_change(bool inserted)
{ {
if (global_settings.unplug_mode) if (global_settings.unplug_mode)
{ {