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

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

?? flash.c

?? 基于 Cortex-M3 (ARM) 內核使用之 uC/OS-II 作業系統,此例程可移植于 Cortex-M3 (ARM)內核的微處理器上的應用,于 Keil MDK 3.15b以上 工程編譯,而
?? C
?? 第 1 頁 / 共 2 頁
字號:
    // Check the argument.
    //
    ASSERT(!(ulAddress & (FLASH_PROTECT_SIZE - 1)));
    ASSERT((eProtect == FlashReadWrite) || (eProtect == FlashReadOnly) ||
           (eProtect == FlashExecuteOnly));

    //
    // Convert the address into a block number.
    //
    ulAddress /= FLASH_PROTECT_SIZE;

    //
    // Get the current protection.
    //
    ulProtectRE = HWREG(FLASH_FMPRE);
    ulProtectPE = HWREG(FLASH_FMPPE);

    //
    // Set the protection based on the requested proection.
    //
    switch(eProtect)
    {
        //
        // Make this block execute only.
        //
        case FlashExecuteOnly:
        {
            //
            // Turn off the read and program bits for this block.
            //
            ulProtectRE &= ~(FLASH_FMP_BLOCK_0 << ulAddress);
            ulProtectPE &= ~(FLASH_FMP_BLOCK_0 << ulAddress);

            //
            // We're done handling this protection.
            //
            break;
        }

        //
        // Make this block read only.
        //
        case FlashReadOnly:
        {
            //
            // The block can not be made read only if it is execute only.
            //
            if(((ulProtectRE >> ulAddress) & FLASH_FMP_BLOCK_0) !=
               FLASH_FMP_BLOCK_0)
            {
                return(-1);
            }

            //
            // Make this block read only.
            //
            ulProtectPE &= ~(FLASH_FMP_BLOCK_0 << ulAddress);

            //
            // We're done handling this protection.
            //
            break;
        }

        //
        // Make this block read/write.
        //
        case FlashReadWrite:
        default:
        {
            //
            // The block can not be made read/write if it is not already
            // read/write.
            //
            if((((ulProtectRE >> ulAddress) & FLASH_FMP_BLOCK_0) !=
                FLASH_FMP_BLOCK_0) ||
               (((ulProtectPE >> ulAddress) & FLASH_FMP_BLOCK_0) !=
                FLASH_FMP_BLOCK_0))
            {
                return(-1);
            }

            //
            // The block is already read/write, so there is nothing to do.
            //
            return(0);
        }
    }

    //
    // Set the new protection.
    //
    HWREG(FLASH_FMPRE) = ulProtectRE;
    HWREG(FLASH_FMPPE) = ulProtectPE;

    //
    // Success.
    //
    return(0);
}

//*****************************************************************************
//
//! Saves the flash protection settings.
//!
//! This function will make the currently programmed flash protection settings
//! permanent.  This is a non-reversible operation; a chip reset or power cycle
//! will not change the flash protection.
//!
//! This function will not return until the protection has been saved.
//!
//! \return Returns 0 on success, or -1 if a hardware error is encountered.
//
//*****************************************************************************
long
FlashProtectSave(void)
{
    //
    // Tell the flash controller to write the flash read protection register.
    //
    HWREG(FLASH_FMA) = 0;
    HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT;

    //
    // Wait until the write has completed.
    //
    while(HWREG(FLASH_FMC) & FLASH_FMC_COMT)
    {
    }

    //
    // Tell the flash controller to write the flash program protection
    // register.
    //
    HWREG(FLASH_FMA) = 1;
    HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT;

    //
    // Wait until the write has completed.
    //
    while(HWREG(FLASH_FMC) & FLASH_FMC_COMT)
    {
    }

    //
    // Success.
    //
    return(0);
}

//*****************************************************************************
//
//! Registers an interrupt.handler for the flash interrupt.
//!
//! \param pfnHandler is a pointer to the function to be called when the flash
//! interrupt occurs.
//!
//! This sets the handler to be called when the flash interrupt occurs.  The
//! flash controller can generate an interrupt when an invalid flash access
//! occurs, such as trying to program or erase a read-only block, or trying to
//! read from an execute-only block.  It can also generate an interrupt when a
//! program or erase operation has completed.  The interrupt will be
//! automatically enabled when the handler is registered.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
void
FlashIntRegister(void (*pfnHandler)(void))
{
    //
    // Register the interrupt.handler, returning an error if an error occurs.
    //
    IntRegister(INT_FLASH, pfnHandler);

    //
    // Enable the flash interrupt.
    //
    IntEnable(INT_FLASH);
}

//*****************************************************************************
//
//! Unregisters the interrupt.handler for the flash interrupt.
//!
//! This function will clear the handler to be called when the flash interrupt
//! occurs.  This will also mask off the interrupt in the interrupt controller
//! so that the interrupt.handler is no longer called.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
void
FlashIntUnregister(void)
{
    //
    // Disable the interrupt.
    //
    IntDisable(INT_FLASH);

    //
    // Unregister the interrupt.handler.
    //
    IntUnregister(INT_FLASH);
}

//*****************************************************************************
//
//! Enables individual flash controller interrupt sources.
//!
//! \param ulIntFlags is a bit mask of the interrupt sources to be enabled.
//! Can be any of the \b FLASH_FCIM_PROGRAM or \b FLASH_FCIM_ACCESS values.
//!
//! Enables the indicated flash controller interrupt sources.  Only the sources
//! that are enabled can be reflected to the processor interrupt; disabled
//! sources have no effect on the processor.
//!
//! \return None.
//
//*****************************************************************************
void
FlashIntEnable(unsigned long ulIntFlags)
{
    //
    // Enable the specified interrupts.
    //
    HWREG(FLASH_FCIM) |= ulIntFlags;
}

//*****************************************************************************
//
//! Disables individual flash controller interrupt sources.
//!
//! \param ulIntFlags is a bit mask of the interrupt sources to be disabled.
//! Can be any of the \b FLASH_FCIM_PROGRAM or \b FLASH_FCIM_ACCESS values.
//!
//! Disables the indicated flash controller interrupt sources.  Only the
//! sources that are enabled can be reflected to the processor interrupt;
//! disabled sources have no effect on the processor.
//!
//! \return None.
//
//*****************************************************************************
void
FlashIntDisable(unsigned long ulIntFlags)
{
    //
    // Disable the specified interrupts.
    //
    HWREG(FLASH_FCIM) &= ~(ulIntFlags);
}

//*****************************************************************************
//
//! Gets the current interrupt status.
//!
//! \param bMasked is false if the raw interrupt status is required and true if
//! the masked interrupt status is required.
//!
//! This returns the interrupt status for the flash controller.  Either the raw
//! interrupt status or the status of interrupts that are allowed to reflect to
//! the processor can be returned.
//!
//! \return The current interrupt status, enumerated as a bit field of
//! \b FLASH_FCMISC_PROGRAM and \b FLASH_FCMISC_ACCESS.
//
//*****************************************************************************
unsigned long
FlashIntGetStatus(tBoolean bMasked)
{
    //
    // Return either the interrupt status or the raw interrupt status as
    // requested.
    //
    if(bMasked)
    {
        return(HWREG(FLASH_FCMISC));
    }
    else
    {
        return(HWREG(FLASH_FCRIS));
    }
}

