kopia lustrzana https://github.com/F5OEO/WsprryPi
Further spring cleaning. Removed some messages from mailbox.c.
rodzic
6e0b8f85d6
commit
1e3547e180
|
@ -52,7 +52,7 @@ using namespace std;
|
||||||
// Choose proper base address depending on RPI1/RPI2 setting from makefile.
|
// Choose proper base address depending on RPI1/RPI2 setting from makefile.
|
||||||
#ifdef RPI2
|
#ifdef RPI2
|
||||||
#define BCM2708_PERI_BASE 0x3f000000
|
#define BCM2708_PERI_BASE 0x3f000000
|
||||||
#pragma message "Raspberry Pi 2 detected."
|
#pragma message "Raspberry Pi 2/3 detected."
|
||||||
#else
|
#else
|
||||||
#define BCM2708_PERI_BASE 0x20000000
|
#define BCM2708_PERI_BASE 0x20000000
|
||||||
#pragma message "Raspberry Pi 1 detected."
|
#pragma message "Raspberry Pi 1 detected."
|
||||||
|
|
|
@ -247,7 +247,7 @@ int mbox_open() {
|
||||||
// Open a char device file used for communicating with kernel mbox driver.
|
// Open a char device file used for communicating with kernel mbox driver.
|
||||||
file_desc = open(DEVICE_FILE_NAME, 0);
|
file_desc = open(DEVICE_FILE_NAME, 0);
|
||||||
if(file_desc >= 0) {
|
if(file_desc >= 0) {
|
||||||
printf("Using mbox device " DEVICE_FILE_NAME ".\n");
|
//printf("Using mbox device " DEVICE_FILE_NAME ".\n");
|
||||||
return file_desc;
|
return file_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,14 +255,14 @@ int mbox_open() {
|
||||||
unlink(LOCAL_DEVICE_FILE_NAME);
|
unlink(LOCAL_DEVICE_FILE_NAME);
|
||||||
if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_A, 0)) >= 0 &&
|
if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_A, 0)) >= 0 &&
|
||||||
(file_desc = open(LOCAL_DEVICE_FILE_NAME, 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;
|
return file_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(LOCAL_DEVICE_FILE_NAME);
|
unlink(LOCAL_DEVICE_FILE_NAME);
|
||||||
if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_B, 0)) >= 0 &&
|
if(mknod(LOCAL_DEVICE_FILE_NAME, S_IFCHR|0600, makedev(MAJOR_NUM_B, 0)) >= 0 &&
|
||||||
(file_desc = open(LOCAL_DEVICE_FILE_NAME, 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;
|
return file_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define MAJOR_NUM_B 100
|
#define MAJOR_NUM_B 100
|
||||||
#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM_B, 0, char *)
|
#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM_B, 0, char *)
|
||||||
#define DEVICE_FILE_NAME "/dev/vcio"
|
#define DEVICE_FILE_NAME "/dev/vcio"
|
||||||
#define LOCAL_DEVICE_FILE_NAME "mbox"
|
#define LOCAL_DEVICE_FILE_NAME "/tmp/mbox"
|
||||||
|
|
||||||
int mbox_open();
|
int mbox_open();
|
||||||
void mbox_close(int file_desc);
|
void mbox_close(int file_desc);
|
||||||
|
|
4
makefile
4
makefile
|
@ -5,10 +5,10 @@ pi_version_flag = $(if $(call archis,armv7,dummy-text),-DRPI2,-DRPI1)
|
||||||
|
|
||||||
all: wspr gpioclk
|
all: wspr gpioclk
|
||||||
|
|
||||||
mailbox.o:
|
mailbox.o: mailbox.c mailbox.h
|
||||||
g++ -c -Wall -lm mailbox.c
|
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
|
g++ -Wall -lm $(pi_version_flag) mailbox.o wspr.cpp -owspr
|
||||||
|
|
||||||
gpioclk: gpioclk.cpp
|
gpioclk: gpioclk.cpp
|
||||||
|
|
17
wspr.cpp
17
wspr.cpp
|
@ -74,7 +74,7 @@ using namespace std;
|
||||||
#ifdef RPI2
|
#ifdef RPI2
|
||||||
#define BCM2708_PERI_BASE 0x3f000000
|
#define BCM2708_PERI_BASE 0x3f000000
|
||||||
#define MEM_FLAG 0x04
|
#define MEM_FLAG 0x04
|
||||||
#pragma message "Raspberry Pi 2 detected."
|
#pragma message "Raspberry Pi 2/3 detected."
|
||||||
#else
|
#else
|
||||||
#define BCM2708_PERI_BASE 0x20000000
|
#define BCM2708_PERI_BASE 0x20000000
|
||||||
#define MEM_FLAG 0x0c
|
#define MEM_FLAG 0x0c
|
||||||
|
@ -670,7 +670,8 @@ void print_usage() {
|
||||||
cout << " -p --ppm ppm" << endl;
|
cout << " -p --ppm ppm" << endl;
|
||||||
cout << " Known PPM correction to 19.2MHz RPi nominal crystal frequency." << endl;
|
cout << " Known PPM correction to 19.2MHz RPi nominal crystal frequency." << endl;
|
||||||
cout << " -s --self-calibration" << 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 << " -r --repeat" << endl;
|
||||||
cout << " Repeatedly, and in order, transmit on all the specified command line freqs." << endl;
|
cout << " Repeatedly, and in order, transmit on all the specified command line freqs." << endl;
|
||||||
cout << " -x --terminate <n>" << endl;
|
cout << " -x --terminate <n>" << endl;
|
||||||
|
@ -680,7 +681,7 @@ void print_usage() {
|
||||||
cout << " +/- " << WSPR_RAND_OFFSET << " Hz for WSPR" << endl;
|
cout << " +/- " << WSPR_RAND_OFFSET << " Hz for WSPR" << endl;
|
||||||
cout << " +/- " << WSPR15_RAND_OFFSET << " Hz for WSPR-15" << endl;
|
cout << " +/- " << WSPR15_RAND_OFFSET << " Hz for WSPR-15" << endl;
|
||||||
cout << " -t --test-tone freq" << 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 << " for debugging and to verify calibration." << endl;
|
||||||
cout << " -n --no-delay" << endl;
|
cout << " -n --no-delay" << endl;
|
||||||
cout << " Transmit immediately, do not wait for a WSPR TX window. Used" << endl;
|
cout << " Transmit immediately, do not wait for a WSPR TX window. Used" << endl;
|
||||||
|
@ -911,7 +912,8 @@ void parse_commandline(
|
||||||
cout << temp.str();
|
cout << temp.str();
|
||||||
temp.str("");
|
temp.str("");
|
||||||
if (self_cal) {
|
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) {
|
} else if (ppm) {
|
||||||
temp << " PPM value to be used for all transmissions: " << ppm << endl;
|
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[]) {
|
int main(const int argc, char * const argv[]) {
|
||||||
|
atexit(unlinkmbox);
|
||||||
|
|
||||||
// Initialize the RNG
|
// Initialize the RNG
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue