1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
From a4e447cb9ef8bc7f8435cf24f96c6323df6077d4 Mon Sep 17 00:00:00 2001
From: Jared Boone <jboone@earfeast.com>
Date: Fri, 28 Aug 2015 12:49:34 -0700
Subject: [PATCH 58/68] Use W25Q80BV read function to retrieve SPI flash
contents.
---
firmware/hackrf_usb/usb_api_spiflash.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
--- a/firmware/hackrf_usb/usb_api_spiflash.c
+++ b/firmware/hackrf_usb/usb_api_spiflash.c
@@ -91,10 +91,8 @@
usb_request_status_t usb_vendor_request_read_spiflash(
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
{
- uint32_t i;
uint32_t addr;
uint16_t len;
- uint8_t* u8_addr_pt;
if (stage == USB_TRANSFER_STAGE_SETUP)
{
@@ -104,12 +102,8 @@
|| ((addr + len) > spi_flash.num_bytes)) {
return USB_REQUEST_STATUS_STALL;
} else {
- /* TODO flush SPIFI "cache" before to read the SPIFI memory */
- u8_addr_pt = (uint8_t*)(addr + SPIFI_DATA_UNCACHED_BASE);
- for(i=0; i<len; i++)
- {
- spiflash_buffer[i] = u8_addr_pt[i];
- }
+ w25q80bv_setup();
+ w25q80bv_read(addr, len, &spiflash_buffer[0]);
usb_transfer_schedule_block(endpoint->in, &spiflash_buffer[0], len,
NULL, NULL);
return USB_REQUEST_STATUS_OK;
|