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

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

?? 8019app.bak

?? 是TCPIP程序
?? BAK
字號:
#ifndef __8019APP_H__
#define __8019APP_H__


#include <8019.h>
#define  BITISR_RX    0x01
#define  BITRSR_RXOK  0x01

void init_8019(void);
void delayms(uchar t);
void dmaread(uchar bc_h,uchar bc_l,uchar st_h,uchar st_l,uchar xdata *saveaddr);//from inram to dmaport
void dmawrite(uchar bc_h,uchar bc_l,uchar st_h,uchar st_l,uchar xdata *writeaddr);//from dmaport to inram
void sendpacket(uchar ct_h,uchar ct_l);//ct_h:msb of count,ct_l:lsb of count
void tx_wait(void);//wait to tx
void recvpacket(void);
void processethpacket(void);
uchar readpacketheader(void);//return if the packet header

void eth_send(uint num);
//void handle_packet(void);
uchar packet_come(void); //if any packet comes


extern uchar xdata *mac;
extern uchar xdata *rcv_hdr;

//uchar xdata *eth;
uchar next_packet;
uchar curr_recv;
bit net_overlow;
bit  flagresend;//sometimes need resend  the packet

uchar curr_use,next_use;
/***********************
void main(void)
{
 uchar temp;
 next_packet=0;
 flagresend=FALSE;
 mac=0;
 rcv_hdr=0x1000;
 eth=&rcv_hdr[4];
 init_8019();
 temp=0;
}
*************************/
void init_8019(void)
{
 uchar xdata *addr;
 uchar temp0,temp1;
 EN_RESET=0x00;
 delayms(2);//delay 2ms
 EN_CMD=EN_PAGE0+EN_NODMA+EN_STOP;// Remote DMA, Stop and reset the chip
 delayms(2);
 EN0_RCNTHI=0;
 EN0_RCNTLO=0;
 EN0_RXCR=ENRXCR_MON;//RX configuration reg,Monitor mode (no packets rcvd)
 EN0_TXCR=ENTXCR_LOOP;//TX configuration reg,set internal loopback mode
 EN0_DCFG=ENDCFG_FT10+ENDCFG_BMS+ENDCFG_WTS;// fifo treshold, Normal operation,
					    // word/byte transfer mode selection
//shit !!!!!!!,in vains
/***********************************************************
 dmaread(0,2*ETHER_ADDR_LEN,0,0,mac);  //get the mac of nic
************************************************************/
 EN_CMD=EN_PAGE0+EN_NODMA ;//Remote DMA
 EN0_STARTPG= RX_START_PG ;//Starting page of ring buffer;First page of RX Ring
 EN0_BOUNDARY= RX_START_PG;//Boundary page of ring buffer
 EN0_STOPPG=NE_STOP_PG    ;//Ending page +1 of ring buffer;End Page = Last page + 1 of RX Ring
 EN0_ISR= -1	;//Interrupt status reg,clear all
 EN0_IMR= 0	;//Interrupt mask reg = Disable All Interrupt


 EN_CMD= EN_PAGE1+EN_NODMA ;//Page 1, Remote DMA

 addr=EN1_PHYS;
 for(temp1=0;temp1<ETHER_ADDR_LEN;temp1++)
  {
   temp0=mac[temp1];
   addr[temp1]=temp0;
  }

 EN_CMD= EN_PAGE1+EN_NODMA+EN_STOP ;//Page 1,Remote DMA, Stop and reset the chip

 addr=EN1_MULT;
 for(temp1=0;temp1<ETHER_ADDR_LEN;temp1++)
 addr[temp1]=0xff;
 EN_CMD= EN_PAGE0+EN_NODMA+EN_START;//Remote DMA, Start the chip, clear reset

 EN_CMD= EN_PAGE1+EN_NODMA+EN_STOP ;//Page 1,Remote DMA, Stop and reset the chip
 EN1_CURPAG= RX_CURR_PG	;//Current memory page = RX_CURR_PG
 EN_CMD= EN_PAGE0+EN_NODMA+EN_START;//Remote DMA, Start the chip, clear reset
 EN0_TXCR= 0	;//TX configuration reg = Normal Operation
 EN0_RXCR= ENRXCR_BCST	;//RX configuration reg = Accept broadcasts
 EN0_ISR= -1	;//Clear the pending Interrupt
 next_packet= RX_CURR_PG;

 curr_use=0;
 next_use=1;

}

void delayms(uchar t)
{
 uchar temp,temp1;
 for(temp=0;temp<t;temp++)
 {
  for(temp1=0;temp1<125;temp1++); //one ++ is about 8us
 }
}

