
Diagnostic SpaceWire Interface
EtherSpaceLink family User Manual
int main (int argc, char * argv [] )
{
unsigned char HWA[6];
int ports = 2;
/* enables one port for loopback
and one for wired loopback */
pthread_t th_rx;
/* Thread for receiving packets */
pthread_t th_tx;
/* Thread for sending packets */
int i;
if (argc < 3)
{ fprintf ( stderr,
"Usage: %s <DSI IP address> <filename>\n", argv[0]);
exit (1);
}
printf ("Connecting to %s ...", argv[1] );
fflush ( stdout );
DSI_unit = EtherSpaceLink_open ( argv[1] );
if ( DSI_unit == 0 )
{
fprintf ( stderr, "\n"
"Failed to establish connection to EtherSpaceLink\n"
"
[Are you using the correct IP address?]\n"
"
[Is the network OK?]\n"
);
exit (1);
}
printf (" OK\n");
EtherSpaceLink_get_HWA ( DSI_unit, HWA );
printf ( "%s",
EtherSpaceLink_get_manufacturer_string ( DSI_unit ) );
printf ( " %s", EtherSpaceLink_get_product_string ( DSI_unit ) );
printf ( " (%i ports)\n", EtherSpaceLink_get_number_of_links ( DSI_unit ) );
printf ( "Serial number %s",
EtherSpaceLink_HWA_to_serial_number_string ( HWA ) );
printf ( " at %2.2X-%2.2X-%2.2X-%2.2X-%2.2X-%2.2X",
HWA[0], HWA[1], HWA[2], HWA[3], HWA[4], HWA[5] );
printf ( "\n\n" );
for ( i = 1; i <= ports; i++ )
{ int status;
status = EtherSpaceLink_set_active_link ( DSI_unit, i
/*tx_link*/ );
EtherSpaceLink_set_speed ( DSI_unit, 100 );
// Global speed for all ports
status = EtherSpaceLink_ER_enable_reporting ( DSI_unit,
EtherSpaceLink_ER_report_parity_error
| EtherSpaceLink_ER_report_time_code
| EtherSpaceLink_ER_report_ESC_EOP
| EtherSpaceLink_ER_report_ESC_EEP
| EtherSpaceLink_ER_report_ESC_ESC
| EtherSpaceLink_ER_report_timeout);
status = EtherSpaceLink_set_mode ( DSI_unit, EtherSpaceLink_LINK_mode_normal );
}
4Links Limited
www.4Links.co.uk
[email protected]
page 60 of 130
T +44 1908 642001; F +44 1908 363463
Milton Keynes MK3 6EB, UK
Suite EU2, Bletchley Park