]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/ibl.git/blobdiff - src/main/iblmain.c
IBL updates. Change to version 1.0.0.13
[keystone-rtos/ibl.git] / src / main / iblmain.c
old mode 100644 (file)
new mode 100755 (executable)
index d376487..49c637a
@@ -65,6 +65,7 @@
 #include "spi_api.h"
 #include "ibl_elf.h"
 #include <string.h>
+#include "uart.h"
 
 extern cregister unsigned int IER;
 
@@ -237,12 +238,15 @@ void main (void)
 {
     int32 i, j;
     UINT32 v, boot_mode_idx, boot_para_idx;
+    unsigned int dip_setting;
 
     /* Initialize the status structure */
     iblMemset (&iblStatus, 0, sizeof(iblStatus_t));
     iblStatus.iblMagic   = ibl_MAGIC_VALUE;
     iblStatus.iblVersion = ibl_VERSION;
 
+    /* Init UART */
+     uart_init();
 
     /* Power up the timer */
     devicePowerPeriph (TARGET_PWR_TIMER_0);
@@ -309,7 +313,7 @@ void main (void)
             }
             boot_mode_idx = boot_para_idx/ibl_N_IMAGES;
             /* Get the boot image index */
-            iblImageIdx == boot_para_idx & (ibl_N_IMAGES - 1);
+            iblImageIdx = boot_para_idx & (ibl_N_IMAGES - 1);
 
             iblStatus.activeBoot = ibl.bootModes[boot_mode_idx].bootMode;
 
@@ -318,6 +322,8 @@ void main (void)
 #ifndef EXCLUDE_ETH
             case ibl_BOOT_MODE_TFTP:
                 iblStatus.activeDevice = ibl_ACTIVE_DEVICE_ETH;
+                /*Print something to UART, max len=80, if len is pased as 0 UART prints entire string upto '\n' or max len */
+                uart_write_string("IBL: Booting from ethernet",0);
                 iblMemcpy (&iblStatus.ethParams, &ibl.bootModes[boot_mode_idx].u.ethBoot.ethInfo, sizeof(iblEthBootInfo_t));
                 iblEthBoot (boot_mode_idx);
                 break;
@@ -327,6 +333,8 @@ void main (void)
             case ibl_BOOT_MODE_NAND:
                 iblPmemCfg (ibl.bootModes[boot_mode_idx].u.nandBoot.interface, ibl.bootModes[boot_mode_idx].port, TRUE);
                 memset ((void *)0x80000000, 0, 0x20000000);
+                /*Print something to UART, max len=80, if len is pased as 0 UART prints entire string upto '\n' or max len */
+                uart_write_string("IBL: Booting from NAND",0);
                 iblNandBoot (boot_mode_idx);
                 break;
 #endif
@@ -334,62 +342,49 @@ void main (void)
 #if (!defined(EXCLUDE_NOR_EMIF) && !defined(EXCLUDE_NOR_SPI))
             case ibl_BOOT_MODE_NOR:
                 iblPmemCfg (ibl.bootModes[boot_mode_idx].u.norBoot.interface, ibl.bootModes[boot_mode_idx].port, TRUE);
+                /*Print something to UART, max len=80, if len is pased as 0 UART prints entire string upto '\n' or max len */
+                uart_write_string("IBL: Booting from NOR",0);
                 iblNorBoot (boot_mode_idx);
                 break;
 #endif
             }
             iblStatus.heartBeat += 1;
         }
-        else
-#endif
-        {
-            
-           /* For C64x devices, loop through the boot modes to find the one with the highest priority
-            * value, and try to boot it. */
-            for (i = ibl_HIGHEST_PRIORITY; i < ibl_LOWEST_PRIORITY; i++)  {
-                
-                for (j = 0; j < ibl_N_BOOT_MODES; j++)  {
-                    
-                    if (ibl.bootModes[j].priority == i)  {
-                        
-                        iblStatus.activeBoot = ibl.bootModes[j].bootMode;
-                        
-                        switch (ibl.bootModes[j].bootMode)  {
-                            
-                            
+#else
+
+       dip_setting = get_device_switch_setting();
+       
+       if (dip_setting == 0)
+               boot_mode_idx = 0;
+       else if (dip_setting == 1)
+               boot_mode_idx = 1;
+       
+       iblStatus.activeBoot = ibl.bootModes[boot_mode_idx].bootMode;
+       
+       switch (ibl.bootModes[boot_mode_idx].bootMode) {                            
 #ifndef EXCLUDE_ETH
-                        case ibl_BOOT_MODE_TFTP:
-                            iblStatus.activeDevice = ibl_ACTIVE_DEVICE_ETH;
-                            iblMemcpy (&iblStatus.ethParams, &ibl.bootModes[j].u.ethBoot.ethInfo, sizeof(iblEthBootInfo_t));
-                            iblEthBoot (j);
-                            break;
+                case ibl_BOOT_MODE_TFTP:
+                        iblStatus.activeDevice = ibl_ACTIVE_DEVICE_ETH;
+                        iblMemcpy (&iblStatus.ethParams, &ibl.bootModes[boot_mode_idx].u.ethBoot.ethInfo, sizeof(iblEthBootInfo_t));
+                        /*Print something to UART, max len=80, if len is pased as 0 UART prints entire string upto '\n' or max len */
+                        uart_write_string("IBL: Booting from Ethernet",0);
+                        iblEthBoot (boot_mode_idx);
+                        break;
 #endif
                             
 #if ((!defined(EXCLUDE_NAND_EMIF)) || (!defined(EXCLUDE_NAND_GPIO)))
-                        case ibl_BOOT_MODE_NAND:
-                            iblPmemCfg (ibl.bootModes[j].u.nandBoot.interface, ibl.bootModes[j].port, TRUE);
-                            iblNandBoot (j);
-                            break;
+               case ibl_BOOT_MODE_NAND:
+                        iblPmemCfg (ibl.bootModes[boot_mode_idx].u.nandBoot.interface, ibl.bootModes[boot_mode_idx].port, TRUE);
+                        /*Print something to UART, max len=80, if len is pased as 0 UART prints entire string upto '\n' or max len */
+                        uart_write_string("IBL: Booting from NAND",0);
+                        iblNandBoot (boot_mode_idx);
+                        break;
 #endif
-                            
-#if (!defined(EXCLUDE_NOR_EMIF) && !defined(EXCLUDE_NOR_SPI))
-                        case ibl_BOOT_MODE_NOR:
-                            iblPmemCfg (ibl.bootModes[j].u.norBoot.interface, ibl.bootModes[j].port, TRUE);
-                            iblNorBoot (j);
-                            break;
+       }
+       iblStatus.heartBeat += 1;
 #endif
-                            
-                        }
-                    }
-                    
-                    iblStatus.heartBeat += 1;
-                    
-                }
-            }
-        }
-    }
-
 
+    }
 } /* main */