int main(int argc, char** argv) { char* service_name = "IntelAccelerator"; int client_type = 4; io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(service_name)); if (service == MACH_PORT_NULL) { printf("can't find service\n"); return 0; } IOServiceOpen(service, mach_task_self(), client_type, &conn); if (conn == MACH_PORT_NULL) { printf("can't connect to service\n"); return 0; } pthread_t t; io_connect_t arg = conn; pthread_create(&t, NULL, (void*) go, (void*) &arg); usleep(100000); start = 1; close_it(conn); pthread_join(t, NULL); return 0; }
int main(int argc, char** argv) { char* service_name = "AppleOscarGyro"; int client_type = 0; io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(service_name)); if (service == MACH_PORT_NULL) { printf("can't find service\n"); return 0; } IOServiceOpen(service, mach_task_self(), client_type, &conn); if (conn == MACH_PORT_NULL) { printf("can't connect to service\n"); return 0; } OSSpinLockLock(&lock); pthread_t t; io_connect_t arg = conn; pthread_create(&t, NULL, (void*) go, (void*) &arg); usleep(100000); OSSpinLockUnlock(&lock); close_it(conn); pthread_join(t, NULL); return 0; }
void go(void* arg){ while(start == 0){;} usleep(1); close_it(*(io_connect_t*)arg); }
void go(void* arg) { int got_it = 0; while (!got_it) { got_it = OSSpinLockTry(&lock); } close_it(*(io_connect_t*)arg); }
rtems_task Init( rtems_task_argument argument ) { TEST_BEGIN(); pppasyncattach(); open_it(); set_wakeups(); set_discipline(); write_it(); ioctl_it(); read_it(); close_it(); TEST_END(); rtems_test_exit(0); }
rtems_task Init( rtems_task_argument ignored ) { bool more_data; printf( "\n\n*** %s TEST ***\n", Mouse_Type_Long ); open_it(); register_it(); do { more_data = enqueue_next_action( Mouse_Actions, Mouse_Actions_Size, Mouse_Actions_Per_Iteration ); receive_uid_message(); } while (more_data); close_it(); printf( "*** END OF %s TEST ***\n", Mouse_Type_Long ); rtems_test_exit( 0 ); }