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

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

?? eth_drv.c

?? DM9000 ARM的UCOS-II 驅動程序。
?? C
字號:
 //==========================================================================
 //
 //      src/lwip/eth_drv.c
 //
 //      Hardware independent ethernet driver for lwIP
 //
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 // for more details.
 //
 // You should have received a copy of the GNU General Public License along
 // with eCos; if not, write to the Free Software Foundation, Inc.,
 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 //
 // As a special exception, if other files instantiate templates or use macros
 // or inline functions from this file, or you compile this file and link it
 // with other works to produce a work based on this file, this file does not
 // by itself cause the resulting work to be covered by the GNU General Public
 // License. However the source code for this file must still be made available
 // in accordance with section (3) of the GNU General Public License.
 //
 // This exception does not invalidate any other reasons why a work based on
 // this file might be covered by the GNU General Public License.
 //
 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
 // at http://sources.redhat.com/ecos/ecos-license/
 // -------------------------------------------
 //####ECOSGPLCOPYRIGHTEND####
 //==========================================================================
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    Jani Monoses <jani@iv.ro>
 // Contributors: 
 // Date:         2002-04-05
 // Purpose:      Hardware independent ethernet driver
 // Description:  Based on the standalone driver for RedBoot.
 //               
 //####DESCRIPTIONEND####
 //
 //==========================================================================
 
#include <pkgconf/system.h>
#include <pkgconf/io_eth_drivers.h>
 
#include <cyg/infra/cyg_type.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/infra/diag.h>
#include <cyg/hal/drv_api.h>
#include <cyg/hal/hal_if.h>
#include <cyg/io/eth/eth_drv.h>
#include <cyg/io/eth/netdev.h>
#include <string.h>
 
#include <cyg/hal/hal_tables.h>
#include <cyg/kernel/kapi.h>
 
#include "lwip/opt.h"
#include "lwip/ip.h"
#include "lwip/mem.h"
#include "lwip/pbuf.h"
#include "lwip/sys.h"
 
#include "netif/etharp.h"
 
 
// Interfaces exported to drivers
 
static void eth_drv_init(struct eth_drv_sc *sc, unsigned char *enaddr);
static void eth_drv_recv(struct eth_drv_sc *sc, int total_len);
static void eth_drv_tx_done(struct eth_drv_sc *sc, CYG_ADDRWORD key, int status);
 
struct eth_drv_funs eth_drv_funs = { eth_drv_init, eth_drv_recv, eth_drv_tx_done };
 
#ifdef CYGDBG_IO_ETH_DRIVERS_DEBUG 
int cyg_io_eth_net_debug = CYGDBG_IO_ETH_DRIVERS_DEBUG_VERBOSITY;
#endif
 
extern void lwip_dsr_stuff(void);
extern void lwip_set_addr(struct netif *);
 
//DSR called from the low level driver.Signals the input_thread
void
eth_drv_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
  struct eth_drv_sc *sc = (struct eth_drv_sc *) data;
  sc->state |= ETH_DRV_NEEDS_DELIVERY;
  lwip_dsr_stuff();     
}
 
err_t ecosif_init(struct netif *netif);
 
// This function is called during system initialization to register a
// network interface with the system.
static void
eth_drv_init(struct eth_drv_sc *sc, unsigned char *enaddr)
{
  struct netif *netif = &sc->sc_arpcom.ac_if;
  
  netif->state = sc;
  ecosif_init(netif);
  
  // enaddr == 0 -> hardware init was incomplete (no ESA)
  if (enaddr != 0) {
    // Set up hardware address
    memcpy(netif->hwaddr, enaddr, ETHER_ADDR_LEN);
    // Perform any hardware initialization
    (sc->funs->start) (sc, (unsigned char *) &netif->hwaddr, 0);
  }
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
 // Set up interfaces so debug environment can share this device
    {
        void *dbg = CYGACC_CALL_IF_DBG_DATA();
        if (!dbg) {
            CYGACC_CALL_IF_DBG_DATA_SET((void *)sc);
        }
    }
#endif 
}

