aboutsummaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-12-18 00:09:55 -0800
committerJosh Blum <josh@joshknows.com>2010-12-18 00:09:55 -0800
commit4c3ba019003fea27577bcd91b2ff5f8cf0f4ac9b (patch)
tree2873a9856ae3a9cdac58d1e2535e496dc6130a62 /firmware
parent4c98ef443b24955b2d266f5783cf5d26c04d3715 (diff)
downloaduhd-4c3ba019003fea27577bcd91b2ff5f8cf0f4ac9b.tar.gz
uhd-4c3ba019003fea27577bcd91b2ff5f8cf0f4ac9b.tar.bz2
uhd-4c3ba019003fea27577bcd91b2ff5f8cf0f4ac9b.zip
usrp-n210: removed fw warnings, bootloader does full size 16k load
Diffstat (limited to 'firmware')
-rw-r--r--firmware/microblaze/apps/uart_flash_loader.c4
-rw-r--r--firmware/microblaze/lib/net_common.c2
-rw-r--r--firmware/microblaze/usrp2p/bootloader/init_bootloader.c2
-rw-r--r--firmware/microblaze/usrp2p/bootloader_utils.c3
-rw-r--r--firmware/microblaze/usrp2p/bootloader_utils.h4
-rw-r--r--firmware/microblaze/usrp2p/ethernet.c95
-rw-r--r--firmware/microblaze/usrp2p/spi_flash_read.c6
7 files changed, 10 insertions, 106 deletions
diff --git a/firmware/microblaze/apps/uart_flash_loader.c b/firmware/microblaze/apps/uart_flash_loader.c
index d67b84677..4ec89284a 100644
--- a/firmware/microblaze/apps/uart_flash_loader.c
+++ b/firmware/microblaze/apps/uart_flash_loader.c
@@ -139,8 +139,8 @@ void delay(uint32_t t) {
}
int main(int argc, char *argv[]) {
- uint8_t buf[32];
- int i = 0;
+ //uint8_t buf[32];
+ //int i = 0;
hal_disable_ints(); // In case we got here via jmp 0x0
diff --git a/firmware/microblaze/lib/net_common.c b/firmware/microblaze/lib/net_common.c
index a34ca615b..637fc3dc1 100644
--- a/firmware/microblaze/lib/net_common.c
+++ b/firmware/microblaze/lib/net_common.c
@@ -37,7 +37,7 @@
#include <string.h>
#include "pkt_ctrl.h"
-static const bool debug = false;
+static const bool debug = true;
static const eth_mac_addr_t BCAST_MAC_ADDR = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
diff --git a/firmware/microblaze/usrp2p/bootloader/init_bootloader.c b/firmware/microblaze/usrp2p/bootloader/init_bootloader.c
index dc22ef8d0..cfa80ffea 100644
--- a/firmware/microblaze/usrp2p/bootloader/init_bootloader.c
+++ b/firmware/microblaze/usrp2p/bootloader/init_bootloader.c
@@ -18,7 +18,7 @@
#include <i2c.h>
#include "usrp2/fw_common.h"
-void pic_interrupt_handler() __attribute__ ((interrupt_handler));
+//void pic_interrupt_handler() __attribute__ ((interrupt_handler));
void pic_interrupt_handler()
{
diff --git a/firmware/microblaze/usrp2p/bootloader_utils.c b/firmware/microblaze/usrp2p/bootloader_utils.c
index fa56c199a..379c5f957 100644
--- a/firmware/microblaze/usrp2p/bootloader_utils.c
+++ b/firmware/microblaze/usrp2p/bootloader_utils.c
@@ -18,8 +18,7 @@ int is_valid_fpga_image(uint32_t addr) {
uint8_t imgbuf[64];
spi_flash_read(addr, 64, imgbuf);
//we're just looking for leading 0xFF padding, followed by the sync bytes 0xAA 0x99
- int i = 0;
- for(i; i<63; i++) {
+ for(size_t i = 0; i<63; i++) {
if(imgbuf[i] == 0xFF) continue;
if(imgbuf[i] == 0xAA && imgbuf[i+1] == 0x99) {
//printf("is_valid_fpga_image(): found valid FPGA image\n");
diff --git a/firmware/microblaze/usrp2p/bootloader_utils.h b/firmware/microblaze/usrp2p/bootloader_utils.h
index 3ad0d4f74..0f49ae6cd 100644
--- a/firmware/microblaze/usrp2p/bootloader_utils.h
+++ b/firmware/microblaze/usrp2p/bootloader_utils.h
@@ -9,8 +9,8 @@
//we're working in bytes and byte addresses so we can run the same code with Flash chips of different sector sizes.
//it's really 1463736, but rounded up to 1.5MB
#define FPGA_IMAGE_SIZE_BYTES 1572864
-//16K - 4B for the hell of it
-#define FW_IMAGE_SIZE_BYTES 15360
+//16K
+#define FW_IMAGE_SIZE_BYTES 0x3fff
#define SAFE_FPGA_IMAGE_LOCATION_ADDR 0x00000000
#define SAFE_FW_IMAGE_LOCATION_ADDR 0x003F0000
diff --git a/firmware/microblaze/usrp2p/ethernet.c b/firmware/microblaze/usrp2p/ethernet.c
index 36d6a17ca..03891f959 100644
--- a/firmware/microblaze/usrp2p/ethernet.c
+++ b/firmware/microblaze/usrp2p/ethernet.c
@@ -279,101 +279,6 @@ ethernet_init(void)
eth_mac_miim_write(PHY_CTRL, t | MII_CR_RESTART_AUTO_NEG);
}
-static bool
-unprogrammed(const void *t, size_t len)
-{
- int i;
- uint8_t *p = (uint8_t *)t;
- bool all_zeros = true;
- bool all_ones = true;
- for (i = 0; i < len; i++){
- all_zeros &= p[i] == 0x00;
- all_ones &= p[i] == 0xff;
- }
- return all_ones | all_zeros;
-}
-
-//////////////////// MAC Addr Stuff ///////////////////////
-/*
-static int8_t src_mac_addr_initialized = false;
-static eth_mac_addr_t src_mac_addr = {{
- 0x00, 0x50, 0xC2, 0x85, 0x3f, 0xff
- }};
-
-const eth_mac_addr_t *
-ethernet_mac_addr(void)
-{
- if (!src_mac_addr_initialized){ // fetch from eeprom
- src_mac_addr_initialized = true;
-
- // if we're simulating, don't read the EEPROM model, it's REALLY slow
- if (hwconfig_simulation_p())
- return &src_mac_addr;
-
- eth_mac_addr_t tmp;
- bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, &tmp, sizeof(tmp));
- if (!ok || unprogrammed(&tmp, sizeof(tmp))){
- // use the default
- }
- else
- src_mac_addr = tmp;
- }
-
- return &src_mac_addr;
-}
-
-bool
-ethernet_set_mac_addr(const eth_mac_addr_t *t)
-{
- bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, t, sizeof(eth_mac_addr_t));
- if (ok){
- src_mac_addr = *t;
- src_mac_addr_initialized = true;
- //eth_mac_set_addr(t); //this breaks the link
- }
-
- return ok;
-}
-
-//////////////////// IP Addr Stuff ///////////////////////
-
-static int8_t src_ip_addr_initialized = false;
-static struct ip_addr src_ip_addr = {
- (192 << 24 | 168 << 16 | 10 << 8 | 2 << 0)
-};
-
-
-const struct ip_addr *get_ip_addr(void)
-{
- if (!src_ip_addr_initialized){ // fetch from eeprom
- src_ip_addr_initialized = true;
-
- // if we're simulating, don't read the EEPROM model, it's REALLY slow
- if (hwconfig_simulation_p())
- return &src_ip_addr;
-
- struct ip_addr tmp;
- bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, &tmp, sizeof(tmp));
- if (!ok || unprogrammed(&tmp, sizeof(tmp))){
- // use the default
- }
- else
- src_ip_addr = tmp;
- }
-
- return &src_ip_addr;
-}
-
-bool set_ip_addr(const struct ip_addr *t){
- bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, t, sizeof(struct ip_addr));
- if (ok){
- src_ip_addr = *t;
- src_ip_addr_initialized = true;
- }
-
- return ok;
-}
-*/
int
ethernet_check_errors(void)
{
diff --git a/firmware/microblaze/usrp2p/spi_flash_read.c b/firmware/microblaze/usrp2p/spi_flash_read.c
index 02155b209..36c326e96 100644
--- a/firmware/microblaze/usrp2p/spi_flash_read.c
+++ b/firmware/microblaze/usrp2p/spi_flash_read.c
@@ -100,8 +100,8 @@ spi_flash_read(uint32_t flash_addr, size_t nbytes, void *buf)
* Read up to 16 bytes at a time until done
*/
unsigned char *dst = (unsigned char *) buf;
- uint32_t m;
- for (uint32_t n = 0; n < nbytes; n += m, dst += m){
+ size_t m;
+ for (size_t n = 0; n < nbytes; n += m){
spif_regs->ctrl = FLAGS | LEN(16 * 8); // xfer 16 bytes
spif_regs->ctrl = FLAGS | LEN(16 * 8) | SPI_CTRL_GO_BSY;
@@ -115,7 +115,7 @@ spi_flash_read(uint32_t flash_addr, size_t nbytes, void *buf)
unsigned char *src = (unsigned char *) &w[0];
m = min(nbytes - n, 16);
for (size_t i = 0; i < m; i++)
- dst[i] = src[i];
+ *(dst++) = src[i];
}
spif_regs->ss = 0; // deassert chip select
}