mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-02-20 00:33:48 +01:00
Add USB requests and host support to set TX/RX shortfall limits.
This adds `-T` and `-R` options to `hackrf_debug`, which set the TX underrun and RX overrun limits in bytes.
This commit is contained in:
@@ -238,6 +238,8 @@ usb_request_status_t usb_vendor_request_set_freq_explicit(
|
||||
}
|
||||
|
||||
static volatile hw_sync_mode_t _hw_sync_mode = HW_SYNC_MODE_OFF;
|
||||
static volatile uint32_t _tx_underrun_limit;
|
||||
static volatile uint32_t _rx_overrun_limit;
|
||||
|
||||
void set_hw_sync_mode(const hw_sync_mode_t new_hw_sync_mode) {
|
||||
_hw_sync_mode = new_hw_sync_mode;
|
||||
@@ -288,12 +290,14 @@ void transceiver_startup(const transceiver_mode_t mode) {
|
||||
led_on(LED2);
|
||||
rf_path_set_direction(&rf_path, RF_PATH_DIRECTION_RX);
|
||||
m0_state.mode = M0_MODE_RX;
|
||||
m0_state.shortfall_limit = _rx_overrun_limit;
|
||||
break;
|
||||
case TRANSCEIVER_MODE_TX:
|
||||
led_off(LED2);
|
||||
led_on(LED3);
|
||||
rf_path_set_direction(&rf_path, RF_PATH_DIRECTION_TX);
|
||||
m0_state.mode = M0_MODE_TX;
|
||||
m0_state.shortfall_limit = _tx_underrun_limit;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -338,6 +342,30 @@ usb_request_status_t usb_vendor_request_set_hw_sync_mode(
|
||||
}
|
||||
}
|
||||
|
||||
usb_request_status_t usb_vendor_request_set_tx_underrun_limit(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage
|
||||
) {
|
||||
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
||||
uint32_t value = (endpoint->setup.index << 16) + endpoint->setup.value;
|
||||
_tx_underrun_limit = value;
|
||||
usb_transfer_schedule_ack(endpoint->in);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
usb_request_status_t usb_vendor_request_set_rx_overrun_limit(
|
||||
usb_endpoint_t* const endpoint,
|
||||
const usb_transfer_stage_t stage
|
||||
) {
|
||||
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
||||
uint32_t value = (endpoint->setup.index << 16) + endpoint->setup.value;
|
||||
_rx_overrun_limit = value;
|
||||
usb_transfer_schedule_ack(endpoint->in);
|
||||
}
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
||||
void transceiver_bulk_transfer_complete(void *user_data, unsigned int bytes_transferred)
|
||||
{
|
||||
(void) user_data;
|
||||
|
||||
Reference in New Issue
Block a user