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

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

?? 16bit_io_cs8900.c

?? 運用16位IO方式控制CS8900A芯片
?? C
?? 第 1 頁 / 共 2 頁
字號:
  q = NULL;  switch (htons(ethhdr->type)) {  /* IP packet? */  case ETHTYPE_IP:    /* update ARP table, obtain first queued packet */    q = etharp_ip_input(netif, p);    /* skip Ethernet header */    pbuf_header(p, -14);    LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: passing packet up to IP\n"));    /* pass to network layer */    netif->input(p, netif);    break;  /* ARP packet? */  case ETHTYPE_ARP:    /* pass p to ARP module, get ARP reply or ARP queued packet */    q = etharp_arp_input(netif, (struct eth_addr *)&netif->hwaddr, p);    break;  /* unsupported Ethernet packet type */  default:    /* free pbuf */    pbuf_free(p);    p = NULL;    break;  }  /* send out the ARP reply or ARP queued packet */  if (q != NULL) {    /* q pbuf has been succesfully sent? */    if (cs8900_output(netif, q) == ERR_OK)    {      pbuf_free(q);      q = NULL;    }    else    {      /* TODO: re-queue packet in the ARP cache here (?) */      pbuf_free(q);      q = NULL;    }  }}					 /***********************************************************************************************************                       Move a received packet from the cs8900 into a new pbuf.** Description : Must be called after reading an ISQ event containing the*               "Receiver Event" register, before reading new ISQ events.**               This function copies a frame from the CS8900A.*               *               It is designed failsafe:*               - It does not assume a frame is actually present.*               - It checks for non-zero length*               - It does not overflow the frame buffer**                * Arguments   : netif: The lwIP network interface data structure belonging to this device. **********************************************************************************************************/static struct pbuf *cs8900_input(struct netif *netif){  struct pbuf *p = NULL, *q = NULL;  u16_t len = 0;  u16_t event_type;  u16_t i;  u16_t *ptr = NULL;  // read RxStatus  event_type = IORead(CS8900_RxTxDataPort);  // correctly received frame, either broadcast or individual address?  // TODO: maybe defer these conditions to cs8900_input()  if ((event_type & 0x0001U/*RxOK*/) && (event_type & 0x000cU/*Broadcast | Individual*/))  {#if LWIP_SNMP > 0    // update number of received MAC-unicast and non-MAC-unicast packets    if (event_type & 0x0004U/*Individual*/)    {      snmp_inc_ifinucastpkts();    }    else    {      snmp_inc_ifinnucastpkts();    }#endif    event_type = 0;    // read RxLength    len = IORead(CS8900_RxTxDataPort);    len = len>>8 | len << 8;  //the length is register content and therefore needs to be reversed.    LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %u\n", len));    snmp_add_ifinoctets(len);    // positive length?    if (len > 0)    {      // allocate a pbuf chain with total length 'len'      p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);      if (p != NULL)      {        for (q = p; q != 0; q = q->next)	{	  LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: pbuf @%p tot_len %u len %u\n", q, q->tot_len, q->len));	  ptr = q->payload;          // TODO: CHECK: what if q->len is odd? we don't use the last byte?          for (i = 0; i < (q->len + 1) / 2; i++)          {            *ptr = IORead(CS8900_RxTxDataPort);            ptr++;          }        }      }      // could not allocate a pbuf      else      {        // skip received frame        // TODO: maybe do not skip the frame at this point in time?        ppWrite(CS_PP_RXCFG, 0x4301U/*SKIP*/);#if (CS8900_STATS > 0)        ((struct cs8900if *)netif->state)->dropped++;#endif        snmp_inc_ifindiscards();        len = 0;      }    }    // length was zero    else    {    }  }  return p;}/***********************************************************************************************************                 Writing an IP packet (to be transmitted) to the CS8900.** Description : Before writing a frame to the CS8900, the ARP module is asked to resolve the*               Ethernet MAC address. The ARP module might undertake actions to resolve the*               address first, and queue this packet for later transmission.*               * Arguments   : netif: The lwIP network interface data structure belonging to this device.*               p pbuf: to be transmitted (or the first pbuf of a chained list of pbufs).*               ipaddr: destination IP address.** Returns     : ERR_OK if the packet was sent or queued. There is no way to*               find out if a packet really makes it onto the network link.* * Notes       : Uses the function cs8900_input() that should handle the actual*               reception of bytes from the network interface.**********************************************************************************************************/err_t cs8900if_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr){  struct cs8900if *cs8900if = netif->state;  err_t result;  /* resolve the link destination hardware address */  p = etharp_output(netif, ipaddr, p);  /* network hardware address obtained? */  if (p != NULL)  {    /* send out the packet */    result = cs8900_output(netif, p);    p = NULL;  }  /* { p == NULL } */  else  {    /* we cannot tell if the packet was sent, the packet could have been queued */    /* on an ARP entry that was already pending. */    return ERR_OK;  }  return result;}							/***********************************************************************************************************                              cs8900_output()** Description : Sends a packet to the cs8900 ethernet controller for transmisison*                * Arguments   : netif: The lwIP network interface data structure belonging to this device. ** Returns     : return error codes*               - ERR_OK: packet transferred to hardware*               - ERR_CONN: no link or link failure*               - ERR_IF: could not transfer to link (hardware buffer full?)***********************************************************************************************************/static err_t cs8900_output(struct netif *netif, struct pbuf *p){  int tries = 0;  err_t result;    // exit if link has failed  if (( ppRead(CS_PP_LINESTATUS) & 0x8000U/*LinkOK*/) != 0x8000U) return ERR_CONN; // no Ethernet link  result = ERR_OK;  /* issue 'transmit' command to CS8900 */  IOWrite(CS_IO_TXCMDW, 0xC900U);//send the write command to the txwrite register    /* send length (in bytes) of packet to send, if its less than the ethernet minimum frame size, the cs8900 will pad automatically */  IOWrite(CS_IO_TXLEN, (p->tot_len<<8 | p->tot_len>>8)); //must be byte reversed! endian issue with the cs8900 auto swapping register data,    // not ready for transmission and still within 100 retries?  while (((ppRead(CS_PP_BUSSTATUS) & 0x0001U/*Rdy4TxNOW*/) != 0x0001) && (tries++ < 100))  {    // throw away the last committed received frame (SKIP)    ppWrite(CS_PP_RXCFG, 0x4301U);  }    // ready to transmit?  if (ppRead(CS_PP_BUSSTATUS) & 0x0001U == 0x0001U)  {  	unsigned long sent_bytes = 0;    /* q traverses through linked list of pbuf's     * This list MUST consist of a single packet ONLY */    struct pbuf *q;    for (q = p; q != NULL; q = q->next)    {      u16_t i;      u16_t *ptr = (u16_t *)q->payload;      /* Send the data from the pbuf to the interface, one pbuf at a       * time. The size of the data in each pbuf is kept in the ->len       * variable.       */      for (i = 0; i < q->len; i += 2)      {        /** TODO: this routine assumes 16-bit boundary pbufs... */        IOWrite(CS8900_RxTxDataPort, *ptr++);        sent_bytes += 2;      }    }    #if (CS8900_STATS > 0)    ((struct cs8900if *)netif->state)->sentpackets++;    ((struct cs8900if *)netif->state)->sentbytes += sent_bytes;#endif    snmp_add_ifoutoctets(sent_bytes);  }  else  {    // { not ready to transmit!? }    snmp_inc_ifoutdiscards();    /* return not connected */    result = ERR_IF;  }  return result;}/***********************************************************************************************************                                    ppRead() - reads cs8900 register content** Description : Reads internal cs8900 packet page registers, and returns their content to the *               calling function.               *               * Arguments   : takes in an 8 bit packet page register address, and returns a 16 bit register content.**********************************************************************************************************/static INT16U ppRead(INT16U pp_addr){        INT16U pp_data;	       //data from the cs8900 pp register will be stored here until it can be returned (2 bytes).    											      Data_DDR = 0xffff;               //set the databus to output    Addr_B = CS8900_PP_PTR_PORT;     //load the address of the pp pointer register onto the address bus    Data_B = pp_addr;                //put the address of the internal cs8900 register we wish to read on to the databus        Signal_B &= ~CS8900_WRITE;       //write this data in to the pp pointer port in the cs8900.    Signal_B |= CS8900_WRITE;        //de-activate the write signal            Data_DDR = 0x0000;               //now, set the databus to input    Addr_B = CS8900_PP_DATA_PORT;    //put the address of the pp data port on to the address bus (this is the register where the cs8900 will put the data we requested just above, all we have to do is retrieve it now)        Signal_B &= ~CS8900_READ;        //assert the read signal. This tells the cs8900 to put the data from the pp data register on to the data bus        pp_data = Data_B;                //store the data thats on the address bus into pp_data        Signal_B |= CS8900_READ;         //de-activate the read signal        return pp_data;                  //return the data from the cs8900 pp register we just read to the calling function. }/***********************************************************************************************************                                    ppWrite() - writes cs8900 register content** Description : Writes 16 bit data values in to the cs8900 packet page registers.*               * Arguments   : Takes in a 16 bit packet page register address, and a 16 bit data*               value to be written to that address. Returns nothing.**********************************************************************************************************/static void ppWrite(INT16U pp_addr, INT16U pp_data){  Data_DDR = 0xffff;                //set the databus to output.	Addr_B = CS8900_PP_PTR_PORT;      //load the address of the pp pointer register onto the address bus	Data_B = pp_addr;                 //put the address of the internal cs8900 register we wish to read on to the databus    Signal_B &= ~CS8900_WRITE;        //write this data in to the pp pointer port in the cs8900.	Signal_B |= CS8900_WRITE;         //de-activate the write signal		Addr_B = CS8900_PP_DATA_PORT;     //put the pp data port address on the address bus. (we write the pointer to this register, then the cs8900 internally gets the data from the register and puts in in the pp data port register)	Data_B = pp_data;                 //put the data that we desire to put into the pp register (pp_address) on the databus		  Signal_B &= ~CS8900_WRITE;        //write this data in to the cs8900 pp data port  Signal_B |= CS8900_WRITE;         //de-activate the write signal, the cs8900 should now have pp_data written to the pp register pp_addr}/*********************************************************************************************************** IORead() - reads cs8900 IO mapped Registers - like the frame data port! - not a packet page function!** Description : Reads a 16 bit word from the cs8900 IO data port. - THIS IS NOT A PACKET PAGE PROCEDURE.*               * Arguments   : Takes in an 8 bit IO register address and returns a 16 bit word from that address**********************************************************************************************************/static INT16U IORead(INT8U IO_Reg_Addr){   INT16U IO_Reg_Data;      //store the returned data here until its returned to the calling function.    Data_DDR = 0x0000;                //set the databus to input  Addr_B = IO_Reg_Addr;		          //put the IO register address we wish to read from on to the databus  Signal_B &= ~CS8900_READ;         //assert the read signal. This tells the cs8900 to put the data from the specified address on to the databus.		IO_Reg_Data = Data_B;             //save the returned data from the cs8900 in IO_Data until its returned to the calling function	Signal_B |= CS8900_READ;          //de-activate the read signal.  		return IO_Reg_Data;               //return the 16 bit word from the cs8900 IO Data Register.}/*********************************************************************************************************** IOWrite() - writes cs8900 IO mapped register like the frame data port! - not a packet page function!** Description : Writes 16 bit data values in to the cs8900 packet page registers.*               * Arguments   : Takes in an 8 bit IO register address, and a 16 bit data*               value to be written to that address. Returns nothing.**********************************************************************************************************/static void IOWrite(INT8U IO_Reg_Addr, INT16U IO_Reg_Data){  Data_DDR = 0xffff;                //Set Data bus to OUTPUT	Data_B = IO_Reg_Data;             //put the data we wish to write to the IO mapped register on the Data Bus 	Addr_B = IO_Reg_Addr;             //put the address of the IO mapped register we wish to write to on the address bus	  Signal_B &= ~CS8900_WRITE;        //write this data in to the cs8900 IO Register  OSTimeDly(1);    Signal_B |= CS8900_WRITE;         //de-activate the write signal}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区在线电影| 亚洲精品国产无天堂网2021 | 久久99国产精品久久99| 国产成人在线看| 欧美日韩国产一二三| 中文字幕欧美国产| 麻豆91免费观看| 日本韩国欧美国产| 国产欧美日韩另类视频免费观看| 亚洲6080在线| 色丁香久综合在线久综合在线观看| 日韩欧美中文一区二区| 亚洲国产另类精品专区| 白白色亚洲国产精品| 2021中文字幕一区亚洲| 青青草原综合久久大伊人精品| 色就色 综合激情| 国产精品麻豆欧美日韩ww| 精久久久久久久久久久| 日韩一区二区三区视频在线 | 久久久亚洲欧洲日产国码αv| 一区二区三区四区乱视频| 播五月开心婷婷综合| 国产午夜精品久久久久久免费视| 久久99精品网久久| 欧美大肚乱孕交hd孕妇| 美女看a上一区| 日韩一区二区在线播放| 日韩电影在线观看一区| 欧美日韩亚洲国产综合| 亚洲国产精品久久不卡毛片| 91论坛在线播放| 一区二区三区在线看| caoporm超碰国产精品| 最新成人av在线| 99这里只有精品| 一片黄亚洲嫩模| 欧美性大战久久| 亚洲成人av资源| 日韩情涩欧美日韩视频| 麻豆成人久久精品二区三区红 | 91麻豆精品91久久久久久清纯| 亚洲福利一二三区| 欧美妇女性影城| 精品一区二区三区蜜桃| 久久精品网站免费观看| 成人黄色免费短视频| 亚洲视频你懂的| 欧美日韩国产高清一区二区| 日本亚洲最大的色成网站www| 精品久久久久香蕉网| 国产福利一区二区三区| 亚洲靠逼com| 欧美一区二区日韩一区二区| 国内精品伊人久久久久av影院| 欧美激情一区二区三区全黄 | 国产不卡高清在线观看视频| 国产精品久久久久久久久果冻传媒 | 国产.欧美.日韩| 亚洲最色的网站| 久久综合九色综合97婷婷女人| 丁香激情综合国产| 亚洲成人手机在线| www成人在线观看| 一本大道综合伊人精品热热| 日韩精品色哟哟| 日本一区二区三区四区在线视频| 欧美亚洲国产怡红院影院| 老司机一区二区| 亚洲人成亚洲人成在线观看图片 | 久久99久久99小草精品免视看| 久久久久国产精品麻豆| 一本大道久久a久久精二百 | 午夜精品爽啪视频| 国产日韩精品久久久| 91精品国产丝袜白色高跟鞋| 成人动漫在线一区| 蜜臀久久99精品久久久久宅男| 日韩美女视频一区二区| 精品国偷自产国产一区| 91国模大尺度私拍在线视频| 国产精品综合在线视频| 亚洲国产精品一区二区久久| 中文字幕巨乱亚洲| 欧美videofree性高清杂交| 日本精品视频一区二区| 国产精品影视在线观看| 日韩二区三区四区| 亚洲午夜久久久久久久久久久| 久久久99精品免费观看| 欧美挠脚心视频网站| 99精品一区二区三区| 国产麻豆日韩欧美久久| 美女视频一区二区三区| 亚洲成人你懂的| 亚洲精品日韩综合观看成人91| 久久久久亚洲蜜桃| 日韩精品专区在线影院观看| 欧美日韩亚洲综合一区二区三区| 91啦中文在线观看| 成人免费的视频| 国产成人精品三级麻豆| 国产麻豆日韩欧美久久| 久久99精品视频| 麻豆精品久久精品色综合| 日韩中文字幕1| 天天操天天干天天综合网| 亚洲香蕉伊在人在线观| 亚洲精品久久嫩草网站秘色| 亚洲男人天堂一区| 亚洲精品老司机| 亚洲狠狠爱一区二区三区| 亚洲色图都市小说| 一区二区三区在线视频观看| 自拍av一区二区三区| 亚洲另类在线制服丝袜| 亚洲一区二区三区中文字幕| 亚洲最大成人综合| 亚洲国产欧美另类丝袜| 亚洲国产另类av| 欧美aaa在线| 国模大尺度一区二区三区| 韩国成人在线视频| 国产成人8x视频一区二区| 国产精品正在播放| 不卡的av电影在线观看| 色综合久久久久综合| 欧美日韩一区二区三区在线 | 色哟哟国产精品| 91福利视频网站| 欧美日韩aaa| 欧美一级黄色大片| 国产拍揄自揄精品视频麻豆| 国产精品网站在线| 一区二区三区四区在线| 日韩精品一区第一页| 国产真实精品久久二三区| 成人a级免费电影| 精品视频在线视频| 欧美电影免费观看高清完整版在线 | 91麻豆精品91久久久久久清纯 | 国产麻豆午夜三级精品| 99九九99九九九视频精品| 欧美色精品在线视频| 26uuu国产日韩综合| 久久精品免费在线观看| 亚洲精品成人悠悠色影视| 午夜久久电影网| 国产精品77777| 欧美三级在线看| 精品国产一区二区三区久久影院| 中文字幕免费不卡| 日产精品久久久久久久性色| 国产99精品国产| 欧美猛男gaygay网站| 国产视频911| 蜜臀91精品一区二区三区| 成人av网站在线观看| 91精品国产色综合久久久蜜香臀| 国产欧美一二三区| 亚洲1区2区3区4区| 成人a免费在线看| 精品区一区二区| 亚洲一级二级在线| 粉嫩av一区二区三区在线播放| 欧美精选在线播放| 亚洲精品国产一区二区精华液| 久久99精品一区二区三区三区| 色激情天天射综合网| 国产日韩av一区二区| 美腿丝袜在线亚洲一区| 欧美亚洲综合网| 日韩美女久久久| 成人97人人超碰人人99| 欧美电影免费观看高清完整版在线观看| 中文字幕综合网| 丁香婷婷综合激情五月色| 日韩午夜av电影| 天天色 色综合| 欧美日韩午夜影院| 亚洲靠逼com| 色综合久久综合网| 国产精品久久久久四虎| 国产成人一级电影| www激情久久| 狠狠色丁香久久婷婷综合_中 | 波波电影院一区二区三区| 欧美精品一区二区高清在线观看| 亚洲一区中文在线| 在线一区二区三区四区| 福利电影一区二区| 国产精品综合一区二区三区| 日韩成人精品视频| 亚洲综合一区在线| 欧美老肥妇做.爰bbww视频| 亚洲另类春色校园小说| 色悠悠久久综合| 一区二区三区欧美| 一本到高清视频免费精品| 亚洲精品成人a在线观看|