Exemple #1
0
/****f* simple.c/c_main
*
* SUMMARY
*  This function is called at application start-up.
*  It is used to register event callbacks and begin the simulation.
*
* SYNOPSIS
*  int c_main()
*
* SOURCE
*/
void c_main()
{
  io_printf (IO_STD, ">> simple\n");

  /* get this core's IDs */
  coreID = spin1_get_core_id();
  chipID = spin1_get_chip_id();

  /* TODO: Works on 4-chip board only! */
  /* set the core map for the simulation */
  if (NUMBER_OF_CHIPS > 0) core_map[0] = CORE_MAP_00;
  if (NUMBER_OF_CHIPS > 1) core_map[1] = CORE_MAP_01;
  if (NUMBER_OF_CHIPS > 2) core_map[2] = CORE_MAP_10;
  if (NUMBER_OF_CHIPS > 3) core_map[3] = CORE_MAP_11;
  spin1_set_core_map(NUMBER_OF_CHIPS, core_map);

  /* set timer tick value (in microseconds) */
  spin1_set_timer_tick(TIMER_TICK_PERIOD);

  /* register callbacks */
  spin1_callback_on(MC_PACKET_RECEIVED, count_packets, -1);
  spin1_callback_on(DMA_TRANSFER_DONE, check_memcopy, 0);
  spin1_callback_on(USER_EVENT, send_packets, 2);
  spin1_callback_on(TIMER_TICK, flip_led, 3);

  /* initialize application */
  app_init();

  /* go */
  spin1_start();

  /* report results */
  app_done();
}
Exemple #2
0
static void
app_terminate(void *data)
{
	/* Release all resources. */
	app_done();
}