linux/drivers/net/hamradio/yam.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*****************************************************************************/

/*
 *    yam.c  -- YAM radio modem driver.
 *
 *      Copyright (C) 1998 Frederic Rible F1OAT ([email protected])
 *      Adapted from baycom.c driver written by Thomas Sailer ([email protected])
 *
 *  Please note that the GPL allows you to use the driver, NOT the radio.
 *  In order to use the radio, you need a license from the communications
 *  authority of your country.
 *
 *  History:
 *   0.0 F1OAT 06.06.98  Begin of work with baycom.c source code V 0.3
 *   0.1 F1OAT 07.06.98  Add timer polling routine for channel arbitration
 *   0.2 F6FBB 08.06.98  Added delay after FPGA programming
 *   0.3 F6FBB 29.07.98  Delayed PTT implementation for dupmode=2
 *   0.4 F6FBB 30.07.98  Added TxTail, Slottime and Persistence
 *   0.5 F6FBB 01.08.98  Shared IRQs, /proc/net and network statistics
 *   0.6 F6FBB 25.08.98  Added 1200Bds format
 *   0.7 F6FBB 12.09.98  Added to the kernel configuration
 *   0.8 F6FBB 14.10.98  Fixed slottime/persistence timing bug
 *       OK1ZIA 2.09.01  Fixed "kfree_skb on hard IRQ" 
 *                       using dev_kfree_skb_any(). (important in 2.4 kernel)
 */

/*****************************************************************************/

#include <linux/module.h>
#include <linux/types.h>
#include <linux/net.h>
#include <linux/in.h>
#include <linux/if.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/bitops.h>
#include <linux/random.h>
#include <asm/io.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/firmware.h>
#include <linux/platform_device.h>

#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <net/ax25.h>

#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <net/net_namespace.h>

#include <linux/uaccess.h>
#include <linux/init.h>

#include <linux/yam.h>

/* --------------------------------------------------------------------- */

static const char yam_drvname[] =;
static const char yam_drvinfo[] __initconst =;

/* --------------------------------------------------------------------- */

#define FIRMWARE_9600
#define FIRMWARE_1200

#define YAM_9600
#define YAM_1200

#define NR_PORTS
#define YAM_MAGIC

/* Transmitter states */

#define TX_OFF
#define TX_HEAD
#define TX_DATA
#define TX_CRC1
#define TX_CRC2
#define TX_TAIL

#define YAM_MAX_FRAME

#define DEFAULT_BITRATE
#define DEFAULT_HOLDD
#define DEFAULT_TXD
#define DEFAULT_TXTAIL
#define DEFAULT_SLOT
#define DEFAULT_PERS

struct yam_port {};

struct yam_mcs {};

static struct net_device *yam_devs[NR_PORTS];

static struct yam_mcs *yam_data;

static DEFINE_TIMER(yam_timer, NULL);

/* --------------------------------------------------------------------- */

#define RBR(iobase)
#define THR(iobase)
#define IER(iobase)
#define IIR(iobase)
#define FCR(iobase)
#define LCR(iobase)
#define MCR(iobase)
#define LSR(iobase)
#define MSR(iobase)
#define SCR(iobase)
#define DLL(iobase)
#define DLM(iobase)

#define YAM_EXTENT

/* Interrupt Identification Register Bit Masks */
#define IIR_NOPEND
#define IIR_MSR
#define IIR_TX
#define IIR_RX
#define IIR_LSR
#define IIR_TIMEOUT

#define IIR_MASK

/* Interrupt Enable Register Bit Masks */
#define IER_RX
#define IER_TX
#define IER_LSR
#define IER_MSR

/* Modem Control Register Bit Masks */
#define MCR_DTR
#define MCR_RTS
#define MCR_OUT1
#define MCR_OUT2
#define MCR_LOOP

/* Modem Status Register Bit Masks */
#define MSR_DCTS
#define MSR_DDSR
#define MSR_DRIN
#define MSR_DDCD
#define MSR_CTS
#define MSR_DSR
#define MSR_RING
#define MSR_DCD

