亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mxc_nb_ipl.c

?? i.mx31 3DS平臺Nandboot引導程序源碼
?? C
字號:
/* * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *//*! * @file mxc_nb_ipl.c *  * @brief Source file for NANDboot Initial Program Loader (IPL) * * NANDboot is for NAND flash booting.  * NAND Flash can be configured as a booting device. This requires an  * Initial Program Loader (IPL) to be written on the first block of the  * NAND Flash which performs the initial booting operations. Since IPL has  * the size limit, it loads Secondary Program Loader (SPL) which initializes  * the system and loads the OS.  * This file contains the IPL code which loads the SPL from NAND Flash to the * SPL_DEST_ADDR address in the RAM and starts executing from that location.  *  * @ingroup NANDboot */typedef unsigned short U16;typedef unsigned int U32;typedef unsigned char U8;typedef unsigned short u16;typedef unsigned int u32;typedef unsigned char u8;#include "mxc_nb_nfc.h"//#define NB_DEBUG#define NB_OP_DELAY           100  #define NB_PRESET_DELAY       10  #ifdef NB_DEBUG#define NB_DEBUG_BUF_ADDR     0x80001000#define NB_DEBUG_BUF_LEN      0x1000static char *dbg_ptr = (char *)NB_DEBUG_BUF_ADDR;static char idx=0;/* * This function writes a one byte message number and 7 char message into the * debug buffer. This is used for debugging when there is no serial output yet * and possibly the debugger is not able to single stpe through the code! */void nb_dbg1(char *msg){        int i;        /* dbg_ptr boundary check */        if ((dbg_ptr + 8) > (char *)(NB_DEBUG_BUF_ADDR + NB_DEBUG_BUF_LEN))        {                dbg_ptr = (char *)NB_DEBUG_BUF_ADDR;        }        *dbg_ptr = idx++; /* Put the message number */        /* put the message, until null */        for (i = 0; i < 7; i++)        {                *(dbg_ptr + i) = *(msg + i);        }        /* Point to the next message to be written*/        dbg_ptr += 8;}void nb_dbg(char *msg){        int i;        /* dbg_ptr boundary check */        if ((dbg_ptr + 8) > (char *)(NB_DEBUG_BUF_ADDR + NB_DEBUG_BUF_LEN))        {                dbg_ptr = (char *)NB_DEBUG_BUF_ADDR;        }        *dbg_ptr++ = idx++; /* Put the message number */}#else   /* !NB_DEBUG */#define nb_dbg(_msg)#endif                                /*! * This is helper sleep function which loops for approximately given number * usecs. *  @param       count     number of usec to wait loop */void udelay(int count){/* Assuming 366 MHz, 366 instructions will take 1 usec, we will execute 2 * inst in the loop (1 compare, 1 increment). */#define LOOPS_PER_USEC (366 / 2)        volatile int i;        count *= LOOPS_PER_USEC; /* 'count' number of usec */        for (i = 0; i < count; i++)                ;}/*! * This function polls the NANDFC to wait for an operation to complete * function. It sets the flags for the commands that requires different read * and write operations. * * @param       maxRetries     number of retry attempts (separated by 1 us) */int wait_op_done(u32 maxRetries){        //maxRetries *= 100;        while (maxRetries-- > 0) {                if (NFC_CONFIG2 & 0x8000) break;                udelay(1);        }        if (maxRetries <= 0)        {                nb_dbg("1-fail");                return -1;        }        return 0;}/*! * The NFC has to be preset before performing any operation */void mxc_nfb_preset(void){        /* Preset Operation */        /* Unlock the internal RAM buffer */        NFC_CONFIG = 0x2;                /* First Block to be unlocked */        NFC_UNLOCKSTART_BLKADDR = 0x0;        /* Last Unlock Block */        NFC_UNLOCKEND_BLKADDR = 0x800;        /* Unlock Block Command */        NFC_WRPROT = 0x4;        /* Mask Interrupt */        NFC_CONFIG1 = 0x10;        udelay(NB_PRESET_DELAY);}/*! * A command has to be sent to the NAND flash for every read/write operation on * NAND Flash.  This function sends command to the NAND Flash. It writes the * command to the NFC's Command Register. Configures the NFC's Configuration * Register to perform the Command Input Operation. *  * @param       cmd    area from where to read the page *  * @return      0 if command operation is not  complete else 1.  */ int mxc_nfb_command(U8 cmd){        NFC_FLASH_CMD = cmd;        /* Configure NAND Flash Config2 Register          * Set INT to 0, FCMD to 1, rest to 0         */        NFC_CONFIG2 = NFC_CMD;        /* Confirm Cmd Complete */        return wait_op_done(NB_OP_DELAY);}/*! * Reading or writing to any location in NAND Flash requires to set an  * address of that location in NFC. This function writes the NAND Flash Address * to the NFC's Address Register. Sets the Configuration Register for the  * Address Input Operation  *  * @param       addr    addr from where to read the page *  * @return      0 if address operation is not  complete else 1.  */int mxc_nfb_address(U16 addr){        NFC_FLASH_ADDR = addr;        /*          * Configure NAND Flash Config2 Register.         * Set INT to 0, FADD to 1, rest to 0.         */        NFC_CONFIG2 = NFC_ADDR;        /* Confirm Cmd Complete */        return wait_op_done(NB_OP_DELAY);}/*! * There are four main area RAM buffers in NAND flash controller. This function * takes the main area RAM buffer number.  It configures the NFC to copy the * data to/from the specified main area buffer from/to the NAND flash, during * read/write operation. *  * @param       addr    value for the internal main area buffer. *  * @return      0 if the operation is not complete else 1.  */int mxc_nfb_bufferaddr(U16 addr){        NFC_BUFFER_ADDR = addr;        /*          * Configure NAND Flash Config2 Register.         * Set INT to 0, FDO to 1, rest to 0.         */        NFC_CONFIG2 = NFC_OUTPUT;        /* Confirm Cmd Complete */        return wait_op_done(NB_OP_DELAY);}#if 0/*! * The function generate the command cycle for read the nandflash id */ void mxc_nfb_readid(void) {           mxc_nfb_command(NAND_CMD_READID);           mxc_nfb_address(0x0);           NFC_BUFFER_ADDR = 0;                    NFC_CONFIG2 = NFC_ID; }#endif typedef u32 (*FPTR)(void);/*! * Main routine of NANDboot Initial Program Loader. It copies all the pages  * after first 2k bytes offset in the 0th block which is guaranteed to be good * block  */ int main(void){        unsigned short i, page;        volatile unsigned short *pMem = SPL_DEST_ADDR;        volatile unsigned short * membuff;        FPTR fptr;        /* To jump to SPL */        /* Wait for INT bit set for completion of boot loading */        while (!(NFC_CONFIG2 & 0x8000))        {                /* Do nothing */        }	/*	NFC_CONFIG2 |= 0x8000;	*/        mxc_nfb_preset();        /*          * Copy 1th block of NAND into memory starting from 2nd page, where SPL         * is expected to be stored. guess to copy 4 pages. 8K         */        for (page = 0x01; page <= 0x04; page++)         {                nb_dbg("readcmd");		 NFC_BUFFER_ADDR = 0;                /* Write to NAND Flash Cmd Register - Read Area 0x0 */               if ( mxc_nfb_command(NAND_CMD_READ0)) {                       return -1;               }                nb_dbg("address");                /*                  * The NAND Flash Addr is a 5 Cycle process. Write to NAND                 * Flash Addr Register - Start Addr in Page 0x0                  */               if ( mxc_nfb_address(0x0)) {                       return -1;               }		 if ( mxc_nfb_address(0x0)) {                       return -1;               }		                 /* Write to NAND Flash Addr Register - Page Addr in Block 0x0 */                if (mxc_nfb_address(page)) {                        return -1;                }                /* Write to NAND Flash Addr Register - Block Addr 0x0 */                if (mxc_nfb_address(0x0)) {                        return -1;                }				                /* Write to NAND Flash Addr Register - Block Addr 0x0 */                if (mxc_nfb_address(0x0)) {                          return -1;                }		 /* confirm to read */               if ( mxc_nfb_command(NAND_CMD_READSTART)) {                       return -1;               }        	NFC_CONFIG2 = NFC_OUTPUT;        	wait_op_done(NB_OP_DELAY);                /*                  * Receive Data in RAM Buffer Addr Register - Set to 1st                 * Internal Buffer, where data will be loaded. First buffer is                 * selected as we have already executed the code in 1st RAM                 * buffer and it is safe to overwrite it.                  * (For the record: The code in this file starts at 0x320 which                * is beyond 1st RAM buffer end address of 0x1FF.)                 */                if (mxc_nfb_bufferaddr(0x1)) {                        return -1;                }                if (mxc_nfb_bufferaddr(0x2)) {                        return -1;                }                if (mxc_nfb_bufferaddr(0x3)) {                        return -1;                }		 if (NFC_STATUS_RESULT & 0x0A) {			nb_dbg("read SPL from NAND failed\n");			return -1;		 }                /* Read Data from RAM Buffer */                membuff = MAIN_AREA0;                nb_dbg("bytecopy");                /* Read 512 Bytes of NAND Flash */                for (i = 0; i < (NAND_PAGE_SIZE/2) ; i++)                 {                        *(pMem++) = *(membuff++);                }                                               }        /* Jump to SPL start address */        fptr = (FPTR)SPL_DEST_ADDR;        fptr();        /* Point of no return */}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品久久久久| 亚洲美女在线国产| 中文字幕色av一区二区三区| 亚洲一卡二卡三卡四卡无卡久久| 精品在线播放免费| 在线亚洲一区二区| 中文在线一区二区 | 久久99久久久久久久久久久| 成人美女在线视频| 久久这里只精品最新地址| 一区二区三区四区不卡在线 | 91在线免费看| 久久久国际精品| 日本伊人精品一区二区三区观看方式| 99免费精品视频| 国产日韩欧美综合一区| 日本欧美肥老太交大片| 欧美日韩在线播| 夜夜亚洲天天久久| 色爱区综合激月婷婷| 亚洲美女免费视频| 北条麻妃一区二区三区| 国产人妖乱国产精品人妖| 国产一区二区影院| 久久综合九色综合97_久久久| 六月婷婷色综合| 欧美xxxxxxxxx| 极品尤物av久久免费看| 国产日韩影视精品| 丁香亚洲综合激情啪啪综合| 久久久久久一二三区| 国产大陆精品国产| 国产精品国产三级国产| 不卡视频一二三四| 亚洲品质自拍视频网站| 欧美亚洲丝袜传媒另类| 天天av天天翘天天综合网色鬼国产| 在线观看av不卡| 婷婷夜色潮精品综合在线| 欧美一区二区三区日韩视频| 麻豆精品一区二区av白丝在线| 日韩欧美国产精品一区| 精品一区二区三区久久| 国产天堂亚洲国产碰碰| 成人app软件下载大全免费| 亚洲欧洲美洲综合色网| 欧美伊人久久久久久久久影院| 天天av天天翘天天综合网| 欧美一级电影网站| 国产伦理精品不卡| 一区在线观看免费| 欧美三级中文字| 精久久久久久久久久久| 中文字幕一区二区在线播放| 欧美午夜影院一区| 卡一卡二国产精品 | 久久久久久麻豆| jlzzjlzz亚洲女人18| 亚洲成av人片在线观看无码| 欧美一区二区在线视频| 国产精品主播直播| 亚洲精品中文字幕乱码三区| 久久先锋资源网| 成人一区二区视频| 亚洲一区二三区| 亚洲精品一区二区三区福利| 97精品国产97久久久久久久久久久久 | 精品1区2区在线观看| 成人动漫一区二区在线| 日本美女一区二区三区视频| 国产欧美日韩精品一区| 欧美区在线观看| 成人午夜电影久久影院| 午夜精品一区二区三区电影天堂| 久久久国产午夜精品 | 成人avav影音| 麻豆成人综合网| 亚洲精品国产无天堂网2021| 精品国产乱码久久久久久1区2区 | 亚洲精品日韩专区silk| 日韩免费高清av| 在线观看欧美黄色| 国产精品123| 麻豆国产精品一区二区三区| 亚洲免费av在线| 国产欧美日韩另类一区| 日韩三级av在线播放| 在线视频欧美精品| www.日本不卡| 国产真实乱偷精品视频免| 日日摸夜夜添夜夜添国产精品| 国产精品久久二区二区| 精品国产乱码久久久久久蜜臀| 欧美羞羞免费网站| 色综合久久久网| 成人美女视频在线观看18| 久久激五月天综合精品| 亚洲成a天堂v人片| 亚洲午夜精品17c| 亚洲女人的天堂| 中文字幕在线不卡| 中文久久乱码一区二区| 精品处破学生在线二十三| 91麻豆精品国产91久久久 | 亚洲永久免费av| 亚洲美女视频在线观看| 中文字幕在线不卡一区二区三区 | 久久综合网色—综合色88| 欧美一级欧美三级在线观看| 欧美日韩一区三区四区| 精品婷婷伊人一区三区三| 欧美性色aⅴ视频一区日韩精品| 色综合天天综合在线视频| 一本大道久久a久久综合| 91电影在线观看| 欧美性videosxxxxx| 欧美日本一区二区三区| 91麻豆精品91久久久久久清纯| 在线观看91av| 欧美va亚洲va| 国产日韩欧美制服另类| 亚洲欧洲日产国产综合网| 亚洲黄网站在线观看| 亚洲国产精品久久久男人的天堂| 亚洲第一主播视频| 免费在线观看一区二区三区| 久久成人久久爱| 国产黄色成人av| 97精品久久久久中文字幕 | 成人国产在线观看| av在线一区二区三区| 91香蕉视频mp4| 欧美色成人综合| 日韩一二在线观看| 久久免费午夜影院| 夜夜操天天操亚洲| 久久综合综合久久综合| 成人一区二区三区中文字幕| 色悠悠亚洲一区二区| 欧美剧情片在线观看| 精品国产亚洲在线| 亚洲欧洲av一区二区三区久久| 日韩理论在线观看| 奇米综合一区二区三区精品视频| 国产精品主播直播| 欧美在线制服丝袜| 久久人人爽爽爽人久久久| 亚洲人成网站精品片在线观看| 欧美96一区二区免费视频| 成人黄页在线观看| 91精品国产全国免费观看 | 亚洲成人一区在线| 国产一区三区三区| 欧美亚洲一区三区| 国产欧美一区二区在线| 亚洲v日本v欧美v久久精品| 韩国毛片一区二区三区| 欧美亚洲尤物久久| 中文字幕免费在线观看视频一区| 亚洲风情在线资源站| 成人黄色在线网站| 26uuu色噜噜精品一区| 亚洲国产成人av好男人在线观看| 国产福利一区二区三区视频在线| 91福利精品第一导航| 国产欧美日韩视频在线观看| 日韩电影在线免费观看| 一本色道久久综合亚洲91| 久久精品一区二区三区不卡牛牛| 亚洲高清免费在线| 99精品热视频| 国产欧美视频一区二区三区| 成年人国产精品| 久久久久久久久久久久久夜| 日韩经典中文字幕一区| 日本二三区不卡| 国产精品不卡在线观看| 国产最新精品精品你懂的| 欧美日韩国产一级二级| 亚洲丝袜美腿综合| 国产成人免费视频网站高清观看视频| 欧美日本免费一区二区三区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 老色鬼精品视频在线观看播放| 国产肉丝袜一区二区| 裸体健美xxxx欧美裸体表演| 欧美精品色综合| 亚洲成av人综合在线观看| 91黄色小视频| 中文字幕一区二区不卡| 成人高清视频在线| 国产精品丝袜一区| 成人性生交大片免费看在线播放| 久久久久久一级片| 国产成人啪免费观看软件| 久久综合av免费| 国产一区二区精品在线观看| 26uuu亚洲综合色| 国产成人午夜精品5599| 中文字幕精品三区|