--- a/mb_master.c Sun Mar 05 00:05:46 2017 +0000
+++ b/mb_master.c Sat Mar 18 15:46:04 2017 +0000
@@ -374,16 +374,16 @@
/* FUNCTION 0x01 - Read Coils
* Bits are stored on an int array, one bit per int.
-inline int read_output_bits(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex) {
+int read_output_bits(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex) { if( count > MAX_READ_BITS ) {
@@ -402,14 +402,14 @@
* Bits are stored on an u32 array, 32 bits per u32.
* Unused bits in last u32 are set to 0.
-inline int read_output_bits_u32(u8 slave,
- const struct timespec *response_timeout) {
+int read_output_bits_u32(u8 slave, + const struct timespec *response_timeout) { if( count > MAX_READ_BITS ) {
@@ -426,16 +426,16 @@
/* FUNCTION 0x02 - Read Discrete Inputs
* Bits are stored on an int array, one bit per int.
-inline int read_input_bits(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex) {
+int read_input_bits(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex) { if( count > MAX_READ_BITS ) {
@@ -454,14 +454,14 @@
* Bits are stored on an u32 array, 32 bits per u32.
* Unused bits in last u32 are set to 0.
-inline int read_input_bits_u32(u8 slave,
- const struct timespec *response_timeout) {
+int read_input_bits_u32(u8 slave, + const struct timespec *response_timeout) { if( count > MAX_READ_BITS ) {
@@ -657,16 +657,16 @@
/* FUNCTION 0x03 - Read Holding Registers */
-inline int read_output_words(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex) {
+int read_output_words(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex) { if( count > MAX_READ_REGS ) {
@@ -686,14 +686,14 @@
* u16 registers are stored in array of u32, two registers per u32.
* Unused bits of last u32 element are set to 0.
-inline int read_output_words_u32(u8 slave,
- const struct timespec *response_timeout) {
+int read_output_words_u32(u8 slave, + const struct timespec *response_timeout) { if( count > MAX_READ_REGS ) {
@@ -712,14 +712,14 @@
/* FUNCTION 0x03 - Read Holding Registers
* return the array with the data to the calling function
-inline int read_output_words_u16_ref(u8 slave,
- const struct timespec *response_timeout) {
+int read_output_words_u16_ref(u8 slave, + const struct timespec *response_timeout) { if( count > MAX_READ_REGS ) {
@@ -736,16 +736,16 @@
/* FUNCTION 0x04 - Read Input Registers */
-inline int read_input_words(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex) {
+int read_input_words(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex) { if( count > MAX_READ_REGS ) {
@@ -763,14 +763,14 @@
* u16 registers are stored in array of u32, two registers per u32.
* Unused bits of last u32 element are set to 0.
-inline int read_input_words_u32(u8 slave,
- const struct timespec *response_timeout) {
+int read_input_words_u32(u8 slave, + const struct timespec *response_timeout) { if( count > MAX_READ_REGS ) {
@@ -789,14 +789,14 @@
/* FUNCTION 0x04 - Read Input Registers
* return the array with the data to the calling function
-inline int read_input_words_u16_ref(u8 slave,
- const struct timespec *response_timeout) {
+int read_input_words_u16_ref(u8 slave, + const struct timespec *response_timeout) { if( count > MAX_READ_REGS ) {
@@ -852,14 +852,14 @@
/* FUNCTION 0x05 - Force Single Coil */
-inline int write_output_bit(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex) {
+int write_output_bit(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex) { if (state) state = 0xFF00;
return set_single(0x05 /* function */,
@@ -872,14 +872,14 @@
/* FUNCTION 0x06 - Write Single Register */
-inline int write_output_word(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex) {
+int write_output_word(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex) { return set_single(0x06 /* function */,
slave, reg_addr, value, fd, send_retries,
error_code, response_timeout, data_access_mutex);
--- a/mb_master.h Sun Mar 05 00:05:46 2017 +0000
+++ b/mb_master.h Sat Mar 18 15:46:04 2017 +0000
@@ -53,16 +53,16 @@
/* FUNCTION 0x01 - Read Coils
* Bits are stored on an int array, one bit per int.
-inline int read_output_bits(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex);
+int read_output_bits(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex); #define read_coils(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
read_output_bits(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
@@ -71,14 +71,14 @@
* Bits are stored on an u32 array, 32 bits per u32.
* Unused bits in last u32 are set to 0.
-inline int read_output_bits_u32(u8 slave,
- const struct timespec *response_timeout);
+int read_output_bits_u32(u8 slave, + const struct timespec *response_timeout); #define read_coils_u32(p1,p2,p3,p4,p5,p6,p7,p8) \
read_output_bits_u32(p1,p2,p3,p4,p5,p6,p7,p8)
@@ -88,16 +88,16 @@
/* FUNCTION 0x02 - Read Discrete Inputs
* Bits are stored on an int array, one bit per int.
-inline int read_input_bits(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex);
+int read_input_bits(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex); #define read_discrete_inputs(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
read_input_bits (p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
@@ -106,14 +106,14 @@
* Bits are stored on an u32 array, 32 bits per u32.
* Unused bits in last u32 are set to 0.
-inline int read_input_bits_u32(u8 slave,
- const struct timespec *response_timeout);
+int read_input_bits_u32(u8 slave, + const struct timespec *response_timeout); #define read_discrete_inputs_u32(p1,p2,p3,p4,p5,p6,p7,p8) \
read_input_bits_u32 (p1,p2,p3,p4,p5,p6,p7,p8)
@@ -121,16 +121,16 @@
/* FUNCTION 0x03 - Read Holding Registers */
-inline int read_output_words(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex);
+int read_output_words(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex); #define read_holding_registers(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
read_output_words (p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
@@ -139,14 +139,14 @@
* u16 registers are stored in array of u32, two registers per u32.
* Unused bits of last u32 element are set to 0.
-inline int read_output_words_u32(u8 slave,
- const struct timespec *response_timeout);
+int read_output_words_u32(u8 slave, + const struct timespec *response_timeout); #define read_holding_registers_u32(p1,p2,p3,p4,p5,p6,p7,p8) \
read_output_words_u32 (p1,p2,p3,p4,p5,p6,p7,p8)
@@ -154,30 +154,30 @@
/* FUNCTION 0x03 - Read Holding Registers
* return the array with the data to the calling function
-inline int read_output_words_u16_ref(u8 slave,
- const struct timespec *response_timeout);
+int read_output_words_u16_ref(u8 slave, + const struct timespec *response_timeout); #define read_holding_registers_u16_ref(p1,p2,p3,p4,p5,p6,p7,p8) \
read_output_words_u16_ref (p1,p2,p3,p4,p5,p6,p7,p8)
/* FUNCTION 0x04 - Read Input Registers */
-inline int read_input_words(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex);
+int read_input_words(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex); #define read_input_registers(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
read_input_words (p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
@@ -187,14 +187,14 @@
* u16 registers are stored in array of u32, two registers per u32.
* Unused bits of last u32 element are set to 0.
-inline int read_input_words_u32(u8 slave,
- const struct timespec *response_timeout);
+int read_input_words_u32(u8 slave, + const struct timespec *response_timeout); #define read_input_registers_u32(p1,p2,p3,p4,p5,p6,p7,p8) \
read_input_words_u32 (p1,p2,p3,p4,p5,p6,p7,p8)
@@ -203,14 +203,14 @@
/* FUNCTION 0x04 - Read Input Registers
* return the array with the data to the calling function
-inline int read_input_words_u16_ref(u8 slave,
- const struct timespec *response_timeout);
+int read_input_words_u16_ref(u8 slave, + const struct timespec *response_timeout); #define read_input_registers_u16_ref(p1,p2,p3,p4,p5,p6,p7,p8) \
read_input_words_u16_ref (p1,p2,p3,p4,p5,p6,p7,p8)
@@ -218,14 +218,14 @@
/* FUNCTION 0x05 - Force Single Coil */
-inline int write_output_bit(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex);
+int write_output_bit(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex); #define force_single_coil(p1,p2,p3,p4,p5,p6,p7,p8) \
write_output_bit (p1,p2,p3,p4,p5,p6,p7,p8)
@@ -235,14 +235,14 @@
/* FUNCTION 0x06 - Write Single Register */
-inline int write_output_word(u8 slave,
- const struct timespec *response_timeout,
- pthread_mutex_t *data_access_mutex);
+int write_output_word(u8 slave, + const struct timespec *response_timeout, + pthread_mutex_t *data_access_mutex); #define write_single_register(p1,p2,p3,p4,p5,p6,p7,p8) \
write_output_word (p1,p2,p3,p4,p5,p6,p7,p8)