forked from espressif/esp-modbus
Merge branch 'bugfix/fix_docs_enable_extended_data_types_conversion_v2' into 'release/v2.0'
fix build docs, extended data types en option v2, mb_event check See merge request idf/esp-modbus!78
This commit is contained in:
@ -5,8 +5,7 @@ stages:
|
||||
|
||||
variables:
|
||||
# System environment
|
||||
TARGET_TEST_ENV_IMAGE: "$CI_DOCKER_REGISTRY/target-test-env-v5.2:2"
|
||||
ESP_DOCS_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-2"
|
||||
ESP_DOCS_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.3:1-1"
|
||||
ESP_DOCS_PATH: "$CI_PROJECT_DIR"
|
||||
TEST_DIR: "$CI_PROJECT_DIR"
|
||||
|
||||
@ -57,6 +56,7 @@ after_script:
|
||||
|
||||
.before_script_build_jobs:
|
||||
before_script:
|
||||
- pip install idf-component-manager --upgrade
|
||||
- pip install "idf_build_apps~=1.0.1"
|
||||
|
||||
.check_idf_ver: &check_idf_ver |
|
||||
@ -69,8 +69,8 @@ after_script:
|
||||
cd ${IDF_PATH}
|
||||
export IDF_DESCRIBE=$(git describe)
|
||||
export IDF_VERSION=${IDF_DESCRIBE%-*}
|
||||
echo "${IDF_VERSION}" >> ${TEST_DIR}/idf_version_info.txt
|
||||
echo "${IDF_VERSION}"
|
||||
echo "$IDF_VERSION" >> $TEST_DIR/idf_version_info.txt
|
||||
echo "ESP-IDF: $IDF_VERSION"
|
||||
fi
|
||||
|
||||
# Note: this script builds the folder against all targets and then deletes
|
||||
@ -160,7 +160,6 @@ build_idf_v5.0:
|
||||
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3"
|
||||
|
||||
.target_test_template:
|
||||
image: $TARGET_TEST_ENV_IMAGE
|
||||
stage: target_test
|
||||
timeout: 1 hour
|
||||
variables:
|
||||
|
6
docs/_static/diag_frame.diag
vendored
6
docs/_static/diag_frame.diag
vendored
@ -2,10 +2,10 @@
|
||||
|
||||
blockdiag mb_float_frame {
|
||||
# global properties
|
||||
span_width = 2;
|
||||
span_width = 5;
|
||||
span_height = 5;
|
||||
node_height = 25;
|
||||
default_fontsize = 16;
|
||||
node_height = 30;
|
||||
default_fontsize = 15;
|
||||
default_group_color = lightgrey;
|
||||
class spacer [shape=none, width=10];
|
||||
# tuning node properties and connections
|
||||
|
5
docs/_static/modbus_docs_versions.js
vendored
5
docs/_static/modbus_docs_versions.js
vendored
@ -1,6 +1,6 @@
|
||||
var DOCUMENTATION_VERSIONS = {
|
||||
DEFAULTS: { has_targets: true,
|
||||
supported_targets: [ "esp32", "esp32s2", "esp32s3", "esp32c2","esp32c3", "esp32c6", "esp32s2", "esp32s3, esp32p4" ]
|
||||
supported_targets: [ "esp32", "esp32s2", "esp32s3", "esp32c2","esp32c3", "esp32c5", "esp32c6", "esp32s2", "esp32s3, esp32p4" ]
|
||||
},
|
||||
VERSIONS: [
|
||||
{ name: "latest" },
|
||||
@ -15,6 +15,7 @@ var DOCUMENTATION_VERSIONS = {
|
||||
{ text: "ESP32-C3", value: "esp32c3"},
|
||||
{ text: "ESP32-C6", value: "esp32c6"},
|
||||
{ text: "ESP32-H2", value: "esp32h2"},
|
||||
{ text: "ESP32-P4", value: "esp32p4"}
|
||||
{ text: "ESP32-P4", value: "esp32p4"},
|
||||
{ text: "ESP32-C5", value: "esp32c5"}
|
||||
]
|
||||
};
|
||||
|
60
docs/_static/modbus_frame_examples.diag
vendored
60
docs/_static/modbus_frame_examples.diag
vendored
@ -4,7 +4,7 @@ blockdiag mb_master_frames {
|
||||
# global properties
|
||||
span_width = 5;
|
||||
span_height = 5;
|
||||
node_height = 25;
|
||||
node_height = 30;
|
||||
default_group_color = lightgrey;
|
||||
default_fontsize = 15;
|
||||
# tuning node properties and connections
|
||||
@ -29,33 +29,33 @@ blockdiag mb_master_frames {
|
||||
style = dashed;
|
||||
64bit_notes;
|
||||
}
|
||||
16bit_notes[label="UINT16, INT16 VALUE = 0x3039 = (uint16_t)12345", width=600, color=orange, shape = roundedbox];
|
||||
req_u16_hd1[label= "TX:| UID | FC | REG_START | REG_LEN | CRC |", color=lightyellow, width=380, colwidth=2, shape = roundedbox ,group=16bit_packets];
|
||||
req_u16_frm1[label="TX:| 01 | 03 | 00 04 | 00 02 | 85 CA |", color=lightgrey, width=380, colwidth=2,group=16bit_packets];
|
||||
rsp_u16_hd1[label= "RX:| UID | FC | LEN | UINT16_AB1 | UINT16_AB2 | CRC |", color=lightyellow, width=380, colwidth=2, shape = roundedbox ,group=16bit_packets];
|
||||
rsp_u16_frm1[label="RX:| 01 | 03 | 04 | 30 39 | 30 39 | F1 2C |", color=lightgrey, width=380, colwidth=2,group=16bit_packets];
|
||||
rsp_u16_hd2[label= "RX:| UID | FC | LEN | UINT16_BA1 | UINT16_BA2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=16bit_packets];
|
||||
rsp_u16_frm2[label="RX:| 01 | 03 | 04 | 39 30 | 39 30 | E4 E4 |\n", color=lightgrey, width=380, colwidth=2,group=16bit_packets];
|
||||
32bit_notes[label="(UINT32, INT32) FLOAT32 VALUE = 0x4640e400 = 12345.0", width=600, color=lightgreen, shape = roundedbox];
|
||||
req_fl_hd1[label= "TX:| UID | FC | REG_START | REG_LEN | CRC |", color=lightyellow, width=380, colwidth=2, shape = roundedbox ,group=32bit_packets];
|
||||
req_fl_frm1[label="TX:| 01 | 03 | 00 XX | 00 04 | C5 CB |", color=lightgrey, width=380, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd1[label= "RX:| UID | FC | LEN | FLOAT_ABCD1 | FLOAT_ABCD2 | CRC |", color=lightyellow, width=380, colwidth=2, shape = roundedbox ,group=32bit_packets];
|
||||
rsp_fl_frm1[label="RX:| 01 | 03 | 08 | E4 00 46 40 | E4 00 46 40 | 90 65 |", color=lightgrey, width=380, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd2[label= "RX:| UID | FC | LEN | FLOAT_CDAB1 | FLOAT_CDAB2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=32bit_packets];
|
||||
rsp_fl_frm2[label="RX:| 01 | 03 | 08 | 46 40 E4 00 | 46 40 E4 00 | 18 71 |\n", color=lightgrey, width=380, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd3[label= "RX:| UID | FC | LEN | FLOAT_BADC1 | FLOAT_BADC2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=32bit_packets];
|
||||
rsp_fl_frm3[label="RX:| 01 | 03 | 08 | 00 E4 40 46 | 00 E4 40 46 | 46 D3 |\n", color=lightgrey, width=380, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd4[label= "RX:| UID | FC | LEN | FLOAT_DCAB1 | FLOAT_DCAB2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=32bit_packets];
|
||||
rsp_fl_frm4[label="RX:| 01 | 03 | 08 | 40 46 00 E4 | 40 46 00 E4 | 32 6B |\n", color=lightgrey, width=380, colwidth=2,group=32bit_packets];
|
||||
64bit_notes[label="(UINT64, INT64) FLOAT64 VALUE = 0x40c81c8000000000 = 12345.0", width=600, color=lightblue, shape = roundedbox];
|
||||
req_dbl_hd1[label= "TX:| UID | FC | REG_START | REG_LEN | CRC |", color=lightyellow, width=380, colwidth=2, shape = roundedbox ,group=64bit_packets];
|
||||
req_dbl_frm1[label="TX:| 01 | 03 | 00 28 | 00 08 | C4 04 |", color=lightgrey, width=380, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd1[label= "RX:| UID | FC | LEN | DOUBLE_ABCDEFGH1 | DOUBLE_ABCDEFGH2 | CRC |", color=lightyellow, width=380, colwidth=2, shape = roundedbox ,group=64bit_packets];
|
||||
rsp_dbl_frm1[label="RX:| 01 | 03 | 10 | 00 00 00 00 1C 80 40 C8 | 00 00 00 00 1C 80 40 C8 | 9F 4B |", color=lightgrey, width=380, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd2[label= "RX:| UID | FC | LEN | DOUBLE_HGFEDCBA1 | DOUBLE_HGFEDCBA2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=64bit_packets];
|
||||
rsp_dbl_frm2[label="RX:| 01 | 03 | 10 | C8 40 80 1C 00 00 00 00 | C8 40 80 1C 00 00 00 00 | DF D3 |\n", color=lightgrey, width=380, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd3[label= "RX:| UID | FC | LEN | DOUBLE_GHEFCDAB1 | DOUBLE_GHEFCDAB2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=64bit_packets];
|
||||
rsp_dbl_frm3[label="RX:| 01 | 03 | 10 | 40 C8 1C 80 00 00 00 00 | 40 C8 1C 80 00 00 00 00 | B1 9C |\n", color=lightgrey, width=380, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd4[label= "RX:| UID | FC | LEN | DOUBLE_BADCFEHG1 | DOUBLE_BADCFEHG2 | CRC |\n ", color=lightyellow, width=380, colwidth=2, shape = roundedbox, group=64bit_packets];
|
||||
rsp_dbl_frm4[label="RX:| 01 | 03 | 10 | 00 00 00 00 80 1C C8 40 | 00 00 00 00 80 1C C8 40 | 86 94 |\n", color=lightgrey, width=380, colwidth=2,group=64bit_packets];
|
||||
16bit_notes[label="(UINT16, INT16) VALUE = 0x3039 = 12345", width=600, color=orange, shape = roundedbox];
|
||||
req_u16_hd1[label= "TX:| UID | FC | REG_START | REG_LEN | CRC |", color=lightyellow, width=520, colwidth=2, shape = roundedbox ,group=16bit_packets];
|
||||
req_u16_frm1[label="TX:| 01 | 03 | 00 04 | 00 02 | 85 CA |", color=lightgrey, width=540, colwidth=2,group=16bit_packets];
|
||||
rsp_u16_hd1[label= "RX:| UID | FC | LEN | UINT16_AB1 | UINT16_AB2 | CRC |", color=lightyellow, width=540, colwidth=2, shape = roundedbox ,group=16bit_packets];
|
||||
rsp_u16_frm1[label="RX:| 01 | 03 | 04 | 30 39 | 30 39 | F1 2C |", color=lightgrey, width=540, colwidth=2,group=16bit_packets];
|
||||
rsp_u16_hd2[label= "RX:| UID | FC | LEN | UINT16_BA1 | UINT16_BA2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=16bit_packets];
|
||||
rsp_u16_frm2[label="RX:| 01 | 03 | 04 | 39 30 | 39 30 | E4 E4 |\n", color=lightgrey, width=540, colwidth=2,group=16bit_packets];
|
||||
32bit_notes[label="(UINT32, INT32, FLOAT32) VALUE = 0x4640e400 = 12345.0", width=600, color=lightgreen, shape = roundedbox];
|
||||
req_fl_hd1[label= "TX:| UID | FC | REG_START | REG_LEN | CRC |", color=lightyellow, width=540, colwidth=2, shape = roundedbox ,group=32bit_packets];
|
||||
req_fl_frm1[label="TX:| 01 | 03 | 00 XX | 00 04 | C5 CB |", color=lightgrey, width=540, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd1[label= "RX:| UID | FC | LEN | FLOAT_ABCD1 | FLOAT_ABCD2 | CRC |", color=lightyellow, width=540, colwidth=2, shape = roundedbox ,group=32bit_packets];
|
||||
rsp_fl_frm1[label="RX:| 01 | 03 | 08 | E4 00 46 40 | E4 00 46 40 | 90 65 |", color=lightgrey, width=540, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd2[label= "RX:| UID | FC | LEN | FLOAT_CDAB1 | FLOAT_CDAB2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=32bit_packets];
|
||||
rsp_fl_frm2[label="RX:| 01 | 03 | 08 | 46 40 E4 00 | 46 40 E4 00 | 18 71 |\n", color=lightgrey, width=540, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd3[label= "RX:| UID | FC | LEN | FLOAT_BADC1 | FLOAT_BADC2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=32bit_packets];
|
||||
rsp_fl_frm3[label="RX:| 01 | 03 | 08 | 00 E4 40 46 | 00 E4 40 46 | 46 D3 |\n", color=lightgrey, width=540, colwidth=2,group=32bit_packets];
|
||||
rsp_fl_hd4[label= "RX:| UID | FC | LEN | FLOAT_DCAB1 | FLOAT_DCAB2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=32bit_packets];
|
||||
rsp_fl_frm4[label="RX:| 01 | 03 | 08 | 40 46 00 E4 | 40 46 00 E4 | 32 6B |\n", color=lightgrey, width=540, colwidth=2,group=32bit_packets];
|
||||
64bit_notes[label="(UINT64, INT64, FLOAT64) VALUE = 0x40c81c8000000000 = 12345.0", width=600, color=lightblue, shape = roundedbox];
|
||||
req_dbl_hd1[label= "TX:| UID | FC | REG_START | REG_LEN | CRC |", color=lightyellow, width=540, colwidth=2, shape = roundedbox ,group=64bit_packets];
|
||||
req_dbl_frm1[label="TX:| 01 | 03 | 00 28 | 00 08 | C4 04 |", color=lightgrey, width=540, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd1[label= "RX:| UID | FC | LEN | DOUBLE_ABCDEFGH1 | DOUBLE_ABCDEFGH2 | CRC |", color=lightyellow, width=540, colwidth=2, shape = roundedbox ,group=64bit_packets];
|
||||
rsp_dbl_frm1[label="RX:| 01 | 03 | 10 | 00 00 00 00 1C 80 40 C8 | 00 00 00 00 1C 80 40 C8 | 9F 4B |", color=lightgrey, width=540, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd2[label= "RX:| UID | FC | LEN | DOUBLE_HGFEDCBA1 | DOUBLE_HGFEDCBA2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=64bit_packets];
|
||||
rsp_dbl_frm2[label="RX:| 01 | 03 | 10 | C8 40 80 1C 00 00 00 00 | C8 40 80 1C 00 00 00 00 | DF D3 |\n", color=lightgrey, width=540, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd3[label= "RX:| UID | FC | LEN | DOUBLE_GHEFCDAB1 | DOUBLE_GHEFCDAB2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=64bit_packets];
|
||||
rsp_dbl_frm3[label="RX:| 01 | 03 | 10 | 40 C8 1C 80 00 00 00 00 | 40 C8 1C 80 00 00 00 00 | B1 9C |\n", color=lightgrey, width=540, colwidth=2,group=64bit_packets];
|
||||
rsp_dbl_hd4[label= "RX:| UID | FC | LEN | DOUBLE_BADCFEHG1 | DOUBLE_BADCFEHG2 | CRC |\n ", color=lightyellow, width=540, colwidth=2, shape = roundedbox, group=64bit_packets];
|
||||
rsp_dbl_frm4[label="RX:| 01 | 03 | 10 | 00 00 00 00 80 1C C8 40 | 00 00 00 00 80 1C C8 40 | 86 94 |\n", color=lightgrey, width=540, colwidth=2,group=64bit_packets];
|
||||
}
|
||||
|
@ -12,6 +12,39 @@ The Modbus serial communication protocol is de facto standard protocol widely us
|
||||
|
||||
.. note:: This documentation (and included code snippets) requires some familiarity with the Modbus protocol. Refer to the Modbus Organization's with protocol specifications for specifics :ref:`modbus_organization`.
|
||||
|
||||
.. _modbus_supported_communication_options:
|
||||
|
||||
Modbus Supported Communication Options
|
||||
--------------------------------------
|
||||
|
||||
The Modbus library supports the standard communication options as per Modbus specification stated below.
|
||||
|
||||
.. list-table:: Standard Modbus communication options
|
||||
:widths: 10 90
|
||||
:header-rows: 1
|
||||
|
||||
* - Modbus option
|
||||
- Description of the option
|
||||
* - RTU communication
|
||||
- * 1 start bit
|
||||
* 8 data bits, least significant bit sent first
|
||||
* 1 bit for even / odd parity-no bit for no parity
|
||||
* 1 stop bit if parity is used, 2 stop bits if no parity
|
||||
* Cyclical Redundancy Check (CRC)
|
||||
* - ASCII communication
|
||||
- * 1 start bit
|
||||
* 7-8 data bits, least significant bit sent first
|
||||
* 1 bit for even / odd parity-no bit for no parity
|
||||
* 1 stop bit if parity is used, 2 stop bits if no parity
|
||||
* Longitudinal Redundancy Check (LRC)
|
||||
* - TCP communication
|
||||
- * Communications between client (master) - server (slave) over TCP/IP networks
|
||||
* Connection uses the standard port 502
|
||||
* The frames do not require checksum calculation (provided by lower layers)
|
||||
|
||||
Some vendors may use subset of communication options. In this case the detailed information is clarified in the device manual and it is possible to override the standard communication options for support of such devices.
|
||||
Please refer to :ref:`modbus_api_slave_setup_communication_options`, :ref:`modbus_api_master_setup_communication_options` for more information.
|
||||
|
||||
Messaging Model And Data Mapping
|
||||
--------------------------------
|
||||
|
||||
@ -227,7 +260,7 @@ The extended data types are used to define all possible combinations of groupped
|
||||
- Double BADCFEHG floating point, little endian, reversed register order
|
||||
- Little endian
|
||||
|
||||
.. note:: The support for the extended data types should be enabled using the option ``CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND`` in kconfig menu.
|
||||
.. note:: The support for the extended data types should be enabled using the option ``CONFIG_FMB_EXT_TYPE_SUPPORT`` in kconfig menu.
|
||||
|
||||
The below diagrams show how the extended data types appear on network layer.
|
||||
|
||||
|
@ -101,7 +101,7 @@ Example initialization of mapped values:
|
||||
Slave Communication
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The function below is used to start Modbus controller interface and allows communication.
|
||||
The function below is used to start Modbus controller interface and allows communication.
|
||||
|
||||
:cpp:func:`mbc_slave_start`
|
||||
|
||||
|
@ -1,7 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf docs
|
||||
build-docs --target esp32 --language en && true
|
||||
exit_if_error() {
|
||||
local exit_code=$1
|
||||
shift
|
||||
[[ $exit_code ]] && # do nothing if no error code passed
|
||||
((exit_code != 0)) && { # do nothing if error code is 0
|
||||
printf 'ERROR: %s\n' "$@" >&2
|
||||
exit "$exit_code"
|
||||
}
|
||||
}
|
||||
|
||||
rm -rf _build
|
||||
build-docs --target esp32 --language en || exit_if_error $? "Documentation build fail."
|
||||
|
||||
# Modifes target field of html files
|
||||
ELEMENT="<script type='text/javascript'>
|
||||
@ -24,4 +34,6 @@ for FILE in ${FILES}
|
||||
echo ${ELEMENT} >> "${FILE}"
|
||||
done
|
||||
|
||||
exit_if_error $? "Documentation build fail."
|
||||
|
||||
echo "Documentation build ok."
|
||||
|
@ -1 +1,2 @@
|
||||
esp-docs>=1.9.1,<2.0
|
||||
esp-docs>=1.9.1,<2.0
|
||||
Pillow==9.5.0
|
||||
|
@ -29,8 +29,9 @@ mb_err_enum_t mb_port_event_create(mb_port_base_t *inst)
|
||||
{
|
||||
mb_port_event_t *pevent = NULL;
|
||||
mb_err_enum_t ret = MB_EILLSTATE;
|
||||
MB_RETURN_ON_FALSE((inst), MB_EILLSTATE, TAG, "mb event creation error.");
|
||||
pevent = (mb_port_event_t *)calloc(1, sizeof(mb_port_event_t));
|
||||
MB_RETURN_ON_FALSE((pevent && inst), MB_EILLSTATE, TAG, "mb event creation error.");
|
||||
MB_RETURN_ON_FALSE((pevent), MB_EILLSTATE, TAG, "mb event creation error.");
|
||||
// Create modbus semaphore (mb resource).
|
||||
pevent->resource_hdl = xSemaphoreCreateBinary();
|
||||
MB_GOTO_ON_FALSE((pevent->resource_hdl), MB_EILLSTATE, error, TAG,
|
||||
@ -66,24 +67,28 @@ error:
|
||||
|
||||
inline void mb_port_event_set_err_type(mb_port_base_t *inst, mb_err_event_t event)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst && inst->event_obj), ;, TAG, "incorrect object handle.");
|
||||
atomic_store(&(inst->event_obj->curr_err_type), event);
|
||||
}
|
||||
|
||||
inline mb_err_event_t mb_port_event_get_err_type(mb_port_base_t *inst)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst && inst->event_obj), EV_ERROR_INIT, TAG, "incorrect object handle.");
|
||||
return atomic_load(&inst->event_obj->curr_err_type);
|
||||
}
|
||||
|
||||
uint64_t mb_port_get_trans_id(mb_port_base_t *inst)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst && inst->event_obj), 0, TAG, "incorrect object handle.");
|
||||
return atomic_load(&(inst->event_obj->curr_trans_id));
|
||||
}
|
||||
|
||||
bool mb_port_event_post(mb_port_base_t *inst, mb_event_t event)
|
||||
{
|
||||
if (!inst || !inst->event_obj || !inst->event_obj->event_hdl) {
|
||||
ESP_LOGE(TAG, "Wrong event handle %d %p %s.", (int)(event.event), inst, inst->descr.parent_name);
|
||||
}
|
||||
MB_RETURN_ON_FALSE((inst), false, TAG, "incorrect object handle for transaction %" PRIu64, event.trans_id);
|
||||
MB_RETURN_ON_FALSE((inst->event_obj && inst->event_obj->event_hdl), false, TAG,
|
||||
"Wrong event handle for transaction: %" PRIu64" %d, %p, %s.",
|
||||
event.trans_id, (int)(event.event), inst, inst->descr.parent_name);
|
||||
BaseType_t result = pdFALSE;
|
||||
mb_event_t temp_event;
|
||||
temp_event = event;
|
||||
@ -126,7 +131,8 @@ bool mb_port_event_post(mb_port_base_t *inst, mb_event_t event)
|
||||
|
||||
bool mb_port_event_get(mb_port_base_t *inst, mb_event_t *pevent)
|
||||
{
|
||||
assert(inst->event_obj->event_hdl);
|
||||
MB_RETURN_ON_FALSE((inst && pevent && inst->event_obj && inst->event_obj->event_hdl), false, TAG,
|
||||
"incorrect object handle.");
|
||||
bool event_happened = false;
|
||||
|
||||
if (xQueueReceive(inst->event_obj->event_hdl, pevent, MB_EVENT_QUEUE_TIMEOUT_MAX) == pdTRUE) {
|
||||
@ -141,6 +147,8 @@ bool mb_port_event_get(mb_port_base_t *inst, mb_event_t *pevent)
|
||||
|
||||
bool mb_port_event_res_take(mb_port_base_t *inst, uint32_t timeout)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst && inst->event_obj && inst->event_obj->resource_hdl), false, TAG,
|
||||
"incorrect object handle.");
|
||||
BaseType_t status = pdTRUE;
|
||||
status = xSemaphoreTake(inst->event_obj->resource_hdl, timeout);
|
||||
ESP_LOGD(TAG, "%s, mb take resource, (%" PRIu32 " ticks).", inst->descr.parent_name, timeout);
|
||||
@ -149,6 +157,8 @@ bool mb_port_event_res_take(mb_port_base_t *inst, uint32_t timeout)
|
||||
|
||||
void mb_port_event_res_release(mb_port_base_t *inst)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst && inst->event_obj && inst->event_obj->resource_hdl), ;, TAG,
|
||||
"incorrect object handle.");
|
||||
BaseType_t status = pdFALSE;
|
||||
status = xSemaphoreGive(inst->event_obj->resource_hdl);
|
||||
if (status != pdTRUE) {
|
||||
@ -158,11 +168,14 @@ void mb_port_event_res_release(mb_port_base_t *inst)
|
||||
|
||||
void mb_port_event_set_resp_flag(mb_port_base_t *inst, mb_event_enum_t event_mask)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst), ;, TAG, "incorrect object handle.");
|
||||
(void)xEventGroupSetBits(inst->event_obj->event_group_hdl, event_mask);
|
||||
}
|
||||
|
||||
mb_err_enum_t mb_port_event_wait_req_finish(mb_port_base_t *inst)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst), MB_EINVAL, TAG,
|
||||
"incorrect object handle.");
|
||||
mb_err_enum_t err_status = MB_ENOERR;
|
||||
mb_event_enum_t rcv_event;
|
||||
EventBits_t bits = xEventGroupWaitBits(inst->event_obj->event_group_hdl, // The event group being tested.
|
||||
@ -195,6 +208,8 @@ mb_err_enum_t mb_port_event_wait_req_finish(mb_port_base_t *inst)
|
||||
|
||||
void mb_port_event_delete(mb_port_base_t *inst)
|
||||
{
|
||||
MB_RETURN_ON_FALSE((inst), ;, TAG,
|
||||
"incorrect event object handle.");
|
||||
if (inst->event_obj->resource_hdl) {
|
||||
vSemaphoreDelete(inst->event_obj->resource_hdl);
|
||||
}
|
||||
|
Reference in New Issue
Block a user