Page 1 of 1

Combining vs1053b patches with custom plugin

Posted: Tue 2017-03-21 9:29
by awong
Hi,

I have written a custom plugin that listens for SCI_AICTRL0 and controls the vs1053b's GPIO ports based on the values. This works fine, but now I want to combine it with some of the features from the vs1053b patches library (mono-downmix and VU meter specifically).

I see this viewtopic.php?t=918#p3617 post asking the same question, but the responses seem to be missing the critical bit of information for how to chain the plugins.

I can change the memory map on my compile to move my plugin so it doesn't stomp on anything vs1053b-patches.plg, but there is still only one entrypoint from AIADDR which ends , no?

How do I get my plugin to run along side it? I see a note on page 20 of vs1053b-patches.pdf that says you can just concat different patch codes that don't use overlapping memory areas, but if the first patch has already executed a JR to exit the patch function, won't it just never reach my patch code ?

Thanks,
Albert

Re: Combining vs1053b patches with custom plugin

Posted: Tue 2017-03-21 13:07
by pasi
The vs1053b patches package currently uses AIADDR just for starting, it clears it and does not use it afterwards.

If you avoid the memory areas the patches package uses, after DREQ rises, you can load your own plugin, and write AIADDR again to hook your code to the application address hook.

There are quite a few versions of the patches, so you need to check the information for the one that you actually use.

Re: Combining vs1053b patches with custom plugin

Posted: Tue 2017-03-28 9:23
by awong
Ah, that makes sense. So the following pseudocode should be correct?

Code: Select all

  loadPlugin("vs1053b-patches.plg"); // Rev 2.4
  waitForDreq();
  // At this point, reading AIADDR should show 0 because the plugin code has bootstrapped
  
  // XXXXX
  
  // Load my plugin that carefully avoids stomping on any of the patches memory.
  loadMyPlugin("foo-starts-at-0x30.plg");
  sciWrite(AIADDR, 0x30); // Starts my plugin.


Is that correct?

That's what I'm trying, but something seems to go wrong. As a test, I stopped the code at XXXXX and just tried to play back a simple mp3. After I've loaded the vs1053b-patches, playback no longer produces sound. Am I missing something?

Thanks!

Re: Combining vs1053b patches with custom plugin

Posted: Tue 2017-03-28 13:23
by pasi
I'm not sure why the patches package messes the playback.

vs1053 and vs1063 contain a few instruction RAM hooks at 0x30 through 0x40, that is why the default start address for these chips are 0x50 instead of 0x30.

Try the end of the instruction RAM for your code.