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

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

?? flash.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 2 頁
字號:
    // 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);
        }
    }

    //
    // For Stellaris Sandstorm-class devices, revision C1 and C2, the upper
    // bits of the FMPPE register are used for JTAG options, and are not
    // available for the FLASH protection scheme.  When setting block
    // protection, ensure that these bits are not altered.
    //
    if(CLASS_IS_SANDSTORM && (REVISION_IS_C1 || REVISION_IS_C2))
    {
        ulProtectRE &= ~(FLASH_FMP_BLOCK_31 | FLASH_FMP_BLOCK_30);
        ulProtectRE |= (HWREG(g_pulFMPRERegs[ulBank]) &
                (FLASH_FMP_BLOCK_31 | FLASH_FMP_BLOCK_30));
    }

    //
    // Set the new protection for the specified flash bank.
    //
    HWREG(g_pulFMPRERegs[ulBank]) = ulProtectRE;
    HWREG(g_pulFMPPERegs[ulBank]) = 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)
{
    int ulTemp, ulLimit;

    //
    // If running on a Sandstorm-class device, only trigger a save of the first
    // two protection registers (FMPRE and FMPPE).  Otherwise, save the
    // entire bank of flash protection registers.
    //
    ulLimit = CLASS_IS_SANDSTORM ? 2 : 8;
    for(ulTemp = 0; ulTemp < ulLimit; ulTemp++)
    {
        //
        // Tell the flash controller to write the flash protection register.
        //
        HWREG(FLASH_FMA) = ulTemp;
        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);
}

//*****************************************************************************
//
//! Gets the user registers.
//!
//! \param pulUser0 is a pointer to the location to store USER Register 0.
//! \param pulUser1 is a pointer to the location to store USER Register 1.
//!
//! This function will read the contents of user registers (0 and 1), and
//! store them in the specified locations.
//!
//! \return Returns 0 on success, or -1 if a hardware error is encountered.
//
//*****************************************************************************
long
FlashUserGet(unsigned long *pulUser0, unsigned long *pulUser1)
{
    //
    // Verify that the pointers are valid.
    //
    ASSERT(pulUser0 != 0);
    ASSERT(pulUser1 != 0);

    //
    // Verify that hardware supports user registers.
    //
    if(CLASS_IS_SANDSTORM)
    {
        return(-1);
    }

    //
    // Get and store the current value of the user registers.
    //
    *pulUser0 = HWREG(FLASH_USERREG0);
    *pulUser1 = HWREG(FLASH_USERREG1);

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

//*****************************************************************************
//
//! Sets the user registers.
//!
//! \param ulUser0 is the value to store in USER Register 0.
//! \param ulUser1 is the value to store in USER Register 1.
//!
//! This function will set the contents of the user registers (0 and 1) to
//! the specified values.
//!
//! \return Returns 0 on success, or -1 if a hardware error is encountered.
//
//*****************************************************************************
long
FlashUserSet(unsigned long ulUser0, unsigned long ulUser1)
{
    //
    // Verify that hardware supports user registers.
    //
    if(CLASS_IS_SANDSTORM)
    {
        return(-1);
    }

    //
    // Save the new values into the user registers.
    //
    HWREG(FLASH_USERREG0) = ulUser0;
    HWREG(FLASH_USERREG1) = ulUser1;

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

//*****************************************************************************
//
//! Saves the user registers.
//!
//! This function will make the currently programmed user register settings
//! permanent.  This is a non-reversible operation; a chip reset or power cycle
//! will not change this setting.
//!
//! 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
FlashUserSave(void)
{
    //
    // Verify that hardware supports user registers.
    //
    if(CLASS_IS_SANDSTORM)
    {
        return(-1);
    }

    //
    // Setting the MSB of FMA will trigger a permanent save of a USER
    // register.  Bit 0 will indicate User 0 (0) or User 1 (1).
    //
    HWREG(FLASH_FMA) = 0x80000000;
    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 USER1 Register.
    //
    HWREG(FLASH_FMA) = 0x80000001;
    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_INT_PROGRAM or \b FLASH_INT_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_INT_PROGRAM or \b FLASH_INT_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_INT_PROGRAM and \b FLASH_INT_ACCESS.
//
//*****************************************************************************
unsigned long
FlashIntStatus(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_INT_PROGRAM or \b FLASH_INT_AMISC 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.
//!
//! \note Since there is a write buffer in the Cortex-M3 processor, it may take
//! several clock cycles before the interrupt source is actually cleared.
//! Therefore, it is recommended that the interrupt source be cleared early in
//! the interrupt handler (as opposed to the very last action) to avoid
//! returning from the interrupt handler before the interrupt source is
//! actually cleared.  Failure to do so may result in the interrupt handler
//! being immediately reentered (since NVIC still sees the interrupt source
//! asserted).
//!
//! \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一区二区三区免费野_久草精品视频
日韩一级免费观看| 欧美精品一卡两卡| 国产综合成人久久大片91| 亚洲sss视频在线视频| 1024成人网| 亚洲欧美激情在线| 亚洲三级小视频| 一区二区在线免费观看| 亚洲欧洲精品一区二区三区| 欧美国产禁国产网站cc| 国产欧美日韩激情| 亚洲视频一区在线观看| 一区二区三区高清不卡| 天天色天天爱天天射综合| 视频一区视频二区中文字幕| 日韩国产成人精品| 国产在线精品一区二区三区不卡| 国产一区二区三区高清播放| 成人黄色电影在线| 色狠狠av一区二区三区| 91精品综合久久久久久| 久久久不卡影院| 亚洲免费看黄网站| 美女在线视频一区| 成人免费视频视频| 欧美午夜精品久久久| 精品国产乱码久久久久久久| **性色生活片久久毛片| 日韩高清不卡一区| 国产白丝网站精品污在线入口| 91免费在线视频观看| 日韩亚洲欧美一区二区三区| 欧美经典一区二区| 偷窥国产亚洲免费视频| 国产成人精品免费| 欧美亚洲免费在线一区| 久久精品网站免费观看| 一区二区三区免费网站| 国产在线不卡视频| 欧美在线高清视频| 久久先锋影音av| 夜夜嗨av一区二区三区| 国产精品一级片| 欧美日韩国产影片| 中文字幕一区二区不卡| 秋霞电影一区二区| 一本色道久久综合狠狠躁的推荐| 欧美一区二区三区色| 日韩一区欧美小说| 国产精选一区二区三区| 欧美顶级少妇做爰| 亚洲免费成人av| 成人免费视频视频在线观看免费 | 国产精品毛片久久久久久| 亚洲国产美女搞黄色| 成人免费视频播放| 久久久久久久国产精品影院| 丝袜美腿亚洲一区二区图片| 色婷婷国产精品综合在线观看| 国产欧美精品一区| 激情偷乱视频一区二区三区| 欧美日韩美少妇| 一区二区三区在线视频观看58 | 亚洲国产精品自拍| 99久久精品一区| 国产精品三级久久久久三级| 精品一区二区日韩| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲成av人**亚洲成av**| 91国产精品成人| 亚洲三级在线播放| 色拍拍在线精品视频8848| 亚洲色欲色欲www| 91在线丨porny丨国产| 中文av一区特黄| 国产精品18久久久久| 久久久精品国产免费观看同学| 久久99精品久久久| 2023国产精品| 国产伦精品一区二区三区在线观看| 日韩欧美中文一区| 国产一区二区伦理片| 久久久久久电影| 成人精品gif动图一区| 中文字幕中文字幕一区| 99久久精品国产网站| 亚洲精品欧美二区三区中文字幕| 色综合天天综合色综合av| 一区二区三区高清| 91麻豆精品国产91久久久使用方法| 日日夜夜精品免费视频| 日韩一二三区视频| 国产不卡在线一区| 亚洲欧洲成人av每日更新| av高清久久久| 亚洲成人av一区| 日韩美女一区二区三区| 国产麻豆9l精品三级站| 亚洲欧美国产高清| 欧美剧情片在线观看| 久久国产精品免费| 国产精品美女www爽爽爽| 91久久精品网| 久久99久久精品欧美| 中文字幕在线视频一区| 欧美高清视频www夜色资源网| 精彩视频一区二区三区| 中文字幕制服丝袜成人av| 9191国产精品| 成人免费高清在线| 日本不卡的三区四区五区| 欧美国产欧美综合| 欧美三级韩国三级日本一级| 国产综合久久久久影院| 亚洲综合在线视频| 久久嫩草精品久久久精品| 日本高清不卡aⅴ免费网站| 免费不卡在线观看| 亚洲三级在线免费观看| 精品久久久久久综合日本欧美| 91在线观看下载| 久久99精品久久久久久国产越南| 自拍偷拍亚洲欧美日韩| 欧美电影免费观看完整版| 一本高清dvd不卡在线观看| 美女视频免费一区| 亚洲曰韩产成在线| 久久九九影视网| 91精品国产黑色紧身裤美女| 91在线看国产| 国产999精品久久| 麻豆91在线播放| 亚州成人在线电影| 亚洲男人都懂的| 国产精品无人区| 久久久久久亚洲综合| 欧美一区二区视频网站| 日本高清免费不卡视频| 波多野结衣亚洲一区| 狠狠色综合日日| 黄色小说综合网站| 欧美aa在线视频| 秋霞国产午夜精品免费视频| 一区二区三区国产精华| 亚洲精品日产精品乱码不卡| 国产精品美女久久久久aⅴ| 欧美国产视频在线| 亚洲国产精品激情在线观看| 26uuu精品一区二区| 精品国产免费人成电影在线观看四季| 欧美日韩电影在线播放| 欧美午夜宅男影院| 色素色在线综合| 日本丶国产丶欧美色综合| 91蜜桃传媒精品久久久一区二区| 国产精品性做久久久久久| 国产精品一卡二| 成人福利视频在线| a美女胸又www黄视频久久| 成人福利视频网站| jlzzjlzz亚洲日本少妇| 99亚偷拍自图区亚洲| 91亚洲国产成人精品一区二区三| 91在线国产观看| 欧美曰成人黄网| 69精品人人人人| 精品欧美一区二区在线观看| 久久综合av免费| 国产精品美女久久久久高潮| 亚洲欧美成人一区二区三区| 亚洲一区二区三区四区在线| 天天亚洲美女在线视频| 国产在线精品不卡| youjizz国产精品| 欧美自拍丝袜亚洲| 欧美高清性hdvideosex| 久久先锋影音av| 国产精品久久久久aaaa樱花| 亚洲欧洲中文日韩久久av乱码| 亚洲主播在线观看| 狠狠久久亚洲欧美| 91在线视频18| 日韩小视频在线观看专区| 久久久www免费人成精品| 亚洲欧洲99久久| 青青草国产精品亚洲专区无| 国产一区二区按摩在线观看| 色婷婷激情一区二区三区| 日韩欧美激情四射| 中文字幕亚洲在| 日本美女一区二区三区| 高清在线观看日韩| 欧美日韩国产高清一区二区三区| 精品久久久久香蕉网| 夜夜嗨av一区二区三区网页| 精品在线观看视频| 色天天综合色天天久久| 国产午夜精品在线观看| 亚洲成av人片一区二区三区| 成人午夜私人影院|