void dmaread(uchar bc_h,uchar bc_l,uchar st_h,uchar st_l,uchar xdata *saveaddr)
{
 uint tempint,tempint1;
 uchar temp;
 tempint=bc_h*0x100+bc_l;
 EN_CMD=EN_PAGE0+EN_NODMA+EN_START;
 EN0_RCNTHI=bc_h	;//MSB Remote byte count reg
 EN0_RCNTLO=bc_l	;//LSB Remote byte count reg
 EN0_RSARHI=st_h	;//MSB Remote start address reg
 EN0_RSARLO=st_l	;//LSB Remote start address reg
 EN_CMD=EN_PAGE0+EN_RREAD+EN_START;//Remote Read, Start the chip, clear reset
 for(tempint1=0;tempint1<tempint;tempint1++)
  {
   temp=EN_DATA;//dma port
   saveaddr[tempint1]=temp;
  }
}

void dmawrite(uchar bc_h,uchar bc_l,uchar st_h,uchar st_l,uchar xdata *writeaddr)
{
 uint xdata tempint,tempint1;
 uchar temp;
 tempint=bc_h*0x100+bc_l;
 EN_CMD= EN_PAGE0+EN_NODMA+EN_START;//Remote DMA, Start the chip, clear reset
 EN0_TCNTHI=bc_h	;//High byte of tx byte count
 EN0_TCNTLO=bc_l	;//Low  byte of tx byte count
 EN0_RSARHI=st_h	;//MSB Remote start address reg
 EN0_RSARLO=st_l	;//LSB Remote start address reg
 EN_CMD= EN_PAGE0+EN_RWRITE+EN_START;//Remote Write, Start the chip, clear reset
 for(tempint1=0;tempint1<tempint;tempint1++)
  {
   temp=writeaddr[tempint1];
   EN_DATA=temp;
  }
}



void sendpacket(uchar ct_h,uchar ct_l)
{
 uint tempint;
 uchar temp;
 tempint=ct_h*0x100+ct_l;
 tx_wait();
 temp=EN0_ISR;// Interrupt status reg
 if((temp&(ENISR_TX_ERR+ENISR_TX))!=0)// Pending Tx interrupts?
  {
   temp=EN0_TSR;//Read Transmit status reg
   EN0_ISR=ENISR_TX_ERR+ENISR_TX;//clear the corresponding bits
  }
 if(tempint>GIANT)return;
 if(tempint<RUNT){ct_h=0;ct_l=RUNT;tempint=RUNT;}
 EN0_TCNTHI=ct_h	;// High byte of tx byte count
 EN0_TCNTLO=ct_l	; //Low  byte of tx byte count
 EN0_TPSR=NE_START_PG;// Transmit starting page, First page of TX buffer
 EN_CMD= EN_PAGE0+EN_NODMA+EN_TRANS+EN_START;// Remote DMA, Transmit a frame
}


void tx_wait(void)
{
 uchar temp;
 temp=EN_CMD;
 if((temp&EN_TRANS)==0)return;
 delayms(250);
 delayms(250);//wait 500ms
}



void eth_send(uint num)
{
 uchar num_h,num_l;
 uchar xdata *senddata;
 senddata=ETH_SEND_ADDR;
 num_h=num>>8;
 num_l=num&0xff;
 /*先寫到網卡芯片RAM,然后再通過命令送出去了*/
 dmawrite(num_h,num_l,NE_START_PG,0,senddata);
 sendpacket(num_h,num_l);
}

uchar packet_come(void) //if any packet comes
{
 uchar temp;
 EN_CMD=EN_PAGE0+EN_NODMA+EN_START;
 temp=EN0_ISR;
 /*如果溢出的話,也要返回,否則以后就玩不轉了*/
 if((temp&ENISR_OVER)==ENISR_OVER)return(TRUE);
 EN_CMD=EN_PAGE1+EN_NODMA+EN_START;
 temp=EN1_CURPAG;
 /*要知道,EN1_CURPAG是自動加的,next_packet可不會,所以數據包到了,他倆就不同了*/
 if(next_packet!=temp)return(TRUE);//new packet come
 return(FALSE);
}

void recvpacket(void)
{
 uchar temp;
 uchar temp1;
 EN_CMD=EN_PAGE0+EN_NODMA+EN_START ;
 temp=EN0_ISR;// Get pending interrupts
 if(temp==0)return;
 if((temp&ENISR_OVER)==ENISR_OVER)
  {
   // i want to reset the NIC
    EN_CMD=EN_PAGE0+EN_NODMA ;//Remote DMA
    EN0_BOUNDARY= RX_START_PG;//Boundary page of ring buffer
    EN_CMD= EN_PAGE1+EN_NODMA+EN_STOP ;//Page 1,Remote DMA, Stop and reset the chip
    EN1_CURPAG= RX_CURR_PG	;//Current memory page = RX_CURR_PG
    EN_CMD= EN_PAGE0+EN_NODMA+EN_START;//Remote DMA, Start the chip, clear reset
    next_packet= RX_CURR_PG;
    EN0_ISR=temp;
    net_overlow=TRUE;
    return;
  }
 if((temp&ENISR_COUNTERS)==ENISR_COUNTERS)
// some errors, read Tally Counters,about no use
  {
   temp1=EN0_COUNTER0;
   temp1=EN0_COUNTER1;
   temp1=EN0_COUNTER2;
   EN0_ISR=ENISR_COUNTERS;// 	Interrupt status reg;ReSet CNT (Error Tally Counters)
  }
 if( ( (temp&ENISR_RX)==ENISR_RX)||((temp&ENISR_RX_ERR)==ENISR_RX_ERR))//packet received
  {
   EN0_ISR=ENISR_RX_ERR+ENISR_RX;//clear those request
   //get the rx page
   EN_CMD=EN_PAGE1+EN_NODMA+EN_START;
   temp=EN1_CURPAG;
   EN_CMD=EN_PAGE0+EN_NODMA+EN_START;
   while(temp!=next_packet)//rece new packet
    {
     curr_recv=next_packet;//curr_recv used in process
     dmaread(0,SIZE_OF_8019_HDR+SIZE_OF_ETH_PKT_HDR,next_packet,0,rcv_hdr);
     temp1=rcv_hdr[0]	; //Get the buffer status byte (the same as EN0_RSR)
     if(((temp1&ENRSR_RXOK)!=ENRSR_RXOK)&&((temp1&ENRSR_PHY)!=ENRSR_PHY))
      {
       next_packet=temp;
       goto recv_break;
      }
     next_packet=rcv_hdr[1];//next page
     if((next_packet>NE_STOP_PG)||(next_packet<RX_START_PG))
      {
       next_packet=temp;//curr_page
       goto recv_break;
      }
     processethpacket();
     if(next_packet==RX_START_PG)EN0_BOUNDARY=NE_STOP_PG-1;
     else EN0_BOUNDARY=next_packet-1;
     EN_CMD=EN_PAGE1+EN_NODMA+EN_START;
     temp=EN1_CURPAG;
     EN_CMD=EN_PAGE0+EN_NODMA+EN_START;
    }
  }
 recv_break:
 EN0_ISR=ENISR_RDC ;//Interrupt status reg
}

void processethpacket(void)
{
 uchar temp;
 uint  tempint;
 dmaread(rcv_hdr[3],rcv_hdr[2],curr_recv,0,rcv_hdr);
 handle_packet();
}