/* line status register bit mask */
#define LSR_RXC
#define LSR_OE
#define LSR_PE
#define LSR_FE
#define LSR_BREAK
#define LSR_THRE
#define LSR_TSRE

/* Line Control Register Bit Masks */
#define LCR_DLAB
#define LCR_BREAK
#define LCR_PZERO
#define LCR_PEVEN
#define LCR_PODD
#define LCR_STOP1
#define LCR_STOP2
#define LCR_BIT5
#define LCR_BIT6
#define LCR_BIT7
#define LCR_BIT8

/* YAM Modem <-> UART Port mapping */

#define TX_RDY
#define RX_DCD
#define RX_FLAG
#define FPGA_DONE
#define PTT_ON
#define PTT_OFF

#define ENABLE_RXINT
#define ENABLE_TXINT
#define ENABLE_RTXINT


/*************************************************************************
* CRC Tables
************************************************************************/

static const unsigned char chktabl[256] =;
static const unsigned char chktabh[256] =;

/*************************************************************************
* FPGA functions
************************************************************************/

static void delay(int ms)
{}

/*
 * reset FPGA
 */

static void fpga_reset(int iobase)
{}

/*
 * send one byte to FPGA
 */

static int fpga_write(int iobase, unsigned char wrd)
{}

/*
 * predef should be 0 for loading user defined mcs
 * predef should be YAM_1200 for loading predef 1200 mcs
 * predef should be YAM_9600 for loading predef 9600 mcs
 */
static unsigned char *add_mcs(unsigned char *bits, int bitrate,
			      unsigned int predef)
{}

static unsigned char *get_mcs(int bitrate)
{}

/*
 * download bitstream to FPGA
 * data is contained in bits[] array in yam1200.h resp. yam9600.h
 */

static int fpga_download(int iobase, int bitrate)
{}


/************************************************************************
* Serial port init 
************************************************************************/

static void yam_set_uart(struct net_device *dev)
{}


/* --------------------------------------------------------------------- */

enum uart {};

static const char *uart_str[] =;

static enum uart yam_check_uart(unsigned int iobase)
{}

/******************************************************************************
* Rx Section
******************************************************************************/
static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp)
{}

static inline void yam_rx_byte(struct net_device *dev, struct yam_port *yp, unsigned char rxb)
{}

/********************************************************************************
* TX Section
********************************************************************************/

static void ptt_on(struct net_device *dev)
{}

static void ptt_off(struct net_device *dev)
{}

static netdev_tx_t yam_send_packet(struct sk_buff *skb,
					 struct net_device *dev)
{}

static void yam_start_tx(struct net_device *dev, struct yam_port *yp)
{}

static void yam_arbitrate(struct net_device *dev)
{}

static void yam_dotimer(struct timer_list *unused)
{}

static void yam_tx_byte(struct net_device *dev, struct yam_port *yp)
{}

/***********************************************************************************
* ISR routine
************************************************************************************/

static irqreturn_t yam_interrupt(int irq, void *dev_id)
{}

#ifdef CONFIG_PROC_FS

static void *yam_seq_start(struct seq_file *seq, loff_t *pos)
{}

static void *yam_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{}

static void yam_seq_stop(struct seq_file *seq, void *v)
{}

static int yam_seq_show(struct seq_file *seq, void *v)
{}

static const struct seq_operations yam_seqops =;
#endif


/* --------------------------------------------------------------------- */

static int yam_open(struct net_device *dev)
{}

/* --------------------------------------------------------------------- */

static int yam_close(struct net_device *dev)
{}

/* --------------------------------------------------------------------- */

static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data, int cmd)
{}

/* --------------------------------------------------------------------- */

static int yam_set_mac_address(struct net_device *dev, void *addr)
{}

/* --------------------------------------------------------------------- */

static const struct net_device_ops yam_netdev_ops =;

static void yam_setup(struct net_device *dev)
{}

static int __init yam_init_driver(void)
{}

/* --------------------------------------------------------------------- */

static void __exit yam_cleanup_driver(void)
{}

/* --------------------------------------------------------------------- */

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();

module_init();
module_exit(yam_cleanup_driver);

/* --------------------------------------------------------------------- */