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

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

?? flash.c

?? 基于 Luminary Micro 公司的 Cortex-M3 (ARM)內(nèi)核使用之 uC/OS-II 作業(yè)系統(tǒng),此例程是移植于 LM3S310 上的應用,于 Keil MDK 工程編譯,而 uC/O
?? 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一区二区三区免费野_久草精品视频
...xxx性欧美| 一区二区三区日本| 日本二三区不卡| 紧缚捆绑精品一区二区| 一区二区三区在线视频播放| 日韩视频一区二区| 日本乱人伦aⅴ精品| 国产在线精品免费| 亚洲444eee在线观看| 国产日韩欧美a| 51精品久久久久久久蜜臀| 99久久免费国产| 激情图片小说一区| 天天综合色天天综合色h| 国产精品美女久久久久久久| 日韩欧美在线1卡| 在线免费视频一区二区| 东方欧美亚洲色图在线| 日本不卡一二三区黄网| 亚洲精品免费一二三区| 久久精品男人的天堂| 91麻豆精品国产自产在线观看一区| 成人免费av在线| 精品伊人久久久久7777人| 亚洲国产中文字幕在线视频综合| 中文字幕中文字幕在线一区 | 亚洲午夜久久久久久久久电影网| 国产日韩欧美综合一区| 欧美成人欧美edvon| 欧美日韩国产综合久久| 日本久久一区二区三区| aaa欧美日韩| 成人午夜伦理影院| 国产69精品久久777的优势| 久久精品国产亚洲高清剧情介绍 | 日韩欧美资源站| 欧美色网一区二区| 91久久精品一区二区| 成人综合激情网| 国产成人综合视频| 国产成人免费9x9x人网站视频| 国产精一区二区三区| 麻豆国产精品777777在线| 免费在线成人网| 免费在线观看视频一区| 奇米色777欧美一区二区| 奇米一区二区三区| 老汉av免费一区二区三区| 日韩不卡免费视频| 喷水一区二区三区| 久久精品国产第一区二区三区| 久久91精品久久久久久秒播| 国内精品久久久久影院一蜜桃| 久色婷婷小香蕉久久| 精品在线视频一区| 国产精品一区免费视频| 成人免费黄色在线| 91黄色免费网站| 欧美日韩精品一区二区三区四区| 在线播放中文一区| 欧美电视剧免费全集观看| 亚洲精品在线免费播放| 日本一区二区视频在线观看| 中文字幕一区二区日韩精品绯色| 亚洲欧美日韩国产一区二区三区| 亚洲无人区一区| 日韩精彩视频在线观看| 国内外精品视频| 国产99久久久久久免费看农村| 不卡的av网站| 欧美日韩一区二区三区免费看| 69堂成人精品免费视频| 2021中文字幕一区亚洲| 国产精品情趣视频| 亚洲一区二区三区自拍| 免费三级欧美电影| 成人高清av在线| 欧美影院一区二区三区| 精品免费日韩av| 亚洲少妇30p| 午夜电影久久久| 国产九色sp调教91| 欧美视频一区二区三区四区| 精品久久久久av影院| 亚洲欧洲精品成人久久奇米网| 亚洲一区二区三区视频在线| 久久99精品久久久| 91亚洲精品乱码久久久久久蜜桃| 777亚洲妇女| 国产欧美一二三区| 日日噜噜夜夜狠狠视频欧美人 | 日本最新不卡在线| 成人做爰69片免费看网站| 欧美最新大片在线看| 精品国产伦一区二区三区免费 | 中文字幕av不卡| 亚洲综合丝袜美腿| 韩国精品免费视频| 欧美性受极品xxxx喷水| 欧美精品一区男女天堂| 亚洲综合免费观看高清完整版在线 | 欧美专区在线观看一区| 久久这里只有精品6| 夜夜嗨av一区二区三区网页| 激情图区综合网| 欧美日韩国产123区| 国产精品福利av| 久久国产精品99久久人人澡| 欧洲一区在线观看| 国产性色一区二区| 美女爽到高潮91| 色狠狠一区二区三区香蕉| 国产欧美va欧美不卡在线| 天堂一区二区在线| 色综合久久久久久久| 欧美激情一区二区三区四区| 日本欧美在线看| 欧美日韩大陆在线| 一区二区三区日韩| 色综合久久中文综合久久97| 欧美极品aⅴ影院| 蜜臀av在线播放一区二区三区| 欧美日韩视频第一区| 一区二区三区小说| av网站免费线看精品| 中文字幕精品在线不卡| 国产精品一区二区男女羞羞无遮挡| 这里只有精品免费| 日日噜噜夜夜狠狠视频欧美人| 欧美视频第二页| 亚洲欧美激情视频在线观看一区二区三区| 国产精品系列在线观看| 久久午夜色播影院免费高清| 久草中文综合在线| 日韩一区二区在线看| 石原莉奈在线亚洲二区| 欧美日韩三级在线| 亚洲电影一级黄| 欧美日韩综合在线| 午夜视频在线观看一区二区三区| 日本道在线观看一区二区| 一区二区三区在线看| 欧美综合一区二区| 一区二区在线观看免费视频播放| 97超碰欧美中文字幕| 亚洲免费资源在线播放| 日本乱码高清不卡字幕| 亚洲午夜激情网站| 欧美午夜不卡在线观看免费| 亚洲成人激情自拍| 欧美欧美午夜aⅴ在线观看| 午夜精品久久久久久久久| 51久久夜色精品国产麻豆| 麻豆91精品视频| 精品福利一二区| 国产激情视频一区二区在线观看 | 欧美激情一区二区三区| 大胆亚洲人体视频| 亚洲男人天堂一区| 欧美日韩中文国产| 天堂久久一区二区三区| 日韩精品一区二区三区在线观看| 九色porny丨国产精品| 欧美极品aⅴ影院| 91美女在线看| 午夜成人免费电影| 日韩精品自拍偷拍| 成人免费观看视频| 一区二区久久久久| 欧美一级夜夜爽| 国产不卡高清在线观看视频| 一区二区三区在线免费| 日韩一区二区三区四区五区六区 | 亚洲欧美日韩国产一区二区三区| 欧美午夜精品一区| 免费欧美高清视频| 国产精品午夜在线观看| 欧美亚洲一区三区| 免费成人在线视频观看| 国产无一区二区| 欧美天天综合网| 国产综合色产在线精品| 亚洲欧洲精品一区二区三区| 欧美日韩成人在线| 久久99久久精品| 亚洲三级在线播放| 日韩美女视频在线| 色悠悠亚洲一区二区| 另类欧美日韩国产在线| 亚洲免费色视频| 日韩免费一区二区三区在线播放| 成人黄色777网| 青青草国产精品97视觉盛宴| 中文字幕在线免费不卡| 欧美一区二区三区不卡| 99精品欧美一区二区蜜桃免费| 久久成人精品无人区| 亚洲精品久久嫩草网站秘色| 久久综合色综合88| 欧美体内she精视频|