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

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

?? nandfs.c

?? 基于EP7312的MP3播放器源代碼,包括MCU和PC端代碼.
?? C
?? 第 1 頁 / 共 3 頁
字號:
//****************************************************************************//// NANDFS.C - File system driver for the on-board NAND FLASH.//// Copyright (c) 1999,2000,2001 Cirrus Logic, Inc.////****************************************************************************#include "globals.h"#include "../hwport.h"#include "../hwdefs.h"//****************************************************************************//// The persistent state of the NAND file system.////****************************************************************************static struct{    //    // A list of the bad blocks in the on-board NAND FLASH, in numerical order.    //    unsigned short usBadBlocks[64];    //    // The number of bad blocks in the on-board NAND FLASH.    //    unsigned short usNumBadBlocks;    //    // The number of blocks in the on-board NAND FLASH.    //    unsigned short usNumBlocks;    //    // The number of pages per block of the on-board NAND FLASH.    //    unsigned char ucPagesPerBlock;    //    // Unused bytes to pad the next member to a word boundary.    //    unsigned char ucUnused1, ucUnused2, ucUnused3;    //    // The length of the one file in the on-board NAND FLASH.    //    unsigned long ulFileLength;    //    // A pointer to the function used to read a page from the on-board NAND    // FLASH.    //    void (*pfnRead)(unsigned long ulNANDAddress, unsigned long ulPage,                    unsigned char *pucData, unsigned char *pucRedundant);    //    // A pointer to the function used to write a page to the on-board NAND    // FLASH.    //    void (*pfnWrite)(unsigned long ulNANDAddress, unsigned long ulPage,                     unsigned char *pucData, unsigned char *pucRedundant);    //    // A pointer to the function used to erase a block of the on-board NAND    // FLASH.    //    void (*pfnErase)(unsigned long ulNANDAddress, unsigned long ulBlock);} sNAND;//****************************************************************************//// The following structure contains the parameters of an opened file.////****************************************************************************typedef struct{    //    // The next page of the file to be read.    //    unsigned long ulPage;    //    // The current byte offset into the file.    //    unsigned long ulFilePos;} tNANDFile;//****************************************************************************//// The following structure contains the parameters of an opened directory.////****************************************************************************typedef struct{    //    // An indicator that is true when there have been no IOCTL_FS_READDIR    // Ioctls after an IOCTL_FS_OPENDIR Ioctl.    //    unsigned long bIsFirstDirEntry;} tNANDDir;//****************************************************************************//// NextPage increments to the next valid page of the NAND FLASH.  The next// valid page is "*pulPage++", unless this falls on an invalid block.  The// current value of the page variable is returned, so that this function can// be used as a post-increment reference (i.e. NextPage(&x) is roughly// equivalent to x++).////****************************************************************************static unsigned longNextPage(unsigned long *pulPage){    unsigned long ulRet;    int iIdx;    //    // Save the current page number.    //    ulRet = *pulPage;    //    // Increment the page number.    //    (*pulPage)++;    //    // If this is not the first page of a block, then it is not part of an    // invalid block.    //    if((*pulPage & (sNAND.ucPagesPerBlock - 1)) != 0)    {        //        // Return the previous page number.        //        return(ulRet);    }    //    // Increment the page number until we reach a page in a valid block.    //    while(1)    {        //        // See if this page lies in one of our invalid blocks.        //        for(iIdx = 0; iIdx < sNAND.usNumBadBlocks; iIdx++)        {            if((*pulPage / sNAND.ucPagesPerBlock) == sNAND.usBadBlocks[iIdx])            {                break;            }        }        //        // If this page does not lie in one of the invalid blocks, then stop        // incrementing the page number.        //        if(iIdx == sNAND.usNumBadBlocks)        {            break;        }        //        // Skip to the first page of the next block.        //        *pulPage += sNAND.ucPagesPerBlock;    }    //    // Return the previous page number.    //    return(ulRet);}//****************************************************************************//// CheckNAND determines if the NAND FLASH on the board has been "formatted"// and reads the bad block table if it has been formatted.////****************************************************************************static intCheckNAND(unsigned char *pucBuffer, unsigned char *pucWriteBuffer){    int iLoop;    //    // Read the first page of the NAND FLASH.    //    (sNAND.pfnRead)(HwNANDAddress, 0, pucBuffer, pucWriteBuffer);    //    // See if the NAND FLASH has been formatted by looking for the signature    // at the beginning of the first page.    //    if((pucBuffer[0] != 'B') || (pucBuffer[1] != 'K') ||       (pucBuffer[2] != 'O') || (pucBuffer[3] != 'K'))    {        //        // The signature does not exist, so the NAND FLASH has not been        // formatted yet.        //        return(0);    }    //    // Get the number of bad blocks.    //    sNAND.usNumBadBlocks = pucBuffer[4] | (pucBuffer[5] << 8);    //    // Make sure that the number of bad blocks is valid.    //    if(sNAND.usNumBadBlocks > 64)    {        sNAND.usNumBadBlocks = 0;        return(0);    }    //    // Read the bad block table.    //    for(iLoop = 0; iLoop < sNAND.usNumBadBlocks; iLoop++)    {        sNAND.usBadBlocks[iLoop] = pucBuffer[6 + (iLoop << 1)] |                                   (pucBuffer[7 + (iLoop << 1)] << 8);    }    //    // The media has been formatted.    //    return(1);}//****************************************************************************//// FormatNAND prepares the NAND FLASH for use to record/download file data.// It checks the NAND FLASH for bad blocks and builds a bad block table.////****************************************************************************static voidFormatNAND(unsigned char *pucBuffer, unsigned char *pucWriteBuffer){    unsigned long ulValue;    int iBlock, iPage, iIdx;    //    // We only need to check for bad blocks if the NAND FLASH has not already    // been formatted.    //    if(!CheckNAND(pucBuffer, pucWriteBuffer))    {        //        // Initially, there are no bad blocks in the NAND FLASH (until we find        // bad blocks).        //        sNAND.usNumBadBlocks = 0;        //        // Loop through all the blocks in the on-board NAND FLASH.        //        for(iBlock = 1; iBlock < sNAND.usNumBlocks; iBlock++)        {            //            // Read the first two pages of each block.  The page will be all            // 0xff if it is good, and will contain zeros if it is bad.            //            for(iPage = 0; iPage < 2; iPage++)            {                //                // Read the page from NAND FLASH.                //                (sNAND.pfnRead)(HwNANDAddress,                                (iBlock * sNAND.ucPagesPerBlock) + iPage,                                pucBuffer, pucWriteBuffer);                //                // Verify that the page contains all 0xff.                //                for(iIdx = 0; iIdx < 512; iIdx++)                {                    if(pucBuffer[iIdx] != 0xff)                    {                        break;                    }                }                //                // If this page did not contain all 0xff, then break out of the                // loop.                //                if(iIdx != 512)                {                    break;                }                //                // Verify that the spare area contains all 0xff.                //                for(iIdx = 0; iIdx < 16; iIdx++)                {                    if(pucWriteBuffer[iIdx] != 0xff)                    {                        break;                    }                }                //                // If the spare area did not contain all 0xff, then break out                // of the loop.                //                if(iIdx != 16)                {                    break;                }            }            //            // If both pages did not contain all 0xff, then this block is bad.            //            if(iPage != 2)            {                //                // Save this block in the bad block table.                //                sNAND.usBadBlocks[sNAND.usNumBadBlocks++] = iBlock;                //                // Quit scanning if we've found too many bad blocks.  This                // ignores any following bad blocks, but what can you do (this                // isn't exactly a "filesystem" and is certainly not product                // worthy)?                //                if(sNAND.usNumBadBlocks == 64)                {                    break;                }            }        }        //        // Build the signature and bad block table for the first page of the        // NAND FLASH.        //        pucBuffer[0] = 'B';        pucBuffer[1] = 'K';        pucBuffer[2] = 'O';        pucBuffer[3] = 'K';        //        // Fill in the bad block table.        //        pucBuffer[4] = sNAND.usNumBadBlocks & 0xFF;        pucBuffer[5] = (sNAND.usNumBadBlocks >> 8) & 0xFF;        for(iIdx = 0; iIdx < sNAND.usNumBadBlocks; iIdx++)        {            pucBuffer[6 + (iIdx << 1)] = sNAND.usBadBlocks[iIdx] & 0xFF;            pucBuffer[7 + (iIdx << 1)] = (sNAND.usBadBlocks[iIdx] >> 8) & 0xFF;        }        //        // Write the bad block table to the beginning of the NAND FLASH.        //        (sNAND.pfnErase)(HwNANDAddress, 0);        NANDWaitTilNotBusy(HwNANDAddress);        (sNAND.pfnWrite)(HwNANDAddress, 0, pucBuffer, pucWriteBuffer);        NANDWaitTilNotBusy(HwNANDAddress);    }    //    // Set the file size to zero, so that we do not try to play the empty    // contents of the NAND FLASH.    //    pucBuffer[0] = 0;    pucBuffer[1] = 0;    pucBuffer[2] = 0;    pucBuffer[3] = 0;    ulValue = sNAND.ucPagesPerBlock - 1;    NextPage(&ulValue);    (sNAND.pfnErase)(HwNANDAddress, ulValue / sNAND.ucPagesPerBlock);    NANDWaitTilNotBusy(HwNANDAddress);    (sNAND.pfnWrite)(HwNANDAddress, ulValue, pucBuffer, pucWriteBuffer);    NANDWaitTilNotBusy(HwNANDAddress);}//****************************************************************************//// The file system entry point for the on-board NAND FLASH.////****************************************************************************unsigned longNANDIoctl(unsigned char *pucScratch, unsigned char *pucWriteBuffer,          unsigned long ulIoctl, unsigned long ulInstance,          unsigned long ulParam1, unsigned long ulParam2){    volatile unsigned long *pulGPIO = (unsigned long *)HwBaseAddress;    //    // If we are being initialized, then we need to setup our global variables.    //    if(ulIoctl == IOCTL_FS_INIT)    {        unsigned long ulDeviceID;        //        // Select the on-board NAND.        //        pulGPIO[HwPortABCD >> 2] &= ~HwPortABCD_NAND1_CS;        //        // Get the ID of the on-board NAND FLASH.        //        ulDeviceID = NANDGetID(HwNANDAddress);        //        // Determine the size and geometry of the on-board NAND FLASH.        //        switch(ulDeviceID)        {            //            // The device capacity is 4MB.            //            case 0x6B:            case 0xE3:            case 0xE5:            {                //                // There are 512 blocks in this device.                //                sNAND.usNumBlocks = 512;                //                // There are 16 pages per block in this device.                //                sNAND.ucPagesPerBlock = 16;                //                // Fill in the function pointers for accessing this FLASH                // device.                //                sNAND.pfnRead = NANDRead_512_3;                sNAND.pfnWrite = NANDWrite_512_3;                sNAND.pfnErase = NANDErase_16;                //                // We've interpreted the device ID.                //                break;            }            //            // The device capacity is 8MB.            //            case 0xE6:            {                //                // There are 1024 blocks in this device.                //                sNAND.usNumBlocks = 1024;                //                // There are 16 pages per block in this device.                //                sNAND.ucPagesPerBlock = 16;                //                // Fill in the function pointers for accessing this FLASH                // device.                //                sNAND.pfnRead = NANDRead_512_3;                sNAND.pfnWrite = NANDWrite_512_3;                sNAND.pfnErase = NANDErase_16;                //                // We've interpreted the device ID.                //                break;            }            //            // The device capacity is 16MB.            //            case 0x73:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区三区久久影院| 欧美视频在线一区二区三区 | 懂色av一区二区夜夜嗨| 成人欧美一区二区三区小说| 欧美妇女性影城| 国产一区二区美女诱惑| 中文成人av在线| 制服丝袜在线91| 成人av在线资源| 美国十次综合导航| 亚洲欧美日韩电影| 久久伊人蜜桃av一区二区| 成人免费视频一区| 日本sm残虐另类| 亚洲柠檬福利资源导航| 日韩欧美国产一二三区| 色综合咪咪久久| 日韩二区在线观看| 亚洲天堂精品在线观看| 精品成人一区二区| 欧美日韩高清在线播放| av电影一区二区| 久久成人久久爱| 亚洲一卡二卡三卡四卡无卡久久 | 在线观看免费一区| 国产成a人亚洲| 免费人成精品欧美精品| 亚洲国产精品久久艾草纯爱 | 91精品国产手机| 成人免费高清在线观看| 精品一区精品二区高清| 亚洲精品乱码久久久久久| 久久久午夜电影| 欧美岛国在线观看| 欧美久久久久久久久| 色老头久久综合| 99久久精品国产毛片| 国产精品一卡二卡| 狠狠狠色丁香婷婷综合久久五月| 午夜精品久久久久久久99水蜜桃 | 在线观看日韩国产| 99精品视频一区二区| 丰满白嫩尤物一区二区| 国产一区二区三区在线观看精品 | 中文字幕av不卡| 久久免费午夜影院| 日韩免费一区二区三区在线播放| 欧美日韩国产首页在线观看| 欧美亚洲综合网| 日本精品一级二级| 99久久99久久精品国产片果冻| 精品亚洲成a人在线观看| 青青草国产成人av片免费| 亚洲一二三四在线观看| 亚洲一区二区三区在线| 亚洲制服欧美中文字幕中文字幕| 亚洲日本va午夜在线影院| 国产精品理论在线观看| 欧美精品一区二区不卡| 久久亚洲综合av| 国产网站一区二区三区| 国产亲近乱来精品视频| 欧美一级日韩一级| 日韩欧美高清一区| 精品国产制服丝袜高跟| 欧美成人aa大片| 国产亚洲成aⅴ人片在线观看| 国产欧美日韩卡一| 国产精品国产自产拍高清av王其 | 亚洲福利国产精品| 视频一区二区中文字幕| 日韩av一二三| 国产一区二区三区在线观看精品 | 激情国产一区二区| 国产一区二三区| 波多野结衣一区二区三区| 国产999精品久久久久久绿帽| 成人精品国产一区二区4080| 床上的激情91.| 成人福利在线看| 色八戒一区二区三区| 欧美猛男超大videosgay| 精品乱人伦一区二区三区| 亚洲欧美一区二区三区极速播放| 青青草97国产精品免费观看无弹窗版 | 国产河南妇女毛片精品久久久| 日本精品一区二区三区高清 | 奇米影视在线99精品| 99久久久久免费精品国产| 日韩欧美一区在线观看| 亚洲女子a中天字幕| 经典三级视频一区| 欧美三级三级三级爽爽爽| 欧美激情一区二区三区四区| 偷窥少妇高潮呻吟av久久免费| 成人小视频免费观看| 日韩欧美激情一区| 一区二区三区在线看| 国产精品18久久久久| 欧美日韩dvd在线观看| 亚洲素人一区二区| 国产成人一区在线| 欧美xxxxxxxxx| 石原莉奈一区二区三区在线观看| 91丨九色丨蝌蚪丨老版| 久久蜜臀中文字幕| 麻豆免费看一区二区三区| 在线视频你懂得一区| 中文字幕一区二区三区蜜月| 国产精品白丝av| 精品理论电影在线| 日本美女一区二区三区视频| 欧美自拍丝袜亚洲| 亚洲日本青草视频在线怡红院| 粉嫩aⅴ一区二区三区四区| 日韩女优视频免费观看| 在线观看一区二区精品视频| 成人免费在线播放视频| 国产精品一二三| 久久伊人蜜桃av一区二区| 久久精品99久久久| 欧美不卡一区二区| 日本va欧美va精品发布| 欧美一区二视频| 日韩av二区在线播放| 欧美一区二区在线免费观看| 五月天激情小说综合| 欧美日韩在线三级| 亚洲成人免费观看| 在线观看91精品国产入口| 一区二区三区成人| 欧美主播一区二区三区| 亚洲影视在线播放| 一区二区三区日本| 97精品久久久久中文字幕| 综合久久久久久| 91丨porny丨国产| 有坂深雪av一区二区精品| 在线视频你懂得一区| 亚洲成人av电影在线| 欧美日韩高清在线| 美女诱惑一区二区| 日韩你懂的在线播放| 国产一区啦啦啦在线观看| 国产网站一区二区| 99久久精品国产网站| 亚洲一区二区三区四区五区中文| 欧美性猛交一区二区三区精品| 亚欧色一区w666天堂| 91精品国产综合久久小美女| 久久国产精品72免费观看| 久久久综合网站| av日韩在线网站| 亚洲第一综合色| 欧美成人艳星乳罩| 成人看片黄a免费看在线| 亚洲丝袜另类动漫二区| 欧美视频一二三区| 美美哒免费高清在线观看视频一区二区| 欧美大片顶级少妇| a4yy欧美一区二区三区| 亚洲成人av免费| 久久精品夜色噜噜亚洲aⅴ| 91亚洲男人天堂| 免费成人美女在线观看| 欧美国产成人在线| 欧美综合久久久| 韩国午夜理伦三级不卡影院| 亚洲欧美一区二区三区久本道91 | 成人ar影院免费观看视频| 亚洲制服丝袜在线| 精品久久一区二区三区| 不卡的av电影在线观看| 亚洲成av人片一区二区| 久久久电影一区二区三区| 欧洲精品视频在线观看| 国产在线精品一区二区夜色| 一区二区在线电影| www国产成人免费观看视频 深夜成人网| 成人av网址在线观看| 欧美aaaaa成人免费观看视频| 国产精品久久久久9999吃药| 3751色影院一区二区三区| a级精品国产片在线观看| 欧美aⅴ一区二区三区视频| 99久久精品久久久久久清纯| 日韩av中文在线观看| 亚洲欧美电影一区二区| 精品国产电影一区二区| 色国产综合视频| 粉嫩欧美一区二区三区高清影视 | 99re8在线精品视频免费播放| 偷拍一区二区三区四区| 一区在线播放视频| 欧美大白屁股肥臀xxxxxx| 欧美亚洲综合色| 波多野结衣一区二区三区| 激情综合色播激情啊| 亚洲国产视频在线| 亚洲日韩欧美一区二区在线|