Compare commits

...

5 commits

Author SHA1 Message Date
Solomon Peachy
017dd72ff3 plugins: Convert all plugins to using mixer API for playback
pcm_play_data -> mixer_channel_play_data
pcm_set_frequeny -> mixer_set_frequency
pcm_play_stop -> audio_stop at startup / mixer_channel_stop at shutdown
pcm_is_playing -> mixer_channel_status

All of these have been removed from the plugin API.  Updated API docs to
clarify role of audio_stop() vs mixer_channel_stop()

Todo:  get rid of pcm_play_[un]lock().

Change-Id: I8800c131b51f064ee923a4c6e42aa405d33851fc
2026-02-22 08:15:14 -05:00
Aidan MacDonald
f6dfa5144d stm32h743: break out SAI and DMA interrupt handlers
Change-Id: I6a8eba6211eab34915d99000426aacd6ea396769
2026-02-22 12:45:56 +00:00
Aidan MacDonald
0cc6f070dd stm32h743: add DMAMUX registers and request IDs
Change-Id: I3819c6535a224d73cfa98b1d8ba78c6927b55c9e
2026-02-22 12:45:56 +00:00
Aidan MacDonald
90bd32dc38 stm32h743: add DMA1/2 registers
Change-Id: I24487fd7a889ea7ae3627ecf1c800c8edffaea42
2026-02-22 12:45:56 +00:00
Aidan MacDonald
0d7f240d81 stm32h743: add SAI registers
Change-Id: I2d669005372daae537c41df68a32043ff96b8e76
2026-02-22 12:45:56 +00:00
26 changed files with 557 additions and 212 deletions

View file

@ -645,10 +645,6 @@ static const struct plugin_api rockbox_api = {
&audio_master_sampr_list[0], &audio_master_sampr_list[0],
&hw_freq_sampr[0], &hw_freq_sampr[0],
pcm_apply_settings, pcm_apply_settings,
pcm_play_data,
pcm_play_stop,
pcm_set_frequency,
pcm_is_playing,
pcm_play_lock, pcm_play_lock,
pcm_play_unlock, pcm_play_unlock,
beep_play, beep_play,

View file

@ -178,7 +178,7 @@ int plugin_open(const char *plugin, const char *parameter);
* when this happens please take the opportunity to sort in * when this happens please take the opportunity to sort in
* any new functions "waiting" at the end of the list. * any new functions "waiting" at the end of the list.
*/ */
#define PLUGIN_API_VERSION 278 #define PLUGIN_API_VERSION 279
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@ -743,12 +743,6 @@ struct plugin_api {
const unsigned long *audio_master_sampr_list; const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr; const unsigned long *hw_freq_sampr;
void (*pcm_apply_settings)(void); void (*pcm_apply_settings)(void);
void (*pcm_play_data)(pcm_play_callback_type get_more,
pcm_status_callback_type status_cb,
const void *start, size_t size);
void (*pcm_play_stop)(void);
void (*pcm_set_frequency)(unsigned int frequency);
bool (*pcm_is_playing)(void);
void (*pcm_play_lock)(void); void (*pcm_play_lock)(void);
void (*pcm_play_unlock)(void); void (*pcm_play_unlock)(void);
void (*beep_play)(unsigned int frequency, unsigned int duration, void (*beep_play)(unsigned int frequency, unsigned int duration,

View file

@ -471,13 +471,13 @@ void I_SubmitSound(void)
if (!enable_sound) if (!enable_sound)
return; return;
rb->pcm_play_data(&get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, &get_more, NULL, 0);
} }
void I_ShutdownSound(void) void I_ShutdownSound(void)
{ {
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); // 44100 rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
} }
void I_InitSound() void I_InitSound()
@ -486,14 +486,14 @@ void I_InitSound()
// Initialize external data (all sounds) at start, keep static. // Initialize external data (all sounds) at start, keep static.
printf( "I_InitSound: "); printf( "I_InitSound: ");
rb->pcm_play_stop(); rb->audio_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Select playback */ /* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif #endif
rb->pcm_set_frequency(SAMPLERATE); rb->mixer_set_frequency(SAMPLERATE);
vol_lookup=malloc(128*256*sizeof(int)); vol_lookup=malloc(128*256*sizeof(int));

View file

@ -342,7 +342,7 @@ static int show_menu(void) /* return 1 to quit */
/* slideshow times < 10s keep disk spinning */ /* slideshow times < 10s keep disk spinning */
rb->storage_spindown(0); rb->storage_spindown(0);
} }
else if (!rb->pcm_is_playing()) else if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) != CHANNEL_PLAYING)
{ {
/* slideshow times > 10s and not playing: ata_off after load */ /* slideshow times > 10s and not playing: ata_off after load */
iv_api.immediate_ata_off = true; iv_api.immediate_ata_off = true;

View file

@ -25,8 +25,5 @@
if not rb.pcm then rb.splash(rb.HZ, "No Support!") return nil end if not rb.pcm then rb.splash(rb.HZ, "No Support!") return nil end
rb.pcm_apply_settings = function() rb.pcm("apply_settings") end rb.pcm_apply_settings = function() rb.pcm("apply_settings") end
rb.pcm_set_frequency = function(freq) rb.pcm("set_frequency", freq) end
rb.pcm_play_stop = function() rb.pcm("play_stop") end
rb.pcm_play_lock = function() rb.pcm("play_lock") end rb.pcm_play_lock = function() rb.pcm("play_lock") end
rb.pcm_play_unlock = function() rb.pcm("play_unlock") end rb.pcm_play_unlock = function() rb.pcm("play_unlock") end
rb.pcm_is_playing = function() return rb.pcm("is_playing") end

View file

@ -549,13 +549,11 @@ RB_WRAP(sound)
RB_WRAP(pcm) RB_WRAP(pcm)
{ {
enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_PLAYLOCK, PCM_PLAYUNLOCK,
PCM_PLAYSTOP, PCM_PLAYLOCK, PCM_PLAYUNLOCK, PCM_ECOUNT};
PCM_SETFREQUENCY, PCM_ECOUNT};
const char *pcm_option[] = {"apply_settings", "is_playing", const char *pcm_option[] = {"apply_settings", "play_lock", "play_unlock",
"play_stop", "play_lock", "play_unlock", NULL};
"set_frequency", NULL};
bool b_result; bool b_result;
lua_pushnil(L); /*push nil so options w/o return have something to return */ lua_pushnil(L); /*push nil so options w/o return have something to return */
@ -566,22 +564,12 @@ RB_WRAP(pcm)
case PCM_APPLYSETTINGS: case PCM_APPLYSETTINGS:
rb->pcm_apply_settings(); rb->pcm_apply_settings();
break; break;
case PCM_ISPLAYING:
b_result = rb->pcm_is_playing();
lua_pushboolean(L, b_result);
break;
case PCM_PLAYSTOP:
rb->pcm_play_stop();
break;
case PCM_PLAYLOCK: case PCM_PLAYLOCK:
rb->pcm_play_lock(); rb->pcm_play_lock();
break; break;
case PCM_PLAYUNLOCK: case PCM_PLAYUNLOCK:
rb->pcm_play_unlock(); rb->pcm_play_unlock();
break; break;
case PCM_SETFREQUENCY:
rb->pcm_set_frequency((unsigned int) luaL_checkint(L, 2));
break;
} }
yield(); yield();

View file

