summaryrefslogtreecommitdiff
path: root/wcfxs.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-07-05 18:00:34 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-07-05 18:00:34 +0000
commitc39e312572dbd0769a616c94986d1d935f74807c (patch)
tree5cd9bc98b5dfee3986cc26900663139a6c370bf1 /wcfxs.c
parent1415cc3356fe350ffe8078fb3aa1b27b491336e6 (diff)
Add register write capability
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@209 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxs.c')
-rwxr-xr-xwcfxs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/wcfxs.c b/wcfxs.c
index 8df338a..c54d9d3 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -843,6 +843,7 @@ static int wcfxs_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
{
struct wcfxs_stats stats;
struct wcfxs_regs regs;
+ struct wcfxs_regop regop;
struct wcfxs *wc = chan->pvt;
int x;
switch (cmd) {
@@ -861,6 +862,18 @@ static int wcfxs_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long dat
if (copy_to_user((struct wcfxs_regs *)data, &regs, sizeof(regs)))
return -EFAULT;
break;
+ case WCFXS_SET_REG:
+ if (copy_from_user(&regop, (struct wcfxs_regop *)data, sizeof(regop)))
+ return -EFAULT;
+ if (regop.indirect) {
+ printk("Setting indirect %d to 0x%04x on %d\n", regop.reg, regop.val, chan->chanpos);
+ wcfxs_setreg_indirect(wc, chan->chanpos - 1, regop.reg, regop.val);
+ } else {
+ regop.val &= 0xff;
+ printk("Setting direct %d to %04x on %d\n", regop.reg, regop.val, chan->chanpos);
+ wcfxs_setreg(wc, chan->chanpos - 1, regop.reg, regop.val);
+ }
+ break;
default:
return -ENOTTY;
}