1 /***********************************************************************************
2 * FILE PURPOSE: The NAND boot wrapper
3 ***********************************************************************************
4 * FILE NAME: nandboot.c
5 *
6 * DESCRIPTION: This file provides the nand boot wrapper used by IBL modules
7 *
8 * @file nandboot.c
9 *
10 * @brief
11 * The nand boot wrapper
12 *
13 ************************************************************************************/
14 #include "types.h"
15 #include "ibl.h"
16 #include "iblloc.h"
17 #include "nand.h"
18 #include "device.h"
21 void iblNandBoot (void)
22 {
23 Uint32 entry;
24 void (*exit)();
26 /* Power up the device */
27 if (devicePowerPeriph (TARGET_PWR_NAND) < 0)
28 return;
31 /* Perform any device specific configurations */
32 if (deviceConfigureForNand() < 0)
33 return;
36 /* Open the nand driver */
37 if ((*nand_boot_module.open) ((void *)&ibl.nandConfig, NULL))
38 return;
41 entry = iblBoot (&nand_boot_module, ibl.nandConfig.bootFormat, &ibl.nandConfig.blob);
43 (*nand_boot_module.close)();
45 if (entry != 0) {
47 iblStatus.exitAddress = entry;
48 exit = (void (*)())entry;
49 (*exit)();
51 }
53 }