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

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

?? rtl8019.c

?? AT45DB161D的測試程序.rar
?? C
?? 第 1 頁 / 共 2 頁
字號:
#include "rtl8019.h"
//#include<stdio.h>

#define _BV(x)	   (1<<x)
extern void sendinthex1(int c);
extern void sendchar1(char c); 
extern void sendstring1(unsigned char * txbuf); 
/*****************************************************************************
*  Module Name:       Realtek 8019AS Driver
*  
*  Created By:        Louis Beaudoin (www.embedded-creations.com)
*
*  Original Release:  September 21, 2002 
*
*  Module Description:  
*  Provides functions to initialize the Realtek 8019AS, and send and retreive
*  packets
*
*  November 16, 2003 - Louis Beaudoin
*    The rtl8019Write and Read functions/macros were changed to support
*      three methods of communcating with the NIC
*    Interfacing with the AVR ports changed from sbi/cbi/etc functions
*      to direct port names
*    Renamed functions to be more consistant with the two NIC drivers
*    Overrun function now retransmits if resend is set (thanks Krzysztof)
* 
*  November 15, 2002 - Louis Beaudoin
*    processRTL8019Interrupt() - bit mask mistake fixed
*
*  November 8, 2003 - Louis Beaudoin
*    Changed delay library function calls
*
*  September 30, 2002 - Louis Beaudoin
*    Receive functions modified to handle errors encountered when receiving a
*      fast data stream.  Functions now manually retreive data instead of
*      using the send packet command.  Interface improved by checking for
*      overruns and data in the buffer internally.
*    Corrected the overrun function - overrun flag was not reset after overrun
*    Added support for the Imagecraft Compiler
*    Added support to communicate with the NIC using general I/O ports
*
*****************************************************************************/


/*****************************************************************************
*  rtl8019Write( RTL_ADDRESS, RTL_DATA )
*  Args:        1. unsigned char RTL_ADDRESS - register offset of RTL register
*               2. unsigned char RTL_DATA - data to write to register
*  Created By:  Louis Beaudoin
*  Date:        September 21, 2002
*  Description: Writes byte to RTL8019 register.
*
*  Notes - If using the External SRAM Interface, performs a write to
*            address MEMORY_MAPPED_RTL8019_OFFSET + (RTL_ADDRESS<<8)
*            The address is sent in the non-multiplxed upper address port so
*            no latch is required.
*
*          If using general I/O ports, the data port is left in the input
*            state with pullups enabled
*
*****************************************************************************/
/*
#if NIC_CONNECTION == MEMORY_MAPPED_HIGHADDR
#define rtl8019Write(RTL_ADDRESS,RTL_DATA) do{ *(volatile unsigned char *) \
                             (MEMORY_MAPPED_RTL8019_OFFSET \
                             + (((unsigned char)(RTL_ADDRESS)) << 8)) = \
                             (unsigned char)(RTL_DATA); } while(0)

#endif
*/                             
#if NIC_CONNECTION == MEMORY_MAPPED
#define rtl8019Write(RTL_ADDRESS,RTL_DATA) do{ *(volatile unsigned char *) \
                             (MEMORY_MAPPED_RTL8019_OFFSET \
                             + (unsigned char)(RTL_ADDRESS)) = \
                             (unsigned char)(RTL_DATA); } while(0)

#endif


#if NIC_CONNECTION == GENERAL_IO

void rtl8019Write(unsigned char address, unsigned char data)
{
    // assert the address, leaving the non-address pins intact
    address |= (RTL8019_ADDRESS_PORT & ~RTL8019_ADDRESS_MASK);
    RTL8019_ADDRESS_PORT = address;
    
	// set data bus as output and place data on bus
    RTL8019_DATA_DDR = 0xFF;
    RTL8019_DATA_PORT = data;
    
	// toggle write pin
    RTL8019_CONTROL_PORT &= ~_BV(RTL8019_CONTROL_WRITEPIN);
    nop();
    RTL8019_CONTROL_PORT |= _BV(RTL8019_CONTROL_WRITEPIN);

    
	// set data port back to input with pullups enabled
    RTL8019_DATA_DDR = 0x00;
    RTL8019_DATA_PORT = 0xFF;
    
}

#endif

/*****************************************************************************
*  rtl8019Read(RTL_ADDRESS)
*  Args:        unsigned char RTL_ADDRESS - register offset of RTL register
*  Created By:  Louis Beaudoin
*  Date:        September 21, 2002
*  Description: Reads byte from RTL8019 register
*
*  Notes - If using the External SRAM Interface, performs a read from
*            address MEMORY_MAPPED_RTL8019_OFFSET + (RTL_ADDRESS<<8)
*            The address is sent in the non-multiplxed upper address port so
*            no latch is required.
*
*          If using general I/O ports, the data port is assumed to already be
*            an input, and is left as an input port when done
*
*****************************************************************************/

