forked from len0rd/rockbox
Cleaned up remnants of early iriver development. First part of #if/#ifdef cleanup,adjusted comments.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7355 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3070bac100
commit
1d38aa19e7
1 changed files with 67 additions and 99 deletions
164
firmware/mpeg.c
164
firmware/mpeg.c
|
@ -19,6 +19,9 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#if CONFIG_HWCODEC != MASNONE
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
|
@ -33,6 +36,7 @@
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#include "bitswap.h"
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "mas.h"
|
#include "mas.h"
|
||||||
|
@ -41,9 +45,7 @@
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "hwcompat.h"
|
#include "hwcompat.h"
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
#include "bitswap.h"
|
|
||||||
|
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
static void init_recording(void);
|
static void init_recording(void);
|
||||||
|
@ -53,13 +55,13 @@ static void stop_recording(void);
|
||||||
static int get_unsaved_space(void);
|
static int get_unsaved_space(void);
|
||||||
static void pause_recording(void);
|
static void pause_recording(void);
|
||||||
static void resume_recording(void);
|
static void resume_recording(void);
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
static int get_unplayed_space(void);
|
static int get_unplayed_space(void);
|
||||||
static int get_playable_space(void);
|
static int get_playable_space(void);
|
||||||
static int get_unswapped_space(void);
|
static int get_unswapped_space(void);
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
#define MPEG_PLAY 1
|
#define MPEG_PLAY 1
|
||||||
#define MPEG_STOP 2
|
#define MPEG_STOP 2
|
||||||
|
@ -86,7 +88,7 @@ extern enum /* from mp3_playback.c */
|
||||||
MPEG_DECODER,
|
MPEG_DECODER,
|
||||||
MPEG_ENCODER
|
MPEG_ENCODER
|
||||||
} mpeg_mode;
|
} mpeg_mode;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
extern char* playlist_peek(int steps);
|
extern char* playlist_peek(int steps);
|
||||||
extern bool playlist_check(int steps);
|
extern bool playlist_check(int steps);
|
||||||
|
@ -121,7 +123,7 @@ static int num_tracks_in_memory(void)
|
||||||
{
|
{
|
||||||
return (track_write_idx - track_read_idx) & MAX_TRACK_ENTRIES_MASK;
|
return (track_write_idx - track_read_idx) & MAX_TRACK_ENTRIES_MASK;
|
||||||
}
|
}
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
static void debug_tags(void)
|
static void debug_tags(void)
|
||||||
|
@ -135,7 +137,7 @@ static void debug_tags(void)
|
||||||
}
|
}
|
||||||
DEBUGF("read: %d, write :%d\n", track_read_idx, track_write_idx);
|
DEBUGF("read: %d, write :%d\n", track_read_idx, track_write_idx);
|
||||||
DEBUGF("num_tracks_in_memory: %d\n", num_tracks_in_memory());
|
DEBUGF("num_tracks_in_memory: %d\n", num_tracks_in_memory());
|
||||||
#endif /* #ifdef DEBUG_TAGS */
|
#endif /* DEBUG_TAGS */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_current_tag(void)
|
static void remove_current_tag(void)
|
||||||
|
@ -172,7 +174,7 @@ static struct trackdata *get_trackdata(int offset)
|
||||||
else
|
else
|
||||||
return &trackdata[(track_read_idx + offset) & MAX_TRACK_ENTRIES_MASK];
|
return &trackdata[(track_read_idx + offset) & MAX_TRACK_ENTRIES_MASK];
|
||||||
}
|
}
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
static void set_elapsed(struct mp3entry* id3)
|
static void set_elapsed(struct mp3entry* id3)
|
||||||
{
|
{
|
||||||
|
@ -293,16 +295,14 @@ unsigned long mpeg_get_last_header(void)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
return 0;
|
return 0;
|
||||||
#elif CONFIG_HWCODEC != MASNONE
|
#else /* !SIMULATOR */
|
||||||
unsigned long tmp[2];
|
unsigned long tmp[2];
|
||||||
|
|
||||||
/* Read the frame data from the MAS and reconstruct it with the
|
/* Read the frame data from the MAS and reconstruct it with the
|
||||||
frame sync and all */
|
frame sync and all */
|
||||||
mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_STATUS_1, tmp, 2);
|
mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_STATUS_1, tmp, 2);
|
||||||
return 0xffe00000 | ((tmp[0] & 0x7c00) << 6) | (tmp[1] & 0xffff);
|
return 0xffe00000 | ((tmp[0] & 0x7c00) << 6) | (tmp[1] & 0xffff);
|
||||||
#else
|
#endif /* !SIMULATOR */
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool paused; /* playback is paused */
|
static bool paused; /* playback is paused */
|
||||||
|
@ -312,7 +312,7 @@ static unsigned int mpeg_errno;
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
static bool is_playing = false;
|
static bool is_playing = false;
|
||||||
static bool playing = false;
|
static bool playing = false;
|
||||||
#else
|
#else /* !SIMULATOR */
|
||||||
static int last_dma_tick = 0;
|
static int last_dma_tick = 0;
|
||||||
|
|
||||||
extern unsigned long mas_version_code;
|
extern unsigned long mas_version_code;
|
||||||
|
@ -370,13 +370,13 @@ static int prerecord_timeout; /* The tick count of the next prerecord data store
|
||||||
|
|
||||||
/* Shadow MAS registers */
|
/* Shadow MAS registers */
|
||||||
unsigned long shadow_encoder_control = 0;
|
unsigned long shadow_encoder_control = 0;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
||||||
unsigned long shadow_io_control_main = 0;
|
unsigned long shadow_io_control_main = 0;
|
||||||
unsigned long shadow_soft_mute = 0;
|
unsigned long shadow_soft_mute = 0;
|
||||||
unsigned shadow_codec_reg0;
|
unsigned shadow_codec_reg0;
|
||||||
#endif
|
#endif /* (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) */
|
||||||
|
|
||||||
static int mpeg_file;
|
static int mpeg_file;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ static int mpeg_file;
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
static bool init_recording_done;
|
static bool init_recording_done;
|
||||||
static bool init_playback_done;
|
static bool init_playback_done;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
static bool mpeg_stop_done;
|
static bool mpeg_stop_done;
|
||||||
|
|
||||||
static void recalculate_watermark(int bitrate)
|
static void recalculate_watermark(int bitrate)
|
||||||
|
@ -465,7 +465,7 @@ static int dbg_cnt2us(unsigned int cnt)
|
||||||
{
|
{
|
||||||
return (cnt * 10000) / (FREQ/800);
|
return (cnt * 10000) / (FREQ/800);
|
||||||
}
|
}
|
||||||
#endif /* #ifdef DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
static int get_unplayed_space(void)
|
static int get_unplayed_space(void)
|
||||||
{
|
{
|
||||||
|
@ -518,13 +518,13 @@ static int get_unsaved_space(void)
|
||||||
space += audiobuflen;
|
space += audiobuflen;
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static long timing_info_index = 0;
|
static long timing_info_index = 0;
|
||||||
static long timing_info[1024];
|
static long timing_info[1024];
|
||||||
#endif /* #ifdef DEBUG */
|
#endif /* DEBUG */
|
||||||
static unsigned long num_rec_bytes;
|
static unsigned long num_rec_bytes;
|
||||||
static unsigned long num_recorded_frames;
|
static unsigned long num_recorded_frames;
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ void rec_tick(void)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
timing_info[timing_info_index++] = current_tick;
|
timing_info[timing_info_index++] = current_tick;
|
||||||
TCNT2 = 0;
|
TCNT2 = 0;
|
||||||
#endif /* #ifdef DEBUG */
|
#endif /* DEBUG */
|
||||||
/* Note: Although this loop is run in interrupt context, further
|
/* Note: Although this loop is run in interrupt context, further
|
||||||
* optimisation will do no good. The MAS would then deliver bad
|
* optimisation will do no good. The MAS would then deliver bad
|
||||||
* frames occasionally, as observed in extended experiments. */
|
* frames occasionally, as observed in extended experiments. */
|
||||||
|
@ -589,7 +589,7 @@ void rec_tick(void)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
timing_info[timing_info_index++] = TCNT2 + (i << 16);
|
timing_info[timing_info_index++] = TCNT2 + (i << 16);
|
||||||
timing_info_index &= 0x3ff;
|
timing_info_index &= 0x3ff;
|
||||||
#endif /* #ifdef DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
num_rec_bytes += i;
|
num_rec_bytes += i;
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ void rec_tick(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
void playback_tick(void)
|
void playback_tick(void)
|
||||||
{
|
{
|
||||||
|
@ -878,7 +878,7 @@ static void track_change(void)
|
||||||
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
||||||
/* Reset the AVC */
|
/* Reset the AVC */
|
||||||
sound_set(SOUND_AVC, -1);
|
sound_set(SOUND_AVC, -1);
|
||||||
#endif /* #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) */
|
#endif /* (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) */
|
||||||
|
|
||||||
if (num_tracks_in_memory() > 0)
|
if (num_tracks_in_memory() > 0)
|
||||||
{
|
{
|
||||||
|
@ -904,7 +904,7 @@ void hexdump(const unsigned char *buf, int len)
|
||||||
}
|
}
|
||||||
DEBUGF("\n");
|
DEBUGF("\n");
|
||||||
}
|
}
|
||||||
#endif /* #ifdef DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
static void start_playback_if_ready(void)
|
static void start_playback_if_ready(void)
|
||||||
{
|
{
|
||||||
|
@ -943,7 +943,6 @@ static void start_playback_if_ready(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_HWCODEC != MASNONE
|
|
||||||
static bool swap_one_chunk(void)
|
static bool swap_one_chunk(void)
|
||||||
{
|
{
|
||||||
int free_space_left;
|
int free_space_left;
|
||||||
|
@ -984,7 +983,6 @@ static bool swap_one_chunk(void)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
const unsigned char empty_id3_header[] =
|
const unsigned char empty_id3_header[] =
|
||||||
|
@ -992,11 +990,10 @@ const unsigned char empty_id3_header[] =
|
||||||
'I', 'D', '3', 0x03, 0x00, 0x00,
|
'I', 'D', '3', 0x03, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */
|
0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* HAVE_RECORDING */
|
||||||
|
|
||||||
static void mpeg_thread(void)
|
static void mpeg_thread(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_HWCODEC != MASNONE
|
|
||||||
static int pause_tick = 0;
|
static int pause_tick = 0;
|
||||||
static unsigned int pause_track = 0;
|
static unsigned int pause_track = 0;
|
||||||
struct event ev;
|
struct event ev;
|
||||||
|
@ -1013,7 +1010,7 @@ static void mpeg_thread(void)
|
||||||
int save_endpos = 0;
|
int save_endpos = 0;
|
||||||
int rc;
|
int rc;
|
||||||
long offset;
|
long offset;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
is_playing = false;
|
is_playing = false;
|
||||||
play_pending = false;
|
play_pending = false;
|
||||||
|
@ -1025,7 +1022,7 @@ static void mpeg_thread(void)
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
if(mpeg_mode == MPEG_DECODER)
|
if(mpeg_mode == MPEG_DECODER)
|
||||||
{
|
{
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
yield();
|
yield();
|
||||||
|
|
||||||
/* Swap if necessary, and don't block on the queue_wait() */
|
/* Swap if necessary, and don't block on the queue_wait() */
|
||||||
|
@ -1056,7 +1053,7 @@ static void mpeg_thread(void)
|
||||||
/* Silence the A/D input, it may be on because the radio
|
/* Silence the A/D input, it may be on because the radio
|
||||||
may be playing */
|
may be playing */
|
||||||
mas_codec_writereg(6, 0x0000);
|
mas_codec_writereg(6, 0x0000);
|
||||||
#endif /* #ifdef CONFIG_TUNER */
|
#endif /* CONFIG_TUNER */
|
||||||
|
|
||||||
/* Stop the current stream */
|
/* Stop the current stream */
|
||||||
play_pending = false;
|
play_pending = false;
|
||||||
|
@ -1447,10 +1444,10 @@ static void mpeg_thread(void)
|
||||||
amount_to_read);
|
amount_to_read);
|
||||||
#if MEM == 8
|
#if MEM == 8
|
||||||
amount_to_read = MIN(0x100000, amount_to_read);
|
amount_to_read = MIN(0x100000, amount_to_read);
|
||||||
#endif /* #if MEM == 8 */
|
#endif /* MEM == 8 */
|
||||||
#ifdef HAVE_MMC /* MMC is slow, so don't read too large chunks */
|
#ifdef HAVE_MMC /* MMC is slow, so don't read too large chunks */
|
||||||
amount_to_read = MIN(0x40000, amount_to_read);
|
amount_to_read = MIN(0x40000, amount_to_read);
|
||||||
#endif
|
#endif /* HAVE_MMC */
|
||||||
|
|
||||||
/* Read as much mpeg data as we can fit in the buffer */
|
/* Read as much mpeg data as we can fit in the buffer */
|
||||||
if(mpeg_file >= 0)
|
if(mpeg_file >= 0)
|
||||||
|
@ -1554,7 +1551,7 @@ static void mpeg_thread(void)
|
||||||
is_playing = false;
|
is_playing = false;
|
||||||
paused = false;
|
paused = false;
|
||||||
stop_playing();
|
stop_playing();
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR //CHECKME
|
||||||
|
|
||||||
/* Tell the USB thread that we are safe */
|
/* Tell the USB thread that we are safe */
|
||||||
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
||||||
|
@ -1562,16 +1559,16 @@ static void mpeg_thread(void)
|
||||||
|
|
||||||
/* Wait until the USB cable is extracted again */
|
/* Wait until the USB cable is extracted again */
|
||||||
usb_wait_for_disconnect(&mpeg_queue);
|
usb_wait_for_disconnect(&mpeg_queue);
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
break;
|
break;
|
||||||
#endif /* #ifndef USB_NONE */
|
#endif /* !USB_NONE */
|
||||||
|
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
case MPEG_INIT_RECORDING:
|
case MPEG_INIT_RECORDING:
|
||||||
init_recording();
|
init_recording();
|
||||||
init_recording_done = true;
|
init_recording_done = true;
|
||||||
break;
|
break;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
case SYS_TIMEOUT:
|
case SYS_TIMEOUT:
|
||||||
if (playing)
|
if (playing)
|
||||||
|
@ -1738,7 +1735,7 @@ static void mpeg_thread(void)
|
||||||
timing_info[i*2+1] >> 16);
|
timing_info[i*2+1] >> 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #ifdef DEBUG1 */
|
#endif /* DEBUG1 */
|
||||||
|
|
||||||
if (prerecording)
|
if (prerecording)
|
||||||
{
|
{
|
||||||
|
@ -1911,67 +1908,42 @@ static void mpeg_thread(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
}
|
}
|
||||||
#else /* HWCODEC != NONE */
|
|
||||||
struct event ev;
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
queue_wait(&mpeg_queue, &ev);
|
|
||||||
|
|
||||||
switch(ev.id)
|
|
||||||
{
|
|
||||||
case MPEG_STOP:
|
|
||||||
mpeg_stop_done = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SYS_USB_CONNECTED:
|
|
||||||
/* Tell the USB thread that we are safe */
|
|
||||||
DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n");
|
|
||||||
usb_acknowledge(SYS_USB_CONNECTED_ACK);
|
|
||||||
|
|
||||||
/* Wait until the USB cable is extracted again */
|
|
||||||
usb_wait_for_disconnect(&mpeg_queue);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
static struct mp3entry taginfo;
|
static struct mp3entry taginfo;
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
void mpeg_id3_options(bool _v1first)
|
void mpeg_id3_options(bool _v1first)
|
||||||
{
|
{
|
||||||
v1first = _v1first;
|
v1first = _v1first;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef IRIVER_H100
|
|
||||||
struct mp3entry* audio_current_track()
|
struct mp3entry* audio_current_track()
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
return &taginfo;
|
return &taginfo;
|
||||||
#else
|
#else /* !SIMULATOR */
|
||||||
if(num_tracks_in_memory())
|
if(num_tracks_in_memory())
|
||||||
return &get_trackdata(0)->id3;
|
return &get_trackdata(0)->id3;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mp3entry* audio_next_track()
|
struct mp3entry* audio_next_track()
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
return &taginfo;
|
return &taginfo;
|
||||||
#else
|
#else /* !SIMULATOR */
|
||||||
if(num_tracks_in_memory() > 1)
|
if(num_tracks_in_memory() > 1)
|
||||||
return &get_trackdata(1)->id3;
|
return &get_trackdata(1)->id3;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
bool audio_has_changed_track(void)
|
bool audio_has_changed_track(void)
|
||||||
|
@ -1983,7 +1955,6 @@ bool audio_has_changed_track(void)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CONFIG_HWCODEC == MAS3587F
|
#if CONFIG_HWCODEC == MAS3587F
|
||||||
void audio_init_playback(void)
|
void audio_init_playback(void)
|
||||||
|
@ -2087,7 +2058,6 @@ static void init_recording(void)
|
||||||
mas_readmem(MAS_BANK_D0, MAS_D0_APP_RUNNING, &val, 1);
|
mas_readmem(MAS_BANK_D0, MAS_D0_APP_RUNNING, &val, 1);
|
||||||
} while(!(val & 0x40));
|
} while(!(val & 0x40));
|
||||||
|
|
||||||
#if 1
|
|
||||||
/* We have started the recording application with monitoring OFF.
|
/* We have started the recording application with monitoring OFF.
|
||||||
This is because we want to record at least one frame to fill the DMA
|
This is because we want to record at least one frame to fill the DMA
|
||||||
buffer, because the silly MAS will not negate EOD until at least one
|
buffer, because the silly MAS will not negate EOD until at least one
|
||||||
|
@ -2106,7 +2076,6 @@ static void init_recording(void)
|
||||||
} while(val & 1);
|
} while(val & 1);
|
||||||
|
|
||||||
drain_dma_buffer();
|
drain_dma_buffer();
|
||||||
#endif
|
|
||||||
mpeg_mode = MPEG_ENCODER;
|
mpeg_mode = MPEG_ENCODER;
|
||||||
|
|
||||||
DEBUGF("MAS Recording application started\n");
|
DEBUGF("MAS Recording application started\n");
|
||||||
|
@ -2356,7 +2325,7 @@ int mpeg_get_mas_pllfreq(void)
|
||||||
else
|
else
|
||||||
return 24576000;
|
return 24576000;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CONFIG_TUNER & S1A0903X01 */
|
||||||
|
|
||||||
/* try to make some kind of beep, also in recording mode */
|
/* try to make some kind of beep, also in recording mode */
|
||||||
void audio_beep(int duration)
|
void audio_beep(int duration)
|
||||||
|
@ -2432,7 +2401,7 @@ unsigned long mpeg_num_recorded_bytes(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (CONFIG_HWCODEC == MASNONE) || defined(SIMULATOR)
|
#elif defined(SIMULATOR)
|
||||||
|
|
||||||
/* dummies coming up
|
/* dummies coming up
|
||||||
|
|
||||||
|
@ -2508,9 +2477,8 @@ void mpeg_set_recording_options(int frequency, int quality,
|
||||||
(void)editable;
|
(void)editable;
|
||||||
(void)prerecord_time;
|
(void)prerecord_time;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CONFIG_HWCODEC == MAS3587F; SIMULATOR */
|
||||||
|
|
||||||
#ifndef IRIVER_H100
|
|
||||||
void audio_play(int offset)
|
void audio_play(int offset)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
@ -2539,11 +2507,11 @@ void audio_play(int offset)
|
||||||
playing = true;
|
playing = true;
|
||||||
break;
|
break;
|
||||||
} while(1);
|
} while(1);
|
||||||
#else
|
#else /* !SIMULATOR */
|
||||||
is_playing = true;
|
is_playing = true;
|
||||||
|
|
||||||
queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset);
|
queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset);
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
}
|
}
|
||||||
|
@ -2555,11 +2523,11 @@ void audio_stop(void)
|
||||||
queue_post(&mpeg_queue, MPEG_STOP, NULL);
|
queue_post(&mpeg_queue, MPEG_STOP, NULL);
|
||||||
while(!mpeg_stop_done)
|
while(!mpeg_stop_done)
|
||||||
yield();
|
yield();
|
||||||
#else
|
#else /* SIMULATOR */
|
||||||
paused = false;
|
paused = false;
|
||||||
is_playing = false;
|
is_playing = false;
|
||||||
playing = false;
|
playing = false;
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2567,29 +2535,29 @@ void audio_pause(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
|
queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
|
||||||
#else
|
#else /* SIMULATOR */
|
||||||
is_playing = true;
|
is_playing = true;
|
||||||
playing = false;
|
playing = false;
|
||||||
paused = true;
|
paused = true;
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_resume(void)
|
void audio_resume(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_RESUME, NULL);
|
queue_post(&mpeg_queue, MPEG_RESUME, NULL);
|
||||||
#else
|
#else /* SIMULATOR */
|
||||||
is_playing = true;
|
is_playing = true;
|
||||||
playing = true;
|
playing = true;
|
||||||
paused = false;
|
paused = false;
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_next(void)
|
void audio_next(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
|
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
|
||||||
#else
|
#else /* SIMULATOR */
|
||||||
char* file;
|
char* file;
|
||||||
int steps = 1;
|
int steps = 1;
|
||||||
int index;
|
int index;
|
||||||
|
@ -2610,14 +2578,14 @@ void audio_next(void)
|
||||||
playing = true;
|
playing = true;
|
||||||
break;
|
break;
|
||||||
} while(1);
|
} while(1);
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_prev(void)
|
void audio_prev(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_PREV, NULL);
|
queue_post(&mpeg_queue, MPEG_PREV, NULL);
|
||||||
#else
|
#else /* SIMULATOR */
|
||||||
char* file;
|
char* file;
|
||||||
int steps = -1;
|
int steps = -1;
|
||||||
int index;
|
int index;
|
||||||
|
@ -2637,23 +2605,23 @@ void audio_prev(void)
|
||||||
playing = true;
|
playing = true;
|
||||||
break;
|
break;
|
||||||
} while(1);
|
} while(1);
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_ff_rewind(int newtime)
|
void audio_ff_rewind(int newtime)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime);
|
queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime);
|
||||||
#else
|
#else /* SIMULATOR */
|
||||||
(void)newtime;
|
(void)newtime;
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_flush_and_reload_tracks(void)
|
void audio_flush_and_reload_tracks(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL);
|
queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL);
|
||||||
#endif /* #ifndef SIMULATOR*/
|
#endif /* !SIMULATOR*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int audio_status(void)
|
int audio_status(void)
|
||||||
|
@ -2672,7 +2640,7 @@ int audio_status(void)
|
||||||
|
|
||||||
if(is_prerecording)
|
if(is_prerecording)
|
||||||
ret |= AUDIO_STATUS_PRERECORD;
|
ret |= AUDIO_STATUS_PRERECORD;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
if(mpeg_errno)
|
if(mpeg_errno)
|
||||||
ret |= AUDIO_STATUS_ERROR;
|
ret |= AUDIO_STATUS_ERROR;
|
||||||
|
@ -2710,7 +2678,7 @@ static void mpeg_thread(void)
|
||||||
sleep(HZ);
|
sleep(HZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
void audio_init(void)
|
void audio_init(void)
|
||||||
{
|
{
|
||||||
|
@ -2719,7 +2687,7 @@ void audio_init(void)
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
audiobuflen = audiobufend - audiobuf;
|
audiobuflen = audiobufend - audiobuf;
|
||||||
queue_init(&mpeg_queue);
|
queue_init(&mpeg_queue);
|
||||||
#endif /* #ifndef SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
create_thread(mpeg_thread, mpeg_stack,
|
create_thread(mpeg_thread, mpeg_stack,
|
||||||
sizeof(mpeg_stack), mpeg_thread_name);
|
sizeof(mpeg_stack), mpeg_thread_name);
|
||||||
|
|
||||||
|
@ -2730,7 +2698,7 @@ void audio_init(void)
|
||||||
and_b(~0x08, &PADRH);
|
and_b(~0x08, &PADRH);
|
||||||
else
|
else
|
||||||
or_b(0x08, &PADRH);
|
or_b(0x08, &PADRH);
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
dbg_timer_start();
|
dbg_timer_start();
|
||||||
|
@ -2738,4 +2706,4 @@ void audio_init(void)
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* IRIVER_H100 */
|
#endif /* CONFIG_HWCODEC != MASNONE */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue