📄 ipl.c
字号:
/*************************************************************************Title: Filename: $Header:$Hardware: MX21Summay:License: The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/Author: Company: Freescale Suzhou Design Center====================Change Log========================$Log:$********************************************************************************////@ingroup NAND_BOOTLOADER///@file ipl.c///@brief This first C code when system reboot.////// Copy SPL to SDRAM and jump to SPL.//////@remark ipl.bin size must be below then 1.5K though mx21 have 2K boot ram.\n/// Because last 512 byte ram will be used for buffer get data from /// NAND, last 512 byte can't used for code//////@author //////@bug///@version $Version$ //<<<<<Include#define IO_ADDRESS #include "mx2.h"#include "nfc.h"//>>>>>Include//<<<<<< Private Macro///SPL Run SDRAM address, ipl will copy spl.bin to this address #define START_SDRAM_ADDRESS 0xc1000000 //0xc3004000///NAND Flash Start Page of SPL#define START_NAND_ADDRESS (0x00000800/NAND_FLASH_PAGE_MAIN_SIZE)///NAND Flash End Page of SPL#define START_END_ADDRESS (0x00004000/NAND_FLASH_PAGE_MAIN_SIZE)//>>>>>> Private Macro//<<<<<< Private Structure//>>>>>> Private Structure//<<<<<< Global Variable//>>>>>> Global Variable//<<<<<Private Function Declearation//>>>>>Private Function Declearation//<<<<<Body///copy spl to SDRAM and jump to spl.main(){ char * buff=(char*)START_SDRAM_ADDRESS; int i; // initialize the NANDFC clcok as 266/8 _reg_CRM_PCDR0 |= 0x7000; _reg_CRM_PCCR0 |= 0x80000; // Enable NFC nfc_init(); // As it's in the first block of NAND flash, no bbc & ecc needed. for(i=START_NAND_ADDRESS;i<START_END_ADDRESS;i++) { nfc_read_page(i, (u32*)((u32)buff + (i-START_NAND_ADDRESS)*NAND_FLASH_PAGE_MAIN_SIZE),0); } return START_SDRAM_ADDRESS;}//>>>>>Body
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -