Skip to content

Commit

Permalink
Merge branch 'master' into struct_pl_merger
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Jul 27, 2018
2 parents 67b8f6b + a9a0ed5 commit 3c91f81
Show file tree
Hide file tree
Showing 128 changed files with 1,266 additions and 980 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Debug
lastfailed
/.cache
.coverage
*.o
*.class
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: python
python: "2.7"
python:
- 2.7
- 3.6
dist: trusty

addons:
Expand Down
3 changes: 2 additions & 1 deletion c_common/front_end_common_lib/FrontEndCommon.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ PROFILER := PROFILER_DISABLED
SHELL = bash
APPLICATION_NAME_HASH = $(shell echo -n "$(APP)" | (md5sum 2>/dev/null || md5) | cut -c 1-8)

CFLAGS += -Wall -Wextra -D$(FEC_DEBUG) -D$(PROFILER) $(OTIME) -DAPPLICATION_NAME_HASH=0x$(APPLICATION_NAME_HASH)
FEC_OPT = $(OTIME)
CFLAGS += -Wall -Wextra -D$(FEC_DEBUG) -D$(PROFILER) $(FEC_OPT) -DAPPLICATION_NAME_HASH=0x$(APPLICATION_NAME_HASH)

include $(SPINN_DIRS)/make/Makefile.common

Expand Down
2 changes: 1 addition & 1 deletion c_common/front_end_common_lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ HEADERS = common-typedefs.h data_specification.h simulation.h recording.h profil
INSTALL_HEADERS = $(HEADERS:%.h=$(SPINN_INC_DIR)/%.h)

# Makefile
MAKEFILES = Makefile.SpiNNFrontEndCommon FrontEndCommon.mk
MAKEFILES = Makefile.SpiNNFrontEndCommon FrontEndCommon.mk local.mk
INSTALL_MAKEFILES = $(MAKEFILES:%=$(SPINN_MAKE_LIB_DIR)/%)

