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, LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); queue_post(&voice_queue, Q_VOICE_STOP, 0); LOGFQUEUE("mp3 > voice Q_VOICE_PLAY"); - queue_post(&voice_queue, Q_VOICE_PLAY, &voice_clip); + queue_post(&voice_queue, Q_VOICE_PLAY, (intptr_t)&voice_clip); voice_thread_start = true; trigger_cpu_boost(); #else @@ -355,7 +355,7 @@ void mp3_play_stop(void) #ifdef PLAYBACK_VOICE queue_remove_from_head(&voice_queue, Q_VOICE_STOP); LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); - queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); + queue_post(&voice_queue, Q_VOICE_STOP, 1); #endif } @@ -500,7 +500,7 @@ bool audio_load_encoder(int afmt) ci.enc_codec_loaded = 0; /* clear any previous error condition */ LOGFQUEUE("audio > Q_AUDIO_LOAD_ENCODER"); - queue_post(&audio_queue, Q_AUDIO_LOAD_ENCODER, (void *)enc_fn); + queue_post(&audio_queue, Q_AUDIO_LOAD_ENCODER, (intptr_t)enc_fn); while (ci.enc_codec_loaded == 0) yield(); @@ -601,7 +601,7 @@ void audio_play(long offset) /* Truncate any existing voice output so we don't have spelling * etc. over the first part of the played track */ LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); - queue_post(&voice_queue, Q_VOICE_STOP, (void *)1); + queue_post(&voice_queue, Q_VOICE_STOP, 1); #endif /* Start playback */ @@ -615,7 +615,7 @@ void audio_play(long offset) LOGFQUEUE("audio > audio Q_AUDIO_STOP"); queue_post(&audio_queue, Q_AUDIO_STOP, 0); LOGFQUEUE("audio > audio Q_AUDIO_PLAY"); - queue_post(&audio_queue, Q_AUDIO_PLAY, (void *)offset); + queue_post(&audio_queue, Q_AUDIO_PLAY, offset); } /* Don't return until playback has actually started */ @@ -637,13 +637,13 @@ void audio_stop(void) void audio_pause(void) { LOGFQUEUE("audio > audio Q_AUDIO_PAUSE"); - queue_post(&audio_queue, Q_AUDIO_PAUSE, (void *)true); + queue_post(&audio_queue, Q_AUDIO_PAUSE, true); } void audio_resume(void) { LOGFQUEUE("audio > audio Q_AUDIO_PAUSE resume"); - queue_post(&audio_queue, Q_AUDIO_PAUSE, (void *)false); + queue_post(&audio_queue, Q_AUDIO_PAUSE, false); } void audio_next(void) @@ -654,7 +654,7 @@ void audio_next(void) pcmbuf_beep(5000, 100, 2500*global_settings.beep); LOGFQUEUE("audio > audio Q_AUDIO_SKIP 1"); - queue_post(&audio_queue, Q_AUDIO_SKIP, (void *)1); + queue_post(&audio_queue, Q_AUDIO_SKIP, 1); /* Keep wps fast while our message travels inside deep playback queues. */ wps_offset++; track_changed = true; @@ -675,7 +675,7 @@ void audio_prev(void) pcmbuf_beep(5000, 100, 2500*global_settings.beep); LOGFQUEUE("audio > audio Q_AUDIO_SKIP -1"); - queue_post(&audio_queue, Q_AUDIO_SKIP, (void *)-1); + queue_post(&audio_queue, Q_AUDIO_SKIP, -1); /* Keep wps fast while our message travels inside deep playback queues. */ wps_offset--; track_changed = true; @@ -691,13 +691,13 @@ void audio_prev(void) void audio_next_dir(void) { LOGFQUEUE("audio > audio Q_AUDIO_DIR_SKIP 1"); - queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, (void *)1); + queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, 1); } void audio_prev_dir(void) { LOGFQUEUE("audio > audio Q_AUDIO_DIR_SKIP -1"); - queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, (void *)-1); + queue_post(&audio_queue, Q_AUDIO_DIR_SKIP, -1); } void audio_pre_ff_rewind(void) @@ -709,7 +709,7 @@ void audio_pre_ff_rewind(void) void audio_ff_rewind(long newpos) { LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND"); - queue_post(&audio_queue, Q_AUDIO_FF_REWIND, (int *)newpos); + queue_post(&audio_queue, Q_AUDIO_FF_REWIND, newpos); } void audio_flush_and_reload_tracks(void) @@ -1139,7 +1139,7 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize) case Q_VOICE_STOP: LOGFQUEUE("voice < Q_VOICE_STOP"); - if (ev.data == (void *)1 && !playing && pcm_is_playing()) + if (ev.data == 1 && !playing && pcm_is_playing()) { /* Aborting: Slight hack - flush PCM buffer if only being used for voice */ @@ -1192,7 +1192,7 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize) voice_is_playing = true; trigger_cpu_boost(); - voice_data = ev.data; + voice_data = (struct voice_info *)ev.data; voice_remaining = voice_data->size; voicebuf = voice_data->buf; voice_getmore = voice_data->callback; @@ -1573,11 +1573,11 @@ static void codec_advance_buffer_callback(size_t amount) if (amount > CUR_TI->available) { - int result; + intptr_t result; LOGFQUEUE("codec >| audio Q_AUDIO_REBUFFER_SEEK"); - result = (int)(intptr_t)queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, - (void *)(uintptr_t)(ci.curpos + amount)); + result = queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, + ci.curpos + amount); switch (result) { @@ -1716,11 +1716,10 @@ static bool codec_seek_buffer_callback(size_t newpos) /* We need to reload the song. */ if (newpos < CUR_TI->start_pos) { - int result; + intptr_t result; LOGFQUEUE("codec >| audio Q_AUDIO_REBUFFER_SEEK"); - result = (int)(intptr_t)queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, - (void *)(uintptr_t)newpos); + result = queue_send(&audio_queue, Q_AUDIO_REBUFFER_SEEK, newpos); switch (result) { @@ -1851,7 +1850,7 @@ static void codec_track_skip_done(bool was_manual) static bool codec_load_next_track(void) { - int result; + intptr_t result; prev_track_elapsed = CUR_TI->id3.elapsed; @@ -1872,8 +1871,7 @@ static bool codec_load_next_track(void) trigger_cpu_boost(); LOGFQUEUE("codec >| audio Q_AUDIO_CHECK_NEW_TRACK"); - result = (int)(intptr_t)queue_send(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, - NULL); + result = queue_send(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0); #if 0 /* Q_CODEC_REQUEST_PENDING never posted anyway */ while (1) @@ -2007,7 +2005,7 @@ static void codec_thread(void) if (voice_codec_loaded && current_codec == CODEC_IDX_VOICE) { LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); - queue_post(&voice_queue, Q_ENCODER_RECORD, NULL); + queue_post(&voice_queue, Q_ENCODER_RECORD, 0); } mutex_lock(&mutex_codecthread); #endif @@ -2097,7 +2095,7 @@ static void codec_thread(void) const char *codec_fn = get_codec_filename(CUR_TI->id3.codectype); LOGFQUEUE("codec > codec Q_CODEC_LOAD_DISK"); queue_post(&codec_queue, Q_CODEC_LOAD_DISK, - (void *)codec_fn); + (intptr_t)codec_fn); } } break; @@ -2533,7 +2531,7 @@ static bool audio_loadcodec(bool start_play) ci.taginfo_ready = &CUR_TI->taginfo_ready; ci.curpos = 0; LOGFQUEUE("codec > codec Q_CODEC_LOAD_DISK"); - queue_post(&codec_queue, Q_CODEC_LOAD_DISK, (void *)codec_fn); + queue_post(&codec_queue, Q_CODEC_LOAD_DISK, (intptr_t)codec_fn); return true; } else @@ -3569,7 +3567,7 @@ static void audio_thread(void) while (1) { - void *result = NULL; + intptr_t result = 0; if (filling) { @@ -3643,18 +3641,18 @@ static void audio_thread(void) case Q_AUDIO_REBUFFER_SEEK: LOGFQUEUE("audio < Q_AUDIO_REBUFFER_SEEK"); - result = (void *)(intptr_t)audio_rebuffer_and_seek((size_t)ev.data); + result = audio_rebuffer_and_seek(ev.data); break; case Q_AUDIO_CHECK_NEW_TRACK: LOGFQUEUE("audio < Q_AUDIO_CHECK_NEW_TRACK"); - result = (void *)(intptr_t)audio_check_new_track(); + result = audio_check_new_track(); break; case Q_AUDIO_DIR_SKIP: LOGFQUEUE("audio < Q_AUDIO_DIR_SKIP"); playlist_end = false; - audio_initiate_dir_change((long)ev.data); + audio_initiate_dir_change(ev.data); break; 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 { #endif void (*queue_init)(struct event_queue *q, bool register_queue); void (*queue_delete)(struct event_queue *q); - void (*queue_post)(struct event_queue *q, long id, void *data); + void (*queue_post)(struct event_queue *q, long id, intptr_t data); void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, int ticks); 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) exit = false; if (exit) { - rb->queue_post(&thread_q, EV_EXIT, NULL); + rb->queue_post(&thread_q, EV_EXIT, 0); while (!s_thread.ended) rb->yield(); /* 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) if (idle) { #ifdef CPU_COLDFIRE - queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, NULL); + queue_post(&backlight_queue, BACKLIGHT_UNBOOST_CPU, 0); #endif timer_unregister(); bl_timer_active = false; @@ -530,7 +530,7 @@ static void backlight_tick(void) if(lcd_sleep_timer == 0) { /* Queue on bl thread or freeze! */ - queue_post(&backlight_queue, LCD_SLEEP, NULL); + queue_post(&backlight_queue, LCD_SLEEP, 0); } } #endif /* HAVE_LCD_SLEEP */ @@ -579,7 +579,7 @@ void x5_backlight_shutdown(void) queue_empty(&backlight_queue); tick_remove_task(backlight_tick); /* Next time the thread runs, if at all, it will just remove itself. */ - queue_post(&backlight_queue, BACKLIGHT_QUIT, NULL); + queue_post(&backlight_queue, BACKLIGHT_QUIT, 0); __backlight_on(); } #endif /* X5_BACKLIGHT_SHUTDOWN */ @@ -587,12 +587,12 @@ void x5_backlight_shutdown(void) void backlight_on(void) { queue_remove_from_head(&backlight_queue, BACKLIGHT_ON); - queue_post(&backlight_queue, BACKLIGHT_ON, NULL); + queue_post(&backlight_queue, BACKLIGHT_ON, 0); } void backlight_off(void) { - queue_post(&backlight_queue, BACKLIGHT_OFF, NULL); + queue_post(&backlight_queue, BACKLIGHT_OFF, 0); } /* 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) #ifdef HAVE_REMOTE_LCD void remote_backlight_on(void) { - queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, NULL); + queue_post(&backlight_queue, REMOTE_BACKLIGHT_ON, 0); } void remote_backlight_off(void) { - queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, NULL); + queue_post(&backlight_queue, REMOTE_BACKLIGHT_OFF, 0); } void 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) void ata_sleep(void) { - queue_post(&ata_queue, Q_SLEEP, NULL); + queue_post(&ata_queue, Q_SLEEP, 0); } void 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) btn = remote_control_rx(); if(btn) { - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); } #endif @@ -94,13 +94,13 @@ static void button_tick(void) { if (! phones_present ) { - queue_post(&button_queue, SYS_PHONE_PLUGGED, NULL); + queue_post(&button_queue, SYS_PHONE_PLUGGED, 0); phones_present = true; } } else { if ( phones_present ) { - queue_post(&button_queue, SYS_PHONE_UNPLUGGED, NULL); + queue_post(&button_queue, SYS_PHONE_UNPLUGGED, 0); phones_present = false; } } @@ -116,17 +116,17 @@ static void button_tick(void) #ifdef HAVE_REMOTE_LCD if(diff & BUTTON_REMOTE) if(!skip_remote_release) - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, 0); else skip_remote_release = false; else #endif if(!skip_release) - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, 0); else skip_release = false; #else - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, 0); #endif } else @@ -201,7 +201,7 @@ static void button_tick(void) * to avoid afterscroll effects. */ if (queue_empty(&button_queue)) { - queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); + queue_post(&button_queue, BUTTON_REPEAT | btn, 0); #ifdef CONFIG_BACKLIGHT #ifdef HAVE_REMOTE_LCD skip_remote_release = false; @@ -221,18 +221,18 @@ static void button_tick(void) || (remote_type()==REMOTETYPE_H300_NONLCD) #endif ) - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); else skip_remote_release = true; } else #endif if (!filter_first_keypress || is_backlight_on()) - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); else skip_release = true; #else /* no backlight, nothing to skip */ - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); #endif post = false; } 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 @@ #define _KERNEL_H_ #include +#include #include "config.h" /* wrap-safe macros for tick comparison */ @@ -51,15 +52,15 @@ struct event { - long id; - void *data; + long id; + intptr_t data; }; #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME struct queue_sender { struct thread_entry *thread; - void *retval; + intptr_t retval; }; struct queue_sender_list @@ -112,17 +113,17 @@ extern void queue_init(struct event_queue *q, bool register_queue); extern void queue_delete(struct event_queue *q); extern void queue_wait(struct event_queue *q, struct event *ev); extern void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks); -extern void queue_post(struct event_queue *q, long id, void *data); +extern void queue_post(struct event_queue *q, long id, intptr_t data); #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME extern void queue_enable_queue_send(struct event_queue *q, struct queue_sender_list *send); -extern void * queue_send(struct event_queue *q, long id, void *data); -extern void queue_reply(struct event_queue *q, void *retval); +extern intptr_t queue_send(struct event_queue *q, long id, intptr_t data); +extern void queue_reply(struct event_queue *q, intptr_t retval); extern bool queue_in_queue_send(struct event_queue *q); #endif /* HAVE_EXTENDED_MESSAGING_AND_NAME */ extern bool queue_empty(const struct event_queue* q); extern void queue_clear(struct event_queue* q); extern void queue_remove_from_head(struct event_queue *q, long id); -extern int queue_broadcast(long id, void *data); +extern int queue_broadcast(long id, intptr_t data); extern void mutex_init(struct mutex *m); extern 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, /* Puts the specified return value in the waiting thread's return value and wakes the thread - a sender should be confirmed to exist first */ -static void queue_release_sender(struct queue_sender **sender, void *retval) +static void queue_release_sender(struct queue_sender **sender, + intptr_t retval) { (*sender)->retval = retval; wakeup_thread(&(*sender)->thread); @@ -127,7 +128,7 @@ static void queue_release_all_senders(struct event_queue *q) &q->send->senders[i & QUEUE_LENGTH_MASK]; if(*spp) { - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } } } @@ -242,7 +243,7 @@ void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks) } } -void queue_post(struct event_queue *q, long id, void *data) +void queue_post(struct event_queue *q, long id, intptr_t data) { int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; @@ -258,7 +259,7 @@ void queue_post(struct event_queue *q, long id, void *data) if(*spp) { /* overflow protect - unblock any thread waiting at this index */ - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } } #endif @@ -268,7 +269,7 @@ void queue_post(struct event_queue *q, long id, void *data) } #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME -void * queue_send(struct event_queue *q, long id, void *data) +intptr_t queue_send(struct event_queue *q, long id, intptr_t data) { int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; @@ -284,7 +285,7 @@ void * queue_send(struct event_queue *q, long id, void *data) if(*spp) { /* overflow protect - unblock any thread waiting at this index */ - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } *spp = &sender; @@ -298,7 +299,7 @@ void * queue_send(struct event_queue *q, long id, void *data) /* Function as queue_post if sending is not enabled */ wakeup_thread(&q->thread); set_irq_level(oldlevel); - return NULL; + return 0; } #if 0 /* not used now but probably will be later */ @@ -310,7 +311,7 @@ bool queue_in_queue_send(struct event_queue *q) #endif /* Replies with retval to any dequeued message sent with queue_send */ -void queue_reply(struct event_queue *q, void *retval) +void queue_reply(struct event_queue *q, intptr_t retval) { if(q->send && q->send->curr_sender) { @@ -360,7 +361,7 @@ void queue_remove_from_head(struct event_queue *q, long id) if(*spp) { /* Release any thread waiting on this message */ - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } } #endif @@ -370,7 +371,7 @@ void queue_remove_from_head(struct event_queue *q, long id) set_irq_level(oldlevel); } -int queue_broadcast(long id, void *data) +int queue_broadcast(long id, intptr_t data) { int i; 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); #define MPEG_PRERECORDING_TICK 104 /* indicator for MPEG_NEED_DATA */ -#define GENERATE_UNBUFFER_EVENTS ((void*)1) +#define GENERATE_UNBUFFER_EVENTS 1 /* list of tracks in memory */ #define MAX_TRACK_ENTRIES (1<<4) /* Must be power of 2 */ @@ -2006,7 +2006,7 @@ static void mpeg_thread(void) break; case STOP_RECORDING: - queue_post(&mpeg_queue, MPEG_STOP_DONE, NULL); + queue_post(&mpeg_queue, MPEG_STOP_DONE, 0); /* will close the file */ break; @@ -2123,7 +2123,7 @@ bool audio_has_changed_track(void) void audio_init_playback(void) { init_playback_done = false; - queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, NULL); + queue_post(&mpeg_queue, MPEG_INIT_PLAYBACK, 0); while(!init_playback_done) sleep_thread(1); @@ -2137,7 +2137,7 @@ void audio_init_recording(unsigned int buffer_offset) { buffer_offset = buffer_offset; init_recording_done = false; - queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL); + queue_post(&mpeg_queue, MPEG_INIT_RECORDING, 0); while(!init_recording_done) sleep_thread(1); @@ -2256,17 +2256,17 @@ void audio_record(const char *filename) strncpy(recording_filename, filename, MAX_PATH - 1); recording_filename[MAX_PATH - 1] = 0; - queue_post(&mpeg_queue, MPEG_RECORD, NULL); + queue_post(&mpeg_queue, MPEG_RECORD, 0); } void audio_pause_recording(void) { - queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, NULL); + queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, 0); } void audio_resume_recording(void) { - queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, NULL); + queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, 0); } static void prepend_header(void) @@ -2569,7 +2569,7 @@ void audio_new_file(const char *filename) strncpy(recording_filename, filename, MAX_PATH - 1); recording_filename[MAX_PATH - 1] = 0; - queue_post(&mpeg_queue, MPEG_NEW_FILE, NULL); + queue_post(&mpeg_queue, MPEG_NEW_FILE, 0); } unsigned long audio_recorded_time(void) @@ -2707,7 +2707,7 @@ void audio_play(long offset) #else /* !SIMULATOR */ is_playing = true; - queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset); + queue_post(&mpeg_queue, MPEG_PLAY, offset); #endif /* !SIMULATOR */ mpeg_errno = 0; @@ -2717,7 +2717,7 @@ void audio_stop(void) { #ifndef SIMULATOR mpeg_stop_done = false; - queue_post(&mpeg_queue, MPEG_STOP, NULL); + queue_post(&mpeg_queue, MPEG_STOP, 0); while(!mpeg_stop_done) yield(); #else /* SIMULATOR */ @@ -2736,7 +2736,7 @@ void audio_stop_recording(void) void audio_pause(void) { #ifndef SIMULATOR - queue_post(&mpeg_queue, MPEG_PAUSE, NULL); + queue_post(&mpeg_queue, MPEG_PAUSE, 0); #else /* SIMULATOR */ is_playing = true; playing = false; @@ -2747,7 +2747,7 @@ void audio_pause(void) void audio_resume(void) { #ifndef SIMULATOR - queue_post(&mpeg_queue, MPEG_RESUME, NULL); + queue_post(&mpeg_queue, MPEG_RESUME, 0); #else /* SIMULATOR */ is_playing = true; playing = true; @@ -2759,7 +2759,7 @@ void audio_next(void) { #ifndef SIMULATOR queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA); - queue_post(&mpeg_queue, MPEG_NEXT, NULL); + queue_post(&mpeg_queue, MPEG_NEXT, 0); #else /* SIMULATOR */ char* file; int steps = 1; @@ -2788,7 +2788,7 @@ void audio_prev(void) { #ifndef SIMULATOR queue_remove_from_head(&mpeg_queue, MPEG_NEED_DATA); - queue_post(&mpeg_queue, MPEG_PREV, NULL); + queue_post(&mpeg_queue, MPEG_PREV, 0); #else /* SIMULATOR */ char* file; int steps = -1; @@ -2815,7 +2815,7 @@ void audio_prev(void) void audio_ff_rewind(long newtime) { #ifndef SIMULATOR - queue_post(&mpeg_queue, MPEG_FF_REWIND, (void *)newtime); + queue_post(&mpeg_queue, MPEG_FF_REWIND, newtime); #else /* SIMULATOR */ (void)newtime; #endif /* SIMULATOR */ @@ -2824,7 +2824,7 @@ void audio_ff_rewind(long newtime) void audio_flush_and_reload_tracks(void) { #ifndef SIMULATOR - queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, NULL); + queue_post(&mpeg_queue, MPEG_FLUSH_RELOAD, 0); #endif /* !SIMULATOR*/ } 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) if (status == DMA_REC_ERROR_DMA) { /* Flush recorded data to disk and stop recording */ - queue_post(&pcmrec_queue, PCMREC_STOP, NULL); + queue_post(&pcmrec_queue, PCMREC_STOP, 0); return -1; } /* else try again next transmission */ @@ -388,7 +388,7 @@ void pcm_rec_init(void) void audio_init_recording(unsigned int buffer_offset) { logf("audio_init_recording"); - queue_send(&pcmrec_queue, PCMREC_INIT, NULL); + queue_send(&pcmrec_queue, PCMREC_INIT, 0); logf("audio_init_recording done"); (void)buffer_offset; } /* audio_init_recording */ @@ -399,7 +399,7 @@ void audio_init_recording(unsigned int buffer_offset) void audio_close_recording(void) { logf("audio_close_recording"); - queue_send(&pcmrec_queue, PCMREC_CLOSE, NULL); + queue_send(&pcmrec_queue, PCMREC_CLOSE, 0); logf("audio_close_recording done"); } /* audio_close_recording */ @@ -409,7 +409,7 @@ void audio_close_recording(void) void audio_set_recording_options(struct audio_recording_options *options) { logf("audio_set_recording_options"); - queue_send(&pcmrec_queue, PCMREC_OPTIONS, (void *)options); + queue_send(&pcmrec_queue, PCMREC_OPTIONS, (intptr_t)options); logf("audio_set_recording_options done"); } /* audio_set_recording_options */ @@ -419,7 +419,7 @@ void audio_set_recording_options(struct audio_recording_options *options) void audio_record(const char *filename) { logf("audio_record: %s", filename); - queue_send(&pcmrec_queue, PCMREC_RECORD, (void *)filename); + queue_send(&pcmrec_queue, PCMREC_RECORD, (intptr_t)filename); logf("audio_record_done"); } /* audio_record */ @@ -429,7 +429,7 @@ void audio_record(const char *filename) void audio_stop_recording(void) { logf("audio_stop_recording"); - queue_send(&pcmrec_queue, PCMREC_STOP, NULL); + queue_send(&pcmrec_queue, PCMREC_STOP, 0); logf("audio_stop_recording done"); } /* audio_stop_recording */ @@ -439,7 +439,7 @@ void audio_stop_recording(void) void audio_pause_recording(void) { logf("audio_pause_recording"); - queue_send(&pcmrec_queue, PCMREC_PAUSE, NULL); + queue_send(&pcmrec_queue, PCMREC_PAUSE, 0); logf("audio_pause_recording done"); } /* audio_pause_recording */ @@ -449,7 +449,7 @@ void audio_pause_recording(void) void audio_resume_recording(void) { logf("audio_resume_recording"); - queue_send(&pcmrec_queue, PCMREC_RESUME, NULL); + queue_send(&pcmrec_queue, PCMREC_RESUME, 0); logf("audio_resume_recording done"); } /* audio_resume_recording */ @@ -1069,7 +1069,7 @@ static void pcmrec_new_stream(const char *filename, /* next file name */ flush will hang the screen for a bit otherwise */ strncpy(buf, filename, MAX_PATH); filename = buf; - queue_reply(&pcmrec_queue, NULL); + queue_reply(&pcmrec_queue, 0); pcmrec_flush(-1); } @@ -1182,7 +1182,7 @@ static void pcmrec_set_recording_options(struct audio_recording_options *options /* apply pcm settings to hardware */ pcm_apply_settings(true); - queue_reply(&pcmrec_queue, NULL); /* Release sender */ + queue_reply(&pcmrec_queue, 0); /* Release sender */ if (audio_load_encoder(enc_config.afmt)) { @@ -1310,7 +1310,7 @@ static void pcmrec_stop(void) } dma_lock = true; /* lock dma write position */ - queue_reply(&pcmrec_queue, NULL); + queue_reply(&pcmrec_queue, 0); /* flush all available data first to avoid overflow while waiting for encoding to finish */ @@ -1470,7 +1470,7 @@ static void pcmrec_thread(void) break; } /* end switch */ - queue_reply(&pcmrec_queue, NULL); + queue_reply(&pcmrec_queue, 0); } /* end while */ } /* pcmrec_thread */ 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) charger_input_state = CHARGER_PLUGGED; return; case CHARGER_PLUGGED: - queue_broadcast(SYS_CHARGER_CONNECTED, NULL); + queue_broadcast(SYS_CHARGER_CONNECTED, 0); charger_input_state = CHARGER; break; case CHARGER: @@ -795,7 +795,7 @@ static void power_thread_sleep(int ticks) case NO_CHARGER: break; case CHARGER_UNPLUGGED: - queue_broadcast(SYS_CHARGER_DISCONNECTED, NULL); + queue_broadcast(SYS_CHARGER_DISCONNECTED, 0); charger_input_state = NO_CHARGER; break; case CHARGER_PLUGGED: @@ -1279,7 +1279,7 @@ void sys_poweroff(void) shutdown_timeout += HZ*20; } - queue_post(&button_queue, SYS_POWEROFF, NULL); + queue_post(&button_queue, SYS_POWEROFF, 0); } void 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) } } if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) - queue_post(&button_queue, wheel_keycode, NULL); + queue_post(&button_queue, wheel_keycode, 0); prev_scroll = new_scroll; } 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) { data = (wheel_delta << 16) | new_wheel_value; queue_post(&button_queue, wheel_keycode | wheel_repeat, - (void *)data); + data); } 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) } } if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) - queue_post(&button_queue, wheel_keycode, NULL); + queue_post(&button_queue, wheel_keycode, 0); prev_scroll = new_scroll; } 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) /* Tell all threads that they have to back off the ATA. We subtract one for our own thread. */ num_acks_to_expect = - queue_broadcast(SYS_USB_CONNECTED, NULL) - 1; + queue_broadcast(SYS_USB_CONNECTED, 0) - 1; waiting_for_ack = true; DEBUGF("USB inserted. Waiting for ack from %d threads...\n", num_acks_to_expect); @@ -290,7 +290,7 @@ static void usb_thread(void) /* Tell all threads that we are back in business */ num_acks_to_expect = - queue_broadcast(SYS_USB_DISCONNECTED, NULL) - 1; + queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1; waiting_for_ack = true; DEBUGF("USB extracted. Waiting for ack from %d threads...\n", num_acks_to_expect); @@ -392,9 +392,9 @@ static void usb_tick(void) if(countdown == 0) { if(current_status) - queue_post(&usb_queue, USB_INSERTED, NULL); + queue_post(&usb_queue, USB_INSERTED, 0); else - queue_post(&usb_queue, USB_EXTRACTED, NULL); + queue_post(&usb_queue, USB_EXTRACTED, 0); } } } @@ -403,7 +403,7 @@ static void usb_tick(void) { usb_mmc_countdown--; if (usb_mmc_countdown == 0) - queue_post(&usb_queue, USB_REENABLE, NULL); + queue_post(&usb_queue, USB_REENABLE, 0); } #endif } @@ -411,7 +411,7 @@ static void usb_tick(void) void usb_acknowledge(long id) { - queue_post(&usb_queue, id, NULL); + queue_post(&usb_queue, id, 0); } void 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) #ifdef HAVE_REMOTE_LCD if(diff & BUTTON_REMOTE) if(!skip_remote_release) - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, 0); else skip_remote_release = false; else #endif if(!skip_release) - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, 0); else skip_release = false; #else - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, 0); #endif } @@ -543,7 +543,7 @@ void button_event(int key, bool pressed) { if (queue_empty(&button_queue)) { - queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); + queue_post(&button_queue, BUTTON_REPEAT | btn, 0); #ifdef CONFIG_BACKLIGHT #ifdef HAVE_REMOTE_LCD if(btn & BUTTON_REMOTE) @@ -565,18 +565,18 @@ void button_event(int key, bool pressed) #ifdef HAVE_REMOTE_LCD if (btn & BUTTON_REMOTE) { if (!remote_filter_first_keypress || is_remote_backlight_on()) - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); else skip_remote_release = true; } else #endif if (!filter_first_keypress || is_backlight_on()) - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); else skip_release = true; #else /* no backlight, nothing to skip */ - queue_post(&button_queue, btn, NULL); + queue_post(&button_queue, btn, 0); #endif post = false; } 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, /* Puts the specified return value in the waiting thread's return value and wakes the thread - a sender should be confirmed to exist first */ -static void queue_release_sender(struct queue_sender **sender, void *retval) +static void queue_release_sender(struct queue_sender **sender, + intptr_t retval) { (*sender)->retval = retval; *sender = NULL; @@ -72,7 +73,7 @@ static void queue_release_all_senders(struct event_queue *q) &q->send->senders[i & QUEUE_LENGTH_MASK]; if(*spp) { - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } } } @@ -154,7 +155,7 @@ void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks) } } -void queue_post(struct event_queue *q, long id, void *data) +void queue_post(struct event_queue *q, long id, intptr_t data) { int oldlevel = set_irq_level(15<<4); unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; @@ -170,7 +171,7 @@ void queue_post(struct event_queue *q, long id, void *data) if(*spp) { /* overflow protect - unblock any thread waiting at this index */ - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } } #endif @@ -179,7 +180,7 @@ void queue_post(struct event_queue *q, long id, void *data) } #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME -void * queue_send(struct event_queue *q, long id, void *data) +intptr_t queue_send(struct event_queue *q, long id, intptr_t data) { int oldlevel = set_irq_level(15<<4); unsigned int wr = q->write++ & QUEUE_LENGTH_MASK; @@ -195,7 +196,7 @@ void * queue_send(struct event_queue *q, long id, void *data) if(*spp) { /* overflow protect - unblock any thread waiting at this index */ - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } *spp = &sender; @@ -211,7 +212,7 @@ void * queue_send(struct event_queue *q, long id, void *data) /* Function as queue_post if sending is not enabled */ set_irq_level(oldlevel); - return NULL; + return 0; } #if 0 /* not used now but probably will be later */ @@ -223,7 +224,7 @@ bool queue_in_queue_send(struct event_queue *q) #endif /* Replies with retval to any dequeued message sent with queue_send */ -void queue_reply(struct event_queue *q, void *retval) +void queue_reply(struct event_queue *q, intptr_t retval) { if(q->send && q->send->curr_sender) { @@ -270,7 +271,7 @@ void queue_remove_from_head(struct event_queue *q, long id) if(*spp) { /* Release any thread waiting on this message */ - queue_release_sender(spp, NULL); + queue_release_sender(spp, 0); } } #endif