sPyNNaker neural_modelling  7.4.2
formation_distance_dependent_impl.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 
20 
21 formation_params_t *synaptogenesis_formation_init(uint8_t **data) {
22  // Reference the parameters to read the sizes
23  formation_params_t *form_params = (formation_params_t *) *data;
24  uint32_t data_size = sizeof(formation_params_t) + (sizeof(uint16_t) *
25  (form_params->ff_prob_size + form_params->lat_prob_size));
26 
27  // Allocate the space for the data and copy it in
28  form_params = spin1_malloc(data_size);
29  if (form_params == NULL) {
30  log_error("Out of memory when allocating parameters");
31  rt_error(RTE_SWERR);
32  }
33  spin1_memcpy(form_params, *data, data_size);
34  log_debug("Formation distance dependent %u bytes, grid=(%u, %u), %u ff probs, %u lat probs",
35  data_size, form_params->grid_x, form_params->grid_y,
36  form_params->ff_prob_size, form_params->lat_prob_size);
37 
38  *data += data_size;
39 
40  return form_params;
41 }
formation_params_t * synaptogenesis_formation_init(uint8_t **data)
Read and return an formation parameter data structure from the data stream.
Synapse formation using a distance-dependent rule.