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

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

?? flash.c

?? 基于 Cortex-M3 (ARM) 內(nèi)核使用之 uC/OS-II 作業(yè)系統(tǒng),此例程可移植于 Cortex-M3 (ARM)內(nèi)核的微處理器上的應用,于 Keil MDK 3.15b以上 工程編譯,而
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// flash.c - Driver for programming the on-chip flash.
//
// Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
//
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's Stellaris Family of microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  Any use in violation
// of the foregoing restrictions may subject the user to criminal sanctions
// under applicable laws, as well as to civil liability for the breach of the
// terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 852 of the Stellaris Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup flash_api
//! @{
//
//*****************************************************************************

#include "hw_flash.h"
#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_sysctl.h"
#include "hw_types.h"
#include "debug.h"
#include "flash.h"
#include "interrupt.h"

//*****************************************************************************
//
//! Gets the number of processor clocks per micro-second.
//!
//! This function returns the number of clocks per micro-second, as presently
//! known by the flash controller.
//!
//! \return Returns the number of processor clocks per micro-second.
//
//*****************************************************************************
unsigned long
FlashUsecGet(void)
{
    //
    // Return the number of clocks per micro-second.
    //
    return(HWREG(FLASH_USECRL) + 1);
}

//*****************************************************************************
//
//! Sets the number of processor clocks per micro-second.
//!
//! \param ulClocks is the number of processor clocks per micro-second.
//!
//! This function is used to tell the flash controller the number of processor
//! clocks per micro-second.  This value must be programmed correctly or the
//! flash most likely will not program correctly; it has no affect on reading
//! flash.
//!
//! \return None.
//
//*****************************************************************************
void
FlashUsecSet(unsigned long ulClocks)
{
    //
    // Set the number of clocks per micro-second.
    //
    HWREG(FLASH_USECRL) = ulClocks - 1;
}

//*****************************************************************************
//
//! Erases a block of flash.
//!
//! \param ulAddress is the start address of the flash block to be erased.
//!
//! This function will erase a 1 kB block of the on-chip flash.  After erasing,
//! the block will be filled with 0xFF bytes.  Read-only and execute-only
//! blocks cannot be erased.
//!
//! This function will not return until the block has been erased.
//!
//! \return Returns 0 on success, or -1 if an invalid block address was
//! specified or the block is write-protected.
//
//*****************************************************************************
long
FlashErase(unsigned long ulAddress)
{
    //
    // Check the arguments.
    //
    ASSERT(!(ulAddress & (FLASH_ERASE_SIZE - 1)));

    //
    // Clear the flash access interrupt.
    //
    HWREG(FLASH_FCMISC) = FLASH_FCMISC_ACCESS;

    //
    // Erase the block.
    //
    HWREG(FLASH_FMA) = ulAddress;
    HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_ERASE;

    //
    // Wait until the word has been programmed.
    //
    while(HWREG(FLASH_FMC) & FLASH_FMC_ERASE)
    {
    }

    //
    // Return an error if an access violation occurred.
    //
    if(HWREG(FLASH_FCRIS) & FLASH_FCRIS_ACCESS)
    {
        return(-1);
    }

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

//*****************************************************************************
//
//! Programs flash.
//!
//! \param pulData is a pointer to the data to be programmed.
//! \param ulAddress is the starting address in flash to be programmed.  Must
//! be a multiple of four.
//! \param ulCount is the number of bytes to be programmed.  Must be a multiple
//! of four.
//!
//! This function will program a sequence of words into the on-chip flash.
//! Programming each location consists of the result of an AND operation
//! of the new data and the existing data; in other words bits that contain
//! 1 can remain 1 or be changed to 0, but bits that are 0 cannot be changed
//! to 1.  Therefore, a word can be programmed multiple times as long as these
//! rules are followed; if a program operation attempts to change a 0 bit to
//! a 1 bit, that bit will not have its value changed.
//!
//! Since the flash is programmed one word at a time, the starting address and
//! byte count must both be multiples of four.  It is up to the caller to
//! verify the programmed contents, if such verification is required.
//!
//! This function will not return until the data has been programmed.
//!
//! \return Returns 0 on success, or -1 if a programming error is encountered.
//
//*****************************************************************************
long
FlashProgram(unsigned long *pulData, unsigned long ulAddress,
             unsigned long ulCount)
{
    //
    // Check the arguments.
    //
    ASSERT(!(ulAddress & 3));
    ASSERT(!(ulCount & 3));

    //
    // Clear the flash access interrupt.
    //
    HWREG(FLASH_FCMISC) = FLASH_FCMISC_ACCESS;

    //
    // Loop over the words to be programmed.
    //
    while(ulCount)
    {
        //
        // Program the next word.
        //
        HWREG(FLASH_FMA) = ulAddress;
        HWREG(FLASH_FMD) = *pulData;
        HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_WRITE;

        //
        // Wait until the word has been programmed.
        //
        while(HWREG(FLASH_FMC) & FLASH_FMC_WRITE)
        {
        }

        //
        // Increment to the next word.
        //
        pulData++;
        ulAddress += 4;
        ulCount -= 4;
    }

    //
    // Return an error if an access violation occurred.
    //
    if(HWREG(FLASH_FCRIS) & FLASH_FCRIS_ACCESS)
    {
        return(-1);
    }

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

//*****************************************************************************
//
//! Gets the protection setting for a block of flash.
//!
//! \param ulAddress is the start address of the flash block to be queried.
//!
//! This function will get the current protection for the specified 2 kB block
//! of flash.  Each block can be read/write, read-only, or execute-only.
//! Read/write blocks can be read, executed, erased, and programmed.  Read-only
//! blocks can be read and executed.  Execute-only blocks can only be executed;
//! processor and debugger data reads are not allowed.
//!
//! \return Returns the protection setting for this block.  See
//! FlashProtectSet() for possible values.
//
//*****************************************************************************
tFlashProtection
FlashProtectGet(unsigned long ulAddress)
{
    unsigned long ulFMPRE, ulFMPPE;

    //
    // Check the argument.
    //
    ASSERT(!(ulAddress & (FLASH_PROTECT_SIZE - 1)));

    //
    // Read the flash protection register and get the bits that apply to the
    // specified block.
    //
    ulFMPRE = HWREG(FLASH_FMPRE);
    ulFMPPE = HWREG(FLASH_FMPPE);
    switch((((ulFMPRE >> (ulAddress / FLASH_PROTECT_SIZE)) &
             FLASH_FMP_BLOCK_0) << 1) |
           ((ulFMPPE >> (ulAddress / FLASH_PROTECT_SIZE)) & FLASH_FMP_BLOCK_0))
    {
        //
        // This block is marked as execute only (i.e. it can not be erased or
        // programmed, and the only reads allowed are via the instruction fecth
        // interface).
        //
        case 0:
        case 1:
        {
            return(FlashExecuteOnly);
        }

        //
        // This block is marked as read only (i.e. it can not be erased or
        // programmed).
        //
        case 2:
        {
            return(FlashReadOnly);
        }

        //
        // This block is read/write; it can be read, erased, and programmed.
        //
        case 3:
        default:
        {
            return(FlashReadWrite);
        }
    }
}

//*****************************************************************************
//
//! Sets the protection setting for a block of flash.
//!
//! \param ulAddress is the start address of the flash block to be protected.
//! \param eProtect is the protection to be applied to the block.  Can be one
//! of \b FlashReadWrite, \b FlashReadOnly, or \b FlashExecuteOnly.
//!
//! This function will set the protection for the specified 2 kB block of
//! flash.  Blocks which are read/write can be made read-only or execute-only.
//! Blocks which are read-only can be made execute-only.  Blocks which are
//! execute-only cannot have their protection modified.  Attempts to make the
//! block protection less stringent (i.e. read-only to read/write) will result
//! in a failure (and be prevented by the hardware).
//!
//! Changes to the flash protection are maintained only until the next reset.
//! This allows the application to be executed in the desired flash protection
//! environment to check for inappropriate flash access (via the flash
//! interrupt).  To make the flash protection permanent, use the
//! FlashProtectSave() function.
//!
//! \return Returns 0 on success, or -1 if an invalid address or an invalid
//! protection was specified.
//
//*****************************************************************************
long
FlashProtectSet(unsigned long ulAddress, tFlashProtection eProtect)
{
    unsigned long ulProtectRE, ulProtectPE;

    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜激情在线| 91丨porny丨户外露出| 国产精品系列在线观看| 欧美日韩久久一区二区| 成人激情小说乱人伦| 久久99精品一区二区三区三区| 亚洲五月六月丁香激情| 亚洲激情成人在线| 亚洲色图视频网| 亚洲色大成网站www久久九九| 极品瑜伽女神91| 色视频欧美一区二区三区| 99久久免费精品| 一本一道久久a久久精品综合蜜臀| 欧美一区二区三区视频在线 | 91蝌蚪porny| 国产网站一区二区| 国产成人av电影在线观看| 国产精品国产自产拍高清av| 一区二区久久久久| 一区二区三区四区激情| 国产成人一区在线| 久久久久久一级片| 国产肉丝袜一区二区| 国产亚洲成aⅴ人片在线观看| 午夜婷婷国产麻豆精品| 依依成人综合视频| 99久久婷婷国产精品综合| 国产欧美日韩麻豆91| 国产成人av福利| 国产亚洲欧美日韩日本| 精品在线观看视频| 久久亚洲一区二区三区明星换脸 | 成人在线一区二区三区| 欧美国产一区二区| 一区二区三区四区中文字幕| 成人黄色小视频在线观看| 国产午夜亚洲精品羞羞网站| 国产夫妻精品视频| 亚洲欧洲日产国码二区| 午夜欧美视频在线观看| 欧美日韩一区三区四区| 欧美国产精品劲爆| 精品国精品国产| 亚洲女同ⅹxx女同tv| 久久精品国产精品青草| 91精品91久久久中77777| 久久综合九色综合97_久久久| 国产制服丝袜一区| 欧美日韩精品欧美日韩精品一综合| 亚洲综合色网站| 国产高清无密码一区二区三区| 久久久久久久久伊人| 成人黄色小视频| 亚洲午夜久久久久久久久久久| 欧美顶级少妇做爰| 国产精品久久久久影院亚瑟| 欧美喷潮久久久xxxxx| 日本亚洲天堂网| caoporn国产精品| 日韩欧美自拍偷拍| 一区二区三区免费在线观看| 91麻豆精品国产综合久久久久久| 日韩毛片高清在线播放| 欧美日本国产视频| 国产成人鲁色资源国产91色综| 亚洲免费观看视频| 精品剧情v国产在线观看在线| 亚洲bt欧美bt精品777| 色8久久精品久久久久久蜜| 日日摸夜夜添夜夜添国产精品| 日韩美女一区二区三区| 午夜精品一区在线观看| 精品国产三级a在线观看| 99久久精品免费看国产| 麻豆freexxxx性91精品| 欧美精品一区二区久久久| 99免费精品在线观看| 免费看欧美女人艹b| 日韩一区二区在线看| 国产69精品久久99不卡| 日韩精品欧美精品| 亚洲欧洲精品一区二区精品久久久| 91精品欧美一区二区三区综合在| 99re热视频这里只精品| 国产在线精品一区在线观看麻豆| 日韩综合在线视频| 亚洲精品乱码久久久久久黑人 | 喷水一区二区三区| 亚洲靠逼com| 国产精品网曝门| 91黄视频在线| 国产成人在线看| 狠狠色狠狠色综合日日91app| 亚洲国产精品久久一线不卡| 国产精品国产三级国产专播品爱网| 精品久久久久久久久久久院品网 | 国产精品传媒在线| 精品国产不卡一区二区三区| 欧美理论电影在线| 欧美揉bbbbb揉bbbbb| 91小视频免费观看| 成人永久免费视频| 丰满放荡岳乱妇91ww| 国产伦精品一区二区三区视频青涩| 久久久久久久久久电影| 日韩一区二区三区在线| 国产精品高潮久久久久无| 欧美男男青年gay1069videost | 欧美性色黄大片手机版| 久久久久亚洲综合| 亚洲精品一区二区三区99| 69av一区二区三区| 欧美色爱综合网| 91国产精品成人| 色八戒一区二区三区| 在线日韩一区二区| 国产伦精品一区二区三区在线观看 | 91年精品国产| 99在线精品免费| 99久久精品一区二区| 色综合久久久久综合体| 在线看日韩精品电影| 欧美精品一区二| 久久中文娱乐网| 91精品国产91久久综合桃花 | 日韩精品电影在线观看| 亚洲成a人片综合在线| 偷窥少妇高潮呻吟av久久免费| 午夜私人影院久久久久| 美女爽到高潮91| 黄色小说综合网站| 成人免费黄色大片| 色综合天天综合色综合av| 日本三级亚洲精品| 久久国产尿小便嘘嘘尿| 欧美日本视频在线| 欧美成人伊人久久综合网| 久久亚洲精华国产精华液| 国产精品三级久久久久三级| 亚洲美女偷拍久久| 免费在线观看日韩欧美| 国产成人精品一区二| 欧洲中文字幕精品| 欧美精品一区二区三区在线| 亚洲视频一区二区在线| 日本不卡在线视频| 丁香另类激情小说| 欧美视频一区二区三区四区 | 亚洲欧美日韩电影| 欧美午夜电影一区| 91精品国产综合久久蜜臀| 精品99久久久久久| 最新日韩在线视频| 日韩影院精彩在线| av资源网一区| 91精品国产一区二区三区蜜臀| 久久久亚洲精品石原莉奈| 亚洲综合在线免费观看| 美女网站一区二区| 91小视频免费观看| 久久综合色综合88| 午夜视频久久久久久| 丁香六月综合激情| 精品黑人一区二区三区久久 | 精品福利一二区| 亚洲视频一区二区在线| 美女一区二区三区| 欧美无乱码久久久免费午夜一区| 欧美videossexotv100| 亚洲精品国产高清久久伦理二区| 成人爱爱电影网址| 亚洲成在线观看| 91精品国产高清一区二区三区| 国产传媒日韩欧美成人| 欧美理论片在线| 一区二区日韩av| 国产xxx精品视频大全| 日韩一级片网址| 五月天激情综合网| 91黄色小视频| 亚洲日本中文字幕区| 成人一区二区在线观看| 欧美videos中文字幕| 蜜桃视频第一区免费观看| 在线不卡中文字幕播放| 一区二区激情小说| 在线亚洲+欧美+日本专区| 综合色中文字幕| 欧美唯美清纯偷拍| 亚洲一区二区视频| 91精品1区2区| 亚洲黄一区二区三区| 色哟哟亚洲精品| 亚洲欧美一区二区三区久本道91| 成人黄色免费短视频| 国产日韩欧美精品综合| 国内精品国产成人国产三级粉色 | 欧美sm极限捆绑bd| 日本少妇一区二区|