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

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

?? extflash.c

?? 基于TI公司Cortex-M3的uart超級通信開發
?? C
?? 第 1 頁 / 共 2 頁
字號:
//! \param pbError is storage for the returned error indicator.
//!
//! This function determines whether the last flash erase operation has
//! completed.  The address passed in parameter \e ulAddress must correspond to
//! an address in the region which was last erased.  When the operation
//! completes, \b true is returned and the caller should check the value of
//! \e *pbError to determine whether or not the operation was successful. If
//! \e *pbError is \b true, an error was reported by the device and the flash
//! may not have been correctly erased.  If \e *pbError is \b false, the
//! operation completed successfully.
//!
//! It is assumed that the EPI configuration has previously been set correctly
//! using a call to PinoutSet().
//!
//! \return Returns \b true if the erase operation completed or \b false if it
//! is still ongoing.
//
//*****************************************************************************
tBoolean
ExtFlashEraseIsComplete(unsigned long ulAddress, tBoolean *pbError)
{
    //
    // If reading the location returns 0xFF, the erase must be complete.
    //
    if(HWREGB(ulAddress) == 0xFF)
    {
        *pbError = false;
        return(true);
    }
    else
    {
        //
        // The erase is not complete so we look at the value read to determine
        // whether an error occurred or not.
        //
        if(HWREGB(ulAddress) & FLASH_STATUS_ERROR)
        {
            //
            // An error seems to have been reported. Check once more as
            // indicated in the datasheet.
            if(HWREGB(ulAddress) == 0xFF)
            {
                //
                // False alarm - tell the caller the operation completed.
                //
                *pbError = false;
                return(true);
            }
            else
            {
                //
                // Looks as if the error was real so issue a Read/Reset to get
                // the chip back into read mode and clear the error condition.
                // then report the failure to the caller.
                //
                HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
                HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
                HWREGB(EXT_FLASH_BASE) = 0xF0;

                *pbError = true;
            }
        }
        else
        {
            *pbError = false;
        }

        //
        // If an error occurred, we return true so that any polling loop will
        // exit.  If no error occurred, the operation is not complete so we
        // return false.
        //
        return(*pbError);
    }
}

//*****************************************************************************
//
//! Erases a single block of the flash device.
//!
//! \param ulAddress is an address within the block to be erased.
//! \param bSync indicates whether to return immediately or poll until the
//! erase operation has completed.
//!
//! This function erases a single block of the flash device.  The block erased
//! is identified by parameter \e ulAddress.  If this is not a block start
//! address, the block containing \e ulAddress is erased.  Applications may
//! call ExtFlashBlockSizeGet() to determine the size and start address of
//! the block containing a particular flash address.
//!
//! If called with \e bAsync set to \b false, the function will poll until the
//! erase operation completes and only return at this point. If, however, \e
//! bAsync is \b true, the function will return immediately and the caller can
//! determine when the erase operation completes by polling function
//! ExtFlashEraseIsComplete(), passing it the same \e ulAddress parameter as
//! was passed to this function.
//!
//! It is assumed that the EPI configuration has previously been set correctly
//! using a call to PinoutSet().
//!
//! \note A block erase will typically take 0.8 seconds to complete and may
//! take up to 6 seconds in the worst case.
//!
//! \return Returns \b true to indicate success or \b false to indicate that
//! an error occurred.
//
//*****************************************************************************
tBoolean
ExtFlashBlockErase(unsigned long ulAddress, tBoolean bSync)
{
    tBoolean bError;

    //
    // Issue the command sequence to erase the block.
    //
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0x80;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(ulAddress) = 0x30;

    //
    // Have we been asked to block until the operation completes?
    //
    if(bSync)
    {
        //
        // We've been asked to wait.  Poll the status until we are told the
        // erase completed.
        //
        while(!ExtFlashEraseIsComplete(ulAddress, &bError))
        {
            //
            // Keep waiting...
            //
        }

        //
        // Return true if no error was reported in the erase operation.
        //
        return(!bError);
    }

    //
    // If we get this far, either we started the erase operation and are
    // returning immediately because bSync is true or the operation completed
    // successfully.
    //
    return(true);
}

//*****************************************************************************
//
//! Erases the entire flash device.
//!
//! \param bSync indicates whether to return immediately or poll until the
//! erase operation has completed.
//!
//! This function erases the entire flash device.  If called with \e bAsync set
//! to \b false, the function will poll until the erase operation completes and
//! only return at this point. If, however, \e bAsync is \b true, the function
//! will return immediately and the caller can determine when the erase
//! operation completes by polling function ExtFlashEraseIsComplete(), passing
//! \e EXT_FLASH_BASE as the \e ulAddress parameter.
//!
//! It is assumed that the EPI configuration has previously been set correctly
//! using a call to PinoutSet().
//!
//! \note A chip erase will typically take 80 seconds to complete and may
//! take up to 400 seconds in the worst case.
//!
//! \return Returns \b true to indicate success or \b false to indicate that
//! an error occurred.
//
//*****************************************************************************
tBoolean
ExtFlashChipErase(tBoolean bSync)
{
    tBoolean bError;

    //
    // Issue the command sequence to erase the entire chip.
    //
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0x80;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0x10;

    //
    // Have we been asked to block until the operation completes?
    //
    if(bSync)
    {
        //
        // We've been asked to wait.  Poll the status until we are told the
        // erase completed.
        //
        while(!ExtFlashEraseIsComplete(EXT_FLASH_BASE, &bError))
        {
            //
            // Keep waiting...
            //
        }

        //
        // Return true if no error was reported in the erase operation.
        //
        return(!bError);
    }

    //
    // If we get this far, either we started the erase operation and are
    // returning immediately because bSync is true or the operation completed
    // successfully.
    //
    return(true);
}

