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

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

?? norflashintel.c

?? IAR5.2下 AT91SAM9260 ARM 對 MCP2515 控制源化碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

//------------------------------------------------------------------------------
//         Headers
//------------------------------------------------------------------------------
#include "NorFlashCFI.h"
#include "NorFlashCommon.h"
#include <utility/trace.h>
#include <string.h>

//------------------------------------------------------------------------------
//        Local defination
//------------------------------------------------------------------------------
 
/// Command for vendor command set CMD_SET_INTEL. Device commands are written 
/// to the Command User Interface (CUI) to control all flash memory device operations.
#define INTEL_CMD_IDIN             0x0090
#define INTEL_CMD_BLOCK_ERASE_1    0x0020
#define INTEL_CMD_BLOCK_ERASE_2    0x00D0
#define INTEL_CMD_READ_STATUS      0x0070
#define INTEL_CMD_CLEAR_STATUS     0x0050
#define INTEL_CMD_BLOCK_LOCKSTART  0x0060
#define INTEL_CMD_BLOCK_LOCK       0x0001
#define INTEL_CMD_BLOCK_UNLOCK     0x00D0
#define INTEL_CMD_BLOCK_LOCKDOWN   0x002F
#define INTEL_CMD_PROGRAM_WORD     0x0010
#define INTEL_CMD_RESET            0x00FF


/// Intel norflash status resgister
#define INTEL_STATUS_DWS    0x80
#define INTEL_STATUS_ESS    0x40
#define INTEL_STATUS_ES     0x20
#define INTEL_STATUS_PS     0x10
#define INTEL_STATUS_VPPS   0x08
#define INTEL_STATUS_PSS    0x04
#define INTEL_STATUS_BLS    0x02
#define INTEL_STATUS_BWS    0x01

/// Intel norflash device Identifier infomation address offset.
#define INTEL_MANU_ID       0x00
#define INTEL_DEVIDE_ID     0x01
#define INTEL_LOCKSTATUS    0x02

/// Intel norflash device lock status.
#define INTEL_LOCKSTATUS_LOCKED         0x01
#define INTEL_LOCKSTATUS_LOCKDOWNED     0x02

//------------------------------------------------------------------------------
//         Local functions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// It implements a RESET command.
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
//------------------------------------------------------------------------------
void intel_Reset(struct NorFlashInfo *pNorFlashInfo, unsigned int address)
{
    unsigned int busAddress;
    unsigned int busWidth;
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    busAddress = NorFlash_GetAddressInChip(pNorFlashInfo, address);
    WriteCommand(busWidth, busAddress, INTEL_CMD_RESET);
}


//------------------------------------------------------------------------------
/// The Read Device Identifier command instructs the device to output manufacturer
/// code, device identifier code, block-lock status, protection register data, 
/// or configuration register data by giving offset.
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
/// \param offset 0: Identifier address offset.
//------------------------------------------------------------------------------
unsigned int intel_ReadIdentification(
    struct NorFlashInfo *pNorFlashInfo, 
    unsigned int offset)
{
    unsigned int data;
    unsigned char busWidth;
    unsigned int address;
    
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    // Issue the Read Device Identifier command at specified address.
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, 0), 
                 INTEL_CMD_IDIN);
    
    if(offset >= INTEL_LOCKSTATUS) {
    	// Block base address.
    	address = NorFlash_GetAddressInChip (pNorFlashInfo, offset);
    }
    else {
    	address = NorFlash_GetByteAddressInChip (pNorFlashInfo, offset);
    }
    ReadRawData(busWidth, address, (unsigned char*)&data);
    return data;
}


//------------------------------------------------------------------------------
/// Return the status register value.
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
//------------------------------------------------------------------------------
unsigned char intel_ReadStatus(struct NorFlashInfo *pNorFlashInfo, unsigned int address)
{
    unsigned int status;
    unsigned char busWidth;
    unsigned int budAddress;
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    
    // Issue the Read Status Register command at any address.
    budAddress = NorFlash_GetAddressInChip(pNorFlashInfo, address), 
    WriteCommand(busWidth, budAddress, INTEL_CMD_READ_STATUS);
    ReadRawData(busWidth, budAddress, (unsigned char*)&status);
    return status;
}

