mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
defs: allow NULL callbacks in gint_call()
This commit is contained in:
parent
18e0db3886
commit
6f758cd36c
7 changed files with 16 additions and 24 deletions
|
@ -153,7 +153,8 @@ static GINLINE int gint_call(gint_call_t cb)
|
||||||
int (*f)(int r4, int r5, int r6, int r7) = cb.function;
|
int (*f)(int r4, int r5, int r6, int r7) = cb.function;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return f(cb.args[0].i, cb.args[1].i, cb.args[2].i, cb.args[3].i);
|
gint_call_arg_t *args = cb.args;
|
||||||
|
return f ? f(args[0].i, args[1].i, args[2].i, args[3].i) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---
|
//---
|
||||||
|
|
|
@ -160,11 +160,8 @@ static void dma_interrupt_transfer_ended(int channel)
|
||||||
if(dma_wait_ics[channel])
|
if(dma_wait_ics[channel])
|
||||||
cpu_csleep_cancel(dma_wait_ics[channel]);
|
cpu_csleep_cancel(dma_wait_ics[channel]);
|
||||||
|
|
||||||
if(dma_callbacks[channel].function)
|
gint_call(dma_callbacks[channel]);
|
||||||
{
|
dma_callbacks[channel] = GINT_CALL_NULL;
|
||||||
gint_call(dma_callbacks[channel]);
|
|
||||||
dma_callbacks[channel] = GINT_CALL_NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dma_channel_wait(): Wait for a particular channel's transfer to finish
|
/* dma_channel_wait(): Wait for a particular channel's transfer to finish
|
||||||
|
|
|
@ -149,7 +149,7 @@ int gint_world_switch(gint_call_t call)
|
||||||
if(canary)
|
if(canary)
|
||||||
*canary = 0xb7c0ffee;
|
*canary = 0xb7c0ffee;
|
||||||
|
|
||||||
int rc = call.function ? gint_call(call) : 0;
|
int rc = gint_call(call);
|
||||||
|
|
||||||
/* The canary check needs to occur before switching in the gint world;
|
/* The canary check needs to occur before switching in the gint world;
|
||||||
otherwise we just crash due to the overflow. gint_panic() isn't
|
otherwise we just crash due to the overflow. gint_panic() isn't
|
||||||
|
|
|
@ -12,8 +12,7 @@ void dupdate(void)
|
||||||
|
|
||||||
r61524_display(gint_vram, 0, 224, method);
|
r61524_display(gint_vram, 0, 224, method);
|
||||||
|
|
||||||
gint_call_t hook = dupdate_get_hook();
|
gint_call(dupdate_get_hook());
|
||||||
if(hook.function) gint_call(hook);
|
|
||||||
|
|
||||||
/* Switch buffers if triple buffering is enabled */
|
/* Switch buffers if triple buffering is enabled */
|
||||||
dvram_switch();
|
dvram_switch();
|
||||||
|
|
|
@ -28,8 +28,7 @@ void dupdate(void)
|
||||||
t6k11_display(gint_vram, 0, 64, 16);
|
t6k11_display(gint_vram, 0, 64, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint_call_t hook = dupdate_get_hook();
|
gint_call(dupdate_get_hook());
|
||||||
if(hook.function) gint_call(hook);
|
|
||||||
}
|
}
|
||||||
__attribute__((alias("dupdate")))
|
__attribute__((alias("dupdate")))
|
||||||
void _WEAK_dupdate(void);
|
void _WEAK_dupdate(void);
|
||||||
|
|
|
@ -263,10 +263,10 @@ static void finish_transfer(struct transfer volatile *t, int pipe)
|
||||||
t->used = 0;
|
t->used = 0;
|
||||||
|
|
||||||
/* Disable the interrupt */
|
/* Disable the interrupt */
|
||||||
if(pipe) USB.BEMPENB &= ~(1 << pipe);
|
if(pipe != 0)
|
||||||
|
USB.BEMPENB &= ~(1 << pipe);
|
||||||
if(t->callback.function) gint_call(t->callback);
|
|
||||||
|
|
||||||
|
gint_call(t->callback);
|
||||||
USB_TRACE("finish_transfer()");
|
USB_TRACE("finish_transfer()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,14 +287,14 @@ static void finish_round(struct transfer volatile *t, int pipe)
|
||||||
t->flying = 0;
|
t->flying = 0;
|
||||||
|
|
||||||
/* Account for auto-transfers */
|
/* Account for auto-transfers */
|
||||||
if(t->used == pipe_bufsize(pipe)) t->used = 0;
|
if(t->used == pipe_bufsize(pipe))
|
||||||
|
t->used = 0;
|
||||||
|
|
||||||
/* At the end, free the FIFO and invoke the callback. Hold the
|
/* At the end, free the FIFO and invoke the callback. Hold the
|
||||||
controller until the pipe is committed */
|
controller until the pipe is committed */
|
||||||
if(t->size == 0)
|
if(t->size == 0) {
|
||||||
{
|
|
||||||
t->data = NULL;
|
t->data = NULL;
|
||||||
if(t->callback.function) gint_call(t->callback);
|
gint_call(t->callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
USB_TRACE("finish_round()");
|
USB_TRACE("finish_round()");
|
||||||
|
|
|
@ -266,13 +266,9 @@ static void usb_interrupt_handler(void)
|
||||||
if(USB.INTSTS0.DVSQ == 3)
|
if(USB.INTSTS0.DVSQ == 3)
|
||||||
{
|
{
|
||||||
usb_configure_clear_pipes();
|
usb_configure_clear_pipes();
|
||||||
|
|
||||||
usb_open_status = true;
|
usb_open_status = true;
|
||||||
if(usb_open_callback.function)
|
gint_call(usb_open_callback);
|
||||||
{
|
usb_open_callback = GINT_CALL_NULL;
|
||||||
gint_call(usb_open_callback);
|
|
||||||
usb_open_callback = GINT_CALL_NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(USB.INTSTS0.BEMP)
|
else if(USB.INTSTS0.BEMP)
|
||||||
|
|
Loading…
Reference in a new issue