Skip to content
Merged
3 changes: 2 additions & 1 deletion firmware/common/LPC4320_M4_memory.ld
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ MEMORY
{
/* rom is really the shadow region that points to SPI flash or elsewhere */
rom (rx) : ORIGIN = 0x00000000, LENGTH = 1M
ram_local1 (rwx) : ORIGIN = 0x10000000, LENGTH = 96K
ram_local1 (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
ram_usb (rw) : ORIGIN = 0x10010000, LENGTH = 32K
ram_local2 (rwx) : ORIGIN = 0x10080000, LENGTH = 32K
ram_sleep (rwx) : ORIGIN = 0x10088000, LENGTH = 8K
}
Expand Down
3 changes: 2 additions & 1 deletion firmware/common/LPC4330_M4_memory.ld
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ MEMORY
{
/* rom is really the shadow region that points to SPI flash or elsewhere */
rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K
ram_local1 (rwx) : ORIGIN = 0x10000000, LENGTH = 128K
ram_local1 (rwx) : ORIGIN = 0x10000000, LENGTH = 96K
ram_usb(rw) : ORIGIN = 0x10018000, LENGTH = 32K
ram_local2 (rwx) : ORIGIN = 0x10080000, LENGTH = 64K
ram_sleep (rwx) : ORIGIN = 0x10090000, LENGTH = 8K
}
Expand Down
5 changes: 3 additions & 2 deletions firmware/common/LPC43xx_M4_memory.ld
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ MEMORY
* to get performance benefit of having two USB buffers addressable
* simultaneously (on two different buses of the AHB multilayer matrix)
*/
ram_usb (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
ram_samp (rwx) : ORIGIN = 0x20008000, LENGTH = 32K
}

usb_bulk_buffer = ORIGIN(ram_usb);
lz4_in_buf = ORIGIN(ram_lz4_in);
lz4_out_buf = ORIGIN(ram_lz4_out);
usb_samp_buffer = ORIGIN(ram_samp);
usb_bulk_buffer = ORIGIN(ram_usb);
m0_state = ORIGIN(ram_shared);
PROVIDE(__ram_m0_start__ = ORIGIN(ram_m0));
20 changes: 10 additions & 10 deletions firmware/common/fpga_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#include "streaming.h"

// USB buffer used during selftests.
#define USB_BULK_BUFFER_SIZE 0x8000
extern uint8_t usb_bulk_buffer[USB_BULK_BUFFER_SIZE];
#define USB_SAMP_BUFFER_SIZE 0x8000
extern uint8_t usb_samp_buffer[USB_SAMP_BUFFER_SIZE];

static int rx_samples(const unsigned int num_samples, uint32_t max_cycles)
{
Expand Down Expand Up @@ -115,10 +115,10 @@ bool fpga_sgpio_selftest(void)
fpga_set_prbs_enable(&fpga, false);

// Generate sequence from first value and compare.
bool seq_in_sync = (usb_bulk_buffer[0] != 0);
uint8_t seq = lfsr_advance(usb_bulk_buffer[0]);
bool seq_in_sync = (usb_samp_buffer[0] != 0);
uint8_t seq = lfsr_advance(usb_samp_buffer[0]);
for (int i = 1; i < 512; ++i) {
if (usb_bulk_buffer[i] != seq) {
if (usb_samp_buffer[i] != seq) {
seq_in_sync = false;
break;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ bool fpga_if_xcvr_selftest(void)
return false;
}

const size_t num_samples = USB_BULK_BUFFER_SIZE / 2;
const size_t num_samples = USB_SAMP_BUFFER_SIZE / 2;

// Set common RX path and gateware settings for the measurements.
fpga_set_tx_nco_pstep(&fpga, 64); // NCO phase increment
Expand All @@ -206,7 +206,7 @@ bool fpga_if_xcvr_selftest(void)
timeout = true;
}
measure_tone(
(int8_t*) usb_bulk_buffer,
(int8_t*) usb_samp_buffer,
num_samples,
&selftest.xcvr_measurements[0]);

Expand All @@ -217,7 +217,7 @@ bool fpga_if_xcvr_selftest(void)
timeout = true;
}
measure_tone(
(int8_t*) usb_bulk_buffer,
(int8_t*) usb_samp_buffer,
num_samples,
&selftest.xcvr_measurements[1]);

Expand All @@ -230,7 +230,7 @@ bool fpga_if_xcvr_selftest(void)
timeout = true;
}
measure_tone(
(int8_t*) usb_bulk_buffer,
(int8_t*) usb_samp_buffer,
num_samples,
&selftest.xcvr_measurements[2]);

Expand All @@ -241,7 +241,7 @@ bool fpga_if_xcvr_selftest(void)
timeout = true;
}
measure_tone(
(int8_t*) usb_bulk_buffer,
(int8_t*) usb_samp_buffer,
num_samples,
&selftest.xcvr_measurements[3]);

Expand Down
2 changes: 2 additions & 0 deletions firmware/common/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

#include "usb_type.h"

usb_queue_head_t* usb_queue_head(const uint_fast8_t endpoint_address);

void usb_peripheral_reset(void);
void usb_phy_enable(void);

Expand Down
1 change: 1 addition & 0 deletions firmware/hackrf_usb/hackrf_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static usb_request_handler_fn vendor_request_handler[] = {
usb_vendor_request_test_rtc_osc,
usb_vendor_request_write_radio_reg,
usb_vendor_request_read_radio_reg,
usb_vendor_request_get_buffer_size,
};

static const uint32_t vendor_request_handler_count =
Expand Down
4 changes: 2 additions & 2 deletions firmware/hackrf_usb/usb_api_sweep.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#include "usb_api_sweep.h"
#include "usb_api_transceiver.h"
#include "usb_bulk_buffer.h"
#include "usb_buffer.h"
#include "usb_endpoint.h"

#define MIN(x, y) ((x) < (y) ? (x) : (y))
Expand Down Expand Up @@ -207,7 +207,7 @@ void sweep_mode(uint32_t seq)
m0_state.next_mode = M0_MODE_RX;

// Write metadata to buffer.
buffer = &usb_bulk_buffer[phase * 0x4000];
buffer = &usb_samp_buffer[phase * 0x4000];
*buffer = 0x7f;
*(buffer + 1) = 0x7f;
*(buffer + 2) = sweep_freq & 0xff;
Expand Down
Loading
Loading