Allow calling chopstx_claim_irq when ready (disabled).

This commit is contained in:
NIIBE Yutaka
2019-05-10 12:05:35 +09:00
parent c1ea549995
commit 79305c3de4
8 changed files with 36 additions and 63 deletions

View File

@@ -725,24 +725,17 @@ cdc_main (void *arg)
#if defined(OLDER_SYS_H)
/*
* Historically (before sys < 3.0), NVIC priority setting for USB
* interrupt was done in usb_lld_sys_init. Thus this code.
*
* When USB interrupt occurs between usb_lld_init (which assumes
* ISR) and chopstx_claim_irq (which clears pending interrupt),
* invocation of usb_lld_event_handler won't occur.
*
* Calling usb_lld_event_handler is no harm even if there were no
* interrupts, thus, we call it unconditionally here, just in case
* if there is a request.
* interrupt was done in usb_lld_sys_init for free standing
* application. Thus this compatibility code.
*
* We can't call usb_lld_init after chopstx_claim_irq, as
* usb_lld_init does its own setting for NVIC. Calling
* chopstx_claim_irq after usb_lld_init overrides that.
* usb_lld_init does its own setting for NVIC, which is incompatible
* to Chopstx's interrupt handling. Calling chopstx_claim_irq after
* usb_lld_init overrides that for Chopstx.
*
*/
usb_lld_init (&dev, VCOM_FEATURE_BUS_POWERED);
chopstx_claim_irq (&usb_intr, INTR_REQ_USB);
goto event_handle;
#else
chopstx_claim_irq (&usb_intr, INTR_REQ_USB);
usb_lld_init (&dev, VCOM_FEATURE_BUS_POWERED);