diff --git a/gpioclk.cpp b/gpioclk.cpp index 7391d7b..915e062 100644 --- a/gpioclk.cpp +++ b/gpioclk.cpp @@ -52,7 +52,7 @@ using namespace std; // Choose proper base address depending on RPI1/RPI2 setting from makefile. #ifdef RPI2 #define BCM2708_PERI_BASE 0x3f000000 -#pragma message "Raspberry Pi 2 detected." +#pragma message "Raspberry Pi 2/3 detected." #else #define BCM2708_PERI_BASE 0x20000000 #pragma message "Raspberry Pi 1 detected." diff --git a/mailbox.c b/mailbox.c index a04b38d..8336eba 100644 --- a/mailbox.c +++ b/mailbox.c @@ -247,7 +247,7 @@ int mbox_open() { // Open a char device file used for communicating with kernel mbox driver. file_desc = open(DEVICE_FILE_NAME, 0); if(file_desc >= 0) { - printf("Using mbox device " DEVICE_FILE_NAME ".\n"); + //printf("Using mbox device " DEVICE_FILE_NAME ".\n"); return file_desc; } @@ -255,14 +255,14 @@ int mbox_open() { unlink(LOCAL_DEVICE_FILE_NAME); if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_A, 0)) >= 0 && (file_desc = open(LOCAL_DEVICE_FILE_NAME, 0)) >= 0) { - printf("Using local mbox device file with major %d.\n", MAJOR_NUM_A); + //printf("Using local mbox device file with major %d.\n", MAJOR_NUM_A); return file_desc; } unlink(LOCAL_DEVICE_FILE_NAME); if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_B, 0)) >= 0 && (file_desc = open(LOCAL_DEVICE_FILE_NAME, 0)) >= 0) { - printf("Using local mbox device file with major %d.\n", MAJOR_NUM_B); + //printf("Using local mbox device file with major %d.\n", MAJOR_NUM_B); return file_desc; } diff --git a/mailbox.h b/mailbox.h index 80bacb0..d1e49f2 100644 --- a/mailbox.h +++ b/mailbox.h @@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define MAJOR_NUM_B 100 #define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM_B, 0, char *) #define DEVICE_FILE_NAME "/dev/vcio" -#define LOCAL_DEVICE_FILE_NAME "mbox" +#define LOCAL_DEVICE_FILE_NAME "/tmp/mbox" int mbox_open(); void mbox_close(int file_desc); diff --git a/makefile b/makefile index dac7964..da3fafc 100644 --- a/makefile +++ b/makefile @@ -5,10 +5,10 @@ pi_version_flag = $(if $(call archis,armv7,dummy-text),-DRPI2,-DRPI1) all: wspr gpioclk -mailbox.o: +mailbox.o: mailbox.c mailbox.h g++ -c -Wall -lm mailbox.c -wspr: mailbox.o wspr.cpp +wspr: mailbox.o wspr.cpp mailbox.h g++ -Wall -lm $(pi_version_flag) mailbox.o wspr.cpp -owspr gpioclk: gpioclk.cpp diff --git a/wspr.cpp b/wspr.cpp index 3ffc169..e0f121e 100644 --- a/wspr.cpp +++ b/wspr.cpp @@ -74,7 +74,7 @@ using namespace std; #ifdef RPI2 #define BCM2708_PERI_BASE 0x3f000000 #define MEM_FLAG 0x04 -#pragma message "Raspberry Pi 2 detected." +#pragma message "Raspberry Pi 2/3 detected." #else #define BCM2708_PERI_BASE 0x20000000 #define MEM_FLAG 0x0c @@ -670,7 +670,8 @@ void print_usage() { cout << " -p --ppm ppm" << endl; cout << " Known PPM correction to 19.2MHz RPi nominal crystal frequency." << endl; cout << " -s --self-calibration" << endl; - cout << " Call ntp_adjtime() before every transmission to obtain the PPM error of the crystal." << endl; + cout << " Call ntp_adjtime() before every transmission to obtain the PPM error of the" << endl; + cout << " crystal." << endl; cout << " -r --repeat" << endl; cout << " Repeatedly, and in order, transmit on all the specified command line freqs." << endl; cout << " -x --terminate " << endl; @@ -680,7 +681,7 @@ void print_usage() { cout << " +/- " << WSPR_RAND_OFFSET << " Hz for WSPR" << endl; cout << " +/- " << WSPR15_RAND_OFFSET << " Hz for WSPR-15" << endl; cout << " -t --test-tone freq" << endl; - cout << " Simply output a test tone and the specified frequency. Only used" << endl; + cout << " Simply output a test tone at the specified frequency. Only used" << endl; cout << " for debugging and to verify calibration." << endl; cout << " -n --no-delay" << endl; cout << " Transmit immediately, do not wait for a WSPR TX window. Used" << endl; @@ -911,7 +912,8 @@ void parse_commandline( cout << temp.str(); temp.str(""); if (self_cal) { - temp << " ntp_adjtime() will be used to peridocially calibrate the transmission frequency" << endl; + temp << " ntp_adjtime() will be used to peridocially calibrate the transmission" << endl; + temp << " frequency" << endl; } else if (ppm) { temp << " PPM value to be used for all transmissions: " << ppm << endl; } @@ -1004,7 +1006,14 @@ void open_mbox() } } +void unlinkmbox() { + unlink(DEVICE_FILE_NAME); + unlink(LOCAL_DEVICE_FILE_NAME); +}; + int main(const int argc, char * const argv[]) { + atexit(unlinkmbox); + // Initialize the RNG srand(time(NULL));