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

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

?? norflashamd.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_AMD.
#define AMD_CMD_IDOUT         0x00F0
#define AMD_CMD_CFI           0x0098
#define AMD_CMD_IDIN          0x0090
#define AMD_CMD_UNLOCK_1      0x00AA
#define AMD_CMD_UNLOCK_2      0x0055
#define AMD_CMD_ERASE_SETUP   0x0080
#define AMD_CMD_ERASE_RESUME  0x0030
#define AMD_CMD_ERASE_CHIP    0x0010
#define AMD_CMD_ERASE_SECTOR  0x0030
#define AMD_CMD_PROGRAM       0x00A0
#define AMD_CMD_UNLOCK_BYPASS 0x0020

// Command offset for vendor command set CMD_SET_AMD
#define AMD_OFFSET_UNLOCK_1   0x05555
#define AMD_OFFSET_UNLOCK_2   0x0AAAA
/// Query command address.
#define FLASH_ADDRESS_CFI     0x0055

/// AMD norflash device Identifier infomation address offset.
#define AMD_MANU_ID           0x00
#define AMD_DEVIDE_ID         0x01

// Data polling mask for vendor command set CMD_SET_AMD
#define AMD_POLLING_DQ7       0x80
#define AMD_POLLING_DQ6       0x60
#define AMD_POLLING_DQ5       0x20
#define AMD_POLLING_DQ3       0x08


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

//------------------------------------------------------------------------------
/// It implements a RESET command.
/// \param pNorFlashInfo  Pointer to an NorFlashInfo instance.
/// \param address  Dummy data for AMD.
//------------------------------------------------------------------------------
void amd_Reset(struct NorFlashInfo *pNorFlashInfo, unsigned int address)
{
    unsigned char busWidth;
    
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1), 
                 AMD_CMD_UNLOCK_1);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_2), 
                 AMD_CMD_UNLOCK_2);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
                 AMD_CMD_IDOUT);
}


//------------------------------------------------------------------------------
/// Read specified manufactory id or device id.
/// \param pNorFlashInfo  Pointer to an NorFlashInfo instance.
/// \param index 0: manufactorid 1: device id.
//------------------------------------------------------------------------------
unsigned int amd_ReadIdentification(
    struct NorFlashInfo *pNorFlashInfo, 
    unsigned char index)
{
    unsigned int id;
    unsigned char busWidth;
    unsigned int address;
    
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    
    // The amd_Read identification command sequence is initiated by first
    // writing two unlock cycles. 
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
                 AMD_CMD_UNLOCK_1);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_2), 
                 AMD_CMD_UNLOCK_2);
                 
    // Followed by a third write cycle that contains the autoselect command.
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1), 
                 AMD_CMD_IDIN);
    
    // The device then enters the autoselect mode. It may read at any address any 
    // number of times without initiating another autoselect command sequence.   
    address = NorFlash_GetByteAddressInChip(pNorFlashInfo, index);
    ReadRawData(busWidth, address, (unsigned char*)&id);

    // The system must write the exit command to return to the read mode
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
                 AMD_CMD_UNLOCK_1);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_2),
                 AMD_CMD_UNLOCK_2);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
                 AMD_CMD_IDOUT);
    return id;
}
//------------------------------------------------------------------------------
/// It implement a program word command. Returns 0 if the operation was
/// successful; otherwise returns an error code.
/// \param pNorFlashInfo  Pointer to an NorFlashInfo instance.
/// \param address Start address offset to be wrote.
/// \param data word to be written.
//------------------------------------------------------------------------------
unsigned char amd_Program(
    struct NorFlashInfo *pNorFlashInfo,
    unsigned int address,
    unsigned int data)
{
    unsigned int pollingData;
    unsigned int busAddress;
    unsigned char done = 0;
    unsigned char busWidth;
    
    busWidth = NorFlash_GetDataBusWidth(pNorFlashInfo);
    // The program command sequence is initiated by writing two unlock write cycles.
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
                 AMD_CMD_UNLOCK_1);
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_2), 
                 AMD_CMD_UNLOCK_2);
    // Followed by the program set-up command.               
    WriteCommand(busWidth, 
                 NorFlash_GetByteAddressInChip(pNorFlashInfo, AMD_OFFSET_UNLOCK_1),
                 AMD_CMD_PROGRAM);
                 
    // The program address and data are written next, 
    // which in turn initiate the Embedded Program algorithm.
    busAddress = NorFlash_GetAddressInChip(pNorFlashInfo, address);
    WriteRawData(busWidth, busAddress, (unsigned char*)&data);
    
    // Data polling 
    do {
        ReadRawData(busWidth, busAddress, (unsigned char *)&pollingData);
        // Check if the chip program algorithm is completed.
        if ((pollingData & AMD_POLLING_DQ7) == (data & AMD_POLLING_DQ7)) {
            // Program operation successful. Device in read mode.
            done = 1;
        }
        else {
            // check if chip Program algrithm exceeded timing limits
            
            if (pollingData & AMD_POLLING_DQ5 ) {
            
                // I/O should be rechecked.
                ReadRawData(busWidth, busAddress, (unsigned char *)&pollingData);
                
                if ((pollingData & AMD_POLLING_DQ7) == (data & AMD_POLLING_DQ7)) {
                    // Program operation successful. Device in read mode.
                    done = 1;
                }
                else {
                    // Program operation not successful, write reset command.
                    amd_Reset(pNorFlashInfo, 0);
                    return NorCommon_ERROR_CANNOTWRITE;
                }
            }
        }
    } while (!done);
    return 0;
}

