void devicetest() { emu_board* b = emub_create(); emu_device* d1 = create_pinger(); emu_device* d2 = create_pinger(); int i; int i1 = 0; int i2 = 1; printf(">>> we are connecting two pingers, in slots %d and %d\n", i1, i2); my_connect(b, d1, i1); my_connect(b, d2, i2); printf(">>> we will now broadcast the signals 0 through 10\n"); for(i = 0; i < 100; i += 10) my_broadcast(b, i); printf(">>> we will now send (255 - n) to each plug n\n"); for(i = 0; i < 0x100; i++) my_send(b, i, 0x100 - i); printf(">>> we will now free the board\n"); emub_free(b); }
/** * Ping a host * * @v hostname Hostname * @v timeout Timeout between pings, in ticks * @v len Payload length * @ret rc Return status code */ int ping ( const char *hostname, unsigned long timeout, size_t len ) { int rc; /* Create pinger */ if ( ( rc = create_pinger ( &monojob, hostname, timeout, len, ping_callback ) ) != 0 ) { printf ( "Could not start ping: %s\n", strerror ( rc ) ); return rc; } /* Wait for ping to complete */ if ( ( rc = monojob_wait ( NULL, 0 ) ) != 0 ) { printf ( "Finished: %s\n", strerror ( rc ) ); return rc; } return 0; }