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"
20 /**
21 * @brief
22 * Nandboot is disabled through iblcfg.h. Disable the definition for the compilation
23 */
24 #ifdef iblNandBoot
25 #undef iblNandBoot
26 #endif
29 void iblNandBoot (void)
30 {
31 Uint32 entry;
32 void (*exit)();
34 /* Power up the device */
35 if (devicePowerPeriph (TARGET_PWR_NAND) < 0)
36 return;
39 /* Perform any device specific configurations */
40 if (deviceConfigureForNand() < 0)
41 return;
44 /* Open the nand driver */
45 if ((*nand_boot_module.open) ((void *)&ibl.nandConfig, NULL))
46 return;
49 entry = iblBoot (&nand_boot_module, ibl.nandConfig.bootFormat, &ibl.nandConfig.blob);
51 (*nand_boot_module.close)();
53 if (entry != 0) {
55 iblStatus.exitAddress = entry;
56 exit = (void (*)())entry;
57 (*exit)();
59 }
61 }