@ -809,9 +809,6 @@ static int bpm_step_counter = 0;
static bool sound_trigger = false; static bool sound_trigger = false;
#define MET_IS_PLAYING rb->pcm_is_playing()
#define MET_PLAY_STOP rb->audio_stop()
/* Really necessary? Cannot just play mono? /* Really necessary? Cannot just play mono?
Also: This is wasted memory! */ Also: This is wasted memory! */
static short tick_buf[sizeof(tick_sound)*2]; static short tick_buf[sizeof(tick_sound)*2];
@ -829,12 +826,12 @@ static void prepare_buffers(void)
static void play_tick(void) static void play_tick(void)
{ {
rb->pcm_play_data(NULL, NULL, tick_buf, sizeof(tick_buf)); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, NULL, tick_buf, sizeof(tick_buf));
} }
static void play_tock(void) static void play_tock(void)
{ {
rb->pcm_play_data(NULL, NULL, tock_buf, sizeof(tock_buf)); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, NULL, tock_buf, sizeof(tock_buf));
} }
/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */ /* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */
@ -1216,10 +1213,10 @@ static void cleanup(void)
if(fd >= 0) rb->close(fd); if(fd >= 0) rb->close(fd);
metronome_pause(); metronome_pause();
MET_PLAY_STOP; /* stop audio ISR */ rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
tweak_volume(0); tweak_volume(0);
rb->led(0); rb->led(0);
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
} }
/* /*
@ -1555,7 +1552,7 @@ enum plugin_status plugin_start(const void* file)
mem_init(); mem_init();
if(MET_IS_PLAYING) MET_PLAY_STOP; /* stop audio IS */ rb->audio_stop();
prepare_buffers(); prepare_buffers();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
@ -1563,7 +1560,7 @@ enum plugin_status plugin_start(const void* file)
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif #endif
rb->pcm_set_frequency(SAMPR_44); rb->mixer_set_frequency(SAMPR_44);
if(file) if(file)
{ {

View file

@ -520,7 +520,7 @@ static int midimain(const void * filename)
} }
rb->talk_force_shutup(); rb->talk_force_shutup();
rb->pcm_play_stop(); rb->audio_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Select playback */ /* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);

View file

@ -536,7 +536,7 @@ static void applysettings(void)
if (inited && (md_mixfreq != rb->hw_freq_sampr[settings.sample_rate])) { if (inited && (md_mixfreq != rb->hw_freq_sampr[settings.sample_rate])) {
md_mixfreq = rb->hw_freq_sampr[settings.sample_rate]; md_mixfreq = rb->hw_freq_sampr[settings.sample_rate];
// MikMod_Reset(""); BROKEN! // MikMod_Reset(""); BROKEN!
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->mixer_set_frequency(md_mixfreq); rb->mixer_set_frequency(md_mixfreq);
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
} }
@ -964,7 +964,7 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_getstringsize("A", NULL, &font_h); rb->lcd_getstringsize("A", NULL, &font_h);
rb->talk_force_shutup(); rb->talk_force_shutup();
rb->pcm_play_stop(); rb->audio_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Select playback */ /* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
@ -1019,10 +1019,11 @@ enum plugin_status plugin_start(const void* parameter)
retval = playfile(np_file); retval = playfile(np_file);
} while (retval == PLUGIN_NEWSONG); } while (retval == PLUGIN_NEWSONG);
MikMod_Exit();
rb->pcmbuf_fade(false, false); rb->pcmbuf_fade(false, false);
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
MikMod_Exit();
rb->mixer_set_frequency(orig_samplerate); rb->mixer_set_frequency(orig_samplerate);
if (retval == PLUGIN_OK) if (retval == PLUGIN_OK)

View file

@ -387,6 +387,8 @@ static void start_sound(void)
if (sound_playing) if (sound_playing)
return; return;
rb->audio_stop();
#ifndef USE_IRAM #ifndef USE_IRAM
/* Ensure control of PCM - stopping music itn't obligatory */ /* Ensure control of PCM - stopping music itn't obligatory */
rb->plugin_get_audio_buffer(NULL); rb->plugin_get_audio_buffer(NULL);
@ -405,8 +407,8 @@ static void start_sound(void)
wsg3_set_sampling_rate(rb->hw_freq_sampr[sr_index]); wsg3_set_sampling_rate(rb->hw_freq_sampr[sr_index]);
rb->pcm_set_frequency(rb->hw_freq_sampr[sr_index]); rb->mixer_set_frequency(rb->hw_freq_sampr[sr_index]);
rb->pcm_play_data(get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
sound_playing = true; sound_playing = true;
} }
@ -419,8 +421,8 @@ static void stop_sound(void)
if (!sound_playing) if (!sound_playing)
return; return;
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
sound_playing = false; sound_playing = false;
} }

View file

@ -54,7 +54,7 @@ void rockbox_open_audio(int rate)
playing = false; playing = false;
/* Stop playing to reconfigure audio settings. */ /* Stop playing to reconfigure audio settings. */
rb->pcm_play_stop(); rb->audio_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Select playback */ /* Select playback */
@ -63,7 +63,7 @@ void rockbox_open_audio(int rate)
#endif #endif
/* Set sample rate of the audio buffer. */ /* Set sample rate of the audio buffer. */
rb->pcm_set_frequency(rate); rb->mixer_set_frequency(rate);
rb->pcm_apply_settings(); rb->pcm_apply_settings();
/* Initialize output buffer. */ /* Initialize output buffer. */
@ -79,13 +79,13 @@ void rockbox_open_audio(int rate)
void rockbox_close_audio(void) void rockbox_close_audio(void)
{ {
/* Stop playback. */ /* Stop playback. */
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
/* Reset playing status. */ /* Reset playing status. */
playing = false; playing = false;
/* Restore default sampling rate. */ /* Restore default sampling rate. */
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
rb->pcm_apply_settings(); rb->pcm_apply_settings();
} }
@ -183,7 +183,7 @@ int rockbox_send_dacs(void)
if(!playing && outbuf_fill > 0) if(!playing && outbuf_fill > 0)
{ {
/* Start playing. */ /* Start playing. */
rb->pcm_play_data(pdbox_get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, pdbox_get_more, NULL, 0);
/* Set status flag. */ /* Set status flag. */
playing = true; playing = true;
@ -191,4 +191,3 @@ int rockbox_send_dacs(void)
return SENDDACS_YES; return SENDDACS_YES;
} }

View file

@ -1084,7 +1084,7 @@ static void record_and_get_pitch(void)
} }
} }
rb->pcm_close_recording(); rb->pcm_close_recording();
rb->pcm_set_frequency(HW_SAMPR_RESET | SAMPR_TYPE_REC); rb->mixer_set_frequency(HW_SAMPR_RESET | SAMPR_TYPE_REC);
#ifdef HAVE_SCHEDULER_BOOSTCTRL #ifdef HAVE_SCHEDULER_BOOSTCTRL
rb->cancel_cpu_boost(); rb->cancel_cpu_boost();
#endif #endif
@ -1118,7 +1118,7 @@ static void init_everything(void)
sample_rate = rb->round_value_to_list32(9000, rb->rec_freq_sampr, sample_rate = rb->round_value_to_list32(9000, rb->rec_freq_sampr,
REC_NUM_FREQ, false); REC_NUM_FREQ, false);
sample_rate = rb->rec_freq_sampr[sample_rate]; sample_rate = rb->rec_freq_sampr[sample_rate];
rb->pcm_set_frequency(sample_rate | SAMPR_TYPE_REC); rb->mixer_set_frequency(sample_rate | SAMPR_TYPE_REC);
rb->pcm_init_recording(); rb->pcm_init_recording();
/* avoid divsion by zero */ /* avoid divsion by zero */

View file

