changeset 231:c0bf6157f67e mergingClockSync

Added some optimizations
author Giulio Moro <giuliomoro@yahoo.it>
date Sun, 10 Apr 2016 02:38:16 +0200
parents af211ee57867
children 600355cf4ed5
files Makefile core/PRU.cpp
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Apr 09 08:19:09 2016 +0100
+++ b/Makefile	Sun Apr 10 02:38:16 2016 +0200
@@ -8,7 +8,7 @@
 
 RM := rm -rf
 STATIC_LIBS := ./libprussdrv.a ./libNE10.a
-LIBS := -lrt -lnative -lxenomai -lsndfile
+LIBS := -lrt -lnative -lxenomai -lsndfile -lpd 
 
 INCLUDES := -I./include -I/usr/include/ne10 -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include -I/usr/arm-linux-gnueabihf/include/ne10
 
@@ -36,8 +36,8 @@
 DEFAULT_MAIN_OBJS := ./build/core/default_main.o
 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d
 
-CPP_FLAGS=-O2
-C_FLAGS=-O2
+CPP_FLAGS=-O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon --fast-math -ftree-vectorize 
+C_FLAGS=-O3 -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=neon --fast-math -ftree-vectorize 
 
 # all = build BeagleRT 
 all: SYNTAX_FLAG :=
--- a/core/PRU.cpp	Sat Apr 09 08:19:09 2016 +0100
+++ b/core/PRU.cpp	Sun Apr 10 02:38:16 2016 +0200
@@ -99,7 +99,7 @@
 const unsigned int PRU::kPruGPIOTestPin2 = 31;	// GPIO0(31); P9-13
 const unsigned int PRU::kPruGPIOTestPin3 = 26;	// GPIO0(26); P8-14
 
-extern bool gShouldStop;
+extern int gShouldStop;
 extern int gRTAudioVerbose;
 
 // Constructor: specify a PRU number (0 or 1)
@@ -561,12 +561,12 @@
 		// Convert short (16-bit) samples to float
 		// TODO: NEON
 		for(unsigned int n = 0; n < 2 * context->audioFrames; n++)
-			context->audioIn[n] = (float)pru_buffer_audio_adc[n + pru_audio_offset] / 32768.0;
+			context->audioIn[n] = (float)pru_buffer_audio_adc[n + pru_audio_offset] / 32768.0f;
 
 		if(analog_enabled) {
 			// TODO: NEON
 			for(unsigned int n = 0; n < context->analogChannels * context->analogFrames; n++)
-				context->analogIn[n] = (float)pru_buffer_spi_adc[n + pru_spi_offset] / 65536.0;
+				context->analogIn[n] = (float)pru_buffer_spi_adc[n + pru_spi_offset] / 65536.0f;
 
 			if(context->flags & BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST) {
 				// Initialize the output buffer with the values that were in the last frame of the previous output
@@ -614,7 +614,7 @@
 
 			// Convert float back to short for SPI output
 			for(unsigned int n = 0; n < context->analogChannels * context->analogFrames; n++) {
-				int out = context->analogOut[n] * 65536.0;
+				int out = context->analogOut[n] * 65536.0f;
 				if(out < 0) out = 0;
 				else if(out > 65535) out = 65535;
 				pru_buffer_spi_dac[n + pru_spi_offset] = (uint16_t)out;
@@ -630,7 +630,7 @@
         // Convert float back to short for audio
 		// TODO: NEON
 		for(unsigned int n = 0; n < 2 * context->audioFrames; n++) {
-			int out = context->audioOut[n] * 32768.0;
+			int out = context->audioOut[n] * 32768.0f;
 			if(out < -32768) out = -32768;
 			else if(out > 32767) out = 32767;
 			pru_buffer_audio_dac[n + pru_audio_offset] = (int16_t)out;