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

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

?? 16bit_io_cs8900.c

?? 運用16位IO方式控制CS8900A芯片
?? C
?? 第 1 頁 / 共 2 頁
字號:
/** @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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲第一电影网| 国产99久久久国产精品| 精品一二三四区| 成人美女视频在线观看18| 欧美另类变人与禽xxxxx| 国产精品美女视频| 国产资源在线一区| 欧美精品久久99| 亚洲男人的天堂av| 成人免费高清在线| 国产亚洲va综合人人澡精品| 午夜视频一区在线观看| 91美女在线看| 国产精品久久99| 成人一区二区三区| 国产欧美精品在线观看| 久久97超碰国产精品超碰| 欧美一级黄色录像| 视频一区欧美日韩| 9191成人精品久久| 国产精品99久久久久久宅男| 日韩天堂在线观看| 男女激情视频一区| 日韩一区二区电影网| 免费人成在线不卡| 欧美一区二区三区人| 日韩激情视频网站| 欧美一卡在线观看| 精品无人码麻豆乱码1区2区| 在线综合视频播放| 免费视频一区二区| xfplay精品久久| 国产精品夜夜爽| 国产精品久久久久一区二区三区共 | 国产情人综合久久777777| 日韩电影免费在线| 欧美一区二区三区日韩视频| 久久国产尿小便嘘嘘| 2017欧美狠狠色| 国产成人在线视频免费播放| 国产精品久久久久久久久久免费看| 成人免费毛片片v| 亚洲欧美日韩电影| 欧美浪妇xxxx高跟鞋交| 蜜臀av一区二区三区| 久久亚洲二区三区| av一区二区久久| 亚洲福中文字幕伊人影院| 日韩一区二区免费视频| 国产二区国产一区在线观看| 亚洲丝袜美腿综合| 欧美精品在线观看播放| 久久不见久久见中文字幕免费| 国产视频一区在线播放| 在线观看国产精品网站| 91亚洲精品久久久蜜桃| 自拍偷拍亚洲激情| 欧美日本在线看| 国产大陆亚洲精品国产| 亚洲欧美日韩一区二区三区在线观看| 欧美日韩一级黄| 久久精品国产在热久久| 亚洲三级小视频| 欧美一区二区三区视频在线观看| 激情综合色播激情啊| 国产精品不卡一区| 日韩视频免费观看高清完整版在线观看 | 国产精品免费丝袜| 综合电影一区二区三区| 91精品国产欧美一区二区18 | 最新国产精品久久精品| 欧美午夜精品一区二区三区| 国产一区二区美女| 亚洲综合清纯丝袜自拍| 久久久综合网站| 欧美酷刑日本凌虐凌虐| 波多野结衣亚洲| 蜜臀av一区二区在线观看| 亚洲视频一区二区在线| 精品国一区二区三区| 色婷婷综合久久久久中文一区二区| 毛片基地黄久久久久久天堂| 最新久久zyz资源站| 精品国精品国产| 欧美日韩高清一区二区| 91日韩精品一区| 国产精品自在欧美一区| 日本欧美在线看| 亚洲一区二区美女| 自拍偷在线精品自拍偷无码专区| 精品国产麻豆免费人成网站| 欧美精选在线播放| 欧美综合一区二区三区| www.亚洲色图| 大美女一区二区三区| 久88久久88久久久| 秋霞电影网一区二区| 亚洲午夜久久久久中文字幕久| √…a在线天堂一区| 欧美韩日一区二区三区四区| 精品国产三级a在线观看| 欧美精品九九99久久| 精品视频资源站| 欧美日韩情趣电影| 欧美日韩第一区日日骚| 欧美日韩一二区| 欧美日韩在线播放一区| 欧美丝袜丝交足nylons图片| 日本久久电影网| 日本精品一区二区三区高清| 色综合久久精品| 欧洲另类一二三四区| 欧美三级电影一区| 欧美日本一区二区在线观看| 欧美日韩精品免费| 欧美日韩你懂得| 91精品国产91久久久久久最新毛片 | 久久久噜噜噜久久人人看| www一区二区| 欧美经典一区二区| 国产精品乱码人人做人人爱 | 在线观看国产91| 欧美日韩一区二区三区在线 | 亚洲色欲色欲www| 亚洲永久精品国产| 亚洲h精品动漫在线观看| 日韩成人精品在线观看| 美女爽到高潮91| 3d动漫精品啪啪1区2区免费| 欧美一区二区大片| 久久精品免费在线观看| 中文字幕亚洲不卡| 亚洲电影在线免费观看| 全部av―极品视觉盛宴亚洲| 激情六月婷婷久久| 97久久超碰精品国产| 欧美日韩国产中文| 国产亚洲成年网址在线观看| 国产精品电影一区二区| 亚洲综合久久久| 久久66热偷产精品| 91视视频在线直接观看在线看网页在线看 | 高清beeg欧美| 91久久一区二区| 日韩免费视频一区| 国产精品国产三级国产aⅴ原创 | 国产91综合网| 色久综合一二码| 欧美成人r级一区二区三区| 国产精品美女www爽爽爽| 亚洲成年人网站在线观看| 国产麻豆午夜三级精品| 91黄色免费看| 久久久久久久久久久99999| 亚洲一区二区视频在线观看| 激情成人综合网| 欧美日韩精品系列| 中文字幕不卡一区| 麻豆一区二区三| 在线影视一区二区三区| 久久久久久久久97黄色工厂| 五月婷婷色综合| 99久久精品99国产精品| 久久青草国产手机看片福利盒子 | www.欧美日韩| 精品久久久久久久一区二区蜜臀| 亚洲美女偷拍久久| 国产精品夜夜爽| 91精品久久久久久久99蜜桃| 亚洲日本一区二区三区| 国产河南妇女毛片精品久久久| 欧美精品欧美精品系列| 亚洲免费观看高清完整版在线 | 色猫猫国产区一区二在线视频| 精品国产欧美一区二区| 视频在线观看91| 欧洲av一区二区嗯嗯嗯啊| 国产精品久久久久国产精品日日| 国内成+人亚洲+欧美+综合在线| 欧美色爱综合网| 亚洲一区二区五区| 在线看日韩精品电影| 亚洲特黄一级片| 99精品视频在线观看免费| 国产精品久久三区| 国产成人免费av在线| xnxx国产精品| 国产真实乱对白精彩久久| 日韩视频国产视频| 日韩国产在线观看| 欧美一卡二卡在线| 男女男精品视频| 日韩精品中文字幕在线一区| 在线观看日韩高清av| 国产精品不卡一区二区三区| 99免费精品在线观看| 国产精品久久久久影院色老大| www.亚洲色图.com| 亚洲精品美国一| 欧美日韩色综合|