mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Remove debug printf.
This commit is contained in:
parent
d4b2dff7c4
commit
0548f97d33
@ -99,9 +99,6 @@ bool usbtmcd_app_msgBulkOut_start(uint8_t rhport, usbtmc_msg_request_dev_dep_out
|
|||||||
{
|
{
|
||||||
(void)rhport;
|
(void)rhport;
|
||||||
(void)msgHeader;
|
(void)msgHeader;
|
||||||
#ifdef xDEBUG
|
|
||||||
uart_tx_str_sync("MSG_OUT_DATA: start\r\n");
|
|
||||||
#endif
|
|
||||||
buffer_len = 0;
|
buffer_len = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -111,15 +108,6 @@ bool usbtmcd_app_msg_data(uint8_t rhport, void *data, size_t len, bool transfer_
|
|||||||
(void)rhport;
|
(void)rhport;
|
||||||
|
|
||||||
// If transfer isn't finished, we just ignore it (for now)
|
// If transfer isn't finished, we just ignore it (for now)
|
||||||
#ifdef xDEBUG
|
|
||||||
uart_tx_str_sync("MSG_OUT_DATA: <<<");
|
|
||||||
uart_tx_sync(data,len);
|
|
||||||
uart_tx_str_sync(">>>\r\n");
|
|
||||||
if(transfer_complete)
|
|
||||||
uart_tx_str_sync("MSG_OUT_DATA: Complete\r\n");
|
|
||||||
sprintf(bigMsg, "len=%u complete=%u\r\n",len,(uint32_t)transfer_complete);
|
|
||||||
uart_tx_str_sync(bigMsg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(len + buffer_len < sizeof(buffer))
|
if(len + buffer_len < sizeof(buffer))
|
||||||
{
|
{
|
||||||
@ -201,9 +189,7 @@ void usbtmc_app_task_iter(void) {
|
|||||||
if(bulkInStarted) {
|
if(bulkInStarted) {
|
||||||
queryState = 0;
|
queryState = 0;
|
||||||
bulkInStarted = 0;
|
bulkInStarted = 0;
|
||||||
#ifdef xDEBUG
|
|
||||||
uart_tx_str_sync("usbtmc_app_task_iter: sending rsp!\r\n");
|
|
||||||
#endif
|
|
||||||
if(idnQuery)
|
if(idnQuery)
|
||||||
{
|
{
|
||||||
usbtmcd_transmit_dev_msg_data(rhport, idn, tu_min32(sizeof(idn)-1,msgReqLen),false);
|
usbtmcd_transmit_dev_msg_data(rhport, idn, tu_min32(sizeof(idn)-1,msgReqLen),false);
|
||||||
|
@ -137,11 +137,6 @@ static usbtmc_interface_state_t usbtmc_state =
|
|||||||
.ep_bulk_out = 0,
|
.ep_bulk_out = 0,
|
||||||
.ep_int_in = 0
|
.ep_int_in = 0
|
||||||
};
|
};
|
||||||
#ifdef xDEBUG
|
|
||||||
#define TRACE(str) uart_tx_str_sync(str)
|
|
||||||
#else
|
|
||||||
#define TRACE(STR) do {} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// We need all headers to fit in a single packet in this implementation.
|
// We need all headers to fit in a single packet in this implementation.
|
||||||
TU_VERIFY_STATIC(USBTMCD_MAX_PACKET_SIZE >= 32u,"USBTMC dev EP packet size too small");
|
TU_VERIFY_STATIC(USBTMCD_MAX_PACKET_SIZE >= 32u,"USBTMC dev EP packet size too small");
|
||||||
@ -383,11 +378,6 @@ static bool handle_devMsgIn(uint8_t rhport, void *data, size_t len)
|
|||||||
TU_VERIFY(len == sizeof(usbtmc_msg_request_dev_dep_in));
|
TU_VERIFY(len == sizeof(usbtmc_msg_request_dev_dep_in));
|
||||||
usbtmc_msg_request_dev_dep_in *msg = (usbtmc_msg_request_dev_dep_in*)data;
|
usbtmc_msg_request_dev_dep_in *msg = (usbtmc_msg_request_dev_dep_in*)data;
|
||||||
|
|
||||||
#ifdef xDebug
|
|
||||||
sprintf(logMsg," handle_devMsgIn len=%ul\r\n",len);
|
|
||||||
TRACE(logMsg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
criticalEnter();
|
criticalEnter();
|
||||||
{
|
{
|
||||||
TU_VERIFY(usbtmc_state.state == STATE_IDLE);
|
TU_VERIFY(usbtmc_state.state == STATE_IDLE);
|
||||||
@ -409,14 +399,8 @@ static bool handle_devMsgIn(uint8_t rhport, void *data, size_t len)
|
|||||||
|
|
||||||
bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
|
bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
|
||||||
{
|
{
|
||||||
TRACE("USBTMC Xfer CB" );
|
|
||||||
TU_VERIFY(result == XFER_RESULT_SUCCESS);
|
TU_VERIFY(result == XFER_RESULT_SUCCESS);
|
||||||
|
|
||||||
#ifdef xDebug
|
|
||||||
sprintf(logMsg," STATE=%lu ", (uint32_t)usbtmc_state.state);
|
|
||||||
TRACE(logMsg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(usbtmc_state.state == STATE_CLEARING) {
|
if(usbtmc_state.state == STATE_CLEARING) {
|
||||||
return true; /* I think we can ignore everything here */
|
return true; /* I think we can ignore everything here */
|
||||||
}
|
}
|
||||||
@ -424,7 +408,7 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
|
|||||||
if(ep_addr == usbtmc_state.ep_bulk_out)
|
if(ep_addr == usbtmc_state.ep_bulk_out)
|
||||||
{
|
{
|
||||||
usbtmc_msg_generic_t *msg = NULL;
|
usbtmc_msg_generic_t *msg = NULL;
|
||||||
TRACE("OUT");
|
|
||||||
switch(usbtmc_state.state)
|
switch(usbtmc_state.state)
|
||||||
{
|
{
|
||||||
case STATE_IDLE:
|
case STATE_IDLE:
|
||||||
@ -434,11 +418,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
|
|||||||
TU_VERIFY(msg->header.bTag == invInvTag);
|
TU_VERIFY(msg->header.bTag == invInvTag);
|
||||||
TU_VERIFY(msg->header.bTag != 0x00);
|
TU_VERIFY(msg->header.bTag != 0x00);
|
||||||
|
|
||||||
#ifdef xDebug
|
|
||||||
sprintf(logMsg," type=%lu\r\n",(uint32_t)msg->header.MsgID);
|
|
||||||
TRACE(logMsg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(msg->header.MsgID) {
|
switch(msg->header.MsgID) {
|
||||||
case USBTMC_MSGID_DEV_DEP_MSG_OUT:
|
case USBTMC_MSGID_DEV_DEP_MSG_OUT:
|
||||||
usbtmc_state.transfer_size_sent = 0u;
|
usbtmc_state.transfer_size_sent = 0u;
|
||||||
@ -447,7 +426,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case USBTMC_MSGID_DEV_DEP_MSG_IN:
|
case USBTMC_MSGID_DEV_DEP_MSG_IN:
|
||||||
TRACE("Handling msg in req\r\n");
|
|
||||||
TU_VERIFY(handle_devMsgIn(rhport, msg, xferred_bytes));
|
TU_VERIFY(handle_devMsgIn(rhport, msg, xferred_bytes));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -484,71 +462,52 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
|
|||||||
case STATE_ABORTING_BULK_IN_ABORTED:
|
case STATE_ABORTING_BULK_IN_ABORTED:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef xDebug
|
|
||||||
if(msg == NULL)
|
|
||||||
sprintf(logMsg," Unknown received control?\r\n ");
|
|
||||||
else {
|
|
||||||
sprintf(logMsg," msg=%lu\r\n ", (uint32_t)msg->header.MsgID);
|
|
||||||
}
|
|
||||||
TRACE(logMsg);
|
|
||||||
#endif
|
|
||||||
TU_VERIFY(false);
|
TU_VERIFY(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ep_addr == usbtmc_state.ep_bulk_in)
|
else if(ep_addr == usbtmc_state.ep_bulk_in)
|
||||||
{
|
{
|
||||||
#ifdef xDebug
|
|
||||||
sprintf(logMsg,"IN\r\n");
|
|
||||||
TRACE(logMsg);
|
|
||||||
#endif
|
|
||||||
switch(usbtmc_state.state) {
|
switch(usbtmc_state.state) {
|
||||||
case STATE_TX_SHORTED:
|
case STATE_TX_SHORTED:
|
||||||
|
|
||||||
TRACE("IN TX shorted done\r\n");
|
|
||||||
|
|
||||||
usbtmc_state.state = STATE_IDLE;
|
usbtmc_state.state = STATE_IDLE;
|
||||||
TU_VERIFY(usbtmcd_app_msgBulkIn_complete(rhport));
|
TU_VERIFY(usbtmcd_app_msgBulkIn_complete(rhport));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_TX_INITIATED:
|
case STATE_TX_INITIATED:
|
||||||
if(usbtmc_state.transfer_size_remaining >=sizeof(usbtmc_state.ep_bulk_in_buf))
|
if(usbtmc_state.transfer_size_remaining >=sizeof(usbtmc_state.ep_bulk_in_buf))
|
||||||
{
|
{
|
||||||
TRACE("IN TX continuing\r\n");
|
|
||||||
// FIXME! This removes const below!
|
// FIXME! This removes const below!
|
||||||
TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in,
|
TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in,
|
||||||
(void*)usbtmc_state.devInBuffer,sizeof(usbtmc_state.ep_bulk_in_buf)));
|
(void*)usbtmc_state.devInBuffer,sizeof(usbtmc_state.ep_bulk_in_buf)));
|
||||||
usbtmc_state.devInBuffer += sizeof(usbtmc_state.ep_bulk_in_buf);
|
usbtmc_state.devInBuffer += sizeof(usbtmc_state.ep_bulk_in_buf);
|
||||||
usbtmc_state.transfer_size_remaining -= sizeof(usbtmc_state.ep_bulk_in_buf);
|
usbtmc_state.transfer_size_remaining -= sizeof(usbtmc_state.ep_bulk_in_buf);
|
||||||
usbtmc_state.transfer_size_sent += sizeof(usbtmc_state.ep_bulk_in_buf);
|
usbtmc_state.transfer_size_sent += sizeof(usbtmc_state.ep_bulk_in_buf);
|
||||||
}
|
}
|
||||||
else // last packet
|
else // last packet
|
||||||
{
|
{
|
||||||
TRACE("IN TX last packet\r\n");
|
size_t packetLen = usbtmc_state.transfer_size_remaining;
|
||||||
size_t packetLen = usbtmc_state.transfer_size_remaining;
|
memcpy(usbtmc_state.ep_bulk_in_buf, usbtmc_state.devInBuffer, usbtmc_state.transfer_size_remaining);
|
||||||
memcpy(usbtmc_state.ep_bulk_in_buf, usbtmc_state.devInBuffer, usbtmc_state.transfer_size_remaining);
|
|
||||||
usbtmc_state.transfer_size_sent += sizeof(usbtmc_state.transfer_size_remaining);
|
usbtmc_state.transfer_size_sent += sizeof(usbtmc_state.transfer_size_remaining);
|
||||||
usbtmc_state.transfer_size_remaining = 0;
|
usbtmc_state.transfer_size_remaining = 0;
|
||||||
usbtmc_state.devInBuffer = NULL;
|
usbtmc_state.devInBuffer = NULL;
|
||||||
TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in, usbtmc_state.ep_bulk_in_buf,(uint16_t)packetLen));
|
TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in, usbtmc_state.ep_bulk_in_buf,(uint16_t)packetLen));
|
||||||
if(((packetLen % USBTMCD_MAX_PACKET_SIZE) != 0) || (packetLen == 0 ))
|
if(((packetLen % USBTMCD_MAX_PACKET_SIZE) != 0) || (packetLen == 0 ))
|
||||||
{
|
{
|
||||||
usbtmc_state.state = STATE_TX_SHORTED;
|
usbtmc_state.state = STATE_TX_SHORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case STATE_ABORTING_BULK_IN:
|
case STATE_ABORTING_BULK_IN:
|
||||||
// need to send short packet (ZLP?)
|
// need to send short packet (ZLP?)
|
||||||
TRACE("IN aborting\r\n");
|
|
||||||
TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in, usbtmc_state.ep_bulk_in_buf,(uint16_t)0u));
|
TU_VERIFY( usbd_edpt_xfer(rhport, usbtmc_state.ep_bulk_in, usbtmc_state.ep_bulk_in_buf,(uint16_t)0u));
|
||||||
usbtmc_state.state = STATE_ABORTING_BULK_IN_SHORTED;
|
usbtmc_state.state = STATE_ABORTING_BULK_IN_SHORTED;
|
||||||
return true;
|
return true;
|
||||||
case STATE_ABORTING_BULK_IN_SHORTED:
|
case STATE_ABORTING_BULK_IN_SHORTED:
|
||||||
/* Done. :)*/
|
/* Done. :)*/
|
||||||
TRACE("IN shorted\r\n");
|
|
||||||
usbtmc_state.state = STATE_ABORTING_BULK_IN_ABORTED;
|
usbtmc_state.state = STATE_ABORTING_BULK_IN_ABORTED;
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
TRACE("IN unknown\r\n");
|
|
||||||
TU_ASSERT(false);
|
TU_ASSERT(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -566,14 +525,12 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
#if (USBTMC_CFG_ENABLE_488)
|
#if (USBTMC_CFG_ENABLE_488)
|
||||||
uint8_t bTag;
|
uint8_t bTag;
|
||||||
#endif
|
#endif
|
||||||
TRACE("xfer cb\r\n");
|
|
||||||
|
|
||||||
if((request->bmRequestType_bit.type == TUSB_REQ_TYPE_STANDARD) &&
|
if((request->bmRequestType_bit.type == TUSB_REQ_TYPE_STANDARD) &&
|
||||||
(request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_ENDPOINT) &&
|
(request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_ENDPOINT) &&
|
||||||
(request->bRequest == TUSB_REQ_CLEAR_FEATURE) &&
|
(request->bRequest == TUSB_REQ_CLEAR_FEATURE) &&
|
||||||
(request->wValue == TUSB_REQ_FEATURE_EDPT_HALT))
|
(request->wValue == TUSB_REQ_FEATURE_EDPT_HALT))
|
||||||
{
|
{
|
||||||
TRACE("feature clear\r\n");
|
|
||||||
if((request->wIndex) == usbtmc_state.ep_bulk_out)
|
if((request->wIndex) == usbtmc_state.ep_bulk_out)
|
||||||
{
|
{
|
||||||
usmtmcd_app_bulkOut_clearFeature(rhport);
|
usmtmcd_app_bulkOut_clearFeature(rhport);
|
||||||
@ -602,7 +559,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
usbtmc_initiate_abort_rsp_t rsp = {
|
usbtmc_initiate_abort_rsp_t rsp = {
|
||||||
.bTag = usbtmc_state.lastBulkOutTag,
|
.bTag = usbtmc_state.lastBulkOutTag,
|
||||||
};
|
};
|
||||||
TRACE("init abort bulk out\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA2); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA2); // in,class,interface
|
||||||
TU_VERIFY(request->wLength == sizeof(rsp));
|
TU_VERIFY(request->wLength == sizeof(rsp));
|
||||||
TU_VERIFY(request->wIndex == usbtmc_state.ep_bulk_out);
|
TU_VERIFY(request->wIndex == usbtmc_state.ep_bulk_out);
|
||||||
@ -611,12 +567,10 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
if(usbtmc_state.state != STATE_RCV)
|
if(usbtmc_state.state != STATE_RCV)
|
||||||
{
|
{
|
||||||
rsp.USBTMC_status = USBTMC_STATUS_FAILED;
|
rsp.USBTMC_status = USBTMC_STATUS_FAILED;
|
||||||
TRACE("init abort bulk out failed\r\n");
|
|
||||||
}
|
}
|
||||||
else if(usbtmc_state.lastBulkOutTag == (request->wValue & 0xf7u))
|
else if(usbtmc_state.lastBulkOutTag == (request->wValue & 0xf7u))
|
||||||
{
|
{
|
||||||
rsp.USBTMC_status = USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS;
|
rsp.USBTMC_status = USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS;
|
||||||
TRACE("init abort bulk out not inprogress\r\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -625,14 +579,12 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
usbtmc_state.state = STATE_ABORTING_BULK_OUT;
|
usbtmc_state.state = STATE_ABORTING_BULK_OUT;
|
||||||
TU_VERIFY(usbtmcd_app_initiate_abort_bulk_out(rhport, &(rsp.USBTMC_status)));
|
TU_VERIFY(usbtmcd_app_initiate_abort_bulk_out(rhport, &(rsp.USBTMC_status)));
|
||||||
usbd_edpt_stall(rhport, usbtmc_state.ep_bulk_out);
|
usbd_edpt_stall(rhport, usbtmc_state.ep_bulk_out);
|
||||||
TRACE("init abort bulk out success\r\n");
|
|
||||||
}
|
}
|
||||||
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&rsp,sizeof(rsp)));
|
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&rsp,sizeof(rsp)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case USBTMC_bREQUEST_CHECK_ABORT_BULK_OUT_STATUS:
|
case USBTMC_bREQUEST_CHECK_ABORT_BULK_OUT_STATUS:
|
||||||
{
|
{
|
||||||
TRACE("init check abort bulk out\r\n");
|
|
||||||
usbtmc_check_abort_bulk_rsp_t rsp = {
|
usbtmc_check_abort_bulk_rsp_t rsp = {
|
||||||
.USBTMC_status = USBTMC_STATUS_SUCCESS,
|
.USBTMC_status = USBTMC_STATUS_SUCCESS,
|
||||||
.NBYTES_RXD_TXD = usbtmc_state.transfer_size_sent
|
.NBYTES_RXD_TXD = usbtmc_state.transfer_size_sent
|
||||||
@ -650,7 +602,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
usbtmc_initiate_abort_rsp_t rsp = {
|
usbtmc_initiate_abort_rsp_t rsp = {
|
||||||
.bTag = usbtmc_state.lastBulkInTag,
|
.bTag = usbtmc_state.lastBulkInTag,
|
||||||
};
|
};
|
||||||
TRACE("init abort bulk in\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA2); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA2); // in,class,interface
|
||||||
TU_VERIFY(request->wLength == sizeof(rsp));
|
TU_VERIFY(request->wLength == sizeof(rsp));
|
||||||
TU_VERIFY(request->wIndex == usbtmc_state.ep_bulk_in);
|
TU_VERIFY(request->wIndex == usbtmc_state.ep_bulk_in);
|
||||||
@ -664,17 +615,14 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
usbtmc_state.state = ((usbtmc_state.transfer_size_sent % USBTMCD_MAX_PACKET_SIZE) != 0) ?
|
usbtmc_state.state = ((usbtmc_state.transfer_size_sent % USBTMCD_MAX_PACKET_SIZE) != 0) ?
|
||||||
STATE_ABORTING_BULK_IN : STATE_ABORTING_BULK_IN_SHORTED;
|
STATE_ABORTING_BULK_IN : STATE_ABORTING_BULK_IN_SHORTED;
|
||||||
TU_VERIFY(usbtmcd_app_initiate_abort_bulk_in(rhport, &(rsp.USBTMC_status)));
|
TU_VERIFY(usbtmcd_app_initiate_abort_bulk_in(rhport, &(rsp.USBTMC_status)));
|
||||||
TRACE("init abort bulk success\r\n");
|
|
||||||
}
|
}
|
||||||
else if((usbtmc_state.state == STATE_TX_REQUESTED || usbtmc_state.state == STATE_TX_INITIATED))
|
else if((usbtmc_state.state == STATE_TX_REQUESTED || usbtmc_state.state == STATE_TX_INITIATED))
|
||||||
{ // FIXME: Unsure how to check if the OUT endpoint fifo is non-empty....
|
{ // FIXME: Unsure how to check if the OUT endpoint fifo is non-empty....
|
||||||
rsp.USBTMC_status = USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS;
|
rsp.USBTMC_status = USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS;
|
||||||
TRACE("init abort bulk in not in progress\r\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rsp.USBTMC_status = USBTMC_STATUS_FAILED;
|
rsp.USBTMC_status = USBTMC_STATUS_FAILED;
|
||||||
TRACE("init abort bulk in failed\r\n");
|
|
||||||
}
|
}
|
||||||
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&rsp,sizeof(rsp)));
|
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&rsp,sizeof(rsp)));
|
||||||
return true;
|
return true;
|
||||||
@ -682,7 +630,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
|
|
||||||
case USBTMC_bREQUEST_CHECK_ABORT_BULK_IN_STATUS:
|
case USBTMC_bREQUEST_CHECK_ABORT_BULK_IN_STATUS:
|
||||||
{
|
{
|
||||||
TRACE("xfer check abort in\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA2); // in,class,EP
|
TU_VERIFY(request->bmRequestType == 0xA2); // in,class,EP
|
||||||
TU_VERIFY(request->wLength == 8u);
|
TU_VERIFY(request->wLength == 8u);
|
||||||
|
|
||||||
@ -715,7 +662,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
|
|
||||||
case USBTMC_bREQUEST_INITIATE_CLEAR:
|
case USBTMC_bREQUEST_INITIATE_CLEAR:
|
||||||
{
|
{
|
||||||
TRACE("init clear\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
||||||
TU_VERIFY(request->wLength == sizeof(tmcStatusCode));
|
TU_VERIFY(request->wLength == sizeof(tmcStatusCode));
|
||||||
// After receiving an INITIATE_CLEAR request, the device must Halt the Bulk-OUT endpoint, queue the
|
// After receiving an INITIATE_CLEAR request, the device must Halt the Bulk-OUT endpoint, queue the
|
||||||
@ -730,7 +676,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
|
|
||||||
case USBTMC_bREQUEST_CHECK_CLEAR_STATUS:
|
case USBTMC_bREQUEST_CHECK_CLEAR_STATUS:
|
||||||
{
|
{
|
||||||
TRACE("check clear\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
||||||
usbtmc_get_clear_status_rsp_t clearStatusRsp = {0};
|
usbtmc_get_clear_status_rsp_t clearStatusRsp = {0};
|
||||||
TU_VERIFY(request->wLength == sizeof(clearStatusRsp));
|
TU_VERIFY(request->wLength == sizeof(clearStatusRsp));
|
||||||
@ -754,7 +699,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
|
|
||||||
case USBTMC_bREQUEST_GET_CAPABILITIES:
|
case USBTMC_bREQUEST_GET_CAPABILITIES:
|
||||||
{
|
{
|
||||||
TRACE("get capabilities\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
||||||
TU_VERIFY(request->wLength == sizeof(usbtmcd_app_capabilities));
|
TU_VERIFY(request->wLength == sizeof(usbtmcd_app_capabilities));
|
||||||
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&usbtmcd_app_capabilities, sizeof(usbtmcd_app_capabilities)));
|
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&usbtmcd_app_capabilities, sizeof(usbtmcd_app_capabilities)));
|
||||||
@ -764,7 +708,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
|
|
||||||
case USBTMC_bREQUEST_INDICATOR_PULSE: // Optional
|
case USBTMC_bREQUEST_INDICATOR_PULSE: // Optional
|
||||||
{
|
{
|
||||||
TRACE("indicate\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
||||||
TU_VERIFY(request->wLength == sizeof(tmcStatusCode));
|
TU_VERIFY(request->wLength == sizeof(tmcStatusCode));
|
||||||
TU_VERIFY(usbtmcd_app_capabilities.bmIntfcCapabilities.supportsIndicatorPulse);
|
TU_VERIFY(usbtmcd_app_capabilities.bmIntfcCapabilities.supportsIndicatorPulse);
|
||||||
@ -777,7 +720,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
// USB488 required requests
|
// USB488 required requests
|
||||||
case USBTMC488_bREQUEST_READ_STATUS_BYTE:
|
case USBTMC488_bREQUEST_READ_STATUS_BYTE:
|
||||||
{
|
{
|
||||||
TRACE("read stb\r\n");
|
|
||||||
usbtmc_read_stb_rsp_488_t rsp;
|
usbtmc_read_stb_rsp_488_t rsp;
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
||||||
TU_VERIFY(request->wLength == sizeof(rsp)); // in,class,interface
|
TU_VERIFY(request->wLength == sizeof(rsp)); // in,class,interface
|
||||||
@ -816,7 +758,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
case USBTMC488_bREQUEST_GO_TO_LOCAL:
|
case USBTMC488_bREQUEST_GO_TO_LOCAL:
|
||||||
case USBTMC488_bREQUEST_LOCAL_LOCKOUT:
|
case USBTMC488_bREQUEST_LOCAL_LOCKOUT:
|
||||||
{
|
{
|
||||||
TRACE("Unsupported REN/GTL/LLO\r\n");
|
|
||||||
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
TU_VERIFY(request->bmRequestType == 0xA1); // in,class,interface
|
||||||
TU_VERIFY(false);
|
TU_VERIFY(false);
|
||||||
return false;
|
return false;
|
||||||
@ -824,7 +765,6 @@ bool usbtmcd_control_request(uint8_t rhport, tusb_control_request_t const * requ
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
TRACE("Default CTRL handler\r\n");
|
|
||||||
TU_VERIFY(false);
|
TU_VERIFY(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user