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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? extflash.c

?? 基于TI公司Cortex-M3的uart超級(jí)通信開發(fā)
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
//*****************************************************************************
//
// extflash.c - Functions accessing the external flash on the lm3s9b96
//              SRAM/Flash daughter board.
//
// Copyright (c) 2009 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 microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  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 5228 of the DK-LM3S9B96 Firmware Package.
//
//*****************************************************************************

#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/epi.h"
#include "extflash.h"

//*****************************************************************************
//
//! \addtogroup extflash_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
// Definitions of important bits in the flash status register.
//
//*****************************************************************************
#define FLASH_STATUS_DATA_POLL 0x80
#define FLASH_STATUS_ERROR     0x20

//*****************************************************************************
//
// Check to determine whether or not the flash appears to be present.  We do
// this by attempting to read the first 3 bytes of the CFI Query Identification
// String which should contain "QRY".  If we get this, we assume all is well,
// otherwise we assume the flash is not accessible.
//
//*****************************************************************************
static tBoolean
CheckFlashPresent(void)
{
    tBoolean bRetcode;

    //
    // Set autoselect mode
    //
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0x90;

    //
    // Set CFI query
    //
    HWREGB(EXT_FLASH_BASE + 0xAA) = 0x98;

    //
    // Check that the query string is returned correctly.
    //
    if((HWREGB(EXT_FLASH_BASE + 0x20) != 'Q') ||
       (HWREGB(EXT_FLASH_BASE + 0x22) != 'R') ||
       (HWREGB(EXT_FLASH_BASE + 0x24) != 'Y'))
    {
        //
        // We can't access the flash correctly - the query string was not
        // read as expected.
        //
        bRetcode = false;
    }
    else
    {
        //
        // We read the query string so tell the caller all is well.
        //
        bRetcode = true;
    }

    //
    // Return to read array mode.  We need to do this twice.  The first write
    // gets us back to autoselect mode and the second returns us to array
    // read.
    //
    HWREGB(EXT_FLASH_BASE) = 0xF0;
    HWREGB(EXT_FLASH_BASE) = 0xF0;

    //
    // Tell the caller whether or not the flash is accessible.
    //
    return(bRetcode);
}

//*****************************************************************************
//
//! Determines whether the external flash on the Flash/SRAM/LCD daughter board
//! is accessible.
//!
//! This function checks to ensure that the external flash is accessible by
//! reading back the "QRY" tag at the beginning of the CFI query block.  If
//! this is read correctly, \b true is returned indicating that the flash is
//! now accessible, otherwise \b false is returned.  It is assumed that the EPI
//! configuration has previously been set correctly using a call to
//! PinoutSet().
//!
//! On return, the flash device is in read array mode.
//!
//! \return Returns \b true if the flash is found and accessible or \b false
//! if the flash device is not found.
//
//*****************************************************************************
tBoolean
ExtFlashPresent(void)
{
    //
    // Make sure we can access the flash.
    //
    return(CheckFlashPresent());
}

//*****************************************************************************
//
//! Queries the total size of the attached flash device.
//!
//! This function read the flash CFI query block to determine the total size of
//! the device in bytes and returns this value to the caller.  It is assumed
//! that the EPI configuration has previously been set correctly using a call
//! to PinoutSet().
//!
//! \return Returns the total size of the attached flash device in bytes.
//
//*****************************************************************************
unsigned long
ExtFlashChipSizeGet(void)
{
    unsigned char ucSize;

    //
    // Set autoselect mode
    //
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0x90;

    //
    // Set CFI query
    //
    HWREGB(EXT_FLASH_BASE + 0xAA) = 0x98;

    //
    // Read the device size from the CFI block.  This is returned as a power
    // of two.
    //
    ucSize = HWREGB(EXT_FLASH_BASE + 0x4E);

    //
    // Switch back to read mode.  We need to do this twice.  The first write
    // gets us back to autoselect mode and the second returns to read array
    // mode.
    //
    HWREGB(EXT_FLASH_BASE) = 0xF0;
    HWREGB(EXT_FLASH_BASE) = 0xF0;

    //
    // Return the size of the device in bytes.
    //
    return(1 << ucSize);
}

