Linux Audio

Check our new training course

Loading...
v3.5.6
 
  1 /*
  2  * Copyright (c) 1997-2000 LAN Media Corporation (LMC)
  3  * All rights reserved.  www.lanmedia.com
  4  *
  5  * This code is written by:
  6  * Andrew Stanley-Jones (asj@cban.com)
  7  * Rob Braun (bbraun@vix.com),
  8  * Michael Graff (explorer@vix.com) and
  9  * Matt Thomas (matt@3am-software.com).
 10  *
 11  * With Help By:
 12  * David Boggs
 13  * Ron Crane
 14  * Allan Cox
 15  *
 16  * This software may be used and distributed according to the terms
 17  * of the GNU General Public License version 2, incorporated herein by reference.
 18  *
 19  * Driver for the LanMedia LMC5200, LMC5245, LMC1000, LMC1200 cards.
 20  */
 21
 22#include <linux/kernel.h>
 23#include <linux/string.h>
 24#include <linux/timer.h>
 25#include <linux/ptrace.h>
 26#include <linux/errno.h>
 27#include <linux/ioport.h>
 28#include <linux/interrupt.h>
 29#include <linux/in.h>
 30#include <linux/if_arp.h>
 31#include <linux/netdevice.h>
 32#include <linux/etherdevice.h>
 33#include <linux/skbuff.h>
 34#include <linux/inet.h>
 35#include <linux/workqueue.h>
 36#include <linux/proc_fs.h>
 37#include <linux/bitops.h>
 38#include <asm/processor.h>             /* Processor type for cache alignment. */
 39#include <asm/io.h>
 40#include <asm/dma.h>
 41#include <linux/smp.h>
 42
 43#include "lmc.h"
 44#include "lmc_var.h"
 45#include "lmc_debug.h"
 46#include "lmc_ioctl.h"
 47#include "lmc_proto.h"
 48
 49// attach
 50void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
 51{
 52    lmc_trace(sc->lmc_device, "lmc_proto_attach in");
 53    if (sc->if_type == LMC_NET) {
 54            struct net_device *dev = sc->lmc_device;
 55            /*
 56	     * They set a few basics because they don't use HDLC
 57             */
 58            dev->flags |= IFF_POINTOPOINT;
 59            dev->hard_header_len = 0;
 60            dev->addr_len = 0;
 61        }
 62    lmc_trace(sc->lmc_device, "lmc_proto_attach out");
 63}
 64
 65int lmc_proto_ioctl(lmc_softc_t *sc, struct ifreq *ifr, int cmd)
 66{
 67	lmc_trace(sc->lmc_device, "lmc_proto_ioctl");
 68	if (sc->if_type == LMC_PPP)
 69		return hdlc_ioctl(sc->lmc_device, ifr, cmd);
 70	return -EOPNOTSUPP;
 71}
 72
 73int lmc_proto_open(lmc_softc_t *sc)
 74{
 75	int ret = 0;
 76
 77	lmc_trace(sc->lmc_device, "lmc_proto_open in");
 78
 79	if (sc->if_type == LMC_PPP) {
 80		ret = hdlc_open(sc->lmc_device);
 81		if (ret < 0)
 82			printk(KERN_WARNING "%s: HDLC open failed: %d\n",
 83			       sc->name, ret);
 84	}
 85
 86	lmc_trace(sc->lmc_device, "lmc_proto_open out");
 87	return ret;
 88}
 89
 90void lmc_proto_close(lmc_softc_t *sc)
 91{
 92	lmc_trace(sc->lmc_device, "lmc_proto_close in");
 93
 94	if (sc->if_type == LMC_PPP)
 95		hdlc_close(sc->lmc_device);
 96
 97	lmc_trace(sc->lmc_device, "lmc_proto_close out");
 98}
 99
