Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4e447c

Browse files
committed
Use W25Q80BV read function to retrieve SPI flash contents.
1 parent 7c98d3e commit a4e447c

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

firmware/hackrf_usb/usb_api_spiflash.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,8 @@ usb_request_status_t usb_vendor_request_write_spiflash(
8686
usb_request_status_t usb_vendor_request_read_spiflash(
8787
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
8888
{
89-
uint32_t i;
9089
uint32_t addr;
9190
uint16_t len;
92-
uint8_t* u8_addr_pt;
9391

9492
if (stage == USB_TRANSFER_STAGE_SETUP)
9593
{
@@ -99,12 +97,8 @@ usb_request_status_t usb_vendor_request_read_spiflash(
9997
|| ((addr + len) > W25Q80BV_NUM_BYTES)) {
10098
return USB_REQUEST_STATUS_STALL;
10199
} else {
102-
/* TODO flush SPIFI "cache" before to read the SPIFI memory */
103-
u8_addr_pt = (uint8_t*)(addr + SPIFI_DATA_UNCACHED_BASE);
104-
for(i=0; i<len; i++)
105-
{
106-
spiflash_buffer[i] = u8_addr_pt[i];
107-
}
100+
w25q80bv_setup();
101+
w25q80bv_read(addr, len, &spiflash_buffer[0]);
108102
usb_transfer_schedule_block(endpoint->in, &spiflash_buffer[0], len,
109103
NULL, NULL);
110104
return USB_REQUEST_STATUS_OK;

0 commit comments

Comments
 (0)