mirror of
https://github.com/johncobb/avr_328p_freertos.git
synced 2025-07-08 16:11:03 +03:00
added support for lwip
This commit is contained in:
94
network/exclude/ethernet.c
Normal file
94
network/exclude/ethernet.c
Normal file
@ -0,0 +1,94 @@
|
||||
/*This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief ethernet management for AVR32 UC3.
|
||||
*
|
||||
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
|
||||
* - Supported devices: All AVR32 devices can be used.
|
||||
* - AppNote:
|
||||
*
|
||||
* \author Atmel Corporation: http://www.atmel.com \n
|
||||
* Support and FAQ: http://support.atmel.no/
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef EXCLUDE
|
||||
/* Copyright (c) 2007, Atmel Corporation 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 ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/* Scheduler include files. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Demo program include files. */
|
||||
//#include "partest.h"
|
||||
//#include "serial.h"
|
||||
|
||||
#include "lwipopts.h"
|
||||
|
||||
/* lwIP includes */
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/api.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "netif/loopif.h"
|
||||
|
||||
|
||||
|
||||
|
||||
static void prvlwIPInit( void );
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief start lwIP layer.
|
||||
*/
|
||||
static void prvlwIPInit( void )
|
||||
{
|
||||
/* Initialize lwIP and its interface layer. */
|
||||
#if LWIP_STATS
|
||||
stats_init();
|
||||
#endif
|
||||
|
||||
sys_init();
|
||||
mem_init();
|
||||
memp_init();
|
||||
pbuf_init();
|
||||
netif_init();
|
||||
|
||||
/* once TCP stack has been initalized, set hw and IP parameters, initialize MACB too */
|
||||
//tcpip_init( prvEthernetConfigureInterface, NULL );
|
||||
}
|
||||
|
||||
#endif
|
62
network/exclude/ethernet.h
Normal file
62
network/exclude/ethernet.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*This file has been prepared for Doxygen automatic documentation generation.*/
|
||||
/*! \file *********************************************************************
|
||||
*
|
||||
* \brief ethernet headers for AVR32 UC3.
|
||||
*
|
||||
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
|
||||
* - Supported devices: All AVR32 devices can be used.
|
||||
* - AppNote:
|
||||
*
|
||||
* \author Atmel Corporation: http://www.atmel.com \n
|
||||
* Support and FAQ: http://support.atmel.no/
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef EXCLUDE
|
||||
/* Copyright (c) 2007, Atmel Corporation 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 ATMEL may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND
|
||||
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ETHERNET_H
|
||||
#define ETHERNET_H
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief create ethernet task, for ethernet management.
|
||||
*
|
||||
* \param uxPriority Input. priority for the task, it should be low
|
||||
*
|
||||
*/
|
||||
void vStartEthernetTask( unsigned portBASE_TYPE uxPriority );
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
65
network/sio.c
Normal file
65
network/sio.c
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* sio.c
|
||||
*
|
||||
* Created on: Feb 12, 2015
|
||||
* Author: jcobb
|
||||
*/
|
||||
|
||||
#include "lwip/sio.h"
|
||||
#include "netif/ppp/ppp.h"
|
||||
|
||||
|
||||
void linkStatusCB(void *ctx, int errCode, void *arg)
|
||||
{
|
||||
int *connected = (int*) ctx;
|
||||
|
||||
struct ppp_addrs *addrs = arg;
|
||||
|
||||
if(errCode == PPPERR_NONE) {
|
||||
// life's good
|
||||
*connected = 1;
|
||||
|
||||
// syslog(LOG_DEBUG, "ip_addr = %s", inet_ntoa(addrs->our_ipaddr));
|
||||
// syslog(LOG_DEBUG, "netmask = %s", inet_ntoa(addrs->netmask));
|
||||
// syslog(LOG_DEBUG, "dns1 = %s", inet_ntoa(addrs->dns1));
|
||||
// syslog(LOG_DEBUG, "dns2 = %s", inet_ntoa(addrs->dns2));
|
||||
} else {
|
||||
// connection lost
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sio_fd_t sio_open(u8_t x)
|
||||
{
|
||||
sio_fd_t a = 0;
|
||||
return a;
|
||||
|
||||
}
|
||||
|
||||
void sio_send(u8_t x, sio_fd_t y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
u8_t sio_recv(sio_fd_t x)
|
||||
{
|
||||
u8_t a = 0;
|
||||
return a;
|
||||
}
|
||||
|
||||
u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)
|
||||
{
|
||||
u32_t tmp = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len)
|
||||
{
|
||||
u32_t tmp = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void sio_read_abort(sio_fd_t fd)
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user