@ -47,24 +47,23 @@ void rockboy_pcm_init(void)
pcm.pos = 0; pcm.pos = 0;
memset(buf, 0, pcm.len * N_BUFS*sizeof(short)); memset(buf, 0, pcm.len * N_BUFS*sizeof(short));
} }
rb->audio_stop();
rb->pcm_play_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Select playback */ /* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif #endif
rb->pcm_set_frequency(pcm.hz); /* 44100 22050 11025 */ rb->mixer_set_frequency(pcm.hz); /* 44100 22050 11025 */
} }
void rockboy_pcm_close(void) void rockboy_pcm_close(void)
{ {
memset(&pcm, 0, sizeof pcm); memset(&pcm, 0, sizeof pcm);
newly_started = true; newly_started = true;
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
} }
int rockboy_pcm_submit(void) int rockboy_pcm_submit(void)
@ -74,7 +73,7 @@ int rockboy_pcm_submit(void)
if(newly_started) if(newly_started)
{ {
rb->pcm_play_data(&get_more, NULL, NULL,0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, &get_more, NULL, 0);
newly_started = false; newly_started = false;
} }

View file

@ -215,7 +215,7 @@ static Uint8 *ROCKBOXAUD_GetAudioBuf(_THIS)
static void ROCKBOXAUD_CloseAudio(_THIS) static void ROCKBOXAUD_CloseAudio(_THIS)
{ {
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
if ( this->hidden->mixbuf != NULL ) { if ( this->hidden->mixbuf != NULL ) {
SDL_FreeAudioMem(this->hidden->mixbuf); SDL_FreeAudioMem(this->hidden->mixbuf);
this->hidden->mixbuf = NULL; this->hidden->mixbuf = NULL;
@ -226,7 +226,7 @@ static void ROCKBOXAUD_CloseAudio(_THIS)
if(this->hidden->rb_buf[i]) if(this->hidden->rb_buf[i])
SDL_FreeAudioMem(this->hidden->rb_buf[i]); SDL_FreeAudioMem(this->hidden->rb_buf[i]);
} }
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
} }
static bool freq_ok(unsigned int freq) static bool freq_ok(unsigned int freq)
@ -257,7 +257,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
SDL_CalculateAudioSpec(spec); SDL_CalculateAudioSpec(spec);
LOGF("samplerate %d", spec->freq); LOGF("samplerate %d", spec->freq);
rb->pcm_set_frequency(spec->freq); rb->mixer_set_frequency(spec->freq);
/* Allocate mixing buffer */ /* Allocate mixing buffer */
this->hidden->mixlen = spec->size; this->hidden->mixlen = spec->size;
@ -286,7 +286,7 @@ static int ROCKBOXAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
rbaud_underruns = 0; rbaud_underruns = 0;
rb->pcm_play_data(get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
/* We're ready to rock and roll. :-) */ /* We're ready to rock and roll. :-) */
return(0); return(0);

View file

@ -167,7 +167,7 @@ static void set_frequency(int index)
output_clear(); output_clear();
update_gen_step(); update_gen_step();
rb->pcm_set_frequency(hw_sampr); rb->mixer_set_frequency(hw_sampr);
rb->pcm_apply_settings(); rb->pcm_apply_settings();
} }
@ -220,7 +220,7 @@ static void play_tone(bool volume_set)
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif
rb->pcm_set_frequency(rb->hw_freq_sampr[freq]); rb->mixer_set_frequency(rb->hw_freq_sampr[freq]);
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Recordable targets can play back from other sources */ /* Recordable targets can play back from other sources */
@ -237,7 +237,7 @@ static void play_tone(bool volume_set)
IF_PRIO(, PRIORITY_PLAYBACK) IF_PRIO(, PRIORITY_PLAYBACK)
IF_COP(, CPU)); IF_COP(, CPU));
rb->pcm_play_data(get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
#ifndef HAVE_VOLUME_IN_LIST #ifndef HAVE_VOLUME_IN_LIST
if (volume_set) if (volume_set)
@ -260,7 +260,7 @@ static void play_tone(bool volume_set)
rb->thread_wait(gen_thread_id); rb->thread_wait(gen_thread_id);
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);
@ -268,7 +268,7 @@ static void play_tone(bool volume_set)
/* restore default - user of apis is responsible for restoring /* restore default - user of apis is responsible for restoring
default state - normally playback at 44100Hz */ default state - normally playback at 44100Hz */
rb->pcm_set_frequency(HW_FREQ_DEFAULT); rb->mixer_set_frequency(HW_FREQ_DEFAULT);
} }
/* Tests hardware sample rate switching */ /* Tests hardware sample rate switching */

View file

@ -222,7 +222,7 @@ void syssnd_update(void)
if (!isAudioPlaying && fillCount > 0) if (!isAudioPlaying && fillCount > 0)
{ {
rb->pcm_play_data(&get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
isAudioPlaying = true; isAudioPlaying = true;
} }
} }
@ -240,6 +240,7 @@ bool syssnd_init(void)
IFDEBUG_AUDIO(sys_printf("xrick/audio: start\n");); IFDEBUG_AUDIO(sys_printf("xrick/audio: start\n"););
rb->audio_stop();
rb->talk_disable(true); rb->talk_disable(true);
/* Stop playback to reconfigure audio settings and acquire audio buffer */ /* Stop playback to reconfigure audio settings and acquire audio buffer */
@ -251,7 +252,7 @@ bool syssnd_init(void)
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif #endif
rb->pcm_set_frequency(HW_FREQ_44); rb->mixer_set_frequency(HW_FREQ_44);
rb->pcm_apply_settings(); rb->pcm_apply_settings();
rb->memset(channels, 0, sizeof(channels)); rb->memset(channels, 0, sizeof(channels));
@ -278,13 +279,13 @@ void syssnd_shutdown(void)
} }
/* Stop playback. */ /* Stop playback. */
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
/* Reset playing status. */ /* Reset playing status. */
isAudioPlaying = false; isAudioPlaying = false;
/* Restore default sampling rate. */ /* Restore default sampling rate. */
rb->pcm_set_frequency(HW_SAMPR_DEFAULT); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
rb->pcm_apply_settings(); rb->pcm_apply_settings();
rb->talk_disable(false); rb->talk_disable(false);
@ -361,9 +362,7 @@ void syssnd_pauseAll(bool pause)
return; return;
} }
rb->pcm_play_lock();
rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, !pause); rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, !pause);
rb->pcm_play_unlock();
} }
/* /*

View file

@ -1029,13 +1029,13 @@ void sys_startAudio(struct System* sys, AudioCallback callback, void *param)
audio_param = param; audio_param = param;
audio_sys = sys; audio_sys = sys;
rb->pcm_play_data(get_more, NULL, NULL, 0); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
} }
void sys_stopAudio(struct System* sys) void sys_stopAudio(struct System* sys)
{ {
(void) sys; (void) sys;
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
} }
uint32_t sys_getOutputSampleRate(struct System* sys) uint32_t sys_getOutputSampleRate(struct System* sys)

View file

@ -290,9 +290,7 @@ static void options_menu(void){
no_yes, 2, NULL); no_yes, 2, NULL);
if (new_setting != settings.sound ) if (new_setting != settings.sound )
settings.sound=new_setting; settings.sound=new_setting;
#if !defined SIMULATOR rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->pcm_play_stop();
#endif
break; break;
case 5: case 5:
new_setting = 9 - settings.volume; new_setting = 9 - settings.volume;
@ -318,9 +316,6 @@ static void options_menu(void){
/* menu */ /* menu */
static bool zxbox_menu(void) static bool zxbox_menu(void)
{ {
#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
int selected=0; int selected=0;
int result; int result;
int menu_quit=0; int menu_quit=0;
@ -332,6 +327,7 @@ static bool zxbox_menu(void)
"Save Snapshot", "Toggle \"fast\" mode", "Save Snapshot", "Toggle \"fast\" mode",
"Options", "Quit"); "Options", "Quit");
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->button_clear_queue(); rb->button_clear_queue();
while (!menu_quit) { while (!menu_quit) {
@ -524,7 +520,3 @@ void start_spectemu(const void *parameter)
run_singlemode(); run_singlemode();
} }

