void main(void) { Sys_Init(); //All init function putchar(' '); XBR0_Init(); ADC_Init(); Port_Init(); PCA_Init(); SMB_Init(); //end the init function lcd_clear(); lcd_print("initializing\r\n"); printf("\n\n\n\rinitalizing"); PCA0CP2 = 0xFFFF - MOTOR_NEUT;//set all to neutural PCA0CPL0 = 0xFFFF - PW_CENTER; PCA0CPH0 = (0xFFFF - PW_CENTER) >> 8; pause(); //pause for a second? start_run(); while (1) { while(SS){ // if the slideswitch is off slide_switch_off(); }///end slide switch off while(!SS){ //while the slideswitch is on Heading(); Ranger(); LCD_Print(); //print all values on the lcd printf("\n\rRange:%d Compass:%d dh: %d, mPW: %d, sPW %d, batt:%d, obst: %d", range, heading, desired_heading, MOTOR_PW_AND_STEER_PW, STEER_PW, battery, near_obstical); //print these on the secure crt for data aquisition //printf("\n\r Range:%d Compass:%d dh: %d, mPW: %d, sPW %d, obst: %d", range, heading, desired_heading, MOTOR_PW_AND_STEER_PW, STEER_PW, near_obstical); //print these on the secure crt for data aquisition }//end slide switch on } //end of the infinite while loop }//end of the main function
void thread_run(thread_routine r,void *arg) { struct thread_arg *_thread_arg = malloc(sizeof(*_thread_arg)); _thread_arg->custom_routine = r; _thread_arg->custom_arg = arg; _thread_arg->_thread = create_thread(0);//not joinable start_run(_thread_arg->_thread,routine,_thread_arg); }
void main(void) { Sys_Init(); //All init function putchar(' '); XBR0_Init(); ADC_Init(); Port_Init(); PCA_Init(); SMB_Init(); //end the init function lcd_clear(); lcd_print("initializing\r\n"); PCA0CP2 = 0xFFFF - MOTOR_NEUT; PCA0CPL0 = 0xFFFF - PW_CENTER; PCA0CPH0 = (0xFFFF - PW_CENTER) >> 8; while (n_Counts < 50); //pause for a second? start_run(); while (1) { while(SS){ // if the slideswitch is off slide_switch_off(); }///end slide switch off while(!SS) //while the slideswitch is on { Heading(); Ranger(); LCD_Print(); //print all values on the lcd printf("\n\r Range:%d Compass:%d PW:%d", range, heading, PW); //print these on the secure crt for data aquisition } } //end of the infinite while loop }//end of the main function
int main(int argc, char **argv) { parse_args(argc, argv); float res = price(n); printf("Price is: %f\n", res); for (int i = 0; i < runs; i++) { start_run(); res = price(n); end_run(); printf("Price is: %f\n", res); } }
module_communicate(uint32_t apbuffersize, uint32_t aieverymaxsize, FUN_READ_CALLBACK aireadfun,/* FUN_WRITE_CALLBACK aiwritefun,*/ bool apstartthread) : m_buffer_size(apbuffersize), m_every_once_max_size(aieverymaxsize), m_readfun(aireadfun), m_startthread(apstartthread) { m_la_handle = new_loop_array( m_buffer_size, m_every_once_max_size, aireadfun, boost::bind(&module_communicate::send_run, this, _1, _2) ); start_run(m_la_handle, m_startthread); }
int main(int argc, char **argv) { coreid_t *cores; int core_count; int c_idx; uint8_t memory; int payloadsz = 64; int nocache = 0; int read_incoming = 0; int head_idx_wb = 1; errval_t err; sleep_init(); // Connect to SKB to get info err = skb_client_connect(); assert(err_is_ok(err)); // Get information about available cores get_cores_skb(&cores, &core_count); printf("Net latency benchmark start\n"); printf("%%\"core\",\"memory\",\"payload\",\"nocache\",\"touch\",\"hiwb\"," "\"rtt\",\"time\"\n"); for (c_idx = 0; c_idx < core_count; c_idx++) { for (memory = 0; memory < 16; memory += 4) { for (payloadsz = 64; payloadsz < 1500; payloadsz *= 4) { for (nocache = 0; nocache <= 1; nocache++) { for (read_incoming = 0; read_incoming <= 1; read_incoming++) { for (head_idx_wb = 0; head_idx_wb <= 1; head_idx_wb++) { start_run(cores[c_idx], memory, payloadsz, nocache, read_incoming, head_idx_wb); } } } } } } printf("Net latency benchmark done\n"); return 0; }
int main(void) { start_run(); return 0; }
int main(int argc, char *argv[]) { int master_fd, op, status; pid_t pid, run_pid; sv cmd; fd_set readfds; struct timeval tout; if (argc != 2) errx(1, "Need socket directory argument"); master_fd = hookup(argv[1]); initscr(); signal(SIGWINCH, sig_winch); nonl(); cbreak(); noecho(); for ( ; ; ) { update_display(); FD_ZERO(&readfds); FD_SET(master_fd, &readfds); gettimeofday(&tout, NULL); tout.tv_sec = 0; tout.tv_usec = 1050000-tout.tv_usec; if (select(master_fd+1, &readfds, NULL, NULL, &tout) < 0) { if (errno == EINTR) continue; err(4, "select"); } if (!FD_ISSET(master_fd, &readfds)) continue; readn(master_fd, &op, sizeof (int)); if (op == TOP_OP_EXIT) break; switch (op) { case TOP_OP_FETCH: read_sv(master_fd, &cmd); init_run(&cmd); break; case TOP_OP_ISSUE: readn(master_fd, &pid, sizeof (pid_t)); readn(master_fd, &run_pid, sizeof (pid_t)); start_run(pid, run_pid); break; case TOP_OP_DONE: readn(master_fd, &run_pid, sizeof (pid_t)); end_run(run_pid, 0); break; case TOP_OP_ATTN: readn(master_fd, &run_pid, sizeof (pid_t)); readn(master_fd, &status, sizeof (pid_t)); end_run(run_pid, status); break; case TOP_OP_ONLINE: sc++; break; case TOP_OP_OFFLINE: sc--; break; default: errx(5, "Unknown opcode %d", op); } } endwin(); return 0; }