ban4jp -
/
uIP-1-0_webserver
uIP 1.0 based webserver for LPC1114 + ENC28J60
Embed:
(wiki syntax)
Show/hide line numbers
tapdev.cpp
00001 /* 00002 * Copyright (c) 2001, Swedish Institute of Computer Science. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 00016 * 3. Neither the name of the Institute nor the names of its contributors 00017 * may be used to endorse or promote products derived from this software 00018 * without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 00024 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00025 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00026 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00027 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00028 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00029 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00030 * SUCH DAMAGE. 00031 * 00032 * Author: Adam Dunkels <adam@sics.se> 00033 * 00034 * $Id: tapdev.c,v 1.8 2006/06/07 08:39:58 adam Exp $ 00035 */ 00036 00037 #include "mbed.h" 00038 00039 #include "enc28j60.h" 00040 #include "uip.h" 00041 00042 #if defined(TARGET_LPC1768) 00043 SPI spi(p11, p12, p13); // mosi, miso, sclk 00044 ENC28J60 enc28j60(&spi, p14, p15); // cs, int 00045 #elif defined(TARGET_LPC1114) 00046 SPI spi(dp2, dp1, dp6); // mosi, miso, sclk 00047 ENC28J60 enc28j60(&spi, dp25, dp26); // cs, int 00048 #else 00049 #error no defined tapdev. 00050 #endif 00051 00052 /*---------------------------------------------------------------------------*/ 00053 void 00054 tapdev_init(void) 00055 { 00056 enc28j60.init(); 00057 00058 //enc28j60.regDump(); 00059 00060 } 00061 /*---------------------------------------------------------------------------*/ 00062 unsigned int 00063 tapdev_read(void) 00064 { 00065 unsigned int len; 00066 len = enc28j60.packetReceive(UIP_BUFSIZE, (u8 *)uip_buf); 00067 return len; 00068 } 00069 /*---------------------------------------------------------------------------*/ 00070 void 00071 tapdev_send(void) 00072 { 00073 enc28j60.packetSend(uip_len, (u8 *)uip_buf); 00074 00075 /* 00076 if(uip_len <= 40 + UIP_LLH_LEN){ 00077 enc28j60.packetSend(uip_len, (u8 *)uip_buf); 00078 }else{ 00079 enc28j60.packetSend2(54, (u8 *)uip_buf, uip_len -40 - UIP_LLH_LEN, (u8 *)uip_appdata); 00080 } 00081 */ 00082 } 00083 /*---------------------------------------------------------------------------*/
Generated on Tue Jul 12 2022 12:52:12 by 1.7.2