//------------------------------------------------------------------------------
/// Clear the status register.
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
//------------------------------------------------------------------------------
void intel_ClearStatus(struct NorFlashInfo *pNorFlashInfo)
{
    unsigned char busWidth;
    unsigned int address;
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    
    // Issue the Clear Status Register command at any address
    address = NorFlash_GetAddressInChip(pNorFlashInfo, 0), 
    WriteCommand(busWidth, address, INTEL_CMD_CLEAR_STATUS);
}

//------------------------------------------------------------------------------
/// Unlocks the specified block of the device. 
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
/// \param address Address in sector.
//------------------------------------------------------------------------------
void intel_UnlockSector(struct NorFlashInfo *pNorFlashInfo, unsigned int address)
{
    unsigned int busAddress;
    unsigned char busWidth;
    // Clear the status register first.
   
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    busAddress = NorFlash_GetAddressInChip(pNorFlashInfo,address);
    
    WriteCommand(busWidth, busAddress, INTEL_CMD_BLOCK_LOCKSTART);
    WriteCommand(busWidth, busAddress, INTEL_CMD_BLOCK_UNLOCK);
    intel_Reset(pNorFlashInfo, 0);
}

//------------------------------------------------------------------------------
/// The Read Device Identifier command instructs the device to output block-lock 
/// status.
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
/// \param address 0: Address in sector/block.
//------------------------------------------------------------------------------
unsigned int intel_GetBlockLockStatus(struct NorFlashInfo *pNorFlashInfo, unsigned int address)
{
    return intel_ReadIdentification(pNorFlashInfo, (address + NorFlash_GetByteAddress(pNorFlashInfo ,INTEL_LOCKSTATUS)));
}

