// Callbacks void incoming_spike_callback(uint key, uint payload) { use(payload); log_debug("Received spike %x", key); // If there was space to add spike to incoming spike queue if (in_spikes_add_spike(key)) { if (!processing_spikes) { processing_spikes = true; spin1_trigger_user_event(0, 0); } } }
/****f* simple.c/flip_led * * SUMMARY * This function is used as a callback for timer tick events. * It inverts the state of LED 1 and sends packets. * * SYNOPSIS * void flip_led (uint ticks, uint null) * * INPUTS * uint ticks: simulation time (in ticks) - provided by the RTS * uint null: padding - all callbacks must have two uint arguments! * * SOURCE */ void flip_led (uint ticks, uint null) { /* flip led 1 */ /* Only 1 core should flip leds! */ if ((get_ncores(NUMBER_OF_CHIPS, core_map) == 1) || (coreID == 1)) { spin1_led_control(LED_INV (1)); } /* trigger user event to send packets */ if (spin1_trigger_user_event(ticks, NULL) == FAILURE) { ufailed++; } /* stop if desired number of ticks reached */ if (ticks >= TOTAL_TICKS) spin1_stop(); }