summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Stefan Richter 2012-06-30 18:49:43 +0200
committerGravatar Stefan Richter 2012-06-30 19:02:20 +0200
commitd50f7381b21e6f720b49464de1c2886950115c9c (patch)
tree0c7a0f60a9183956f73143dc52c744ae1eb1c1cd /tools
parentTrivial whitespace normalization in ieee1394.h and raw1394.h (diff)
Add raw1394_get_speed() API
This lets initiators of isochronous streams or asynchronous streams from or to the local node figure out what maximum speed can be configured. Furthermore it can be used to display connection speeds for informative purposes without having to perform topology analysis (in case of 1394a buses) or extensive phy port status queries (in case of 1394b buses). To be in line with other existing libraw1394 APIs which use nodeid_t variables, this API identifies a node only via a card:nodeID tuple which is unsafe against generation changes. A node can only be properly identified by card:generation:nodeID tuples. However, since this new API extension and libraw1394 as a whole is mainly aimed towards existing libraw1394 client code bases rather than new developments, I decided against making this call race free but somewhat more difficult to use in typical existing client code. A unit test for the new call is added to testlibraw as well. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to '')
-rw-r--r--tools/testlibraw.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/testlibraw.c b/tools/testlibraw.c
index b322a5d..fbeb273 100644
--- a/tools/testlibraw.c
+++ b/tools/testlibraw.c
@@ -229,7 +229,7 @@ int test_card(int card)
struct raw1394_portinfo pinf;
tag_handler_t std_handler;
struct pollfd pfd;
- int i, n, numcards, retval;
+ int i, l, n, numcards, retval, s;
handle = raw1394_new_handle();
@@ -267,10 +267,22 @@ int test_card(int card)
}
n = raw1394_get_nodecount(handle);
- printf("%d nodes on bus, local ID is %d, IRM is %d\n",
- n,
- raw1394_get_local_id(handle) & 0x3f,
- raw1394_get_irm_id(handle) & 0x3f);
+ l = raw1394_get_local_id(handle) & 0x3f;
+ i = raw1394_get_irm_id(handle) & 0x3f;
+ printf("%d nodes on bus, local ID is %d, IRM is %d\n", n, l, i);
+
+ if (n > 0)
+ printf("\n - getting speeds between between nodes and local node\n");
+ for (i = 0; i < n; i++) {
+ printf(" node %d: ", i);
+ fflush(stdout);
+ s = raw1394_get_speed(handle, 0xffc0 | i);
+ if (s >= 0)
+ printf("S%d00%s\n", 1 << s,
+ i == l ? " (local node)" : "");
+ else
+ perror("unknown");
+ }
if (n > 0) {
printf("\n - doing transactions with custom tag handler\n");
t='Gravatar' /> bencollins 4-5/+14 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@108 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-23add libtoolize to bootstrapGravatar ddennedy 1-1/+10 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@107 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-21added Dan Maas' rawiso docsGravatar ddennedy 1-32/+295 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@106 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-07new_handle_on_port() error path fix from Jim RadfordGravatar dmaas 1-1/+3 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@105 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-03-26add raw1394_new_handle_on_port() convenience functionGravatar dmaas 2-1/+41 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@104 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-02-22Updates for new rawiso ioctl interface.Gravatar bencollins 3-37/+125 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@103 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15add iso_xmit_sync() and iso_xmit_write(); clean up iso handling a bitGravatar dmaas 5-39/+161 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@102 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15implement tag matching for rawiso receptionGravatar dmaas 3-4/+12 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@101 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-06back out previous commit - don't drop the legacy API just yetGravatar dmaas 6-173/+130 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@100 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@99 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@98 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@97 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; ↵Gravatar anonymous 3-124/+48 brought kernel-raw1394.h back in sync with the kernel version git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@96 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 - changed return type of rawiso xmit/recv handlers from int to enum raw1394_iso_disposition - added an ioctl (RAW1394_ISO_QUEUE_ACTIVITY) to force an ISO_ACTIVITY event into the queue. This is needed for handling RAW1394_ISO_DEFER, to kick us out of the next read() instead of sleeping forever. - removed references to "8-byte" isochronous header - this is an OHCI-specific implementation detail git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@95 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@94 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@93 53a565d1-3bb7-0310-b661-cf11e63c67ab