//*****************************************************************************
//
//! Returns the size of a given flash block.
//!
//! \param ulAddress is the flash address whose block information is being
//! queried.
//! \param pulBlockAddr is storage for the returned block start address.
//!
//! This function determines the start address and size of the flash block
//! which contains the supplied address.  The block information is determined
//! by parsing the flash CFI query data.  If an invalid address is passed, the
//! block address and size are both returned as 0.
//!
//! It is assumed that the EPI configuration has previously been set correctly
//! using a call to PinoutSet().
//!
//! \return Returns the size of the flash block which contains \e ulAddress or
//! 0 if \e ulAddress is invalid.
//
//*****************************************************************************
unsigned long
ExtFlashBlockSizeGet(unsigned long ulAddress, unsigned long *pulBlockAddr)
{
    unsigned char *pcCFIQuery;
    unsigned char ucSize;
    unsigned short usNumBlocks;
    unsigned long ulBlockStart, ulBlockEnd, ulSizeBlock;
    unsigned long ulRetcode, ulBlockAddr;

    //
    // Modify the address to be relative to the start of the flash device.
    //
    ulAddress -= EXT_FLASH_BASE;

    //
    // Set return values to indicate an error for now.
    //
    ulRetcode = 0;
    ulBlockAddr = 0;

    //
    // Set autoselect mode
    //
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0xAA;
    HWREGB(EXT_FLASH_BASE + 0x555) = 0x55;
    HWREGB(EXT_FLASH_BASE + 0xAAA) = 0x90;

    //
    // Set CFI query
    //
    HWREGB(EXT_FLASH_BASE + 0xAA) = 0x98;

    //
    // Get a pointer to the CFI query information.
    //
    pcCFIQuery = (unsigned char *)EXT_FLASH_BASE;

    //
    //
    // Read the device size from the CFI block.  This is returned as a power
    // of two.
    //
    ucSize = pcCFIQuery[0x4E];

    //
    // Is the address passed within the device?
    //
    if(ulAddress < (1 << ucSize))
    {
        //
        // The address appears to be valid.  Now walk the CFI regions to
        // determine which one it is within.
        //
        ulBlockStart = 0;
        for(ucSize = 0; ucSize < pcCFIQuery[0x58]; ucSize++)
        {
            //
            // How many erase blocks exist in this region?
            //
            usNumBlocks = (pcCFIQuery[0x5A + (8 * ucSize)] +
                          (pcCFIQuery[0x5C + (8 * ucSize)] << 8) + 1);

            //
            // How big is each block?
            //
            ulSizeBlock = (pcCFIQuery[0x5E + (8 * ucSize)] +
                          (pcCFIQuery[0x60 + (8 * ucSize)] << 8)) * 256;

            // Where does this region end?
            //
            ulBlockEnd = ulBlockStart + ((unsigned long)usNumBlocks *
                         ulSizeBlock);

            //
            // Does the passed address fall within this region?
            //
            if(ulAddress < ulBlockEnd)
            {
                //
                // Yes - determine where the block starts.
                //
                ulBlockAddr = EXT_FLASH_BASE + (ulBlockStart +
                              (((ulAddress - ulBlockStart) / ulSizeBlock) *
                              ulSizeBlock));

                //
                // Set up to return the block size.
                //
                ulRetcode = ulSizeBlock;

                //
                // Drop out of the loop now that we have found the required
                // block.
                //
                break;
            }

            //
            // Move on to the next region.
            //
            ulBlockStart = ulBlockEnd;
        }
    }

    //
    // Return to read array mode.  We need to do this twice.  The first write
    // gets us back to autoselect mode and the second returns us to array
    // read.
    //
    HWREGB(EXT_FLASH_BASE) = 0xF0;
    HWREGB(EXT_FLASH_BASE) = 0xF0;

    //
    // Return the block start address and size to the caller.
    //
    *pulBlockAddr = ulBlockAddr;
    return(ulRetcode);

}

