diff options
-rw-r--r-- | apps/playback.c | 11 | ||||
-rw-r--r-- | apps/playlist.c | 4 | ||||
-rw-r--r-- | apps/plugin.h | 4 | ||||
-rw-r--r-- | apps/plugins/battery_bench.c | 14 | ||||
-rw-r--r-- | apps/scrobbler.c | 7 | ||||
-rw-r--r-- | apps/scrobbler.h | 8 | ||||
-rw-r--r-- | apps/settings.c | 14 | ||||
-rw-r--r-- | apps/tagcache.c | 11 | ||||
-rw-r--r-- | apps/tagtree.c | 6 | ||||
-rw-r--r-- | firmware/ata_idle_notify.c | 8 | ||||
-rw-r--r-- | firmware/events.c | 4 | ||||
-rw-r--r-- | firmware/export/ata_idle_notify.h | 6 | ||||
-rw-r--r-- | firmware/export/events.h | 4 |
13 files changed, 51 insertions, 50 deletions
diff --git a/apps/playback.c b/apps/playback.c index 3fa42b9f94..7b614cd0d0 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1562,11 +1562,12 @@ static void buffering_handle_rebuffer_callback(void *data) | |||
1562 | queue_post(&audio_queue, Q_AUDIO_FLUSH, 0); | 1562 | queue_post(&audio_queue, Q_AUDIO_FLUSH, 0); |
1563 | } | 1563 | } |
1564 | 1564 | ||
1565 | static void buffering_handle_finished_callback(int *data) | 1565 | static void buffering_handle_finished_callback(void *data) |
1566 | { | 1566 | { |
1567 | logf("handle %d finished buffering", *data); | 1567 | logf("handle %d finished buffering", *data); |
1568 | int hid = (*(int*)data); | ||
1568 | 1569 | ||
1569 | if (*data == tracks[track_widx].id3_hid) | 1570 | if (hid == tracks[track_widx].id3_hid) |
1570 | { | 1571 | { |
1571 | int offset = ci.new_track + wps_offset; | 1572 | int offset = ci.new_track + wps_offset; |
1572 | int next_idx = (track_ridx + offset + 1) & MAX_TRACK_MASK; | 1573 | int next_idx = (track_ridx + offset + 1) & MAX_TRACK_MASK; |
@@ -1574,16 +1575,16 @@ static void buffering_handle_finished_callback(int *data) | |||
1574 | We can ask the audio thread to load the rest of the track's data. */ | 1575 | We can ask the audio thread to load the rest of the track's data. */ |
1575 | LOGFQUEUE("audio >| audio Q_AUDIO_FINISH_LOAD"); | 1576 | LOGFQUEUE("audio >| audio Q_AUDIO_FINISH_LOAD"); |
1576 | queue_post(&audio_queue, Q_AUDIO_FINISH_LOAD, 0); | 1577 | queue_post(&audio_queue, Q_AUDIO_FINISH_LOAD, 0); |
1577 | if (tracks[next_idx].id3_hid == *data) | 1578 | if (tracks[next_idx].id3_hid == hid) |
1578 | send_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, NULL); | 1579 | send_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, NULL); |
1579 | } | 1580 | } |
1580 | else | 1581 | else |
1581 | { | 1582 | { |
1582 | /* This is most likely an audio handle, so we strip the useless | 1583 | /* This is most likely an audio handle, so we strip the useless |
1583 | trailing tags that are left. */ | 1584 | trailing tags that are left. */ |
1584 | strip_tags(*data); | 1585 | strip_tags(hid); |
1585 | 1586 | ||
1586 | if (*data == tracks[track_widx-1].audio_hid | 1587 | if (hid == tracks[track_widx-1].audio_hid |
1587 | && filling == STATE_END_OF_PLAYLIST) | 1588 | && filling == STATE_END_OF_PLAYLIST) |
1588 | { | 1589 | { |
1589 | /* This was the last track in the playlist. | 1590 | /* This was the last track in the playlist. |
diff --git a/apps/playlist.c b/apps/playlist.c index b70fdc8a1f..1e96ebf46b 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -1214,8 +1214,9 @@ static int compare(const void* p1, const void* p2) | |||
1214 | * without affecting playlist load up performance. This thread also flushes | 1214 | * without affecting playlist load up performance. This thread also flushes |
1215 | * any pending control commands when the disk spins up. | 1215 | * any pending control commands when the disk spins up. |
1216 | */ | 1216 | */ |
1217 | static bool playlist_flush_callback(void) | 1217 | static void playlist_flush_callback(void *param) |
1218 | { | 1218 | { |
1219 | (void)param; | ||
1219 | struct playlist_info *playlist; | 1220 | struct playlist_info *playlist; |
1220 | playlist = ¤t_playlist; | 1221 | playlist = ¤t_playlist; |
1221 | if (playlist->control_fd >= 0) | 1222 | if (playlist->control_fd >= 0) |
@@ -1228,7 +1229,6 @@ static bool playlist_flush_callback(void) | |||
1228 | } | 1229 | } |
1229 | sync_control(playlist, true); | 1230 | sync_control(playlist, true); |
1230 | } | 1231 | } |
1231 | return true; | ||
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | static void playlist_thread(void) | 1234 | static void playlist_thread(void) |
diff --git a/apps/plugin.h b/apps/plugin.h index 41375a6adb..6ff7e7e568 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -403,8 +403,8 @@ struct plugin_api { | |||
403 | void (*storage_spin)(void); | 403 | void (*storage_spin)(void); |
404 | void (*storage_spindown)(int seconds); | 404 | void (*storage_spindown)(int seconds); |
405 | #if USING_STORAGE_CALLBACK | 405 | #if USING_STORAGE_CALLBACK |
406 | void (*register_storage_idle_func)(storage_idle_notify function); | 406 | void (*register_storage_idle_func)(void (*function)(void *data)); |
407 | void (*unregister_storage_idle_func)(storage_idle_notify function, bool run); | 407 | void (*unregister_storage_idle_func)(void (*function)(void *data), bool run); |
408 | #endif /* USING_STORAGE_CALLBACK */ | 408 | #endif /* USING_STORAGE_CALLBACK */ |
409 | void (*reload_directory)(void); | 409 | void (*reload_directory)(void); |
410 | char *(*create_numbered_filename)(char *buffer, const char *path, | 410 | char *(*create_numbered_filename)(char *buffer, const char *path, |
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 909de03512..c0b6d44e9f 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -306,22 +306,19 @@ static unsigned int charge_state(void) | |||
306 | #endif | 306 | #endif |
307 | 307 | ||
308 | 308 | ||
309 | static bool flush_buffer(void) | 309 | static void flush_buffer(void* data) |
310 | { | 310 | { |
311 | (void)data; | ||
311 | int fd, secs; | 312 | int fd, secs; |
312 | unsigned int i; | 313 | unsigned int i; |
313 | 314 | ||
314 | /* don't access the disk when in usb mode, or when no data is available */ | 315 | /* don't access the disk when in usb mode, or when no data is available */ |
315 | if (in_usb_mode || (buf_idx == 0)) | 316 | if (in_usb_mode || (buf_idx == 0)) |
316 | { | 317 | return; |
317 | return false; | ||
318 | } | ||
319 | 318 | ||
320 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND); | 319 | fd = rb->open(BATTERY_LOG, O_RDWR | O_CREAT | O_APPEND); |
321 | if (fd < 0) | 320 | if (fd < 0) |
322 | { | 321 | return; |
323 | return false; | ||
324 | } | ||
325 | 322 | ||
326 | for (i = 0; i < buf_idx; i++) | 323 | for (i = 0; i < buf_idx; i++) |
327 | { | 324 | { |
@@ -357,7 +354,6 @@ static bool flush_buffer(void) | |||
357 | rb->close(fd); | 354 | rb->close(fd); |
358 | 355 | ||
359 | buf_idx = 0; | 356 | buf_idx = 0; |
360 | return true; | ||
361 | } | 357 | } |
362 | 358 | ||
363 | 359 | ||
@@ -395,7 +391,7 @@ void thread(void) | |||
395 | for this to occur because it requires > 16 hours of no disk activity. | 391 | for this to occur because it requires > 16 hours of no disk activity. |
396 | */ | 392 | */ |
397 | if (buf_idx == BUF_ELEMENTS) { | 393 | if (buf_idx == BUF_ELEMENTS) { |
398 | flush_buffer(); | 394 | flush_buffer(NULL); |
399 | } | 395 | } |
400 | 396 | ||
401 | /* sleep some time until next measurement */ | 397 | /* sleep some time until next measurement */ |
diff --git a/apps/scrobbler.c b/apps/scrobbler.c index b0f65158e8..83f546b59f 100644 --- a/apps/scrobbler.c +++ b/apps/scrobbler.c | |||
@@ -128,11 +128,11 @@ static void write_cache(void) | |||
128 | cache_pos = 0; | 128 | cache_pos = 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | static bool scrobbler_flush_callback(void) | 131 | static void scrobbler_flush_callback(void *data) |
132 | { | 132 | { |
133 | (void)data; | ||
133 | if (scrobbler_initialised && cache_pos) | 134 | if (scrobbler_initialised && cache_pos) |
134 | write_cache(); | 135 | write_cache(); |
135 | return true; | ||
136 | } | 136 | } |
137 | 137 | ||
138 | static void add_to_cache(unsigned long play_length) | 138 | static void add_to_cache(unsigned long play_length) |
@@ -185,8 +185,9 @@ static void add_to_cache(unsigned long play_length) | |||
185 | 185 | ||
186 | } | 186 | } |
187 | 187 | ||
188 | void scrobbler_change_event(struct mp3entry *id) | 188 | static void scrobbler_change_event(void *data) |
189 | { | 189 | { |
190 | struct mp3entry *id = (struct mp3entry*)data; | ||
190 | /* add entry using the previous scrobbler_entry and timestamp */ | 191 | /* add entry using the previous scrobbler_entry and timestamp */ |
191 | if (pending) | 192 | if (pending) |
192 | add_to_cache(audio_prev_elapsed()); | 193 | add_to_cache(audio_prev_elapsed()); |
diff --git a/apps/scrobbler.h b/apps/scrobbler.h index d7a9b25624..050522e43b 100644 --- a/apps/scrobbler.h +++ b/apps/scrobbler.h | |||
@@ -18,10 +18,14 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | void scrobbler_change_event(struct mp3entry *id); | 22 | #ifndef __SCROBBLER_H__ |
23 | #define __SCROBBLER_H__ | ||
24 | |||
23 | int scrobbler_init(void); | 25 | int scrobbler_init(void); |
24 | void scrobbler_flush_cache(void); | 26 | void scrobbler_flush_cache(void); |
25 | void scrobbler_shutdown(void); | 27 | void scrobbler_shutdown(void); |
26 | void scrobbler_poweroff(void); | 28 | void scrobbler_poweroff(void); |
27 | bool scrobbler_is_enabled(void); | 29 | bool scrobbler_is_enabled(void); |
30 | |||
31 | #endif /* __SCROBBLER_H__ */ | ||
diff --git a/apps/settings.c b/apps/settings.c index 7a36a0ee1d..f12bd92bfd 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -568,17 +568,17 @@ static bool settings_write_config(const char* filename, int options) | |||
568 | return true; | 568 | return true; |
569 | } | 569 | } |
570 | #ifndef HAVE_RTC_RAM | 570 | #ifndef HAVE_RTC_RAM |
571 | static bool flush_global_status_callback(void) | 571 | static void flush_global_status_callback(void *data) |
572 | { | 572 | { |
573 | return write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); | 573 | (void)data; |
574 | write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); | ||
574 | } | 575 | } |
575 | #endif | 576 | #endif |
576 | static bool flush_config_block_callback(void) | 577 | static void flush_config_block_callback(void *data) |
577 | { | 578 | { |
578 | bool r1, r2; | 579 | (void)data; |
579 | r1 = write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); | 580 | write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); |
580 | r2 = settings_write_config(CONFIGFILE, SETTINGS_SAVE_CHANGED); | 581 | settings_write_config(CONFIGFILE, SETTINGS_SAVE_CHANGED); |
581 | return r1 || r2; | ||
582 | } | 582 | } |
583 | 583 | ||
584 | /* | 584 | /* |
diff --git a/apps/tagcache.c b/apps/tagcache.c index a5df2f0ad1..14d88bbfb8 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -3068,16 +3068,16 @@ static bool command_queue_is_full(void) | |||
3068 | return (next == command_queue_ridx); | 3068 | return (next == command_queue_ridx); |
3069 | } | 3069 | } |
3070 | 3070 | ||
3071 | static bool command_queue_sync_callback(void) | 3071 | static void command_queue_sync_callback(void *data) |
3072 | { | 3072 | { |
3073 | 3073 | (void)data; | |
3074 | struct master_header myhdr; | 3074 | struct master_header myhdr; |
3075 | int masterfd; | 3075 | int masterfd; |
3076 | 3076 | ||
3077 | mutex_lock(&command_queue_mutex); | 3077 | mutex_lock(&command_queue_mutex); |
3078 | 3078 | ||
3079 | if ( (masterfd = open_master_fd(&myhdr, true)) < 0) | 3079 | if ( (masterfd = open_master_fd(&myhdr, true)) < 0) |
3080 | return false; | 3080 | return; |
3081 | 3081 | ||
3082 | while (command_queue_ridx != command_queue_widx) | 3082 | while (command_queue_ridx != command_queue_widx) |
3083 | { | 3083 | { |
@@ -3092,7 +3092,7 @@ static bool command_queue_sync_callback(void) | |||
3092 | 3092 | ||
3093 | /* Re-open the masterfd. */ | 3093 | /* Re-open the masterfd. */ |
3094 | if ( (masterfd = open_master_fd(&myhdr, true)) < 0) | 3094 | if ( (masterfd = open_master_fd(&myhdr, true)) < 0) |
3095 | return true; | 3095 | return; |
3096 | 3096 | ||
3097 | break; | 3097 | break; |
3098 | } | 3098 | } |
@@ -3111,7 +3111,6 @@ static bool command_queue_sync_callback(void) | |||
3111 | 3111 | ||
3112 | tc_stat.queue_length = 0; | 3112 | tc_stat.queue_length = 0; |
3113 | mutex_unlock(&command_queue_mutex); | 3113 | mutex_unlock(&command_queue_mutex); |
3114 | return true; | ||
3115 | } | 3114 | } |
3116 | 3115 | ||
3117 | static void run_command_queue(bool force) | 3116 | static void run_command_queue(bool force) |
@@ -3120,7 +3119,7 @@ static void run_command_queue(bool force) | |||
3120 | return; | 3119 | return; |
3121 | 3120 | ||
3122 | if (force || command_queue_is_full()) | 3121 | if (force || command_queue_is_full()) |
3123 | command_queue_sync_callback(); | 3122 | command_queue_sync_callback(NULL); |
3124 | else | 3123 | else |
3125 | register_storage_idle_func(command_queue_sync_callback); | 3124 | register_storage_idle_func(command_queue_sync_callback); |
3126 | } | 3125 | } |
diff --git a/apps/tagtree.c b/apps/tagtree.c index 2962d57dac..832a49e359 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -642,9 +642,10 @@ static int compare(const void *p1, const void *p2) | |||
642 | return strncasecmp(e1->name, e2->name, MAX_PATH); | 642 | return strncasecmp(e1->name, e2->name, MAX_PATH); |
643 | } | 643 | } |
644 | 644 | ||
645 | static void tagtree_buffer_event(struct mp3entry *id3) | 645 | static void tagtree_buffer_event(void *data) |
646 | { | 646 | { |
647 | struct tagcache_search tcs; | 647 | struct tagcache_search tcs; |
648 | struct mp3entry *id3 = (struct mp3entry*)data; | ||
648 | 649 | ||
649 | /* Do not gather data unless proper setting has been enabled. */ | 650 | /* Do not gather data unless proper setting has been enabled. */ |
650 | if (!global_settings.runtimedb) | 651 | if (!global_settings.runtimedb) |
@@ -671,12 +672,13 @@ static void tagtree_buffer_event(struct mp3entry *id3) | |||
671 | tagcache_search_finish(&tcs); | 672 | tagcache_search_finish(&tcs); |
672 | } | 673 | } |
673 | 674 | ||
674 | static void tagtree_track_finish_event(struct mp3entry *id3) | 675 | static void tagtree_track_finish_event(void *data) |
675 | { | 676 | { |
676 | long playcount; | 677 | long playcount; |
677 | long playtime; | 678 | long playtime; |
678 | long lastplayed; | 679 | long lastplayed; |
679 | long tagcache_idx; | 680 | long tagcache_idx; |
681 | struct mp3entry *id3 = (struct mp3entry*)data; | ||
680 | 682 | ||
681 | /* Do not gather data unless proper setting has been enabled. */ | 683 | /* Do not gather data unless proper setting has been enabled. */ |
682 | if (!global_settings.runtimedb) | 684 | if (!global_settings.runtimedb) |
diff --git a/firmware/ata_idle_notify.c b/firmware/ata_idle_notify.c index 99b1d4d786..35d192bee0 100644 --- a/firmware/ata_idle_notify.c +++ b/firmware/ata_idle_notify.c | |||
@@ -25,12 +25,12 @@ | |||
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "string.h" | 26 | #include "string.h" |
27 | 27 | ||
28 | void register_storage_idle_func(storage_idle_notify function) | 28 | void register_storage_idle_func(void (*function)(void *data)) |
29 | { | 29 | { |
30 | #if USING_STORAGE_CALLBACK | 30 | #if USING_STORAGE_CALLBACK |
31 | add_event(DISK_EVENT_SPINUP, true, function); | 31 | add_event(DISK_EVENT_SPINUP, true, function); |
32 | #else | 32 | #else |
33 | function(); /* just call the function now */ | 33 | function(NULL); /* just call the function now */ |
34 | /* this _may_ cause problems later if the calling function | 34 | /* this _may_ cause problems later if the calling function |
35 | sets a variable expecting the callback to unset it, because | 35 | sets a variable expecting the callback to unset it, because |
36 | the callback will be run before this function exits, so before the var is set */ | 36 | the callback will be run before this function exits, so before the var is set */ |
@@ -38,12 +38,12 @@ void register_storage_idle_func(storage_idle_notify function) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | #if USING_STORAGE_CALLBACK | 40 | #if USING_STORAGE_CALLBACK |
41 | void unregister_storage_idle_func(storage_idle_notify func, bool run) | 41 | void unregister_storage_idle_func(void (*func)(void *data), bool run) |
42 | { | 42 | { |
43 | remove_event(DISK_EVENT_SPINUP, func); | 43 | remove_event(DISK_EVENT_SPINUP, func); |
44 | 44 | ||
45 | if (run) | 45 | if (run) |
46 | func(); | 46 | func(NULL); |
47 | } | 47 | } |
48 | 48 | ||
49 | bool call_storage_idle_notifys(bool force) | 49 | bool call_storage_idle_notifys(bool force) |
diff --git a/firmware/events.c b/firmware/events.c index 951214377e..dca612bc7b 100644 --- a/firmware/events.c +++ b/firmware/events.c | |||
@@ -33,7 +33,7 @@ struct sysevent { | |||
33 | 33 | ||
34 | static struct sysevent events[MAX_SYS_EVENTS]; | 34 | static struct sysevent events[MAX_SYS_EVENTS]; |
35 | 35 | ||
36 | bool add_event(unsigned short id, bool oneshot, void (*handler)) | 36 | bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data)) |
37 | { | 37 | { |
38 | int i; | 38 | int i; |
39 | 39 | ||
@@ -60,7 +60,7 @@ bool add_event(unsigned short id, bool oneshot, void (*handler)) | |||
60 | return false; | 60 | return false; |
61 | } | 61 | } |
62 | 62 | ||
63 | void remove_event(unsigned short id, void (*handler)) | 63 | void remove_event(unsigned short id, void (*handler)(void *data)) |
64 | { | 64 | { |
65 | int i; | 65 | int i; |
66 | 66 | ||
diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h index 18f1648e00..348165f1d1 100644 --- a/firmware/export/ata_idle_notify.h +++ b/firmware/export/ata_idle_notify.h | |||
@@ -48,11 +48,9 @@ enum { | |||
48 | && (CONFIG_NAND == NAND_IFP7XX)) \ | 48 | && (CONFIG_NAND == NAND_IFP7XX)) \ |
49 | && !defined(BOOTLOADER) | 49 | && !defined(BOOTLOADER) |
50 | 50 | ||
51 | typedef bool (*storage_idle_notify)(void); | 51 | extern void register_storage_idle_func(void (*function)(void *data)); |
52 | |||
53 | extern void register_storage_idle_func(storage_idle_notify function); | ||
54 | #if USING_STORAGE_CALLBACK | 52 | #if USING_STORAGE_CALLBACK |
55 | extern void unregister_storage_idle_func(storage_idle_notify function, bool run); | 53 | extern void unregister_storage_idle_func(void (*function)(void *data), bool run); |
56 | extern bool call_storage_idle_notifys(bool force); | 54 | extern bool call_storage_idle_notifys(bool force); |
57 | #else | 55 | #else |
58 | #define unregister_storage_idle_func(f,r) | 56 | #define unregister_storage_idle_func(f,r) |
diff --git a/firmware/export/events.h b/firmware/export/events.h index cad0fad895..694566a43e 100644 --- a/firmware/export/events.h +++ b/firmware/export/events.h | |||
@@ -38,8 +38,8 @@ | |||
38 | #define EVENT_CLASS_BUFFERING 0x0400 | 38 | #define EVENT_CLASS_BUFFERING 0x0400 |
39 | #define EVENT_CLASS_GUI 0x0800 | 39 | #define EVENT_CLASS_GUI 0x0800 |
40 | 40 | ||
41 | bool add_event(unsigned short id, bool oneshot, void (*handler)); | 41 | bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data)); |
42 | void remove_event(unsigned short id, void (*handler)); | 42 | void remove_event(unsigned short id, void (*handler)(void *data)); |
43 | void send_event(unsigned short id, void *data); | 43 | void send_event(unsigned short id, void *data); |
44 | 44 | ||
45 | #endif | 45 | #endif |