File: romtest.c

package info (click to toggle)
libavc1394 0.5.4-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 1,640 kB
  • sloc: sh: 10,131; ansic: 2,958; makefile: 61
file content (91 lines) | stat: -rw-r--r-- 3,409 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * librom1394 - GNU/Linux IEEE 1394 CSR Config ROM Library
 * romtest - a program to test the library and give info about your devices
 * 
 * Copyright 2001 by Dan Dennedy <dan@dennedy.org>
 * 
 * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include <config.h>

#include "../librom1394/rom1394.h"

#include <libraw1394/raw1394.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main (int argc, char *argv[])
{
	raw1394handle_t handle;
	int i, length;
	rom1394_bus_options bus_options;
	octlet_t guid;
	rom1394_directory dir;

#ifdef RAW1394_V_0_8
	handle = raw1394_get_handle();
#else
    handle = raw1394_new_handle();
#endif
    if (!handle) {
        if (!errno) {
            printf("Not Compatible!\n");
        } else {
            printf("\ncouldn't get handle\n");
            printf("Not Loaded!\n");
        }
        exit(1);
    } 


	if ( raw1394_set_port(handle, 0) < 0 ) {
		printf("couldn't set port\n");
		exit(1);
	}

    printf("Librom1394 Test Report\n");
    printf("=================================================\n");

    for (i=0; i < raw1394_get_nodecount(handle); ++i) {
        printf( "\nNode %d: \n", i);
        printf( "-------------------------------------------------\n");
        length = rom1394_get_bus_info_block_length(handle, i);
        printf("bus info block length = %d\n", length);
        printf("bus id = 0x%08x\n", rom1394_get_bus_id(handle, i));
        rom1394_get_bus_options(handle, i, &bus_options);
        printf("bus options:\n");
        printf("    isochronous resource manager capable: %d\n", bus_options.irmc);
        printf("    cycle master capable                : %d\n", bus_options.cmc);
        printf("    isochronous capable                 : %d\n", bus_options.isc);
        printf("    bus manager capable                 : %d\n", bus_options.bmc);
        printf("    cycle master clock accuracy         : %d ppm\n", bus_options.cyc_clk_acc);
        printf("    maximum asynchronous record size    : %d bytes\n", bus_options.max_rec);
        guid = rom1394_get_guid(handle, i);
        printf("GUID: 0x%08x%08x\n", (quadlet_t) (guid>>32), (quadlet_t) (guid & 0xffffffff));
        rom1394_get_directory( handle, i, &dir);
        printf("directory:\n");
        printf("    node capabilities    : 0x%08x\n", dir.node_capabilities);
        printf("    vendor id            : 0x%08x\n", dir.vendor_id);
        printf("    unit spec id         : 0x%08x\n", dir.unit_spec_id);
        printf("    unit software version: 0x%08x\n", dir.unit_sw_version);
        printf("    model id             : 0x%08x\n", dir.model_id);
        printf("    textual leaves       : %s\n", dir.label);

        rom1394_free_directory( &dir);
    }
    return 0;
}