void spi2serial_main(void) { uint8_t status; /* TODO load listening address from flash. */ uint8_t thisAddr[5]= {97, 83, 22, 222, 121}; init_stdio_USART2(); init_delay(); SPI2_Init(); delay_ms(10); nrf24l01Init(); delay_ms(100); status = nRF24_Check(); if (status == 1) { for (;;); } nrfSetRxMode(92, 5, thisAddr); init_node_link(); for (;;) { status = SPI2Serial_Loop(); if (status) { nrfSetRxMode(92, 5, thisAddr); } } }
dwg :: dwg(float z, int del1, int del2, int commute, dwgs *parent) { this->parent = parent; if(del1>1) init_delay(&(d[0]), del1-1); if(del2>1) init_delay(&(d[1]), del2-1); this->del1 = del1; this->del2 = del2; nl = 0; nr = 0; l = new dwg_node(z); r = new dwg_node(z); this->commute = commute; }
void node_main(void) { uint8_t status; /* TODO load listening address from flash. */ uint8_t thisAddr[5]= {97, 89, 64, 222, 121}; init_stdio_USART2(); init_delay(); SPI2_Init(); delay_ms(10); nrf24l01Init(); delay_ms(100); status = nRF24_Check(); if (status == 1) { for (;;); } printf("nRF check OK!\n"); nrfSetRxMode(92, 5, thisAddr); init_node_link(); printf("init_node_link OK!\n"); nRF_Task_Init(); /* From now on, controls and sensors can be initialized. */ init_switches(); printf("init_switches OK!\n"); for (;;) { nRF_Task_Loop(); delay_ms(1); } }
int main() { init_uart(); //配置systick中断延时 Delay_ms() init_delay(); //SysTick_Configuration(); /*configuration rtc*/ rtc_time_init(); /*configuration alarm time*/ rtc_alarm_config();//必须在rtc初始化之后 //get current time while(1){ delay_ms(500); delay_ms(500); get_rtc_time(); //get_alarm_time(); } }
PERF_RT_Private * PERF_RT_create(PERF_Private *perf, PERF_Config *config, PERF_MODULETYPE eModule) { char *fOutFile = NULL; FILE *fOut = NULL; /* check if we support this component */ if (perf->ulID != PERF_FOURS("CAM_") && perf->ulID != PERF_FOURS("CAMT") && perf->ulID != PERF_FOURS("VP__") && perf->ulID != PERF_FOURS("VP_T") && perf->ulID != PERF_FOURS("VD__") && perf->ulID != PERF_FOURS("VD_T") && perf->ulID != PERF_FOURS("VE__") && perf->ulID != PERF_FOURS("VE_T")) { /* if we don't support this component, we don't create the real-time interface */ return (NULL); } PERF_RT_Private *me = perf->cip.pRT = malloc(sizeof(PERF_RT_Private)); if (me) { int succeed = 1; /* we track steady state on the component thread only */ me->needSteadyState = (perf->ulID & 0xff) == 'T'; me->steadyState = 0; /* allocate rate tracking structures */ me->maxDRate = MAX_RATES_TRACKED; me->dRate = malloc(sizeof(PERF_RTdata_rate) * me->maxDRate); succeed = succeed && me->dRate; me->decoder = (perf->ulID == PERF_FOURS("VD__") || perf->ulID == PERF_FOURS("VD_T")); me->encoder = (perf->ulID == PERF_FOURS("VE__") || perf->ulID == PERF_FOURS("VE_T")); me->nDRate = 0; /* allocate shot-to-shot tracking structures */ if (succeed && perf->ulID == PERF_FOURS("CAMT")) { me->dSTS = malloc(sizeof(PERF_RTdata_sts)); succeed = succeed && me->dSTS; if (me->dSTS) { init_delay(&me->dSTS->dBurst, -1); /* no first timestamp yet */ init_delay(&me->dSTS->dABurst, 0); init_delay(&me->dSTS->dBurst2, 0); init_delay(&me->dSTS->dABurst2, 0); init_delay(&me->dSTS->dSingle, -1); /* no first timestamp yet */ me->dSTS->size_max = me->dSTS->size_min = me->dSTS->capturing = 0; } } else { me->dSTS = NULL; } /* allocate uptime tracking structures */ /* :NOTE: for now we restrict creations of uptime to steady state only */ if (succeed && !uptime_started && me->needSteadyState && !(perf->uMode & PERF_Mode_Replay)) { me->dUptime = malloc(sizeof(PERF_RTdata_uptime)); succeed = succeed && me->dUptime; if (succeed) { uptime_started = 1; me->dUptime->measuring = 0; me->dUptime->last_idletime = me->dUptime->last_uptime = 0; me->dUptime->start_idletime = me->dUptime->start_uptime = 0; me->dUptime->success = 1; me->dUptime->xx = me->dUptime->x = me->dUptime->n = 0; TIME_GET(me->dUptime->last_reporting); } } else { me->dUptime = NULL; } /* configuration */ me->summary = config->rt_summary != 0; me->debug = config->rt_debug & 0x1FF; me->detailed = (config->rt_detailed > 2) ? 2 : (int) config->rt_detailed; me->granularity = (config->rt_granularity < 1) ? 1 : (config->rt_granularity > MAX_GRANULARITY) ? MAX_GRANULARITY : (long) config->rt_granularity; me->granularity *= 1000000; /* convert to microsecs */ TIME_COPY(me->first_time, perf->time); /* if we do not care about detailed statistics, only report significant statistics for each component */ if (succeed && !me->detailed) { /* VP_T - display rate */ if (perf->ulID == PERF_FOURS("VP_T")) { me->only_moduleandflags = PERF_FlagSending | PERF_FlagFrame | PERF_ModuleHardware; } /* VD_T - decode rate */ else if (perf->ulID == PERF_FOURS("VD_T")) { me->only_moduleandflags = PERF_FlagSending | PERF_FlagFrame | PERF_ModuleLLMM; } /* VE_T - encode rate */ else if (perf->ulID == PERF_FOURS("VE_T")) { me->only_moduleandflags = PERF_FlagSending | PERF_FlagFrame | PERF_ModuleLLMM; } /* CAMT - capture rate */ else if (perf->ulID == PERF_FOURS("CAMT")) { me->only_moduleandflags = PERF_FlagReceived | PERF_FlagFrame | PERF_ModuleHardware; } /* otherwise, we don't care about rates */ else { free(me->dRate); me->dRate = NULL; me->maxDRate = 0; } } /* set up fRt file pointers */ if (config->rt_file && succeed) { /* open log file unless STDOUT or STDERR is specified */ if (!strcasecmp(config->rt_file, "STDOUT")) fOut = stdout; else if (!strcasecmp(config->rt_file, "STDERR")) fOut = stderr; else { /* expand file name with PID and name */ fOutFile = (char *) malloc (strlen(config->rt_file) + 32); if (fOutFile) { sprintf(fOutFile, "%s-%05lu-%08lx-%c%c%c%c.log", config->rt_file, perf->ulPID, (unsigned long) perf, PERF_FOUR_CHARS(perf->ulID)); fOut = fopen(fOutFile, "at"); /* free new file name */ free(fOutFile); fOutFile = NULL; } /* if could not open output, set it to STDOUT */ if (!fOut) fOut = stderr; } me->fRt = fOut; } /* if we had allocation failures, free resources and return NULL */ if (succeed) { perf->uMode |= PERF_Mode_RealTime; } else { PERF_RT_done(perf); me = NULL; } } return(me); }
int main(int ac, char *av[]) { int errorn; long total_output_spks; double input_traject_vars[NUM_JOINTS*3]; // Desired trajectory position, velocity and acceletarion double robot_state_vars[NUM_JOINTS*3]; // Actual robot position, velocity and acceleration double cerebellar_output_vars[NUM_OUTPUT_VARS]={0.0}; // Corrective cerebellar output torque double robot_inv_dyn_torque[NUM_JOINTS]; // Robot's inverse dynamics torque double total_torque[NUM_JOINTS]; // Total torque applied to the robot double *delayed_error_vars; double robot_error_vars[NUM_JOINTS]; // Joint error (PD correction) double cerebellar_learning_vars[NUM_OUTPUT_VARS]; // Error-related learning signals // Robot's dynamics variables mxArray *robot_inv_dyn_object=NULL, *robot_dir_dyn_object=NULL; struct integrator_buffers num_integration_buffers; // Integration buffers used to simulate the robot Simulation *neural_sim; int n_robot_joints; // Time variables double sim_time,cur_traject_time; float slot_elapsed_time,sim_elapsed_time; int n_traj_exec; // Delay line struct delay error_delay; // Variable for logging the simulation state variables struct log var_log; #if defined(REAL_TIME_WINNT) // Variables for consumed-CPU-time measurement LARGE_INTEGER startt,endt,freq; #elif defined(REAL_TIME_OSX) uint64_t startt, endt, elapsed; static mach_timebase_info_data_t freq; #elif defined(REAL_TIME_LINUX) // Calculate time taken by a request - Link with real-time library -lrt struct timespec startt, endt, freq; #endif #if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64)) // _CrtMemState state0; _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); #endif #if defined(REAL_TIME_WINNT) if(!QueryPerformanceFrequency(&freq)) puts("QueryPerformanceFrequency failed"); #elif defined (REAL_TIME_LINUX) if(clock_getres(CLOCK_REALTIME, &freq)) puts("clock_getres failed"); #elif defined (REAL_TIME_OSX) // If this is the first time we've run, get the timebase. // We can use denom == 0 to indicate that sTimebaseInfo is // uninitialised because it makes no sense to have a zero // denominator is a fraction. if (freq.denom == 0 ) { (void) mach_timebase_info(&freq); } #endif // Load Matlab robot objects from Matlab files if(!(errorn=load_robot(ROBOT_VAR_FILE_NAME,ROBOT_BASE_VAR_NAME,&n_robot_joints,&robot_inv_dyn_object)) && \ !(errorn=load_robot(ROBOT_VAR_FILE_NAME,ROBOT_SIMUL_VAR_NAME,NULL,&robot_dir_dyn_object))) { if(!(errorn=allocate_integration_buffers(&num_integration_buffers,n_robot_joints))) // Initialize the buffers for numerical integration using the initial desired robot's state { // Initialize variable log if(!(errorn=create_log(&var_log, MAX_TRAJ_EXECUTIONS, TRAJECTORY_TIME))) { // Initialize EDLUT and load neural network files neural_sim=create_neural_simulation(NET_FILE, INPUT_WEIGHT_FILE, INPUT_ACTIVITY_FILE, OUTPUT_WEIGHT_FILE, OUTPUT_ACTIVITY_FILE, WEIGHT_SAVE_PERIOD, REAL_TIME_NEURAL_SIM); if(neural_sim) { double min_traj_amplitude[3], max_traj_amplitude[3]; // Position, velocity and acceleration calculate_input_trajectory_max_amplitude(TRAJECTORY_TIME,TRAJ_POS_AMP, min_traj_amplitude, max_traj_amplitude); // Calcula the maximum and minimum values of the desired trajectory total_output_spks=0L; puts("Simulating..."); sim_elapsed_time=0.0; errorn=0; // _CrtMemCheckpoint(&state0); for(n_traj_exec=0;n_traj_exec<MAX_TRAJ_EXECUTIONS && !errorn;n_traj_exec++) { calculate_input_trajectory(robot_state_vars, TRAJ_POS_AMP, 0.0); // Initialize simulated robot's actual state from the desired state (input trajectory) (position, velocity and acceleration) initialize_integration_buffers(robot_state_vars,&num_integration_buffers,n_robot_joints); // For the robot's direct reset_neural_simulation(neural_sim); // after each trajectory execution the network simulation state must be reset (pending activity events are discarded) init_delay(&error_delay, ERROR_DELAY_TIME); // Clear the delay line cur_traject_time=0.0; do { int n_joint; #if defined(REAL_TIME_WINNT) QueryPerformanceCounter(&startt); #elif defined(REAL_TIME_LINUX) clock_gettime(CLOCK_REALTIME, &startt); #elif defined(REAL_TIME_OSX) startt = mach_absolute_time(); #endif // control loop iteration starts sim_time=(double)n_traj_exec*TRAJECTORY_TIME + cur_traject_time; // Calculate absolute simulation time calculate_input_trajectory(input_traject_vars, TRAJ_POS_AMP, cur_traject_time); // Calculate desired input trajectory //ECEA generate_input_traj_activity(neural_sim, sim_time, input_traject_vars, min_traj_amplitude, max_traj_amplitude); // Translates desired trajectory (position and velocity) into spikes generate_robot_state_activity(neural_sim, sim_time, input_traject_vars, min_traj_amplitude, max_traj_amplitude); // Translates desired trajectory into spikes again to improve the input codification (using the robot's state input neurons) //ICEA // generate_robot_state_activity(neural_sim, sim_time, robot_state_vars, min_traj_amplitude, max_traj_amplitude); // Translates robot's current state (position and velocity) into spikes compute_robot_inv_dynamics(robot_inv_dyn_object,input_traject_vars,ROBOT_EXTERNAL_FORCE,ROBOT_GRAVITY,robot_inv_dyn_torque); // Calculate crude inverse dynamics of the base robot. They constitude the base robot's input torque for(n_joint=0;n_joint<NUM_JOINTS;n_joint++) // Calculate total torque from forward controller (cerebellum) torque plus base controller torque total_torque[n_joint]=robot_inv_dyn_torque[n_joint]+cerebellar_output_vars[n_joint*2]-cerebellar_output_vars[n_joint*2+1]; compute_robot_dir_dynamics(robot_dir_dyn_object,robot_state_vars,total_torque,robot_state_vars,&num_integration_buffers,ROBOT_EXTERNAL_FORCE,ROBOT_GRAVITY,SIM_SLOT_LENGTH); // Simulate the robot (direct dynamics). calculate_error_signals(input_traject_vars, robot_state_vars, robot_error_vars); // Calculated robot's performed error //delayed_error_vars=delay_line(&error_delay,robot_error_vars); // Delay in the error bars delayed_error_vars=robot_error_vars; // No delay in the error bars calculate_learning_signals(delayed_error_vars, cerebellar_output_vars, cerebellar_learning_vars); // Calculate learning signal from the calculated error generate_learning_activity(neural_sim, sim_time, cerebellar_learning_vars); // Translates the learning activity into spikes and injects this activity in the network errorn=run_neural_simulation_slot(neural_sim, sim_time+SIM_SLOT_LENGTH); // Simulation the neural network during a time slot total_output_spks+=(long)compute_output_activity(neural_sim, cerebellar_output_vars); // Translates cerebellum output activity into analog output variables (corrective torques) // control loop iteration ends #if defined(REAL_TIME_WINNT) QueryPerformanceCounter(&endt); // measures time slot_elapsed_time=(endt.QuadPart-startt.QuadPart)/(float)freq.QuadPart; // to be logged #elif defined(REAL_TIME_LINUX) clock_gettime(CLOCK_REALTIME, &endt); // Calculate time it took slot_elapsed_time = (endt.tv_sec-startt.tv_sec ) + (endt.tv_nsec-endt.tv_nsec )/((float)(1e9)); #elif defined(REAL_TIME_OSX) // Stop the clock. endt = mach_absolute_time(); // Calculate the duration. elapsed = endt - startt; slot_elapsed_time = 1e-9 * elapsed * freq.numer / freq.denom; #endif sim_elapsed_time+=slot_elapsed_time; log_vars(&var_log, sim_time, input_traject_vars, robot_state_vars, robot_inv_dyn_torque, cerebellar_output_vars, cerebellar_learning_vars, delayed_error_vars, slot_elapsed_time,get_neural_simulation_spike_counter(neural_sim)); // Store vars into RAM cur_traject_time+=SIM_SLOT_LENGTH; } while(cur_traject_time<TRAJECTORY_TIME-(SIM_SLOT_LENGTH/2.0) && !errorn); // we add -(SIM_SLOT_LENGTH/2.0) because of floating-point-type codification problems } // reset_neural_simulation(neural_sim); // _CrtMemDumpAllObjectsSince(&state0); if(errorn) printf("Error %i performing neural network simulation\n",errorn); printf("Total neural-network output spikes: %li\n",total_output_spks); printf("Total number of neural updates: %Ld\n",get_neural_simulation_event_counter(neural_sim)); printf("Mean number of neural-network spikes in heap: %f\n",get_accumulated_heap_occupancy_counter(neural_sim)/(double)get_neural_simulation_event_counter(neural_sim)); #if defined(REAL_TIME_WINNT) printf("Total elapsed time: %fs (time resolution: %fus)\n",sim_elapsed_time,1.0e6/freq.QuadPart); #elif defined(REAL_TIME_LINUX) printf("Total elapsed time: %fs (time resolution: %fus)\n",sim_elapsed_time,freq.tv_sec*1.0e6+freq.tv_nsec/((float)(1e3))); #elif defined(REAL_TIME_OSX) printf("Total elapsed time: %fs (time resolution: %fus)\n",sim_elapsed_time,1e-3*freq.numer/freq.denom); #endif save_neural_weights(neural_sim); finish_neural_simulation(neural_sim); } else { errorn=10000; printf("Error initializing neural network simulation\n"); } puts("Saving log file"); errorn=save_and_finish_log(&var_log, LOG_FILE); // Store logged vars in disk if(errorn) printf("Error %i while saving log file\n",errorn); } else { errorn*=1000; printf("Error allocating memory for the log of the simulation variables\n"); } free_integration_buffers(&num_integration_buffers); } else { errorn*=100; printf("Error allocating memory for the numerical integration\n"); } free_robot(robot_inv_dyn_object); free_robot(robot_dir_dyn_object); } else { errorn*=10; printf("Error loading the robot object from file: %s\n",ROBOT_VAR_FILE_NAME); } if(!errorn) puts("OK"); else printf("Error: %i\n",errorn); #if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64)) _CrtDumpMemoryLeaks(); #endif return(errorn); }
void init_delay(Delay *c, int di, float fb) { init_delay(c,di); c->fb = fb; }
/** * @brief [initialize eq struct for equalizer routines] * * @param low_gain [bass gain in dB] * @param mid_gain [mid gain in dB] * @param high_gain [treble gain in dB] * @param block_size [number of samples to work on] * @param FS [sampling frequency used in the delay routine] * @return [pointer to the eq struct] */ EQ_T * init_eq(float low_gain, float mid_gain, float high_gain, int block_size, int FS) { int i, j; // set up struct for eq ------------------------------------------------------------------------------------- EQ_T * Q = (EQ_T *)malloc(sizeof(EQ_T)); // allocate struct if(Q == NULL) return NULL; // errcheck malloc call Q->block_size = block_size; // pow(dB / 20) = gain Q->low_scale = pow(10, (low_gain / 20.0)); Q->mid_scale = pow(10, (mid_gain / 20.0)); Q->high_scale = pow(10, (high_gain / 20.0)); // initialize delays for keeping the outputs in phase with each other --------------------------------------- // delay the same amount as the delay caused by the fir routine // both filters have the same number of coefs, so the delays will be the same int sample_delay = ((eq_low_num - 1) / 2); // delay for fir is (M-1)/2 Q->D1 = init_delay(0, FS, sample_delay, 1, block_size); // 0 is delay in samples instead of in seconds Q->D2 = init_delay(0, FS, sample_delay, 1, block_size); Q->D3 = init_delay(0, FS, sample_delay, 1, block_size); if(Q->D1 == NULL || Q->D2 == NULL || Q->D3 == NULL) return NULL; // declare and initialize variables necessary for arm fir routines ------------------------------------------ float * low_state = (float *)malloc(sizeof(float) * (eq_low_num + block_size - 1)); float * mid_state = (float *)malloc(sizeof(float) * (eq_mid_num + block_size - 1)); if(low_state == NULL || mid_state == NULL) return NULL; // declare arm struct arm_fir_instance_f32 S_low; arm_fir_instance_f32 S_mid; // initialize arm struct arm_fir_init_f32(&S_low, eq_low_num, &(eq_low_coefs[0]), low_state, block_size); arm_fir_init_f32(&S_mid, eq_mid_num, &(eq_mid_coefs[0]), mid_state, block_size); Q->S_low = S_low; Q->S_mid = S_mid; // initialize band output buffers -------------------------------------------------------------------------- Q->low_band_out = (float *)malloc(sizeof(float) * block_size); Q->mid_band_out = (float *)malloc(sizeof(float) * block_size); Q->high_band_out = (float *)malloc(sizeof(float) * block_size); if(Q->low_band_out == NULL || Q->mid_band_out == NULL || Q->high_band_out == NULL) return NULL; for(i = 0; i < block_size; i++) { Q->low_band_out[i] = 0.0; Q->mid_band_out[i] = 0.0; Q->high_band_out[i] = 0.0; } // initialize eq output buffer ----------------------------------------------------------------------------- Q->output = (float *)malloc(sizeof(float) * block_size); if(Q->output == NULL) return NULL; for(j = 0; j < block_size; j++) { Q->output[j] = 0.0; } // return pointer to struct--------------------------------------------------------------------------------- return Q; }
static void bios_init(void) { KDEBUG(("bios_init()\n")); /* initialize Native Features, if available * do it as soon as possible so that kprintf can make use of them */ #if DETECT_NATIVE_FEATURES KDEBUG(("natfeat_init()\n")); natfeat_init(); #endif #if STONX_NATIVE_PRINT KDEBUG(("stonx_kprintf_init()\n")); stonx_kprintf_init(); #endif #if CONF_WITH_UAE KDEBUG(("amiga_uaelib_init()\n")); amiga_uaelib_init(); #endif /* Initialize the processor */ KDEBUG(("processor_init()\n")); processor_init(); /* Set CPU type, longframe and FPU type */ KDEBUG(("vecs_init()\n")); vecs_init(); /* setup all exception vectors (above) */ KDEBUG(("init_delay()\n")); init_delay(); /* set 'reasonable' default values for delay */ /* Detect optional hardware (video, sound, etc.) */ KDEBUG(("machine_detect()\n")); machine_detect(); /* detect hardware */ KDEBUG(("machine_init()\n")); machine_init(); /* initialise machine-specific stuff */ /* Initialize the screen */ KDEBUG(("screen_init()\n")); screen_init(); /* detect monitor type, ... */ /* Initialize the BIOS memory management */ KDEBUG(("bmem_init()\n")); bmem_init(); /* this must be done after screen_init() */ KDEBUG(("cookie_init()\n")); cookie_init(); /* sets a cookie jar */ KDEBUG(("fill_cookie_jar()\n")); fill_cookie_jar(); /* detect hardware features and fill the cookie jar */ /* Set up the BIOS console output */ KDEBUG(("linea_init()\n")); linea_init(); /* initialize screen related line-a variables */ font_init(); /* initialize font ring (requires cookie_akp) */ font_set_default(-1);/* set default font */ vt52_init(); /* initialize the vt52 console */ /* Now kcprintf() will also send debug info to the screen */ KDEBUG(("after vt52_init()\n")); /* misc. variables */ dumpflg = -1; sysbase = (LONG) os_entry; savptr = (LONG) trap_save_area; etv_timer = (void(*)(int)) just_rts; etv_critic = default_etv_critic; etv_term = just_rts; /* setup VBL queue */ nvbls = 8; vblqueue = vbl_list; { int i; for(i = 0 ; i < 8 ; i++) { vbl_list[i] = 0; } } #if CONF_WITH_MFP KDEBUG(("mfp_init()\n")); mfp_init(); #endif #if CONF_WITH_TT_MFP if (has_tt_mfp) { KDEBUG(("tt_mfp_init()\n")); tt_mfp_init(); } #endif /* Initialize the system 200 Hz timer */ KDEBUG(("init_system_timer()\n")); init_system_timer(); /* Initialize the RS-232 port(s) */ KDEBUG(("chardev_init()\n")); chardev_init(); /* Initialize low-memory bios vectors */ boot_status |= CHARDEV_AVAILABLE; /* track progress */ KDEBUG(("init_serport()\n")); init_serport(); boot_status |= RS232_AVAILABLE; /* track progress */ #if CONF_WITH_SCC if (has_scc) boot_status |= SCC_AVAILABLE; /* track progress */ #endif /* The sound init must be done before allowing MFC interrupts, * because of dosound stuff in the timer C interrupt routine. */ #if CONF_WITH_DMASOUND KDEBUG(("dmasound_init()\n")); dmasound_init(); #endif KDEBUG(("snd_init()\n")); snd_init(); /* Reset Soundchip, deselect floppies */ /* Init the two ACIA devices (MIDI and KBD). The three actions below can * be done in any order provided they happen before allowing MFP * interrupts. */ KDEBUG(("kbd_init()\n")); kbd_init(); /* init keyboard, disable mouse and joystick */ KDEBUG(("midi_init()\n")); midi_init(); /* init MIDI acia so that kbd acia irq works */ KDEBUG(("init_acia_vecs()\n")); init_acia_vecs(); /* Init the ACIA interrupt vector and related stuff */ KDEBUG(("after init_acia_vecs()\n")); boot_status |= MIDI_AVAILABLE; /* track progress */ /* Now we can enable the interrupts. * We need a timer for DMA timeouts in floppy and harddisk initialisation. * The VBL processing will be enabled later with the vblsem semaphore. */ #if CONF_WITH_ATARI_VIDEO /* Keep the HBL disabled */ set_sr(0x2300); #else set_sr(0x2000); #endif KDEBUG(("calibrate_delay()\n")); calibrate_delay(); /* determine values for delay() function */ /* - requires interrupts to be enabled */ KDEBUG(("blkdev_init()\n")); blkdev_init(); /* floppy and harddisk initialisation */ KDEBUG(("after blkdev_init()\n")); /* initialize BIOS components */ KDEBUG(("parport_init()\n")); parport_init(); /* parallel port */ //mouse_init(); /* init mouse driver */ KDEBUG(("clock_init()\n")); clock_init(); /* init clock */ KDEBUG(("after clock_init()\n")); #if CONF_WITH_NLS KDEBUG(("nls_init()\n")); nls_init(); /* init native language support */ nls_set_lang(get_lang_name()); #endif /* set start of user interface */ #if WITH_AES exec_os = ui_start; #elif WITH_CLI exec_os = coma_start; #else exec_os = NULL; #endif KDEBUG(("osinit()\n")); osinit(); /* initialize BDOS */ KDEBUG(("after osinit()\n")); boot_status |= DOS_AVAILABLE; /* track progress */ /* Enable VBL processing */ vblsem = 1; #if CONF_WITH_CARTRIDGE { WORD save_hz = v_hz_rez, save_vt = v_vt_rez, save_pl = v_planes; /* Run all boot applications from the application cartridge. * Beware: Hatari features a special cartridge which is used * for GEMDOS drive emulation. It will hack drvbits and hook Pexec(). * It will also hack Line A variables to enable extended VDI video modes. */ KDEBUG(("run_cartridge_applications(3)\n")); run_cartridge_applications(3); /* Type "Execute prior to bootdisk" */ KDEBUG(("after run_cartridge_applications()\n")); if ((v_hz_rez != save_hz) || (v_vt_rez != save_vt) || (v_planes != save_pl)) { set_rez_hacked(); font_set_default(-1); /* set default font */ vt52_init(); /* initialize the vt52 console */ } } #endif #if CONF_WITH_ALT_RAM #if CONF_WITH_FASTRAM /* add TT-RAM that was detected in memory.S */ if (ramtop != NULL) { KDEBUG(("xmaddalt()\n")); xmaddalt(FASTRAM_START, ramtop - FASTRAM_START); } #endif #if CONF_WITH_MONSTER /* Add MonSTer alt-RAM detected in machine.c */ if (has_monster) { /* Dummy read from MonSTer register to initiate write sequence. */ unsigned short monster_reg = *(volatile unsigned short *)MONSTER_REG; /* Only enable 6Mb when on a Mega STE due to address conflict with VME bus. Todo: This should be made configurable. */ if (has_vme) monster_reg = 6; else monster_reg = 8; /* Register write sequence: read - write - write */ *(volatile unsigned short *)MONSTER_REG = monster_reg; *(volatile unsigned short *)MONSTER_REG = monster_reg; KDEBUG(("xmaddalt()\n")); xmaddalt((UBYTE *)0x400000L, monster_reg*0x100000L); } #endif #ifdef MACHINE_AMIGA KDEBUG(("amiga_add_alt_ram()\n")); amiga_add_alt_ram(); #endif #endif /* CONF_WITH_ALT_RAM */ KDEBUG(("bios_init() end\n")); }