mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
USBTMC: Handle busy interrupt in.
This commit is contained in:
parent
239b5d5279
commit
c675debfb2
@ -189,7 +189,10 @@ typedef enum {
|
|||||||
USBTMC_STATUS_FAILED = 0x80,
|
USBTMC_STATUS_FAILED = 0x80,
|
||||||
USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS = 0x81,
|
USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS = 0x81,
|
||||||
USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS = 0x82,
|
USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS = 0x82,
|
||||||
USBTMC_STATUS_SPLIT_IN_PROGRESS = 0x83
|
USBTMC_STATUS_SPLIT_IN_PROGRESS = 0x83,
|
||||||
|
|
||||||
|
/****** USBTMC 488 *************/
|
||||||
|
USB488_STATUS_INTERRUPT_IN_BUSY = 0x20
|
||||||
} usbtmc_status_enum;
|
} usbtmc_status_enum;
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
@ -831,26 +831,32 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
|
|||||||
|
|
||||||
bTag = request->wValue & 0x7F;
|
bTag = request->wValue & 0x7F;
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1);
|
TU_VERIFY(request->bmRequestType == 0xA1);
|
||||||
TU_VERIFY((request->wValue & (~0x7F)) == 0u); // Other bits are required to be zero
|
TU_VERIFY((request->wValue & (~0x7F)) == 0u); // Other bits are required to be zero (USB488v1.0 Table 11)
|
||||||
TU_VERIFY(bTag >= 0x02 && bTag <= 127);
|
TU_VERIFY(bTag >= 0x02 && bTag <= 127);
|
||||||
TU_VERIFY(request->wIndex == usbtmc_state.itf_id);
|
TU_VERIFY(request->wIndex == usbtmc_state.itf_id);
|
||||||
TU_VERIFY(request->wLength == 0x0003);
|
TU_VERIFY(request->wLength == 0x0003);
|
||||||
rsp.bTag = (uint8_t)bTag;
|
rsp.bTag = (uint8_t)bTag;
|
||||||
if(usbtmc_state.ep_int_in != 0)
|
if(usbtmc_state.ep_int_in != 0)
|
||||||
{
|
{
|
||||||
rsp.USBTMC_status = USBTMC_STATUS_SUCCESS;
|
rsp.statusByte = 0x00; // Use interrupt endpoint, instead. Must be 0x00 (USB488v1.0 4.3.1.2)
|
||||||
rsp.statusByte = 0x00; // Use interrupt endpoint, instead.
|
if(usbd_edpt_busy(rhport, usbtmc_state.ep_int_in))
|
||||||
|
|
||||||
usbtmc_read_stb_interrupt_488_t intMsg =
|
|
||||||
{
|
{
|
||||||
.bNotify1 = {
|
rsp.USBTMC_status = USB488_STATUS_INTERRUPT_IN_BUSY;
|
||||||
.one = 1,
|
}
|
||||||
.bTag = bTag & 0x7Fu,
|
else
|
||||||
},
|
{
|
||||||
.StatusByte = tud_usbtmc_get_stb_cb(&(rsp.USBTMC_status))
|
rsp.USBTMC_status = USBTMC_STATUS_SUCCESS;
|
||||||
};
|
usbtmc_read_stb_interrupt_488_t intMsg =
|
||||||
// USB488 spec states that transfer must be queued before control request response sent.
|
{
|
||||||
usbd_edpt_xfer(rhport, usbtmc_state.ep_int_in, (void*)&intMsg, sizeof(intMsg));
|
.bNotify1 = {
|
||||||
|
.one = 1,
|
||||||
|
.bTag = bTag & 0x7Fu,
|
||||||
|
},
|
||||||
|
.StatusByte = tud_usbtmc_get_stb_cb(&(rsp.USBTMC_status))
|
||||||
|
};
|
||||||
|
// Must be queued before control request response sent (USB488v1.0 4.3.1.2)
|
||||||
|
usbd_edpt_xfer(rhport, usbtmc_state.ep_int_in, (void*)&intMsg, sizeof(intMsg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user