//
// Control whether any special locking needs to take place if we intend to
// cooperate with a ROM monitor (e.g. RedBoot) using this hardware.  
//
#if defined(CYGSEM_HAL_USE_ROM_MONITOR) && \
     defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) && \
    !defined(CYGSEM_HAL_VIRTUAL_VECTOR_CLAIM_COMMS)
 
// Indicate that special locking precautions are warranted.
#define _LOCK_WITH_ROM_MONITOR
 
// This defines the [well known] channel that RedBoot will use when it is
// using the network hardware for the debug channel.
#define RedBoot_TCP_CHANNEL CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS
 
#endif
 
//
// Send a packet of data to the hardware
//
static void
eth_drv_send(struct netif *netif, struct pbuf *p)
{
  struct eth_drv_sg sg_list[MAX_ETH_DRV_SG];
  struct eth_drv_sc *sc = netif->state;
  int sg_len = 0;
  struct pbuf *q;
 
#ifdef _LOCK_WITH_ROM_MONITOR
    bool need_lock = false;
    int debug_chan;
#endif
 
  while (!(sc->funs->can_send) (sc)); 
 
  for (q = p; q != NULL; q = q->next) {
    sg_list[sg_len].buf = (CYG_ADDRESS) q->payload;
    sg_list[sg_len++].len = q->len;
  }
#ifdef _LOCK_WITH_ROM_MONITOR
  debug_chan = CYGACC_CALL_IF_SET_DEBUG_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
  if (debug_chan == RedBoot_TCP_CHANNEL) {
    need_lock = true;
    cyg_drv_dsr_lock();
  }
#endif // _LOCK_WITH_ROM_MONITOR
 
  (sc->funs->send) (sc, sg_list, sg_len, p->tot_len,
                     (CYG_ADDRWORD) p);
 
#ifdef _LOCK_WITH_ROM_MONITOR
  // Unlock the driver & hardware.  It can once again be safely shared.
  if (need_lock) {
    cyg_drv_dsr_unlock();
  }
#endif // _LOCK_WITH_ROM_MONITOR
 
}
 
//
// This function is called from the hardware driver when an output operation
// has completed - i.e. the packet has been sent.
//
static void
eth_drv_tx_done(struct eth_drv_sc *sc, CYG_ADDRWORD key, int status)
 {
#if 0   
  struct pbuf *p = (struct pbuf *)key;
  struct netif *netif = &sc->sc_arpcom.ac_if;
 
  CYGARC_HAL_SAVE_GP();
  CYGARC_HAL_RESTORE_GP();
#endif  
}
 
static void ecosif_input(struct netif *netif, struct pbuf* pbuf);
 
#define MAX_ETH_MSG 1540
//
// This function is called from a hardware driver to indicate that an input
// packet has arrived.  The routine will set up appropriate network resources
// to hold the data and call back into the driver to retrieve the data.
//
static void
eth_drv_recv(struct eth_drv_sc *sc, int total_len)
{
  struct eth_drv_sg sg_list[MAX_ETH_DRV_SG];
  struct netif *netif = &sc->sc_arpcom.ac_if; 
  struct pbuf *p, *q;

  int sg_len = 0;
  CYGARC_HAL_SAVE_GP();

  if ((total_len > MAX_ETH_MSG) || (total_len < 0)) {
    total_len = MAX_ETH_MSG;
  }
 
  p = pbuf_alloc(PBUF_RAW, total_len, PBUF_POOL);

  if (p == NULL) {
    LWIP_DEBUGF(0, ("ecosif_input: low_level_input returned NULL\n"));
    return;
  }
 
  for (q = p; q != NULL; q = q->next) {
    sg_list[sg_len].buf = (CYG_ADDRESS) q->payload;
    sg_list[sg_len++].len = q->len;
  }
  (sc->funs->recv) (sc, sg_list, sg_len);
  ecosif_input(netif, p);
  CYGARC_HAL_RESTORE_GP();
}
 
 
#define IFNAME0 'e'
#define IFNAME1 't'

//
// low_level_output():
//
// Should do the actual transmission of the packet. The packet is
// contained in the pbuf that is passed to the function. This pbuf
// might be chained.We pass the data down to the eCos hw independent 
// ethernet driver
//
 
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
  eth_drv_send(netif, p);
  return ERR_OK;
}