/*#if NIC_CONNECTION == MEMORY_MAPPED_HIGHADDR

#define rtl8019Read(RTL_ADDRESS) (*(volatile unsigned char *) \
                       (MEMORY_MAPPED_RTL8019_OFFSET \
                       + (((unsigned char)(RTL_ADDRESS)) << 8)) )
#endif
*/                             
#if NIC_CONNECTION == MEMORY_MAPPED

#define rtl8019Read(RTL_ADDRESS) (*(volatile unsigned char *) \
                       (MEMORY_MAPPED_RTL8019_OFFSET \
                       + (unsigned char)(RTL_ADDRESS)) )
#endif

#if NIC_CONNECTION == GENERAL_IO

unsigned char rtl8019Read(unsigned char address)
{
    unsigned char byte;
   
    // assert the address, leaving the non-address pins intact
    address |= (RTL8019_ADDRESS_PORT & ~RTL8019_ADDRESS_MASK);
    RTL8019_ADDRESS_PORT = address;
   
    // assert read
    RTL8019_CONTROL_PORT &= ~_BV(RTL8019_CONTROL_READPIN);
    nop();
   
    // read in the data
    byte = RTL8019_DATA_PIN;

    // negate read
    RTL8019_CONTROL_PORT |= _BV(RTL8019_CONTROL_READPIN);
    }

#endif                       



/*****************************************************************************
*  rtl8019SetupPorts(void);
*
*  Created By:  Louis Beaudoin
*  Date:        September 21, 2002
*  Description: Sets up the ports used for communication with the RTL8019 NIC
*                 (data bus, address bus, read, write, and reset)
*****************************************************************************/
void rtl8019SetupPorts(void)
{

#if NIC_CONNECTION == GENERAL_IO

    // make the address port output
	RTL8019_ADDRESS_DDR = RTL8019_ADDRESS_MASK;
    
    // make the data port input with pull-ups
    RTL8019_DATA_PORT = 0xFF;

	// make the control port read and write pins outputs and asserted
	RTL8019_CONTROL_DDR |= _BV(RTL8019_CONTROL_READPIN);
    RTL8019_CONTROL_DDR |= _BV(RTL8019_CONTROL_WRITEPIN);
	          
	RTL8019_CONTROL_PORT |= _BV(RTL8019_CONTROL_READPIN);
	RTL8019_CONTROL_PORT |= _BV(RTL8019_CONTROL_WRITEPIN);


#else

  	// enable external SRAM interface - no wait states
    MCUCR |= 0x80;//|0x40;//_BV(SREG);//_BV(SRE);0xc0;//
	//XMCRA = 0x40; //0x00 external memory
    XMCRB = 0x00; // 釋放PC7,作為通用I/O引腳使用 

#endif

	// enable output pin for Resetting the RTL8019
	RTL8019_RESET_DDR |= _BV(RTL8019_RESET_PIN);
}



/*****************************************************************************
*  HARD_RESET_RTL8019()
*
*  Created By:  Louis Beaudoin
*  Date:        September 21, 2002
*  Description: Simply toggles the pin that resets the NIC
*****************************************************************************/
#define HARD_RESET_RTL8019() do{ RTL8019_RESET_PORT |= _BV(RTL8019_RESET_PIN);\
                                delay_ms(200); \
                                RTL8019_RESET_PORT &= ~_BV(RTL8019_RESET_PIN);}\
                                while(0)



/*****************************************************************************
*  rtl8019Overrun(void);
*
*  Created By:  Louis Beaudoin
*  Date:        September 21, 2002
*  Description: "Canned" receive buffer overrun function originally from
*                 a National Semiconductor appnote
*  Notes:       This function must be called before retreiving packets from
*                 the NIC if there is a buffer overrun
*****************************************************************************/
void rtl8019Overrun(void);




