Posted: Thu Sep 25, 2003 2:00 am Post subject: [Asterisk-cvs] zaptel wcfxs.c,1.20,1.21
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv18388
Modified Files:
wcfxs.c
Log Message:
Try Both Auto and Manual Calibration
Add sane and manual flag to init_proslic
Set RESET to low if module fails to load
-static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast);
+static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast , int manual, int sane);
static int wcfxs_proslic_insane(struct wcfxs *wc, int card)
{
- int blah;
+ int blah,insane_report;
+ insane_report=0;
blah = wcfxs_getreg(wc, card, 0);
if (debug)
@@ -537,19 +538,22 @@
if (blah != 0x2) {
printk("ProSLIC on module %d insane (1) %d should be 2\n", card, blah);
return -1;
- }
+ } else if ( insane_report)
+ printk("ProSLIC on module %d Reg 8 Reads %d Expected is 0x2\n",card,blah);
blah = wcfxs_getreg(wc, card, 64);
if (blah != 0x0) {
printk("ProSLIC on module %d insane (2)\n", card);
return -1;
- }
+ } else if ( insane_report)
+ printk("ProSLIC on module %d Reg 64 Reads %d Expected is 0x0\n",card,blah);
blah = wcfxs_getreg(wc, card, 11);
if (blah != 0x33) {
printk("ProSLIC on module %d insane (3)\n", card);
return -1;
- }
+ } else if ( insane_report)
+ printk("ProSLIC on module %d Reg 11 Reads %d Expected is 0x33\n",card,blah);
/* Just be sure it's setup right. */
wcfxs_setreg(wc, card, 30, 0);
@@ -724,7 +728,7 @@
return(0);
}
-#if 0
+#if 1
static int wcfxs_calibrate(struct wcfxs *wc, int card)
{
unsigned long origjiffies;
@@ -754,7 +758,7 @@
return 0;
}
#endif
-static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast)
+static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual, int sane)
{
/* Sanity check the ProSLIC */
- if (wcfxs_proslic_insane(wc, card))
- return -1;
+ if (!sane && wcfxs_proslic_insane(wc, card))
+ return -2;
if (wcfxs_init_indirect_regs(wc, card)) {
printk(KERN_INFO "Indirect Registers failed to initialize on module %d.\n", card);
@@ -814,9 +818,25 @@
}
#ifndef NO_CALIBRATION
/* Perform calibration */
- if (wcfxs_manual_calibrate(wc, card)) {
- printk("ProSlic died on Calibration (try -DNO_CALIBRATION in Makefile).\n");
- return -1;
+ if(manual) {
+ if (wcfxs_manual_calibrate(wc, card)) {
+ //printk("Proslic failed on Manual Calibration\n");
+ if (wcfxs_manual_calibrate(wc, card)) {
+ printk("Proslic Failed on Second Attempt to Calibrate Manually. (Try -DNO_CALIBRATION in Makefile)\n");
+ return -1;
+ }
+ printk("Proslic Passed Manual Calibration on Second Attempt\n");
+ }
+ }
+ else {
+ if(wcfxs_calibrate(wc, card)) {
+ //printk("ProSlic died on Auto Calibration.\n");
+ if (wcfxs_calibrate(wc, card)) {
+ printk("Proslic Failed on Second Attempt to Auto Calibrate\n");
+ return -1;
+ }
+ printk("Proslic Passed Auto Calibration on Second Attempt\n");
+ }
}
#endif
@@ -891,7 +911,7 @@
res = wcfxs_getreg(wc, card, 8);
if (res) {
printk("Ouch, part reset, quickly restoring reality (%d)\n", card);
- wcfxs_init_proslic(wc, card, 1);
+ wcfxs_init_proslic(wc, card, 1, 0, 1);
} else {
res = wcfxs_getreg(wc, card, 64);
if (!res && (res != wc->lasttxhook[card])) {
@@ -1105,8 +1125,10 @@
unsigned char x,y;
int failed;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum