///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // install MIDI Rx callback function MIOS32_MIDI_DirectRxCallback_Init(&NOTIFY_MIDI_Rx); // print welcome message on MIOS terminal MIOS32_MIDI_SendDebugMessage("\n"); MIOS32_MIDI_SendDebugMessage("====================\n"); MIOS32_MIDI_SendDebugMessage("%s\n", MIOS32_LCD_BOOT_MSG_LINE1); MIOS32_MIDI_SendDebugMessage("====================\n"); MIOS32_MIDI_SendDebugMessage("\n"); MIOS32_MIDI_SendDebugMessage("Measurement results will be displayed once a MIDI clock is received."); MIOS32_MIDI_SendDebugMessage("Type \"reset\" in MIOS terminal to reset the current measurements!"); // clear line buffer line_buffer[0] = 0; line_ix = 0; // install the callback function which is called on incoming characters // from MIOS Terminal MIOS32_MIDI_DebugCommandCallback_Init(CONSOLE_Parse); }
///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // turn off gate LED MIOS32_BOARD_LED_Set(1, 0); // create semaphores xSDCardSemaphore = xSemaphoreCreateRecursiveMutex(); // initialize file functions FILE_Init(0); // initialize MIDI handler SEQ_MIDI_OUT_Init(0); // initialize sequencer SEQ_Init(0); // install MIDI Rx callback function MIOS32_MIDI_DirectRxCallback_Init(NOTIFY_MIDI_Rx); // install sequencer task xTaskCreate(TASK_SEQ, (signed portCHAR *)"SEQ", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_SEQ, NULL); }
///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // create semaphores xMIDIINSemaphore = xSemaphoreCreateRecursiveMutex(); xMIDIOUTSemaphore = xSemaphoreCreateRecursiveMutex(); // install SysEx callback MIOS32_MIDI_SysExCallback_Init(APP_SYSEX_Parser); // install MIDI Rx/Tx callback functions MIOS32_MIDI_DirectRxCallback_Init(&NOTIFY_MIDI_Rx); MIOS32_MIDI_DirectTxCallback_Init(&NOTIFY_MIDI_Tx); // install timeout callback function MIOS32_MIDI_TimeOutCallback_Init(&NOTIFY_MIDI_TimeOut); // limit the number of DIN/DOUT SRs which will be scanned for faster scan rate MIOS32_SRIO_ScanNumSet(2); // init keyboard functions KEYBOARD_Init(0); // read EEPROM content PRESETS_Init(0); // init MIDI port/router handling MIDI_PORT_Init(0); MIDI_ROUTER_Init(0); // init terminal TERMINAL_Init(0); // init MIDImon MIDIMON_Init(0); // start uIP task UIP_TASK_Init(0); // print welcome message on MIOS terminal MIOS32_MIDI_SendDebugMessage("\n"); MIOS32_MIDI_SendDebugMessage("=================\n"); MIOS32_MIDI_SendDebugMessage("%s\n", MIOS32_LCD_BOOT_MSG_LINE1); MIOS32_MIDI_SendDebugMessage("=================\n"); MIOS32_MIDI_SendDebugMessage("\n"); // speed up SPI transfer rate (was MIOS32_SPI_PRESCALER_128, initialized by MIOS32_SRIO_Init()) MIOS32_SPI_TransferModeInit(MIOS32_SRIO_SPI, MIOS32_SPI_MODE_CLK1_PHASE1, MIOS32_SPI_PRESCALER_128); // prescaler 64 results into a transfer rate of 0.64 uS per bit // when 2 SRs are transfered, we are able to scan the whole 16x8 matrix in 300 uS // standard SRIO scan has been disabled in programming_models/traditional/main.c via MIOS32_DONT_SERVICE_SRIO_SCAN in mios32_config.h // start the scan here - and retrigger it whenever it's finished APP_SRIO_ServicePrepare(); MIOS32_SRIO_ScanStart(APP_SRIO_ServiceFinish); // start tasks xTaskCreate(TASK_Period_1mS, (signed portCHAR *)"1mS", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_PERIOD_1mS, NULL); }
///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// extern "C" void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // initialize AOUT driver AOUT_Init(0); // initialize SID module SID_Init(0); // start tasks (differs between MIOS32 and MacOS) TASKS_Init(0); // install MIDI Rx/Tx callback functions MIOS32_MIDI_DirectRxCallback_Init((void *)&NOTIFY_MIDI_Rx); MIOS32_MIDI_DirectTxCallback_Init((void *)&NOTIFY_MIDI_Tx); // install MIDI SysEx callback function MIOS32_MIDI_SysExCallback_Init((void *)&NOTIFY_MIDI_SysEx); // install timeout callback function MIOS32_MIDI_TimeOutCallback_Init((void *)&NOTIFY_MIDI_TimeOut); // init Stopwatch APP_StopwatchInit(); // init MBNet MBNET_Init(0); MBNET_NodeIDSet(0x10); // initialize MbSidEnvironment sid_se_speed_factor = 2; mbSidEnvironment.updateSpeedFactorSet(sid_se_speed_factor); // start timer // TODO: increase once performance has been evaluated MIOS32_TIMER_Init(2, 2000 / sid_se_speed_factor, (void *)&SID_TIMER_SE_Update, MIOS32_IRQ_PRIO_MID); }
///////////////////////////////////////////////////////////////////////////// //! This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // initialize stopwatch for measuring delays MIOS32_STOPWATCH_Init(100); // hardware will be enabled once configuration has been loaded from SD Card // (resp. no SD Card is available) hw_enabled = 0; // only print error messages by default debug_verbose_level = DEBUG_VERBOSE_LEVEL_ERROR; // disable MSD by default (has to be enabled in SHIFT menu) msd_state = MSD_DISABLED; // hardware will be enabled once configuration has been loaded from SD Card // (resp. no SD Card is available) hw_enabled = 0; // initialize all J10 pins as inputs with internal Pull-Up int pin; for(pin=0; pin<8; ++pin) MIOS32_BOARD_J10_PinInit(pin, MIOS32_BOARD_PIN_MODE_INPUT_PU); // initialize LCDs MBNG_LCD_Init(0); // initialize the AINSER module(s) AINSER_Init(0); // initialize the AOUT module(s) AOUT_Init(0); // create semaphores xSDCardSemaphore = xSemaphoreCreateRecursiveMutex(); xMIDIINSemaphore = xSemaphoreCreateRecursiveMutex(); xMIDIOUTSemaphore = xSemaphoreCreateRecursiveMutex(); xLCDSemaphore = xSemaphoreCreateRecursiveMutex(); xJ16Semaphore = xSemaphoreCreateRecursiveMutex(); // install SysEx callback MIOS32_MIDI_SysExCallback_Init(APP_SYSEX_Parser); // install MIDI Rx/Tx callback functions MIOS32_MIDI_DirectRxCallback_Init(&NOTIFY_MIDI_Rx); MIOS32_MIDI_DirectTxCallback_Init(&NOTIFY_MIDI_Tx); // install timeout callback function MIOS32_MIDI_TimeOutCallback_Init(&NOTIFY_MIDI_TimeOut); // initialize code modules MIDI_PORT_Init(0); MBNG_SYSEX_Init(0); MIDI_ROUTER_Init(0); MBNG_EVENT_Init(0); MBNG_DIN_Init(0); MBNG_DOUT_Init(0); MBNG_ENC_Init(0); MBNG_MF_Init(0); MBNG_AIN_Init(0); MBNG_AINSER_Init(0); MBNG_CV_Init(0); MBNG_KB_Init(0); MBNG_MATRIX_Init(0); UIP_TASK_Init(0); SCS_Init(0); SCS_CONFIG_Init(0); TERMINAL_Init(0); MIDIMON_Init(0); MBNG_FILE_Init(0); MBNG_SEQ_Init(0); SEQ_MIDI_OUT_Init(0); MBNG_PATCH_Init(0); //KEYBOARD_Init(0); // done in MBNG_PATCH_Init() #if MIOS32_DONT_SERVICE_SRIO_SCAN //MIOS32_SRIO_ScanNumSet(4); // standard SRIO scan has been disabled in programming_models/traditional/main.c via MIOS32_DONT_SERVICE_SRIO_SCAN in mios32_config.h // start the scan here - and retrigger it whenever it's finished APP_SRIO_ServicePrepare(); MIOS32_SRIO_ScanStart(APP_SRIO_ServiceFinish); #endif }
///////////////////////////////////////////////////////////////////////////// // This hook is called after startup to initialize the application ///////////////////////////////////////////////////////////////////////////// void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); // disable DIN test mode by default app_din_testmode = 0; #ifdef MBSEQV4L // MBSEQV4L: set default port to 0xc0: multiple outputs MIOS32_MIDI_DefaultPortSet(0xc0); #endif // initialize hardware soft-config SEQ_HWCFG_Init(0); #ifndef MBSEQV4L // initialize CLCDs SEQ_LCD_Init(0); #endif // init BLMs #ifndef MBSEQV4L BLM_Init(0); #else BLM_CHEAPO_Init(0); #endif BLM_X_Init(); SEQ_TPD_Init(0); // initialize CV SEQ_CV_Init(0); // initialize MIDI handlers SEQ_MIDI_PORT_Init(0); SEQ_MIDI_IN_Init(0); SEQ_MIDI_SYSEX_Init(0); SEQ_BLM_Init(0); SEQ_MIDI_OUT_Init(0); SEQ_MIDI_ROUTER_Init(0); SEQ_TERMINAL_Init(0); // init mixer page SEQ_MIXER_Init(0); // init sequencer core SEQ_CORE_Init(0); // init user interface #ifndef MBSEQV4L SEQ_LABEL_Init(0); SEQ_CC_LABELS_Init(0); #endif SEQ_LED_Init(0); SEQ_UI_Init(0); // initial load of filesystem SEQ_FILE_Init(0); // start tasks (differs between MIOS32 and MacOS) TASKS_Init(0); // install MIDI Rx/Tx callback functions MIOS32_MIDI_DirectRxCallback_Init(&NOTIFY_MIDI_Rx); MIOS32_MIDI_DirectTxCallback_Init(&NOTIFY_MIDI_Tx); // install SysEx callback MIOS32_MIDI_SysExCallback_Init(APP_SYSEX_Parser); // install timeout callback function MIOS32_MIDI_TimeOutCallback_Init(&NOTIFY_MIDI_TimeOut); }