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

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

?? 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一区二区三区免费野_久草精品视频
在线观看欧美黄色| 国产精品亚洲一区二区三区妖精| 国产日韩欧美在线一区| 久久众筹精品私拍模特| 精品电影一区二区三区| 精品久久久久久久人人人人传媒 | 日韩精品中文字幕在线不卡尤物| 色94色欧美sute亚洲线路二| 91视频在线观看免费| 欧美午夜宅男影院| 欧美亚洲精品一区| 精品99一区二区| 国产精品久久久久婷婷| 亚洲人亚洲人成电影网站色| 国产精品久久久久天堂| 亚洲综合成人网| 精品一区精品二区高清| 美女精品一区二区| 国产精品原创巨作av| 国产aⅴ精品一区二区三区色成熟| 国产校园另类小说区| 国产精品免费av| 视频一区二区国产| 99麻豆久久久国产精品免费 | 91在线国产福利| 正在播放亚洲一区| 中文欧美字幕免费| 激情图片小说一区| 欧美日韩一区在线| 中文字幕一区二区日韩精品绯色| 蜜桃视频一区二区三区| 欧美日韩综合一区| 国产精品久久久久久久第一福利| 日韩精品一级中文字幕精品视频免费观看 | 一区二区三区免费网站| 国产乱码精品一区二区三区av | 性做久久久久久免费观看| 精品午夜一区二区三区在线观看| 在线播放中文一区| 丝袜a∨在线一区二区三区不卡| 色综合欧美在线视频区| 一区二区中文视频| 国产精品99久久久久久久vr| 91精品国产美女浴室洗澡无遮挡| 中文子幕无线码一区tr| 成人免费毛片片v| 国产视频视频一区| 亚洲成人av一区二区三区| 91国偷自产一区二区开放时间 | 午夜精品福利在线| 欧美三电影在线| 日韩av网站免费在线| 欧美丰满少妇xxxbbb| 国产一区二区调教| 国产精品色呦呦| 欧美专区日韩专区| 国产做a爰片久久毛片| 国产农村妇女精品| 欧美婷婷六月丁香综合色| 麻豆精品在线视频| 久久久不卡影院| 色婷婷av一区二区三区gif| 亚洲人成7777| 久久人人爽爽爽人久久久| 91视频国产观看| 亚洲视频中文字幕| 2023国产精品| 欧美日韩精品三区| 91麻豆swag| 色综合中文字幕国产 | 日韩电影一区二区三区四区| 日韩午夜精品电影| 不卡影院免费观看| 国产真实乱子伦精品视频| 亚洲精品高清视频在线观看| 日韩三级精品电影久久久| 91视频.com| a在线播放不卡| 成人在线视频一区二区| 国产精品综合一区二区三区| 午夜精彩视频在线观看不卡| 亚洲天天做日日做天天谢日日欢| 久久看人人爽人人| 久久久亚洲精品一区二区三区| 日韩一区二区三区四区| 日韩欧美在线123| 91精品国产综合久久久久| 日韩亚洲欧美中文三级| 91精品国产丝袜白色高跟鞋| 制服.丝袜.亚洲.中文.综合| 欧美日韩电影在线播放| 在线电影院国产精品| 日韩欧美一级精品久久| 欧美精品一区二区高清在线观看 | 日本少妇一区二区| 青青草97国产精品免费观看无弹窗版| 亚洲福利一区二区三区| 人人爽香蕉精品| 丁香婷婷综合网| 色吊一区二区三区| 91精品久久久久久久久99蜜臂| 777午夜精品视频在线播放| 欧美婷婷六月丁香综合色| 精品三级av在线| 中文字幕中文乱码欧美一区二区| 最新成人av在线| 婷婷成人激情在线网| 日本一二三四高清不卡| 91丨porny丨首页| 欧美日韩一二三区| 中文字幕高清一区| 日本亚洲三级在线| 成人精品在线视频观看| 5858s免费视频成人| 日韩美女精品在线| 久久99久久久久久久久久久| 色天使久久综合网天天| 久久精品网站免费观看| 蜜臀久久久久久久| 色婷婷综合久久久中文字幕| 欧美精品一区二| 日本女优在线视频一区二区| 色婷婷综合久久| 国产精品视频观看| 免费精品视频在线| 91传媒视频在线播放| 亚洲欧美自拍偷拍| 国产精品亚洲专一区二区三区| 欧美一区二区三区精品| 天堂久久一区二区三区| 欧美电影在线免费观看| 日韩精品国产欧美| 欧美成人性战久久| 国内精品免费在线观看| 久久日一线二线三线suv| 天天做天天摸天天爽国产一区| 欧美亚洲愉拍一区二区| 亚洲午夜国产一区99re久久| 欧美在线你懂得| 亚洲男人的天堂在线aⅴ视频| 91原创在线视频| 香蕉久久一区二区不卡无毒影院| 99视频国产精品| 日韩电影一二三区| 成人一区二区视频| 成人精品国产一区二区4080| 中文字幕成人在线观看| av不卡免费在线观看| 亚洲国产一区二区视频| 欧美成人乱码一区二区三区| 国产一区二区网址| 亚洲国产一区二区三区青草影视| 欧美精品亚洲二区| 久久爱另类一区二区小说| 国产精品不卡一区| 91精品国产aⅴ一区二区| 国产91在线|亚洲| 偷拍与自拍一区| 亚洲男人的天堂网| 国产欧美一区二区精品仙草咪| 在线日韩av片| 波多野结衣视频一区| 人人超碰91尤物精品国产| 国产精品免费av| 久久精品亚洲精品国产欧美kt∨ | 亚洲精品一区二区三区99| 欧美少妇bbb| 一本久道久久综合中文字幕| 国产99一区视频免费| 国产一区在线观看麻豆| 五月天一区二区| 日韩精品一卡二卡三卡四卡无卡| 亚洲精品伦理在线| 亚洲女女做受ⅹxx高潮| 亚洲另类春色国产| 伊人婷婷欧美激情| 亚洲色图欧美激情| 亚洲精品国产a久久久久久| 1000部国产精品成人观看| 国产精品免费网站在线观看| 国产精品丝袜91| 亚洲色图一区二区| 香蕉加勒比综合久久| 蜜臀精品一区二区三区在线观看 | 日韩欧美国产综合一区| 在线播放欧美女士性生活| 欧美电影免费观看高清完整版在线 | 国产v日产∨综合v精品视频| 国产成人无遮挡在线视频| 国产超碰在线一区| 91在线播放网址| 欧美日韩一区二区三区视频 | 综合久久给合久久狠狠狠97色| 中文字幕一区二区三区乱码在线| 亚洲一区二区三区爽爽爽爽爽| 无吗不卡中文字幕| 丰满少妇久久久久久久| 欧美色图激情小说| 欧美xxx久久| 午夜视频久久久久久|