void initialize_out_spikes (size_t max_spike_sources)
{
  out_spikes_size = get_bit_field_size(max_spike_sources);
  log_info("Out spike size is %u words, allowing %u spike sources", out_spikes_size, max_spike_sources);
  
  out_spikes = (bit_field_t)sark_alloc (out_spikes_size * sizeof (uint32_t), 1);
  reset_out_spikes ();
}
void initialize_current_buffer (void)
{
  counter_t i;

  current = (current_t*)sark_alloc(CURRENT_BUFFER_SIZE*sizeof(current_t), 1);
  log_info ("address of current %x - Current buffer size %u, ring-buffer size %u", (uint32_t)current, CURRENT_BUFFER_SIZE, RING_BUFFER_SIZE);

  for (i = 0; i < CURRENT_BUFFER_SIZE; i++)
  {
    current[i] = current_0;
  }
}
void event_register_pkt(uint queue_size, vic_slot slot)
{
    if (queue_size <= 256 &&
            (queue_size & (queue_size - 1)) == 0 &&
            slot <= SLOT_MAX &&
            vic[VIC_CNTL + slot] == 0) {
        event.pkt_queue = sark_alloc(queue_size, sizeof(pkt_t));

        if (event.pkt_queue != NULL) {
            event.pkt_insert = 1;
            event.pkt_size = queue_size;

            sark_vic_set(slot, CC_TNF_INT, 0, txpkt_int_han);

            cc[CC_TCR] = PKT_MC;

            return;
        }
    }

    rt_error(RTE_PKT);
}