//******************************************************************
//*	REALTEK CONTROL REGISTER OFFSETS
//*   All offsets in Page 0 unless otherwise specified
//*	  All functions accessing CR must leave CR in page 0 upon exit
//******************************************************************
#define CR		 	0x00
#define PSTART		0x01
#define PAR0      	0x01    // Page 1
#define CR9346    	0x01    // Page 3
#define PSTOP		0x02
#define BNRY		0x03
#define TSR			0x04
#define TPSR		0x04
#define TBCR0		0x05
#define NCR			0x05
#define TBCR1		0x06
#define ISR			0x07
#define CURR		0x07   // Page 1
#define RSAR0		0x08
#define CRDA0		0x08
#define RSAR1		0x09
#define CRDA1		0x09
#define RBCR0		0x0A
#define RBCR1		0x0B
#define RSR			0x0C
#define RCR			0x0C
#define TCR			0x0D
#define CNTR0		0x0D
#define DCR			0x0E
#define CNTR1		0x0E
#define IMR			0x0F
#define CNTR2		0x0F
#define RDMAPORT  	0x10
#define RSTPORT   	0x18
#define CONFIG2     0x05    // page 3
#define CONFIG3     0x06    // page 3
#define RTL_EECR        0x01    // page 3



/*****************************************************************************
*
* RTL ISR Register Bits
*
*****************************************************************************/
#define ISR_RST	7
#define ISR_OVW 4
#define ISR_PRX 0
#define ISR_RDC 6
#define ISR_PTX 1


/*****************************************************************************
*
*  RTL Register Initialization Values
*
*****************************************************************************/
// RCR : accept broadcast packets and packets destined to this MAC
//         drop short frames and receive errors
#define RCR_INIT		0x04

// TCR : default transmit operation - CRC is generated 
#define TCR_INIT		0x00

// DCR : allows send packet to be used for packet retreival
//         FIFO threshold: 8-bits (works)
//         8-bit transfer mode
#define DCR_INIT		0x58

// IMR : interrupt enabled for receive and overrun events
#define IMR_INIT		0x11

// buffer boundaries - transmit has 6 256-byte pages
//   receive has 26 256-byte pages
//   entire available packet buffer space is allocated
#define TXSTART_INIT   	0x40
#define RXSTART_INIT   	0x46
#define RXSTOP_INIT    	0x60