View file

@ -5,7 +5,7 @@
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. See the file COPYING. * (at your option) any later version. See the file COPYING.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -67,71 +67,65 @@ unsigned short my_buf[TMNUM*2*3*2];
const byte lin8_ulaw[] = { const byte lin8_ulaw[] = {
31, 31, 31, 32, 32, 32, 32, 33, 31, 31, 31, 32, 32, 32, 32, 33,
33, 33, 33, 34, 34, 34, 34, 35, 33, 33, 33, 34, 34, 34, 34, 35,
35, 35, 35, 36, 36, 36, 36, 37, 35, 35, 35, 36, 36, 36, 36, 37,
37, 37, 37, 38, 38, 38, 38, 39, 37, 37, 37, 38, 38, 38, 38, 39,
39, 39, 39, 40, 40, 40, 40, 41, 39, 39, 39, 40, 40, 40, 40, 41,
41, 41, 41, 42, 42, 42, 42, 43, 41, 41, 41, 42, 42, 42, 42, 43,
43, 43, 43, 44, 44, 44, 44, 45, 43, 43, 43, 44, 44, 44, 44, 45,
45, 45, 45, 46, 46, 46, 46, 47, 45, 45, 45, 46, 46, 46, 46, 47,
47, 47, 47, 48, 48, 49, 49, 50, 47, 47, 47, 48, 48, 49, 49, 50,
50, 51, 51, 52, 52, 53, 53, 54, 50, 51, 51, 52, 52, 53, 53, 54,
54, 55, 55, 56, 56, 57, 57, 58, 54, 55, 55, 56, 56, 57, 57, 58,
58, 59, 59, 60, 60, 61, 61, 62, 58, 59, 59, 60, 60, 61, 61, 62,
62, 63, 63, 64, 65, 66, 67, 68, 62, 63, 63, 64, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 81, 83, 85, 87, 89, 77, 78, 79, 81, 83, 85, 87, 89,
91, 93, 95, 99, 103, 107, 111, 119, 91, 93, 95, 99, 103, 107, 111, 119,
255, 247, 239, 235, 231, 227, 223, 221, 255, 247, 239, 235, 231, 227, 223, 221,
219, 217, 215, 213, 211, 209, 207, 206, 219, 217, 215, 213, 211, 209, 207, 206,
205, 204, 203, 202, 201, 200, 199, 198, 205, 204, 203, 202, 201, 200, 199, 198,
197, 196, 195, 194, 193, 192, 191, 191, 197, 196, 195, 194, 193, 192, 191, 191,
190, 190, 189, 189, 188, 188, 187, 187, 190, 190, 189, 189, 188, 188, 187, 187,
186, 186, 185, 185, 184, 184, 183, 183, 186, 186, 185, 185, 184, 184, 183, 183,
182, 182, 181, 181, 180, 180, 179, 179, 182, 182, 181, 181, 180, 180, 179, 179,
178, 178, 177, 177, 176, 176, 175, 175, 178, 178, 177, 177, 176, 176, 175, 175,
175, 175, 174, 174, 174, 174, 173, 173, 175, 175, 174, 174, 174, 174, 173, 173,
173, 173, 172, 172, 172, 172, 171, 171, 173, 173, 172, 172, 172, 172, 171, 171,
171, 171, 170, 170, 170, 170, 169, 169, 171, 171, 170, 170, 170, 170, 169, 169,
169, 169, 168, 168, 168, 168, 167, 167, 169, 169, 168, 168, 168, 168, 167, 167,
167, 167, 166, 166, 166, 166, 165, 165, 167, 167, 166, 166, 166, 166, 165, 165,
165, 165, 164, 164, 164, 164, 163, 163, 165, 165, 164, 164, 164, 164, 163, 163,
163, 163, 162, 162, 162, 162, 161, 161, 163, 163, 162, 162, 162, 162, 161, 161,
161, 161, 160, 160, 160, 160, 159, 159, 161, 161, 160, 160, 160, 160, 159, 159,
}; };
static void open_snd(void) static void open_snd(void)
{ {
sndstate = SPS_OPENED; sndstate = SPS_OPENED;
sound_avail=1; sound_avail=1;
rb->pcm_play_stop(); rb->audio_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0
/* Select playback */ /* Select playback */
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif #endif
rb->pcm_set_frequency(SAMPR_44); rb->mixer_set_frequency(SAMPR_44);
} }
static void close_snd(int normal) static void close_snd(int normal)
{ {
(void)normal; (void)normal;
sound_avail = 0; sound_avail = 0;
rb->pcm_play_stop(); rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
} }
void init_spect_sound(void) void init_spect_sound(void)
{ {
#if 1 /* TODO: Is this OK? */
open_snd(); open_snd();
#endif
} }
#ifndef VOLREDUCE #ifndef VOLREDUCE
#define VOLREDUCE 0 #define VOLREDUCE 0
#endif #endif
@ -149,7 +143,7 @@ void init_spect_sound(void)
static void process_sound(void) static void process_sound(void)
{ {
static int soundhp; static int soundhp;
int i; int i;
byte *sb; byte *sb;
register int sv; register int sv;
@ -169,7 +163,7 @@ static void process_sound(void)
} }
else { else {
signed char *tsp; signed char *tsp;
tsp = sp_tape_sound; tsp = sp_tape_sound;
for(i = TMNUM; i; sb++,tsp++,i--) { for(i = TMNUM; i; sb++,tsp++,i--) {
sv = *sb + TAPESOUND(tsp); sv = *sb + TAPESOUND(tsp);
@ -218,7 +212,7 @@ static void write_buf(void){
= my_buf[j+10] = my_buf[j+11] \ = my_buf[j+10] = my_buf[j+11] \
= (((byte)sp_sound_buf[i])<<8) >> settings.volume; = (((byte)sp_sound_buf[i])<<8) >> settings.volume;
rb->pcm_play_data(&get_more,NULL,(unsigned char*)(my_buf),TMNUM*4*3*2); rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, (unsigned char*)(my_buf),TMNUM*4*3*2);
#if 0 #if 0
/* can use to save and later analyze what we produce */ /* can use to save and later analyze what we produce */
@ -232,10 +226,9 @@ static void write_buf(void){
rb->close (i); rb->close (i);
#endif #endif
while(!doneplay) while(!doneplay)
rb->yield(); rb->yield();
} }
void play_sound(int evenframe) void play_sound(int evenframe)
{ {
@ -249,7 +242,7 @@ void play_sound(int evenframe)
close_snd(1); close_snd(1);
return; return;
} }
z80_proc.sound_change = 0; z80_proc.sound_change = 0;
process_sound(); process_sound();
@ -260,7 +253,7 @@ void play_sound(int evenframe)
void setbufsize(void) void setbufsize(void)
{ {
} }
@ -286,5 +279,3 @@ void autoclose_sound(void)
} }
#endif /* NO_SOUND */ #endif /* NO_SOUND */

View file

@ -103,13 +103,12 @@ enum plugin_status plugin_start(const void* parameter)
#endif #endif
#ifdef USE_GREY #ifdef USE_GREY
grey_show(false); grey_show(false);
grey_release(); grey_release();
#endif #endif
#if !defined SIMULATOR rb->audio_stop();
rb->pcm_play_stop(); rb->mixer_set_frequency(HW_SAMPR_DEFAULT);
#endif
return PLUGIN_OK; return PLUGIN_OK;
} }
@ -267,4 +266,3 @@ void press_key(int c){
spkb_kbstate[ki].state = 1; spkb_kbstate[ki].state = 1;
process_keys(); process_keys();
} }

