mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-10-02 05:47:11 -05:00
Making LINK_WIRELESS_ENABLE_NESTED_IRQ independent from LINK_WIRELESS_PUT_ISR_IN_IWRAM
This commit is contained in:
@@ -312,7 +312,6 @@ You can update these values at any time without creating a new instance:
|
||||
- `LINK_WIRELESS_PUT_ISR_IN_IWRAM`: to put critical functions in IWRAM, which can significantly improve performance due to its faster access. This is disabled by default to conserve IWRAM space, which is limited, but it's enabled in demos to showcase its performance benefits.
|
||||
- If you enable this, make sure that `LinkWireless.cpp` gets compiled! For example, in a Makefile-based project, verify that the file is in your `SRCDIRS` list.
|
||||
- `LINK_WIRELESS_ENABLE_NESTED_IRQ`: to allow `LINK_WIRELESS_ISR_*` functions to be interrupted. This can be useful, for example, if your audio engine requires calling a VBlank handler with precise timing.
|
||||
- This won't produce any effect if `LINK_WIRELESS_PUT_ISR_IN_IWRAM` is disabled.
|
||||
|
||||
# 💻 LinkWirelessMultiboot
|
||||
|
||||
|
||||
@@ -1176,10 +1176,8 @@ class LinkRawWireless {
|
||||
if (!acknowledge())
|
||||
return -4;
|
||||
|
||||
#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM
|
||||
#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
Link::_REG_IME = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sendAsyncCommand(newData, _clockInversionSupport);
|
||||
@@ -1665,11 +1663,9 @@ class LinkRawWireless {
|
||||
}
|
||||
|
||||
void transferAsync(u32 data, bool fromIRQ) {
|
||||
#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM
|
||||
#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
if (fromIRQ)
|
||||
Link::_REG_IME = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
linkSPI.transfer(data, []() { return false; }, true, true);
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#include "LinkWireless.hpp"
|
||||
|
||||
#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM
|
||||
#define _LINK_CODE LINK_CODE_IWRAM
|
||||
#else
|
||||
#define _LINK_CODE
|
||||
#endif
|
||||
|
||||
LINK_CODE_IWRAM void LinkWireless::_onSerial() {
|
||||
_LINK_CODE void LinkWireless::_onSerial() {
|
||||
#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
interrupt = true;
|
||||
LINK_BARRIER;
|
||||
@@ -46,5 +50,3 @@ void LinkWireless::_onTimer() {
|
||||
* - VBLANK interrupts are postponed if SERIAL or TIMER ISRs are running.
|
||||
* - Nobody can interrupt VBLANK ISR.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -110,8 +110,6 @@
|
||||
* enable).
|
||||
* This can be useful, for example, if your audio engine requires calling a
|
||||
* VBlank handler with precise timing.
|
||||
* \warning This won't produce any effect if `LINK_WIRELESS_PUT_ISR_IN_IWRAM` is
|
||||
* disabled.
|
||||
*/
|
||||
// #define LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
#endif
|
||||
@@ -820,14 +818,12 @@ class LinkWireless {
|
||||
if (!isEnabled)
|
||||
return;
|
||||
|
||||
#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM
|
||||
#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
if (interrupt) {
|
||||
pendingVBlank = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LINK_WIRELESS_PROFILING_ENABLED
|
||||
profileStart();
|
||||
@@ -1057,13 +1053,10 @@ class LinkWireless {
|
||||
volatile Error lastError = Error::NONE;
|
||||
volatile bool isEnabled = false;
|
||||
|
||||
#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM
|
||||
#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
volatile bool interrupt = false, pendingVBlank = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM
|
||||
#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ
|
||||
void irqEnd() {
|
||||
Link::_REG_IME = 0;
|
||||
@@ -1074,7 +1067,6 @@ class LinkWireless {
|
||||
pendingVBlank = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
LINK_INLINE void processAsyncCommand(
|
||||
|
||||
Reference in New Issue
Block a user