integrate ccid and usb threads

This commit is contained in:
NIIBE Yutaka
2016-05-18 21:34:14 +09:00
parent 48905155c5
commit 51d4b754e6
5 changed files with 124 additions and 156 deletions

View File

@@ -488,68 +488,3 @@ int usb_cb_interface (uint8_t cmd, struct req_args *arg)
return USB_SUCCESS;
}
}
#define INTR_REQ_USB 20
void *
usb_intr (void *arg)
{
chopstx_intr_t interrupt;
(void)arg;
usb_lld_init (USB_INITIAL_FEATURE);
chopstx_claim_irq (&interrupt, INTR_REQ_USB);
usb_interrupt_handler ();
while (1)
{
chopstx_intr_wait (&interrupt);
/* Process interrupt. */
usb_interrupt_handler ();
}
return NULL;
}
extern void EP1_IN_Callback (void);
extern void EP2_IN_Callback (void);
extern void EP1_OUT_Callback (void);
extern void EP6_IN_Callback (void);
void
usb_cb_rx_ready (uint8_t ep_num)
{
if (ep_num == ENDP1)
EP1_OUT_Callback ();
#ifdef DEBUG
else if (ep_num == ENDP5)
{
chopstx_mutex_lock (&stdout.m_dev);
usb_lld_rx_enable (ep_num);
chopstx_mutex_unlock (&stdout.m_dev);
}
#endif
}
void
usb_cb_tx_done (uint8_t ep_num)
{
if (ep_num == ENDP1)
EP1_IN_Callback ();
else if (ep_num == ENDP2)
EP2_IN_Callback ();
#ifdef DEBUG
else if (ep_num == ENDP3)
{
chopstx_mutex_lock (&stdout.m_dev);
chopstx_cond_signal (&stdout.cond_dev);
chopstx_mutex_unlock (&stdout.m_dev);
}
#endif
#ifdef PINPAD_SUPPORT
else if (ep_num == ENDP6)
EP6_IN_Callback ();
#endif
}