Index: trunk/libfreebob/config.h.in =================================================================== --- trunk/libfreebob/config.h.in (revision 185) +++ trunk/libfreebob/config.h.in (revision 185) @@ -0,0 +1,94 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Freebob major version */ +#undef FREEBOB_MAJOR_VERSION + +/* Freebob micro version */ +#undef FREEBOB_MICRO_VERSION + +/* Freebob minor version */ +#undef FREEBOB_MINOR_VERSION + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if MMX assembly is available. */ +#undef USE_MMX + +/* Define to 1 if SSE assembly is available. */ +#undef USE_SSE + +/* Version number of package */ +#undef VERSION + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to empty if the keyword `volatile' does not work. Warning: valid + code using `volatile' can become incorrect without. Disable with care. */ +#undef volatile + +/* "Nope it's intel" */ +#undef x86 Index: trunk/libfreebob/libfreebob.pc.in =================================================================== --- trunk/libfreebob/libfreebob.pc.in (revision 336) +++ trunk/libfreebob/libfreebob.pc.in (revision 336) @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libfreebob +Description: FreeBoB +Version: @VERSION@ +Libs: -L${libdir} -lfreebob +Cflags: -I${includedir} Index: trunk/libfreebob/tests/test-fw410.cpp =================================================================== --- trunk/libfreebob/tests/test-fw410.cpp (revision 336) +++ trunk/libfreebob/tests/test-fw410.cpp (revision 336) @@ -0,0 +1,204 @@ +/* test-fw410.cpp + * Copyright (C) 2006 by Daniel Wagner + * + * This file is part of FreeBoB. + * + * FreeBoB 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. + * FreeBoB 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 FreeBoB; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + +#include +#include + +#include +#include +#include + +using namespace std; + +//////////////////////////////////////////////// +// arg parsing +//////////////////////////////////////////////// +const char *argp_program_version = "test-fw410 0.1"; +const char *argp_program_bug_address = ""; +static char doc[] = "test-fw410 -- test program to get the fw410 streaming"; +static char args_doc[] = "NODE_ID"; +static struct argp_option options[] = { + {"verbose", 'v', 0, 0, "Produce verbose output" }, + {"port", 'p', "PORT", 0, "Set port" }, + { 0 } +}; + +struct arguments +{ + arguments() + : verbose( false ) + , test( false ) + , port( 0 ) + { + args[0] = 0; + } + + char* args[1]; + bool verbose; + bool test; + int port; +} arguments; + +// Parse a single option. +static error_t +parse_opt( int key, char* arg, struct argp_state* state ) +{ + // Get the input argument from `argp_parse', which we + // know is a pointer to our arguments structure. + struct arguments* arguments = ( struct arguments* ) state->input; + + char* tail; + switch (key) { + case 'v': + arguments->verbose = true; + break; + case 't': + arguments->test = true; + break; + case 'p': + errno = 0; + arguments->port = strtol(arg, &tail, 0); + if (errno) { + perror("argument parsing failed:"); + return errno; + } + break; + case ARGP_KEY_ARG: + if (state->arg_num >= 1) { + // Too many arguments. + argp_usage (state); + } + arguments->args[state->arg_num] = arg; + break; + case ARGP_KEY_END: + if (state->arg_num < 1) { + // Not enough arguments. + argp_usage (state); + } + break; + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +static struct argp argp = { options, parse_opt, args_doc, doc }; + +/////////////////////////// +// main +////////////////////////// +int +main(int argc, char **argv) +{ + // arg parsing + argp_parse (&argp, argc, argv, 0, 0, &arguments); + + errno = 0; + char* tail; + int iNodeId = strtol(arguments.args[0], &tail, 0); + if (errno) { + perror("argument parsing failed:"); + return -1; + } + + raw1394handle_t pHandle = raw1394_new_handle_on_port( arguments.port ); + if ( !pHandle ) { + if ( !errno ) { + cerr << "libraw1394 not compatible" << endl; + } else { + perror( "Could not get 1394 handle" ); + cerr << "Is ieee1394 and raw1394 driver loaded?" << endl; + } + return -1; + } + + struct Connection { + int m_output; + int m_oplug; + int m_input; + int m_iplug; + int m_iBandwith; + int m_iIsoChannel; + }; + + + int iLocalId = raw1394_get_local_id( pHandle ); + int iRemoteId = iNodeId | 0xffc0; + Connection cons[] = { + // output, oplug, input, iplug, bandwith, iso channel + { iRemoteId, 0, iLocalId, -1, 0x148, -1 }, // oPCR[0] + { iRemoteId, 1, iLocalId, -1, 0x148, -1 }, // oPCR[1] + // { iRemoteId, 2, iLocalId, -1, 0, -1 }, // oPCR[2]: cmp not supported + { iLocalId, -1, iRemoteId, 0, 0x148, -1 }, // iPCR[0] + { iLocalId, -1, iRemoteId, 1, 0x148, -1 }, // iPCR[1] + // { iLocalId, -1, iRemoteId, 2, 0, -1 }, // iPCR[2]: cmp not supported + }; + + printf( "local node id %d\n", iLocalId & ~0xffc0); + printf( "remote node id %d\n", iRemoteId & ~0xffc0); + + for ( unsigned int i = 0; i < sizeof( cons ) / sizeof( cons[0] ); ++i ) { + Connection* pCons = &cons[i]; + + // the bandwith calculation fails, so its better to use + // some default values. + pCons->m_iBandwith = iec61883_cmp_calc_bandwidth ( pHandle, + pCons->m_output, + pCons->m_oplug, + IEC61883_DATARATE_400 ); + sleep(1); + pCons->m_iIsoChannel = iec61883_cmp_connect( pHandle, + pCons->m_output, + &pCons->m_oplug, + pCons->m_input, + &pCons->m_iplug, + &pCons->m_iBandwith ); + printf( "%2d -> %2d %cPCR[%2d]: bw = %4d, ch = %2d\n", + pCons->m_output & ~0xffc0, + pCons->m_input & ~0xffc0, + pCons->m_oplug == -1? 'i' : 'o', + pCons->m_oplug == -1? pCons->m_iplug: pCons->m_oplug, + pCons->m_iBandwith, + pCons->m_iIsoChannel ); + sleep(1); + } + + sleep( 5 ); + + for ( unsigned int i = 0; i < sizeof( cons ) / sizeof( cons[0] ); ++i ) { + Connection* pCons = &cons[i]; + + if ( pCons->m_iIsoChannel != -1 ) { + iec61883_cmp_disconnect( pHandle, + pCons->m_output, + pCons->m_oplug, + pCons->m_input, + pCons->m_iplug, + pCons->m_iIsoChannel, + pCons->m_iBandwith ); + + + } + } + + + raw1394_destroy_handle( pHandle ); + return 0; +} Index: trunk/libfreebob/tests/test-freebob.c =================================================================== --- trunk/libfreebob/tests/test-freebob.c (revision 336) +++ trunk/libfreebob/tests/test-freebob.c (revision 336) @@ -0,0 +1,440 @@ +/* test-freebob.c + * Copyright (C) 2005 by Daniel Wagner + * + * This file is part of FreeBoB. + * + * FreeBoB 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. + * FreeBoB 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 FreeBoB; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA. + */ + +#include + +#include "libfreebob/freebob.h" +#include "libfreebob/freebob_bounce.h" + +#include +#include +#include +#include + +#define FREEBOB_BOUNCE_SERVER_GETXMLDESCRIPTION_CMD +#define AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER 0x0D + +const char *argp_program_version = PACKAGE_STRING; +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + +// Program documentation. +static char doc[] = "FreeBoB -- a driver for BeBoB devices (test application)\n\n" + "OPERATION: discover\n" + " odisocver\n" + " setsamplerate\n" + " xmldump\n" + " testmultidevicediscovery\n" + " streamformats\n"; + +// A description of the arguments we accept. +static char args_doc[] = "OPERATION"; + +struct arguments +{ + short silent; + short verbose; + int port; + int node_id; + int node_id_set; + int time; + char* args[2]; +}; + +// The options we understand. +static struct argp_option options[] = { + {"quiet", 'q', 0, 0, "Don't produce any output" }, + {"silent", 's', 0, OPTION_ALIAS }, + + {"verbose", 'v', "level", 0, "Produce verbose output" }, + + + {"node", 'n', "id", 0, "Node to use" }, + {"port", 'p', "nr", 0, "IEEE1394 Port to use" }, + {"time", 't', "time", 0, "Workaround: sleep