コード例 #1
0
void handle_key_2(s32 val) {
  if(check_key(2)) {
    bfin_disable();
    net_report_params();
    bfin_enable();
  }
}
コード例 #2
0
ファイル: page_dsp.c プロジェクト: bensteinberg/aleph
// function keys
void handle_key_0(s32 val) {
  // load module
  if(val == 0) { return; }
  if(check_key(0)) {
    notify("loading...");
    // don't do this! let it break?
    //    net_clear_user_ops();
    // disconnect parameters though
    net_disconnect_params();

    files_load_dsp(*pageSelect);

    bfin_wait_ready();

    scene_query_module();

    net_report_params();

    bfin_enable();

    redraw_ins();
    redraw_dsp();

    notify("finished loading.");
  }
  show_foot();
}
コード例 #3
0
// function keys
void handle_key_0(s32 val) {
  // load module
  if(val == 0) { return; }
  if(check_key(0)) {
    region_fill(headRegion, 0x0);
    font_string_region_clip(headRegion, "loading DSP module...", 0, 0, 0xa, 0);
    headRegion->dirty = 1;
    render_update();
    
    net_clear_user_ops();

    files_load_dsp(*pageSelect);
    bfin_wait_ready();
    net_report_params();
    bfin_enable();

    // render status to head region 
    region_fill(headRegion, 0x0);
    font_string_region_clip(headRegion, "finished loading.", 0, 0, 0xa, 0);
    headRegion->dirty = 1;
    render_update();

  }
  show_foot();
}
コード例 #4
0
ファイル: page_dsp.c プロジェクト: catfact/aleph
// function keys
void handle_key_0(s32 val) {
  // load module
  if(val == 0) { return; }
  if(check_key(0)) {
    notify("loading...");

    net_disconnect_params();

    files_load_dsp(*pageSelect);

    bfin_wait_ready();
    bfin_enable();

    redraw_ins();
    redraw_dsp();

    notify("finished loading.");
  }
  show_foot();
}
コード例 #5
0
ファイル: app_mix.c プロジェクト: duncanspeakman/aleph
// this is called from the event queue to start the app 
// return >0 if there is an error doing firstrun init
u8 app_launch(u8 firstrun) {
  u32 waitForCard;

  print_dbg("\r\n app launch");
  print_dbg("\r\n firstrun: ");
  print_dbg_ulong(firstrun);

  if(firstrun) {
    // it is the first run.
    // need to copy audio module binary from sdcard to internal flash.
    render_boot("first run. waiting for SDcard...");
    render_update();
  
    print_dbg("\r\n SD check... ");
    while (!sd_mmc_spi_mem_check()) {
      waitForCard++;
    }
    print_dbg("\r\nfound SD card. ");

    render_boot("found sdcard.. reading DSP...");
    render_update();

    // search for our dsp and load it
    // return success (0 == fail)
    if( files_search_dsp() ) {
      ;;
    } else {
      screen_clear();
      return 0;
    }

  } else {

    // firstrun pattern was set, so there should be a blackfin executable in flash.
    // read from flash to RAM
    render_boot("loading flash to RAM...");
    render_update();
    flash_read_ldr();
    
    render_boot( "booting DSP from flash...");
    render_update();
    // reboot DSP from RAM
    bfin_load_buf();
  }

  render_boot("waiting for bfin init...      ");
  render_update();

  bfin_wait_ready();

  // set encoder sensitivity
  set_enc_thresh(3, 16);
  delay_ms(20);

  // enable audio
  render_boot("run                       ");
  render_update();
  bfin_enable();

  // enable timers
  init_app_timers();

  render_startup();
  render_update();

  // set app event handlers
  mix_assign_event_handlers();

  return 1;
}
コード例 #6
0
ファイル: scene.c プロジェクト: duncanspeakman/aleph
// set current state of system from global RAM buffer
void scene_read_buf(void) {
  /// pointer to serial blob
  const u8* src = (u8*)&(sceneData->pickle);
  int i;
  // param count reported from dsp
  //  u32 paramsReported;
  //// TEST
  char moduleName[MODULE_NAME_LEN];
  ModuleVersion moduleVersion;
  ////

   app_pause();

  // store current mod name in scene desc
   //  memcpy(modName, sceneData->desc.moduleName, MODULE_NAME_LEN);
   
   // read scene name
  for(i=0; i<SCENE_NAME_LEN; i++) {
    sceneData->desc.sceneName[i] = *src;
    src++;
  }

   // read bees version
  sceneData->desc.beesVersion.min = *src;
  src++;
  sceneData->desc.beesVersion.maj = *src;
  src++;
  src = unpickle_16(src, &(sceneData->desc.beesVersion.rev));

 // read module name
  // target is temp module name buffer, so we can run a comparison 
  for(i=0; i<MODULE_NAME_LEN; i++) {
    moduleName[i] = *src;
    src++;
  }
  print_dbg("\r\n unpickled module name: ");
  print_dbg(moduleName);

   // read module version
  sceneData->desc.moduleVersion.min = *src;
  src++;
  sceneData->desc.moduleVersion.maj = *src;
  src++;
  src = unpickle_16(src, &(sceneData->desc.moduleVersion.rev));

  print_dbg("\r\n unpickled module version: ");
  print_dbg_ulong(sceneData->desc.moduleVersion.maj);
  print_dbg(".");
  print_dbg_ulong(sceneData->desc.moduleVersion.min);
  print_dbg(".");
  print_dbg_ulong(sceneData->desc.moduleVersion.rev);

  print_dbg("\r\n checking against module name from scene data: ");
  print_dbg(sceneData->desc.moduleName);

  if(strcmp(moduleName, sceneData->desc.moduleName) == 0) {
    print_dbg("\r\n requested module name is already loaded; skip DSP reboot.");
    // skip DSP load
    /// FIXME: should check module version too

  } else {
    strcpy(sceneData->desc.moduleName, moduleName);
    render_boot("loading DSP module:");
    render_boot(sceneData->desc.moduleName);

    ///// load the DSP now!  
    render_boot("loading module from sdcard");
    print_dbg("\r\n loading module from card, filename: ");
    print_dbg(sceneData->desc.moduleName);

    files_load_dsp_name(sceneData->desc.moduleName);

    render_boot("waiting for module init");
    print_dbg("\r\n waiting for DSP init...");
    bfin_wait_ready();

#if RELEASEBUILD==1
#else
  
    // query module name / version

    render_boot("querying module");

    print_dbg("\r\n querying module name...");
    bfin_get_module_name(moduleName);
    print_dbg("\r\n querying module version...");
    bfin_get_module_version(&moduleVersion);

    print_dbg("\r\n received module name: ");
    print_dbg((char*)moduleName);

    print_dbg("\r\n received module version: ");
    print_dbg_ulong(moduleVersion.maj);
    print_dbg(".");
    print_dbg_ulong(moduleVersion.min);
    print_dbg(".");
    print_dbg_ulong(moduleVersion.rev);

#ifdef BEEKEEP
#else
    // store in scene data
    render_boot("storing module version");

    sceneData->desc.moduleVersion.maj = moduleVersion.maj;
    sceneData->desc.moduleVersion.min = moduleVersion.min;
    sceneData->desc.moduleVersion.rev = moduleVersion.rev;
    strcpy(sceneData->desc.moduleName, (const char*)moduleName);
#endif

#endif

  } // load-module case
  app_pause();

  /// don't have to do this b/c net_unpickle will deinit anyways
  /*
  print_dbg("\r\n clearing operator list...");
  net_clear_user_ops();
  */

  //// FIXME: use .dsc
  /*
  print_dbg("\r\n reporting DSP parameters...");
  paramsReported = net_report_params();
  */

  /// FIXME:
  /// check the module version and warn if different!
  // there could also be a check here for mismatched parameter list.

  // unpickle network 
  render_boot("reading network");
  print_dbg("\r\n unpickling network for scene recall...");
  src = net_unpickle(src);
    
  // unpickle presets
  render_boot("reading presets");
  print_dbg("\r\n unpickling presets for scene recall...");
  src = presets_unpickle(src);

  render_boot("scene data stored in RAM");
  print_dbg("\r\n copied stored network and presets to RAM ");

  /* for(i=0; i<net->numParams; i++) { */
  /*   print_dbg("\r\n param "); */
  /*   print_dbg_ulong(i); */
  /*   print_dbg(" : "); */
  /*   print_dbg(net->params[i].desc.label); */
  /*   print_dbg(" ; val "); */
  /*   print_dbg_hex((u32)net->params[i].data.value); */
  /* } */

  render_boot("waiting for DSP");
  bfin_wait_ready();
  // update bfin parameters
  //  if(net->numParams != paramsReported) {
  //    print_dbg("\r\n !!!!!! WARNING ! param count from scene does not match reported count from DSP");
  //    render_boot("warning: param count mismatch!");
  //  } else {

#ifdef BEEKEEP
#else
  render_boot("sending param values");
  net_send_params();
#endif

  //  }

  print_dbg("\r\n sent new parameter values");

  delay_ms(5);


  render_boot("enabling audio");  // enable audio processing
  bfin_enable();
  
  app_resume();
}
コード例 #7
0
ファイル: app_bees.c プロジェクト: botstein/aleph
// this is called from main event handler
u8 app_launch(u8 firstrun) {

  print_dbg("\r\n launching app with firstrun: ");
  print_dbg_ulong(firstrun);

  //  net_print();

  
  render_boot("BEES");
  render_boot(versionString);

  if(firstrun) {
    render_boot("launching app, first run");
    print_dbg("\r\n first run, writing nonvolatile data...");
    
    ///... write param scaler data
    // this is done at firstrun instead of being linked statically,
    // so that users can tune scaler data offline without recompiling
    render_boot("init param scaling data...");
    flash_init_scaler_data();

    print_dbg("\r\n first run, try and load default DSP");
    render_boot("launching default DSP...");

    files_load_dsp_name("aleph-waves.ldr");
    
    render_boot("waiting for DSP init...");
    bfin_wait_ready();

    //    print_dbg(" requesting param report...");
    render_boot("requesting DSP params");
    net_report_params();

    //    print_dbg("\r\n enable DSP audio...");
        render_boot("enabling audio");
    bfin_enable();

    render_boot("writing default dsp to flash...");
    //    files_store_default_dsp_name("aleph-waves.ldr");
    
  } else {

    app_pause();

    print_dbg("\r\n booting default ldr from flash... ");
    render_boot("booting DSP from flash");
    //    flash_read_ldr();

    bfin_load_buf();    
    print_dbg("\r\n DSP booted, waiting to query params...");
    render_boot("waiting for DSP init...");

    /// blackfin should clear ready pin ASAP on boot.
    /// but give it a moment to accomplish that.
    delay_ms(2);
    
    bfin_wait_ready();
    print_dbg(" requesting param report...");
    render_boot("requesting DSP params");
    net_report_params();

    print_dbg("\r\n enable DSP audio...");
    render_boot("enabling audio");
    bfin_enable();
    
    print_dbg("\r\n reading default scene... ");
    render_boot("reading default scene");
    scene_read_default();

    app_resume();
    
   }

  // init pages (fill graphics buffers)
  print_dbg("\r\n pages_init...");
  pages_init();

  print_dbg("\r\n play_init...");
  play_init();

  // enable timers
  print_dbg("\r\n enable app timers...");
  render_boot("enabling app timers...");
  init_app_timers();

  // pull up power control pin, enabling soft-powerdown
  gpio_set_gpio_pin(POWER_CTL_PIN);

  // assign app event handlers
  print_dbg("\r\n assigning handlers ");
  render_boot("assigning UI handlers...");
  assign_bees_event_handlers();

  // update page rendering and handlers
  pages_reselect();

  // start in play mode 
  pages_toggle_play();

  return 1;
}
コード例 #8
0
ファイル: scene.c プロジェクト: botstein/aleph
// set current state of system from global RAM buffer
void scene_read_buf(void) {
  s8 modName[MODULE_NAME_LEN];
  const u8* src = (u8*)&(sceneData->pickle);

  /// FIXME: we really should be using this comparison
  
  //  s8 neq = 0;
  //  u32 i;

  app_pause();

  // store current mod name in scene desc
  memcpy(modName, sceneData->desc.moduleName, MODULE_NAME_LEN);

  ///// always load:
    print_dbg("\r\n loading module name: ");
    print_dbg(sceneData->desc.moduleName);
    files_load_dsp_name(sceneData->desc.moduleName);
    //  }

    bfin_wait_ready();

    net_clear_user_ops();

    net_report_params();

  // unpickle network 
  print_dbg("\r\n unpickling network for scene recall...");
  src = net_unpickle(src);

  // unpickle presets
  print_dbg("\r\n unpickling presets for scene recall...");
  src = presets_unpickle(src);
  
  print_dbg("\r\n copied stored network and presets to RAM ");

  /* for(i=0; i<net->numParams; i++) { */
  /*   print_dbg("\r\n param "); */
  /*   print_dbg_ulong(i); */
  /*   print_dbg(" : "); */
  /*   print_dbg(net->params[i].desc.label); */
  /*   print_dbg(" ; val "); */
  /*   print_dbg_hex((u32)net->params[i].data.value); */
  /* } */

  // compare module name  

  //// is strncmp f*****g with us??
  ///  neq = strncmp((const char*)modName, (const char*)sceneData->desc.moduleName, MODULE_NAME_LEN);
  
  //  if(neq) {
    // load bfin module if it doesn't match the current scene desc

  //...
    
    bfin_wait_ready();

  //// well let's try it, actually that would explain some things..
    //  delay_ms(10);

  // update bfin parameters
  net_send_params();
  print_dbg("\r\n sent new params");

  delay_ms(5);

  // enable audio processing
  bfin_enable();
  
  app_resume();
}
コード例 #9
0
ファイル: app_bees.c プロジェクト: bbnickell/aleph
// this is called from main event handler
u8 app_launch(u8 firstrun) {

  print_dbg("\r\n launching app with firstrun: ");
  print_dbg_ulong(firstrun);

  //  net_print();
  
  render_boot("BEES");
  render_boot(versionString);

  while (!sd_mmc_spi_mem_check()) {
    render_boot("waiting for SD card...");
  }

  if(firstrun) {
    render_boot("launching app, first run");
    print_dbg("\r\n first run, writing nonvolatile data...");
    
    ///... write param scaler data
    // this is done at firstrun instead of being linked statically,
    // so that users can tune scaler data offline without recompiling
    render_boot("init param scaling data...");
    flash_init_scaler_data();

    print_dbg("\r\n first run, try and load default DSP");
    render_boot("launching default DSP");

    //// startup using default DSP name
    files_load_dsp_name(DEFAULT_LDR);
    
    render_boot("waiting for DSP init...");
    bfin_wait_ready();

    //    print_dbg("\r\n enable DSP audio...");
    render_boot("enabling audio");
    bfin_enable();
    
  } else {

    app_pause();

    /// blackfin should clear ready pin ASAP on boot.
    /// but give it a moment to accomplish that.
    delay_ms(2);

    /// read the default scene from sd card
    /// this also attempts to load associated .ldr    
    render_boot("reading default scene");
    print_dbg("\r\n loading default scene. current module name from sceneData: ");
    print_dbg(sceneData->desc.moduleName);

    scene_read_default();

    delay_ms(2); 

    app_resume();
    
   }

  // init pages (fill graphics buffers)
  render_boot("initializing gfx");
  print_dbg("\r\n pages_init...");
  pages_init();

  print_dbg("\r\n play_init...");
  play_init();

  // enable timers
  print_dbg("\r\n enable app timers...");
  render_boot("enabling app timers");
  init_app_timers();

  // pull up power control pin, enabling soft-powerdown
  //  gpio_set_gpio_pin(POWER_CTL_PIN);

  // assign app event handlers
  print_dbg("\r\n assigning handlers... ");
  render_boot("assigning UI handlers");
  assign_bees_event_handlers();

  // update page rendering and handlers...
  pages_reselect();

  // start in play mode if not firstrun 
  if(!firstrun) pages_toggle_play();

  return 1;
}