|
liblightmodbus 3.0
A lightweight, header-only, hardware-agnostic Modbus RTU/TCP library
|
Common types and functions (implementation) More...
Include dependency graph for base.impl.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| ModbusError | modbusDefaultAllocator (ModbusBuffer *buffer, uint16_t size, void *context) |
| The default memory allocator based on realloc() | |
| ModbusErrorInfomodbusBufferInit (ModbusBuffer *buffer, ModbusAllocator allocator) | |
| Initializes a buffer for use. | |
| void | modbusBufferFree (ModbusBuffer *buffer, void *context) |
| Frees memory allocated inside the buffer. | |
| void | modbusBufferDestroy (ModbusBuffer *buffer, void *context) |
| Equivalent of modbusBufferFree() \copydetail modbusBufferFree() | |
| ModbusError | modbusBufferAllocateADU (ModbusBuffer *buffer, uint16_t pduSize, void *context) |
| Allocates memory to hold Modbus ADU. | |
| uint16_t | modbusCRC (const uint8_t *data, uint16_t length) |
| Calculates 16-bit Modbus CRC of provided data. | |
Common types and functions (implementation)
| ModbusError modbusBufferAllocateADU | ( | ModbusBuffer * | buffer, |
| uint16_t | pduSize, | ||
| void * | context ) |
Allocates memory to hold Modbus ADU.
| pduSize | size of the PDU in bytes |
| context | context pointer passed on to the allocator |
If called with pduSize == 0, the buffer is freed. Otherwise a buffer for (pduSize + buffer->padding) bytes is allocated. This guarantees that the buffer is big enough to hold the entire ADU.
This function is responsible for managing data, pdu and length fields in the buffer struct. The pdu pointer is set up to point pduOffset bytes after the data pointer unless data is a null pointer.
Here is the caller graph for this function:| void modbusBufferDestroy | ( | ModbusBuffer * | buffer, |
| void * | context ) |
Equivalent of modbusBufferFree() \copydetail modbusBufferFree()
Here is the call graph for this function:
Here is the caller graph for this function:| void modbusBufferFree | ( | ModbusBuffer * | buffer, |
| void * | context ) |
Frees memory allocated inside the buffer.
| context | context pointer passed on to the allocator |
Here is the call graph for this function:
Here is the caller graph for this function:| uint16_t modbusCRC | ( | const uint8_t * | data, |
| uint16_t | length ) |
Calculates 16-bit Modbus CRC of provided data.
| data | A pointer to the data to be processed |
| length | Number of bytes, starting at the data pointer, to process |
Here is the caller graph for this function:| ModbusError modbusDefaultAllocator | ( | ModbusBuffer * | buffer, |
| uint16_t | size, | ||
| void * | context ) |
The default memory allocator based on realloc()
| buffer | a pointer to the buffer to be reallocated |
| size | new desired buffer size in bytes |
| context | user's context pointer |
| ModbusErrorInfomodbusBufferInit | ( | ModbusBuffer * | buffer, |
| ModbusAllocator | allocator ) |
Initializes a buffer for use.
| allocator | Memory allocator to be used by the buffer |