# Libraries
Expand Down
6 changes: 3 additions & 3 deletions c_common/front_end_common_lib/include/buffered_eieio_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ typedef enum eieio_command_messages {
// End of all buffers, stop execution
EVENT_STOP_COMMANDS,

// Stop complaining that there is sdram free space for buffers
// Stop complaining that there is SDRAM free space for buffers
STOP_SENDING_REQUESTS,

// Start complaining that there is sdram free space for buffers
// Start complaining that there is SDRAM free space for buffers
START_SENDING_REQUESTS,

// Spinnaker requesting new buffers for spike source population
// SpiNNaker requesting new buffers for spike source population
SPINNAKER_REQUEST_BUFFERS,

// Buffers being sent from host to SpiNNaker
Expand Down
2 changes: 1 addition & 1 deletion c_common/front_end_common_lib/include/data_specification.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ address_t data_specification_get_data_address();
bool data_specification_read_header(address_t data_address);

//! \brief Gets the address of a region
//! \param[in] region the id of the region, starting at 0
//! \param[in] region the ID of the region, starting at 0
//! \param[in] data_address The address of the start of the data generated
//! \return The address of the specified region
address_t data_specification_get_region(
Expand Down
10 changes: 5 additions & 5 deletions c_common/front_end_common_lib/include/simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "common-typedefs.h"
#include <spin1_api.h>

// constant for how many dma ids you can use (caps the values of the tags as
// constant for how many DMA IDs you can use (caps the values of the tags as
// well)
#define MAX_DMA_CALLBACK_TAG 16

Expand Down Expand Up @@ -121,14 +121,14 @@ bool simulation_sdp_callback_on(
//| \param[in] sdp_port The SDP port to disable callbacks for
void simulation_sdp_callback_off(uint sdp_port);

//! \brief registers a dma transfer callback to the simulation system
//! \param[in] tag: the dma transfer tag to register against
//! \brief registers a DMA transfer callback to the simulation system
//! \param[in] tag: the DMA transfer tag to register against
//! \param[in] callback: the callback to register for the given tag
//! \return true if successful, false otherwise
bool simulation_dma_transfer_done_callback_on(uint tag, callback_t callback);

//! \brief turns off a registered callback for a given dma transfer done tag
//! \param[in] tag: the dma transfer tag to de-register
//! \brief turns off a registered callback for a given DMA transfer done tag
//! \param[in] tag: the DMA transfer tag to de-register
void simulation_dma_transfer_done_callback_off(uint tag);

#endif // _SIMULATION_H_
91 changes: 91 additions & 0 deletions c_common/front_end_common_lib/local.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SPINN_DIRS must be set for this file to be found

# APP_OUTPUT_DIR directory to save a and dict files to (none installed)
# APP_OUTPUT_DIR must end with /
ifndef APP_OUTPUT_DIR
$(error APP_OUTPUT_DIR is not set. Please define APP_OUTPUT_DIR)
endif

# APP name for a and dict files
ifndef APP
$(error APP is not set. Please define APP)
endif

# BUILD_DIR local directory to put o files into
ifndef BUILD_DIR
BUILD_DIR := build/
endif

# MODIFIED_DIR local directory to put modified c and h files into
ifndef MODIFIED_DIR
MODIFIED_DIR := modified_src/
endif

# SRC_DIR local directory where the raw c and h files are
ifndef SRC_DIR
SRC_DIR := src/
endif

# SOURCES one or more unmodified c files to build
# While these file will be in the SRC_DIR that will not be included in SOURCES
# SOURCES can be in sub directories of SRC_DIR in which case the sub directory is included
ifndef SOURCES
$(error SOURCES is not set. Please define SOURCES)
endif

# Convert the objs into the correct format to work here
_OBJS := $(SOURCES)
$(eval _OBJS := $(_OBJS:%.c=$(BUILD_DIR)%.o))
OBJECTS += $(_OBJS)

LIBRARIES += -lspinn_frontend_common -lspinn_common -lm
FEC_DEBUG := PRODUCTION_CODE
PROFILER := PROFILER_DISABLED

# Run md5sum on application name and extract first 8 bytes
SHELL = bash
APPLICATION_NAME_HASH = $(shell echo -n "$(APP)" | (md5sum 2>/dev/null || md5) | cut -c 1-8)

FEC_OPT = $(OTIME)
CFLAGS += -Wall -Wextra -D$(FEC_DEBUG) -D$(PROFILER) $(FEC_OPT) -DAPPLICATION_NAME_HASH=0x$(APPLICATION_NAME_HASH)

MODIFIED_DICT_FILE = $(MODIFIED_DIR)log_dict.dict

LOG_DICT_FILES += $(wildcard $(SPINN_DIRS)/lib/*.dict)
LOG_DICT_FILES += $(MODIFIED_DICT_FILE)
APP_DICT_FILE = $(APP_OUTPUT_DIR)$(APP).dict

ALL_TARGETS += $(APP_OUTPUT_DIR)$(APP).aplx $(APP_DICT_FILE)

# default rule based on list ALL_TARGETS so more main targets can be added later
all: $(ALL_TARGETS)

# All the c and h files built at the same time but individual rules needed for make chains
$(MODIFIED_DIR)%.c: $(SRC_DIR)%.c
python -m spinn_utilities.make_tools.convertor $(SRC_DIR) $(MODIFIED_DIR) $(MODIFIED_DICT_FILE)

$(MODIFIED_DIR)%.h: $(SRC_DIR)%.h
python -m spinn_utilities.make_tools.convertor $(SRC_DIR) $(MODIFIED_DIR) $(MODIFIED_DICT_FILE)

$(MODIFIED_DICT_FILE): $(SRC_DIR)
python -m spinn_utilities.make_tools.convertor $(SRC_DIR) $(MODIFIED_DIR) $(MODIFIED_DICT_FILE)

# Build the o files from the modified sources and any copied directories (if applicable)
$(BUILD_DIR)%.o: $(MODIFIED_DIR)%.c $(COPIED_DIRS)
# local
-mkdir -p $(dir $@)
$(CC) $(CFLAGS) -o $@ $<

include $(SPINN_DIRS)/make/spinnaker_tools.mk

$(APP_DICT_FILE): $(LOG_DICT_FILES)
# Add the two header lines once
head -2 $(firstword $(LOG_DICT_FILES)) > $(APP_DICT_FILE)
# Add the none header lines for each file remembering tail starts counting at 1
$(foreach ldf, $(LOG_DICT_FILES), tail -n +3 $(ldf) >> $(APP_DICT_FILE) ;)

# Tidy and cleaning dependencies
clean:
$(RM) $(TEMP_FILES) $(OBJECTS) $(BUILD_DIR)$(APP).elf $(BUILD_DIR)$(APP).txt $(ALL_TARGETS) $(LOG_DICT_FILE)
rm -rf $(MODIFIED_DIR)

2 changes: 1 addition & 1 deletion c_common/front_end_common_lib/src/data_specification.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool data_specification_read_header(uint32_t* address) {

//! \brief Returns the absolute SDRAM memory address for a given region value.
//!
//! \param[in] region The region id (between 0 and 15) to which the absolute
//! \param[in] region The region ID (between 0 and 15) to which the absolute
//! memory address in SDRAM is to be located
//! \param[in] data_address The absolute SDRAM address for the start of the
//! app_pointer table as created by the host DSE.
Expand Down
13 changes: 6 additions & 7 deletions c_common/front_end_common_lib/src/recording.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
extern void spin1_wfi();

// Standard includes
#include <string.h>
#include <debug.h>

enum recording_data_e {
Expand Down Expand Up @@ -49,7 +48,7 @@ typedef struct recording_channel_t {
// Globals
//---------------------------------------

//! circular queue for dma complete addresses
//! circular queue for DMA complete addresses
static circular_buffer dma_complete_buffer;

//! array containing all possible channels.
Expand Down Expand Up @@ -176,7 +175,7 @@ static inline void _recording_eieio_packet_handler(
break;

default:
log_debug("unhandled command id %d", pkt_command);
log_debug("unhandled command ID %d", pkt_command);
break;
}
}
Expand Down Expand Up @@ -487,7 +486,7 @@ bool recording_record(uint8_t channel, void *data, uint32_t size_bytes) {
return true;
}

//! brief this writes the state data to the regions
//! \brief this writes the state data to the regions
void _recording_buffer_state_data_write(){
for (uint32_t recording_region_id = 0;
recording_region_id < n_recording_regions;
Expand Down Expand Up @@ -550,7 +549,7 @@ void recording_finalise() {
}
}

//! \brief updates host read point as dma has finished
//! \brief updates host read point as DMA has finished
void _recording_dma_finished(uint unused, uint tag) {

// pop region and write pointer from circular queue
Expand All @@ -576,7 +575,7 @@ void _recording_dma_finished(uint unused, uint tag) {
bool recording_initialize(
address_t recording_data_address, uint32_t *recording_flags) {

// build dma address circular queue
// build DMA address circular queue
dma_complete_buffer = circular_buffer_initialize(DMA_QUEUE_SIZE * 4);

// Read in the parameters
Expand Down Expand Up @@ -667,7 +666,7 @@ bool recording_initialize(
// register the SDP handler
simulation_sdp_callback_on(sdp_port, _buffering_in_handler);

// register dma transfer done callback
// register DMA transfer done callback
simulation_dma_transfer_done_callback_on(
RECORDING_DMA_COMPLETE_TAG_ID, _recording_dma_finished);

Expand Down
12 changes: 6 additions & 6 deletions c_common/front_end_common_lib/src/simulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ static exit_callback_t stored_exit_function = NULL;
//! the function call to run just before resuming a simulation
static resume_callback_t stored_resume_function = NULL;

//! the region id for storing provenance data from the chip
//! the region ID for storing provenance data from the chip
static address_t stored_provenance_data_address = NULL;

//! the list of SDP callbacks for ports
static callback_t sdp_callback[NUM_SDP_PORTS];

//! the list of DMA callbacks for dma complete callbacks
//! the list of DMA callbacks for DMA complete callbacks
static callback_t dma_complete_callbacks[MAX_DMA_CALLBACK_TAG];

//! \brief handles the storing of basic provenance data
Expand Down Expand Up @@ -199,7 +199,7 @@ void _simulation_control_scp_callback(uint mailbox, uint port) {
}
}

//! \brief handles the sdp callbacks interface.
//! \brief handles the SDP callbacks interface.
void _simulation_sdp_callback_handler(uint mailbox, uint port) {

if (sdp_callback[port] != NULL) {
Expand All @@ -218,7 +218,7 @@ bool simulation_sdp_callback_on(uint sdp_port, callback_t callback) {
if (sdp_callback[sdp_port] == NULL) {
sdp_callback[sdp_port] = callback;
} else {
log_error("Cannot allocate sdp callback on port %d as its already "
log_error("Cannot allocate SDP callback on port %d as its already "
"been allocated.", sdp_port);
return false;
}
Expand All @@ -228,7 +228,7 @@ void simulation_sdp_callback_off(uint sdp_port) {
sdp_callback[sdp_port] = NULL;
}

//! \brief handles the dma transfer done callbacks interface.
//! \brief handles the DMA transfer done callbacks interface.
void _simulation_dma_transfer_done_callback(uint unused, uint tag) {
if (tag < MAX_DMA_CALLBACK_TAG && dma_complete_callbacks[tag] != NULL) {
dma_complete_callbacks[tag](unused, tag);
Expand All @@ -250,7 +250,7 @@ bool simulation_dma_transfer_done_callback_on(uint tag, callback_t callback) {
} else {

// if allocated already, raise error
log_error("Cannot allocate dma transfer callback on tag %d as its "
log_error("Cannot allocate DMA transfer callback on tag %d as its "
"already been allocated.", tag);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion c_common/models/chip_power_monitor/chip_power_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void reset_core_counters(void)
}

//! \brief the function to call when resuming a simulation
//! return None
//! \return None
void resume_callback() {
// change simulation ticks to be a number related to sampling frequency
simulation_ticks = (simulation_ticks * timer) / sample_frequency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <data_specification.h>
#include <debug.h>
#include <simulation.h>
#include <string.h>
#include <stdbool.h>

// Command structure
Expand Down Expand Up @@ -145,7 +144,7 @@ bool read_scheduled_parameters(address_t address) {
return false;
}

memcpy(
spin1_memcpy(
timed_commands, &address[START_OF_SCHEDULE],
n_timed_commands * sizeof(timed_command));

Expand All @@ -171,7 +170,7 @@ bool read_start_resume_commands(address_t address) {
log_error("Could not allocate the start/resume commands");
return false;
}
memcpy(
spin1_memcpy(
start_resume_commands, &address[START_OF_SCHEDULE],
n_start_resume_commands * sizeof(command));

Expand All @@ -194,7 +193,7 @@ bool read_pause_stop_commands(address_t address) {
log_error("Could not allocate the pause/stop commands");
return false;
}
memcpy(
spin1_memcpy(
pause_stop_commands, &address[START_OF_SCHEDULE],
n_pause_stop_commands * sizeof(command));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
#include <simulation.h>
#include <debug.h>

//! How many mc packets are to be received per sdp packet
//! How many multicast packets are to be received per SDP packet
#define ITEMS_PER_DATA_PACKET 68

//! first sequence number to use and reset to
#define FIRST_SEQ_NUM 0

//! extra length adjustment for the sdp header
//! extra length adjustment for the SDP header
#define LENGTH_OF_SDP_HEADER 8

//! convert between words to bytes
#define WORD_TO_BYTE_MULTIPLIER 4

//! struct for a SDP message with pure data, no scp header
//! struct for a SDP message with pure data, no SCP header
typedef struct sdp_msg_pure_data { // SDP message (=292 bytes)
struct sdp_msg *next; // Next in free list
uint16_t length; // length
Expand All @@ -31,7 +31,7 @@ typedef struct sdp_msg_pure_data { // SDP message (=292 bytes)
uint16_t dest_addr; // SDP destination address
uint16_t srce_addr; // SDP source address

// User data (272 bytes when no scp header)
// User data (272 bytes when no SCP header)
uint32_t data[ITEMS_PER_DATA_PACKET];

uint32_t _PAD; // Private padding
Expand All @@ -54,11 +54,11 @@ static uint32_t end_flag_key = 0;
static uint32_t seq_num = FIRST_SEQ_NUM;
static uint32_t max_seq_num = 0;

//! data holders for the sdp packet
//! data holders for the SDP packet
static uint32_t data[ITEMS_PER_DATA_PACKET];
static uint32_t position_in_store = 0;

//! sdp message holder for transmissions
//! SDP message holder for transmissions
sdp_msg_pure_data my_msg;


Expand Down
Loading

0 comments on commit 3c91f81

Please sign in to comment.