callback fix
This commit is contained in:
parent
0be9113381
commit
2a57bfea62
@ -472,6 +472,8 @@ static void udp_handle_ep(uint32_t ep)
|
||||
ep_handle_ctrlrequest(&req);
|
||||
}
|
||||
|
||||
void (* transfer_cb)(void) = NULL;
|
||||
|
||||
/* transmit complete? */
|
||||
if (*csr & AT91C_UDP_TXCOMP) {
|
||||
struct ep_ctx *ctx = &ep_ctx[ep];
|
||||
@ -497,9 +499,7 @@ static void udp_handle_ep(uint32_t ep)
|
||||
/* transfer complete, execute callback */
|
||||
} else {
|
||||
ctx->flags &= ~CTX_IN;
|
||||
|
||||
if (transfer->complete_cb)
|
||||
transfer->complete_cb();
|
||||
transfer_cb = transfer->complete_cb;
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,8 +520,6 @@ static void udp_handle_ep(uint32_t ep)
|
||||
ctx->transfer->curpos = 0;
|
||||
}
|
||||
|
||||
void *exec_cb = NULL;
|
||||
|
||||
if (ctx->flags & CTX_FIFO) {
|
||||
fifo_rxudp(ctx->fifo, ep, len);
|
||||
|
||||
@ -538,9 +536,7 @@ static void udp_handle_ep(uint32_t ep)
|
||||
/* test again */
|
||||
if (transfer->length == transfer->curpos) {
|
||||
ctx->flags &= ~CTX_OUT;
|
||||
|
||||
/* exec callback after rxbank ack */
|
||||
exec_cb = transfer->complete_cb;
|
||||
transfer_cb = transfer->complete_cb;
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,10 +554,10 @@ static void udp_handle_ep(uint32_t ep)
|
||||
|
||||
ctx->flags = (ctx->flags & ~CTX_RXBANK1) | CTX_RXBANK0;
|
||||
}
|
||||
|
||||
if (exec_cb)
|
||||
ctx->transfer->complete_cb();
|
||||
}
|
||||
|
||||
if (transfer_cb)
|
||||
transfer_cb();
|
||||
}
|
||||
|
||||
static void udp_isr(void)
|
||||
|
Loading…
Reference in New Issue
Block a user