#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91官网在线观看| 国产精品欧美久久久久无广告 | 日日骚欧美日韩| 国模套图日韩精品一区二区| 99久久久免费精品国产一区二区| 欧美精品久久久久久久久老牛影院| 久久蜜桃av一区精品变态类天堂| 一区二区三区日韩精品视频| 国产一区三区三区| 日韩一区二区电影在线| 亚洲影视在线播放| 一本色道亚洲精品aⅴ| 国产欧美精品区一区二区三区| 五月婷婷另类国产| 91在线码无精品| 国产精品久久久久久亚洲伦 | 97se亚洲国产综合自在线| 精品欧美一区二区三区精品久久| 亚洲一区精品在线| 色香蕉成人二区免费| 国产精品视频你懂的| 粉嫩欧美一区二区三区高清影视| 日韩一区二区三| 日韩黄色免费电影| 欧美精品一二三区| 亚洲国产日日夜夜| 欧美日韩精品高清| 亚洲午夜在线视频| 欧美日韩高清一区二区三区| 伊人性伊人情综合网| 91蝌蚪porny| 亚洲欧美激情插| 91久久奴性调教| 亚洲制服丝袜一区| 欧美伦理电影网| 美女网站一区二区| 久久免费美女视频| www.欧美亚洲| 亚洲精品视频在线观看网站| 色琪琪一区二区三区亚洲区| 一区二区不卡在线播放| 欧美视频在线一区二区三区| 日韩成人免费在线| 日韩欧美高清在线| 国产麻豆精品在线观看| 国产精品卡一卡二| 91久久精品一区二区| 日韩国产欧美在线播放| 精品久久久网站| 成人永久免费视频| 一区二区三区中文字幕| 欧美精品自拍偷拍| 久久99日本精品| 国产精品理论在线观看| 在线观看日韩av先锋影音电影院| 视频一区视频二区在线观看| 日韩精品一区二区三区四区视频| 国产麻豆精品95视频| 自拍偷拍亚洲激情| 欧美精品久久一区二区三区| 国产一区二区三区免费观看| 国产精品九色蝌蚪自拍| 欧美喷水一区二区| 成人综合激情网| 香港成人在线视频| 国产人妖乱国产精品人妖| 91搞黄在线观看| 久久99精品久久久久久动态图 | 色激情天天射综合网| 日本成人在线网站| 日本一区二区电影| 欧美挠脚心视频网站| 国产成人亚洲综合a∨猫咪| 午夜影院久久久| 国产欧美一区二区三区鸳鸯浴 | 蜜臀a∨国产成人精品| 国产精品理论片| 日韩视频中午一区| av电影天堂一区二区在线| 日本大胆欧美人术艺术动态| 中文字幕视频一区| 精品久久五月天| 欧美三区在线视频| 白白色亚洲国产精品| 韩国欧美一区二区| 午夜精品一区在线观看| 中文字幕五月欧美| 久久婷婷国产综合精品青草| 欧美视频在线一区| 91在线播放网址| 成人午夜短视频| 九九国产精品视频| 日本中文在线一区| 亚洲gay无套男同| 亚洲激情自拍偷拍| 亚洲人成在线播放网站岛国| 国产亚洲成aⅴ人片在线观看| 884aa四虎影成人精品一区| 日本久久电影网| 色综合激情久久| 97se亚洲国产综合在线| 成人午夜大片免费观看| 国产精品资源在线观看| 久久不见久久见免费视频1| 日韩va亚洲va欧美va久久| 亚洲国产精品麻豆| 亚洲成av人片观看| 亚洲一卡二卡三卡四卡无卡久久| 17c精品麻豆一区二区免费| 国产嫩草影院久久久久| 久久久久久久一区| xfplay精品久久| 久久综合av免费| www欧美成人18+| 久久色中文字幕| 国产午夜精品在线观看| 欧美国产精品一区二区| 中文欧美字幕免费| 国产精品免费av| 亚洲欧美日韩国产成人精品影院 | 欧美影片第一页| 在线视频国内自拍亚洲视频| 99re66热这里只有精品3直播 | 亚洲精品欧美专区| 亚洲黄色小视频| 亚洲国产精品影院| 免费黄网站欧美| 国产麻豆精品95视频| www.欧美色图| 欧美中文字幕久久| 日韩一区二区三区电影在线观看| 精品国产电影一区二区| 久久精品夜色噜噜亚洲aⅴ| 国产精品网站在线观看| 亚洲女爱视频在线| 五月开心婷婷久久| 老色鬼精品视频在线观看播放| 精品制服美女久久| 97国产一区二区| 欧美精品自拍偷拍| 日本一区二区免费在线观看视频 | 在线亚洲欧美专区二区| 欧美高清视频一二三区| 精品福利在线导航| 欧美高清在线精品一区| 亚洲午夜电影在线| 久久99久久99| 日本韩国精品一区二区在线观看| 欧美一区二区三区视频免费| 久久综合色婷婷| 亚洲卡通动漫在线| 久久99九九99精品| 在线一区二区三区四区五区| 欧美成人精品1314www| 国产精品免费免费| 麻豆国产欧美日韩综合精品二区| 成人小视频在线观看| 欧美精品vⅰdeose4hd| 欧美国产一区视频在线观看| 午夜视频久久久久久| 国产成人综合在线播放| 欧美日韩精品一区二区三区| 国产喂奶挤奶一区二区三区| 午夜私人影院久久久久| 国产成人午夜电影网| 69堂成人精品免费视频| 亚洲欧美日韩国产另类专区| 久久不见久久见免费视频7| 日本国产一区二区| 日本一区二区久久| 另类小说综合欧美亚洲| 在线观看日产精品| 中文字幕一区二区三区视频| 麻豆传媒一区二区三区| 欧美在线free| 亚洲欧美在线aaa| 极品少妇一区二区三区精品视频 | 亚洲国产一二三| 99精品久久只有精品| 久久综合九色综合欧美亚洲| 日韩福利视频导航| 欧美日韩视频在线一区二区| 国产精品乱码一区二区三区软件| 久草这里只有精品视频| 欧美高清视频不卡网| 亚洲成人tv网| 欧美中文字幕亚洲一区二区va在线 | 最新中文字幕一区二区三区| 国产在线国偷精品产拍免费yy| 5566中文字幕一区二区电影| 亚洲二区在线观看| 在线欧美小视频| 亚洲精品国产第一综合99久久| av中文一区二区三区| 亚洲欧洲性图库| 不卡电影一区二区三区| 中文字幕视频一区| 一本久道久久综合中文字幕| 亚洲卡通欧美制服中文| 欧美又粗又大又爽|