diff options
author | Josh Blum <josh@joshknows.com> | 2011-01-09 20:45:35 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-01-09 20:45:35 -0800 |
commit | ac97f5ba9c07b29840eddc9f3ecfcac5d9926efd (patch) | |
tree | 83303fc8c161e31fd5c99dcd1b6c2c83b3b5278c /firmware/zpu/usrp2p/bootloader | |
parent | 4ca01c6dbeb253162e64a13f69ce981fc0b8b9bd (diff) | |
download | uhd-ac97f5ba9c07b29840eddc9f3ecfcac5d9926efd.tar.gz uhd-ac97f5ba9c07b29840eddc9f3ecfcac5d9926efd.tar.bz2 uhd-ac97f5ba9c07b29840eddc9f3ecfcac5d9926efd.zip |
usrp-n210: firmware changes related to init and bootloader
added u2p init file that is called by u2init
added spi flash init and added to u2pinit
implemented mdelay usage in bootloader
Diffstat (limited to 'firmware/zpu/usrp2p/bootloader')
-rw-r--r-- | firmware/zpu/usrp2p/bootloader/init_bootloader.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/firmware/zpu/usrp2p/bootloader/init_bootloader.c b/firmware/zpu/usrp2p/bootloader/init_bootloader.c index cfa80ffea..f71b0a7b2 100644 --- a/firmware/zpu/usrp2p/bootloader/init_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/init_bootloader.c @@ -11,6 +11,7 @@ #include <spi_flash.h> #include <spi_flash_private.h> //#include <clocks.h> +#include <mdelay.h> #include <ihex.h> #include <bootloader_utils.h> #include <string.h> @@ -49,17 +50,14 @@ void load_ihex(void) { //simple IHEX parser to load proper records into RAM. loa } } -void delay(uint32_t t) { - while(t-- != 0) asm("NOP"); -} - int main(int argc, char *argv[]) { - hal_disable_ints(); // In case we got here via jmp 0x0 + hal_disable_ints(); // In case we got here via jmp 0x0 output_regs->leds = 0xFF; - delay(5000); + mdelay(100); output_regs->leds = 0x00; hal_uart_init(); spif_init(); + spi_flash_init(); i2c_init(); //for EEPROM puts("USRP2+ bootloader super ultra ZPU edition\n"); @@ -85,7 +83,7 @@ int main(int argc, char *argv[]) { if(is_valid_fpga_image(PROD_FPGA_IMAGE_LOCATION_ADDR)) { puts("Valid production FPGA image found. Attempting to boot."); set_safe_booted_flag(1); - delay(300); //so serial output can finish + mdelay(300); //so serial output can finish icap_reload_fpga(PROD_FPGA_IMAGE_LOCATION_ADDR); } puts("No valid production FPGA image found.\nAttempting to load production firmware..."); @@ -94,11 +92,11 @@ int main(int argc, char *argv[]) { puts("Valid production firmware found. Loading..."); spi_flash_read(PROD_FW_IMAGE_LOCATION_ADDR, FW_IMAGE_SIZE_BYTES, (void *)RAM_BASE); puts("Finished loading. Starting image."); - delay(300); + mdelay(300); start_program(); puts("ERROR: Return from main program! This should never happen!"); //if this happens, though, the safest thing to do is reboot the whole FPGA and start over. - delay(300); + mdelay(300); icap_reload_fpga(SAFE_FPGA_IMAGE_LOCATION_ADDR); return 1; } @@ -106,10 +104,10 @@ int main(int argc, char *argv[]) { if(is_valid_fw_image(SAFE_FW_IMAGE_LOCATION_ADDR)) { spi_flash_read(SAFE_FW_IMAGE_LOCATION_ADDR, FW_IMAGE_SIZE_BYTES, (void *)RAM_BASE); puts("Finished loading. Starting image."); - delay(300); + mdelay(300); start_program(); puts("ERROR: return from main program! This should never happen!"); - delay(300); + mdelay(300); icap_reload_fpga(SAFE_FPGA_IMAGE_LOCATION_ADDR); return 1; } |