summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/audio.h81
-rw-r--r--firmware/export/mpeg.h56
-rw-r--r--firmware/mpeg.c71
-rw-r--r--firmware/powermgmt.c24
-rw-r--r--firmware/rolo.c4
5 files changed, 131 insertions, 105 deletions
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
new file mode 100644
index 0000000000..b276490ab3
--- /dev/null
+++ b/firmware/export/audio.h
@@ -0,0 +1,81 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef AUDIO_H
20#define AUDIO_H
21
22#include <stdbool.h>
23
24#ifdef SIMULATOR
25#define audio_play(x) sim_audio_play(x)
26#endif
27
28#define AUDIO_STATUS_PLAY 1
29#define AUDIO_STATUS_PAUSE 2
30#define AUDIO_STATUS_RECORD 4
31#define AUDIO_STATUS_PRERECORD 8
32#define AUDIO_STATUS_ERROR 16
33
34#define AUDIOERR_DISK_FULL 1
35
36struct audio_debug
37{
38 int mp3buflen;
39 int mp3buf_write;
40 int mp3buf_swapwrite;
41 int mp3buf_read;
42
43 int last_dma_chunk_size;
44
45 bool dma_on;
46 bool playing;
47 bool play_pending;
48 bool is_playing;
49 bool filling;
50 bool dma_underrun;
51
52 int unplayed_space;
53 int playable_space;
54 int unswapped_space;
55
56 int low_watermark_level;
57 int lowest_watermark_level;
58};
59
60void audio_init(void);
61void audio_play(int offset);
62void audio_stop(void);
63void audio_pause(void);
64void audio_resume(void);
65void audio_next(void);
66void audio_prev(void);
67int audio_status(void);
68void audio_ff_rewind(int newtime);
69void audio_flush_and_reload_tracks(void);
70struct mp3entry* audio_current_track(void);
71struct mp3entry* audio_next_track(void);
72bool audio_has_changed_track(void);
73void audio_get_debugdata(struct audio_debug *dbgdata);
74void audio_set_buffer_margin(int seconds);
75unsigned int audio_error(void);
76void audio_error_clear(void);
77int audio_get_file_pos(void);
78void audio_beep(int duration);
79void audio_init_playback(void);
80
81#endif
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index 479c5f2317..ca0de1f823 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -42,50 +42,8 @@
42/* For ID3 info and VBR header */ 42/* For ID3 info and VBR header */
43#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500) 43#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500)
44 44
45#ifdef SIMULATOR
46#define mpeg_play(x) sim_mpeg_play(x)
47#endif
48
49struct mpeg_debug
50{
51 int mp3buflen;
52 int mp3buf_write;
53 int mp3buf_swapwrite;
54 int mp3buf_read;
55
56 int last_dma_chunk_size;
57
58 bool dma_on;
59 bool playing;
60 bool play_pending;
61 bool is_playing;
62 bool filling;
63 bool dma_underrun;
64
65 int unplayed_space;
66 int playable_space;
67 int unswapped_space;
68
69 int low_watermark_level;
70 int lowest_watermark_level;
71};
72
73void mpeg_init(void);
74void mpeg_play(int offset);
75void mpeg_stop(void);
76void mpeg_pause(void);
77void mpeg_resume(void);
78void mpeg_next(void);
79void mpeg_prev(void);
80void mpeg_ff_rewind(int newtime);
81void mpeg_flush_and_reload_tracks(void);
82struct mp3entry* mpeg_current_track(void);
83struct mp3entry* mpeg_next_track(void);
84bool mpeg_has_changed_track(void);
85int mpeg_status(void);
86#if (CONFIG_HWCODEC == MAS3587F) || defined(SIMULATOR) 45#if (CONFIG_HWCODEC == MAS3587F) || defined(SIMULATOR)
87void mpeg_init_recording(void); 46void mpeg_init_recording(void);
88void mpeg_init_playback(void);
89void mpeg_record(const char *filename); 47void mpeg_record(const char *filename);
90void mpeg_new_file(const char *filename); 48void mpeg_new_file(const char *filename);
91void mpeg_set_recording_options(int frequency, int quality, 49void mpeg_set_recording_options(int frequency, int quality,
@@ -97,25 +55,11 @@ unsigned long mpeg_num_recorded_bytes(void);
97void mpeg_pause_recording(void); 55void mpeg_pause_recording(void);
98void mpeg_resume_recording(void); 56void mpeg_resume_recording(void);
99#endif 57#endif
100void mpeg_get_debugdata(struct mpeg_debug *dbgdata);
101void mpeg_set_buffer_margin(int seconds);
102unsigned int mpeg_error(void);
103void mpeg_error_clear(void);
104int mpeg_get_file_pos(void);
105unsigned long mpeg_get_last_header(void); 58unsigned long mpeg_get_last_header(void);
106void mpeg_beep(int duration);
107 59
108/* in order to keep the recording here, I have to expose this */ 60/* in order to keep the recording here, I have to expose this */
109void rec_tick(void); 61void rec_tick(void);
110void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */ 62void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
111void mpeg_id3_options(bool _v1first); 63void mpeg_id3_options(bool _v1first);
112 64
113#define MPEG_STATUS_PLAY 1
114#define MPEG_STATUS_PAUSE 2
115#define MPEG_STATUS_RECORD 4
116#define MPEG_STATUS_PRERECORD 8
117#define MPEG_STATUS_ERROR 16
118
119#define MPEGERR_DISK_FULL 1
120
121#endif 65#endif
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index d8de1a37b4..79265e4452 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -23,6 +23,7 @@
23#include "panic.h" 23#include "panic.h"
24#include "id3.h" 24#include "id3.h"
25#include "mpeg.h" 25#include "mpeg.h"
26#include "audio.h"
26#include "ata.h" 27#include "ata.h"
27#include "string.h" 28#include "string.h"
28#include <kernel.h> 29#include <kernel.h>
@@ -220,10 +221,10 @@ static void set_elapsed(struct mp3entry* id3)
220 id3->elapsed = id3->offset / id3->bpf * id3->tpf; 221 id3->elapsed = id3->offset / id3->bpf * id3->tpf;
221} 222}
222 223
223int mpeg_get_file_pos(void) 224int audio_get_file_pos(void)
224{ 225{
225 int pos = -1; 226 int pos = -1;
226 struct mp3entry *id3 = mpeg_current_track(); 227 struct mp3entry *id3 = audio_current_track();
227 228
228 if (id3->vbr) 229 if (id3->vbr)
229 { 230 {
@@ -402,12 +403,12 @@ static void recalculate_watermark(int bitrate)
402 } 403 }
403} 404}
404 405
405void mpeg_set_buffer_margin(int seconds) 406void audio_set_buffer_margin(int seconds)
406{ 407{
407 low_watermark_margin = seconds; 408 low_watermark_margin = seconds;
408} 409}
409 410
410void mpeg_get_debugdata(struct mpeg_debug *dbgdata) 411void audio_get_debugdata(struct audio_debug *dbgdata)
411{ 412{
412 dbgdata->mp3buflen = mp3buflen; 413 dbgdata->mp3buflen = mp3buflen;
413 dbgdata->mp3buf_write = mp3buf_write; 414 dbgdata->mp3buf_write = mp3buf_write;
@@ -1264,7 +1265,7 @@ static void mpeg_thread(void)
1264 } 1265 }
1265 1266
1266 case MPEG_FF_REWIND: { 1267 case MPEG_FF_REWIND: {
1267 struct mp3entry *id3 = mpeg_current_track(); 1268 struct mp3entry *id3 = audio_current_track();
1268 unsigned int oldtime = id3->elapsed; 1269 unsigned int oldtime = id3->elapsed;
1269 unsigned int newtime = (unsigned int)ev.data; 1270 unsigned int newtime = (unsigned int)ev.data;
1270 int curpos, newpos, diffpos; 1271 int curpos, newpos, diffpos;
@@ -1272,7 +1273,7 @@ static void mpeg_thread(void)
1272 1273
1273 id3->elapsed = newtime; 1274 id3->elapsed = newtime;
1274 1275
1275 newpos = mpeg_get_file_pos(); 1276 newpos = audio_get_file_pos();
1276 if(newpos < 0) 1277 if(newpos < 0)
1277 { 1278 {
1278 id3->elapsed = oldtime; 1279 id3->elapsed = oldtime;
@@ -1808,7 +1809,7 @@ static void mpeg_thread(void)
1808 { 1809 {
1809 if(errno == ENOSPC) 1810 if(errno == ENOSPC)
1810 { 1811 {
1811 mpeg_errno = MPEGERR_DISK_FULL; 1812 mpeg_errno = AUDIOERR_DISK_FULL;
1812 demand_irq_enable(false); 1813 demand_irq_enable(false);
1813 stop_recording(); 1814 stop_recording();
1814 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); 1815 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
@@ -1830,7 +1831,7 @@ static void mpeg_thread(void)
1830 { 1831 {
1831 if(errno == ENOSPC) 1832 if(errno == ENOSPC)
1832 { 1833 {
1833 mpeg_errno = MPEGERR_DISK_FULL; 1834 mpeg_errno = AUDIOERR_DISK_FULL;
1834 demand_irq_enable(false); 1835 demand_irq_enable(false);
1835 stop_recording(); 1836 stop_recording();
1836 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); 1837 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
@@ -1902,7 +1903,7 @@ static void mpeg_thread(void)
1902 { 1903 {
1903 if(errno == ENOSPC) 1904 if(errno == ENOSPC)
1904 { 1905 {
1905 mpeg_errno = MPEGERR_DISK_FULL; 1906 mpeg_errno = AUDIOERR_DISK_FULL;
1906 stop_recording(); 1907 stop_recording();
1907 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); 1908 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
1908 break; 1909 break;
@@ -2013,7 +2014,7 @@ void mpeg_id3_options(bool _v1first)
2013 v1first = _v1first; 2014 v1first = _v1first;
2014} 2015}
2015 2016
2016struct mp3entry* mpeg_current_track() 2017struct mp3entry* audio_current_track()
2017{ 2018{
2018#ifdef SIMULATOR 2019#ifdef SIMULATOR
2019 return &taginfo; 2020 return &taginfo;
@@ -2025,7 +2026,7 @@ struct mp3entry* mpeg_current_track()
2025#endif /* #ifdef SIMULATOR */ 2026#endif /* #ifdef SIMULATOR */
2026} 2027}
2027 2028
2028struct mp3entry* mpeg_next_track() 2029struct mp3entry* audio_next_track()
2029{ 2030{
2030#ifdef SIMULATOR 2031#ifdef SIMULATOR
2031 return &taginfo; 2032 return &taginfo;
@@ -2037,7 +2038,7 @@ struct mp3entry* mpeg_next_track()
2037#endif /* #ifdef SIMULATOR */ 2038#endif /* #ifdef SIMULATOR */
2038} 2039}
2039 2040
2040bool mpeg_has_changed_track(void) 2041bool audio_has_changed_track(void)
2041{ 2042{
2042 if(last_track_counter != current_track_counter) 2043 if(last_track_counter != current_track_counter)
2043 { 2044 {
@@ -2048,7 +2049,7 @@ bool mpeg_has_changed_track(void)
2048} 2049}
2049 2050
2050#if CONFIG_HWCODEC == MAS3587F 2051#if CONFIG_HWCODEC == MAS3587F
2051void mpeg_init_playback(void) 2052void audio_init_playback(void)
2052{ 2053{
2053 init_playback_done = false; 2054 init_playback_done = false;
2054 queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL); 2055 queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL);
@@ -2407,7 +2408,7 @@ void mpeg_set_recording_gain(int left, int right, bool use_mic)
2407} 2408}
2408 2409
2409/* try to make some kind of beep, also in recording mode */ 2410/* try to make some kind of beep, also in recording mode */
2410void mpeg_beep(int duration) 2411void audio_beep(int duration)
2411{ 2412{
2412 long starttick = current_tick; 2413 long starttick = current_tick;
2413 do 2414 do
@@ -2495,7 +2496,7 @@ void bitswap(unsigned char *data, int length)
2495 (void)length; 2496 (void)length;
2496} 2497}
2497 2498
2498void mpeg_init_playback(void) 2499void audio_init_playback(void)
2499{ 2500{
2500 /* a dummy */ 2501 /* a dummy */
2501} 2502}
@@ -2504,7 +2505,7 @@ unsigned long mpeg_recorded_time(void)
2504 /* a dummy */ 2505 /* a dummy */
2505 return 0; 2506 return 0;
2506} 2507}
2507void mpeg_beep(int duration) 2508void audio_beep(int duration)
2508{ 2509{
2509 /* a dummy */ 2510 /* a dummy */
2510 (void)duration; 2511 (void)duration;
@@ -2558,7 +2559,7 @@ void mpeg_set_recording_options(int frequency, int quality,
2558} 2559}
2559#endif 2560#endif
2560 2561
2561void mpeg_play(int offset) 2562void audio_play(int offset)
2562{ 2563{
2563#ifdef SIMULATOR 2564#ifdef SIMULATOR
2564 char* trackname; 2565 char* trackname;
@@ -2595,7 +2596,7 @@ void mpeg_play(int offset)
2595 mpeg_errno = 0; 2596 mpeg_errno = 0;
2596} 2597}
2597 2598
2598void mpeg_stop(void) 2599void audio_stop(void)
2599{ 2600{
2600#ifndef SIMULATOR 2601#ifndef SIMULATOR
2601 mpeg_stop_done = false; 2602 mpeg_stop_done = false;
@@ -2610,7 +2611,7 @@ void mpeg_stop(void)
2610 2611
2611} 2612}
2612 2613
2613void mpeg_pause(void) 2614void audio_pause(void)
2614{ 2615{
2615#ifndef SIMULATOR 2616#ifndef SIMULATOR
2616 queue_post(&mpeg_queue, MPEG_PAUSE, NULL); 2617 queue_post(&mpeg_queue, MPEG_PAUSE, NULL);
@@ -2621,7 +2622,7 @@ void mpeg_pause(void)
2621#endif /* #ifndef SIMULATOR */ 2622#endif /* #ifndef SIMULATOR */
2622} 2623}
2623 2624
2624void mpeg_resume(void) 2625void audio_resume(void)
2625{ 2626{
2626#ifndef SIMULATOR 2627#ifndef SIMULATOR
2627 queue_post(&mpeg_queue, MPEG_RESUME, NULL); 2628 queue_post(&mpeg_queue, MPEG_RESUME, NULL);
@@ -2632,7 +2633,7 @@ void mpeg_resume(void)
2632#endif /* #ifndef SIMULATOR */ 2633#endif /* #ifndef SIMULATOR */
2633} 2634}
2634 2635
2635void mpeg_next(void) 2636void audio_next(void)
2636{ 2637{
2637#ifndef SIMULATOR 2638#ifndef SIMULATOR
2638 queue_post(&mpeg_queue, MPEG_NEXT, NULL); 2639 queue_post(&mpeg_queue, MPEG_NEXT, NULL);
@@ -2660,7 +2661,7 @@ void mpeg_next(void)
2660#endif /* #ifndef SIMULATOR */ 2661#endif /* #ifndef SIMULATOR */
2661} 2662}
2662 2663
2663void mpeg_prev(void) 2664void audio_prev(void)
2664{ 2665{
2665#ifndef SIMULATOR 2666#ifndef SIMULATOR
2666 queue_post(&mpeg_queue, MPEG_PREV, NULL); 2667 queue_post(&mpeg_queue, MPEG_PREV, NULL);
@@ -2687,7 +2688,7 @@ void mpeg_prev(void)
2687#endif /* #ifndef SIMULATOR */ 2688#endif /* #ifndef SIMULATOR */
2688} 2689}
2689 2690
2690void mpeg_ff_rewind(int newtime) 2691void audio_ff_rewind(int newtime)
2691{ 2692{
2692#ifndef SIMULATOR 2693#ifndef SIMULATOR
2693 queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime); 2694 queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime);
@@ -2696,43 +2697,43 @@ void mpeg_ff_rewind(int newtime)
2696#endif /* #ifndef SIMULATOR */ 2697#endif /* #ifndef SIMULATOR */
2697} 2698}
2698 2699
2699void mpeg_flush_and_reload_tracks(void) 2700void audio_flush_and_reload_tracks(void)
2700{ 2701{
2701#ifndef SIMULATOR 2702#ifndef SIMULATOR
2702 queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL); 2703 queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL);
2703#endif /* #ifndef SIMULATOR*/ 2704#endif /* #ifndef SIMULATOR*/
2704} 2705}
2705 2706
2706int mpeg_status(void) 2707int audio_status(void)
2707{ 2708{
2708 int ret = 0; 2709 int ret = 0;
2709 2710
2710 if(is_playing) 2711 if(is_playing)
2711 ret |= MPEG_STATUS_PLAY; 2712 ret |= AUDIO_STATUS_PLAY;
2712 2713
2713 if(paused) 2714 if(paused)
2714 ret |= MPEG_STATUS_PAUSE; 2715 ret |= AUDIO_STATUS_PAUSE;
2715 2716
2716#if CONFIG_HWCODEC == MAS3587F 2717#if CONFIG_HWCODEC == MAS3587F
2717 if(is_recording && !is_prerecording) 2718 if(is_recording && !is_prerecording)
2718 ret |= MPEG_STATUS_RECORD; 2719 ret |= AUDIO_STATUS_RECORD;
2719 2720
2720 if(is_prerecording) 2721 if(is_prerecording)
2721 ret |= MPEG_STATUS_PRERECORD; 2722 ret |= AUDIO_STATUS_PRERECORD;
2722#endif /* #if CONFIG_HWCODEC == MAS3587F */ 2723#endif /* #if CONFIG_HWCODEC == MAS3587F */
2723 2724
2724 if(mpeg_errno) 2725 if(mpeg_errno)
2725 ret |= MPEG_STATUS_ERROR; 2726 ret |= AUDIO_STATUS_ERROR;
2726 2727
2727 return ret; 2728 return ret;
2728} 2729}
2729 2730
2730unsigned int mpeg_error(void) 2731unsigned int audio_error(void)
2731{ 2732{
2732 return mpeg_errno; 2733 return mpeg_errno;
2733} 2734}
2734 2735
2735void mpeg_error_clear(void) 2736void audio_error_clear(void)
2736{ 2737{
2737 mpeg_errno = 0; 2738 mpeg_errno = 0;
2738} 2739}
@@ -2745,21 +2746,21 @@ static void mpeg_thread(void)
2745 struct mp3entry* id3; 2746 struct mp3entry* id3;
2746 while ( 1 ) { 2747 while ( 1 ) {
2747 if (is_playing) { 2748 if (is_playing) {
2748 id3 = mpeg_current_track(); 2749 id3 = audio_current_track();
2749 if (!paused) 2750 if (!paused)
2750 { 2751 {
2751 id3->elapsed+=1000; 2752 id3->elapsed+=1000;
2752 id3->offset+=1000; 2753 id3->offset+=1000;
2753 } 2754 }
2754 if (id3->elapsed>=id3->length) 2755 if (id3->elapsed>=id3->length)
2755 mpeg_next(); 2756 audio_next();
2756 } 2757 }
2757 sleep(HZ); 2758 sleep(HZ);
2758 } 2759 }
2759} 2760}
2760#endif /* #ifdef SIMULATOR */ 2761#endif /* #ifdef SIMULATOR */
2761 2762
2762void mpeg_init(void) 2763void audio_init(void)
2763{ 2764{
2764 mpeg_errno = 0; 2765 mpeg_errno = 0;
2765 2766
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 71b0f08fff..9cfacad9b0 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -31,7 +31,7 @@
31#include "power.h" 31#include "power.h"
32#include "button.h" 32#include "button.h"
33#include "ata.h" 33#include "ata.h"
34#include "mpeg.h" 34#include "audio.h"
35#include "mp3_playback.h" 35#include "mp3_playback.h"
36#include "usb.h" 36#include "usb.h"
37#include "powermgmt.h" 37#include "powermgmt.h"
@@ -343,7 +343,7 @@ static void battery_level_update(void)
343static void handle_auto_poweroff(void) 343static void handle_auto_poweroff(void)
344{ 344{
345 long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ; 345 long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
346 int mpeg_stat = mpeg_status(); 346 int audio_stat = audio_status();
347 347
348#ifdef HAVE_CHARGING 348#ifdef HAVE_CHARGING
349 /* 349 /*
@@ -360,8 +360,8 @@ static void handle_auto_poweroff(void)
360 (radio_get_status() != FMRADIO_PLAYING) && 360 (radio_get_status() != FMRADIO_PLAYING) &&
361#endif 361#endif
362 !usb_inserted() && 362 !usb_inserted() &&
363 ((mpeg_stat == 0) || 363 ((audio_stat == 0) ||
364 ((mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)) && 364 ((audio_stat == (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE)) &&
365 !sleeptimer_active))) 365 !sleeptimer_active)))
366 { 366 {
367 if(TIME_AFTER(current_tick, last_event_tick + timeout) && 367 if(TIME_AFTER(current_tick, last_event_tick + timeout) &&
@@ -377,7 +377,7 @@ static void handle_auto_poweroff(void)
377 { 377 {
378 if(TIME_AFTER(current_tick, sleeptimer_endtick)) 378 if(TIME_AFTER(current_tick, sleeptimer_endtick))
379 { 379 {
380 mpeg_stop(); 380 audio_stop();
381#ifdef HAVE_CHARGING 381#ifdef HAVE_CHARGING
382 if((charger_input_state == CHARGER) || 382 if((charger_input_state == CHARGER) ||
383 (charger_input_state == CHARGER_PLUGGED)) 383 (charger_input_state == CHARGER_PLUGGED))
@@ -413,8 +413,8 @@ static void car_adapter_mode_processing(void)
413 413
414 if (waiting_to_resume_play) { 414 if (waiting_to_resume_play) {
415 if (TIME_AFTER(current_tick, play_resume_time)) { 415 if (TIME_AFTER(current_tick, play_resume_time)) {
416 if (mpeg_status() & MPEG_STATUS_PAUSE) { 416 if (audio_status() & AUDIO_STATUS_PAUSE) {
417 mpeg_resume(); 417 audio_resume();
418 } 418 }
419 waiting_to_resume_play = false; 419 waiting_to_resume_play = false;
420 } 420 }
@@ -423,15 +423,15 @@ static void car_adapter_mode_processing(void)
423 /* 423 /*
424 * Just got unplugged, pause if playing 424 * Just got unplugged, pause if playing
425 */ 425 */
426 if ((mpeg_status() & MPEG_STATUS_PLAY) && 426 if ((audio_status() & AUDIO_STATUS_PLAY) &&
427 !(mpeg_status() & MPEG_STATUS_PAUSE)) { 427 !(audio_status() & AUDIO_STATUS_PAUSE)) {
428 mpeg_pause(); 428 audio_pause();
429 } 429 }
430 } else if(charger_input_state == CHARGER_PLUGGED) { 430 } else if(charger_input_state == CHARGER_PLUGGED) {
431 /* 431 /*
432 * Just got plugged in, delay & resume if we were playing 432 * Just got plugged in, delay & resume if we were playing
433 */ 433 */
434 if (mpeg_status() & MPEG_STATUS_PAUSE) { 434 if (audio_status() & AUDIO_STATUS_PAUSE) {
435 /* delay resume a bit while the engine is cranking */ 435 /* delay resume a bit while the engine is cranking */
436 play_resume_time = current_tick + HZ*5; 436 play_resume_time = current_tick + HZ*5;
437 waiting_to_resume_play = true; 437 waiting_to_resume_play = true;
@@ -920,7 +920,7 @@ void shutdown_hw(void)
920 fd = -1; 920 fd = -1;
921 } 921 }
922#endif 922#endif
923 mpeg_stop(); 923 audio_stop();
924 ata_flush(); 924 ata_flush();
925 ata_spindown(1); 925 ata_spindown(1);
926 while(ata_disk_is_active()) 926 while(ata_disk_is_active())
diff --git a/firmware/rolo.c b/firmware/rolo.c
index ceb70791cf..e2ef26b3aa 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -23,7 +23,7 @@
23#include "sprintf.h" 23#include "sprintf.h"
24#include "button.h" 24#include "button.h"
25#include "file.h" 25#include "file.h"
26#include "mpeg.h" 26#include "audio.h"
27#include "system.h" 27#include "system.h"
28#include "i2c.h" 28#include "i2c.h"
29#include "string.h" 29#include "string.h"
@@ -101,7 +101,7 @@ int rolo_load(const char* filename)
101 lcd_puts(0, 1, "Loading"); 101 lcd_puts(0, 1, "Loading");
102 lcd_update(); 102 lcd_update();
103 103
104 mpeg_stop(); 104 audio_stop();
105 105
106 fd = open(filename, O_RDONLY); 106 fd = open(filename, O_RDONLY);
107 if(-1 == fd) { 107 if(-1 == fd) {