summaryrefslogtreecommitdiff
path: root/src/class/usbtmc/usbtmc_device.h
diff options
context:
space:
mode:
authorTommie Gannert <[email protected]>2024-02-26 11:41:50 +0100
committerTommie Gannert <[email protected]>2024-02-26 11:43:45 +0100
commit5ce7b147117826dd75c2d7b347df80b0177e7252 (patch)
tree6f31c905b3852160371206a64c2882821b634998 /src/class/usbtmc/usbtmc_device.h
parentf92c2c2758e47c1dd9a0e441f1a48188171ae403 (diff)
add notification support for device class USBTMC.
The ep_int_in is already used for responding to USB488 READ_STATUS_BYTE requests, but that EP is defined for all of USBTMC. This extends the functionality to let callers send notifications and receive ACKs.
Diffstat (limited to 'src/class/usbtmc/usbtmc_device.h')
-rw-r--r--src/class/usbtmc/usbtmc_device.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/class/usbtmc/usbtmc_device.h b/src/class/usbtmc/usbtmc_device.h
index c1298ddb8..2f3c91dbd 100644
--- a/src/class/usbtmc/usbtmc_device.h
+++ b/src/class/usbtmc/usbtmc_device.h
@@ -73,6 +73,10 @@ bool tud_usbtmc_check_abort_bulk_in_cb(usbtmc_check_abort_bulk_rsp_t *rsp);
bool tud_usbtmc_check_abort_bulk_out_cb(usbtmc_check_abort_bulk_rsp_t *rsp);
bool tud_usbtmc_check_clear_cb(usbtmc_get_clear_status_rsp_t *rsp);
+// The interrupt-IN endpoint buffer was transmitted to the host. Use
+// tud_usbtmc_transmit_notification_data to send another notification.
+TU_ATTR_WEAK bool tud_usbtmc_notification_complete_cb(void);
+
// Indicator pulse should be 0.5 to 1.0 seconds long
TU_ATTR_WEAK bool tud_usbtmc_indicator_pulse_cb(tusb_control_request_t const * msg, uint8_t *tmcResult);
@@ -93,6 +97,17 @@ bool tud_usbtmc_transmit_dev_msg_data(
const void * data, size_t len,
bool endOfMessage, bool usingTermChar);
+// Buffers a notification to be sent to the host. The buffer must be
+// valid until the tud_usbtmc_notification_complete_cb callback. The
+// data starts with the bNotify1 field, see the USBTMC Specification,
+// Table 13.
+//
+// If the previous notification data has not yet been sent, this
+// returns false.
+//
+// Requires an interrupt endpoint in the interface.
+bool tud_usbtmc_transmit_notification_data(const void * data, size_t len);
+
bool tud_usbtmc_start_bus_read(void);
@@ -104,9 +119,4 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result,
bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
void usbtmcd_init_cb(void);
-/************************************************************
- * USBTMC Descriptor Templates
- *************************************************************/
-
-
#endif /* CLASS_USBTMC_USBTMC_DEVICE_H_ */