//------------------------------------------------------------------------------
/// It implement a program word command. Returns 0 if the operation was
/// successful; otherwise returns an error code.
/// \param pNorFlashInfo  Pointer to an struct NorFlashInfo instance.
/// \param address Start address offset to be wrote.
/// \param data word to be written.
//------------------------------------------------------------------------------    
unsigned char intel_Program(
    struct NorFlashInfo *pNorFlashInfo,
    unsigned int address,
    unsigned int data
    )
{
    unsigned int status;
    unsigned int datain;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99九九99九九九视频精品| 99在线热播精品免费| 精品99一区二区| 日韩中文字幕一区二区三区| 欧美成人精品1314www| 国产一区二区影院| 国产精品福利一区二区| 国内偷窥港台综合视频在线播放| 欧美日韩高清在线播放| 中国色在线观看另类| 色爱区综合激月婷婷| 黄页视频在线91| 亚洲麻豆国产自偷在线| 欧美电影在线免费观看| 国产成人午夜精品5599| 亚洲成av人影院| 国产精品每日更新| 久久疯狂做爰流白浆xx| 亚洲欧美另类图片小说| 亚洲mv在线观看| 亚洲日本在线看| 久久综合久久综合久久| 欧美日韩黄视频| 欧美精选在线播放| 99久久国产综合精品麻豆| 99久久精品国产一区二区三区| 91亚洲资源网| 麻豆精品久久精品色综合| 人禽交欧美网站| 欧美国产日产图区| 国产欧美精品一区| 综合久久久久久| 国产精品网友自拍| 激情国产一区二区| 丁香五精品蜜臀久久久久99网站| 国产.精品.日韩.另类.中文.在线.播放| 国产精品一区二区三区乱码| jvid福利写真一区二区三区| 欧美美女一区二区| 亚洲一区二区高清| 琪琪一区二区三区| 日韩欧美一区电影| 六月丁香婷婷色狠狠久久| 日韩一区二区在线观看视频| 五月天久久比比资源色| 国产一区二区在线观看免费 | 国产毛片一区二区| 欧美精品一区视频| 一区二区在线观看视频在线观看| 日本sm残虐另类| 欧美大黄免费观看| 麻豆精品在线视频| 国产精品99久久久久久宅男| 欧美mv日韩mv| 精品一区二区三区免费播放| 久久日韩粉嫩一区二区三区| 一区二区三区四区国产精品| 91视频91自| 亚洲香肠在线观看| 日韩一级视频免费观看在线| 国产乱码精品1区2区3区| 国产精品丝袜久久久久久app| 亚洲成av人片一区二区梦乃| 日韩一级片网址| 国产精品一区在线观看你懂的| 欧美专区亚洲专区| 蜜臀a∨国产成人精品| 久久精品一区二区三区四区| eeuss鲁片一区二区三区| 亚洲国产精品久久久久婷婷884| 成人美女视频在线看| 一区二区三区在线免费播放 | 亚洲一区二区在线免费看| 欧美一区二区在线视频| 亚洲综合色视频| 波多野结衣欧美| 午夜精品久久久久久久99水蜜桃| 色先锋久久av资源部| 男女男精品网站| 欧美国产精品一区二区| 91精品国产综合久久精品麻豆| 综合自拍亚洲综合图不卡区| 欧美一区二区精品在线| 亚洲电影第三页| 久久久久99精品一区| 一本色道**综合亚洲精品蜜桃冫| 中文字幕乱码久久午夜不卡| 国产乱人伦偷精品视频免下载| 7777精品伊人久久久大香线蕉的| 亚洲超碰97人人做人人爱| 久久综合色8888| 欧美一区中文字幕| 欧美综合亚洲图片综合区| 亚洲男人天堂av网| 亚洲精品一区二区三区四区高清| 六月丁香婷婷色狠狠久久| 一区二区在线观看视频| 久久精品在这里| 9i看片成人免费高清| 久久66热re国产| 亚洲一区二区三区中文字幕| 久久精品欧美日韩精品| 日韩一级黄色片| 精品视频在线看| av一区二区三区黑人| 国产高清一区日本| 久久丁香综合五月国产三级网站| 国产欧美日韩卡一| 久久亚洲二区三区| 欧美成人官网二区| 国产成人av影院| 久久精品国产99| 欧美日韩国产中文| 播五月开心婷婷综合| 欧美一区二区三区在线| 日韩激情av在线| 久久综合九色综合欧美就去吻| 伊人开心综合网| 欧美中文字幕一区二区三区| 精品亚洲aⅴ乱码一区二区三区| 成人黄色片在线观看| 午夜影院久久久| 99久久国产免费看| 91小视频在线观看| 国产伦精品一区二区三区视频青涩| 成人动漫视频在线| 色噜噜久久综合| 丰满白嫩尤物一区二区| xfplay精品久久| 欧美乱妇20p| 色婷婷亚洲一区二区三区| 国产一级精品在线| 国产在线一区观看| 国产一区二区不卡老阿姨| 日本伊人色综合网| 国产精品亚洲第一| 极品美女销魂一区二区三区免费| 91一区在线观看| 日韩福利视频导航| 亚洲欧美日韩久久精品| 久久久久久电影| 欧美久久久久久久久| 日韩一区二区免费视频| www.亚洲激情.com| 成人一区二区视频| 精品对白一区国产伦| 国产专区综合网| 在线亚洲精品福利网址导航| av电影在线不卡| 欧美三级中文字| 亚洲日本在线a| 亚洲h在线观看| 成人一区在线观看| 精品欧美一区二区久久| 精品少妇一区二区三区在线视频| 欧美α欧美αv大片| 综合在线观看色| 男女男精品网站| 国产精品国模大尺度视频| 一二三四区精品视频| 视频一区二区三区中文字幕| 韩国av一区二区| 在线观看免费亚洲| 欧美精品一区二区三区四区| 亚洲色大成网站www久久九九| 欧美日本视频在线| 国产天堂亚洲国产碰碰| 亚洲国产精品综合小说图片区| 中文字幕综合网| 麻豆精品视频在线观看视频| 91在线小视频| 99re视频精品| 欧美精品一区二区三区蜜桃| 一区二区三区小说| 国产精品99久久久久久似苏梦涵| 狠狠狠色丁香婷婷综合激情| 色天使久久综合网天天| 久久免费看少妇高潮| 日日摸夜夜添夜夜添国产精品| 日本亚洲欧美天堂免费| 色综合欧美在线视频区| 国产日本一区二区| 日韩高清一区在线| 欧美午夜不卡视频| 欧美国产精品中文字幕| 精久久久久久久久久久| 欧美日韩一区二区三区高清| 中文字幕一区二区三区av| 蜜桃av噜噜一区| 日韩精品高清不卡| 色婷婷久久综合| 中文字幕一区二区在线观看| 狠狠色狠狠色综合| 成人性生交大片免费看中文 | 亚洲一区二区三区国产| 午夜精品一区在线观看| 91麻豆免费观看| 亚洲色图欧洲色图婷婷| 国产精品538一区二区在线| 国产1区2区3区精品美女|