int main(int argc, char* argv[]) { #ifdef SW init_pipe_handler_with_log("pipelog.txt"); PTHREAD_DECL(maxDaemon); // declare the Daemon thread. PTHREAD_CREATE(maxDaemon); // start the Daemon.. #endif while(1) { uint32_t a, b; scanf("%d", &a); scanf("%d", &b); write_uint32("in_data",a); write_uint32("in_data",b); uint32_t c = read_uint32("out_data"); fprintf(stdout,"Result = %d.\n", c); if(a == 0) break; } #ifdef SW close_pipe_handler(); PTHREAD_CANCEL(maxDaemon); #endif return(0); }
int main(int argc, char* argv[]) { uint32_t result[ORDER]; signal(SIGINT, Exit); signal(SIGTERM, Exit); #ifdef SW init_pipe_handler_with_log("pipeHandler.log"); _start_daemons(stderr); #endif PTHREAD_DECL_AND_CREATE(Sender); read_uint32_n("out_data",result,ORDER); uint32_t idx; for(idx = 0; idx < ORDER; idx++) { fprintf(stdout,"Result = %u, expected = %u.\n", result[idx],idx+1); } PTHREAD_CANCEL(Sender); #ifdef SW close_pipe_handler(); _stop_daemons(); #endif return(0); }
int main(int argc, char* argv[]) { #ifdef SW init_pipe_handler_with_log("pipelog.txt"); PTHREAD_DECL(vector_control_daemon); // declare the Daemon thread. PTHREAD_CREATE(vector_control_daemon); // start the Daemon.. #endif double *iq, *iq_prev, *id, *id_prev, *flq, *flq_prev, *fld, *fld_prev, *spd, *spd_prev, vd, vq, torque, load_torque, *time = 0; double speed_ref int i=0; int no_of_cycles = 4000 ; // 100u/25n (Ideal time necessary for conputation for FPGA/Motor_iteration_step) while(1) { for(i = 0; i< no_of_cycles; i++){ im_zep(&iq,&iq_prev,&id,&id_prev,&flq,&flq_prev,&fld,&fld_prev,&spd_prev,vd,vq,&torque,load_torque,&time) } write_float32("in_data",*id); write_float32("in_data",*iq); write_float32("in_data",speed_ref); vd = read_float32("out_data"); vq = read_float32("out_data"); } #ifdef SW close_pipe_handler(); PTHREAD_CANCEL(vector_control_daemon); #endif return(0); }
void init_pipe_handler() { init_pipe_handler_with_log(NULL); }