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

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

?? flash.c

?? 基于 Luminary Micro 公司的 Cortex-M3 (ARM)內核使用之 uC/OS-II 作業系統,此例程是移植于 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一区二区三区免费野_久草精品视频
91丨九色丨尤物| 久久av资源网| 精品视频一区二区三区免费| 亚洲精品一卡二卡| 欧美性受极品xxxx喷水| 亚洲国产精品一区二区久久恐怖片| 欧美在线免费播放| 日本在线不卡视频| 337p粉嫩大胆噜噜噜噜噜91av| 国产精品综合一区二区三区| 国产精品毛片高清在线完整版| 91麻豆免费看片| 亚洲丰满少妇videoshd| 日韩欧美在线123| 国产sm精品调教视频网站| 自拍av一区二区三区| 777午夜精品视频在线播放| 精品一区二区三区欧美| 国产精品麻豆欧美日韩ww| 日本乱人伦aⅴ精品| 青椒成人免费视频| 国产精品久久国产精麻豆99网站 | 久久综合狠狠综合| 成人黄色综合网站| 视频一区中文字幕| 中文字幕精品一区二区三区精品| 欧洲一区二区三区在线| 精品一区免费av| 亚洲欧美国产77777| 欧美一区二区视频在线观看2020| 成人综合婷婷国产精品久久蜜臀| 一区二区三区.www| 久久五月婷婷丁香社区| 91极品视觉盛宴| 国产精品夜夜爽| 日韩国产欧美在线播放| 国产精品久久午夜夜伦鲁鲁| 91精品国产综合久久精品app| 成人精品国产免费网站| 日本不卡视频一二三区| 亚洲精品日韩综合观看成人91| 日韩一级在线观看| 欧美色倩网站大全免费| 国产sm精品调教视频网站| 人人狠狠综合久久亚洲| 亚洲自拍偷拍av| 中文字幕在线不卡一区二区三区| 欧美一卡二卡三卡| 色婷婷精品大在线视频 | 蜜桃av一区二区三区电影| 亚洲特黄一级片| 久久精品夜夜夜夜久久| 欧美一区二区三区不卡| 欧美午夜精品一区二区蜜桃| va亚洲va日韩不卡在线观看| 国产一区日韩二区欧美三区| 五月婷婷激情综合| 一区二区在线电影| 国产精品久久久久久久久图文区| 亚洲精品一区二区三区四区高清 | 91在线视频官网| 韩日精品视频一区| 日本女优在线视频一区二区 | 国产精品五月天| 亚洲精品一区二区在线观看| 欧美一区二区三区免费在线看| 欧美在线色视频| 欧美视频一区在线观看| 色婷婷亚洲综合| 欧洲中文字幕精品| 欧美日韩国产天堂| 欧美偷拍一区二区| 欧美三级日韩三级国产三级| 91国模大尺度私拍在线视频| 色呦呦一区二区三区| 色综合天天综合网天天看片| 91影院在线免费观看| 91丨porny丨首页| 91高清在线观看| 欧美日韩精品一区二区三区四区| 欧美性生交片4| 欧美日本一区二区三区四区| 欧美军同video69gay| 制服视频三区第一页精品| 91精品国产欧美一区二区成人| 欧美精品aⅴ在线视频| 91精品在线免费| 日韩欧美二区三区| 久久久天堂av| 国产精品色哟哟| 亚洲综合久久久| 首页国产欧美久久| 精品亚洲国内自在自线福利| 国产做a爰片久久毛片| 国产精品1区2区3区在线观看| 成人精品高清在线| 欧美午夜不卡视频| 欧美mv日韩mv国产网站| 久久久欧美精品sm网站| 国产精品人人做人人爽人人添| 国产精品污www在线观看| 亚洲人成伊人成综合网小说| 舔着乳尖日韩一区| 国产精品一色哟哟哟| 91麻豆蜜桃一区二区三区| 正在播放一区二区| 国产欧美一区二区在线| 一区二区在线观看视频| 久久国产精品色婷婷| 99热在这里有精品免费| 制服丝袜中文字幕一区| 中文字幕精品一区二区精品绿巨人 | 国产宾馆实践打屁股91| 在线视频国内自拍亚洲视频| 日韩限制级电影在线观看| 中文字幕欧美日韩一区| 亚洲国产一区二区在线播放| 韩国午夜理伦三级不卡影院| 91麻豆精品在线观看| 日韩精品一区二区三区中文精品| 国产精品第四页| 免费国产亚洲视频| 99久久精品免费观看| 日韩欧美成人一区二区| 亚洲情趣在线观看| 国产麻豆成人传媒免费观看| 91久久奴性调教| 国产欧美日本一区视频| 视频一区二区三区在线| 不卡的av在线| 欧美v国产在线一区二区三区| 亚洲欧洲国产日韩| 狠狠色综合播放一区二区| 精品视频1区2区3区| 国产日韩欧美不卡| 男女男精品视频| 91久久久免费一区二区| 久久精品一区二区| 精品一区二区三区香蕉蜜桃| 欧美色综合影院| 国产精品电影一区二区| 国产黑丝在线一区二区三区| 91精品国产综合久久久蜜臀粉嫩 | 99久久精品免费看国产| 久久久亚洲精华液精华液精华液| 日韩成人精品视频| 欧美视频一区在线观看| 亚洲精品成a人| 波多野结衣亚洲| 欧美国产激情二区三区| 九一久久久久久| 91精品国产品国语在线不卡| 香蕉久久一区二区不卡无毒影院| k8久久久一区二区三区| 欧美国产精品劲爆| 国产69精品一区二区亚洲孕妇| 欧美成人精品1314www| 日本欧美加勒比视频| 91麻豆精品国产91久久久久久| 亚洲一区二区三区四区在线观看 | 欧美三级乱人伦电影| 亚洲一区二区三区爽爽爽爽爽| 91精彩视频在线观看| 亚洲美女视频在线观看| 日本韩国欧美在线| 亚洲乱码一区二区三区在线观看| 99精品热视频| 亚洲日本中文字幕区| 色哟哟一区二区三区| 国产综合久久久久久鬼色| 久久伊人中文字幕| 国产黄色91视频| 国产精品色呦呦| 99精品视频一区| 亚洲国产欧美在线| 56国语精品自产拍在线观看| 麻豆专区一区二区三区四区五区| 日韩一区二区三区视频| 精品午夜久久福利影院| 国产亚洲一区二区三区四区| 成人丝袜高跟foot| 亚洲精品视频在线| 91精品国模一区二区三区| 精品一区二区在线看| 久久看人人爽人人| 97久久精品人人做人人爽| 亚洲综合视频网| 日韩一区二区三区观看| 国产suv精品一区二区883| 亚洲欧美精品午睡沙发| 欧美久久久一区| 国产老妇另类xxxxx| 国产精品短视频| 欧美日韩视频在线观看一区二区三区| 视频一区二区中文字幕| 久久久久久久久久看片| 日本电影欧美片| 久久9热精品视频| 亚洲欧洲另类国产综合| 欧美一区二区三区爱爱|