From c4dadeab4a60dc9c302d85eceedb81b85a5f991d Mon Sep 17 00:00:00 2001 From: "Michal Princ (nxa17570)" Date: Tue, 10 Jan 2023 00:47:07 +0100 Subject: [PATCH] eRPC updates 01/2023 -- MUTransport adaptation to new supported SoCs. -- Made MUTransport class variables volatile. -- Add missing setCrc16 and getCrc16 methods into rpmsg transport layers. -- Adapt rpmsg_lite based transports to changed rpmsg_lite_wait_for_link_up() API parameters. -- Serialize enums as int32 instead of uint32 in Python. -- Replace github.com/NXPmicro by github.com/nxp-mcuxpresso. -- Update license file. --- LICENSE | 2 +- README.md | 8 ++-- doxygen/Doxyfile.erpc | 2 +- doxygen/Doxyfile.erpcgen | 2 +- erpc_c/infra/erpc_message_buffer.cpp | 6 ++- erpc_c/infra/erpc_transport.hpp | 2 +- erpc_c/infra/erpc_version.h | 4 +- erpc_c/setup/erpc_transport_setup.h | 2 +- erpc_c/transports/erpc_mu_transport.cpp | 34 ++++++---------- erpc_c/transports/erpc_mu_transport.hpp | 39 ++++++++++++++----- .../transports/erpc_rpmsg_linux_transport.hpp | 2 +- .../erpc_rpmsg_lite_rtos_transport.cpp | 14 ++++++- .../erpc_rpmsg_lite_rtos_transport.hpp | 17 +++++++- .../transports/erpc_rpmsg_lite_transport.cpp | 14 ++++++- .../transports/erpc_rpmsg_lite_transport.hpp | 17 +++++++- .../erpc_rpmsg_tty_rtos_transport.cpp | 2 +- erpc_python/erpc/erpc_version.py | 2 +- erpcgen/src/templates/py_coders.template | 4 +- erpcgen/src/templates/py_interface.template | 2 +- .../service/__init__.py | 2 +- .../service/erpc_matrix_multiply/__init__.py | 6 +-- .../service/erpc_matrix_multiply/client.py | 2 +- .../service/erpc_matrix_multiply/common.py | 2 +- .../service/erpc_matrix_multiply/interface.py | 2 +- .../service/erpc_matrix_multiply/server.py | 2 +- test/common/unit_test_server.cpp | 6 ++- 26 files changed, 132 insertions(+), 65 deletions(-) diff --git a/LICENSE b/LICENSE index bd77a927..cfe35768 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ Copyright 2014-2016 Freescale Semiconductor, Inc. -Copyright 2016-2022 NXP +Copyright 2016-2023 NXP All rights reserved. The BSD 3 Clause License diff --git a/README.md b/README.md index acbff514..2aa3498e 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Supported transports: * NXP Kinetis SPI and DSPI * POSIX and Windows serial port * TCP/IP (mostly for testing) -* [NXP RPMsg-Lite / RPMsg TTY](https://github.com/NXPmicro/rpmsg-lite) +* [NXP RPMsg-Lite / RPMsg TTY](https://github.com/nxp-mcuxpresso/rpmsg-lite) * SPIdev Linux * USB CDC * NXP Messaging Unit @@ -102,8 +102,8 @@ To get the board list with multicore support (eRPC included) use filtering based eRPC examples use the 'erpc_' name prefix. -Another way of getting NXP MCUXpressoSDK eRPC multicore and multiprocessor examples is using the [mcux-sdk](https://github.com/NXPmicro/mcux-sdk) Github repo. Follow the description how to use the West tool -to clone and update the mcuxsdk repo in [readme Overview section](https://github.com/NXPmicro/mcux-sdk#overview). Once done the armgcc eRPC examples can be found in +Another way of getting NXP MCUXpressoSDK eRPC multicore and multiprocessor examples is using the [mcux-sdk](https://github.com/nxp-mcuxpresso/mcux-sdk) Github repo. Follow the description how to use the West tool +to clone and update the mcuxsdk repo in [readme Overview section](https://github.com/nxp-mcuxpresso/mcux-sdk#overview). Once done the armgcc eRPC examples can be found in mcuxsdk/examples//multicore_examples or in @@ -230,4 +230,4 @@ Repository on Github contains two main branches. __Master__ and __develop__. Cod --- Copyright 2014-2016 Freescale Semiconductor, Inc. -Copyright 2016-2021 NXP +Copyright 2016-2023 NXP diff --git a/doxygen/Doxyfile.erpc b/doxygen/Doxyfile.erpc index 7016d0cf..b3e5f091 100644 --- a/doxygen/Doxyfile.erpc +++ b/doxygen/Doxyfile.erpc @@ -38,7 +38,7 @@ PROJECT_NAME = "eRPC API Reference" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "Rev. 1.9.1" +PROJECT_NUMBER = "Rev. 1.10.0" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/doxygen/Doxyfile.erpcgen b/doxygen/Doxyfile.erpcgen index 7fa3934c..348fffc9 100644 --- a/doxygen/Doxyfile.erpcgen +++ b/doxygen/Doxyfile.erpcgen @@ -38,7 +38,7 @@ PROJECT_NAME = "eRPC Generator (erpcgen)" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "Rev. 1.9.1" +PROJECT_NUMBER = "Rev. 1.10.0" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/erpc_c/infra/erpc_message_buffer.cpp b/erpc_c/infra/erpc_message_buffer.cpp index 7a347549..8c2cfc90 100644 --- a/erpc_c/infra/erpc_message_buffer.cpp +++ b/erpc_c/infra/erpc_message_buffer.cpp @@ -113,14 +113,16 @@ void MessageBuffer::Cursor::set(MessageBuffer *buffer) uint8_t &MessageBuffer::Cursor::operator[](int index) { - erpc_assert(((m_pos + index) >= m_buffer->get()) && ((uint16_t)(m_pos - m_buffer->get()) + index <= m_buffer->getLength())); + erpc_assert(((m_pos + index) >= m_buffer->get()) && + ((uint16_t)(m_pos - m_buffer->get()) + index <= m_buffer->getLength())); return m_pos[index]; } const uint8_t &MessageBuffer::Cursor::operator[](int index) const { - erpc_assert(((m_pos + index) >= m_buffer->get()) && ((uint16_t)(m_pos - m_buffer->get()) + index <= m_buffer->getLength())); + erpc_assert(((m_pos + index) >= m_buffer->get()) && + ((uint16_t)(m_pos - m_buffer->get()) + index <= m_buffer->getLength())); return m_pos[index]; } diff --git a/erpc_c/infra/erpc_transport.hpp b/erpc_c/infra/erpc_transport.hpp index ea3267b3..88fe2e16 100644 --- a/erpc_c/infra/erpc_transport.hpp +++ b/erpc_c/infra/erpc_transport.hpp @@ -91,7 +91,7 @@ class Transport * * @return Crc16* Pointer to CRC-16 object containing crc-16 compute function. */ - virtual Crc16 *getCrc16() { return NULL; } + virtual Crc16 *getCrc16(void) { return NULL; } }; /*! diff --git a/erpc_c/infra/erpc_version.h b/erpc_c/infra/erpc_version.h index a4a95853..bd52c132 100644 --- a/erpc_c/infra/erpc_version.h +++ b/erpc_c/infra/erpc_version.h @@ -20,9 +20,9 @@ //////////////////////////////////////////////////////////////////////////////// //! @brief String version of eRPC. -#define ERPC_VERSION "1.9.1" +#define ERPC_VERSION "1.10.0" //! @brief Integer version of eRPC. -#define ERPC_VERSION_NUMBER 10901 +#define ERPC_VERSION_NUMBER 11000 /*! @} */ diff --git a/erpc_c/setup/erpc_transport_setup.h b/erpc_c/setup/erpc_transport_setup.h index fd70f206..eaa8b0ce 100644 --- a/erpc_c/setup/erpc_transport_setup.h +++ b/erpc_c/setup/erpc_transport_setup.h @@ -279,7 +279,7 @@ void erpc_transport_rpmsg_lite_tty_rtos_deinit(void); * @brief Create an Linux RPMSG endpoint transport. * * This function is using RPMSG endpoints based on this implementation: - * github.com/NXPmicro/rpmsg-sysfs/tree/0aa1817545a765c200b1b2f9b6680a420dcf9171 . + * github.com/nxp-mcuxpresso/rpmsg-sysfs/tree/0aa1817545a765c200b1b2f9b6680a420dcf9171 . * * When local/remote address is set to '-1', then default addresses will be used. * When type is set to '0', then Datagram model will be used, else Stream. diff --git a/erpc_c/transports/erpc_mu_transport.cpp b/erpc_c/transports/erpc_mu_transport.cpp index 423d0d66..80d04eb1 100644 --- a/erpc_c/transports/erpc_mu_transport.cpp +++ b/erpc_c/transports/erpc_mu_transport.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 NXP + * Copyright 2017-2022 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -39,8 +39,7 @@ static MUTransport *s_mu_instance = NULL; void MUTransport::mu_tx_empty_irq_callback(void) { MUTransport *transport = s_mu_instance; - if ((transport != NULL) && - (0U != (transport->m_muBase->CR & (1UL << (MU_CR_TIEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT))))) + if ((transport != NULL) && MU_IS_TX_EMPTY_FLAG_SET) { transport->tx_cb(); } @@ -49,8 +48,7 @@ void MUTransport::mu_tx_empty_irq_callback(void) void MUTransport::mu_rx_full_irq_callback(void) { MUTransport *transport = s_mu_instance; - if ((transport != NULL) && - (0U != (transport->m_muBase->CR & (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT))))) + if ((transport != NULL) && MU_IS_RX_FULL_FLAG_SET) { transport->rx_cb(); } @@ -60,27 +58,17 @@ void MUTransport::mu_irq_callback(void) { MUTransport *transport = s_mu_instance; uint32_t flags; - uint32_t rxFlags; - uint32_t txFlags; flags = MU_GetStatusFlags(transport->m_muBase); - // parse flags of full rx registers - rxFlags = ((flags & MU_SR_RFn_MASK) >> MU_SR_RFn_SHIFT); - rxFlags = (rxFlags >> (MU_RR_COUNT - MU_REG_COUNT)); - - // parse flags of empty tx registers - txFlags = ((flags & MU_SR_TEn_MASK) >> MU_SR_TEn_SHIFT); - txFlags = (txFlags >> (MU_TR_COUNT - MU_REG_COUNT)); - // RECEIVING - rx full flag and rx full irq enabled - if ((rxFlags & 0x1U) && (transport->m_muBase->CR & (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT)))) + if ((flags & MU_SR_RX_MASK) && MU_IS_RX_FULL_FLAG_SET) { transport->rx_cb(); } // TRANSMITTING - tx empty flag and tx empty irq enabled - if ((txFlags & 0x1U) && (transport->m_muBase->CR & (1UL << (MU_CR_TIEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT)))) + if ((flags & MU_SR_TX_MASK) && MU_IS_TX_EMPTY_FLAG_SET) { transport->tx_cb(); } @@ -118,7 +106,7 @@ erpc_status_t MUTransport::init(MU_Type *muBase) #if !ERPC_THREADS // enabling the MU rx full irq is necessary only for BM app - MU_EnableInterrupts(m_muBase, (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT))); + MU_EnableInterrupts(m_muBase, MU_RX_INTR_MASK); #endif NVIC_SetPriority(MU_IRQ, MU_IRQ_PRIORITY); @@ -135,7 +123,7 @@ void MUTransport::rx_cb(void) { // the receive function has not been called yet // disable MU rx full interrupt - MU_DisableInterrupts(m_muBase, (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT))); + MU_DisableInterrupts(m_muBase, MU_RX_INTR_MASK); m_newMessage = true; } else @@ -166,7 +154,7 @@ void MUTransport::rx_cb(void) m_rxBuffer = NULL; #if !ERPC_THREADS_IS(NONE) // disable MU rx full interrupt in rtos-based blocking implementation - MU_DisableInterrupts(m_muBase, (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT))); + MU_DisableInterrupts(m_muBase, MU_RX_INTR_MASK); m_rxSemaphore.putFromISR(); #endif } @@ -195,7 +183,7 @@ void MUTransport::tx_cb(void) if (m_txCntBytes >= m_txMsgSize) { // disable MU tx empty irq from the last tx reg - MU_DisableInterrupts(m_muBase, (1UL << (MU_CR_TIEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT))); + MU_DisableInterrupts(m_muBase, MU_TX_INTR_MASK); // unblock caller of the send function m_txBuffer = NULL; @@ -224,7 +212,7 @@ erpc_status_t MUTransport::receive(MessageBuffer *message) m_rxBuffer = (uint32_t *)message->get(); // enable the MU rx full irq - MU_EnableInterrupts(m_muBase, (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT))); + MU_EnableInterrupts(m_muBase, MU_RX_INTR_MASK); // wait until the receiving is not complete #if !ERPC_THREADS_IS(NONE) @@ -282,7 +270,7 @@ erpc_status_t MUTransport::send(MessageBuffer *message) if (m_txCntBytes < m_txMsgSize) { // enable MU tx empty irq from the last mu tx reg - MU_EnableInterrupts(m_muBase, (1UL << (MU_CR_TIEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT))); + MU_EnableInterrupts(m_muBase, MU_TX_INTR_MASK); // wait until the sending is not complete #if !ERPC_THREADS_IS(NONE) (void)m_txSemaphore.get(); diff --git a/erpc_c/transports/erpc_mu_transport.hpp b/erpc_c/transports/erpc_mu_transport.hpp index 6bced3ac..d9f1ca71 100644 --- a/erpc_c/transports/erpc_mu_transport.hpp +++ b/erpc_c/transports/erpc_mu_transport.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 NXP + * Copyright 2017-2022 NXP * All rights reserved. * * @@ -47,6 +47,27 @@ extern "C" { #else #define MU_REG_COUNT (MU_RR_COUNT) /*!< Count of MU tx/rx registers to be used by this transport layer */ #endif /* ERPC_TRANSPORT_MU_USE_MCMGR */ + +#if (defined(CPU_MIMXRT1189AVM8A_cm7) || defined(CPU_MIMXRT1189CVM8A_cm7) || defined(CPU_MIMXRT1189CVM8A_cm7) || \ + defined(CPU_MIMXRT1189AVM8A_cm33) || defined(CPU_MIMXRT1189CVM8A_cm33) || defined(CPU_MIMXRT1189CVM8A_cm33)) +#define MU_TX_SHIFT (1UL << (MU_REG_COUNT - 1U)) +#define MU_RX_SHIFT (1UL << (MU_REG_COUNT - 1U)) +#define MU_RX_INTR_MASK (MU_RX_INTR(MU_RX_SHIFT)) +#define MU_TX_INTR_MASK (MU_TX_INTR(MU_TX_SHIFT)) +#define MU_IS_TX_EMPTY_FLAG_SET (0U != (transport->m_muBase->TCR & MU_TX_SHIFT)) +#define MU_IS_RX_FULL_FLAG_SET (0U != (transport->m_muBase->RCR & MU_RX_SHIFT)) +#define MU_SR_TX_MASK (1UL << (20U + (MU_REG_COUNT - 1U))) +#define MU_SR_RX_MASK (1UL << (24U + (MU_REG_COUNT - 1U))) +#else +#define MU_TX_SHIFT (1UL << (MU_CR_TIEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT)) +#define MU_RX_SHIFT (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT)) +#define MU_RX_INTR_MASK (MU_RX_SHIFT) +#define MU_TX_INTR_MASK (MU_TX_SHIFT) +#define MU_IS_TX_EMPTY_FLAG_SET (0U != (transport->m_muBase->CR & MU_TX_SHIFT)) +#define MU_IS_RX_FULL_FLAG_SET (0U != (transport->m_muBase->CR & MU_RX_SHIFT)) +#define MU_SR_TX_MASK (1UL << (MU_SR_TEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT)) +#define MU_SR_RX_MASK (1UL << (MU_SR_RFn_SHIFT + MU_RR_COUNT - MU_REG_COUNT)) +#endif //////////////////////////////////////////////////////////////////////////////// // Classes //////////////////////////////////////////////////////////////////////////////// @@ -176,15 +197,15 @@ class MUTransport : public Transport */ void tx_cb(void); - volatile bool m_newMessage; /*!< Flag used in function hasMessage() to inform server by polling function that - message is ready for receiving */ - uint32_t m_rxMsgSize; /*!< Size of received message - count of bytes to must be received to complete currently - received message */ - uint32_t m_rxCntBytes; /*!< Count of currently received bytes of message */ + volatile bool m_newMessage; /*!< Flag used in function hasMessage() to inform server by polling function that + message is ready for receiving */ + volatile uint32_t m_rxMsgSize; /*!< Size of received message - count of bytes to must be received to complete + currently received message */ + uint32_t m_rxCntBytes; /*!< Count of currently received bytes of message */ uint32_t *volatile m_rxBuffer; /*!< Pointer to buffer to which is copied data from MU registers during receiving */ - uint32_t m_txMsgSize; /*!< Size of transmitted message - count of bytes to must be transmitted to send complete - message */ - uint32_t m_txCntBytes; /*!< Count of currently received bytes of message */ + volatile uint32_t m_txMsgSize; /*!< Size of transmitted message - count of bytes to must be transmitted to send + complete message */ + uint32_t m_txCntBytes; /*!< Count of currently received bytes of message */ uint32_t *volatile m_txBuffer; /*!< Pointer to buffer from which is copied data to MU registers during sending */ #if !ERPC_THREADS_IS(NONE) diff --git a/erpc_c/transports/erpc_rpmsg_linux_transport.hpp b/erpc_c/transports/erpc_rpmsg_linux_transport.hpp index 93ca059c..968780d7 100644 --- a/erpc_c/transports/erpc_rpmsg_linux_transport.hpp +++ b/erpc_c/transports/erpc_rpmsg_linux_transport.hpp @@ -19,7 +19,7 @@ namespace erpc { /*! * @brief RPMSG Linux transport to send/receive messages through RPMSG endpoints - * based on github.com/NXPmicro/rpmsg-sysfs/tree/0aa1817545a765c200b1b2f9b6680a420dcf9171 + * based on github.com/nxp-mcuxpresso/rpmsg-sysfs/tree/0aa1817545a765c200b1b2f9b6680a420dcf9171 * implementation. * @ingroup rpmsg_linux_transport */ diff --git a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp index be4c2f32..2b39a5cb 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp @@ -34,6 +34,7 @@ RPMsgRTOSTransport::RPMsgRTOSTransport(void) , m_dst_addr(0) , m_rpmsg_queue(NULL) , m_rpmsg_ept(NULL) +, m_crcImpl(NULL) { } @@ -70,6 +71,17 @@ RPMsgRTOSTransport::~RPMsgRTOSTransport(void) } } +void RPMsgRTOSTransport::setCrc16(Crc16 *crcImpl) +{ + erpc_assert(crcImpl != NULL); + m_crcImpl = crcImpl; +} + +Crc16 *RPMsgRTOSTransport::getCrc16(void) +{ + return m_crcImpl; +} + erpc_status_t RPMsgRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, uint32_t rpmsg_link_id) { @@ -166,7 +178,7 @@ erpc_status_t RPMsgRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, voi ready_cb(); } - rpmsg_lite_wait_for_link_up(s_rpmsg); + (void)rpmsg_lite_wait_for_link_up(s_rpmsg, RL_BLOCK); #if RL_USE_STATIC_API m_rpmsg_queue = rpmsg_queue_create(s_rpmsg, m_queue_stack, &m_queue_context); diff --git a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.hpp b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.hpp index 3e084878..f237d0b0 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.hpp +++ b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2022 NXP * All rights reserved. * * @@ -10,6 +10,7 @@ #ifndef _EMBEDDED_RPC__RPMSG_LITE_RTOS_TRANSPORT_H_ #define _EMBEDDED_RPC__RPMSG_LITE_RTOS_TRANSPORT_H_ +#include "erpc_crc16.hpp" #include "erpc_message_buffer.hpp" #include "erpc_rpmsg_lite_base_transport.hpp" @@ -107,6 +108,19 @@ class RPMsgRTOSTransport : public RPMsgBaseTransport */ virtual erpc_status_t send(MessageBuffer *message); + /*! + * @brief This functions sets the CRC-16 implementation. + * + * @param[in] crcImpl Object containing crc-16 compute function. + */ + virtual void setCrc16(Crc16 *crcImpl); + + /*! + * @brief This functions gets the CRC-16 object. + * + * @return Crc16* Pointer to CRC-16 object containing crc-16 compute function. + */ + virtual Crc16 *getCrc16(void); /*! * @brief Function to check if is message in receive queue and wait for processing. * @@ -123,6 +137,7 @@ class RPMsgRTOSTransport : public RPMsgBaseTransport uint32_t m_dst_addr; /*!< Destination address used by rpmsg. */ rpmsg_queue_handle m_rpmsg_queue; /*!< Handle of RPMsg queue. */ struct rpmsg_lite_endpoint *m_rpmsg_ept; /*!< Pointer to RPMsg Lite Endpoint structure. */ + Crc16 *m_crcImpl; //!< CRC object. }; } // namespace erpc diff --git a/erpc_c/transports/erpc_rpmsg_lite_transport.cpp b/erpc_c/transports/erpc_rpmsg_lite_transport.cpp index 45dbcf83..70086767 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_lite_transport.cpp @@ -43,6 +43,7 @@ RPMsgTransport::RPMsgTransport(void) : RPMsgBaseTransport() , m_dst_addr(0) , m_rpmsg_ept(NULL) +, m_crcImpl(NULL) { } @@ -71,6 +72,17 @@ RPMsgTransport::~RPMsgTransport(void) } } +void RPMsgTransport::setCrc16(Crc16 *crcImpl) +{ + erpc_assert(crcImpl != NULL); + m_crcImpl = crcImpl; +} + +Crc16 *RPMsgTransport::getCrc16(void) +{ + return m_crcImpl; +} + erpc_status_t RPMsgTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, uint32_t rpmsg_link_id) { @@ -146,7 +158,7 @@ erpc_status_t RPMsgTransport::init(uint32_t src_addr, uint32_t dst_addr, void *b ready_cb(); } - rpmsg_lite_wait_for_link_up(s_rpmsg); + (void)rpmsg_lite_wait_for_link_up(s_rpmsg, RL_BLOCK); #if RL_USE_STATIC_API m_rpmsg_ept = rpmsg_lite_create_ept(s_rpmsg, src_addr, rpmsg_read_cb, this, &m_ept_context); diff --git a/erpc_c/transports/erpc_rpmsg_lite_transport.hpp b/erpc_c/transports/erpc_rpmsg_lite_transport.hpp index ba681790..7fcaa3c9 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_transport.hpp +++ b/erpc_c/transports/erpc_rpmsg_lite_transport.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. - * Copyright 2016-2021 NXP + * Copyright 2016-2022 NXP * All rights reserved. * * @@ -10,6 +10,7 @@ #ifndef _EMBEDDED_RPC__RPMSG_LITE_TRANSPORT_H_ #define _EMBEDDED_RPC__RPMSG_LITE_TRANSPORT_H_ +#include "erpc_crc16.hpp" #include "erpc_config_internal.h" #include "erpc_message_buffer.hpp" #include "erpc_rpmsg_lite_base_transport.hpp" @@ -111,6 +112,19 @@ class RPMsgTransport : public RPMsgBaseTransport */ virtual erpc_status_t send(MessageBuffer *message); + /*! + * @brief This functions sets the CRC-16 implementation. + * + * @param[in] crcImpl Object containing crc-16 compute function. + */ + virtual void setCrc16(Crc16 *crcImpl); + + /*! + * @brief This functions gets the CRC-16 object. + * + * @return Crc16* Pointer to CRC-16 object containing crc-16 compute function. + */ + virtual Crc16 *getCrc16(void); /*! * @brief Function to check if is message in receive queue and wait for processing. * @@ -141,6 +155,7 @@ class RPMsgTransport : public RPMsgBaseTransport uint32_t m_dst_addr; /*!< Destination address used by rpmsg. */ struct rpmsg_lite_endpoint *m_rpmsg_ept; /*!< Pointer to RPMsg Lite Endpoint structure. */ + Crc16 *m_crcImpl; //!< CRC object. }; } // namespace erpc diff --git a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp index 2cf4d341..d13c9636 100644 --- a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp @@ -178,7 +178,7 @@ erpc_status_t RPMsgTTYRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, ready_cb(); } - rpmsg_lite_wait_for_link_up(s_rpmsg); + (void)rpmsg_lite_wait_for_link_up(s_rpmsg, RL_BLOCK); #if RL_USE_STATIC_API m_rpmsg_queue = rpmsg_queue_create(s_rpmsg, m_queue_stack, &m_queue_context); diff --git a/erpc_python/erpc/erpc_version.py b/erpc_python/erpc/erpc_version.py index 51f59d29..b3f67c57 100644 --- a/erpc_python/erpc/erpc_version.py +++ b/erpc_python/erpc/erpc_version.py @@ -6,4 +6,4 @@ # SPDX-License-Identifier: BSD-3-Clause # Should be same as in erpc_version.h -ERPC_VERSION = "1.9.1" +ERPC_VERSION = "1.10.0" diff --git a/erpcgen/src/templates/py_coders.template b/erpcgen/src/templates/py_coders.template index ac272efc..3df4db7b 100644 --- a/erpcgen/src/templates/py_coders.template +++ b/erpcgen/src/templates/py_coders.template @@ -9,7 +9,7 @@ {$name}._write({$codec}, {$info.discriminatorName}){%>%} {#--------------- enum ---------------#} {% elif info.type == "enum" %} -{$codec}.write_uint32({$name}){%>%} +{$codec}.write_int32({$name}){%>%} {#--------------- string ---------------#} {% elif info.type == "string" %} {$codec}.write_string({$name}){%>%} @@ -46,7 +46,7 @@ {$name}, {$info.discriminatorName} = {$commonPrefix}{$info.name}()._read({$codec}){%>%} {#--------------- enum ---------------#} {% elif info.type == "enum" %} -{$name} = {$codec}.read_uint32(){%>%} +{$name} = {$codec}.read_int32(){%>%} {#--------------- string ---------------#} {% elif info.type == "string" %} {$name} = {$codec}.read_string(){%>%} diff --git a/erpcgen/src/templates/py_interface.template b/erpcgen/src/templates/py_interface.template index 04a3c72b..9a0ebd34 100644 --- a/erpcgen/src/templates/py_interface.template +++ b/erpcgen/src/templates/py_interface.template @@ -8,7 +8,7 @@ # AUTOGENERATED - DO NOT EDIT # -{% for iface in group.interfaces if iface.isNonExternalInterface == true %} +{% for iface in group.interfaces %} {% if iface.mlComment %} {$iface.mlComment} {% else %} diff --git a/examples/matrix_multiply_tcp_python/service/__init__.py b/examples/matrix_multiply_tcp_python/service/__init__.py index d1c9ed72..7f501191 100644 --- a/examples/matrix_multiply_tcp_python/service/__init__.py +++ b/examples/matrix_multiply_tcp_python/service/__init__.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. +# Generated by erpcgen 1.10.0 on Thu Oct 13 21:22:10 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py index cb6a3109..7a0ca3b5 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/__init__.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. +# Generated by erpcgen 1.10.0 on Thu Oct 13 21:22:10 2022. # # AUTOGENERATED - DO NOT EDIT # @@ -15,8 +15,8 @@ version = erpc_version.ERPC_VERSION except ImportError: version = "unknown" -if version != "1.9.1": - raise ValueError("The generated shim code version (1.9.1) is different to the rest of eRPC code (%s). \ +if version != "1.10.0": + raise ValueError("The generated shim code version (1.10.0) is different to the rest of eRPC code (%s). \ Install newer version by running \"python setup.py install\" in folder erpc/erpc_python/." % repr(version)) from . import common diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py index 1f7dfd67..4a05460a 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/client.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. +# Generated by erpcgen 1.10.0 on Thu Oct 13 21:22:10 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py index 0ee0524e..511c4033 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/common.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. +# Generated by erpcgen 1.10.0 on Thu Oct 13 21:22:10 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py index 81c19590..8137fcc0 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/interface.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. +# Generated by erpcgen 1.10.0 on Thu Oct 13 21:22:10 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py index 7e961917..ccb2daa4 100644 --- a/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py +++ b/examples/matrix_multiply_tcp_python/service/erpc_matrix_multiply/server.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause # -# Generated by erpcgen 1.9.1 on Tue Apr 12 11:04:35 2022. +# Generated by erpcgen 1.10.0 on Thu Oct 13 21:22:10 2022. # # AUTOGENERATED - DO NOT EDIT # diff --git a/test/common/unit_test_server.cpp b/test/common/unit_test_server.cpp index 1883ba8f..aa755efc 100644 --- a/test/common/unit_test_server.cpp +++ b/test/common/unit_test_server.cpp @@ -17,13 +17,15 @@ extern "C" { #define APP_ERPC_READY_EVENT_DATA (1) #include "mcmgr.h" #include "rpmsg_lite.h" +#include "app_core1.h" #elif defined(UART) -#include "fsl_usart_cmsis.h" +#include "fsl_lpuart_cmsis.h" +#include "app_core0.h" #elif defined(MU) #define APP_ERPC_READY_EVENT_DATA (1) #include "mcmgr.h" -#endif #include "app_core1.h" +#endif #if defined(__CC_ARM) || defined(__ARMCC_VERSION) int main(int argc, const char *argv[]); #endif