summaryrefslogtreecommitdiff
path: root/pattest.c
diff options
context:
space:
mode:
authorjim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-23 02:10:18 +0000
committerjim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-23 02:10:18 +0000
commit709e2be4a4ed3ea6ef77ec79f9e8101ba56426fa (patch)
tree110e5800c9527a863e47f90d1cae3a3a13d81cfb /pattest.c
parentef96b440e1e3ab30938d2e04ff6dbcacaf72ec29 (diff)
Fixed problems in wct4xxp driver, and added error/alarm processing to patgen and pattest (Jim D)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@370 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'pattest.c')
-rwxr-xr-xpattest.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/pattest.c b/pattest.c
index 63fe061..e694619 100755
--- a/pattest.c
+++ b/pattest.c
@@ -25,16 +25,11 @@ void print_packet(unsigned char *buf, int len)
int main(int argc, char *argv[])
{
int fd;
- int fd2;
- int ires, res, x;
- int i;
+ int res, x;
ZT_PARAMS tp;
int bs = BLOCK_SIZE;
unsigned char c=0;
- unsigned char inbuf[BLOCK_SIZE];
unsigned char outbuf[BLOCK_SIZE];
- unsigned int fcs;
- static int packets=0;
int setup=0;
int errors=0;
int bytes=0;
@@ -60,8 +55,28 @@ int main(int argc, char *argv[])
res = bs;
res = read(fd, outbuf, res);
if (res < bs) {
- printf("Res is %d\n", res);
- exit(1);
+ int e;
+ ZT_SPANINFO zi;
+ res = ioctl(fd,ZT_GETEVENT,&e);
+ if (res == -1)
+ {
+ perror("ZT_GETEVENT");
+ exit(1);
+ }
+ if (e == ZT_EVENT_NOALARM)
+ printf("ALARMS CLEARED\n");
+ if (e == ZT_EVENT_ALARM)
+ {
+ zi.spanno = 0;
+ res = ioctl(fd,ZT_SPANSTAT,&zi);
+ if (res == -1)
+ {
+ perror("ZT_SPANSTAT");
+ exit(1);
+ }
+ printf("Alarm mask %x hex\n",zi.alarms);
+ }
+ continue;
}
if (!setup) {
c = outbuf[0];
@@ -69,7 +84,7 @@ int main(int argc, char *argv[])
}
for (x=0;x<bs;x++) {
if (outbuf[x] != c) {
- printf("(Error %d): Unexpected result, %d != %d, %d bytes since last error.\n", ++errors, outbuf[x], c, bytes);
+ printf("(Error %d): Unexpected result, %d != %d, %d bytes since last error.\n", ++errors, outbuf[x], c, bytes);
c = outbuf[x];
bytes=0;
}