[aadk-commits] dbailey: uClinux/trunk r534 - in /uClinux/trunk/uClinux-dist: config/ user/bu...
SVN commits to the AADK repository
aadk-commits at lists.digium.com
Fri Jul 20 16:13:43 CDT 2007
Author: dbailey
Date: Fri Jul 20 16:13:43 2007
New Revision: 534
URL: http://svn.digium.com/view/aadk?view=rev&rev=534
Log:
Add fxstest utility into the busybox suite of applets.
This allows the inspection/manipulation of the proslic and daa line driver IC's
Added:
uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c (with props)
Modified:
uClinux/trunk/uClinux-dist/config/.config
uClinux/trunk/uClinux-dist/config/config.in
uClinux/trunk/uClinux-dist/config/digium-config
uClinux/trunk/uClinux-dist/user/busybox/.config.mkconfig
uClinux/trunk/uClinux-dist/user/busybox/config-s800i
uClinux/trunk/uClinux-dist/user/busybox/defconfig
uClinux/trunk/uClinux-dist/user/busybox/include/applets.h
uClinux/trunk/uClinux-dist/user/busybox/include/usage.h
uClinux/trunk/uClinux-dist/user/busybox/miscutils/Config.in
uClinux/trunk/uClinux-dist/user/busybox/miscutils/Makefile.in
uClinux/trunk/uClinux-dist/vendors/Digium/S800I/config.vendor-2.6.x
Modified: uClinux/trunk/uClinux-dist/config/.config
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/config/.config?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/config/.config (original)
+++ uClinux/trunk/uClinux-dist/config/.config Fri Jul 20 16:13:43 2007
@@ -477,6 +477,7 @@
CONFIG_USER_BUSYBOX_FTPGET=y
CONFIG_USER_BUSYBOX_FTPPUT=y
CONFIG_USER_BUSYBOX_FXOTUNE=y
+# CONFIG_USER_BUSYBOX_FXSTEST is not set
CONFIG_USER_BUSYBOX_GETOPT=y
CONFIG_USER_BUSYBOX_GETTY=y
CONFIG_USER_BUSYBOX_GREP=y
Modified: uClinux/trunk/uClinux-dist/config/config.in
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/config/config.in?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/config/config.in (original)
+++ uClinux/trunk/uClinux-dist/config/config.in Fri Jul 20 16:13:43 2007
@@ -972,6 +972,7 @@
bool 'ftpget' CONFIG_USER_BUSYBOX_FTPGET
bool 'ftpput' CONFIG_USER_BUSYBOX_FTPPUT
bool 'fxotune' CONFIG_USER_BUSYBOX_FXOTUNE
+ bool 'fxstest' CONFIG_USER_BUSYBOX_FXSTEST
bool 'getopt' CONFIG_USER_BUSYBOX_GETOPT
bool 'getty' CONFIG_USER_BUSYBOX_GETTY
bool 'grep' CONFIG_USER_BUSYBOX_GREP
Modified: uClinux/trunk/uClinux-dist/config/digium-config
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/config/digium-config?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/config/digium-config (original)
+++ uClinux/trunk/uClinux-dist/config/digium-config Fri Jul 20 16:13:43 2007
@@ -703,6 +703,7 @@
# CONFIG_USER_BUSYBOX_ZTCFG is not set
# CONFIG_USER_BUSYBOX_ZTMONITOR is not set
# CONFIG_USER_BUSYBOX_FXOTUNE is not set
+# CONFIG_USER_BUSYBOX_FXSTEST is not set
# CONFIG_USER_BUSYBOX_MAKELIST is not set
# CONFIG_USER_BUSYBOX_USE_BB_PWD_GRP is not set
# CONFIG_USER_BUSYBOX_DMALLOC is not set
Modified: uClinux/trunk/uClinux-dist/user/busybox/.config.mkconfig
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/.config.mkconfig?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/.config.mkconfig (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/.config.mkconfig Fri Jul 20 16:13:43 2007
@@ -322,6 +322,7 @@
CONFIG_ZTCFG=y
CONFIG_ZTMONITOR=y
CONFIG_FXOTUNE=y
+# CONFIG_FXSTEST is not set
#
# Linux Module Utilities
Modified: uClinux/trunk/uClinux-dist/user/busybox/config-s800i
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/config-s800i?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/config-s800i (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/config-s800i Fri Jul 20 16:13:43 2007
@@ -285,6 +285,7 @@
CONFIG_ZTCFG=y
CONFIG_ZTMONITOR=y
CONFIG_FXOTUNE=y
+CONFIG_FXSTEST=y
CONFIG_NVRAM_EDIT=y
#
Modified: uClinux/trunk/uClinux-dist/user/busybox/defconfig
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/defconfig?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/defconfig (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/defconfig Fri Jul 20 16:13:43 2007
@@ -322,6 +322,7 @@
# CONFIG_ZTCFG is not set
# CONFIG_ZTMONITOR is not set
# CONFIG_FXOTUNE is not set
+# CONFIG_FXSTEST is not set
#
# Linux Module Utilities
Modified: uClinux/trunk/uClinux-dist/user/busybox/include/applets.h
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/include/applets.h?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/include/applets.h (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/include/applets.h Fri Jul 20 16:13:43 2007
@@ -226,6 +226,9 @@
#ifdef CONFIG_FXOTUNE
APPLET(fxotune, fxotune_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
+#ifdef CONFIG_FXSTEST
+ APPLET(fxstest, fxstest_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
#ifdef CONFIG_GETOPT
APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
Modified: uClinux/trunk/uClinux-dist/user/busybox/include/usage.h
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/include/usage.h?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/include/usage.h (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/include/usage.h Fri Jul 20 16:13:43 2007
@@ -86,6 +86,9 @@
"<channel num> [OPTIONS]..."
#define fxotune_trivial_usage \
+ "[OPTIONS]..."
+
+#define fxstest_trivial_usage \
"[OPTIONS]..."
#define ztcfg_full_usage \
@@ -132,6 +135,16 @@
" -w <waveform> : -1 for multitone waveform, or frequency of\n" \
" single tone (default -1)\n"
+#define fxstest_full_usage \
+ "Usage: fxstest <zap device> <cmd>\n" \
+ " This application allows for probing proslic and daa.\n" \
+ " line drivers. <cmd> is one of:\n" \
+ " stats - reports voltages\n" \
+ " regdump - dumps ProSLIC registers\n" \
+ " tones - plays a series of tones\n" \
+ " polarity - tests polarity reversal\n" \
+ " ring - rings phone\n"
+
#define makeiplist_trivial_usage \
"START COUNT"
Modified: uClinux/trunk/uClinux-dist/user/busybox/miscutils/Config.in
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/miscutils/Config.in?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/miscutils/Config.in (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/miscutils/Config.in Fri Jul 20 16:13:43 2007
@@ -233,6 +233,13 @@
The utility both determines coefficient values as well as restore
settings from a configuration file.
+config CONFIG_FXSTEST
+ bool "fxstest"
+ default n
+ help
+ The fxstest utility allows the user to inspect/excercise the proslic
+ and 3050 DAA registers.
+
config CONFIG_NVRAM
bool "nvram"
default y
Modified: uClinux/trunk/uClinux-dist/user/busybox/miscutils/Makefile.in
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/miscutils/Makefile.in?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/miscutils/Makefile.in (original)
+++ uClinux/trunk/uClinux-dist/user/busybox/miscutils/Makefile.in Fri Jul 20 16:13:43 2007
@@ -41,6 +41,7 @@
MISCUTILS-$(CONFIG_ZTMONITOR) += ztmonitor.o
MISCUTILS-$(CONFIG_ZAPSCAN) += zapscan.o
MISCUTILS-$(CONFIG_FXOTUNE) += fxotune.o
+MISCUTILS-$(CONFIG_FXSTEST) += fxstest.o
MISCUTILS-$(CONFIG_NVRAM) += nvram.o
MISCUTILS-$(CONFIG_MAKEIPLIST) += makeiplist.o
@@ -51,6 +52,7 @@
needlibm-$(CONFIG_ZTCFG) := y
needlibm-$(CONFIG_ZTMONITOR) := y
needlibm-$(CONFIG_FXOTUNE) := y
+needlibm-$(CONFIG_FXSTEST) := y
ifeq ($(needlibm-y),y)
LIBRARIES += -lm
Added: uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c?view=auto&rev=534
==============================================================================
--- uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c (added)
+++ uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c Fri Jul 20 16:13:43 2007
@@ -1,0 +1,158 @@
+/*
+ * This file and contents thereof are licensed under the terms and
+ * conditions of the GNU Public License version 2. For more information
+ * (including terms and conditions) see http://www.gnu.org/
+ *
+ * fxstest.c -- A utility for inspecting proslic and DAA register sets
+ *
+ * (C) 2007 Digium, Inc.
+ */
+#include "busybox.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+//#include "zaptel.h"
+//#include "tonezone.h"
+#include <zaptel/zaptel.h>
+#include <zaptel/tonezone.h>
+#include "wctdm.h"
+
+static int tones[] = {
+ ZT_TONE_DIALTONE,
+ ZT_TONE_BUSY,
+ ZT_TONE_RINGTONE,
+ ZT_TONE_CONGESTION,
+ ZT_TONE_DIALRECALL,
+};
+
+int fxstest_main(int argc, char *argv[])
+{
+ int fd;
+ int res;
+ int x;
+ if (argc < 3) {
+ fprintf(stderr, "Usage: fxstest <zap device> <cmd>\n"
+ " where cmd is one of:\n"
+ " stats - reports voltages\n"
+ " regdump - dumps ProSLIC registers\n"
+ " tones - plays a series of tones\n"
+ " polarity - tests polarity reversal\n"
+ " ring - rings phone\n");
+ exit(1);
+ }
+ fd = open(argv[1], O_RDWR);
+ if (fd < 0) {
+ fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno));
+ exit(1);
+ }
+ if (!strcasecmp(argv[2], "ring")) {
+ fprintf(stderr, "Ringing phone...\n");
+ x = ZT_RING;
+ res = ioctl(fd, ZT_HOOK, &x);
+ if (res) {
+ fprintf(stderr, "Unable to ring phone...\n");
+ } else {
+ fprintf(stderr, "Phone is ringing...\n");
+ sleep(2);
+ }
+ } else if (!strcasecmp(argv[2], "polarity")) {
+ fprintf(stderr, "Twiddling polarity...\n");
+ x = 0;
+ res = ioctl(fd, ZT_SETPOLARITY, &x);
+ if (res) {
+ fprintf(stderr, "Unable to polarity...\n");
+ } else {
+ fprintf(stderr, "Polarity is forward...\n");
+ sleep(2);
+ x = 1;
+ ioctl(fd, ZT_SETPOLARITY, &x);
+ fprintf(stderr, "Polarity is reversed...\n");
+ sleep(5);
+ x = 0;
+ ioctl(fd, ZT_SETPOLARITY, &x);
+ fprintf(stderr, "Polarity is forward...\n");
+ sleep(2);
+ }
+ } else if (!strcasecmp(argv[2], "tones")) {
+ int x = 0;
+ for (;;) {
+ res = tone_zone_play_tone(fd, tones[x]);
+ if (res)
+ fprintf(stderr, "Unable to play tone %d\n", tones[x]);
+ sleep(3);
+ x=(x+1) % (sizeof(tones) / sizeof(tones[0]));
+ }
+ } else if (!strcasecmp(argv[2], "stats")) {
+ struct wctdm_stats stats;
+ res = ioctl(fd, WCTDM_GET_STATS, &stats);
+ if (res) {
+ fprintf(stderr, "Unable to get stats on channel %s\n", argv[1]);
+ } else {
+ printf("TIP: %7.4f Volts\n", (float)stats.tipvolt / 1000.0);
+ printf("RING: %7.4f Volts\n", (float)stats.ringvolt / 1000.0);
+ printf("VBAT: %7.4f Volts\n", (float)stats.batvolt / 1000.0);
+ }
+ } else if (!strcasecmp(argv[2], "regdump")) {
+ struct wctdm_regs regs;
+ int numregs = NUM_REGS;
+ memset(®s, 0, sizeof(regs));
+ res = ioctl(fd, WCTDM_GET_REGS, ®s);
+ if (res) {
+ fprintf(stderr, "Unable to get registers on channel %s\n", argv[1]);
+ } else {
+ for (x=60;x<NUM_REGS;x++) {
+ if (regs.direct[x])
+ break;
+ }
+ if (x == NUM_REGS)
+ numregs = 60;
+ printf("Direct registers: \n");
+ for (x=0;x<numregs;x++) {
+ printf("%3d. %02x ", x, regs.direct[x]);
+ if ((x % 8) == 7)
+ printf("\n");
+ }
+ if (numregs == NUM_REGS) {
+ printf("\n\nIndirect registers: \n");
+ for (x=0;x<NUM_INDIRECT_REGS;x++) {
+ printf("%3d. %04x ", x, regs.indirect[x]);
+ if ((x % 6) == 5)
+ printf("\n");
+ }
+ }
+ printf("\n\n");
+ }
+ } else if (!strcasecmp(argv[2], "setdirect") ||
+ !strcasecmp(argv[2], "setindirect")) {
+ struct wctdm_regop regop;
+ int val;
+ int reg;
+ if ((argc < 5) || (sscanf(argv[3], "%i", ®) != 1) ||
+ (sscanf(argv[4], "%i", &val) != 1)) {
+ fprintf(stderr, "Need a register and value...\n");
+ } else {
+ regop.reg = reg;
+ regop.val = val;
+ if (!strcasecmp(argv[2], "setindirect")) {
+ regop.indirect = 1;
+ regop.val &= 0xff;
+ } else {
+ regop.indirect = 0;
+ }
+ res = ioctl(fd, WCTDM_SET_REG, ®op);
+ if (res)
+ fprintf(stderr, "Unable to get registers on channel %s\n", argv[1]);
+ else
+ printf("Success.\n");
+ }
+ } else
+ fprintf(stderr, "Invalid command\n");
+ close(fd);
+ return 0;
+}
+
Propchange: uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: uClinux/trunk/uClinux-dist/user/busybox/miscutils/fxstest.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: uClinux/trunk/uClinux-dist/vendors/Digium/S800I/config.vendor-2.6.x
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/vendors/Digium/S800I/config.vendor-2.6.x?view=diff&rev=534&r1=533&r2=534
==============================================================================
--- uClinux/trunk/uClinux-dist/vendors/Digium/S800I/config.vendor-2.6.x (original)
+++ uClinux/trunk/uClinux-dist/vendors/Digium/S800I/config.vendor-2.6.x Fri Jul 20 16:13:43 2007
@@ -477,6 +477,7 @@
CONFIG_USER_BUSYBOX_FTPGET=y
CONFIG_USER_BUSYBOX_FTPPUT=y
CONFIG_USER_BUSYBOX_FXOTUNE=y
+CONFIG_USER_BUSYBOX_FXSTEST=y
CONFIG_USER_BUSYBOX_GETOPT=y
CONFIG_USER_BUSYBOX_GETTY=y
CONFIG_USER_BUSYBOX_GREP=y
More information about the aadk-commits
mailing list