//
// ecosif_output():
//
// This function is called by the TCP/IP stack when an IP packet
// should be sent. It calls the function called low_level_output() to
// do the actual transmission of the packet.
//
//
static err_t
ecosif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
{

  p = etharp_output(netif, ipaddr, p);
  if (p) {
    low_level_output(netif, p);
    p = NULL;
  }
  return ERR_OK;
}


 
//
// ecosif_input():
// This function is called when the eCos hw independent driver
// has some data to pass up to lwIP.It does it through ecosif_input.
//
static void
ecosif_input(struct netif *netif, struct pbuf *p)
{
  struct eth_hdr *ethhdr;
  
  ethhdr = p->payload;
 
  switch (htons(ethhdr->type)) {
  case ETHTYPE_IP:
    LWIP_DEBUGF(0, ("ecosif_input: IP packet\n"));
    etharp_ip_input(netif, p);
    pbuf_header(p, -14);
    netif->input(p, netif);
    break;
  case ETHTYPE_ARP:
    LWIP_DEBUGF(0, ("ecosif_input: ARP packet\n"));
    etharp_arp_input(netif, (struct eth_addr *) &netif->hwaddr, p);
    break;
  default:
    pbuf_free(p);
    break;
  }
 
 }
 
err_t
ecosif_init(struct netif *netif)
{
  netif->name[0] = IFNAME0;
  netif->name[1] = IFNAME1;
  netif->hwaddr_len = 6;
  netif->output = ecosif_output;
  netif->linkoutput = low_level_output;
  netif->mtu = 1500;
  lwip_set_addr(netif);
  return ERR_OK;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品视频线看| 欧美高清视频一二三区| 日韩在线观看一区二区| 亚洲国产视频一区二区| 国产精品私房写真福利视频| 精品99一区二区| 欧美一区二区在线观看| 欧美日韩日本视频| 欧美亚洲国产一区二区三区| 成人黄色网址在线观看| 成人一区在线观看| 不卡的av电影在线观看| 国产99精品国产| 成人性生交大片免费看在线播放 | 欧美第一区第二区| 欧美一区二区三区四区五区| 欧美日韩午夜影院| 欧美蜜桃一区二区三区| 欧美美女一区二区在线观看| 在线播放/欧美激情| 欧美一区二区三区免费视频| 91精品国产欧美一区二区成人| 欧美日韩国产综合一区二区| 欧美日本高清视频在线观看| 欧美片网站yy| 日韩一区二区电影| 26uuu精品一区二区| 久久久久久**毛片大全| 国产精品色婷婷| 一区二区在线免费| 日日夜夜精品免费视频| 日本美女一区二区| 国产乱色国产精品免费视频| 国产精品羞羞答答xxdd| eeuss鲁一区二区三区| 在线看不卡av| 日韩欧美国产一区二区在线播放| 精品国产一区二区三区不卡 | 日本少妇一区二区| 国产在线一区观看| 波多野结衣中文一区| 色综合网站在线| 91精选在线观看| 欧美激情中文不卡| 亚洲一区二区三区视频在线播放| 日本最新不卡在线| 国产成人av一区二区三区在线观看| 成人av在线一区二区| 欧美高清激情brazzers| 久久九九久久九九| 亚洲一二三区视频在线观看| 久久精品国内一区二区三区| 成人h动漫精品一区二| 欧美精品成人一区二区三区四区| 久久婷婷成人综合色| 一个色综合av| 国产999精品久久| 欧美疯狂性受xxxxx喷水图片| 久久日韩粉嫩一区二区三区| 亚洲国产视频a| 成人免费精品视频| 日韩一卡二卡三卡| 亚洲老妇xxxxxx| 国产乱国产乱300精品| 欧美综合视频在线观看| 国产午夜精品美女毛片视频| 午夜精品123| 91在线你懂得| 国产亚洲欧美在线| 久色婷婷小香蕉久久| 欧美体内she精高潮| 国产精品久久久久7777按摩| 久久99国产精品免费| 欧美日韩成人综合| 国产精品国产自产拍高清av王其| 日韩电影网1区2区| 欧洲精品一区二区| 国产精品国产三级国产普通话蜜臀 | 欧美视频精品在线| 中文字幕视频一区二区三区久| 麻豆精品一区二区综合av| 日本电影欧美片| 国产精品成人免费精品自在线观看| 麻豆久久久久久久| 欧美一级片免费看| 婷婷成人综合网| 欧美性videosxxxxx| 综合激情成人伊人| 99精品国产视频| 亚洲人吸女人奶水| 色婷婷狠狠综合| 亚洲综合色成人| 欧美三级欧美一级| 亚洲不卡一区二区三区| 欧美性videosxxxxx| 一区二区三区视频在线看| 91污片在线观看| 一区二区视频在线| 日本韩国精品一区二区在线观看| 最新国产精品久久精品| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品成人午夜| 日本黄色一区二区| 五月婷婷欧美视频| 日韩欧美一级在线播放| 日本成人超碰在线观看| 欧美一级片在线| 国产精品18久久久久久久久 | 97se亚洲国产综合自在线观| 亚洲欧美怡红院| 日本韩国欧美三级| 日韩精品成人一区二区三区| 91精品婷婷国产综合久久性色| 三级成人在线视频| 精品国产91洋老外米糕| 国产91综合网| 亚洲青青青在线视频| 在线观看视频一区| 青青国产91久久久久久| 久久蜜桃香蕉精品一区二区三区| 国产成人一级电影| 亚洲精品日韩一| 日韩一区二区三区视频| 国产电影一区二区三区| 亚洲日本va在线观看| 欧美一区二区视频在线观看 | 亚洲综合色区另类av| 欧美一区二区三级| 懂色av一区二区夜夜嗨| 亚洲精品五月天| 欧美精品一区二| 色狠狠av一区二区三区| 麻豆国产精品官网| 综合久久国产九一剧情麻豆| 91精品在线观看入口| 成人中文字幕合集| 天天综合网 天天综合色| 337p日本欧洲亚洲大胆精品| 91麻豆swag| 国内精品免费**视频| 一区二区三区中文免费| 久久久www成人免费毛片麻豆| 一本到不卡免费一区二区| 久久99日本精品| 亚洲一区自拍偷拍| 久久精品人人做人人综合| 欧美日韩国产一级二级| 国产成人精品三级| 日韩高清在线电影| 亚洲欧美激情一区二区| 国产日产欧美一区二区三区| 欧美日韩精品一二三区| 成人一区二区三区| 久久精品国产**网站演员| 亚洲夂夂婷婷色拍ww47 | 国产精品国产自产拍高清av王其| 91精品国产黑色紧身裤美女| 91在线视频官网| 岛国av在线一区| 国产制服丝袜一区| 麻豆传媒一区二区三区| 亚洲成年人影院| 亚洲免费av观看| 国产精品麻豆久久久| 精品999在线播放| 日韩免费性生活视频播放| 在线视频亚洲一区| 91在线视频观看| 99re视频这里只有精品| 高清不卡一二三区| 国产高清精品网站| 狠狠狠色丁香婷婷综合激情| 美女在线视频一区| 秋霞电影一区二区| 麻豆精品一区二区| 美女网站色91| 精品伊人久久久久7777人| 捆绑调教美女网站视频一区| 免费在线观看一区二区三区| 日韩精品亚洲一区二区三区免费| 亚洲一区二区欧美日韩| 亚洲综合久久久| 丝袜亚洲另类欧美综合| 日韩在线一区二区三区| 免费在线观看一区| 精品一区二区三区免费观看| 蜜桃视频一区二区| 国内精品久久久久影院色| 国产成人免费视频网站高清观看视频 | 中文字幕一区二区三区不卡在线| 国产精品国产三级国产a| 中文字幕亚洲一区二区va在线| 日韩毛片高清在线播放| 伊人婷婷欧美激情| 五月天婷婷综合| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产精品综合av一区二区国产馆| 国产盗摄女厕一区二区三区| 99这里只有久久精品视频| 色婷婷综合久色|