浏览代码

:x

tags/v0.9.3
Udayan Kumar 18 年前
父节点
当前提交
bfa322bb19
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5
    3
      src/drivers/net/natsemi.c

+ 5
- 3
src/drivers/net/natsemi.c 查看文件

495
  * @v netdev	Network device
495
  * @v netdev	Network device
496
  * @v rx_quota	Maximum number of packets to receive
496
  * @v rx_quota	Maximum number of packets to receive
497
  */
497
  */
498
-static void nat_poll ( struct net_device *netdev, unsigned int rx_quota ) {
498
+static void nat_poll ( struct net_device *netdev) {
499
 	struct natsemi_nic *nat = netdev->priv;
499
 	struct natsemi_nic *nat = netdev->priv;
500
 	unsigned int status;
500
 	unsigned int status;
501
 	unsigned int rx_status;
501
 	unsigned int rx_status;
544
 	/* Handle received packets 
544
 	/* Handle received packets 
545
 	 */
545
 	 */
546
 	rx_status=(unsigned int)nat->rx[nat->rx_cur].cmdsts; 
546
 	rx_status=(unsigned int)nat->rx[nat->rx_cur].cmdsts; 
547
-	while (rx_quota && (rx_status & OWN)) {
547
+	while ((rx_status & OWN)) {
548
 		rx_len= (rx_status & DSIZE) - CRC_SIZE;
548
 		rx_len= (rx_status & DSIZE) - CRC_SIZE;
549
 		/*check for the corrupt packet 
549
 		/*check for the corrupt packet 
550
 		 */
550
 		 */
565
 			/* add to the receive queue. 
565
 			/* add to the receive queue. 
566
 			 */
566
 			 */
567
 			netdev_rx(netdev,rx_iob);
567
 			netdev_rx(netdev,rx_iob);
568
-			rx_quota--;
569
 		}
568
 		}
570
 		nat->rx[nat->rx_cur].cmdsts = RX_BUF_SIZE;
569
 		nat->rx[nat->rx_cur].cmdsts = RX_BUF_SIZE;
571
 		nat->rx_cur=(nat->rx_cur+1) % NUM_RX_DESC;
570
 		nat->rx_cur=(nat->rx_cur+1) % NUM_RX_DESC;
620
 	uint8_t ll_addr_encoded[MAX_LL_ADDR_LEN];
619
 	uint8_t ll_addr_encoded[MAX_LL_ADDR_LEN];
621
 	uint8_t last=0;
620
 	uint8_t last=0;
622
 	uint8_t last1=0;
621
 	uint8_t last1=0;
622
+	uint8_t prev_bytes[2];
623
 
623
 
624
 	/* Allocate net device 
624
 	/* Allocate net device 
625
 	 */
625
 	 */
641
 	 */
641
 	 */
642
 	nat_reset ( nat );
642
 	nat_reset ( nat );
643
 	nat_init_eeprom ( nat );
643
 	nat_init_eeprom ( nat );
644
+	nvs_read ( &nat->eeprom.nvs, EE_MAC-1, prev_bytes, 1);
644
 	nvs_read ( &nat->eeprom.nvs, EE_MAC, ll_addr_encoded, ETH_ALEN );
645
 	nvs_read ( &nat->eeprom.nvs, EE_MAC, ll_addr_encoded, ETH_ALEN );
645
 	/* decoding the MAC address read from NVS 
646
 	/* decoding the MAC address read from NVS 
646
 	 * and save it in netdev->ll_addr
647
 	 * and save it in netdev->ll_addr
647
          */
648
          */
649
+	last=prev_bytes[1]>>7;
648
 	for ( i = 0 ; i < ETH_ALEN ; i++) {
650
 	for ( i = 0 ; i < ETH_ALEN ; i++) {
649
 		last1=ll_addr_encoded[i]>>7;
651
 		last1=ll_addr_encoded[i]>>7;
650
 	 	netdev->ll_addr[i]=ll_addr_encoded[i]<<1|last;
652
 	 	netdev->ll_addr[i]=ll_addr_encoded[i]<<1|last;

正在加载...
取消
保存