Added an optional second ibl config area to the i2c eeprom
[keystone-rtos/ibl.git] / src / interp / btbl / btblwrap.c
index a8ac4d44ca4ca36009fcdc1f7b2bb17446e884f4..ae113cd18445d3c458860cb9a27d8f8ca4ae9c11 100644 (file)
@@ -54,11 +54,11 @@ void iblBootBtbl (BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *entry_point)
     btblWrapEcode = 0;
 
     /* Initialize stats and btbl state */
-    memset (&bootStats, 0, sizeof(bootStats_t));
+    iblMemset (&bootStats, 0, sizeof(bootStats_t));
     
     boot_init_boot_tbl_inst (&tiBootTable);    
 
-    data = malloc (TI_BTBL_BLOCK_SIZE);
+    data = iblMalloc (TI_BTBL_BLOCK_SIZE);
     if (data == NULL)  {
         btblWrapEcode = BTBL_WRAP_ECODE_MALLOC_FAIL;
         return;
@@ -70,6 +70,9 @@ void iblBootBtbl (BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *entry_point)
 
         switch (tiBootTable.state)  {
 
+            case BOOT_TBL_STATE_PAD:   readSize = 2;
+                                       break;
+
             case BOOT_TBL_STATE_INIT:  
             case BOOT_TBL_STATE_SIZE:  
             case BOOT_TBL_STATE_ADDR:  readSize = 4;
@@ -88,7 +91,7 @@ void iblBootBtbl (BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *entry_point)
             /* No recovery on block read failure */
             if ((*bootFxn->read)(data, blockSize) < 0)  {
                 btblWrapEcode = BTBL_WRAP_ECODE_READ_FAIL;
-                free (data);
+                iblFree (data);
                 return;
             }
 
@@ -114,7 +117,7 @@ void iblBootBtbl (BOOT_MODULE_FXN_TABLE *bootFxn, Uint32 *entry_point)
     if (btblEcode == 0)
         *entry_point = tiBootTable.code_start_addr;
 
-    free (data);
+    iblFree (data);
 
 }