hackrf_usb: Port things away from schedule_wait
This commit is contained in:
@ -390,7 +390,7 @@ usb_request_status_t usb_vendor_request_read_max2837(
|
|||||||
const uint16_t value = max2837_reg_read(endpoint->setup.index);
|
const uint16_t value = max2837_reg_read(endpoint->setup.index);
|
||||||
endpoint->buffer[0] = value & 0xff;
|
endpoint->buffer[0] = value & 0xff;
|
||||||
endpoint->buffer[1] = value >> 8;
|
endpoint->buffer[1] = value >> 8;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 2, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 2, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ usb_request_status_t usb_vendor_request_read_si5351c(
|
|||||||
if( endpoint->setup.index < 256 ) {
|
if( endpoint->setup.index < 256 ) {
|
||||||
const uint8_t value = si5351c_read_single(endpoint->setup.index);
|
const uint8_t value = si5351c_read_single(endpoint->setup.index);
|
||||||
endpoint->buffer[0] = value;
|
endpoint->buffer[0] = value;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 1, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 1, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -482,7 +482,7 @@ usb_request_status_t usb_vendor_request_read_rffc5071(
|
|||||||
value = rffc5071_reg_read(endpoint->setup.index);
|
value = rffc5071_reg_read(endpoint->setup.index);
|
||||||
endpoint->buffer[0] = value & 0xff;
|
endpoint->buffer[0] = value & 0xff;
|
||||||
endpoint->buffer[1] = value >> 8;
|
endpoint->buffer[1] = value >> 8;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 2, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 2, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -522,7 +522,7 @@ usb_request_status_t usb_vendor_request_write_spiflash(
|
|||||||
|| ((addr + len) > W25Q80BV_NUM_BYTES)) {
|
|| ((addr + len) > W25Q80BV_NUM_BYTES)) {
|
||||||
return USB_REQUEST_STATUS_STALL;
|
return USB_REQUEST_STATUS_STALL;
|
||||||
} else {
|
} else {
|
||||||
usb_transfer_schedule_wait(endpoint->out, &spiflash_buffer[0], len, NULL);
|
usb_transfer_schedule(endpoint->out, &spiflash_buffer[0], len, NULL);
|
||||||
w25q80bv_setup();
|
w25q80bv_setup();
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ usb_request_status_t usb_vendor_request_read_spiflash(
|
|||||||
{
|
{
|
||||||
spiflash_buffer[i] = u8_addr_pt[i];
|
spiflash_buffer[i] = u8_addr_pt[i];
|
||||||
}
|
}
|
||||||
usb_transfer_schedule_wait(endpoint->in, &spiflash_buffer[0], len, NULL);
|
usb_transfer_schedule(endpoint->in, &spiflash_buffer[0], len, NULL);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
||||||
@ -604,7 +604,7 @@ usb_request_status_t usb_vendor_request_write_cpld(
|
|||||||
// len is limited to 64KB 16bits no overflow can happen
|
// len is limited to 64KB 16bits no overflow can happen
|
||||||
total_len = endpoint->setup.value;
|
total_len = endpoint->setup.value;
|
||||||
len = endpoint->setup.length;
|
len = endpoint->setup.length;
|
||||||
usb_transfer_schedule_wait(endpoint->out, &cpld_xsvf_buffer[write_cpld_idx], len, NULL);
|
usb_transfer_schedule(endpoint->out, &cpld_xsvf_buffer[write_cpld_idx], len, NULL);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
||||||
{
|
{
|
||||||
@ -656,7 +656,7 @@ usb_request_status_t usb_vendor_request_read_board_id(
|
|||||||
{
|
{
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||||
endpoint->buffer[0] = BOARD_ID;
|
endpoint->buffer[0] = BOARD_ID;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 1, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 1, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
}
|
}
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
@ -669,7 +669,7 @@ usb_request_status_t usb_vendor_request_read_version_string(
|
|||||||
|
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||||
length = (uint8_t)strlen(version_string);
|
length = (uint8_t)strlen(version_string);
|
||||||
usb_transfer_schedule_wait(endpoint->in, version_string, length, NULL);
|
usb_transfer_schedule(endpoint->in, version_string, length, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
}
|
}
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
@ -681,7 +681,7 @@ usb_request_status_t usb_vendor_request_set_freq(
|
|||||||
{
|
{
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP)
|
if (stage == USB_TRANSFER_STAGE_SETUP)
|
||||||
{
|
{
|
||||||
usb_transfer_schedule_wait(endpoint->out, &set_freq_params, sizeof(set_freq_params_t), NULL);
|
usb_transfer_schedule(endpoint->out, &set_freq_params, sizeof(set_freq_params_t), NULL);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
||||||
{
|
{
|
||||||
@ -703,7 +703,7 @@ usb_request_status_t usb_vendor_request_set_sample_rate_frac(
|
|||||||
{
|
{
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP)
|
if (stage == USB_TRANSFER_STAGE_SETUP)
|
||||||
{
|
{
|
||||||
usb_transfer_schedule_wait(endpoint->out, &set_sample_r_params, sizeof(set_sample_r_params_t), NULL);
|
usb_transfer_schedule(endpoint->out, &set_sample_r_params, sizeof(set_sample_r_params_t), NULL);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
} else if (stage == USB_TRANSFER_STAGE_DATA)
|
||||||
{
|
{
|
||||||
@ -777,7 +777,7 @@ usb_request_status_t usb_vendor_request_read_partid_serialno(
|
|||||||
read_partid_serialno.serial_no[3] = iap_cmd_res.status_res.iap_result[3];
|
read_partid_serialno.serial_no[3] = iap_cmd_res.status_res.iap_result[3];
|
||||||
|
|
||||||
length = (uint8_t)sizeof(read_partid_serialno_t);
|
length = (uint8_t)sizeof(read_partid_serialno_t);
|
||||||
usb_transfer_schedule_wait(endpoint->in, &read_partid_serialno, length, NULL);
|
usb_transfer_schedule(endpoint->in, &read_partid_serialno, length, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
}
|
}
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
@ -789,7 +789,7 @@ usb_request_status_t usb_vendor_request_set_lna_gain(
|
|||||||
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
||||||
const uint8_t value = max2837_set_lna_gain(endpoint->setup.index);
|
const uint8_t value = max2837_set_lna_gain(endpoint->setup.index);
|
||||||
endpoint->buffer[0] = value;
|
endpoint->buffer[0] = value;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 1, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 1, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -802,7 +802,7 @@ usb_request_status_t usb_vendor_request_set_vga_gain(
|
|||||||
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
||||||
const uint8_t value = max2837_set_vga_gain(endpoint->setup.index);
|
const uint8_t value = max2837_set_vga_gain(endpoint->setup.index);
|
||||||
endpoint->buffer[0] = value;
|
endpoint->buffer[0] = value;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 1, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 1, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ usb_request_status_t usb_vendor_request_set_txvga_gain(
|
|||||||
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
if( stage == USB_TRANSFER_STAGE_SETUP ) {
|
||||||
const uint8_t value = max2837_set_txvga_gain(endpoint->setup.index);
|
const uint8_t value = max2837_set_txvga_gain(endpoint->setup.index);
|
||||||
endpoint->buffer[0] = value;
|
endpoint->buffer[0] = value;
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 1, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 1, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ static usb_request_status_t usb_send_descriptor(
|
|||||||
if( descriptor_data[1] == USB_DESCRIPTOR_TYPE_CONFIGURATION ) {
|
if( descriptor_data[1] == USB_DESCRIPTOR_TYPE_CONFIGURATION ) {
|
||||||
descriptor_length = (descriptor_data[3] << 8) | descriptor_data[2];
|
descriptor_length = (descriptor_data[3] << 8) | descriptor_data[2];
|
||||||
}
|
}
|
||||||
usb_transfer_schedule_wait(
|
usb_transfer_schedule(
|
||||||
endpoint->in,
|
endpoint->in,
|
||||||
descriptor_data,
|
descriptor_data,
|
||||||
(setup_length > descriptor_length) ? descriptor_length : setup_length,
|
(setup_length > descriptor_length) ? descriptor_length : setup_length,
|
||||||
@ -267,7 +267,7 @@ static usb_request_status_t usb_standard_request_get_configuration_setup(
|
|||||||
if( endpoint->device->configuration ) {
|
if( endpoint->device->configuration ) {
|
||||||
endpoint->buffer[0] = endpoint->device->configuration->number;
|
endpoint->buffer[0] = endpoint->device->configuration->number;
|
||||||
}
|
}
|
||||||
usb_transfer_schedule_wait(endpoint->in, &endpoint->buffer, 1, NULL);
|
usb_transfer_schedule(endpoint->in, &endpoint->buffer, 1, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user