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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 16bit_io_cs8900.c

?? 運(yùn)用16位IO方式控制CS8900A芯片
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
/** @file * *  Ethernet network driver for IP *//* * Copyright (c) 2001-2003 Leon Woestenberg <address@hidden> * Copyright (c) 2001-2003 Axon Digital Design B.V., The Netherlands. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, *    this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, *    this list of conditions and the following disclaimer in the documentation *    and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products *    derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Leon Woestenberg <address@hidden> * Modified by: Eric Shufro <address@hidden> * * This is a device driver for the Crystal Semiconductor CS8900 * chip in combination with the lwIP stack. * * This is work under development. Please coordinate changes * and requests with Leon Woestenberg <address@hidden> * * The Swedish Institute of Computer Science and Adam Dunkels * are specifically granted permission to redistribute this * source code under any conditions they seem fit. * * A quick function roadmap: * * cs8900_*() are low level, cs8900 hardware specific functions. * These are declared static in the device driver source and * SHOULD NOT need to be called from outside this source. * * cs8900if_*() are the lwIP network interface functions. * * cs8900_init() sets up the cs8900, using its register set. When * using the driver on your particular hardware platform, make sure * the register setups match. * Function is called from cs8900if_init(). * * cs8900_input() transfers a received packet from the chip. * Function is called from cs8900if_input(). * * cs8900_output() transfers a packet to the chip for transmission. * Function is called from cs8900if_output(). * * cs8900if_init() initializes the lwIP network interface, and * calls cs8900_init() to initialize the hardware. * Function is called from lwIP. * * cs8900if_input() calls cs8900_input() to get a received packet * and then forwards the packet to protocol(s) handler(s). * Function is called from cs8900_service(). * * cs8900if_output() resolves the hardware address, then * calls cs8900_output() to transfer the packet. * Function is called from lwIP. */#include "lwip/opt.h"#include "lwip/def.h"#include "lwip/err.h"#include "lwip/mem.h"#include "lwip/pbuf.h"#include "lwip/stats.h"#include "lwip/sys.h"#include "netif/etharp.h"#include "netif/cs8900if.h"#include "bsp.h"/***********************************************************************************************************                              global variables**********************************************************************************************************/       OS_EVENT      *CS8900_Service_Sem;extern OS_CPU_SR      cpu_sr;/***********************************************************************************************************                      Initialize the CS8900 Ethernet MAC/PHY and its device driver.** Description : Initialize the CS8900 interface and then call the low level hardware initializing*               function to setup the ethernet controller.*               * Arguments   : netif: The lwIP network interface data structure belonging to this device.*               MAY be NULL as we do not support multiple devices yet.**********************************************************************************************************/err_t cs8900if_init(struct netif *netif){  struct cs8900if *cs8900if;  cs8900if = mem_malloc(sizeof(struct cs8900if));  if (cs8900if == NULL)  {    LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: out of memory for cs8900if\n"));    return ERR_MEM;  }  // initialize lwip network interface  netif->name[0] = IFNAME0;  netif->name[1] = IFNAME1;    // set the interface's mac address  netif->hwaddr[0] = 0x00;  netif->hwaddr[1] = 0x50;  netif->hwaddr[2] = 0xc2;  netif->hwaddr[3] = 0x25;  netif->hwaddr[4] = 0x60;  netif->hwaddr[5] = 0x0b;       /* downward functions */  netif->output = cs8900if_output;  netif->linkoutput = cs8900_output;  // initialize cs8900 specific interface state data pointer  netif->state = cs8900if;  /* maximum transfer unit */  netif->mtu = 1500;  /* broadcast capability */  netif->flags = NETIF_FLAG_BROADCAST;  /* hardware address length */  netif->hwaddr_len = 6;  // initially assume no ISQ event  cs8900if->needs_service = 0;  // set to 1 if polling method is used  cs8900if->use_polling = 0;#if (CS8900_STATS > 0)  // number of interrupt service routine calls  cs8900if->interrupts = 0;  cs8900if->missed = 0;  cs8900if->dropped = 0;  cs8900if->sentpackets = 0;  cs8900if->sentbytes = 0;#endif  // intialize the cs8900a chip  return cs8900_init();}/***********************************************************************************************************                              cs8900_init()** Description : Calls for a CS8900 hardware reset and then initializes the cs8900 registers*                * Arguments   : netif: The lwIP network interface data structure belonging to this device. ** Returns     : return error codes*               - ERR_OK: packet transferred to hardware***********************************************************************************************************/static err_t cs8900_init(void){    CS8900_Service_Sem = OSSemCreate(0);   /* semaphore to awaken the cs8900 service routine after an isr occurs */            while((cs8900_reset() & 0x8000) != 0x8000) { // if device is not ready...(initd should be set when ready)  //todo add timeout       OSTimeDly(10);    }         ppWrite(CS_PP_INTNUM,  0x0000U);        //set the cs8900 interrupt to use to pin cs8900 pin 0, (connected to 9s12 micro using IRQ pin)	 ppWrite(CS_PP_RXCFG,   0x0301U);        //receiver configuration register	 ppWrite(CS_PP_RXCTL,   0x050DU);        //receiver control register	 ppWrite(CS_PP_BUFCFG,  0x0B05U);        //bus configuration register	 ppWrite(CS_PP_BUSCTL,  0x1780U);        //bus control register	 ppWrite(CS_PP_LINECTL, 0xD300U);        //line control register	 ppWrite(CS_PP_IA1,     0x0050U);        //mac address high bytes	 ppWrite(CS_PP_IA2,     0xC225U); 		   //mac address middle bytes	 ppWrite(CS_PP_IA3,     0x600BU);				 //mac address low bytes 	 	 INTCR = 0x40;                           //re-enable the irq pin now the the cs8900 is ready to go      return ERR_OK;}/***********************************************************************************************************                 Reset the CS8900A using a hardware reset** Description : Pulls the CS8900's reset pin high to reset the ethernet controller.*               * Arguments   : None* Notes       : Not User Accessible.            **********************************************************************************************************/static INT16U cs8900_reset(void){	 //default state for the signal bus (no inputs asserted)	 Signal_B = 0x06;	    /* pull reset pin and wait a bit */   Signal_B |= CS8900_RESET;   OSTimeDly(10);   /* release reset pin and wait a bit*/   Signal_B &= ~CS8900_RESET;   OSTimeDly(10);     //toggle SBHE to enter 16 bit mode (as specified in the datasheet)   Signal_B |= CS8900_SBHE;  //SBHE active   OSTimeDly(10);   Signal_B &= ~CS8900_SBHE; //SBHE inactive   OSTimeDly(10);   Signal_B |= CS8900_SBHE;  //SBHE active   OSTimeDly(10);   Signal_B &= ~CS8900_SBHE; //SBHE inactive   OSTimeDly(10);   //return the value of the selftest register which tells us if the device has finished resetting   return  ppRead(CS_PP_SELFTEST); }/***********************************************************************************************************                              CS8900 Interrupt Service Routine** Description : function which gets called after the cs8900 asserts a hardware interrupt *               this posts a semaphore to the OS in order to awaken ServiceCS8900 which *               actually does the dirty work. The hardware interrupt pin is disabled here as well.*                * Arguments   : None**********************************************************************************************************/void CS8900_Interrupt(void) {   INT8U  err;   INT16U isq_data;               //hold the isq event register number   INTCR = 0x00;                  //disable the irq pin!     /* do      {         isq_data = IORead(CS8900_ISQ) >> 8;			            switch(isq_data & 0x3f)	       {	          case 0x00:                   //isq is empty. exit.	             break;	          case 0x04:										//receieve event	             cs8900if_input(&netif);	             break;	          case 0x08:										//transmit event	             break;            case 0x0C:										//buffer event   	             break; 	          case 0x10:										//receiver miss event  	           break;	          case 0x12:										//transmit collision event 	             break;            default:										  //should never be here event. 	             break;	       }       }while(isq_data != 0);            */   err = OSSemPost(CS8900_Service_Sem);   //signal ServiceCS8900 to run.	 }/***********************************************************************************************************                              CS8900 Service Routine** Description : function which gets called after the cs8900 interrupt routine runs and posts a *               semaphore to awaken this task and service the cs8900 ISQ and get data etc...*               When done servicing the cs8900, the hardware interrupt pin is re-enabled.*                * Arguments   : None**********************************************************************************************************/void ServiceCS8900(void){   INT8U err;   INT16U isq_data;               //hold the isq event register number     while(1)   {      OSSemPend(CS8900_Service_Sem, 0, &err);                         do      {         isq_data = IORead(CS8900_ISQ) >> 8;			            switch(isq_data & 0x3f)	       {	          case 0x00:                   //isq is empty. exit.	             break;	          case 0x04:										//receieve event	             cs8900if_input(&netif);	             break;	          case 0x08:										//transmit event	             break;            case 0x0C:										//buffer event   	             break; 	          case 0x10:										//receiver miss event  	           break;	          case 0x12:										//transmit collision event 	             break;            default:										  //should never be here event. 	             break;	       }       }while(isq_data != 0);                    INTCR = 0x40;                       //re-enable interrupts   	    }}												/***********************************************************************************************************                 Read a received packet from the CS8900.** Description : This function should be called when a packet is received by the CS8900*               and is fully available to read. It moves the received packet to a pbuf*               which is forwarded to the IP network layer or ARP module. It transmits*               a resulting ARP reply or queued packet.*               * Arguments   : netif: The lwIP network interface to read from.* * Notes       : Uses cs8900_input() to move the packet from the CS8900 to a*               newly allocated pbuf.**********************************************************************************************************/void cs8900if_input(struct netif *netif){  struct cs8900if *cs8900if = netif->state;  struct eth_hdr *ethhdr = NULL;  struct pbuf *p = NULL, *q = NULL;  /* move received packet into a new pbuf */  p = cs8900_input(netif);  /* no packet could be read */  if (p == NULL) {    /* silently ignore this */    return;  }  /* points to packet payload, which starts with an Ethernet header */  ethhdr = p->payload;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区在线视频| 国产精品美女视频| 一区二区在线观看免费视频播放| 欧美r级在线观看| 一区二区三区欧美日韩| 成人在线综合网| 国产色综合久久| 丝袜诱惑制服诱惑色一区在线观看| 91麻豆国产香蕉久久精品| 国产亚洲一本大道中文在线| 日本成人在线网站| 欧美高清视频不卡网| 亚洲国产va精品久久久不卡综合| 国产一区二区三区在线观看免费视频 | 不卡大黄网站免费看| 国产一区二区久久| 91啪九色porn原创视频在线观看| 免费成人美女在线观看| 91精品黄色片免费大全| 性久久久久久久久| 91欧美激情一区二区三区成人| 久久亚洲捆绑美女| 日本怡春院一区二区| 欧美丰满美乳xxx高潮www| 亚洲毛片av在线| 中文字幕一区免费在线观看| 亚洲欧美在线另类| 国产乱码精品一品二品| 欧美一级xxx| 亚洲宅男天堂在线观看无病毒| 国产福利视频一区二区三区| 久久五月婷婷丁香社区| 国产精品影视在线观看| 欧美偷拍一区二区| 天堂蜜桃一区二区三区| 91精品国产一区二区人妖| 免费亚洲电影在线| 成人aa视频在线观看| 日本一区二区电影| 久久精品国产精品青草| 日韩一区二区三区四区五区六区| 久久超碰97人人做人人爱| 国产女同性恋一区二区| 91蝌蚪porny九色| 亚洲男人天堂一区| 成人深夜福利app| 午夜精品爽啪视频| 久久久精品黄色| 91久久精品网| 久久电影网站中文字幕| 最新不卡av在线| 69成人精品免费视频| yourporn久久国产精品| 91在线观看免费视频| 美女久久久精品| 亚洲日本青草视频在线怡红院 | 亚洲午夜羞羞片| 久久精品夜色噜噜亚洲aⅴ| 欧美一a一片一级一片| 国产在线精品视频| 久久精品国产在热久久| 亚洲一区在线观看视频| 国产精品你懂的| 精品黑人一区二区三区久久| 成人avav影音| 久久无码av三级| 欧美日韩性生活| 91网上在线视频| 国产成人免费视频网站| 久久精品国产亚洲一区二区三区 | 26uuu国产在线精品一区二区| 欧美日韩大陆在线| 欧美性xxxxx极品少妇| 色综合久久88色综合天天| 国产.欧美.日韩| 国产不卡视频一区二区三区| 久久丁香综合五月国产三级网站 | 国产精品小仙女| 精品一二线国产| 另类小说图片综合网| 国产成人在线视频播放| 亚洲va国产天堂va久久en| 中文字幕一区二区三区在线不卡| 日本一二三四高清不卡| 国产日韩欧美亚洲| 国产精品乱码一区二三区小蝌蚪| 日本一区二区三区四区| 亚洲视频一区二区在线观看| 国产片一区二区三区| 99国产精品久久久久久久久久久| 成人亚洲一区二区一| av一区二区久久| 欧美日韩亚洲不卡| 欧美精品一区二区久久久| 国产欧美日韩在线观看| 一区二区三区精品| 美美哒免费高清在线观看视频一区二区 | 亚洲人成网站色在线观看| 亚洲人成伊人成综合网小说| 亚洲成av人综合在线观看| 理论片日本一区| 高潮精品一区videoshd| 欧美日韩在线播放一区| 久久久久综合网| 亚洲精品久久久久久国产精华液| 日本大胆欧美人术艺术动态| 国产一区二区在线影院| 欧美最猛黑人xxxxx猛交| 欧美一级爆毛片| 1024成人网色www| 日本不卡在线视频| 精品一区免费av| 久久国产尿小便嘘嘘| 日韩一区二区免费高清| 日本不卡1234视频| 欧美群妇大交群的观看方式| 一区二区在线观看免费视频播放| 色久综合一二码| 性久久久久久久| 日韩一区二区三区三四区视频在线观看| 亚洲一区二区三区小说| 国产欧美精品一区二区三区四区| 亚洲乱码中文字幕| 粉嫩av一区二区三区| 精品久久久久久久久久久久包黑料 | 国产盗摄女厕一区二区三区| 91.com视频| 亚洲大片免费看| 在线欧美小视频| 亚洲婷婷在线视频| 成人av第一页| 最新久久zyz资源站| 高清久久久久久| 欧美国产激情一区二区三区蜜月| 国产一区二区福利| 久久久午夜精品| 国产成人av电影在线播放| 国产三级精品视频| 成人免费高清在线观看| 国产精品成人午夜| 国产a视频精品免费观看| 国产一级精品在线| 日韩美女视频一区| 91美女视频网站| 久久这里只精品最新地址| 日本一区二区综合亚洲| 亚洲一区二区精品3399| 成人听书哪个软件好| 欧美在线观看视频一区二区三区| 精品对白一区国产伦| 天涯成人国产亚洲精品一区av| 99久久精品国产导航| 国产精品少妇自拍| 日本电影亚洲天堂一区| 天天色天天操综合| 一级特黄大欧美久久久| 一区二区日韩电影| 91精品蜜臀在线一区尤物| 久久99精品国产.久久久久| 国产亲近乱来精品视频| 91极品视觉盛宴| 免费成人av在线| 欧美国产亚洲另类动漫| 91官网在线观看| 精品写真视频在线观看| 亚洲图片欧美激情| 67194成人在线观看| 不卡的av网站| 亚洲成人激情自拍| 久久人人爽人人爽| 欧美在线观看视频在线| 看电影不卡的网站| 色婷婷精品久久二区二区蜜臂av| 亚洲va天堂va国产va久| 国产日韩欧美一区二区三区乱码| 欧美在线视频日韩| 风间由美一区二区av101| 日韩高清一区二区| 一区二区三区在线视频免费| 久久久久久9999| 91精品欧美久久久久久动漫| 91碰在线视频| 成人一级视频在线观看| 韩国欧美国产1区| 三级久久三级久久| 中文字幕一区视频| 亚洲国产精品激情在线观看| 91精品国产一区二区三区蜜臀| 91视频在线看| 亚洲天堂成人在线观看| 久久噜噜亚洲综合| 在线播放/欧美激情| 色素色在线综合| 色999日韩国产欧美一区二区| 国产999精品久久| 加勒比av一区二区| 九九热在线视频观看这里只有精品| 日韩va欧美va亚洲va久久| 一区二区三区在线视频免费观看| 欧美极品美女视频|