static int EthernetIoctl(const int opcode, void *args) { #ifdef DEBUG printf( "EthernetIoctl: op %d arg %x\n", opcode, args ); #endif /* * IGNORE(opcode) */ if (0) { int dummy = opcode; UNUSED(dummy); } UNUSED(args); switch ( opcode ) { case DC_RESYNC: { #ifdef DEBUG printf( "EthernetIoctl: resync\n" ); #endif fetch_ports(); return 0; } default: { return -1; } } }
void init_camera(void) { fprintf(stderr, "initializing camera\n"); create_component(CAMERA, &(g_data.camera), "camera"); fetch_ports(g_data.camera); configure_camera(g_data.camera); set_preview_port(g_data.camera_preview_port); set_video_port(g_data.camera_video_port); create_pool_on_port( &(g_data.camera_video_port_pool), g_data.camera_video_port, video_buffer_callback, "video"); enable_component(g_data.camera, "camera"); }
/* * Function: Ethernet_Open * Purpose: Open the Ethernet device. See the documentation for * DeviceOpen in drivers.h * * Post-conditions: Will have updated struct sockaddr_in remote (*ia) * with the address of the remote target. */ static int EthernetOpen(const char *name, const char *arg) { #ifdef COMPILING_ON_WINDOWS WORD wVersionRequested; WSADATA wsaData; #endif /* * name is passed as e=<blah>, so skip 1st two characters */ const char *etheraddr = name + 2; #ifdef DEBUG printf("EthernetOpen: name `%s'\n", name); #endif /* Check that the name is a valid one */ if (EthernetMatch(name, arg) != 0) return -1; #ifdef COMPILING_ON_WINDOWS wVersionRequested = MAKEWORD(1, 1); if (WSAStartup(wVersionRequested, &wsaData) != 0) /* * Couldn't find a useable winsock.dll. */ return -1; if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 ) { WSACleanup(); /* * Couldn't find a winsock.dll with supported version. */ return -1; } #endif memset((char *)ia, 0, sizeof(*ia)); if (set_address(etheraddr, ia) < 0) { #ifdef COMPILING_ON_WINDOWS /* * SJ - I'm not sure that this is the correct way to handle this * as Fail calls remote_disable and exits, while panic just exits. * However at the time of writing remote_disable does nothing! */ /* Panic("EthernetOpen: bad name `%s'\n", etheraddr); */ #else Fail("EthernetOpen: bad name `%s'\n", etheraddr); #endif return -1; } if ((sock = open_socket()) < 0) return -1; /* * fetch the port numbers assigned by the remote target * to its Debug and Application sockets */ fetch_ports(); return 0; }