//*****************************************************************************
//
//! Determines whether the last erase operation has completed.
//!
//! \param ulAddress is an address within the area of flash which was last
//! erased using a call to ExtFlashBlockErase() or any valid flash address if
//! ExtFlashChipErase() was last issued.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影在线播放| 亚洲欧洲美洲综合色网| 精品日产卡一卡二卡麻豆| 91麻豆精品国产91久久久久 | 国内精品视频一区二区三区八戒| 亚洲h动漫在线| 亚洲成在线观看| 亚洲成人激情综合网| 日韩精品一区第一页| 日本大胆欧美人术艺术动态| 日韩1区2区3区| 黄色日韩网站视频| 成人一区二区视频| fc2成人免费人成在线观看播放 | 欧美tickling挠脚心丨vk| 精品国精品国产| 久久精品一区二区三区不卡牛牛| 中文字幕 久热精品 视频在线 | 洋洋av久久久久久久一区| 亚洲影视资源网| 日韩av中文字幕一区二区三区| 久久se这里有精品| 国产经典欧美精品| 91在线精品秘密一区二区| 欧美伊人久久大香线蕉综合69 | 欧美电影免费观看高清完整版在线观看 | 亚洲伦在线观看| 亚洲福利视频三区| 久久精品免费观看| 成人精品视频.| 欧美色爱综合网| 亚洲精品在线免费观看视频| 中文字幕一区二区三区四区| 亚洲综合图片区| 精品综合久久久久久8888| 成人免费毛片嘿嘿连载视频| 欧美性猛交xxxx黑人交| 欧美xxxxx牲另类人与| 国产精品久久久久aaaa樱花| 亚洲电影你懂得| 国产精品主播直播| 欧美日韩三级一区| 国产亚洲欧美日韩日本| 亚洲自拍与偷拍| 狠狠v欧美v日韩v亚洲ⅴ| www.欧美色图| 欧美一区二区视频在线观看2022| 国产欧美中文在线| 日日摸夜夜添夜夜添国产精品| 国产精品夜夜爽| 欧美日韩一区二区三区高清 | 亚洲免费大片在线观看| 久久精品国产久精国产爱| 99久久久久久99| 日韩免费一区二区| 亚洲激情中文1区| 国产一区二区三区观看| 欧美日韩一级黄| 国产精品久久久久aaaa| 美国av一区二区| 91国模大尺度私拍在线视频| 久久蜜桃av一区二区天堂| 偷拍日韩校园综合在线| 91热门视频在线观看| 精品国产乱子伦一区| 亚洲成精国产精品女| eeuss影院一区二区三区 | 亚洲一区二区三区四区在线免费观看| 精品午夜一区二区三区在线观看| 色综合久久66| 欧美国产激情二区三区| 麻豆精品视频在线观看视频| 在线观看免费亚洲| 国产精品久久久久久久久免费丝袜 | 欧美v日韩v国产v| 亚瑟在线精品视频| 色婷婷狠狠综合| 国产精品久久久久7777按摩| 国产一区二区在线看| 制服.丝袜.亚洲.中文.综合| 亚洲最快最全在线视频| 99久久夜色精品国产网站| 国产亚洲精品中文字幕| 国产一区二区三区电影在线观看| 欧美一级午夜免费电影| 天天色图综合网| 在线观看日韩av先锋影音电影院| 亚洲人成小说网站色在线 | 国产亚洲视频系列| 加勒比av一区二区| 欧美成人艳星乳罩| 日韩av中文字幕一区二区三区| 欧美在线制服丝袜| 亚洲一区二区四区蜜桃| 91国偷自产一区二区使用方法| 亚洲人123区| 91色乱码一区二区三区| 亚洲免费伊人电影| 91久久免费观看| 亚洲最大成人综合| 欧美亚洲免费在线一区| 亚洲国产婷婷综合在线精品| 欧美熟乱第一页| 三级一区在线视频先锋| 51精品秘密在线观看| 天堂av在线一区| 日韩一区和二区| 久久国产三级精品| xfplay精品久久| 国产成人亚洲综合色影视| 欧美国产欧美综合| 99综合影院在线| 亚洲综合一区二区三区| 欧美日韩国产一级片| 日韩在线观看一区二区| 日韩欧美国产综合一区| 国产曰批免费观看久久久| 国产日韩v精品一区二区| 成人激情开心网| 国产精品福利在线播放| 久久蜜桃av一区二区天堂| 国产福利91精品| 一区在线中文字幕| 欧美色区777第一页| 偷拍日韩校园综合在线| 2024国产精品视频| 成人一区二区视频| 亚洲一区自拍偷拍| 日韩一区二区免费电影| 国产一区二区按摩在线观看| 国产欧美日韩三区| 色悠悠久久综合| 日韩成人dvd| 国产三级一区二区| 色婷婷综合激情| 日韩综合小视频| 久久蜜臀精品av| 91黄色免费网站| 紧缚奴在线一区二区三区| 综合婷婷亚洲小说| 4438x亚洲最大成人网| 国产一区二区三区日韩| 亚洲人成伊人成综合网小说| 91精品国产综合久久久久久漫画 | 日韩精品成人一区二区三区| 久久色视频免费观看| 91丝袜美女网| 久久精品国产久精国产| 亚洲人吸女人奶水| 日韩精品中文字幕一区| 97久久精品人人做人人爽50路| 日韩—二三区免费观看av| 亚洲国产高清在线| 91麻豆精品国产91久久久更新时间 | 国产一区二区在线视频| 一区二区三区四区蜜桃| xnxx国产精品| 欧美猛男男办公室激情| 成a人片亚洲日本久久| 日韩国产在线观看| 亚洲视频你懂的| 欧美va天堂va视频va在线| 欧美丝袜第三区| av电影一区二区| 欧美精品一二三| 懂色av一区二区三区蜜臀| 婷婷开心激情综合| 国产91丝袜在线18| 亚洲一区二区三区美女| 国产亚洲综合色| 欧美一级国产精品| 91在线观看污| 国产麻豆精品久久一二三| 爽爽淫人综合网网站| 中文字幕一区二区三区在线不卡| 精品国产1区二区| 欧美三级一区二区| 91在线视频观看| 成人免费毛片高清视频| 国产在线麻豆精品观看| 奇米888四色在线精品| 一区二区三区免费网站| 中文字幕成人av| 国产视频一区在线播放| 91精品在线一区二区| 在线中文字幕不卡| 色综合久久综合中文综合网| 国产成人av资源| 国内精品国产成人| 捆绑调教一区二区三区| 日韩—二三区免费观看av| 天使萌一区二区三区免费观看| 玉足女爽爽91| 亚洲欧美一区二区三区孕妇| 欧美国产欧美综合| 国产日韩av一区| 中文字幕免费不卡| 国产精品欧美一区二区三区| 亚洲国产精品成人综合 | 中文字幕在线不卡一区|