From cfc5f8fbaf2ea5deeaac3d31e00c83b478123f47 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 28 Oct 2017 10:25:57 -0600 Subject: [PATCH] drivers/net: Remove the old, unfinished Crystal LAN driver. I don't even have the hardware that it goes with anymore. --- TODO | 10 +- drivers/net/Kconfig | 8 - drivers/net/Make.defs | 4 - drivers/net/cs89x0.c | 1017 ------------------------------------ drivers/net/cs89x0.h | 326 ------------ include/nuttx/net/cs89x0.h | 141 ----- 6 files changed, 1 insertion(+), 1505 deletions(-) delete mode 100644 drivers/net/cs89x0.c delete mode 100644 drivers/net/cs89x0.h delete mode 100644 include/nuttx/net/cs89x0.h diff --git a/TODO b/TODO index 2259bd76d7..25fffb9b87 100644 --- a/TODO +++ b/TODO @@ -19,7 +19,7 @@ nuttx/: (8) Kernel/Protected Build (3) C++ Support (6) Binary loaders (binfmt/) - (17) Network (net/, drivers/net) + (16) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (0) Other drivers (drivers/) (12) Libraries (libc/, libm/) @@ -1079,14 +1079,6 @@ o Network (net/, drivers/net) Status: Open Priority: Low. - Title: UNFINISHED CRYSTALLAN CS89X0 DRIVER - Description: I started coding a CrystalLan CS89x0 driver (drivers/net/cs89x0.c), - but never finished it. - Status: Closed. - Priority: Low. I don't plan to finish the CS89x0 driver. It is just - history now. The unfinished coded is retained in case someone - needs to resurrect it. - Title: INTERFACES TO LEAVE/JOIN IGMP MULTICAST GROUP Description: The interfaces used to leave/join IGMP multicast groups is non-standard. RFC3678 (IGMPv3) suggests ioctl() commands to do this (SIOCSIPMSFILTER) but diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f360e33f68..b976953331 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -204,14 +204,6 @@ endchoice # Work queue endif # NET_DM90x0 -config NET_CS89x0 - bool "CS89x0 support" - default n - depends on EXPERIMENTAL - select ARCH_HAVE_NETDEV_STATISTICS - ---help--- - Under construction -- do not use - menuconfig ENC28J60 bool "Microchip ENC28J60 support" default n diff --git a/drivers/net/Make.defs b/drivers/net/Make.defs index 144313623b..c91aaee6e8 100644 --- a/drivers/net/Make.defs +++ b/drivers/net/Make.defs @@ -51,10 +51,6 @@ ifeq ($(CONFIG_NET_DM90x0),y) CSRCS += dm90x0.c endif -ifeq ($(CONFIG_NET_CS89x0),y) - CSRCS += cs89x0.c -endif - ifeq ($(CONFIG_ENC28J60),y) CSRCS += enc28j60.c endif diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c deleted file mode 100644 index 3dd1e7e0dd..0000000000 --- a/drivers/net/cs89x0.c +++ /dev/null @@ -1,1017 +0,0 @@ -/**************************************************************************** - * drivers/net/cs89x0.c - * - * Copyright (C) 2009-2011, 2014-2016 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#if defined(CONFIG_NET) && defined(CONFIG_NET_CS89x0) - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#ifdef CONFIG_NET_PKT -# include -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#error "Under construction -- do not use" - -/* CONFIG_CS89x0_NINTERFACES determines the number of physical interfaces - * that will be supported. - */ - -#ifndef CONFIG_CS89x0_NINTERFACES -# define CONFIG_CS89x0_NINTERFACES 1 -#endif - -/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */ - -#define CS89x0_WDDELAY (1*CLK_TCK) - -/* TX timeout = 1 minute */ - -#define CS89x0_TXTIMEOUT (60*CLK_TCK) - -/* This is a helper pointer for accessing the contents of the Ethernet header */ - -#define BUF ((struct eth_hdr_s *)cs89x0->cs_dev.d_buf) - -#define PKTBUF_SIZE (MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE) - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static FAR struct cs89x0_driver_s *g_cs89x0[CONFIG_CS89x0_NINTERFACES]; - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/* CS89x0 register access */ - -static uint16_t cs89x0_getreg(struct cs89x0_driver_s *cs89x0, int offset); -static void cs89x0_putreg(struct cs89x0_driver_s *cs89x0, int offset, - uint16_t value); -static uint16_t cs89x0_getppreg(struct cs89x0_driver_s *cs89x0, int addr); -static void cs89x0_putppreg(struct cs89x0_driver_s *cs89x0, int addr, - uint16_t value); - -/* Common TX logic */ - -static int cs89x0_transmit(struct cs89x0_driver_s *cs89x0); -static int cs89x0_txpoll(struct net_driver_s *dev); - -/* Interrupt handling */ - -static void cs89x0_receive(struct cs89x0_driver_s *cs89x0); -static void cs89x0_txdone(struct cs89x0_driver_s *cs89x0, uint16_t isq); -static int cs89x0_interrupt(int irq, FAR void *context, FAR void *arg); - -/* Watchdog timer expirations */ - -static void cs89x0_polltimer(int argc, uint32_t arg, ...); -static void cs89x0_txtimeout(int argc, uint32_t arg, ...); - -/* NuttX callback functions */ - -static int cs89x0_ifup(struct net_driver_s *dev); -static int cs89x0_ifdown(struct net_driver_s *dev); -static int cs89x0_txavail(struct net_driver_s *dev); -#ifdef CONFIG_NET_IGMP -static int cs89x0_addmac(struct net_driver_s *dev, FAR const uint8_t *mac); -static int cs89x0_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac); -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: cs89x0_getreg and cs89x0_putreg - * - * Description: - * Read from and write to a CS89x0 register - * - * Parameters: - * cs89x0 - Reference to the driver state structure - * offset - Offset to the CS89x0 register - * value - Value to be written (cs89x0_putreg only) - * - * Returned Value: - * cs89x0_getreg: The 16-bit value of the register - * cs89x0_putreg: None - * - ****************************************************************************/ - -static uint16_t cs89x0_getreg(struct cs89x0_driver_s *cs89x0, int offset) -{ -#ifdef CONFIG_CS89x0_ALIGN16 - return getreg16(s89x0->cs_base + offset); -#else - return (uint16_t)getreg32(s89x0->cs_base + offset); -#endif -} - -static void cs89x0_putreg(struct cs89x0_driver_s *cs89x0, int offset, uint16_t value) -{ -#ifdef CONFIG_CS89x0_ALIGN16 - return putreg16(value, s89x0->cs_base + offset); -#else - return (uint16_t)putreg32((uint32_t)value, s89x0->cs_base + offset); -#endif -} - -/**************************************************************************** - * Name: cs89x0_getppreg and cs89x0_putppreg - * - * Description: - * Read from and write to a CS89x0 page packet register - * - * Parameters: - * cs89x0 - Reference to the driver state structure - * addr - Address of the CS89x0 page packet register - * value - Value to be written (cs89x0_putppreg only) - * - * Returned Value: - * cs89x0_getppreg: The 16-bit value of the page packet register - * cs89x0_putppreg: None - * - ****************************************************************************/ - -static uint16_t cs89x0_getppreg(struct cs89x0_driver_s *cs89x0, int addr) -{ - /* In memory mode, the CS89x0's internal registers and frame buffers are mapped - * into a contiguous 4kb block providing direct access to the internal registers - * and frame buffers. - */ - -#ifdef CONFIG_CS89x0_MEMMODE - if (cs89x0->cs_memmode) - { -#ifdef CONFIG_CS89x0_ALIGN16 - return getreg16(s89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??)); -#else - return (uint16_t)getreg32(s89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??)); -#endif - } - - /* When configured in I/O mode, the CS89x0 is accessed through eight, 16-bit - * I/O ports that in the host system's I/O space. - */ - - else -#endif - { -#ifdef CONFIG_CS89x0_ALIGN16 - putreg16((uint16_t)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET); - return getreg16(s89x0->cs_base + CS89x0_PDATA_OFFSET); -#else - putreg32((uint32_t)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET); - return (uint16_t)getreg32(s89x0->cs_base + CS89x0_PDATA_OFFSET); -#endif - } -} - -static void cs89x0_putppreg(struct cs89x0_driver_s *cs89x0, int addr, uint16_t value) -{ - /* In memory mode, the CS89x0's internal registers and frame buffers are mapped - * into a contiguous 4kb block providing direct access to the internal registers - * and frame buffers. - */ - -#ifdef CONFIG_CS89x0_MEMMODE - if (cs89x0->cs_memmode) - { -#ifdef CONFIG_CS89x0_ALIGN16 - putreg16(value), cs89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??)); -#else - putreg32((uint32_t)value, cs89x0->cs_ppbase + (CS89x0_PDATA_OFFSET << ??)); -#endif - } - - /* When configured in I/O mode, the CS89x0 is accessed through eight, 16-bit - * I/O ports that in the host system's I/O space. - */ - - else -#endif - { -#ifdef CONFIG_CS89x0_ALIGN16 - putreg16((uint16_t)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET); - putreg16(value, cs89x0->cs_base + CS89x0_PDATA_OFFSET); -#else - putreg32((uint32_t)addr, cs89x0->cs_base + CS89x0_PPTR_OFFSET); - putreg32((uint32_t)value, cs89x0->cs_base + CS89x0_PDATA_OFFSET); -#endif - } -} - -/**************************************************************************** - * Name: cs89x0_transmit - * - * Description: - * Start hardware transmission. Called either from the txdone interrupt - * handling or from watchdog based polling. - * - * Parameters: - * cs89x0 - Reference to the driver state structure - * - * Returned Value: - * OK on success; a negated errno on failure - * - * Assumptions: - * - ****************************************************************************/ - -static int cs89x0_transmit(struct cs89x0_driver_s *cs89x0) -{ - /* Verify that the hardware is ready to send another packet */ -#warning "Missing logic" - - /* Increment statistics */ -#warning "Missing logic" - - /* Disable Ethernet interrupts */ -#warning "Missing logic" - - /* Send the packet: address=cs89x0->cs_dev.d_buf, length=cs89x0->cs_dev.d_len */ -#warning "Missing logic" - - /* Restore Ethernet interrupts */ -#warning "Missing logic" - - /* Setup the TX timeout watchdog (perhaps restarting the timer) */ - - (void)wd_start(cs89x0->cs_txtimeout, CS89x0_TXTIMEOUT, cs89x0_txtimeout, - 1, (wdparm_t)cs89x0); - return OK; -} - -/**************************************************************************** - * Name: cs89x0_txpoll - * - * Description: - * The transmitter is available, check if the network has any outgoing packets ready - * to send. This is a callback from devif_poll(). devif_poll() may be called: - * - * 1. When the preceding TX packet send is complete, - * 2. When the preceding TX packet send timesout and the interface is reset - * 3. During normal TX polling - * - * Parameters: - * dev - Reference to the NuttX driver state structure - * - * Returned Value: - * OK on success; a negated errno on failure - * - * Assumptions: - * - ****************************************************************************/ - -static int cs89x0_txpoll(struct net_driver_s *dev) -{ - struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)dev->d_private; - - /* If the polling resulted in data that should be sent out on the network, - * the field d_len is set to a value > 0. - */ - - if (cs89x0->cs_dev.d_len > 0) - { - /* Look up the destination MAC address and add it to the Ethernet - * header. - */ - -#ifdef CONFIG_NET_IPv4 -#ifdef CONFIG_NET_IPv6 - if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags)) -#endif - { - arp_out(&cs89x0->cs_dev); - } -#endif /* CONFIG_NET_IPv4 */ - -#ifdef CONFIG_NET_IPv6 -#ifdef CONFIG_NET_IPv4 - else -#endif - { - neighbor_out(&cs89x0->cs_dev); - } -#endif /* CONFIG_NET_IPv6 */ - - /* Send the packet */ - - cs89x0_transmit(cs89x0); - - /* Check if there is room in the CS89x0 to hold another packet. If not, - * return a non-zero value to terminate the poll. - */ -#warning "Missing logic" - } - - /* If zero is returned, the polling will continue until all connections have - * been examined. - */ - - return 0; -} - -/**************************************************************************** - * Name: cs89x0_receive - * - * Description: - * An interrupt was received indicating the availability of a new RX packet - * - * Parameters: - * cs89x0 - Reference to the driver state structure - * isq - Interrupt status queue value read by interrupt handler - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void cs89x0_receive(FAR struct cs89x0_driver_s *cs89x0, uint16_t isq) -{ - FAR uint16_t *dest; - uint16_t rxlength; - int nbytes; - - /* Check for errors and update statistics */ - - rxlength = cs89x0_getreg(PPR_RXLENGTH); - if ((isq & RX_OK) == 0) - { -#ifdef CONFIG_NETDEV_STATISTICS - NETDEV_RXERRORS(&cd89x0->cs_dev); - -#if 0 - if ((isq & RX_RUNT) != 0) - { - } - - if ((isq & RX_EXTRA_DATA) != 0) - { - } - - if (isq & RX_CRC_ERROR) != 0) - { - if (!(isq & (RX_EXTRA_DATA | RX_RUNT))) - { - } - } - - if ((isq & RX_DRIBBLE) != 0) - { - } -#endif -#endif - - return; - } - - /* Check if the packet is a valid size for the network buffer configuration */ - - if (rxlength > ???) - { - NETDEV_RXERRORS(&cd89x0->cs_dev); - return; - } - - /* Copy the data data from the hardware to cs89x0->cs_dev.d_buf. Set - * amount of data in cs89x0->cs_dev.d_len - */ - - dest = (FAR uint16_t *)cs89x0->cs_dev.d_buf; - for (nbytes = 0; nbytes < rxlength; nbytes += sizeof(uint16_t)) - { - *dest++ = cs89x0_getreg(PPR_RXFRAMELOCATION); - } - - NETDEV_RXPACKETS(&cd89x0->cs_dev); - -#ifdef CONFIG_NET_PKT - /* When packet sockets are enabled, feed the frame into the packet tap */ - - pkt_input(&cs89x0->cs_dev); -#endif - - /* We only accept IP packets of the configured type and ARP packets */ - -#ifdef CONFIG_NET_IPv4 - if (BUF->type == HTONS(ETHTYPE_IP)) - { - ninfo("IPv4 frame\n"); - NETDEV_RXIPV4(&priv->cs_dev); - - /* Handle ARP on input then give the IPv4 packet to the network - * layer - */ - - arp_ipin(&cs89x0->cs_dev); - ipv4_input(&cs89x0->cs_dev); - - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ - - if (cs89x0->cs_dev.d_len > 0) - { - /* Update the Ethernet header with the correct MAC address */ - -#ifdef CONFIG_NET_IPv6 - if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags)) -#endif - { - arp_out(&cs89x0->cs_dev); - } -#ifdef CONFIG_NET_IPv6 - else - { - neighbor_out(&s89x0->cs_dev); - } -#endif - - /* And send the packet */ - - cs89x0_transmit(cs89x0); - } - } - else -#endif -#ifdef CONFIG_NET_IPv6 - if (BUF->type == HTONS(ETHTYPE_IP6)) - { - ninfo("Iv6 frame\n"); - NETDEV_RXIPV6(&priv->cs_dev); - - /* Give the IPv6 packet to the network layer */ - - ipv6_input(&cs89x0->cs_dev); - - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ - - if (cs89x0->cs_dev.d_len > 0) - { - /* Update the Ethernet header with the correct MAC address */ - -#ifdef CONFIG_NET_IPv4 - if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags)) - { - arp_out(&cs89x0->cs_dev); - } - else -#endif -#ifdef CONFIG_NET_IPv6 - { - neighbor_out(&cs89x0->cs_dev); - } -#endif - - /* And send the packet */ - - cs89x0_transmit(cs89x0); - } - } - else -#endif -#ifdef CONFIG_NET_ARP - if (BUF->type == htons(ETHTYPE_ARP)) - { - NETDEV_RXARP(&priv->cs_dev); - arp_arpin(&cs89x0->cs_dev); - - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ - - if (cs89x0->cs_dev.d_len > 0) - { - cs89x0_transmit(cs89x0); - } - } - else -#endif - { - ninfo("Unrecognized packet type %02x\n", BUF->type); - NETDEV_RXDROPPED(&priv->cs_dev); - } -} - -/**************************************************************************** - * Name: cs89x0_txdone - * - * Description: - * An interrupt was received indicating that the last TX packet(s) is done - * - * Parameters: - * cs89x0 - Reference to the driver state structure - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void cs89x0_txdone(struct cs89x0_driver_s *cs89x0, uint16_t isq) -{ - /* Check for errors and update statistics. The lower 6-bits of the ISQ - * hold the register address causing the interrupt. We got here because - * those bits indicated */ - -#ifdef CONFIG_NETDEV_STATISTICS - NETDEV_TXPACKETS(&cd89x0->cs_dev); - if ((isq & ISQ_TXEVENT_TXOK) == 0) - { - NETDEV_TXERRORS(&cd89x0->cs_dev); - } - -#if 0 - if ((isq & ISQ_TXEVENT_LOSSOFCRS) != 0) - { - } - - if ((isq & ISQ_TXEVENT_SQEERROR) != 0) - { - } - - if (i(sq & ISQ_TXEVENT_OUTWINDOW) != 0) - { - } - - if (isq & TX_16_COL) - { - } -#endif -#endif - - /* If no further xmits are pending, then cancel the TX timeout */ - - wd_cancel(cs89x0->cs_txtimeout); - - /* Then poll the network for new XMIT data */ - - (void)devif_poll(&cs89x0->cs_dev, cs89x0_txpoll); -} - -/**************************************************************************** - * Name: cs89x0_interrupt - * - * Description: - * Hardware interrupt handler - * - * Parameters: - * irq - Number of the IRQ that generated the interrupt - * context - Interrupt register state save info (architecture-specific) - * - * Returned Value: - * OK on success - * - * Assumptions: - * - ****************************************************************************/ - -static int cs89x0_interrupt(int irq, FAR void *context, FAR void *arg) -{ - FAR struct cs89x0_driver_s *cs89x0 = (FAR struct cs89x0_driver_s *)arg; - uint16_t isq; - - DEBUGASSERT(cs89x0 != NULL); - - /* Read and process all of the events from the ISQ */ - - while ((isq = cs89x0_getreg(dev, CS89x0_ISQ_OFFSET)) != 0) - { - ninfo("ISQ: %04x\n", isq); - switch (isq & ISQ_EVENTMASK) - { - case ISQ_RXEVENT: - cs89x0_receive(cs89x0); - break; - - case ISQ_TXEVENT: - cs89x0_txdone(cs89x0, isq); - break; - - case ISQ_BUFEVENT: - if ((isq & ISQ_BUFEVENT_TXUNDERRUN) != 0) - { - nerr("ERROR: Transmit underrun\n"); -#ifdef CONFIG_CS89x0_XMITEARLY - cd89x0->cs_txunderrun++; - if (cd89x0->cs_txunderrun == 3) - { - cd89x0->cs_txstart = PPR_TXCMD_TXSTART381; - } - else if (cd89x0->cs_txunderrun == 6) - { - cd89x0->cs_txstart = PPR_TXCMD_TXSTARTFULL; - } -#endif - } - break; - - case ISQ_RXMISSEVENT: - NETDEV_RXERRORS(&cd89x0->cs_dev); - break; - - case ISQ_TXCOLEVENT: - NETDEV_TXERRORS(&cd89x0->cs_dev); - break; - } - } - return OK; -} - -/**************************************************************************** - * Name: cs89x0_txtimeout - * - * Description: - * Our TX watchdog timed out. Called from the timer interrupt handler. - * The last TX never completed. Reset the hardware and start again. - * - * Parameters: - * argc - The number of available arguments - * arg - The first argument - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void cs89x0_txtimeout(int argc, uint32_t arg, ...) -{ - struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)arg; - - /* Increment statistics and dump debug info */ -#warning "Missing logic" - - /* Then reset the hardware */ -#warning "Missing logic" - - /* Then poll the network for new XMIT data */ - - (void)devif_poll(&cs89x0->cs_dev, cs89x0_txpoll); -} - -/**************************************************************************** - * Name: cs89x0_polltimer - * - * Description: - * Periodic timer handler. Called from the timer interrupt handler. - * - * Parameters: - * argc - The number of available arguments - * arg - The first argument - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static void cs89x0_polltimer(int argc, uint32_t arg, ...) -{ - struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)arg; - - /* Check if there is room in the send another TXr packet. */ -#warning "Missing logic" - - /* If so, update TCP timing states and poll the network for new XMIT data */ - - (void)devif_timer(&cs89x0->cs_dev, cs89x0_txpoll); - - /* Setup the watchdog poll timer again */ - - (void)wd_start(cs89x0->cs_txpoll, CS89x0_WDDELAY, cs89x0_polltimer, 1, - (wdparm_t)arg); -} - -/**************************************************************************** - * Name: cs89x0_ifup - * - * Description: - * NuttX Callback: Bring up the Ethernet interface when an IP address is - * provided - * - * Parameters: - * dev - Reference to the NuttX driver state structure - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static int cs89x0_ifup(struct net_driver_s *dev) -{ - struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)dev->d_private; - - ninfo("Bringing up: %d.%d.%d.%d\n", - dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff, - (dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24); - - /* Initialize the Ethernet interface */ -#warning "Missing logic" - - /* Set and activate a timer process */ - - (void)wd_start(cs89x0->cs_txpoll, CS89x0_WDDELAY, cs89x0_polltimer, 1, - (wdparm_t)cs89x0); - - /* Enable the Ethernet interrupt */ - - cs89x0->cs_bifup = true; - up_enable_irq(CONFIG_CS89x0_IRQ); - return OK; -} - -/**************************************************************************** - * Name: cs89x0_ifdown - * - * Description: - * NuttX Callback: Stop the interface. - * - * Parameters: - * dev - Reference to the NuttX driver state structure - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static int cs89x0_ifdown(struct net_driver_s *dev) -{ - struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)dev->d_private; - irqstate_t flags; - - /* Disable the Ethernet interrupt */ - - flags = enter_critical_section(); - up_disable_irq(CONFIG_CS89x0_IRQ); - - /* Cancel the TX poll timer and TX timeout timers */ - - wd_cancel(cs89x0->cs_txpoll); - wd_cancel(cs89x0->cs_txtimeout); - - /* Reset the device */ - - cs89x0->cs_bifup = false; - leave_critical_section(flags); - return OK; -} - -/**************************************************************************** - * Name: cs89x0_txavail - * - * Description: - * Driver callback invoked when new TX data is available. This is a - * stimulus perform an out-of-cycle poll and, thereby, reduce the TX - * latency. - * - * Parameters: - * dev - Reference to the NuttX driver state structure - * - * Returned Value: - * None - * - * Assumptions: - * Called in normal user mode - * - ****************************************************************************/ - -static int cs89x0_txavail(struct net_driver_s *dev) -{ - struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)dev->d_private; - irqstate_t flags; - - flags = enter_critical_section(); - - /* Ignore the notification if the interface is not yet up */ - - if (cs89x0->cs_bifup) - { - /* Check if there is room in the hardware to hold another outgoing packet. */ -#warning "Missing logic" - - /* If so, then poll the network for new XMIT data */ - - (void)devif_poll(&cs89x0->cs_dev, cs89x0_txpoll); - } - - leave_critical_section(flags); - return OK; -} - -/**************************************************************************** - * Name: cs89x0_addmac - * - * Description: - * NuttX Callback: Add the specified MAC address to the hardware multicast - * address filtering - * - * Parameters: - * dev - Reference to the NuttX driver state structure - * mac - The MAC address to be added - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -#ifdef CONFIG_NET_IGMP -static int cs89x0_addmac(struct net_driver_s *dev, FAR const uint8_t *mac) -{ - FAR struct cs89x0_driver_s *priv = (FAR struct cs89x0_driver_s *)dev->d_private; - - /* Add the MAC address to the hardware multicast routing table */ - -#warning "Multicast MAC support not implemented" - return OK; -} -#endif - -/**************************************************************************** - * Name: cs89x0_rmmac - * - * Description: - * NuttX Callback: Remove the specified MAC address from the hardware multicast - * address filtering - * - * Parameters: - * dev - Reference to the NuttX driver state structure - * mac - The MAC address to be removed - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -#ifdef CONFIG_NET_IGMP -static int cs89x0_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) -{ - FAR struct cs89x0_driver_s *priv = (FAR struct cs89x0_driver_s *)dev->d_private; - - /* Add the MAC address to the hardware multicast routing table */ - -#warning "Multicast MAC support not implemented" - return OK; -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: cs89x0_initialize - * - * Description: - * Initialize the Ethernet driver - * - * Parameters: - * impl - decribes the implementation of the cs89x00 implementation. - * This reference is retained so so must remain stable throughout the - * life of the driver instance. - * devno - Identifies the device number. This must be a number between - * zero CONFIG_CS89x0_NINTERFACES and the same devno must not be - * initialized twice. The associated network device will be referred - * to with the name "eth" followed by this number (eth0, eth1, etc). - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * - ****************************************************************************/ - -/* Initialize the CS89x0 chip and driver */ - -int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno) -{ - FAR uint8_t *pktbuf; - - /* Sanity checks -- only performed with debug enabled */ - -#ifdef CONFIG_DEBUG_FEATURES - if (!cs89x0 || (unsigned)devno > CONFIG_CS89x0_NINTERFACES || g_cs89x00[devno]) - { - return -EINVAL; - } -#endif - - /* Check if a Ethernet chip is recognized at its I/O base */ - -#warning "Missing logic" - - /* Attach the IRQ to the driver */ - - if (irq_attach(cs89x0->irq, cs89x0_interrupt, cs89x0)) - { - /* We could not attach the ISR to the ISR */ - - return -EAGAIN; - } - - /* Allocate a packet buffer */ - - pktbuf = (FAR uint_t *)kmm_alloc(MAX_NET_DEV_MTU + CONFIG_NET_GUARDSIZE); - if (pktbuf == NULL) - { - return -ENOMEM; - } - - /* Initialize the driver structure */ - - g_cs89x[devno] = cs89x0; /* Used to map IRQ back to instance */ - cs89x0->cs_dev.d_buf = g_pktbuf; /* Single packet buffer */ - cs89x0->cs_dev.d_ifup = cs89x0_ifup; /* I/F down callback */ - cs89x0->cs_dev.d_ifdown = cs89x0_ifdown; /* I/F up (new IP address) callback */ - cs89x0->cs_dev.d_txavail = cs89x0_txavail; /* New TX data callback */ -#ifdef CONFIG_NET_IGMP - cs89x0->cs_dev.d_addmac = cs89x0_addmac; /* Add multicast MAC address */ - cs89x0->cs_dev.d_rmmac = cs89x0_rmmac; /* Remove multicast MAC address */ -#endif - cs89x0->cs_dev.d_private = (FAR void *)cs89x0; /* Used to recover private state from dev */ - - /* Create a watchdog for timing polling for and timing of transmisstions */ - - cs89x0->cs_txpoll = wd_create(); /* Create periodic poll timer */ - cs89x0->cs_txtimeout = wd_create(); /* Create TX timeout timer */ - - /* Read the MAC address from the hardware into cs89x0->cs_dev.d_mac.ether.ether_addr_octet */ - - /* Register the device with the OS so that socket IOCTLs can be performed */ - - (void)netdev_register(&cs89x0->cs_dev, NET_LL_ETHERNET); - return OK; -} - -#endif /* CONFIG_NET && CONFIG_NET_CS89x0 */ diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h deleted file mode 100644 index f6d99120ab..0000000000 --- a/drivers/net/cs89x0.h +++ /dev/null @@ -1,326 +0,0 @@ -/**************************************************************************** - * drivers/net/cs89x0.h - * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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 __DRIVERS_NET_CS89x0_H -#define __DRIVERS_NET_CS89x0_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* CONFIG_CS89x0_ALIGN16/32 determines if the 16-bit CS89x0 registers are - * aligned to 16-bit or 32-bit address boundaries. NOTE: If there multiple - * CS89x00 parts in the board architecture, we assume that the address - * alignment is the same for all implementations. If that is not the - * case, then it will be necessary to move a shift value into - * the cs89x0_driver_s structure and calculate the offsets dynamically in - * the putreg and getreg functions. - */ - -#if defined(CONFIG_CS89x0_ALIGN16) -# define CS89x0_RTDATA_OFFSET (0 << 1) -# define CS89x0_TxCMD_OFFSET (2 << 1) -# define CS89x0_TxLEN_OFFSET (3 << 1) -# define CS89x0_ISQ_OFFSET (4 << 1) -# define CS89x0_PPTR_OFFSET (5 << 1) -# define CS89x0_PDATA_OFFSET (6 << 1) -#elif defined(CONFIG_CS89x0_ALIGN32) -# define CS89x0_RTDATA_OFFSET (0 << 2) -# define CS89x0_TxCMD_OFFSET (2 << 2) -# define CS89x0_TxLEN_OFFSET (3 << 2) -# define CS89x0_ISQ_OFFSET (4 << 2) -# define CS89x0_PPTR_OFFSET (5 << 2) -# define CS89x0_PDATA_OFFSET (6 << 2) -#else -# error "CS89x00 address alignment is not defined" -#endif - -/* ISQ register bit definitions */ - -#define ISQ_EVENTMASK 0x003f /* Bits 0-5 indicate the status register */ -#define ISQ_RXEVENT 0x0004 -#define ISQ_TXEVENT 0x0008 -#define ISQ_BUFEVENT 0x000c -#define ISQ_RXMISSEVENT 0x0010 -#define ISQ_TXCOLEVENT 0x0012 - -/* ISQ register TxEVENT bit definitions*/ - -#define ISQ_RXEVENT_IAHASH (1 << 6) -#define ISQ_RXEVENT_DRIBBLE (1 << 7) -#define ISQ_RXEVENT_RXOK (1 << 8) -#define ISQ_RXEVENT_HASHED (1 << 9) -#define ISQ_RXEVENT_HASHNDX_SHIFT 10 -#define ISQ_RXEVENT_HASHNDX_MASK (0x3f << ISQ_RXEVENT_HASHNDX_SHIFT) - -/* ISQ register TxEVENT bit definitions*/ - -#define ISQ_TXEVENT_LOSSOFCRS (1 << 6) -#define ISQ_TXEVENT_SQEERROR (1 << 7) -#define ISQ_TXEVENT_TXOK (1 << 8) -#define ISQ_TXEVENT_OUTWINDOW (1 << 9) -#define ISQ_TXEVENT_JABBER (1 << 10) -#define ISQ_TXEVENT_NCOLLISION_SHIFT 11 -#define ISQ_TXEVENT_NCOLLISION_MASK (15 << ISQ_TXEVENT_NCOLLISION_SHIFT) -#define ISQ_TXEVENT_16COLL (1 << 15) - -/* ISQ register BufEVENT bit definitions */ - -#define ISQ_BUFEVENT_SWINT (1 << 6) -#define ISQ_BUFEVENT_RXDMAFRAME (1 << 7) -#define ISQ_BUFEVENT_RDY4TX (1 << 8) -#define ISQ_BUFEVENT_TXUNDERRUN (1 << 9) -#define ISQ_BUFEVENT_RXMISS (1 << 10) -#define ISQ_BUFEVENT_RX128 (1 << 11) -#define ISQ_BUFEVENT_RXDEST (1 << 15) - -/* Packet page register offsets *********************************************/ - -/* 0x0000 Bus interface registers */ - -#define PPR_CHIPID 0x0000 /* Chip identifier - must be 0x630E */ -#define PPR_CHIPREV 0x0002 /* Chip revision, model codes */ -#define PPR_IOBASEADDRESS 0x0020 /* I/O Base Address */ -#define PPR_INTREG 0x0022 /* Interrupt configuration */ -# define PPR_INTREG_IRQ0 0x0000 /* Use INTR0 pin */ -# define PPR_INTREG_IRQ1 0x0001 /* Use INTR1 pin */ -# define PPR_INTREG_IRQ2 0x0002 /* Use INTR2 pin */ -# define PPR_INTREG_IRQ3 0x0003 /* Use INTR3 pin */ - -#define PPR_DMACHANNELNUMBER 0x0024 /* DMA Channel Number (0,1, or 2) */ -#define PPR_DMASTARTOFFRAME 0x0026 /* DMA Start of Frame */ -#define PPR_DMAFRAMECOUNT 0x0028 /* DMA Frame Count (12-bits) */ -#define PPR_RXDMABYTECOUNT 0x002a /* Rx DMA Byte Count */ -#define PPR_MEMORYBASEADDRESS 0x002c /* Memory Base Address Register (20-bit) */ -#define PPR_BOOTPROMBASEADDRESS 0x0030 /* Boot PROM Base Address */ -#define PPR_BOOTPROMADDRESSMASK 0x0034 /* Boot PROM Address Mask */ -#define PPR_EEPROMCOMMAND 0x0040 /* EEPROM Command */ -#define PPR_EEPROMDATA 0x0042 /* EEPROM Data */ -#define PPR_RECVFRAMEBYTES 0x0050 /* Received Frame Byte Counter */ - -/* 0x0100 - Configuration and control registers */ - -#define PPR_RXCFG 0x0102 /* Receiver configuration */ -# define PPR_RXCFG_SKIP1 (1 << 6) /* Skip (discard) current frame */ -# define PPR_RXCFG_STREAM (1 << 7) /* Enable streaming mode */ -# define PPR_RXCFG_RXOK (1 << 8) /* RxOK interrupt enable */ -# define PPR_RxCFG_RxDMAonly (1 << 9) /* Use RxDMA for all frames */ -# define PPR_RxCFG_AutoRxDMA (1 << 10) /* Select RxDMA automatically */ -# define PPR_RxCFG_BufferCRC (1 << 11) /* Include CRC characters in frame */ -# define PPR_RxCFG_CRC (1 << 12) /* Enable interrupt on CRC error */ -# define PPR_RxCFG_RUNT (1 << 13) /* Enable interrupt on RUNT frames */ -# define PPR_RxCFG_EXTRA (1 << 14) /* Enable interrupt on frames with extra data */ - -#define PPR_RXCTL 0x0104 /* Receiver control */ -# define PPR_RXCTL_IAHASH (1 << 6) /* Accept frames that match hash */ -# define PPR_RXCTL_PROMISCUOUS (1 << 7) /* Accept any frame */ -# define PPR_RXCTL_RXOK (1 << 8) /* Accept well formed frames */ -# define PPR_RXCTL_MULTICAST (1 << 9) /* Accept multicast frames */ -# define PPR_RXCTL_IA (1 << 10) /* Accept frame that matches IA */ -# define PPR_RXCTL_BROADCAST (1 << 11) /* Accept broadcast frames */ -# define PPR_RXCTL_CRC (1 << 12) /* Accept frames with bad CRC */ -# define PPR_RXCTL_RUNT (1 << 13) /* Accept runt frames */ -# define PPR_RXCTL_EXTRA (1 << 14) /* Accept frames that are too long */ - -#define PPR_TXCFG 0x0106 /* Transmit configuration */ -# define PPR_TXCFG_CRS (1 << 6) /* Enable interrupt on loss of carrier */ -# define PPR_TXCFG_SQE (1 << 7) /* Enable interrupt on Signal Quality Error */ -# define PPR_TXCFG_TXOK (1 << 8) /* Enable interrupt on successful xmits */ -# define PPR_TXCFG_LATE (1 << 9) /* Enable interrupt on "out of window" */ -# define PPR_TXCFG_JABBER (1 << 10) /* Enable interrupt on jabber detect */ -# define PPR_TXCFG_COLLISION (1 << 11) /* Enable interrupt if collision */ -# define PPR_TXCFG_16COLLISIONS (1 << 15) /* Enable interrupt if > 16 collisions */ - -#define PPR_TXCMD 0x0108 /* Transmit command status */ -# define PPR_TXCMD_TXSTART5 (0 << 6) /* Start after 5 bytes in buffer */ -# define PPR_TXCMD_TXSTART381 (1 << 6) /* Start after 381 bytes in buffer */ -# define PPR_TXCMD_TXSTART1021 (2 << 6) /* Start after 1021 bytes in buffer */ -# define PPR_TXCMD_TXSTARTFULL (3 << 6) /* Start after all bytes loaded */ -# define PPR_TXCMD_FORCE (1 << 8) /* Discard any pending packets */ -# define PPR_TXCMD_ONECOLLISION (1 << 9) /* Abort after a single collision */ -# define PPR_TXCMD_NOCRC (1 << 12) /* Do not add CRC */ -# define PPR_TXCMD_NOPAD (1 << 13) /* Do not pad short packets */ - -#define PPR_BUFCFG 0x010a /* Buffer configuration */ -# define PPR_BUFCFG_SWI (1 << 6) /* Force interrupt via software */ -# define PPR_BUFCFG_RXDMA (1 << 7) /* Enable interrupt on Rx DMA */ -# define PPR_BUFCFG_TXRDY (1 << 8) /* Enable interrupt when ready for Tx */ -# define PPR_BUFCFG_TXUE (1 << 9) /* Enable interrupt in Tx underrun */ -# define PPR_BUFCFG_RXMISS (1 << 10) /* Enable interrupt on missed Rx packets */ -# define PPR_BUFCFG_RX128 (1 << 11) /* Enable Rx interrupt after 128 bytes */ -# define PPR_BUFCFG_TXCOL (1 << 12) /* Enable int on Tx collision ctr overflow */ -# define PPR_BUFCFG_MISS (1 << 13) /* Enable int on Rx miss ctr overflow */ -# define PPR_BUFCFG_RXDEST (1 << 15) /* Enable int on Rx dest addr match */ - -#define PPR_LINECTL 0x0112 /* Line control */ -# define PPR_LINECTL_RX (1 << 6) /* Enable receiver */ -# define PPR_LINECTL_TX (1 << 7) /* Enable transmitter */ -# define PPR_LINECTL_AUIONLY (1 << 8) /* AUI interface only */ -# define PPR_LINECTL_AUTOAUI10BT (1 << 9) /* Autodetect AUI or 10BaseT interface */ -# define PPR_LINECTL_MODBACKOFFE (1 << 11) /* Enable modified backoff algorithm */ -# define PPR_LINECTL_POLARITYDIS (1 << 12) /* Disable Rx polarity autodetect */ -# define PPR_LINECTL_2PARTDEFDIS (1 << 13) /* Disable two-part defferal */ -# define PPR_LINECTL_LORXSQUELCH (1 << 14) /* Reduce receiver squelch threshold */ - -#define PPR_SELFCTL 0x0114 /* Chip self control */ -# define PPR_SELFCTL_RESET (1 << 6) /* Self-clearing reset */ -# define PPR_SELFCTL_SWSUSPEND (1 << 8) /* Initiate suspend mode */ -# define PPR_SELFCTL_HWSLEEPE (1 << 9) /* Enable SLEEP input */ -# define PPR_SELFCTL_HWSTANDBYE (1 << 10) /* Enable standby mode */ -# define PPR_SELFCTL_HC0E (1 << 12) /* Use HCB0 for LINK LED */ -# define PPR_SELFCTL_HC1E (1 << 13) /* Use HCB1 for BSTATUS LED */ -# define PPR_SELFCTL_HCB0 (1 << 14) /* Control LINK LED if HC0E set */ -# define PPR_SELFCTL_HCB1 (1 << 15) /* Cntrol BSTATUS LED if HC1E set */ - -#define PPR_BUSCTL 0x0116 /* Bus control */ -# define PPR_BUSCTL_RESETRXDMA (1 << 6) /* Reset RxDMA pointer */ -# define PPR_BUSCTL_DMAEXTEND (1 << 8) /* Extend DMA cycle */ -# define PPR_BUSCTL_USESA (1 << 9) /* Assert MEMCS16 on address decode */ -# define PPR_BUSCTL_MEMORYE (1 << 10) /* Enable memory mode */ -# define PPR_BUSCTL_DMABURST (1 << 11) /* Limit DMA access burst */ -# define PPR_BUSCTL_IOCHRDYE (1 << 12) /* Set IOCHRDY high impedence */ -# define PPR_BUSCTL_RXDMASIZE (1 << 13) /* Set DMA buffer size 64KB */ -# define PPR_BUSCTL_ENABLEIRQ (1 << 15) /* Generate interrupt on interrupt event */ - -#define PPR_TESTCTL 0x0118 /* Test control */ -# define PPR_TESTCTL_DISABLELT (1 << 7) /* Disable link status */ -# define PPR_TESTCTL_ENDECLOOP (1 << 9) /* Internal loopback */ -# define PPR_TESTCTL_AUILOOP (1 << 10) /* AUI loopback */ -# define PPR_TESTCTL_DISBACKOFF (1 << 11) /* Disable backoff algorithm */ -# define PPR_TESTCTL_FDX (1 << 14) /* Enable full duplex mode */ - -/* 0x0120 - Status and Event Registers */ - -#define PPR_ISQ 0x0120 /* Interrupt Status Queue */ -#define PPR_RER 0x0124 /* Receive event */ -# define PPR_RER_IAHASH (1 << 6) /* Frame hash match */ -# define PPR_RER_DRIBBLE (1 << 7) /* Frame had 1-7 extra bits after last byte */ -# define PPR_RER_RXOK (1 << 8) /* Frame received with no errors */ -# define PPR_RER_HASHED (1 << 9) /* Frame address hashed OK */ -# define PPR_RER_IA (1 << 10) /* Frame address matched IA */ -# define PPR_RER_BROADCAST (1 << 11) /* Broadcast frame */ -# define PPR_RER_CRC (1 << 12) /* Frame had CRC error */ -# define PPR_RER_RUNT (1 << 13) /* Runt frame */ -# define PPR_RER_EXTRA (1 << 14) /* Frame was too long */ - -#define PPR_TER 0x0128 /* Transmit event */ -# define PPR_TER_CRS (1 << 6) /* Carrier lost */ -# define PPR_TER_SQE (1 << 7) /* Signal Quality Error */ -# define PPR_TER_TXOK (1 << 8) /* Packet sent without error */ -# define PPR_TER_LATE (1 << 9) /* Out of window */ -# define PPR_TER_JABBER (1 << 10) /* Stuck transmit? */ -# define PPR_TER_NUMCOLLISIONS_SHIFT 11 -# define PPR_TER_NUMCOLLISIONS_MASK (15 << PPR_TER_NUMCOLLISIONS_SHIFT) -# define PPR_TER_16COLLISIONS (1 << 15) /* > 16 collisions */ - -#define PPR_BER 0x012C /* Buffer event */ -# define PPR_BER_SWINT (1 << 6) /* Software interrupt */ -# define PPR_BER_RXDMAFRAME (1 << 7) /* Received framed DMAed */ -# define PPR_BER_RDY4TX (1 << 8) /* Ready for transmission */ -# define PPR_BER_TXUNDERRUN (1 << 9) /* Transmit underrun */ -# define PPR_BER_RXMISS (1 << 10) /* Received frame missed */ -# define PPR_BER_RX128 (1 << 11) /* 128 bytes received */ -# define PPR_BER_RXDEST (1 << 15) /* Received framed passed address filter */ - -#define PPR_RXMISS 0x0130 /* Receiver miss counter */ -#define PPR_TXCOL 0x0132 /* Transmit collision counter */ -#define PPR_LINESTAT 0x0134 /* Line status */ -# define PPR_LINESTAT_LINKOK (1 << 7) /* Line is connected and working */ -# define PPR_LINESTAT_AUI (1 << 8) /* Connected via AUI */ -# define PPR_LINESTAT_10BT (1 << 9) /* Connected via twisted pair */ -# define PPR_LINESTAT_POLARITY (1 << 12) /* Line polarity OK (10BT only) */ -# define PPR_LINESTAT_CRS (1 << 14) /* Frame being received */ - -#define PPR_SELFSTAT 0x0136 /* Chip self status */ -# define PPR_SELFSTAT_33VACTIVE (1 << 6) /* supply voltage is 3.3V */ -# define PPR_SELFSTAT_INITD (1 << 7) /* Chip initialization complete */ -# define PPR_SELFSTAT_SIBSY (1 << 8) /* EEPROM is busy */ -# define PPR_SELFSTAT_EEPROM (1 << 9) /* EEPROM present */ -# define PPR_SELFSTAT_EEPROMOK (1 << 10) /* EEPROM checks out */ -# define PPR_SELFSTAT_ELPRESENT (1 << 11) /* External address latch logic available */ -# define PPR_SELFSTAT_EESIZE (1 << 12) /* Size of EEPROM */ - -#define PPR_BUSSTAT 0x0138 /* Bus status */ -# define PPR_BUSSTAT_TXBID (1 << 7) /* Tx error */ -# define PPR_BUSSTAT_TXRDY (1 << 8) /* Ready for Tx data */ - -#define PPR_TDR 0x013C /* AUI Time Domain Reflectometer */ - -/* 0x0144 - Initiate transmit registers */ - -#define PPR_TXCOMMAND 0x0144 /* Tx Command */ -#define PPR_TXLENGTH 0x0146 /* Tx Length */ - -/* 0x0150 - Address filter registers */ - -#define PPR_LAF 0x0150 /* Logical address filter (6 bytes) */ -#define PPR_IA 0x0158 /* Individual address (MAC) */ - -/* 0x0400 - Frame location registers */ - -#define PPR_RXSTATUS 0x0400 /* Rx Status */ -#define PPR_RXLENGTH 0x0402 /* Rx Length */ -#define PPR_RXFRAMELOCATION 0x0404 /* Rx Frame Location */ -#define PPR_TXFRAMELOCATION 0x0a00 /* Tx Frame Location */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __DRIVERS_NET_CS89x0_H */ diff --git a/include/nuttx/net/cs89x0.h b/include/nuttx/net/cs89x0.h deleted file mode 100644 index 98ef9772b4..0000000000 --- a/include/nuttx/net/cs89x0.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** - * include/nuttx/net/cs89x0.h - * - * Copyright (C) 2009, 2012, 2014-2015 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 - * COPYRIGHT OWNER OR CONTRIBUTORS 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 __INCLUDE_NUTTX_NET_CS89x0_H -#define __INCLUDE_NUTTX_NET_CS89x0_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure encapsulates all state information for a single hardware - * interface. It includes values that must be provided by the user to in - * to describe details of the CS89x00 implementation on a particular board. - * An instance if this structure is passed to cs89x00 to instantiate the - * driver. - * - * This structure also includes internal driver state information that should - * be of no concern to the caller of cs89x0_initialize(). These fields must - * be zeroed. - */ - -struct cs89x0_driver_s -{ - /* User-provided CS89x00 platform-specific implementation details. The - * caller of cs89x0_initialize() must provide all of these values. - */ - - FAR void *cs_base; /* CS89x0 region base address */ -#ifdef CONFIG_CS89x0_MEMMODE - FAR void *cs_ppbase; /* CS89x0 page packet base address */ -#endif - uint8_t cs_irq; /* CS89x00 IRQ number */ - - /* Driver internal state fields. These must be zeroed by before the - * instance of this structure is passed to cs89x0_initialize - */ -#ifdef CONFIG_CS89x0_XMITEARLY - uint8_t txstart; /* Bits 6-7 of TxCMD controls Tx race */ -#endif - bool cs_memmode; /* true:memory mode false: I/O mode */ - bool cs_bifup; /* true:ifup false:ifdown */ - WDOG_ID cs_txpoll; /* TX poll timer */ - WDOG_ID cs_txtimeout; /* TX timeout timer */ -#ifdef CONFIG_CS89x0_XMITEARLY - uint32_t cs_txunderrun; /* Count of Tx underrun errors */ -#endif - - /* This holds the information visible to the NuttX network */ - - struct net_driver_s cs_dev; /* Interface understood by the network */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Name: cs89x0_initialize - * - * Description: - * Initialize the Ethernet driver - * - * Parameters: - * impl - decribes the implementation of the cs89x00 implementation. - * This reference is retained so so must remain stable throughout the - * life of the driver instance. - * devno - Identifies the device number. This must be a number between - * zero CONFIG_CS89x0_NINTERFACES and the same devno must not be - * initialized twice. The associated network device will be referred - * to with the name "eth" followed by this number (eth0, eth1, etc). - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * - ****************************************************************************/ - -/* Initialize the CS89x0 chip and driver */ - -int cs89x0_initialize(FAR const cs89x0_driver_s *cs89x0, int devno); - -#undef EXTERN -#ifdef __cplusplus -} -#endif - -#endif /* __INCLUDE_NUTTX_NET_CS89x0_H */