//*****************************************************************************
//
//! Writes data to the flash device.
//!
//! \param ulAddress is the address that the data is to be written to.
//! \param ulLength is the number of bytes of data to write.
//! \param pucSrc points to the first byte of data to write.
//!
//! This function writes data to the flash device.  Callers must ensure that
//! the are of flash being written has previously been erased or, at least,
//! that writing the data will not require any bits which are already stored
//! as 0s in the flash to revert to 1s.  The function returns either when an
//! error is detected or all data has been successfully written to the device.
//!
//! It is assumed that the EPI configuration has previously been set correctly
//! using a call to PinoutSet().
//!
//! \note Programming data may take as long as 200 microseconds per byte.
//!
//! \return Returns the number of bytes successfully written.
//
//*****************************************************************************
unsigned long
ExtFlashWrite(unsigned long ulAddress, unsigned long ulLength,
              unsigned char *pucSrc)
{
    unsigned long ulLoop;

    //
    // Program each byte in turn.
    //
    for(ulLoop = 0; ulLoop < ulLength; ulLoop++)
    {
        //
        // Send the command to program this byte.
        //
        HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
        HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
        HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xA0;
        HWREGB(ulAddress) = *pucSrc;

        //
        // Wait for this byte to be programmed.
        //
        while(1)
        {
            if(HWREGB(ulAddress) == *pucSrc)
            {
                //
                // The flash reads back the same data we wrote to it so this
                // write operation has completed.
                //
                break;
            }
            else
            {
                //
                // The operation has not completed. Is an error reported?
                //
                if(HWREGB(ulAddress) & FLASH_STATUS_ERROR)
                {
                    //
                    // The error bit appears to be set but this may just be
                    // because the operation just completed. Check the location
                    // once more to be sure.
                    //
                    if(HWREGB(ulAddress) == *pucSrc)
                    {
                        //
                        // Yes - it completed.  Move on to the next byte.
                        //
                        break;
                    }
                    else
                    {
                        //
                        // An error was reported.  We clear the error and return
                        // early telling the caller how many bytes we actually
                        // programmed.
                        //
                        HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
                        HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
                        HWREGB(EXT_FLASH_BASE) = 0xF0;

                        return(ulLoop);
                    }
                }
            }
        }
        //
        // Move on to the next location.
        //
        ulAddress++;
        pucSrc++;

    }

    //
    // If we get here, we successfully programmed everything we were given.
    //
    return(ulLength);
}

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品婷婷国产综合久久| 中文字幕一区二区三区av| 久久久久久亚洲综合| 亚洲免费观看视频| 久久成人精品无人区| av成人免费在线观看| 日韩精品一区二区三区四区视频| 中文字幕一区免费在线观看| 蜜臀av性久久久久av蜜臀妖精| av不卡免费在线观看| 久久综合丝袜日本网| 午夜精品爽啪视频| 日本精品免费观看高清观看| 久久久久久夜精品精品免费| 日韩国产成人精品| 在线免费一区三区| 国产精品成人免费| 国产中文字幕精品| 精品奇米国产一区二区三区| 亚洲成a人片在线不卡一二三区| 成人精品鲁一区一区二区| 日韩一区二区精品在线观看| 亚洲国产视频一区二区| 99re视频这里只有精品| 亚洲国产精品ⅴa在线观看| 极品尤物av久久免费看| 日韩欧美视频一区| 蜜桃av一区二区在线观看| 欧美婷婷六月丁香综合色| 亚洲欧洲成人av每日更新| 国产91精品一区二区麻豆网站| 欧美电影免费观看高清完整版在线 | 色吊一区二区三区| 国产精品久久久久桃色tv| 国产精品资源站在线| 欧美精品一区二区三区很污很色的 | 日本二三区不卡| 欧美国产成人在线| 懂色av一区二区三区蜜臀| 2022国产精品视频| 精品中文av资源站在线观看| 日韩三区在线观看| 久久99在线观看| 久久久久久久久久美女| 国产精品自拍在线| 中文字幕在线不卡一区二区三区| 99精品国产99久久久久久白柏| 欧美国产成人精品| 色天使久久综合网天天| 亚洲h在线观看| 日韩精品一区二区三区四区视频| 久久精品国产精品亚洲综合| 久久夜色精品一区| 成人理论电影网| 亚洲综合区在线| 欧美天天综合网| 久久aⅴ国产欧美74aaa| 国产日韩欧美制服另类| 成人高清免费观看| 性欧美大战久久久久久久久| 欧美一区二区在线观看| 国产传媒久久文化传媒| 亚洲色图制服丝袜| 欧美精品xxxxbbbb| 懂色av中文一区二区三区| 国产精品卡一卡二卡三| 欧美影院午夜播放| 日本aⅴ亚洲精品中文乱码| 久久免费电影网| 色婷婷综合久久久久中文| 日韩中文字幕亚洲一区二区va在线| 欧美一区日本一区韩国一区| 成人综合婷婷国产精品久久免费| 亚洲精品第1页| 日韩视频在线观看一区二区| 成人免费看视频| 三级久久三级久久久| 国产清纯白嫩初高生在线观看91 | 中文字幕一区二区三区乱码在线| 欧美色视频在线| 韩国av一区二区三区| 伊人夜夜躁av伊人久久| 欧美videossexotv100| 色综合夜色一区| 精品一区二区成人精品| 伊人色综合久久天天| 久久综合精品国产一区二区三区| 91网页版在线| 国产很黄免费观看久久| 午夜视频在线观看一区| 国产精品美女久久久久aⅴ| 欧美日韩的一区二区| 成人午夜免费视频| 日本一不卡视频| 亚洲一线二线三线视频| 国产午夜亚洲精品午夜鲁丝片| 制服丝袜激情欧洲亚洲| 91偷拍与自偷拍精品| 国产精品一区二区不卡| 日韩精品亚洲一区二区三区免费| 国产精品电影院| 亚洲精品一区二区三区影院| 欧美日韩一区二区在线观看视频 | 日本va欧美va欧美va精品| 亚洲图片另类小说| 国产精品视频九色porn| 久久你懂得1024| 亚洲精品一线二线三线无人区| 欧美精品九九99久久| 欧美天天综合网| 欧美伊人久久久久久午夜久久久久| 国产成人欧美日韩在线电影| 久久99久久99小草精品免视看| 亚洲成av人在线观看| 亚洲精品成人少妇| 一区二区三区在线影院| 亚洲人成精品久久久久| 中文字幕一区不卡| 国产精品嫩草影院av蜜臀| 久久久99精品免费观看| 久久香蕉国产线看观看99| 欧美精品一区视频| 久久久久久久久久久黄色| 久久久激情视频| 国产欧美精品区一区二区三区| 亚洲精品一区二区三区香蕉| 久久综合精品国产一区二区三区| 精品成人一区二区三区四区| 精品国产一区二区三区av性色 | 色综合中文字幕国产 | 99久久免费精品高清特色大片| 国产**成人网毛片九色| 盗摄精品av一区二区三区| 国产成人超碰人人澡人人澡| 成人动漫一区二区三区| 99久久伊人久久99| 在线免费不卡电影| 欧美日韩www| 欧美大片拔萝卜| 久久久久九九视频| 中文字幕日韩一区| 亚洲第一电影网| 免费高清成人在线| 国产91高潮流白浆在线麻豆| 不卡视频一二三四| 91豆麻精品91久久久久久| 欧美日韩精品电影| 日韩写真欧美这视频| 国产人成亚洲第一网站在线播放| 国产精品电影一区二区| 亚洲国产综合在线| 韩国成人在线视频| 色婷婷久久一区二区三区麻豆| 欧美久久婷婷综合色| 久久中文娱乐网| 亚洲男人的天堂在线观看| 日韩精品成人一区二区三区| 国产精品系列在线观看| 欧美三区在线观看| 久久精品免视看| 午夜电影久久久| 成熟亚洲日本毛茸茸凸凹| 欧美日韩和欧美的一区二区| 精品国产乱码久久| 亚洲图片一区二区| 国产激情一区二区三区桃花岛亚洲| 91久久精品国产91性色tv| 日韩一级免费一区| 亚洲免费伊人电影| 国产麻豆精品theporn| 欧美日韩精品三区| 国产精品午夜电影| 美女一区二区视频| 欧美性色黄大片手机版| 国产精品高潮呻吟| 国产呦精品一区二区三区网站| 欧美调教femdomvk| 中文字幕一区二区三区四区 | 日韩欧美一区二区三区在线| 国产精品网站在线观看| 日本不卡1234视频| 欧美视频一区二区三区四区| 中文字幕不卡在线观看| 麻豆91在线播放| 欧美午夜理伦三级在线观看| 国产精品久久久久久久久免费相片| 免费人成网站在线观看欧美高清| 99久久99久久免费精品蜜臀| 久久久精品黄色| 久久99精品一区二区三区| 欧美性猛交xxxx乱大交退制版| 国产精品久久久久久久久图文区 | 久久久久九九视频| 免费成人性网站| 91精品国产福利| 同产精品九九九| 欧美精品粉嫩高潮一区二区| 亚洲福利视频一区| 欧美午夜视频网站| 日韩精品午夜视频|