Esempio n. 1
0
void c_main(void) {
  address_t address = system_load_sram();
  if (!data_system(region_start(1, address)) ||
      !data_get_output_keys(region_start(2, address)) ||
      !input_filter_get_filters(&g_input, region_start(3, address)) ||
      !input_filter_get_filter_routes(&g_input, region_start(4, address)) ||
      !data_get_transform(region_start(5, address))
  ) {
    io_printf(IO_BUF, "[Filter] Failed to initialise.\n");
    return;
  }

  // Setup timer tick, start
  spin1_set_timer_tick(g_filter.machine_timestep);
  spin1_callback_on(MCPL_PACKET_RECEIVED, mcpl_callback, -1);
  spin1_callback_on(TIMER_TICK, filter_update, 2);

  while (true)
  {
    // Wait for data loading, etc.
    event_wait();

    // Determine how long to simulate for
    config_get_n_ticks();

    // Perform the simulation
    spin1_start(SYNC_WAIT);
  }
}
void c_main(void) {
  // Load in all data
  address_t address = system_load_sram();
  if (!get_packets(region_start(2, address), &start_packets) ||
      !get_packets(region_start(4, address), &end_packets)
  ) {
    return;
  }

  spin1_set_timer_tick(1000);
  spin1_callback_on(TIMER_TICK, tick, 2);

  while(true)
  {
    // Wait for data loading, etc.
    event_wait();

    // Determine how long to simulate for
    config_get_n_ticks();

    // Transmit all packets assigned to be sent prior to the start of the
    // simulation
    transmit_packet_region(start_packets);

    // Synchronise with the simulation
    spin1_start(SYNC_WAIT);
  }
}