# HG changeset patch
# User andrewm
# Date 1423327316 0
# Node ID 901d205d1a3c52d9b12d93fd54a32fccd9e1fa9e
# Parent 06f93bef7dd20abaa955c9f44659cf23f73ff799
Updated to latest PRU library; external PRU file no longer needed. Also catch SIGTERM as well as SIGINT to clean up gracefully.
diff -r 06f93bef7dd2 -r 901d205d1a3c .cproject
--- a/.cproject Fri Jan 23 15:35:10 2015 +0000
+++ b/.cproject Sat Feb 07 16:41:56 2015 +0000
@@ -73,7 +73,7 @@
-
+
@@ -147,7 +147,7 @@
-
+
diff -r 06f93bef7dd2 -r 901d205d1a3c core/PRU.cpp
--- a/core/PRU.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/core/PRU.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -18,6 +18,7 @@
#include "../include/pruss_intc_mapping.h"
#include "../include/GPIOcontrol.h"
#include "../include/render.h"
+#include "../include/pru_rtaudio_bin.h"
#include
#include
@@ -249,7 +250,7 @@
/* Allocate and initialize memory */
prussdrv_init();
- if(prussdrv_open(PRU_EVTOUT_0)) {
+ if(prussdrv_open(pru_number == 0 ? PRU_EVTOUT_0 : PRU_EVTOUT_1)) {
rt_printf("Failed to open PRU driver\n");
return 1;
}
@@ -331,14 +332,17 @@
}
// Run the code image in the specified file
-int PRU::start(char * const filename)
+int PRU::start()
{
/* Clear any old interrupt */
- prussdrv_pru_clear_event(pru_number == 0 ? PRU0_ARM_INTERRUPT : PRU1_ARM_INTERRUPT);
+ if(pru_number == 0)
+ prussdrv_pru_clear_event(PRU_EVTOUT_0, PRU0_ARM_INTERRUPT);
+ else
+ prussdrv_pru_clear_event(PRU_EVTOUT_1, PRU1_ARM_INTERRUPT);
/* Load and execute binary on PRU */
- if(prussdrv_exec_program(pru_number, filename)) {
- rt_printf("Failed to execute PRU code from %s\n", filename);
+ if(prussdrv_exec_code(pru_number, PRUcode, sizeof(PRUcode))) {
+ rt_printf("Failed to execute PRU code\n");
return 1;
}
@@ -450,8 +454,11 @@
{
if(!running)
return;
- prussdrv_pru_wait_event (PRU_EVTOUT_0);
- prussdrv_pru_clear_event(pru_number == 0 ? PRU0_ARM_INTERRUPT : PRU1_ARM_INTERRUPT);
+ prussdrv_pru_wait_event (pru_number == 0 ? PRU_EVTOUT_0 : PRU_EVTOUT_1);
+ if(pru_number == 0)
+ prussdrv_pru_clear_event(PRU_EVTOUT_0, PRU0_ARM_INTERRUPT);
+ else
+ prussdrv_pru_clear_event(PRU_EVTOUT_1, PRU1_ARM_INTERRUPT);
}
// Turn off the PRU when done
diff -r 06f93bef7dd2 -r 901d205d1a3c core/RTAudio.cpp
--- a/core/RTAudio.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/core/RTAudio.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -57,7 +57,6 @@
// general settings
int gRTAudioVerbose = 0; // Verbosity level for debugging
-char gPRUFilename[256] = "pru_rtaudio.bin"; // path to PRU binary file
int gAmplifierMutePin = -1;
int gAmplifierShouldBeginMuted = 0;
@@ -209,8 +208,8 @@
gShouldStop = 1;
}
else {
- if(gPRU->start(gPRUFilename)) {
- rt_printf("Error: unable to start PRU from file %s\n", gPRUFilename);
+ if(gPRU->start()) {
+ rt_printf("Error: unable to start PRU\n");
gShouldStop = 1;
}
else {
diff -r 06f93bef7dd2 -r 901d205d1a3c include/PRU.h
--- a/include/PRU.h Fri Jan 23 15:35:10 2015 +0000
+++ b/include/PRU.h Sat Feb 07 16:41:56 2015 +0000
@@ -36,8 +36,8 @@
int initialise(int pru_num, int frames_per_buffer, int spi_channels,
bool xenomai_test_pin = false);
- // Run the code image in the specified file
- int start(char * const filename);
+ // Run the code image in pru_rtaudio_bin.h
+ int start();
// Loop: read and write data from the PRU
void loop();
diff -r 06f93bef7dd2 -r 901d205d1a3c include/pru_rtaudio_bin.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/pru_rtaudio_bin.h Sat Feb 07 16:41:56 2015 +0000
@@ -0,0 +1,531 @@
+
+
+/* This file contains the PRU instructions in a C array which are to */
+/* be downloaded from the host CPU to the PRU instruction memory. */
+/* This file is generated by the PRU assembler. */
+
+const unsigned int PRUcode[] = {
+ 0x240002c3,
+ 0x24202083,
+ 0x240000e2,
+ 0xe1002382,
+ 0x240002c3,
+ 0x24202883,
+ 0x240120e2,
+ 0xe1002382,
+ 0x240001d9,
+ 0x24000099,
+ 0x244803da,
+ 0x2401009a,
+ 0x244803dd,
+ 0x2480009d,
+ 0x91042480,
+ 0x1d04e0e0,
+ 0x81042480,
+ 0x240000f8,
+ 0x240008e9,
+ 0xf1243982,
+ 0x5100e202,
+ 0x1f01f8f8,
+ 0xc901f868,
+ 0xf1283989,
+ 0x6108e903,
+ 0x240008e9,
+ 0x79000005,
+ 0x6104e903,
+ 0x240004e9,
+ 0x79000002,
+ 0x240002e9,
+ 0x240002e2,
+ 0x2444e0c3,
+ 0x24004c83,
+ 0xe1002382,
+ 0x240002e2,
+ 0xe1103a82,
+ 0xf1143a82,
+ 0xcf00e2ff,
+ 0x240000e2,
+ 0xe1343a82,
+ 0xe1483a82,
+ 0x240000e2,
+ 0xe1283a82,
+ 0x241801c2,
+ 0x240fc582,
+ 0xe12c3a82,
+ 0x241801c2,
+ 0x24078482,
+ 0xe1403a82,
+ 0x240001e2,
+ 0xe1343a82,
+ 0xe1483a82,
+ 0x240700c2,
+ 0x24000082,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471909c,
+ 0xe1003c9b,
+ 0xe1383a82,
+ 0xf1303a9b,
+ 0xcf00fbff,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471949c,
+ 0xe1003c9b,
+ 0xf13c3a9b,
+ 0x24f120e2,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1909c,
+ 0xe1003c9b,
+ 0xe14c3a82,
+ 0xf1443a9b,
+ 0xcf00fbff,
+ 0xf1503a82,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1949c,
+ 0xe1003c9b,
+ 0x240800c2,
+ 0x24000182,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471909c,
+ 0xe1003c9b,
+ 0xe1383a82,
+ 0xf1303a9b,
+ 0xcf00fbff,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471949c,
+ 0xe1003c9b,
+ 0xf13c3a9b,
+ 0x24f120e2,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1909c,
+ 0xe1003c9b,
+ 0xe14c3a82,
+ 0xf1443a9b,
+ 0xcf00fbff,
+ 0xf1503a82,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1949c,
+ 0xe1003c9b,
+ 0x24f320e2,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1909c,
+ 0xe1003c9b,
+ 0xe14c3a82,
+ 0xf1443a9b,
+ 0xcf00fbff,
+ 0xf1503a82,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1949c,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0xe1443d9b,
+ 0x240000fb,
+ 0x240180fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x240184fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x240188fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x24018cfc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x240190fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x240194fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240002fb,
+ 0xe1043d9b,
+ 0x240000fb,
+ 0xe1103d9b,
+ 0x240800db,
+ 0x2400049b,
+ 0xe1143d9b,
+ 0x240000fb,
+ 0xe14c3d9b,
+ 0x240000fb,
+ 0xe1503d9b,
+ 0x24fffffb,
+ 0xe1643d9b,
+ 0x24807cfb,
+ 0xe1683d9b,
+ 0x240100fb,
+ 0xe16c3d9b,
+ 0x240080fb,
+ 0xe1703d9b,
+ 0x248001fb,
+ 0xe1743d9b,
+ 0x240003fb,
+ 0xe1783d9b,
+ 0x240000fb,
+ 0xe17c3d9b,
+ 0x24fffffb,
+ 0xe1a43d9b,
+ 0x24807cfb,
+ 0xe1a83d9b,
+ 0x240100fb,
+ 0xe1ac3d9b,
+ 0x240000fb,
+ 0xe1b03d9b,
+ 0x248001fb,
+ 0xe1b43d9b,
+ 0x240003fb,
+ 0xe1b83d9b,
+ 0x240000fb,
+ 0xe1bc3d9b,
+ 0x240002fb,
+ 0x240180fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240001fb,
+ 0x240188fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x241000fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240000fb,
+ 0x241008fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x2400fffb,
+ 0xe1c03d9b,
+ 0x2400fffb,
+ 0xe1803d9b,
+ 0x240002fb,
+ 0xf1603d9c,
+ 0x12fbfcfc,
+ 0xe1603d9c,
+ 0xf1603d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240200fb,
+ 0xf1a03d9c,
+ 0x12fbfcfc,
+ 0xe1a03d9c,
+ 0xf1a03d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x241000c2,
+ 0x24000082,
+ 0x244804c3,
+ 0x24c19483,
+ 0xe1002382,
+ 0x240001c2,
+ 0x2486a082,
+ 0x0501e2e2,
+ 0x6f00e2ff,
+ 0x241000c2,
+ 0x24000082,
+ 0x244804c3,
+ 0x24c19083,
+ 0xe1002382,
+ 0x240001fb,
+ 0xf1603d9c,
+ 0x12fbfcfc,
+ 0xe1603d9c,
+ 0xf1603d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240100fb,
+ 0xf1a03d9c,
+ 0x12fbfcfc,
+ 0xe1a03d9c,
+ 0xf1a03d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240004fb,
+ 0xf1603d9c,
+ 0x12fbfcfc,
+ 0xe1603d9c,
+ 0xf1603d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240400fb,
+ 0xf1a03d9c,
+ 0x12fbfcfc,
+ 0xe1a03d9c,
+ 0xf1a03d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240008fb,
+ 0xf1603d9c,
+ 0x12fbfcfc,
+ 0xe1603d9c,
+ 0xf1603d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240800fb,
+ 0xf1a03d9c,
+ 0x12fbfcfc,
+ 0xe1a03d9c,
+ 0xf1a03d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x240000fb,
+ 0x240208fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0x240010fb,
+ 0xf1603d9c,
+ 0x12fbfcfc,
+ 0xe1603d9c,
+ 0xf1603d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0x241000fb,
+ 0xf1a03d9c,
+ 0x12fbfcfc,
+ 0xe1a03d9c,
+ 0xf1a03d9c,
+ 0x10fbfcfc,
+ 0x5700fcfe,
+ 0xf108398b,
+ 0x240000f0,
+ 0x0901ebf1,
+ 0x2701e9e2,
+ 0x08e2f1f1,
+ 0x240000f4,
+ 0x08e2ebf5,
+ 0x1d00f8f8,
+ 0x240000e2,
+ 0xe1203982,
+ 0xf1c03d82,
+ 0xcf05e2ff,
+ 0x240000fb,
+ 0x240208fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0xf1803d82,
+ 0xcf05e2ff,
+ 0x240280fc,
+ 0x00fcfdfc,
+ 0xf1003c82,
+ 0x10f0f0f2,
+ 0x2701e9e2,
+ 0x08e2ebf3,
+ 0x0902f3f3,
+ 0x00f2f3f3,
+ 0x10f4f4f6,
+ 0x08e2ebf7,
+ 0x0901f7f7,
+ 0x02f6f7f7,
+ 0x240000ea,
+ 0x240000e1,
+ 0xc901f805,
+ 0x90f2388c,
+ 0x240000e2,
+ 0x80f23882,
+ 0x0104f2f2,
+ 0xd102f808,
+ 0x90f63c8e,
+ 0x240000e2,
+ 0x80f63c82,
+ 0x0104f6f6,
+ 0x24ffffe2,
+ 0x10e2eee7,
+ 0x79000002,
+ 0x0b10eee7,
+ 0xf1c03d82,
+ 0xcf05e2ff,
+ 0x10e7e7fb,
+ 0x240208fc,
+ 0x00fcfdfc,
+ 0xe1003c9b,
+ 0xd102f80a,
+ 0x240000ef,
+ 0xf1803d82,
+ 0xcf05e2ff,
+ 0x240280fc,
+ 0x00fcfdfc,
+ 0xf1003c83,
+ 0x24ffffe2,
+ 0x10e2e3ef,
+ 0x7900000a,
+ 0xf1803d82,
+ 0xcf05e2ff,
+ 0x240280fc,
+ 0x00fcfdfc,
+ 0xf1003c83,
+ 0x0910e3e3,
+ 0x12e3efef,
+ 0x80f73c8f,
+ 0x0104f7f7,
+ 0xc901f85c,
+ 0x24ffffe2,
+ 0x10e2ece7,
+ 0x0904e7e7,
+ 0x240300c8,
+ 0x24000088,
+ 0x12e8e7e7,
+ 0x0914e1e8,
+ 0x12e8e7e7,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471909c,
+ 0xe1003c9b,
+ 0xe1383a87,
+ 0xf1303a9b,
+ 0xcf00fbff,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471949c,
+ 0xe1003c9b,
+ 0xf13c3a9b,
+ 0x240000ed,
+ 0x0102e1e8,
+ 0x0501e9e7,
+ 0x10e7e8e8,
+ 0x0909e8e8,
+ 0x24f120e7,
+ 0x12e8e7e7,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1909c,
+ 0xe1003c9b,
+ 0xe14c3a87,
+ 0xf1443a9b,
+ 0xcf00fbff,
+ 0xf1503a87,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1949c,
+ 0xe1003c9b,
+ 0x24ffffe2,
+ 0x10e2e7ed,
+ 0x0101e1e1,
+ 0x0b10ece7,
+ 0x0904e7e7,
+ 0x240300c8,
+ 0x24000088,
+ 0x12e8e7e7,
+ 0x0914e1e8,
+ 0x12e8e7e7,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471909c,
+ 0xe1003c9b,
+ 0xe1383a87,
+ 0xf1303a9b,
+ 0xcf00fbff,
+ 0x240020fb,
+ 0x2444e0dc,
+ 0x2471949c,
+ 0xe1003c9b,
+ 0xf13c3a9b,
+ 0x0102e1e8,
+ 0x0501e9e7,
+ 0x10e7e8e8,
+ 0x0909e8e8,
+ 0x24f120e7,
+ 0x12e8e7e7,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1909c,
+ 0xe1003c9b,
+ 0xe14c3a87,
+ 0xf1443a9b,
+ 0xcf00fbff,
+ 0xf1503a87,
+ 0x240001db,
+ 0x2400009b,
+ 0x244804dc,
+ 0x24c1949c,
+ 0xe1003c9b,
+ 0x0910e7e7,
+ 0x12e7eded,
+ 0x80f3388d,
+ 0x0104f3f3,
+ 0x1504f8f8,
+ 0x0101e1e1,
+ 0x6ee9e17f,
+ 0x79000004,
+ 0x1504f8f8,
+ 0x0102e1e1,
+ 0x6ee9e17b,
+ 0x0101eaea,
+ 0x6eebea78,
+ 0x10f0f0e2,
+ 0x10f1f1f0,
+ 0x10e2e2f1,
+ 0x10f4f4e2,
+ 0x10f5f5f4,
+ 0x10e2e2f5,
+ 0x1501f8f8,
+ 0x1101f8e2,
+ 0xe1043982,
+ 0xf1203982,
+ 0x00ebe2e2,
+ 0xe1203982,
+ 0xf1183983,
+ 0x5100e30d,
+ 0x241000e1,
+ 0x10e1e2e2,
+ 0x5100e206,
+ 0xf11c3982,
+ 0x240194e1,
+ 0x00e1e3e3,
+ 0xe1002382,
+ 0x79000005,
+ 0xf11c3982,
+ 0x240190e1,
+ 0x00e1e3e3,
+ 0xe1002382,
+ 0xc900f807,
+ 0x241000c2,
+ 0x24000082,
+ 0x244804c3,
+ 0x24c19483,
+ 0xe1002382,
+ 0x79000006,
+ 0x241000c2,
+ 0x24000082,
+ 0x244804c3,
+ 0x24c19083,
+ 0xe1002382,
+ 0xf1003982,
+ 0x5700e246,
+ 0x240000fb,
+ 0xe1443d9b,
+ 0xc901f80c,
+ 0x244803c3,
+ 0x24012c83,
+ 0xf1002382,
+ 0x1d0de2e2,
+ 0x1d1be2e2,
+ 0xe1002382,
+ 0x244803c3,
+ 0x24013483,
+ 0xf1002382,
+ 0x1d01e2e2,
+ 0xe1002382,
+ 0x2400231f,
+ 0x2a000000 };
+
diff -r 06f93bef7dd2 -r 901d205d1a3c include/pruss_intc_mapping.h
--- a/include/pruss_intc_mapping.h Fri Jan 23 15:35:10 2015 +0000
+++ b/include/pruss_intc_mapping.h Sat Feb 07 16:41:56 2015 +0000
@@ -1,37 +1,37 @@
/*
* pruss_intc_mapping.h
- *
+ *
* Example PRUSS INTC mapping for the application
*
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
* are met:
*
- * Redistributions of source code must retain the above copyright
+ * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -96,7 +96,7 @@
#define PRUSS_INTC_INITDATA { \
-{ PRU0_PRU1_INTERRUPT, PRU1_PRU0_INTERRUPT, PRU0_ARM_INTERRUPT, PRU1_ARM_INTERRUPT, ARM_PRU0_INTERRUPT, ARM_PRU1_INTERRUPT, -1 }, \
+{ PRU0_PRU1_INTERRUPT, PRU1_PRU0_INTERRUPT, PRU0_ARM_INTERRUPT, PRU1_ARM_INTERRUPT, ARM_PRU0_INTERRUPT, ARM_PRU1_INTERRUPT, (char)-1 }, \
{ {PRU0_PRU1_INTERRUPT,CHANNEL1}, {PRU1_PRU0_INTERRUPT, CHANNEL0}, {PRU0_ARM_INTERRUPT,CHANNEL2}, {PRU1_ARM_INTERRUPT, CHANNEL3}, {ARM_PRU0_INTERRUPT, CHANNEL0}, {ARM_PRU1_INTERRUPT, CHANNEL1}, {-1,-1}}, \
{ {CHANNEL0,PRU0}, {CHANNEL1, PRU1}, {CHANNEL2, PRU_EVTOUT0}, {CHANNEL3, PRU_EVTOUT1}, {-1,-1} }, \
(PRU0_HOSTEN_MASK | PRU1_HOSTEN_MASK | PRU_EVTOUT0_HOSTEN_MASK | PRU_EVTOUT1_HOSTEN_MASK) /*Enable PRU0, PRU1, PRU_EVTOUT0 */ \
diff -r 06f93bef7dd2 -r 901d205d1a3c include/prussdrv.h
--- a/include/prussdrv.h Fri Jan 23 15:35:10 2015 +0000
+++ b/include/prussdrv.h Sat Feb 07 16:41:56 2015 +0000
@@ -1,37 +1,37 @@
/*
* prussdrv.h
- *
+ *
* Describes PRUSS userspace driver for Industrial Communications
*
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
* are met:
*
- * Redistributions of source code must retain the above copyright
+ * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -49,7 +49,6 @@
#define _PRUSSDRV_H
#include
-#include
#if defined (__cplusplus)
extern "C" {
@@ -65,6 +64,9 @@
#define PRUSS0_PRU0_IRAM 2
#define PRUSS0_PRU1_IRAM 3
+#define PRUSS_V1 1 // AM18XX
+#define PRUSS_V2 2 // AM33XX
+
//Available in AM33xx series - begin
#define PRUSS0_SHARED_DATARAM 4
#define PRUSS0_CFG 5
@@ -84,7 +86,6 @@
#define PRU_EVTOUT_6 6
#define PRU_EVTOUT_7 7
- typedef void *(*prussdrv_function_handler) (void *);
typedef struct __sysevt_to_channel_map {
short sysevt;
short channel;
@@ -103,56 +104,98 @@
//Channel to Host map.Channels -Range: 0..9 HOSTs - Range:0..9
//{-1, -1} indicates end of list
tchannel_to_host_map channel_to_host_map[NUM_PRU_CHANNELS];
- //10-bit mask - Enable Host0-Host9 {Host0/1:PRU0/1, Host2..9 : PRUEVT_OUT0..7)
+ //10-bit mask - Enable Host0-Host9 {Host0/1:PRU0/1, Host2..9 : PRUEVT_OUT0..7}
unsigned int host_enable_bitmask;
} tpruss_intc_initdata;
int prussdrv_init(void);
- int prussdrv_open(unsigned int pru_evtout_num);
+ int prussdrv_open(unsigned int host_interrupt);
+
+ /** Return version of PRU. This must be called after prussdrv_open. */
+ int prussdrv_version();
+
+ /** Return string description of PRU version. */
+ const char* prussdrv_strversion(int version);
int prussdrv_pru_reset(unsigned int prunum);
int prussdrv_pru_disable(unsigned int prunum);
int prussdrv_pru_enable(unsigned int prunum);
+ int prussdrv_pru_enable_at(unsigned int prunum, size_t addr);
int prussdrv_pru_write_memory(unsigned int pru_ram_id,
unsigned int wordoffset,
- unsigned int *memarea,
+ const unsigned int *memarea,
unsigned int bytelength);
- int prussdrv_pruintc_init(tpruss_intc_initdata * prussintc_init_data);
+ int prussdrv_pruintc_init(const tpruss_intc_initdata *prussintc_init_data);
+
+ /** Find and return the channel a specified event is mapped to.
+ * Note that this only searches for the first channel mapped and will not
+ * detect error cases where an event is mapped erroneously to multiple
+ * channels.
+ * @return channel-number to which a system event is mapped.
+ * @return -1 for no mapping found
+ */
+ short prussdrv_get_event_to_channel_map( unsigned int eventnum );
+
+ /** Find and return the host interrupt line a specified channel is mapped
+ * to. Note that this only searches for the first host interrupt line
+ * mapped and will not detect error cases where a channel is mapped
+ * erroneously to multiple host interrupt lines.
+ * @return host-interrupt-line to which a channel is mapped.
+ * @return -1 for no mapping found
+ */
+ short prussdrv_get_channel_to_host_map( unsigned int channel );
+
+ /** Find and return the host interrupt line a specified event is mapped
+ * to. This first finds the intermediate channel and then the host.
+ * @return host-interrupt-line to which a system event is mapped.
+ * @return -1 for no mapping found
+ */
+ short prussdrv_get_event_to_host_map( unsigned int eventnum );
int prussdrv_map_l3mem(void **address);
int prussdrv_map_extmem(void **address);
+ unsigned int prussdrv_extmem_size(void);
+
int prussdrv_map_prumem(unsigned int pru_ram_id, void **address);
int prussdrv_map_peripheral_io(unsigned int per_id, void **address);
- unsigned int prussdrv_get_phys_addr(void *address);
+ unsigned int prussdrv_get_phys_addr(const void *address);
void *prussdrv_get_virt_addr(unsigned int phyaddr);
- int prussdrv_pru_wait_event(unsigned int pru_evtout_num);
+ /** Wait for the specified host interrupt.
+ * @return the number of times the event has happened. */
+ unsigned int prussdrv_pru_wait_event(unsigned int host_interrupt);
+
+ int prussdrv_pru_event_fd(unsigned int host_interrupt);
int prussdrv_pru_send_event(unsigned int eventnum);
- int prussdrv_pru_clear_event(unsigned int eventnum);
+ /** Clear the specified event and re-enable the host interrupt. */
+ int prussdrv_pru_clear_event(unsigned int host_interrupt,
+ unsigned int sysevent);
int prussdrv_pru_send_wait_clear_event(unsigned int send_eventnum,
- unsigned int pru_evtout_num,
+ unsigned int host_interrupt,
unsigned int ack_eventnum);
int prussdrv_exit(void);
- int prussdrv_exec_program(int prunum, char *filename);
+ int prussdrv_exec_program(int prunum, const char *filename);
+ int prussdrv_exec_program_at(int prunum, const char *filename, size_t addr);
- int prussdrv_start_irqthread(unsigned int pru_evtout_num, int priority,
- prussdrv_function_handler irqhandler);
-
+ int prussdrv_exec_code(int prunum, const unsigned int *code, int codelen);
+ int prussdrv_exec_code_at(int prunum, const unsigned int *code, int codelen, size_t addr);
+ int prussdrv_load_data(int prunum, const unsigned int *code, int codelen);
+ int prussdrv_load_datafile(int prunum, const char *filename);
#if defined (__cplusplus)
}
diff -r 06f93bef7dd2 -r 901d205d1a3c libprussdrv.a
Binary file libprussdrv.a has changed
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/audio_in_FFT/main.cpp
--- a/projects/audio_in_FFT/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/audio_in_FFT/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -79,8 +79,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/basic/main.cpp
--- a/projects/basic/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/basic/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -77,8 +77,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/basic_analog_output/main.cpp
--- a/projects/basic_analog_output/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/basic_analog_output/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -84,8 +84,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/basic_passthru/main.cpp
--- a/projects/basic_passthru/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/basic_passthru/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -71,8 +71,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/basic_sensor/main.cpp
--- a/projects/basic_sensor/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/basic_sensor/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -97,8 +97,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/d-box/DboxSensors.cpp
--- a/projects/d-box/DboxSensors.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/d-box/DboxSensors.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -13,14 +13,14 @@
-int DboxSensors::initSensors(int tk0_bus, int tk0_address, int tk1_bus, int tk1_address, int tk_file, int fsr_pin, int fsrmax, bool useNewSensors, int gpio_0, int gpio_1)
+int DboxSensors::initSensors(int tk0_bus, int tk0_address, int tk1_bus, int tk1_address, int tk_file, int fsr_pin, int fsrmax, int sensorTypeToUse, int gpio_0, int gpio_1)
{
- newSensors = useNewSensors;
+ sensorType = sensorTypeToUse;
// init first touch key on i2c bus
if(tk0_address >= 0) {
if(TK0.initI2C_RW(tk0_bus, tk0_address, tk_file)>0)
return 1;
- if(TK0.initTouchKey(newSensors)>0)
+ if(TK0.initTouchKey(sensorType)>0)
return 2;
}
@@ -28,7 +28,7 @@
if(tk1_address >= 0) {
if(TK1.initI2C_RW(tk1_bus, tk1_address, tk_file)>0)
return 1;
- if(TK1.initTouchKey(newSensors)>0)
+ if(TK1.initTouchKey(sensorType)>0)
return 2;
}
@@ -77,7 +77,7 @@
int max = 3;
- if(newSensors)
+ if(sensorType != kSensorTypeTouchKey)
max = 5;
// if touches detected on main touch key
if(tk0_touchCnt == 0 && tk1_touchCnt == 0)
@@ -131,7 +131,7 @@
void DboxSensors::resetSensorsData()
{
int max = 3;
- if(newSensors)
+ if(sensorType != kSensorTypeTouchKey)
max = 5;
for(int i=0; i 2 || sensorType < 0)
+ sensorType = 2;
+
+ numBytesToRead = kSensorBytes[sensorType];
char buf[3] = { 0x00, 0x01, 0x00 }; // code for centroid mode
if(write(i2C_file, buf, 3) !=3)
@@ -44,7 +47,11 @@
usleep(5000); // need to give TouchKey enough time to process command
- buf[0] = 0x06; // code for data collection
+ if(sensorType == kSensorTypeDBox2)
+ buf[0] = 0x04; // code for data collection
+ else
+ buf[0] = 0x06; // code for data collection
+
if(write(i2C_file, buf, 1) !=1)
{
cout << "Failed to prepare data collection " << endl;
@@ -75,39 +82,52 @@
touchCount = 0;
- rawSliderPosition[0] = (((dataBuffer[0] & 0xF0) << 4) + dataBuffer[1]);
- rawSliderPosition[1] = (((dataBuffer[0] & 0x0F) << 8) + dataBuffer[2]);
- rawSliderPosition[2] = (((dataBuffer[3] & 0xF0) << 4) + dataBuffer[4]);
-
// Old TouchKeys sensors have 3 touch locations plus horizontal positions
// New D-Box sensors have 5 touch locations but no horizontal position
- if(newSensor)
- {
+ // Later D-Box sensors have same data in a different format
+ if(sensorType == kSensorTypeDBox1) {
+ rawSliderPosition[0] = (((dataBuffer[0] & 0xF0) << 4) + dataBuffer[1]);
+ rawSliderPosition[1] = (((dataBuffer[0] & 0x0F) << 8) + dataBuffer[2]);
+ rawSliderPosition[2] = (((dataBuffer[3] & 0xF0) << 4) + dataBuffer[4]);
rawSliderPosition[3] = (((dataBuffer[5] & 0xF0) << 4) + dataBuffer[6]);
rawSliderPosition[4] = (((dataBuffer[5] & 0x0F) << 8) + dataBuffer[7]);
rawSliderPositionH = 0x0FFF;
}
- else
- {
+ else if(sensorType == kSensorTypeDBox2) {
+ rawSliderPosition[0] = ((dataBuffer[0] << 8) + dataBuffer[1]) & 0x0FFF;
+ rawSliderPosition[1] = ((dataBuffer[2] << 8) + dataBuffer[3]) & 0x0FFF;
+ rawSliderPosition[2] = ((dataBuffer[4] << 8) + dataBuffer[5]) & 0x0FFF;
+ rawSliderPosition[3] = ((dataBuffer[6] << 8) + dataBuffer[7]) & 0x0FFF;
+ rawSliderPosition[4] = ((dataBuffer[8] << 8) + dataBuffer[9]) & 0x0FFF;
+ rawSliderPositionH = 0x0FFF;
+ }
+ else {
+ rawSliderPosition[0] = (((dataBuffer[0] & 0xF0) << 4) + dataBuffer[1]);
+ rawSliderPosition[1] = (((dataBuffer[0] & 0x0F) << 8) + dataBuffer[2]);
+ rawSliderPosition[2] = (((dataBuffer[3] & 0xF0) << 4) + dataBuffer[4]);
rawSliderPosition[3] = 0x0FFF;
rawSliderPosition[4] = 0x0FFF;
rawSliderPositionH = (((dataBuffer[3] & 0x0F) << 8) + dataBuffer[5]);
}
-
for(int i = 0; i < 5; i++)
{
if(rawSliderPosition[i] != 0x0FFF) // 0x0FFF means no touch
{
- //sliderPosition[i] = (float)rawSliderPosition[i] / 1536.0; // Black keys, vertical (128 * 12)
- //sliderPosition[i] = (float)rawSliderPosition[i] / 768.0; // Cute white key, for simple instrument
- if(newSensor)
+ if(sensorType != kSensorTypeTouchKey)
sliderPosition[i] = (float)rawSliderPosition[i] / 3200.0; // New sensors; 26 pads (128 * 25)
else
sliderPosition[i] = (float)rawSliderPosition[i] / 2432.0; // White keys, vertical (128 * 19)
- if(sliderPosition[i]>1.0)
+
+ if(sliderPosition[i] > 1.0)
sliderPosition[i] = 1.0;
- if(newSensor)
+
+ if(sensorType == kSensorTypeDBox2) {
+ sliderSize[i] = (float)((dataBuffer[2*i + 10] << 8) + dataBuffer[2*i + 11]) / 5000.0;
+ if(sliderSize[i] > 1.0)
+ sliderSize[i] = 1.0;
+ }
+ else if(sensorType == kSensorTypeDBox1)
sliderSize[i] = (float)dataBuffer[i + 8] / 255.0;
else {
if(i < 3)
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/d-box/I2c_TouchKey.h
--- a/projects/d-box/I2c_TouchKey.h Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/d-box/I2c_TouchKey.h Sat Feb 07 16:41:56 2015 +0000
@@ -10,18 +10,28 @@
#include "../../include/I2c.h"
-#define NUM_BYTES_OLD 9
-#define NUM_BYTES_NEW 13
+// #define NUM_BYTES_OLD 9
+// #define NUM_BYTES_NEW 13
+
+#define MAX_SENSOR_BYTES 20
+
+enum {
+ kSensorTypeTouchKey = 0,
+ kSensorTypeDBox1 = 1,
+ kSensorTypeDBox2 = 2
+};
+
+static const int kSensorBytes[3] = {9, 13, 20};
class I2c_TouchKey : public I2c
{
private:
bool isReady;
- bool newSensor;
+ int sensorType;
int numBytesToRead;
// read NUM_BYTES bytes, which have to be properly parsed
- char dataBuffer[NUM_BYTES_NEW];
+ char dataBuffer[MAX_SENSOR_BYTES];
int bytesRead;
int rawSliderPosition[5];
@@ -34,7 +44,7 @@
public:
- int initTouchKey(bool useNewSensor = false);
+ int initTouchKey(int sensorTypeToUse = kSensorTypeTouchKey);
int readI2C();
int getTouchCount();
float * getSlidersize();
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/d-box/main.cpp
--- a/projects/d-box/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/d-box/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -71,7 +71,7 @@
int touchSensor0Address = 0x0C; // I2C addresses of touch sensors
int touchSensor1Address = 0x0B;
-bool useNewSensors = false;
+int sensorType = 0;
char sdPath[256] = "/dev/mmcblk0p2"; // system path of the SD, partition 2
char mountPath[256] = "/root/d-box/usersounds"; // mount point of SD partition 2 [where user files are]
@@ -275,7 +275,7 @@
{"file", 1, NULL, 'f'},
{"keyboard", 1, NULL, 'k'},
{"audio-test", 0, NULL, 'T'},
- {"new-sensors", 0, NULL, 'S'},
+ {"sensor-type", 1, NULL, 'S'},
{"sensor0", 1, NULL, 'Q'},
{"sensor1", 1, NULL, 'R'},
{"log", 1, NULL, 'l'},
@@ -293,7 +293,7 @@
while (1)
{
int c;
- if ((c = BeagleRT_getopt_long(args.argc, args.argv, "hf:ki:sTQ:R:Sl:u:o:n:g:", long_option, settings)) < 0)
+ if ((c = BeagleRT_getopt_long(args.argc, args.argv, "hf:ki:sTQ:R:S:l:u:o:n:g:", long_option, settings)) < 0)
break;
switch (c)
{
@@ -317,7 +317,7 @@
useAudioTest = true;
break;
case 'S':
- useNewSensors = true;
+ sensorType = atoi(optarg);
break;
case 'Q':
touchSensor0Address = atoi(optarg);
@@ -396,7 +396,7 @@
free(gPartialFilename);
if(!useAudioTest) {
- if(initSensorLoop(touchSensor0Address, touchSensor1Address, useNewSensors) != 0)
+ if(initSensorLoop(touchSensor0Address, touchSensor1Address, sensorType) != 0)
return -1;
}
@@ -450,8 +450,9 @@
}
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// load all other files into oscBanks
loadAudioFiles(false);
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/d-box/sensors.cpp
--- a/projects/d-box/sensors.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/d-box/sensors.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -56,7 +56,7 @@
using namespace std;
-int initSensorLoop(int sensorAddress0, int sensorAddress1, bool useNewSensors)
+int initSensorLoop(int sensorAddress0, int sensorAddress1, int sensorType)
{
int tk0_bus = 1;
int tk0_address = sensorAddress0;
@@ -69,7 +69,7 @@
if(gVerbose==1)
cout << "---------------->Init Control Thread" << endl;
- if(Sensors.initSensors(tk0_bus, tk0_address, tk1_bus, tk1_address, tk_file, fsr_pinNum, fsr_max, useNewSensors)>0)
+ if(Sensors.initSensors(tk0_bus, tk0_address, tk1_bus, tk1_address, tk_file, fsr_pinNum, fsr_max, sensorType)>0)
{
gShouldStop = 1;
cout << "control cannot start" << endl;
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/d-box/sensors.h
--- a/projects/d-box/sensors.h Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/d-box/sensors.h Sat Feb 07 16:41:56 2015 +0000
@@ -10,7 +10,7 @@
#include "config.h"
-int initSensorLoop(int sensorAddress0, int sensorAddress1, bool useNewSensors);
+int initSensorLoop(int sensorAddress0, int sensorAddress1, int sensorType);
void sensorLoop(void *);
void *keyboardLoop(void *);
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/filter_FIR/main.cpp
--- a/projects/filter_FIR/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/filter_FIR/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -158,8 +158,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/filter_IIR/main.cpp
--- a/projects/filter_IIR/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/filter_IIR/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -164,8 +164,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/oscillator_bank/main.cpp
--- a/projects/oscillator_bank/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/oscillator_bank/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -96,8 +96,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/samples/main.cpp
--- a/projects/samples/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/samples/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -158,8 +158,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {
diff -r 06f93bef7dd2 -r 901d205d1a3c projects/tank_wars/main.cpp
--- a/projects/tank_wars/main.cpp Fri Jan 23 15:35:10 2015 +0000
+++ b/projects/tank_wars/main.cpp Sat Feb 07 16:41:56 2015 +0000
@@ -82,8 +82,9 @@
return -1;
}
- // Set up interrupt handler to catch Control-C
+ // Set up interrupt handler to catch Control-C and SIGTERM
signal(SIGINT, interrupt_handler);
+ signal(SIGTERM, interrupt_handler);
// Run until told to stop
while(!gShouldStop) {