View file

@ -163,7 +163,7 @@ int audio_status(void)
void audio_stop(void) void audio_stop(void)
\group playback control \group playback control
\description \description Gracefully shuts down the playback (ie codec) engine. Anything else playing back (talk/voice, other mixer channels) is unaffected.
void backlight_off(void) void backlight_off(void)
\group For OLED targets like the Sansa Clip, the backlight_* functions control * the display enable, which has essentially the same effect. \group For OLED targets like the Sansa Clip, the backlight_* functions control * the display enable, which has essentially the same effect.
@ -1775,27 +1775,10 @@ void pcm_init_recording(void)
\conditions (defined(HAVE_RECORDING)) \conditions (defined(HAVE_RECORDING))
\description \description
bool pcm_is_playing(void)
\group sound
\return true unless playback is paused
\description
void pcm_play_data(pcm_play_callback_type get_more, pcm_status_callback_type status_cb, const void *start, size_t size)
\group sound
\param get_more Optional callback
\param status_cb Optional status callback
\param start is the address of raw 16-16, interleaved PCM data
\param size is the size of the data to play
\description
void pcm_play_lock(void) void pcm_play_lock(void)
\group sound \group sound
\description \description
void pcm_play_stop(void)
\group sound
\description Stops the playback and empties the audio buffer.
void pcm_play_unlock(void) void pcm_play_unlock(void)
\group sound \group sound
\description \description
@ -1809,11 +1792,6 @@ void pcm_record_data(pcm_rec_callback_type more_ready, pcm_status_callback_type
\param size \param size
\description \description
void pcm_set_frequency(unsigned int frequency)
\group sound
\param frequency
\description
void pcm_stop_recording(void) void pcm_stop_recording(void)
\group sound \group sound
\conditions (defined(HAVE_RECORDING)) \conditions (defined(HAVE_RECORDING))

View file

@ -455,6 +455,10 @@ void mixer_set_frequency(unsigned int samplerate)
pcm_set_frequency(samplerate); pcm_set_frequency(samplerate);
samplerate = pcm_get_frequency(); samplerate = pcm_get_frequency();
#ifdef CONFIG_SAMPR_TYPES
samplerate &= ~SAMPR_TYPE_MASK;
#endif
if (samplerate == mixer_sampr) if (samplerate == mixer_sampr)
return; return;

View file

@ -1180,3 +1180,224 @@ EXTI @ 0x58000000 : block {
CPUEMR @ 0x84 [3; 0x10] : reg CPUEMR @ 0x84 [3; 0x10] : reg
CPUPR @ 0x88 [3; 0x10] : reg CPUPR @ 0x88 [3; 0x10] : reg
} }
// Serial audio interface
block SAI {
GCR @ 0x00 : reg {
05 04 SYNCOUT : { 0 = NONE; 1 = BLOCK_A; 2 = BLOCK_B }
01 00 SYNCIN
}
block SUBBLOCK {
CR1 @ 0x04 : reg {
-- 26 OSR : { 0 = 256FS; 1 = 512FS }
25 20 MCKDIV
-- 19 NOMCK
-- 17 DMAEN
-- 16 SAIEN
-- 13 OUTDRIV
-- 12 MONO
11 10 SYNCEN : { 0 = ASYNC; 1 = SYNC_INT; 2 = SYNC_EXT }
-- 09 CKSTR : { 0 = TX_RISING_RX_FALLING; 1 = TX_FALLING_RX_RISING }
-- 08 LSBFIRST
07 05 DS : { 2 = 8BIT; 3 = 10BIT; 4 = 16BIT; 5 = 20BIT; 6 = 24BIT; 7 = 32BIT }
03 02 PRTCFG : { 0 = FREE; 1 = SPDIF; 2 = AC97 }
01 00 MODE : { 0 = MASTER_TX; 1 = MASTER_RX; 2 = SLAVE_TX; 3 = SLAVE_RX }
}
CR2 @ 0x08 : reg {
15 14 COMP : { 0 = NONE; 2 = U_LAW; 3 = A_LAW }
-- 13 CPL
12 07 MUTECNT
-- 06 MUTEVAL : { 0 = ZERO_SAMPLE; 1 = LAST_SAMPLE }
-- 05 MUTE
-- 04 TRIS
-- 03 FFLUSH
02 00 FTH : { 0 = EMPTY; 1 = QUARTER; 2 = HALF; 3 = THREE_QUARTERS; 4 = FULL }
}
FRCR @ 0x0c : reg {
-- 18 FSOFF
-- 17 FSPOL
-- 16 FSDEF
14 08 FSALL
07 00 FRL
}
SLOTR @ 0x10 : reg {
31 16 SLOTEN
11 08 NBSLOT
07 06 SLOTSZ : { 0 = DATASZ; 1 = 16BIT; 2 = 32BIT }
04 00 FBOFF
}
IM @ 0x14 : reg {
06 LFSDET
05 AFSDET
04 CNRDY
03 FREQ
02 WCKCFG
01 MUTEDET
00 OVRUDR
}
SR @ 0x18 : reg {
18 16 FLVL
include IM
}
CLRFR @ 0x1c : reg {
include IM
}
DR @ 0x20 : reg
}
A @ 0x00 : SUBBLOCK
B @ 0x20 : SUBBLOCK
}
SAI1 @ 0x40015800 : SAI
SAI2 @ 0x40015c00 : SAI
SAI3 @ 0x40016000 : SAI
SAI4 @ 0x58005400 : SAI
// DMA controller
block DMA {
LISR @ 0x00 : reg {
27 TCIF3
26 HTIF3
25 TEIF3
24 DMEIF3
22 FEIF3
21 TCIF2
20 HTIF2
19 TEIF2
18 DMEIF2
16 FEIF2
11 TCIF1
10 HTIF1
09 TEIF1
08 DMEIF1
06 FEIF1
05 TCIF0
04 HTIF0
03 TEIF0
02 DMEIF0
00 FEIF0
}
HISR @ 0x04 : reg {
27 TCIF7
26 HTIF7
25 TEIF7
24 DMEIF7
22 FEIF7
21 TCIF6
20 HTIF6
19 TEIF6
18 DMEIF6
16 FEIF6
11 TCIF5
10 HTIF5
09 TEIF5
08 DMEIF5
06 FEIF5
05 TCIF4
04 HTIF4
03 TEIF4
02 DMEIF4
00 FEIF4
}
LIFCR @ 0x08 : LISR
HIFCR @ 0x0c : HISR
CHN @ 0x00 [8; 0x18] : block {
CR @ 0x10 : reg {
enum BURST_TYPE {
0 = SINGLE
1 = INCR4
2 = INCR8
3 = INCR16
}
enum SIZE_TYPE {
0 = 8BIT
1 = 16BIT
2 = 32BIT
}
24 23 MBURST : BURST_TYPE
22 21 PBURST : BURST_TYPE
-- 20 TRBUFF
-- 19 CT
-- 18 DBM
17 16 PL : { 0 = LOW; 1 = MEDIUM; 2 = HIGH; 3 = VERYHIGH }
-- 15 PINCOS
14 13 MSIZE : SIZE_TYPE
12 11 PSIZE : SIZE_TYPE
-- 10 MINC
-- 09 PINC
-- 08 CIRC
07 06 DIR : { 0 = PERIPH_TO_MEM; 1 = MEM_TO_PERIPH; 2 = MEM_TO_MEM }
-- 05 PFCTRL : { 0 = DMA; 1 = PERIPH }
-- 04 TCIE
-- 03 HTIE
-- 02 TEIE
-- 01 DMEIE
-- 00 EN
}
NDTR @ 0x14 : reg
PAR @ 0x18 : reg
M0AR @ 0x1c : reg
M1AR @ 0x20 : reg
FCR @ 0x24 : reg {
-- 07 FEIE
05 03 FS
-- 02 DMDIS
01 00 FTH : { 0 = QUARTER; 1 = HALF; 2 = THREE_QUARTERS; 3 = FULL }
}
}
}
DMA1 @ 0x40020000 : DMA
DMA2 @ 0x40020400 : DMA
// DMA multiplexer
block DMAMUX {
CR @ 0x00 [16; 0x04] : reg {
28 24 SYNC_ID
23 19 NBREQ
18 17 SPOL
-- 16 SE
-- 09 EGE
-- 08 SOIE
06 00 DMAREQ_ID
}
CSR @ 0x80 : reg
CFR @ 0x84 : reg
RGCR @ 0x100 [8; 0x04] : reg {
23 19 GNBREQ
18 17 GPOL
-- 16 GE
-- 08 OIE
04 00 SIG_ID
}
RGSR @ 0x140 : reg
RGCFR @ 0x144 : reg
}
DMAMUX1 @ 0x40020800 : DMAMUX
DMAMUX2 @ 0x58025800 : DMAMUX