100__be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
101{
102    lmc_trace(sc->lmc_device, "lmc_proto_type in");
103    switch(sc->if_type){
104    case LMC_PPP:
105	    return hdlc_type_trans(skb, sc->lmc_device);
106	    break;
107    case LMC_NET:
108        return htons(ETH_P_802_2);
109        break;
110    case LMC_RAW: /* Packet type for skbuff kind of useless */
111        return htons(ETH_P_802_2);
112        break;
113    default:
114        printk(KERN_WARNING "%s: No protocol set for this interface, assuming 802.2 (which is wrong!!)\n", sc->name);
115        return htons(ETH_P_802_2);
116        break;
117    }
118    lmc_trace(sc->lmc_device, "lmc_proto_tye out");
119
120}
121
122void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
123{
124    lmc_trace(sc->lmc_device, "lmc_proto_netif in");
125    switch(sc->if_type){
126    case LMC_PPP:
127    case LMC_NET:
128    default:
129        netif_rx(skb);
130        break;
131    case LMC_RAW:
132        break;
133    }
134    lmc_trace(sc->lmc_device, "lmc_proto_netif out");
135}
v5.9
  1// SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Copyright (c) 1997-2000 LAN Media Corporation (LMC)
  4  * All rights reserved.  www.lanmedia.com
  5  *
  6  * This code is written by:
  7  * Andrew Stanley-Jones (asj@cban.com)
  8  * Rob Braun (bbraun@vix.com),
  9  * Michael Graff (explorer@vix.com) and
 10  * Matt Thomas (matt@3am-software.com).
 11  *
 12  * With Help By:
 13  * David Boggs
 14  * Ron Crane
 15  * Allan Cox
 
 
 
 16  *
 17  * Driver for the LanMedia LMC5200, LMC5245, LMC1000, LMC1200 cards.
 18  */
 19
 20#include <linux/kernel.h>
 21#include <linux/string.h>
 22#include <linux/timer.h>
 23#include <linux/ptrace.h>
 24#include <linux/errno.h>
 25#include <linux/ioport.h>
 26#include <linux/interrupt.h>
 27#include <linux/in.h>
 28#include <linux/if_arp.h>
 29#include <linux/netdevice.h>
 30#include <linux/etherdevice.h>
 31#include <linux/skbuff.h>
 32#include <linux/inet.h>
 33#include <linux/workqueue.h>
 34#include <linux/proc_fs.h>
 35#include <linux/bitops.h>
 36#include <asm/processor.h>             /* Processor type for cache alignment. */
 37#include <asm/io.h>
 38#include <asm/dma.h>
 39#include <linux/smp.h>
 40
 41#include "lmc.h"
 42#include "lmc_var.h"
 43#include "lmc_debug.h"
 44#include "lmc_ioctl.h"
 45#include "lmc_proto.h"
 46
 47// attach
 48void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
 49{
 50    lmc_trace(sc->lmc_device, "lmc_proto_attach in");
 51    if (sc->if_type == LMC_NET) {
 52            struct net_device *dev = sc->lmc_device;
 53            /*
 54	     * They set a few basics because they don't use HDLC
 55             */
 56            dev->flags |= IFF_POINTOPOINT;
 57            dev->hard_header_len = 0;
 58            dev->addr_len = 0;
 59        }
 60    lmc_trace(sc->lmc_device, "lmc_proto_attach out");
 61}
 62
 63int lmc_proto_ioctl(lmc_softc_t *sc, struct ifreq *ifr, int cmd)
 64{
 65	lmc_trace(sc->lmc_device, "lmc_proto_ioctl");
 66	if (sc->if_type == LMC_PPP)
 67		return hdlc_ioctl(sc->lmc_device, ifr, cmd);
 68	return -EOPNOTSUPP;
 69}
 70
 71int lmc_proto_open(lmc_softc_t *sc)
 72{
 73	int ret = 0;
 74
 75	lmc_trace(sc->lmc_device, "lmc_proto_open in");
 76
 77	if (sc->if_type == LMC_PPP) {
 78		ret = hdlc_open(sc->lmc_device);
 79		if (ret < 0)
 80			printk(KERN_WARNING "%s: HDLC open failed: %d\n",
 81			       sc->name, ret);
 82	}
 83
 84	lmc_trace(sc->lmc_device, "lmc_proto_open out");
 85	return ret;
 86}
 87
 88void lmc_proto_close(lmc_softc_t *sc)
 89{
 90	lmc_trace(sc->lmc_device, "lmc_proto_close in");
 91
 92	if (sc->if_type == LMC_PPP)
 93		hdlc_close(sc->lmc_device);
 94
 95	lmc_trace(sc->lmc_device, "lmc_proto_close out");
 96}
 97
 98__be16 lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
 99{
100    lmc_trace(sc->lmc_device, "lmc_proto_type in");
101    switch(sc->if_type){
102    case LMC_PPP:
103	    return hdlc_type_trans(skb, sc->lmc_device);
104	    break;
105    case LMC_NET:
106        return htons(ETH_P_802_2);
107        break;
108    case LMC_RAW: /* Packet type for skbuff kind of useless */
109        return htons(ETH_P_802_2);
110        break;
111    default:
112        printk(KERN_WARNING "%s: No protocol set for this interface, assuming 802.2 (which is wrong!!)\n", sc->name);
113        return htons(ETH_P_802_2);
114        break;
115    }
116    lmc_trace(sc->lmc_device, "lmc_proto_tye out");
117
118}
119
120void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb) /*FOLD00*/
121{
122    lmc_trace(sc->lmc_device, "lmc_proto_netif in");
123    switch(sc->if_type){
124    case LMC_PPP:
125    case LMC_NET:
126    default:
127        netif_rx(skb);
128        break;
129    case LMC_RAW:
130        break;
131    }
132    lmc_trace(sc->lmc_device, "lmc_proto_netif out");
133}