diff --git a/README.md b/README.md index fb243b6a..6dc3ad2a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Client side usage: void example_client(void) { // Initialize client running over UART. erpc_client_init( - erpc_transport_cmsis_uart_init(UART0_NonBlocking_Driver); + erpc_transport_cmsis_uart_init(Driver_USART0); // Now we can call the remote function to turn on the green LED. set_led(kGreen, true); @@ -43,7 +43,7 @@ void set_led(LEDName whichLed, bool onOrOff) { void example_server(void) { // Initialize server running over UART. erpc_server_init( - erpc_transport_uart_init(UART0_NonBlocking_Driver); + erpc_transport_cmsis_uart_init(Driver_USART0); // Add the IO service. erpc_add_service_to_server(create_IO_service()); @@ -71,7 +71,7 @@ eRPC is available with an unrestrictive BSD 3-clause license. See the LICENSE fi ## Documentation -[Documentation](https://github.com/EmbeddedRPC/erpc/wiki) is in the `wiki` section. Commit sha in wiki repository: 7199a9c00fef4b952a6b05a8e3b0257f788e4eeb. +[Documentation](https://github.com/EmbeddedRPC/erpc/wiki) is in the `wiki` section. Commit sha in wiki repository: 431cba8. [Example IDL](examples/README.md) is available in the `examples/` folder. diff --git a/doxygen/Doxyfile.erpc b/doxygen/Doxyfile.erpc index a76e2af5..dae9cb25 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.7.2" +PROJECT_NUMBER = "Rev. 1.7.3" # 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 c83ed08a..1771189b 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.7.2" +PROJECT_NUMBER = "Rev. 1.7.3" # 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/config/erpc_config.h b/erpc_c/config/erpc_config.h index a8a1b84a..6e2e7353 100644 --- a/erpc_c/config/erpc_config.h +++ b/erpc_c/config/erpc_config.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2016-2018 NXP + * Copyright 2016-2019 NXP * All rights reserved. * * @@ -94,7 +94,7 @@ //! @def ERPC_MESSAGE_LOGGING //! -//! Enable eRPC message logging code through the eRPC. Take look into "message_logging.h". Can be used for base printing +//! Enable eRPC message logging code through the eRPC. Take look into "erpc_message_loggers.h". Can be used for base printing //! messages, or sending data to another system for data analysis. Default set to ERPC_MESSAGE_LOGGING_DISABLED. //! //! Uncomment for using logging feature. @@ -112,7 +112,7 @@ //! is part of the project, otherwise the ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED option is used. This settings can be //! overwritten from the erpc_config.h by uncommenting the ERPC_TRANSPORT_MU_USE_MCMGR macro definition. Do not forget //! to add the MCMGR library into your project when ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED option is used! See the -//! mu_transport.h for additional MU settings. +//! erpc_mu_transport.h for additional MU settings. //#define ERPC_TRANSPORT_MU_USE_MCMGR ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED //@} diff --git a/erpc_c/infra/erpc_arbitrated_client_manager.cpp b/erpc_c/infra/erpc_arbitrated_client_manager.cpp index 50c20463..a6866164 100644 --- a/erpc_c/infra/erpc_arbitrated_client_manager.cpp +++ b/erpc_c/infra/erpc_arbitrated_client_manager.cpp @@ -29,7 +29,7 @@ void ArbitratedClientManager::setArbitrator(TransportArbitrator *arbitrator) m_transport = arbitrator; } -erpc_status_t ArbitratedClientManager::performClientRequest(RequestContext &request) +void ArbitratedClientManager::performClientRequest(RequestContext &request) { assert(m_arbitrator && "arbitrator not set"); @@ -42,13 +42,15 @@ erpc_status_t ArbitratedClientManager::performClientRequest(RequestContext &requ #if ERPC_NESTED_CALLS_DETECTION if (nestingDetection) { - return kErpcStatus_NestedCallFailure; + request.getCodec()->updateStatus(kErpcStatus_NestedCallFailure); + return; } #endif token = m_arbitrator->prepareClientReceive(request); if (!token) { - return kErpcStatus_Fail; + request.getCodec()->updateStatus(kErpcStatus_Fail); + return; } } @@ -58,7 +60,8 @@ erpc_status_t ArbitratedClientManager::performClientRequest(RequestContext &requ err = logMessage(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #endif @@ -66,7 +69,8 @@ erpc_status_t ArbitratedClientManager::performClientRequest(RequestContext &requ err = m_arbitrator->send(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } if (!request.isOneway()) @@ -75,14 +79,16 @@ erpc_status_t ArbitratedClientManager::performClientRequest(RequestContext &requ err = m_arbitrator->clientReceive(token); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #if ERPC_MESSAGE_LOGGING err = logMessage(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #endif @@ -90,9 +96,10 @@ erpc_status_t ArbitratedClientManager::performClientRequest(RequestContext &requ err = verifyReply(request); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } } - return kErpcStatus_Success; + return; } diff --git a/erpc_c/infra/erpc_arbitrated_client_manager.h b/erpc_c/infra/erpc_arbitrated_client_manager.h index 194dad06..d6bf0922 100644 --- a/erpc_c/infra/erpc_arbitrated_client_manager.h +++ b/erpc_c/infra/erpc_arbitrated_client_manager.h @@ -69,7 +69,7 @@ class ArbitratedClientManager : public ClientManager * * @param[in] request Request context to perform. */ - virtual erpc_status_t performClientRequest(RequestContext &request); + virtual void performClientRequest(RequestContext &request); //! @brief This method is not used with this class. void setTransport(Transport *transport) {} diff --git a/erpc_c/infra/erpc_client_manager.cpp b/erpc_c/infra/erpc_client_manager.cpp index f5d38c3a..2a4e025c 100644 --- a/erpc_c/infra/erpc_client_manager.cpp +++ b/erpc_c/infra/erpc_client_manager.cpp @@ -35,8 +35,15 @@ RequestContext ClientManager::createRequest(bool isOneway) return RequestContext(++m_sequence, codec, isOneway); } -erpc_status_t ClientManager::performRequest(RequestContext &request) +void ClientManager::performRequest(RequestContext &request) { + // Check the codec status + if (kErpcStatus_Success != (request.getCodec()->getStatus())) + { + // Do not perform the request + return; + } + #if ERPC_NESTED_CALLS assert(m_serverThreadId && "server thread id was not set"); if (Thread::getCurrentThreadId() == m_serverThreadId) @@ -47,12 +54,13 @@ erpc_status_t ClientManager::performRequest(RequestContext &request) return performClientRequest(request); } -erpc_status_t ClientManager::performClientRequest(RequestContext &request) +void ClientManager::performClientRequest(RequestContext &request) { #if ERPC_NESTED_CALLS_DETECTION if (!request.isOneway() && nestingDetection) { - return kErpcStatus_NestedCallFailure; + request.getCodec()->updateStatus(kErpcStatus_NestedCallFailure); + return; } #endif @@ -62,7 +70,8 @@ erpc_status_t ClientManager::performClientRequest(RequestContext &request) err = logMessage(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #endif @@ -70,7 +79,8 @@ erpc_status_t ClientManager::performClientRequest(RequestContext &request) err = m_transport->send(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } // If the request is oneway, then there is nothing more to do. @@ -80,14 +90,16 @@ erpc_status_t ClientManager::performClientRequest(RequestContext &request) err = m_transport->receive(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #if ERPC_MESSAGE_LOGGING err = logMessage(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #endif @@ -95,15 +107,16 @@ erpc_status_t ClientManager::performClientRequest(RequestContext &request) err = verifyReply(request); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } } - return kErpcStatus_Success; + return; } #if ERPC_NESTED_CALLS -erpc_status_t ClientManager::performNestedClientRequest(RequestContext &request) +void ClientManager::performNestedClientRequest(RequestContext &request) { assert(m_transport && "transport/arbitrator not set"); @@ -113,7 +126,8 @@ erpc_status_t ClientManager::performNestedClientRequest(RequestContext &request) err = logMessage(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #endif @@ -121,7 +135,8 @@ erpc_status_t ClientManager::performNestedClientRequest(RequestContext &request) err = m_transport->send(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } // If the request is oneway, then there is nothing more to do. @@ -132,14 +147,16 @@ erpc_status_t ClientManager::performNestedClientRequest(RequestContext &request) err = m_server->run(request); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #if ERPC_MESSAGE_LOGGING err = logMessage(request.getCodec()->getBuffer()); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } #endif @@ -147,11 +164,10 @@ erpc_status_t ClientManager::performNestedClientRequest(RequestContext &request) err = verifyReply(request); if (err) { - return err; + request.getCodec()->updateStatus(err); + return; } } - - return kErpcStatus_Success; } #endif diff --git a/erpc_c/infra/erpc_client_manager.h b/erpc_c/infra/erpc_client_manager.h index cc4f825a..9bef6d23 100644 --- a/erpc_c/infra/erpc_client_manager.h +++ b/erpc_c/infra/erpc_client_manager.h @@ -119,7 +119,7 @@ class ClientManager * * @param[in] request Request context to perform. */ - virtual erpc_status_t performRequest(RequestContext &request); + virtual void performRequest(RequestContext &request); /*! * @brief This function releases request context. @@ -180,7 +180,7 @@ class ClientManager * * @param[in] request Request context to perform. */ - virtual erpc_status_t performClientRequest(RequestContext &request); + virtual void performClientRequest(RequestContext &request); #if ERPC_NESTED_CALLS /*! @@ -190,7 +190,7 @@ class ClientManager * * @param[in] request Request context to perform. */ - virtual erpc_status_t performNestedClientRequest(RequestContext &request); + virtual void performNestedClientRequest(RequestContext &request); #endif //! @brief Validate that an incoming message is a reply. diff --git a/erpc_c/infra/erpc_server.cpp b/erpc_c/infra/erpc_server.cpp index 5e3b98a9..08bade9e 100644 --- a/erpc_c/infra/erpc_server.cpp +++ b/erpc_c/infra/erpc_server.cpp @@ -42,6 +42,26 @@ void Server::addService(Service *service) link->setNext(service); } +void Server::removeService(Service *service) +{ + Service *link = m_firstService; + + if (link == service) + { + m_firstService = link->getNext(); + return; + } + while (link != NULL) + { + if (link->getNext() == service) + { + link->setNext(link->getNext()->getNext()); + return; + } + link = link->getNext(); + } +} + erpc_status_t Server::readHeadOfMessage(Codec *codec, message_type_t &msgType, uint32_t &serviceId, uint32_t &methodId, uint32_t &sequence) { diff --git a/erpc_c/infra/erpc_server.h b/erpc_c/infra/erpc_server.h index c9c8c222..7e32f2c9 100644 --- a/erpc_c/infra/erpc_server.h +++ b/erpc_c/infra/erpc_server.h @@ -159,6 +159,13 @@ class Server */ void addService(Service *service); + /*! + * @brief Remove service. + * + * @param[in] service Service to remove. + */ + void removeService(Service *service); + /*! * @brief This function runs the server. */ diff --git a/erpc_c/infra/erpc_simple_server.cpp b/erpc_c/infra/erpc_simple_server.cpp index bb70639a..7777c3e5 100644 --- a/erpc_c/infra/erpc_simple_server.cpp +++ b/erpc_c/infra/erpc_simple_server.cpp @@ -15,16 +15,6 @@ using namespace erpc; // Code //////////////////////////////////////////////////////////////////////////////// -SimpleServer::~SimpleServer(void) -{ - while (m_firstService != NULL) - { - Service *firstService = m_firstService; - m_firstService = m_firstService->getNext(); - delete firstService; - } -} - void SimpleServer::disposeBufferAndCodec(Codec *codec) { if (codec) diff --git a/erpc_c/infra/erpc_simple_server.h b/erpc_c/infra/erpc_simple_server.h index 01942e2d..2326f0ff 100644 --- a/erpc_c/infra/erpc_simple_server.h +++ b/erpc_c/infra/erpc_simple_server.h @@ -41,11 +41,6 @@ class SimpleServer : public Server { } - /*! - * @brief SimpleServer destructor - */ - virtual ~SimpleServer(void); - /*! * @brief Run server in infinite loop. * diff --git a/erpc_c/infra/erpc_transport_arbitrator.cpp b/erpc_c/infra/erpc_transport_arbitrator.cpp index 846a5645..d004af3a 100644 --- a/erpc_c/infra/erpc_transport_arbitrator.cpp +++ b/erpc_c/infra/erpc_transport_arbitrator.cpp @@ -115,12 +115,11 @@ erpc_status_t TransportArbitrator::send(MessageBuffer *message) TransportArbitrator::client_token_t TransportArbitrator::prepareClientReceive(RequestContext &request) { PendingClientInfo *info = addPendingClient(); - if (!info) + if (NULL != info) { - return kErpcStatus_Fail; + info->m_request = &request; + info->m_isValid = true; } - info->m_request = &request; - info->m_isValid = true; return reinterpret_cast(info); } diff --git a/erpc_c/infra/erpc_version.h b/erpc_c/infra/erpc_version.h index 94964efc..653b1cb1 100644 --- a/erpc_c/infra/erpc_version.h +++ b/erpc_c/infra/erpc_version.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2016-2017 NXP + * Copyright 2016-2019 NXP * All rights reserved. * * @@ -20,9 +20,9 @@ //////////////////////////////////////////////////////////////////////////////// //! @brief String version of eRPC. -#define ERPC_VERSION "1.7.2" +#define ERPC_VERSION "1.7.3" //! @brief Integer version of eRPC. -#define ERPC_VERSION_NUMBER 10702 +#define ERPC_VERSION_NUMBER 10703 /*! @} */ diff --git a/erpc_c/port/erpc_config_internal.h b/erpc_c/port/erpc_config_internal.h index 7f3a83bf..d9bca3a0 100644 --- a/erpc_c/port/erpc_config_internal.h +++ b/erpc_c/port/erpc_config_internal.h @@ -106,7 +106,7 @@ #define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_DISABLED) #endif -#if defined(__CC_ARM) /* Keil MDK */ +#if defined(__CC_ARM) || defined(__ARMCC_VERSION) /* Keil MDK */ #define THROW_BADALLOC throw(std::bad_alloc) #define THROW throw() #else diff --git a/erpc_c/port/erpc_threading_freertos.cpp b/erpc_c/port/erpc_threading_freertos.cpp index ac2a8617..748e55cb 100644 --- a/erpc_c/port/erpc_threading_freertos.cpp +++ b/erpc_c/port/erpc_threading_freertos.cpp @@ -66,16 +66,17 @@ void Thread::start(void *arg) // which will scan the linked list. taskENTER_CRITICAL(); - (void)xTaskCreate(threadEntryPointStub, (m_name ? m_name : "task"), - ((m_stackSize + sizeof(uint32_t) - 1) / sizeof(uint32_t)), // Round up number of words. - this, m_priority, &m_task); - - // Link in this thread to the list. - if (s_first) + if (pdPASS == xTaskCreate(threadEntryPointStub, (m_name ? m_name : "task"), + ((m_stackSize + sizeof(uint32_t) - 1) / sizeof(uint32_t)), // Round up number of words. + this, m_priority, &m_task)) { - m_next = s_first; + // Link in this thread to the list. + if (NULL != s_first) + { + m_next = s_first; + } + s_first = this; } - s_first = this; taskEXIT_CRITICAL(); } @@ -234,7 +235,10 @@ bool Semaphore::get(uint32_t timeout) timeout = portMAX_DELAY - 1; } #endif - (void)xSemaphoreTake(m_sem, timeout / 1000 / portTICK_PERIOD_MS); + if (pdTRUE != xSemaphoreTake(m_sem, timeout / 1000 / portTICK_PERIOD_MS)) + { + return false; + } return true; } diff --git a/erpc_c/setup/erpc_server_setup.cpp b/erpc_c/setup/erpc_server_setup.cpp index ac998415..5bf37057 100644 --- a/erpc_c/setup/erpc_server_setup.cpp +++ b/erpc_c/setup/erpc_server_setup.cpp @@ -67,6 +67,14 @@ void erpc_add_service_to_server(void *service) } } +void erpc_remove_service_from_server(void *service) +{ + if (g_server != NULL && service != NULL) + { + g_server->removeService(static_cast(service)); + } +} + void erpc_server_set_crc(uint32_t crcStart) { s_crc16->setCrcStart(crcStart); diff --git a/erpc_c/setup/erpc_server_setup.h b/erpc_c/setup/erpc_server_setup.h index a91dda71..dd6d42f3 100644 --- a/erpc_c/setup/erpc_server_setup.h +++ b/erpc_c/setup/erpc_server_setup.h @@ -63,6 +63,13 @@ void erpc_server_deinit(void); */ void erpc_add_service_to_server(void *service); +/*! + * @brief This function removes service from server. + * + * @param[in] service Service which contains implementations of functions called from client to server. + */ +void erpc_remove_service_from_server(void *service); + /*! * @brief Can be used to set own crcStart number. * diff --git a/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp b/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp index 37c8a257..9b1bb040 100644 --- a/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp +++ b/erpc_c/setup/erpc_setup_mbf_rpmsg.cpp @@ -47,7 +47,7 @@ class RPMsgMessageBufferFactory : public MessageBufferFactory virtual MessageBuffer create(void) { void *buf = NULL; - unsigned long size = 0; + uint32_t size = 0; buf = rpmsg_lite_alloc_tx_buffer(m_rpmsg, &size, RL_BLOCK); assert(NULL != buf); @@ -65,7 +65,7 @@ class RPMsgMessageBufferFactory : public MessageBufferFactory void *tmp = (void *)buf->get(); if (tmp) { - int ret; + int32_t ret; ret = rpmsg_lite_release_rx_buffer(m_rpmsg, tmp); if (ret != RL_SUCCESS) { diff --git a/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp b/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp index beef233c..56752976 100644 --- a/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp +++ b/erpc_c/setup/erpc_setup_mbf_rpmsg_tty.cpp @@ -50,7 +50,7 @@ class RPMsgTTYMessageBufferFactory : public MessageBufferFactory virtual MessageBuffer create(void) { void *buf = NULL; - unsigned long size = 0; + uint32_t size = 0; buf = rpmsg_lite_alloc_tx_buffer(m_rpmsg, &size, TIMEOUT_MS); assert(NULL != buf); @@ -69,7 +69,7 @@ class RPMsgTTYMessageBufferFactory : public MessageBufferFactory void *tmp = (void *)buf->get(); if (tmp) { - int ret; + int32_t ret; ret = rpmsg_lite_release_rx_buffer(m_rpmsg, (void *)(((uint8_t *)tmp) - sizeof(FramedTransport::Header))); if (ret != RL_SUCCESS) { diff --git a/erpc_c/setup/erpc_setup_rpmsg_lite_master.cpp b/erpc_c/setup/erpc_setup_rpmsg_lite_master.cpp index a4401cbe..4cb00af8 100644 --- a/erpc_c/setup/erpc_setup_rpmsg_lite_master.cpp +++ b/erpc_c/setup/erpc_setup_rpmsg_lite_master.cpp @@ -38,8 +38,7 @@ static ManuallyConstructed s_transport; // Code //////////////////////////////////////////////////////////////////////////////// -erpc_transport_t erpc_transport_rpmsg_lite_master_init(unsigned long src_addr, unsigned long dst_addr, - int rpmsg_link_id) +erpc_transport_t erpc_transport_rpmsg_lite_master_init(uint32_t src_addr, uint32_t dst_addr, int32_t rpmsg_link_id) { s_transport.construct(); if (s_transport->init(src_addr, dst_addr, rpmsg_lite_base, SH_MEM_TOTAL_SIZE, rpmsg_link_id) == kErpcStatus_Success) diff --git a/erpc_c/setup/erpc_setup_rpmsg_lite_remote.cpp b/erpc_c/setup/erpc_setup_rpmsg_lite_remote.cpp index a2813d8e..90064653 100644 --- a/erpc_c/setup/erpc_setup_rpmsg_lite_remote.cpp +++ b/erpc_c/setup/erpc_setup_rpmsg_lite_remote.cpp @@ -23,8 +23,8 @@ static ManuallyConstructed s_transport; // Code //////////////////////////////////////////////////////////////////////////////// -erpc_transport_t erpc_transport_rpmsg_lite_remote_init(unsigned long src_addr, unsigned long dst_addr, - void *start_address, int rpmsg_link_id, rpmsg_ready_cb ready, +erpc_transport_t erpc_transport_rpmsg_lite_remote_init(uint32_t src_addr, uint32_t dst_addr, void *start_address, + int32_t rpmsg_link_id, rpmsg_ready_cb ready, char *nameservice_name) { s_transport.construct(); diff --git a/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_master.cpp b/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_master.cpp index a5f07667..1d20569c 100644 --- a/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_master.cpp +++ b/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_master.cpp @@ -37,8 +37,7 @@ static ManuallyConstructed s_transport; // Code //////////////////////////////////////////////////////////////////////////////// -erpc_transport_t erpc_transport_rpmsg_lite_rtos_master_init(unsigned long src_addr, unsigned long dst_addr, - int rpmsg_link_id) +erpc_transport_t erpc_transport_rpmsg_lite_rtos_master_init(uint32_t src_addr, uint32_t dst_addr, int32_t rpmsg_link_id) { s_transport.construct(); if (s_transport->init(src_addr, dst_addr, rpmsg_lite_base, SH_MEM_TOTAL_SIZE, rpmsg_link_id) == kErpcStatus_Success) diff --git a/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp b/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp index 0b2bf7e6..35fe535d 100644 --- a/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp +++ b/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp @@ -23,9 +23,9 @@ static ManuallyConstructed s_transport; // Code //////////////////////////////////////////////////////////////////////////////// -erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init(unsigned long src_addr, unsigned long dst_addr, - void *start_address, int rpmsg_link_id, - rpmsg_ready_cb ready, char *nameservice_name) +erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init(uint32_t src_addr, uint32_t dst_addr, void *start_address, + int32_t rpmsg_link_id, rpmsg_ready_cb ready, + char *nameservice_name) { s_transport.construct(); if (s_transport->init(src_addr, dst_addr, start_address, rpmsg_link_id, ready, nameservice_name) == diff --git a/erpc_c/setup/erpc_setup_rpmsg_tty_rtos_remote.cpp b/erpc_c/setup/erpc_setup_rpmsg_tty_rtos_remote.cpp index db20f8f7..bfdfd52a 100644 --- a/erpc_c/setup/erpc_setup_rpmsg_tty_rtos_remote.cpp +++ b/erpc_c/setup/erpc_setup_rpmsg_tty_rtos_remote.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2016-2017 NXP + * Copyright 2016-2019 NXP * All rights reserved. * * @@ -23,8 +23,8 @@ static ManuallyConstructed s_transport; // Code //////////////////////////////////////////////////////////////////////////////// -erpc_transport_t erpc_transport_rpmsg_lite_tty_rtos_remote_init(unsigned long src_addr, unsigned long dst_addr, - void *start_address, int rpmsg_link_id, +erpc_transport_t erpc_transport_rpmsg_lite_tty_rtos_remote_init(uint32_t src_addr, uint32_t dst_addr, + void *start_address, int32_t rpmsg_link_id, rpmsg_ready_cb ready, char *nameservice_name) { s_transport.construct(); diff --git a/erpc_c/setup/erpc_transport_setup.h b/erpc_c/setup/erpc_transport_setup.h index 33b59fdf..1caf4666 100644 --- a/erpc_c/setup/erpc_transport_setup.h +++ b/erpc_c/setup/erpc_transport_setup.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2016, Freescale Semiconductor, Inc. - * Copyright 2016-2017 NXP + * Copyright 2016-2019 NXP * All rights reserved. * * @@ -161,8 +161,7 @@ erpc_transport_t erpc_transport_mu_init(void *baseAddr); * * @return Return NULL or erpc_transport_t instance pointer. */ -erpc_transport_t erpc_transport_rpmsg_lite_master_init(unsigned long src_addr, unsigned long dst_addr, - int rpmsg_link_id); +erpc_transport_t erpc_transport_rpmsg_lite_master_init(uint32_t src_addr, uint32_t dst_addr, int32_t rpmsg_link_id); /*! * @brief Create an RPMsg-Lite transport. @@ -183,8 +182,8 @@ erpc_transport_t erpc_transport_rpmsg_lite_master_init(unsigned long src_addr, u * * @return Return NULL or erpc_transport_t instance pointer. */ -erpc_transport_t erpc_transport_rpmsg_lite_remote_init(unsigned long src_addr, unsigned long dst_addr, - void *start_address, int rpmsg_link_id, rpmsg_ready_cb ready, +erpc_transport_t erpc_transport_rpmsg_lite_remote_init(uint32_t src_addr, uint32_t dst_addr, void *start_address, + int32_t rpmsg_link_id, rpmsg_ready_cb ready, char *nameservice_name); /*! @@ -199,8 +198,8 @@ erpc_transport_t erpc_transport_rpmsg_lite_remote_init(unsigned long src_addr, u * * @return Return NULL or erpc_transport_t instance pointer. */ -erpc_transport_t erpc_transport_rpmsg_lite_rtos_master_init(unsigned long src_addr, unsigned long dst_addr, - int rpmsg_link_id); +erpc_transport_t erpc_transport_rpmsg_lite_rtos_master_init(uint32_t src_addr, uint32_t dst_addr, + int32_t rpmsg_link_id); /*! * @brief Create an RPMsg-Lite RTOS transport. @@ -220,9 +219,9 @@ erpc_transport_t erpc_transport_rpmsg_lite_rtos_master_init(unsigned long src_ad * * @return Return NULL or erpc_transport_t instance pointer. */ -erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init(unsigned long src_addr, unsigned long dst_addr, - void *start_address, int rpmsg_link_id, - rpmsg_ready_cb ready, char *nameservice_name); +erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init(uint32_t src_addr, uint32_t dst_addr, void *start_address, + int32_t rpmsg_link_id, rpmsg_ready_cb ready, + char *nameservice_name); /*! * @brief Create an RPMsg-Lite TTY transport. @@ -243,8 +242,8 @@ erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init(unsigned long src_ad * * @return Return NULL or erpc_transport_t instance pointer. */ -erpc_transport_t erpc_transport_rpmsg_lite_tty_rtos_remote_init(unsigned long src_addr, unsigned long dst_addr, - void *start_address, int rpmsg_link_id, +erpc_transport_t erpc_transport_rpmsg_lite_tty_rtos_remote_init(uint32_t src_addr, uint32_t dst_addr, + void *start_address, int32_t rpmsg_link_id, rpmsg_ready_cb ready, char *nameservice_name); /*! diff --git a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp index 2f2e1b75..c48eb090 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.cpp @@ -40,8 +40,8 @@ RPMsgRTOSTransport::~RPMsgRTOSTransport(void) s_initialized = 0; } -erpc_status_t RPMsgRTOSTransport::init(unsigned long src_addr, unsigned long dst_addr, void *base_address, - unsigned long length, int rpmsg_link_id) +erpc_status_t RPMsgRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, + int32_t rpmsg_link_id) { if (!s_initialized) { @@ -65,8 +65,8 @@ erpc_status_t RPMsgRTOSTransport::init(unsigned long src_addr, unsigned long dst return m_rpmsg_ept == RL_NULL ? kErpcStatus_InitFailed : kErpcStatus_Success; } -erpc_status_t RPMsgRTOSTransport::init(unsigned long src_addr, unsigned long dst_addr, void *base_address, - int rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name) +erpc_status_t RPMsgRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, int32_t rpmsg_link_id, + void (*ready_cb)(void), char *nameservice_name) { if (!s_initialized) { @@ -111,8 +111,8 @@ erpc_status_t RPMsgRTOSTransport::init(unsigned long src_addr, unsigned long dst erpc_status_t RPMsgRTOSTransport::receive(MessageBuffer *message) { char *buf = NULL; - int length = 0; - int ret_val = rpmsg_queue_recv_nocopy(s_rpmsg, m_rpmsg_queue, &m_dst_addr, &buf, &length, RL_BLOCK); + uint32_t length = 0; + int32_t ret_val = rpmsg_queue_recv_nocopy(s_rpmsg, m_rpmsg_queue, &m_dst_addr, &buf, &length, RL_BLOCK); assert(buf); message->set((uint8_t *)buf, length); message->setUsed(length); @@ -125,7 +125,7 @@ erpc_status_t RPMsgRTOSTransport::send(MessageBuffer *message) uint32_t length = message->getLength(); uint32_t used = message->getUsed(); message->set(NULL, 0); - int ret_val = rpmsg_lite_send_nocopy(s_rpmsg, m_rpmsg_ept, m_dst_addr, buf, used); + int32_t ret_val = rpmsg_lite_send_nocopy(s_rpmsg, m_rpmsg_ept, m_dst_addr, buf, used); if (ret_val == RL_SUCCESS) { return kErpcStatus_Success; diff --git a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.h b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.h index 6995d59e..3a07d901 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.h +++ b/erpc_c/transports/erpc_rpmsg_lite_rtos_transport.h @@ -62,8 +62,8 @@ class RPMsgRTOSTransport : public RPMsgBaseTransport * @retval kErpcStatus_Success When rpmsg init function was executed successfully. * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. */ - virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length, - int rpmsg_link_id); + virtual erpc_status_t init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, + int32_t rpmsg_link_id); /*! * @brief This function call RPMsg rtos init function - as RPMsg remote @@ -79,7 +79,7 @@ class RPMsgRTOSTransport : public RPMsgBaseTransport * @retval kErpcStatus_Success When rpmsg init function was executed successfully. * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. */ - virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, int rpmsg_link_id, + virtual erpc_status_t init(uint32_t src_addr, uint32_t dst_addr, void *base_address, int32_t rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name); /*! @@ -117,7 +117,7 @@ class RPMsgRTOSTransport : public RPMsgBaseTransport /* Remote device */ struct remote_device *m_rdev; /*!< Device which represent the second core. */ struct rpmsg_channel *m_app_rp_chnl; /*!< Represent connection between two device (two cores). */ - unsigned long m_dst_addr; /*!< Destination address used by rpmsg. */ + 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. */ }; diff --git a/erpc_c/transports/erpc_rpmsg_lite_transport.cpp b/erpc_c/transports/erpc_rpmsg_lite_transport.cpp index b255d6c5..8202f879 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_lite_transport.cpp @@ -23,7 +23,7 @@ struct rpmsg_lite_instance *RPMsgBaseTransport::s_rpmsg = NULL; // Code //////////////////////////////////////////////////////////////////////////////// -int RPMsgTransport::rpmsg_read_cb(void *payload, int payload_len, unsigned long src, void *priv) +int32_t RPMsgTransport::rpmsg_read_cb(void *payload, uint32_t payload_len, uint32_t src, void *priv) { RPMsgTransport *transport = (RPMsgTransport *)priv; if (payload_len <= ERPC_DEFAULT_BUFFER_SIZE) @@ -45,8 +45,8 @@ RPMsgTransport::RPMsgTransport(void) RPMsgTransport::~RPMsgTransport(void) {} -erpc_status_t RPMsgTransport::init(unsigned long src_addr, unsigned long dst_addr, void *base_address, - unsigned long length, int rpmsg_link_id) +erpc_status_t RPMsgTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, + int32_t rpmsg_link_id) { if (!s_initialized) { @@ -61,8 +61,8 @@ erpc_status_t RPMsgTransport::init(unsigned long src_addr, unsigned long dst_add return m_rpmsg_ept == RL_NULL ? kErpcStatus_InitFailed : kErpcStatus_Success; } -erpc_status_t RPMsgTransport::init(unsigned long src_addr, unsigned long dst_addr, void *base_address, - int rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name) +erpc_status_t RPMsgTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, int32_t rpmsg_link_id, + void (*ready_cb)(void), char *nameservice_name) { if (!s_initialized) { @@ -107,7 +107,8 @@ erpc_status_t RPMsgTransport::receive(MessageBuffer *message) erpc_status_t RPMsgTransport::send(MessageBuffer *message) { - int ret_val = rpmsg_lite_send_nocopy(s_rpmsg, m_rpmsg_ept, m_dst_addr, (char *)message->get(), message->getUsed()); + int32_t ret_val = + rpmsg_lite_send_nocopy(s_rpmsg, m_rpmsg_ept, m_dst_addr, (char *)message->get(), message->getUsed()); message->set(NULL, 0); return ret_val != RL_SUCCESS ? kErpcStatus_SendFailed : kErpcStatus_Success; } diff --git a/erpc_c/transports/erpc_rpmsg_lite_transport.h b/erpc_c/transports/erpc_rpmsg_lite_transport.h index 622bf119..201bbcd5 100644 --- a/erpc_c/transports/erpc_rpmsg_lite_transport.h +++ b/erpc_c/transports/erpc_rpmsg_lite_transport.h @@ -65,8 +65,8 @@ class RPMsgTransport : public RPMsgBaseTransport * @retval kErpcStatus_Success When rpmsg init function was executed successfully. * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. */ - virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length, - int rpmsg_link_id); + virtual erpc_status_t init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, + int32_t rpmsg_link_id); /*! * @brief Initialization of RPMsgTransport layer - as RPMsg remote @@ -84,7 +84,7 @@ class RPMsgTransport : public RPMsgBaseTransport * @retval kErpcStatus_Success When rpmsg init function was executed successfully. * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. */ - virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, int rpmsg_link_id, + virtual erpc_status_t init(uint32_t src_addr, uint32_t dst_addr, void *base_address, int32_t rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name); /*! @@ -131,12 +131,12 @@ class RPMsgTransport : public RPMsgBaseTransport * * @return */ - static int rpmsg_read_cb(void *payload, int payload_len, unsigned long src, void *priv); + static int32_t rpmsg_read_cb(void *payload, uint32_t payload_len, uint32_t src, void *priv); StaticQueue m_messageQueue; /*!< Received messages. Queue of messages with buffers filled in rpmsg callback. */ - unsigned long m_dst_addr; /*!< Destination address used by rpmsg. */ + uint32_t m_dst_addr; /*!< Destination address used by rpmsg. */ struct rpmsg_lite_ept_static_context m_rpmsg_ept_context; /*!< RPMsg Lite Endpoint static context. */ struct rpmsg_lite_endpoint *m_rpmsg_ept; /*!< Pointer to RPMsg Lite Endpoint structure. */ diff --git a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp index 6dbc2d09..983ecd1b 100644 --- a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp +++ b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2017 NXP + * Copyright 2017-2019 NXP * All rights reserved. * * @@ -70,8 +70,8 @@ void RPMsgTTYRTOSTransport::setCrc16(Crc16 *crcImpl) m_crcImpl = crcImpl; } -erpc_status_t RPMsgTTYRTOSTransport::init(unsigned long src_addr, unsigned long dst_addr, void *base_address, - unsigned long length, int rpmsg_link_id) +erpc_status_t RPMsgTTYRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, + int32_t rpmsg_link_id) { if (!s_initialized) { @@ -95,8 +95,8 @@ erpc_status_t RPMsgTTYRTOSTransport::init(unsigned long src_addr, unsigned long return m_rpmsg_ept == RL_NULL ? kErpcStatus_InitFailed : kErpcStatus_Success; } -erpc_status_t RPMsgTTYRTOSTransport::init(unsigned long src_addr, unsigned long dst_addr, void *base_address, - int rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name) +erpc_status_t RPMsgTTYRTOSTransport::init(uint32_t src_addr, uint32_t dst_addr, void *base_address, + int32_t rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name) { if (!s_initialized) { @@ -143,9 +143,9 @@ erpc_status_t RPMsgTTYRTOSTransport::receive(MessageBuffer *message) assert(m_crcImpl && "Uninitialized Crc16 object."); FramedTransport::Header h; char *buf = NULL; - int length = 0; + uint32_t length = 0; - int ret_val = rpmsg_queue_recv_nocopy(s_rpmsg, m_rpmsg_queue, &m_dst_addr, &buf, &length, RL_BLOCK); + int32_t ret_val = rpmsg_queue_recv_nocopy(s_rpmsg, m_rpmsg_queue, &m_dst_addr, &buf, &length, RL_BLOCK); assert(buf); memcpy((uint8_t *)&h, buf, sizeof(h)); @@ -177,7 +177,7 @@ erpc_status_t RPMsgTTYRTOSTransport::send(MessageBuffer *message) memcpy(buf - sizeof(h), (uint8_t *)&h, sizeof(h)); - int ret_val = rpmsg_lite_send_nocopy(s_rpmsg, m_rpmsg_ept, m_dst_addr, buf - sizeof(h), used + sizeof(h)); + int32_t ret_val = rpmsg_lite_send_nocopy(s_rpmsg, m_rpmsg_ept, m_dst_addr, buf - sizeof(h), used + sizeof(h)); if (ret_val == RL_SUCCESS) { return kErpcStatus_Success; diff --git a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.h b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.h index c7918b1c..70c9a3d1 100644 --- a/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.h +++ b/erpc_c/transports/erpc_rpmsg_tty_rtos_transport.h @@ -67,8 +67,8 @@ class RPMsgTTYRTOSTransport : public RPMsgBaseTransport * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed * successfully. */ - virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length, - int rpmsg_link_id); + virtual erpc_status_t init(uint32_t src_addr, uint32_t dst_addr, void *base_address, uint32_t length, + int32_t rpmsg_link_id); /*! * @brief This function call RPMsg rtos init function - as RPMsg remote @@ -88,7 +88,7 @@ class RPMsgTTYRTOSTransport : public RPMsgBaseTransport * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed * successfully. */ - virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, int rpmsg_link_id, + virtual erpc_status_t init(uint32_t src_addr, uint32_t dst_addr, void *base_address, int32_t rpmsg_link_id, void (*ready_cb)(void), char *nameservice_name); /*! @@ -122,7 +122,7 @@ class RPMsgTTYRTOSTransport : public RPMsgBaseTransport virtual void setCrc16(Crc16 *crcImpl); protected: - unsigned long m_dst_addr; /*!< Destination address used by rpmsg. */ + 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. diff --git a/erpc_python/README.rst b/erpc_python/README.rst deleted file mode 100644 index 822acf46..00000000 --- a/erpc_python/README.rst +++ /dev/null @@ -1,24 +0,0 @@ -| eRPC Python Infrastructure -| ========================== -| -| This folder contains the Python implementation of the eRPC infrastructure. -| -| The eRPC project is stored on Github_. -.. _Github: https://github.com/EmbeddedRPC/erpc -| -| The Python implementation of eRPC is fully compatible with the C/C++ implementation at the -| protocol level. Also, the classes mirror those in the C++ infrastructure. -| -| Installation: -| -| To install the eRPC Python infrastructure, run the setup.py script like this: -| -| pip install erpc -| -| -| Once installed, you can access the infrastructure via a standard import statement. -| -| import erpc -| xport = erpc.transport.SerialTransport("/dev/ttyS1", 115200) -| client = erpc.client.ClientManager(xport, erpc.basic_codec.BasicCodec) - diff --git a/erpc_python/README_Pypi.md b/erpc_python/README_Pypi.md new file mode 100644 index 00000000..7b48e33b --- /dev/null +++ b/erpc_python/README_Pypi.md @@ -0,0 +1,23 @@ +eRPC Python Infrastructure +========================== + +This folder contains the Python implementation of the eRPC infrastructure. + +The eRPC project is stored on Github: https://github.com/EmbeddedRPC/erpc + +The Python implementation of eRPC is fully compatible with the C/C++ implementation at the +protocol level. Also, the classes mirror those in the C++ infrastructure. + +Installation: + + To install the eRPC Python infrastructure, run the setup.py script like this: + + pip install erpc + + + Once installed, you can access the infrastructure via a standard import statement. + + import erpc + xport = erpc.transport.SerialTransport("/dev/ttyS1", 115200) + client = erpc.client.ClientManager(xport, erpc.basic_codec.BasicCodec) + diff --git a/erpc_python/erpc/erpc_version.py b/erpc_python/erpc/erpc_version.py index 5d09d992..d669c1a1 100644 --- a/erpc_python/erpc/erpc_version.py +++ b/erpc_python/erpc/erpc_version.py @@ -1,9 +1,9 @@ #!/usr/bin/env python -# Copyright 2017 NXP +# Copyright 2017-2019 NXP # All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause #Should be same as in erpc_version.h -ERPC_VERSION = "1.7.2" +ERPC_VERSION = "1.7.3" diff --git a/erpc_python/setup.cfg b/erpc_python/setup.cfg index c34b498b..adf5ed72 100644 --- a/erpc_python/setup.cfg +++ b/erpc_python/setup.cfg @@ -1,5 +1,7 @@ [bdist_wheel] -# This flag says that the code is written to work on both Python 2 and Python -# 3. If at all possible, it is good practice to do this. If you cannot, you -# will need to generate wheels for each Python version that you support. -universal=1 \ No newline at end of file +universal = 1 + +[egg_info] +tag_build = +tag_date = 0 + diff --git a/erpc_python/setup.py b/erpc_python/setup.py index 565c1f4e..98e86021 100644 --- a/erpc_python/setup.py +++ b/erpc_python/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Copyright (c) 2016 Freescale Semiconductor, Inc. -# Copyright 2016 NXP +# Copyright 2016-2019 NXP # All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause @@ -13,7 +13,7 @@ here = path.abspath(path.dirname(__file__)) -with open(path.join(here, 'README.rst'), encoding='utf-8') as f: +with open(path.join(here, 'README_Pypi.md'), encoding='utf-8') as f: long_description = f.read() #steps: https://packaging.python.org/distributing/ @@ -26,6 +26,7 @@ version=erpc_version.ERPC_VERSION, description="eRPC Python infrastructure", long_description=long_description, + long_description_content_type="text/markdown", author="NXP", url='https://github.com/embeddedrpc/erpc', license="BSD 3-Clause", @@ -41,7 +42,7 @@ "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", ], - keywords='rpc rpc-framework embedded multicore multiprocessor amp', + keywords='rpc rpc-framework embedded multicore multiprocessor amp rpmsg_lite', use_2to3=True, packages=['erpc'], ) diff --git a/erpcgen/src/templates/c_common_header.template b/erpcgen/src/templates/c_common_header.template index 0e93542a..bb8fbdf5 100644 --- a/erpcgen/src/templates/c_common_header.template +++ b/erpcgen/src/templates/c_common_header.template @@ -8,7 +8,7 @@ #define {$commonGuardMacro} {% if usedUnionType %} -#if defined(__CC_ARM) +#if defined(__CC_ARM) || defined(__ARMCC_VERSION) #pragma anon_unions #endif {% endif -- usedUnionType %} diff --git a/erpcgen/src/templates/c_server_header.template b/erpcgen/src/templates/c_server_header.template index 71098a49..52e2aba2 100644 --- a/erpcgen/src/templates/c_server_header.template +++ b/erpcgen/src/templates/c_server_header.template @@ -50,6 +50,12 @@ typedef void * erpc_service_t; {% for iface in group.interfaces %} erpc_service_t create_{$iface.serviceClassName}(void); +{% if dynamicServices == true %} +void destroy_{$iface.serviceClassName}(erpc_service_t *service); +{% else --dynamicServices == true %} +void destroy_{$iface.serviceClassName}(void); +{% endif --dynamicServices == true %} + {% endfor -- iface %} #ifdef __cplusplus } diff --git a/erpcgen/src/templates/c_server_source.template b/erpcgen/src/templates/c_server_source.template index 68d842c3..a7b427ce 100644 --- a/erpcgen/src/templates/c_server_source.template +++ b/erpcgen/src/templates/c_server_source.template @@ -240,11 +240,24 @@ erpc_service_t create_{$iface.serviceClassName}() { return new (nothrow) {$iface.serviceClassName}(); } + +void destroy_{$iface.serviceClassName}(erpc_service_t *service) +{ + if (*service) + { + delete service; + } +} {% else --dynamicServices == true %} erpc_service_t create_{$iface.serviceClassName}() { s_{$iface.serviceClassName}.construct(); return s_{$iface.serviceClassName}.get(); } + +void destroy_{$iface.serviceClassName}() +{ + s_{$iface.serviceClassName}.destroy(); +} {% endif --dynamicServices == true %} {% endfor -- iface %} diff --git a/examples/matrix_multiply_tcp_python/service/__init__.py b/examples/matrix_multiply_tcp_python/service/__init__.py index 4de10ade..f6d859d0 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.7.2 on Fri Mar 15 10:14:52 2019. +# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019. # # 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 18eb5d0f..5ecf43d9 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.7.2 on Fri Mar 15 10:14:52 2019. +# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019. # # AUTOGENERATED - DO NOT EDIT # @@ -15,8 +15,8 @@ version = erpc_version.ERPC_VERSION except ImportError: version = "unknown" -if version != "1.7.2": - raise ValueError("The generated shim code version (1.7.2) is different to the rest of eRPC code (%s). \ +if version != "1.7.3": + raise ValueError("The generated shim code version (1.7.3) 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 41fdc87d..834b30c6 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.7.2 on Fri Mar 15 10:14:52 2019. +# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019. # # 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 cf21b35b..1e1264d1 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.7.2 on Fri Mar 15 10:14:52 2019. +# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019. # # 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 e3561808..6f3fe773 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.7.2 on Fri Mar 15 10:14:52 2019. +# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019. # # 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 f2750aa5..6bbc32ee 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.7.2 on Fri Mar 15 10:14:52 2019. +# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019. # # AUTOGENERATED - DO NOT EDIT # diff --git a/test/common/gtest/gtest.h b/test/common/gtest/gtest.h index eb28fadc..ca8f6926 100644 --- a/test/common/gtest/gtest.h +++ b/test/common/gtest/gtest.h @@ -2091,7 +2091,7 @@ using ::std::tuple_size; #endif // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project. -#if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) +#if ((defined(__GLIBCXX__) || defined(_LIBCPP_VERSION)) && (!defined(__ARMCC_VERSION))) # define GTEST_HAS_CXXABI_H_ 1 #else # define GTEST_HAS_CXXABI_H_ 0 diff --git a/test/common/retarget_cpp_streamed_io.c b/test/common/retarget_cpp_streamed_io.c index 9048d55c..273180d0 100644 --- a/test/common/retarget_cpp_streamed_io.c +++ b/test/common/retarget_cpp_streamed_io.c @@ -26,18 +26,17 @@ #if defined(__CC_ARM) || defined(__ARMCC_VERSION) -#include "fsl_log.h" +//#include "fsl_log.h" +#include "fsl_debug_console.h" //#pragma import(__use_no_semihosting_swi) #include #define DEFAULT_HANDLE 0x100; -char *_sys_command_string(char *cmd, int len) -{ - return (cmd); -} - +#if 0 //already defined in fsl_debug_console.c +char *_sys_command_string(char *cmd, int len) { return (cmd); } +#endif /* * These names are special strings which will be recognized by * _sys_open and will cause it to return the standard I/O handles, instead @@ -51,18 +50,14 @@ const char __stderr_name[] = "STDERR"; * Open a file. May return -1 if the file failed to open. We do not require * this function to do anything. Simply return a dummy handle. */ -FILEHANDLE _sys_open(const char *name, int openmode) -{ - return DEFAULT_HANDLE; -} +FILEHANDLE _sys_open(const char *name, int openmode) { return DEFAULT_HANDLE; } /* * Close a file. Should return 0 on success or a negative value on error. * Not required in this implementation. Always return success. */ -int _sys_close(FILEHANDLE fh) -{ - return 0; // return success +int _sys_close(FILEHANDLE fh) { + return 0; // return success } /* @@ -70,16 +65,18 @@ int _sys_close(FILEHANDLE fh) * of characters _not_ written on partial success. This implementation sends * a buffer of size 'len' to the UART. */ -int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) -{ - int i; - for (i = 0; i < len; i++) - { - // UART_write(buf[i]); - LOG_Push((uint8_t *)(&buf[i]), 1); - } - - return 0; +int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, + int mode) { + // int i; + // for (i = 0; i < len; i++) + //{ + // // UART_write(buf[i]); + // LOG_Push((uint8_t *)(&buf[i]), 1); + //} + + DbgConsole_SendData((uint8_t *)buf, len); + + return 0; } /* @@ -93,66 +90,65 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) * if required (backspace) and then echo the character to the Terminal * Emulator, printing the correct sequence after successive keystrokes. */ -int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) -{ - int pos = 0; - - do - { - - // buf[pos]=UART_read(); - LOG_ReadCharacter((uint8_t *)&buf[pos]); - - // Advance position in buffer - pos++; - - // Handle backspace - if (buf[pos - 1] == '\b') - { - // More than 1 char in buffer - if (pos > 1) - { - // Delete character on terminal - // UART_write('\b'); - // UART_write(' '); - // UART_write('\b'); - - // Update position in buffer - pos -= 2; - } - else if (pos > 0) - pos--; // Backspace pressed, empty buffer - } - // else UART_write(buf[pos-1]); // Echo normal char to terminal - else - LOG_Push((uint8_t *)(&buf[pos - 1]), 1); // Echo normal char to terminal - - } while (buf[pos - 1] != '\r'); - - buf[pos] = '\0'; // Ensure Null termination - - return 0; +int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) { + int pos = 0; + + do { + + // buf[pos]=UART_read(); + // LOG_ReadCharacter((uint8_t *)&buf[pos]); + DbgConsole_ReadCharacter((uint8_t *)&buf[pos]); + + // Advance position in buffer + pos++; + + // Handle backspace + if (buf[pos - 1] == '\b') { + // More than 1 char in buffer + if (pos > 1) { + // Delete character on terminal + // UART_write('\b'); + // UART_write(' '); + // UART_write('\b'); + + // Update position in buffer + pos -= 2; + } else if (pos > 0) + pos--; // Backspace pressed, empty buffer + } + // else UART_write(buf[pos-1]); // Echo normal char to terminal + else + // LOG_Push((uint8_t *)(&buf[pos - 1]), 1); // Echo normal char to + // terminal + DbgConsole_SendData((uint8_t *)(&buf[pos - 1]), + 1); // Echo normal char to terminal + + } while (buf[pos - 1] != '\r'); + + buf[pos] = '\0'; // Ensure Null termination + + return 0; } +#if 0 //already defined in fsl_debug_console.c /* * Writes a character to the output channel. This function is used * for last-resort error message output. */ -void _ttywrch(int ch) -{ - // Convert correctly for endianness change - char ench = ch; +void _ttywrch(int ch) { + // Convert correctly for endianness change + char ench = ch; - // UART_write(ench); - LOG_Push((uint8_t *)(&ench), 1); + // UART_write(ench); + // LOG_Push((uint8_t *)(&ench), 1); + DbgConsole_SendData((uint8_t *)(&ench), 1); } - +#endif /* * Return non-zero if the argument file is connected to a terminal. */ -int _sys_istty(FILEHANDLE fh) -{ - return 1; // no interactive device present +int _sys_istty(FILEHANDLE fh) { + return 1; // no interactive device present } /* @@ -160,9 +156,8 @@ int _sys_istty(FILEHANDLE fh) * Returns >=0 on success, <0 on failure. Seeking is not supported for the * UART. */ -int _sys_seek(FILEHANDLE fh, long pos) -{ - return -1; // error +int _sys_seek(FILEHANDLE fh, long pos) { + return -1; // error } /* @@ -170,9 +165,8 @@ int _sys_seek(FILEHANDLE fh, long pos) * is up to date on disk. Result is >=0 if OK, negative for an * error. */ -int _sys_ensure(FILEHANDLE fh) -{ - return 0; // success +int _sys_ensure(FILEHANDLE fh) { + return 0; // success } /* @@ -182,29 +176,23 @@ int _sys_ensure(FILEHANDLE fh) * called when processing SEEK_END relative fseeks, and therefore a * call to _sys_flen is always followed by a call to _sys_seek. */ -long _sys_flen(FILEHANDLE fh) -{ - return 0; -} +long _sys_flen(FILEHANDLE fh) { return 0; } /* * Return the name for temporary file number sig in the buffer * name. Returns 0 on failure. maxlen is the maximum name length * allowed. */ -int _sys_tmpnam(char *name, int sig, unsigned maxlen) -{ - return 0; // fail, not supported +int _sys_tmpnam(char *name, int sig, unsigned maxlen) { + return 0; // fail, not supported } +#if 0 //already defined in fsl_debug_console.c /* * Terminate the program, passing a return code back to the user. * This function may not return. */ -void _sys_exit(int returncode) -{ - while (1) - { - }; +void _sys_exit(int returncode) { while (1) { }; } +#endif #endif /* __CC_ARM */ diff --git a/test/common/unit_test_client.cpp b/test/common/unit_test_client.cpp index 7f5b5b61..b83b2207 100644 --- a/test/common/unit_test_client.cpp +++ b/test/common/unit_test_client.cpp @@ -14,7 +14,7 @@ #include "myAlloc.h" #include "test_unit_test_common.h" -#if (defined(RPMSG) || defined(UART) || defined(LPUART)) +#if (defined(RPMSG) || defined(UART)) extern "C" { #include "app_core0.h" #include "board.h" @@ -22,6 +22,8 @@ extern "C" { #include "mcmgr.h" #if defined(RPMSG) #include "rpmsg_lite.h" +#elif defined(UART) +#include "fsl_usart_cmsis.h" #endif } @@ -79,6 +81,9 @@ volatile uint16_t eRPCReadyEventData = 0; //////////////////////////////////////////////////////////////////////////////// // Code //////////////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif #if defined(RPMSG) /*! * @brief eRPC server side ready event handler @@ -101,9 +106,6 @@ void SystemInitHook(void) } #endif -#ifdef __cplusplus -extern "C" { -#endif int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); @@ -111,7 +113,7 @@ int main(int argc, char **argv) ::testing::TestEventListeners &listeners = ::testing::UnitTest::GetInstance()->listeners(); listeners.Append(new LeakChecker); -#if (defined(RPMSG) || defined(UART) || defined(LPUART)) +#if (defined(RPMSG) || defined(UART)) delete listeners.Release(listeners.default_result_printer()); listeners.Append(new MinimalistPrinter); #ifdef UNITY_DUMP_RESULTS @@ -158,14 +160,8 @@ int main(int argc, char **argv) #if defined(RPMSG) transport = erpc_transport_rpmsg_lite_master_init(100, 101, ERPC_TRANSPORT_RPMSG_LITE_LINK_ID); message_buffer_factory = erpc_mbf_rpmsg_init(transport); -#else -#if defined(UART) - transport = erpc_transport_uart_init(ERPC_BOARD_UART_BASEADDR, ERPC_BOARD_UART_BAUDRATE, - CLOCK_GetFreq(ERPC_BOARD_UART_CLKSRC); -#elif defined(LPUART) - transport = erpc_transport_lpuart_init(ERPC_BOARD_UART_BASEADDR, ERPC_BOARD_UART_BAUDRATE, - CLOCK_GetFreq(ERPC_BOARD_UART_CLKSRC); -#endif +#elif defined(UART) + transport = erpc_transport_cmsis_uart_init((void *)&Driver_USART0); message_buffer_factory = erpc_mbf_dynamic_init(); #endif diff --git a/test/common/unit_test_server.cpp b/test/common/unit_test_server.cpp index d5a1779b..370af62d 100644 --- a/test/common/unit_test_server.cpp +++ b/test/common/unit_test_server.cpp @@ -14,13 +14,15 @@ #include "test_unit_test_common_server.h" #include "unit_test_wrapped.h" -#if (defined(RPMSG) || defined(UART) || defined(LPUART)) +#if (defined(RPMSG) || defined(UART)) extern "C" { #include "app_core1.h" #if defined(RPMSG) #define APP_ERPC_READY_EVENT_DATA (1) #include "mcmgr.h" #include "rpmsg_lite.h" +#elif defined(UART) +#include "fsl_usart_cmsis.h" #endif } #endif @@ -34,6 +36,9 @@ int MyAlloc::allocated_ = 0; //////////////////////////////////////////////////////////////////////////////// // Code //////////////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif #if defined(RPMSG) static void SignalReady(void) { @@ -53,9 +58,6 @@ void SystemInitHook(void) } #endif -#ifdef __cplusplus -extern "C" { -#endif int main(int argc, const char *argv[]) { #if defined(RPMSG) @@ -77,14 +79,8 @@ int main(int argc, const char *argv[]) transport = erpc_transport_rpmsg_lite_remote_init(101, 100, (void *)startupData, ERPC_TRANSPORT_RPMSG_LITE_LINK_ID, SignalReady, NULL); message_buffer_factory = erpc_mbf_rpmsg_init(transport); -#else -#if defined(UART) - transport = erpc_transport_uart_init(ERPC_BOARD_UART_BASEADDR, ERPC_BOARD_UART_BAUDRATE, - CLOCK_GetFreq(ERPC_BOARD_UART_CLKSRC); -#elif defined(LPUART) - transport = erpc_transport_lpuart_init(ERPC_BOARD_UART_BASEADDR, ERPC_BOARD_UART_BAUDRATE, - CLOCK_GetFreq(ERPC_BOARD_UART_CLKSRC); -#endif +#elif defined(UART) + transport = erpc_transport_cmsis_uart_init((void *)&Driver_USART0); message_buffer_factory = erpc_mbf_dynamic_init(); #endif diff --git a/test/test_callbacks/callbacks1.h b/test/test_callbacks/callbacks1.h index 57ef3c6e..b1d511c7 100644 --- a/test/test_callbacks/callbacks1.h +++ b/test/test_callbacks/callbacks1.h @@ -6,6 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -void callback1(int32_t a, int32_t b); +void callback1a(int32_t a, int32_t b); -void callback2(int32_t param1, int32_t param2); +void callback1b(int32_t param1, int32_t param2); diff --git a/test/test_callbacks/callbacks2.h b/test/test_callbacks/callbacks2.h index 3208ecea..f3f4120c 100644 --- a/test/test_callbacks/callbacks2.h +++ b/test/test_callbacks/callbacks2.h @@ -6,4 +6,4 @@ * SPDX-License-Identifier: BSD-3-Clause */ -void callback3(int32_t param1, int32_t param2); +void callback2(int32_t param1, int32_t param2); diff --git a/test/test_callbacks/test_callbacks.erpc b/test/test_callbacks/test_callbacks.erpc index 45ae4da7..031cdf9c 100644 --- a/test/test_callbacks/test_callbacks.erpc +++ b/test/test_callbacks/test_callbacks.erpc @@ -17,20 +17,20 @@ oneway callback2_t(int32, int32) @group("core0") interface ClientCore0Services { - myFun(in callback1_t pCallback1_t, out callback1_t pCallback2_t) -> void + myFun(in callback1_t pCallback1_in, out callback1_t pCallback1_out) -> void - myFun2(callback2_t pCallback1_t, out callback2_t pCallback2_t) -> void + myFun2(callback2_t pCallback2_in, out callback2_t pCallback2_out) -> void @include("callbacks1.h") - callback1_t callback1; + callback1_t callback1a; @include("callbacks1.h") - callback1_t callback2(param1, param2); + callback1_t callback1b(param1, param2); } @group("core1") interface ClientCore1Services { @include("callbacks2.h") - callback2_t callback3(param1, param2); + callback2_t callback2(param1, param2); } \ No newline at end of file diff --git a/test/test_callbacks/test_callbacks_client_impl.cpp b/test/test_callbacks/test_callbacks_client_impl.cpp index 11bb1291..4d812e6c 100644 --- a/test/test_callbacks/test_callbacks_client_impl.cpp +++ b/test/test_callbacks/test_callbacks_client_impl.cpp @@ -9,24 +9,32 @@ #include "test_core0.h" #include "test_core1_server.h" -void callback3(int32_t param1, int32_t param2) {} +void callback2(int32_t param1, int32_t param2) {} //////////////////////////////////////////////////////////////////////////////// // Unit test Implementation code //////////////////////////////////////////////////////////////////////////////// -TEST(test_callbacks, In_Out_table) +TEST(test_callbacks, In_Out_table_1) { - callback1_t pCallback2_t = NULL; - myFun(callback1, &pCallback2_t); + callback1_t pCallback1_out = NULL; + myFun(callback1a, &pCallback1_out); - EXPECT_TRUE(callback1 == *pCallback2_t); + EXPECT_TRUE(callback1a == *pCallback1_out); +} + +TEST(test_callbacks, In_Out_table_2) +{ + callback1_t pCallback1_out = NULL; + myFun(callback1b, &pCallback1_out); + + EXPECT_TRUE(callback1b == *pCallback1_out); } TEST(test_callbacks, In_Out_withoutTable) { - callback2_t pCallback2_t = NULL; - myFun2(callback3, &pCallback2_t); + callback2_t pCallback2_out = NULL; + myFun2(callback2, &pCallback2_out); - EXPECT_TRUE(callback3 == *pCallback2_t); + EXPECT_TRUE(callback2 == *pCallback2_out); } diff --git a/test/test_callbacks/test_callbacks_server_impl.cpp b/test/test_callbacks/test_callbacks_server_impl.cpp index 69bae214..1d76d7ee 100644 --- a/test/test_callbacks/test_callbacks_server_impl.cpp +++ b/test/test_callbacks/test_callbacks_server_impl.cpp @@ -16,37 +16,38 @@ // Implementation of function code //////////////////////////////////////////////////////////////////////////////// -void myFun(const callback1_t pCallback1_t, callback1_t *pCallback2_t) +callback1_t *cb1 = NULL; +callback2_t *cb2 = NULL; + +void myFun(const callback1_t pCallback1_in, callback1_t *pCallback1_out) { - if (pCallback1_t == callback1) - { - *pCallback2_t = pCallback1_t; - } - else - { - *pCallback2_t = callback2; - } + cb1 = NULL; + pCallback1_in(1, 2); + *pCallback1_out = (callback1_t)cb1; } -void myFun2(const callback2_t pCallback1_t, callback2_t *pCallback2_t) +void myFun2(const callback2_t pCallback2_in, callback2_t *pCallback2_out) { - - if (pCallback1_t == callback3) - { - *pCallback2_t = pCallback1_t; - } - else - { - *pCallback2_t = NULL; - } + cb2 = NULL; + pCallback2_in(1, 2); + *pCallback2_out = (callback2_t)cb2; } -void callback1(int32_t a, int32_t b) {} +void callback1a(int32_t a, int32_t b) +{ + cb1 = (callback1_t *)callback1a; +} -void callback2(int32_t param1, int32_t param2) {} +void callback1b(int32_t param1, int32_t param2) +{ + cb1 = (callback1_t *)callback1b; +} /* will be shim code in real use case */ -void callback3(int32_t param1, int32_t param2) {} +void callback2(int32_t param1, int32_t param2) +{ + cb2 = (callback2_t *)callback2; +} //////////////////////////////////////////////////////////////////////////////// // Add service to server code