View file

@ -0,0 +1,159 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2026 by Aidan MacDonald
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __DMAMUX_STM32H743_H__
#define __DMAMUX_STM32H743_H__
/* DMAMUX1 request multiplexer inputs (DMAMUX_CR.DMAREQ_ID) */
#define DMAMUX1_REQ_GEN0 1
#define DMAMUX1_REQ_GEN1 2
#define DMAMUX1_REQ_GEN2 3
#define DMAMUX1_REQ_GEN3 4
#define DMAMUX1_REQ_GEN4 5
#define DMAMUX1_REQ_GEN5 6
#define DMAMUX1_REQ_GEN6 7
#define DMAMUX1_REQ_GEN7 8
#define DMAMUX1_REQ_ADC1_DMA 9
#define DMAMUX1_REQ_ADC2_DMA 10
#define DMAMUX1_REQ_TIM1_CH1 11
#define DMAMUX1_REQ_TIM1_CH2 12
#define DMAMUX1_REQ_TIM1_CH3 13
#define DMAMUX1_REQ_TIM1_CH4 14
#define DMAMUX1_REQ_TIM1_UP 15
#define DMAMUX1_REQ_TIM1_TRIG 16
#define DMAMUX1_REQ_TIM1_COM 16
#define DMAMUX1_REQ_TIM2_CH1 18
#define DMAMUX1_REQ_TIM2_CH2 19
#define DMAMUX1_REQ_TIM2_CH3 20
#define DMAMUX1_REQ_TIM2_CH4 21
#define DMAMUX1_REQ_TIM2_UP 22
#define DMAMUX1_REQ_TIM3_CH1 23
#define DMAMUX1_REQ_TIM3_CH2 24
#define DMAMUX1_REQ_TIM3_CH3 25
#define DMAMUX1_REQ_TIM3_CH4 26
#define DMAMUX1_REQ_TIM3_UP 27
#define DMAMUX1_REQ_TIM3_TRIG 28
#define DMAMUX1_REQ_TIM4_CH1 29
#define DMAMUX1_REQ_TIM4_CH2 30
#define DMAMUX1_REQ_TIM4_CH3 31
#define DMAMUX1_REQ_TIM4_UP 32
#define DMAMUX1_REQ_I2C1_RX_DMA 33
#define DMAMUX1_REQ_I2C1_TX_DMA 34
#define DMAMUX1_REQ_I2C2_RX_DMA 35
#define DMAMUX1_REQ_I2C2_TX_DMA 36
#define DMAMUX1_REQ_SPI1_RX_DMA 37
#define DMAMUX1_REQ_SPI1_TX_DMA 38
#define DMAMUX1_REQ_SPI2_RX_DMA 39
#define DMAMUX1_REQ_SPI2_TX_DMA 40
#define DMAMUX1_REQ_USART1_RX_DMA 41
#define DMAMUX1_REQ_USART1_TX_DMA 42
#define DMAMUX1_REQ_USART2_RX_DMA 43
#define DMAMUX1_REQ_USART2_TX_DMA 44
#define DMAMUX1_REQ_USART3_RX_DMA 45
#define DMAMUX1_REQ_USART3_TX_DMA 46
#define DMAMUX1_REQ_TIM8_CH1 47
#define DMAMUX1_REQ_TIM8_CH2 48
#define DMAMUX1_REQ_TIM8_CH3 49
#define DMAMUX1_REQ_TIM8_CH4 50
#define DMAMUX1_REQ_TIM8_UP 51
#define DMAMUX1_REQ_TIM8_TRIG 52
#define DMAMUX1_REQ_TIM8_COM 53
#define DMAMUX1_REQ_TIM5_CH1 55
#define DMAMUX1_REQ_TIM5_CH2 56
#define DMAMUX1_REQ_TIM5_CH3 57
#define DMAMUX1_REQ_TIM5_CH4 58
#define DMAMUX1_REQ_TIM5_UP 59
#define DMAMUX1_REQ_TIM5_TRIG 60
#define DMAMUX1_REQ_SPI3_RX_DMA 61
#define DMAMUX1_REQ_SPI3_TX_DMA 62
#define DMAMUX1_REQ_UART4_RX_DMA 63
#define DMAMUX1_REQ_UART4_TX_DMA 64
#define DMAMUX1_REQ_UART5_RX_DMA 65
#define DMAMUX1_REQ_UART5_TX_DMA 66
#define DMAMUX1_REQ_DAC_CH1_DMA 67
#define DMAMUX1_REQ_DAC_CH2_DMA 68
#define DMAMUX1_REQ_TIM6_UP 69
#define DMAMUX1_REQ_TIM7_UP 70
#define DMAMUX1_REQ_USART6_RX_DMA 71
#define DMAMUX1_REQ_USART6_TX_DMA 72
#define DMAMUX1_REQ_I2C3_RX_DMA 73
#define DMAMUX1_REQ_I2C3_TX_DMA 74
#define DMAMUX1_REQ_DCMI_DMA 75
#define DMAMUX1_REQ_CRYP_IN_DMA 76
#define DMAMUX1_REQ_CRYP_OUT_DMA 77
#define DMAMUX1_REQ_HASH_IN_DMA 78
#define DMAMUX1_REQ_UART7_RX_DMA 79
#define DMAMUX1_REQ_UART7_TX_DMA 80
#define DMAMUX1_REQ_UART8_RX_DMA 81
#define DMAMUX1_REQ_UART8_TX_DMA 82
#define DMAMUX1_REQ_SPI4_RX_DMA 83
#define DMAMUX1_REQ_SPI4_TX_DMA 84
#define DMAMUX1_REQ_SPI5_RX_DMA 85
#define DMAMUX1_REQ_SPI5_TX_DMA 86
#define DMAMUX1_REQ_SAI1A_DMA 87
#define DMAMUX1_REQ_SAI1B_DMA 88
#define DMAMUX1_REQ_SAI2A_DMA 89
#define DMAMUX1_REQ_SAI2B_DMA 90
#define DMAMUX1_REQ_SWPMI_RX_DMA 91
#define DMAMUX1_REQ_SWPMI_TX_DMA 92
#define DMAMUX1_REQ_SPDIFRX_DAT_DMA 93
#define DMAMUX1_REQ_SPDIFRX_CTRL_DMA 94
#define DMAMUX1_REQ_HR_REQ1 95
#define DMAMUX1_REQ_HR_REQ2 96
#define DMAMUX1_REQ_HR_REQ3 97
#define DMAMUX1_REQ_HR_REQ4 98
#define DMAMUX1_REQ_HR_REQ5 99
#define DMAMUX1_REQ_HR_REQ6 100
#define DMAMUX1_REQ_DFSDM1_DMA0 101
#define DMAMUX1_REQ_DFSDM1_DMA1 102
#define DMAMUX1_REQ_DFSDM1_DMA2 103
#define DMAMUX1_REQ_DFSDM1_DMA3 104
#define DMAMUX1_REQ_TIM15_CH1 105
#define DMAMUX1_REQ_TIM15_UP 106
#define DMAMUX1_REQ_TIM15_TRIG 107
#define DMAMUX1_REQ_TIM15_COM 108
#define DMAMUX1_REQ_TIM16_CH1 109
#define DMAMUX1_REQ_TIM16_UP 110
#define DMAMUX1_REQ_TIM17_CH1 111
#define DMAMUX1_REQ_TIM17_UP 112
#define DMAMUX1_REQ_SAI3A_DMA 113
#define DMAMUX1_REQ_SAI3B_DMA 114
#define DMAMUX1_REQ_ADC3_DMA 115
/* DMAMUX2 request multiplexer inputs (DMAMUX_CR.DMAREQ_ID) */
#define DMAMUX2_REQ_GEN0 1
#define DMAMUX2_REQ_GEN1 2
#define DMAMUX2_REQ_GEN2 3
#define DMAMUX2_REQ_GEN3 4
#define DMAMUX2_REQ_GEN4 5
#define DMAMUX2_REQ_GEN5 6
#define DMAMUX2_REQ_GEN6 7
#define DMAMUX2_REQ_GEN7 8
#define DMAMUX2_REQ_LPUART1_RX_DMA 9
#define DMAMUX2_REQ_LPUART1_TX_DMA 10
#define DMAMUX2_REQ_SPI6_RX_DMA 11
#define DMAMUX2_REQ_SPI6_TX_DMA 12
#define DMAMUX2_REQ_I2C4_RX_DMA 13
#define DMAMUX2_REQ_I2C4_TX_DMA 14
#define DMAMUX2_REQ_SAI4A_DMA 15
#define DMAMUX2_REQ_SAI4B_DMA 16
#define DMAMUX2_REQ_ADC3_DMA 17
#endif /* __DMAMUX_STM32H743_H__ */

