summaryrefslogtreecommitdiff
path: root/ztcodec_dte/codec_test.c
diff options
context:
space:
mode:
authormogorman <mogorman@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-01-17 21:42:45 +0000
committermogorman <mogorman@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-01-17 21:42:45 +0000
commit57f719d85f04bd036045c40c644e232a7196a564 (patch)
tree20bb3f438b302dd9104d304c7d54c10794fc2c32 /ztcodec_dte/codec_test.c
parent09b4857c756ec320188f099d51697a708245e311 (diff)
move to better binary methods
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1839 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztcodec_dte/codec_test.c')
-rw-r--r--ztcodec_dte/codec_test.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/ztcodec_dte/codec_test.c b/ztcodec_dte/codec_test.c
new file mode 100644
index 0000000..bab6398
--- /dev/null
+++ b/ztcodec_dte/codec_test.c
@@ -0,0 +1,71 @@
+/*
+ * Wilcard TC400B Digium Transcoder Engine Interface Driver for Zapata Telephony interface test tool.
+ *
+ * Written by Matt O'Gorman <mogormandigium.com>
+ *
+ * Copyright (C) 2006, Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <zaptel/zaptel.h>
+
+struct format_map {
+ unsigned int map[32][32];
+};
+
+static int find_transcoders(void)
+{
+ struct zt_transcode_info info = { 0, };
+ struct format_map map = { { { 0 } } };
+ int fd, res;
+ unsigned int x, y;
+
+ info.op = ZT_TCOP_GETINFO;
+ if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0) {
+ printf("Warning: No Zaptel transcoder support!\n");
+ return 0;
+ }
+ for (info.tcnum = 0; !(res = ioctl(fd, ZT_TRANSCODE_OP, &info)); info.tcnum++) {
+ printf("Found transcoder %d, '%s'.\n",info.tcnum, info.name);
+ x = ZT_TCOP_TEST;
+ ioctl(fd, ZT_TRANSCODE_OP, &x);
+ }
+ close(fd);
+ if (!info.tcnum)
+ printf("No hardware transcoders found.\n");
+ return 0;
+}
+
+int main()
+{
+ printf("this is a test\n");
+ find_transcoders();
+ return 0;
+}