summaryrefslogtreecommitdiff
path: root/wcfxo.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-06-17 16:58:47 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-06-17 16:58:47 +0000
commita86a789e55b6f6300137d263218546ef05c6b3ec (patch)
tree20517f9816e8bda1da7fbb40bb918ffc85c81cd0 /wcfxo.c
parent4b6c592d23d4e7887af61b569fce9bd9c4b07630 (diff)
Internationalize FXO
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@197 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxo.c')
-rwxr-xr-xwcfxo.c53
1 files changed, 52 insertions, 1 deletions
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<sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++)
+ printk("%d: %s\n", x, fxo_modes[x].name);
+ return -ENODEV;
+ }
res = pci_module_init(&wcfxo_driver);
if (res)
return -ENODEV;
@@ -931,6 +981,7 @@ static void __exit wcfxo_cleanup(void)
MODULE_PARM(debug, "i");
MODULE_PARM(quiet, "i");
MODULE_PARM(monitor, "i");
+MODULE_PARM(opermode, "i");
MODULE_DESCRIPTION("Wildcard X100P Zaptel Driver");
MODULE_AUTHOR("Mark Spencer <markster@linux-support.net>");
#ifdef MODULE_LICENSE