diff --git a/amplifiers/elecraft/kpa1500.c b/amplifiers/elecraft/kpa1500.c index 0c2773456..bcdbed910 100644 --- a/amplifiers/elecraft/kpa1500.c +++ b/amplifiers/elecraft/kpa1500.c @@ -28,7 +28,6 @@ #include "register.h" #include "kpa.h" -#include "hamlib/port.h" struct kpa_priv_data *kpa1500_priv; diff --git a/amplifiers/gemini/dx1200.c b/amplifiers/gemini/dx1200.c index f13aee6e2..b1738485e 100644 --- a/amplifiers/gemini/dx1200.c +++ b/amplifiers/gemini/dx1200.c @@ -28,7 +28,6 @@ #include "register.h" #include "gemini.h" -#include "hamlib/port.h" struct gemini_priv_data *gemini_priv; /* diff --git a/include/hamlib/port.h b/include/hamlib/port.h index cec85912e..2fa175b45 100644 --- a/include/hamlib/port.h +++ b/include/hamlib/port.h @@ -178,15 +178,7 @@ typedef hamlib_port_t_deprecated port_t_deprecated; typedef hamlib_port_t port_t; #endif -#if defined(IN_HAMLIB) -/* These are for internal use only */ -#define RIGPORT(r) (&(r)->state.rigport) -#define PTTPORT(r) (&(r)->state.pttport) -#define DCDPORT(r) (&(r)->state.dcdport) -#define AMPPORT(a) (&(a)->state.ampport) -#define ROTPORT(r) (&(r)->state.rotport) -#define ROTPORT2(r) (&(r)->state.rotport2) -#endif +// Macros for app access to hamlib_port_t data #define HAMLIB_RIGPORT(r) ((hamlib_port_t *)rig_data_pointer((r), RIG_PTRX_RIGPORT)) #define HAMLIB_PTTPORT(r) ((hamlib_port_t *)rig_data_pointer((r), RIG_PTRX_PTTPORT)) #define HAMLIB_DCDPORT(r) ((hamlib_port_t *)rig_data_pointer((r), RIG_PTRX_DCDPORT)) diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index b33f505ac..7c0d39424 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2385,13 +2385,13 @@ __BEGIN_DECLS // Note: Experimental, and subject to change!! #if defined(IN_HAMLIB) /* These are for internal use only */ -//Moved to include/hamlib/port.h #define RIGPORT(r) (&r->state.rigport) -// " " " #define PTTPORT(r) (&r->state.pttport) -// " " " #define DCDPORT(r) (&r->state.dcdport) +#define RIGPORT(r) (&(r)->state.rigport) +#define PTTPORT(r) (&(r)->state.pttport) +#define DCDPORT(r) (&(r)->state.dcdport) //Moved to src/cache.h #define CACHE(r) ((r)->cache_addr) -//Moved to include/hamlib/port.h #define AMPPORT(a) (&a->state.ampport) -// " " " #define ROTPORT(r) (&r->state.rotport) -// " " " #define ROTPORT2(r) (&r->state.rotport2) +#define AMPPORT(a) (&(a)->state.ampport) +#define ROTPORT(r) (&(r)->state.rotport) +#define ROTPORT2(r) (&(r)->state.rotport2) //Moved to include/hamlib/rig_state.h #define STATE(r) (&r->state) //Moved to include/hamlib/amp_state.h #define AMPSTATE(a) (&(a)->state) //Moved to include/hamlib/rot_state.h #define ROTSTATE(r) (&(r)->state) diff --git a/rotators/amsat/if100.c b/rotators/amsat/if100.c index 3094a940a..d9c2e73e3 100644 --- a/rotators/amsat/if100.c +++ b/rotators/amsat/if100.c @@ -27,7 +27,6 @@ #endif #include -#include "hamlib/port.h" #include "hamlib/rot_state.h" #include "parallel.h" #include "register.h" diff --git a/rotators/apex/apex.c b/rotators/apex/apex.c index 956088378..04f803f05 100644 --- a/rotators/apex/apex.c +++ b/rotators/apex/apex.c @@ -1,5 +1,4 @@ #include -#include "hamlib/port.h" #include #include "iofunc.h" #include "register.h" diff --git a/rotators/apex/sharedloop.c b/rotators/apex/sharedloop.c index 6490aeefd..5fa8eb865 100644 --- a/rotators/apex/sharedloop.c +++ b/rotators/apex/sharedloop.c @@ -2,7 +2,6 @@ #include #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "iofunc.h" #include "apex.h" diff --git a/rotators/ars/ars.c b/rotators/ars/ars.c index 928cbcf7c..795aa0f53 100644 --- a/rotators/ars/ars.c +++ b/rotators/ars/ars.c @@ -32,7 +32,6 @@ #endif #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "hamlib/rot_state.h" #include "parallel.h" #include "misc.h" diff --git a/rotators/easycomm/easycomm.c b/rotators/easycomm/easycomm.c index 7bb0cac9f..4af5cb217 100644 --- a/rotators/easycomm/easycomm.c +++ b/rotators/easycomm/easycomm.c @@ -26,7 +26,6 @@ #include /* String function definitions */ #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "hamlib/rot_state.h" #include "serial.h" #include "register.h" diff --git a/rotators/ether6/ether6.c b/rotators/ether6/ether6.c index aeffa6bf3..a4c2a6de4 100644 --- a/rotators/ether6/ether6.c +++ b/rotators/ether6/ether6.c @@ -25,7 +25,6 @@ #include /* String function definitions */ #include -#include "hamlib/port.h" #include "hamlib/rot_state.h" #include "serial.h" #include "register.h" diff --git a/rotators/fodtrack/fodtrack.c b/rotators/fodtrack/fodtrack.c index 0b31ac70c..455a40eb3 100644 --- a/rotators/fodtrack/fodtrack.c +++ b/rotators/fodtrack/fodtrack.c @@ -32,7 +32,6 @@ #endif #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "hamlib/rot_state.h" #include "parallel.h" #include "misc.h" diff --git a/rotators/ioptron/rot_ioptron.c b/rotators/ioptron/rot_ioptron.c index b19d40db0..c4899952d 100644 --- a/rotators/ioptron/rot_ioptron.c +++ b/rotators/ioptron/rot_ioptron.c @@ -24,7 +24,6 @@ #include #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "serial.h" #include "register.h" diff --git a/rotators/radant/radant.c b/rotators/radant/radant.c index 10a457a79..b8203ef1f 100644 --- a/rotators/radant/radant.c +++ b/rotators/radant/radant.c @@ -26,7 +26,6 @@ #include /* String function definitions */ #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "serial.h" #include "misc.h" #include "register.h" diff --git a/rotators/saebrtrack/saebrtrack.c b/rotators/saebrtrack/saebrtrack.c index 25a9cb689..4baa4a8f9 100644 --- a/rotators/saebrtrack/saebrtrack.c +++ b/rotators/saebrtrack/saebrtrack.c @@ -29,7 +29,6 @@ #include /* String function definitions */ #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "serial.h" #include "register.h" diff --git a/rotators/satel/satel.c b/rotators/satel/satel.c index 024ac35a9..aa90d8db7 100644 --- a/rotators/satel/satel.c +++ b/rotators/satel/satel.c @@ -28,7 +28,6 @@ #include #include "hamlib/rotator.h" -#include "hamlib/port.h" #include "serial.h" #include "register.h" diff --git a/src/gpio.c b/src/gpio.c index e5fcfb597..385cc41ee 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -27,6 +27,7 @@ #include #include "gpio.h" +#include "hamlib/port.h" int gpio_open(hamlib_port_t *port, int output, int on_value) diff --git a/src/iofunc.c b/src/iofunc.c index 956d56c25..a6998869c 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -42,7 +42,7 @@ #include #include -#include +#include "hamlib/port.h" #include "iofunc.h" #include "misc.h" diff --git a/src/network.c b/src/network.c index 3404eaeb5..ceea68921 100644 --- a/src/network.c +++ b/src/network.c @@ -74,6 +74,7 @@ #endif #include +#include "hamlib/port.h" #include "hamlib/rig_state.h" #include "network.h" #include "misc.h" diff --git a/src/parallel.c b/src/parallel.c index 56478434e..e3fba4b6e 100644 --- a/src/parallel.c +++ b/src/parallel.c @@ -58,6 +58,7 @@ # include #endif +#include "hamlib/port.h" #include "parallel.h" #ifdef HAVE_LINUX_PPDEV_H diff --git a/src/usb_port.c b/src/usb_port.c index bd89b0a18..1a3d687c8 100644 --- a/src/usb_port.c +++ b/src/usb_port.c @@ -40,6 +40,7 @@ #include #include +#include "hamlib/port.h" #ifdef HAVE_LIBUSB_H # include