View file

@ -23,11 +23,41 @@
* NOTE: This file must be included from system-arm-micro.c! * NOTE: This file must be included from system-arm-micro.c!
*/ */
void dma_irq_handler(void) ATTR_IRQ_HANDLER; void dmamux1_irq_handler(void) ATTR_IRQ_HANDLER;
void dmamux2_irq_handler(void) ATTR_IRQ_HANDLER;
void mdma_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2d_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch0_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch1_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch2_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch3_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch4_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch5_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch6_irq_handler(void) ATTR_IRQ_HANDLER;
void dma1_ch7_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch0_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch1_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch2_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch3_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch4_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch5_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch6_irq_handler(void) ATTR_IRQ_HANDLER;
void dma2_ch7_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch0_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch1_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch2_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch3_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch4_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch5_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch6_irq_handler(void) ATTR_IRQ_HANDLER;
void bdma_ch7_irq_handler(void) ATTR_IRQ_HANDLER;
void i2c_irq_handler(void) ATTR_IRQ_HANDLER; void i2c_irq_handler(void) ATTR_IRQ_HANDLER;
void lcdc_irq_handler(void) ATTR_IRQ_HANDLER; void lcdc_irq_handler(void) ATTR_IRQ_HANDLER;
void otg_hs_irq_handler(void) ATTR_IRQ_HANDLER; void otg_hs_irq_handler(void) ATTR_IRQ_HANDLER;
void sai_irq_handler(void) ATTR_IRQ_HANDLER; void sai1_irq_handler(void) ATTR_IRQ_HANDLER;
void sai2_irq_handler(void) ATTR_IRQ_HANDLER;
void sai3_irq_handler(void) ATTR_IRQ_HANDLER;
void sai4_irq_handler(void) ATTR_IRQ_HANDLER;
void sdmmc1_irq_handler(void) ATTR_IRQ_HANDLER; void sdmmc1_irq_handler(void) ATTR_IRQ_HANDLER;
void sdmmc2_irq_handler(void) ATTR_IRQ_HANDLER; void sdmmc2_irq_handler(void) ATTR_IRQ_HANDLER;
void spi1_irq_handler(void) ATTR_IRQ_HANDLER; void spi1_irq_handler(void) ATTR_IRQ_HANDLER;

View file

