| 1 | /* |
| 2 | * Copyright © Stéphane Raimbault <[email protected]> |
| 3 | * |
| 4 | * SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef MODBUS_Hcxx . . $ `src/modbus.h:8:9`! |
| 8 | #define MODBUS_Hcxx . . $ `src/modbus.h:8:9`! |
| 9 | |
| 10 | // clang-format off |
| 11 | /* Add this for macros that defined unix flavor */ |
| 12 | #if (defined(__unix__cxx . . $ `<built-in>:395:9`!) || defined(unixcxx . . $ `<built-in>:395:9`!)) && !defined(USG) |
| 13 | # include <sys/param.h> |
| 14 | #endif |
| 15 | |
| 16 | #ifndef _MSC_VER |
| 17 | # include <stdint.h> |
| 18 | #else |
| 19 | # include "stdint.h" |
| 20 | #endif |
| 21 | |
| 22 | #include "modbus-version.h"cxx . . $ `<file>/src/modbus-version.h`/ |
| 23 | |
| 24 | #if defined(_MSC_VER) |
| 25 | # if defined(DLLBUILD) |
| 26 | /* define DLLBUILD when building the DLL */ |
| 27 | # define MODBUS_API __declspec(dllexport) |
| 28 | # else |
| 29 | # define MODBUS_API __declspec(dllimport) |
| 30 | # endif |
| 31 | #else |
| 32 | # define MODBUS_APIcxx . . $ `src/modbus.h:32:10`! |
| 33 | #endif |
| 34 | |
| 35 | #ifdef __cplusplus |
| 36 | # define MODBUS_BEGIN_DECLS extern "C" { |
| 37 | # define MODBUS_END_DECLS } |
| 38 | #else |
| 39 | # define MODBUS_BEGIN_DECLScxx . . $ `src/modbus.h:39:10`! |
| 40 | # define MODBUS_END_DECLScxx . . $ `src/modbus.h:40:10`! |
| 41 | #endif |
| 42 | // clang-format on |
| 43 | |
| 44 | MODBUS_BEGIN_DECLScxx . . $ `src/modbus.h:39:10`! |
| 45 | |
| 46 | #ifndef FALSE |
| 47 | #define FALSEcxx . . $ `src/modbus.h:47:9`! 0 |
| 48 | #endif |
| 49 | |
| 50 | #ifndef TRUE |
| 51 | #define TRUEcxx . . $ `src/modbus.h:51:9`! 1 |
| 52 | #endif |
| 53 | |
| 54 | #ifndef OFF |
| 55 | #define OFFcxx . . $ `src/modbus.h:55:9`! 0 |
| 56 | #endif |
| 57 | |
| 58 | #ifndef ON |
| 59 | #define ONcxx . . $ `src/modbus.h:59:9`! 1 |
| 60 | #endif |
| 61 | |
| 62 | /* Modbus function codes */ |
| 63 | #define MODBUS_FC_READ_COILScxx . . $ `src/modbus.h:63:9`! 0x01 |
| 64 | #define MODBUS_FC_READ_DISCRETE_INPUTScxx . . $ `src/modbus.h:64:9`! 0x02 |
| 65 | #define MODBUS_FC_READ_HOLDING_REGISTERScxx . . $ `src/modbus.h:65:9`! 0x03 |
| 66 | #define MODBUS_FC_READ_INPUT_REGISTERScxx . . $ `src/modbus.h:66:9`! 0x04 |
| 67 | #define MODBUS_FC_WRITE_SINGLE_COILcxx . . $ `src/modbus.h:67:9`! 0x05 |
| 68 | #define MODBUS_FC_WRITE_SINGLE_REGISTERcxx . . $ `src/modbus.h:68:9`! 0x06 |
| 69 | #define MODBUS_FC_READ_EXCEPTION_STATUScxx . . $ `src/modbus.h:69:9`! 0x07 |
| 70 | #define MODBUS_FC_WRITE_MULTIPLE_COILScxx . . $ `src/modbus.h:70:9`! 0x0F |
| 71 | #define MODBUS_FC_WRITE_MULTIPLE_REGISTERScxx . . $ `src/modbus.h:71:9`! 0x10 |
| 72 | #define MODBUS_FC_REPORT_SLAVE_IDcxx . . $ `src/modbus.h:72:9`! 0x11 |
| 73 | #define MODBUS_FC_MASK_WRITE_REGISTERcxx . . $ `src/modbus.h:73:9`! 0x16 |
| 74 | #define MODBUS_FC_WRITE_AND_READ_REGISTERScxx . . $ `src/modbus.h:74:9`! 0x17 |
| 75 | |
| 76 | #define MODBUS_BROADCAST_ADDRESScxx . . $ `src/modbus.h:76:9`! 0 |
| 77 | |
| 78 | /* Modbus_Application_Protocol_V1_1b.pdf (chapter 6 section 1 page 12) |
| 79 | * Quantity of Coils to read (2 bytes): 1 to 2000 (0x7D0) |
| 80 | * (chapter 6 section 11 page 29) |
| 81 | * Quantity of Coils to write (2 bytes): 1 to 1968 (0x7B0) |
| 82 | */ |
| 83 | #define MODBUS_MAX_READ_BITScxx . . $ `src/modbus.h:83:9`! 2000 |
| 84 | #define MODBUS_MAX_WRITE_BITScxx . . $ `src/modbus.h:84:9`! 1968 |
| 85 | |
| 86 | /* Modbus_Application_Protocol_V1_1b.pdf (chapter 6 section 3 page 15) |
| 87 | * Quantity of Registers to read (2 bytes): 1 to 125 (0x7D) |
| 88 | * (chapter 6 section 12 page 31) |
| 89 | * Quantity of Registers to write (2 bytes) 1 to 123 (0x7B) |
| 90 | * (chapter 6 section 17 page 38) |
| 91 | * Quantity of Registers to write in R/W registers (2 bytes) 1 to 121 (0x79) |
| 92 | */ |
| 93 | #define MODBUS_MAX_READ_REGISTERScxx . . $ `src/modbus.h:93:9`! 125 |
| 94 | #define MODBUS_MAX_WRITE_REGISTERScxx . . $ `src/modbus.h:94:9`! 123 |
| 95 | #define MODBUS_MAX_WR_WRITE_REGISTERScxx . . $ `src/modbus.h:95:9`! 121 |
| 96 | #define MODBUS_MAX_WR_READ_REGISTERScxx . . $ `src/modbus.h:96:9`! 125 |
| 97 | |
| 98 | /* The size of the MODBUS PDU is limited by the size constraint inherited from |
| 99 | * the first MODBUS implementation on Serial Line network (max. RS485 ADU = 256 |
| 100 | * bytes). Therefore, MODBUS PDU for serial line communication = 256 - Server |
| 101 | * address (1 byte) - CRC (2 bytes) = 253 bytes. |
| 102 | */ |
| 103 | #define MODBUS_MAX_PDU_LENGTHcxx . . $ `src/modbus.h:103:9`! 253 |
| 104 | |
| 105 | /* Consequently: |
| 106 | * - RTU MODBUS ADU = 253 bytes + Server address (1 byte) + CRC (2 bytes) = 256 |
| 107 | * bytes. |
| 108 | * - TCP MODBUS ADU = 253 bytes + MBAP (7 bytes) = 260 bytes. |
| 109 | * so the maximum of both backend in 260 bytes. This size can used to allocate |
| 110 | * an array of bytes to store responses and it will be compatible with the two |
| 111 | * backends. |
| 112 | */ |
| 113 | #define MODBUS_MAX_ADU_LENGTHcxx . . $ `src/modbus.h:113:9`! 260 |
| 114 | |
| 115 | /* Random number to avoid errno conflicts */ |
| 116 | #define MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! 112345678 |
| 117 | |
| 118 | /* Protocol exceptions */ |
| 119 | enumcxx . . $ $anonymous_type_ef589beb6a8f2342_0# { |
| 120 | MODBUS_EXCEPTION_ILLEGAL_FUNCTIONcxx . . $ MODBUS_EXCEPTION_ILLEGAL_FUNCTION. = 0x01, |
| 121 | MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESScxx . . $ MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS., |
| 122 | MODBUS_EXCEPTION_ILLEGAL_DATA_VALUEcxx . . $ MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE., |
| 123 | MODBUS_EXCEPTION_SLAVE_OR_SERVER_FAILUREcxx . . $ MODBUS_EXCEPTION_SLAVE_OR_SERVER_FAILURE., |
| 124 | MODBUS_EXCEPTION_ACKNOWLEDGEcxx . . $ MODBUS_EXCEPTION_ACKNOWLEDGE., |
| 125 | MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSYcxx . . $ MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY., |
| 126 | MODBUS_EXCEPTION_NEGATIVE_ACKNOWLEDGEcxx . . $ MODBUS_EXCEPTION_NEGATIVE_ACKNOWLEDGE., |
| 127 | MODBUS_EXCEPTION_MEMORY_PARITYcxx . . $ MODBUS_EXCEPTION_MEMORY_PARITY., |
| 128 | MODBUS_EXCEPTION_NOT_DEFINEDcxx . . $ MODBUS_EXCEPTION_NOT_DEFINED., |
| 129 | MODBUS_EXCEPTION_GATEWAY_PATHcxx . . $ MODBUS_EXCEPTION_GATEWAY_PATH., |
| 130 | MODBUS_EXCEPTION_GATEWAY_TARGETcxx . . $ MODBUS_EXCEPTION_GATEWAY_TARGET., |
| 131 | MODBUS_EXCEPTION_MAXcxx . . $ MODBUS_EXCEPTION_MAX. |
| 132 | }; |
| 133 | |
| 134 | #define EMBXILFUNcxx . . $ `src/modbus.h:134:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_ILLEGAL_FUNCTION) |
| 135 | #define EMBXILADDcxx . . $ `src/modbus.h:135:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS) |
| 136 | #define EMBXILVALcxx . . $ `src/modbus.h:136:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE) |
| 137 | #define EMBXSFAILcxx . . $ `src/modbus.h:137:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_SLAVE_OR_SERVER_FAILURE) |
| 138 | #define EMBXACKcxx . . $ `src/modbus.h:138:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_ACKNOWLEDGE) |
| 139 | #define EMBXSBUSYcxx . . $ `src/modbus.h:139:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY) |
| 140 | #define EMBXNACKcxx . . $ `src/modbus.h:140:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_NEGATIVE_ACKNOWLEDGE) |
| 141 | #define EMBXMEMPARcxx . . $ `src/modbus.h:141:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_MEMORY_PARITY) |
| 142 | #define EMBXGPATHcxx . . $ `src/modbus.h:142:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_GATEWAY_PATH) |
| 143 | #define EMBXGTARcxx . . $ `src/modbus.h:143:9`! (MODBUS_ENOBASEcxx . . $ `src/modbus.h:116:9`! + MODBUS_EXCEPTION_GATEWAY_TARGET) |
| 144 | |
| 145 | /* Native libmodbus error codes */ |
| 146 | #define EMBBADCRCcxx . . $ `src/modbus.h:146:9`! (EMBXGTARcxx . . $ `src/modbus.h:143:9`! + 1) |
| 147 | #define EMBBADDATAcxx . . $ `src/modbus.h:147:9`! (EMBXGTARcxx . . $ `src/modbus.h:143:9`! + 2) |
| 148 | #define EMBBADEXCcxx . . $ `src/modbus.h:148:9`! (EMBXGTARcxx . . $ `src/modbus.h:143:9`! + 3) |
| 149 | #define EMBUNKEXCcxx . . $ `src/modbus.h:149:9`! (EMBXGTAR + 4) |
| 150 | #define EMBMDATAcxx . . $ `src/modbus.h:150:9`! (EMBXGTARcxx . . $ `src/modbus.h:143:9`! + 5) |
| 151 | #define EMBBADSLAVEcxx . . $ `src/modbus.h:151:9`! (EMBXGTARcxx . . $ `src/modbus.h:143:9`! + 6) |
| 152 | |
| 153 | extern const unsigned int libmodbus_version_majorcxx . . $ libmodbus_version_major.; |
| 154 | extern const unsigned int libmodbus_version_minorcxx . . $ libmodbus_version_minor.; |
| 155 | extern const unsigned int libmodbus_version_microcxx . . $ libmodbus_version_micro.; |
| 156 | |
| 157 | typedef struct _modbuscxx . . $ _modbus# modbus_tcxx . . $ modbus_t#; |
| 158 | |
| 159 | /*! Memory layout in tab_xxx arrays is processor-endianness. |
| 160 | When receiving modbus data, it is converted to processor-endianness, |
| 161 | see read_registers(). |
| 162 | */ |
| 163 | typedef struct _modbus_mapping_tcxx . . $ _modbus_mapping_t# { |
| 164 | int nb_bitscxx . . $ _modbus_mapping_t#nb_bits.; |
| 165 | int start_bitscxx . . $ _modbus_mapping_t#start_bits.; |
| 166 | int nb_input_bitscxx . . $ _modbus_mapping_t#nb_input_bits.; |
| 167 | int start_input_bitscxx . . $ _modbus_mapping_t#start_input_bits.; |
| 168 | int nb_input_registerscxx . . $ _modbus_mapping_t#nb_input_registers.; |
| 169 | int start_input_registerscxx . . $ _modbus_mapping_t#start_input_registers.; |
| 170 | int nb_registerscxx . . $ _modbus_mapping_t#nb_registers.; |
| 171 | int start_registerscxx . . $ _modbus_mapping_t#start_registers.; |
| 172 | uint8_tcxx . . $ uint8_t# *tab_bitscxx . . $ _modbus_mapping_t#tab_bits.; |
| 173 | uint8_tcxx . . $ uint8_t# *tab_input_bitscxx . . $ _modbus_mapping_t#tab_input_bits.; |
| 174 | uint16_tcxx . . $ uint16_t# *tab_input_registerscxx . . $ _modbus_mapping_t#tab_input_registers.; |
| 175 | uint16_tcxx . . $ uint16_t# *tab_registerscxx . . $ _modbus_mapping_t#tab_registers.; |
| 176 | } modbus_mapping_tcxx . . $ modbus_mapping_t#; |
| 177 | |
| 178 | typedef enumcxx . . $ $anonymous_type_ef589beb6a8f2342_1# { |
| 179 | MODBUS_ERROR_RECOVERY_NONEcxx . . $ MODBUS_ERROR_RECOVERY_NONE. = 0, |
| 180 | MODBUS_ERROR_RECOVERY_LINKcxx . . $ MODBUS_ERROR_RECOVERY_LINK. = (1 << 1), |
| 181 | MODBUS_ERROR_RECOVERY_PROTOCOLcxx . . $ MODBUS_ERROR_RECOVERY_PROTOCOL. = (1 << 2) |
| 182 | } modbus_error_recovery_modecxx . . $ modbus_error_recovery_mode#; |
| 183 | |
| 184 | typedef enumcxx . . $ $anonymous_type_ef589beb6a8f2342_2# { |
| 185 | MODBUS_QUIRK_NONEcxx . . $ MODBUS_QUIRK_NONE. = 0, |
| 186 | MODBUS_QUIRK_MAX_SLAVEcxx . . $ MODBUS_QUIRK_MAX_SLAVE. = (1 << 1), |
| 187 | MODBUS_QUIRK_REPLY_TO_BROADCASTcxx . . $ MODBUS_QUIRK_REPLY_TO_BROADCAST. = (1 << 2), |
| 188 | MODBUS_QUIRK_ALLcxx . . $ MODBUS_QUIRK_ALL. = 0xFF |
| 189 | } modbus_quirkscxx . . $ modbus_quirks#; |
| 190 | |
| 191 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_set_slavecxx . . $ modbus_set_slave(2a7e0e283938d456).(modbus_tcxx . . $ modbus_t# *ctx, int slave); |
| 192 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_get_slavecxx . . $ modbus_get_slave(c57adc5f48380e39).(modbus_tcxx . . $ modbus_t# *ctx); |
| 193 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_set_error_recoverycxx . . $ modbus_set_error_recovery(882859f4d5bb8f75).(modbus_tcxx . . $ modbus_t# *ctx, |
| 194 | modbus_error_recovery_modecxx . . $ modbus_error_recovery_mode# error_recovery); |
| 195 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_set_socketcxx . . $ modbus_set_socket(2a7e0e283938d456).(modbus_tcxx . . $ modbus_t# *ctx, int s); |
| 196 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_get_socketcxx . . $ modbus_get_socket(c57adc5f48380e39).(modbus_tcxx . . $ modbus_t# *ctx); |
| 197 | |
| 198 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 199 | modbus_get_response_timeoutcxx . . $ modbus_get_response_timeout(536e4a54166c71db).(modbus_tcxx . . $ modbus_t# *ctx, uint32_tcxx . . $ uint32_t# *to_sec, uint32_tcxx . . $ uint32_t# *to_usec); |
| 200 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 201 | modbus_set_response_timeoutcxx . . $ modbus_set_response_timeout(a50f7c93d24cb0e).(modbus_tcxx . . $ modbus_t# *ctx, uint32_tcxx . . $ uint32_t# to_sec, uint32_tcxx . . $ uint32_t# to_usec); |
| 202 | |
| 203 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 204 | modbus_get_byte_timeoutcxx . . $ modbus_get_byte_timeout(536e4a54166c71db).(modbus_tcxx . . $ modbus_t# *ctx, uint32_tcxx . . $ uint32_t# *to_sec, uint32_tcxx . . $ uint32_t# *to_usec); |
| 205 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_set_byte_timeoutcxx . . $ modbus_set_byte_timeout(a50f7c93d24cb0e).(modbus_tcxx . . $ modbus_t# *ctx, uint32_tcxx . . $ uint32_t# to_sec, uint32_tcxx . . $ uint32_t# to_usec); |
| 206 | |
| 207 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 208 | modbus_get_indication_timeoutcxx . . $ modbus_get_indication_timeout(536e4a54166c71db).(modbus_tcxx . . $ modbus_t# *ctx, uint32_tcxx . . $ uint32_t# *to_sec, uint32_tcxx . . $ uint32_t# *to_usec); |
| 209 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 210 | modbus_set_indication_timeoutcxx . . $ modbus_set_indication_timeout(a50f7c93d24cb0e).(modbus_tcxx . . $ modbus_t# *ctx, uint32_tcxx . . $ uint32_t# to_sec, uint32_tcxx . . $ uint32_t# to_usec); |
| 211 | |
| 212 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_get_header_lengthcxx . . $ modbus_get_header_length(c57adc5f48380e39).(modbus_tcxx . . $ modbus_t# *ctx); |
| 213 | |
| 214 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_connectcxx . . $ modbus_connect(c57adc5f48380e39).(modbus_tcxx . . $ modbus_t# *ctx); |
| 215 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_closecxx . . $ modbus_close(24b4870c26038e9).(modbus_tcxx . . $ modbus_t# *ctx); |
| 216 | |
| 217 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_freecxx . . $ modbus_free(24b4870c26038e9).(modbus_tcxx . . $ modbus_t# *ctx); |
| 218 | |
| 219 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_flushcxx . . $ modbus_flush(c57adc5f48380e39).(modbus_tcxx . . $ modbus_t# *ctx); |
| 220 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_set_debugcxx . . $ modbus_set_debug(2a7e0e283938d456).(modbus_tcxx . . $ modbus_t# *ctx, int flag); |
| 221 | |
| 222 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! const char *modbus_strerrorcxx . . $ modbus_strerror(f7ae7e56280f18ae).(int errnum); |
| 223 | |
| 224 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_read_bitscxx . . $ modbus_read_bits(11f4da49ebe31404).(modbus_tcxx . . $ modbus_t# *ctx, int addr, int nb, uint8_tcxx . . $ uint8_t# *dest); |
| 225 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_read_input_bitscxx . . $ modbus_read_input_bits(11f4da49ebe31404).(modbus_tcxx . . $ modbus_t# *ctx, int addr, int nb, uint8_tcxx . . $ uint8_t# *dest); |
| 226 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_read_registerscxx . . $ modbus_read_registers(e941881bef6bc78c).(modbus_tcxx . . $ modbus_t# *ctx, int addr, int nb, uint16_tcxx . . $ uint16_t# *dest); |
| 227 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 228 | modbus_read_input_registerscxx . . $ modbus_read_input_registers(e941881bef6bc78c).(modbus_tcxx . . $ modbus_t# *ctx, int addr, int nb, uint16_tcxx . . $ uint16_t# *dest); |
| 229 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_write_bitcxx . . $ modbus_write_bit(16de6ae3c67ca311).(modbus_tcxx . . $ modbus_t# *ctx, int coil_addr, int status); |
| 230 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_write_registercxx . . $ modbus_write_register(146febe49439e9d3).(modbus_tcxx . . $ modbus_t# *ctx, int reg_addr, const uint16_tcxx . . $ uint16_t# value); |
| 231 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_write_bitscxx . . $ modbus_write_bits(90e367cb830b4f97).(modbus_tcxx . . $ modbus_t# *ctx, int addr, int nb, const uint8_tcxx . . $ uint8_t# *data); |
| 232 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 233 | modbus_write_registerscxx . . $ modbus_write_registers(1ccebf9f3d033562).(modbus_tcxx . . $ modbus_t# *ctx, int addr, int nb, const uint16_tcxx . . $ uint16_t# *data); |
| 234 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 235 | modbus_mask_write_registercxx . . $ modbus_mask_write_register(ba42a0470b5e623e).(modbus_tcxx . . $ modbus_t# *ctx, int addr, uint16_tcxx . . $ uint16_t# and_mask, uint16_tcxx . . $ uint16_t# or_mask); |
| 236 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_write_and_read_registerscxx . . $ modbus_write_and_read_registers(c6a0b9119112ae8e).(modbus_tcxx . . $ modbus_t# *ctx, |
| 237 | int write_addr, |
| 238 | int write_nb, |
| 239 | const uint16_tcxx . . $ uint16_t# *src, |
| 240 | int read_addr, |
| 241 | int read_nb, |
| 242 | uint16_tcxx . . $ uint16_t# *dest); |
| 243 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_report_slave_idcxx . . $ modbus_report_slave_id(a57d72a08e870a11).(modbus_tcxx . . $ modbus_t# *ctx, int max_dest, uint8_tcxx . . $ uint8_t# *dest); |
| 244 | |
| 245 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! modbus_mapping_tcxx . . $ modbus_mapping_t# * |
| 246 | modbus_mapping_new_start_addresscxx . . $ modbus_mapping_new_start_address(444dd58f5e23594d).(unsigned int start_bits, |
| 247 | unsigned int nb_bits, |
| 248 | unsigned int start_input_bits, |
| 249 | unsigned int nb_input_bits, |
| 250 | unsigned int start_registers, |
| 251 | unsigned int nb_registers, |
| 252 | unsigned int start_input_registers, |
| 253 | unsigned int nb_input_registers); |
| 254 | |
| 255 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! modbus_mapping_tcxx . . $ modbus_mapping_t# *modbus_mapping_newcxx . . $ modbus_mapping_new(4d1e5ca6ca14e01f).(int nb_bits, |
| 256 | int nb_input_bits, |
| 257 | int nb_registers, |
| 258 | int nb_input_registers); |
| 259 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_mapping_freecxx . . $ modbus_mapping_free(456c0c7ef81b32ba).(modbus_mapping_tcxx . . $ modbus_mapping_t# *mb_mapping); |
| 260 | |
| 261 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 262 | modbus_send_raw_requestcxx . . $ modbus_send_raw_request(9fdc62dfbbb43cda).(modbus_tcxx . . $ modbus_t# *ctx, const uint8_tcxx . . $ uint8_t# *raw_req, int raw_req_length); |
| 263 | |
| 264 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_send_raw_request_tidcxx . . $ modbus_send_raw_request_tid(169e637adbc4a829).(modbus_tcxx . . $ modbus_t# *ctx, |
| 265 | const uint8_tcxx . . $ uint8_t# *raw_req, |
| 266 | int raw_req_length, |
| 267 | int tid); |
| 268 | |
| 269 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_receivecxx . . $ modbus_receive(744a031d86f39170).(modbus_tcxx . . $ modbus_t# *ctx, uint8_tcxx . . $ uint8_t# *req); |
| 270 | |
| 271 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_receive_confirmationcxx . . $ modbus_receive_confirmation(744a031d86f39170).(modbus_tcxx . . $ modbus_t# *ctx, uint8_tcxx . . $ uint8_t# *rsp); |
| 272 | |
| 273 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_replycxx . . $ modbus_reply(2bd5663397286dec).(modbus_tcxx . . $ modbus_t# *ctx, |
| 274 | const uint8_tcxx . . $ uint8_t# *req, |
| 275 | int req_length, |
| 276 | modbus_mapping_tcxx . . $ modbus_mapping_t# *mb_mapping); |
| 277 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int |
| 278 | modbus_reply_exceptioncxx . . $ modbus_reply_exception(9fb3248ea093d6a5).(modbus_tcxx . . $ modbus_t# *ctx, const uint8_tcxx . . $ uint8_t# *req, unsigned int exception_code); |
| 279 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_proxycxx . . $ modbus_proxy(6441bf31ea5943db).(modbus_tcxx . . $ modbus_t# *frontend_ctx, |
| 280 | modbus_tcxx . . $ modbus_t# *backend_ctx, |
| 281 | const uint8_tcxx . . $ uint8_t# *req, |
| 282 | int req_length); |
| 283 | |
| 284 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_enable_quirkscxx . . $ modbus_enable_quirks(6e391a97c669bd3b).(modbus_tcxx . . $ modbus_t# *ctx, unsigned int quirks_mask); |
| 285 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! int modbus_disable_quirkscxx . . $ modbus_disable_quirks(6e391a97c669bd3b).(modbus_tcxx . . $ modbus_t# *ctx, unsigned int quirks_mask); |
| 286 | |
| 287 | /** |
| 288 | * UTILS FUNCTIONS |
| 289 | **/ |
| 290 | |
| 291 | #define MODBUS_GET_HIGH_BYTEcxx . . $ `src/modbus.h:291:9`!(data) (((data) >> 8) & 0xFF) |
| 292 | #define MODBUS_GET_LOW_BYTEcxx . . $ `src/modbus.h:292:9`!(data) ((data) & 0xFF) |
| 293 | /* The shifts are done in unsigned width and the result converted to the signed |
| 294 | type: shifting a (possibly negative or overflowing) signed value is undefined |
| 295 | behavior. The produced value is unchanged on two's-complement platforms. */ |
| 296 | #define MODBUS_GET_INT64_FROM_INT16cxx . . $ `src/modbus.h:296:9`!(tab_int16, index) \ |
| 297 | ((int64_t) (((uint64_t) (uint16_t) tab_int16[(index)] << 48) | \ |
| 298 | ((uint64_t) (uint16_t) tab_int16[(index) + 1] << 32) | \ |
| 299 | ((uint64_t) (uint16_t) tab_int16[(index) + 2] << 16) | \ |
| 300 | (uint64_t) (uint16_t) tab_int16[(index) + 3])) |
| 301 | #define MODBUS_GET_INT32_FROM_INT16cxx . . $ `src/modbus.h:301:9`!(tab_int16, index) \ |
| 302 | ((int32_t) (((uint32_t) (uint16_t) tab_int16[(index)] << 16) | \ |
| 303 | (uint32_t) (uint16_t) tab_int16[(index) + 1])) |
| 304 | #define MODBUS_GET_INT16_FROM_INT8cxx . . $ `src/modbus.h:304:9`!(tab_int8, index) \ |
| 305 | ((int16_t) (((uint16_t) (uint8_t) tab_int8[(index)] << 8) | \ |
| 306 | (uint16_t) (uint8_t) tab_int8[(index) + 1])) |
| 307 | #define MODBUS_SET_INT16_TO_INT8cxx . . $ `src/modbus.h:307:9`!(tab_int8, index, value) \ |
| 308 | do { \ |
| 309 | ((int8_t *) (tab_int8))[(index)] = (int8_t) ((value) >> 8); \ |
| 310 | ((int8_t *) (tab_int8))[(index) + 1] = (int8_t) (value); \ |
| 311 | } while (0) |
| 312 | #define MODBUS_SET_INT32_TO_INT16cxx . . $ `src/modbus.h:312:9`!(tab_int16, index, value) \ |
| 313 | do { \ |
| 314 | ((int16_t *) (tab_int16))[(index)] = (int16_t) ((value) >> 16); \ |
| 315 | ((int16_t *) (tab_int16))[(index) + 1] = (int16_t) (value); \ |
| 316 | } while (0) |
| 317 | #define MODBUS_SET_INT64_TO_INT16cxx . . $ `src/modbus.h:317:9`!(tab_int16, index, value) \ |
| 318 | do { \ |
| 319 | ((int16_t *) (tab_int16))[(index)] = (int16_t) ((value) >> 48); \ |
| 320 | ((int16_t *) (tab_int16))[(index) + 1] = (int16_t) ((value) >> 32); \ |
| 321 | ((int16_t *) (tab_int16))[(index) + 2] = (int16_t) ((value) >> 16); \ |
| 322 | ((int16_t *) (tab_int16))[(index) + 3] = (int16_t) (value); \ |
| 323 | } while (0) |
| 324 | |
| 325 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_bits_from_bytecxx . . $ modbus_set_bits_from_byte(97da53ea57bcb32d).(uint8_tcxx . . $ uint8_t# *dest, int idx, const uint8_tcxx . . $ uint8_t# value); |
| 326 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_bits_from_bytescxx . . $ modbus_set_bits_from_bytes(a1587c06cb9b3a17).(uint8_tcxx . . $ uint8_t# *dest, |
| 327 | int idx, |
| 328 | unsigned int nb_bits, |
| 329 | const uint8_tcxx . . $ uint8_t# *tab_byte); |
| 330 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! uint8_tcxx . . $ uint8_t# modbus_get_byte_from_bitscxx . . $ modbus_get_byte_from_bits(452d793f89d8163c).(const uint8_tcxx . . $ uint8_t# *src, |
| 331 | int idx, |
| 332 | unsigned int nb_bits); |
| 333 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! float modbus_get_floatcxx . . $ modbus_get_float(b07654c42935ee93).(const uint16_tcxx . . $ uint16_t# *src); |
| 334 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! float modbus_get_float_abcdcxx . . $ modbus_get_float_abcd(b07654c42935ee93).(const uint16_tcxx . . $ uint16_t# *src); |
| 335 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! float modbus_get_float_dcbacxx . . $ modbus_get_float_dcba(b07654c42935ee93).(const uint16_tcxx . . $ uint16_t# *src); |
| 336 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! float modbus_get_float_badccxx . . $ modbus_get_float_badc(b07654c42935ee93).(const uint16_tcxx . . $ uint16_t# *src); |
| 337 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! float modbus_get_float_cdabcxx . . $ modbus_get_float_cdab(b07654c42935ee93).(const uint16_tcxx . . $ uint16_t# *src); |
| 338 | |
| 339 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_floatcxx . . $ modbus_set_float(39eb9394749c9c9b).(float f, uint16_tcxx . . $ uint16_t# *dest); |
| 340 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_float_abcdcxx . . $ modbus_set_float_abcd(39eb9394749c9c9b).(float f, uint16_tcxx . . $ uint16_t# *dest); |
| 341 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_float_dcbacxx . . $ modbus_set_float_dcba(39eb9394749c9c9b).(float f, uint16_tcxx . . $ uint16_t# *dest); |
| 342 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_float_badccxx . . $ modbus_set_float_badc(39eb9394749c9c9b).(float f, uint16_tcxx . . $ uint16_t# *dest); |
| 343 | MODBUS_APIcxx . . $ `src/modbus.h:32:10`! void modbus_set_float_cdabcxx . . $ modbus_set_float_cdab(39eb9394749c9c9b).(float f, uint16_tcxx . . $ uint16_t# *dest); |
| 344 | |
| 345 | #include "modbus-rtu.h"cxx . . $ `<file>/src/modbus-rtu.h`/ |
| 346 | #include "modbus-tcp.h"cxx . . $ `<file>/src/modbus-tcp.h`/ |
| 347 | |
| 348 | MODBUS_END_DECLScxx . . $ `src/modbus.h:40:10`! |
| 349 | |
| 350 | #endif /* MODBUS_H */ |