亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
久久精品视频一区| 欧美国产1区2区| 日韩欧美国产一区在线观看| 色伊人久久综合中文字幕| 美女在线一区二区| 免费成人小视频| 久久se这里有精品| 精品系列免费在线观看| 国产九九视频一区二区三区| 成人永久aaa| 91精品国产一区二区人妖| 日韩欧美另类在线| 欧美精品自拍偷拍动漫精品| 日韩欧美久久久| 国产午夜久久久久| 亚洲另类春色校园小说| 日韩成人一级大片| 丁香六月综合激情| 91成人免费电影| 精品播放一区二区| 亚洲一区二区三区在线| 青青青伊人色综合久久| 99天天综合性| 久久影院午夜论| 午夜影院久久久| 粉嫩av一区二区三区在线播放| 欧美体内she精高潮| 国产偷国产偷亚洲高清人白洁| 一区二区三区 在线观看视频| 免费的国产精品| 欧美日韩在线播放一区| 自拍偷拍国产精品| 色综合婷婷久久| 国产精品久久久久aaaa| 捆绑调教一区二区三区| 欧美日韩亚洲综合一区| 亚洲黄色在线视频| 色综合久久久久久久久久久| 亚洲国产精品av| 国产精品99久| 亚洲视频一区在线观看| av中文字幕亚洲| 亚洲免费成人av| 精品少妇一区二区三区日产乱码| 亚洲人成网站精品片在线观看| 成人国产精品免费观看视频| 一区二区三区在线观看网站| 色菇凉天天综合网| 蜜桃久久久久久| 国产亚洲va综合人人澡精品| 99精品欧美一区二区蜜桃免费| 中文字幕中文字幕在线一区| 成人黄色777网| 午夜精品免费在线| 中文子幕无线码一区tr| 欧美综合久久久| 国产精品自拍在线| 亚洲一卡二卡三卡四卡| 欧美经典三级视频一区二区三区| 99麻豆久久久国产精品免费优播| 国产白丝精品91爽爽久久| 一区二区三区毛片| 国产女人18毛片水真多成人如厕 | 亚洲欧美日韩国产另类专区| 欧美日韩www| 亚洲免费在线观看视频| 欧美三级电影在线观看| 精品一区二区久久| 日韩电影一区二区三区| 亚洲女同一区二区| 国产喂奶挤奶一区二区三区| 欧美一区二区三区小说| 97久久超碰精品国产| 国产精品一区二区久久不卡 | 久久不见久久见免费视频7| 国产精品免费av| 中文在线免费一区三区高中清不卡| 欧洲av一区二区嗯嗯嗯啊| 99热精品一区二区| 欧美中文字幕不卡| 欧美高清激情brazzers| 日韩精品一级中文字幕精品视频免费观看 | 亚洲自拍偷拍网站| 日日摸夜夜添夜夜添精品视频| 午夜精品久久久久久久蜜桃app| 亚洲精品国产a久久久久久| 国产精品麻豆网站| 中文字幕日韩av资源站| 国产精品福利av| 亚洲成人综合在线| 国产一区二区精品久久91| 成年人国产精品| 一本到不卡免费一区二区| 在线精品视频免费观看| 91精品国产综合久久蜜臀| 精品美女一区二区| 欧美高清在线一区二区| 亚洲精选视频免费看| 美女网站视频久久| 日韩一级在线观看| 一级精品视频在线观看宜春院| 蜜桃av一区二区三区电影| 99视频有精品| 国产偷v国产偷v亚洲高清| 日本sm残虐另类| 精品欧美乱码久久久久久1区2区| 亚洲手机成人高清视频| 日韩成人免费电影| 欧美日韩国产综合一区二区 | 日本一区二区三区视频视频| 亚洲欧洲制服丝袜| 国产jizzjizz一区二区| 欧美刺激午夜性久久久久久久 | 青青草原综合久久大伊人精品优势| 国产成人aaa| 国产午夜精品一区二区三区视频| 国精品**一区二区三区在线蜜桃| 这里只有精品视频在线观看| 午夜精品久久一牛影视| 日韩欧美自拍偷拍| 精品午夜久久福利影院| 国产精品久久久久四虎| 91豆麻精品91久久久久久| 亚洲午夜成aⅴ人片| 制服视频三区第一页精品| 日韩电影免费在线看| 国产欧美一区视频| 成人性视频免费网站| 日韩va亚洲va欧美va久久| 欧美国产日韩在线观看| av爱爱亚洲一区| 激情成人午夜视频| 亚洲一区二区三区四区五区黄 | 成人午夜视频网站| 日韩成人免费在线| 国产日本欧美一区二区| 激情文学综合丁香| 日韩三级视频中文字幕| 久久国产精品99久久久久久老狼| 亚洲人xxxx| 日韩欧美国产高清| 蜜臀久久99精品久久久久宅男| 在线免费观看成人短视频| 亚洲精品水蜜桃| 99久免费精品视频在线观看 | 中文子幕无线码一区tr| 亚洲综合色视频| 91精品婷婷国产综合久久竹菊| 日本亚洲三级在线| 国产亚洲一二三区| 在线综合视频播放| 成人免费毛片aaaaa**| 日本美女一区二区三区视频| 日本韩国欧美在线| 寂寞少妇一区二区三区| 婷婷一区二区三区| 亚洲综合偷拍欧美一区色| 三级一区在线视频先锋| 精品久久人人做人人爱| 在线这里只有精品| 麻豆成人在线观看| 亚洲国产综合在线| 日韩电影在线看| 激情六月婷婷久久| 亚洲18色成人| 亚洲午夜视频在线| 日韩电影一二三区| 国产精选一区二区三区| 91亚洲国产成人精品一区二三| 中文字幕一区二区不卡| 亚洲四区在线观看| 日本乱人伦一区| 欧美日韩大陆一区二区| 亚洲色图在线播放| 奇米影视一区二区三区小说| 亚洲国产一区二区视频| 亚洲自拍欧美精品| 蜜桃视频一区二区三区| 一二三四社区欧美黄| 国产一区二区三区香蕉| 悠悠色在线精品| 久久99这里只有精品| 国产成人免费9x9x人网站视频| 国产一区二区三区在线观看精品| 日韩一卡二卡三卡| 欧美精品一区二区不卡| 欧美日韩精品欧美日韩精品一综合| 久久精品男人天堂av| 亚洲国产成人精品视频| 蜜桃av一区二区三区| 欧美日韩国产美女| 亚洲国产综合色| 国产精品亚洲一区二区三区妖精 | 亚洲免费观看高清| 国产福利视频一区二区三区| 91在线porny国产在线看| 欧美亚洲一区二区在线| 欧美午夜在线观看| 综合久久国产九一剧情麻豆| 蜜臂av日日欢夜夜爽一区|