int man_platform_config(man_platform_t *_platform, string config_file) { mdebug("platform=0x%x, config_file=%s\n",platform,config_file); if (!_platform) { return -1; } rtdal_machine(&machine); platform = _platform; platform->nof_nodes = 1; platform->nof_processors = machine.nof_cores; platform->ts_length_us = machine.ts_len_ns/1000; platform->core0_relative = machine.core0_relative; if (machine.scheduling == SCHEDULING_BESTEFFORT) { platform->nof_processors = 1; platform->ts_length_us = 1; } for (int i=0;i<platform->nof_processors;i++) { platform->nodes[0].processors[i].node = &platform->nodes[0]; platform->processors[i] = &platform->nodes[0].processors[i]; platform->nodes[0].processors[i].idx_in_node = i; } platform->nodes[0].id = 0; platform->nodes[0].platform = platform; return 0; }
/** * Returns the duration of the time slot in microseconds. */ int oesr_tslot_length(void *context) { rtdal_machine_t machine; rtdal_machine(&machine); return machine.ts_len_us; }
void *_run_main(void *arg) { int c; int tslen; int mode; rtdal_machine(&machine); tslen = machine.ts_len_ns/1000; /* this would be done by the node */ if (nod_anode_initialize(&machine,2)) { aerror("initializing node\n"); return NULL; } /* from here, this is the oesr_man interface only */ if (oesr_man_initialize(NULL,2)) { aerror("initializing oesr_man\n"); return NULL; } memset(&waveform,0,sizeof(waveform_t)); c=0; printf("\n\nList of commands:\n" "\t<l>\tLoad waveform\n" "\t<i>\tSet INIT\n" "\t<r>\tSet RUN\n" "\t<p>\tSet PAUSE\n" "\t<t>\tSet STEP\n" "\t<s>\tStop waveform\n" "\t<m>\tSet waveform mode\n" "\t<e>\tView execution time\n" "\n<Ctr+C>\tExit\n"); waveform_status_t new_status; do { if (c != '\n') { printf("\n>> "); fflush(0); } c = getchar(); new_status.cur_status = LOADED; switch((char) c) { case 'm': getchar(); print_modes(&waveform); printf("\nEnter waveform mode (index): "); if (scanf("%d",&mode) == -1) { aerror("reading input\n"); break; } printf("\nSwitching to '%s'...\n",waveform.modes[mode].desc); if (waveform_mode_set(&waveform,waveform.modes[mode].name)) { aerror("setting waveform mode\n"); break; } break; case 'l': waveform_delete(&waveform); strcpy(waveform.model_file,arg); strcpy(waveform.name,arg); if (waveform_parse(&waveform,1)) { aerror("parsing waveform\n"); return NULL; } if (waveform_load(&waveform)) { aerror("loading waveform\n"); break; } fflush(stdout); printf("OK!\n"); break; case 'i': new_status.cur_status=INIT; break; case 'r': new_status.cur_status=RUN; break; case 'p': new_status.cur_status=PAUSE; break; case 't': new_status.cur_status=STEP; break; case 's': new_status.cur_status=STOP; break; case 'e': if (waveform_update(&waveform)) { aerror("updating waveform\n"); break; } if (print_execinfo(&waveform,tslen)) { aerror("printing execinfo\n"); break; } break; case '\n': break; default: printf("Unknown command %c\n",(char) c); break; } if (new_status.cur_status != LOADED) { new_status.next_timeslot = rtdal_time_slot(); if (waveform_status_set(&waveform,&new_status)) { printf("DID NOT CHANGE!\n"); } else { printf("OK!\n"); } } } while(1); /* status init */ /* pause o sleep o return */ printf("exit\n"); return NULL; }