summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index e6d59176f7..df9e77a305 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -44,7 +44,7 @@
44 44
45#include "bitswap.h" 45#include "bitswap.h"
46 46
47#ifdef HAVE_MAS3587F 47#if CONFIG_HWCODEC == MAS3587F
48static void init_recording(void); 48static void init_recording(void);
49static void start_prerecording(void); 49static void start_prerecording(void);
50static void start_recording(void); 50static void start_recording(void);
@@ -52,7 +52,7 @@ static void stop_recording(void);
52static int get_unsaved_space(void); 52static int get_unsaved_space(void);
53static void pause_recording(void); 53static void pause_recording(void);
54static void resume_recording(void); 54static void resume_recording(void);
55#endif /* #ifdef HAVE_MAS3587F */ 55#endif /* #if CONFIG_HWCODEC == MAS3587F */
56 56
57#ifndef SIMULATOR 57#ifndef SIMULATOR
58static int get_unplayed_space(void); 58static int get_unplayed_space(void);
@@ -79,13 +79,13 @@ static int get_unswapped_space(void);
79#define MPEG_SAVE_DATA 102 79#define MPEG_SAVE_DATA 102
80#define MPEG_STOP_DONE 103 80#define MPEG_STOP_DONE 103
81 81
82#ifdef HAVE_MAS3587F 82#if CONFIG_HWCODEC == MAS3587F
83extern enum /* from mp3_playback.c */ 83extern enum /* from mp3_playback.c */
84{ 84{
85 MPEG_DECODER, 85 MPEG_DECODER,
86 MPEG_ENCODER 86 MPEG_ENCODER
87} mpeg_mode; 87} mpeg_mode;
88#endif /* #ifdef HAVE_MAS3587F */ 88#endif /* #if CONFIG_HWCODEC == MAS3587F */
89 89
90extern char* playlist_peek(int steps); 90extern char* playlist_peek(int steps);
91extern bool playlist_check(int steps); 91extern bool playlist_check(int steps);
@@ -326,7 +326,7 @@ unsigned long mpeg_get_last_header(void)
326 326
327 /* Read the frame data from the MAS and reconstruct it with the 327 /* Read the frame data from the MAS and reconstruct it with the
328 frame sync and all */ 328 frame sync and all */
329#ifdef HAVE_MAS3587F 329#if CONFIG_HWCODEC == MAS3587F
330 mas_readmem(MAS_BANK_D0, 0xfd1, tmp, 2); 330 mas_readmem(MAS_BANK_D0, 0xfd1, tmp, 2);
331#else 331#else
332 mas_readmem(MAS_BANK_D0, 0x301, tmp, 2); 332 mas_readmem(MAS_BANK_D0, 0x301, tmp, 2);
@@ -368,7 +368,7 @@ static int low_watermark; /* Dynamic low watermark level */
368static int low_watermark_margin; /* Extra time in seconds for watermark */ 368static int low_watermark_margin; /* Extra time in seconds for watermark */
369static int lowest_watermark_level; /* Debug value to observe the buffer 369static int lowest_watermark_level; /* Debug value to observe the buffer
370 usage */ 370 usage */
371#ifdef HAVE_MAS3587F 371#if CONFIG_HWCODEC == MAS3587F
372static bool is_recording; /* We are recording */ 372static bool is_recording; /* We are recording */
373static bool stop_pending; 373static bool stop_pending;
374unsigned long record_start_time; /* Value of current_tick when recording 374unsigned long record_start_time; /* Value of current_tick when recording
@@ -399,15 +399,15 @@ unsigned long shadow_7f1 = 0;
399unsigned long shadow_7f6 = 0; 399unsigned long shadow_7f6 = 0;
400unsigned long shadow_7f9 = 0; 400unsigned long shadow_7f9 = 0;
401 401
402#endif /* #ifdef HAVE_MAS3587F */ 402#endif /* #if CONFIG_HWCODEC == MAS3587F */
403 403
404static int mpeg_file; 404static int mpeg_file;
405 405
406/* Synchronization variables */ 406/* Synchronization variables */
407#ifdef HAVE_MAS3587F 407#if CONFIG_HWCODEC == MAS3587F
408static bool init_recording_done; 408static bool init_recording_done;
409static bool init_playback_done; 409static bool init_playback_done;
410#endif /* #ifdef HAVE_MAS3587F */ 410#endif /* #if CONFIG_HWCODEC == MAS3587F */
411static bool mpeg_stop_done; 411static bool mpeg_stop_done;
412 412
413static void recalculate_watermark(int bitrate) 413static void recalculate_watermark(int bitrate)
@@ -533,7 +533,7 @@ static int get_unswapped_space(void)
533 return space; 533 return space;
534} 534}
535 535
536#ifdef HAVE_MAS3587F 536#if CONFIG_HWCODEC == MAS3587F
537static int get_unsaved_space(void) 537static int get_unsaved_space(void)
538{ 538{
539 int space = mp3buf_write - mp3buf_read; 539 int space = mp3buf_write - mp3buf_read;
@@ -541,9 +541,9 @@ static int get_unsaved_space(void)
541 space += mp3buflen; 541 space += mp3buflen;
542 return space; 542 return space;
543} 543}
544#endif /* #ifdef HAVE_MAS3587F */ 544#endif /* #if CONFIG_HWCODEC == MAS3587F */
545 545
546#ifdef HAVE_MAS3587F 546#if CONFIG_HWCODEC == MAS3587F
547#ifdef DEBUG 547#ifdef DEBUG
548static long timing_info_index = 0; 548static long timing_info_index = 0;
549static long timing_info[1024]; 549static long timing_info[1024];
@@ -584,12 +584,12 @@ static void drain_dma_buffer(void)
584 ); 584 );
585} 585}
586 586
587#endif /* #ifdef HAVE_MAS3587F */ 587#endif /* #if CONFIG_HWCODEC == MAS3587F */
588 588
589void rec_tick (void) __attribute__ ((section (".icode"))); 589void rec_tick (void) __attribute__ ((section (".icode")));
590void rec_tick(void) 590void rec_tick(void)
591{ 591{
592#ifdef HAVE_MAS3587F 592#if CONFIG_HWCODEC == MAS3587F
593 int i; 593 int i;
594 int num_bytes; 594 int num_bytes;
595 if(is_recording && (PBDR & 0x4000)) 595 if(is_recording && (PBDR & 0x4000))
@@ -694,7 +694,7 @@ void rec_tick(void)
694 } 694 }
695 } 695 }
696 } 696 }
697#endif /* #ifdef HAVE_MAS3587F */ 697#endif /* #if CONFIG_HWCODEC == MAS3587F */
698} 698}
699 699
700void playback_tick(void) 700void playback_tick(void)
@@ -927,10 +927,10 @@ static void track_change(void)
927{ 927{
928 DEBUGF("Track change\n"); 928 DEBUGF("Track change\n");
929 929
930#ifdef HAVE_MAS3587F 930#if CONFIG_HWCODEC == MAS3587F
931 /* Reset the AVC */ 931 /* Reset the AVC */
932 mpeg_sound_set(SOUND_AVC, -1); 932 mpeg_sound_set(SOUND_AVC, -1);
933#endif /* #ifdef HAVE_MAS3587F */ 933#endif /* #if CONFIG_HWCODEC == MAS3587F */
934 remove_current_tag(); 934 remove_current_tag();
935 935
936 update_playlist(); 936 update_playlist();
@@ -1049,7 +1049,7 @@ static void mpeg_thread(void)
1049 int amount_to_read; 1049 int amount_to_read;
1050 int t1, t2; 1050 int t1, t2;
1051 int start_offset; 1051 int start_offset;
1052#ifdef HAVE_MAS3587F 1052#if CONFIG_HWCODEC == MAS3587F
1053 int amount_to_save; 1053 int amount_to_save;
1054 int writelen; 1054 int writelen;
1055 int framelen; 1055 int framelen;
@@ -1058,7 +1058,7 @@ static void mpeg_thread(void)
1058 int rc; 1058 int rc;
1059 int offset; 1059 int offset;
1060 int countdown; 1060 int countdown;
1061#endif /* #ifdef HAVE_MAS3587F */ 1061#endif /* #if CONFIG_HWCODEC == MAS3587F */
1062 1062
1063 is_playing = false; 1063 is_playing = false;
1064 play_pending = false; 1064 play_pending = false;
@@ -1067,10 +1067,10 @@ static void mpeg_thread(void)
1067 1067
1068 while(1) 1068 while(1)
1069 { 1069 {
1070#ifdef HAVE_MAS3587F 1070#if CONFIG_HWCODEC == MAS3587F
1071 if(mpeg_mode == MPEG_DECODER) 1071 if(mpeg_mode == MPEG_DECODER)
1072 { 1072 {
1073#endif /* #ifdef HAVE_MAS3587F */ 1073#endif /* #if CONFIG_HWCODEC == MAS3587F */
1074 yield(); 1074 yield();
1075 1075
1076 /* Swap if necessary, and don't block on the queue_wait() */ 1076 /* Swap if necessary, and don't block on the queue_wait() */
@@ -1092,11 +1092,11 @@ static void mpeg_thread(void)
1092 case MPEG_PLAY: 1092 case MPEG_PLAY:
1093 DEBUGF("MPEG_PLAY\n"); 1093 DEBUGF("MPEG_PLAY\n");
1094 1094
1095#ifdef HAVE_FMRADIO 1095#ifdef CONFIG_TUNER
1096 /* Silence the A/D input, it may be on because the radio 1096 /* Silence the A/D input, it may be on because the radio
1097 may be playing */ 1097 may be playing */
1098 mas_codec_writereg(6, 0x0000); 1098 mas_codec_writereg(6, 0x0000);
1099#endif /* #ifdef HAVE_FMRADIO */ 1099#endif /* #ifdef CONFIG_TUNER */
1100 1100
1101 /* Stop the current stream */ 1101 /* Stop the current stream */
1102 play_pending = false; 1102 play_pending = false;
@@ -1589,14 +1589,14 @@ static void mpeg_thread(void)
1589 break; 1589 break;
1590#endif /* #ifndef USB_NONE */ 1590#endif /* #ifndef USB_NONE */
1591 1591
1592#ifdef HAVE_MAS3587F 1592#if CONFIG_HWCODEC == MAS3587F
1593 case MPEG_INIT_RECORDING: 1593 case MPEG_INIT_RECORDING:
1594 init_recording(); 1594 init_recording();
1595 init_recording_done = true; 1595 init_recording_done = true;
1596 break; 1596 break;
1597#endif /* #ifdef HAVE_MAS3587F */ 1597#endif /* #if CONFIG_HWCODEC == MAS3587F */
1598 } 1598 }
1599#ifdef HAVE_MAS3587F 1599#if CONFIG_HWCODEC == MAS3587F
1600 } 1600 }
1601 else 1601 else
1602 { 1602 {
@@ -1996,7 +1996,7 @@ static void mpeg_thread(void)
1996 break; 1996 break;
1997 } 1997 }
1998 } 1998 }
1999#endif /* #ifdef HAVE_MAS3587F */ 1999#endif /* #if CONFIG_HWCODEC == MAS3587F */
2000 } 2000 }
2001} 2001}
2002#endif /* SIMULATOR */ 2002#endif /* SIMULATOR */
@@ -2044,7 +2044,7 @@ bool mpeg_has_changed_track(void)
2044 return false; 2044 return false;
2045} 2045}
2046 2046
2047#ifdef HAVE_MAS3587F 2047#if CONFIG_HWCODEC == MAS3587F
2048void mpeg_init_playback(void) 2048void mpeg_init_playback(void)
2049{ 2049{
2050 init_playback_done = false; 2050 init_playback_done = false;
@@ -2617,13 +2617,13 @@ int mpeg_status(void)
2617 if(paused) 2617 if(paused)
2618 ret |= MPEG_STATUS_PAUSE; 2618 ret |= MPEG_STATUS_PAUSE;
2619 2619
2620#ifdef HAVE_MAS3587F 2620#if CONFIG_HWCODEC == MAS3587F
2621 if(is_recording && !is_prerecording) 2621 if(is_recording && !is_prerecording)
2622 ret |= MPEG_STATUS_RECORD; 2622 ret |= MPEG_STATUS_RECORD;
2623 2623
2624 if(is_prerecording) 2624 if(is_prerecording)
2625 ret |= MPEG_STATUS_PRERECORD; 2625 ret |= MPEG_STATUS_PRERECORD;
2626#endif /* #ifdef HAVE_MAS3587F */ 2626#endif /* #if CONFIG_HWCODEC == MAS3587F */
2627 2627
2628 if(mpeg_errno) 2628 if(mpeg_errno)
2629 ret |= MPEG_STATUS_ERROR; 2629 ret |= MPEG_STATUS_ERROR;
@@ -2677,12 +2677,12 @@ void mpeg_init(void)
2677 memset(id3tags, sizeof(id3tags), 0); 2677 memset(id3tags, sizeof(id3tags), 0);
2678 memset(_id3tags, sizeof(id3tags), 0); 2678 memset(_id3tags, sizeof(id3tags), 0);
2679 2679
2680#ifdef HAVE_MAS3587F 2680#if CONFIG_HWCODEC == MAS3587F
2681 if(read_hw_mask() & PR_ACTIVE_HIGH) 2681 if(read_hw_mask() & PR_ACTIVE_HIGH)
2682 and_b(~0x08, &PADRH); 2682 and_b(~0x08, &PADRH);
2683 else 2683 else
2684 or_b(0x08, &PADRH); 2684 or_b(0x08, &PADRH);
2685#endif /* #ifdef HAVE_MAS3587F */ 2685#endif /* #if CONFIG_HWCODEC == MAS3587F */
2686 2686
2687#ifdef DEBUG 2687#ifdef DEBUG
2688 dbg_timer_start(); 2688 dbg_timer_start();