From a86a789e55b6f6300137d263218546ef05c6b3ec Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 17 Jun 2003 16:58:47 +0000 Subject: Internationalize FXO git-svn-id: http://svn.digium.com/svn/zaptel/trunk@197 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wcfxo.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'wcfxo.c') diff --git a/wcfxo.c b/wcfxo.c index fb12d73..abf12b8 100755 --- a/wcfxo.c +++ b/wcfxo.c @@ -178,6 +178,25 @@ static int monitor = 0; static int quiet = 0; +static int opermode = 0; + +static struct fxo_mode { + char *name; + int ohs; + int act; + int dct; + int rz; + int rt; + int lim; + int vol; +} fxo_modes[] = +{ + { "FCC", 0, 0, 2, 0, 0, 0, 0 }, /* US */ + { "CTR21", 0, 0, 3, 0, 0, 3, 0 }, /* Austria, Belgium, Denmark, Finland, France, Germany, + Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands, + Norway, Portugal, Spain, Sweden, Switzerland, and UK */ +}; + static inline void wcfxo_transmitprep(struct wcfxo *wc, unsigned char ints) { volatile int *writechunk; @@ -696,6 +715,30 @@ static void wcfxo_disable_interrupts(struct wcfxo *wc) outb(0x00, wc->ioaddr + WC_MASK1); } +static int wcfxo_set_daa_mode(struct wcfxo *wc) +{ + /* Set country specific parameters (OHS, ACT, DCT, RZ, RT, LIM, VOL) */ + int reg16 = ((fxo_modes[opermode].ohs & 0x1) << 6) | + ((fxo_modes[opermode].act & 0x1) << 5) | + ((fxo_modes[opermode].dct & 0x3) << 2) | + ((fxo_modes[opermode].rz & 0x1) << 1) | + ((fxo_modes[opermode].rt & 0x1) << 0); + int reg17 = ((fxo_modes[opermode].lim & 0x3) << 3); + int reg18 = ((fxo_modes[opermode].vol & 0x3) << 3); + + wcfxo_setreg(wc, 0x16, reg16); + wcfxo_setreg(wc, 0x17, reg17); + wcfxo_setreg(wc, 0x18, reg18); + + + /* Wait a couple of jiffies for our writes to finish */ + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(1 + (ZT_CHUNKSIZE * HZ) / 800); + + printk("wcfxo: DAA mode is '%s'\n", fxo_modes[opermode].name); + return 0; +} + static int wcfxo_init_daa(struct wcfxo *wc) { /* This must not be called in an interrupt */ @@ -855,7 +898,7 @@ static int __devinit wcfxo_init_one(struct pci_dev *pdev, const struct pci_devic kfree(wc); return -EIO; } - + wcfxo_set_daa_mode(wc); printk("Found a Wildcard FXO: %s\n", wc->variety); res = 0; } else @@ -917,6 +960,13 @@ static struct pci_driver wcfxo_driver = { static int __init wcfxo_init(void) { int res; + int x; + if ((opermode >= sizeof(fxo_modes) / sizeof(fxo_modes[0])) || (opermode < 0)) { + printk("Invalid/unknown operating mode specified. Please choose one of:\n"); + for (x=0;x"); #ifdef MODULE_LICENSE -- cgit v1.2.3