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

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

?? intel28f640_16x1.c

?? umon bootloader source code, support mips cpu.
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/* intel28f640_16x1.c:
 * Support for INTEL 28f640 or the 28f128 (double the size of the 640).
 * Bank configuration is as a single 16-bit device.
 */
#include "config.h"
#if INCLUDE_FLASH
#ifdef PIF_FLASH
#include "endian.h"
#include "stddefs.h"
#include "genlib.h"
#include "cpu.h"
#include "flash.h"
#include "intel28f640_16x1.h"
//stone added
#include "Pif.h"
#include "risc.h"
#include "28F640J3.h"
//stone added end
#define FLASHCFG_16x1	1
#include "strata.h"

/* Manufacturer and device id... */
#define INTEL_DT28F128J5		0x00890018
#define INTEL_28F640			0x00890017
#define INTEL_DT28F640J5		0x00890015
#define ST_M58LW064D			0x00200017

/*
*************************************************************************************
*                                       PifPCMCIAModeRegSet
*
* Description: Set rPIF_PCI_CTL.
*
* Arguments  : mode         can be the following values:
*                             PIF_BOOT_MODE;
*                             PIF_CBUS_MODE;
*                             PIF_DBUS_MODE
*              mstr-bs      It specifies the burst size on the memory bus for master 
*                           transactions. can be:
*                             PCMCIA_MSTR_BS_8BYTE
*                             PCMCIA_MSTR_BS_16BYTE
*                             PCMCIA_MSTR_BS_32BYTE
*                             PCMCIA_MSTR_BS_64BYTE
*
* Return     : none.
*
* Note(s)    : 
*************************************************************************************
*/
void PifPCMCIAModeRegSet(int mode, int mstr_bs)
{
    rPIF_PCI_CTL = (mode<<26) | (mstr_bs<<21);                  
}

/*
*************************************************************************************
*                                       PifTimingRegSet
*
* Description: Set rPIF_PCI_TIM.
*
* Arguments  : setup         controls the setup time from PCMCIA CS on to the 
*                            OE/WE/IOWR/IORD strobe on. It’s the PIF clock cycles.
*              hold          controls the hold time from the OE/WE/IOWR/IORD strobe 
*                            off to the CS.
*              interval      controls the interval of the OE/WE/IOWR/IORD on time.
*              wait_cycle    This field is useful when 'swait' bit is 1. It is the 
*                            idle cycles between each access started from asserting CS.
*              ioack_wait    can be:
*                              PIF_WAIT_INPACK - wait for 'inpack' signal during IORD
*                              PIF_NO_WAIT - don’t care 'inpack' signal
*              pimcia_width  can be:
*                              PCMCIA_WIDTH_8BIT – PCMCIA data is 8 bit wide
*                              PCMCIA_WIDTH_16BIT – PCMCIA data is 16 bit wide
*                              PCMCIA_WIDTH_DEPEND – PCMCIA width is depending on 
*                                                    'is_16bit' pin input
*              wait          can be:
*                              PCMCIA_CHECK_WAIT – PCMCIA check the ‘wait’ input 
*                                                  pin during OE/WE/IOWR/IORD pulse
*                              PCMCIA_NO_CHECK – PCMCIA doesn’t check ‘wait’ input pin
*              swait         can be:
*                              PCMCIA_INSERT_IDLE – PCMCIA insert idle cycles for 
*                                                   specified cycles before actual
*                                                   transfer cycle
*                              PCMCIA_NO_INSERT – PCMCIA doesn’t insert idle cycles
*              devID         controls which PCMCIA device to access. One of the 
*                            4 CS signals are enabled according to:
*                              PIF_CS0
*                              PIF_CS1
*                              PIF_CS2
*                              PIF_CS3
*
*              xfr_type      can be:
*                              PIF_IORD - IO read use IORD
*                              PIF_IOWR - IO write use IOWR
*                              PIF_OE - memory read use OE
*                              PIF_WE - memory write use WE
*
* Return     : none.
*
* Note(s)    : 
*********************************************************************************************
*/
void PifTimingRegSet(int setup, int hold, int interval, int wait_cycle, int ioack_wait,\
                     int pcmcia_width, int wait, int swait, int devID, int xfr_type)
{
    rPIF_PCI_TIM = setup | (hold<<4) | (interval<<8) | (wait_cycle<<16) | (ioack_wait<23)|\
                   (pcmcia_width<<24) | (wait<<26) | (swait<<27) | (devID<<28) |\
                   (xfr_type<<30);	
}


/*
*********************************************************************************************
*                                       PifWaitTillDone
*
* Description: It is a delay function, waiting the master transaction is finished.
*
* Arguments  : none
*
* Return     : none.
*
* Note(s)    : 
*********************************************************************************************
*/
void PifWaitTillDone(void)
{
    /* Wait till the busy bit is clear & the done bit is set */	
    while(rPIF_INTR & 0x60000000 ^ (0x1<<29));
    
    /* Clear the done bit */
    PIF_DONE_CLEAR();	
}

/*
**************************************************************************************
*                                       NorFlashPifInit
*
* Description: initialize the PCMCIA interface
*
* Arguments  : devID     controls which PCMCIA device to access. 
*                                  0 – CS0
*                                  1 – CS1
*                                  2 – CS2
*                                  3 – CS3
*                            For Virtex-4, devID = 0.
*
* Return     : none
*
* Note(s)    : Before any Nor flash operations, you should call it at first.
**************************************************************************************
*/
/*4> word 0xa80a0000
0x04000000
5> word 0xa80a0010
0x890F0FFF
6>*/ 
void NorFlashPifInit(void)
{
    unsigned int tmp;
    
    PifPCMCIAModeRegSet(PIF_CBUS_MODE, PCMCIA_MSTR_BS_8BYTE);    
    
    PifTimingRegSet(0xf /* setup */, 0xf /* hold */, 0xf /* interval */, \
                    0xf /* wait_cycle */, PIF_NO_WAIT /* ioack_wait */, \
                    PCMCIA_WIDTH_16BIT /* pcmcia_width */, PCMCIA_NO_CHECK /* wait */, \
                    PCMCIA_INSERT_IDLE /* swait */, PIF_CS0 /* devID */, \
                    PIF_OE /* xfr_type */);
    
    PIF_INTR_DIS();       // Disable the PIF interrupts
    PIF_DONE_CLEAR();     // Clear the bit done
    
    tmp = *(unsigned int *)0xa80a001c;
    tmp &= 0x7fffffff;
    *(unsigned int *)0xa80a001c = tmp;
}

/*
*********************************************************************************************
*                                       NorFlashRd
*
* Description: read the data from the specified address.
*
* Arguments  : start_addr       is the start byte address.
*              data             is the data pointer.
*              number           is the data of number to be read. It is counted by half-words.
*
* Return     : none.
*
* Note(s)    : 
*********************************************************************************************
*/
void NorFlashRd(int start_addr, short *data, int number)
{
    unsigned int i, tmp;	        

    PIF_READ_SET();
    rPIF_PCI_LEN = 2;          // rPIF_PCI_LEN is counted by bytes.  	
        
    for(i = 0; i < number; i++) {
    	rPIF_PCI_DEV_A = start_addr;    // the byte address
    	start_addr += 2;	    	
    	PIF_START();    	
        *data++ = rPIF_PCMCIA_DATA;	        
    }
}

/*
*********************************************************************************************
*                                       NorFlashRdData
*
* Description: read the data from the specified address.
*
* Arguments  : start_addr       is the start byte address.
*              data             is the data pointer.
*              number           is the data of number to be read. It is counted by half-words.
*
* Return     : none.
*
* Note(s)    : 
*********************************************************************************************
*/
void NorFlashRdData(int start_addr, short *data, int number)
{
    int i;	
	
    /* The read array command */	
    PIF_WRITE_SET();
    rPIF_PCI_LEN = 2;
    PIF_START();
    rPIF_PCMCIA_DATA = NOR_FLASH_RD_ARRAY;
    
    PifWaitTillDone();           // Wait till the first cycle complete
    
    NorFlashRd(start_addr, data, number);    	
}

/*
*********************************************************************************************
*                                       NorFlashRdID
*
* Description: read the manufacture ID, device ID, and block lock configuration.
*
* Arguments  : mID              is the manufacture ID pointer.
*              deviceID         is the device ID pointer.
*              block_lock_cfg   is the block lock configuration.
*
* Return     : none.
*
* Note(s)    : 
*********************************************************************************************
*/
void NorFlashRdID(short *mID, short *deviceID, short *block_lock_cfg)
{
    short status;
    	
    PIF_WRITE_SET();
    rPIF_PCI_LEN = 2;
    PIF_START();
    rPIF_PCMCIA_DATA = NOR_FLASH_RD_ID;
    
    PifWaitTillDone();         // Wait till the first cycle complete	
    
    NorFlashRd(0, mID, 1);
    NorFlashRd(2, deviceID, 1);
    NorFlashRd(4, block_lock_cfg, 1);
}

/*
*********************************************************************************************
*                                       NorFlashProg
*
* Description: program a half-word into the specified address
*
* Arguments  : addr     is the byte address. 
*              data     is the half-word to be programmed.
*
* Return     : SUCCESSFUL  shows the erasure is successful.
*              FAILED      shows the erasure is failed.
*
* Note(s)    : 
*********************************************************************************************
*/
int NorFlashProg(int addr, short data)
//int NorFlashProg(unsigned char *addr, unsigned char *data)
{
    short status;
    	
    /* the first cycle */	
    PIF_WRITE_SET();
    rPIF_PCI_LEN = 2;
    PIF_START();
    rPIF_PCMCIA_DATA = NOR_FLASH_PROG_WORD;
    
    PifWaitTillDone();         // Wait till the first cycle complete
    
    /* the second cycle */	
    rPIF_PCI_DEV_A = addr;     // the byte address
    PIF_START();
    rPIF_PCMCIA_DATA = data;
    
    PifWaitTillDone();         // Wait till the second cycle complete
    
    status = 0x0;
    
    while(!(status & 0x80)) {     // Flash is busy?
        NorFlashRd(0, &status, 1);
    }
    if(status & 0x1a)             // Whether the SR1 SR3 or SR4 is set
        return FAILED;
    return SUCCESSFUL;
}


/* Intel28f640_16x1_erase():
 * Erase sector 'snum'.
 * Return 0 if success, else negative.
 */
int
Intel28f640_16x1_erase(struct flashinfo *fdev,int snum)
{

	short status;
    	
    /* the first cycle of block erase */	
    PIF_WRITE_SET();
    rPIF_PCI_LEN = 2;
    rPIF_PCI_DEV_A = fdev->sectors[snum].begin;    // the byte address
    PIF_START();
    rPIF_PCMCIA_DATA = NOR_FLASH_ERASE_BLOCK1;
    
    PifWaitTillDone();         // Wait till the first cycle complete
    
    /* the second cycle of block erase */	
    PIF_START();
    rPIF_PCMCIA_DATA = NOR_FLASH_ERASE_BLOCK2;
    
    PifWaitTillDone();         // Wait till the second cycle complete
    
    status = 0x0;
    
    while(!(status & 0x80)) {     // Flash is busy?
        NorFlashRd(0, &status, 1);
    }
    if(status & 0x30)             // Whether the SR4 or SR5 is set
        {
		printf("erase sec[%d] error\r\n",snum);
		return -1;
    	}
	printf("erase sec[%d] successful\r\n",snum);
    return 0;
	//return 0;//zx debug
/*	
	// Issue the setup/confirm sequence:
	
	STRATACMD_BLOCKERASE(fdev->sectors[snum].begin);
	STRATACMD_CONFIRM(fdev->sectors[snum].begin);

	// Wait for completion:
	
	WAIT_FOR_WSMS_STATUS_READY();

	// Cleanup:
	 
	STRATACMD_CLEARSTATUS();
	STRATACMD_READARRAY();
	WAIT_FOR_FF(fdev->sectors[snum].begin);
	return(0);
*/
}

/* EndIntel28f640_16x1_erase():
 * Function place holder to determine the end of the above function.
 */
void
EndIntel28f640_16x1_erase(void)
{}

int
Intel28f640_16x1_write(struct flashinfo *fdev,uchar *dest,uchar *src,
	long bytecnt)
{
	int		i,addr;
	short	data;
	uchar	temp;

	addr = dest;
	for(i = 0; i < bytecnt/2; i ++) {
		//printf("current char : %c\r\n",src[i]);
		temp = *src++;
		data = (*src<<8) | temp;
		/*data = *src<<8;
		src++;
		data |= *src;*/
		//printf("program data is 0x%x\t Addr is:0x%x\r\n",data,addr);
		NorFlashProg(addr, data);
		//printf("After program\r\n");
		/* Flash program setup command */
		addr +=2;
		src++;
	}
	printf("Write %d byte OK!\r\n",bytecnt);
	
}

int
Intel28f640_16x1_write1(struct flashinfo *fdev,uchar *dest,uchar *src,
	long bytecnt)
{
	volatile int	tot, ret;
	int				i, giveup, aligntot, size;
	volatile uchar	buf[BUFFER_SIZE], *aligndest, *block;

	return 0;//zx debug
	
	/* The write buffer can only be used on 32-byte blocks; hence, the
	 * low 5 bits of the destination must be zero at the start of a 
	 * buffer write.  This means that we must align the destination
	 * address on this boundary.  To do this, we decrement the destination
	 * address until the alignment is reached, then load that space with
	 * the same data that is already there.
	 */ 
	aligntot = 0;
	aligndest = dest;
	while(((ulong)aligndest & BUFFER_ALIGN) != 0) {
		aligndest--;
		aligntot++;
		bytecnt++;
	}

	ret = tot = 0;
	while((tot < bytecnt) && (ret == 0)) {
		size = bytecnt - tot;
		if (size > BUFFER_SIZE)
			size = BUFFER_SIZE;

		block = aligndest;

		/* Copy buffer's worth of data into local buffer just in
		 * case the source is this flash device.
		 */
		for(i=0;i<size;i++) {
			if (aligndest < dest)
				buf[i] = *aligndest++;
			else
				buf[i] = *src++;
		}
		if (size & 1) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久毛片软件| 波多野结衣中文字幕一区| 日本一区二区三区国色天香 | 97精品国产露脸对白| 久久99国内精品| 美女视频黄a大片欧美| 奇米影视在线99精品| 蜜臀精品一区二区三区在线观看| 日本视频在线一区| 蜜桃免费网站一区二区三区| 精品无人码麻豆乱码1区2区| 国产在线乱码一区二区三区| 国产成人啪免费观看软件| 国产经典欧美精品| 色综合久久久久久久| 欧美色图一区二区三区| 日韩一级片在线观看| 久久精品夜夜夜夜久久| 中文字幕亚洲区| 一二三四社区欧美黄| 天天综合天天做天天综合| 免费观看在线综合| 成人午夜在线视频| 91久久香蕉国产日韩欧美9色| 欧美日韩国产天堂| 久久九九影视网| 亚洲欧美电影一区二区| 亚洲国产一二三| 国产综合久久久久影院| 91麻豆国产精品久久| 欧美精品第1页| 国产日本欧美一区二区| 亚洲与欧洲av电影| 国产一区二区按摩在线观看| 岛国av在线一区| 制服.丝袜.亚洲.中文.综合| 久久精品欧美一区二区三区不卡| 中文字幕一区二区三区不卡在线 | 亚洲成年人网站在线观看| 精品中文字幕一区二区小辣椒| 成人免费视频caoporn| 91精品国模一区二区三区| 欧美国产1区2区| 蜜臀久久久99精品久久久久久| 色悠悠亚洲一区二区| 欧美精品一区二区在线播放| 亚洲一区影音先锋| 大陆成人av片| 久久久午夜精品理论片中文字幕| 亚洲在线成人精品| 91网站在线观看视频| 久久免费午夜影院| 久久国产精品一区二区| 欧美日韩中文精品| 亚洲欧美成人一区二区三区| 成人丝袜视频网| 日韩亚洲欧美中文三级| 亚洲成人在线免费| 99r国产精品| 日韩一区二区精品在线观看| 亚洲欧美电影一区二区| 国产成人综合网| 欧美另类z0zxhd电影| 一片黄亚洲嫩模| 色一情一伦一子一伦一区| 国产精品免费av| 成人性生交大合| 国产精品视频在线看| 国产精品正在播放| 精品国产乱码久久久久久闺蜜| 亚洲mv在线观看| 欧美午夜精品免费| 亚瑟在线精品视频| 欧美偷拍一区二区| 偷偷要91色婷婷| 欧美日韩国产一级二级| 亚洲情趣在线观看| 欧美亚洲国产一区二区三区va | 亚洲精选在线视频| caoporen国产精品视频| 亚洲天堂网中文字| 欧洲一区二区三区免费视频| 亚洲精品久久嫩草网站秘色| 欧美怡红院视频| 亚洲v中文字幕| 欧美日韩国产免费| 免费高清视频精品| 精品国产髙清在线看国产毛片| 激情五月激情综合网| 久久丝袜美腿综合| 99久久国产免费看| 亚洲国产精品综合小说图片区| 欧美日韩精品免费| 久久激情综合网| 国产日韩欧美综合一区| 99精品偷自拍| 五月婷婷欧美视频| 精品成人私密视频| 成人av网址在线| 偷窥少妇高潮呻吟av久久免费| 欧美一级免费观看| 国产成人精品综合在线观看 | 久久国产尿小便嘘嘘| 2021中文字幕一区亚洲| 顶级嫩模精品视频在线看| 亚洲一区二区欧美日韩| 欧美成人在线直播| 91在线小视频| 毛片不卡一区二区| 亚洲欧美国产毛片在线| 91精品国产一区二区三区香蕉| 国产麻豆91精品| 亚洲中国最大av网站| 久久久综合网站| 欧美丰满嫩嫩电影| 成人精品免费看| 青青草91视频| 亚洲精品一二三四区| 久久综合国产精品| 欧美丝袜自拍制服另类| 国产福利精品导航| 日韩和欧美一区二区三区| 国产精品亲子伦对白| 日韩三级在线免费观看| 国产 日韩 欧美大片| 婷婷久久综合九色国产成人 | 欧美日韩成人综合天天影院| 国产精品一区二区果冻传媒| 亚洲国产视频一区二区| 亚洲欧洲精品天堂一级| 欧美成人一级视频| 7777精品伊人久久久大香线蕉超级流畅| 国产精品99久久久久久宅男| 婷婷六月综合亚洲| 一区二区三区四区在线播放 | 亚洲精品日产精品乱码不卡| 精品成人佐山爱一区二区| 欧美日韩国产综合草草| 97久久超碰国产精品| 国产精品亚洲第一区在线暖暖韩国| 偷拍一区二区三区| 亚洲综合色区另类av| 亚洲日本电影在线| 国产精品久久777777| 欧美激情一区二区三区四区| 亚洲精品一区二区三区福利| 精品国产乱码久久久久久牛牛 | 国产福利视频一区二区三区| 美女一区二区在线观看| 日韩综合小视频| 日日夜夜精品视频免费 | 精品国产伦一区二区三区观看体验| 欧美三级在线视频| 欧美婷婷六月丁香综合色| 日本丰满少妇一区二区三区| av高清不卡在线| 97精品视频在线观看自产线路二| 99综合电影在线视频| 成人av午夜电影| 91免费观看视频| 色爱区综合激月婷婷| 色94色欧美sute亚洲线路一ni| 欧美在线一二三| 欧美久久久久中文字幕| 日韩限制级电影在线观看| 欧美一级免费大片| 国产亚洲欧美在线| 国产精品国产成人国产三级| 亚洲欧美影音先锋| 亚洲成人综合网站| 免费观看在线色综合| 国产91在线看| 91天堂素人约啪| 欧美日韩和欧美的一区二区| 日韩一级片网站| 中文字幕亚洲精品在线观看| 一区二区三区蜜桃| 久久成人精品无人区| 国产精品中文字幕欧美| 91久久国产最好的精华液| 3atv一区二区三区| 亚洲国产精品精华液ab| 一区二区视频在线看| 亚洲18女电影在线观看| 国产91高潮流白浆在线麻豆| 不卡的电影网站| 6080yy午夜一二三区久久| 久久久久亚洲蜜桃| 亚洲在线中文字幕| 日韩综合小视频| 国产成人精品一区二区三区网站观看| 成人av动漫网站| 欧美大片一区二区三区| 国产精品女同互慰在线看| 三级精品在线观看| 99re成人在线| www久久精品| 一区视频在线播放| 国产在线精品一区二区三区不卡 | 欧美日韩电影一区|