summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2008-03-16 13:55:16 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2008-03-16 13:55:16 +0000
commit19c6e66c1353993659ee007a6c1792a6b0b7ba13 (patch)
tree1dd7f88282b2e543fb5b22458fcb2f3bf1c7eb80 /firmware/export
parent478ba0afa11061a620e44cd9cc60debd955b1b33 (diff)
downloadrockbox-19c6e66c1353993659ee007a6c1792a6b0b7ba13.tar.gz
rockbox-19c6e66c1353993659ee007a6c1792a6b0b7ba13.zip
Implement the playback event handling as a system-wide multi-purpose event system. Unified mpeg.c and playback.c audio event handling. Converted ata_idle_notify to use the new event handling system also.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16682 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/ata_idle_notify.h10
-rw-r--r--firmware/export/events.h51
-rw-r--r--firmware/export/mpeg.h1
3 files changed, 59 insertions, 3 deletions
diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h
index ee825c967e..1dda3e196a 100644
--- a/firmware/export/ata_idle_notify.h
+++ b/firmware/export/ata_idle_notify.h
@@ -19,7 +19,9 @@
19#ifndef __ATACALLBACK_H__ 19#ifndef __ATACALLBACK_H__
20#define __ATACALLBACK_H__ 20#define __ATACALLBACK_H__
21 21
22
22#include <stdbool.h> 23#include <stdbool.h>
24#include "events.h"
23 25
24#if 0 26#if 0
25 NOTE: ata_idle_nofity usage notes.. 27 NOTE: ata_idle_nofity usage notes..
@@ -34,15 +36,17 @@
34 5) Dont Panic! 36 5) Dont Panic!
35#endif 37#endif
36 38
39enum {
40 DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1),
41};
42
37#define USING_ATA_CALLBACK !defined(SIMULATOR) \ 43#define USING_ATA_CALLBACK !defined(SIMULATOR) \
38 && !defined(HAVE_FLASH_DISK) 44 && !defined(HAVE_FLASH_DISK)
39 45
40#define MAX_ATA_CALLBACKS 5
41typedef bool (*ata_idle_notify)(void); 46typedef bool (*ata_idle_notify)(void);
42 47
43extern bool register_ata_idle_func(ata_idle_notify function); 48extern void register_ata_idle_func(ata_idle_notify function);
44#if USING_ATA_CALLBACK 49#if USING_ATA_CALLBACK
45extern void ata_idle_notify_init(void);
46extern void unregister_ata_idle_func(ata_idle_notify function, bool run); 50extern void unregister_ata_idle_func(ata_idle_notify function, bool run);
47extern bool call_ata_idle_notifys(bool force); 51extern bool call_ata_idle_notifys(bool force);
48#else 52#else
diff --git a/firmware/export/events.h b/firmware/export/events.h
new file mode 100644
index 0000000000..b27b5dee4c
--- /dev/null
+++ b/firmware/export/events.h
@@ -0,0 +1,51 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Miika Pekkarinen
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
20#ifndef _EVENTS_H
21#define _EVENTS_H
22
23#include <stdbool.h>
24
25#define MAX_SYS_EVENTS 10
26
27/**
28 * High nibble = Event class definition
29 * Low nibble = Event ID
30 */
31
32#define EVENT_CLASS_DISK 0x0100
33#define EVENT_CLASS_PLAYBACK 0x0200
34
35/**
36 * Because same playback events are used in mpeg.c and playback.c, define
37 * them here to prevent cluttering and ifdefs.
38 */
39enum {
40 PLAYBACK_EVENT_TRACK_BUFFER = (EVENT_CLASS_PLAYBACK|1),
41 PLAYBACK_EVENT_TRACK_FINISH,
42 PLAYBACK_EVENT_TRACK_CHANGE,
43};
44
45
46bool add_event(unsigned short id, void (*handler));
47void remove_event(unsigned short id, void (*handler));
48void send_event(unsigned short id, bool oneshot, void *data);
49
50#endif
51
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index 3e36c44ac5..0a9d62cdf0 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -21,6 +21,7 @@
21 21
22#include <stdbool.h> 22#include <stdbool.h>
23#include "id3.h" 23#include "id3.h"
24#include "events.h"
24 25
25#define MPEG_SWAP_CHUNKSIZE 0x2000 26#define MPEG_SWAP_CHUNKSIZE 0x2000
26#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we 27#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we