#define HFC_MULTI_VERSION …
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/mISDNhw.h>
#include <linux/mISDNdsp.h>
#include "hfc_multi.h"
#ifdef ECHOPREP
#include "gaintab.h"
#endif
#define MAX_CARDS …
#define MAX_PORTS …
#define MAX_FRAGS …
static LIST_HEAD(HFClist);
static DEFINE_SPINLOCK(HFClock);
static void ph_state_change(struct dchannel *);
static struct hfc_multi *syncmaster;
static int plxsd_master;
static DEFINE_SPINLOCK(plx_lock);
#define TYP_E1 …
#define TYP_4S …
#define TYP_8S …
static int poll_timer = …;
static int nt_t1_count[] = …;
#define CLKDEL_TE …
#define CLKDEL_NT …
#define DIP_4S …
#define DIP_8S …
#define DIP_E1 …
static uint type[MAX_CARDS];
static int pcm[MAX_CARDS];
static uint dmask[MAX_CARDS];
static uint bmask[MAX_FRAGS];
static uint iomode[MAX_CARDS];
static uint port[MAX_PORTS];
static uint debug;
static uint poll;
static int clock;
static uint timer;
static uint clockdelay_te = …;
static uint clockdelay_nt = …;
#define HWID_NONE …
#define HWID_MINIP4 …
#define HWID_MINIP8 …
#define HWID_MINIP16 …
static uint hwid = …;
static int HFC_cnt, E1_cnt, bmask_cnt, Port_cnt, PCM_cnt = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…);
module_param(debug, uint, S_IRUGO | S_IWUSR);
module_param(poll, uint, S_IRUGO | S_IWUSR);
module_param(clock, int, S_IRUGO | S_IWUSR);
module_param(timer, uint, S_IRUGO | S_IWUSR);
module_param(clockdelay_te, uint, S_IRUGO | S_IWUSR);
module_param(clockdelay_nt, uint, S_IRUGO | S_IWUSR);
module_param_array(…);
module_param_array(…);
module_param_array(…);
module_param_array(…);
module_param_array(…);
module_param_array(…);
module_param(hwid, uint, S_IRUGO | S_IWUSR);
#ifdef HFC_REGISTER_DEBUG
#define HFC_outb …
#define HFC_outb_nodebug …
#define HFC_inb …
#define HFC_inb_nodebug …
#define HFC_inw …
#define HFC_inw_nodebug …
#define HFC_wait …
#define HFC_wait_nodebug …
#else
#define HFC_outb(hc, reg, val) …
#define HFC_outb_nodebug(hc, reg, val) …
#define HFC_inb(hc, reg) …
#define HFC_inb_nodebug(hc, reg) …
#define HFC_inw(hc, reg) …
#define HFC_inw_nodebug(hc, reg) …
#define HFC_wait(hc) …
#define HFC_wait_nodebug(hc) …
#endif
#ifdef CONFIG_MISDN_HFCMULTI_8xx
#include "hfc_multi_8xx.h"
#endif
static void
#ifdef HFC_REGISTER_DEBUG
HFC_outb_pcimem(struct hfc_multi *hc, u_char reg, u_char val,
const char *function, int line)
#else
HFC_outb_pcimem(struct hfc_multi *hc, u_char reg, u_char val)
#endif
{ … }
static u_char
#ifdef HFC_REGISTER_DEBUG
HFC_inb_pcimem(struct hfc_multi *hc, u_char reg, const char *function, int line)
#else
HFC_inb_pcimem(struct hfc_multi *hc, u_char reg)
#endif
{ … }
static u_short
#ifdef HFC_REGISTER_DEBUG
HFC_inw_pcimem(struct hfc_multi *hc, u_char reg, const char *function, int line)
#else
HFC_inw_pcimem(struct hfc_multi *hc, u_char reg)
#endif
{ … }
static void
#ifdef HFC_REGISTER_DEBUG
HFC_wait_pcimem(struct hfc_multi *hc, const char *function, int line)
#else
HFC_wait_pcimem(struct hfc_multi *hc)
#endif
{ … }
static void
#ifdef HFC_REGISTER_DEBUG
HFC_outb_regio(struct hfc_multi *hc, u_char reg, u_char val,
const char *function, int line)
#else
HFC_outb_regio(struct hfc_multi *hc, u_char reg, u_char val)
#endif
{ … }
static u_char
#ifdef HFC_REGISTER_DEBUG
HFC_inb_regio(struct hfc_multi *hc, u_char reg, const char *function, int line)
#else
HFC_inb_regio(struct hfc_multi *hc, u_char reg)
#endif
{ … }
static u_short
#ifdef HFC_REGISTER_DEBUG
HFC_inw_regio(struct hfc_multi *hc, u_char reg, const char *function, int line)
#else
HFC_inw_regio(struct hfc_multi *hc, u_char reg)
#endif
{ … }
static void
#ifdef HFC_REGISTER_DEBUG
HFC_wait_regio(struct hfc_multi *hc, const char *function, int line)
#else
HFC_wait_regio(struct hfc_multi *hc)
#endif
{ … }
#ifdef HFC_REGISTER_DEBUG
static void
HFC_outb_debug(struct hfc_multi *hc, u_char reg, u_char val,
const char *function, int line)
{
char regname[256] = "", bits[9] = "xxxxxxxx";
int i;
i = -1;
while (hfc_register_names[++i].name) {
if (hfc_register_names[i].reg == reg)
strcat(regname, hfc_register_names[i].name);
}
if (regname[0] == '\0')
strcpy(regname, "register");
bits[7] = '0' + (!!(val & 1));
bits[6] = '0' + (!!(val & 2));
bits[5] = '0' + (!!(val & 4));
bits[4] = '0' + (!!(val & 8));
bits[3] = '0' + (!!(val & 16));
bits[2] = '0' + (!!(val & 32));
bits[1] = '0' + (!!(val & 64));
bits[0] = '0' + (!!(val & 128));
printk(KERN_DEBUG
"HFC_outb(chip %d, %02x=%s, 0x%02x=%s); in %s() line %d\n",
hc->id, reg, regname, val, bits, function, line);
HFC_outb_nodebug(hc, reg, val);
}
static u_char
HFC_inb_debug(struct hfc_multi *hc, u_char reg, const char *function, int line)
{
char regname[256] = "", bits[9] = "xxxxxxxx";
u_char val = HFC_inb_nodebug(hc, reg);
int i;
i = 0;
while (hfc_register_names[i++].name)
;
while (hfc_register_names[++i].name) {
if (hfc_register_names[i].reg == reg)
strcat(regname, hfc_register_names[i].name);
}
if (regname[0] == '\0')
strcpy(regname, "register");
bits[7] = '0' + (!!(val & 1));
bits[6] = '0' + (!!(val & 2));
bits[5] = '0' + (!!(val & 4));
bits[4] = '0' + (!!(val & 8));
bits[3] = '0' + (!!(val & 16));
bits[2] = '0' + (!!(val & 32));
bits[1] = '0' + (!!(val & 64));
bits[0] = '0' + (!!(val & 128));
printk(KERN_DEBUG
"HFC_inb(chip %d, %02x=%s) = 0x%02x=%s; in %s() line %d\n",
hc->id, reg, regname, val, bits, function, line);
return val;
}
static u_short
HFC_inw_debug(struct hfc_multi *hc, u_char reg, const char *function, int line)
{
char regname[256] = "";
u_short val = HFC_inw_nodebug(hc, reg);
int i;
i = 0;
while (hfc_register_names[i++].name)
;
while (hfc_register_names[++i].name) {
if (hfc_register_names[i].reg == reg)
strcat(regname, hfc_register_names[i].name);
}
if (regname[0] == '\0')
strcpy(regname, "register");
printk(KERN_DEBUG
"HFC_inw(chip %d, %02x=%s) = 0x%04x; in %s() line %d\n",
hc->id, reg, regname, val, function, line);
return val;
}
static void
HFC_wait_debug(struct hfc_multi *hc, const char *function, int line)
{
printk(KERN_DEBUG "HFC_wait(chip %d); in %s() line %d\n",
hc->id, function, line);
HFC_wait_nodebug(hc);
}
#endif
static void
write_fifo_regio(struct hfc_multi *hc, u_char *data, int len)
{ … }
static void
write_fifo_pcimem(struct hfc_multi *hc, u_char *data, int len)
{ … }
static void
read_fifo_regio(struct hfc_multi *hc, u_char *data, int len)
{ … }
static void
read_fifo_pcimem(struct hfc_multi *hc, u_char *data, int len)
{ … }
static void
enable_hwirq(struct hfc_multi *hc)
{ … }
static void
disable_hwirq(struct hfc_multi *hc)
{ … }
#define NUM_EC …
#define MAX_TDM_CHAN …
static inline void
enablepcibridge(struct hfc_multi *c)
{ … }
static inline void
disablepcibridge(struct hfc_multi *c)
{ … }
static inline unsigned char
readpcibridge(struct hfc_multi *hc, unsigned char address)
{ … }
static inline void
writepcibridge(struct hfc_multi *hc, unsigned char address, unsigned char data)
{ … }
static inline void
cpld_set_reg(struct hfc_multi *hc, unsigned char reg)
{ … }
static inline void
cpld_write_reg(struct hfc_multi *hc, unsigned char reg, unsigned char val)
{ … }
static inline void
vpm_write_address(struct hfc_multi *hc, unsigned short addr)
{ … }
static inline unsigned char
vpm_in(struct hfc_multi *c, int which, unsigned short addr)
{ … }
static inline void
vpm_out(struct hfc_multi *c, int which, unsigned short addr,
unsigned char data)
{ … }
static void
vpm_init(struct hfc_multi *wc)
{ … }
#ifdef UNUSED
static void
vpm_check(struct hfc_multi *hctmp)
{
unsigned char gpi2;
gpi2 = HFC_inb(hctmp, R_GPI_IN2);
if ((gpi2 & 0x3) != 0x3)
printk(KERN_DEBUG "Got interrupt 0x%x from VPM!\n", gpi2);
}
#endif
static void
vpm_echocan_on(struct hfc_multi *hc, int ch, int taps)
{ … }
static void
vpm_echocan_off(struct hfc_multi *hc, int ch)
{ … }
static inline void
hfcmulti_resync(struct hfc_multi *locked, struct hfc_multi *newmaster, int rm)
{ … }
static inline void
plxsd_checksync(struct hfc_multi *hc, int rm)
{ … }
static void
release_io_hfcmulti(struct hfc_multi *hc)
{ … }
static int
init_chip(struct hfc_multi *hc)
{ … }
static void
hfcmulti_watchdog(struct hfc_multi *hc)
{ … }
static void
hfcmulti_leds(struct hfc_multi *hc)
{ … }
static void
hfcmulti_dtmf(struct hfc_multi *hc)
{ … }
static void
hfcmulti_tx(struct hfc_multi *hc, int ch)
{ … }
static void
hfcmulti_rx(struct hfc_multi *hc, int ch)
{ … }
static void
signal_state_up(struct dchannel *dch, int info, char *msg)
{ … }
static inline void
handle_timer_irq(struct hfc_multi *hc)
{ … }
static void
ph_state_irq(struct hfc_multi *hc, u_char r_irq_statech)
{ … }
static void
fifo_irq(struct hfc_multi *hc, int block)
{ … }
#ifdef IRQ_DEBUG
int irqsem;
#endif
static irqreturn_t
hfcmulti_interrupt(int intno, void *dev_id)
{ … }
static void
hfcmulti_dbusy_timer(struct timer_list *t)
{ … }
static int
mode_hfcmulti(struct hfc_multi *hc, int ch, int protocol, int slot_tx,
int bank_tx, int slot_rx, int bank_rx)
{ … }
static void
hfcmulti_pcm(struct hfc_multi *hc, int ch, int slot_tx, int bank_tx,
int slot_rx, int bank_rx)
{ … }
static void
hfcmulti_conf(struct hfc_multi *hc, int ch, int num)
{ … }
static int
hfcm_l1callback(struct dchannel *dch, u_int cmd)
{ … }
static int
handle_dmsg(struct mISDNchannel *ch, struct sk_buff *skb)
{ … }
static void
deactivate_bchannel(struct bchannel *bch)
{ … }
static int
handle_bmsg(struct mISDNchannel *ch, struct sk_buff *skb)
{ … }
static int
channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq)
{ … }
static int
hfcm_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
{ … }
static void
ph_state_change(struct dchannel *dch)
{ … }
static void
hfcmulti_initmode(struct dchannel *dch)
{ … }
static int
open_dchannel(struct hfc_multi *hc, struct dchannel *dch,
struct channel_req *rq)
{ … }
static int
open_bchannel(struct hfc_multi *hc, struct dchannel *dch,
struct channel_req *rq)
{ … }
static int
channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)
{ … }
static int
hfcm_dctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
{ … }
static int
clockctl(void *priv, int enable)
{ … }
static int
init_card(struct hfc_multi *hc)
{ … }
static int
setup_pci(struct hfc_multi *hc, struct pci_dev *pdev,
const struct pci_device_id *ent)
{ … }
static void
release_port(struct hfc_multi *hc, struct dchannel *dch)
{ … }
static void
release_card(struct hfc_multi *hc)
{ … }
static void
init_e1_port_hw(struct hfc_multi *hc, struct hm_map *m)
{ … }
static int
init_e1_port(struct hfc_multi *hc, struct hm_map *m, int pt)
{ … }
static int
init_multi_port(struct hfc_multi *hc, int pt)
{ … }
static int
hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
const struct pci_device_id *ent)
{ … }
static void hfc_remove_pci(struct pci_dev *pdev)
{ … }
#define VENDOR_CCD …
#define VENDOR_BN …
#define VENDOR_DIG …
#define VENDOR_JH …
#define VENDOR_PRIM …
static const struct hm_map hfcm_map[] = …;
#undef H
#define H …
static const struct pci_device_id hfmultipci_ids[] = …;
#undef H
MODULE_DEVICE_TABLE(pci, hfmultipci_ids);
static int
hfcmulti_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static struct pci_driver hfcmultipci_driver = …;
static void __exit
HFCmulti_cleanup(void)
{ … }
static int __init
HFCmulti_init(void)
{ … }
module_init(…) …;
module_exit(HFCmulti_cleanup);