summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-06-30 14:36:58 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-06-30 14:36:58 +0000
commitcb30e5422fec01cca2377cd8179d76a272707664 (patch)
treec13eb28cf25cd57d8da21b9fbfde0fae92170539 /firmware/mpeg.c
parent8523a441b43ada9f339bcca6442f4849f777e01f (diff)
downloadrockbox-cb30e5422fec01cca2377cd8179d76a272707664.tar.gz
rockbox-cb30e5422fec01cca2377cd8179d76a272707664.zip
Adapted for simulator compile
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1268 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c62
1 files changed, 44 insertions, 18 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index b27382750c..c84efb3a58 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -18,18 +18,20 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <stdbool.h> 19#include <stdbool.h>
20#include "config.h" 20#include "config.h"
21#include "debug.h"
22#include "panic.h"
23#include "id3.h"
24#include "mpeg.h"
25#ifndef SIMULATOR
21#include "i2c.h" 26#include "i2c.h"
22#include "mas.h" 27#include "mas.h"
23#include "dac.h" 28#include "dac.h"
24#include "system.h" 29#include "system.h"
25#include "debug.h"
26#include "kernel.h" 30#include "kernel.h"
27#include "thread.h" 31#include "thread.h"
28#include "usb.h" 32#include "usb.h"
29#include "panic.h"
30#include "file.h" 33#include "file.h"
31#include "mpeg.h" 34#endif
32#include "id3.h"
33 35
34#define MPEG_STACK_SIZE 0x2000 36#define MPEG_STACK_SIZE 0x2000
35#define MPEG_CHUNKSIZE 0x20000 37#define MPEG_CHUNKSIZE 0x20000
@@ -116,6 +118,17 @@ int mpeg_sound_default(int setting)
116 return defaultval[setting]; 118 return defaultval[setting];
117} 119}
118 120
121/* list of tracks in memory */
122#define MAX_ID3_TAGS 4
123static struct {
124 struct mp3entry id3;
125 int mempos;
126} id3tags[MAX_ID3_TAGS];
127
128#ifndef SIMULATOR
129static int last_tag = 0;
130static int last_dma_tick = 0;
131
119#ifndef ARCHOS_RECORDER 132#ifndef ARCHOS_RECORDER
120static unsigned int bass_table[] = 133static unsigned int bass_table[] =
121{ 134{
@@ -267,15 +280,6 @@ static bool filling; /* We are filling the buffer with data from disk */
267 280
268static int mpeg_file; 281static int mpeg_file;
269 282
270/* list of tracks in memory */
271#define MAX_ID3_TAGS 4
272static struct {
273 struct mp3entry id3;
274 int mempos;
275} id3tags[MAX_ID3_TAGS];
276static int last_tag = 0;
277static int last_dma_tick = 0;
278
279static void create_fliptable(void) 283static void create_fliptable(void)
280{ 284{
281 int i; 285 int i;
@@ -467,11 +471,6 @@ static int new_file(bool next_track)
467 return 0; 471 return 0;
468} 472}
469 473
470struct mp3entry* mpeg_current_track(void)
471{
472 return &(id3tags[0].id3);
473}
474
475static void stop_playing(void) 474static void stop_playing(void)
476{ 475{
477 /* Stop the current stream */ 476 /* Stop the current stream */
@@ -746,40 +745,62 @@ static void setup_sci0(void)
746 /* Enable Tx (only!) */ 745 /* Enable Tx (only!) */
747 SCR0 |= 0x20; 746 SCR0 |= 0x20;
748} 747}
748#endif /* SIMULATOR */
749 749
750struct mp3entry* mpeg_current_track(void)
751{
752 return &(id3tags[0].id3);
753}
750 754
751void mpeg_play(char* trackname) 755void mpeg_play(char* trackname)
752{ 756{
757#ifdef SIMULATOR
758 trackname = trackname;
759#else
753 queue_post(&mpeg_queue, MPEG_PLAY, trackname); 760 queue_post(&mpeg_queue, MPEG_PLAY, trackname);
761#endif
754} 762}
755 763
756void mpeg_stop(void) 764void mpeg_stop(void)
757{ 765{
766#ifndef SIMULATOR
758 queue_post(&mpeg_queue, MPEG_STOP, NULL); 767 queue_post(&mpeg_queue, MPEG_STOP, NULL);
768#endif
759} 769}
760 770
761void mpeg_pause(void) 771void mpeg_pause(void)
762{ 772{
773#ifndef SIMULATOR
763 queue_post(&mpeg_queue, MPEG_PAUSE, NULL); 774 queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
775#endif
764} 776}
765 777
766void mpeg_resume(void) 778void mpeg_resume(void)
767{ 779{
780#ifndef SIMULATOR
768 queue_post(&mpeg_queue, MPEG_RESUME, NULL); 781 queue_post(&mpeg_queue, MPEG_RESUME, NULL);
782#endif
769} 783}
770 784
771void mpeg_next(void) 785void mpeg_next(void)
772{ 786{
787#ifndef SIMULATOR
773 queue_post(&mpeg_queue, MPEG_NEXT, NULL); 788 queue_post(&mpeg_queue, MPEG_NEXT, NULL);
789#endif
774} 790}
775 791
776void mpeg_prev(void) 792void mpeg_prev(void)
777{ 793{
794#ifndef SIMULATOR
778 queue_post(&mpeg_queue, MPEG_PREV, NULL); 795 queue_post(&mpeg_queue, MPEG_PREV, NULL);
796#endif
779} 797}
780 798
781void mpeg_sound_set(int setting, int value) 799void mpeg_sound_set(int setting, int value)
782{ 800{
801#ifdef SIMULATOR
802 setting = value;
803#else
783 int tmp; 804 int tmp;
784 805
785 switch(setting) 806 switch(setting)
@@ -814,6 +835,7 @@ void mpeg_sound_set(int setting, int value)
814#endif 835#endif
815 break; 836 break;
816 } 837 }
838#endif /* SIMULATOR */
817} 839}
818 840
819int mpeg_val2phys(int setting, int value) 841int mpeg_val2phys(int setting, int value)
@@ -847,6 +869,9 @@ int mpeg_val2phys(int setting, int value)
847 869
848void mpeg_init(int volume, int bass, int treble) 870void mpeg_init(int volume, int bass, int treble)
849{ 871{
872#ifdef SIMULATOR
873 volume = bass = treble;
874#else
850#ifdef ARCHOS_RECORDER 875#ifdef ARCHOS_RECORDER
851 int rc; 876 int rc;
852 unsigned long val; 877 unsigned long val;
@@ -913,4 +938,5 @@ void mpeg_init(int volume, int bass, int treble)
913 mpeg_sound_set(SOUND_BASS, bass); 938 mpeg_sound_set(SOUND_BASS, bass);
914 mpeg_sound_set(SOUND_TREBLE, treble); 939 mpeg_sound_set(SOUND_TREBLE, treble);
915 mpeg_sound_set(SOUND_VOLUME, volume); 940 mpeg_sound_set(SOUND_VOLUME, volume);
941#endif /* SIMULATOR */
916} 942}