@ -38,13 +38,13 @@ __vectors_platform:
.word exti2_irq_handler /* [ 8] EXTI2 */ .word exti2_irq_handler /* [ 8] EXTI2 */
.word exti3_irq_handler /* [ 9] EXTI3 */ .word exti3_irq_handler /* [ 9] EXTI3 */
.word exti4_irq_handler /* [ 10] EXTI4 */ .word exti4_irq_handler /* [ 10] EXTI4 */
.word dma_irq_handler /* [ 11] DMA1 Stream0 */ .word dma1_ch0_irq_handler /* [ 11] DMA1 Stream0 */
.word dma_irq_handler /* [ 12] DMA1 Stream1 */ .word dma1_ch1_irq_handler /* [ 12] DMA1 Stream1 */
.word dma_irq_handler /* [ 13] DMA1 Stream2 */ .word dma1_ch2_irq_handler /* [ 13] DMA1 Stream2 */
.word dma_irq_handler /* [ 14] DMA1 Stream3 */ .word dma1_ch3_irq_handler /* [ 14] DMA1 Stream3 */
.word dma_irq_handler /* [ 15] DMA1 Stream4 */ .word dma1_ch4_irq_handler /* [ 15] DMA1 Stream4 */
.word dma_irq_handler /* [ 16] DMA1 Stream5 */ .word dma1_ch5_irq_handler /* [ 16] DMA1 Stream5 */
.word dma_irq_handler /* [ 17] DMA1 Stream6 */ .word dma1_ch6_irq_handler /* [ 17] DMA1 Stream6 */
.word UIE /* [ 18] */ .word UIE /* [ 18] */
.word UIE /* [ 19] */ .word UIE /* [ 19] */
.word UIE /* [ 20] */ .word UIE /* [ 20] */
@ -74,7 +74,7 @@ __vectors_platform:
.word UIE /* [ 44] */ .word UIE /* [ 44] */
.word UIE /* [ 45] */ .word UIE /* [ 45] */
.word UIE /* [ 46] */ .word UIE /* [ 46] */
.word dma_irq_handler /* [ 47] DMA1 Stream7 */ .word dma1_ch7_irq_handler /* [ 47] DMA1 Stream7 */
.word UIE /* [ 48] */ .word UIE /* [ 48] */
.word sdmmc1_irq_handler /* [ 49] SDMMC1 */ .word sdmmc1_irq_handler /* [ 49] SDMMC1 */
.word UIE /* [ 50] */ .word UIE /* [ 50] */
@ -83,11 +83,11 @@ __vectors_platform:
.word UIE /* [ 53] */ .word UIE /* [ 53] */
.word UIE /* [ 54] */ .word UIE /* [ 54] */
.word UIE /* [ 55] */ .word UIE /* [ 55] */
.word dma_irq_handler /* [ 56] DMA2 Stream0 */ .word dma2_ch0_irq_handler /* [ 56] DMA2 Stream0 */
.word dma_irq_handler /* [ 57] DMA2 Stream1 */ .word dma2_ch1_irq_handler /* [ 57] DMA2 Stream1 */
.word dma_irq_handler /* [ 58] DMA2 Stream2 */ .word dma2_ch2_irq_handler /* [ 58] DMA2 Stream2 */
.word dma_irq_handler /* [ 59] DMA2 Stream3 */ .word dma2_ch3_irq_handler /* [ 59] DMA2 Stream3 */
.word dma_irq_handler /* [ 60] DMA2 Stream4 */ .word dma2_ch4_irq_handler /* [ 60] DMA2 Stream4 */
.word UIE /* [ 61] */ .word UIE /* [ 61] */
.word UIE /* [ 62] */ .word UIE /* [ 62] */
.word UIE /* [ 63] */ .word UIE /* [ 63] */
@ -95,9 +95,9 @@ __vectors_platform:
.word UIE /* [ 65] */ .word UIE /* [ 65] */
.word UIE /* [ 66] */ .word UIE /* [ 66] */
.word UIE /* [ 67] */ .word UIE /* [ 67] */
.word dma_irq_handler /* [ 68] DMA2 Stream5 */ .word dma2_ch5_irq_handler /* [ 68] DMA2 Stream5 */
.word dma_irq_handler /* [ 69] DMA2 Stream6 */ .word dma2_ch6_irq_handler /* [ 69] DMA2 Stream6 */
.word dma_irq_handler /* [ 70] DMA2 Stream7 */ .word dma2_ch7_irq_handler /* [ 70] DMA2 Stream7 */
.word UIE /* [ 71] */ .word UIE /* [ 71] */
.word i2c_irq_handler /* [ 72] I2C3 event */ .word i2c_irq_handler /* [ 72] I2C3 event */
.word i2c_irq_handler /* [ 73] I2C3 error */ .word i2c_irq_handler /* [ 73] I2C3 error */
@ -114,11 +114,11 @@ __vectors_platform:
.word spi4_irq_handler /* [ 84] SPI4 */ .word spi4_irq_handler /* [ 84] SPI4 */
.word spi5_irq_handler /* [ 85] SPI5 */ .word spi5_irq_handler /* [ 85] SPI5 */
.word spi6_irq_handler /* [ 86] SPI6 */ .word spi6_irq_handler /* [ 86] SPI6 */
.word sai_irq_handler /* [ 87] SAI1 */ .word sai1_irq_handler /* [ 87] SAI1 */
.word lcdc_irq_handler /* [ 88] LCDC */ .word lcdc_irq_handler /* [ 88] LCDC */
.word lcdc_irq_handler /* [ 89] LCDC error */ .word lcdc_irq_handler /* [ 89] LCDC error */
.word dma_irq_handler /* [ 90] DMA2D */ .word dma2d_irq_handler /* [ 90] DMA2D */
.word sai_irq_handler /* [ 91] SAI2 */ .word sai2_irq_handler /* [ 91] SAI2 */
.word UIE /* [ 92] */ .word UIE /* [ 92] */
.word UIE /* [ 93] */ .word UIE /* [ 93] */
.word UIE /* [ 94] */ .word UIE /* [ 94] */
@ -129,7 +129,7 @@ __vectors_platform:
.word UIE /* [ 99] */ .word UIE /* [ 99] */
.word UIE /* [100] */ .word UIE /* [100] */
.word INT_USB_FUNC /* [101] OTG FS */ .word INT_USB_FUNC /* [101] OTG FS */
.word dma_irq_handler /* [102] DMAMUX1 overrun */ .word dmamux1_irq_handler /* [102] DMAMUX1 overrun */
.word UIE /* [103] */ .word UIE /* [103] */
.word UIE /* [104] */ .word UIE /* [104] */
.word UIE /* [105] */ .word UIE /* [105] */
@ -141,7 +141,7 @@ __vectors_platform:
.word UIE /* [111] */ .word UIE /* [111] */
.word UIE /* [112] */ .word UIE /* [112] */
.word UIE /* [113] */ .word UIE /* [113] */
.word sai_irq_handler /* [114] SAI3 */ .word sai3_irq_handler /* [114] SAI3 */
.word UIE /* [115] */ .word UIE /* [115] */
.word UIE /* [116] */ .word UIE /* [116] */
.word UIE /* [117] */ .word UIE /* [117] */
@ -149,21 +149,21 @@ __vectors_platform:
.word UIE /* [119] */ .word UIE /* [119] */
.word UIE /* [120] */ .word UIE /* [120] */
.word UIE /* [121] */ .word UIE /* [121] */
.word dma_irq_handler /* [122] MDMA */ .word mdma_irq_handler /* [122] MDMA */
.word UIE /* [123] */ .word UIE /* [123] */
.word sdmmc2_irq_handler /* [124] SDMMC2 */ .word sdmmc2_irq_handler /* [124] SDMMC2 */
.word UIE /* [125] */ .word UIE /* [125] */
.word UIE /* [126] */ .word UIE /* [126] */
.word UIE /* [127] */ .word UIE /* [127] */
.word dma_irq_handler /* [128] DMAMUX2 overrun */ .word dmamux2_irq_handler /* [128] DMAMUX2 overrun */
.word dma_irq_handler /* [129] BDMA channel 0 */ .word bdma_ch0_irq_handler /* [129] BDMA channel 0 */
.word dma_irq_handler /* [130] BDMA channel 1 */ .word bdma_ch1_irq_handler /* [130] BDMA channel 1 */
.word dma_irq_handler /* [131] BDMA channel 2 */ .word bdma_ch2_irq_handler /* [131] BDMA channel 2 */
.word dma_irq_handler /* [132] BDMA channel 3 */ .word bdma_ch3_irq_handler /* [132] BDMA channel 3 */
.word dma_irq_handler /* [133] BDMA channel 4 */ .word bdma_ch4_irq_handler /* [133] BDMA channel 4 */
.word dma_irq_handler /* [134] BDMA channel 5 */ .word bdma_ch5_irq_handler /* [134] BDMA channel 5 */
.word dma_irq_handler /* [135] BDMA channel 6 */ .word bdma_ch6_irq_handler /* [135] BDMA channel 6 */
.word dma_irq_handler /* [136] BDMA channel 7 */ .word bdma_ch7_irq_handler /* [136] BDMA channel 7 */
.word UIE /* [137] */ .word UIE /* [137] */
.word UIE /* [138] */ .word UIE /* [138] */
.word UIE /* [139] */ .word UIE /* [139] */
@ -173,7 +173,7 @@ __vectors_platform:
.word UIE /* [143] */ .word UIE /* [143] */
.word UIE /* [144] */ .word UIE /* [144] */
.word UIE /* [145] */ .word UIE /* [145] */
.word sai_irq_handler /* [146] SAI4 */ .word sai4_irq_handler /* [146] SAI4 */
.word UIE /* [147] */ .word UIE /* [147] */
.word UIE /* [148] */ .word UIE /* [148] */
.word UIE /* [149] */ .word UIE /* [149] */