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

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

?? extflash.c

?? 基于TI公司Cortex-M3的uart超級通信開發
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// 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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区中文在线| 黑人巨大精品欧美一区| 日本不卡在线视频| www.亚洲人| 欧美不卡123| 亚洲一区中文日韩| 成人丝袜18视频在线观看| 在线播放亚洲一区| 国产精品电影一区二区三区| 青草av.久久免费一区| 欧洲国产伦久久久久久久| 国产色产综合色产在线视频| 午夜亚洲国产au精品一区二区 | 亚洲国产精品二十页| 日韩不卡在线观看日韩不卡视频| 99天天综合性| 欧美国产一区在线| 国产一区二区三区精品欧美日韩一区二区三区 | 一区二区三区美女视频| 国产一区二区三区黄视频| 日韩欧美卡一卡二| 日韩精品高清不卡| 欧美在线综合视频| 一区二区在线看| 91久久精品一区二区| 亚洲欧美在线高清| 99久久伊人网影院| 国产精品久久久久国产精品日日| 国产精品伊人色| 久久免费视频一区| 国产一二精品视频| www久久久久| 国产iv一区二区三区| 国产精品素人视频| gogo大胆日本视频一区| 一区二区中文字幕在线| 色综合欧美在线| 一区二区三区免费| 91精品免费在线观看| 美国十次综合导航| 久久精品一区四区| 成人免费视频一区二区| 综合久久国产九一剧情麻豆| 91麻豆国产福利精品| 亚洲激情五月婷婷| 欧美三级资源在线| 日韩激情视频网站| 久久久噜噜噜久久中文字幕色伊伊| 国产精品一区二区久久精品爱涩| 久久精品视频免费| 91欧美一区二区| 午夜精品一区二区三区电影天堂| 日韩欧美三级在线| 粉嫩13p一区二区三区| 国产精品成人一区二区艾草 | 国产偷国产偷精品高清尤物| av亚洲精华国产精华| 亚洲在线视频免费观看| 在线不卡的av| 成人福利在线看| 亚洲高清中文字幕| 久久先锋影音av鲁色资源网| 99麻豆久久久国产精品免费| 午夜欧美在线一二页| 精品sm捆绑视频| 色中色一区二区| 久久99国产精品久久99果冻传媒| 中文字幕免费一区| 欧美精品在线一区二区三区| 国产综合成人久久大片91| 中文字幕在线观看一区二区| 欧美日韩国产成人在线免费| 国产揄拍国内精品对白| 一区二区日韩电影| 国产清纯白嫩初高生在线观看91| 欧美视频精品在线观看| 国产成人av一区| 日韩精品一级二级| 1000部国产精品成人观看| 日韩欧美在线不卡| 色激情天天射综合网| 国产成人免费视频一区| 视频一区视频二区中文| 中文字幕第一页久久| 91精品国产高清一区二区三区| 高清免费成人av| 久久国内精品自在自线400部| 亚洲男女一区二区三区| 国产日韩欧美电影| 日韩欧美国产午夜精品| 欧美午夜在线一二页| av一区二区三区黑人| 国产在线视频一区二区| 久久精品二区亚洲w码| 亚洲国产综合视频在线观看| 国产精品久久久久久久岛一牛影视| 欧美α欧美αv大片| 51精品视频一区二区三区| 色婷婷综合久久久久中文| 国产成人啪免费观看软件| 国产综合色视频| 国产一区二区成人久久免费影院| 丝袜亚洲另类欧美综合| 亚洲午夜激情网页| 一区二区三区不卡视频在线观看| 亚洲视频精选在线| 国产精品久久三| 亚洲国产精品高清| 国产精品免费aⅴ片在线观看| 久久久亚洲精华液精华液精华液| 日韩精品一区二| 欧美精品一区二区精品网| 日韩精品一区二区三区视频在线观看 | 欧美日本一区二区在线观看| 精品视频一区 二区 三区| 91国模大尺度私拍在线视频| 色婷婷av久久久久久久| 色香色香欲天天天影视综合网| 91免费看视频| 在线视频综合导航| 91麻豆精品视频| 欧美性淫爽ww久久久久无| 欧美三级视频在线观看 | 色综合色综合色综合色综合色综合 | 国产精品人妖ts系列视频| 久久久综合视频| 中文字幕一区二区三区四区不卡 | 国产精品视频yy9299一区| 国产精品久久久久久久久久免费看 | 男男视频亚洲欧美| 久久精品国产亚洲高清剧情介绍| 久国产精品韩国三级视频| 久久er99精品| 成人精品视频一区二区三区| 91丨九色丨蝌蚪富婆spa| 色噜噜久久综合| 欧美精选在线播放| 久久久亚洲欧洲日产国码αv| 国产精品卡一卡二卡三| 一区二区三区色| 麻豆视频一区二区| 国产91精品欧美| 欧美日韩中文另类| 2024国产精品| 一区二区三区精品久久久| 琪琪久久久久日韩精品| 国产成人啪午夜精品网站男同| 91精品1区2区| 日韩美女在线视频| 中文字幕一区二区在线播放 | 亚洲视频在线一区| 麻豆久久一区二区| 色哟哟精品一区| 欧美大片一区二区三区| 日本一区二区电影| 首页国产欧美久久| 菠萝蜜视频在线观看一区| 91麻豆精品国产91久久久 | 91精品国产乱码久久蜜臀| 日本一二三四高清不卡| 秋霞av亚洲一区二区三| 91视视频在线直接观看在线看网页在线看| 色婷婷久久久久swag精品| 久久伊人蜜桃av一区二区| 亚洲午夜羞羞片| 国产成a人亚洲精品| 日韩三级伦理片妻子的秘密按摩| 亚洲欧洲综合另类在线| 久久疯狂做爰流白浆xx| 色伊人久久综合中文字幕| 国产亚洲婷婷免费| 蜜桃av一区二区| 91久久精品一区二区二区| 日本一区二区三区电影| 麻豆一区二区在线| 欧美巨大另类极品videosbest | 综合色天天鬼久久鬼色| 狠狠色狠狠色综合| 91精品国产高清一区二区三区蜜臀| 亚洲天堂免费看| 国产成人夜色高潮福利影视| 日韩精品一区二区三区在线观看 | 欧美一级久久久久久久大片| 亚洲精品久久嫩草网站秘色| 国产99精品国产| 精品国产乱码久久久久久牛牛 | 日韩一区国产二区欧美三区| 亚洲国产日韩综合久久精品| 99九九99九九九视频精品| 久久久精品蜜桃| 激情文学综合丁香| 欧美成人一区二区三区片免费| 午夜精品福利一区二区三区蜜桃| 日本二三区不卡| 亚洲欧美视频一区| 99视频精品在线| 国产精品国产成人国产三级| 成人免费的视频| 国产精品人人做人人爽人人添| 懂色中文一区二区在线播放|