summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-12-19 16:50:07 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-12-19 16:50:07 +0000
commit4b902679cc5fcca7f4e8d83b25112754f7903736 (patch)
tree7853f7d80a4254f521107c2c6e7191d3a1e1974e
parentd152b6492a2371c261c195494864c3744609cf3c (diff)
downloadrockbox-4b902679cc5fcca7f4e8d83b25112754f7903736.tar.gz
rockbox-4b902679cc5fcca7f4e8d83b25112754f7903736.zip
Convert queues to use intptr_t for event data and return values as most of the time pointer are not passed and it should make some things a bit cleaner.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11818 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c58
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/battery_bench.c2
-rw-r--r--firmware/backlight.c14
-rw-r--r--firmware/drivers/ata.c2
-rw-r--r--firmware/drivers/button.c20
-rw-r--r--firmware/export/kernel.h15
-rw-r--r--firmware/kernel.c21
-rw-r--r--firmware/mpeg.c32
-rw-r--r--firmware/pcm_record.c24
-rw-r--r--firmware/powermgmt.c6
-rw-r--r--firmware/target/arm/ipod/3g/button-3g.c2
-rw-r--r--firmware/target/arm/ipod/button-clickwheel.c2
-rw-r--r--firmware/target/arm/ipod/button-mini1g.c2
-rw-r--r--firmware/usb.c12
-rw-r--r--uisimulator/sdl/button.c14
-rw-r--r--uisimulator/sdl/kernel.c19
17 files changed, 124 insertions, 123 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 53dbe07823..7873700247 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -340,7 +340,7 @@ void mp3_play_data(const unsigned char* start, int size,
340 LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); 340 LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
341 queue_post(&voice_queue, Q_VOICE_STOP, 0); 341 queue_post(&voice_queue, Q_VOICE_STOP, 0);
342 LOGFQUEUE("mp3 > voice Q_VOICE_PLAY"); 342 LOGFQUEUE("mp3 > voice Q_VOICE_PLAY");
343 queue_post(&voice_queue, Q_VOICE_PLAY, &voice_clip); 343 queue_post(&voice_queue, Q_VOICE_PLAY, (intptr_t)&voice_clip);
344 voice_thread_start = true; 344 voice_thread_start = true;
345 trigger_cpu_boost(); 345 trigger_cpu_boost();
346#else 346#else
@@ -355,7 +355,7 @@ void mp3_play_stop(void)
355#ifdef PLAYBACK_VOICE 355#ifdef PLAYBACK_VOICE
356 queue_remove_from_head(&voice_queue, Q_VOICE_STOP); 356 queue_remove_from_head(&voice_queue, Q_VOICE_STOP);
357 LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); 357 LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
358 queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); 358 queue_post(&voice_queue, Q_VOICE_STOP, 1);
359#endif 359#endif
360} 360}
361 361
@@ -500,7 +500,7 @@ bool audio_load_encoder(int afmt)
500 ci.enc_codec_loaded = 0; /* clear any previous error condition */ 500 ci.enc_codec_loaded = 0; /* clear any previous error condition */
501 501
502 LOGFQUEUE("audio > Q_AUDIO_LOAD_ENCODER"); 502 LOGFQUEUE("audio > Q_AUDIO_LOAD_ENCODER");
503 queue_post(&audio_queue, Q_AUDIO_LOAD_ENCODER, (void *)enc_fn); 503 queue_post(&audio_queue, Q_AUDIO_LOAD_ENCODER, (intptr_t)enc_fn);
504 504
505 while (ci.enc_codec_loaded == 0) 505 while (ci.enc_codec_loaded == 0)
506 yield(); 506 yield();
@@ -601,7 +601,7 @@ void audio_play(long offset)
601 /* Truncate any existing voice output so we don't have spelling 601 /* Truncate any existing voice output so we don't have spelling
602 * etc. over the first part of the played track */ 602 * etc. over the first part of the played track */
603 LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); 603 LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
604 queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); 604 queue_post(&voice_queue, Q_VOICE_STOP, 1);
605#endif 605#endif
606 606
607 /* Start playback */ 607 /* Start playback */
@@ -615,7 +615,7 @@ void audio_play(long offset)
615 LOGFQUEUE("audio > audio Q_AUDIO_STOP"); 615 LOGFQUEUE("audio > audio Q_AUDIO_STOP");
616 queue_post(&audio_queue, Q_AUDIO_STOP, 0); 616 queue_post(&audio_queue, Q_AUDIO_STOP, 0);
617 LOGFQUEUE("audio > audio Q_AUDIO_PLAY"); 617 LOGFQUEUE("audio > audio Q_AUDIO_PLAY");
618 queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset); 618 queue_post(&audio_queue, Q_AUDIO_PLAY, offset);
619 } 619 }
620 620
621 /* Don't return until playback has actually started */ 621 /* Don't return until playback has actually started */
@@ -637,13 +637,13 @@ void audio_stop(void)
637void audio_pause(void) 637void audio_pause(void)
638{ 638{
639 LOGFQUEUE("audio > audio Q_AUDIO_PAUSE"); 639 LOGFQUEUE("audio > audio Q_AUDIO_PAUSE");
640 queue_post(&audio_queue, Q_AUDIO_PAUSE, (void *)true); 640 queue_post(&audio_queue, Q_AUDIO_PAUSE, true);
641} 641}
642 642
643void audio_resume(void) 643void audio_resume(void)
644{ 644{
645 LOGFQUEUE("audio > audio Q_AUDIO_PAUSE resume"); 645 LOGFQUEUE("audio > audio Q_AUDIO_PAUSE resume");
646 queue_post(&audio_queue, Q_AUDIO_PAUSE, (void *)false); 646 queue_post(&audio_queue, Q_AUDIO_PAUSE, false);
647} 647}
648 648
649void audio_next(void) 649void audio_next(void)
@@ -654,7 +654,7 @@ void audio_next(void)
654 pcmbuf_beep(5000, 100, 2500*global_settings.beep); 654 pcmbuf_beep(5000, 100, 2500*global_settings.beep);
655 655
656 LOGFQUEUE("audio > audio Q_AUDIO_SKIP 1"); 656 LOGFQUEUE("audio > audio Q_AUDIO_SKIP 1");
657 queue_post(&audio_queue, Q_AUDIO_SKIP, (void *)1); 657 queue_post(&audio_queue, Q_AUDIO_SKIP, 1);
658 /* Keep wps fast while our message travels inside deep playback queues. */ 658 /* Keep wps fast while our message travels inside deep playback queues. */
659 wps_offset++; 659 wps_offset++;
660 track_changed = true; 660 track_changed = true;
@@ -675,7 +675,7 @@ void audio_prev(void)
675 pcmbuf_beep(5000, 100, 2500*global_settings.beep); 675 pcmbuf_beep(5000, 100, 2500*global_settings.beep);
676 676
677 LOGFQUEUE("audio > audio Q_AUDIO_SKIP -1"); 677 LOGFQUEUE("audio > audio Q_AUDIO_SKIP -1");
678 queue_post(&audio_queue, Q_AUDIO_SKIP, (void *)-1); 678 queue_post(&audio_queue, Q_AUDIO_SKIP, -1);
679 /* Keep wps fast while our message travels inside deep playback queues. */ 679 /* Keep wps fast while our message travels inside deep playback queues. */
680 wps_offset--; 680 wps_offset--;
681 track_changed = true; 681 track_changed = true;
@@ -691,13 +691,13 @@ void audio_prev(void)
691void audio_next_dir(void) 691void audio_next_dir(void)
692{ 692{
693 LOGFQUEUE("audio > audio Q_AUDIO_DIR_SKIP 1"); 693 LOGFQUEUE("audio > audio Q_AUDIO_DIR_SKIP 1");
694 queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, (void *)1); 694 queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, 1);
695} 695}
696 696
697void audio_prev_dir(void) 697void audio_prev_dir(void)
698{ 698{
699 LOGFQUEUE("audio > audio Q_AUDIO_DIR_SKIP -1"); 699 LOGFQUEUE("audio > audio Q_AUDIO_DIR_SKIP -1");
700 queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, (void *)-1); 700 queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, -1);
701} 701}
702 702
703void audio_pre_ff_rewind(void) 703void audio_pre_ff_rewind(void)
@@ -709,7 +709,7 @@ void audio_pre_ff_rewind(void)
709void audio_ff_rewind(long newpos) 709void audio_ff_rewind(long newpos)
710{ 710{
711 LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND"); 711 LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND");
712 queue_post(&audio_queue, Q_AUDIO_FF_REWIND, (int *)newpos); 712 queue_post(&audio_queue, Q_AUDIO_FF_REWIND, newpos);
713} 713}
714 714
715void audio_flush_and_reload_tracks(void) 715void audio_flush_and_reload_tracks(void)
@@ -1139,7 +1139,7 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize)
1139 1139
1140 case Q_VOICE_STOP: 1140 case Q_VOICE_STOP:
1141 LOGFQUEUE("voice < Q_VOICE_STOP"); 1141 LOGFQUEUE("voice < Q_VOICE_STOP");
1142 if (ev.data == (void *)1 && !playing && pcm_is_playing()) 1142 if (ev.data == 1 && !playing && pcm_is_playing())
1143 { 1143 {
1144 /* Aborting: Slight hack - flush PCM buffer if 1144 /* Aborting: Slight hack - flush PCM buffer if
1145 only being used for voice */ 1145 only being used for voice */
@@ -1192,7 +1192,7 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize)
1192 1192
1193 voice_is_playing = true; 1193 voice_is_playing = true;
1194 trigger_cpu_boost(); 1194 trigger_cpu_boost();
1195 voice_data = ev.data; 1195 voice_data = (struct voice_info *)ev.data;
1196 voice_remaining = voice_data->size; 1196 voice_remaining = voice_data->size;
1197 voicebuf = voice_data->buf; 1197 voicebuf = voice_data->buf;
1198 voice_getmore = voice_data->callback; 1198 voice_getmore = voice_data->callback;
@@ -1573,11 +1573,11 @@ static void codec_advance_buffer_callback(size_t amount)
1573 1573
1574 if (amount > CUR_TI->available) 1574 if (amount > CUR_TI->available)
1575 { 1575 {
1576 int result; 1576 intptr_t result;
1577 LOGFQUEUE("codec >| audio Q_AUDIO_REBUFFER_SEEK"); 1577 LOGFQUEUE("codec >| audio Q_AUDIO_REBUFFER_SEEK");
1578 1578
1579 result = (int)(intptr_t)queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, 1579 result = queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK,
1580 (void *)(uintptr_t)(ci.curpos + amount)); 1580 ci.curpos + amount);
1581 1581
1582 switch (result) 1582 switch (result)
1583 { 1583 {
@@ -1716,11 +1716,10 @@ static bool codec_seek_buffer_callback(size_t newpos)
1716 /* We need to reload the song. */ 1716 /* We need to reload the song. */
1717 if (newpos < CUR_TI->start_pos) 1717 if (newpos < CUR_TI->start_pos)
1718 { 1718 {
1719 int result; 1719 intptr_t result;
1720 1720
1721 LOGFQUEUE("codec >| audio Q_AUDIO_REBUFFER_SEEK"); 1721 LOGFQUEUE("codec >| audio Q_AUDIO_REBUFFER_SEEK");
1722 result = (int)(intptr_t)queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, 1722 result = queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, newpos);
1723 (void *)(uintptr_t)newpos);
1724 1723
1725 switch (result) 1724 switch (result)
1726 { 1725 {
@@ -1851,7 +1850,7 @@ static void codec_track_skip_done(bool was_manual)
1851 1850
1852static bool codec_load_next_track(void) 1851static bool codec_load_next_track(void)
1853{ 1852{
1854 int result; 1853 intptr_t result;
1855 1854
1856 prev_track_elapsed = CUR_TI->id3.elapsed; 1855 prev_track_elapsed = CUR_TI->id3.elapsed;
1857 1856
@@ -1872,8 +1871,7 @@ static bool codec_load_next_track(void)
1872 1871
1873 trigger_cpu_boost(); 1872 trigger_cpu_boost();
1874 LOGFQUEUE("codec >| audio Q_AUDIO_CHECK_NEW_TRACK"); 1873 LOGFQUEUE("codec >| audio Q_AUDIO_CHECK_NEW_TRACK");
1875 result = (int)(intptr_t)queue_send(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 1874 result = queue_send(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0);
1876 NULL);
1877 1875
1878#if 0 /* Q_CODEC_REQUEST_PENDING never posted anyway */ 1876#if 0 /* Q_CODEC_REQUEST_PENDING never posted anyway */
1879 while (1) 1877 while (1)
@@ -2007,7 +2005,7 @@ static void codec_thread(void)
2007 if (voice_codec_loaded && current_codec == CODEC_IDX_VOICE) 2005 if (voice_codec_loaded && current_codec == CODEC_IDX_VOICE)
2008 { 2006 {
2009 LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); 2007 LOGFQUEUE("codec > voice Q_ENCODER_RECORD");
2010 queue_post(&voice_queue, Q_ENCODER_RECORD, NULL); 2008 queue_post(&voice_queue, Q_ENCODER_RECORD, 0);
2011 } 2009 }
2012 mutex_lock(&mutex_codecthread); 2010 mutex_lock(&mutex_codecthread);
2013#endif 2011#endif
@@ -2097,7 +2095,7 @@ static void codec_thread(void)
2097 const char *codec_fn = get_codec_filename(CUR_TI->id3.codectype); 2095 const char *codec_fn = get_codec_filename(CUR_TI->id3.codectype);
2098 LOGFQUEUE("codec > codec Q_CODEC_LOAD_DISK"); 2096 LOGFQUEUE("codec > codec Q_CODEC_LOAD_DISK");
2099 queue_post(&codec_queue, Q_CODEC_LOAD_DISK, 2097 queue_post(&codec_queue, Q_CODEC_LOAD_DISK,
2100 (void *)codec_fn); 2098 (intptr_t)codec_fn);
2101 } 2099 }
2102 } 2100 }
2103 break; 2101 break;
@@ -2533,7 +2531,7 @@ static bool audio_loadcodec(bool start_play)
2533 ci.taginfo_ready = &CUR_TI->taginfo_ready; 2531 ci.taginfo_ready = &CUR_TI->taginfo_ready;
2534 ci.curpos = 0; 2532 ci.curpos = 0;
2535 LOGFQUEUE("codec > codec Q_CODEC_LOAD_DISK"); 2533 LOGFQUEUE("codec > codec Q_CODEC_LOAD_DISK");
2536 queue_post(&codec_queue, Q_CODEC_LOAD_DISK, (void *)codec_fn); 2534 queue_post(&codec_queue, Q_CODEC_LOAD_DISK, (intptr_t)codec_fn);
2537 return true; 2535 return true;
2538 } 2536 }
2539 else 2537 else
@@ -3569,7 +3567,7 @@ static void audio_thread(void)
3569 3567
3570 while (1) 3568 while (1)
3571 { 3569 {
3572 void *result = NULL; 3570 intptr_t result = 0;
3573 3571
3574 if (filling) 3572 if (filling)
3575 { 3573 {
@@ -3643,18 +3641,18 @@ static void audio_thread(void)
3643 3641
3644 case Q_AUDIO_REBUFFER_SEEK: 3642 case Q_AUDIO_REBUFFER_SEEK:
3645 LOGFQUEUE("audio < Q_AUDIO_REBUFFER_SEEK"); 3643 LOGFQUEUE("audio < Q_AUDIO_REBUFFER_SEEK");
3646 result = (void *)(intptr_t)audio_rebuffer_and_seek((size_t)ev.data); 3644 result = audio_rebuffer_and_seek(ev.data);
3647 break; 3645 break;
3648 3646
3649 case Q_AUDIO_CHECK_NEW_TRACK: 3647 case Q_AUDIO_CHECK_NEW_TRACK:
3650 LOGFQUEUE("audio < Q_AUDIO_CHECK_NEW_TRACK"); 3648 LOGFQUEUE("audio < Q_AUDIO_CHECK_NEW_TRACK");
3651 result = (void *)(intptr_t)audio_check_new_track(); 3649 result = audio_check_new_track();
3652 break; 3650 break;
3653 3651
3654 case Q_AUDIO_DIR_SKIP: 3652 case Q_AUDIO_DIR_SKIP:
3655 LOGFQUEUE("audio < Q_AUDIO_DIR_SKIP"); 3653 LOGFQUEUE("audio < Q_AUDIO_DIR_SKIP");
3656 playlist_end = false; 3654 playlist_end = false;
3657 audio_initiate_dir_change((long)ev.data); 3655 audio_initiate_dir_change(ev.data);
3658 break; 3656 break;
3659 3657
3660 case Q_AUDIO_NEW_PLAYLIST: 3658 case Q_AUDIO_NEW_PLAYLIST:
diff --git a/apps/plugin.h b/apps/plugin.h
index 5b5215f9e9..6fad78edd7 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -354,7 +354,7 @@ struct plugin_api {
354#endif 354#endif
355 void (*queue_init)(struct event_queue *q, bool register_queue); 355 void (*queue_init)(struct event_queue *q, bool register_queue);
356 void (*queue_delete)(struct event_queue *q); 356 void (*queue_delete)(struct event_queue *q);
357 void (*queue_post)(struct event_queue *q, long id, void *data); 357 void (*queue_post)(struct event_queue *q, long id, intptr_t data);
358 void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, 358 void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev,
359 int ticks); 359 int ticks);
360 void (*usb_acknowledge)(long id); 360 void (*usb_acknowledge)(long id);
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 7e439cbd53..bf0c2f32dd 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -141,7 +141,7 @@ bool exit_tsr(bool reenter)
141 exit = false; 141 exit = false;
142 if (exit) 142 if (exit)
143 { 143 {
144 rb->queue_post(&thread_q, EV_EXIT, NULL); 144 rb->queue_post(&thread_q, EV_EXIT, 0);
145 while (!s_thread.ended) 145 while (!s_thread.ended)
146 rb->yield(); 146 rb->yield();
147 /* remove the thread's queue from the broadcast list */ 147 /* remove the thread's queue from the broadcast list */
diff --git a/firmware/backlight.c b/firmware/backlight.c
index b794f23056..a2d35302eb 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -213,7 +213,7 @@ static void backlight_isr(void)
213 if (idle) 213 if (idle)
214 { 214 {
215#ifdef CPU_COLDFIRE 215#ifdef CPU_COLDFIRE
216 queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, NULL); 216 queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, 0);
217#endif 217#endif
218 timer_unregister(); 218 timer_unregister();
219 bl_timer_active = false; 219 bl_timer_active = false;
@@ -530,7 +530,7 @@ static void backlight_tick(void)
530 if(lcd_sleep_timer == 0) 530 if(lcd_sleep_timer == 0)
531 { 531 {
532 /* Queue on bl thread or freeze! */ 532 /* Queue on bl thread or freeze! */
533 queue_post(&backlight_queue, LCD_SLEEP, NULL); 533 queue_post(&backlight_queue, LCD_SLEEP, 0);
534 } 534 }
535 } 535 }
536#endif /* HAVE_LCD_SLEEP */ 536#endif /* HAVE_LCD_SLEEP */
@@ -579,7 +579,7 @@ void x5_backlight_shutdown(void)
579 queue_empty(&backlight_queue); 579 queue_empty(&backlight_queue);
580 tick_remove_task(backlight_tick); 580 tick_remove_task(backlight_tick);
581 /* Next time the thread runs, if at all, it will just remove itself. */ 581 /* Next time the thread runs, if at all, it will just remove itself. */
582 queue_post(&backlight_queue, BACKLIGHT_QUIT, NULL); 582 queue_post(&backlight_queue, BACKLIGHT_QUIT, 0);
583 __backlight_on(); 583 __backlight_on();
584} 584}
585#endif /* X5_BACKLIGHT_SHUTDOWN */ 585#endif /* X5_BACKLIGHT_SHUTDOWN */
@@ -587,12 +587,12 @@ void x5_backlight_shutdown(void)
587void backlight_on(void) 587void backlight_on(void)
588{ 588{
589 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON); 589 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
590 queue_post(&backlight_queue, BACKLIGHT_ON, NULL); 590 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
591} 591}
592 592
593void backlight_off(void) 593void backlight_off(void)
594{ 594{
595 queue_post(&backlight_queue, BACKLIGHT_OFF, NULL); 595 queue_post(&backlight_queue, BACKLIGHT_OFF, 0);
596} 596}
597 597
598/* returns true when the backlight is on OR when it's set to always off */ 598/* returns true when the backlight is on OR when it's set to always off */
@@ -692,12 +692,12 @@ void lcd_set_sleep_after_backlight_off(int index)
692#ifdef HAVE_REMOTE_LCD 692#ifdef HAVE_REMOTE_LCD
693void remote_backlight_on(void) 693void remote_backlight_on(void)
694{ 694{
695 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, NULL); 695 queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0);
696} 696}
697 697
698void remote_backlight_off(void) 698void remote_backlight_off(void)
699{ 699{
700 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, NULL); 700 queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0);
701} 701}
702 702
703void remote_backlight_set_timeout(int index) 703void remote_backlight_set_timeout(int index)
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 800bd1a31a..8c591253f9 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -571,7 +571,7 @@ static int ata_perform_sleep(void)
571 571
572void ata_sleep(void) 572void ata_sleep(void)
573{ 573{
574 queue_post(&ata_queue, Q_SLEEP, NULL); 574 queue_post(&ata_queue, Q_SLEEP, 0);
575} 575}
576 576
577void ata_sleepnow(void) 577void ata_sleepnow(void)
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index deaf7f2fdd..cab62f950c 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -85,7 +85,7 @@ static void button_tick(void)
85 btn = remote_control_rx(); 85 btn = remote_control_rx();
86 if(btn) 86 if(btn)
87 { 87 {
88 queue_post(&button_queue, btn, NULL); 88 queue_post(&button_queue, btn, 0);
89 } 89 }
90#endif 90#endif
91 91
@@ -94,13 +94,13 @@ static void button_tick(void)
94 { 94 {
95 if (! phones_present ) 95 if (! phones_present )
96 { 96 {
97 queue_post(&button_queue, SYS_PHONE_PLUGGED, NULL); 97 queue_post(&button_queue, SYS_PHONE_PLUGGED, 0);
98 phones_present = true; 98 phones_present = true;
99 } 99 }
100 } else { 100 } else {
101 if ( phones_present ) 101 if ( phones_present )
102 { 102 {
103 queue_post(&button_queue, SYS_PHONE_UNPLUGGED, NULL); 103 queue_post(&button_queue, SYS_PHONE_UNPLUGGED, 0);
104 phones_present = false; 104 phones_present = false;
105 } 105 }
106 } 106 }
@@ -116,17 +116,17 @@ static void button_tick(void)
116#ifdef HAVE_REMOTE_LCD 116#ifdef HAVE_REMOTE_LCD
117 if(diff & BUTTON_REMOTE) 117 if(diff & BUTTON_REMOTE)
118 if(!skip_remote_release) 118 if(!skip_remote_release)
119 queue_post(&button_queue, BUTTON_REL | diff, NULL); 119 queue_post(&button_queue, BUTTON_REL | diff, 0);
120 else 120 else
121 skip_remote_release = false; 121 skip_remote_release = false;
122 else 122 else
123#endif 123#endif
124 if(!skip_release) 124 if(!skip_release)
125 queue_post(&button_queue, BUTTON_REL | diff, NULL); 125 queue_post(&button_queue, BUTTON_REL | diff, 0);
126 else 126 else
127 skip_release = false; 127 skip_release = false;
128#else 128#else
129 queue_post(&button_queue, BUTTON_REL | diff, NULL); 129 queue_post(&button_queue, BUTTON_REL | diff, 0);
130#endif 130#endif
131 } 131 }
132 else 132 else
@@ -201,7 +201,7 @@ static void button_tick(void)
201 * to avoid afterscroll effects. */ 201 * to avoid afterscroll effects. */
202 if (queue_empty(&button_queue)) 202 if (queue_empty(&button_queue))
203 { 203 {
204 queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); 204 queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
205#ifdef CONFIG_BACKLIGHT 205#ifdef CONFIG_BACKLIGHT
206#ifdef HAVE_REMOTE_LCD 206#ifdef HAVE_REMOTE_LCD
207 skip_remote_release = false; 207 skip_remote_release = false;
@@ -221,18 +221,18 @@ static void button_tick(void)
221 || (remote_type()==REMOTETYPE_H300_NONLCD) 221 || (remote_type()==REMOTETYPE_H300_NONLCD)
222#endif 222#endif
223 ) 223 )
224 queue_post(&button_queue, btn, NULL); 224 queue_post(&button_queue, btn, 0);
225 else 225 else
226 skip_remote_release = true; 226 skip_remote_release = true;
227 } 227 }
228 else 228 else
229#endif 229#endif
230 if (!filter_first_keypress || is_backlight_on()) 230 if (!filter_first_keypress || is_backlight_on())
231 queue_post(&button_queue, btn, NULL); 231 queue_post(&button_queue, btn, 0);
232 else 232 else
233 skip_release = true; 233 skip_release = true;
234#else /* no backlight, nothing to skip */ 234#else /* no backlight, nothing to skip */
235 queue_post(&button_queue, btn, NULL); 235 queue_post(&button_queue, btn, 0);
236#endif 236#endif
237 post = false; 237 post = false;
238 } 238 }
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index 23ffc3c06a..ec8aa28a08 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -20,6 +20,7 @@
20#define _KERNEL_H_ 20#define _KERNEL_H_
21 21
22#include <stdbool.h> 22#include <stdbool.h>
23#include <inttypes.h>
23#include "config.h" 24#include "config.h"
24 25
25/* wrap-safe macros for tick comparison */ 26/* wrap-safe macros for tick comparison */
@@ -51,15 +52,15 @@
51 52
52struct event 53struct event
53{ 54{
54 long id; 55 long id;
55 void *data; 56 intptr_t data;
56}; 57};
57 58
58#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME 59#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
59struct queue_sender 60struct queue_sender
60{ 61{
61 struct thread_entry *thread; 62 struct thread_entry *thread;
62 void *retval; 63 intptr_t retval;
63}; 64};
64 65
65struct queue_sender_list 66struct queue_sender_list
@@ -112,17 +113,17 @@ extern void queue_init(struct event_queue *q, bool register_queue);
112extern void queue_delete(struct event_queue *q); 113extern void queue_delete(struct event_queue *q);
113extern void queue_wait(struct event_queue *q, struct event *ev); 114extern void queue_wait(struct event_queue *q, struct event *ev);
114extern void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks); 115extern void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks);
115extern void queue_post(struct event_queue *q, long id, void *data); 116extern void queue_post(struct event_queue *q, long id, intptr_t data);
116#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME 117#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
117extern void queue_enable_queue_send(struct event_queue *q, struct queue_sender_list *send); 118extern void queue_enable_queue_send(struct event_queue *q, struct queue_sender_list *send);
118extern void * queue_send(struct event_queue *q, long id, void *data); 119extern intptr_t queue_send(struct event_queue *q, long id, intptr_t data);
119extern void queue_reply(struct event_queue *q, void *retval); 120extern void queue_reply(struct event_queue *q, intptr_t retval);
120extern bool queue_in_queue_send(struct event_queue *q); 121extern bool queue_in_queue_send(struct event_queue *q);
121#endif /* HAVE_EXTENDED_MESSAGING_AND_NAME */ 122#endif /* HAVE_EXTENDED_MESSAGING_AND_NAME */
122extern bool queue_empty(const struct event_queue* q); 123extern bool queue_empty(const struct event_queue* q);
123extern void queue_clear(struct event_queue* q); 124extern void queue_clear(struct event_queue* q);
124extern void queue_remove_from_head(struct event_queue *q, long id); 125extern void queue_remove_from_head(struct event_queue *q, long id);
125extern int queue_broadcast(long id, void *data); 126extern int queue_broadcast(long id, intptr_t data);
126 127
127extern void mutex_init(struct mutex *m); 128extern void mutex_init(struct mutex *m);
128extern void mutex_lock(struct mutex *m); 129extern void mutex_lock(struct mutex *m);
diff --git a/firmware/kernel.c b/firmware/kernel.c
index 55d78e0e0b..01adfcc57d 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -107,7 +107,8 @@ static void queue_fetch_sender(struct queue_sender_list *send,
107 107
108/* Puts the specified return value in the waiting thread's return value 108/* Puts the specified return value in the waiting thread's return value
109 and wakes the thread - a sender should be confirmed to exist first */ 109 and wakes the thread - a sender should be confirmed to exist first */
110static void queue_release_sender(struct queue_sender **sender, void *retval) 110static void queue_release_sender(struct queue_sender **sender,
111 intptr_t retval)
111{ 112{
112 (*sender)->retval = retval; 113 (*sender)->retval = retval;
113 wakeup_thread(&(*sender)->thread); 114 wakeup_thread(&(*sender)->thread);
@@ -127,7 +128,7 @@ static void queue_release_all_senders(struct event_queue *q)
127 &q->send->senders[i & QUEUE_LENGTH_MASK]; 128 &q->send->senders[i & QUEUE_LENGTH_MASK];
128 if(*spp) 129 if(*spp)
129 { 130 {
130 queue_release_sender(spp, NULL); 131 queue_release_sender(spp, 0);
131 } 132 }
132 } 133 }
133 } 134 }
@@ -242,7 +243,7 @@ void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
242 } 243 }
243} 244}
244 245
245void queue_post(struct event_queue *q, long id, void *data) 246void queue_post(struct event_queue *q, long id, intptr_t data)
246{ 247{
247 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 248 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
248 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; 249 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK;
@@ -258,7 +259,7 @@ void queue_post(struct event_queue *q, long id, void *data)
258 if(*spp) 259 if(*spp)
259 { 260 {
260 /* overflow protect - unblock any thread waiting at this index */ 261 /* overflow protect - unblock any thread waiting at this index */
261 queue_release_sender(spp, NULL); 262 queue_release_sender(spp, 0);
262 } 263 }
263 } 264 }
264#endif 265#endif
@@ -268,7 +269,7 @@ void queue_post(struct event_queue *q, long id, void *data)
268} 269}
269 270
270#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME 271#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
271void * queue_send(struct event_queue *q, long id, void *data) 272intptr_t queue_send(struct event_queue *q, long id, intptr_t data)
272{ 273{
273 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 274 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
274 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; 275 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK;
@@ -284,7 +285,7 @@ void * queue_send(struct event_queue *q, long id, void *data)
284 if(*spp) 285 if(*spp)
285 { 286 {
286 /* overflow protect - unblock any thread waiting at this index */ 287 /* overflow protect - unblock any thread waiting at this index */
287 queue_release_sender(spp, NULL); 288 queue_release_sender(spp, 0);
288 } 289 }
289 290
290 *spp = &sender; 291 *spp = &sender;
@@ -298,7 +299,7 @@ void * queue_send(struct event_queue *q, long id, void *data)
298 /* Function as queue_post if sending is not enabled */ 299 /* Function as queue_post if sending is not enabled */
299 wakeup_thread(&q->thread); 300 wakeup_thread(&q->thread);
300 set_irq_level(oldlevel); 301 set_irq_level(oldlevel);
301 return NULL; 302 return 0;
302} 303}
303 304
304#if 0 /* not used now but probably will be later */ 305#if 0 /* not used now but probably will be later */
@@ -310,7 +311,7 @@ bool queue_in_queue_send(struct event_queue *q)
310#endif 311#endif
311 312
312/* Replies with retval to any dequeued message sent with queue_send */ 313/* Replies with retval to any dequeued message sent with queue_send */
313void queue_reply(struct event_queue *q, void *retval) 314void queue_reply(struct event_queue *q, intptr_t retval)
314{ 315{
315 if(q->send && q->send->curr_sender) 316 if(q->send && q->send->curr_sender)
316 { 317 {
@@ -360,7 +361,7 @@ void queue_remove_from_head(struct event_queue *q, long id)
360 if(*spp) 361 if(*spp)
361 { 362 {
362 /* Release any thread waiting on this message */ 363 /* Release any thread waiting on this message */
363 queue_release_sender(spp, NULL); 364 queue_release_sender(spp, 0);
364 } 365 }
365 } 366 }
366#endif 367#endif
@@ -370,7 +371,7 @@ void queue_remove_from_head(struct event_queue *q, long id)
370 set_irq_level(oldlevel); 371 set_irq_level(oldlevel);
371} 372}
372 373
373int queue_broadcast(long id, void *data) 374int queue_broadcast(long id, intptr_t data)
374{ 375{
375 int i; 376 int i;
376 377
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index c9f48f2d97..d3e508a159 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -89,7 +89,7 @@ extern int playlist_update_resume_info(const struct mp3entry* id3);
89#define MPEG_PRERECORDING_TICK 104 89#define MPEG_PRERECORDING_TICK 104
90 90
91/* indicator for MPEG_NEED_DATA */ 91/* indicator for MPEG_NEED_DATA */
92#define GENERATE_UNBUFFER_EVENTS ((void*)1) 92#define GENERATE_UNBUFFER_EVENTS 1
93 93
94/* list of tracks in memory */ 94/* list of tracks in memory */
95#define MAX_TRACK_ENTRIES (1<<4) /* Must be power of 2 */ 95#define MAX_TRACK_ENTRIES (1<<4) /* Must be power of 2 */
@@ -2006,7 +2006,7 @@ static void mpeg_thread(void)
2006 break; 2006 break;
2007 2007
2008 case STOP_RECORDING: 2008 case STOP_RECORDING:
2009 queue_post(&mpeg_queue, MPEG_STOP_DONE, NULL); 2009 queue_post(&mpeg_queue, MPEG_STOP_DONE, 0);
2010 /* will close the file */ 2010 /* will close the file */
2011 break; 2011 break;
2012 2012
@@ -2123,7 +2123,7 @@ bool audio_has_changed_track(void)
2123void audio_init_playback(void) 2123void audio_init_playback(void)
2124{ 2124{
2125 init_playback_done = false; 2125 init_playback_done = false;
2126 queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL); 2126 queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, 0);
2127 2127
2128 while(!init_playback_done) 2128 while(!init_playback_done)
2129 sleep_thread(1); 2129 sleep_thread(1);
@@ -2137,7 +2137,7 @@ void audio_init_recording(unsigned int buffer_offset)
2137{ 2137{
2138 buffer_offset = buffer_offset; 2138 buffer_offset = buffer_offset;
2139 init_recording_done = false; 2139 init_recording_done = false;
2140 queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL); 2140 queue_post(&mpeg_queue, MPEG_INIT_RECORDING, 0);
2141 2141
2142 while(!init_recording_done) 2142 while(!init_recording_done)
2143 sleep_thread(1); 2143 sleep_thread(1);
@@ -2256,17 +2256,17 @@ void audio_record(const char *filename)
2256 strncpy(recording_filename, filename, MAX_PATH - 1); 2256 strncpy(recording_filename, filename, MAX_PATH - 1);
2257 recording_filename[MAX_PATH - 1] = 0; 2257 recording_filename[MAX_PATH - 1] = 0;
2258 2258
2259 queue_post(&mpeg_queue, MPEG_RECORD, NULL); 2259 queue_post(&mpeg_queue, MPEG_RECORD, 0);
2260} 2260}
2261 2261
2262void audio_pause_recording(void) 2262void audio_pause_recording(void)
2263{ 2263{
2264 queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, NULL); 2264 queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, 0);
2265} 2265}
2266 2266
2267void audio_resume_recording(void) 2267void audio_resume_recording(void)
2268{ 2268{
2269 queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, NULL); 2269 queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, 0);
2270} 2270}
2271 2271
2272static void prepend_header(void) 2272static void prepend_header(void)
@@ -2569,7 +2569,7 @@ void audio_new_file(const char *filename)
2569 strncpy(recording_filename, filename, MAX_PATH - 1); 2569 strncpy(recording_filename, filename, MAX_PATH - 1);
2570 recording_filename[MAX_PATH - 1] = 0; 2570 recording_filename[MAX_PATH - 1] = 0;
2571 2571
2572 queue_post(&mpeg_queue, MPEG_NEW_FILE, NULL); 2572 queue_post(&mpeg_queue, MPEG_NEW_FILE, 0);
2573} 2573}
2574 2574
2575unsigned long audio_recorded_time(void) 2575unsigned long audio_recorded_time(void)
@@ -2707,7 +2707,7 @@ void audio_play(long offset)
2707#else /* !SIMULATOR */ 2707#else /* !SIMULATOR */
2708 is_playing = true; 2708 is_playing = true;
2709 2709
2710 queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset); 2710 queue_post(&mpeg_queue, MPEG_PLAY, offset);
2711#endif /* !SIMULATOR */ 2711#endif /* !SIMULATOR */
2712 2712
2713 mpeg_errno = 0; 2713 mpeg_errno = 0;
@@ -2717,7 +2717,7 @@ void audio_stop(void)
2717{ 2717{
2718#ifndef SIMULATOR 2718#ifndef SIMULATOR
2719 mpeg_stop_done = false; 2719 mpeg_stop_done = false;
2720 queue_post(&mpeg_queue, MPEG_STOP, NULL); 2720 queue_post(&mpeg_queue, MPEG_STOP, 0);
2721 while(!mpeg_stop_done) 2721 while(!mpeg_stop_done)
2722 yield(); 2722 yield();
2723#else /* SIMULATOR */ 2723#else /* SIMULATOR */
@@ -2736,7 +2736,7 @@ void audio_stop_recording(void)
2736void audio_pause(void) 2736void audio_pause(void)
2737{ 2737{
2738#ifndef SIMULATOR 2738#ifndef SIMULATOR
2739 queue_post(&mpeg_queue, MPEG_PAUSE, NULL); 2739 queue_post(&mpeg_queue, MPEG_PAUSE, 0);
2740#else /* SIMULATOR */ 2740#else /* SIMULATOR */
2741 is_playing = true; 2741 is_playing = true;
2742 playing = false; 2742 playing = false;
@@ -2747,7 +2747,7 @@ void audio_pause(void)
2747void audio_resume(void) 2747void audio_resume(void)
2748{ 2748{
2749#ifndef SIMULATOR 2749#ifndef SIMULATOR
2750 queue_post(&mpeg_queue, MPEG_RESUME, NULL); 2750 queue_post(&mpeg_queue, MPEG_RESUME, 0);
2751#else /* SIMULATOR */ 2751#else /* SIMULATOR */
2752 is_playing = true; 2752 is_playing = true;
2753 playing = true; 2753 playing = true;
@@ -2759,7 +2759,7 @@ void audio_next(void)
2759{ 2759{
2760#ifndef SIMULATOR 2760#ifndef SIMULATOR
2761 queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA); 2761 queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA);
2762 queue_post(&mpeg_queue, MPEG_NEXT, NULL); 2762 queue_post(&mpeg_queue, MPEG_NEXT, 0);
2763#else /* SIMULATOR */ 2763#else /* SIMULATOR */
2764 char* file; 2764 char* file;
2765 int steps = 1; 2765 int steps = 1;
@@ -2788,7 +2788,7 @@ void audio_prev(void)
2788{ 2788{
2789#ifndef SIMULATOR 2789#ifndef SIMULATOR
2790 queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA); 2790 queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA);
2791 queue_post(&mpeg_queue, MPEG_PREV, NULL); 2791 queue_post(&mpeg_queue, MPEG_PREV, 0);
2792#else /* SIMULATOR */ 2792#else /* SIMULATOR */
2793 char* file; 2793 char* file;
2794 int steps = -1; 2794 int steps = -1;
@@ -2815,7 +2815,7 @@ void audio_prev(void)
2815void audio_ff_rewind(long newtime) 2815void audio_ff_rewind(long newtime)
2816{ 2816{
2817#ifndef SIMULATOR 2817#ifndef SIMULATOR
2818 queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime); 2818 queue_post(&mpeg_queue, MPEG_FF_REWIND, newtime);
2819#else /* SIMULATOR */ 2819#else /* SIMULATOR */
2820 (void)newtime; 2820 (void)newtime;
2821#endif /* SIMULATOR */ 2821#endif /* SIMULATOR */
@@ -2824,7 +2824,7 @@ void audio_ff_rewind(long newtime)
2824void audio_flush_and_reload_tracks(void) 2824void audio_flush_and_reload_tracks(void)
2825{ 2825{
2826#ifndef SIMULATOR 2826#ifndef SIMULATOR
2827 queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL); 2827 queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, 0);
2828#endif /* !SIMULATOR*/ 2828#endif /* !SIMULATOR*/
2829} 2829}
2830 2830
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index f03939bd3c..b826763370 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -249,7 +249,7 @@ static int pcm_rec_have_more(int status)
249 if (status == DMA_REC_ERROR_DMA) 249 if (status == DMA_REC_ERROR_DMA)
250 { 250 {
251 /* Flush recorded data to disk and stop recording */ 251 /* Flush recorded data to disk and stop recording */
252 queue_post(&pcmrec_queue, PCMREC_STOP, NULL); 252 queue_post(&pcmrec_queue, PCMREC_STOP, 0);
253 return -1; 253 return -1;
254 } 254 }
255 /* else try again next transmission */ 255 /* else try again next transmission */
@@ -388,7 +388,7 @@ void pcm_rec_init(void)
388void audio_init_recording(unsigned int buffer_offset) 388void audio_init_recording(unsigned int buffer_offset)
389{ 389{
390 logf("audio_init_recording"); 390 logf("audio_init_recording");
391 queue_send(&pcmrec_queue, PCMREC_INIT, NULL); 391 queue_send(&pcmrec_queue, PCMREC_INIT, 0);
392 logf("audio_init_recording done"); 392 logf("audio_init_recording done");
393 (void)buffer_offset; 393 (void)buffer_offset;
394} /* audio_init_recording */ 394} /* audio_init_recording */
@@ -399,7 +399,7 @@ void audio_init_recording(unsigned int buffer_offset)
399void audio_close_recording(void) 399void audio_close_recording(void)
400{ 400{
401 logf("audio_close_recording"); 401 logf("audio_close_recording");
402 queue_send(&pcmrec_queue, PCMREC_CLOSE, NULL); 402 queue_send(&pcmrec_queue, PCMREC_CLOSE, 0);
403 logf("audio_close_recording done"); 403 logf("audio_close_recording done");
404} /* audio_close_recording */ 404} /* audio_close_recording */
405 405
@@ -409,7 +409,7 @@ void audio_close_recording(void)
409void audio_set_recording_options(struct audio_recording_options *options) 409void audio_set_recording_options(struct audio_recording_options *options)
410{ 410{
411 logf("audio_set_recording_options"); 411 logf("audio_set_recording_options");
412 queue_send(&pcmrec_queue, PCMREC_OPTIONS, (void *)options); 412 queue_send(&pcmrec_queue, PCMREC_OPTIONS, (intptr_t)options);
413 logf("audio_set_recording_options done"); 413 logf("audio_set_recording_options done");
414} /* audio_set_recording_options */ 414} /* audio_set_recording_options */
415 415
@@ -419,7 +419,7 @@ void audio_set_recording_options(struct audio_recording_options *options)
419void audio_record(const char *filename) 419void audio_record(const char *filename)
420{ 420{
421 logf("audio_record: %s", filename); 421 logf("audio_record: %s", filename);
422 queue_send(&pcmrec_queue, PCMREC_RECORD, (void *)filename); 422 queue_send(&pcmrec_queue, PCMREC_RECORD, (intptr_t)filename);
423 logf("audio_record_done"); 423 logf("audio_record_done");
424} /* audio_record */ 424} /* audio_record */
425 425
@@ -429,7 +429,7 @@ void audio_record(const char *filename)
429void audio_stop_recording(void) 429void audio_stop_recording(void)
430{ 430{
431 logf("audio_stop_recording"); 431 logf("audio_stop_recording");
432 queue_send(&pcmrec_queue, PCMREC_STOP, NULL); 432 queue_send(&pcmrec_queue, PCMREC_STOP, 0);
433 logf("audio_stop_recording done"); 433 logf("audio_stop_recording done");
434} /* audio_stop_recording */ 434} /* audio_stop_recording */
435 435
@@ -439,7 +439,7 @@ void audio_stop_recording(void)
439void audio_pause_recording(void) 439void audio_pause_recording(void)
440{ 440{
441 logf("audio_pause_recording"); 441 logf("audio_pause_recording");
442 queue_send(&pcmrec_queue, PCMREC_PAUSE, NULL); 442 queue_send(&pcmrec_queue, PCMREC_PAUSE, 0);
443 logf("audio_pause_recording done"); 443 logf("audio_pause_recording done");
444} /* audio_pause_recording */ 444} /* audio_pause_recording */
445 445
@@ -449,7 +449,7 @@ void audio_pause_recording(void)
449void audio_resume_recording(void) 449void audio_resume_recording(void)
450{ 450{
451 logf("audio_resume_recording"); 451 logf("audio_resume_recording");
452 queue_send(&pcmrec_queue, PCMREC_RESUME, NULL); 452 queue_send(&pcmrec_queue, PCMREC_RESUME, 0);
453 logf("audio_resume_recording done"); 453 logf("audio_resume_recording done");
454} /* audio_resume_recording */ 454} /* audio_resume_recording */
455 455
@@ -1069,7 +1069,7 @@ static void pcmrec_new_stream(const char *filename, /* next file name */
1069 flush will hang the screen for a bit otherwise */ 1069 flush will hang the screen for a bit otherwise */
1070 strncpy(buf, filename, MAX_PATH); 1070 strncpy(buf, filename, MAX_PATH);
1071 filename = buf; 1071 filename = buf;
1072 queue_reply(&pcmrec_queue, NULL); 1072 queue_reply(&pcmrec_queue, 0);
1073 pcmrec_flush(-1); 1073 pcmrec_flush(-1);
1074 } 1074 }
1075 1075
@@ -1182,7 +1182,7 @@ static void pcmrec_set_recording_options(struct audio_recording_options *options
1182 /* apply pcm settings to hardware */ 1182 /* apply pcm settings to hardware */
1183 pcm_apply_settings(true); 1183 pcm_apply_settings(true);
1184 1184
1185 queue_reply(&pcmrec_queue, NULL); /* Release sender */ 1185 queue_reply(&pcmrec_queue, 0); /* Release sender */
1186 1186
1187 if (audio_load_encoder(enc_config.afmt)) 1187 if (audio_load_encoder(enc_config.afmt))
1188 { 1188 {
@@ -1310,7 +1310,7 @@ static void pcmrec_stop(void)
1310 } 1310 }
1311 1311
1312 dma_lock = true; /* lock dma write position */ 1312 dma_lock = true; /* lock dma write position */
1313 queue_reply(&pcmrec_queue, NULL); 1313 queue_reply(&pcmrec_queue, 0);
1314 1314
1315 /* flush all available data first to avoid overflow while waiting 1315 /* flush all available data first to avoid overflow while waiting
1316 for encoding to finish */ 1316 for encoding to finish */
@@ -1470,7 +1470,7 @@ static void pcmrec_thread(void)
1470 break; 1470 break;
1471 } /* end switch */ 1471 } /* end switch */
1472 1472
1473 queue_reply(&pcmrec_queue, NULL); 1473 queue_reply(&pcmrec_queue, 0);
1474 } /* end while */ 1474 } /* end while */
1475} /* pcmrec_thread */ 1475} /* pcmrec_thread */
1476 1476
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 90ac492fc8..6c7f96baad 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -784,7 +784,7 @@ static void power_thread_sleep(int ticks)
784 charger_input_state = CHARGER_PLUGGED; 784 charger_input_state = CHARGER_PLUGGED;
785 return; 785 return;
786 case CHARGER_PLUGGED: 786 case CHARGER_PLUGGED:
787 queue_broadcast(SYS_CHARGER_CONNECTED, NULL); 787 queue_broadcast(SYS_CHARGER_CONNECTED, 0);
788 charger_input_state = CHARGER; 788 charger_input_state = CHARGER;
789 break; 789 break;
790 case CHARGER: 790 case CHARGER:
@@ -795,7 +795,7 @@ static void power_thread_sleep(int ticks)
795 case NO_CHARGER: 795 case NO_CHARGER:
796 break; 796 break;
797 case CHARGER_UNPLUGGED: 797 case CHARGER_UNPLUGGED:
798 queue_broadcast(SYS_CHARGER_DISCONNECTED, NULL); 798 queue_broadcast(SYS_CHARGER_DISCONNECTED, 0);
799 charger_input_state = NO_CHARGER; 799 charger_input_state = NO_CHARGER;
800 break; 800 break;
801 case CHARGER_PLUGGED: 801 case CHARGER_PLUGGED:
@@ -1279,7 +1279,7 @@ void sys_poweroff(void)
1279 shutdown_timeout += HZ*20; 1279 shutdown_timeout += HZ*20;
1280 } 1280 }
1281 1281
1282 queue_post(&button_queue, SYS_POWEROFF, NULL); 1282 queue_post(&button_queue, SYS_POWEROFF, 0);
1283} 1283}
1284 1284
1285void cancel_shutdown(void) 1285void cancel_shutdown(void)
diff --git a/firmware/target/arm/ipod/3g/button-3g.c b/firmware/target/arm/ipod/3g/button-3g.c
index 25afd42095..e9b0c5e3b6 100644
--- a/firmware/target/arm/ipod/3g/button-3g.c
+++ b/firmware/target/arm/ipod/3g/button-3g.c
@@ -93,7 +93,7 @@ void handle_scroll_wheel(int new_scroll, int was_hold, int reverse)
93 } 93 }
94 } 94 }
95 if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) 95 if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue))
96 queue_post(&button_queue, wheel_keycode, NULL); 96 queue_post(&button_queue, wheel_keycode, 0);
97 prev_scroll = new_scroll; 97 prev_scroll = new_scroll;
98} 98}
99 99
diff --git a/firmware/target/arm/ipod/button-clickwheel.c b/firmware/target/arm/ipod/button-clickwheel.c
index 6cac037155..79107884c5 100644
--- a/firmware/target/arm/ipod/button-clickwheel.c
+++ b/firmware/target/arm/ipod/button-clickwheel.c
@@ -139,7 +139,7 @@ static inline int ipod_4g_button_read(void)
139 { 139 {
140 data = (wheel_delta << 16) | new_wheel_value; 140 data = (wheel_delta << 16) | new_wheel_value;
141 queue_post(&button_queue, wheel_keycode | wheel_repeat, 141 queue_post(&button_queue, wheel_keycode | wheel_repeat,
142 (void *)data); 142 data);
143 } 143 }
144 144
145 if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT; 145 if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT;
diff --git a/firmware/target/arm/ipod/button-mini1g.c b/firmware/target/arm/ipod/button-mini1g.c
index f979991141..4a9a9ee310 100644
--- a/firmware/target/arm/ipod/button-mini1g.c
+++ b/firmware/target/arm/ipod/button-mini1g.c
@@ -100,7 +100,7 @@ void handle_scroll_wheel(int new_scroll, int was_hold, int reverse)
100 } 100 }
101 } 101 }
102 if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) 102 if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue))
103 queue_post(&button_queue, wheel_keycode, NULL); 103 queue_post(&button_queue, wheel_keycode, 0);
104 prev_scroll = new_scroll; 104 prev_scroll = new_scroll;
105} 105}
106 106
diff --git a/firmware/usb.c b/firmware/usb.c
index 5c800bde03..f585544024 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -235,7 +235,7 @@ static void usb_thread(void)
235 /* Tell all threads that they have to back off the ATA. 235 /* Tell all threads that they have to back off the ATA.
236 We subtract one for our own thread. */ 236 We subtract one for our own thread. */
237 num_acks_to_expect = 237 num_acks_to_expect =
238 queue_broadcast(SYS_USB_CONNECTED, NULL) - 1; 238 queue_broadcast(SYS_USB_CONNECTED, 0) - 1;
239 waiting_for_ack = true; 239 waiting_for_ack = true;
240 DEBUGF("USB inserted. Waiting for ack from %d threads...\n", 240 DEBUGF("USB inserted. Waiting for ack from %d threads...\n",
241 num_acks_to_expect); 241 num_acks_to_expect);
@@ -290,7 +290,7 @@ static void usb_thread(void)
290 290
291 /* Tell all threads that we are back in business */ 291 /* Tell all threads that we are back in business */
292 num_acks_to_expect = 292 num_acks_to_expect =
293 queue_broadcast(SYS_USB_DISCONNECTED, NULL) - 1; 293 queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1;
294 waiting_for_ack = true; 294 waiting_for_ack = true;
295 DEBUGF("USB extracted. Waiting for ack from %d threads...\n", 295 DEBUGF("USB extracted. Waiting for ack from %d threads...\n",
296 num_acks_to_expect); 296 num_acks_to_expect);
@@ -392,9 +392,9 @@ static void usb_tick(void)
392 if(countdown == 0) 392 if(countdown == 0)
393 { 393 {
394 if(current_status) 394 if(current_status)
395 queue_post(&usb_queue, USB_INSERTED, NULL); 395 queue_post(&usb_queue, USB_INSERTED, 0);
396 else 396 else
397 queue_post(&usb_queue, USB_EXTRACTED, NULL); 397 queue_post(&usb_queue, USB_EXTRACTED, 0);
398 } 398 }
399 } 399 }
400 } 400 }
@@ -403,7 +403,7 @@ static void usb_tick(void)
403 { 403 {
404 usb_mmc_countdown--; 404 usb_mmc_countdown--;
405 if (usb_mmc_countdown == 0) 405 if (usb_mmc_countdown == 0)
406 queue_post(&usb_queue, USB_REENABLE, NULL); 406 queue_post(&usb_queue, USB_REENABLE, 0);
407 } 407 }
408#endif 408#endif
409} 409}
@@ -411,7 +411,7 @@ static void usb_tick(void)
411 411
412void usb_acknowledge(long id) 412void usb_acknowledge(long id)
413{ 413{
414 queue_post(&usb_queue, id, NULL); 414 queue_post(&usb_queue, id, 0);
415} 415}
416 416
417void usb_init(void) 417void usb_init(void)
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index 777c9d1b95..6931d13fe5 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -481,17 +481,17 @@ void button_event(int key, bool pressed)
481#ifdef HAVE_REMOTE_LCD 481#ifdef HAVE_REMOTE_LCD
482 if(diff & BUTTON_REMOTE) 482 if(diff & BUTTON_REMOTE)
483 if(!skip_remote_release) 483 if(!skip_remote_release)
484 queue_post(&button_queue, BUTTON_REL | diff, NULL); 484 queue_post(&button_queue, BUTTON_REL | diff, 0);
485 else 485 else
486 skip_remote_release = false; 486 skip_remote_release = false;
487 else 487 else
488#endif 488#endif
489 if(!skip_release) 489 if(!skip_release)
490 queue_post(&button_queue, BUTTON_REL | diff, NULL); 490 queue_post(&button_queue, BUTTON_REL | diff, 0);
491 else 491 else
492 skip_release = false; 492 skip_release = false;
493#else 493#else
494 queue_post(&button_queue, BUTTON_REL | diff, NULL); 494 queue_post(&button_queue, BUTTON_REL | diff, 0);
495#endif 495#endif
496 } 496 }
497 497
@@ -543,7 +543,7 @@ void button_event(int key, bool pressed)
543 { 543 {
544 if (queue_empty(&button_queue)) 544 if (queue_empty(&button_queue))
545 { 545 {
546 queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); 546 queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
547#ifdef CONFIG_BACKLIGHT 547#ifdef CONFIG_BACKLIGHT
548#ifdef HAVE_REMOTE_LCD 548#ifdef HAVE_REMOTE_LCD
549 if(btn & BUTTON_REMOTE) 549 if(btn & BUTTON_REMOTE)
@@ -565,18 +565,18 @@ void button_event(int key, bool pressed)
565#ifdef HAVE_REMOTE_LCD 565#ifdef HAVE_REMOTE_LCD
566 if (btn & BUTTON_REMOTE) { 566 if (btn & BUTTON_REMOTE) {
567 if (!remote_filter_first_keypress || is_remote_backlight_on()) 567 if (!remote_filter_first_keypress || is_remote_backlight_on())
568 queue_post(&button_queue, btn, NULL); 568 queue_post(&button_queue, btn, 0);
569 else 569 else
570 skip_remote_release = true; 570 skip_remote_release = true;
571 } 571 }
572 else 572 else
573#endif 573#endif
574 if (!filter_first_keypress || is_backlight_on()) 574 if (!filter_first_keypress || is_backlight_on())
575 queue_post(&button_queue, btn, NULL); 575 queue_post(&button_queue, btn, 0);
576 else 576 else
577 skip_release = true; 577 skip_release = true;
578#else /* no backlight, nothing to skip */ 578#else /* no backlight, nothing to skip */
579 queue_post(&button_queue, btn, NULL); 579 queue_post(&button_queue, btn, 0);
580#endif 580#endif
581 post = false; 581 post = false;
582 } 582 }
diff --git a/uisimulator/sdl/kernel.c b/uisimulator/sdl/kernel.c
index fa573a3cc9..dddfa70066 100644
--- a/uisimulator/sdl/kernel.c
+++ b/uisimulator/sdl/kernel.c
@@ -53,7 +53,8 @@ static void queue_fetch_sender(struct queue_sender_list *send,
53 53
54/* Puts the specified return value in the waiting thread's return value 54/* Puts the specified return value in the waiting thread's return value
55 and wakes the thread - a sender should be confirmed to exist first */ 55 and wakes the thread - a sender should be confirmed to exist first */
56static void queue_release_sender(struct queue_sender **sender, void *retval) 56static void queue_release_sender(struct queue_sender **sender,
57 intptr_t retval)
57{ 58{
58 (*sender)->retval = retval; 59 (*sender)->retval = retval;
59 *sender = NULL; 60 *sender = NULL;
@@ -72,7 +73,7 @@ static void queue_release_all_senders(struct event_queue *q)
72 &q->send->senders[i & QUEUE_LENGTH_MASK]; 73 &q->send->senders[i & QUEUE_LENGTH_MASK];
73 if(*spp) 74 if(*spp)
74 { 75 {
75 queue_release_sender(spp, NULL); 76 queue_release_sender(spp, 0);
76 } 77 }
77 } 78 }
78 } 79 }
@@ -154,7 +155,7 @@ void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks)
154 } 155 }
155} 156}
156 157
157void queue_post(struct event_queue *q, long id, void *data) 158void queue_post(struct event_queue *q, long id, intptr_t data)
158{ 159{
159 int oldlevel = set_irq_level(15<<4); 160 int oldlevel = set_irq_level(15<<4);
160 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; 161 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK;
@@ -170,7 +171,7 @@ void queue_post(struct event_queue *q, long id, void *data)
170 if(*spp) 171 if(*spp)
171 { 172 {
172 /* overflow protect - unblock any thread waiting at this index */ 173 /* overflow protect - unblock any thread waiting at this index */
173 queue_release_sender(spp, NULL); 174 queue_release_sender(spp, 0);
174 } 175 }
175 } 176 }
176#endif 177#endif
@@ -179,7 +180,7 @@ void queue_post(struct event_queue *q, long id, void *data)
179} 180}
180 181
181#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME 182#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
182void * queue_send(struct event_queue *q, long id, void *data) 183intptr_t queue_send(struct event_queue *q, long id, intptr_t data)
183{ 184{
184 int oldlevel = set_irq_level(15<<4); 185 int oldlevel = set_irq_level(15<<4);
185 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; 186 unsigned int wr = q->write++ & QUEUE_LENGTH_MASK;
@@ -195,7 +196,7 @@ void * queue_send(struct event_queue *q, long id, void *data)
195 if(*spp) 196 if(*spp)
196 { 197 {
197 /* overflow protect - unblock any thread waiting at this index */ 198 /* overflow protect - unblock any thread waiting at this index */
198 queue_release_sender(spp, NULL); 199 queue_release_sender(spp, 0);
199 } 200 }
200 201
201 *spp = &sender; 202 *spp = &sender;
@@ -211,7 +212,7 @@ void * queue_send(struct event_queue *q, long id, void *data)
211 212
212 /* Function as queue_post if sending is not enabled */ 213 /* Function as queue_post if sending is not enabled */
213 set_irq_level(oldlevel); 214 set_irq_level(oldlevel);
214 return NULL; 215 return 0;
215} 216}
216 217
217#if 0 /* not used now but probably will be later */ 218#if 0 /* not used now but probably will be later */
@@ -223,7 +224,7 @@ bool queue_in_queue_send(struct event_queue *q)
223#endif 224#endif
224 225
225/* Replies with retval to any dequeued message sent with queue_send */ 226/* Replies with retval to any dequeued message sent with queue_send */
226void queue_reply(struct event_queue *q, void *retval) 227void queue_reply(struct event_queue *q, intptr_t retval)
227{ 228{
228 if(q->send && q->send->curr_sender) 229 if(q->send && q->send->curr_sender)
229 { 230 {
@@ -270,7 +271,7 @@ void queue_remove_from_head(struct event_queue *q, long id)
270 if(*spp) 271 if(*spp)
271 { 272 {
272 /* Release any thread waiting on this message */ 273 /* Release any thread waiting on this message */
273 queue_release_sender(spp, NULL); 274 queue_release_sender(spp, 0);
274 } 275 }
275 } 276 }
276#endif 277#endif