//*****************************************************************************
//
//! Clears flash controller interrupt sources.
//!
//! \param ulIntFlags is the bit mask of the interrupt sources to be cleared.
//! Can be any of the \b FLASH_FCMISC_PROGRAM or \b FLASH_FCMISC_ACCESS
//! values.
//!
//! The specified flash controller interrupt sources are cleared, so that they
//! no longer assert.  This must be done in the interrupt.handler to keep it
//! from being called again immediately upon exit.
//!
//! \return None.
//
//*****************************************************************************
void
FlashIntClear(unsigned long ulIntFlags)
{
    //
    // Clear the flash interrupt.
    //
    HWREG(FLASH_FCMISC) = ulIntFlags;
}

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区日韩欧美| 精品国产乱码久久久久久蜜臀 | 色成人在线视频| 欧美亚日韩国产aⅴ精品中极品| 91片黄在线观看| 欧美日韩精品三区| 7777精品伊人久久久大香线蕉完整版| 911精品产国品一二三产区| 日韩欧美在线影院| 国产精品夫妻自拍| 午夜精品久久久久久久久久| 日韩成人一区二区| 国产精品一级在线| 欧美人牲a欧美精品| 精品久久人人做人人爰| 亚洲久草在线视频| 久久99国产精品尤物| 色呦呦网站一区| 久久久91精品国产一区二区精品| 亚洲综合色视频| 成人av在线资源网| 国产精品毛片大码女人| 婷婷六月综合亚洲| 日本久久精品电影| 中文字幕亚洲视频| 精品一区二区三区视频| 欧美人妖巨大在线| 亚洲在线成人精品| 成人涩涩免费视频| 国产调教视频一区| 国内偷窥港台综合视频在线播放| 欧美三级电影在线看| 一区二区国产视频| 日本道色综合久久| 亚洲一区中文在线| 色94色欧美sute亚洲线路二| 1000精品久久久久久久久| 丰满少妇在线播放bd日韩电影| 精品久久久久久久久久久久包黑料| 亚洲一区二区三区四区在线观看 | 成人免费av在线| 国产视频不卡一区| 91麻豆精东视频| 亚洲最大的成人av| 51精品秘密在线观看| 麻豆精品久久久| 亚洲一二三区在线观看| 91免费观看视频| 日韩国产欧美视频| 欧美精品一区二区三区蜜桃视频| 国产乱妇无码大片在线观看| 国产网站一区二区| 在线一区二区三区四区五区 | 欧美日韩国产天堂| 久久99国产精品免费网站| 亚洲国产高清不卡| 欧美日韩国产综合草草| 国产一区91精品张津瑜| 亚洲丝袜制服诱惑| 精品国产百合女同互慰| 成人动漫一区二区| 日韩精品亚洲一区| 国产精品二区一区二区aⅴ污介绍| 欧洲色大大久久| 成人一区在线观看| 狠狠色伊人亚洲综合成人| 亚洲精品精品亚洲| 国产精品久久久99| 精品久久五月天| 在线播放/欧美激情| 91视频观看免费| 福利电影一区二区| 国产一区二区三区国产| 免费在线观看一区| 婷婷中文字幕一区三区| 亚洲综合在线第一页| 中文字幕在线观看不卡视频| 久久精品一二三| 精品国产伦一区二区三区观看体验| 欧美日韩国产高清一区| 在线观看三级视频欧美| 91网页版在线| 欧美做爰猛烈大尺度电影无法无天| 国产福利一区二区| 国产91在线看| 91免费看视频| 欧美精品粉嫩高潮一区二区| 欧美日韩精品电影| 日韩欧美国产一二三区| xnxx国产精品| 中文字幕免费不卡在线| 亚洲天堂免费在线观看视频| 亚洲天堂中文字幕| 免费观看在线综合色| 国产露脸91国语对白| av电影在线观看不卡| 欧美日韩国产精品成人| 日韩精品一区二区三区中文精品 | 久久er99精品| av电影天堂一区二区在线观看| 在线免费视频一区二区| 日韩免费高清电影| 国产午夜精品理论片a级大结局| 亚洲欧洲制服丝袜| 九九热在线视频观看这里只有精品| 国产91清纯白嫩初高中在线观看| 91高清视频在线| 国产精品久久久一区麻豆最新章节| 亚洲风情在线资源站| av一区二区不卡| 精品久久久久99| 麻豆专区一区二区三区四区五区| 91久久精品一区二区| 欧美激情在线一区二区三区| 中文字幕视频一区| 欧美aaaaaa午夜精品| av中文字幕在线不卡| 久久综合狠狠综合| 日韩激情av在线| 欧美系列亚洲系列| 亚洲美女精品一区| 不卡av电影在线播放| 久久久夜色精品亚洲| 蜜桃精品视频在线| 欧美精品一级二级三级| 亚洲午夜久久久久久久久电影网| 成人免费视频caoporn| 欧美激情一区三区| 国内久久精品视频| 久久尤物电影视频在线观看| 丝袜脚交一区二区| 日韩三级伦理片妻子的秘密按摩| 亚洲香肠在线观看| 欧美日韩另类一区| 日韩综合在线视频| 精品国产一区二区三区久久影院| 免费av网站大全久久| 日韩欧美国产一区二区三区| 捆绑调教一区二区三区| 91精品国产色综合久久 | 欧美视频在线观看一区| 亚洲国产成人高清精品| 欧美一级一区二区| 亚洲国产精品一区二区www| 91麻豆国产福利在线观看| 日韩av不卡一区二区| 久久九九影视网| 欧美在线观看一区| 看片网站欧美日韩| 亚洲一区在线看| 国产喂奶挤奶一区二区三区| 欧美日韩一级二级| 国产精品77777| 日韩电影一区二区三区四区| 中文字幕欧美三区| 日韩一卡二卡三卡| 欧美日韩国产欧美日美国产精品| 国产自产高清不卡| 日韩高清不卡在线| 亚洲综合男人的天堂| 中文字幕一区二区三中文字幕| 欧美一卡2卡三卡4卡5免费| 欧美色综合影院| 一本到不卡免费一区二区| 国产**成人网毛片九色| 激情亚洲综合在线| 国产在线视频不卡二| 九九久久精品视频| 激情五月婷婷综合网| 寂寞少妇一区二区三区| 久久99久久精品| 国产一区二区三区高清播放| 国内成人精品2018免费看| 99久久综合精品| 在线亚洲一区观看| 欧美乱熟臀69xxxxxx| 欧美精品一二三| 精品国产亚洲在线| 国产女人水真多18毛片18精品视频| 亚洲精品在线三区| 中文字幕一区二区三区色视频| 国产精品二三区| 日韩激情视频网站| 美女视频第一区二区三区免费观看网站| 亚洲第一激情av| 久久国产尿小便嘘嘘尿| 国产成人在线电影| 精品视频在线视频| 久久久99精品久久| 视频一区中文字幕国产| 国产在线看一区| 欧美日韩在线电影| 国产片一区二区三区| 亚洲第一成年网| 成人中文字幕在线| 欧美性生活久久| 成人免费一区二区三区在线观看| 亚洲国产欧美在线人成| 国产91色综合久久免费分享| 欧美精选在线播放|