1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Code that has been in mpeg.c before, now creating an encapsulated play
11 * data module, to be used by other sources than file playback as well.
13 * Copyright (C) 2004 by Linus Nielsen Feltzing
15 * All files in this archive are subject to the GNU General Public License.
16 * See the file COPYING in the source tree root for full license agreement.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
27 #include "mpeg.h" /* ToDo: remove crosslinks */
28 #include "mp3_playback.h"
37 /* hacking into mpeg.c, recording is still there */
38 #if CONFIG_HWCODEC == MAS3587F
44 #endif /* #ifdef MAS3587F */
46 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
47 extern unsigned long shadow_io_control_main
;
52 /* own version, independent of mpeg.c */
53 static bool paused
; /* playback is paused */
54 static bool playing
; /* We are playing an MP3 stream */
57 /* for measuring the play time */
58 static long playstart_tick
;
59 static long cumulative_ticks
;
61 /* the registered callback function to ask for more mp3 data */
62 static void (*callback_for_more
)(unsigned char**, int*);
63 #endif /* #ifndef SIMULATOR */
65 static const char* const units
[] =
75 "dB", /* Right gain */
77 "dB", /* MDB Strength */
78 "%", /* MDB Harmonics */
79 "Hz", /* MDB Center */
85 static const int numdecimals
[] =
98 0, /* MDB Harmonics */
105 static const int steps
[] =
117 1, /* MDB Strength */
118 1, /* MDB Harmonics */
125 static const int minval
[] =
128 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
142 0, /* MDB Strength */
143 0, /* MDB Harmonics */
150 static const int maxval
[] =
153 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
167 127, /* MDB Strength */
168 100, /* MDB Harmonics */
169 300, /* MDB Center */
175 static const int defaultval
[] =
178 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
192 50, /* MDB Strength */
193 48, /* MDB Harmonics */
200 const char *mpeg_sound_unit(int setting
)
202 return units
[setting
];
205 int mpeg_sound_numdecimals(int setting
)
207 return numdecimals
[setting
];
210 int mpeg_sound_steps(int setting
)
212 return steps
[setting
];
215 int mpeg_sound_min(int setting
)
217 return minval
[setting
];
220 int mpeg_sound_max(int setting
)
222 return maxval
[setting
];
225 int mpeg_sound_default(int setting
)
227 return defaultval
[setting
];
230 /* list of tracks in memory */
231 #define MAX_ID3_TAGS (1<<4) /* Must be power of 2 */
232 #define MAX_ID3_TAGS_MASK (MAX_ID3_TAGS - 1)
235 static bool mpeg_is_initialized
= false;
240 unsigned long mas_version_code
;
242 #if CONFIG_HWCODEC == MAS3507D
244 static const unsigned int bass_table
[] =
279 static const unsigned int treble_table
[] =
314 static const unsigned int prescale_table
[] =
335 bool dma_on
; /* The DMA is active */
337 #if CONFIG_HWCODEC == MAS3507D
338 static void mas_poll_start(int interval_in_ms
)
342 count
= (FREQ
* interval_in_ms
) / 1000 / 8;
346 panicf("Error! The MAS poll interval is too long (%d ms)\n",
351 /* We are using timer 1 */
353 TSTR
&= ~0x02; /* Stop the timer */
354 TSNC
&= ~0x02; /* No synchronization */
355 TMDR
&= ~0x02; /* Operate normally */
357 TCNT1
= 0; /* Start counting at 0 */
359 TCR1
= 0x23; /* Clear at GRA match, sysclock/8 */
361 /* Enable interrupt on level 5 */
362 IPRC
= (IPRC
& ~0x000f) | 0x0005;
365 TIER1
= 0xf9; /* Enable GRA match interrupt */
367 TSTR
|= 0x02; /* Start timer 1 */
370 static void postpone_dma_tick(void)
374 count
= FREQ
/ 2000 / 8;
376 /* We are using timer 1 */
378 TSTR
&= ~0x02; /* Stop the timer */
379 TSNC
&= ~0x02; /* No synchronization */
380 TMDR
&= ~0x02; /* Operate normally */
382 TCNT1
= 0; /* Start counting at 0 */
384 TCR1
= 0x23; /* Clear at GRA match, sysclock/8 */
386 /* Enable interrupt on level 5 */
387 IPRC
= (IPRC
& ~0x000f) | 0x0005;
390 TIER1
= 0xf9; /* Enable GRA match interrupt */
392 TSTR
|= 0x02; /* Start timer 1 */
397 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
398 void demand_irq_enable(bool on
)
400 int oldlevel
= set_irq_level(HIGHEST_IRQ_LEVEL
);
404 IPRA
= (IPRA
& 0xfff0) | 0x000b;
405 ICR
&= ~0x0010; /* IRQ3 level sensitive */
410 set_irq_level(oldlevel
);
412 #endif /* #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) */
417 if(playing
&& !paused
)
419 /* Start DMA if it is disabled and the DEMAND pin is high */
420 if(!(SCR0
& 0x80) && (PBDR
& 0x4000))
425 playback_tick(); /* dirty call to mpeg.c */
432 unsigned char* start
;
435 if (callback_for_more
!= NULL
)
437 callback_for_more(&start
, &size
);
442 DTCR3
= size
& 0xffff;
443 SAR3
= (unsigned int) start
;
447 CHCR3
&= ~0x0001; /* Disable the DMA interrupt */
450 CHCR3
&= ~0x0002; /* Clear DMA interrupt */
454 void IMIA1(void) /* Timer 1 interrupt */
459 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
460 /* Disable interrupt */
466 void IRQ6(void) /* PB14: MAS stop demand IRQ */
471 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
473 void IRQ3(void) /* PA15: MAS demand IRQ */
475 /* Begin with setting the IRQ to edge sensitive */
478 #if CONFIG_HWCODEC == MAS3587F
479 if(mpeg_mode
== MPEG_ENCODER
)
485 #endif /* #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) */
487 static void setup_sci0(void)
489 /* PB15 is I/O, PB14 is IRQ6, PB12 is SCK0, PB9 is TxD0 */
490 PBCR1
= (PBCR1
& 0x0cff) | 0x1208;
492 /* Set PB12 to output */
495 /* Disable serial port */
498 /* Synchronous, no prescale */
501 /* Set baudrate 1Mbit/s */
504 /* use SCK as serial clock output */
507 /* Clear FER and PER */
510 /* Set interrupt ITU2 and SCI0 priority to 0 */
513 /* set PB15 and PB14 to inputs */
514 and_b(~0x80, &PBIORH
);
515 and_b(~0x40, &PBIORH
);
517 /* Enable End of DMA interrupt at prio 8 */
518 IPRC
= (IPRC
& 0xf0ff) | 0x0800;
520 /* Enable Tx (only!) */
523 #endif /* SIMULATOR */
525 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
526 static void init_playback(void)
531 mp3_play_pause(false);
535 /* Enable the audio CODEC and the DSP core, max analog voltage range */
536 rc
= mas_direct_config_write(MAS_CONTROL
, 0x8c00);
538 panicf("mas_ctrl_w: %d", rc
);
540 /* Stop the current application */
542 mas_writemem(MAS_BANK_D0
, MAS_D0_APP_SELECT
, &val
, 1);
545 mas_readmem(MAS_BANK_D0
, MAS_D0_APP_RUNNING
, &val
, 1);
548 /* Enable the D/A Converter */
549 mas_codec_writereg(0x0, 0x0001);
551 /* ADC scale 0%, DSP scale 100% */
552 mas_codec_writereg(6, 0x0000);
553 mas_codec_writereg(7, 0x4000);
555 #ifdef HAVE_SPDIF_OUT
556 val
= 0x09; /* Disable SDO and SDI, low impedance S/PDIF outputs */
558 val
= 0x2d; /* Disable SDO and SDI, disable S/PDIF output */
560 mas_writemem(MAS_BANK_D0
, MAS_D0_INTERFACE_CONTROL
, &val
, 1);
562 /* Set Demand mode and validate all settings */
563 shadow_io_control_main
= 0x25;
564 mas_writemem(MAS_BANK_D0
, MAS_D0_IO_CONTROL_MAIN
, &shadow_io_control_main
, 1);
566 /* Start the Layer2/3 decoder applications */
568 mas_writemem(MAS_BANK_D0
, MAS_D0_APP_SELECT
, &val
, 1);
571 mas_readmem(MAS_BANK_D0
, MAS_D0_APP_RUNNING
, &val
, 1);
572 } while((val
& 0x0c) != 0x0c);
574 mpeg_sound_channel_config(MPEG_SOUND_STEREO
);
576 #if CONFIG_HWCODEC == MAS3587F
577 mpeg_mode
= MPEG_DECODER
;
580 /* set IRQ6 to edge detect */
583 /* set IRQ6 prio 8 */
584 IPRB
= ( IPRB
& 0xff0f ) | 0x0080;
586 DEBUGF("MAS Decoding application started\n");
588 #endif /* #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) */
591 #if CONFIG_HWCODEC == MAS3507D
592 int current_left_volume
= 0; /* all values in tenth of dB */
593 int current_right_volume
= 0; /* all values in tenth of dB */
594 int current_treble
= 0;
595 int current_bass
= 0;
596 int current_balance
= 0;
598 /* convert tenth of dB volume to register value */
599 static int tenthdb2reg(int db
) {
601 return (db
+ 780) / 30;
603 return (db
+ 660) / 15;
606 void set_prescaled_volume(void)
611 prescale
= MAX(current_bass
, current_treble
);
613 prescale
= 0; /* no need to prescale if we don't boost
616 mas_writereg(MAS_REG_KPRESCALE
, prescale_table
[prescale
/10]);
618 /* gain up the analog volume to compensate the prescale reduction gain */
619 l
= current_left_volume
+ prescale
;
620 r
= current_right_volume
+ prescale
;
622 dac_volume(tenthdb2reg(l
), tenthdb2reg(r
), false);
624 #endif /* MAS3507D */
625 #endif /* !SIMULATOR */
627 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
628 unsigned long mdb_shape_shadow
= 0;
629 unsigned long loudness_shadow
= 0;
632 void mpeg_sound_set(int setting
, int value
)
637 #if CONFIG_HWCODEC == MAS3507D
643 if(!mpeg_is_initialized
)
649 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
650 tmp
= 0x7f00 * value
/ 100;
651 mas_codec_writereg(0x10, tmp
& 0xff00);
656 if(current_balance
> 0)
658 l
-= current_balance
;
663 if(current_balance
< 0)
665 r
+= current_balance
;
673 /* store volume in tenth of dB */
674 current_left_volume
= ( l
< 0x08 ? l
*30 - 780 : l
*15 - 660 );
675 current_right_volume
= ( r
< 0x08 ? r
*30 - 780 : r
*15 - 660 );
677 set_prescaled_volume();
682 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
683 tmp
= ((value
* 127 / 100) & 0xff) << 8;
684 mas_codec_writereg(0x11, tmp
& 0xff00);
686 current_balance
= value
;
691 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
692 tmp
= ((value
* 8) & 0xff) << 8;
693 mas_codec_writereg(0x14, tmp
& 0xff00);
695 mas_writereg(MAS_REG_KBASS
, bass_table
[value
+15]);
696 current_bass
= (value
) * 10;
697 set_prescaled_volume();
702 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
703 tmp
= ((value
* 8) & 0xff) << 8;
704 mas_codec_writereg(0x15, tmp
& 0xff00);
706 mas_writereg(MAS_REG_KTREBLE
, treble_table
[value
+15]);
707 current_treble
= (value
) * 10;
708 set_prescaled_volume();
712 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
714 loudness_shadow
= (loudness_shadow
& 0x04) |
715 (MAX(MIN(value
* 4, 0x44), 0) << 8);
716 mas_codec_writereg(MAS_REG_KLOUDNESS
, loudness_shadow
);
722 tmp
= (0x1 << 8) | (0x8 << 12);
725 tmp
= (0x2 << 8) | (0x8 << 12);
728 tmp
= (0x4 << 8) | (0x8 << 12);
731 tmp
= (0x8 << 8) | (0x8 << 12);
733 case -1: /* turn off and then turn on again to decay quickly */
734 tmp
= mas_codec_readreg(MAS_REG_KAVC
);
735 mas_codec_writereg(MAS_REG_KAVC
, 0);
741 mas_codec_writereg(MAS_REG_KAVC
, tmp
);
744 case SOUND_MDB_STRENGTH
:
745 mas_codec_writereg(MAS_REG_KMDB_STR
, (value
& 0x7f) << 8);
748 case SOUND_MDB_HARMONICS
:
749 tmp
= value
* 127 / 100;
750 mas_codec_writereg(MAS_REG_KMDB_HAR
, (tmp
& 0x7f) << 8);
753 case SOUND_MDB_CENTER
:
754 mas_codec_writereg(MAS_REG_KMDB_FC
, (value
/10) << 8);
757 case SOUND_MDB_SHAPE
:
758 mdb_shape_shadow
= (mdb_shape_shadow
& 0x02) | ((value
/10) << 8);
759 mas_codec_writereg(MAS_REG_KMDB_SWITCH
, mdb_shape_shadow
);
762 case SOUND_MDB_ENABLE
:
763 mdb_shape_shadow
= (mdb_shape_shadow
& ~0x02) | (value
?2:0);
764 mas_codec_writereg(MAS_REG_KMDB_SWITCH
, mdb_shape_shadow
);
767 case SOUND_SUPERBASS
:
768 loudness_shadow
= (loudness_shadow
& ~0x04) |
770 mas_codec_writereg(MAS_REG_KLOUDNESS
, loudness_shadow
);
774 mpeg_sound_channel_config(value
);
777 #endif /* SIMULATOR */
780 int mpeg_val2phys(int setting
, int value
)
782 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
787 case SOUND_LEFT_GAIN
:
788 case SOUND_RIGHT_GAIN
:
789 result
= (value
- 2) * 15;
793 result
= value
* 15 + 210;
807 void mpeg_sound_channel_config(int configuration
)
812 unsigned long val_ll
= 0x80000;
813 unsigned long val_lr
= 0;
814 unsigned long val_rl
= 0;
815 unsigned long val_rr
= 0x80000;
817 switch(configuration
)
819 case MPEG_SOUND_STEREO
:
826 case MPEG_SOUND_MONO
:
833 case MPEG_SOUND_MONO_LEFT
:
840 case MPEG_SOUND_MONO_RIGHT
:
847 case MPEG_SOUND_STEREO_NARROW
:
854 case MPEG_SOUND_STEREO_WIDE
:
861 case MPEG_SOUND_KARAOKE
:
869 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
870 mas_writemem(MAS_BANK_D0
, MAS_D0_OUT_LL
, &val_ll
, 1); /* LL */
871 mas_writemem(MAS_BANK_D0
, MAS_D0_OUT_LR
, &val_lr
, 1); /* LR */
872 mas_writemem(MAS_BANK_D0
, MAS_D0_OUT_RL
, &val_rl
, 1); /* RL */
873 mas_writemem(MAS_BANK_D0
, MAS_D0_OUT_RR
, &val_rr
, 1); /* RR */
875 mas_writemem(MAS_BANK_D1
, 0x7f8, &val_ll
, 1); /* LL */
876 mas_writemem(MAS_BANK_D1
, 0x7f9, &val_lr
, 1); /* LR */
877 mas_writemem(MAS_BANK_D1
, 0x7fa, &val_rl
, 1); /* RL */
878 mas_writemem(MAS_BANK_D1
, 0x7fb, &val_rr
, 1); /* RR */
883 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
884 /* This function works by telling the decoder that we have another
885 crystal frequency than we actually have. It will adjust its internal
886 parameters and the result is that the audio is played at another pitch.
888 The pitch value is in tenths of percent.
890 void mpeg_set_pitch(int pitch
)
894 /* invert pitch value */
895 pitch
= 1000000/pitch
;
897 /* Calculate the new (bogus) frequency */
898 val
= 18432*pitch
/1000;
900 mas_writemem(MAS_BANK_D0
, MAS_D0_OFREQ_CONTROL
, &val
, 1);
902 /* We must tell the MAS that the frequency has changed.
903 This will unfortunately cause a short silence. */
904 mas_writemem(MAS_BANK_D0
, MAS_D0_IO_CONTROL_MAIN
, &shadow_io_control_main
, 1);
908 void mp3_init(int volume
, int bass
, int treble
, int balance
, int loudness
,
909 int avc
, int channel_config
,
910 int mdb_strength
, int mdb_harmonics
,
911 int mdb_center
, int mdb_shape
, bool mdb_enable
,
921 (void)channel_config
;
929 #if CONFIG_HWCODEC == MAS3507D
943 #ifdef HAVE_MAS_SIBI_CONTROL
944 and_b(~0x01, &PBDRH
); /* drive SIBI low */
945 or_b(0x01, &PBIORH
); /* output for PB8 */
948 #if CONFIG_HWCODEC == MAS3587F
949 or_b(0x08, &PAIORH
); /* output for /PR */
952 mas_version_code
= mas_readver();
953 DEBUGF("MAS3587 derivate %d, version %c%d\n",
954 (mas_version_code
& 0xf000) >> 12,
955 'A' + ((mas_version_code
& 0x0f00) >> 8), mas_version_code
& 0xff);
956 #elif CONFIG_HWCODEC == MAS3539F
957 or_b(0x08, &PAIORH
); /* output for /PR */
960 mas_version_code
= mas_readver();
961 DEBUGF("MAS3539 derivate %d, version %c%d\n",
962 (mas_version_code
& 0xf000) >> 12,
963 'A' + ((mas_version_code
& 0x0f00) >> 8), mas_version_code
& 0xff);
970 #if CONFIG_HWCODEC == MAS3507D
971 and_b(~0x20, &PBDRL
);
976 /* set IRQ6 to edge detect */
979 /* set IRQ6 prio 8 */
980 IPRB
= ( IPRB
& 0xff0f ) | 0x0080;
982 mas_readmem(MAS_BANK_D1
, 0xff7, &mas_version_code
, 1);
984 mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */
988 /* Clear the upper 12 bits of the 32-bit samples */
989 mas_writereg(0xc5, 0);
990 mas_writereg(0xc6, 0);
992 /* We need to set the PLL for a 14.1318MHz crystal */
993 if(mas_version_code
== 0x0601) /* Version F10? */
996 mas_writemem(MAS_BANK_D0
, 0x32d, &val
, 1);
998 mas_writemem(MAS_BANK_D0
, 0x32e, &val
, 1);
1000 mas_writemem(MAS_BANK_D0
, 0x32f, &val
, 1);
1006 mas_writemem(MAS_BANK_D0
, 0x36d, &val
, 1);
1008 mas_writemem(MAS_BANK_D0
, 0x36e, &val
, 1);
1010 mas_writemem(MAS_BANK_D0
, 0x36f, &val
, 1);
1016 #if CONFIG_HWCODEC == MAS3507D
1019 mas_writereg(MAS_REG_KPRESCALE
, 0xe9400);
1022 mpeg_sound_channel_config(channel_config
);
1025 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
1026 ICR
&= ~0x0010; /* IRQ3 level sensitive */
1027 PACR1
= (PACR1
& 0x3fff) | 0x4000; /* PA15 is IRQ3 */
1030 /* Must be done before calling mpeg_sound_set() */
1031 mpeg_is_initialized
= true;
1033 mpeg_sound_set(SOUND_BASS
, bass
);
1034 mpeg_sound_set(SOUND_TREBLE
, treble
);
1035 mpeg_sound_set(SOUND_BALANCE
, balance
);
1036 mpeg_sound_set(SOUND_VOLUME
, volume
);
1038 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
1039 mpeg_sound_channel_config(channel_config
);
1040 mpeg_sound_set(SOUND_LOUDNESS
, loudness
);
1041 mpeg_sound_set(SOUND_AVC
, avc
);
1042 mpeg_sound_set(SOUND_MDB_STRENGTH
, mdb_strength
);
1043 mpeg_sound_set(SOUND_MDB_HARMONICS
, mdb_harmonics
);
1044 mpeg_sound_set(SOUND_MDB_CENTER
, mdb_center
);
1045 mpeg_sound_set(SOUND_MDB_SHAPE
, mdb_shape
);
1046 mpeg_sound_set(SOUND_MDB_ENABLE
, mdb_enable
);
1047 mpeg_sound_set(SOUND_SUPERBASS
, superbass
);
1049 #endif /* !SIMULATOR */
1055 void mp3_shutdown(void)
1058 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
1059 unsigned long val
= 1;
1060 mas_writemem(MAS_BANK_D0
, MAS_D0_SOFT_MUTE
, &val
, 1); /* Mute */
1063 #if CONFIG_HWCODEC == MAS3507D
1064 dac_volume(0, 0, false);
1070 /* new functions, to be exported to plugin API */
1074 void mp3_play_init(void)
1076 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
1081 callback_for_more
= NULL
;
1082 mp3_reset_playtime();
1085 void mp3_play_data(const unsigned char* start
, int size
,
1086 void (*get_more
)(unsigned char** start
, int* size
) /* callback fn */
1091 CHCR3
&= ~0x0002; /* Clear interrupt */
1092 CHCR3
= 0x1504; /* Single address destination, TXI0, IE=1 */
1093 DMAOR
= 0x0001; /* Enable DMA */
1095 callback_for_more
= get_more
;
1097 SAR3
= (unsigned int)start
;
1098 DTCR3
= size
& 0xffff;
1103 CHCR3
|= 0x0001; /* Enable DMA IRQ */
1105 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
1106 demand_irq_enable(true);
1110 void mp3_play_pause(bool play
)
1113 { /* resume playback */
1116 playstart_tick
= current_tick
;
1118 else if (!paused
&& !play
)
1119 { /* stop playback */
1122 cumulative_ticks
+= current_tick
- playstart_tick
;
1126 void mp3_play_stop(void)
1129 mp3_play_pause(false);
1130 CHCR3
&= ~0x0001; /* Disable the DMA interrupt */
1131 #if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
1132 demand_irq_enable(false);
1136 long mp3_get_playtime(void)
1139 return cumulative_ticks
;
1141 return cumulative_ticks
+ current_tick
- playstart_tick
;
1144 void mp3_reset_playtime(void)
1146 cumulative_ticks
= 0;
1147 playstart_tick
= current_tick
;
1151 bool mp3_is_playing(void)
1157 /* returns the next byte position which would be transferred */
1158 unsigned char* mp3_get_pos(void)
1160 return (unsigned char*)SAR3
;
1164 #endif /* #ifndef SIMULATOR */