diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2005-07-07 20:58:51 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2005-07-07 20:58:51 +0000 |
commit | 062be1702fea4f004949cf66a566e07dacfbe852 (patch) | |
tree | 44c479c87e716f59fb08b02e087081e409a64880 | |
parent | 0aaa59929cba084c778248a52120e33050274a61 (diff) |
Make Fractional T1 work, reported and tested by Greg Mortensen,
patch from alex@
-rw-r--r-- | sys/dev/pci/if_san_te1.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/pci/if_san_te1.c b/sys/dev/pci/if_san_te1.c index 385d024e8e0..2b976554501 100644 --- a/sys/dev/pci/if_san_te1.c +++ b/sys/dev/pci/if_san_te1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_te1.c,v 1.8 2005/04/01 21:42:36 canacar Exp $ */ +/* $OpenBSD: if_san_te1.c,v 1.9 2005/07/07 20:58:50 canacar Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -2009,6 +2009,12 @@ sdla_te_settimeslot(void* pcard, unsigned long ts_map) log(LOG_INFO, "%s: Setting timeslot map to %08lX\n", card->devname, ts_map); #endif /* DEBUG_INIT */ + if (IS_T1(&card->fe_te.te_cfg)) { + /* For T1, Shift timeslot map left by 1, because bit 0 + ** is not been used by T1 timeslot map (bit 1 is used for + ** channel 1, bit 2 is used for channel 2 and so on). */ + ts_map = ts_map >> 1; + } card->fe_te.te_cfg.active_ch = ts_map; return; } @@ -2016,7 +2022,14 @@ sdla_te_settimeslot(void* pcard, unsigned long ts_map) unsigned long sdla_te_gettimeslot(void* pcard) { - return ((sdla_t*)pcard)->fe_te.te_cfg.active_ch; + sdla_t *card = (sdla_t*)pcard; + unsigned long ts_map = card->fe_te.te_cfg.active_ch; + + if (IS_T1(&card->fe_te.te_cfg)) { + /* See explaination before. */ + ts_map = ts_map << 1; + } + return ts_map; } /* @@ -2368,7 +2381,7 @@ sdla_te_config(void* card_id) EnableAllChannels(card); } else { for (i = 1; i <= channel_range; i++) { - if (te_cfg->active_ch & (1 << i)) { + if (te_cfg->active_ch & (1 << (i-1))) { #ifdef DEBUG_INIT log(LOG_DEBUG, "%s: Enable channel %d\n", card->devname, i); |