mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-21 16:20:46 +00:00
Rename USBTMC functions.
This commit is contained in:
parent
412a279073
commit
2d4352bfe9
@ -57,7 +57,7 @@
|
||||
|
||||
#define CFG_TUD_USBTMC 1
|
||||
#define CFG_TUD_USBTMC_ENABLE_INT_EP 1
|
||||
#define CFG_USBTMC_CFG_ENABLE_488 1
|
||||
#define CFG_TUD_USBTMC_ENABLE_488 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "bsp/board.h"
|
||||
#include "main.h"
|
||||
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
usbtmc_response_capabilities_488_t const
|
||||
#else
|
||||
usbtmc_response_capabilities_t const
|
||||
@ -48,7 +48,7 @@ tud_usbtmc_app_capabilities =
|
||||
.canEndBulkInOnTermChar = 0
|
||||
},
|
||||
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
.bcdUSB488 = USBTMC_488_VERSION,
|
||||
.bmIntfcCapabilities488 =
|
||||
{
|
||||
@ -99,7 +99,7 @@ static usbtmc_msg_dev_dep_msg_in_header_t rspMsg = {
|
||||
void tud_usbtmc_app_open_cb(uint8_t interface_id)
|
||||
{
|
||||
(void)interface_id;
|
||||
usbtmcd_start_bus_read();
|
||||
tud_usbtmc_start_bus_read();
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ bool tud_usbtmc_app_msg_data_cb(void *data, size_t len, bool transfer_complete)
|
||||
d=0;
|
||||
resp_delay = (uint32_t)d;
|
||||
}
|
||||
usbtmcd_start_bus_read();
|
||||
tud_usbtmc_start_bus_read();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ bool tud_usbtmc_app_msgBulkIn_complete_cb()
|
||||
bulkInStarted = 0;
|
||||
buffer_tx_ix = 0;
|
||||
}
|
||||
usbtmcd_start_bus_read();
|
||||
tud_usbtmc_start_bus_read();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -193,7 +193,7 @@ bool tud_usbtmc_app_msgBulkIn_request_cb(usbtmc_msg_request_dev_dep_in const * r
|
||||
else
|
||||
{
|
||||
size_t txlen = tu_min32(buffer_len-buffer_tx_ix,msgReqLen);
|
||||
usbtmcd_transmit_dev_msg_data(&buffer[buffer_tx_ix], txlen,
|
||||
tud_usbtmc_transmit_dev_msg_data(&buffer[buffer_tx_ix], txlen,
|
||||
(buffer_tx_ix+txlen) == buffer_len, false);
|
||||
buffer_tx_ix += txlen;
|
||||
}
|
||||
@ -226,14 +226,14 @@ void usbtmc_app_task_iter(void) {
|
||||
if(bulkInStarted && (buffer_tx_ix == 0)) {
|
||||
if(idnQuery)
|
||||
{
|
||||
usbtmcd_transmit_dev_msg_data(idn, tu_min32(sizeof(idn)-1,msgReqLen),true,false);
|
||||
tud_usbtmc_transmit_dev_msg_data(idn, tu_min32(sizeof(idn)-1,msgReqLen),true,false);
|
||||
queryState = 0;
|
||||
bulkInStarted = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_tx_ix = tu_min32(buffer_len,msgReqLen);
|
||||
usbtmcd_transmit_dev_msg_data(buffer, buffer_tx_ix, buffer_tx_ix == buffer_len, false);
|
||||
tud_usbtmc_transmit_dev_msg_data(buffer, buffer_tx_ix, buffer_tx_ix == buffer_len, false);
|
||||
}
|
||||
// MAV is cleared in the transfer complete callback.
|
||||
}
|
||||
@ -273,7 +273,7 @@ bool tud_usbtmc_app_initiate_abort_bulk_in_cb(uint8_t *tmcResult)
|
||||
bool tud_usbtmc_app_check_abort_bulk_in_cb(usbtmc_check_abort_bulk_rsp_t *rsp)
|
||||
{
|
||||
(void)rsp;
|
||||
usbtmcd_start_bus_read();
|
||||
tud_usbtmc_start_bus_read();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -286,16 +286,16 @@ bool tud_usbtmc_app_initiate_abort_bulk_out_cb(uint8_t *tmcResult)
|
||||
bool tud_usbtmc_app_check_abort_bulk_out_cb(usbtmc_check_abort_bulk_rsp_t *rsp)
|
||||
{
|
||||
(void)rsp;
|
||||
usbtmcd_start_bus_read();
|
||||
tud_usbtmc_start_bus_read();
|
||||
return true;
|
||||
}
|
||||
|
||||
void usmtmcd_app_bulkIn_clearFeature_cb(void)
|
||||
void tud_usbtmc_app_bulkIn_clearFeature_cb(void)
|
||||
{
|
||||
}
|
||||
void usmtmcd_app_bulkOut_clearFeature_cb(void)
|
||||
void tud_usmtmc_app_bulkOut_clearFeature_cb(void)
|
||||
{
|
||||
usbtmcd_start_bus_read();
|
||||
tud_usbtmc_start_bus_read();
|
||||
}
|
||||
|
||||
// Return status byte, but put the transfer result status code in the rspResult argument.
|
||||
|
@ -186,7 +186,7 @@ bool atomicChangeState(usbtmcd_state_enum expectedState, usbtmcd_state_enum newS
|
||||
|
||||
// We can't just send the whole thing at once because we need to concatanate the
|
||||
// header with the data.
|
||||
bool usbtmcd_transmit_dev_msg_data(
|
||||
bool tud_usbtmc_transmit_dev_msg_data(
|
||||
const void * data, size_t len,
|
||||
bool endOfMessage,
|
||||
bool usingTermChar)
|
||||
@ -236,7 +236,7 @@ bool usbtmcd_transmit_dev_msg_data(
|
||||
void usbtmcd_init_cb(void)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
# if CFG_USBTMC_CFG_ENABLE_488
|
||||
# if CFG_TUD_USBTMC_ENABLE_488
|
||||
if(tud_usbtmc_app_capabilities.bmIntfcCapabilities488.supportsTrigger)
|
||||
TU_ASSERT(&tud_usbtmc_app_msg_trigger_cb != NULL,);
|
||||
// Per USB488 spec: table 8
|
||||
@ -316,7 +316,7 @@ bool usbtmcd_open_cb(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
|
||||
{
|
||||
TU_ASSERT(usbtmc_state.ep_int_in != 0);
|
||||
}
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
if(tud_usbtmc_app_capabilities.bmIntfcCapabilities488.is488_2 ||
|
||||
tud_usbtmc_app_capabilities.bmDevCapabilities488.SR1)
|
||||
{
|
||||
@ -335,7 +335,7 @@ bool usbtmcd_open_cb(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
|
||||
// processing a command (such as a clear). Returns true if it was
|
||||
// in the NAK state and successfully transitioned to the ACK wait
|
||||
// state.
|
||||
bool usbtmcd_start_bus_read()
|
||||
bool tud_usbtmc_start_bus_read()
|
||||
{
|
||||
usbtmcd_state_enum oldState = usbtmc_state.state;
|
||||
switch(oldState)
|
||||
@ -468,7 +468,7 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
|
||||
TU_VERIFY(handle_devMsgIn(msg, xferred_bytes));
|
||||
break;
|
||||
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
case USBTMC_MSGID_USB488_TRIGGER:
|
||||
// Spec says we halt the EP if we didn't declare we support it.
|
||||
TU_VERIFY(tud_usbtmc_app_capabilities.bmIntfcCapabilities488.supportsTrigger);
|
||||
@ -562,7 +562,7 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
|
||||
bool usbtmcd_control_request_cb(uint8_t rhport, tusb_control_request_t const * request) {
|
||||
|
||||
uint8_t tmcStatusCode = USBTMC_STATUS_FAILED;
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
uint8_t bTag;
|
||||
#endif
|
||||
|
||||
@ -578,11 +578,11 @@ bool usbtmcd_control_request_cb(uint8_t rhport, tusb_control_request_t const * r
|
||||
criticalEnter();
|
||||
usbtmc_state.state = STATE_NAK; // USBD core has placed EP in NAK state for us
|
||||
criticalLeave();
|
||||
usmtmcd_app_bulkOut_clearFeature_cb();
|
||||
tud_usmtmc_app_bulkOut_clearFeature_cb();
|
||||
}
|
||||
else if (ep_addr == usbtmc_state.ep_bulk_in)
|
||||
{
|
||||
usmtmcd_app_bulkIn_clearFeature_cb();
|
||||
tud_usbtmc_app_bulkIn_clearFeature_cb();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -783,7 +783,7 @@ bool usbtmcd_control_request_cb(uint8_t rhport, tusb_control_request_t const * r
|
||||
TU_VERIFY(tud_control_xfer(rhport, request, (void*)&tmcStatusCode, sizeof(tmcStatusCode)));
|
||||
return true;
|
||||
}
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
|
||||
// USB488 required requests
|
||||
case USB488_bREQUEST_READ_STATUS_BYTE:
|
||||
|
@ -37,8 +37,8 @@
|
||||
#include "usbtmc.h"
|
||||
|
||||
// Enable 488 mode by default
|
||||
#if !defined(CFG_USBTMC_CFG_ENABLE_488)
|
||||
#define CFG_CFG_USBTMC_CFG_ENABLE_488 (1)
|
||||
#if !defined(CFG_TUD_USBTMC_ENABLE_488)
|
||||
#define CFG_TUD_USBTMC_ENABLE_488 (1)
|
||||
#endif
|
||||
|
||||
// USB spec says that full-speed must be 8,16,32, or 64.
|
||||
@ -49,31 +49,31 @@
|
||||
* Functions to be implemeted by the class implementation
|
||||
*/
|
||||
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
extern usbtmc_response_capabilities_488_t const tud_usbtmc_app_capabilities;
|
||||
#else
|
||||
extern usbtmc_response_capabilities_t const tud_usbtmc_app_capabilities;
|
||||
#endif
|
||||
|
||||
// In order to proceed, app must call call usbtmcd_start_bus_read(rhport) during or soon after:
|
||||
// In order to proceed, app must call call tud_usbtmc_start_bus_read(rhport) during or soon after:
|
||||
// * tud_usbtmc_app_open_cb
|
||||
// * tud_usbtmc_app_msg_data_cb
|
||||
// * tud_usbtmc_app_msgBulkIn_complete_cb
|
||||
// * tud_usbtmc_app_msg_trigger_cb
|
||||
// * (successful) tud_usbtmc_app_check_abort_bulk_out_cb
|
||||
// * (successful) tud_usbtmc_app_check_abort_bulk_in_cb
|
||||
// * (successful) usmtmcd_app_bulkOut_clearFeature_cb
|
||||
// * (successful) tud_usmtmc_app_bulkOut_clearFeature_cb
|
||||
|
||||
void tud_usbtmc_app_open_cb(uint8_t interface_id);
|
||||
|
||||
bool tud_usbtmc_app_msgBulkOut_start_cb(usbtmc_msg_request_dev_dep_out const * msgHeader);
|
||||
// transfer_complete does not imply that a message is complete.
|
||||
bool tud_usbtmc_app_msg_data_cb( void *data, size_t len, bool transfer_complete);
|
||||
void usmtmcd_app_bulkOut_clearFeature_cb(void); // Notice to clear and abort the pending BULK out transfer
|
||||
void tud_usmtmc_app_bulkOut_clearFeature_cb(void); // Notice to clear and abort the pending BULK out transfer
|
||||
|
||||
bool tud_usbtmc_app_msgBulkIn_request_cb(usbtmc_msg_request_dev_dep_in const * request);
|
||||
bool tud_usbtmc_app_msgBulkIn_complete_cb(void);
|
||||
void usmtmcd_app_bulkIn_clearFeature_cb(void); // Notice to clear and abort the pending BULK out transfer
|
||||
void tud_usbtmc_app_bulkIn_clearFeature_cb(void); // Notice to clear and abort the pending BULK out transfer
|
||||
|
||||
bool tud_usbtmc_app_initiate_abort_bulk_in_cb(uint8_t *tmcResult);
|
||||
bool tud_usbtmc_app_initiate_abort_bulk_out_cb(uint8_t *tmcResult);
|
||||
@ -86,7 +86,7 @@ bool tud_usbtmc_app_check_clear_cb(usbtmc_get_clear_status_rsp_t *rsp);
|
||||
// Indicator pulse should be 0.5 to 1.0 seconds long
|
||||
TU_ATTR_WEAK bool tud_usbtmc_app_indicator_pulse_cb(tusb_control_request_t const * msg, uint8_t *tmcResult);
|
||||
|
||||
#if (CFG_USBTMC_CFG_ENABLE_488)
|
||||
#if (CFG_TUD_USBTMC_ENABLE_488)
|
||||
uint8_t tud_usbtmc_app_get_stb_cb(uint8_t *tmcResult);
|
||||
TU_ATTR_WEAK bool tud_usbtmc_app_msg_trigger_cb(usbtmc_msg_generic_t* msg);
|
||||
//TU_ATTR_WEAK bool tud_usbtmc_app_go_to_local_cb();
|
||||
@ -99,11 +99,11 @@ TU_ATTR_WEAK bool tud_usbtmc_app_msg_trigger_cb(usbtmc_msg_generic_t* msg);
|
||||
* notified that the transfer is complete.
|
||||
******************************************/
|
||||
|
||||
bool usbtmcd_transmit_dev_msg_data(
|
||||
bool tud_usbtmc_transmit_dev_msg_data(
|
||||
const void * data, size_t len,
|
||||
bool endOfMessage, bool usingTermChar);
|
||||
|
||||
bool usbtmcd_start_bus_read(void);
|
||||
bool tud_usbtmc_start_bus_read(void);
|
||||
|
||||
|
||||
/* "callbacks" from USB device core */
|
||||
|
Loading…
x
Reference in New Issue
Block a user