sPyNNaker neural_modelling 7.3.1
Loading...
Searching...
No Matches
in_spikes.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 The University of Manchester
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
19
20#ifndef _IN_SPIKES_H_
21#define _IN_SPIKES_H_
22
23#include "neuron-typedefs.h"
24#include <circular_buffer.h>
25
29
51static inline bool in_spikes_initialize_spike_buffer(uint32_t size) {
53 return buffer != 0;
54}
55
59static inline bool in_spikes_add_spike(spike_t spike) {
60 return circular_buffer_add(buffer, spike);
61}
62
66static inline bool in_spikes_get_next_spike(spike_t* spike) {
67 return circular_buffer_get_next(buffer, spike);
68}
69
74static inline bool in_spikes_is_next_spike_equal(spike_t spike) {
75 return circular_buffer_advance_if_next_equals(buffer, spike);
76}
77
81 return circular_buffer_get_n_buffer_overflows(buffer);
82}
83
87 return 0;
88}
89
95
96//---------------------------------------
97// Synaptic rewiring functions
98//---------------------------------------
102static inline uint32_t in_spikes_input_index(void) {
103 return circular_buffer_input(buffer);
104}
105
109static inline uint32_t in_spikes_output_index(void) {
110 return circular_buffer_output(buffer);
111}
112
115static inline uint32_t in_spikes_real_size(void) {
116 return circular_buffer_real_size(buffer);
117}
118
121static inline uint32_t in_spikes_size(void) {
122 return circular_buffer_size(buffer);
123}
124
126static inline void in_spikes_clear(void) {
127 circular_buffer_clear(buffer);
128}
129
135static inline spike_t in_spikes_value_at_index(uint32_t index) {
136 return circular_buffer_value_at_index(buffer, index);
137}
138#endif // _IN_SPIKES_H_
uint32_t counter_t
circular_buffer circular_buffer_initialize(uint32_t size)
void circular_buffer_print_buffer(circular_buffer buffer)
static uint32_t in_spikes_output_index(void)
Get the index in the buffer of the point where the next removal comes from.
Definition in_spikes.h:109
static bool in_spikes_get_next_spike(spike_t *spike)
Retrieves a spike from the input spike buffer.
Definition in_spikes.h:66
static bool in_spikes_is_next_spike_equal(spike_t spike)
Skips the next spike in the buffer if it is equal to an existing spike.
Definition in_spikes.h:74
static uint32_t in_spikes_real_size(void)
Get the size of the input spike buffer.
Definition in_spikes.h:115
static spike_t in_spikes_value_at_index(uint32_t index)
Get the spike at a specific index of the input spike buffer.
Definition in_spikes.h:135
static uint32_t in_spikes_input_index(void)
Get the index in the buffer of the point where the next insertion goes.
Definition in_spikes.h:102
static circular_buffer buffer
Buffer for quickly taking spikes received by a fast interrupt and queueing them for later processing ...
Definition in_spikes.h:28
static bool in_spikes_initialize_spike_buffer(uint32_t size)
This function initialises the input spike buffer.
Definition in_spikes.h:51
static void in_spikes_clear(void)
clears the input spike buffer.
Definition in_spikes.h:126
static uint32_t in_spikes_size(void)
get the size of the input spike buffer
Definition in_spikes.h:121
static counter_t in_spikes_get_n_buffer_overflows(void)
Get the number of times that the input spike buffer overflowed.
Definition in_spikes.h:80
static counter_t in_spikes_get_n_buffer_underflows(void)
Get the number of times that the input spike buffer underflowed.
Definition in_spikes.h:86
static void in_spikes_print_buffer(void)
Print the input spike buffer.
Definition in_spikes.h:92
static bool in_spikes_add_spike(spike_t spike)
Adds a spike to the input spike buffer.
Definition in_spikes.h:59
Data type definitions for SpiNNaker Neuron-modelling.
uint32_t spike_t
The type of a spike.