feat:open I cache and FPU
This commit is contained in:
parent
590191d7e3
commit
d8053c532a
24
.config
24
.config
@ -236,7 +236,7 @@ CONFIG_RT_USING_SERIAL=y
|
||||
CONFIG_RT_USING_SERIAL_V1=y
|
||||
# CONFIG_RT_USING_SERIAL_V2 is not set
|
||||
CONFIG_RT_SERIAL_USING_DMA=y
|
||||
CONFIG_RT_SERIAL_RB_BUFSZ=128
|
||||
CONFIG_RT_SERIAL_RB_BUFSZ=1024
|
||||
# CONFIG_RT_USING_SERIAL_BYPASS is not set
|
||||
# CONFIG_RT_USING_CAN is not set
|
||||
# CONFIG_RT_USING_CPUTIME is not set
|
||||
@ -1437,30 +1437,28 @@ CONFIG_SOC_STM32H750XB=y
|
||||
#
|
||||
# On-chip Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_SCB_ENABLE_I_CACHE=y
|
||||
# CONFIG_BSP_SCB_ENABLE_D_CACHE is not set
|
||||
CONFIG_BSP_ENABLE_FPU=y
|
||||
CONFIG_BSP_USING_GPIO=y
|
||||
CONFIG_BSP_USING_UART=y
|
||||
CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000
|
||||
CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=6000
|
||||
CONFIG_BSP_USING_UART1=y
|
||||
# CONFIG_BSP_UART1_RX_USING_DMA is not set
|
||||
# CONFIG_BSP_UART1_TX_USING_DMA is not set
|
||||
CONFIG_BSP_USING_UART2=y
|
||||
# CONFIG_BSP_UART2_RX_USING_DMA is not set
|
||||
CONFIG_BSP_UART2_RX_USING_DMA=y
|
||||
# CONFIG_BSP_UART2_TX_USING_DMA is not set
|
||||
CONFIG_BSP_UART2_RX_BUFSIZE=1024
|
||||
CONFIG_BSP_UART2_TX_BUFSIZE=0
|
||||
CONFIG_BSP_UART2_TX_BUFSIZE=512
|
||||
CONFIG_BSP_USING_UART3=y
|
||||
# CONFIG_BSP_UART3_RX_USING_DMA is not set
|
||||
CONFIG_BSP_UART3_RX_USING_DMA=y
|
||||
# CONFIG_BSP_UART3_TX_USING_DMA is not set
|
||||
CONFIG_BSP_UART3_RX_BUFSIZE=256
|
||||
CONFIG_BSP_UART3_TX_BUFSIZE=0
|
||||
CONFIG_BSP_UART3_RX_BUFSIZE=1024
|
||||
CONFIG_BSP_UART3_TX_BUFSIZE=512
|
||||
# CONFIG_BSP_USING_PWM is not set
|
||||
# CONFIG_BSP_USING_QSPI is not set
|
||||
CONFIG_BSP_USING_SPI=y
|
||||
# CONFIG_BSP_USING_SPI1 is not set
|
||||
CONFIG_BSP_USING_SPI5=y
|
||||
CONFIG_BSP_SPI5_TX_USING_DMA=y
|
||||
# CONFIG_BSP_SPI5_RX_USING_DMA is not set
|
||||
# CONFIG_BSP_USING_SPI6 is not set
|
||||
# CONFIG_BSP_USING_SPI is not set
|
||||
# CONFIG_BSP_USING_CRC is not set
|
||||
# CONFIG_BSP_USING_RNG is not set
|
||||
# CONFIG_BSP_USING_UDID is not set
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,7 +13,7 @@
|
||||
build
|
||||
Debug
|
||||
documentation/html
|
||||
packages/
|
||||
#packages/
|
||||
*~
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
3
.idea/vcs.xml
generated
3
.idea/vcs.xml
generated
@ -2,5 +2,8 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/packages/CMSIS-Core-latest" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/packages/stm32h7_cmsis_driver-latest" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/packages/stm32h7_hal_driver-latest" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -32,6 +32,7 @@ INCLUDE_DIRECTORIES(
|
||||
applications/erpc
|
||||
applications/erpc/service
|
||||
applications/erpc/client
|
||||
applications/erpc/common
|
||||
applications/erpc/proto/generated
|
||||
board
|
||||
board/CubeMX_Config/Inc
|
||||
@ -82,12 +83,13 @@ ADD_DEFINITIONS(
|
||||
|
||||
# Library source files
|
||||
SET(RT_APP_ERPC_SOURCES
|
||||
applications/erpc/client/src/erpc_client_main.cpp
|
||||
applications/erpc/proto/generated/head_service_server.cpp
|
||||
applications/erpc/proto/generated/head_service_client.cpp
|
||||
applications/erpc/service/src/head_service_impl.cpp
|
||||
applications/erpc/service/src/erpc_server_main.cpp
|
||||
applications/erpc/common/src/erpc_error_handler.cpp
|
||||
applications/erpc/service/src/head_service_impl.cpp
|
||||
applications/erpc/proto/generated/head_service_server.cpp
|
||||
applications/erpc/client/src/erpc_client_main.cpp
|
||||
applications/erpc/proto/generated/head_service_interface.cpp
|
||||
applications/erpc/proto/generated/head_service_client.cpp
|
||||
)
|
||||
|
||||
SET(RT_APPLICATIONS_SOURCES
|
||||
@ -106,8 +108,8 @@ SET(RT_COMPILER_SOURCES
|
||||
)
|
||||
|
||||
SET(RT_CPP_SOURCES
|
||||
rt-thread/components/libc/cplusplus/cxx_crt_init.c
|
||||
rt-thread/components/libc/cplusplus/cxx_crt.cpp
|
||||
rt-thread/components/libc/cplusplus/cxx_crt_init.c
|
||||
)
|
||||
|
||||
SET(RT_DEVICEDRIVERS_SOURCES
|
||||
@ -139,33 +141,33 @@ SET(RT_DRIVERS_SOURCES
|
||||
)
|
||||
|
||||
SET(RT_ERPC_SOURCES
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_client_setup.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_server.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_arbitrated_client_setup.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_server_setup.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_mbf_static.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_uart_cmsis.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_mbf_dynamic.cpp
|
||||
packages/erpc-1.14.0/erpc_c/transports/erpc_uart_cmsis_transport.cpp
|
||||
packages/erpc-1.14.0/erpc_c/port/erpc_threading_pthreads.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_server_setup.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_server.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_mbf_static.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_simple_server.cpp
|
||||
packages/erpc-1.14.0/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_serial.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_framed_transport.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_client_manager.cpp
|
||||
packages/erpc-1.14.0/erpc_c/transports/erpc_serial_transport.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.cpp
|
||||
packages/erpc-1.14.0/erpc_c/port/erpc_threading_pthreads.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.cpp
|
||||
packages/erpc-1.14.0/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp
|
||||
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_arbitrated_client_setup.cpp
|
||||
packages/erpc-1.14.0/erpc_c/setup/erpc_client_setup.cpp
|
||||
)
|
||||
|
||||
SET(RT_FINSH_SOURCES
|
||||
rt-thread/components/finsh/shell.c
|
||||
rt-thread/components/finsh/cmd.c
|
||||
rt-thread/components/finsh/msh.c
|
||||
rt-thread/components/finsh/msh_parse.c
|
||||
rt-thread/components/finsh/shell.c
|
||||
)
|
||||
|
||||
SET(RT_KERNEL_SOURCES
|
||||
@ -187,17 +189,17 @@ SET(RT_KERNEL_SOURCES
|
||||
)
|
||||
|
||||
SET(RT_KLIBC_SOURCES
|
||||
rt-thread/src/klibc/kerrno.c
|
||||
rt-thread/src/klibc/rt_vsnprintf_tiny.c
|
||||
rt-thread/src/klibc/rt_vsscanf.c
|
||||
rt-thread/src/klibc/rt_vsnprintf_tiny.c
|
||||
rt-thread/src/klibc/kerrno.c
|
||||
rt-thread/src/klibc/kstdio.c
|
||||
rt-thread/src/klibc/kstring.c
|
||||
)
|
||||
|
||||
SET(RT_KTIME_SOURCES
|
||||
rt-thread/components/drivers/ktime/src/cputimer.c
|
||||
rt-thread/components/drivers/ktime/src/hrtimer.c
|
||||
rt-thread/components/drivers/ktime/src/boottime.c
|
||||
rt-thread/components/drivers/ktime/src/cputimer.c
|
||||
)
|
||||
|
||||
SET(RT_LIBCPU_SOURCES
|
||||
@ -210,30 +212,30 @@ SET(RT_LIBCPU_SOURCES
|
||||
)
|
||||
|
||||
SET(RT_LIBRARIES_SOURCES
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_sram.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rng.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_comp.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c
|
||||
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/system_stm32h7xx.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cec.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cec.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_comp.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_usart.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
|
||||
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/system_stm32h7xx.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_sram.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc_ex.c
|
||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rng.c
|
||||
)
|
||||
|
||||
SET(RT_POSIX_SOURCES
|
||||
|
||||
@ -23,7 +23,7 @@ gen_dir = p('proto', 'generated')
|
||||
|
||||
# interface 建议始终编译(两端都可能需要)
|
||||
src += [p('proto', 'generated', 'head_service_interface.cpp')]
|
||||
|
||||
src += [p('common', 'src', 'erpc_error_handler.cpp')]
|
||||
if GetDepend(['ERPC_MODE_SERVER']):
|
||||
src += [p('proto', 'generated', 'head_service_server.cpp')]
|
||||
|
||||
@ -34,6 +34,7 @@ CPPPATH = [
|
||||
cwd,
|
||||
p('service'),
|
||||
p('client'),
|
||||
p('common'),
|
||||
gen_dir,
|
||||
]
|
||||
|
||||
|
||||
@ -10,15 +10,16 @@
|
||||
#include "erpc_client_setup.h"
|
||||
|
||||
// generated (C++ stub)
|
||||
#include "drv_gpio.h"
|
||||
#include "erpc/proto/generated/head_service_client.hpp"
|
||||
#include "head_service_common.hpp" // 若有用到类型
|
||||
|
||||
#ifndef ERPC_UART_NAME
|
||||
#define ERPC_UART_NAME "uart3"
|
||||
#ifndef ERPC_CLIENT_UART_NAME
|
||||
#define ERPC_CLIENT_UART_NAME "uart3"
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_UART_BAUD
|
||||
#define ERPC_UART_BAUD (115200)
|
||||
#define ERPC_UART_BAUD (921600 )
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_CLIENT_STACK
|
||||
@ -26,20 +27,21 @@
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_CLIENT_PRIO
|
||||
#define ERPC_CLIENT_PRIO (20)
|
||||
#define ERPC_CLIENT_PRIO (5)
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_CLIENT_TICK
|
||||
#define ERPC_CLIENT_TICK (10)
|
||||
#define ERPC_CLIENT_TICK (5)
|
||||
#endif
|
||||
|
||||
static void erpc_client_entry(void *parameter)
|
||||
{
|
||||
(void)parameter;
|
||||
|
||||
rt_kprintf("[erpc] client init on %s, %d\r\n", ERPC_UART_NAME, ERPC_UART_BAUD);
|
||||
rt_kprintf("[erpc] client init on %s, %d\r\n", ERPC_CLIENT_UART_NAME, ERPC_UART_BAUD);
|
||||
|
||||
erpc_transport_t transport = erpc_transport_cmsis_uart_init(ERPC_UART_NAME);
|
||||
erpc_transport_t transport = erpc_transport_serial_init(ERPC_CLIENT_UART_NAME,ERPC_UART_BAUD);
|
||||
// erpc_transport_t transport = erpc_transport_cmsis_uart_init(ERPC_CLIENT_UART_NAME);
|
||||
if (!transport)
|
||||
{
|
||||
rt_kprintf("[erpc] transport init failed!\r\n");
|
||||
@ -63,17 +65,31 @@ static void erpc_client_entry(void *parameter)
|
||||
|
||||
auto *mgr = reinterpret_cast<erpc::ClientManager *>(client);
|
||||
erpcShim::demo_client stub(mgr);
|
||||
int32_t a = 7;
|
||||
int32_t b = 8;
|
||||
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
||||
int32_t r = stub.add(7, 8);
|
||||
rt_kprintf("[erpc] add(1,2)=%d\r\n", (int)r);
|
||||
|
||||
rt_tick_t now = rt_tick_get();
|
||||
rt_uint32_t ms = (rt_uint32_t)((rt_uint64_t)now * 1000 / RT_TICK_PER_SECOND);
|
||||
rt_kprintf("start:[%lu ms] [erpc client] \r\n",(unsigned long)ms);
|
||||
// rt_pin_write(GET_PIN(D, 0), PIN_HIGH);
|
||||
int32_t r = stub.add(a, b);
|
||||
// rt_pin_write(GET_PIN(D, 0), PIN_LOW);
|
||||
|
||||
now = rt_tick_get();
|
||||
ms = (rt_uint32_t)((rt_uint64_t)now * 1000 / RT_TICK_PER_SECOND);
|
||||
rt_kprintf("end:[%lu ms] [erpc client] \r\n",(unsigned long)ms);
|
||||
|
||||
rt_thread_mdelay(1000);
|
||||
}
|
||||
|
||||
// 如果你未来要退出线程:
|
||||
// erpc_client_deinit(client);
|
||||
// 退出线程:
|
||||
erpc_client_deinit(client);
|
||||
}
|
||||
|
||||
extern "C" int erpc_client_start(void)
|
||||
|
||||
48
applications/erpc/common/include/erpc_error_handler.h
Normal file
48
applications/erpc/common/include/erpc_error_handler.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__ERROR_HANDLER_H_
|
||||
#define _EMBEDDED_RPC__ERROR_HANDLER_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "erpc_common.h"
|
||||
|
||||
/*!
|
||||
* @addtogroup error_handler
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! @name Error handler
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @brief This function handles eRPC errors.
|
||||
*
|
||||
* This function prints a description of occurred error and sets bool variable g_erpc_error_occurred which is used for
|
||||
* determining if error occurred in user application on client side.
|
||||
*/
|
||||
void erpc_error_handler(erpc_status_t err, uint32_t functionID);
|
||||
|
||||
//@}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
#endif // _EMBEDDED_RPC__ERROR_HANDLER_H_
|
||||
106
applications/erpc/common/src/erpc_error_handler.cpp
Normal file
106
applications/erpc/common/src/erpc_error_handler.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include "erpc/common/include/erpc_error_handler.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Variables
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern bool g_erpc_error_occurred;
|
||||
bool g_erpc_error_occurred = false;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void erpc_error_handler(erpc_status_t err, uint32_t functionID)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case kErpcStatus_Fail:
|
||||
printf("\r\nGeneric failure.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_InvalidArgument:
|
||||
printf("\r\nArgument is an invalid value.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_Timeout:
|
||||
printf("\r\nOperated timed out.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_InvalidMessageVersion:
|
||||
printf("\r\nMessage header contains an unknown version.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_ExpectedReply:
|
||||
printf("\r\nExpected a reply message but got another message type.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_CrcCheckFailed:
|
||||
printf("\r\nMessage is corrupted.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_BufferOverrun:
|
||||
printf("\r\nAttempt to read or write past the end of a buffer.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_UnknownName:
|
||||
printf("\r\nCould not find host with given name.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_ConnectionFailure:
|
||||
printf("\r\nFailed to connect to host.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_ConnectionClosed:
|
||||
printf("\r\nConnected closed by peer.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_MemoryError:
|
||||
printf("\r\nMemory allocation error.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_ServerIsDown:
|
||||
printf("\r\nServer is stopped.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_InitFailed:
|
||||
printf("\r\nTransport layer initialization failed.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_ReceiveFailed:
|
||||
printf("\r\nFailed to receive data.");
|
||||
break;
|
||||
|
||||
case kErpcStatus_SendFailed:
|
||||
printf("\r\nFailed to send data.");
|
||||
break;
|
||||
|
||||
/* no error occurred */
|
||||
case kErpcStatus_Success:
|
||||
return;
|
||||
|
||||
/* unhandled error */
|
||||
default:
|
||||
printf("\r\nUnhandled error occurred.");
|
||||
break;
|
||||
}
|
||||
|
||||
/* When error occurred on client side. */
|
||||
if (functionID != 0)
|
||||
{
|
||||
printf("Function id '%u'.", (unsigned int)functionID);
|
||||
}
|
||||
printf("\r\n");
|
||||
|
||||
/* error occurred */
|
||||
g_erpc_error_occurred = true;
|
||||
}
|
||||
@ -6,6 +6,7 @@
|
||||
#include <rtdevice.h>
|
||||
|
||||
// eRPC setup
|
||||
|
||||
#include "erpc_server_setup.h"
|
||||
#include "erpc_transport_setup.h"
|
||||
#include "erpc_mbf_setup.h"
|
||||
@ -15,36 +16,40 @@
|
||||
#include "erpc/proto/generated/head_service_interface.hpp"
|
||||
|
||||
#include "erpc/service/include/head_service_impl.h"
|
||||
#include "erpc/common/include/erpc_error_handler.h"
|
||||
|
||||
// ====== 可按需修改的参数 ======
|
||||
#ifndef ERPC_UART_NAME
|
||||
#define ERPC_UART_NAME "uart2"
|
||||
// ====== 参数 ======
|
||||
#ifndef ERPC_SERVER_UART_NAME
|
||||
#define ERPC_SERVER_UART_NAME "uart2"
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_UART_BAUD
|
||||
#define ERPC_UART_BAUD (115200)
|
||||
#define ERPC_UART_BAUD (921600 )
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_THREAD_STACK
|
||||
#define ERPC_THREAD_STACK (8192)
|
||||
#define ERPC_THREAD_STACK (4096)
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_THREAD_PRIO
|
||||
#define ERPC_THREAD_PRIO (20)
|
||||
#define ERPC_THREAD_PRIO (4)
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_THREAD_TICK
|
||||
#define ERPC_THREAD_TICK (10)
|
||||
#define ERPC_THREAD_TICK (5)
|
||||
#endif
|
||||
|
||||
static void erpc_server_entry(void *parameter)
|
||||
{
|
||||
(void)parameter;
|
||||
// rt_kprintf("CPACR=%08lx\n", SCB->CPACR);
|
||||
|
||||
rt_kprintf("[erpc] server init on %s, %d\r\n", ERPC_UART_NAME, ERPC_UART_BAUD);
|
||||
|
||||
rt_kprintf("[erpc] server init on %s, %d\r\n", ERPC_SERVER_UART_NAME, ERPC_UART_BAUD);
|
||||
|
||||
// 1) transport
|
||||
erpc_transport_t transport = erpc_transport_cmsis_uart_init(ERPC_UART_NAME);
|
||||
erpc_transport_t transport = erpc_transport_serial_init(ERPC_SERVER_UART_NAME,ERPC_UART_BAUD);
|
||||
// erpc_transport_t transport = erpc_transport_cmsis_uart_init(ERPC_SERVER_UART_NAME);
|
||||
if (!transport)
|
||||
{
|
||||
rt_kprintf("[erpc] transport init failed!\r\n");
|
||||
@ -79,7 +84,7 @@ static void erpc_server_entry(void *parameter)
|
||||
erpc_status_t tcp_status = erpc_server_poll(server);
|
||||
if (tcp_status != kErpcStatus_Success)
|
||||
{
|
||||
// erpc_error_handler(tcp_status,0);
|
||||
erpc_error_handler(tcp_status,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,5 +107,5 @@ extern "C" int erpc_server_start(void)
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
// 让系统启动后自动拉起(如果你希望手动启动,就把这一行注释掉)
|
||||
|
||||
INIT_APP_EXPORT(erpc_server_start);
|
||||
|
||||
@ -8,6 +8,10 @@
|
||||
|
||||
int32_t HeadServiceImpl::add(int32_t a, int32_t b)
|
||||
{
|
||||
rt_kprintf("[erpc] add(%d, %d)\r\n", (int)a, (int)b);
|
||||
return a + b;
|
||||
int32_t r = a + b;
|
||||
rt_tick_t now = rt_tick_get();
|
||||
rt_uint32_t ms = (rt_uint32_t)((rt_uint64_t)now * 1000 / RT_TICK_PER_SECOND);
|
||||
rt_kprintf("[%lu ms] [erpc service] add(%ld,%ld)=%ld\r\n",
|
||||
(unsigned long)ms, (long)a, (long)b, (long)r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ int main(void)
|
||||
int count = 1;
|
||||
/* set LED0 pin mode to output */
|
||||
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
||||
rt_pin_mode(GET_PIN(D, 0), PIN_MODE_OUTPUT);
|
||||
|
||||
|
||||
while (count++)
|
||||
@ -33,6 +34,15 @@ int main(void)
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
static inline int dwt_init(void)
|
||||
{
|
||||
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||
DWT->CYCCNT = 0;
|
||||
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
|
||||
return 0;
|
||||
}
|
||||
|
||||
INIT_APP_EXPORT(dwt_init);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,25 @@ endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
|
||||
config BSP_SCB_ENABLE_I_CACHE
|
||||
bool "Enable I-Cache (SCB_EnableICache)"
|
||||
default y
|
||||
help
|
||||
Enable Cortex-M7 I-Cache for better XIP performance.
|
||||
|
||||
config BSP_SCB_ENABLE_D_CACHE
|
||||
bool "Enable D-Cache (SCB_EnableDCache)"
|
||||
default n
|
||||
help
|
||||
Enable Cortex-M7 D-Cache. Make sure MPU is configured correctly.
|
||||
|
||||
config BSP_ENABLE_FPU
|
||||
bool "Enable FPU support (select RT_USING_FPU)"
|
||||
default y
|
||||
select RT_USING_FPU
|
||||
help
|
||||
Enable RT-Thread FPU context support on Cortex-M7.
|
||||
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
/* DMA1 stream0 */
|
||||
@ -37,6 +38,22 @@ extern "C" {
|
||||
#define UART2_TX_DMA_IRQ DMA1_Stream1_IRQn
|
||||
#endif
|
||||
|
||||
/* DMA1 stream2/3 for USART3 */
|
||||
#if defined(BSP_UART3_RX_USING_DMA) && !defined(UART3_RX_DMA_INSTANCE)
|
||||
#define UART3_DMA_RX_IRQHandler DMA1_Stream2_IRQHandler
|
||||
#define UART3_RX_DMA_RCC RCC_AHB1ENR_DMA1EN
|
||||
#define UART3_RX_DMA_INSTANCE DMA1_Stream2
|
||||
#define UART3_RX_DMA_REQUEST DMA_REQUEST_USART3_RX
|
||||
#define UART3_RX_DMA_IRQ DMA1_Stream2_IRQn
|
||||
#endif
|
||||
|
||||
#if defined(BSP_UART3_TX_USING_DMA) && !defined(UART3_TX_DMA_INSTANCE)
|
||||
#define UART3_DMA_TX_IRQHandler DMA1_Stream3_IRQHandler
|
||||
#define UART3_TX_DMA_RCC RCC_AHB1ENR_DMA1EN
|
||||
#define UART3_TX_DMA_INSTANCE DMA1_Stream3
|
||||
#define UART3_TX_DMA_REQUEST DMA_REQUEST_USART3_TX
|
||||
#define UART3_TX_DMA_IRQ DMA1_Stream3_IRQn
|
||||
#endif
|
||||
/* DMA1 stream2 */
|
||||
#if defined(BSP_SPI3_RX_USING_DMA) && !defined(SPI3_RX_DMA_INSTANCE)
|
||||
#define SPI3_DMA_RX_IRQHandler DMA1_Stream2_IRQHandler
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BSP_USING_UART1)
|
||||
@ -99,6 +100,17 @@ extern "C" {
|
||||
#endif /* UART3_DMA_RX_CONFIG */
|
||||
#endif /* BSP_UART3_RX_USING_DMA */
|
||||
|
||||
#if defined(BSP_UART3_TX_USING_DMA)
|
||||
#ifndef UART3_DMA_TX_CONFIG
|
||||
#define UART3_DMA_TX_CONFIG \
|
||||
{ \
|
||||
.Instance = UART3_TX_DMA_INSTANCE, \
|
||||
.request = UART3_TX_DMA_REQUEST, \
|
||||
.dma_rcc = UART3_TX_DMA_RCC, \
|
||||
.dma_irq = UART3_TX_DMA_IRQ, \
|
||||
}
|
||||
#endif /* UART3_DMA_TX_CONFIG */
|
||||
#endif /* BSP_UART3_TX_USING_DMA */
|
||||
#if defined(BSP_USING_UART4)
|
||||
#ifndef UART4_CONFIG
|
||||
#define UART4_CONFIG \
|
||||
|
||||
1
packages/CMSIS-Core-latest
Submodule
1
packages/CMSIS-Core-latest
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 39d8e01f0be84b83a8f11d33756e82ce1ef07a84
|
||||
49
packages/Kconfig
Normal file
49
packages/Kconfig
Normal file
@ -0,0 +1,49 @@
|
||||
menu "Third Packages Drivers"
|
||||
|
||||
menuconfig BSP_USING_ERPC
|
||||
bool "Enable using erpc"
|
||||
default n
|
||||
|
||||
|
||||
if BSP_USING_ERPC
|
||||
|
||||
|
||||
config ERPC_USING_RTT
|
||||
bool "Enable erpc using rtt"
|
||||
default n
|
||||
|
||||
|
||||
|
||||
menuconfig ERPC_MODE
|
||||
bool "Select erpc mode"
|
||||
default y
|
||||
if ERPC_MODE
|
||||
config ERPC_MODE_SERVER
|
||||
bool "ERPC Server Mode"
|
||||
default y
|
||||
config ERPC_MODE_CLIENT
|
||||
bool "ERPC Client Mode"
|
||||
default n
|
||||
endif
|
||||
|
||||
|
||||
|
||||
menuconfig ERPC_TRANSPORTS
|
||||
bool "Select erpc transports"
|
||||
default y
|
||||
if ERPC_TRANSPORTS
|
||||
config ERPC_TRANSPORTS_SPI
|
||||
bool "SPI transports"
|
||||
default n
|
||||
config ERPC_TRANSPORTS_UART
|
||||
bool "UART transports"
|
||||
default n
|
||||
config ERPC_TRANSPORTS_TCP
|
||||
bool "TCP transports"
|
||||
default n
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
endmenu
|
||||
37
packages/SConscript
Normal file
37
packages/SConscript
Normal file
@ -0,0 +1,37 @@
|
||||
import os
|
||||
from building import *
|
||||
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
# 黑名单(exact)
|
||||
exclude_dirs = {
|
||||
'cmsis-core-latest',
|
||||
'stm32h7_cmsis_driver-latest',
|
||||
'stm32h7_hal_driver-latest',
|
||||
}
|
||||
|
||||
#黑名单(prefix)
|
||||
exclude_prefixes = (
|
||||
'cmsis-core-',
|
||||
'stm32h7_cmsis_driver-',
|
||||
'stm32h7_hal_driver-',
|
||||
)
|
||||
|
||||
for item in os.listdir(cwd):
|
||||
item_path = os.path.join(cwd, item)
|
||||
|
||||
if not os.path.isdir(item_path):
|
||||
continue
|
||||
|
||||
name = item.lower()
|
||||
|
||||
if name in exclude_dirs or name.startswith(exclude_prefixes):
|
||||
print('[scons] skip dir:', item)
|
||||
continue
|
||||
|
||||
scon = os.path.join(item_path, 'SConscript')
|
||||
if os.path.isfile(scon):
|
||||
objs += SConscript(scon)
|
||||
|
||||
Return('objs')
|
||||
103
packages/erpc-1.14.0/.circleci/config.yml
vendored
Normal file
103
packages/erpc-1.14.0/.circleci/config.yml
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
win: circleci/windows@5.0 # The Windows orb gives you everything you need to start using the
|
||||
|
||||
commands:
|
||||
install_dependencies:
|
||||
parameters:
|
||||
compiler:
|
||||
default: ""
|
||||
type: string
|
||||
steps:
|
||||
- run: chmod u+x install_dependencies.sh && ./install_dependencies.sh <<parameters.compiler>>
|
||||
run_tests:
|
||||
parameters:
|
||||
compiler:
|
||||
default: ""
|
||||
type: string
|
||||
steps:
|
||||
- run: chmod u+x run_tests.sh && ./run_tests.sh <<parameters.compiler>>
|
||||
|
||||
jobs:
|
||||
build-linux-gcc:
|
||||
machine:
|
||||
image: ubuntu-2204:2022.04.2 #https://circleci.com/developer/machine/image/ubuntu-2204 pick LTS
|
||||
steps:
|
||||
- checkout
|
||||
- install_dependencies
|
||||
- run_tests
|
||||
- store_artifacts:
|
||||
path: ./Release/Linux/erpcgen/erpcgen
|
||||
|
||||
build-linux-clang:
|
||||
machine:
|
||||
image: ubuntu-2204:2022.04.2 #https://circleci.com/developer/machine/image/ubuntu-2204 pick LTS
|
||||
steps:
|
||||
- checkout
|
||||
- install_dependencies:
|
||||
compiler: "clang"
|
||||
- run_tests:
|
||||
compiler: "clang"
|
||||
# - store_artifacts:
|
||||
# path: ./Release/Linux/erpcgen/erpcgen
|
||||
|
||||
build-mac-gcc:
|
||||
macos:
|
||||
xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases
|
||||
resource_class: macos.x86.medium.gen2
|
||||
steps:
|
||||
- checkout
|
||||
- install_dependencies
|
||||
- run_tests
|
||||
- store_artifacts:
|
||||
path: ./Release/Darwin/erpcgen/erpcgen
|
||||
|
||||
build-mac-clang:
|
||||
macos:
|
||||
xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases
|
||||
resource_class: macos.x86.medium.gen2
|
||||
steps:
|
||||
- checkout
|
||||
- install_dependencies:
|
||||
compiler: "clang"
|
||||
- run_tests:
|
||||
compiler: "clang"
|
||||
# - store_artifacts:
|
||||
# path: ./Release/Darwin/erpcgen/erpcgen
|
||||
|
||||
build-windows-mingw:
|
||||
executor:
|
||||
name: win/default
|
||||
size: large
|
||||
steps:
|
||||
- checkout
|
||||
- run: powershell.exe .\install_dependencies.ps1
|
||||
- run: .\mingw64\bin\mingw32-make all
|
||||
- run: .\mingw64\opt\bin\python3.exe .\test\run_unit_tests.py -m"..\\..\\mingw64\\bin\\mingw32-make"
|
||||
# - store_artifacts:
|
||||
# path: ./Release/MINGW64/erpcgen/erpcgen.exe
|
||||
|
||||
build-windows-VS:
|
||||
executor:
|
||||
name: win/default
|
||||
size: large
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install VS buuildtools
|
||||
no_output_timeout: 60m
|
||||
command: powershell.exe .\install_dependencies.ps1 VS
|
||||
- run: powershell.exe "& 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe' .\erpcgen\VisualStudio_v14\erpcgen.sln /property:Configuration=Release"
|
||||
- store_artifacts:
|
||||
path: ./erpcgen/VisualStudio_v14/Release/erpcgen.exe
|
||||
|
||||
workflows:
|
||||
build-workflow:
|
||||
jobs:
|
||||
- build-linux-gcc
|
||||
- build-linux-clang
|
||||
- build-mac-gcc
|
||||
- build-mac-clang
|
||||
- build-windows-mingw
|
||||
- build-windows-VS
|
||||
80
packages/erpc-1.14.0/.clang-format
vendored
Normal file
80
packages/erpc-1.14.0/.clang-format
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
#https://releases.llvm.org/16.0.0/tools/clang/docs/ClangFormatStyleOptions.html
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
BasedOnStyle: Google
|
||||
#BinPackParameters : false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: false
|
||||
ColumnLimit: 120
|
||||
ContinuationIndentWidth: 4
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
IndentCaseLabels: true
|
||||
IndentWrappedFunctionNames: false
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: 1
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
Standard: c++11
|
||||
TabWidth: 1
|
||||
UseTab: Never
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: Align
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakConstructorInitializers: AfterColon
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 0
|
||||
Cpp11BracedListStyle: false
|
||||
FixNamespaceComments: true
|
||||
NamespaceIndentation: None
|
||||
PointerAlignment: Right
|
||||
SortIncludes: Never
|
||||
SortUsingDeclarations: Lexicographic
|
||||
SpacesInAngles: Never
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeWhile: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: "^<" # system includes
|
||||
Priority: 10
|
||||
- Regex: '^"erpc_' # erpc public includes
|
||||
Priority: 1
|
||||
CommentPragmas: "#"
|
||||
9
packages/erpc-1.14.0/.clang-format-ignore
vendored
Normal file
9
packages/erpc-1.14.0/.clang-format-ignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#list of ignored files to format
|
||||
./erpc_c/port/erpc_serial.cpp
|
||||
./erpcgen/src/cpptemplate/cpptempl.hpp
|
||||
./erpcgen/src/cpptemplate/cpptempl.cpp
|
||||
./erpcgen/src/cpptemplate/cpptempl_test.cpp
|
||||
./erpcgen/test/test_includes/test_includes_union.h
|
||||
./test/common/gtest/gtest.h
|
||||
./test/common/gtest/gtest.cpp
|
||||
./test/common/retarget_cpp_streamed_io.c
|
||||
43
packages/erpc-1.14.0/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
43
packages/erpc-1.14.0/.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG] "
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Describe the bug
|
||||
<!--
|
||||
A clear and concise description of what the bug is.
|
||||
-->
|
||||
|
||||
## To Reproduce
|
||||
<!--
|
||||
Steps to reproduce the behavior:
|
||||
-->
|
||||
|
||||
## Expected behavior
|
||||
<!--
|
||||
A clear and concise description of what you expected to happen.
|
||||
-->
|
||||
|
||||
## Screenshots
|
||||
<!--
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
||||
|
||||
## Desktop (please complete the following information)
|
||||
|
||||
- OS<!--[e.g. iOS]-->:
|
||||
- eRPC Version<!--[e.g. v1.9.0]-->:
|
||||
|
||||
## Steps you didn't forgot to do
|
||||
|
||||
- [ ] I checked if there is no related issue opened/closed.
|
||||
- [ ] I checked that there doesn't exist opened PR which is solving this issue.
|
||||
|
||||
## Additional context
|
||||
<!--
|
||||
Add any other context about the problem here.
|
||||
-->
|
||||
33
packages/erpc-1.14.0/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
33
packages/erpc-1.14.0/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Is your feature request related to a problem? Please describe
|
||||
<!--
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
-->
|
||||
|
||||
## Describe the solution you'd like
|
||||
<!--
|
||||
A clear and concise description of what you want to happen.
|
||||
-->
|
||||
|
||||
## Describe alternatives you've considered
|
||||
<!--
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
-->
|
||||
|
||||
## Steps you didn't forgot to do
|
||||
|
||||
- [ ] I checked if there is no related issue opened/closed.
|
||||
- [ ] I checked that there doesn't exist opened PR which is solving this issue.
|
||||
|
||||
## Additional context
|
||||
<!--
|
||||
Add any other context or screenshots about the feature request here.
|
||||
-->
|
||||
19
packages/erpc-1.14.0/.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
19
packages/erpc-1.14.0/.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Question
|
||||
about: Question regarding to eRPC
|
||||
title: "[QUESTION]"
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## If you didn't find answer in existing open/closed issues you may ask here
|
||||
<!--
|
||||
A clear and concise description of what you want to ask.
|
||||
-->
|
||||
|
||||
## Steps you didn't forgot to do
|
||||
|
||||
- [ ] I checked if there is no related issue opened/closed.
|
||||
- [ ] I checked that there doesn't exist opened/closed PR which is solving this issue.
|
||||
- [ ] I looked in documentation if there is related information.
|
||||
44
packages/erpc-1.14.0/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
44
packages/erpc-1.14.0/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# Pull request
|
||||
|
||||
## Choose Correct
|
||||
|
||||
- [ ] bug
|
||||
- [ ] feature
|
||||
|
||||
## Describe the pull request
|
||||
<!--
|
||||
A clear and concise description of what the pull request is.
|
||||
-->
|
||||
|
||||
## To Reproduce
|
||||
<!--
|
||||
Steps to reproduce the behavior.
|
||||
-->
|
||||
|
||||
## Expected behavior
|
||||
<!--
|
||||
A clear and concise description of what you expected to happen.
|
||||
-->
|
||||
|
||||
## Screenshots
|
||||
<!--
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
||||
|
||||
## Desktop (please complete the following information):
|
||||
|
||||
- OS<!--[e.g. iOS]-->:
|
||||
- eRPC Version<!--[e.g. v1.9.0]-->:
|
||||
|
||||
## Steps you didn't forgot to do
|
||||
|
||||
- [ ] I checked if other PR isn't solving this issue.
|
||||
- [ ] I read Contribution details and did appropriate actions.
|
||||
- [ ] PR code is tested.
|
||||
- [ ] PR code is formatted.
|
||||
- [ ] Allow edits from maintainers pull request option is set (recommended).
|
||||
|
||||
## Additional context
|
||||
<!--
|
||||
Add any other context about the problem here.
|
||||
-->
|
||||
22
packages/erpc-1.14.0/.github/workflows/clang-format.yml
vendored
Normal file
22
packages/erpc-1.14.0/.github/workflows/clang-format.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: clang-format lint
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DoozyX/clang-format-lint-action@v0.16.2
|
||||
with:
|
||||
source: '.'
|
||||
exclude: './examples/zephyr/matrix_multiply_mbox/remote/src/service
|
||||
./examples/zephyr/matrix_multiply_mbox/src/service
|
||||
./examples/zephyr/matrix_multiply_rpmsglite/remote/src/service
|
||||
./examples/zephyr/matrix_multiply_rpmsglite/src/service
|
||||
./examples/zephyr/matrix_multiply_tcp/src/service
|
||||
./examples/zephyr/matrix_multiply_uart/src/service
|
||||
./examples/MCUXPRESSO_SDK/erpc_matrix_multiply/service
|
||||
./examples/MCUXPRESSO_SDK/erpc_two_way_rpc/service'
|
||||
clangFormatVersion: 16
|
||||
16
packages/erpc-1.14.0/.github/workflows/greetings.yml
vendored
Normal file
16
packages/erpc-1.14.0/.github/workflows/greetings.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
name: Greetings
|
||||
|
||||
on: [pull_request, issues]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: 'Hi eRPC user. Thank you for your interest and welcome. We hope you will enjoy this framework well.'
|
||||
pr-message: 'Hi eRPC user. Thank you for your PR. We are appreciating that and we will try to review it as soon as possible. We hope you are enjoying this framework so far.'
|
||||
116
packages/erpc-1.14.0/.gitignore
vendored
Normal file
116
packages/erpc-1.14.0/.gitignore
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
#
|
||||
# NOTE! Don't add files that are generated in specific
|
||||
# subdirectories here. Add them in the ".gitignore" file
|
||||
# in that subdirectory instead.
|
||||
#
|
||||
# NOTE! Please use 'git ls-files -i --exclude-standard'
|
||||
# command after changing this file, to see if there are
|
||||
# any tracked files which get ignored after the change.
|
||||
#
|
||||
# Normal rules
|
||||
#
|
||||
*.o
|
||||
*.o.*
|
||||
*.a
|
||||
*.ko
|
||||
*.so
|
||||
*.so.dbg
|
||||
*.mod.c
|
||||
*.i
|
||||
*.lst
|
||||
*.symtypes
|
||||
*.order
|
||||
*.elf
|
||||
*.bin
|
||||
*.gz
|
||||
._*
|
||||
.DS_Store
|
||||
*.swp
|
||||
*.tmp
|
||||
*.log
|
||||
|
||||
#
|
||||
# Top-level generic files
|
||||
#
|
||||
[rR]elease
|
||||
[dD]ebug
|
||||
*_release
|
||||
tags
|
||||
TAGS
|
||||
vmlinux
|
||||
System.map
|
||||
Module.markers
|
||||
Module.symvers
|
||||
!.gitignore
|
||||
!.mailmap
|
||||
|
||||
#
|
||||
# Generated include files
|
||||
#
|
||||
|
||||
# stgit generated dirs
|
||||
patches-*
|
||||
|
||||
# quilt's files
|
||||
patches
|
||||
series
|
||||
*.patch
|
||||
|
||||
# cscope files
|
||||
cscope.*
|
||||
ncscope.*
|
||||
|
||||
*.orig
|
||||
*~
|
||||
\#*#
|
||||
workspace
|
||||
.BUILD*
|
||||
~*
|
||||
|
||||
# Windows project stuff
|
||||
*.suo
|
||||
*.sdf
|
||||
*.opensdf
|
||||
|
||||
# Xcode user state
|
||||
*.xcbkptlist
|
||||
*.xcuserstate
|
||||
|
||||
# Python bytecode
|
||||
*.pyc
|
||||
__pycache__
|
||||
.pytest_cache
|
||||
|
||||
# IAR temp files
|
||||
EW*.tmp
|
||||
|
||||
# Xcode build folders
|
||||
DerivedData/
|
||||
Build/
|
||||
|
||||
# Generated output
|
||||
erpcgen-output
|
||||
*.stackdump
|
||||
*.tags*
|
||||
/lib
|
||||
armgcc
|
||||
gcc
|
||||
atl
|
||||
kds
|
||||
iar
|
||||
mdk
|
||||
lpcx
|
||||
tags
|
||||
|
||||
format-files-to-commit.rb
|
||||
language\.settings\.xml
|
||||
*.vsix
|
||||
null.d
|
||||
boost.7z
|
||||
boost*/
|
||||
mingw.7z
|
||||
mingw64/
|
||||
vs_BuildTools*
|
||||
|
||||
# Zephyr's repo link
|
||||
__repo__/
|
||||
7
packages/erpc-1.14.0/.gitpod.Dockerfile
vendored
Normal file
7
packages/erpc-1.14.0/.gitpod.Dockerfile
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
FROM gitpod/workspace-full
|
||||
|
||||
# Install custom tools, runtimes, etc.
|
||||
# For example "bastet", a command-line tetris clone:
|
||||
# RUN brew install bastet
|
||||
#
|
||||
# More information: https://www.gitpod.io/docs/config-docker/
|
||||
6
packages/erpc-1.14.0/.gitpod.yml
vendored
Normal file
6
packages/erpc-1.14.0/.gitpod.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
image:
|
||||
file: .gitpod.Dockerfile
|
||||
- command: apt-get update && apt-get install flex
|
||||
|
||||
tasks:
|
||||
- init: make
|
||||
10
packages/erpc-1.14.0/.idea/.gitignore
generated
vendored
Normal file
10
packages/erpc-1.14.0/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
10
packages/erpc-1.14.0/.idea/codeStyles/Project.xml
generated
vendored
Normal file
10
packages/erpc-1.14.0/.idea/codeStyles/Project.xml
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<RiderCodeStyleSettings>
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="true" type="bool" />
|
||||
</RiderCodeStyleSettings>
|
||||
<clangFormatSettings>
|
||||
<option name="ENABLED" value="true" />
|
||||
</clangFormatSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
5
packages/erpc-1.14.0/.idea/codeStyles/codeStyleConfig.xml
generated
vendored
Normal file
5
packages/erpc-1.14.0/.idea/codeStyles/codeStyleConfig.xml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
250
packages/erpc-1.14.0/.idea/editor.xml
generated
vendored
Normal file
250
packages/erpc-1.14.0/.idea/editor.xml
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BackendCodeEditorSettings">
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefinitionsOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="true" type="bool" />
|
||||
</component>
|
||||
</project>
|
||||
2
packages/erpc-1.14.0/.idea/erpc-1.14.0.iml
generated
vendored
Normal file
2
packages/erpc-1.14.0/.idea/erpc-1.14.0.iml
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CIDR" type="CPP_MODULE" version="4" />
|
||||
7
packages/erpc-1.14.0/.idea/misc.xml
generated
vendored
Normal file
7
packages/erpc-1.14.0/.idea/misc.xml
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakePythonSetting">
|
||||
<option name="pythonIntegrationState" value="YES" />
|
||||
</component>
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
||||
8
packages/erpc-1.14.0/.idea/modules.xml
generated
vendored
Normal file
8
packages/erpc-1.14.0/.idea/modules.xml
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/erpc-1.14.0.iml" filepath="$PROJECT_DIR$/.idea/erpc-1.14.0.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
374
packages/erpc-1.14.0/CHANGELOG.md
vendored
Normal file
374
packages/erpc-1.14.0/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,374 @@
|
||||
# Changelog eRPC
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.14.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Added Cmake/Kconfig support.
|
||||
- Made java code jdk11 compliant, GitHub PR #432.
|
||||
- Added imxrt1186 support into mu transport layer.
|
||||
- erpcgen: Added assert for listType before usage, GitHub PR #406.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Sources reformatted.
|
||||
- erpc: Fixed typo in semaphore get (mutex -> semaphore), and write it can fail in case of timeout, GitHub PR #446.
|
||||
- erpc: Free the arbitrated client token from client manager, GitHub PR #444.
|
||||
- erpc: Fixed Makefile, install the erpc_simple_server header, GitHub PR #447.
|
||||
- erpc_python: Fixed possible AttributeError and OSError on calling TCPTransport.close(), GitHub PR #438.
|
||||
- Examples and tests consolidated.
|
||||
|
||||
## [1.13.0]
|
||||
|
||||
### Added
|
||||
|
||||
- erpc: Add BSD-3 license to endianness agnostic files, GitHub PR #417.
|
||||
- eRPC: Add new Zephyr-related transports (zephyr_uart, zephyr_mbox).
|
||||
- eRPC: Add new Zephyr-related examples.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC,erpcgen: Fixing/improving markdown files, GitHub PR #395.
|
||||
- eRPC: Fix Python client TCPTransports not being able to close, GitHub PR #390.
|
||||
- eRPC,erpcgen: Align switch brackets, GitHub PR #396.
|
||||
- erpc: Fix zephyr uart transport, GitHub PR #410.
|
||||
- erpc: UART ZEPHYR Transport stop to work after a few transactions when using USB-CDC resolved, GitHub PR #420.
|
||||
|
||||
### Removed
|
||||
|
||||
- eRPC,erpcgen: Remove cstbool library, GitHub PR #403.
|
||||
|
||||
## [1.12.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Add dynamic/static option for transport init, GitHub PR #361.
|
||||
- eRPC,erpcgen: Winsock2 support, GitHub PR #365.
|
||||
- eRPC,erpcgen: Feature/support multiple clients, GitHub PR #271.
|
||||
- eRPC,erpcgen: Feature/buffer head - Framed transport header data stored in MessageBuffer, GitHub PR #378.
|
||||
- eRPC,erpcgen: Add experimental Java support.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Fix receive error value for spidev, GitHub PR #363.
|
||||
- eRPC: UartTransport::init adaptation to changed driver.
|
||||
- eRPC: Fix typo in assert, GitHub PR #371.
|
||||
- eRPC,erpcgen: Move enums to enum classes, GitHub PR #379.
|
||||
- eRPC: Fixed rpmsg tty transport to work with serial transport, GitHub PR #373.
|
||||
|
||||
## [1.11.0]
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Makefiles update, GitHub PR #301.
|
||||
- eRPC: Resolving warnings in Python, GitHub PR #325.
|
||||
- eRPC: Python3.8 is not ready for usage of typing.Any type, GitHub PR #325.
|
||||
- eRPC: Improved codec function to use reference instead of address, GitHub PR #324.
|
||||
- eRPC: Fix NULL check for pending client creation, GitHub PR #341.
|
||||
- eRPC: Replace sprintf with snprintf, GitHub PR #343.
|
||||
- eRPC: Use MU_SendMsg blocking call in MU transport.
|
||||
- eRPC: New LPSPI and LPI2C transport layers.
|
||||
- eRPC: Freeing static objects, GitHub PR #353.
|
||||
- eRPC: Fixed casting in deinit functions, GitHub PR #354.
|
||||
- eRPC: Align LIBUSBSIO.GetNumPorts API use with libusbsio python module v. 2.1.11.
|
||||
- erpcgen: Renamed temp variable to more generic one, GitHub PR #321.
|
||||
- erpcgen: Add check that string read is not more than max length, GitHub PR #328.
|
||||
- erpcgen: Move to g++ in pytest, GitHub PR #335.
|
||||
- erpcgen: Use build=release for make, GitHub PR #334.
|
||||
- erpcgen: Removed boost dependency, GitHub PR #346.
|
||||
- erpcgen: Mingw support, GitHub PR #344.
|
||||
- erpcgen: VS build update, GitHub PR #347.
|
||||
- erpcgen: Modified name for common types macro scope, GitHub PR #337.
|
||||
- erpcgen: Fixed memcpy for template, GitHub PR #352.
|
||||
- eRPC,erpcgen: Change default build target to release + adding artefacts, GitHub PR #334.
|
||||
- eRPC,erpcgen: Remove redundant includes, GitHub PR #338.
|
||||
- eRPC,erpcgen: Many minor code improvements, GitHub PR #323.
|
||||
|
||||
## [1.10.0]
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: MU transport layer switched to blocking MU_SendMsg() API use.
|
||||
|
||||
## [1.10.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Add TCP_NODELAY option to python, GitHub PR #298.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: MUTransport adaptation to new supported SoCs.
|
||||
- eRPC: Simplifying CI with installing dependencies using shell script, GitHub PR #267.
|
||||
- eRPC: Using event for waiting for sock connection in TCP python server, formatting python code, C specific includes, GitHub PR #269.
|
||||
- eRPC: Endianness agnostic update, GitHub PR #276.
|
||||
- eRPC: Assertion added for functions which are returning status on freeing memory, GitHub PR #277.
|
||||
- eRPC: Fixed closing arbitrator server in unit tests, GitHub PR #293.
|
||||
- eRPC: Makefile updated to reflect the correct header names, GitHub PR #295.
|
||||
- eRPC: Compare value length to used length() in reading data from message buffer, GitHub PR #297.
|
||||
- eRPC: Replace EXPECT_TRUE with EXPECT_EQ in unit tests, GitHub PR #318.
|
||||
- eRPC: Adapt rpmsg_lite based transports to changed rpmsg_lite_wait_for_link_up() API parameters.
|
||||
- eRPC, erpcgen: Better distuingish which file can and cannot by linked by C linker, GitHub PR #266.
|
||||
- eRPC, erpcgen: Stop checking if pointer is NULL before sending it to the erpc_free function, GitHub PR #275.
|
||||
- eRPC, erpcgen: Changed api to count with more interfaces, GitHub PR #304.
|
||||
- erpcgen: Check before reading from heap the buffer boundaries, GitHub PR #287.
|
||||
- erpcgen: Several fixes for tests and CI, GitHub PR #289.
|
||||
- erpcgen: Refactoring erpcgen code, GitHub PR #302.
|
||||
- erpcgen: Fixed assigning const value to enum, GitHub PR #309.
|
||||
- erpcgen: Enable runTesttest_enumErrorCode_allDirection, serialize enums as int32 instead of uint32.
|
||||
|
||||
## [1.9.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Construct the USB CDC transport, rather than a client, GitHub PR #220.
|
||||
- eRPC: Fix premature import of package, causing failure when attempting installation of Python library in a clean environment, GitHub PR #38, #226.
|
||||
- eRPC: Improve python detection in make, GitHub PR #225.
|
||||
- eRPC: Fix several warnings with deprecated call in pytest, GitHub PR #227.
|
||||
- eRPC: Fix freeing union members when only default need be freed, GitHub PR #228.
|
||||
- eRPC: Fix making test under Linux, GitHub PR #229.
|
||||
- eRPC: Assert costumizing, GitHub PR #148.
|
||||
- eRPC: Fix corrupt clientList bug in TransportArbitrator, GitHub PR #199.
|
||||
- eRPC: Fix build issue when invoking g++ with -Wno-error=free-nonheap-object, GitHub PR #233.
|
||||
- eRPC: Fix inout cases, GitHub PR #237.
|
||||
- eRPC: Remove ERPC_PRE_POST_ACTION dependency on return type, GitHub PR #238.
|
||||
- eRPC: Adding NULL to ptr when codec function failed, fixing memcpy when fail is present during deserialization, GitHub PR #253.
|
||||
- eRPC: MessageBuffer usage improvement, GitHub PR #258.
|
||||
- eRPC: Get rid for serial and enum34 dependency (enum34 is in python3 since 3.4 (from 2014)), GitHub PR #247.
|
||||
- eRPC: Several MISRA violations addressed.
|
||||
- eRPC: Fix timeout for Freertos semaphore, GitHub PR #251.
|
||||
- eRPC: Use of rpmsg_lite_wait_for_link_up() in rpmsg_lite based transports, GitHub PR #223.
|
||||
- eRPC: Fix codec nullptr dereferencing, GitHub PR #264.
|
||||
- erpcgen: Fix two syntax errors in erpcgen Python output related to non-encapsulated unions, improved test for union, GitHub PR #206, #224.
|
||||
- erpcgen: Fix serialization of list/binary types, GitHub PR #240.
|
||||
- erpcgen: Fix empty list parsing, GitHub PR #72.
|
||||
- erpcgen: Fix templates for malloc errors, GitHub PR #110.
|
||||
- erpcgen: Get rid of encapsulated union declarations in global scale, improve enum usage in unions, GitHub PR #249, #250.
|
||||
- erpcgen: Fix compile error:UniqueIdChecker.cpp:156:104:'sort' was not declared, GitHub PR #265.
|
||||
|
||||
## [1.9.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Allow used LIBUSBSIO device index being specified from the Python command line argument.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Improving template usage, GitHub PR #153.
|
||||
- eRPC: run_clang_format.py cleanup, GitHub PR #177.
|
||||
- eRPC: Build TCP transport setup code into liberpc, GitHub PR #179.
|
||||
- eRPC: Fix multiple definitions of g_client error, GitHub PR #180.
|
||||
- eRPC: Fix memset past end of buffer in erpc_setup_mbf_static.cpp, GitHub PR #184.
|
||||
- eRPC: Fix deprecated error with newer pytest version, GitHub PR #203.
|
||||
- eRPC, erpcgen: Static allocation support and usage of rpmsg static FreeRTOSs related APi, GitHub PR #168, #169.
|
||||
- erpcgen: Remove redundant module imports in erpcgen, GitHub PR #196.
|
||||
|
||||
## [1.8.1]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: New i2c_slave_transport trasnport introduced.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Fix misra erpc c, GitHub PR #158.
|
||||
- eRPC: Allow conditional compilation of message_loggers and pre_post_action.
|
||||
- eRPC: (D)SPI slave transports updated to avoid busy loops in rtos environments.
|
||||
- erpcgen: Re-implement EnumMember::hasValue(), GitHub PR #159.
|
||||
- erpcgen: Fixing several misra issues in shim code, erpcgen and unit tests updated, GitHub PR #156.
|
||||
- erpcgen: Fix bison file, GitHub PR #156.
|
||||
|
||||
## [1.8.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Support win32 thread, GitHub PR #108.
|
||||
- eRPC: Add mbed support for malloc() and free(), GitHub PR #92.
|
||||
- eRPC: Introduced pre and post callbacks for eRPC call, GitHub PR #131.
|
||||
- eRPC: Introduced new USB CDC transport.
|
||||
- eRPC: Introduced new Linux spidev-based transport.
|
||||
- eRPC: Added formatting extension for VSC, GitHub PR #134.
|
||||
- erpcgen: Introduce ustring type for unsigned char and force cast to char*, GitHub PR #125.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Update makefile.
|
||||
- eRPC: Fixed warnings and error with using MessageLoggers, GitHub PR #127.
|
||||
- eRPC: Extend error msg for python server service handle function, GitHub PR #132.
|
||||
- eRPC: Update CMSIS UART transport layer to avoid busy loops in rtos environments, introduce semaphores.
|
||||
- eRPC: SPI transport update to allow usage without handshaking GPIO.
|
||||
- eRPC: Native _WIN32 erpc serial transport and threading.
|
||||
- eRPC: Arbitrator deadlock fix, TCP transport updated, TCP setup functions introduced, GitHub PR #121.
|
||||
- eRPC: Update of matrix_multiply.py example: Add --serial and --baud argument, GitHub PR #137.
|
||||
- eRPC: Update of .clang-format, GitHub PR #140.
|
||||
- eRPC: Update of erpc_framed_transport.cpp: return error if received message has zero length, GitHub PR #141.
|
||||
- eRPC, erpcgen: Fixed error messages produced by -Wall -Wextra -Wshadow -pedantic-errors compiler flags, GitHub PR #136, #139.
|
||||
- eRPC, erpcgen: Core re-formatted using Clang version 10.
|
||||
- erpcgen: Enable deallocation in server shim code when callback/function pointer used as out parameter in IDL.
|
||||
- erpcgen: Removed '$' character from generated symbol name in '_$union' suffix, GitHub PR #103.
|
||||
- erpcgen: Resolved mismatch between C++ and Python for callback index type, GitHub PR #111.
|
||||
- erpcgen: Python generator improvements, GitHub PR #100, #118.
|
||||
- erpcgen: Fixed error messages produced by -Wall -Wextra -Wshadow -pedantic-errors compiler flags, GitHub PR #136.
|
||||
|
||||
|
||||
## [1.7.4]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Support MU transport unit testing.
|
||||
- eRPC: Adding mbed os support.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Unit test code updated to handle service add and remove operations.
|
||||
- eRPC: Several MISRA issues in rpmsg-based transports addressed.
|
||||
- eRPC: Fixed Linux/TCP acceptance tests in release target.
|
||||
- eRPC: Minor documentation updates, code formatting.
|
||||
- erpcgen: Whitespace removed from C common header template.
|
||||
|
||||
## [1.7.3]
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Improved the test_callbacks logic to be more understandable and to allow requested callback execution on the server side.
|
||||
- eRPC: TransportArbitrator::prepareClientReceive modified to avoid incorrect return value type.
|
||||
- eRPC: The ClientManager and the ArbitratedClientManager updated to avoid performing client requests when the previous serialization phase fails.
|
||||
- erpcgen: Generate the shim code for destroy of statically allocated services.
|
||||
|
||||
## [1.7.2]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Add missing doxygen comments for transports.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Improved support of const types.
|
||||
- eRPC: Fixed Mac build.
|
||||
- eRPC: Fixed serializing python list.
|
||||
- eRPC: Documentation update.
|
||||
|
||||
## [1.7.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Fixed semaphore in static message buffer factory.
|
||||
- erpcgen: Fixed MU received error flag.
|
||||
- erpcgen: Fixed tcp transport.
|
||||
|
||||
## [1.7.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: List names are based on their types. Names are more deterministic.
|
||||
- eRPC: Service objects are as a default created as global static objects.
|
||||
- eRPC: Added missing doxygen comments.
|
||||
- eRPC: Added support for 64bit numbers.
|
||||
- eRPC: Added support of program language specific annotations.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Improved code size of generated code.
|
||||
- eRPC: Generating crc value is optional.
|
||||
- eRPC: Fixed CMSIS Uart driver. Removed dependency on KSDK.
|
||||
- eRPC: Forbid users use reserved words.
|
||||
- eRPC: Removed outByref for function parameters.
|
||||
- eRPC: Optimized code style of callback functions.
|
||||
|
||||
## [1.6.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Added \@nullable support for scalar types.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: Improved code size of generated code.
|
||||
- eRPC: Improved eRPC nested calls.
|
||||
- eRPC: Improved eRPC list length variable serialization.
|
||||
|
||||
## [1.5.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: Added support for unions type non-wrapped by structure.
|
||||
- eRPC: Added callbacks support.
|
||||
- eRPC: Added support \@external annotation for functions.
|
||||
- eRPC: Added support \@name annotation.
|
||||
- eRPC: Added Messaging Unit transport layer.
|
||||
- eRPC: Added RPMSG Lite RTOS TTY transport layer.
|
||||
- eRPC: Added version verification and IDL version verification between eRPC code and eRPC generated shim code.
|
||||
- eRPC: Added support of shared memory pointer.
|
||||
- eRPC: Added annotation to forbid generating const keyword for function parameters.
|
||||
- eRPC: Added python matrix multiply example.
|
||||
- eRPC: Added nested call support.
|
||||
- eRPC: Added struct member "byref" option support.
|
||||
- eRPC: Added support of forward declarations of structures
|
||||
- eRPC: Added Python RPMsg Multiendpoint kernel module support
|
||||
- eRPC: Added eRPC sniffer tool
|
||||
|
||||
## [1.4.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: New RPMsg-Lite Zero Copy (RPMsgZC) transport layer.
|
||||
|
||||
### Fixed
|
||||
|
||||
- eRPC: win_flex_bison.zip for windows updated.
|
||||
- eRPC: Use one codec (instead of inCodec outCodec).
|
||||
|
||||
## [1.3.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC: New annotation types introduced (\@length, \@max_length, ...).
|
||||
- eRPC: Support for running both erpc client and erpc server on one side.
|
||||
- eRPC: New transport layers for (LP)UART, (D)SPI.
|
||||
- eRPC: Error handling support.
|
||||
|
||||
## [1.2.0]
|
||||
|
||||
### Added
|
||||
|
||||
- eRPC source directory organization changed.
|
||||
- Many eRPC improvements.
|
||||
|
||||
## [1.1.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Multicore SDK 1.1.0 ported to KSDK 2.0.0.
|
||||
|
||||
## [1.0.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Initial Release
|
||||
|
||||
|
||||
[unreleased]: https://github.com/EmbeddedRPC/erpc/compare/1.14.0...HEAD
|
||||
[1.14.0]: https://github.com/EmbeddedRPC/erpc/compare/1.13.0...1.14.0
|
||||
[1.13.0]: https://github.com/EmbeddedRPC/erpc/compare/1.12.0...1.13.0
|
||||
[1.12.0]: https://github.com/EmbeddedRPC/erpc/compare/1.11.0...1.12.0
|
||||
[1.11.0]: https://github.com/EmbeddedRPC/erpc/compare/1.10.0...1.11.0
|
||||
[1.10.0]: https://github.com/EmbeddedRPC/erpc/compare/1.9.1...1.10.0
|
||||
[1.9.1]: https://github.com/EmbeddedRPC/erpc/compare/1.9.0...1.9.1
|
||||
[1.9.0]: https://github.com/EmbeddedRPC/erpc/compare/1.8.1...1.9.0
|
||||
[1.8.1]: https://github.com/EmbeddedRPC/erpc/compare/1.8.0...1.8.1
|
||||
[1.8.0]: https://github.com/EmbeddedRPC/erpc/compare/1.7.4...1.8.0
|
||||
[1.7.4]: https://github.com/EmbeddedRPC/erpc/compare/1.7.3...1.7.4
|
||||
[1.7.3]: https://github.com/EmbeddedRPC/erpc/compare/1.7.2...1.7.3
|
||||
[1.7.2]: https://github.com/EmbeddedRPC/erpc/compare/1.7.1...1.7.2
|
||||
[1.7.1]: https://github.com/EmbeddedRPC/erpc/compare/1.7.0...1.7.1
|
||||
[1.7.0]: https://github.com/EmbeddedRPC/erpc/compare/1.6.0...1.7.0
|
||||
[1.6.0]: https://github.com/EmbeddedRPC/erpc/compare/1.5.0...1.6.0
|
||||
[1.5.0]: https://github.com/EmbeddedRPC/erpc/compare/1.4.0...1.5.0
|
||||
[1.4.0]: https://github.com/EmbeddedRPC/erpc/releases/tag/1.4.0
|
||||
58
packages/erpc-1.14.0/CMakeLists.txt
vendored
Normal file
58
packages/erpc-1.14.0/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
#
|
||||
# Copyright 2024 NXP
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(eRPC)
|
||||
|
||||
###############################################################################
|
||||
# Define basic variables
|
||||
###############################################################################
|
||||
set(ERPC_BASE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
set(ERPC_ERPCGEN ${ERPC_BASE}/erpcgen)
|
||||
set(ERPC_C ${ERPC_BASE}/erpc_c)
|
||||
set(ERPC_TEST ${ERPC_BASE}/test)
|
||||
set(ERPC_EXAMPLES ${ERPC_BASE}/examples)
|
||||
|
||||
###############################################################################
|
||||
# Includes required modules
|
||||
###############################################################################
|
||||
include(${ERPC_BASE}/cmake/extensions.cmake)
|
||||
include(${ERPC_BASE}/cmake/python.cmake)
|
||||
include(${ERPC_BASE}/cmake/kconfig.cmake)
|
||||
include(${ERPC_BASE}/cmake/erpc_utils.cmake)
|
||||
|
||||
###############################################################################
|
||||
# Add components base on Kconfig
|
||||
###############################################################################
|
||||
|
||||
if(CONFIG_REQUIRE_ERPCGEN)
|
||||
if(CONFIG_ERPC_GENERATOR)
|
||||
set(ERPCGEN_EXECUTABLE $<TARGET_FILE:erpcgen>)
|
||||
else()
|
||||
find_program(ERPCGEN_EXECUTABLE NAMES erpcgen)
|
||||
|
||||
if(NOT ERPCGEN_EXECUTABLE)
|
||||
message(FATAL_ERROR "It was not possible to find the erpcgen executable. Enable ERPC_GENERATOR in Kconfig to build erpcgen from source or add 'erpcgen' to PATH.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_ERPC_GENERATOR)
|
||||
add_subdirectory(${ERPC_ERPCGEN})
|
||||
endif()
|
||||
|
||||
if(CONFIG_ERPC_LIB)
|
||||
add_subdirectory(${ERPC_C})
|
||||
endif()
|
||||
|
||||
if(CONFIG_ERPC_TESTS)
|
||||
add_subdirectory(${ERPC_TEST})
|
||||
endif()
|
||||
|
||||
if(CONFIG_ERPC_EXAMPLES)
|
||||
add_subdirectory(${ERPC_EXAMPLES})
|
||||
endif()
|
||||
24
packages/erpc-1.14.0/CMakePresets.json
vendored
Normal file
24
packages/erpc-1.14.0/CMakePresets.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": 6,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "mingw64",
|
||||
"displayName": "Mingw64 eRPC config",
|
||||
"description": "Default Mingw64 preset for eRPC",
|
||||
"generator": "MinGW Makefiles",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "gcc",
|
||||
"CMAKE_CXX_COMPILER": "g++"
|
||||
},
|
||||
"environment": {
|
||||
"PATH": "${sourceDir}/mingw64/bin;$penv{PATH}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
3
packages/erpc-1.14.0/CONTRIBUTING.md
vendored
Normal file
3
packages/erpc-1.14.0/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Contribution
|
||||
|
||||
Contribution details are described in our [wiki/Contributing](https://github.com/EmbeddedRPC/erpc/wiki/Contributing)
|
||||
177
packages/erpc-1.14.0/Kconfig
vendored
Normal file
177
packages/erpc-1.14.0/Kconfig
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
#
|
||||
# Copyright 2024 NXP
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
config ERPC_GENERATOR
|
||||
bool "Build eRPC Generator"
|
||||
default y
|
||||
|
||||
config REQUIRE_ERPCGEN
|
||||
bool
|
||||
default n
|
||||
|
||||
config ERPC_LIB
|
||||
bool "Build eRPC C Library"
|
||||
default y
|
||||
|
||||
menuconfig ERPC_TESTS
|
||||
bool "Build eRPC Tests"
|
||||
default n
|
||||
select REQUIRE_ERPCGEN
|
||||
|
||||
if ERPC_TESTS
|
||||
menu "Test transport"
|
||||
menuconfig ERPC_TESTS.transport.tcp
|
||||
bool "Test transport TCP"
|
||||
default y
|
||||
|
||||
if ERPC_TESTS.transport.tcp
|
||||
config ERPC_TESTS.transport.tcp.host
|
||||
string "TCP Host"
|
||||
default "localhost"
|
||||
|
||||
config ERPC_TESTS.transport.tcp.port
|
||||
int "TCP Port"
|
||||
default 12345
|
||||
endif
|
||||
|
||||
menuconfig ERPC_TESTS.transport.serial
|
||||
bool "Test transport Serial"
|
||||
default n
|
||||
|
||||
if ERPC_TESTS.transport.serial
|
||||
config ERPC_TESTS.transport.serial.port
|
||||
string "Serial port"
|
||||
default "localhost"
|
||||
|
||||
config ERPC_TESTS.transport.serial.baud
|
||||
int "Baud"
|
||||
default 115200
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config ERPC_TESTS.client
|
||||
bool "Build test's client side"
|
||||
default y
|
||||
|
||||
config ERPC_TESTS.server
|
||||
bool "Build test's server side"
|
||||
default y
|
||||
|
||||
menu "Test cases"
|
||||
config ERPC_TESTS.testcase.test_annotations
|
||||
bool "Build test_annotations"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_arbitrator
|
||||
bool "Build test_arbitrator"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_arrays
|
||||
bool "Build test_arrays"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_binary
|
||||
bool "Build test_binary"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_builtin
|
||||
bool "Build test_builtin"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_callbacks
|
||||
bool "Build test_callbacks"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_const
|
||||
bool "Build test_const"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_enums
|
||||
bool "Build test_enums"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_lists
|
||||
bool "Build test_lists"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_shared
|
||||
bool "Build test_shared"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_struct
|
||||
bool "Build test_struct"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_typedef
|
||||
bool "Build test_typedef"
|
||||
default y
|
||||
config ERPC_TESTS.testcase.test_unions
|
||||
bool "Build test_unions"
|
||||
default y
|
||||
endmenu
|
||||
|
||||
endif
|
||||
|
||||
menuconfig ERPC_EXAMPLES
|
||||
bool "Build eRPC Examples"
|
||||
default n
|
||||
select REQUIRE_ERPCGEN
|
||||
|
||||
if ERPC_EXAMPLES
|
||||
menuconfig ERPC_MATRIX_MULTIPLY_TCP
|
||||
bool "Matrix Multiply TCP example"
|
||||
default n
|
||||
select REQUIRE_ERPCGEN
|
||||
|
||||
if ERPC_MATRIX_MULTIPLY_TCP
|
||||
config ERPC_MATRIX_MULTIPLY_TCP.host
|
||||
string "TCP Host"
|
||||
default "localhost"
|
||||
|
||||
config ERPC_MATRIX_MULTIPLY_TCP.port
|
||||
int "TCP Port"
|
||||
default 8811
|
||||
|
||||
config ERPC_MATRIX_MULTIPLY_TCP.c
|
||||
bool "Build C version of the demo"
|
||||
default y
|
||||
config ERPC_MATRIX_MULTIPLY_TCP.cpp
|
||||
bool "Build C++ version of the demo"
|
||||
default y
|
||||
endif
|
||||
|
||||
menuconfig ERPC_MATRIX_MULTIPLY_UART
|
||||
bool "Matrix Multiply UART example"
|
||||
default n
|
||||
select REQUIRE_ERPCGEN
|
||||
|
||||
if ERPC_MATRIX_MULTIPLY_UART
|
||||
config ERPC_MATRIX_MULTIPLY_UART.serial
|
||||
string "Serial port"
|
||||
default "localhost"
|
||||
|
||||
config ERPC_MATRIX_MULTIPLY_UART.baud
|
||||
int "Baud"
|
||||
default 115200
|
||||
|
||||
config ERPC_MATRIX_MULTIPLY_UART.c
|
||||
bool "Build C version of the demo"
|
||||
default y
|
||||
config ERPC_MATRIX_MULTIPLY_UART.cpp
|
||||
bool "Build C++ version of the demo"
|
||||
default y
|
||||
endif
|
||||
|
||||
menuconfig ERPC_HELLO_WORLD
|
||||
bool "Hello World example"
|
||||
default n
|
||||
select REQUIRE_ERPCGEN
|
||||
|
||||
if ERPC_HELLO_WORLD
|
||||
config ERPC_HELLO_WORLD.c
|
||||
bool "Build C version of the demo"
|
||||
default y
|
||||
config ERPC_HELLO_WORLD.cpp
|
||||
bool "Build C++ version of the demo"
|
||||
default y
|
||||
config ERPC_HELLO_WORLD.python
|
||||
bool "Generate shim code for Python"
|
||||
default y
|
||||
config ERPC_HELLO_WORLD.java
|
||||
bool "Generate shim code for Java"
|
||||
default y
|
||||
endif
|
||||
endif
|
||||
|
||||
26
packages/erpc-1.14.0/LICENSE
vendored
Normal file
26
packages/erpc-1.14.0/LICENSE
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
The BSD 3 Clause License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
96
packages/erpc-1.14.0/Makefile
vendored
Normal file
96
packages/erpc-1.14.0/Makefile
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2014-2016 Freescale Semiconductor
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
# SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Top-level Makefile.
|
||||
#
|
||||
# This file is responsible for building all libraries and applications.
|
||||
#
|
||||
|
||||
include mk/erpc_common.mk
|
||||
|
||||
# Turn off parallel jobs for this makefile only. Child makefiles will still use the
|
||||
# specified number of jobs. This isn't strictly necessary, and actually slows the build
|
||||
# a little bit, but greatly improves the readability of the log output.
|
||||
#.NOTPARALLEL:
|
||||
|
||||
ifeq "$(is_linux)" "1"
|
||||
ERPCSNIFFER = erpcsniffer
|
||||
endif
|
||||
|
||||
# Subdirectories to run make on.
|
||||
TESTDIR = test
|
||||
SUBDIRS_LIST = erpcgen $(ERPCSNIFFER) $(TESTDIR)
|
||||
# test if all exists
|
||||
SUBDIRS = $(foreach f,$(SUBDIRS_LIST), $(if $(wildcard $(f)), $(f)))
|
||||
|
||||
# Default target.
|
||||
.PHONY: default
|
||||
default: erpc $(ERPCSNIFFER) erpcgen
|
||||
|
||||
erpcsniffer: erpc
|
||||
|
||||
.PHONY: erpc
|
||||
erpc:
|
||||
@$(MAKE) $(silent_make) -j$(MAKETHREADS) -r -C erpc_c
|
||||
|
||||
.PHONY: install
|
||||
install: erpc erpc_c erpcgen $(ERPCSNIFFER)
|
||||
@$(MAKE) $(silent_make) -j$(MAKETHREADS) -r -C erpc_c install
|
||||
@$(MAKE) $(silent_make) -j$(MAKETHREADS) -r -C erpcgen install
|
||||
ifeq "$(is_linux)" "1"
|
||||
@$(MAKE) $(silent_make) -j$(MAKETHREADS) -r -C erpcsniffer install
|
||||
endif
|
||||
|
||||
#make all target
|
||||
.PHONY: all
|
||||
all: erpc $(SUBDIRS)
|
||||
|
||||
# Unit Test Targets
|
||||
.PHONY: test-tcp
|
||||
test-tcp: TESTTARGET := test-tcp
|
||||
test-tcp: $(TESTDIR)
|
||||
|
||||
.PHONY: test-serial
|
||||
test-serial: TESTTARGET := test-serial
|
||||
test-serial: $(TESTDIR)
|
||||
|
||||
# Force rebuild
|
||||
.PHONY: fresh
|
||||
fresh: clean all
|
||||
|
||||
# define clean_fun
|
||||
# $(warning "$(at)$(POWERSHELL) "if (Test-Path $(1)) { $(rmc) $(1) }"")
|
||||
# $(at)$(POWERSHELL) 'if (Test-Path $(1)) { $(rmc) $(1) }'
|
||||
# endef
|
||||
|
||||
# Target to clean everything.
|
||||
.PHONY: clean
|
||||
clean::
|
||||
@echo "Deleting output directories..."
|
||||
@$(rmc) Debug Release
|
||||
@$(rmc) out*.*
|
||||
@$(rmc) erpc_outputs
|
||||
# @$(call clean_fun,Debug,)
|
||||
# @$(call clean_fun,Release,)
|
||||
# @$(call clean_fun,erpc_outputs,)
|
||||
@echo "done."
|
||||
|
||||
# Process subdirs
|
||||
include $(ERPC_ROOT)/mk/subdirs.mk
|
||||
|
||||
.PHONY: os_name
|
||||
os_name:
|
||||
@echo $(os_name)
|
||||
431
packages/erpc-1.14.0/README.md
vendored
Normal file
431
packages/erpc-1.14.0/README.md
vendored
Normal file
@ -0,0 +1,431 @@
|
||||
# MCUXpresso SDK : mcuxsdk-middleware-erpc
|
||||
|
||||
## Overview
|
||||
This repository is for MCUXpresso SDK eRPC middleware delivery and it contains eRPC component officially provided in NXP MCUXpresso SDK. This repository is part of the MCUXpresso SDK overall delivery which is composed of several sub-repositories/projects. Navigate to the top/parent repository [mcuxsdk](https://github.com/nxp-mcuxpresso/mcuxsdk-manifests/) for the complete delivery of MCUXpresso SDK to be able to build and run eRPC examples that are based on mcux-sdk-middleware-erpc component.
|
||||
|
||||
## Documentation
|
||||
Overall details can be reviewed here: [MCUXpresso SDK Online Documentation](https://mcuxpresso.nxp.com/mcuxsdk/latest/html/introduction/README.html)
|
||||
|
||||
Visit [eRPC - Documentation](https://mcuxpresso.nxp.com/mcuxsdk/latest/html/middleware/multicore/erpc/README.html) to review details on the contents in this sub-repo.
|
||||
|
||||
## Setup
|
||||
Instructions on how to install the MCUXpresso SDK provided from GitHub via west manifest [Getting Started with SDK - Detailed Installation Instructions](https://mcuxpresso.nxp.com/mcuxsdk/latest/html/gsd/installation.html#installation)
|
||||
|
||||
## Contribution
|
||||
We welcome and encourage the community to submit patches directly to the eRPC project placed on github. Contributing can be managed via pull-requests. Before a pull-request is created the code should be tested and properly formatted.
|
||||
|
||||
---------------------------------
|
||||
|
||||
# eRPC
|
||||
|
||||

|
||||
[](/LICENSE)
|
||||
[](https://github.com/EmbeddedRPC/erpc/releases/latest)
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://github.com/EmbeddedRPC/erpc/forks)
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://github.com/EmbeddedRPC/erpc/graphs/contributors)
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues)
|
||||
[](https://github.com/EmbeddedRPC/erpc/pulls)
|
||||
|
||||
- [MCUXpresso SDK : mcuxsdk-middleware-erpc](#mcuxpresso-sdk--mcuxsdk-middleware-erpc)
|
||||
- [Overview](#overview)
|
||||
- [Documentation](#documentation)
|
||||
- [Setup](#setup)
|
||||
- [Contribution](#contribution)
|
||||
- [eRPC](#erpc)
|
||||
- [About](#about)
|
||||
- [Releases](#releases)
|
||||
- [Edge releases](#edge-releases)
|
||||
- [Documentation](#documentation-1)
|
||||
- [Examples](#examples)
|
||||
- [References](#references)
|
||||
- [Directories](#directories)
|
||||
- [Building and installing](#building-and-installing)
|
||||
- [Requirements](#requirements)
|
||||
- [Windows](#windows)
|
||||
- [Mac OS X](#mac-os-x)
|
||||
- [Building](#building)
|
||||
- [CMake and KConfig](#cmake-and-kconfig)
|
||||
- [Make](#make)
|
||||
- [Installing for Python](#installing-for-python)
|
||||
- [Known issues and limitations](#known-issues-and-limitations)
|
||||
- [Code providing](#code-providing)
|
||||
|
||||
## About
|
||||
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement)
|
||||
[](https://github.com/EmbeddedRPC/erpc/pulls?q=is%3Apr+is%3Aopen+label%3Aenhancement)
|
||||
[](https://github.com/EmbeddedRPC/erpc/pulls?q=is%3Apr+is%3Aclosed+label%3Aenhancement)
|
||||
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aclosed+label%3Abug)
|
||||
[](https://github.com/EmbeddedRPC/erpc/pulls?q=is%3Apr+is%3Aopen+label%3Abug)
|
||||
[](https://github.com/EmbeddedRPC/erpc/pulls?q=is%3Apr+is%3Aclosed+label%3Abug)
|
||||
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aopen+label%3Aquestion)
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aclosed+label%3Aquestion)
|
||||
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aopen+label%3A%22help%20wanted%22)
|
||||
[](https://github.com/EmbeddedRPC/erpc/issues?q=is%3Aissue+is%3Aclosed+label%3A%22help%20wanted%22)
|
||||
|
||||
eRPC (Embedded RPC) is an open source Remote Procedure Call (RPC) system for multichip embedded systems and heterogeneous multicore SoCs.
|
||||
|
||||
Unlike other modern RPC systems, such as the excellent [Apache Thrift](http://thrift.apache.org), eRPC distinguishes itself by being designed for tightly coupled systems, using plain C for remote functions, and having a small code size (<5kB). It is not intended for high performance distributed systems over a network.
|
||||
|
||||
eRPC does not force upon you any particular API style. It allows you to export existing C functions, without having to change their prototypes. (There are limits, of course.) And although the internal infrastructure is written in C++, most users will be able to use only the simple C setup APIs shown in the examples below.
|
||||
|
||||
A code generator tool called `erpcgen` is included. It accepts input IDL files, having an `.erpc` extension, that have definitions of your data types and remote interfaces, and generates the shim code that handles serialization and invocation. `erpcgen` can generate either C/C++ or Python code.
|
||||
|
||||
Example `.erpc` file:
|
||||
|
||||
```C++
|
||||
// Define a data type.
|
||||
enum LEDName { kRed, kGreen, kBlue }
|
||||
|
||||
// An interface is a logical grouping of functions.
|
||||
interface IO {
|
||||
// Simple function declaration with an empty reply.
|
||||
set_led(LEDName whichLed, bool onOrOff) -> void
|
||||
}
|
||||
```
|
||||
|
||||
Client side usage:
|
||||
|
||||
```C
|
||||
void example_client(void) {
|
||||
erpc_transport_t transport;
|
||||
erpc_mbf_t message_buffer_factory;
|
||||
erpc_client_t client_manager;
|
||||
|
||||
/* Init eRPC client infrastructure */
|
||||
transport = erpc_transport_cmsis_uart_init(Driver_USART0);
|
||||
message_buffer_factory = erpc_mbf_dynamic_init();
|
||||
client_manager = erpc_client_init(transport, message_buffer_factory);
|
||||
|
||||
/* init eRPC client IO service */
|
||||
initIO_client(client_manager);
|
||||
|
||||
// Now we can call the remote function to turn on the green LED.
|
||||
set_led(kGreen, true);
|
||||
|
||||
/* deinit objects */
|
||||
deinitIO_client();
|
||||
erpc_client_deinit(client_manager);
|
||||
erpc_mbf_dynamic_deinit(message_buffer_factory);
|
||||
erpc_transport_tcp_deinit(transport);
|
||||
}
|
||||
```
|
||||
|
||||
```C++
|
||||
void example_client(void) {
|
||||
erpc_transport_t transport;
|
||||
erpc_mbf_t message_buffer_factory;
|
||||
erpc_client_t client_manager;
|
||||
|
||||
/* Init eRPC client infrastructure */
|
||||
transport = erpc_transport_cmsis_uart_init(Driver_USART0);
|
||||
message_buffer_factory = erpc_mbf_dynamic_init();
|
||||
client_manager = erpc_client_init(transport, message_buffer_factory);
|
||||
|
||||
/* scope for client service */
|
||||
{
|
||||
/* init eRPC client IO service */
|
||||
IO_client client(client_manager);
|
||||
|
||||
// Now we can call the remote function to turn on the green LED.
|
||||
client.set_led(kGreen, true);
|
||||
}
|
||||
|
||||
/* deinit objects */
|
||||
erpc_client_deinit(client_manager);
|
||||
erpc_mbf_dynamic_deinit(message_buffer_factory);
|
||||
erpc_transport_tcp_deinit(transport);
|
||||
}
|
||||
```
|
||||
|
||||
Server side usage:
|
||||
|
||||
```C
|
||||
// Implement the remote function.
|
||||
void set_led(LEDName whichLed, bool onOrOff) {
|
||||
// implementation goes here
|
||||
}
|
||||
|
||||
void example_server(void) {
|
||||
erpc_transport_t transport;
|
||||
erpc_mbf_t message_buffer_factory;
|
||||
erpc_server_t server;
|
||||
erpc_service_t service = create_IO_service();
|
||||
|
||||
/* Init eRPC server infrastructure */
|
||||
transport = erpc_transport_cmsis_uart_init(Driver_USART0);
|
||||
message_buffer_factory = erpc_mbf_dynamic_init();
|
||||
server = erpc_server_init(transport, message_buffer_factory);
|
||||
|
||||
/* add custom service implementation to the server */
|
||||
erpc_add_service_to_server(server, service);
|
||||
|
||||
// Run the server.
|
||||
erpc_server_run();
|
||||
|
||||
/* deinit objects */
|
||||
destroy_IO_service(service);
|
||||
erpc_server_deinit(server);
|
||||
erpc_mbf_dynamic_deinit(message_buffer_factory);
|
||||
erpc_transport_tcp_deinit(transport);
|
||||
}
|
||||
```
|
||||
|
||||
```C++
|
||||
// Implement the remote function.
|
||||
class IO : public IO_interface
|
||||
{
|
||||
/* eRPC call definition */
|
||||
void set_led(LEDName whichLed, bool onOrOff) override {
|
||||
// implementation goes here
|
||||
}
|
||||
}
|
||||
|
||||
void example_server(void) {
|
||||
erpc_transport_t transport;
|
||||
erpc_mbf_t message_buffer_factory;
|
||||
erpc_server_t server;
|
||||
IO IOImpl;
|
||||
IO_service io(&IOImpl);
|
||||
|
||||
/* Init eRPC server infrastructure */
|
||||
transport = erpc_transport_cmsis_uart_init(Driver_USART0);
|
||||
message_buffer_factory = erpc_mbf_dynamic_init();
|
||||
server = erpc_server_init(transport, message_buffer_factory);
|
||||
|
||||
/* add custom service implementation to the server */
|
||||
erpc_add_service_to_server(server, &io);
|
||||
|
||||
/* poll for requests */
|
||||
erpc_status_t err = server.run();
|
||||
|
||||
/* deinit objects */
|
||||
erpc_server_deinit(server);
|
||||
erpc_mbf_dynamic_deinit(message_buffer_factory);
|
||||
erpc_transport_tcp_deinit(transport);
|
||||
}
|
||||
```
|
||||
|
||||
A number of transports are supported, and new transport classes are easy to write.
|
||||
|
||||
Supported transports can be found in [erpc/erpc_c/transport](/erpc_c/transports) folder. E.g:
|
||||
|
||||
* CMSIS UART
|
||||
* NXP Kinetis SPI and DSPI
|
||||
* POSIX and Windows serial port
|
||||
* TCP/IP (mostly for testing)
|
||||
* [NXP RPMsg-Lite / RPMsg TTY](https://github.com/nxp-mcuxpresso/rpmsg-lite)
|
||||
* SPIdev Linux
|
||||
* USB CDC
|
||||
* NXP Messaging Unit
|
||||
|
||||
eRPC is available with an unrestrictive BSD 3-clause license. See the [LICENSE file](https://github.com/EmbeddedRPC/erpc/blob/develop/LICENSE) for the full license text.
|
||||
|
||||
## Releases
|
||||
|
||||
[eRPC releases](https://github.com/EmbeddedRPC/erpc/releases)
|
||||
|
||||
### Edge releases
|
||||
|
||||
Edge releases can by found on [eRPC CircleCI](https://app.circleci.com/pipelines/github/EmbeddedRPC/erpc) webpage. Choose build of interest, then platform target and choose ARTIFACTS tab. Here you can find binary application from chosen build.
|
||||
|
||||
## Documentation
|
||||
|
||||
[Documentation](https://github.com/EmbeddedRPC/erpc/wiki) is in the `wiki` section.
|
||||
|
||||
[eRPC Infrastructure documentation](https://embeddedrpc.github.io/)
|
||||
|
||||
## Examples
|
||||
|
||||
[Example IDL](examples/README.md) is available in the [examples/](/examples/) folder.
|
||||
|
||||
Plenty of eRPC multicore and multiprocessor examples can be also found in NXP MCUXpressoSDK packages. Visit [https://mcuxpresso.nxp.com](https://mcuxpresso.nxp.com) to configure, build and download these packages.
|
||||
|
||||
To get the board list with multicore support (eRPC included) use filtering based on Middleware and search for 'multicore' string. Once the selected package with the multicore middleware is downloaded, see
|
||||
|
||||
<MCUXpressoSDK_install_dir>/boards/<board_name>/multicore_examples for eRPC multicore examples (RPMsg_Lite or Messaging Unit transports used) or
|
||||
|
||||
<MCUXpressoSDK_install_dir>/boards/<board_name>/multiprocessor_examples for eRPC multiprocessor examples (UART or SPI transports used).
|
||||
|
||||
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/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/<board_name>/multicore_examples or in
|
||||
|
||||
mcuxsdk/examples/<board_name>/multiprocessor_examples folders.
|
||||
|
||||
You can use the evkmimxrt1170 as the board_name for instance. Similar to MCUXpressoSDK packages the eRPC examples use the 'erpc_' name prefix.
|
||||
|
||||
## References
|
||||
|
||||
This section provides links to interesting erpc-based projects, articles, blogs or guides:
|
||||
|
||||
* [erpc (EmbeddedRPC) getting started notes](https://programmersought.com/article/37585084512/)
|
||||
* [ERPC Linux Local Environment Construction and Use](https://programmersought.com/article/88827920353/)
|
||||
* [The New Wio Terminal eRPC Firmware](https://www.hackster.io/Salmanfarisvp/the-new-wio-terminal-erpc-firmware-bfd8bd)
|
||||
|
||||
## Directories
|
||||
|
||||
[doc](/doc) - Documentation.
|
||||
|
||||
[doxygen](/doxygen) - Configuration and support files for running Doxygen over the eRPC C++ infrastructure and erpcgen code.
|
||||
|
||||
[erpc_c](/erpc_c) - Holds C/C++ infrastructure for eRPC. This is the code you will include in your application.
|
||||
|
||||
[erpc_python](/erpc_python) - Holds Python version of the eRPC infrastructure.
|
||||
|
||||
[erpcgen](/erpcgen) - Holds source code for erpcgen and makefiles or project files to build erpcgen on Windows, Linux, and OS X.
|
||||
|
||||
[erpcsniffer](/erpcsniffer) - Holds source code for erpcsniffer application.
|
||||
|
||||
[examples](/examples) - Several example IDL files.
|
||||
|
||||
[mk](/mk) - Contains common makefiles for building eRPC components.
|
||||
|
||||
[test](/test) - Client/server tests. These tests verify the entire communications path from client to server and back.
|
||||
|
||||
[utilities](/utilities) - Holds utilities which bring additional benefit to eRPC apps developers.
|
||||
|
||||
## Building and installing
|
||||
|
||||
These build instructions apply to host PCs and embedded Linux. For bare metal or RTOS embedded environments, you should copy the [erpc_c](/erpc_c) directory into your application sources.
|
||||
|
||||
**CMake and KConfig build**:
|
||||
|
||||
It builds a static library of the eRPC C/C++ infrastructure, the `erpcgen` executable, and optionally the unit tests and examples.
|
||||
|
||||
CMake is compatible with gcc and clang. On Windows local MingGW downloaded by [script](./install_dependencies.ps1) can be used.
|
||||
|
||||
**Make build**:
|
||||
|
||||
It builds a static library of the eRPC C/C++ infrastructure, the `erpcgen` executable, and optionally the unit tests.
|
||||
|
||||
The makefiles are compatible with gcc or clang on Linux, OS X, and Cygwin. A Windows build
|
||||
of erpcgen using Visual Studio is also available in the [erpcgen/VisualStudio_v14](erpcgen/VisualStudio_v14) directory.
|
||||
There is also an Xcode project file in the [erpcgen](/erpcgen) directory, which can be used to build erpcgen for OS X.
|
||||
|
||||
### Requirements
|
||||
|
||||
eRPC now support building **erpcgen**, **erpc_lib**, **tests** and **C examples** using CMake.
|
||||
|
||||
Requirements when using CMake:
|
||||
* **CMake** (minimal version 3.20.0)
|
||||
* Generator - **Make**, **Ninja**, ...
|
||||
* **C/C++ compiler** - **GCC**, **CLANG**, ...
|
||||
* **Binson** - https://www.gnu.org/software/bison/
|
||||
* **Flex** - https://github.com/westes/flex/
|
||||
|
||||
Requirements when using Make:
|
||||
* **Make**
|
||||
* **C/C++ compiler** - **GCC**, **CLANG**, ...
|
||||
* **Binson** - https://www.gnu.org/software/bison/
|
||||
* **Flex** - https://github.com/westes/flex/
|
||||
|
||||
|
||||
#### Windows
|
||||
Related steps to build **erpcgen** using **Visual Studio** are described in [`erpcgen/VisualStudio_v14/readme_erpcgen.txt`](erpcgen/VisualStudio_v14/readme_erpcgen.txt).
|
||||
|
||||
To install MinGW, Bison, Flex locally on Windows:
|
||||
```bash
|
||||
./install_dependencies.ps1
|
||||
* ```
|
||||
|
||||
#### Linux
|
||||
|
||||
```bash
|
||||
./install_dependencies.sh
|
||||
```
|
||||
|
||||
Mandatory for case, when build for different architecture is needed
|
||||
|
||||
* gcc-multilib, g++-multilib
|
||||
|
||||
#### Mac OS X
|
||||
|
||||
```bash
|
||||
./install_dependencies.sh
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
#### CMake and KConfig
|
||||
eRPC use CMake and KConfig to configurate and build eRPC related targets. KConfig can be edited by [prj.conf](./prj.conf) or _menuconfig_ when building.
|
||||
|
||||
Generate project, config and build. In [erpc/](./) execute:
|
||||
```bash
|
||||
cmake -B ./build # in erpc/build generate cmake project
|
||||
cmake --build ./build --target menuconfig # Build menuconfig and configurate erpcgen, erpc_lib, tests and examples
|
||||
cmake --build ./build # Build all selected target from prj.conf/menuconfig
|
||||
```
|
||||
**CMake will use the system's default compilers and generator
|
||||
|
||||
If you want to use Windows and locally installed MinGW, use [CMake preset](./CMakePresets.json) :
|
||||
```bash
|
||||
cmake --preset mingw64 # Generate project in ./build using mingw64's make and compilers
|
||||
cmake --build ./build --target menuconfig # Build menuconfig and configurate erpcgen, erpc_lib, tests and examples
|
||||
cmake --build ./build # Build all selected target from prj.conf/menuconfig
|
||||
```
|
||||
|
||||
#### Make
|
||||
To build the library and erpcgen, run from the repo root directory:
|
||||
|
||||
```sh
|
||||
make
|
||||
```
|
||||
|
||||
To install the library, erpcgen, and include files, run:
|
||||
|
||||
```sh
|
||||
make install
|
||||
```
|
||||
|
||||
You may need to sudo the `make install`.
|
||||
|
||||
By default this will install into `/usr/local`. If you want to install elsewhere, set the `PREFIX` environment variable. Example for installing into `/opt`:
|
||||
|
||||
```sh
|
||||
make install PREFIX=/opt
|
||||
```
|
||||
|
||||
List of top level Makefile targets:
|
||||
|
||||
* `erpc`: build the liberpc.a static library
|
||||
* `erpcgen`: build the erpcgen tool
|
||||
* `erpcsniffer`: build the sniffer tool
|
||||
* `test`: build the unit tests under the [test](/test) directory
|
||||
* `all`: build all of the above
|
||||
* `install`: install liberpc.a, erpcgen, and include files
|
||||
|
||||
eRPC code is validated with respect to the C++ 11 standard.
|
||||
|
||||
### Installing for Python
|
||||
|
||||
To install the Python infrastructure for eRPC see instructions in the [erpc python readme](/erpc_python/readme.md).
|
||||
|
||||
## Known issues and limitations
|
||||
|
||||
* Static allocations controlled by the ERPC_ALLOCATION_POLICY config macro are not fully supported yet, i.e. not all erpc objects can be allocated statically now. It deals with the ongoing process and the full static allocations support will be added in the future.
|
||||
|
||||
## Code providing
|
||||
|
||||
Repository on Github contains two main branches: __main__ and __develop__. Code is developed on __develop__ branch. Release version is created via merging __develop__ branch into __main__ branch.
|
||||
|
||||
---
|
||||
Copyright 2014-2016 Freescale Semiconductor, Inc.
|
||||
|
||||
Copyright 2016-2025 NXP
|
||||
114
packages/erpc-1.14.0/SBOM.spdx.json
vendored
Normal file
114
packages/erpc-1.14.0/SBOM.spdx.json
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"SPDXID": "SPDXRef-DOCUMENT",
|
||||
"spdxVersion": "SPDX-2.3",
|
||||
"creationInfo": {
|
||||
"created": "2025-05-30T06:44:48Z",
|
||||
"creators": [
|
||||
"Organization: NXP"
|
||||
],
|
||||
"licenseListVersion": "3.20"
|
||||
},
|
||||
"name": "erpc-1.14.0",
|
||||
"dataLicense": "CC0-1.0",
|
||||
"documentNamespace": "https://nxp.com/spdx/1dfe3ec4-b29f-4e7b-afd3-36278a134a93",
|
||||
"packages": [
|
||||
{
|
||||
"SPDXID": "SPDXRef-package-1dfe3ec4-b29f-4e7b-afd3-36278a134a93",
|
||||
"name": "erpc",
|
||||
"versionInfo": "1.14.0",
|
||||
"licenseConcluded": "(BSD-3-Clause)",
|
||||
"licenseDeclared": "(BSD-3-Clause)",
|
||||
"downloadLocation": "https://github.com/EmbeddedRPC/erpc",
|
||||
"originator": "Organization: NXP",
|
||||
"supplier": "NOASSERTION",
|
||||
"externalRefs": [],
|
||||
"filesAnalyzed": false
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-package-f919933c-33b3-4b0a-950f-83c11a3d4b39",
|
||||
"name": "BusPirate/Bus_Pirate",
|
||||
"versionInfo": "v6.1",
|
||||
"licenseConcluded": "CC0-1.0",
|
||||
"licenseDeclared": "CC0-1.0",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"originator": "Organization: NXP",
|
||||
"supplier": "NOASSERTION",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:github/BusPirate/Bus_Pirate@v6.1",
|
||||
"referenceType": "purl"
|
||||
},
|
||||
{
|
||||
"referenceCategory": "OTHER",
|
||||
"referenceLocator": "3a28d3d0-0713-4113-92c5-9a8b53e12e05",
|
||||
"referenceType": "BlackDuck-ComponentOrigin"
|
||||
}
|
||||
],
|
||||
"filesAnalyzed": false
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-package-d83f2de3-93ed-46e7-9472-401fe64df55d",
|
||||
"name": "Kconfiglib",
|
||||
"versionInfo": "14.1.0",
|
||||
"licenseConcluded": "ISC",
|
||||
"licenseDeclared": "ISC",
|
||||
"homepage": "https://github.com/ulfalizer/Kconfiglib",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"externalRefs": [],
|
||||
"filesAnalyzed": false,
|
||||
"supplier": "NOASSERTION"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-package-9069e7c0-e11a-4d17-aa04-153e5fd93c3c",
|
||||
"name": "zephyr",
|
||||
"versionInfo": "v3.6.0",
|
||||
"licenseConcluded": "Apache-2.0",
|
||||
"licenseDeclared": "Apache-2.0",
|
||||
"homepage": "https://zephyrproject.org/doc",
|
||||
"downloadLocation": "https://github.com/zephyrproject-rtos/zephyr",
|
||||
"originator": "Organization: NXP",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "SECURITY",
|
||||
"referenceLocator": "cpe:2.3:a:zephyrproject:zephyr:3.6.0:*:*:*:*:*:*:*",
|
||||
"referenceType": "cpe23Type"
|
||||
},
|
||||
{
|
||||
"referenceCategory": "SECURITY",
|
||||
"referenceLocator": "cpe:2.3:o:zephyrproject:zephyr:3.6.0:*:*:*:*:*:*:*",
|
||||
"referenceType": "cpe23Type"
|
||||
},
|
||||
{
|
||||
"referenceCategory": "SECURITY",
|
||||
"referenceLocator": "cpe:2.3:a:zephyrproject_rtos:zephyr:3.6.0:*:*:*:*:*:*:*",
|
||||
"referenceType": "cpe23Type"
|
||||
}
|
||||
],
|
||||
"filesAnalyzed": false,
|
||||
"supplier": "NOASSERTION"
|
||||
}
|
||||
],
|
||||
"relationships": [
|
||||
{
|
||||
"spdxElementId": "SPDXRef-DOCUMENT",
|
||||
"relationshipType": "DESCRIBES",
|
||||
"relatedSpdxElement": "SPDXRef-package-1dfe3ec4-b29f-4e7b-afd3-36278a134a93"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-package-1dfe3ec4-b29f-4e7b-afd3-36278a134a93",
|
||||
"relationshipType": "CONTAINS",
|
||||
"relatedSpdxElement": "SPDXRef-package-d83f2de3-93ed-46e7-9472-401fe64df55d"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-package-1dfe3ec4-b29f-4e7b-afd3-36278a134a93",
|
||||
"relationshipType": "CONTAINS",
|
||||
"relatedSpdxElement": "SPDXRef-package-9069e7c0-e11a-4d17-aa04-153e5fd93c3c"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-package-1dfe3ec4-b29f-4e7b-afd3-36278a134a93",
|
||||
"relationshipType": "CONTAINS",
|
||||
"relatedSpdxElement": "SPDXRef-package-f919933c-33b3-4b0a-950f-83c11a3d4b39"
|
||||
}
|
||||
]
|
||||
}
|
||||
78
packages/erpc-1.14.0/SCR.txt
vendored
Normal file
78
packages/erpc-1.14.0/SCR.txt
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
Release Name: eRPC
|
||||
Release Version: 1.14.0
|
||||
Package License: BSD-3-Clause
|
||||
|
||||
the_bus_pirate Name: The Bus Pirate
|
||||
Version: NA
|
||||
Outgoing License: Open Source - CC0 (Public Domain
|
||||
Dedication License)
|
||||
License File: http://code.google.com/p/the-bus-pirate/
|
||||
Format: source code
|
||||
Description: OS independent serial interface
|
||||
Location:
|
||||
erpc_c/port/erpc_serial.h,
|
||||
erpc_c/port/erpc_serial.cpp
|
||||
Origin: Community
|
||||
Url: http://code.google.com/p/the-bus-pirate/
|
||||
|
||||
cpp_template Name: CPP Template
|
||||
Version: NA
|
||||
Outgoing License: Open Source - MIT
|
||||
License File:
|
||||
erpcgen/src/cpptemplate/LICENSE.txt
|
||||
Format: source code
|
||||
Description: CPP Template
|
||||
Location: erpcgen/src/cpptemplate
|
||||
Origin: Ryan Ginstrom & Martinho Fernandes
|
||||
|
||||
cpp_option_parser Name: C++ option-parser
|
||||
Version: NA
|
||||
Outgoing License: Brad Appleton's license
|
||||
License File: http://www.bradapp.com/ftp/src/libs/C++/Options.tar.gz
|
||||
, see README file
|
||||
Format: Plain Text
|
||||
Description: C++ option-parser
|
||||
Location: erpcgen/src/options.cpp
|
||||
Origin: Brad Appleton bradapp@enteract.com
|
||||
Url: http://www.bradapp.com/ftp/src/libs/C++/Options.html
|
||||
|
||||
kconfig_scripts Name: A flexible Python 2/3 Kconfig implementation and library
|
||||
Version: NA
|
||||
Outgoing License: ISC
|
||||
License File: https://github.com/ulfalizer/Kconfiglib/blob/master/LICENSE.txt
|
||||
Format: source code
|
||||
Description: A flexible Python 2/3 Kconfig implementation and library
|
||||
Location: scripts/kconfig/kconfiglib.py,
|
||||
scripts/kconfig/guiconfig.py, scripts/kconfig/menuconfig.py
|
||||
Origin: Ulf Magnusson
|
||||
Url: https://github.com/ulfalizer/Kconfiglib
|
||||
|
||||
hardenconfig_script Name: Zephyr RTOS scripts
|
||||
Version: 3.6
|
||||
Outgoing License: Apache 2.0
|
||||
License File: https://github.com/zephyrproject-rtos/zephyr/blob/main/LICENSE
|
||||
Format: source code
|
||||
Description: Zephyr RTOS scripts
|
||||
Location: scripts/kconfig/hardenconfig.py
|
||||
Origin: Intel Corporation
|
||||
Url: https://github.com/zephyrproject-rtos/zephyr
|
||||
|
||||
kconfigfunctions_script Name: Zephyr RTOS scripts
|
||||
Version: 3.6
|
||||
Outgoing License: Apache 2.0
|
||||
License File: https://github.com/zephyrproject-rtos/zephyr/blob/main/LICENSE
|
||||
Format: source code
|
||||
Description: Zephyr RTOS scripts
|
||||
Location: scripts/kconfig/kconfigfunctions.py
|
||||
Origin: Nordic Semiconductor ASA, Linaro
|
||||
Url: https://github.com/zephyrproject-rtos/zephyr
|
||||
|
||||
lint_script Name: Zephyr RTOS scripts
|
||||
Version: 3.6
|
||||
Outgoing License: Apache 2.0
|
||||
License File: https://github.com/zephyrproject-rtos/zephyr/blob/main/LICENSE
|
||||
Format: source code
|
||||
Description: Zephyr RTOS scripts
|
||||
Location: scripts/kconfig/lint.py
|
||||
Origin: Nordic Semiconductor ASA
|
||||
Url: https://github.com/zephyrproject-rtos/zephyr
|
||||
94
packages/erpc-1.14.0/SConscript
vendored
Normal file
94
packages/erpc-1.14.0/SConscript
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
import os
|
||||
from building import *
|
||||
import rtconfig
|
||||
|
||||
import shutil
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
|
||||
|
||||
src = []
|
||||
inc = []
|
||||
|
||||
cwd = cwd + '/erpc_c/'
|
||||
|
||||
inc = inc + [cwd]
|
||||
for root, dirs, files in os.walk(cwd):
|
||||
for dir in dirs:
|
||||
inc = inc + [os.path.join(root,dir)]
|
||||
|
||||
src = Split("""
|
||||
|
||||
erpc_c/infra/erpc_basic_codec.cpp
|
||||
erpc_c/infra/erpc_message_buffer.cpp
|
||||
erpc_c/infra/erpc_message_loggers.cpp
|
||||
erpc_c/infra/erpc_crc16.cpp
|
||||
erpc_c/infra/erpc_pre_post_action.cpp
|
||||
erpc_c/infra/erpc_framed_transport.cpp
|
||||
|
||||
|
||||
erpc_c/setup/erpc_setup_mbf_static.cpp
|
||||
erpc_c/setup/erpc_setup_mbf_dynamic.cpp
|
||||
|
||||
""")
|
||||
|
||||
if GetDepend(['ERPC_USING_RTT']):
|
||||
src += Glob('erpc_c/port/erpc_threading_pthreads.cpp')
|
||||
# src += Glob('erpc_c/port/erpc_port_threadx.cpp')
|
||||
|
||||
if GetDepend(['ERPC_TRANSPORTS_SPI','ERPC_MODE_CLIENT']):
|
||||
src += Glob('erpc_c/setup/erpc_setup_spi_master.cpp')
|
||||
src += Glob('erpc_c/transports/erpc_spi_master_transport.cpp')
|
||||
|
||||
if GetDepend(['ERPC_TRANSPORTS_SPI','ERPC_MODE_SERVER']):
|
||||
src += Glob('erpc_c/setup/erpc_setup_spi_slave.cpp')
|
||||
src += Glob('erpc_c/transports/erpc_spi_slave_transport.cpp')
|
||||
#
|
||||
# if GetDepend(['ERPC_TRANSPORTS_UART']):
|
||||
# src += Glob('erpc_c/setup/erpc_setup_uart_cmsis.cpp')
|
||||
# src += Glob('erpc_c/transports/erpc_uart_cmsis_transport.cpp')
|
||||
if GetDepend(['ERPC_TRANSPORTS_UART']):
|
||||
src += Glob('erpc_c/setup/erpc_setup_serial.cpp')
|
||||
src += Glob('erpc_c/transports/erpc_serial_transport.cpp')
|
||||
|
||||
if GetDepend(['ERPC_TRANSPORTS_TCP']):
|
||||
src += Glob('erpc_c/setup/erpc_setup_tcp.cpp')
|
||||
src += Glob('erpc_c/transports/erpc_tcp_transport.cpp')
|
||||
|
||||
if GetDepend(['ERPC_MODE_CLIENT']):
|
||||
src += Glob('erpc_c/infra/erpc_client_manager.cpp')
|
||||
src += Glob('erpc_c/setup/erpc_client_setup.cpp')
|
||||
|
||||
|
||||
if GetDepend(['ERPC_MODE_SERVER']):
|
||||
src += Glob('erpc_c/infra/erpc_simple_server.cpp')
|
||||
src += Glob('erpc_c/infra/erpc_server.cpp')
|
||||
src += Glob('erpc_c/setup/erpc_server_setup.cpp')
|
||||
|
||||
|
||||
if GetDepend(['ERPC_MODE_CLIENT','ERPC_USING_RTT']):
|
||||
src += Glob('erpc_c/infra/erpc_arbitrated_client_manager.cpp')
|
||||
src += Glob('erpc_c/infra/erpc_transport_arbitrator.cpp')
|
||||
src += Glob('erpc_c/setup/erpc_arbitrated_client_setup.cpp')
|
||||
src += Glob('erpc_c/transports/erpc_inter_thread_buffer_transport.cpp')
|
||||
|
||||
|
||||
if GetDepend(['ERPC_MODE_SERVER','ERPC_USING_RTT']):
|
||||
src += Glob('erpc_c/infra/erpc_transport_arbitrator.cpp')
|
||||
src += Glob('erpc_c/transports/erpc_inter_thread_buffer_transport.cpp')
|
||||
|
||||
|
||||
# LOCAL_CCFLAGS = ''
|
||||
# if rtconfig.PLATFORM == 'gcc': # GCC
|
||||
# LOCAL_CCFLAGS += ' -std=c99'
|
||||
# elif rtconfig.PLATFORM == 'armcc': # Keil AC5
|
||||
# LOCAL_CCFLAGS += ' --c99 --gnu -g -W'
|
||||
# elif rtconfig.PLATFORM == 'armclang': # Keil AC6
|
||||
# LOCAL_CCFLAGS += ' -std=c99 -g -w'
|
||||
#
|
||||
# # group = DefineGroup('erpc', src, depend = [''],CPPPATH = inc,LOCAL_CCFLAGS = LOCAL_CCFLAGS)
|
||||
group = DefineGroup('erpc', src, depend = [''],CPPPATH = inc)
|
||||
|
||||
Return('group')
|
||||
|
||||
57
packages/erpc-1.14.0/cmake/erpc_utils.cmake
vendored
Normal file
57
packages/erpc-1.14.0/cmake/erpc_utils.cmake
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
#
|
||||
# Copyright 2024 NXP
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# To optimize build process, for each erpc_config.h file used, generate only one library.
|
||||
# This function compute MD5 of given config file and base on this hash check if target library exist,
|
||||
# otherwise create new library with hash postfix
|
||||
function(erpc_link_c_library)
|
||||
cmake_parse_arguments(_ "" "TARGET;CONFIG_DIR;TRANSPORT" "" ${ARGN})
|
||||
|
||||
|
||||
include(${ERPC_C}/erpc_c_sources.cmake)
|
||||
|
||||
if(NOT __TARGET)
|
||||
message(FATAL_ERROR "Not target specified.")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT __CONFIG_DIR)
|
||||
set(__CONFIG_DIR ${ERPC_C}/config)
|
||||
endif()
|
||||
|
||||
file(MD5 ${__CONFIG_DIR}/erpc_config.h CONFIG_HASH)
|
||||
|
||||
if(NOT TARGET erpc_c_lib_${CONFIG_HASH})
|
||||
add_library(erpc_c_lib_${CONFIG_HASH} ${ERPC_C_SOURCES})
|
||||
target_include_directories(erpc_c_lib_${CONFIG_HASH} PUBLIC ${ERPC_C_INCLUDES} ${__CONFIG_DIR})
|
||||
|
||||
# Required for TCP transport
|
||||
if(WIN32)
|
||||
target_link_libraries(erpc_c_lib_${CONFIG_HASH} PUBLIC wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
target_link_libraries(erpc_c_lib_${CONFIG_HASH} PUBLIC Threads::Threads)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(${__TARGET} PRIVATE erpc_c_lib_${CONFIG_HASH})
|
||||
endfunction()
|
||||
|
||||
function(erpc_generate_shim_code)
|
||||
cmake_parse_arguments(_ "" "IDL_FILE;OUTPUT_DIR;LANGUAGE;WORKING_DIRECTORY" "OUTPUT_FILES" ${ARGN})
|
||||
|
||||
if(NOT ERPCGEN_EXECUTABLE)
|
||||
message(FATAL_ERROR "erpcgen executable not found. Enable CONFIG_ERPC_GENERATOR in Kconfig or provide erpcgen in PATH.")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${__OUTPUT_FILES}
|
||||
COMMAND ${ERPCGEN_EXECUTABLE} -g c -o ${__OUTPUT_DIR} ${__IDL_FILE}
|
||||
WORKING_DIRECTORY ${__WORKING_DIRECTORY}
|
||||
DEPENDS ${__IDL_FILE}
|
||||
COMMENT "erpcgen: ${ERPCGEN_EXECUTABLE} -g c -o ${__OUTPUT_DIR} ${__IDL_FILE}"
|
||||
)
|
||||
endfunction()
|
||||
5531
packages/erpc-1.14.0/cmake/extensions.cmake
vendored
Normal file
5531
packages/erpc-1.14.0/cmake/extensions.cmake
vendored
Normal file
File diff suppressed because it is too large
Load Diff
176
packages/erpc-1.14.0/cmake/kconfig.cmake
vendored
Normal file
176
packages/erpc-1.14.0/cmake/kconfig.cmake
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
# Copyright 2024 NXP
|
||||
# All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
include_guard(GLOBAL)
|
||||
# (1) merge each proj.conf (2) kconfig entry file generation (3) call Kconfiglib
|
||||
# to generate .config file (4) process .config file to generate header file or
|
||||
# set compiler/linker flags
|
||||
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/kconfig)
|
||||
|
||||
set_ifndef(AUTOCONF_H
|
||||
${CMAKE_CURRENT_BINARY_DIR}/kconfig/include/generated/autoconf.h)
|
||||
|
||||
set(SPLITCONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes
|
||||
set_property(
|
||||
DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
|
||||
|
||||
set_ifndef(KCONFIG_NAMESPACE "CONFIG")
|
||||
set(DOTCONFIG ${CMAKE_CURRENT_BINARY_DIR}/.config)
|
||||
set(PARSED_KCONFIG_SOURCES_TXT ${CMAKE_CURRENT_BINARY_DIR}/kconfig/sources.txt)
|
||||
set(GENERATED_HEADERS_TXT ${CMAKE_CURRENT_BINARY_DIR}/kconfig/headers.txt)
|
||||
|
||||
# Only defined KCONFIG_ROOT if not set, because SYSBUILD has defined
|
||||
# KCONFIG_ROOT before
|
||||
if(NOT DEFINED KCONFIG_ROOT)
|
||||
if(EXISTS ${APPLICATION_SOURCE_DIR}/Kconfig)
|
||||
set(KCONFIG_ROOT ${APPLICATION_SOURCE_DIR}/Kconfig)
|
||||
else()
|
||||
set(KCONFIG_ROOT ${ERPC_BASE}/Kconfig)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(COMMON_KCONFIG_ENV_SETTINGS
|
||||
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
|
||||
CONFIG_=${KCONFIG_NAMESPACE}_
|
||||
KCONFIG_CONFIG=${DOTCONFIG}
|
||||
ERPC_BASE=${ERPC_BASE}
|
||||
KCONFIG_BINARY_DIR=${KCONFIG_BINARY_DIR}
|
||||
# The variables below is for sysbuild kconfig
|
||||
config=${CMAKE_BUILD_CONFIG})
|
||||
|
||||
set(EXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig
|
||||
${ERPC_BASE}/scripts/kconfig/menuconfig.py)
|
||||
|
||||
set(EXTRA_KCONFIG_TARGET_COMMAND_FOR_guiconfig
|
||||
${ERPC_BASE}/scripts/kconfig/guiconfig.py)
|
||||
|
||||
set_ifndef(KCONFIG_TARGETS menuconfig guiconfig hardenconfig)
|
||||
|
||||
foreach(kconfig_target ${KCONFIG_TARGETS} ${EXTRA_KCONFIG_TARGETS})
|
||||
add_custom_target(
|
||||
${kconfig_target}
|
||||
${CMAKE_COMMAND}
|
||||
-E
|
||||
env
|
||||
ZEPHYR_BASE=${ERPC_BASE}
|
||||
${COMMON_KCONFIG_ENV_SETTINGS}
|
||||
"SHIELD_AS_LIST=${SHIELD_AS_LIST_ESCAPED}"
|
||||
DTS_POST_CPP=${DTS_POST_CPP}
|
||||
DTS_ROOT_BINDINGS=${DTS_ROOT_BINDINGS}
|
||||
${PYTHON_EXECUTABLE}
|
||||
${EXTRA_KCONFIG_TARGET_COMMAND_FOR_${kconfig_target}}
|
||||
${KCONFIG_ROOT}
|
||||
WORKING_DIRECTORY ${ERPC_BASE}
|
||||
USES_TERMINAL COMMAND_EXPAND_LISTS)
|
||||
endforeach()
|
||||
|
||||
# if CUSTOM_PRJ_CONF_PATHS is not empty, append it to merge_config_files
|
||||
if(CUSTOM_PRJ_CONF_PATHS)
|
||||
foreach(path ${CUSTOM_PRJ_CONF_PATHS})
|
||||
list(APPEND merge_config_files ${CUSTOM_PRJ_CONF_PATHS})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CONF_FILE)
|
||||
string(CONFIGURE "${CONF_FILE}" CONF_FILE_EXPANDED)
|
||||
string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE_EXPANDED}")
|
||||
list(APPEND merge_config_files ${CONF_FILE_AS_LIST})
|
||||
else()
|
||||
list(APPEND merge_config_files ${ERPC_BASE}/prj.conf)
|
||||
endif()
|
||||
|
||||
# Calculate a checksum of merge_config_files to determine if we need to
|
||||
# re-generate .config
|
||||
set(merge_config_files_checksum "")
|
||||
foreach(f ${merge_config_files})
|
||||
file(MD5 ${f} checksum)
|
||||
set(merge_config_files_checksum "${merge_config_files_checksum}${checksum}")
|
||||
endforeach()
|
||||
|
||||
# Create a new .config if it does not exists, or if the checksum of the
|
||||
# dependencies has changed
|
||||
set(merge_config_files_checksum_file
|
||||
${CMAKE_CURRENT_BINARY_DIR}/.cmake.dotconfig.checksum)
|
||||
set(CREATE_NEW_DOTCONFIG 1)
|
||||
# Check if the checksum file exists too before trying to open it, though it
|
||||
# should under normal circumstances
|
||||
if(EXISTS ${DOTCONFIG} AND EXISTS ${merge_config_files_checksum_file})
|
||||
# Read out what the checksum was previously
|
||||
file(READ ${merge_config_files_checksum_file}
|
||||
merge_config_files_checksum_prev)
|
||||
if(${merge_config_files_checksum} STREQUAL
|
||||
${merge_config_files_checksum_prev})
|
||||
# Checksum is the same as before
|
||||
set(CREATE_NEW_DOTCONFIG 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CREATE_NEW_DOTCONFIG)
|
||||
set(input_configs_flags --handwritten-input-configs)
|
||||
set(input_configs ${merge_config_files} ${FORCED_CONF_FILE})
|
||||
else()
|
||||
set(input_configs ${DOTCONFIG} ${FORCED_CONF_FILE})
|
||||
endif()
|
||||
# set(FORCED_CONF_FILE)
|
||||
if(DEFINED FORCED_CONF_FILE)
|
||||
list(APPEND input_configs_flags --forced-input-configs)
|
||||
endif()
|
||||
|
||||
cmake_path(GET AUTOCONF_H PARENT_PATH autoconf_h_path)
|
||||
if(NOT EXISTS ${autoconf_h_path})
|
||||
file(MAKE_DIRECTORY ${autoconf_h_path})
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E env
|
||||
${COMMON_KCONFIG_ENV_SETTINGS}
|
||||
${PYTHON_EXECUTABLE}
|
||||
${ERPC_BASE}/scripts/kconfig/kconfig.py
|
||||
--zephyr-base=${ERPC_BASE}
|
||||
${input_configs_flags}
|
||||
${KCONFIG_ROOT}
|
||||
${DOTCONFIG}
|
||||
${AUTOCONF_H}
|
||||
""
|
||||
# ${SPLITCONFIG_DIR}
|
||||
${PARSED_KCONFIG_SOURCES_TXT}
|
||||
${GENERATED_HEADERS_TXT}
|
||||
${input_configs}
|
||||
WORKING_DIRECTORY ${ERPC_BASE}
|
||||
# The working directory is set to the app dir such that the user can use
|
||||
# relative paths in CONF_FILE, e.g. CONF_FILE=nrf5.conf
|
||||
RESULT_VARIABLE ret)
|
||||
if(NOT "${ret}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Kconfig process command run failed with return code: ${ret}")
|
||||
endif()
|
||||
|
||||
if(CREATE_NEW_DOTCONFIG)
|
||||
# Write the new configuration fragment checksum. Only do this if kconfig.py
|
||||
# succeeds, to avoid marking zephyr/.config as up-to-date when it hasn't been
|
||||
# regenerated.
|
||||
file(WRITE ${merge_config_files_checksum_file} ${merge_config_files_checksum})
|
||||
endif()
|
||||
|
||||
# Read out the list of 'Kconfig' sources that were used by the engine.
|
||||
file(STRINGS ${PARSED_KCONFIG_SOURCES_TXT} PARSED_KCONFIG_SOURCES_LIST)
|
||||
file(STRINGS ${GENERATED_HEADERS_TXT} GENERATED_HEADERS_LIST)
|
||||
|
||||
# Force CMAKE configure when the Kconfig sources or configuration files changes.
|
||||
foreach(kconfig_input ${merge_config_files} ${DOTCONFIG}
|
||||
${PARSED_KCONFIG_SOURCES_LIST} ${GENERATED_HEADERS_LIST})
|
||||
set_property(
|
||||
DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${kconfig_input})
|
||||
endforeach()
|
||||
|
||||
# import config
|
||||
import_kconfig(${KCONFIG_NAMESPACE} ${DOTCONFIG})
|
||||
46
packages/erpc-1.14.0/cmake/python.cmake
vendored
Normal file
46
packages/erpc-1.14.0/cmake/python.cmake
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# On Windows, instruct Python to output UTF-8 even when not
|
||||
# interacting with a terminal. This is required since Python scripts
|
||||
# are invoked by CMake code and, on Windows, standard I/O encoding defaults
|
||||
# to the current code page if not connected to a terminal, which is often
|
||||
# not what we want.
|
||||
if (WIN32)
|
||||
set(ENV{PYTHONIOENCODING} "utf-8")
|
||||
endif()
|
||||
|
||||
set(PYTHON_MINIMUM_REQUIRED 3.8)
|
||||
|
||||
#find_package(Deprecated COMPONENTS PYTHON_PREFER)
|
||||
|
||||
if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON)
|
||||
set(Python3_EXECUTABLE "${WEST_PYTHON}")
|
||||
endif()
|
||||
|
||||
if(NOT Python3_EXECUTABLE)
|
||||
# We are using foreach here, instead of
|
||||
# find_program(PYTHON_EXECUTABLE_SYSTEM_DEFAULT "python" "python3")
|
||||
# cause just using find_program directly could result in a python2.7 as python,
|
||||
# and not finding a valid python3.
|
||||
foreach(candidate "python" "python3")
|
||||
find_program(Python3_EXECUTABLE ${candidate})
|
||||
if(Python3_EXECUTABLE)
|
||||
execute_process (COMMAND "${Python3_EXECUTABLE}" -c
|
||||
"import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE version
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(version VERSION_LESS PYTHON_MINIMUM_REQUIRED)
|
||||
set(Python3_EXECUTABLE "Python3_EXECUTABLE-NOTFOUND" CACHE INTERNAL "Path to a program")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package(Python3 ${PYTHON_MINIMUM_REQUIRED} REQUIRED)
|
||||
|
||||
# Zephyr internally used Python variable.
|
||||
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
|
||||
150
packages/erpc-1.14.0/cmake/test.cmake
vendored
Normal file
150
packages/erpc-1.14.0/cmake/test.cmake
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
#
|
||||
# Copyright 2024 NXP
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Generate basic set of tests for given test case - client/server, tcp/serial
|
||||
function(generate_erpc_test)
|
||||
|
||||
# Add TCP test
|
||||
if(CONFIG_ERPC_TESTS.transport.tcp)
|
||||
|
||||
if(CONFIG_ERPC_TESTS.client)
|
||||
add_erpc_test(TEST_TYPE "client" TRANSPORT "tcp")
|
||||
endif()
|
||||
if(CONFIG_ERPC_TESTS.server)
|
||||
add_erpc_test(TEST_TYPE "server" TRANSPORT "tcp")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add SERIAL test
|
||||
if(CONFIG_ERPC_TESTS.transport.serial)
|
||||
if(CONFIG_ERPC_TESTS.client)
|
||||
add_erpc_test(TEST_TYPE "client" TRANSPORT "serial")
|
||||
endif()
|
||||
if(CONFIG_ERPC_TESTS.server)
|
||||
add_erpc_test(TEST_TYPE "server" TRANSPORT "serial")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction(generate_erpc_test)
|
||||
|
||||
# This function inheres basic test's parameters from calling CMake generated by
|
||||
# 'generate_erpc_test_variables'. This allows to override some of them to fit each test's requirements.
|
||||
# If test need to use different sources or incudes, it can use 'add_erpc_test' parameters:
|
||||
#
|
||||
# add_erpc_test (
|
||||
# TEST_TYPE (client|server)
|
||||
# TRANSPORT (tcp|serial)
|
||||
# [CUSTOM_CONFIG path]
|
||||
# [TEST_ERPC_FILES file [item1...]]
|
||||
# [TEST_SOURCES [item1...]]
|
||||
# [TEST_INCLUDES [item1...]]
|
||||
# )
|
||||
#
|
||||
# This allows to specify custom source for client/server in one test case (test_arbitrator, ...).
|
||||
# If CUSTOM_CONFIG if specified, generator will try to find or creates erpc library with given config file.
|
||||
function(add_erpc_test)
|
||||
set(oneValueArgs TEST_TYPE TRANSPORT CUSTOM_CONFIG)
|
||||
set(multiValueArgs TEST_ERPC_FILES TEST_SOURCES TEST_INCLUDES)
|
||||
cmake_parse_arguments(_ "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
set_ifndef(__TEST_ERPC_FILES
|
||||
${TEST_ERPC_OUT_DIR}/${ERPC_NAME_APP}_interface.cpp
|
||||
${TEST_ERPC_OUT_DIR}/${ERPC_NAME}_unit_test_common_interface.cpp
|
||||
|
||||
${TEST_ERPC_OUT_DIR}/${ERPC_NAME_APP}_${__TEST_TYPE}.cpp
|
||||
${TEST_ERPC_OUT_DIR}/${ERPC_NAME}_unit_test_common_${__TEST_TYPE}.cpp
|
||||
|
||||
${TEST_ERPC_OUT_DIR}/c_${ERPC_NAME_APP}_${__TEST_TYPE}.cpp
|
||||
${TEST_ERPC_OUT_DIR}/c_${ERPC_NAME}_unit_test_common_${__TEST_TYPE}.cpp
|
||||
)
|
||||
|
||||
if(GENERATE_ERPC_IDL_FILES)
|
||||
erpc_generate_shim_code(
|
||||
IDL_FILE ${IDL_FILE}
|
||||
OUTPUT_DIR ${ERPC_OUT_ROOT_DIR}
|
||||
WORKING_DIRECTORY ${TEST_SOURCE_DIR}
|
||||
OUTPUT_FILES ${__TEST_ERPC_FILES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set_ifndef(__TEST_SOURCES
|
||||
${TEST_COMMON_DIR}/unit_test_${__TRANSPORT}_${__TEST_TYPE}.cpp
|
||||
${TEST_SOURCE_DIR}/${TEST_NAME}_${__TEST_TYPE}_impl.cpp
|
||||
|
||||
${ERPC_ERPCGEN}/src/Logging.cpp
|
||||
${__TEST_ERPC_FILES}
|
||||
|
||||
${TEST_EXT_SOURCES}
|
||||
)
|
||||
|
||||
set_ifndef(__TEST_INCLUDES
|
||||
${TEST_ERPC_OUT_DIR}
|
||||
${TEST_SOURCE_DIR}
|
||||
${CONFIG_DIR}
|
||||
${TEST_COMMON_DIR}
|
||||
${ERPC_ERPCGEN}/src
|
||||
${TEST_EXT_INCLUDES}
|
||||
)
|
||||
|
||||
# Custom target name base on test, test type and transport (test_arbitrator_client_tcp, ...)
|
||||
set(TARGET ${TEST_NAME}_${__TEST_TYPE}_${__TRANSPORT})
|
||||
|
||||
add_executable(${TARGET} ${__TEST_SOURCES} )
|
||||
target_include_directories(${TARGET} PRIVATE ${__TEST_INCLUDES})
|
||||
|
||||
target_link_libraries(${TARGET} PRIVATE gtest)
|
||||
erpc_link_c_library(TARGET ${TARGET} CONFIG_DIR ${CONFIG_DIR})
|
||||
|
||||
# Pass transport parameters to test's source code
|
||||
if(CONFIG_ERPC_TESTS.transport.serial)
|
||||
add_definitions(-DUNIT_TEST_SERIAL_PORT="${CONFIG_ERPC_TESTS.transport.serial.port}")
|
||||
add_definitions(-DUNIT_TEST_SERIAL_BAUD=${CONFIG_ERPC_TESTS.transport.serial.baud})
|
||||
endif()
|
||||
|
||||
if(CONFIG_ERPC_TESTS.transport.tcp)
|
||||
add_definitions(-DUNIT_TEST_TCP_HOST="${CONFIG_ERPC_TESTS.transport.tcp.host}")
|
||||
add_definitions(-DUNIT_TEST_TCP_PORT=${CONFIG_ERPC_TESTS.transport.tcp.port})
|
||||
endif()
|
||||
|
||||
# Add test_name target to build current test
|
||||
if(NOT TARGET ${TEST_NAME})
|
||||
add_custom_target(${TEST_NAME})
|
||||
endif()
|
||||
|
||||
add_dependencies(${TEST_NAME} ${TARGET})
|
||||
|
||||
endfunction(add_erpc_test)
|
||||
|
||||
macro(generate_erpc_test_variables)
|
||||
|
||||
get_filename_component(TEST_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
|
||||
# Set test implementation directory
|
||||
set(TEST_SOURCE_DIR ${ERPC_BASE}/test/${TEST_NAME})
|
||||
set(TEST_COMMON_DIR ${ERPC_BASE}/test/common)
|
||||
|
||||
# Set test name
|
||||
set(ERPC_NAME "test")
|
||||
set(ERPC_NAME_APP ${ERPC_NAME})
|
||||
|
||||
# Directory where test is generated
|
||||
set(TEST_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Directory where eRPC shim is generated
|
||||
set(ERPC_OUT_ROOT_DIR ${TEST_OUT_DIR})
|
||||
set(ERPC_OUT_DIR erpc_outputs)
|
||||
set(TEST_ERPC_OUT_DIR ${ERPC_OUT_ROOT_DIR}/${ERPC_OUT_DIR})
|
||||
|
||||
# Disable/Enable ERPC Shim generation; Source code has to be added to TEST_CLIENT_SOURCES/TEST_SERVER_SOURCES
|
||||
set(GENERATE_ERPC_IDL_FILES TRUE)
|
||||
|
||||
# IDL file
|
||||
set(IDL_FILE ${TEST_SOURCE_DIR}/${TEST_NAME}.erpc)
|
||||
|
||||
# Config directory
|
||||
set(CONFIG_DIR ${TEST_COMMON_DIR}/config)
|
||||
|
||||
endmacro(generate_erpc_test_variables)
|
||||
3
packages/erpc-1.14.0/doxygen/.gitignore
vendored
Normal file
3
packages/erpc-1.14.0/doxygen/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
erpc
|
||||
erpcgen
|
||||
|
||||
2482
packages/erpc-1.14.0/doxygen/Doxyfile.erpc
vendored
Normal file
2482
packages/erpc-1.14.0/doxygen/Doxyfile.erpc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2353
packages/erpc-1.14.0/doxygen/Doxyfile.erpcgen
vendored
Normal file
2353
packages/erpc-1.14.0/doxygen/Doxyfile.erpcgen
vendored
Normal file
File diff suppressed because it is too large
Load Diff
90
packages/erpc-1.14.0/doxygen/customdoxygen.css
vendored
Normal file
90
packages/erpc-1.14.0/doxygen/customdoxygen.css
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
|
||||
body {
|
||||
color: #51626f;
|
||||
}
|
||||
|
||||
body, table, div, p, dl {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.textblock ul {
|
||||
list-style: none outside url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAF0lEQVQIHWP8uZXhPwMWwIRFDCxEDwkAjygCuZMRiw4AAAAASUVORK5CYII=");
|
||||
}
|
||||
|
||||
h1, h2.groupheader {
|
||||
color: #51626f;
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.tablist a,
|
||||
.tablist a:hover {
|
||||
text-shadow: none;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.tablist a {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.tablist a:hover {
|
||||
background-color: #f2f2f5;
|
||||
color: #007088;
|
||||
}
|
||||
|
||||
.tablist li.current a {
|
||||
text-shadow: none;
|
||||
background-image: none;
|
||||
background-color: #ffffff;
|
||||
color: #777777;
|
||||
}
|
||||
|
||||
.navpath ul {
|
||||
background-image: none;
|
||||
background-color: #e6e6e6;
|
||||
color: #646464;
|
||||
}
|
||||
|
||||
.tabs, .tabs2, .tabs3,
|
||||
.tablist li {
|
||||
background: rgba(0, 0, 0, 0) linear-gradient(to bottom, #f1b635, #e4942a) repeat scroll 0 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #5e89c1;
|
||||
}
|
||||
|
||||
#nav-tree .selected {
|
||||
text-shadow: none;
|
||||
background-image: none;
|
||||
background-color: #e6e6e6;
|
||||
color: #646464;
|
||||
}
|
||||
|
||||
#nav-tree .selected a {
|
||||
color: #646464;
|
||||
}
|
||||
|
||||
#titlearea {
|
||||
border-bottom: 1px solid #51626f;
|
||||
}
|
||||
|
||||
#projectname {
|
||||
font: 32px "Helvetica Neue", Helvetica, Arial;
|
||||
}
|
||||
|
||||
.image {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
17
packages/erpc-1.14.0/doxygen/html_footer.html
vendored
Normal file
17
packages/erpc-1.14.0/doxygen/html_footer.html
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<!-- HTML footer for doxygen 1.8.5-->
|
||||
<!-- start footer part -->
|
||||
<!--BEGIN GENERATE_TREEVIEW-->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul class="foot">
|
||||
<li class="footer">Copyright 2016-2020 NXP Semiconductors. All rights reserved.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--END GENERATE_TREEVIEW-->
|
||||
<!--BEGIN !GENERATE_TREEVIEW-->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Copyright 2016-2020 NXP Semiconductors. All rights reserved.
|
||||
</small></address>
|
||||
<!--END !GENERATE_TREEVIEW-->
|
||||
</body>
|
||||
</html>
|
||||
195
packages/erpc-1.14.0/doxygen/layout.xml
vendored
Normal file
195
packages/erpc-1.14.0/doxygen/layout.xml
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
<doxygenlayout version="1.0">
|
||||
<!-- Generated by doxygen 1.8.11 -->
|
||||
<!-- Navigation index tabs for HTML output -->
|
||||
<navindex>
|
||||
<tab type="mainpage" visible="yes" title=""/>
|
||||
<tab type="pages" visible="yes" title="" intro=""/>
|
||||
<tab type="modules" visible="yes" title="API Reference" intro=""/>
|
||||
<tab type="namespaces" visible="yes" title="">
|
||||
<tab type="namespacelist" visible="yes" title="" intro=""/>
|
||||
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="classes" visible="yes" title="">
|
||||
<tab type="classlist" visible="yes" title="" intro=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="hierarchy" visible="yes" title="" intro=""/>
|
||||
<tab type="classmembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="files" visible="yes" title="">
|
||||
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||
<tab type="globals" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
<class>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<inheritancegraph visible="$CLASS_GRAPH"/>
|
||||
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
|
||||
<memberdecl>
|
||||
<nestedclasses visible="yes" title=""/>
|
||||
<publictypes title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<publicslots title=""/>
|
||||
<signals title=""/>
|
||||
<publicmethods title=""/>
|
||||
<publicstaticmethods title=""/>
|
||||
<publicattributes title=""/>
|
||||
<publicstaticattributes title=""/>
|
||||
<protectedtypes title=""/>
|
||||
<protectedslots title=""/>
|
||||
<protectedmethods title=""/>
|
||||
<protectedstaticmethods title=""/>
|
||||
<protectedattributes title=""/>
|
||||
<protectedstaticattributes title=""/>
|
||||
<packagetypes title=""/>
|
||||
<packagemethods title=""/>
|
||||
<packagestaticmethods title=""/>
|
||||
<packageattributes title=""/>
|
||||
<packagestaticattributes title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
<privatetypes title=""/>
|
||||
<privateslots title=""/>
|
||||
<privatemethods title=""/>
|
||||
<privatestaticmethods title=""/>
|
||||
<privateattributes title=""/>
|
||||
<privatestaticattributes title=""/>
|
||||
<friends title=""/>
|
||||
<related title="" subtitle=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<services title=""/>
|
||||
<interfaces title=""/>
|
||||
<constructors title=""/>
|
||||
<functions title=""/>
|
||||
<related title=""/>
|
||||
<variables title=""/>
|
||||
<properties title=""/>
|
||||
<events title=""/>
|
||||
</memberdef>
|
||||
<allmemberslink visible="yes"/>
|
||||
<usedfiles visible="$SHOW_USED_FILES"/>
|
||||
<authorsection visible="yes"/>
|
||||
</class>
|
||||
|
||||
<!-- Layout definition for a namespace page -->
|
||||
<namespace>
|
||||
<briefdescription visible="yes"/>
|
||||
<memberdecl>
|
||||
<nestednamespaces visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</namespace>
|
||||
|
||||
<!-- Layout definition for a file page -->
|
||||
<file>
|
||||
<briefdescription visible="yes"/>
|
||||
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||
<sourcelink visible="yes"/>
|
||||
<memberdecl>
|
||||
<classes visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<constantgroups visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
</memberdef>
|
||||
<authorsection/>
|
||||
</file>
|
||||
|
||||
<!-- Layout definition for a group page -->
|
||||
<group>
|
||||
<briefdescription visible="yes"/>
|
||||
<detaileddescription title="Overview" />
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<memberdecl>
|
||||
<nestedgroups visible="yes" title=""/>
|
||||
<dirs visible="yes" title=""/>
|
||||
<files visible="yes" title=""/>
|
||||
<namespaces visible="yes" title=""/>
|
||||
<classes visible="yes" title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
<membergroups visible="yes"/>
|
||||
</memberdecl>
|
||||
|
||||
<memberdef>
|
||||
<pagedocs/>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
<enumvalues title=""/>
|
||||
<functions title=""/>
|
||||
<variables title=""/>
|
||||
<signals title=""/>
|
||||
<publicslots title=""/>
|
||||
<protectedslots title=""/>
|
||||
<privateslots title=""/>
|
||||
<events title=""/>
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
</memberdef>
|
||||
<authorsection visible="yes"/>
|
||||
</group>
|
||||
|
||||
<!-- Layout definition for a directory page -->
|
||||
<directory>
|
||||
<briefdescription visible="yes"/>
|
||||
<directorygraph visible="yes"/>
|
||||
<memberdecl>
|
||||
<dirs visible="yes"/>
|
||||
<files visible="yes"/>
|
||||
</memberdecl>
|
||||
<detaileddescription title=""/>
|
||||
</directory>
|
||||
</doxygenlayout>
|
||||
16
packages/erpc-1.14.0/doxygen/mainpage_erpc.md
vendored
Normal file
16
packages/erpc-1.14.0/doxygen/mainpage_erpc.md
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
Introduction {#mainpage}
|
||||
=================
|
||||
|
||||
eRPC (Embedded Remote Procedure Call) is an open source RPC system with a focus on constrained embedded environments.
|
||||
|
||||
Generally, RPC is a mechanism used to invoke a software routine on a remote system via a simple local function call. The remote system may be any CPU connected by an arbitrary communications channel: a server across a network, another CPU core in a multicore system, and so on. To the client, it is just like calling a function in a library built into the application. The only difference is any latency or unreliability introduced by the communications channel.
|
||||
|
||||
When a remote function is called by the client, the function's parameters and an identifier for the called routine are marshalled (or serialized) into a stream of bytes. This byte stream is transported to the server through a communications channel (IPC, TPC/IP, UART, etc). The server unmarshals the parameters, determines which function was invoked, and calls it. If the function returns a value, then it is marshalled and sent back to the client.
|
||||
|
||||
Here is a block diagram of an RPC system:
|
||||
|
||||

|
||||
|
||||
This diagram only shows one direction of communication. It leaves out the reply from the server to send the invoked function's return value. This reply uses basically the same sequence of events, but flows back from the server to the client.
|
||||
|
||||
RPC implementations typically use combination of a tool (`erpcgen` in our case) and IDL (interface definition language) file to generate source code to handle the details of marshalling a function's parameters and building the data stream. The tool also generates code for a server side shim that knows how to unmarshal a request and call the appropriate function. The IDL input is used to tell the generator tool about data types and RPC services.
|
||||
3
packages/erpc-1.14.0/doxygen/mainpage_erpcgen.md
vendored
Normal file
3
packages/erpc-1.14.0/doxygen/mainpage_erpcgen.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# About eRPC generator {#mainpage}
|
||||
|
||||
The eRPC generator (erpcgen) is a tool which generates the shim code for a server and client side. The generated shim code handles marshaling and unmarshaling a request. On the server side after unmarshaling, it implements a function call to the appropriate function based on request. An IDL (Interface Definition Language) is used to tell the generator tool about data types and RPC services.
|
||||
BIN
packages/erpc-1.14.0/doxygen/rpc_block_diagram.png
vendored
Normal file
BIN
packages/erpc-1.14.0/doxygen/rpc_block_diagram.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
23
packages/erpc-1.14.0/erpc_c/CMakeLists.txt
vendored
Normal file
23
packages/erpc-1.14.0/erpc_c/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Copyright 2024 NXP
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
include(erpc_c_sources.cmake)
|
||||
# Create erpc library
|
||||
add_library(erpc STATIC ${ERPC_C_SOURCES})
|
||||
set_target_properties(erpc PROPERTIES PUBLIC_HEADER "${ERPC_C_HEADERS}")
|
||||
|
||||
target_include_directories(erpc PUBLIC ${ERPC_C_INCLUDES} ${ERPC_C}/config)
|
||||
|
||||
# Required for TCP transport
|
||||
if(WIN32)
|
||||
target_link_libraries(erpc PRIVATE wsock32 ws2_32)
|
||||
endif()
|
||||
|
||||
# Install erpc as library
|
||||
install(TARGETS erpc PUBLIC_HEADER DESTINATION include/erpc/)
|
||||
|
||||
|
||||
|
||||
151
packages/erpc-1.14.0/erpc_c/Makefile
vendored
Normal file
151
packages/erpc-1.14.0/erpc_c/Makefile
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016 Freescale Semiconductor, Inc.
|
||||
# Copyright 2016-2020 NXP
|
||||
# All rights reserved.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
# SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
this_makefile := $(firstword $(MAKEFILE_LIST))
|
||||
ERPC_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../)
|
||||
|
||||
include $(ERPC_ROOT)/mk/erpc_common.mk
|
||||
|
||||
ERPC_C_ROOT = $(ERPC_ROOT)/erpc_c
|
||||
|
||||
# TARGET_OUTPUT_ROOT = $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)/$(os_name)/$(APP_NAME)
|
||||
|
||||
#-----------------------------------------------
|
||||
# setup variables
|
||||
# ----------------------------------------------
|
||||
|
||||
LIB_NAME = erpc
|
||||
|
||||
TARGET_OUTPUT_ROOT = $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)/$(os_name)/$(LIB_NAME)
|
||||
|
||||
TARGET_LIB = $(LIBS_ROOT)/lib$(LIB_NAME).a
|
||||
|
||||
OBJS_ROOT = $(TARGET_OUTPUT_ROOT)/obj
|
||||
|
||||
LIBS_ROOT = $(TARGET_OUTPUT_ROOT)/lib
|
||||
|
||||
#-----------------------------------------------
|
||||
# Include path. Add the include paths like this:
|
||||
# INCLUDES += ./include/
|
||||
#-----------------------------------------------
|
||||
INCLUDES += $(ERPC_C_ROOT)/config \
|
||||
$(ERPC_C_ROOT)/infra \
|
||||
$(ERPC_C_ROOT)/port \
|
||||
$(ERPC_C_ROOT)/setup \
|
||||
$(ERPC_C_ROOT)/transports
|
||||
|
||||
SOURCES += $(ERPC_C_ROOT)/infra/erpc_arbitrated_client_manager.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_basic_codec.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_client_manager.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_crc16.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_framed_transport.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_message_buffer.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_message_loggers.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_server.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_simple_server.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_transport_arbitrator.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_utils.cpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_pre_post_action.cpp \
|
||||
$(ERPC_C_ROOT)/port/erpc_port_stdlib.cpp \
|
||||
$(ERPC_C_ROOT)/port/erpc_threading_pthreads.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_arbitrated_client_setup.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_client_setup.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_setup_mbf_dynamic.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_setup_mbf_static.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_server_setup.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_setup_serial.cpp \
|
||||
$(ERPC_C_ROOT)/setup/erpc_setup_tcp.cpp \
|
||||
$(ERPC_C_ROOT)/transports/erpc_inter_thread_buffer_transport.cpp \
|
||||
$(ERPC_C_ROOT)/transports/erpc_tcp_transport.cpp
|
||||
ifeq "$(is_mingw)" ""
|
||||
SOURCES += $(ERPC_C_ROOT)/transports/erpc_serial_transport.cpp \
|
||||
$(ERPC_C_ROOT)/port/erpc_serial.cpp
|
||||
endif
|
||||
|
||||
HEADERS += $(ERPC_C_ROOT)/config/erpc_config.h \
|
||||
$(ERPC_C_ROOT)/infra/erpc_arbitrated_client_manager.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_basic_codec.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_client_manager.h \
|
||||
$(ERPC_C_ROOT)/infra/erpc_codec.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_crc16.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_common.h \
|
||||
$(ERPC_C_ROOT)/infra/erpc_version.h \
|
||||
$(ERPC_C_ROOT)/infra/erpc_framed_transport.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_manually_constructed.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_message_buffer.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_message_loggers.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_server.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_simple_server.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_static_queue.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_transport_arbitrator.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_transport.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_utils.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_client_server_common.hpp \
|
||||
$(ERPC_C_ROOT)/infra/erpc_pre_post_action.h \
|
||||
$(ERPC_C_ROOT)/port/erpc_setup_extensions.h \
|
||||
$(ERPC_C_ROOT)/port/erpc_config_internal.h \
|
||||
$(ERPC_C_ROOT)/port/erpc_port.h \
|
||||
$(ERPC_C_ROOT)/port/erpc_threading.h \
|
||||
$(ERPC_C_ROOT)/port/erpc_serial.h \
|
||||
$(ERPC_C_ROOT)/setup/erpc_arbitrated_client_setup.h \
|
||||
$(ERPC_C_ROOT)/setup/erpc_client_setup.h \
|
||||
$(ERPC_C_ROOT)/setup/erpc_mbf_setup.h \
|
||||
$(ERPC_C_ROOT)/setup/erpc_server_setup.h \
|
||||
$(ERPC_C_ROOT)/setup/erpc_transport_setup.h \
|
||||
$(ERPC_C_ROOT)/transports/erpc_inter_thread_buffer_transport.hpp \
|
||||
$(ERPC_C_ROOT)/transports/erpc_serial_transport.hpp \
|
||||
$(ERPC_C_ROOT)/transports/erpc_tcp_transport.hpp
|
||||
|
||||
MAKE_TARGET = $(TARGET_LIB)($(OBJECTS_ALL))
|
||||
|
||||
include $(ERPC_ROOT)/mk/targets.mk
|
||||
|
||||
# Release should be alwas static. Customers don't need install things.
|
||||
ifeq "$(build)" "release"
|
||||
# Except Darwin.
|
||||
ifeq "$(is_darwin)" ""
|
||||
LIBRARIES += -static
|
||||
endif
|
||||
endif
|
||||
|
||||
$(TARGET_LIB)(%): %
|
||||
@$(call printmessage,ar,Archiving, $(?F) in $(@F))
|
||||
$(at)$(mkdirc) -p $(dir $(@))
|
||||
$(AR) $(ARFLAGS) $@ $?
|
||||
|
||||
.PHONY: install
|
||||
install: install_headers install_lib
|
||||
|
||||
.PHONY: install_headers
|
||||
install_headers: $(HEADERS) | $(INC_INSTALL_DIR)
|
||||
@$(call printmessage,c,Installing, headers in $(INC_INSTALL_DIR))
|
||||
$(at)$(mkdirc) -p $(INC_INSTALL_DIR)
|
||||
$(at)install $(?) $(INC_INSTALL_DIR)
|
||||
|
||||
$(INC_INSTALL_DIR):
|
||||
$(at)$(mkdirc) -p $(INC_INSTALL_DIR)
|
||||
|
||||
.PHONY: install_lib
|
||||
install_lib: $(TARGET_LIB)
|
||||
@$(call printmessage,c,Installing, $(subst $(LIBS_ROOT)/,,$<) in $(LIB_INSTALL_DIR))
|
||||
$(at)$(mkdirc) -p $(LIB_INSTALL_DIR)
|
||||
$(at)install $(TARGET_LIB) $(LIB_INSTALL_DIR)
|
||||
|
||||
clean::
|
||||
$(at)$(rmc) $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
|
||||
22
packages/erpc-1.14.0/erpc_c/README.md
vendored
Normal file
22
packages/erpc-1.14.0/erpc_c/README.md
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# eRPC library code
|
||||
|
||||
Directory Structure:
|
||||
|
||||
- **config** - Holds the user-editable erpc_config.h header. This file can either be edited in place,
|
||||
or copied to application code.
|
||||
|
||||
- **infra** - Contains C++ infrastructure code used to build server and client applications. For most
|
||||
use cases, the APIs in the setup/ folder are easier. Accessing the C++ layer directly is only
|
||||
required if you need to extend eRPC, or for atypical configurations.
|
||||
|
||||
- **port** - Contains the eRPC porting layer to adapt to different environments.
|
||||
|
||||
- **setup** - Contains a set of plain C APIs that wrap the C++ infrastructure, providing client and server
|
||||
init and deinit routines that greatly simplify eRPC usage in C-based projects. No knowledge of
|
||||
C++ is required to use these APIs.
|
||||
|
||||
- **transports** - Contains transport classes for the different methods of communication supported by
|
||||
eRPC. Some transports are applicable only to host PCs, while others are applicable only to
|
||||
embedded or multicore systems. Most transports have a corresponding C transport setup
|
||||
function in the setup/ folder.
|
||||
|
||||
6
packages/erpc-1.14.0/erpc_c/config/config.dox
vendored
Normal file
6
packages/erpc-1.14.0/erpc_c/config/config.dox
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/*!
|
||||
@defgroup config Configuration
|
||||
@brief Configuration settings
|
||||
*/
|
||||
|
||||
|
||||
215
packages/erpc-1.14.0/erpc_c/config/erpc_config.h
vendored
Normal file
215
packages/erpc-1.14.0/erpc_c/config/erpc_config.h
vendored
Normal file
@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2020 NXP
|
||||
* Copyright 2020-2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _ERPC_CONFIG_H_
|
||||
#define _ERPC_CONFIG_H_
|
||||
|
||||
/*!
|
||||
* @addtogroup config
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! @name Threading model options
|
||||
//@{
|
||||
#define ERPC_ALLOCATION_POLICY_DYNAMIC (0U) //!< Dynamic allocation policy
|
||||
#define ERPC_ALLOCATION_POLICY_STATIC (1U) //!< Static allocation policy
|
||||
|
||||
#define ERPC_THREADS_NONE (0U) //!< No threads.
|
||||
#define ERPC_THREADS_PTHREADS (1U) //!< POSIX pthreads.
|
||||
#define ERPC_THREADS_FREERTOS (2U) //!< FreeRTOS.
|
||||
#define ERPC_THREADS_ZEPHYR (3U) //!< ZEPHYR.
|
||||
#define ERPC_THREADS_MBED (4U) //!< Mbed OS
|
||||
#define ERPC_THREADS_WIN32 (5U) //!< WIN32
|
||||
#define ERPC_THREADS_THREADX (6U) //!< THREADX
|
||||
|
||||
#define ERPC_NOEXCEPT_DISABLED (0U) //!< Disabling noexcept feature.
|
||||
#define ERPC_NOEXCEPT_ENABLED (1U) //!< Enabling noexcept feature.
|
||||
|
||||
#define ERPC_NESTED_CALLS_DISABLED (0U) //!< No nested calls support.
|
||||
#define ERPC_NESTED_CALLS_ENABLED (1U) //!< Nested calls support.
|
||||
|
||||
#define ERPC_NESTED_CALLS_DETECTION_DISABLED (0U) //!< Nested calls detection disabled.
|
||||
#define ERPC_NESTED_CALLS_DETECTION_ENABLED (1U) //!< Nested calls detection enabled.
|
||||
|
||||
#define ERPC_MESSAGE_LOGGING_DISABLED (0U) //!< Trace functions disabled.
|
||||
#define ERPC_MESSAGE_LOGGING_ENABLED (1U) //!< Trace functions enabled.
|
||||
|
||||
#define ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED (0U) //!< Do not use MCMGR for MU ISR management.
|
||||
#define ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED (1U) //!< Use MCMGR for MU ISR management.
|
||||
|
||||
#define ERPC_PRE_POST_ACTION_DISABLED (0U) //!< Pre post shim callbacks functions disabled.
|
||||
#define ERPC_PRE_POST_ACTION_ENABLED (1U) //!< Pre post shim callback functions enabled.
|
||||
|
||||
#define ERPC_PRE_POST_ACTION_DEFAULT_DISABLED (0U) //!< Pre post shim default callbacks functions disabled.
|
||||
#define ERPC_PRE_POST_ACTION_DEFAULT_ENABLED (1U) //!< Pre post shim default callback functions enabled.
|
||||
//@}
|
||||
|
||||
#ifdef MCUXPRESSO_SDK
|
||||
#include "erpc_config_gen.h"
|
||||
#endif /* MCUXPRESSO_SDK */
|
||||
|
||||
//! @name Configuration options
|
||||
//@{
|
||||
|
||||
//! @def ERPC_ALLOCATION_POLICY
|
||||
//!
|
||||
//! @brief Choose which allocation policy should be used.
|
||||
//!
|
||||
//! Set ERPC_ALLOCATION_POLICY_DYNAMIC if dynamic allocations should be used.
|
||||
//! Set ERPC_ALLOCATION_POLICY_STATIC if static allocations should be used.
|
||||
//!
|
||||
//! Default value is ERPC_ALLOCATION_POLICY_DYNAMIC or in case of FreeRTOS it can be auto-detected if __has_include() is
|
||||
//! supported by compiler. Uncomment comment bellow to use static allocation policy. In case of static implementation
|
||||
//! user need consider another values to set (ERPC_CODEC_COUNT, ERPC_MESSAGE_LOGGERS_COUNT,
|
||||
//! ERPC_CLIENTS_THREADS_AMOUNT).
|
||||
#define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_DYNAMIC)
|
||||
|
||||
//! @def ERPC_CODEC_COUNT
|
||||
//!
|
||||
//! @brief Set amount of codecs objects used simultaneously in case of ERPC_ALLOCATION_POLICY is set to
|
||||
//! ERPC_ALLOCATION_POLICY_STATIC. For example if client or server is used in one thread then 1. If both are used in one
|
||||
//! thread per each then 2, ... Default value 2.
|
||||
#define ERPC_CODEC_COUNT (2U)
|
||||
|
||||
//! @def ERPC_MESSAGE_LOGGERS_COUNT
|
||||
//!
|
||||
//! @brief Set amount of message loggers objects used simultaneously in case of ERPC_ALLOCATION_POLICY is set to
|
||||
//! ERPC_ALLOCATION_POLICY_STATIC.
|
||||
//! For example if client or server is used in one thread then 1. If both are used in one thread per each then 2, ...
|
||||
//! For arbitrated client 1 is enough.
|
||||
//! Default value 0 (May not be used).
|
||||
// #define ERPC_MESSAGE_LOGGERS_COUNT (0U)
|
||||
|
||||
//! @def ERPC_CLIENTS_THREADS_AMOUNT
|
||||
//!
|
||||
//! @brief Set amount of client threads objects used in case of ERPC_ALLOCATION_POLICY is set to
|
||||
//! ERPC_ALLOCATION_POLICY_STATIC. Default value 1 (Most of current cases).
|
||||
// #define ERPC_CLIENTS_THREADS_AMOUNT (1U)
|
||||
|
||||
//! @def ERPC_THREADS
|
||||
//!
|
||||
//! @brief Select threading model.
|
||||
//!
|
||||
//! Set to one of the @c ERPC_THREADS_x macros to specify the threading model used by eRPC.
|
||||
//!
|
||||
//! Leave commented out to attempt to auto-detect. Auto-detection works well for pthreads.
|
||||
//! FreeRTOS can be detected when building with compilers that support __has_include().
|
||||
//! Otherwise, the default is no threading.
|
||||
#define ERPC_THREADS (ERPC_THREADS_PTHREADS)
|
||||
|
||||
//! @def ERPC_DEFAULT_BUFFER_SIZE
|
||||
//!
|
||||
//! Uncomment to change the size of buffers allocated by one of MessageBufferFactory.
|
||||
//! (@ref client_setup and @ref server_setup). The default size is set to 256.
|
||||
//! For RPMsg transport layer, ERPC_DEFAULT_BUFFER_SIZE must be 2^n - 16.
|
||||
#define ERPC_DEFAULT_BUFFER_SIZE (512U)
|
||||
|
||||
//! @def ERPC_DEFAULT_BUFFERS_COUNT
|
||||
//!
|
||||
//! Uncomment to change the count of buffers allocated by one of statically allocated messages.
|
||||
//! Default value is set to 2.
|
||||
//#define ERPC_DEFAULT_BUFFERS_COUNT (2U)
|
||||
|
||||
//! @def ERPC_NOEXCEPT
|
||||
//!
|
||||
//! @brief Disable/enable noexcept support.
|
||||
//!
|
||||
//! Uncomment for using noexcept feature.
|
||||
//#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_ENABLED)
|
||||
|
||||
//! @def ERPC_NESTED_CALLS
|
||||
//!
|
||||
//! Default set to ERPC_NESTED_CALLS_DISABLED. Uncomment when callbacks, or other eRPC
|
||||
//! functions are called from server implementation of another eRPC call. Nested functions
|
||||
//! need to be marked as @nested in IDL.
|
||||
//#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_ENABLED)
|
||||
|
||||
//! @def ERPC_NESTED_CALLS_DETECTION
|
||||
//!
|
||||
//! Default set to ERPC_NESTED_CALLS_DETECTION_ENABLED when NDEBUG macro is presented.
|
||||
//! This serve for locating nested calls in code. Nested calls are calls where inside eRPC function
|
||||
//! on server side is called another eRPC function (like callbacks). Code need be a bit changed
|
||||
//! to support nested calls. See ERPC_NESTED_CALLS macro.
|
||||
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_DISABLED)
|
||||
|
||||
//! @def ERPC_MESSAGE_LOGGING
|
||||
//!
|
||||
//! 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.
|
||||
//#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_ENABLED)
|
||||
|
||||
//! @def ERPC_TRANSPORT_MU_USE_MCMGR
|
||||
//!
|
||||
//! @brief MU transport layer configuration.
|
||||
//!
|
||||
//! Set to one of the @c ERPC_TRANSPORT_MU_USE_MCMGR_x macros to configure the MCMGR usage in MU transport layer.
|
||||
//!
|
||||
//! MU transport layer could leverage the Multicore Manager (MCMGR) component for Inter-Core
|
||||
//! interrupts / MU interrupts management or the Inter-Core interrupts can be managed by itself (MUX_IRQHandler
|
||||
//! overloading). By default, ERPC_TRANSPORT_MU_USE_MCMGR is set to ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED when mcmgr.h
|
||||
//! 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
|
||||
//! erpc_mu_transport.h for additional MU settings.
|
||||
#define ERPC_TRANSPORT_MU_USE_MCMGR ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED
|
||||
//@}
|
||||
|
||||
//! @def ERPC_PRE_POST_ACTION
|
||||
//!
|
||||
//! Enable eRPC pre and post callback functions shim code. Take look into "erpc_pre_post_action.h". Can be used for
|
||||
//! detection of eRPC call freeze, ... Default set to ERPC_PRE_POST_ACTION_DISABLED.
|
||||
//!
|
||||
//! Uncomment for using pre post callback feature.
|
||||
//#define ERPC_PRE_POST_ACTION (ERPC_PRE_POST_ACTION_ENABLED)
|
||||
|
||||
//! @def ERPC_PRE_POST_ACTION_DEFAULT
|
||||
//!
|
||||
//! Enable eRPC pre and post default callback functions. Take look into "erpc_setup_extensions.h". Can be used for
|
||||
//! detection of eRPC call freeze, ... Default set to ERPC_PRE_POST_ACTION_DEFAULT_DISABLED.
|
||||
//!
|
||||
//! Uncomment for using pre post default callback feature.
|
||||
//#define ERPC_PRE_POST_ACTION_DEFAULT (ERPC_PRE_POST_ACTION_DEFAULT_ENABLED)
|
||||
|
||||
//! @name Assert function definition
|
||||
//@{
|
||||
//! User custom asser defition. Include header file if needed before bellow line. If assert is not enabled, default will
|
||||
//! be used.
|
||||
// #define erpc_assert(condition)
|
||||
//@}
|
||||
|
||||
//! @def ENDIANES_HEADER
|
||||
//!
|
||||
//! Include header file that controls the communication endianness
|
||||
//!
|
||||
//! Uncomment for example behaviour for endianness agnostic with:
|
||||
//! 1. communication in little endian.
|
||||
//! 2. current processor is big endian.
|
||||
//! 3. pointer size is 32 bit.
|
||||
//! 4. float+double scheme not defined, so throws assert if passes.
|
||||
//! #define ERPC_PROCESSOR_ENDIANNESS_LITTLE 0
|
||||
//! #define ERPC_COMMUNICATION_LITTLE 1
|
||||
//! #define ERPC_POINTER_SIZE_16 0
|
||||
//! #define ERPC_POINTER_SIZE_32 1
|
||||
//! #define ERPC_POINTER_SIZE_64 0
|
||||
//! #define ENDIANNESS_HEADER "erpc_endianness_agnostic_example.h"
|
||||
|
||||
/*! @} */
|
||||
#endif // _ERPC_CONFIG_H_
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// EOF
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
79
packages/erpc-1.14.0/erpc_c/erpc_c_sources.cmake
vendored
Normal file
79
packages/erpc-1.14.0/erpc_c/erpc_c_sources.cmake
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
#
|
||||
# Copyright 2024 NXP
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
set(ERPC_C_INCLUDES
|
||||
${ERPC_C}/infra
|
||||
${ERPC_C}/port
|
||||
${ERPC_C}/service
|
||||
${ERPC_C}/setup
|
||||
${ERPC_C}/transports
|
||||
)
|
||||
|
||||
set(ERPC_C_HEADERS
|
||||
${ERPC_C}/config/erpc_config.h
|
||||
${ERPC_C}/infra/erpc_arbitrated_client_manager.hpp
|
||||
${ERPC_C}/infra/erpc_basic_codec.hpp
|
||||
${ERPC_C}/infra/erpc_client_manager.h
|
||||
${ERPC_C}/infra/erpc_codec.hpp
|
||||
${ERPC_C}/infra/erpc_crc16.hpp
|
||||
${ERPC_C}/infra/erpc_common.h
|
||||
${ERPC_C}/infra/erpc_version.h
|
||||
${ERPC_C}/infra/erpc_framed_transport.hpp
|
||||
${ERPC_C}/infra/erpc_manually_constructed.hpp
|
||||
${ERPC_C}/infra/erpc_message_buffer.hpp
|
||||
${ERPC_C}/infra/erpc_message_loggers.hpp
|
||||
${ERPC_C}/infra/erpc_server.hpp
|
||||
${ERPC_C}/infra/erpc_static_queue.hpp
|
||||
${ERPC_C}/infra/erpc_transport_arbitrator.hpp
|
||||
${ERPC_C}/infra/erpc_transport.hpp
|
||||
${ERPC_C}/infra/erpc_utils.hpp
|
||||
${ERPC_C}/infra/erpc_client_server_common.hpp
|
||||
${ERPC_C}/infra/erpc_pre_post_action.h
|
||||
${ERPC_C}/port/erpc_setup_extensions.h
|
||||
${ERPC_C}/port/erpc_config_internal.h
|
||||
${ERPC_C}/port/erpc_port.h
|
||||
${ERPC_C}/port/erpc_threading.h
|
||||
${ERPC_C}/port/erpc_serial.h
|
||||
${ERPC_C}/setup/erpc_arbitrated_client_setup.h
|
||||
${ERPC_C}/setup/erpc_client_setup.h
|
||||
${ERPC_C}/setup/erpc_mbf_setup.h
|
||||
${ERPC_C}/setup/erpc_server_setup.h
|
||||
${ERPC_C}/setup/erpc_transport_setup.h
|
||||
${ERPC_C}/transports/erpc_inter_thread_buffer_transport.hpp
|
||||
${ERPC_C}/transports/erpc_serial_transport.hpp
|
||||
${ERPC_C}/transports/erpc_tcp_transport.hpp
|
||||
)
|
||||
|
||||
set(ERPC_C_SOURCES
|
||||
${ERPC_C}/infra/erpc_arbitrated_client_manager.cpp
|
||||
${ERPC_C}/infra/erpc_basic_codec.cpp
|
||||
${ERPC_C}/infra/erpc_client_manager.cpp
|
||||
${ERPC_C}/infra/erpc_crc16.cpp
|
||||
${ERPC_C}/infra/erpc_framed_transport.cpp
|
||||
${ERPC_C}/infra/erpc_message_buffer.cpp
|
||||
${ERPC_C}/infra/erpc_message_loggers.cpp
|
||||
${ERPC_C}/infra/erpc_server.cpp
|
||||
${ERPC_C}/infra/erpc_simple_server.cpp
|
||||
${ERPC_C}/infra/erpc_transport_arbitrator.cpp
|
||||
${ERPC_C}/infra/erpc_utils.cpp
|
||||
${ERPC_C}/infra/erpc_pre_post_action.cpp
|
||||
|
||||
${ERPC_C}/port/erpc_port_stdlib.cpp
|
||||
${ERPC_C}/port/erpc_threading_pthreads.cpp
|
||||
${ERPC_C}/port/erpc_serial.cpp
|
||||
|
||||
${ERPC_C}/setup/erpc_arbitrated_client_setup.cpp
|
||||
${ERPC_C}/setup/erpc_client_setup.cpp
|
||||
${ERPC_C}/setup/erpc_setup_mbf_dynamic.cpp
|
||||
${ERPC_C}/setup/erpc_setup_mbf_static.cpp
|
||||
${ERPC_C}/setup/erpc_server_setup.cpp
|
||||
${ERPC_C}/setup/erpc_setup_serial.cpp
|
||||
${ERPC_C}/setup/erpc_setup_tcp.cpp
|
||||
|
||||
${ERPC_C}/transports/erpc_inter_thread_buffer_transport.cpp
|
||||
${ERPC_C}/transports/erpc_tcp_transport.cpp
|
||||
${ERPC_C}/transports/erpc_serial_transport.cpp
|
||||
)
|
||||
110
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.cpp
vendored
Normal file
110
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.cpp
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2020 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_arbitrated_client_manager.hpp"
|
||||
|
||||
#include "erpc_transport_arbitrator.hpp"
|
||||
|
||||
#if ERPC_THREADS_IS(NONE)
|
||||
#error "Arbitrator code does not work in no-threading configuration."
|
||||
#endif
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ERPC_NESTED_CALLS_DETECTION
|
||||
extern bool nestingDetection;
|
||||
#ifndef _WIN32
|
||||
#pragma weak nestingDetection
|
||||
bool nestingDetection = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void ArbitratedClientManager::setArbitrator(TransportArbitrator *arbitrator)
|
||||
{
|
||||
m_arbitrator = arbitrator;
|
||||
m_transport = arbitrator;
|
||||
}
|
||||
|
||||
void ArbitratedClientManager::performClientRequest(RequestContext &request)
|
||||
{
|
||||
erpc_status_t err;
|
||||
TransportArbitrator::client_token_t token = 0;
|
||||
|
||||
erpc_assert((m_arbitrator != NULL) && ("arbitrator not set" != NULL));
|
||||
|
||||
// Set up the client receive before we send the request, so if the reply is sent
|
||||
// before we get to the clientReceive() call below the arbitrator already has the buffer.
|
||||
if (!request.isOneway())
|
||||
{
|
||||
#if ERPC_NESTED_CALLS_DETECTION
|
||||
if (nestingDetection)
|
||||
{
|
||||
request.getCodec()->updateStatus(kErpcStatus_NestedCallFailure);
|
||||
}
|
||||
#endif
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
token = m_arbitrator->prepareClientReceive(request);
|
||||
if (token == 0U)
|
||||
{
|
||||
request.getCodec()->updateStatus(kErpcStatus_Fail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = logMessage(request.getCodec()->getBuffer());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Send the request.
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = m_arbitrator->send(&request.getCodec()->getBufferRef());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
|
||||
if (!request.isOneway())
|
||||
{
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
// Complete the receive through the arbitrator.
|
||||
err = m_arbitrator->clientReceive(token);
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
|
||||
if (token != 0)
|
||||
{
|
||||
// Also if status bad, need to free the token.
|
||||
m_arbitrator->removePendingClient(token);
|
||||
}
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = logMessage(request.getCodec()->getBuffer());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
// Check the reply.
|
||||
verifyReply(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
85
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.hpp
vendored
Normal file
85
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.hpp
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__ARBITRATED_CLIENT_MANAGER_H_
|
||||
#define _EMBEDDED_RPC__ARBITRATED_CLIENT_MANAGER_H_
|
||||
|
||||
#include "erpc_client_manager.h"
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_client
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
class TransportArbitrator;
|
||||
|
||||
/*!
|
||||
* @brief Client that can share a transport with a server.
|
||||
*
|
||||
* This class is a special subclass of ClientManager that works with the TransportArbitrator
|
||||
* to share a single transport with a Server. This enables, for instance, a single UART to
|
||||
* be used for bidirectional remote function invocations and replies.
|
||||
*
|
||||
* The setTransport() method used on ClientManager is not used with this class. Instead, there
|
||||
* is a setArbitrator() method. The underlying transport that is shared is set on the arbitrator.
|
||||
*
|
||||
* @ingroup infra_client
|
||||
*/
|
||||
class ArbitratedClientManager : public ClientManager
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
ArbitratedClientManager(void) : ClientManager(), m_arbitrator(NULL) {}
|
||||
|
||||
/*!
|
||||
* @brief Sets the transport arbitrator instance.
|
||||
*
|
||||
* @param[in] arbitrator Transport arbitrator to use.
|
||||
*/
|
||||
void setArbitrator(TransportArbitrator *arbitrator);
|
||||
|
||||
/*!
|
||||
* @brief Gets the transport arbitrator instance.
|
||||
*
|
||||
* @return TransportArbitrator * Transport arbitrator instance.
|
||||
*/
|
||||
TransportArbitrator *getArbitrator(void) { return m_arbitrator; };
|
||||
|
||||
protected:
|
||||
TransportArbitrator *m_arbitrator; //!< Optional transport arbitrator. May be NULL.
|
||||
|
||||
/*!
|
||||
* @brief This function performs request.
|
||||
*
|
||||
* Should be called in non server context (do not call another eRPC function in server
|
||||
* remote call implementation).
|
||||
*
|
||||
* @param[in] request Request context to perform.
|
||||
*/
|
||||
virtual void performClientRequest(RequestContext &request) override;
|
||||
|
||||
//! @brief This method is not used with this class.
|
||||
void setTransport(Transport *transport) { (void)transport; }
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__ARBITRATED_CLIENT_MANAGER_H_
|
||||
386
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.cpp
vendored
Normal file
386
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.cpp
vendored
Normal file
@ -0,0 +1,386 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_basic_codec.hpp"
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
#include ENDIANNESS_HEADER
|
||||
#include "erpc_manually_constructed.hpp"
|
||||
|
||||
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||
#include <new>
|
||||
#endif
|
||||
#include <cassert>
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const uint32_t BasicCodec::kBasicCodecVersion = 1UL;
|
||||
|
||||
BasicCodec::BasicCodec(void) : Codec() {}
|
||||
|
||||
BasicCodec::~BasicCodec(void) {}
|
||||
|
||||
void BasicCodec::startWriteMessage(message_type_t type, uint32_t service, uint32_t request, uint32_t sequence)
|
||||
{
|
||||
uint32_t header =
|
||||
(kBasicCodecVersion << 24u) | ((service & 0xffu) << 16u) | ((request & 0xffu) << 8u) | ((uint32_t)type & 0xffu);
|
||||
|
||||
write(header);
|
||||
|
||||
write(sequence);
|
||||
}
|
||||
|
||||
void BasicCodec::writeData(uint32_t length, const void *value)
|
||||
{
|
||||
if (isStatusOk())
|
||||
{
|
||||
m_status = m_cursor.write(value, length);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::write(bool value)
|
||||
{
|
||||
// Make sure the bool is a single byte.
|
||||
uint8_t v = (uint8_t)value;
|
||||
|
||||
writeData(sizeof(v), &v);
|
||||
}
|
||||
|
||||
void BasicCodec::write(int8_t value)
|
||||
{
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(int16_t value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_16(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(int32_t value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_32(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(int64_t value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_64(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(uint8_t value)
|
||||
{
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(uint16_t value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_16(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(uint32_t value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_32(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(uint64_t value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_64(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(float value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_FLOAT(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::write(double value)
|
||||
{
|
||||
ERPC_WRITE_AGNOSTIC_DOUBLE(value);
|
||||
|
||||
writeData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::writePtr(uintptr_t value)
|
||||
{
|
||||
uint8_t ptrSize = (uint8_t)sizeof(value);
|
||||
|
||||
write(ptrSize);
|
||||
|
||||
ERPC_WRITE_AGNOSTIC_PTR(value);
|
||||
|
||||
writeData(ptrSize, &value);
|
||||
}
|
||||
|
||||
void BasicCodec::writeString(uint32_t length, const char *value)
|
||||
{
|
||||
// Just treat the string as binary.
|
||||
writeBinary(length, reinterpret_cast<const uint8_t *>(value));
|
||||
}
|
||||
|
||||
void BasicCodec::writeBinary(uint32_t length, const uint8_t *value)
|
||||
{
|
||||
// Write the blob length as a u32.
|
||||
write(length);
|
||||
|
||||
writeData(length, value);
|
||||
}
|
||||
|
||||
void BasicCodec::startWriteList(uint32_t length)
|
||||
{
|
||||
// Write the list length as a u32.
|
||||
write(length);
|
||||
}
|
||||
|
||||
void BasicCodec::startWriteUnion(int32_t discriminator)
|
||||
{
|
||||
// Write the union discriminator as a u32.
|
||||
write(discriminator);
|
||||
}
|
||||
|
||||
void BasicCodec::writeNullFlag(bool isNull)
|
||||
{
|
||||
write(static_cast<uint8_t>(isNull ? null_flag_t::kIsNull : null_flag_t::kNotNull));
|
||||
}
|
||||
|
||||
void BasicCodec::startReadMessage(message_type_t &type, uint32_t &service, uint32_t &request, uint32_t &sequence)
|
||||
{
|
||||
uint32_t header;
|
||||
|
||||
read(header);
|
||||
|
||||
if (((header >> 24) & 0xffU) != kBasicCodecVersion)
|
||||
{
|
||||
updateStatus(kErpcStatus_InvalidMessageVersion);
|
||||
}
|
||||
|
||||
if (isStatusOk())
|
||||
{
|
||||
service = ((header >> 16) & 0xffU);
|
||||
request = ((header >> 8) & 0xffU);
|
||||
type = static_cast<message_type_t>(header & 0xffU);
|
||||
|
||||
read(sequence);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::readData(uint32_t length, void *value)
|
||||
{
|
||||
if (isStatusOk())
|
||||
{
|
||||
m_status = m_cursor.read(value, length);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(bool &value)
|
||||
{
|
||||
uint8_t v = 0;
|
||||
|
||||
readData(sizeof(v), &v);
|
||||
if (isStatusOk())
|
||||
{
|
||||
value = (bool)v;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(int8_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::read(int16_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_16(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(int32_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_32(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(int64_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_64(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(uint8_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
}
|
||||
|
||||
void BasicCodec::read(uint16_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_16(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(uint32_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_32(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(uint64_t &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_64(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(float &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_FLOAT(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::read(double &value)
|
||||
{
|
||||
readData(sizeof(value), &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_DOUBLE(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::readPtr(uintptr_t &value)
|
||||
{
|
||||
uint8_t ptrSize;
|
||||
|
||||
read(ptrSize);
|
||||
|
||||
if (ptrSize > sizeof(value))
|
||||
{
|
||||
updateStatus(kErpcStatus_BadAddressScale);
|
||||
}
|
||||
|
||||
readData(ptrSize, &value);
|
||||
if (isStatusOk())
|
||||
{
|
||||
ERPC_READ_AGNOSTIC_PTR(*value);
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::readString(uint32_t &length, char **value)
|
||||
{
|
||||
readBinary(length, reinterpret_cast<uint8_t **>(value));
|
||||
}
|
||||
|
||||
void BasicCodec::readBinary(uint32_t &length, uint8_t **value)
|
||||
{
|
||||
// Read length first as u32.
|
||||
read(length);
|
||||
|
||||
if (isStatusOk())
|
||||
{
|
||||
if (m_cursor.getRemainingUsed() < length)
|
||||
{
|
||||
m_status = kErpcStatus_Fail;
|
||||
}
|
||||
else if (m_cursor.getRemaining() < length)
|
||||
{
|
||||
m_status = kErpcStatus_BufferOverrun;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return current pointer into buffer.
|
||||
*value = m_cursor.get();
|
||||
|
||||
// Skip over data.
|
||||
m_cursor += (uint16_t)length;
|
||||
}
|
||||
}
|
||||
if (!isStatusOk())
|
||||
{
|
||||
length = 0;
|
||||
*value = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::startReadList(uint32_t &length)
|
||||
{
|
||||
// Read list length as u32.
|
||||
read(length);
|
||||
|
||||
if (!isStatusOk())
|
||||
{
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicCodec::startReadUnion(int32_t &discriminator)
|
||||
{
|
||||
// Read union discriminator as u32.
|
||||
read(discriminator);
|
||||
}
|
||||
|
||||
void BasicCodec::readNullFlag(bool &isNull)
|
||||
{
|
||||
uint8_t flag;
|
||||
|
||||
read(flag);
|
||||
if (isStatusOk())
|
||||
{
|
||||
isNull = (flag == static_cast<uint8_t>(null_flag_t::kIsNull));
|
||||
}
|
||||
}
|
||||
|
||||
ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(BasicCodec, s_basicCodecManual, ERPC_CODEC_COUNT);
|
||||
|
||||
BasicCodecFactory::BasicCodecFactory(void) : CodecFactory() {}
|
||||
|
||||
BasicCodecFactory::~BasicCodecFactory(void) {}
|
||||
|
||||
Codec *BasicCodecFactory::create(void)
|
||||
{
|
||||
ERPC_CREATE_NEW_OBJECT(BasicCodec, s_basicCodecManual, ERPC_CODEC_COUNT)
|
||||
}
|
||||
|
||||
void BasicCodecFactory::dispose(Codec *codec)
|
||||
{
|
||||
ERPC_DESTROY_OBJECT(codec, s_basicCodecManual, ERPC_CODEC_COUNT)
|
||||
}
|
||||
381
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.hpp
vendored
Normal file
381
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.hpp
vendored
Normal file
@ -0,0 +1,381 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__BASIC_SERIALIZATION_H_
|
||||
#define _EMBEDDED_RPC__BASIC_SERIALIZATION_H_
|
||||
|
||||
#include "erpc_codec.hpp"
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_codec
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
/*!
|
||||
* @brief Values of the uint8 flag prefixing nullable values.
|
||||
*/
|
||||
enum class null_flag_t
|
||||
{
|
||||
kNotNull = 0,
|
||||
kIsNull
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Simple binary serialization format.
|
||||
*
|
||||
* @ingroup infra_codec
|
||||
*/
|
||||
class BasicCodec : public Codec
|
||||
{
|
||||
public:
|
||||
static const uint32_t kBasicCodecVersion; /*!< Codec version. */
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
BasicCodec(void);
|
||||
|
||||
/*!
|
||||
* @brief CodecFactory destructor
|
||||
*/
|
||||
virtual ~BasicCodec(void);
|
||||
|
||||
//! @name Encoding
|
||||
//@{
|
||||
/*!
|
||||
* @brief Prototype for write header of message.
|
||||
*
|
||||
* @param[in] type Type of message.
|
||||
* @param[in] service Which interface is requested.
|
||||
* @param[in] request Which function need be called.
|
||||
* @param[in] sequence Send sequence number to be sure that
|
||||
* received message is reply for current request. or write function.
|
||||
*/
|
||||
virtual void startWriteMessage(message_type_t type, uint32_t service, uint32_t request, uint32_t sequence) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write data stream.
|
||||
*
|
||||
* @param[in] length Size of data stream in bytes.
|
||||
* @param[in] value Pointer to data stream.
|
||||
*/
|
||||
virtual void writeData(uint32_t length, const void *value);
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write boolean value.
|
||||
*
|
||||
* @param[in] value Boolean typed value to write.
|
||||
*/
|
||||
virtual void write(bool value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int8_t value.
|
||||
*
|
||||
* @param[in] value int8_t typed value to write.
|
||||
*/
|
||||
virtual void write(int8_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int16_t value.
|
||||
*
|
||||
* @param[in] value int16_t typed value to write.
|
||||
*/
|
||||
virtual void write(int16_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int32_t value.
|
||||
*
|
||||
* @param[in] value int32_t typed value to write.
|
||||
*/
|
||||
virtual void write(int32_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int64_t value.
|
||||
*
|
||||
* @param[in] value int64_t typed value to write.
|
||||
*/
|
||||
virtual void write(int64_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint8_t value.
|
||||
*
|
||||
* @param[in] value uint8_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint8_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint16_t value.
|
||||
*
|
||||
* @param[in] value uint16_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint16_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint32_t value.
|
||||
*
|
||||
* @param[in] value uint32_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint32_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint64_t value.
|
||||
*
|
||||
* @param[in] value uint64_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint64_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write float value.
|
||||
*
|
||||
* @param[in] value float typed value to write.
|
||||
*/
|
||||
virtual void write(float value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write double value.
|
||||
*
|
||||
* @param[in] value double typed value to write.
|
||||
*/
|
||||
virtual void write(double value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uintptr value.
|
||||
*
|
||||
* @param[in] value uintptr typed value to write.
|
||||
*/
|
||||
virtual void writePtr(uintptr_t value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write string value.
|
||||
*
|
||||
* @param[in] length of string.
|
||||
* @param[in] value string value to write.
|
||||
*/
|
||||
virtual void writeString(uint32_t length, const char *value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write binary value.
|
||||
*
|
||||
* @param[in] length of binary.
|
||||
* @param[in] value Binary value to write.
|
||||
*/
|
||||
virtual void writeBinary(uint32_t length, const uint8_t *value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start write list.
|
||||
*
|
||||
* @param[in] length Length of list.
|
||||
*/
|
||||
virtual void startWriteList(uint32_t length) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start write union.
|
||||
*
|
||||
* @param[in] discriminator Discriminator of union.
|
||||
*/
|
||||
virtual void startWriteUnion(int32_t discriminator) override;
|
||||
|
||||
/*!
|
||||
* @brief Writes a flag indicating whether the next value is null.
|
||||
*
|
||||
* @param[in] isNull Null flag to send.
|
||||
*/
|
||||
virtual void writeNullFlag(bool isNull) override;
|
||||
//@}
|
||||
|
||||
//! @name Decoding
|
||||
//@{
|
||||
/*!
|
||||
* @brief Prototype for read header of message.
|
||||
*
|
||||
* @param[out] type Type of message.
|
||||
* @param[out] service Which interface was used.
|
||||
* @param[out] request Which function was called.
|
||||
* @param[out] sequence Returned sequence number to be sure that
|
||||
* received message is reply for current request.
|
||||
*/
|
||||
virtual void startReadMessage(message_type_t &type, uint32_t &service, uint32_t &request,
|
||||
uint32_t &sequence) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read data stream.
|
||||
*
|
||||
* @param[in] length Size of data stream in bytes to be read.
|
||||
* @param[in] value Pointer to data stream to be read.
|
||||
*/
|
||||
virtual void readData(uint32_t length, void *value);
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read boolean value.
|
||||
*
|
||||
* @param[out] value Boolean typed value to read.
|
||||
*/
|
||||
virtual void read(bool &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int8_t value.
|
||||
*
|
||||
* @param[out] value int8_t typed value to read.
|
||||
*/
|
||||
virtual void read(int8_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int16_t value.
|
||||
*
|
||||
* @param[out] value int16_t typed value to read.
|
||||
*/
|
||||
virtual void read(int16_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int32_t value.
|
||||
*
|
||||
* @param[out] value int32_t typed value to read.
|
||||
*/
|
||||
virtual void read(int32_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int64_t value.
|
||||
*
|
||||
* @param[out] value int64_t typed value to read.
|
||||
*/
|
||||
virtual void read(int64_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint8_t value.
|
||||
*
|
||||
* @param[out] value uint8_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint8_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint16_t value.
|
||||
*
|
||||
* @param[out] value uint16_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint16_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint32_t value.
|
||||
*
|
||||
* @param[out] value uint32_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint32_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint64_t value.
|
||||
*
|
||||
* @param[out] value uint64_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint64_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read float value.
|
||||
*
|
||||
* @param[out] value float typed value to read.
|
||||
*/
|
||||
virtual void read(float &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read double value.
|
||||
*
|
||||
* @param[out] value double typed value to read.
|
||||
*/
|
||||
virtual void read(double &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uintptr value.
|
||||
*
|
||||
* @param[out] value uintptr typed value to read.
|
||||
*/
|
||||
virtual void readPtr(uintptr_t &value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read string value.
|
||||
*
|
||||
* @param[out] length of string.
|
||||
* @param[out] value String value to read.
|
||||
*/
|
||||
virtual void readString(uint32_t &length, char **value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read binary value.
|
||||
*
|
||||
* @param[out] length of binary. 0 can be valid value or in case of error.
|
||||
* @param[out] value Binary value to read. Null in case of error.
|
||||
*/
|
||||
virtual void readBinary(uint32_t &length, uint8_t **value) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start read list.
|
||||
*
|
||||
* @param[out] length Length of list.
|
||||
*/
|
||||
virtual void startReadList(uint32_t &length) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start read union.
|
||||
*
|
||||
* @param[in] discriminator Discriminator of union.
|
||||
*/
|
||||
virtual void startReadUnion(int32_t &discriminator) override;
|
||||
|
||||
/*!
|
||||
* @brief Reads a flag indicating whether the next value is null.
|
||||
*
|
||||
* @param[in] isNull Null flag to read.
|
||||
*/
|
||||
virtual void readNullFlag(bool &isNull) override;
|
||||
//@}
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Basic codec factory implements functions from codec factory.
|
||||
*
|
||||
* @ingroup infra_codec
|
||||
*/
|
||||
class BasicCodecFactory : public CodecFactory
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
BasicCodecFactory(void);
|
||||
|
||||
/*!
|
||||
* @brief CodecFactory destructor
|
||||
*/
|
||||
virtual ~BasicCodecFactory(void);
|
||||
|
||||
/*!
|
||||
* @brief Return created codec.
|
||||
*
|
||||
* @return Pointer to created codec.
|
||||
*/
|
||||
virtual Codec *create(void) override;
|
||||
|
||||
/*!
|
||||
* @brief Dispose codec.
|
||||
*
|
||||
* @param[in] codec Codec to dispose.
|
||||
*/
|
||||
virtual void dispose(Codec *codec) override;
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__BASIC_SERIALIZATION_H_
|
||||
228
packages/erpc-1.14.0/erpc_c/infra/erpc_client_manager.cpp
vendored
Normal file
228
packages/erpc-1.14.0/erpc_c/infra/erpc_client_manager.cpp
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_client_manager.h"
|
||||
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ERPC_NESTED_CALLS_DETECTION
|
||||
extern bool nestingDetection;
|
||||
#ifndef _WIN32
|
||||
#pragma weak nestingDetection
|
||||
bool nestingDetection = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
RequestContext ClientManager::createRequest(bool isOneway)
|
||||
{
|
||||
// Create codec to read and write the request.
|
||||
Codec *codec = createBufferAndCodec();
|
||||
|
||||
return RequestContext(++m_sequence, codec, isOneway);
|
||||
}
|
||||
|
||||
void ClientManager::performRequest(RequestContext &request)
|
||||
{
|
||||
bool performRequest;
|
||||
|
||||
// Check the codec status
|
||||
performRequest = request.getCodec()->isStatusOk();
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
if (performRequest)
|
||||
{
|
||||
erpc_assert((m_serverThreadId != NULL) && ("server thread id was not set" != NULL));
|
||||
if (Thread::getCurrentThreadId() == m_serverThreadId)
|
||||
{
|
||||
performNestedClientRequest(request);
|
||||
performRequest = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (performRequest)
|
||||
{
|
||||
|
||||
performClientRequest(request);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ClientManager::performClientRequest(RequestContext &request)
|
||||
{
|
||||
erpc_status_t err;
|
||||
|
||||
#if ERPC_NESTED_CALLS_DETECTION
|
||||
if (!request.isOneway() && nestingDetection)
|
||||
{
|
||||
request.getCodec()->updateStatus(kErpcStatus_NestedCallFailure);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = logMessage(request.getCodec()->getBuffer());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Send invocation request to server.
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
|
||||
err = m_transport->send(&request.getCodec()->getBufferRef());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
|
||||
// If the request is oneway, then there is nothing more to do.
|
||||
if (!request.isOneway())
|
||||
{
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
// Receive reply.
|
||||
err = m_transport->receive(&request.getCodec()->getBufferRef());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = logMessage(request.getCodec()->getBuffer());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check the reply.
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
verifyReply(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
void ClientManager::performNestedClientRequest(RequestContext &request)
|
||||
{
|
||||
erpc_status_t err;
|
||||
|
||||
erpc_assert((m_transport != NULL) && ("transport/arbitrator not set" != NULL));
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = logMessage(request.getCodec()->getBuffer());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Send invocation request to server.
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = m_transport->send(&request.getCodec()->getBufferRef());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
|
||||
// If the request is oneway, then there is nothing more to do.
|
||||
if (!request.isOneway())
|
||||
{
|
||||
// Receive reply.
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
erpc_assert((m_server != NULL) && ("server for nesting calls was not set" != NULL));
|
||||
err = m_server->run(request);
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
err = logMessage(request.getCodec()->getBuffer());
|
||||
request.getCodec()->updateStatus(err);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check the reply.
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
verifyReply(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ClientManager::verifyReply(RequestContext &request)
|
||||
{
|
||||
message_type_t msgType;
|
||||
uint32_t service;
|
||||
uint32_t requestNumber;
|
||||
uint32_t sequence;
|
||||
|
||||
// Some transport layers change the request's message buffer pointer (for things like zero
|
||||
// copy support), so inCodec must be reset to work with correct buffer.
|
||||
request.getCodec()->reset(m_transport->reserveHeaderSize());
|
||||
|
||||
// Extract the reply header.
|
||||
request.getCodec()->startReadMessage(msgType, service, requestNumber, sequence);
|
||||
|
||||
if (request.getCodec()->isStatusOk() == true)
|
||||
{
|
||||
// Verify that this is a reply to the request we just sent.
|
||||
if ((msgType != message_type_t::kReplyMessage) || (sequence != request.getSequence()))
|
||||
{
|
||||
request.getCodec()->updateStatus(kErpcStatus_ExpectedReply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Codec *ClientManager::createBufferAndCodec(void)
|
||||
{
|
||||
Codec *codec = m_codecFactory->create();
|
||||
MessageBuffer message;
|
||||
uint8_t reservedMessageSpace = m_transport->reserveHeaderSize();
|
||||
|
||||
if (codec != NULL)
|
||||
{
|
||||
message = m_messageFactory->create(reservedMessageSpace);
|
||||
if (NULL != message.get())
|
||||
{
|
||||
codec->setBuffer(message, reservedMessageSpace);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Dispose of buffers and codecs.
|
||||
m_codecFactory->dispose(codec);
|
||||
codec = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return codec;
|
||||
}
|
||||
|
||||
void ClientManager::releaseRequest(RequestContext &request)
|
||||
{
|
||||
if (request.getCodec() != NULL)
|
||||
{
|
||||
m_messageFactory->dispose(&request.getCodec()->getBufferRef());
|
||||
m_codecFactory->dispose(request.getCodec());
|
||||
}
|
||||
}
|
||||
|
||||
void ClientManager::callErrorHandler(erpc_status_t err, uint32_t functionID)
|
||||
{
|
||||
if (m_errorHandler != NULL)
|
||||
{
|
||||
m_errorHandler(err, functionID);
|
||||
}
|
||||
}
|
||||
241
packages/erpc-1.14.0/erpc_c/infra/erpc_client_manager.h
vendored
Normal file
241
packages/erpc-1.14.0/erpc_c/infra/erpc_client_manager.h
vendored
Normal file
@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* Copyright 2020-2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__CLIENT_MANAGER_H_
|
||||
#define _EMBEDDED_RPC__CLIENT_MANAGER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "erpc_client_server_common.hpp"
|
||||
#if ERPC_NESTED_CALLS
|
||||
#include "erpc_server.hpp"
|
||||
#include "erpc_threading.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_client
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#else
|
||||
#include "erpc_common.h"
|
||||
#endif
|
||||
|
||||
typedef void (*client_error_handler_t)(erpc_status_t err,
|
||||
uint32_t functionID); /*!< eRPC error handler function type. */
|
||||
|
||||
//! @brief Opaque client object type.
|
||||
typedef struct ClientType *erpc_client_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
class RequestContext;
|
||||
#if ERPC_NESTED_CALLS
|
||||
class Server;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief Base client implementation.
|
||||
*
|
||||
* @ingroup infra_client
|
||||
*/
|
||||
class ClientManager : public ClientServerCommon
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
ClientManager(void) :
|
||||
ClientServerCommon(), m_sequence(0), m_errorHandler(NULL)
|
||||
#if ERPC_NESTED_CALLS
|
||||
,
|
||||
m_server(NULL), m_serverThreadId(NULL)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief ClientManager destructor
|
||||
*/
|
||||
virtual ~ClientManager(void) {}
|
||||
|
||||
/*!
|
||||
* @brief This function creates request context.
|
||||
*
|
||||
* @param[in] isOneway True if need send data only, else false.
|
||||
*/
|
||||
virtual RequestContext createRequest(bool isOneway);
|
||||
|
||||
/*!
|
||||
* @brief This function performs request.
|
||||
*
|
||||
* @param[in] request Request context to perform.
|
||||
*/
|
||||
virtual void performRequest(RequestContext &request);
|
||||
|
||||
/*!
|
||||
* @brief This function releases request context.
|
||||
*
|
||||
* @param[in] request Request context to release.
|
||||
*/
|
||||
virtual void releaseRequest(RequestContext &request);
|
||||
|
||||
/*!
|
||||
* @brief This function sets error handler function for infrastructure errors.
|
||||
*
|
||||
* @param[in] error_handler Pointer to error handler function.
|
||||
*/
|
||||
void setErrorHandler(client_error_handler_t error_handler) { m_errorHandler = error_handler; }
|
||||
|
||||
/*!
|
||||
* @brief This function calls error handler callback function with given status.
|
||||
*
|
||||
* Function is called in client shim code at the end of function when error occurred.
|
||||
*
|
||||
* @param[in] err Specify function status at the end of eRPC call.
|
||||
* @param[in] functionID Specify eRPC function call.
|
||||
*/
|
||||
void callErrorHandler(erpc_status_t err, uint32_t functionID);
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
/*!
|
||||
* @brief This function sets server used for nested calls.
|
||||
*
|
||||
* @param[in] server Server used for nested calls.
|
||||
*/
|
||||
void setServer(Server *server) { m_server = server; }
|
||||
|
||||
/*!
|
||||
* @brief This function sets server thread id.
|
||||
*
|
||||
* @param[in] serverThreadId Id of thread where server run function is executed.
|
||||
*/
|
||||
void setServerThreadId(Thread::thread_id_t serverThreadId) { m_serverThreadId = serverThreadId; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
uint32_t m_sequence; //!< Sequence number.
|
||||
client_error_handler_t m_errorHandler; //!< Pointer to function error handler.
|
||||
#if ERPC_NESTED_CALLS
|
||||
Server *m_server; //!< Server used for nested calls.
|
||||
Thread::thread_id_t m_serverThreadId; //!< Thread in which server run function is called.
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief This function performs request.
|
||||
*
|
||||
* Should be called in non server context (do not call another eRPC function in server
|
||||
* remote call implementation).
|
||||
*
|
||||
* @param[in] request Request context to perform.
|
||||
*/
|
||||
virtual void performClientRequest(RequestContext &request);
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
/*!
|
||||
* @brief This function performs nested request.
|
||||
*
|
||||
* Used when from eRPC function server implementation context is called new eRPC function.
|
||||
*
|
||||
* @param[in] request Request context to perform.
|
||||
*/
|
||||
virtual void performNestedClientRequest(RequestContext &request);
|
||||
#endif
|
||||
|
||||
//! @brief Validate that an incoming message is a reply.
|
||||
virtual void verifyReply(RequestContext &request);
|
||||
|
||||
/*!
|
||||
* @brief Create message buffer and codec.
|
||||
*
|
||||
* The new codec is set to use the new message buffer. Both codec and buffer are allocated
|
||||
* with the relevant factories.
|
||||
*
|
||||
* @return Pointer to created codec with message buffer.
|
||||
*/
|
||||
Codec *createBufferAndCodec(void);
|
||||
|
||||
private:
|
||||
ClientManager(const ClientManager &other); //!< Disable copy ctor.
|
||||
ClientManager &operator=(const ClientManager &other); //!< Disable copy ctor.
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Encapsulates all information about a request.
|
||||
*
|
||||
* @ingroup infra_client
|
||||
*/
|
||||
class RequestContext
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function sets request context attributes.
|
||||
*
|
||||
* @param[in] sequence Sequence number.
|
||||
* @param[in] codec Set in inout codec.
|
||||
* @param[in] isOneway Set information if codec is only oneway or bidirectional.
|
||||
*/
|
||||
RequestContext(uint32_t sequence, Codec *codec, bool argIsOneway) :
|
||||
m_sequence(sequence), m_codec(codec), m_oneway(argIsOneway)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Get inout codec (for writing).
|
||||
*
|
||||
* @return Inout codec.
|
||||
*/
|
||||
Codec *getCodec(void) { return m_codec; }
|
||||
|
||||
/*!
|
||||
* @brief Get sequence number (be sure that reply belong to current request).
|
||||
*
|
||||
* @return Sequence number.
|
||||
*/
|
||||
uint32_t getSequence(void) const { return m_sequence; }
|
||||
|
||||
/*!
|
||||
* @brief Returns information if request context is oneway or not.
|
||||
*
|
||||
* @retval True when request context is oneway direction, else false.
|
||||
*/
|
||||
bool isOneway(void) const { return m_oneway; }
|
||||
|
||||
/*!
|
||||
* @brief Set request context to be oneway type (only send data).
|
||||
*
|
||||
* @return Set request context to be oneway.
|
||||
*/
|
||||
void setIsOneway(bool oneway) { m_oneway = oneway; }
|
||||
|
||||
protected:
|
||||
uint32_t m_sequence; //!< Sequence number. To be sure that reply belong to current request.
|
||||
Codec *m_codec; //!< Inout codec. Codec for receiving and sending data.
|
||||
bool m_oneway; //!< When true, request context will be oneway type (only send data).
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _EMBEDDED_RPC__CLIENT_MANAGER_H_
|
||||
145
packages/erpc-1.14.0/erpc_c/infra/erpc_client_server_common.hpp
vendored
Normal file
145
packages/erpc-1.14.0/erpc_c/infra/erpc_client_server_common.hpp
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright 2020 NXP
|
||||
* Copyright 2020 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__CLIENTSERVERCOMMON_H_
|
||||
#define _EMBEDDED_RPC__CLIENTSERVERCOMMON_H_
|
||||
|
||||
#include "erpc_codec.hpp"
|
||||
#include "erpc_config_internal.h"
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
#include "erpc_message_loggers.hpp"
|
||||
#endif
|
||||
#if ERPC_PRE_POST_ACTION
|
||||
#include "erpc_pre_post_action.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
|
||||
/*!
|
||||
* @brief Common class inherited by client and server class.
|
||||
*
|
||||
* @ingroup infra_utility
|
||||
*/
|
||||
class ClientServerCommon
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
#ifdef ERPC_OTHER_INHERITANCE
|
||||
,
|
||||
#else
|
||||
#define ERPC_OTHER_INHERITANCE 1
|
||||
:
|
||||
#endif
|
||||
public MessageLoggers
|
||||
#endif
|
||||
#if ERPC_PRE_POST_ACTION
|
||||
#ifdef ERPC_OTHER_INHERITANCE
|
||||
,
|
||||
#else
|
||||
#define ERPC_OTHER_INHERITANCE 1
|
||||
:
|
||||
#endif
|
||||
public PrePostAction
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief ClientServerCommon constructor.
|
||||
*/
|
||||
ClientServerCommon(void)
|
||||
#ifdef ERPC_OTHER_INHERITANCE
|
||||
#undef ERPC_OTHER_INHERITANCE
|
||||
#endif
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
#ifdef ERPC_OTHER_INHERITANCE
|
||||
,
|
||||
#else
|
||||
#define ERPC_OTHER_INHERITANCE 1
|
||||
:
|
||||
#endif
|
||||
MessageLoggers()
|
||||
#endif
|
||||
#if ERPC_PRE_POST_ACTION
|
||||
#ifdef ERPC_OTHER_INHERITANCE
|
||||
,
|
||||
#else
|
||||
#define ERPC_OTHER_INHERITANCE 1
|
||||
:
|
||||
#endif
|
||||
PrePostAction()
|
||||
#endif
|
||||
#ifdef ERPC_OTHER_INHERITANCE
|
||||
,
|
||||
#else
|
||||
#define ERPC_OTHER_INHERITANCE 1
|
||||
:
|
||||
#endif
|
||||
m_messageFactory(NULL), m_codecFactory(NULL), m_transport(NULL){};
|
||||
|
||||
/*!
|
||||
* @brief ClientServerCommon destructor
|
||||
*/
|
||||
~ClientServerCommon(void){};
|
||||
|
||||
/*!
|
||||
* @brief This function sets message buffer factory to use.
|
||||
*
|
||||
* @param[in] factory Message buffer factory to use.
|
||||
*/
|
||||
void setMessageBufferFactory(MessageBufferFactory * factory) { m_messageFactory = factory; }
|
||||
|
||||
/*!
|
||||
* @brief This function sets codec factory to use.
|
||||
*
|
||||
* @param[in] factory Codec factory to use.
|
||||
*/
|
||||
void setCodecFactory(CodecFactory * factory) { m_codecFactory = factory; }
|
||||
|
||||
/*!
|
||||
* @brief This function sets codec factory to use.
|
||||
*
|
||||
* @return CodecFactory * Codec factory to use.
|
||||
*/
|
||||
CodecFactory *getCodecFactory(void) { return m_codecFactory; }
|
||||
|
||||
/*!
|
||||
* @brief This function sets transport layer to use.
|
||||
*
|
||||
* It also set messageBufferFactory to the same as in transport layer.
|
||||
*
|
||||
* @param[in] transport Transport layer to use.
|
||||
*/
|
||||
void setTransport(Transport * transport) { m_transport = transport; }
|
||||
|
||||
/*!
|
||||
* @brief This function gets transport instance.
|
||||
*
|
||||
* @return Transport * Pointer to transport instance.
|
||||
*/
|
||||
Transport *getTransport(void) { return m_transport; }
|
||||
|
||||
protected:
|
||||
MessageBufferFactory *m_messageFactory; //!< Message buffer factory to use.
|
||||
CodecFactory *m_codecFactory; //!< Codec to use.
|
||||
Transport *m_transport; //!< Transport layer to use.
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__CLIENTSERVERCOMMON_H_
|
||||
440
packages/erpc-1.14.0/erpc_c/infra/erpc_codec.hpp
vendored
Normal file
440
packages/erpc-1.14.0/erpc_c/infra/erpc_codec.hpp
vendored
Normal file
@ -0,0 +1,440 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__CODEC_H_
|
||||
#define _EMBEDDED_RPC__CODEC_H_
|
||||
|
||||
#include "erpc_common.h"
|
||||
#include "erpc_message_buffer.hpp"
|
||||
#include "erpc_transport.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_codec
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
/*!
|
||||
* @brief Types of messages that can be encoded.
|
||||
*/
|
||||
enum class message_type_t
|
||||
{
|
||||
kInvocationMessage = 0,
|
||||
kOnewayMessage,
|
||||
kReplyMessage,
|
||||
kNotificationMessage
|
||||
};
|
||||
|
||||
typedef void *funPtr; // Pointer to functions
|
||||
typedef funPtr *arrayOfFunPtr; // Pointer to array of functions
|
||||
|
||||
/*!
|
||||
* @brief Abstract serialization encoder/decoder interface.
|
||||
*
|
||||
* Codecs write to or read from a MessageBuffer.
|
||||
*
|
||||
* @ingroup infra_codec
|
||||
*/
|
||||
class Codec
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
Codec(void) : m_cursor(), m_status(kErpcStatus_Success) {}
|
||||
|
||||
/*!
|
||||
* @brief Codec destructor
|
||||
*/
|
||||
virtual ~Codec(void) {}
|
||||
|
||||
/*!
|
||||
* @brief Return message buffer used for read and write data.
|
||||
*
|
||||
* @return Pointer to used message buffer.
|
||||
*/
|
||||
MessageBuffer getBuffer(void) { return m_cursor.getBuffer(); }
|
||||
|
||||
MessageBuffer &getBufferRef(void) { return m_cursor.getBufferRef(); }
|
||||
|
||||
/*!
|
||||
* @brief Prototype for set message buffer used for read and write data.
|
||||
*
|
||||
* @param[in] buf Message buffer to set.
|
||||
* @param[in] skip How many bytes to skip from reading.
|
||||
*/
|
||||
virtual void setBuffer(MessageBuffer &buf, uint8_t skip = 0)
|
||||
{
|
||||
m_cursor.setBuffer(buf, skip);
|
||||
m_status = kErpcStatus_Success;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Reset the codec to initial state.
|
||||
*
|
||||
* @param[in] skip How many bytes to skip from reading.
|
||||
*/
|
||||
virtual void reset(uint8_t skip = 0)
|
||||
{
|
||||
MessageBuffer buffer = m_cursor.getBuffer();
|
||||
m_cursor.setBuffer(buffer, skip);
|
||||
m_status = kErpcStatus_Success;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Return current status of eRPC message processing.
|
||||
*
|
||||
* @return Current status of eRPC message processing.
|
||||
*/
|
||||
erpc_status_t getStatus(void) { return m_status; }
|
||||
|
||||
/*!
|
||||
* @brief Return bool value representing current status.
|
||||
*
|
||||
* @retval True Current status value is kErpcStatus_Success.
|
||||
* @retval False Current status is other than kErpcStatus_Success.
|
||||
*/
|
||||
bool isStatusOk(void) { return (m_status == kErpcStatus_Success); }
|
||||
|
||||
/*!
|
||||
* @brief Set current status of eRPC message processing to given value.
|
||||
*
|
||||
* @param[in] status New current value.
|
||||
*/
|
||||
void updateStatus(erpc_status_t status)
|
||||
{
|
||||
if (isStatusOk())
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
}
|
||||
|
||||
//! @name Encoding
|
||||
//@{
|
||||
/*!
|
||||
* @brief Prototype for write header of message.
|
||||
*
|
||||
* @param[in] type Type of message.
|
||||
* @param[in] service Which interface is requested.
|
||||
* @param[in] request Which function need be called.
|
||||
* @param[in] sequence Send sequence number to be sure that
|
||||
* received message is reply for current request.
|
||||
*/
|
||||
virtual void startWriteMessage(message_type_t type, uint32_t service, uint32_t request, uint32_t sequence) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write boolean value.
|
||||
*
|
||||
* @param[in] value Boolean typed value to write.
|
||||
*/
|
||||
virtual void write(bool value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int8_t value.
|
||||
*
|
||||
* @param[in] value int8_t typed value to write.
|
||||
*/
|
||||
virtual void write(int8_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int16_t value.
|
||||
*
|
||||
* @param[in] value int16_t typed value to write.
|
||||
*/
|
||||
virtual void write(int16_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int32_t value.
|
||||
*
|
||||
* @param[in] value int32_t typed value to write.
|
||||
*/
|
||||
virtual void write(int32_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write int64_t value.
|
||||
*
|
||||
* @param[in] value int64_t typed value to write.
|
||||
*/
|
||||
virtual void write(int64_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint8_t value.
|
||||
*
|
||||
* @param[in] value uint8_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint8_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint16_t value.
|
||||
*
|
||||
* @param[in] value uint16_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint16_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint32_t value.
|
||||
*
|
||||
* @param[in] value uint32_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint32_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uint64_t value.
|
||||
*
|
||||
* @param[in] value uint64_t typed value to write.
|
||||
*/
|
||||
virtual void write(uint64_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write float value.
|
||||
*
|
||||
* @param[in] value float typed value to write.
|
||||
*/
|
||||
virtual void write(float value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write double value.
|
||||
*
|
||||
* @param[in] value double typed value to write.
|
||||
*/
|
||||
virtual void write(double value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write uintptr value.
|
||||
*
|
||||
* @param[in] value uintptr typed value to write.
|
||||
*/
|
||||
virtual void writePtr(uintptr_t value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write string value.
|
||||
*
|
||||
* @param[in] length of string.
|
||||
* @param[in] value string value to write.
|
||||
*/
|
||||
virtual void writeString(uint32_t length, const char *value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for write binary value.
|
||||
*
|
||||
* @param[in] length of binary.
|
||||
* @param[in] value Binary value to write.
|
||||
*/
|
||||
virtual void writeBinary(uint32_t length, const uint8_t *value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start write list.
|
||||
*
|
||||
* @param[in] length Length of list.
|
||||
*/
|
||||
virtual void startWriteList(uint32_t length) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start write union.
|
||||
*
|
||||
* @param[in] discriminator Discriminator of union.
|
||||
*/
|
||||
virtual void startWriteUnion(int32_t discriminator) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Writes a flag indicating whether the next value is null.
|
||||
*
|
||||
* @param[in] isNull Null flag to send.
|
||||
*/
|
||||
virtual void writeNullFlag(bool isNull) = 0;
|
||||
//@}
|
||||
|
||||
//! @name Decoding
|
||||
//@{
|
||||
/*!
|
||||
* @brief Prototype for read header of message.
|
||||
*
|
||||
* @param[in] type Type of message.
|
||||
* @param[in] service Which interface was used.
|
||||
* @param[in] request Which function was called.
|
||||
* @param[in] sequence Returned sequence number to be sure that
|
||||
* received message is reply for current request.
|
||||
*/
|
||||
virtual void startReadMessage(message_type_t &type, uint32_t &service, uint32_t &request, uint32_t &sequence) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read boolean value.
|
||||
*
|
||||
* @param[in] value Boolean typed value to read.
|
||||
*/
|
||||
virtual void read(bool &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int8_t value.
|
||||
*
|
||||
* @param[in] value int8_t typed value to read.
|
||||
*/
|
||||
virtual void read(int8_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int16_t value.
|
||||
*
|
||||
* @param[in] value int16_t typed value to read.
|
||||
*/
|
||||
virtual void read(int16_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int32_t value.
|
||||
*
|
||||
* @param[in] value int32_t typed value to read.
|
||||
*/
|
||||
virtual void read(int32_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read int64_t value.
|
||||
*
|
||||
* @param[in] value int64_t typed value to read.
|
||||
*/
|
||||
virtual void read(int64_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint8_t value.
|
||||
*
|
||||
* @param[in] value uint8_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint8_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint16_t value.
|
||||
*
|
||||
* @param[in] value uint16_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint16_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint32_t value.
|
||||
*
|
||||
* @param[in] value uint32_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint32_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uint64_t value.
|
||||
*
|
||||
* @param[in] value uint64_t typed value to read.
|
||||
*/
|
||||
virtual void read(uint64_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read float value.
|
||||
*
|
||||
* @param[in] value float typed value to read.
|
||||
*/
|
||||
virtual void read(float &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read double value.
|
||||
*
|
||||
* @param[in] value double typed value to read.
|
||||
*/
|
||||
virtual void read(double &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read uintptr value.
|
||||
*
|
||||
* @param[in] value uintptr typed value to read.
|
||||
*/
|
||||
virtual void readPtr(uintptr_t &value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read string value.
|
||||
*
|
||||
* @param[in] length of string.
|
||||
* @param[in] value String value to read.
|
||||
*/
|
||||
virtual void readString(uint32_t &length, char **value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for read binary value.
|
||||
*
|
||||
* @param[out] length of binary. 0 can be valid value or in case of error.
|
||||
* @param[out] value Binary value to read. Null in case of error.
|
||||
*/
|
||||
virtual void readBinary(uint32_t &length, uint8_t **value) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start read list.
|
||||
*
|
||||
* @param[in] length Length of list.
|
||||
*/
|
||||
virtual void startReadList(uint32_t &length) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for start read union.
|
||||
*
|
||||
* @param[in] discriminator Discriminator of union.
|
||||
*/
|
||||
virtual void startReadUnion(int32_t &discriminator) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Reads a flag indicating whether the next value is null.
|
||||
*
|
||||
* @param[in] isNull Null flag to read.
|
||||
*/
|
||||
virtual void readNullFlag(bool &isNull) = 0;
|
||||
|
||||
protected:
|
||||
Cursor m_cursor; /*!< Copy data to message buffers. */
|
||||
erpc_status_t m_status; /*!< Status of serialized data. */
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Abstract interface for codec factory.
|
||||
*
|
||||
* @ingroup infra_codec
|
||||
*/
|
||||
class CodecFactory
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
CodecFactory(void) {}
|
||||
|
||||
/*!
|
||||
* @brief CodecFactory destructor
|
||||
*/
|
||||
virtual ~CodecFactory(void) {}
|
||||
|
||||
/*!
|
||||
* @brief Return created codec.
|
||||
*
|
||||
* @return Pointer to created codec.
|
||||
*/
|
||||
virtual Codec *create(void) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Dispose codec.
|
||||
*
|
||||
* @param[in] codec Codec to dispose.
|
||||
*/
|
||||
virtual void dispose(Codec *codec) = 0;
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__CODEC_H_
|
||||
89
packages/erpc-1.14.0/erpc_c/infra/erpc_common.h
vendored
Normal file
89
packages/erpc-1.14.0/erpc_c/infra/erpc_common.h
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__ERPC_COMMON_H_
|
||||
#define _EMBEDDED_RPC__ERPC_COMMON_H_
|
||||
|
||||
/*!
|
||||
* @addtogroup infra
|
||||
* @{
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Definitions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*! @brief eRPC status return codes. */
|
||||
enum _erpc_status
|
||||
{
|
||||
//! No error occurred.
|
||||
kErpcStatus_Success = 0,
|
||||
|
||||
//! Generic failure.
|
||||
kErpcStatus_Fail = 1,
|
||||
|
||||
//! Argument is an invalid value.
|
||||
kErpcStatus_InvalidArgument = 4,
|
||||
|
||||
//! Operated timed out.
|
||||
kErpcStatus_Timeout = 5,
|
||||
|
||||
//! Message header contains an unknown version.
|
||||
kErpcStatus_InvalidMessageVersion = 6,
|
||||
|
||||
//! Expected a reply message but got another message type.
|
||||
kErpcStatus_ExpectedReply,
|
||||
|
||||
//! Message is corrupted.
|
||||
kErpcStatus_CrcCheckFailed,
|
||||
|
||||
//! Attempt to read or write past the end of a buffer.
|
||||
kErpcStatus_BufferOverrun,
|
||||
|
||||
//! Could not find host with given name.
|
||||
kErpcStatus_UnknownName,
|
||||
|
||||
//! Failed to connect to host.
|
||||
kErpcStatus_ConnectionFailure,
|
||||
|
||||
//! Connected closed by peer.
|
||||
kErpcStatus_ConnectionClosed,
|
||||
|
||||
//! Memory allocation error.
|
||||
kErpcStatus_MemoryError,
|
||||
|
||||
//! Server is stopped.
|
||||
kErpcStatus_ServerIsDown,
|
||||
|
||||
//! Transport layer initialization failed.
|
||||
kErpcStatus_InitFailed,
|
||||
|
||||
//! Failed to receive data.
|
||||
kErpcStatus_ReceiveFailed,
|
||||
|
||||
//! Failed to send data.
|
||||
kErpcStatus_SendFailed,
|
||||
|
||||
//! Sending/Receiving callback function which is not defined in IDL.
|
||||
kErpcStatus_UnknownCallback,
|
||||
|
||||
//! Calling eRPC function from another eRPC function. For more information see erpc_common.h.
|
||||
kErpcStatus_NestedCallFailure,
|
||||
|
||||
//! When sending address from bigger architecture to smaller.
|
||||
kErpcStatus_BadAddressScale
|
||||
};
|
||||
|
||||
/*! @brief Type used for all status and error return values. */
|
||||
typedef enum _erpc_status erpc_status_t;
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif /* _EMBEDDED_RPC__ERPC_COMMON_H_ */
|
||||
54
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.cpp
vendored
Normal file
54
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.cpp
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_crc16.hpp"
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Crc16::Crc16(uint32_t crcStart) : m_crcStart(crcStart) {}
|
||||
|
||||
Crc16::Crc16(void) : m_crcStart(0xEF4A) {}
|
||||
|
||||
Crc16::~Crc16(void) {}
|
||||
|
||||
uint16_t Crc16::computeCRC16(const uint8_t *data, uint32_t lengthInBytes)
|
||||
{
|
||||
uint32_t crc = m_crcStart;
|
||||
uint32_t j;
|
||||
uint32_t i;
|
||||
uint32_t byte;
|
||||
uint32_t temp;
|
||||
const uint32_t andValue = 0x8000U;
|
||||
const uint32_t xorValue = 0x1021U;
|
||||
|
||||
for (j = 0; j < lengthInBytes; ++j)
|
||||
{
|
||||
byte = data[j];
|
||||
crc ^= byte << 8;
|
||||
for (i = 0; i < 8U; ++i)
|
||||
{
|
||||
temp = crc << 1;
|
||||
if (0UL != (crc & andValue))
|
||||
{
|
||||
temp ^= xorValue;
|
||||
}
|
||||
crc = temp;
|
||||
}
|
||||
}
|
||||
|
||||
return (uint16_t)crc;
|
||||
}
|
||||
void Crc16::setCrcStart(uint32_t crcStart)
|
||||
{
|
||||
m_crcStart = crcStart;
|
||||
}
|
||||
74
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.hpp
vendored
Normal file
74
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.hpp
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2017 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__CRC16_H_
|
||||
#define _EMBEDDED_RPC__CRC16_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
|
||||
/*!
|
||||
* @brief Class for compute crc16.
|
||||
*/
|
||||
class Crc16
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* @param[in] crcStart Start value for crc function.
|
||||
*/
|
||||
explicit Crc16(uint32_t crcStart);
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
Crc16(void);
|
||||
|
||||
/*!
|
||||
* @brief Crc16 destructor
|
||||
*/
|
||||
~Crc16(void);
|
||||
|
||||
/*!
|
||||
* @brief Compute a ITU-CCITT CRC-16 over the provided data.
|
||||
*
|
||||
* This implementation is slow but small in size.
|
||||
*
|
||||
* @param[in] data Pointer to data used for crc16.
|
||||
* @param[in] lengthInBytes Data length.
|
||||
*/
|
||||
uint16_t computeCRC16(const uint8_t *data, uint32_t lengthInBytes);
|
||||
|
||||
/*!
|
||||
* @brief Set crc start number.
|
||||
*
|
||||
* @param[in] crcStart Crc start number.
|
||||
*/
|
||||
void setCrcStart(uint32_t crcStart);
|
||||
|
||||
protected:
|
||||
uint32_t m_crcStart; /*!< CRC start number. */
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__CRC16_H_
|
||||
196
packages/erpc-1.14.0/erpc_c/infra/erpc_framed_transport.cpp
vendored
Normal file
196
packages/erpc-1.14.0/erpc_c/infra/erpc_framed_transport.cpp
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2020 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_framed_transport.hpp"
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
#include ENDIANNESS_HEADER
|
||||
#include "erpc_message_buffer.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FramedTransport::FramedTransport(void) :
|
||||
Transport(), m_crcImpl(NULL)
|
||||
#if !ERPC_THREADS_IS(NONE)
|
||||
,
|
||||
m_sendLock(), m_receiveLock()
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
FramedTransport::~FramedTransport(void) {}
|
||||
|
||||
uint8_t FramedTransport::reserveHeaderSize(void)
|
||||
{
|
||||
return sizeof(FramedTransport::Header::m_crcHeader) + sizeof(FramedTransport::Header::m_messageSize) +
|
||||
sizeof(FramedTransport::Header::m_crcBody);
|
||||
}
|
||||
|
||||
void FramedTransport::setCrc16(Crc16 *crcImpl)
|
||||
{
|
||||
erpc_assert(crcImpl);
|
||||
m_crcImpl = crcImpl;
|
||||
}
|
||||
|
||||
Crc16 *FramedTransport::getCrc16(void)
|
||||
{
|
||||
return m_crcImpl;
|
||||
}
|
||||
|
||||
erpc_status_t FramedTransport::receive(MessageBuffer *message)
|
||||
{
|
||||
Header h = { 0, 0, 0 };
|
||||
erpc_status_t retVal;
|
||||
uint16_t computedCrc;
|
||||
uint8_t offset = 0;
|
||||
|
||||
erpc_assert((m_crcImpl != NULL) && ("Uninitialized Crc16 object." != NULL));
|
||||
|
||||
// e.g. rpmsg tty may have nullptr and buffer is assigned in receive function.
|
||||
if ((message->get() != nullptr) && (message->getLength() < reserveHeaderSize()))
|
||||
{
|
||||
retVal = kErpcStatus_MemoryError;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !ERPC_THREADS_IS(NONE)
|
||||
Mutex::Guard lock(m_receiveLock);
|
||||
#endif
|
||||
|
||||
// Receive header first.
|
||||
retVal = underlyingReceive(message, reserveHeaderSize(), 0);
|
||||
if ((retVal == kErpcStatus_Success) && (message->getLength() < reserveHeaderSize()))
|
||||
{
|
||||
retVal = kErpcStatus_MemoryError;
|
||||
}
|
||||
|
||||
if (retVal == kErpcStatus_Success)
|
||||
{
|
||||
static_cast<void>(memcpy(&h.m_crcHeader, message->get(), sizeof(h.m_crcHeader)));
|
||||
offset = sizeof(h.m_crcHeader);
|
||||
static_cast<void>(memcpy(&h.m_messageSize, &message->get()[offset], sizeof(h.m_messageSize)));
|
||||
offset += sizeof(h.m_messageSize);
|
||||
static_cast<void>(memcpy(&h.m_crcBody, &message->get()[offset], sizeof(h.m_crcBody)));
|
||||
offset += sizeof(h.m_crcBody);
|
||||
|
||||
ERPC_READ_AGNOSTIC_16(h.m_crcHeader);
|
||||
ERPC_READ_AGNOSTIC_16(h.m_messageSize);
|
||||
ERPC_READ_AGNOSTIC_16(h.m_crcBody);
|
||||
|
||||
computedCrc =
|
||||
m_crcImpl->computeCRC16(reinterpret_cast<const uint8_t *>(&h.m_messageSize), sizeof(h.m_messageSize)) +
|
||||
m_crcImpl->computeCRC16(reinterpret_cast<const uint8_t *>(&h.m_crcBody), sizeof(h.m_crcBody));
|
||||
if (computedCrc != h.m_crcHeader)
|
||||
{
|
||||
retVal = kErpcStatus_CrcCheckFailed;
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal == kErpcStatus_Success)
|
||||
{
|
||||
// received size can't be larger then buffer length.
|
||||
if ((h.m_messageSize + reserveHeaderSize()) > message->getLength())
|
||||
{
|
||||
retVal = kErpcStatus_ReceiveFailed;
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal == kErpcStatus_Success)
|
||||
{
|
||||
// rpmsg tty can receive all data in one buffer, others need second call.
|
||||
if (message->getUsed() < (h.m_messageSize + reserveHeaderSize()))
|
||||
{
|
||||
// Receive rest of the message now we know its size.
|
||||
retVal = underlyingReceive(message, h.m_messageSize, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal == kErpcStatus_Success)
|
||||
{
|
||||
// Verify CRC.
|
||||
computedCrc = m_crcImpl->computeCRC16(&message->get()[offset], h.m_messageSize);
|
||||
if (computedCrc != h.m_crcBody)
|
||||
{
|
||||
retVal = kErpcStatus_CrcCheckFailed;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
erpc_status_t FramedTransport::send(MessageBuffer *message)
|
||||
{
|
||||
|
||||
|
||||
|
||||
erpc_status_t ret;
|
||||
|
||||
|
||||
uint16_t messageLength;
|
||||
Header h;
|
||||
uint8_t offset;
|
||||
|
||||
erpc_assert((m_crcImpl != NULL) && ("Uninitialized Crc16 object." != NULL));
|
||||
|
||||
messageLength = message->getUsed() - reserveHeaderSize();
|
||||
|
||||
// Send header first.
|
||||
h.m_messageSize = messageLength;
|
||||
h.m_crcBody = m_crcImpl->computeCRC16(&message->get()[reserveHeaderSize()], messageLength);
|
||||
h.m_crcHeader =
|
||||
m_crcImpl->computeCRC16(reinterpret_cast<const uint8_t *>(&h.m_messageSize), sizeof(h.m_messageSize)) +
|
||||
m_crcImpl->computeCRC16(reinterpret_cast<const uint8_t *>(&h.m_crcBody), sizeof(h.m_crcBody));
|
||||
|
||||
ERPC_WRITE_AGNOSTIC_16(h.m_crcHeader);
|
||||
ERPC_WRITE_AGNOSTIC_16(h.m_messageSize);
|
||||
ERPC_WRITE_AGNOSTIC_16(h.m_crcBody);
|
||||
|
||||
static_cast<void>(memcpy(message->get(), reinterpret_cast<const uint8_t *>(&h.m_crcHeader), sizeof(h.m_crcHeader)));
|
||||
offset = sizeof(h.m_crcHeader);
|
||||
static_cast<void>(
|
||||
memcpy(&message->get()[offset], reinterpret_cast<const uint8_t *>(&h.m_messageSize), sizeof(h.m_messageSize)));
|
||||
offset += sizeof(h.m_messageSize);
|
||||
static_cast<void>(
|
||||
memcpy(&message->get()[offset], reinterpret_cast<const uint8_t *>(&h.m_crcBody), sizeof(h.m_crcBody)));
|
||||
|
||||
|
||||
|
||||
ret = underlyingSend(message, message->getUsed(), 0);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
erpc_status_t FramedTransport::underlyingSend(MessageBuffer *message, uint32_t size, uint32_t offset)
|
||||
{
|
||||
erpc_status_t retVal = underlyingSend(&message->get()[offset], size);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
erpc_status_t FramedTransport::underlyingReceive(MessageBuffer *message, uint32_t size, uint32_t offset)
|
||||
{
|
||||
erpc_status_t retVal = underlyingReceive(&message->get()[offset], size);
|
||||
|
||||
if (retVal == kErpcStatus_Success)
|
||||
{
|
||||
message->setUsed(size + offset);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
188
packages/erpc-1.14.0/erpc_c/infra/erpc_framed_transport.hpp
vendored
Normal file
188
packages/erpc-1.14.0/erpc_c/infra/erpc_framed_transport.hpp
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2020 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__FRAMED_TRANSPORT_H_
|
||||
#define _EMBEDDED_RPC__FRAMED_TRANSPORT_H_
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
#include "erpc_message_buffer.hpp"
|
||||
#include "erpc_transport.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#if !ERPC_THREADS_IS(NONE)
|
||||
#include "erpc_threading.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
|
||||
/*!
|
||||
* @brief Base class for framed transport layers.
|
||||
*
|
||||
* This class adds simple framing to the data transmitted and received on the
|
||||
* communications channel. This allows the transport to perform reads and writes
|
||||
* of a size known in advance. Subclasses must implement the underlyingSend() and
|
||||
* underlyingReceive() methods to actually transmit and receive data.
|
||||
*
|
||||
* Frames have a maximum size of 64kB, as a 16-bit frame size is used.
|
||||
*
|
||||
* @note This implementation currently assumes both sides of the communications channel
|
||||
* are the same endianness.
|
||||
*
|
||||
* The frame header includes a CRC-16 over the data for integrity checking. This class
|
||||
* includes a default CRC-16 implementation that is optimized for code size, but is
|
||||
* relatively slow. If a faster implementation is desired, you can pass the new CRC
|
||||
* function to setCRCFunction().
|
||||
*
|
||||
* @ingroup infra_transport
|
||||
*/
|
||||
class FramedTransport : public Transport
|
||||
{
|
||||
public:
|
||||
/*! @brief Contents of the header that prefixes each message. */
|
||||
struct Header
|
||||
{
|
||||
uint16_t m_crcHeader; //!< CRC-16 over this header structure data
|
||||
uint16_t m_messageSize; //!< Size in bytes of the message, excluding the header.
|
||||
uint16_t m_crcBody; //!< CRC-16 over the message data.
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
FramedTransport(void);
|
||||
|
||||
/*!
|
||||
* @brief FramedTransport destructor
|
||||
*/
|
||||
virtual ~FramedTransport(void);
|
||||
|
||||
/**
|
||||
* @brief Size of data placed in MessageBuffer before serializing eRPC data.
|
||||
*
|
||||
* @return uint8_t Amount of bytes, reserved before serialized data.
|
||||
*/
|
||||
virtual uint8_t reserveHeaderSize(void) override;
|
||||
|
||||
/*!
|
||||
* @brief Receives an entire message.
|
||||
*
|
||||
* The frame header and message data are received. The CRC-16 in the frame header is
|
||||
* compared with the computed CRC. If the received CRC is invalid, #kErpcStatus_Fail
|
||||
* will be returned.
|
||||
*
|
||||
* The @a message is only filled with the message data, not the frame header.
|
||||
*
|
||||
* This function is blocking.
|
||||
*
|
||||
* @param[in] message Message buffer, to which will be stored incoming message.
|
||||
*
|
||||
* @retval kErpcStatus_Success When receiving was successful.
|
||||
* @retval kErpcStatus_CrcCheckFailed When receiving failed.
|
||||
* @retval other Subclass may return other errors from the underlyingReceive() method.
|
||||
*/
|
||||
virtual erpc_status_t receive(MessageBuffer *message) override;
|
||||
|
||||
/*!
|
||||
* @brief Function to send prepared message.
|
||||
*
|
||||
* @param[in] message Pass message buffer to send.
|
||||
*
|
||||
* @retval kErpcStatus_Success When sending was successful.
|
||||
* @retval other Subclass may return other errors from the underlyingSend() method.
|
||||
*/
|
||||
virtual erpc_status_t send(MessageBuffer *message) override;
|
||||
|
||||
/*!
|
||||
* @brief This functions sets the CRC-16 implementation.
|
||||
*
|
||||
* @param[in] crcImpl Object containing crc-16 compute function.
|
||||
*/
|
||||
virtual void setCrc16(Crc16 *crcImpl) override;
|
||||
|
||||
/*!
|
||||
* @brief This functions gets the CRC-16 object.
|
||||
*
|
||||
* @return Crc16* Pointer to CRC-16 object containing crc-16 compute function.
|
||||
*/
|
||||
virtual Crc16 *getCrc16(void) override;
|
||||
|
||||
protected:
|
||||
Crc16 *m_crcImpl; /*!< CRC object. */
|
||||
|
||||
#if !ERPC_THREADS_IS(NONE)
|
||||
Mutex m_sendLock; //!< Mutex protecting send.
|
||||
Mutex m_receiveLock; //!< Mutex protecting receive.
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief Adds ability to framed transport to overwrite MessageBuffer when sending data.
|
||||
*
|
||||
* Usually we don't want to do that.
|
||||
*
|
||||
* @param message MessageBuffer to send.
|
||||
* @param size size of message to send.
|
||||
* @param offset data start address offset
|
||||
*
|
||||
* @return erpc_status_t kErpcStatus_Success when it finished successful otherwise error.
|
||||
*/
|
||||
virtual erpc_status_t underlyingSend(MessageBuffer *message, uint32_t size, uint32_t offset);
|
||||
|
||||
/*!
|
||||
* @brief Adds ability to framed transport to overwrite MessageBuffer when receiving data.
|
||||
*
|
||||
* Usually we don't want to do that.
|
||||
*
|
||||
* @param message MessageBuffer to send.
|
||||
* @param size size of message to send.
|
||||
* @param offset data start address offset
|
||||
*
|
||||
* @return erpc_status_t kErpcStatus_Success when it finished successful otherwise error.
|
||||
*/
|
||||
virtual erpc_status_t underlyingReceive(MessageBuffer *message, uint32_t size, uint32_t offset);
|
||||
|
||||
/*!
|
||||
* @brief Subclasses must implement this function to send data.
|
||||
*
|
||||
* @param[in] data Buffer to send.
|
||||
* @param[in] size Size of data to send.
|
||||
*
|
||||
* @retval kErpcStatus_Success When data was written successfully.
|
||||
* @retval kErpcStatus_Fail When writing data ends with error.
|
||||
*/
|
||||
virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Subclasses must implement this function to receive data.
|
||||
*
|
||||
* @param[inout] data Preallocated buffer for receiving data.
|
||||
* @param[in] size Size of data to read.
|
||||
*
|
||||
* @retval kErpcStatus_Success When data was read successfully.
|
||||
* @retval kErpcStatus_Fail When reading data ends with error.
|
||||
*/
|
||||
virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size) = 0;
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__FRAMED_TRANSPORT_H_
|
||||
238
packages/erpc-1.14.0/erpc_c/infra/erpc_manually_constructed.hpp
vendored
Normal file
238
packages/erpc-1.14.0/erpc_c/infra/erpc_manually_constructed.hpp
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__MANUALLY_CONSTRUCTED_H_
|
||||
#define _EMBEDDED_RPC__MANUALLY_CONSTRUCTED_H_
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
|
||||
#include <new>
|
||||
#include <stdint.h>
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_utility
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
/*!
|
||||
* @brief Allocates static storage for an object.
|
||||
*
|
||||
* This template class defines storage of the template class' size. Then it
|
||||
* gives the user explicit control over construction and destruction of the
|
||||
* object residing in that storage. This is useful for placing objects in
|
||||
* unions, or other situations where you need static storage but want to delay
|
||||
* the actual construction of the object.
|
||||
*
|
||||
* Objects of this class will act as a pointer to the template argument class
|
||||
* type. Of course, if the object has not yet been constructed then the
|
||||
* behavior is undefined if the pointer to it is used.
|
||||
*
|
||||
* Note that there is not a constructor or deconstructor. This is because
|
||||
* members of unions cannot have constructors or deconstructors.
|
||||
*
|
||||
* Instances of this template class are aligned to 8 bytes.
|
||||
*
|
||||
* @ingroup infra_utility
|
||||
*/
|
||||
template <class T>
|
||||
class ManuallyConstructed
|
||||
{
|
||||
public:
|
||||
//! @name Object access
|
||||
//@{
|
||||
T *get(void) { return (m_isConstructed) ? reinterpret_cast<T *>(&m_storage) : nullptr; }
|
||||
const T *get(void) const { return (m_isConstructed) ? reinterpret_cast<const T *>(&m_storage) : nullptr; }
|
||||
T *operator->(void) { return get(); }
|
||||
const T *operator->(void) const { return get(); }
|
||||
T &operator*(void)
|
||||
{
|
||||
if (m_isConstructed)
|
||||
{
|
||||
return *get();
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&m_storage, 0, sizeof(m_storage) * 8);
|
||||
return reinterpret_cast<T &>(m_storage);
|
||||
};
|
||||
}
|
||||
const T &operator*(void) const
|
||||
{
|
||||
if (m_isConstructed)
|
||||
{
|
||||
return *get();
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&m_storage, 0, sizeof(m_storage) * 8);
|
||||
return reinterpret_cast<const T &>(m_storage);
|
||||
};
|
||||
}
|
||||
operator T *(void) { return get(); }
|
||||
operator const T *(void) const { return get(); }
|
||||
//@}
|
||||
|
||||
//! @name Explicit construction methods
|
||||
//@{
|
||||
void construct(void)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T;
|
||||
m_isConstructed = true;
|
||||
}
|
||||
|
||||
template <typename A1>
|
||||
void construct(const A1 &a1)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T(a1);
|
||||
m_isConstructed = true;
|
||||
}
|
||||
|
||||
template <typename A1, typename A2>
|
||||
void construct(const A1 &a1, const A2 &a2)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T(a1, a2);
|
||||
m_isConstructed = true;
|
||||
}
|
||||
|
||||
template <typename A1, typename A2, typename A3>
|
||||
void construct(const A1 &a1, const A2 &a2, const A3 &a3)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T(a1, a2, a3);
|
||||
m_isConstructed = true;
|
||||
}
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4>
|
||||
void construct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T(a1, a2, a3, a4);
|
||||
m_isConstructed = true;
|
||||
}
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4, typename A5>
|
||||
void construct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T(a1, a2, a3, a4, a5);
|
||||
m_isConstructed = true;
|
||||
}
|
||||
|
||||
template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
|
||||
void construct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5, const A6 &a6)
|
||||
{
|
||||
destroy();
|
||||
new (m_storage) T(a1, a2, a3, a4, a5, a6);
|
||||
m_isConstructed = true;
|
||||
}
|
||||
//@}
|
||||
|
||||
/*!
|
||||
* @brief Invoke the object's destructor.
|
||||
*
|
||||
* Behavior is undefined if the objected was not previously initialized.
|
||||
*/
|
||||
void destroy(void)
|
||||
{
|
||||
if (m_isConstructed)
|
||||
{
|
||||
get()->~T();
|
||||
m_isConstructed = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Returns information if object is free or is used.
|
||||
*
|
||||
* @return true Object is constructed and used.
|
||||
* @return false Object wasn't constructed or it was destructed already.
|
||||
*/
|
||||
bool isUsed(void) { return m_isConstructed; }
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* @brief Storage for the object.
|
||||
*
|
||||
* An array of uint64 is used to get 8-byte alignment.
|
||||
*/
|
||||
uint64_t m_storage[(sizeof(T) + sizeof(uint64_t) - 1) / sizeof(uint64_t)];
|
||||
|
||||
/*!
|
||||
* @brief Track construct/destruct calls.
|
||||
*
|
||||
* Based on this variable we can allow or forbid construct/destruct calls.
|
||||
*/
|
||||
bool m_isConstructed = false;
|
||||
};
|
||||
|
||||
#define ERPC_MANUALLY_CONSTRUCTED(class, variableName) static ManuallyConstructed<class> variableName
|
||||
#define ERPC_MANUALLY_CONSTRUCTED_ARRAY(class, variableName, dimension) \
|
||||
ERPC_MANUALLY_CONSTRUCTED(class, variableName)[dimension]
|
||||
|
||||
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
|
||||
#define ERPC_MANUALLY_CONSTRUCTED_STATIC(class, variableName) ERPC_MANUALLY_CONSTRUCTED(class, variableName)
|
||||
#else
|
||||
#define ERPC_MANUALLY_CONSTRUCTED_STATIC(class, variableName)
|
||||
#endif
|
||||
|
||||
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
|
||||
#define ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(class, variableName, dimension) \
|
||||
ERPC_MANUALLY_CONSTRUCTED_ARRAY(class, variableName, dimension)
|
||||
#else
|
||||
#define ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(class, variableName, dimension)
|
||||
#endif
|
||||
|
||||
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||
#define ERPC_CREATE_NEW_OBJECT(class, arrayOfObjects, numberOfObjects, ...) \
|
||||
return new (std::nothrow) class(__VA_ARGS__);
|
||||
|
||||
#define ERPC_DESTROY_OBJECT(object, ...) delete object;
|
||||
|
||||
#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
|
||||
#define ERPC_CREATE_NEW_OBJECT(class, arrayOfObjects, numberOfObjects, ...) \
|
||||
uint8_t objectsIterator; \
|
||||
class *ret = NULL; \
|
||||
for (objectsIterator = 0; objectsIterator < numberOfObjects; objectsIterator++) \
|
||||
{ \
|
||||
if (!arrayOfObjects[objectsIterator].isUsed()) \
|
||||
{ \
|
||||
arrayOfObjects[objectsIterator].construct(__VA_ARGS__); \
|
||||
ret = arrayOfObjects[objectsIterator].get(); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
return ret;
|
||||
|
||||
#define ERPC_DESTROY_OBJECT(object, arrayOfObjects, numberOfObjects) \
|
||||
uint8_t objectsIterator; \
|
||||
for (objectsIterator = 0; objectsIterator < numberOfObjects; objectsIterator++) \
|
||||
{ \
|
||||
if (object == arrayOfObjects[objectsIterator].get()) \
|
||||
{ \
|
||||
arrayOfObjects[objectsIterator].destroy(); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__MANUALLY_CONSTRUCTED_H_
|
||||
268
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.cpp
vendored
Normal file
268
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.cpp
vendored
Normal file
@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2023 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_message_buffer.hpp"
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace erpc;
|
||||
using namespace std;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MessageBuffer::MessageBuffer(const MessageBuffer &buffer)
|
||||
{
|
||||
m_buf = buffer.m_buf;
|
||||
m_len = buffer.m_len;
|
||||
m_used = buffer.m_used;
|
||||
}
|
||||
|
||||
void MessageBuffer::setUsed(uint16_t used)
|
||||
{
|
||||
erpc_assert(used <= m_len);
|
||||
|
||||
m_used = used;
|
||||
}
|
||||
|
||||
erpc_status_t MessageBuffer::read(uint16_t offset, void *data, uint32_t length)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
|
||||
if (length > 0U)
|
||||
{
|
||||
if (data == NULL)
|
||||
{
|
||||
err = kErpcStatus_MemoryError;
|
||||
}
|
||||
else if ((offset + length) > m_len || (offset + length) < offset)
|
||||
{
|
||||
err = kErpcStatus_BufferOverrun;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)memcpy(data, &m_buf[offset], length);
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t MessageBuffer::write(uint16_t offset, const void *data, uint32_t length)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
|
||||
if (length > 0U)
|
||||
{
|
||||
if (data == NULL)
|
||||
{
|
||||
err = kErpcStatus_MemoryError;
|
||||
}
|
||||
else if ((offset + length) > m_len || (offset + length) < offset)
|
||||
{
|
||||
err = kErpcStatus_BufferOverrun;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)memcpy(&m_buf[offset], data, length);
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t MessageBuffer::copy(const MessageBuffer *other)
|
||||
{
|
||||
erpc_status_t err;
|
||||
|
||||
erpc_assert(other != NULL);
|
||||
erpc_assert(m_len >= other->m_len);
|
||||
|
||||
m_used = other->m_used;
|
||||
err = this->write(0, other->m_buf, m_used);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void MessageBuffer::swap(MessageBuffer *other)
|
||||
{
|
||||
erpc_assert(other != NULL);
|
||||
|
||||
MessageBuffer temp(*other);
|
||||
|
||||
other->m_len = m_len;
|
||||
other->m_used = m_used;
|
||||
other->m_buf = m_buf;
|
||||
m_len = temp.m_len;
|
||||
m_used = temp.m_used;
|
||||
m_buf = temp.m_buf;
|
||||
}
|
||||
|
||||
void Cursor::setBuffer(MessageBuffer &buffer, uint8_t reserved)
|
||||
{
|
||||
// RPMSG when nested calls are enabled can set NULL buffer.
|
||||
// erpc_assert(buffer->get() && "Data buffer wasn't set to MessageBuffer.");
|
||||
// receive function should return err if it couldn't set data buffer.
|
||||
|
||||
// erpc_assert(buffer != NULL);
|
||||
|
||||
m_buffer = buffer;
|
||||
if (buffer != NULL)
|
||||
{
|
||||
m_pos = buffer.get() + reserved;
|
||||
}
|
||||
}
|
||||
|
||||
MessageBuffer Cursor::getBuffer(void)
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
MessageBuffer &Cursor::getBufferRef(void)
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
uint8_t &Cursor::operator[](int index)
|
||||
{
|
||||
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 &Cursor::operator[](int index) const
|
||||
{
|
||||
erpc_assert(((m_pos + index) >= m_buffer.get()) &&
|
||||
((uint16_t)(m_pos - m_buffer.get()) + index <= m_buffer.getLength()));
|
||||
|
||||
return m_pos[index];
|
||||
}
|
||||
|
||||
Cursor &Cursor::operator+=(uint16_t n)
|
||||
{
|
||||
erpc_assert((uint32_t)(m_pos - m_buffer.get()) + n <= m_buffer.getLength());
|
||||
|
||||
m_pos += n;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Cursor &Cursor::operator-=(uint16_t n)
|
||||
{
|
||||
erpc_assert(((uintptr_t)m_pos >= n) && (m_pos - n) >= m_buffer.get());
|
||||
|
||||
m_pos -= n;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Cursor &Cursor::operator++(void)
|
||||
{
|
||||
erpc_assert((uint16_t)(m_pos - m_buffer.get()) < m_buffer.getLength());
|
||||
|
||||
++m_pos;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Cursor &Cursor::operator--(void)
|
||||
{
|
||||
erpc_assert(m_pos > m_buffer.get());
|
||||
|
||||
--m_pos;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
erpc_status_t Cursor::read(void *data, uint32_t length)
|
||||
{
|
||||
erpc_assert((m_pos != NULL) && ("Data buffer wasn't set to MessageBuffer." != NULL));
|
||||
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
|
||||
if (length > 0U)
|
||||
{
|
||||
if (data == NULL)
|
||||
{
|
||||
err = kErpcStatus_MemoryError;
|
||||
}
|
||||
else if (length > getRemainingUsed())
|
||||
{
|
||||
err = kErpcStatus_Fail;
|
||||
}
|
||||
else if (length > getRemaining())
|
||||
{
|
||||
err = kErpcStatus_BufferOverrun;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)memcpy(data, m_pos, length);
|
||||
m_pos += length;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t Cursor::write(const void *data, uint32_t length)
|
||||
{
|
||||
erpc_assert((m_pos != NULL) && ("Data buffer wasn't set to MessageBuffer." != NULL));
|
||||
erpc_assert(m_pos == (m_buffer.get() + m_buffer.getUsed()));
|
||||
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
|
||||
if (length > 0U)
|
||||
{
|
||||
if (data == NULL)
|
||||
{
|
||||
err = kErpcStatus_MemoryError;
|
||||
}
|
||||
else if (length > getRemaining())
|
||||
{
|
||||
err = kErpcStatus_BufferOverrun;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)memcpy(m_pos, data, length);
|
||||
m_pos += length;
|
||||
m_buffer.setUsed(m_buffer.getUsed() + length);
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
MessageBufferFactory::MessageBufferFactory(void) {}
|
||||
|
||||
MessageBufferFactory::~MessageBufferFactory(void) {}
|
||||
|
||||
MessageBuffer MessageBufferFactory::create(uint8_t reserveHeaderSize)
|
||||
{
|
||||
MessageBuffer messageBuffer = create();
|
||||
|
||||
messageBuffer.setUsed(reserveHeaderSize);
|
||||
|
||||
return messageBuffer;
|
||||
}
|
||||
|
||||
bool MessageBufferFactory::createServerBuffer(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
erpc_status_t MessageBufferFactory::prepareServerBufferForSend(MessageBuffer &message, uint8_t reserveHeaderSize)
|
||||
{
|
||||
message.setUsed(reserveHeaderSize);
|
||||
return kErpcStatus_Success;
|
||||
}
|
||||
407
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.hpp
vendored
Normal file
407
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.hpp
vendored
Normal file
@ -0,0 +1,407 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__MESSAGE_BUFFER_H_
|
||||
#define _EMBEDDED_RPC__MESSAGE_BUFFER_H_
|
||||
|
||||
#include "erpc_common.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdint.h>
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_codec
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
/*!
|
||||
* @brief Represents a memory buffer containing a message.
|
||||
*
|
||||
* The MessageBuffer object does not own the buffer memory. It simply provides an interface
|
||||
* to accessing that memory in a convenient manner.
|
||||
*
|
||||
* @ingroup infra_codec
|
||||
*/
|
||||
class MessageBuffer
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
MessageBuffer(void) : m_buf(NULL), m_len(0), m_used(0) {}
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*
|
||||
* @param[in] buffer Pointer to buffer.
|
||||
* @param[in] length Length of buffer.
|
||||
*/
|
||||
MessageBuffer(uint8_t *buffer, uint16_t length) : m_buf(buffer), m_len(length), m_used(0) {}
|
||||
|
||||
MessageBuffer(const MessageBuffer &buffer);
|
||||
|
||||
/*!
|
||||
* @brief This function set new buffer and his length.
|
||||
*
|
||||
* This function set buffer to read/write data.
|
||||
*
|
||||
* @param[in] buffer Pointer to another buffer to read/write data.
|
||||
* @param[in] length Length of buffer.
|
||||
*/
|
||||
void set(uint8_t *buffer, uint16_t length)
|
||||
{
|
||||
m_buf = buffer;
|
||||
m_len = length;
|
||||
m_used = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief This function returns pointer to buffer to read/write.
|
||||
*
|
||||
* @return Pointer to buffer to read/write.
|
||||
*/
|
||||
uint8_t *get(void) { return m_buf; }
|
||||
|
||||
/*!
|
||||
* @brief This function returns pointer to buffer to read/write.
|
||||
*
|
||||
* @return Pointer to buffer to read/write.
|
||||
*/
|
||||
const uint8_t *get(void) const { return m_buf; }
|
||||
|
||||
/*!
|
||||
* @brief This function returns length of buffer.
|
||||
*
|
||||
* @return Length of buffer.
|
||||
*/
|
||||
uint16_t getLength(void) const { return m_len; }
|
||||
|
||||
/*!
|
||||
* @brief This function returns length of used space of buffer.
|
||||
*
|
||||
* @return Length of used space of buffer.
|
||||
*/
|
||||
uint16_t getUsed(void) const { return m_used; }
|
||||
|
||||
/*!
|
||||
* @brief This function returns length of free space of buffer.
|
||||
*
|
||||
* @return Length of free space of buffer.
|
||||
*/
|
||||
uint16_t getFree(void) const { return m_len - m_used; }
|
||||
|
||||
/*!
|
||||
* @brief This function sets length of used space of buffer.
|
||||
*
|
||||
* @param[in] used Length of used space of buffer.
|
||||
*/
|
||||
void setUsed(uint16_t used);
|
||||
|
||||
/*!
|
||||
* @brief This function read data from local buffer.
|
||||
*
|
||||
* @param[in] offset Offset in local buffer.
|
||||
* @param[inout] data Given buffer to save read data.
|
||||
* @param[in] length Length of data to read.
|
||||
*
|
||||
* @return Status from reading data.
|
||||
*/
|
||||
erpc_status_t read(uint16_t offset, void *data, uint32_t length);
|
||||
|
||||
/*!
|
||||
* @brief This function write data to local buffer.
|
||||
*
|
||||
* @param[in] offset Offset in local buffer.
|
||||
* @param[inout] data Given buffer from which are copied data.
|
||||
* @param[in] length Length of data to write.
|
||||
*
|
||||
* @return Status from reading data.
|
||||
*/
|
||||
erpc_status_t write(uint16_t offset, const void *data, uint32_t length);
|
||||
|
||||
/*!
|
||||
* @brief This function copy given message buffer to local instance.
|
||||
*
|
||||
* @param[in] other MesageBuffer to copy.
|
||||
*
|
||||
* @return Status from reading data.
|
||||
*/
|
||||
erpc_status_t copy(const MessageBuffer *other);
|
||||
|
||||
/*!
|
||||
* @brief This function swap message buffer attributes between given instance and local instance.
|
||||
*
|
||||
* @param[in] other MesageBuffer to swap.
|
||||
*/
|
||||
void swap(MessageBuffer *other);
|
||||
|
||||
/*!
|
||||
* @brief Casting operator return local buffer.
|
||||
*/
|
||||
operator uint8_t *(void) { return m_buf; }
|
||||
|
||||
/*!
|
||||
* @brief Casting operator return local buffer.
|
||||
*/
|
||||
operator const uint8_t *(void) const { return m_buf; }
|
||||
|
||||
/*!
|
||||
* @brief Array operator return value of buffer at given index.
|
||||
*
|
||||
* @param[in] index Index in buffer.
|
||||
*/
|
||||
uint8_t &operator[](int index) { return m_buf[index]; }
|
||||
|
||||
/*!
|
||||
* @brief Array operator return value of buffer at given index.
|
||||
*
|
||||
* @param[in] index Index in buffer.
|
||||
*/
|
||||
const uint8_t &operator[](int index) const { return m_buf[index]; }
|
||||
|
||||
private:
|
||||
uint8_t *volatile m_buf; /*!< Buffer used to read write data. */
|
||||
uint16_t volatile m_len; /*!< Length of buffer. */
|
||||
uint16_t volatile m_used; /*!< Used buffer bytes. */
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Cursor within a MessageBuffer.
|
||||
*/
|
||||
class Cursor
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
Cursor(void) : m_buffer(), m_pos(NULL) {}
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*
|
||||
* @param[in] buffer MessageBuffer for sending/receiving.
|
||||
*/
|
||||
explicit Cursor(MessageBuffer &buffer) : m_buffer(buffer), m_pos(buffer.get()) {}
|
||||
|
||||
/*!
|
||||
* @brief Set message buffer.
|
||||
*
|
||||
* @param[in] buffer Message buffer to set.
|
||||
* @param[in] reserved Moved cursor position outside of reserved memory.
|
||||
*/
|
||||
void setBuffer(MessageBuffer &buffer, uint8_t reserved = 0);
|
||||
|
||||
/*!
|
||||
* @brief Get message buffer.
|
||||
*/
|
||||
MessageBuffer getBuffer(void);
|
||||
|
||||
/*!
|
||||
* @brief Get message buffer.
|
||||
*/
|
||||
MessageBuffer &getBufferRef(void);
|
||||
|
||||
/*!
|
||||
* @brief Return position in buffer.
|
||||
*
|
||||
* Return position, where it last write/read.
|
||||
*
|
||||
* @return Return position in buffer.
|
||||
*/
|
||||
uint8_t *get(void) { return m_pos; }
|
||||
|
||||
/*!
|
||||
* @brief Return position in buffer.
|
||||
*
|
||||
* Return position, where it last write/read.
|
||||
*
|
||||
* @return Return position in buffer.
|
||||
*/
|
||||
const uint8_t *get(void) const { return m_pos; }
|
||||
|
||||
/*!
|
||||
* @brief Return remaining free space in current buffer.
|
||||
*
|
||||
* @return Remaining free space in current buffer.
|
||||
*/
|
||||
uint16_t getRemaining(void) const { return m_buffer.getLength() - (uint16_t)(m_pos - m_buffer.get()); }
|
||||
|
||||
/*!
|
||||
* @brief Return remaining space from used of current buffer.
|
||||
*
|
||||
* @return Remaining space from used of current buffer.
|
||||
*/
|
||||
uint16_t getRemainingUsed(void) const { return m_buffer.getUsed() - (uint16_t)(m_pos - m_buffer.get()); }
|
||||
|
||||
/*!
|
||||
* @brief Read data from current buffer.
|
||||
*
|
||||
* @param[out] data Pointer to value, where copy read data.
|
||||
* @param[in] length How much bytes need be read.
|
||||
*
|
||||
* @retval kErpcStatus_Success
|
||||
* @retval kErpcStatus_BufferOverrun
|
||||
*/
|
||||
erpc_status_t read(void *data, uint32_t length);
|
||||
|
||||
/*!
|
||||
* @brief Read data from current buffer.
|
||||
*
|
||||
* @param[out] data Pointer to value to be sent.
|
||||
* @param[in] length How much bytes need be wrote.
|
||||
*
|
||||
* @retval kErpcStatus_Success
|
||||
* @retval kErpcStatus_BufferOverrun
|
||||
*/
|
||||
erpc_status_t write(const void *data, uint32_t length);
|
||||
|
||||
/*!
|
||||
* @brief Casting operator return local buffer.
|
||||
*/
|
||||
operator uint8_t *(void) { return m_pos; }
|
||||
|
||||
/*!
|
||||
* @brief Casting operator return local buffer.
|
||||
*/
|
||||
operator const uint8_t *(void) const { return m_pos; }
|
||||
|
||||
/*!
|
||||
* @brief Array operator return value of buffer at given index.
|
||||
*
|
||||
* @param[in] index Index in buffer.
|
||||
*/
|
||||
uint8_t &operator[](int index);
|
||||
|
||||
/*!
|
||||
* @brief Array operator return value of buffer at given index.
|
||||
*
|
||||
* @param[in] index Index in buffer.
|
||||
*/
|
||||
const uint8_t &operator[](int index) const;
|
||||
|
||||
/*!
|
||||
* @brief Sum operator return local buffer.
|
||||
*
|
||||
* @param[in] n Summing with n.
|
||||
*
|
||||
* @return Current cursor instance.
|
||||
*/
|
||||
Cursor &operator+=(uint16_t n);
|
||||
|
||||
/*!
|
||||
* @brief Subtract operator return local buffer.
|
||||
*
|
||||
* @param[in] n Subtracting with n.
|
||||
*
|
||||
* @return Current cursor instance.
|
||||
*/
|
||||
Cursor &operator-=(uint16_t n);
|
||||
|
||||
/*!
|
||||
* @brief Sum +1 operator.
|
||||
*
|
||||
* @return Current cursor instance.
|
||||
*/
|
||||
Cursor &operator++(void);
|
||||
|
||||
/*!
|
||||
* @brief Subtract -1 operator.
|
||||
*
|
||||
* @return Current cursor instance.
|
||||
*/
|
||||
Cursor &operator--(void);
|
||||
|
||||
private:
|
||||
MessageBuffer m_buffer; /*!< Buffer for reading or writing data. */
|
||||
uint8_t *m_pos; /*!< Position in buffer, where it last write/read */
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Abstract interface for message buffer factory.
|
||||
*
|
||||
* @ingroup infra_codec
|
||||
*/
|
||||
class MessageBufferFactory
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
MessageBufferFactory(void);
|
||||
|
||||
/*!
|
||||
* @brief MessageBufferFactory destructor
|
||||
*/
|
||||
virtual ~MessageBufferFactory(void);
|
||||
|
||||
/*!
|
||||
* @brief This function creates new message buffer.
|
||||
*
|
||||
* @return New created MessageBuffer.
|
||||
*/
|
||||
virtual MessageBuffer create(void) = 0;
|
||||
|
||||
/*!
|
||||
* @brief This function creates new message buffer with reserved bytes at the beginning
|
||||
*
|
||||
* Reserved bytes can be used by transport to write transport related header file data.
|
||||
*
|
||||
* @param[in] reserveHeaderSize Reserved amount of bytes at the beginning of message buffer.
|
||||
*
|
||||
* @return New created MessageBuffer.
|
||||
*/
|
||||
MessageBuffer create(uint8_t reserveHeaderSize);
|
||||
|
||||
/*!
|
||||
* @brief This function informs server if it has to create buffer for received message.
|
||||
*
|
||||
* @return Has to return TRUE when server need create buffer for receiving message.
|
||||
*/
|
||||
virtual bool createServerBuffer(void);
|
||||
|
||||
/*!
|
||||
* @brief This function is preparing output buffer on server side.
|
||||
*
|
||||
* This function do decision if this function want reuse buffer, or use new buffer.
|
||||
* In case of using new buffer function has to free given buffer.
|
||||
*
|
||||
* @param[in] message MessageBuffer which can be reused.
|
||||
* @param[in] reserveHeaderSize Reserved amount of bytes at the beginning of message buffer.
|
||||
*/
|
||||
virtual erpc_status_t prepareServerBufferForSend(MessageBuffer &message, uint8_t reserveHeaderSize = 0);
|
||||
|
||||
/*!
|
||||
* @brief This function disposes message buffer.
|
||||
*
|
||||
* @param[in] buf MessageBuffer to dispose.
|
||||
*/
|
||||
virtual void dispose(MessageBuffer *buf) = 0;
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__MESSAGE_BUFFER_H_
|
||||
98
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.cpp
vendored
Normal file
98
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.cpp
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2017-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include "erpc_config_internal.h"
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
|
||||
#include "erpc_manually_constructed.hpp"
|
||||
#include "erpc_message_loggers.hpp"
|
||||
|
||||
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||
#include <new>
|
||||
#endif
|
||||
|
||||
using namespace erpc;
|
||||
using namespace std;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(MessageLogger, s_messageLoggersManual, ERPC_MESSAGE_LOGGERS_COUNT);
|
||||
|
||||
MessageLoggers::~MessageLoggers(void)
|
||||
{
|
||||
MessageLogger *logger;
|
||||
|
||||
while (m_logger != NULL)
|
||||
{
|
||||
logger = m_logger;
|
||||
m_logger = m_logger->getNext();
|
||||
ERPC_DESTROY_OBJECT(logger, s_messageLoggersManual, ERPC_MESSAGE_LOGGERS_COUNT)
|
||||
}
|
||||
}
|
||||
|
||||
bool MessageLoggers::addMessageLogger(Transport *transport)
|
||||
{
|
||||
bool retVal = false;
|
||||
MessageLogger *logger;
|
||||
MessageLogger *_logger;
|
||||
|
||||
if (transport != NULL)
|
||||
{
|
||||
logger = create(transport);
|
||||
if (logger != NULL)
|
||||
{
|
||||
if (m_logger == NULL)
|
||||
{
|
||||
m_logger = logger;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger = m_logger;
|
||||
while (_logger->getNext() != NULL)
|
||||
{
|
||||
_logger = _logger->getNext();
|
||||
}
|
||||
|
||||
_logger->setNext(logger);
|
||||
}
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
erpc_status_t MessageLoggers::logMessage(MessageBuffer *msg)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
MessageLogger *_logger = m_logger;
|
||||
|
||||
while (_logger != NULL)
|
||||
{
|
||||
err = _logger->getLogger()->send(msg);
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
_logger = _logger->getNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
MessageLogger *MessageLoggers::create(Transport *transport)
|
||||
{
|
||||
ERPC_CREATE_NEW_OBJECT(MessageLogger, s_messageLoggersManual, ERPC_MESSAGE_LOGGERS_COUNT, transport)
|
||||
}
|
||||
|
||||
#endif /* ERPC_MESSAGE_LOGGING */
|
||||
125
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.hpp
vendored
Normal file
125
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.hpp
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright 2017 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__LOGEVENTLISTENERS_H_
|
||||
#define _EMBEDDED_RPC__LOGEVENTLISTENERS_H_
|
||||
|
||||
#include "erpc_transport.hpp"
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
|
||||
/*!
|
||||
* @brief Logging messages objects used for logging sent/received messages.
|
||||
*
|
||||
* @ingroup infra_utility
|
||||
*/
|
||||
class MessageLogger
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief MessageLogger constructor.
|
||||
*/
|
||||
explicit MessageLogger(Transport *transport) : m_next(NULL), m_transport(transport){};
|
||||
|
||||
/*!
|
||||
* @brief MessageLogger destructor
|
||||
*/
|
||||
~MessageLogger(void){};
|
||||
|
||||
/*!
|
||||
* @brief Return next logger.
|
||||
*
|
||||
* @return Pointer to next logger.
|
||||
*/
|
||||
MessageLogger *getNext(void) { return m_next; }
|
||||
|
||||
/*!
|
||||
* @brief Set next logger.
|
||||
*
|
||||
* @param[in] next Pointer to next logger.
|
||||
*/
|
||||
void setNext(MessageLogger *next) { m_next = next; }
|
||||
|
||||
/*!
|
||||
* @brief Returns next transport object used for logging messages.
|
||||
*
|
||||
* @return Transport object used for logging messages.
|
||||
*/
|
||||
Transport *getLogger(void) { return m_transport; }
|
||||
|
||||
protected:
|
||||
MessageLogger *m_next; /*!< Pointer to next logger. */
|
||||
Transport *m_transport; /*!< Pointer to transport object used for logging messages. */
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Logging messages functionality.
|
||||
*
|
||||
* @ingroup infra_utility
|
||||
*/
|
||||
class MessageLoggers
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
MessageLoggers(void) : m_logger(NULL){};
|
||||
|
||||
/*!
|
||||
* @brief Transport destructor
|
||||
*/
|
||||
~MessageLoggers(void);
|
||||
|
||||
/*!
|
||||
* @brief This function add given transport to newly created MessageLogger object.
|
||||
*
|
||||
* @param[in] transport Transport used for logging messages
|
||||
*
|
||||
* @retval True When transport was successfully added.
|
||||
* @retval False When transport wasn't added.
|
||||
*/
|
||||
bool addMessageLogger(Transport *transport);
|
||||
|
||||
protected:
|
||||
MessageLogger *m_logger; /*!< Pointer to first logger. */
|
||||
|
||||
/*!
|
||||
* @brief This function add given transport to newly created MessageLogger object.
|
||||
*
|
||||
* @param[in] msg Buffer which will be logged.
|
||||
*
|
||||
* @return The eRPC status based on transport type.
|
||||
*/
|
||||
erpc_status_t logMessage(MessageBuffer *msg);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief This function create new MessageLogger object
|
||||
*
|
||||
* @param[in] transport Transport used by MessageLogger.
|
||||
*
|
||||
* @return MessageLogger* Returns new MessageLogger object.
|
||||
*/
|
||||
MessageLogger *create(Transport *transport);
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__LOGEVENTLISTENERS_H_
|
||||
53
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.cpp
vendored
Normal file
53
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.cpp
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2020-2021 NXP
|
||||
* Copyright 2020 ACRIOS Systems s.r.o.
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
#if ERPC_PRE_POST_ACTION
|
||||
|
||||
#include "erpc_pre_post_action.h"
|
||||
#if ERPC_PRE_POST_ACTION_DEFAULT
|
||||
#include "erpc_setup_extensions.h"
|
||||
#endif
|
||||
|
||||
using namespace erpc;
|
||||
using namespace std;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void PrePostAction::addPreCB(pre_post_action_cb preCB)
|
||||
{
|
||||
if (preCB != NULL)
|
||||
{
|
||||
m_preCB = preCB;
|
||||
}
|
||||
#if ERPC_PRE_POST_ACTION_DEFAULT
|
||||
else
|
||||
{
|
||||
m_preCB = erpc_pre_cb_default;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void PrePostAction::addPostCB(pre_post_action_cb postCB)
|
||||
{
|
||||
if (postCB != NULL)
|
||||
{
|
||||
m_postCB = postCB;
|
||||
}
|
||||
#if ERPC_PRE_POST_ACTION_DEFAULT
|
||||
else
|
||||
{
|
||||
m_postCB = erpc_post_cb_default;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* ERPC_PRE_POST_ACTION */
|
||||
93
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.h
vendored
Normal file
93
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.h
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright 2020 NXP
|
||||
* Copyright 2020 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__PREPOSTACTION_H_
|
||||
#define _EMBEDDED_RPC__PREPOSTACTION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*pre_post_action_cb)(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
|
||||
/*!
|
||||
* @brief Client and server may used cb functions before and after rpc call.
|
||||
*
|
||||
* @ingroup infra_utility
|
||||
*/
|
||||
class PrePostAction
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief PrePostAction constructor.
|
||||
*/
|
||||
PrePostAction(void) : m_preCB(NULL), m_postCB(NULL){};
|
||||
|
||||
/*!
|
||||
* @brief This function sets "before eRPC call start" callback function.
|
||||
*
|
||||
* @param[in] preCB Pointer for callback function. When NULL and ERPC_PRE_POST_ACTION_DEFAULT
|
||||
* is enabled then default function will be set.
|
||||
*/
|
||||
void addPreCB(pre_post_action_cb preCB);
|
||||
|
||||
/*!
|
||||
* @brief This function sets "after eRPC call finish" callback function.
|
||||
*
|
||||
* @param[in] postCB Pointer for callback function. When NULL and ERPC_PRE_POST_ACTION_DEFAULT
|
||||
* is enabled then default function will be set.
|
||||
*/
|
||||
void addPostCB(pre_post_action_cb postCB);
|
||||
|
||||
/*!
|
||||
* @brief This function returns "before eRPC call start" callback function.
|
||||
*
|
||||
* @return preCB Pointer for callback function.
|
||||
*/
|
||||
pre_post_action_cb getPreCB(void) { return m_preCB; }
|
||||
|
||||
/*!
|
||||
* @brief This function returns "after eRPC call finish" callback function.
|
||||
*
|
||||
* @return postCB Pointer for callback function.
|
||||
*/
|
||||
pre_post_action_cb getPostCB(void) { return m_postCB; }
|
||||
|
||||
/*!
|
||||
* @brief PrePostAction destructor
|
||||
*/
|
||||
~PrePostAction(void){};
|
||||
|
||||
protected:
|
||||
pre_post_action_cb m_preCB; /*!< Pointer to "before eRPC call start" callback function. */
|
||||
pre_post_action_cb m_postCB; /*!< Pointer to after eRPC call finish" callback function. */
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _EMBEDDED_RPC__PREPOSTACTION_H_
|
||||
113
packages/erpc-1.14.0/erpc_c/infra/erpc_server.cpp
vendored
Normal file
113
packages/erpc-1.14.0/erpc_c/infra/erpc_server.cpp
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_server.hpp"
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ERPC_NESTED_CALLS_DETECTION
|
||||
extern bool nestingDetection;
|
||||
bool nestingDetection = false;
|
||||
#endif
|
||||
|
||||
void Server::addService(Service *service)
|
||||
{
|
||||
if (m_firstService == NULL)
|
||||
{
|
||||
m_firstService = service;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Service *link = m_firstService;
|
||||
while (link->getNext() != NULL)
|
||||
{
|
||||
link = link->getNext();
|
||||
}
|
||||
|
||||
link->setNext(service);
|
||||
}
|
||||
}
|
||||
|
||||
void Server::removeService(Service *service)
|
||||
{
|
||||
Service *link = m_firstService;
|
||||
|
||||
if (link == service)
|
||||
{
|
||||
m_firstService = link->getNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (link != NULL)
|
||||
{
|
||||
if (link->getNext() == service)
|
||||
{
|
||||
link->setNext(link->getNext()->getNext());
|
||||
break;
|
||||
}
|
||||
link = link->getNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
erpc_status_t Server::readHeadOfMessage(Codec *codec, message_type_t &msgType, uint32_t &serviceId, uint32_t &methodId,
|
||||
uint32_t &sequence)
|
||||
{
|
||||
codec->startReadMessage(msgType, serviceId, methodId, sequence);
|
||||
return codec->getStatus();
|
||||
}
|
||||
|
||||
erpc_status_t Server::processMessage(Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId,
|
||||
uint32_t sequence)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
Service *service;
|
||||
|
||||
if ((msgType != message_type_t::kInvocationMessage) && (msgType != message_type_t::kOnewayMessage))
|
||||
{
|
||||
err = kErpcStatus_InvalidArgument;
|
||||
}
|
||||
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
service = findServiceWithId(serviceId);
|
||||
if (service == NULL)
|
||||
{
|
||||
err = kErpcStatus_InvalidArgument;
|
||||
}
|
||||
}
|
||||
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
err = service->handleInvocation(methodId, sequence, codec, m_messageFactory, m_transport);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
Service *Server::findServiceWithId(uint32_t serviceId)
|
||||
{
|
||||
Service *service = m_firstService;
|
||||
while (service != NULL)
|
||||
{
|
||||
if (service->getServiceId() == serviceId)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
service = service->getNext();
|
||||
}
|
||||
return service;
|
||||
}
|
||||
199
packages/erpc-1.14.0/erpc_c/infra/erpc_server.hpp
vendored
Normal file
199
packages/erpc-1.14.0/erpc_c/infra/erpc_server.hpp
vendored
Normal file
@ -0,0 +1,199 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* Copyright 2020 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__SERVER_H_
|
||||
#define _EMBEDDED_RPC__SERVER_H_
|
||||
|
||||
#include "erpc_client_server_common.hpp"
|
||||
#include "erpc_config_internal.h"
|
||||
#if ERPC_NESTED_CALLS
|
||||
#include "erpc_client_manager.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_server
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
#if ERPC_NESTED_CALLS
|
||||
class RequestContext;
|
||||
#endif
|
||||
/*!
|
||||
* @brief Abstract interface for service, which can be executed on server side.
|
||||
*
|
||||
* @ingroup infra_server
|
||||
*/
|
||||
class Service
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
Service(uint32_t serviceId) : m_serviceId(serviceId), m_next(NULL) {}
|
||||
|
||||
/*!
|
||||
* @brief Service destructor
|
||||
*/
|
||||
virtual ~Service(void) {}
|
||||
|
||||
/*!
|
||||
* @brief Return service id number.
|
||||
*
|
||||
* @return Service id number.
|
||||
*/
|
||||
uint32_t getServiceId(void) const { return m_serviceId; }
|
||||
|
||||
/*!
|
||||
* @brief Return next service.
|
||||
*
|
||||
* @return Pointer to next service.
|
||||
*/
|
||||
Service *getNext(void) { return m_next; }
|
||||
|
||||
/*!
|
||||
* @brief Set next service.
|
||||
*
|
||||
* @param[in] next Pointer to next service.
|
||||
*/
|
||||
void setNext(Service *next) { m_next = next; }
|
||||
|
||||
/*!
|
||||
* @brief This function call function implementation of current service.
|
||||
*
|
||||
* @param[in] methodId Id number of function, which is requested.
|
||||
* @param[in] sequence Sequence number. To be sure that reply from server belongs to client request.
|
||||
* @param[in] codec For reading and writing data.
|
||||
* @param[in] messageFactory Used for setting output buffer.
|
||||
*
|
||||
* @return Based on handleInvocation implementation.
|
||||
*/
|
||||
virtual erpc_status_t handleInvocation(uint32_t methodId, uint32_t sequence, Codec *codec,
|
||||
MessageBufferFactory *messageFactory, Transport *transport) = 0;
|
||||
|
||||
protected:
|
||||
uint32_t m_serviceId; /*!< Service unique id. */
|
||||
Service *m_next; /*!< Pointer to next service. */
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Based server functionality.
|
||||
*
|
||||
* @ingroup infra_server
|
||||
*/
|
||||
class Server : public ClientServerCommon
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
Server(void) : ClientServerCommon(), m_firstService(NULL) {}
|
||||
|
||||
/*!
|
||||
* @brief Server destructor
|
||||
*/
|
||||
virtual ~Server(void) {}
|
||||
|
||||
/*!
|
||||
* @brief Add service.
|
||||
*
|
||||
* @param[in] service Service to use.
|
||||
*/
|
||||
void addService(Service *service);
|
||||
|
||||
/*!
|
||||
* @brief Remove service.
|
||||
*
|
||||
* @param[in] service Service to remove.
|
||||
*/
|
||||
void removeService(Service *service);
|
||||
|
||||
/*!
|
||||
* @brief This function runs the server.
|
||||
*/
|
||||
virtual erpc_status_t run(void) = 0;
|
||||
|
||||
/*!
|
||||
* @brief This function stop the server.
|
||||
*/
|
||||
virtual void stop(void) = 0;
|
||||
|
||||
protected:
|
||||
Service *m_firstService; /*!< Contains pointer to first service. */
|
||||
|
||||
/*!
|
||||
* @brief Process message.
|
||||
*
|
||||
* @param[in] codec Inout codec to use.
|
||||
* @param[in] msgType Type of received message. Based on message type will be (will be not) sent respond.
|
||||
* @param[in] serviceId To identify interface.
|
||||
* @param[in] methodId To identify function in interface.
|
||||
* @param[in] sequence To connect correct answer with correct request.
|
||||
*
|
||||
* @returns #kErpcStatus_Success or based on codec startReadMessage.
|
||||
*/
|
||||
virtual erpc_status_t processMessage(Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId,
|
||||
uint32_t sequence);
|
||||
|
||||
/*!
|
||||
* @brief Read head of message to identify type of message.
|
||||
*
|
||||
* @param[in] codec Inout codec to use.
|
||||
* @param[out] msgType Type of received message. Based on message type will be (will be not) sent respond.
|
||||
* @param[out] serviceId To identify interface.
|
||||
* @param[out] methodId To identify function in interface.
|
||||
* @param[out] sequence To connect correct answer with correct request.
|
||||
*
|
||||
* @returns #kErpcStatus_Success or based on service handleInvocation.
|
||||
*/
|
||||
virtual erpc_status_t readHeadOfMessage(Codec *codec, message_type_t &msgType, uint32_t &serviceId,
|
||||
uint32_t &methodId, uint32_t &sequence);
|
||||
|
||||
/*!
|
||||
* @brief This function finds service base on service ID.
|
||||
*
|
||||
* @param[in] serviceId Service id number.
|
||||
*
|
||||
* @return Pointer to service or NULL.
|
||||
*/
|
||||
virtual Service *findServiceWithId(uint32_t serviceId);
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
friend class ClientManager;
|
||||
friend class ArbitratedClientManager;
|
||||
|
||||
/*!
|
||||
* @brief This function runs the server.
|
||||
*
|
||||
* @param[in] Request context to check that answer was for nested call.
|
||||
*/
|
||||
virtual erpc_status_t run(RequestContext &request) = 0;
|
||||
#endif
|
||||
|
||||
private:
|
||||
// Disable copy ctor.
|
||||
Server(const Server &other); /*!< Disable copy ctor. */
|
||||
Server &operator=(const Server &other); /*!< Disable copy ctor. */
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__SERVER_H_
|
||||
244
packages/erpc-1.14.0/erpc_c/infra/erpc_simple_server.cpp
vendored
Normal file
244
packages/erpc-1.14.0/erpc_c/infra/erpc_simple_server.cpp
vendored
Normal file
@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2019-2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_simple_server.hpp"
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
SimpleServer::SimpleServer(void) : m_isServerOn(true) {}
|
||||
|
||||
SimpleServer::~SimpleServer(void) {}
|
||||
|
||||
erpc_status_t SimpleServer::run(void)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
while ((err == kErpcStatus_Success) && m_isServerOn)
|
||||
{
|
||||
err = runInternal();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t SimpleServer::poll(void)
|
||||
{
|
||||
erpc_status_t err;
|
||||
|
||||
if (m_isServerOn)
|
||||
{
|
||||
if (m_transport->hasMessage() == true)
|
||||
{
|
||||
err = runInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
err = kErpcStatus_Success;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = kErpcStatus_ServerIsDown;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void SimpleServer::stop(void)
|
||||
{
|
||||
m_isServerOn = false;
|
||||
}
|
||||
|
||||
erpc_status_t SimpleServer::runInternal(void)
|
||||
{
|
||||
MessageBuffer buff;
|
||||
Codec *codec = NULL;
|
||||
|
||||
// Handle the request.
|
||||
message_type_t msgType;
|
||||
uint32_t serviceId;
|
||||
uint32_t methodId;
|
||||
uint32_t sequence;
|
||||
|
||||
erpc_status_t err = runInternalBegin(&codec, buff, msgType, serviceId, methodId, sequence);
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
err = runInternalEnd(codec, msgType, serviceId, methodId, sequence);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t SimpleServer::runInternalBegin(Codec **codec, MessageBuffer &buff, message_type_t &msgType,
|
||||
uint32_t &serviceId, uint32_t &methodId, uint32_t &sequence)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
|
||||
if (m_messageFactory->createServerBuffer() == true)
|
||||
{
|
||||
buff = m_messageFactory->create();
|
||||
if (NULL == buff.get())
|
||||
{
|
||||
err = kErpcStatus_MemoryError;
|
||||
}
|
||||
}
|
||||
|
||||
// Receive the next invocation request.
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
err = m_transport->receive(&buff);
|
||||
}
|
||||
|
||||
#if ERPC_PRE_POST_ACTION
|
||||
pre_post_action_cb preCB = this->getPreCB();
|
||||
if (preCB != NULL)
|
||||
{
|
||||
preCB();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
err = logMessage(&buff);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
*codec = m_codecFactory->create();
|
||||
if (*codec == NULL)
|
||||
{
|
||||
err = kErpcStatus_MemoryError;
|
||||
}
|
||||
}
|
||||
|
||||
if (err != kErpcStatus_Success)
|
||||
{
|
||||
// Dispose of buffers.
|
||||
if (buff.get() != NULL)
|
||||
{
|
||||
m_messageFactory->dispose(&buff);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
(*codec)->setBuffer(buff, m_transport->reserveHeaderSize());
|
||||
|
||||
err = readHeadOfMessage(*codec, msgType, serviceId, methodId, sequence);
|
||||
if (err != kErpcStatus_Success)
|
||||
{
|
||||
// Dispose of buffers and codecs.
|
||||
disposeBufferAndCodec(*codec);
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t SimpleServer::runInternalEnd(Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId,
|
||||
uint32_t sequence)
|
||||
{
|
||||
erpc_status_t err = processMessage(codec, msgType, serviceId, methodId, sequence);
|
||||
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
if (msgType != message_type_t::kOnewayMessage)
|
||||
{
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
err = logMessage(codec->getBuffer());
|
||||
if (err == kErpcStatus_Success)
|
||||
{
|
||||
#endif
|
||||
err = m_transport->send(&codec->getBufferRef());
|
||||
#if ERPC_MESSAGE_LOGGING
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ERPC_PRE_POST_ACTION
|
||||
pre_post_action_cb postCB = this->getPostCB();
|
||||
if (postCB != NULL)
|
||||
{
|
||||
postCB();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Dispose of buffers and codecs.
|
||||
disposeBufferAndCodec(codec);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
erpc_status_t SimpleServer::run(RequestContext &request)
|
||||
{
|
||||
erpc_status_t err = kErpcStatus_Success;
|
||||
message_type_t msgType;
|
||||
uint32_t serviceId;
|
||||
uint32_t methodId;
|
||||
uint32_t sequence;
|
||||
|
||||
while ((err == kErpcStatus_Success) && m_isServerOn)
|
||||
{
|
||||
MessageBuffer buff;
|
||||
Codec *codec = NULL;
|
||||
|
||||
// Handle the request.
|
||||
err = runInternalBegin(&codec, buff, msgType, serviceId, methodId, sequence);
|
||||
|
||||
if (err != kErpcStatus_Success)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (msgType == message_type_t::kReplyMessage)
|
||||
{
|
||||
if (sequence == request.getSequence())
|
||||
{
|
||||
// Swap the received message buffer with the client's message buffer.
|
||||
request.getCodec()->getBufferRef().swap(&buff);
|
||||
codec->setBuffer(buff);
|
||||
}
|
||||
|
||||
// Dispose of buffers and codecs.
|
||||
disposeBufferAndCodec(codec);
|
||||
|
||||
if (sequence != request.getSequence())
|
||||
{
|
||||
// Ignore message
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = runInternalEnd(codec, msgType, serviceId, methodId, sequence);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SimpleServer::disposeBufferAndCodec(Codec *codec)
|
||||
{
|
||||
if (codec != NULL)
|
||||
{
|
||||
if (codec->getBuffer() != NULL)
|
||||
{
|
||||
m_messageFactory->dispose(&codec->getBufferRef());
|
||||
}
|
||||
m_codecFactory->dispose(codec);
|
||||
}
|
||||
}
|
||||
128
packages/erpc-1.14.0/erpc_c/infra/erpc_simple_server.hpp
vendored
Normal file
128
packages/erpc-1.14.0/erpc_c/infra/erpc_simple_server.hpp
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__SIMPLE_SERVER_H_
|
||||
#define _EMBEDDED_RPC__SIMPLE_SERVER_H_
|
||||
|
||||
#include "erpc_server.hpp"
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_server
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
/*!
|
||||
* @brief Based server implementation.
|
||||
*
|
||||
* @ingroup infra_server
|
||||
*/
|
||||
class SimpleServer : public Server
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*
|
||||
* This function initializes object attributes.
|
||||
*/
|
||||
SimpleServer(void);
|
||||
|
||||
virtual ~SimpleServer(void);
|
||||
|
||||
/*!
|
||||
* @brief Run server in infinite loop.
|
||||
*
|
||||
* Will never jump out from this function.
|
||||
*/
|
||||
virtual erpc_status_t run(void) override;
|
||||
|
||||
/*!
|
||||
* @brief Run server implementation only if exist message to process.
|
||||
*
|
||||
* If is message to process, server process it and jumps out from this function,
|
||||
* useful for bare-metal because doesn't block main loop, when are not messages
|
||||
* to process.
|
||||
*
|
||||
* @return Return true when server is ON, else false.
|
||||
*/
|
||||
virtual erpc_status_t poll(void);
|
||||
|
||||
/*!
|
||||
* @brief This function sets server from ON to OFF
|
||||
*/
|
||||
virtual void stop(void) override;
|
||||
|
||||
protected:
|
||||
bool m_isServerOn; /*!< Information if server is ON or OFF. */
|
||||
|
||||
/*!
|
||||
* @brief Run server implementation.
|
||||
*
|
||||
* This function call functions for receiving data, process this data and
|
||||
* if reply exist, send it back.
|
||||
*/
|
||||
erpc_status_t runInternal(void);
|
||||
|
||||
/*!
|
||||
* @brief This function handle receiving request message and reading base info about message.
|
||||
*
|
||||
* @param[in] codec Inout codec to use.
|
||||
* @param[in] buff Inout codec to use.
|
||||
* @param[out] msgType Type of received message. Based on message type will be (will be not) sent respond.
|
||||
* @param[out] serviceId To identify interface.
|
||||
* @param[out] methodId To identify function in interface.
|
||||
* @param[out] sequence To connect correct answer with correct request.
|
||||
*
|
||||
* @returns #kErpcStatus_Success or based on service handleInvocation.
|
||||
*/
|
||||
erpc_status_t runInternalBegin(Codec **codec, MessageBuffer &buff, message_type_t &msgType, uint32_t &serviceId,
|
||||
uint32_t &methodId, uint32_t &sequence);
|
||||
|
||||
/*!
|
||||
* @brief This function process message and handle sending respond.
|
||||
*
|
||||
* @param[in] codec Inout codec to use.
|
||||
* @param[in] msgType Type of received message. Based on message type will be (will be not) sent respond.
|
||||
* @param[in] serviceId To identify interface.
|
||||
* @param[in] methodId To identify function in interface.
|
||||
* @param[in] sequence To connect correct answer with correct request.
|
||||
*
|
||||
* @returns #kErpcStatus_Success or based on service handleInvocation.
|
||||
*/
|
||||
erpc_status_t runInternalEnd(Codec *codec, message_type_t msgType, uint32_t serviceId, uint32_t methodId,
|
||||
uint32_t sequence);
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
/*!
|
||||
* @brief This function runs the server.
|
||||
*
|
||||
* @param[in] Request context to check that answer was for nested call.
|
||||
*/
|
||||
virtual erpc_status_t run(RequestContext &request) override;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief Disposing message buffers and codecs.
|
||||
*
|
||||
* @param[in] codec Pointer to codec to dispose. It contains also message buffer to dispose.
|
||||
*/
|
||||
void disposeBufferAndCodec(Codec *codec);
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__SIMPLE_SERVER_H_
|
||||
120
packages/erpc-1.14.0/erpc_c/infra/erpc_static_queue.hpp
vendored
Normal file
120
packages/erpc-1.14.0/erpc_c/infra/erpc_static_queue.hpp
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2021 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef __embedded_rpc__static_queue__
|
||||
#define __embedded_rpc__static_queue__
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_utility
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
/*!
|
||||
* @brief Template class which implements static queue as ring buffer
|
||||
*
|
||||
* @ingroup infra_utility
|
||||
*/
|
||||
template <class T, uint32_t elementCount>
|
||||
class StaticQueue
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor of StaticQueue class.
|
||||
*
|
||||
* This function sets capacity of queue, m_head and m_tail indexes to zero.
|
||||
*/
|
||||
StaticQueue(void)
|
||||
{
|
||||
m_capacity = elementCount;
|
||||
m_head = 0;
|
||||
m_tail = 0;
|
||||
(void)memset(m_storage, 0, sizeof(m_storage));
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Destructor of StaticQueue class.
|
||||
*
|
||||
* This function free allocated buffer for m_data.
|
||||
*/
|
||||
~StaticQueue(void) {}
|
||||
/*!
|
||||
* @brief This function adds element to queue.
|
||||
*
|
||||
* @param[in] element Element for adding.
|
||||
*
|
||||
* @retval true Element was added.
|
||||
* @retval false Element was not added, queue is full.
|
||||
*/
|
||||
bool add(T element)
|
||||
{
|
||||
if ((m_head + 1U) % m_capacity != m_tail)
|
||||
{
|
||||
(void)std::memcpy(m_storage[m_head], &element, sizeof(T));
|
||||
m_head = (m_head + 1U) % m_capacity;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief This function returns element from queue.
|
||||
*
|
||||
* @param[out] element Pointer to element to which will be copied element from queue.
|
||||
*
|
||||
* @retval true Element was copied from queue.
|
||||
* @retval false Element was not copied, queue is empty.
|
||||
*/
|
||||
bool get(T *element)
|
||||
{
|
||||
if (m_tail != m_head)
|
||||
{
|
||||
(void)std::memcpy(element, m_storage[m_tail], sizeof(T));
|
||||
m_tail = (m_tail + 1U) % m_capacity;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief This function returns number of elements in queue.
|
||||
*
|
||||
* @return Number of elements in queue.
|
||||
*/
|
||||
uint32_t size(void)
|
||||
{
|
||||
if (m_head >= m_tail)
|
||||
{
|
||||
return m_head - m_tail;
|
||||
}
|
||||
return (m_capacity - m_tail + m_head);
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64_t m_storage[elementCount]
|
||||
[(sizeof(T) + sizeof(uint64_t) - 1U) / sizeof(uint64_t)]; /*!< Preallocated space based on data
|
||||
type size and elements count. */
|
||||
uint32_t m_capacity; /*!< Capacity of queue */
|
||||
uint32_t volatile m_head; /*!< Index to free slot */
|
||||
uint32_t volatile m_tail; /*!< Index to slot with m_data */
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // defined(__embedded_rpc__static_queue__)
|
||||
134
packages/erpc-1.14.0/erpc_c/infra/erpc_transport.hpp
vendored
Normal file
134
packages/erpc-1.14.0/erpc_c/infra/erpc_transport.hpp
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _EMBEDDED_RPC__TRANSPORT_H_
|
||||
#define _EMBEDDED_RPC__TRANSPORT_H_
|
||||
|
||||
#include "erpc_common.h"
|
||||
#include "erpc_crc16.hpp"
|
||||
#include "erpc_message_buffer.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
|
||||
/*!
|
||||
* @brief Abstract interface for transport layer.
|
||||
*
|
||||
* @ingroup infra_transport
|
||||
*/
|
||||
class Transport
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
Transport(void) {}
|
||||
|
||||
/*!
|
||||
* @brief Transport destructor
|
||||
*/
|
||||
virtual ~Transport(void) {}
|
||||
|
||||
/**
|
||||
* @brief Size of data placed in MessageBuffer before serializing eRPC data.
|
||||
*
|
||||
* @return uint8_t Amount of bytes, reserved before serialized data.
|
||||
*/
|
||||
virtual uint8_t reserveHeaderSize(void) { return 0; }
|
||||
|
||||
/*!
|
||||
* @brief Prototype for receiving message.
|
||||
*
|
||||
* Each transport layer need define this function.
|
||||
*
|
||||
* @param[out] message Will return pointer to received message buffer.
|
||||
*
|
||||
* @return based on receive implementation.
|
||||
*/
|
||||
virtual erpc_status_t receive(MessageBuffer *message) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for send message.
|
||||
*
|
||||
* Each transport layer need define this function.
|
||||
*
|
||||
* @param[in] message Pass message buffer to send.
|
||||
*
|
||||
* @return based on send implementation.
|
||||
*/
|
||||
virtual erpc_status_t send(MessageBuffer *message) = 0;
|
||||
|
||||
/*!
|
||||
* @brief Poll for an incoming message.
|
||||
*
|
||||
* This function should return true if are some messages to process by server,
|
||||
* the return value should be tested before calling receive function to avoid
|
||||
* waiting for a new message (receive can be implemented as blocking function).
|
||||
*
|
||||
* @retval True when a message is available to process, else false.
|
||||
*/
|
||||
virtual bool hasMessage(void) { return true; }
|
||||
|
||||
/*!
|
||||
* @brief This functions sets the CRC-16 implementation.
|
||||
*
|
||||
* @param[in] crcImpl Object containing crc-16 compute function.
|
||||
*/
|
||||
virtual void setCrc16(Crc16 *crcImpl) { (void)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) { return NULL; }
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Abstract interface for transport factory.
|
||||
*
|
||||
* @ingroup infra_transport
|
||||
*/
|
||||
class TransportFactory
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
TransportFactory(void) {}
|
||||
|
||||
/*!
|
||||
* @brief TransportFactory destructor
|
||||
*/
|
||||
virtual ~TransportFactory(void) {}
|
||||
|
||||
/*!
|
||||
* @brief Return created transport object.
|
||||
*
|
||||
* @return Pointer to created transport object.
|
||||
*/
|
||||
virtual Transport *create(void) = 0;
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // _EMBEDDED_RPC__TRANSPORT_H_
|
||||
288
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.cpp
vendored
Normal file
288
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.cpp
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2021 NXP
|
||||
* Copyright 2021 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include "erpc_transport_arbitrator.hpp"
|
||||
|
||||
#include "erpc_config_internal.h"
|
||||
#include "erpc_manually_constructed.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#if ERPC_THREADS_IS(NONE)
|
||||
#error "Arbitrator code does not work in no-threading configuration."
|
||||
#endif
|
||||
|
||||
using namespace erpc;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Code
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(TransportArbitrator::PendingClientInfo, s_pendingClientInfoArray,
|
||||
ERPC_CLIENTS_THREADS_AMOUNT);
|
||||
|
||||
TransportArbitrator::TransportArbitrator(void) :
|
||||
Transport(), m_sharedTransport(NULL), m_codec(NULL), m_clientList(NULL), m_clientFreeList(NULL), m_clientListMutex()
|
||||
{
|
||||
}
|
||||
|
||||
TransportArbitrator::~TransportArbitrator(void)
|
||||
{
|
||||
// Dispose of client info objects.
|
||||
freeClientList(m_clientList);
|
||||
freeClientList(m_clientFreeList);
|
||||
}
|
||||
|
||||
uint8_t TransportArbitrator::reserveHeaderSize(void)
|
||||
{
|
||||
return m_sharedTransport->reserveHeaderSize();
|
||||
}
|
||||
|
||||
erpc_status_t TransportArbitrator::receive(MessageBuffer *message)
|
||||
{
|
||||
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));
|
||||
|
||||
erpc_status_t err;
|
||||
message_type_t msgType;
|
||||
uint32_t service;
|
||||
uint32_t requestNumber;
|
||||
uint32_t sequence;
|
||||
PendingClientInfo *client;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Receive a message.
|
||||
err = m_sharedTransport->receive(message);
|
||||
if (err != kErpcStatus_Success)
|
||||
{
|
||||
// if we timeout, we must unblock all pending client(s)
|
||||
if (err == kErpcStatus_Timeout)
|
||||
{
|
||||
client = m_clientList;
|
||||
for (; client; client = client->m_next)
|
||||
{
|
||||
if (client->m_isValid)
|
||||
{
|
||||
client->m_sem.put();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
m_codec->setBuffer(*message, m_sharedTransport->reserveHeaderSize());
|
||||
|
||||
// Parse the message header.
|
||||
m_codec->startReadMessage(msgType, service, requestNumber, sequence);
|
||||
err = m_codec->getStatus();
|
||||
if (err != kErpcStatus_Success)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this message is an invocation, return it to the calling server.
|
||||
if ((msgType == message_type_t::kInvocationMessage) || (msgType == message_type_t::kOnewayMessage))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Just ignore messages we don't know what to do with.
|
||||
if (msgType != message_type_t::kReplyMessage)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if there is a client waiting for this message.
|
||||
client = m_clientList;
|
||||
for (; client; client = client->m_next)
|
||||
{
|
||||
if (client->m_isValid && (sequence == client->m_request->getSequence()))
|
||||
{
|
||||
// Swap the received message buffer with the client's message buffer.
|
||||
client->m_request->getCodec()->getBufferRef().swap(message);
|
||||
|
||||
// Wake up the client receive thread.
|
||||
client->m_sem.put();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if ERPC_NESTED_CALLS
|
||||
// If received answer is not for postponed client, it can be for nested server call.
|
||||
if (client == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
erpc_status_t TransportArbitrator::send(MessageBuffer *message)
|
||||
{
|
||||
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));
|
||||
return m_sharedTransport->send(message);
|
||||
}
|
||||
|
||||
bool TransportArbitrator::hasMessage(void)
|
||||
{
|
||||
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));
|
||||
|
||||
return m_sharedTransport->hasMessage();
|
||||
}
|
||||
|
||||
void TransportArbitrator::setCrc16(Crc16 *crcImpl)
|
||||
{
|
||||
erpc_assert(crcImpl != NULL);
|
||||
erpc_assert(m_sharedTransport != NULL);
|
||||
m_sharedTransport->setCrc16(crcImpl);
|
||||
}
|
||||
|
||||
Crc16 *TransportArbitrator::getCrc16(void)
|
||||
{
|
||||
erpc_assert(m_sharedTransport != NULL);
|
||||
return m_sharedTransport->getCrc16();
|
||||
}
|
||||
|
||||
void TransportArbitrator::setSharedTransport(Transport *shared)
|
||||
{
|
||||
m_sharedTransport = shared;
|
||||
}
|
||||
|
||||
Transport *TransportArbitrator::getSharedTransport(void)
|
||||
{
|
||||
return m_sharedTransport;
|
||||
}
|
||||
|
||||
void TransportArbitrator::setCodec(Codec *codec)
|
||||
{
|
||||
m_codec = codec;
|
||||
}
|
||||
|
||||
Codec *TransportArbitrator::getCodec(void)
|
||||
{
|
||||
return m_codec;
|
||||
}
|
||||
|
||||
TransportArbitrator::client_token_t TransportArbitrator::prepareClientReceive(RequestContext &request)
|
||||
{
|
||||
PendingClientInfo *info = addPendingClient();
|
||||
if (NULL != info)
|
||||
{
|
||||
info->m_request = &request;
|
||||
info->m_isValid = true;
|
||||
}
|
||||
return reinterpret_cast<client_token_t>(info);
|
||||
}
|
||||
|
||||
erpc_status_t TransportArbitrator::clientReceive(client_token_t token)
|
||||
{
|
||||
erpc_assert((token != 0) && ("invalid client token" != NULL));
|
||||
|
||||
// Convert token to pointer to info struct for this client receive request.
|
||||
PendingClientInfo *info = reinterpret_cast<PendingClientInfo *>(token);
|
||||
|
||||
// Wait on the semaphore until we're signaled.
|
||||
info->m_sem.get(Semaphore::kWaitForever);
|
||||
|
||||
return kErpcStatus_Success;
|
||||
}
|
||||
|
||||
TransportArbitrator::PendingClientInfo *TransportArbitrator::createPendingClient(void){ ERPC_CREATE_NEW_OBJECT(
|
||||
TransportArbitrator::PendingClientInfo, s_pendingClientInfoArray, ERPC_CLIENTS_THREADS_AMOUNT) }
|
||||
|
||||
TransportArbitrator::PendingClientInfo *TransportArbitrator::addPendingClient(void)
|
||||
{
|
||||
Mutex::Guard lock(m_clientListMutex);
|
||||
|
||||
// Get a free client info node, or allocate one.
|
||||
PendingClientInfo *info = NULL;
|
||||
if (m_clientFreeList == NULL)
|
||||
{
|
||||
info = createPendingClient();
|
||||
}
|
||||
else
|
||||
{
|
||||
info = m_clientFreeList;
|
||||
m_clientFreeList = m_clientFreeList->m_next;
|
||||
}
|
||||
|
||||
if (info != NULL)
|
||||
{
|
||||
// Add to active list.
|
||||
info->m_next = m_clientList;
|
||||
m_clientList = info;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void TransportArbitrator::removePendingClient(client_token_t token)
|
||||
{
|
||||
// Convert token to pointer to info struct.
|
||||
PendingClientInfo *info = reinterpret_cast<PendingClientInfo *>(token);
|
||||
Mutex::Guard lock(m_clientListMutex);
|
||||
PendingClientInfo *node;
|
||||
|
||||
erpc_assert((token != 0) && ("invalid client token" != NULL));
|
||||
erpc_assert((info->m_sem.getCount() == 0) && ("Semaphore should be clean" != NULL));
|
||||
|
||||
// Clear fields.
|
||||
info->m_request = NULL;
|
||||
info->m_isValid = false;
|
||||
|
||||
// Remove from active list.
|
||||
if (m_clientList == info)
|
||||
{
|
||||
m_clientList = info->m_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
node = m_clientList;
|
||||
while (node != NULL)
|
||||
{
|
||||
if (node->m_next == info)
|
||||
{
|
||||
node->m_next = info->m_next;
|
||||
break;
|
||||
}
|
||||
node = node->m_next;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to free list.
|
||||
info->m_next = m_clientFreeList;
|
||||
m_clientFreeList = info;
|
||||
}
|
||||
|
||||
void TransportArbitrator::freeClientList(PendingClientInfo *list)
|
||||
{
|
||||
PendingClientInfo *info = list;
|
||||
PendingClientInfo *temp;
|
||||
|
||||
while (info != NULL)
|
||||
{
|
||||
temp = info;
|
||||
info = info->m_next;
|
||||
ERPC_DESTROY_OBJECT(temp, s_pendingClientInfoArray, ERPC_CLIENTS_THREADS_AMOUNT)
|
||||
}
|
||||
}
|
||||
|
||||
TransportArbitrator::PendingClientInfo::PendingClientInfo(void) :
|
||||
m_request(NULL), m_sem(0), m_isValid(false), m_next(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
TransportArbitrator::PendingClientInfo::~PendingClientInfo(void) {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// EOF
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
230
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.hpp
vendored
Normal file
230
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.hpp
vendored
Normal file
@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#if !defined(__embedded_rpc__transport_arbitrator__)
|
||||
#define __embedded_rpc__transport_arbitrator__
|
||||
|
||||
#include "erpc_client_manager.h"
|
||||
#include "erpc_codec.hpp"
|
||||
#include "erpc_threading.h"
|
||||
#include "erpc_transport.hpp"
|
||||
|
||||
/*!
|
||||
* @addtogroup infra_transport
|
||||
* @{
|
||||
* @file
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace erpc {
|
||||
class Codec;
|
||||
|
||||
/*!
|
||||
* @brief Interposer to share transport between client and server.
|
||||
*
|
||||
* Allocates memory for client receive request info. This memory is never freed. It is put on a
|
||||
* free list and is reused for future client receives. The class will allocate as many client
|
||||
* receive info structs as the maximum number of simultaneous client receive requests from different
|
||||
* threads.
|
||||
*
|
||||
* @ingroup infra_transport
|
||||
*/
|
||||
class TransportArbitrator : public Transport
|
||||
{
|
||||
public:
|
||||
//! @brief Represents a single client's receive request.
|
||||
typedef uintptr_t client_token_t;
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
TransportArbitrator(void);
|
||||
|
||||
/*!
|
||||
* @brief Destructor.
|
||||
*/
|
||||
virtual ~TransportArbitrator(void);
|
||||
|
||||
/**
|
||||
* @brief Size of data placed in MessageBuffer before serializing eRPC data.
|
||||
*
|
||||
* @return uint8_t Amount of bytes, reserved before serialized data.
|
||||
*/
|
||||
virtual uint8_t reserveHeaderSize(void) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for receiving message.
|
||||
*
|
||||
* Each transport layer need define this function.
|
||||
*
|
||||
* @param[out] message Will return pointer to received message buffer.
|
||||
*
|
||||
* @return based on receive implementation.
|
||||
*/
|
||||
virtual erpc_status_t receive(MessageBuffer *message) override;
|
||||
|
||||
/*!
|
||||
* @brief Prototype for send message.
|
||||
*
|
||||
* Each transport layer need define this function.
|
||||
*
|
||||
* @param[in] message Pass message buffer to send.
|
||||
*
|
||||
* @return based on send implementation.
|
||||
*/
|
||||
virtual erpc_status_t send(MessageBuffer *message) override;
|
||||
|
||||
/*!
|
||||
* @brief Check if the underlying shared transport has a message
|
||||
*
|
||||
* @retval The underlying transport is expected to return true when a message is available to
|
||||
* process and false otherwise.
|
||||
*/
|
||||
virtual bool hasMessage(void) override;
|
||||
|
||||
/*!
|
||||
* @brief This functions sets the CRC-16 implementation.
|
||||
*
|
||||
* @param[in] crcImpl Object containing crc-16 compute function.
|
||||
*/
|
||||
virtual void setCrc16(Crc16 *crcImpl) override;
|
||||
|
||||
/*!
|
||||
* @brief This functions gets the CRC-16 object.
|
||||
*
|
||||
* @return Crc16* Pointer to CRC-16 object containing crc-16 compute function.
|
||||
*/
|
||||
virtual Crc16 *getCrc16(void) override;
|
||||
|
||||
/*!
|
||||
* @brief This function set shared client/server transport.
|
||||
*
|
||||
* @param[in] shared Shared client/server transport.
|
||||
*/
|
||||
void setSharedTransport(Transport *shared);
|
||||
|
||||
/*!
|
||||
* @brief This function returns shared client/server transport.
|
||||
*
|
||||
* @return Transport * Returns shared client/server transport.
|
||||
*/
|
||||
Transport *getSharedTransport(void);
|
||||
|
||||
/*!
|
||||
* @brief This function set codec.
|
||||
*
|
||||
* @param[in] codec Codec.
|
||||
*/
|
||||
void setCodec(Codec *codec);
|
||||
|
||||
/*!
|
||||
* @brief This function get codec.
|
||||
*
|
||||
* @return Codec * Pointer to codec used within transport.
|
||||
*/
|
||||
Codec *getCodec(void);
|
||||
|
||||
/*!
|
||||
* @brief Add a client request to the client list.
|
||||
*
|
||||
* This call is made by the client thread prior to sending the invocation to the server. It
|
||||
* ensures that the transport arbitrator has the client's response message buffer ready in
|
||||
* case it sees the response before the client even has a chance to call clientReceive().
|
||||
*
|
||||
* @param[in] request Reuquest context for receive action.
|
||||
*
|
||||
* @return A token is returned to the client
|
||||
*/
|
||||
client_token_t prepareClientReceive(RequestContext &request);
|
||||
|
||||
/*!
|
||||
* @brief Receive method for the client.
|
||||
*
|
||||
* Blocks until the a reply message is received with the expected sequence number that is
|
||||
* associated with @a token. The client must have called prepareClientReceive() previously.
|
||||
*
|
||||
* @param[in] token The token previously returned by prepareClientReceive().
|
||||
*
|
||||
* @return erpc_status_t Return erpc status of client receive function.
|
||||
*/
|
||||
erpc_status_t clientReceive(client_token_t token);
|
||||
|
||||
/*!
|
||||
* @brief This function free client token.
|
||||
*
|
||||
* @param[in] token the client token to remove.
|
||||
*/
|
||||
void removePendingClient(client_token_t token);
|
||||
|
||||
/*!
|
||||
* @brief Request info for a client trying to receive a response.
|
||||
*/
|
||||
struct PendingClientInfo
|
||||
{
|
||||
RequestContext *m_request; /*!< Client request context. */
|
||||
Semaphore m_sem; /*!< Client semaphore. */
|
||||
bool m_isValid; /*!< This struct validation. */
|
||||
PendingClientInfo *m_next; /*!< Next client pending information. */
|
||||
|
||||
/*!
|
||||
* @brief Constructor.
|
||||
*/
|
||||
PendingClientInfo(void);
|
||||
|
||||
/*!
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~PendingClientInfo(void);
|
||||
};
|
||||
|
||||
protected:
|
||||
Transport *m_sharedTransport; //!< Transport being shared through this arbitrator.
|
||||
Codec *m_codec; //!< Codec used to read incoming message headers.
|
||||
|
||||
PendingClientInfo *m_clientList; //!< Active client receive requests.
|
||||
PendingClientInfo *m_clientFreeList; //!< Unused client receive info structs.
|
||||
Mutex m_clientListMutex; //!< Mutex guarding the client active and free lists.
|
||||
|
||||
/*!
|
||||
* @brief Create a Pending Client object.
|
||||
*
|
||||
* @return PendingClientInfo* Return created object.
|
||||
*/
|
||||
PendingClientInfo *createPendingClient(void);
|
||||
|
||||
/*!
|
||||
* @brief This function adds pending client.
|
||||
*
|
||||
* @return Pending client information.
|
||||
*/
|
||||
PendingClientInfo *addPendingClient(void);
|
||||
|
||||
/*!
|
||||
* @brief This function removes pending client list.
|
||||
*
|
||||
* @param[in] list Pending client list to remove.
|
||||
*/
|
||||
void freeClientList(PendingClientInfo *list);
|
||||
|
||||
private:
|
||||
// Disable copy ctor.
|
||||
TransportArbitrator(const TransportArbitrator &other); /*!< Disable copy ctor. */
|
||||
TransportArbitrator &operator=(const TransportArbitrator &other); /*!< Disable copy ctor. */
|
||||
};
|
||||
|
||||
} // namespace erpc
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif // defined(__embedded_rpc__transport_arbitrator__)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// EOF
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
26
packages/erpc-1.14.0/erpc_c/infra/erpc_utils.cpp
vendored
Normal file
26
packages/erpc-1.14.0/erpc_c/infra/erpc_utils.cpp
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2023 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "erpc_utils.hpp"
|
||||
|
||||
bool erpc::findIndexOfFunction(const arrayOfFunctionPtr_t sourceArrayOfFunctionPtr, uint16_t sourceArrayLength,
|
||||
const functionPtr_t functionPtr, uint16_t &retVal)
|
||||
{
|
||||
uint32_t index;
|
||||
bool find = false;
|
||||
for (index = 0; index < sourceArrayLength; index++)
|
||||
{
|
||||
if (sourceArrayOfFunctionPtr[index] == functionPtr)
|
||||
{
|
||||
retVal = index;
|
||||
find = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return find;
|
||||
}
|
||||
17
packages/erpc-1.14.0/erpc_c/infra/erpc_utils.hpp
vendored
Normal file
17
packages/erpc-1.14.0/erpc_c/infra/erpc_utils.hpp
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2023 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace erpc {
|
||||
typedef void *functionPtr_t;
|
||||
typedef functionPtr_t *arrayOfFunctionPtr_t;
|
||||
|
||||
bool findIndexOfFunction(const arrayOfFunctionPtr_t sourceArrayOfFunctionPtr, uint16_t sourceArrayLength,
|
||||
const functionPtr_t functionPtr, uint16_t &retVal);
|
||||
} // namespace erpc
|
||||
29
packages/erpc-1.14.0/erpc_c/infra/erpc_version.h
vendored
Normal file
29
packages/erpc-1.14.0/erpc_c/infra/erpc_version.h
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2025 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _ERPC_VERSION_H_
|
||||
#define _ERPC_VERSION_H_
|
||||
|
||||
/*!
|
||||
* @addtogroup infra
|
||||
* @{
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Definitions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! @brief String version of eRPC.
|
||||
#define ERPC_VERSION "1.14.0"
|
||||
//! @brief Integer version of eRPC.
|
||||
#define ERPC_VERSION_NUMBER 11400
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif /* _ERPC_VERSION_H_ */
|
||||
34
packages/erpc-1.14.0/erpc_c/infra/infra.dox
vendored
Normal file
34
packages/erpc-1.14.0/erpc_c/infra/infra.dox
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/*!
|
||||
@defgroup infra Infrastructure
|
||||
@brief C++ core
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defgroup infra_transport Transports
|
||||
@brief Superclasses for building transports.
|
||||
@ingroup infra
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defgroup infra_utility Utilities
|
||||
@brief Utility code used by the infrastructure.
|
||||
@ingroup infra
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defgroup infra_server Server
|
||||
@brief Server classes.
|
||||
@ingroup infra
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defgroup infra_client Client
|
||||
@brief Client classes
|
||||
@ingroup infra
|
||||
*/
|
||||
|
||||
/*!
|
||||
@defgroup infra_codec Serialization
|
||||
@brief Classes used for message serialization.
|
||||
@ingroup infra
|
||||
*/
|
||||
232
packages/erpc-1.14.0/erpc_c/port/erpc_config_internal.h
vendored
Normal file
232
packages/erpc-1.14.0/erpc_c/port/erpc_config_internal.h
vendored
Normal file
@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2017 NXP
|
||||
* Copyright 2020 ACRIOS Systems s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _ERPC_DETECT_H_
|
||||
#define _ERPC_DETECT_H_
|
||||
|
||||
#include "erpc_config.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/* clang-format off */
|
||||
|
||||
// Determine if this is a POSIX system.
|
||||
#if !defined(ERPC_HAS_POSIX)
|
||||
// Detect Linux, BSD, Cygwin, and Mac OS X.
|
||||
#if defined(__linux__) || defined(__GNU__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) || defined(__MACH__) || \
|
||||
defined(__MINGW32__)
|
||||
#define ERPC_HAS_POSIX (1)
|
||||
#else
|
||||
#define ERPC_HAS_POSIX (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Determine if we are targeting WIN32 environment
|
||||
#if !defined(ERPC_HAS_WIN32)
|
||||
#if defined(_WIN32)
|
||||
#define ERPC_HAS_WIN32 (1)
|
||||
#else
|
||||
#define ERPC_HAS_WIN32 (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Safely detect FreeRTOSConfig.h.
|
||||
#define ERPC_HAS_FREERTOSCONFIG_H (0)
|
||||
#if defined(__has_include)
|
||||
#if __has_include("FreeRTOSConfig.h")
|
||||
#undef ERPC_HAS_FREERTOSCONFIG_H
|
||||
#define ERPC_HAS_FREERTOSCONFIG_H (1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Detect allocation policy if not already set.
|
||||
#if !defined(ERPC_ALLOCATION_POLICY)
|
||||
#if ERPC_HAS_FREERTOSCONFIG_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "FreeRTOSConfig.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#if defined(configSUPPORT_STATIC_ALLOCATION) && configSUPPORT_STATIC_ALLOCATION
|
||||
#define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_STATIC)
|
||||
#else
|
||||
#define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_DYNAMIC)
|
||||
#endif
|
||||
#else
|
||||
#define ERPC_ALLOCATION_POLICY (ERPC_ALLOCATION_POLICY_DYNAMIC)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
|
||||
#if !defined(ERPC_CODEC_COUNT)
|
||||
#define ERPC_CODEC_COUNT (2U)
|
||||
#endif
|
||||
#if !defined(ERPC_MESSAGE_LOGGERS_COUNT)
|
||||
#define ERPC_MESSAGE_LOGGERS_COUNT (0U)
|
||||
#endif
|
||||
#if !defined(ERPC_CLIENTS_THREADS_AMOUNT)
|
||||
#define ERPC_CLIENTS_THREADS_AMOUNT (1U)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Safely detect tx_api.h.
|
||||
#define ERPC_HAS_THREADX_API_H (0)
|
||||
#if defined(__has_include)
|
||||
#if __has_include("tx_api.h")
|
||||
#undef ERPC_HAS_THREADX_API_H
|
||||
#define ERPC_HAS_THREADX_API_H (1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Detect threading model if not already set.
|
||||
#if !defined(ERPC_THREADS)
|
||||
#if ERPC_HAS_POSIX
|
||||
// Default to pthreads for POSIX systems.
|
||||
#define ERPC_THREADS (ERPC_THREADS_PTHREADS)
|
||||
#elif ERPC_HAS_FREERTOSCONFIG_H
|
||||
// Use FreeRTOS if we can auto detect it.
|
||||
#define ERPC_THREADS (ERPC_THREADS_FREERTOS)
|
||||
#elif ERPC_HAS_WIN32
|
||||
#define ERPC_THREADS (ERPC_THREADS_WIN32)
|
||||
#elif ERPC_HAS_THREADX_API_H
|
||||
#define ERPC_THREADS (ERPC_THREADS_THREADX)
|
||||
#else
|
||||
// Otherwise default to no threads.
|
||||
#define ERPC_THREADS (ERPC_THREADS_NONE)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Handy macro to test threading model. You can also ERPC_THREADS directly to test for threading
|
||||
// support, i.e. "#if ERPC_THREADS", because ERPC_THREADS_NONE has a value of 0.
|
||||
#define ERPC_THREADS_IS(_n_) (ERPC_THREADS == (ERPC_THREADS_##_n_))
|
||||
|
||||
// Set default buffer size.
|
||||
#if !defined(ERPC_DEFAULT_BUFFER_SIZE)
|
||||
//! @brief Size of buffers allocated by BasicMessageBufferFactory in setup functions.
|
||||
#define ERPC_DEFAULT_BUFFER_SIZE (256U)
|
||||
#endif
|
||||
|
||||
// Set default buffers count.
|
||||
#if !defined(ERPC_DEFAULT_BUFFERS_COUNT)
|
||||
//! @brief Count of buffers allocated by StaticMessageBufferFactory.
|
||||
#define ERPC_DEFAULT_BUFFERS_COUNT (2U)
|
||||
#endif
|
||||
|
||||
// Disable/enable noexcept.
|
||||
#if !defined(ERPC_NOEXCEPT)
|
||||
#if ERPC_HAS_POSIX
|
||||
#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_ENABLED)
|
||||
#else
|
||||
#define ERPC_NOEXCEPT (ERPC_NOEXCEPT_DISABLED)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//NOEXCEPT support
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103 && ERPC_NOEXCEPT
|
||||
#define NOEXCEPT noexcept
|
||||
#else
|
||||
#define NOEXCEPT
|
||||
#endif // NOEXCEPT
|
||||
|
||||
// Disabling nesting calls support as default.
|
||||
#if !defined(ERPC_NESTED_CALLS)
|
||||
#define ERPC_NESTED_CALLS (ERPC_NESTED_CALLS_DISABLED)
|
||||
#endif
|
||||
|
||||
#if ERPC_NESTED_CALLS && !ERPC_THREADS
|
||||
#error "Nested calls currently working only with Threads."
|
||||
#endif
|
||||
|
||||
// Enabling nesting calls detection as default for debug.
|
||||
#if !defined(ERPC_NESTED_CALLS_DETECTION)
|
||||
#if defined(NDEBUG) || (ERPC_NESTED_CALLS == ERPC_NESTED_CALLS_ENABLED)
|
||||
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_DISABLED)
|
||||
#else
|
||||
#define ERPC_NESTED_CALLS_DETECTION (ERPC_NESTED_CALLS_DETECTION_ENABLED)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Disabling tracing the eRPC.
|
||||
#if !defined(ERPC_MESSAGE_LOGGING)
|
||||
#define ERPC_MESSAGE_LOGGING (ERPC_MESSAGE_LOGGING_DISABLED)
|
||||
#endif
|
||||
|
||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION) /* Keil MDK */
|
||||
#define THROW_BADALLOC throw(std::bad_alloc)
|
||||
#define THROW throw()
|
||||
#else
|
||||
#define THROW_BADALLOC
|
||||
#define THROW
|
||||
#endif
|
||||
|
||||
#ifndef ERPC_TRANSPORT_MU_USE_MCMGR
|
||||
#if defined(__has_include)
|
||||
#if (__has_include("mcmgr.h"))
|
||||
#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED)
|
||||
#else
|
||||
#define ERPC_TRANSPORT_MU_USE_MCMGR (ERPC_TRANSPORT_MU_USE_MCMGR_DISABLED)
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(__has_include)
|
||||
#if ((!(__has_include("mcmgr.h"))) && (ERPC_TRANSPORT_MU_USE_MCMGR == ERPC_TRANSPORT_MU_USE_MCMGR_ENABLED))
|
||||
#error "Do not forget to add the MCMGR library into your project!"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Disabling pre and post callback function related code.
|
||||
#if !defined(ERPC_PRE_POST_ACTION)
|
||||
#define ERPC_PRE_POST_ACTION (ERPC_PRE_POST_ACTION_DISABLED)
|
||||
#endif
|
||||
|
||||
// Disabling pre and post default callback function code.
|
||||
#if !defined(ERPC_PRE_POST_ACTION_DEFAULT)
|
||||
#define ERPC_PRE_POST_ACTION_DEFAULT (ERPC_PRE_POST_ACTION_DEFAULT_DISABLED)
|
||||
#endif
|
||||
|
||||
#if !defined(erpc_assert)
|
||||
#if ERPC_HAS_FREERTOSCONFIG_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define erpc_assert(condition) configASSERT(condition)
|
||||
#elif defined(ERPC_THREADS) && (ERPC_THREADS == ERPC_THREADS_MBED)
|
||||
#include "platform/mbed_assert.h"
|
||||
#define erpc_assert(condition) MBED_ASSERT(condition)
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#include <cassert>
|
||||
#else
|
||||
#include "assert.h"
|
||||
#endif
|
||||
#define erpc_assert(condition) assert(condition)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Disabling endianness agnostic feature.
|
||||
#ifndef ENDIANNESS_HEADER
|
||||
#define ENDIANNESS_HEADER "erpc_endianness_undefined.h"
|
||||
#endif
|
||||
|
||||
/* clang-format on */
|
||||
#endif // _ERPC_DETECT_H_
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// EOF
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user