void rtl8019BeginPacketSend(unsigned int packetLength)
{
	unsigned int sendPacketLength;
	sendPacketLength = (packetLength>=ETHERNET_MIN_PACKET_LENGTH) ?
	                 packetLength : ETHERNET_MIN_PACKET_LENGTH ;
	
	//start the NIC
	rtl8019Write(CR,0x22);
	
	// still transmitting a packet - wait for it to finish
	while( rtl8019Read(CR) & 0x04 );

	//load beginning page for transmit buffer
	rtl8019Write(TPSR,TXSTART_INIT);
	
	//set start address for remote DMA operation
	rtl8019Write(RSAR0,0x00);
	rtl8019Write(RSAR1,0x40);
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久综合色| 精品在线亚洲视频| 欧美一区二区三区在线观看| 国产精品白丝jk白祙喷水网站| 亚洲色图另类专区| 制服丝袜亚洲精品中文字幕| 成人黄色大片在线观看| 日韩国产欧美三级| 亚洲日穴在线视频| 2欧美一区二区三区在线观看视频| 色综合久久久网| 福利电影一区二区| 美腿丝袜一区二区三区| 一区二区欧美精品| 国产精品私人自拍| 久久在线观看免费| 欧美一区二区在线免费观看| 91国产丝袜在线播放| 国产91精品一区二区| 免费观看一级特黄欧美大片| 亚洲综合在线电影| 日韩理论片网站| 日韩中文欧美在线| 国产精品久久久久一区二区三区共| 精品国产一区二区亚洲人成毛片| 日本福利一区二区| 91亚洲国产成人精品一区二三| 国产91色综合久久免费分享| 狠狠色综合播放一区二区| 日本成人在线一区| 亚洲va韩国va欧美va精品| 一区二区三区**美女毛片| 亚洲欧美日韩一区二区| 亚洲欧美在线aaa| 中文字幕va一区二区三区| 国产欧美综合色| 中文字幕av一区 二区| 久久视频一区二区| 久久中文字幕电影| 久久综合狠狠综合久久综合88| 日韩免费一区二区三区在线播放| 日韩欧美不卡在线观看视频| 欧美一卡2卡三卡4卡5免费| 日韩一区二区电影在线| 日韩午夜激情视频| 久久综合九色综合97婷婷女人| 日韩精品中午字幕| 2021国产精品久久精品| 国产亚洲综合av| 国产日韩欧美高清在线| 国产精品久久久久四虎| 亚洲区小说区图片区qvod| 亚洲精品日韩专区silk| 亚洲第一搞黄网站| 美女视频一区二区| 国产精品正在播放| 国产.欧美.日韩| 一本大道久久精品懂色aⅴ| 欧美系列日韩一区| 欧美一卡二卡三卡| 2024国产精品视频| 中文字幕人成不卡一区| 亚洲香蕉伊在人在线观| 日韩二区三区在线观看| 韩国精品主播一区二区在线观看 | 成人激情开心网| 不卡一区二区中文字幕| 欧美在线综合视频| 欧美xxxxx牲另类人与| 中文字幕av一区二区三区免费看| 亚洲日本免费电影| 青草国产精品久久久久久| 国产精品亚洲午夜一区二区三区 | 亚洲福利视频一区| 高清在线观看日韩| 亚洲欧洲制服丝袜| 午夜天堂影视香蕉久久| 国产一区二区三区美女| 91一区二区在线| 3d成人h动漫网站入口| 国产亚洲成av人在线观看导航| 最新国产成人在线观看| 丝袜亚洲另类欧美| 国产91在线看| 欧美日韩国产影片| 国产精品丝袜久久久久久app| 亚洲一区二区三区四区中文字幕| 九一九一国产精品| 91看片淫黄大片一级| 日韩免费一区二区| 亚洲精品视频自拍| 麻豆成人av在线| 色综合久久中文综合久久97| 日韩欧美中文字幕公布| 亚洲人成人一区二区在线观看| 毛片av一区二区| 在线视频欧美区| 久久九九久精品国产免费直播| 亚洲午夜久久久久| 成+人+亚洲+综合天堂| 日韩三级高清在线| 亚洲已满18点击进入久久| 成人精品鲁一区一区二区| 欧美一级日韩不卡播放免费| 亚洲裸体xxx| 高清在线不卡av| 欧美xxxxxxxxx| 日韩制服丝袜av| 欧美性猛交xxxx黑人交| 欧美经典一区二区三区| 蜜桃av一区二区在线观看| 在线观看国产91| 亚洲欧美怡红院| 成人精品高清在线| 久久综合成人精品亚洲另类欧美 | 国产精品久久久久久久久搜平片| 日韩一区精品字幕| 欧美午夜一区二区三区免费大片| 国产精品免费av| 成人免费av在线| 国产欧美一区二区三区网站| 国产在线播精品第三| 日韩免费一区二区三区在线播放| 亚洲成av人片一区二区三区| 日本二三区不卡| 亚洲免费av在线| av不卡在线播放| 亚洲男女毛片无遮挡| av在线这里只有精品| 中文字幕乱码一区二区免费| 日本欧美大码aⅴ在线播放| 欧美日韩久久久一区| 亚洲成av人片在线| 欧美亚洲免费在线一区| 亚洲狼人国产精品| 欧美在线三级电影| 一区二区三区中文字幕| 日本高清不卡aⅴ免费网站| 亚洲精品视频一区二区| 色网综合在线观看| 亚洲一区二区三区自拍| 欧美日韩国产电影| 秋霞成人午夜伦在线观看| 91精品中文字幕一区二区三区| 婷婷亚洲久悠悠色悠在线播放| 欧美色图在线观看| 午夜日韩在线电影| 91精品国产91热久久久做人人| 美女视频网站久久| 久久丝袜美腿综合| 波多野结衣一区二区三区| 亚洲欧洲精品一区二区三区| 97精品国产97久久久久久久久久久久| 亚洲私人影院在线观看| 欧美日韩一卡二卡三卡| 男人操女人的视频在线观看欧美| 欧美va亚洲va| 丁香婷婷综合五月| 亚洲精品ww久久久久久p站| 欧美人狂配大交3d怪物一区| 午夜电影网亚洲视频| 久久综合九色综合97_久久久| 成人午夜免费av| 亚洲图片一区二区| 337p日本欧洲亚洲大胆精品| 成人网在线免费视频| 亚洲国产综合人成综合网站| 欧美mv日韩mv国产网站| 99在线精品视频| 午夜私人影院久久久久| 久久综合av免费| 欧美影院一区二区| 精品综合免费视频观看| 国产精品麻豆99久久久久久| 欧美日韩中字一区| 国产精品自拍av| 樱花草国产18久久久久| 精品美女在线播放| 99国产麻豆精品| 久久国产夜色精品鲁鲁99| 国产精品乱人伦一区二区| 欧美视频你懂的| 国产suv精品一区二区三区| 性欧美大战久久久久久久久| 久久色在线视频| 在线播放中文一区| 成人国产精品视频| 日本亚洲免费观看| 亚洲啪啪综合av一区二区三区| 日韩女优av电影| 欧美日韩一区三区四区| 成人性视频免费网站| 日韩精品福利网| 亚洲人xxxx| 国产欧美精品一区二区三区四区 | 国产精品18久久久久久久久久久久 | 91在线视频免费观看| 久久精品国产成人一区二区三区 | 香蕉久久一区二区不卡无毒影院| 国产欧美一区二区精品性|