From 709e2be4a4ed3ea6ef77ec79f9e8101ba56426fa Mon Sep 17 00:00:00 2001 From: jim Date: Fri, 23 Apr 2004 02:10:18 +0000 Subject: 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 --- patgen.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'patgen.c') diff --git a/patgen.c b/patgen.c index 5c360dc..6ee48f5 100755 --- a/patgen.c +++ b/patgen.c @@ -26,16 +26,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, res1, 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; if (argc < 2) { fprintf(stderr, "Usage: markhdlctest \n"); exit(1); @@ -65,7 +60,31 @@ int main(int argc, char *argv[]) outbuf[x] = c; c = bit_next(c); } - res = write(fd, outbuf, res); + res1 = write(fd, outbuf, res); + if (res1 < res) { + 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 0 printf("(%d) Wrote %d bytes\n", packets++, res); #endif -- cgit v1.2.3