//------------------------------------------------------------------------------
//         Exported functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// It implements a RESET command.
/// \param pNorFlashInfo  Pointer to an NorFlashInfo instance.
/// \param address  Dummy data for AMD.
//------------------------------------------------------------------------------
void AMD_Reset(struct NorFlashInfo *pNorFlashInfo, unsigned int address)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费看片在线观看| 亚洲大型综合色站| 一区二区三区电影在线播| 91免费版pro下载短视频| 亚洲日穴在线视频| 波多野结衣在线一区| 久久久精品黄色| 成人免费三级在线| 日韩欧美激情在线| 亚洲mv大片欧洲mv大片精品| 在线观看国产一区二区| 亚洲成av人片www| 精品sm在线观看| 风流少妇一区二区| 成人av中文字幕| 欧美一区二区播放| 国产aⅴ综合色| 亚洲自拍偷拍欧美| 欧美色网站导航| 激情综合一区二区三区| 中文字幕中文字幕在线一区| av亚洲精华国产精华精| 奇米综合一区二区三区精品视频 | 国产目拍亚洲精品99久久精品| 艳妇臀荡乳欲伦亚洲一区| 日韩午夜激情免费电影| av福利精品导航| 久久99精品国产.久久久久久| 亚洲综合一区二区三区| 中文字幕国产一区| 久久蜜桃一区二区| 国产午夜精品久久久久久久| 欧美一级理论片| 日韩精品在线一区| 久久久久高清精品| 亚洲国产日韩综合久久精品| 日韩欧美黄色影院| 精品国产乱码久久久久久浪潮| 99国产精品国产精品久久| 免费观看日韩av| 久久精品国产在热久久| 成人黄色大片在线观看| 菠萝蜜视频在线观看一区| 成人免费视频视频| 91浏览器打开| 制服.丝袜.亚洲.另类.中文 | 国产精品色一区二区三区| 国产精品欧美综合在线| 亚洲日本护士毛茸茸| 亚洲精品免费在线观看| 亚洲综合精品久久| 日韩成人免费看| 高清beeg欧美| 欧美午夜在线观看| 欧美日韩一级二级| 精品免费日韩av| 亚洲精品菠萝久久久久久久| 国产精品福利在线播放| 天天综合色天天综合色h| 懂色av一区二区夜夜嗨| 成人午夜私人影院| 欧美一区二区三区免费观看视频 | 亚洲综合激情网| 国产精品白丝av| 欧美岛国在线观看| 亚洲成人午夜电影| www.66久久| 欧美大度的电影原声| 亚洲影视在线播放| 99在线精品免费| 中文字幕va一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎| 在线观看免费亚洲| 国产亚洲婷婷免费| 欧美电影免费提供在线观看| 18欧美乱大交hd1984| 蜜桃视频在线观看一区二区| 精品视频999| 午夜精品一区二区三区免费视频| 99视频超级精品| 国产精品亲子乱子伦xxxx裸| 国产二区国产一区在线观看| 精品国产髙清在线看国产毛片| 一区二区在线免费| 99v久久综合狠狠综合久久| 中文文精品字幕一区二区| 国内精品国产成人国产三级粉色| 久久精品国产**网站演员| 蜜桃一区二区三区四区| 日韩一区国产二区欧美三区| 视频在线观看91| 欧美不卡视频一区| 国产乱码字幕精品高清av| 国产欧美一区二区三区沐欲| av一区二区三区四区| 日韩主播视频在线| 欧美mv和日韩mv的网站| 日韩电影免费在线| 欧美国产在线观看| 欧美日韩国产欧美日美国产精品| 久久不见久久见中文字幕免费| 国产人久久人人人人爽| 91黄视频在线| 国产酒店精品激情| 亚洲大片一区二区三区| 久久精品一级爱片| 欧美三级日韩三级| 国产宾馆实践打屁股91| 亚洲美女在线国产| 国产精品全国免费观看高清| 精品国内片67194| 丁香六月久久综合狠狠色| 麻豆精品国产传媒mv男同| 一区二区三区鲁丝不卡| 国产日本一区二区| 亚洲素人一区二区| 亚洲私人影院在线观看| 久久久99免费| 午夜欧美在线一二页| 91首页免费视频| 国产毛片一区二区| 成人av电影在线观看| 91丝袜美女网| 欧美日韩欧美一区二区| 欧美日本视频在线| 亚洲精品一区二区三区在线观看| 久久久一区二区三区| 国产精品入口麻豆原神| 亚洲一区二区视频| 久久精品av麻豆的观看方式| 懂色av中文字幕一区二区三区| 91香蕉视频黄| 精品国产污污免费网站入口 | 久久久久国色av免费看影院| 国产欧美一区二区精品性| 中文字幕中文字幕在线一区| 日本视频一区二区三区| 婷婷中文字幕综合| 波多野结衣亚洲| 精品久久久久一区| 视频一区二区三区中文字幕| 成人免费的视频| 日韩你懂的在线观看| 亚洲另类春色校园小说| 国产精品99久久久久久宅男| 欧美一区二区三区四区视频 | 国产欧美日韩另类视频免费观看 | 中文字幕一区二区三| 国产精品99久久久久| 国产调教视频一区| 国产乱国产乱300精品| 精品国产第一区二区三区观看体验| 亚洲国产人成综合网站| 欧洲精品中文字幕| 一区二区欧美精品| 欧美撒尿777hd撒尿| 亚洲一区二区美女| 欧美三级日本三级少妇99| 亚洲免费高清视频在线| 欧美日韩国产精选| 亚洲高清在线视频| 欧美精品vⅰdeose4hd| 午夜欧美电影在线观看| 精品国内二区三区| 99re这里只有精品首页| 亚洲美女一区二区三区| 欧美一区二区大片| 99在线视频精品| 免费成人你懂的| 日本一区二区成人在线| 欧美日韩一本到| 国产精品资源在线| 一区二区三区av电影| 日韩一区二区精品在线观看| 国产美女精品在线| 亚洲电影视频在线| 国产精品污网站| 日韩色在线观看| 色综合久久精品| 高清不卡在线观看| 免费人成在线不卡| 亚洲成人一二三| 亚洲乱码国产乱码精品精小说| 欧美美女一区二区在线观看| av电影在线不卡| 麻豆视频观看网址久久| 日韩久久久精品| 99riav一区二区三区| 亚洲一二三四在线观看| 不卡影院免费观看| 国模娜娜一区二区三区| 亚洲综合色自拍一区| 国产精品国产a| 欧美激情一区二区三区不卡| 久久夜色精品国产噜噜av| 欧美亚一区二区| youjizz久久| 99re在线视频这里只有精品| 国产成人免费视频网站| 国产一区二区免费看|