diff --git a/firmware/common/streaming.c b/firmware/common/streaming.c new file mode 100644 index 00000000..32dbb295 --- /dev/null +++ b/firmware/common/streaming.c @@ -0,0 +1,42 @@ +/* + * Copyright 2012 Jared Boone + * Copyright 2013 Benjamin Vernoux + * + * This file is part of HackRF. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include + +#include +#include + +#include + +void baseband_streaming_enable() { + nvic_set_priority(NVIC_SGPIO_IRQ, 0); + nvic_enable_irq(NVIC_SGPIO_IRQ); + SGPIO_SET_EN_1 = (1 << SGPIO_SLICE_A); + + sgpio_cpld_stream_enable(); +} + +void baseband_streaming_disable() { + sgpio_cpld_stream_disable(); + + nvic_disable_irq(NVIC_SGPIO_IRQ); +} \ No newline at end of file diff --git a/firmware/common/streaming.h b/firmware/common/streaming.h new file mode 100644 index 00000000..1f234127 --- /dev/null +++ b/firmware/common/streaming.h @@ -0,0 +1,29 @@ +/* + * Copyright 2012 Jared Boone + * Copyright 2013 Benjamin Vernoux + * + * This file is part of HackRF. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __STREAMING_H__ +#define __STREAMING_H__ + +void baseband_streaming_enable(); +void baseband_streaming_disable(); + +#endif/*__STREAMING_H__*/ diff --git a/firmware/hackrf_usb/Makefile b/firmware/hackrf_usb/Makefile index 73a2ea14..8b1ae8bf 100644 --- a/firmware/hackrf_usb/Makefile +++ b/firmware/hackrf_usb/Makefile @@ -25,6 +25,7 @@ BINARY = hackrf_usb SRC = $(BINARY).c \ ../common/rf_path.c \ ../common/tuning.c \ + ../common/streaming.c \ sgpio_isr.c \ usb_bulk_buffer.c \ ../common/usb.c \ @@ -37,6 +38,7 @@ SRC = $(BINARY).c \ usb_api_cpld.c \ usb_api_register.c \ usb_api_spiflash.c \ + usb_api_transceiver.c \ ../common/usb_queue.c \ ../common/fault_handler.c \ ../common/hackrf_core.c \ diff --git a/firmware/hackrf_usb/Makefile_rom_to_ram b/firmware/hackrf_usb/Makefile_rom_to_ram index e8748326..d5aea6c3 100644 --- a/firmware/hackrf_usb/Makefile_rom_to_ram +++ b/firmware/hackrf_usb/Makefile_rom_to_ram @@ -25,6 +25,7 @@ BINARY = hackrf_usb_rom_to_ram SRC = hackrf_usb.c \ ../common/rf_path.c \ ../common/tuning.c \ + ../common/streaming.c \ sgpio_isr.c \ usb_bulk_buffer.c \ ../common/usb.c \ @@ -37,6 +38,7 @@ SRC = hackrf_usb.c \ usb_api_cpld.c \ usb_api_register.c \ usb_api_spiflash.c \ + usb_api_transceiver.c \ ../common/usb_queue.c \ ../common/fault_handler.c \ ../common/hackrf_core.c \ diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c index 113b839d..f25e7c9a 100644 --- a/firmware/hackrf_usb/hackrf_usb.c +++ b/firmware/hackrf_usb/hackrf_usb.c @@ -20,26 +20,12 @@ * Boston, MA 02110-1301, USA. */ -#include +#include -#include - -#include #include #include -#include - -#include -#include -#include -#include -#include #include "usb.h" -#include "usb_type.h" -#include "usb_queue.h" -#include "usb_request.h" -#include "usb_descriptor.h" #include "usb_standard_request.h" #include "usb_device.h" @@ -49,232 +35,10 @@ #include "usb_api_register.h" #include "usb_api_spiflash.h" +#include "usb_api_transceiver.h" #include "rf_path.h" -#include "tuning.h" -#include "sgpio_isr.h" #include "usb_bulk_buffer.h" -static volatile transceiver_mode_t transceiver_mode = TRANSCEIVER_MODE_OFF; - -typedef struct { - uint32_t freq_mhz; - uint32_t freq_hz; -} set_freq_params_t; - -set_freq_params_t set_freq_params; - -typedef struct { - uint32_t freq_hz; - uint32_t divider; -} set_sample_r_params_t; - -set_sample_r_params_t set_sample_r_params; - -void baseband_streaming_enable() { - nvic_set_priority(NVIC_SGPIO_IRQ, 0); - nvic_enable_irq(NVIC_SGPIO_IRQ); - SGPIO_SET_EN_1 = (1 << SGPIO_SLICE_A); - - sgpio_cpld_stream_enable(); -} - -void baseband_streaming_disable() { - sgpio_cpld_stream_disable(); - - nvic_disable_irq(NVIC_SGPIO_IRQ); -} - -void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) { - baseband_streaming_disable(); - - usb_endpoint_disable(&usb_endpoint_bulk_in); - usb_endpoint_disable(&usb_endpoint_bulk_out); - - transceiver_mode = new_transceiver_mode; - - if( transceiver_mode == TRANSCEIVER_MODE_RX ) { - gpio_clear(PORT_LED1_3, PIN_LED3); - gpio_set(PORT_LED1_3, PIN_LED2); - usb_endpoint_init(&usb_endpoint_bulk_in); - rf_path_set_direction(RF_PATH_DIRECTION_RX); - vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_rx; - } else if (transceiver_mode == TRANSCEIVER_MODE_TX) { - gpio_clear(PORT_LED1_3, PIN_LED2); - gpio_set(PORT_LED1_3, PIN_LED3); - usb_endpoint_init(&usb_endpoint_bulk_out); - rf_path_set_direction(RF_PATH_DIRECTION_TX); - vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_tx; - } else { - gpio_clear(PORT_LED1_3, PIN_LED2); - gpio_clear(PORT_LED1_3, PIN_LED3); - rf_path_set_direction(RF_PATH_DIRECTION_OFF); - vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_rx; - } - - if( transceiver_mode != TRANSCEIVER_MODE_OFF ) { - baseband_streaming_enable(); - } -} - -usb_request_status_t usb_vendor_request_set_transceiver_mode( - usb_endpoint_t* const endpoint, - const usb_transfer_stage_t stage -) { - if( stage == USB_TRANSFER_STAGE_SETUP ) { - switch( endpoint->setup.value ) { - case TRANSCEIVER_MODE_OFF: - case TRANSCEIVER_MODE_RX: - case TRANSCEIVER_MODE_TX: - set_transceiver_mode(endpoint->setup.value); - usb_transfer_schedule_ack(endpoint->in); - return USB_REQUEST_STATUS_OK; - default: - return USB_REQUEST_STATUS_STALL; - } - } else { - return USB_REQUEST_STATUS_OK; - } -} - -usb_request_status_t usb_vendor_request_set_baseband_filter_bandwidth( - usb_endpoint_t* const endpoint, - const usb_transfer_stage_t stage -) { - if( stage == USB_TRANSFER_STAGE_SETUP ) { - const uint32_t bandwidth = (endpoint->setup.index << 16) | endpoint->setup.value; - if( baseband_filter_bandwidth_set(bandwidth) ) { - usb_transfer_schedule_ack(endpoint->in); - return USB_REQUEST_STATUS_OK; - } - return USB_REQUEST_STATUS_STALL; - } else { - return USB_REQUEST_STATUS_OK; - } -} - -usb_request_status_t usb_vendor_request_set_freq( - usb_endpoint_t* const endpoint, - const usb_transfer_stage_t stage) -{ - if (stage == USB_TRANSFER_STAGE_SETUP) - { - usb_transfer_schedule_block(endpoint->out, &set_freq_params, sizeof(set_freq_params_t), - NULL, NULL); - return USB_REQUEST_STATUS_OK; - } else if (stage == USB_TRANSFER_STAGE_DATA) - { - if( set_freq(set_freq_params.freq_mhz, set_freq_params.freq_hz) ) - { - usb_transfer_schedule_ack(endpoint->in); - return USB_REQUEST_STATUS_OK; - } - return USB_REQUEST_STATUS_STALL; - } else - { - return USB_REQUEST_STATUS_OK; - } -} - -usb_request_status_t usb_vendor_request_set_sample_rate_frac( - usb_endpoint_t* const endpoint, - const usb_transfer_stage_t stage) -{ - if (stage == USB_TRANSFER_STAGE_SETUP) - { - usb_transfer_schedule_block(endpoint->out, &set_sample_r_params, sizeof(set_sample_r_params_t), - NULL, NULL); - return USB_REQUEST_STATUS_OK; - } else if (stage == USB_TRANSFER_STAGE_DATA) - { - if( sample_rate_frac_set(set_sample_r_params.freq_hz * 2, set_sample_r_params.divider ) ) - { - usb_transfer_schedule_ack(endpoint->in); - return USB_REQUEST_STATUS_OK; - } - return USB_REQUEST_STATUS_STALL; - } else - { - return USB_REQUEST_STATUS_OK; - } -} - -usb_request_status_t usb_vendor_request_set_amp_enable( - usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) -{ - if (stage == USB_TRANSFER_STAGE_SETUP) { - switch (endpoint->setup.value) { - case 0: - rf_path_set_lna(0); - usb_transfer_schedule_ack(endpoint->in); - return USB_REQUEST_STATUS_OK; - case 1: - rf_path_set_lna(1); - usb_transfer_schedule_ack(endpoint->in); - return USB_REQUEST_STATUS_OK; - default: - return USB_REQUEST_STATUS_STALL; - } - } else { - return USB_REQUEST_STATUS_OK; - } -} - -usb_request_status_t usb_vendor_request_set_lna_gain( - usb_endpoint_t* const endpoint, - const usb_transfer_stage_t stage) -{ - if( stage == USB_TRANSFER_STAGE_SETUP ) { - const uint8_t value = max2837_set_lna_gain(endpoint->setup.index); - endpoint->buffer[0] = value; - usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1, - NULL, NULL); - usb_transfer_schedule_ack(endpoint->out); - return USB_REQUEST_STATUS_OK; - } - return USB_REQUEST_STATUS_OK; -} - -usb_request_status_t usb_vendor_request_set_vga_gain( - usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) -{ - if( stage == USB_TRANSFER_STAGE_SETUP ) { - const uint8_t value = max2837_set_vga_gain(endpoint->setup.index); - endpoint->buffer[0] = value; - usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1, - NULL, NULL); - usb_transfer_schedule_ack(endpoint->out); - return USB_REQUEST_STATUS_OK; - } - return USB_REQUEST_STATUS_OK; -} - -usb_request_status_t usb_vendor_request_set_txvga_gain( - usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) -{ - if( stage == USB_TRANSFER_STAGE_SETUP ) { - const uint8_t value = max2837_set_txvga_gain(endpoint->setup.index); - endpoint->buffer[0] = value; - usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1, - NULL, NULL); - usb_transfer_schedule_ack(endpoint->out); - return USB_REQUEST_STATUS_OK; - } - return USB_REQUEST_STATUS_OK; -} - -usb_request_status_t usb_vendor_request_set_if_freq( - usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage -) { - if( stage == USB_TRANSFER_STAGE_SETUP ) { - if( set_freq_if((uint32_t)endpoint->setup.index * 1000 * 1000) ) { - usb_transfer_schedule_ack(endpoint->in); - } else { - return USB_REQUEST_STATUS_STALL; - } - } - return USB_REQUEST_STATUS_OK; -} - static const usb_request_handler_fn vendor_request_handler[] = { NULL, usb_vendor_request_set_transceiver_mode, @@ -383,9 +147,9 @@ int main(void) { // Set up IN transfer of buffer 0. if ( usb_bulk_buffer_offset >= 16384 && phase == 1 - && transceiver_mode != TRANSCEIVER_MODE_OFF) { + && transceiver_mode() != TRANSCEIVER_MODE_OFF) { usb_transfer_schedule_block( - (transceiver_mode == TRANSCEIVER_MODE_RX) + (transceiver_mode() == TRANSCEIVER_MODE_RX) ? &usb_endpoint_bulk_in : &usb_endpoint_bulk_out, &usb_bulk_buffer[0x0000], 0x4000, @@ -397,9 +161,9 @@ int main(void) { // Set up IN transfer of buffer 1. if ( usb_bulk_buffer_offset < 16384 && phase == 0 - && transceiver_mode != TRANSCEIVER_MODE_OFF) { + && transceiver_mode() != TRANSCEIVER_MODE_OFF) { usb_transfer_schedule_block( - (transceiver_mode == TRANSCEIVER_MODE_RX) + (transceiver_mode() == TRANSCEIVER_MODE_RX) ? &usb_endpoint_bulk_in : &usb_endpoint_bulk_out, &usb_bulk_buffer[0x4000], 0x4000, diff --git a/firmware/hackrf_usb/usb_api_transceiver.c b/firmware/hackrf_usb/usb_api_transceiver.c new file mode 100644 index 00000000..4b24fcdf --- /dev/null +++ b/firmware/hackrf_usb/usb_api_transceiver.c @@ -0,0 +1,250 @@ +/* + * Copyright 2012 Jared Boone + * Copyright 2013 Benjamin Vernoux + * + * This file is part of HackRF. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#include "usb_api_transceiver.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "sgpio_isr.h" +#include "usb_endpoint.h" + +static volatile transceiver_mode_t _transceiver_mode = TRANSCEIVER_MODE_OFF; + +void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) { + baseband_streaming_disable(); + + usb_endpoint_disable(&usb_endpoint_bulk_in); + usb_endpoint_disable(&usb_endpoint_bulk_out); + + _transceiver_mode = new_transceiver_mode; + + if( _transceiver_mode == TRANSCEIVER_MODE_RX ) { + gpio_clear(PORT_LED1_3, PIN_LED3); + gpio_set(PORT_LED1_3, PIN_LED2); + usb_endpoint_init(&usb_endpoint_bulk_in); + rf_path_set_direction(RF_PATH_DIRECTION_RX); + vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_rx; + } else if (_transceiver_mode == TRANSCEIVER_MODE_TX) { + gpio_clear(PORT_LED1_3, PIN_LED2); + gpio_set(PORT_LED1_3, PIN_LED3); + usb_endpoint_init(&usb_endpoint_bulk_out); + rf_path_set_direction(RF_PATH_DIRECTION_TX); + vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_tx; + } else { + gpio_clear(PORT_LED1_3, PIN_LED2); + gpio_clear(PORT_LED1_3, PIN_LED3); + rf_path_set_direction(RF_PATH_DIRECTION_OFF); + vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_rx; + } + + if( _transceiver_mode != TRANSCEIVER_MODE_OFF ) { + baseband_streaming_enable(); + } +} + +transceiver_mode_t transceiver_mode(void) { + return _transceiver_mode; +} + +typedef struct { + uint32_t freq_mhz; + uint32_t freq_hz; +} set_freq_params_t; + +set_freq_params_t set_freq_params; + +typedef struct { + uint32_t freq_hz; + uint32_t divider; +} set_sample_r_params_t; + +set_sample_r_params_t set_sample_r_params; + +usb_request_status_t usb_vendor_request_set_transceiver_mode( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage +) { + if( stage == USB_TRANSFER_STAGE_SETUP ) { + switch( endpoint->setup.value ) { + case TRANSCEIVER_MODE_OFF: + case TRANSCEIVER_MODE_RX: + case TRANSCEIVER_MODE_TX: + set_transceiver_mode(endpoint->setup.value); + usb_transfer_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + default: + return USB_REQUEST_STATUS_STALL; + } + } else { + return USB_REQUEST_STATUS_OK; + } +} + +usb_request_status_t usb_vendor_request_set_baseband_filter_bandwidth( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage +) { + if( stage == USB_TRANSFER_STAGE_SETUP ) { + const uint32_t bandwidth = (endpoint->setup.index << 16) | endpoint->setup.value; + if( baseband_filter_bandwidth_set(bandwidth) ) { + usb_transfer_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_STALL; + } else { + return USB_REQUEST_STATUS_OK; + } +} + +usb_request_status_t usb_vendor_request_set_freq( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage) +{ + if (stage == USB_TRANSFER_STAGE_SETUP) + { + usb_transfer_schedule_block(endpoint->out, &set_freq_params, sizeof(set_freq_params_t), + NULL, NULL); + return USB_REQUEST_STATUS_OK; + } else if (stage == USB_TRANSFER_STAGE_DATA) + { + if( set_freq(set_freq_params.freq_mhz, set_freq_params.freq_hz) ) + { + usb_transfer_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_STALL; + } else + { + return USB_REQUEST_STATUS_OK; + } +} + +usb_request_status_t usb_vendor_request_set_sample_rate_frac( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage) +{ + if (stage == USB_TRANSFER_STAGE_SETUP) + { + usb_transfer_schedule_block(endpoint->out, &set_sample_r_params, sizeof(set_sample_r_params_t), + NULL, NULL); + return USB_REQUEST_STATUS_OK; + } else if (stage == USB_TRANSFER_STAGE_DATA) + { + if( sample_rate_frac_set(set_sample_r_params.freq_hz * 2, set_sample_r_params.divider ) ) + { + usb_transfer_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_STALL; + } else + { + return USB_REQUEST_STATUS_OK; + } +} + +usb_request_status_t usb_vendor_request_set_amp_enable( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) +{ + if (stage == USB_TRANSFER_STAGE_SETUP) { + switch (endpoint->setup.value) { + case 0: + rf_path_set_lna(0); + usb_transfer_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + case 1: + rf_path_set_lna(1); + usb_transfer_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + default: + return USB_REQUEST_STATUS_STALL; + } + } else { + return USB_REQUEST_STATUS_OK; + } +} + +usb_request_status_t usb_vendor_request_set_lna_gain( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage) +{ + if( stage == USB_TRANSFER_STAGE_SETUP ) { + const uint8_t value = max2837_set_lna_gain(endpoint->setup.index); + endpoint->buffer[0] = value; + usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1, + NULL, NULL); + usb_transfer_schedule_ack(endpoint->out); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_OK; +} + +usb_request_status_t usb_vendor_request_set_vga_gain( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) +{ + if( stage == USB_TRANSFER_STAGE_SETUP ) { + const uint8_t value = max2837_set_vga_gain(endpoint->setup.index); + endpoint->buffer[0] = value; + usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1, + NULL, NULL); + usb_transfer_schedule_ack(endpoint->out); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_OK; +} + +usb_request_status_t usb_vendor_request_set_txvga_gain( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) +{ + if( stage == USB_TRANSFER_STAGE_SETUP ) { + const uint8_t value = max2837_set_txvga_gain(endpoint->setup.index); + endpoint->buffer[0] = value; + usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1, + NULL, NULL); + usb_transfer_schedule_ack(endpoint->out); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_OK; +} + +usb_request_status_t usb_vendor_request_set_if_freq( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage +) { + if( stage == USB_TRANSFER_STAGE_SETUP ) { + if( set_freq_if((uint32_t)endpoint->setup.index * 1000 * 1000) ) { + usb_transfer_schedule_ack(endpoint->in); + } else { + return USB_REQUEST_STATUS_STALL; + } + } + return USB_REQUEST_STATUS_OK; +} diff --git a/firmware/hackrf_usb/usb_api_transceiver.h b/firmware/hackrf_usb/usb_api_transceiver.h new file mode 100644 index 00000000..ce686640 --- /dev/null +++ b/firmware/hackrf_usb/usb_api_transceiver.h @@ -0,0 +1,57 @@ +/* + * Copyright 2012 Jared Boone + * Copyright 2013 Benjamin Vernoux + * + * This file is part of HackRF. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __USB_API_TRANSCEIVER_H__ +#define __USB_API_TRANSCEIVER_H__ + +#include +#include +#include + +void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode); +transceiver_mode_t transceiver_mode(void); + +usb_request_status_t usb_vendor_request_set_transceiver_mode( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_baseband_filter_bandwidth( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_freq( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_sample_rate_frac( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_amp_enable( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_lna_gain( + usb_endpoint_t* const endpoint, + const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_vga_gain( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_txvga_gain( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); +usb_request_status_t usb_vendor_request_set_if_freq( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); + +#endif/*__USB_API_TRANSCEIVER_H__*/ diff --git a/firmware/hackrf_usb_rom_to_ram/Makefile b/firmware/hackrf_usb_rom_to_ram/Makefile index fe33b02a..de2b883b 100644 --- a/firmware/hackrf_usb_rom_to_ram/Makefile +++ b/firmware/hackrf_usb_rom_to_ram/Makefile @@ -27,6 +27,7 @@ SRC_DIR = hackrf_usb SRC = hackrf_usb.c \ ../common/rf_path.c \ ../common/tuning.c \ + ../common/streaming.c \ sgpio_isr.c \ usb_bulk_buffer.c \ ../common/usb.c \ @@ -39,6 +40,7 @@ SRC = hackrf_usb.c \ usb_api_cpld.c \ usb_api_register.c \ usb_api_spiflash.c \ + usb_api_transceiver.c \ ../common/usb_queue.c \ ../common/fault_handler.c \ ../common/hackrf_core.c \