void exec_init() { // initialize all sub-systems hl_init(); schd_init(); lcd_init(); cam_init(); adc_init(); serv_init(); cont_init(); ui_init(); mot_init(); //comms_init(); // disable interrupt disable_irq(EXEC_PIT_IRQ_NUM); // enable the clock to the PIT module (pg. 299) SIM_SCGC6 |= SIM_SCGC6_PIT_MASK; // enable clock for PIT timers and allow timers to continue to // run in debug mode (pg. 1038) PIT_MCR = 0x0; exec_disablePit(); exec_sysMode = EXEC_MODE_IDLE; lcd_update(); exec_update(); }
static rb_context_t * cont_new(VALUE klass) { rb_context_t *cont; volatile VALUE contval; contval = Data_Make_Struct(klass, rb_context_t, cont_mark, cont_free, cont); cont->self = contval; cont_init(cont); return cont; }
static rb_context_t * cont_new(VALUE klass) { rb_context_t *cont; volatile VALUE contval; rb_thread_t *th = GET_THREAD(); THREAD_MUST_BE_RUNNING(th); contval = TypedData_Make_Struct(klass, rb_context_t, &cont_data_type, cont); cont->self = contval; cont_init(cont, th); return cont; }
void arduino_init(void) { uart_div_modify(0, UART_CLK_FREQ / (115200)); init(); //disable uart0 debug, init wiring system: pins, timer1 initVariant(); cont_init(&g_cont); system_os_task(loop_task, LOOP_TASK_PRIORITY, g_loop_queue, LOOP_QUEUE_SIZE); system_init_done_cb(&init_done); }
static rb_fiber_t* fiber_t_alloc(VALUE fibval) { rb_fiber_t *fib = ALLOC(rb_fiber_t); memset(fib, 0, sizeof(rb_fiber_t)); fib->cont.self = fibval; fib->cont.type = FIBER_CONTEXT; cont_init(&fib->cont); fib->prev = Qnil; fib->status = CREATED; DATA_PTR(fibval) = fib; return fib; }
extern "C" void user_init(void) { struct rst_info *rtc_info_ptr = system_get_rst_info(); memcpy((void *) &resetInfo, (void *) rtc_info_ptr, sizeof(resetInfo)); uart_div_modify(0, UART_CLK_FREQ / (115200)); init(); initVariant(); cont_init(&g_cont); system_os_task(loop_task, LOOP_TASK_PRIORITY, g_loop_queue, LOOP_QUEUE_SIZE); system_init_done_cb(&init_done); }
void user_init(void) { if(!setup_done) { setup(); setup_done = true; } cont_init(&g_cont); system_os_task(loop_task, LOOP_TASK_PRIORITY, g_loop_queue, LOOP_QUEUE_SIZE); printf("loop_task installed\n"); system_init_done_cb(&init_done); }
/** * Initialize the templ theme * @param hue [0..360] hue value from HSV color space to define the theme's base color * @param font pointer to a font (NULL to use the default) * @return pointer to the initialized theme */ lv_theme_t * lv_theme_templ_init(uint16_t hue, lv_font_t *font) { if(font == NULL) font = LV_FONT_DEFAULT; _hue = hue; _font = font; /*For backward compatibility initialize all theme elements with a default style */ uint16_t i; lv_style_t **style_p = (lv_style_t**) &theme; for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) { *style_p = &def; style_p++; } basic_init(); cont_init(); btn_init(); label_init(); img_init(); line_init(); led_init(); bar_init(); slider_init(); sw_init(); lmeter_init(); gauge_init(); chart_init(); cb_init(); btnm_init(); kb_init(); mbox_init(); page_init(); ta_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); win_init(); return &theme; }
int init() { int i,j,k; /****************************************************** * Variables assignments (ALL INITIAL VALUES) * ****************************************************/ p_mynum = &mynum; p_mu = μ /*********************** * Menu prompts * *********************/ main_prompt = ""; numerics_prompt = "numerics"; graphics_prompt = "graphics"; cross_prompt = "cross"; periodics_prompt = "periodics"; file_prompt = "file"; cont_prompt = "continue"; rand_prompt = "random"; errors_prompt = "errors"; sing_prompt = "singularity"; traj_prompt = "trajectory"; /* *********************** */ /* Submenu prompts */ /* *********************** */ /* Histogram submenu of periodics menu */ periodics_hist_prompt = (char *)malloc((strlen(periodics_prompt) + \ strlen("/histogram")+2)*sizeof(char)); periodics_hist_prompt = strcpy(periodics_hist_prompt,periodics_prompt); periodics_hist_prompt = strcat(periodics_hist_prompt,"/histogram"); gnuplot_prompt = "gnuplot('q' to exit)"; /* End of histogram submenu */ /* Menu buffers */ /* History buffers */ buf_hist = (char ***)malloc(MAX_N_HIST_ENT*sizeof(char **)); for(i=0;i<MAX_N_HIST_ENT;i++){ buf_hist[i] = (char **)malloc(MAX_N_ARG*sizeof(char *)); for(j=0;j<MAX_N_ARG;j++) buf_hist[i][j] = (char *)calloc(MAX_ARG_LEN,sizeof(char)); } /* Commands and their arguments. See read_menu(...) function. */ cmd = (char **)malloc(MAX_N_ARG*sizeof(char *)); for(i=0;i<MAX_N_ARG;i++)/* We allocate memory for all possible arguments */ cmd[i] = (char *)calloc(MAX_ARG_LEN,sizeof(char)); /*Loading constants and parameters from the file --- conf_name. */ if(strlen(conf_name) != 0) if((read_conf(conf_name)) == -1)/*read_config is the binary conf file~(.bcf)*/ fprintf(stdout,"Config file: could not open the file.\n"); /*************************************/ /*Converting new style entities to old one for compatibility*/ if((fmod((double)DIM,(double)LDIM))>0.5){ /*If reminder of DIM/LDIM == 1 or more than it is wrongly defined system.*/ /*DIM comes from number of ODEs. LDIM is specified by the user in #system directive of ode file.*/ /*Error in ODE system specification*/ fprintf(stderr,"Fatal: not symmetric ODE system\n"); return 151; } /*New style -> old style converter*/ mynum.total_dim = LDIM; mynum.local_dim = (int)DIM/LDIM; mynum.num_par = PARDIM; if((strlen(method) >= METH_NAME_LEN) || (strlen(method2) >= METH_NAME_LEN)){ fprintf(stderr,"Error: method has a very long name.\n"); fprintf(stderr,"Max allowed length is %d.\n",METH_NAME_LEN-1); return 143; } strncpy(mynum.method,method,(size_t)strlen(method)); strncpy(mynum.method2,method2,(size_t)strlen(method2)); /******************************************** Initializing values *********************************************/ mynum.global_buffer = BUFFER;/*Reading default*/ xs = (double **)calloc(BUFFER,sizeof(double *)); for(i=0;i<BUFFER;i++){ xs[i] = (double *)calloc(DIM,sizeof(double)); } ts = (double *)calloc(BUFFER,sizeof(double)); //ampl = (double *)calloc(DIM,sizeof(double)); //max_x = (double *)calloc(DIM,sizeof(double)); //min_x = (double *)calloc(DIM,sizeof(double)); x_cross = (double *)calloc(DIM,sizeof(double)); /* Vars */ y = (long int *)malloc(DIM*sizeof(long int)); x = (double *)malloc(DIM*sizeof(double)); f = (double *)malloc(DIM*sizeof(double)); for(i=0;i<DIM;i++){ x[i] = xin[i]; y[i] = yin[i]; } ksi = (double *)malloc(DIM*sizeof(double));/*Noise is zero*/ /* Propensities */ pr = (double *)malloc(NREAC*sizeof(double)); /* Auxillaries */ a = (double *)malloc(AUXNUM*sizeof(double)); /************************************************************/ /*RANDOM number parameters initialization...*/ random_init(); /*CONTINUATION parameters intitialization...*/ cont_init(); /*ROOT FINDING parameters initialization...*/ multiroot_init(); /*Lyapunov parameters initialization...*/ lyap_init(); /* Graphics init */ init_graph(); /* periods histogram init */ thist_init(); /* T-system init */ traj_init(); //****************************************************** // Loading init. conditions from the file -- init_name. if(strlen(init_name) != 0){ FILE *init; init = fopen(init_name,"r"); if(init == NULL){ fprintf(stdout,"Cannot open file with initial conditions.\n");} else{ j = 1; while(j<=DIM) { fscanf(init,"%lf",&x[j-1]); y[j-1] = (long int)x[j-1];/*discrete*/ j += 1; } fprintf(stdout,"Initial points\n"); j = 1; while(j<=DIM){ xin[j-1] = x[j-1]; yin[j-1] = y[j-1]; fprintf(stdout,"%lf\n",xin[j-1]); j += 1; } fclose(init); } } return 0; }