From 305260a33470227a2124c6e0a439ef51cbb542d1 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Wed, 10 Mar 2021 17:17:31 +0100 Subject: [PATCH 1/5] WIP rpmsg static api improvement. --- lib/include/rpmsg_env.h | 22 +++++++++++++ lib/include/rpmsg_lite.h | 4 +++ lib/include/rpmsg_queue.h | 7 +++++ .../porting/environment/rpmsg_env_freertos.c | 31 +++++++++++++++++++ .../platform/imx7ulp_m4/rpmsg_platform.c | 6 ++++ lib/rpmsg_lite/rpmsg_lite.c | 9 ++++++ lib/rpmsg_lite/rpmsg_queue.c | 9 ++++++ 7 files changed, 88 insertions(+) diff --git a/lib/include/rpmsg_env.h b/lib/include/rpmsg_env.h index 38937b1..24b746b 100644 --- a/lib/include/rpmsg_env.h +++ b/lib/include/rpmsg_env.h @@ -3,6 +3,7 @@ * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016-2019 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,6 +82,7 @@ #include #include "rpmsg_default_config.h" #include "rpmsg_platform.h" +#include "FreeRTOS.h" /*! * env_init @@ -245,10 +247,15 @@ void env_wmb(void); * * @param lock - pointer to created mutex * @param count - initial count 0 or 1 + * @param stack - stack for mutex * * @return - status of function execution */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_mutex(void **lock, int32_t count, void *stack); +#else int32_t env_create_mutex(void **lock, int32_t count); +#endif /*! * env_delete_mutex @@ -291,13 +298,18 @@ void env_unlock_mutex(void *lock); * * @param lock - pointer to created sync lock object * @param state - initial state , lock or unlocked + * @param stack - stack for lock * * @returns - status of function execution */ #define LOCKED 0 #define UNLOCKED 1 +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_sync_lock(void **lock, int32_t state, void *stack); +#else int32_t env_create_sync_lock(void **lock, int32_t state); +#endif /*! * env_create_sync_lock @@ -453,6 +465,10 @@ void env_disable_cache(void); typedef void LOCK; +typedef StaticSemaphore_t STACK; + +typedef StaticQueue_t rpmsg_static_queue; + /*! * env_create_queue * @@ -461,10 +477,16 @@ typedef void LOCK; * @param queue Pointer to created queue * @param length Maximum number of elements in the queue * @param item_size Queue element size in bytes + * @param queue_stack Stack for queue + * @param static_queue Context holder for queue * * @return - status of function execution */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_queue(void **queue, int32_t length, int32_t element_size, uint8_t *queue_stack, StaticQueue_t *static_queue); +#else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size); +#endif /*! * env_delete_queue diff --git a/lib/include/rpmsg_lite.h b/lib/include/rpmsg_lite.h index 3880913..cfc7706 100644 --- a/lib/include/rpmsg_lite.h +++ b/lib/include/rpmsg_lite.h @@ -3,6 +3,7 @@ * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016-2020 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,6 +126,9 @@ struct rpmsg_lite_instance struct virtqueue *tvq; /*!< transmit virtqueue */ struct llist *rl_endpoints; /*!< linked list of endpoints */ LOCK *lock; /*!< local RPMsg Lite mutex lock */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + STACK lock_stack; /*!< Stack for lock */ +#endif uint32_t link_state; /*!< state of the link, up/down*/ char *sh_mem_base; /*!< base address of the shared memory */ uint32_t sh_mem_remaining; /*!< amount of remaining unused buffers in shared memory */ diff --git a/lib/include/rpmsg_queue.h b/lib/include/rpmsg_queue.h index d1bc8d9..d940a68 100644 --- a/lib/include/rpmsg_queue.h +++ b/lib/include/rpmsg_queue.h @@ -3,6 +3,7 @@ * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,11 +76,17 @@ int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, voi * for blocking reception. * * @param rpmsg_lite_dev RPMsg Lite instance + * @param queue_stack RPMsg Lite queue static stack pointer + * @param rpmsg_qeue RPMsg Lite queue context holder * * @return RPMsg queue handle or RL_NULL * */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev, uint8_t *queue_stack, rpmsg_static_queue *rpmsg_qeue); +#else rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev); +#endif /*! * @brief diff --git a/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c b/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c index 947a905..a8275f0 100644 --- a/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c +++ b/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c @@ -3,6 +3,7 @@ * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016-2019 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +57,9 @@ static int32_t env_init_counter = 0; static SemaphoreHandle_t env_sema = ((void *)0); +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +StaticSemaphore_t env_sem_static_semaphore; +#endif /* RL_ENV_MAX_MUTEX_COUNT is an arbitrary count greater than 'count' if the inital count is 1, this function behaves as a mutex @@ -113,7 +117,11 @@ int32_t env_init(void) if (env_init_counter == 1) { // first call +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + env_sema = xSemaphoreCreateBinaryStatic(&env_sem_static_semaphore); +#else env_sema = xSemaphoreCreateBinary(); +#endif (void)memset(isr_table, 0, sizeof(isr_table)); (void)xTaskResumeAll(); retval = platform_init(); @@ -318,14 +326,22 @@ void *env_map_patova(uint32_t address) * Creates a mutex with the given initial count. * */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_mutex(void **lock, int32_t count, void *stack) +#else int32_t env_create_mutex(void **lock, int32_t count) +#endif { if (count > RL_ENV_MAX_MUTEX_COUNT) { return -1; } +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + *lock = xSemaphoreCreateCountingStatic((UBaseType_t)RL_ENV_MAX_MUTEX_COUNT, (UBaseType_t)count, (StaticSemaphore_t*)stack); +#else *lock = xSemaphoreCreateCounting((UBaseType_t)RL_ENV_MAX_MUTEX_COUNT, (UBaseType_t)count); +#endif if (*lock != ((void *)0)) { return 0; @@ -383,10 +399,17 @@ void env_unlock_mutex(void *lock) * when signal has to be sent from the interrupt context to main * thread context. */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_sync_lock(void **lock, int32_t state, void *stack) +{ + return env_create_mutex(lock, state, stack); /* state=1 .. initially free */ +} +#else int32_t env_create_sync_lock(void **lock, int32_t state) { return env_create_mutex(lock, state); /* state=1 .. initially free */ } +#endif /*! * env_delete_sync_lock @@ -583,12 +606,20 @@ void env_isr(uint32_t vector) * @param queue - pointer to created queue * @param length - maximum number of elements in the queue * @param element_size - queue element size in bytes + * @param queue_stack Stack for queue + * @param static_queue Context holder for queue * * @return - status of function execution */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_queue(void **queue, int32_t length, int32_t element_size, uint8_t *queue_stack, StaticQueue_t *staticQueue) +{ + *queue = xQueueCreateStatic((UBaseType_t)length, (UBaseType_t)element_size, queue_stack, staticQueue); +#else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) { *queue = xQueueCreate((UBaseType_t)length, (UBaseType_t)element_size); +#endif if (*queue != ((void *)0)) { return 0; diff --git a/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c index fde4128..0c3df27 100644 --- a/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016-2020 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * @@ -25,6 +26,7 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +static STACK platform_lock_stack; static void platform_global_isr_disable(void) { @@ -267,7 +269,11 @@ int32_t platform_init(void) NVIC_EnableIRQ(MU_A_IRQn); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_stack)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/rpmsg_lite.c b/lib/rpmsg_lite/rpmsg_lite.c index 7c69379..6aa65ee 100644 --- a/lib/rpmsg_lite/rpmsg_lite.c +++ b/lib/rpmsg_lite/rpmsg_lite.c @@ -3,6 +3,7 @@ * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016-2020 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1006,7 +1007,11 @@ struct rpmsg_lite_instance *rpmsg_lite_master_init(void *shmem_addr, #endif } +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1, &rpmsg_lite_dev->lock_stack); +#else status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1); +#endif if (status != RL_SUCCESS) { #if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) @@ -1186,7 +1191,11 @@ struct rpmsg_lite_instance *rpmsg_lite_remote_init(void *shmem_addr, uint32_t li #endif } +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1, &rpmsg_lite_dev->lock_stack); +#else status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1); +#endif if (status != RL_SUCCESS) { #if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) diff --git a/lib/rpmsg_lite/rpmsg_queue.c b/lib/rpmsg_lite/rpmsg_queue.c index 1ba5787..082f0e1 100644 --- a/lib/rpmsg_lite/rpmsg_queue.c +++ b/lib/rpmsg_lite/rpmsg_queue.c @@ -3,6 +3,7 @@ * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright 2016-2019 NXP + * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,7 +60,11 @@ int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, voi return RL_RELEASE; } +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev, uint8_t *queue_stack, rpmsg_static_queue *rpmsg_queue) +#else rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev) +#endif { int32_t status; void *q = RL_NULL; @@ -70,7 +75,11 @@ rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev } /* create message queue for channel default endpoint */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + status = env_create_queue(&q, (int32_t)rpmsg_lite_dev->rvq->vq_nentries, (int32_t)sizeof(rpmsg_queue_rx_cb_data_t), queue_stack, rpmsg_queue); +#else status = env_create_queue(&q, (int32_t)rpmsg_lite_dev->rvq->vq_nentries, (int32_t)sizeof(rpmsg_queue_rx_cb_data_t)); +#endif if ((status != 0) || (q == RL_NULL)) { return RL_NULL; From 61a5bb2a97a838298eeddb1c41da6c8262602329 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Thu, 16 Sep 2021 09:00:21 +0200 Subject: [PATCH 2/5] PR update from Michal Princ NXP + my few modification Signed-off-by: Cervenka Dusan --- .gitignore | 3 +- .../environment/bm/rpmsg_env_specific.h | 27 +++++++ .../environment/freertos/rpmsg_env_specific.h | 36 +++++++++ .../environment/qnx/rpmsg_env_specific.h | 33 +++++++++ .../environment/threadx/rpmsg_env_specific.h | 32 ++++++++ .../environment/xos/rpmsg_env_specific.h | 31 ++++++++ .../environment/zephyr/rpmsg_env_specific.h | 31 ++++++++ lib/include/rpmsg_default_config.h | 10 ++- lib/include/rpmsg_env.h | 36 +++++---- lib/include/rpmsg_lite.h | 12 +-- lib/include/rpmsg_queue.h | 19 +++-- .../porting/environment/rpmsg_env_bm.c | 6 +- .../porting/environment/rpmsg_env_freertos.c | 30 +++++--- .../porting/environment/rpmsg_env_qnx.c | 54 ++++++++++++-- .../porting/environment/rpmsg_env_threadx.c | 73 +++++++++++++++++-- .../porting/environment/rpmsg_env_zephyr.c | 47 +++++++++++- .../platform/imx6sx_m4/rpmsg_platform.c | 9 ++- .../imx6sx_m4/rpmsg_platform_zephyr_ipm.c | 9 ++- .../platform/imx7d_m4/rpmsg_platform.c | 9 ++- .../imx7d_m4/rpmsg_platform_zephyr_ipm.c | 9 ++- .../platform/imx7ulp_m4/rpmsg_platform.c | 8 +- .../platform/imx8mm_m4/rpmsg_platform.c | 9 ++- .../platform/imx8mn_m7/rpmsg_platform.c | 9 ++- .../platform/imx8mq_m4/rpmsg_platform.c | 9 ++- .../platform/imx8qm_m4/rpmsg_platform.c | 9 ++- .../platform/imx8qx_cm4/rpmsg_platform.c | 9 ++- .../platform/imxrt600_hifi4/rpmsg_platform.c | 30 +++++--- .../platform/imxrt600_m33/rpmsg_platform.c | 9 ++- .../porting/platform/k32l3a6/rpmsg_platform.c | 9 ++- .../platform/lpc5410x/rpmsg_platform.c | 9 ++- .../platform/lpc5411x/rpmsg_platform.c | 9 ++- .../lpc5411x/rpmsg_platform_zephyr_ipm.c | 9 ++- .../platform/lpc55s69/rpmsg_platform.c | 9 ++- lib/rpmsg_lite/rpmsg_lite.c | 9 +-- lib/rpmsg_lite/rpmsg_queue.c | 16 ++-- 35 files changed, 576 insertions(+), 102 deletions(-) create mode 100644 lib/include/environment/bm/rpmsg_env_specific.h create mode 100644 lib/include/environment/freertos/rpmsg_env_specific.h create mode 100644 lib/include/environment/qnx/rpmsg_env_specific.h create mode 100644 lib/include/environment/threadx/rpmsg_env_specific.h create mode 100644 lib/include/environment/xos/rpmsg_env_specific.h create mode 100644 lib/include/environment/zephyr/rpmsg_env_specific.h diff --git a/.gitignore b/.gitignore index 67a55ce..75b1f76 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ armgcc mdk iar kds -build \ No newline at end of file +build +*.patch \ No newline at end of file diff --git a/lib/include/environment/bm/rpmsg_env_specific.h b/lib/include/environment/bm/rpmsg_env_specific.h new file mode 100644 index 0000000..4f35c30 --- /dev/null +++ b/lib/include/environment/bm/rpmsg_env_specific.h @@ -0,0 +1,27 @@ +/* + * Copyright 2021 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/************************************************************************** + * FILE NAME + * + * rpmsg_env_specific.h + * + * DESCRIPTION + * + * This file contains baremetal specific constructions. + * + **************************************************************************/ +#ifndef RPMSG_ENV_SPECIFIC_H_ +#define RPMSG_ENV_SPECIFIC_H_ + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +typedef uint8_t LOCK_STATIC_CONTEXT; +typedef uint8_t rpmsg_static_queue_ctxt; +#endif + +#endif /* RPMSG_ENV_SPECIFIC_H_ */ diff --git a/lib/include/environment/freertos/rpmsg_env_specific.h b/lib/include/environment/freertos/rpmsg_env_specific.h new file mode 100644 index 0000000..a9a1693 --- /dev/null +++ b/lib/include/environment/freertos/rpmsg_env_specific.h @@ -0,0 +1,36 @@ +/* + * Copyright 2021 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/************************************************************************** + * FILE NAME + * + * rpmsg_env_specific.h + * + * DESCRIPTION + * + * This file contains FreeRTOS specific constructions. + * + **************************************************************************/ +#ifndef RPMSG_ENV_SPECIFIC_H_ +#define RPMSG_ENV_SPECIFIC_H_ + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +#if (configSUPPORT_STATIC_ALLOCATION == 0) +#warning You have configured RPMsg_Lite to use static API but FreeRTOS is not configured for static allocations! Please switch the configSUPPORT_STATIC_ALLOCATION to 1 in your FreeRTOSConfig.h file. +#endif + +#include "FreeRTOS.h" + +typedef StaticSemaphore_t LOCK_STATIC_CONTEXT; +typedef StaticQueue_t rpmsg_static_queue_ctxt; + +/* Queue object static storage size in bytes, should be defined as (RL_BUFFER_COUNT*sizeof(rpmsg_queue_rx_cb_data_t)) */ +#define RL_ENV_QUEUE_STATIC_STORAGE_SIZE (RL_BUFFER_COUNT * sizeof(rpmsg_queue_rx_cb_data_t)) +#endif + +#endif /* RPMSG_ENV_SPECIFIC_H_ */ diff --git a/lib/include/environment/qnx/rpmsg_env_specific.h b/lib/include/environment/qnx/rpmsg_env_specific.h new file mode 100644 index 0000000..64d6e5d --- /dev/null +++ b/lib/include/environment/qnx/rpmsg_env_specific.h @@ -0,0 +1,33 @@ +/* + * Copyright 2021 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/************************************************************************** + * FILE NAME + * + * rpmsg_env_specific.h + * + * DESCRIPTION + * + * This file contains QNX specific constructions. + * + **************************************************************************/ +#ifndef RPMSG_ENV_SPECIFIC_H_ +#define RPMSG_ENV_SPECIFIC_H_ + + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +#include +#include + +typedef pthread_mutex_t LOCK_STATIC_CONTEXT; +typedef env_queue_t rpmsg_static_queue_ctxt; +/* Queue object static storage size in bytes, should be defined as (RL_BUFFER_COUNT*sizeof(rpmsg_queue_rx_cb_data_t)) */ +#define RL_ENV_QUEUE_STATIC_STORAGE_SIZE (RL_BUFFER_COUNT * sizeof(rpmsg_queue_rx_cb_data_t)) +#endif + +#endif /* RPMSG_ENV_SPECIFIC_H_ */ diff --git a/lib/include/environment/threadx/rpmsg_env_specific.h b/lib/include/environment/threadx/rpmsg_env_specific.h new file mode 100644 index 0000000..66dee2d --- /dev/null +++ b/lib/include/environment/threadx/rpmsg_env_specific.h @@ -0,0 +1,32 @@ +/* + * Copyright 2021 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/************************************************************************** + * FILE NAME + * + * rpmsg_env_specific.h + * + * DESCRIPTION + * + * This file contains ThreadX specific constructions. + * + **************************************************************************/ +#ifndef RPMSG_ENV_SPECIFIC_H_ +#define RPMSG_ENV_SPECIFIC_H_ + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +#include "tx_api.h" +#include "tx_event_flags.h" + +typedef TX_SEMAPHORE LOCK_STATIC_CONTEXT; +typedef TX_QUEUE rpmsg_static_queue_ctxt; +/* Queue object static storage size in bytes, should be defined as (RL_BUFFER_COUNT*sizeof(rpmsg_queue_rx_cb_data_t)) */ +#define RL_ENV_QUEUE_STATIC_STORAGE_SIZE (RL_BUFFER_COUNT * sizeof(rpmsg_queue_rx_cb_data_t)) +#endif + +#endif /* RPMSG_ENV_SPECIFIC_H_ */ diff --git a/lib/include/environment/xos/rpmsg_env_specific.h b/lib/include/environment/xos/rpmsg_env_specific.h new file mode 100644 index 0000000..860fc68 --- /dev/null +++ b/lib/include/environment/xos/rpmsg_env_specific.h @@ -0,0 +1,31 @@ +/* + * Copyright 2021 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/************************************************************************** + * FILE NAME + * + * rpmsg_env_specific.h + * + * DESCRIPTION + * + * This file contains XOS specific constructions. + * + **************************************************************************/ +#ifndef RPMSG_ENV_SPECIFIC_H_ +#define RPMSG_ENV_SPECIFIC_H_ + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +#include + +typedef XosSem LOCK_STATIC_CONTEXT; +typedef void rpmsg_static_queue_ctxt; +/* Queue object static storage size in bytes, should be defined as (RL_BUFFER_COUNT*sizeof(rpmsg_queue_rx_cb_data_t)) */ +#define RL_ENV_QUEUE_STATIC_STORAGE_SIZE (XOS_MSGQ_SIZE(RL_BUFFER_COUNT, sizeof(rpmsg_queue_rx_cb_data_t))) +#endif + +#endif /* RPMSG_ENV_SPECIFIC_H_ */ diff --git a/lib/include/environment/zephyr/rpmsg_env_specific.h b/lib/include/environment/zephyr/rpmsg_env_specific.h new file mode 100644 index 0000000..0dfe309 --- /dev/null +++ b/lib/include/environment/zephyr/rpmsg_env_specific.h @@ -0,0 +1,31 @@ +/* + * Copyright 2021 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/************************************************************************** + * FILE NAME + * + * rpmsg_env_specific.h + * + * DESCRIPTION + * + * This file contains Zephyr specific constructions. + * + **************************************************************************/ +#ifndef RPMSG_ENV_SPECIFIC_H_ +#define RPMSG_ENV_SPECIFIC_H_ + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +#include + +typedef k_sem LOCK_STATIC_CONTEXT; +typedef k_msgq rpmsg_static_queue_ctxt; +/* Queue object static storage size in bytes, should be defined as (RL_BUFFER_COUNT*sizeof(rpmsg_queue_rx_cb_data_t)) */ +#define RL_ENV_QUEUE_STATIC_STORAGE_SIZE (RL_BUFFER_COUNT * sizeof(rpmsg_queue_rx_cb_data_t)) +#endif + +#endif /* RPMSG_ENV_SPECIFIC_H_ */ diff --git a/lib/include/rpmsg_default_config.h b/lib/include/rpmsg_default_config.h index 503542f..42f0d90 100644 --- a/lib/include/rpmsg_default_config.h +++ b/lib/include/rpmsg_default_config.h @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,8 +59,8 @@ //! @def RL_BUFFER_PAYLOAD_SIZE //! //! Size of the buffer payload, it must be equal to (240, 496, 1008, ...) -//! [2^n - 16]. -//! The default value is 496U. +//! [2^n - 16]. Ensure the same value is defined on both sides of rpmsg +//! communication. The default value is 496U. #ifndef RL_BUFFER_PAYLOAD_SIZE #define RL_BUFFER_PAYLOAD_SIZE (496U) #endif @@ -69,6 +69,10 @@ //! //! Number of the buffers, it must be power of two (2, 4, ...). //! The default value is 2U. +//! Note this value defines the buffer count for one direction of the rpmsg +//! communication only, i.e. if the default value of 2 is used +//! in rpmsg_config.h files for the master and the remote side, 4 buffers +//! in total are created in the shared memory. #ifndef RL_BUFFER_COUNT #define RL_BUFFER_COUNT (2U) #endif diff --git a/lib/include/rpmsg_env.h b/lib/include/rpmsg_env.h index 24b746b..7767fe1 100644 --- a/lib/include/rpmsg_env.h +++ b/lib/include/rpmsg_env.h @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -78,11 +78,10 @@ #ifndef RPMSG_ENV_H_ #define RPMSG_ENV_H_ -#include #include #include "rpmsg_default_config.h" +#include "rpmsg_env_specific.h" #include "rpmsg_platform.h" -#include "FreeRTOS.h" /*! * env_init @@ -157,7 +156,16 @@ void env_memcpy(void *dst, void const *src, uint32_t len); int32_t env_strcmp(const char *dst, const char *src); void env_strncpy(char *dest, const char *src, uint32_t len); int32_t env_strncmp(char *dest, const char *src, uint32_t len); +#ifdef MCUXPRESSO_SDK +/* MCUXpresso_SDK's PRINTF used in SDK examples */ +#include "fsl_debug_console.h" +#define env_print(...) PRINTF(__VA_ARGS__) +#else +/* When RPMsg_Lite being used outside of MCUXpresso_SDK use your own env_print + implemenetation to avoid conflict with Misra 21.6 rule */ +#include #define env_print(...) printf(__VA_ARGS__) +#endif /* MCUXPRESSO_SDK */ /*! *----------------------------------------------------------------------------- @@ -247,12 +255,12 @@ void env_wmb(void); * * @param lock - pointer to created mutex * @param count - initial count 0 or 1 - * @param stack - stack for mutex + * @param context - context for mutex * * @return - status of function execution */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -int32_t env_create_mutex(void **lock, int32_t count, void *stack); +int32_t env_create_mutex(void **lock, int32_t count, void *context); #else int32_t env_create_mutex(void **lock, int32_t count); #endif @@ -298,7 +306,7 @@ void env_unlock_mutex(void *lock); * * @param lock - pointer to created sync lock object * @param state - initial state , lock or unlocked - * @param stack - stack for lock + * @param context - context for lock * * @returns - status of function execution */ @@ -306,7 +314,7 @@ void env_unlock_mutex(void *lock); #define UNLOCKED 1 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -int32_t env_create_sync_lock(void **lock, int32_t state, void *stack); +int32_t env_create_sync_lock(void **lock, int32_t state, void *context); #else int32_t env_create_sync_lock(void **lock, int32_t state); #endif @@ -465,10 +473,6 @@ void env_disable_cache(void); typedef void LOCK; -typedef StaticSemaphore_t STACK; - -typedef StaticQueue_t rpmsg_static_queue; - /*! * env_create_queue * @@ -477,13 +481,17 @@ typedef StaticQueue_t rpmsg_static_queue; * @param queue Pointer to created queue * @param length Maximum number of elements in the queue * @param item_size Queue element size in bytes - * @param queue_stack Stack for queue - * @param static_queue Context holder for queue + * @param queue_static_storage Pointer to queue static storage buffer + * @param queue_static_context Pointer to queue static context * * @return - status of function execution */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -int32_t env_create_queue(void **queue, int32_t length, int32_t element_size, uint8_t *queue_stack, StaticQueue_t *static_queue); +int32_t env_create_queue(void **queue, + int32_t length, + int32_t element_size, + uint8_t *queue_static_storage, + rpmsg_static_queue_ctxt *queue_static_context); #else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size); #endif diff --git a/lib/include/rpmsg_lite.h b/lib/include/rpmsg_lite.h index cfc7706..44e68d6 100644 --- a/lib/include/rpmsg_lite.h +++ b/lib/include/rpmsg_lite.h @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -122,12 +122,12 @@ struct rpmsg_lite_ept_static_context */ struct rpmsg_lite_instance { - struct virtqueue *rvq; /*!< receive virtqueue */ - struct virtqueue *tvq; /*!< transmit virtqueue */ - struct llist *rl_endpoints; /*!< linked list of endpoints */ - LOCK *lock; /*!< local RPMsg Lite mutex lock */ + struct virtqueue *rvq; /*!< receive virtqueue */ + struct virtqueue *tvq; /*!< transmit virtqueue */ + struct llist *rl_endpoints; /*!< linked list of endpoints */ + LOCK *lock; /*!< local RPMsg Lite mutex lock */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - STACK lock_stack; /*!< Stack for lock */ + LOCK_STATIC_CONTEXT lock_static_ctxt; /*!< Static context for lock object creation */ #endif uint32_t link_state; /*!< state of the link, up/down*/ char *sh_mem_base; /*!< base address of the shared memory */ diff --git a/lib/include/rpmsg_queue.h b/lib/include/rpmsg_queue.h index d940a68..8836544 100644 --- a/lib/include/rpmsg_queue.h +++ b/lib/include/rpmsg_queue.h @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -44,6 +44,13 @@ */ typedef void *rpmsg_queue_handle; +typedef struct +{ + uint32_t src; + void *data; + uint32_t len; +} rpmsg_queue_rx_cb_data_t; + /* RL_API_HAS_ZEROCOPY has to be enabled for RPMsg Queue to work */ #if defined(RL_API_HAS_ZEROCOPY) && (RL_API_HAS_ZEROCOPY == 1) @@ -75,15 +82,17 @@ int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, voi * Create a RPMsg queue which can be used * for blocking reception. * - * @param rpmsg_lite_dev RPMsg Lite instance - * @param queue_stack RPMsg Lite queue static stack pointer - * @param rpmsg_qeue RPMsg Lite queue context holder + * @param rpmsg_lite_dev RPMsg Lite instance + * @param queue_storage RPMsg Lite queue static storage pointer + * @param queue_ctxt RPMsg Lite queue static context holder * * @return RPMsg queue handle or RL_NULL * */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev, uint8_t *queue_stack, rpmsg_static_queue *rpmsg_qeue); +rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev, + uint8_t *queue_storage, + rpmsg_static_queue_ctxt *queue_ctxt); #else rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev); #endif diff --git a/lib/rpmsg_lite/porting/environment/rpmsg_env_bm.c b/lib/rpmsg_lite/porting/environment/rpmsg_env_bm.c index 93ba58d..98ed345 100644 --- a/lib/rpmsg_lite/porting/environment/rpmsg_env_bm.c +++ b/lib/rpmsg_lite/porting/environment/rpmsg_env_bm.c @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -259,7 +259,11 @@ void *env_map_patova(uint32_t address) * Creates a mutex with the given initial count. * */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_mutex(void **lock, int32_t count, void *context) +#else int32_t env_create_mutex(void **lock, int32_t count) +#endif { /* make the mutex pointer point to itself * this marks the mutex handle as initialized. diff --git a/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c b/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c index a8275f0..9d68ad4 100644 --- a/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c +++ b/lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -58,7 +58,7 @@ static int32_t env_init_counter = 0; static SemaphoreHandle_t env_sema = ((void *)0); #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -StaticSemaphore_t env_sem_static_semaphore; +LOCK_STATIC_CONTEXT env_sem_static_context; #endif /* RL_ENV_MAX_MUTEX_COUNT is an arbitrary count greater than 'count' @@ -118,7 +118,7 @@ int32_t env_init(void) { // first call #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - env_sema = xSemaphoreCreateBinaryStatic(&env_sem_static_semaphore); + env_sema = xSemaphoreCreateBinaryStatic(&env_sem_static_context); #else env_sema = xSemaphoreCreateBinary(); #endif @@ -327,7 +327,7 @@ void *env_map_patova(uint32_t address) * */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -int32_t env_create_mutex(void **lock, int32_t count, void *stack) +int32_t env_create_mutex(void **lock, int32_t count, void *context) #else int32_t env_create_mutex(void **lock, int32_t count) #endif @@ -338,7 +338,8 @@ int32_t env_create_mutex(void **lock, int32_t count) } #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - *lock = xSemaphoreCreateCountingStatic((UBaseType_t)RL_ENV_MAX_MUTEX_COUNT, (UBaseType_t)count, (StaticSemaphore_t*)stack); + *lock = xSemaphoreCreateCountingStatic((UBaseType_t)RL_ENV_MAX_MUTEX_COUNT, (UBaseType_t)count, + (StaticSemaphore_t *)context); #else *lock = xSemaphoreCreateCounting((UBaseType_t)RL_ENV_MAX_MUTEX_COUNT, (UBaseType_t)count); #endif @@ -400,9 +401,9 @@ void env_unlock_mutex(void *lock) * thread context. */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -int32_t env_create_sync_lock(void **lock, int32_t state, void *stack) +int32_t env_create_sync_lock(void **lock, int32_t state, void *context) { - return env_create_mutex(lock, state, stack); /* state=1 .. initially free */ + return env_create_mutex(lock, state, context); /* state=1 .. initially free */ } #else int32_t env_create_sync_lock(void **lock, int32_t state) @@ -606,15 +607,20 @@ void env_isr(uint32_t vector) * @param queue - pointer to created queue * @param length - maximum number of elements in the queue * @param element_size - queue element size in bytes - * @param queue_stack Stack for queue - * @param static_queue Context holder for queue + * @param queue_static_storage - pointer to queue static storage buffer + * @param queue_static_context - pointer to queue static context * * @return - status of function execution */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -int32_t env_create_queue(void **queue, int32_t length, int32_t element_size, uint8_t *queue_stack, StaticQueue_t *staticQueue) -{ - *queue = xQueueCreateStatic((UBaseType_t)length, (UBaseType_t)element_size, queue_stack, staticQueue); +int32_t env_create_queue(void **queue, + int32_t length, + int32_t element_size, + uint8_t *queue_static_storage, + rpmsg_static_queue_ctxt *queue_static_context) +{ + *queue = + xQueueCreateStatic((UBaseType_t)length, (UBaseType_t)element_size, queue_static_storage, queue_static_context); #else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) { diff --git a/lib/rpmsg_lite/porting/environment/rpmsg_env_qnx.c b/lib/rpmsg_lite/porting/environment/rpmsg_env_qnx.c index 1b1424a..ea574a4 100644 --- a/lib/rpmsg_lite/porting/environment/rpmsg_env_qnx.c +++ b/lib/rpmsg_lite/porting/environment/rpmsg_env_qnx.c @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -311,20 +311,37 @@ void *env_map_patova(void *env, uint32_t address) * Creates a mutex with the given initial count. * */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_mutex(void **lock, int32_t count, void *context) +#else int32_t env_create_mutex(void **lock, int32_t count) +#endif { + if (count > RL_ENV_MAX_MUTEX_COUNT) + { + return -1; + } + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + *lock = context; +#else *lock = env_allocate_memory(sizeof(pthread_mutex_t)); +#endif if (*lock == ((void *)0)) { return -1; } - if (pthread_mutex_init((pthread_mutex_t *)*lock, ((void *)0)) != EOK) + if (EOK == pthread_mutex_init((pthread_mutex_t *)*lock, ((void *)0))) + { + return 0; + } + else { +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(*lock); - *lock = ((void *)0); +#endif return -1; } - return 0; } /*! @@ -336,7 +353,9 @@ int32_t env_create_mutex(void **lock, int32_t count) void env_delete_mutex(void *lock) { pthread_mutex_destroy(lock); +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(lock); +#endif } /*! @@ -367,10 +386,17 @@ void env_unlock_mutex(void *lock) * when signal has to be sent from the interrupt context to main * thread context. */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_sync_lock(void **lock, int32_t state, void *context) +{ + return env_create_mutex(lock, state, context); /* state=1 .. initially free */ +} +#else int32_t env_create_sync_lock(void **lock, int32_t state) { return env_create_mutex(lock, state); /* state=1 .. initially free */ } +#endif /*! * env_delete_sync_lock @@ -594,14 +620,28 @@ int32_t env_deinit_interrupt(void *env, int32_t vq_id) * @param queue - pointer to created queue * @param length - maximum number of elements in the queue * @param element_size - queue element size in bytes + * @param queue_static_storage - pointer to queue static storage buffer + * @param queue_static_context - pointer to queue static context * * @return - status of function execution */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_queue(void **queue, + int32_t length, + int32_t element_size, + uint8_t *queue_static_storage, + rpmsg_static_queue_ctxt *queue_static_context) +#else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) +#endif { char name[100]; struct mq_attr mqstat; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + env_queue_t *q = (env_queue_t *)queue_static_context; +#else env_queue_t *q = env_allocate_memory(sizeof(env_queue_t)); +#endif if (q == ((void *)0)) { return -1; @@ -615,10 +655,12 @@ int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) mqstat.mq_recvwait = 0; mqstat.mq_sendwait = 0; q->msg_len = element_size; - q->mqd = mq_open(name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR, &mqstat); + q->mqd = (name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR, &mqstat); if (q->mqd == -1) { +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(q); +#endif fprintf(stderr, "mq_open failed: %s\n", strerror(errno)); return -1; } @@ -639,7 +681,9 @@ void env_delete_queue(void *queue) env_queue_t *q = queue; mq_close(q->mqd); +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(queue); +#endif } /*! diff --git a/lib/rpmsg_lite/porting/environment/rpmsg_env_threadx.c b/lib/rpmsg_lite/porting/environment/rpmsg_env_threadx.c index 46d311c..44d0743 100644 --- a/lib/rpmsg_lite/porting/environment/rpmsg_env_threadx.c +++ b/lib/rpmsg_lite/porting/environment/rpmsg_env_threadx.c @@ -1,5 +1,5 @@ /* - * Copyright 2020 NXP + * Copyright 2020-2021 NXP * All rights reserved. * * @@ -297,27 +297,41 @@ void *env_map_patova(uint32_t address) * Creates a mutex with the given initial count. * */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_mutex(void **lock, int32_t count, void *context) +#else int32_t env_create_mutex(void **lock, int32_t count) +#endif { TX_SEMAPHORE *semaphore_ptr; - semaphore_ptr = (TX_SEMAPHORE *)env_allocate_memory(sizeof(TX_SEMAPHORE)); - if (semaphore_ptr == ((void *)0)) + if (count > RL_ENV_MAX_MUTEX_COUNT) { return -1; } - if (count > RL_ENV_MAX_MUTEX_COUNT) +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + semaphore_ptr = (TX_SEMAPHORE *)context; +#else + semaphore_ptr = (TX_SEMAPHORE *)env_allocate_memory(sizeof(TX_SEMAPHORE)); +#endif + if (semaphore_ptr == ((void *)0)) { return -1; } - if (TX_SUCCESS != _tx_semaphore_create((TX_SEMAPHORE *)semaphore_ptr, NULL, count)) + if (TX_SUCCESS == _tx_semaphore_create((TX_SEMAPHORE *)semaphore_ptr, NULL, count)) + { + *lock = (void *)semaphore_ptr; + return 0; + } + else { +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) + env_free_memory(semaphore_ptr); +#endif return -1; } - *lock = (void *)semaphore_ptr; - return 0; } /*! @@ -329,7 +343,9 @@ int32_t env_create_mutex(void **lock, int32_t count) void env_delete_mutex(void *lock) { (void)_tx_semaphore_delete((TX_SEMAPHORE *)lock); +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(lock); +#endif } /*! @@ -366,10 +382,17 @@ void env_unlock_mutex(void *lock) * when signal has to be sent from the interrupt context to main * thread context. */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_sync_lock(void **lock, int32_t state, void *context) +{ + return env_create_mutex(lock, state, context); /* state=1 .. initially free */ +} +#else int32_t env_create_sync_lock(void **lock, int32_t state) { return env_create_mutex(lock, state); /* state=1 .. initially free */ } +#endif /*! * env_delete_sync_lock @@ -532,17 +555,48 @@ void env_isr(uint32_t vector) * @param queue - pointer to created queue * @param length - maximum number of elements in the queue * @param element_size - queue element size in bytes + * @param queue_static_storage - pointer to queue static storage buffer + * @param queue_static_context - pointer to queue static context * * @return - status of function execution */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_queue(void **queue, + int32_t length, + int32_t element_size, + uint8_t *queue_static_storage, + rpmsg_static_queue_ctxt *queue_static_context) +#else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) +#endif { - if (TX_SUCCESS == _tx_queue_create((TX_QUEUE *)*queue, NULL, element_size, NULL, length)) + struct TX_QUEUE *queue_ptr = ((void *)0); + char *msgq_buffer_ptr = ((void *)0); + +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + queue_ptr = (struct k_msgq *)queue_static_context; + msgq_buffer_ptr = (char *)queue_static_storage; +#else + queue_ptr = (struct k_msgq *)env_allocate_memory(sizeof(struct TX_QUEUE)); + msgq_buffer_ptr = (char *)env_allocate_memory(length * element_size); +#endif + if ((queue_ptr == ((void *)0)) || (msgq_buffer_ptr == ((void *)0))) { + return -1; + } + + if (TX_SUCCESS == + _tx_queue_create((TX_QUEUE *)queue_ptr, NULL, element_size, (VOID *)msgq_buffer_ptr, (length * element_size))) + { + *queue = (void *)queue_ptr; return 0; } else { +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) + env_free_memory(queue_ptr); + env_free_memory(msgq_buffer_ptr); +#endif return -1; } } @@ -558,6 +612,9 @@ int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) void env_delete_queue(void *queue) { tx_queue_delete(queue); +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) + env_free_memory(queue); +#endif } /*! diff --git a/lib/rpmsg_lite/porting/environment/rpmsg_env_zephyr.c b/lib/rpmsg_lite/porting/environment/rpmsg_env_zephyr.c index cf07c73..7c00b8d 100644 --- a/lib/rpmsg_lite/porting/environment/rpmsg_env_zephyr.c +++ b/lib/rpmsg_lite/porting/environment/rpmsg_env_zephyr.c @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -313,22 +313,33 @@ void *env_map_patova(uint32_t address) * Creates a mutex with the given initial count. * */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_mutex(void **lock, int32_t count, void *context) +#else int32_t env_create_mutex(void **lock, int32_t count) +#endif { struct k_sem *semaphore_ptr; - semaphore_ptr = (struct k_sem *)env_allocate_memory(sizeof(struct k_sem)); - if (semaphore_ptr == ((void *)0)) + if (count > RL_ENV_MAX_MUTEX_COUNT) { return -1; } - if (count > RL_ENV_MAX_MUTEX_COUNT) +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + semaphore_ptr = (struct k_sem *)context; +#else + semaphore_ptr = (struct k_sem *)env_allocate_memory(sizeof(struct k_sem)); +#endif + if (semaphore_ptr == ((void *)0)) { return -1; } k_sem_init(semaphore_ptr, count, RL_ENV_MAX_MUTEX_COUNT); + /* Becasue k_sem_init() does not return any status, we do not know if all is OK or not. + If something would not be OK dynamically allocated memory has to be freed here. */ + *lock = (void *)semaphore_ptr; return 0; } @@ -342,7 +353,9 @@ int32_t env_create_mutex(void **lock, int32_t count) void env_delete_mutex(void *lock) { k_sem_reset(lock); +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(lock); +#endif } /*! @@ -379,10 +392,17 @@ void env_unlock_mutex(void *lock) * when signal has to be sent from the interrupt context to main * thread context. */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_sync_lock(void **lock, int32_t state, void *context) +{ + return env_create_mutex(lock, state, context); /* state=1 .. initially free */ +} +#else int32_t env_create_sync_lock(void **lock, int32_t state) { return env_create_mutex(lock, state); /* state=1 .. initially free */ } +#endif /*! * env_delete_sync_lock @@ -545,21 +565,38 @@ void env_isr(uint32_t vector) * @param queue - pointer to created queue * @param length - maximum number of elements in the queue * @param element_size - queue element size in bytes + * @param queue_static_storage - pointer to queue static storage buffer + * @param queue_static_context - pointer to queue static context * * @return - status of function execution */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +int32_t env_create_queue(void **queue, + int32_t length, + int32_t element_size, + uint8_t *queue_static_storage, + rpmsg_static_queue_ctxt *queue_static_context) +#else int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) +#endif { struct k_msgq *queue_ptr = ((void *)0); char *msgq_buffer_ptr = ((void *)0); +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + queue_ptr = (struct k_msgq *)queue_static_context; + msgq_buffer_ptr = (char *)queue_static_storage; +#else queue_ptr = (struct k_msgq *)env_allocate_memory(sizeof(struct k_msgq)); msgq_buffer_ptr = (char *)env_allocate_memory(length * element_size); +#endif if ((queue_ptr == ((void *)0)) || (msgq_buffer_ptr == ((void *)0))) { return -1; } k_msgq_init(queue_ptr, msgq_buffer_ptr, element_size, length); + /* Becasue k_msgq_init() does not return any status, we do not know if all is OK or not. + If something would not be OK dynamically allocated memory has to be freed here. */ *queue = (void *)queue_ptr; return 0; @@ -576,8 +613,10 @@ int32_t env_create_queue(void **queue, int32_t length, int32_t element_size) void env_delete_queue(void *queue) { k_msgq_purge((struct k_msgq *)queue); +#if !(defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)) env_free_memory(((struct k_msgq *)queue)->buffer_start); env_free_memory(queue); +#endif } /*! diff --git a/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform.c index 6963640..b4aaa29 100644 --- a/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -23,6 +23,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -265,7 +268,11 @@ int32_t platform_init(void) NVIC_EnableIRQ(BOARD_MU_IRQ_NUM); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform_zephyr_ipm.c b/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform_zephyr_ipm.c index c400618..c946a57 100644 --- a/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform_zephyr_ipm.c +++ b/lib/rpmsg_lite/porting/platform/imx6sx_m4/rpmsg_platform_zephyr_ipm.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -20,6 +20,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static struct device *ipm_handle = ((void *)0); void platform_ipm_callback(void *context, u32_t id, volatile void *data) @@ -244,7 +247,11 @@ int32_t platform_init(void) ipm_register_callback(ipm_handle, platform_ipm_callback, ((void *)0)); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform.c index 6963640..b4aaa29 100644 --- a/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -23,6 +23,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -265,7 +268,11 @@ int32_t platform_init(void) NVIC_EnableIRQ(BOARD_MU_IRQ_NUM); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform_zephyr_ipm.c b/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform_zephyr_ipm.c index f327917..5458d34 100644 --- a/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform_zephyr_ipm.c +++ b/lib/rpmsg_lite/porting/platform/imx7d_m4/rpmsg_platform_zephyr_ipm.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -20,6 +20,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static struct device *ipm_handle = ((void *)0); void platform_ipm_callback(void *context, u32_t id, volatile void *data) @@ -244,7 +247,11 @@ int32_t platform_init(void) ipm_register_callback(ipm_handle, platform_ipm_callback, ((void *)0)); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c index 0c3df27..e21f4de 100644 --- a/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx7ulp_m4/rpmsg_platform.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -26,7 +26,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; -static STACK platform_lock_stack; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -270,7 +272,7 @@ int32_t platform_init(void) /* Create lock used in multi-instanced RPMsg */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_stack)) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) #else if (0 != env_create_mutex(&platform_lock, 1)) #endif diff --git a/lib/rpmsg_lite/porting/platform/imx8mm_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx8mm_m4/rpmsg_platform.c index f4319d2..312576a 100644 --- a/lib/rpmsg_lite/porting/platform/imx8mm_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx8mm_m4/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 NXP + * Copyright 2017-2021 NXP * All rights reserved. * * @@ -22,6 +22,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -264,7 +267,11 @@ int32_t platform_init(void) NVIC_EnableIRQ(MU_M4_IRQn); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx8mn_m7/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx8mn_m7/rpmsg_platform.c index 6ac6eb6..33344d2 100644 --- a/lib/rpmsg_lite/porting/platform/imx8mn_m7/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx8mn_m7/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 NXP + * Copyright 2017-2021 NXP * All rights reserved. * * @@ -22,6 +22,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -264,7 +267,11 @@ int32_t platform_init(void) NVIC_EnableIRQ(MU_M7_IRQn); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx8mq_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx8mq_m4/rpmsg_platform.c index 131d488..9f57207 100644 --- a/lib/rpmsg_lite/porting/platform/imx8mq_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx8mq_m4/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 NXP + * Copyright 2017-2021 NXP * All rights reserved. * * @@ -22,6 +22,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -256,7 +259,11 @@ int32_t platform_init(void) NVIC_EnableIRQ(MU_M4_IRQn); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx8qm_m4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx8qm_m4/rpmsg_platform.c index 2855356..645d65c 100644 --- a/lib/rpmsg_lite/porting/platform/imx8qm_m4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx8qm_m4/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 NXP + * Copyright 2017-2021 NXP * All rights reserved. * * @@ -66,6 +66,9 @@ static int32_t isr_counter1 = 0; /* RL_PLATFORM_IMX8QM_M4_M4_USER_LINK_ID is static int32_t disable_counter0 = 0; static int32_t disable_counter1 = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -458,7 +461,11 @@ int32_t platform_init(void) IRQSTEER_EnableInterrupt(IRQSTEER, APP_M4_M4_MU_IRQn); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imx8qx_cm4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imx8qx_cm4/rpmsg_platform.c index ce21ad1..034dcfb 100644 --- a/lib/rpmsg_lite/porting/platform/imx8qx_cm4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imx8qx_cm4/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 NXP + * Copyright 2017-2021 NXP * All rights reserved. * * @@ -40,6 +40,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static void platform_global_isr_disable(void) { @@ -274,7 +277,11 @@ int32_t platform_init(void) IRQSTEER_EnableInterrupt(IRQSTEER, APP_M4_MU_IRQn); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/imxrt600_hifi4/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imxrt600_hifi4/rpmsg_platform.c index a847a74..776fad2 100644 --- a/lib/rpmsg_lite/porting/platform/imxrt600_hifi4/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imxrt600_hifi4/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 NXP + * Copyright 2019-2021 NXP * All rights reserved. * * @@ -13,7 +13,10 @@ #include "rpmsg_env.h" #include -#ifndef FSL_RTOS_FREE_RTOS +#ifdef SDK_OS_BAREMETAL +#include +#include +#else #include #endif @@ -27,6 +30,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif void MU_B_IRQHandler(void *arg) { @@ -144,8 +150,8 @@ int32_t platform_interrupt_enable(uint32_t vector_id) { RL_ASSERT(0 < disable_counter); -#ifdef FSL_RTOS_FREE_RTOS - xt_interrupt_enable(6); +#ifdef SDK_OS_BAREMETAL + _xtos_interrupt_enable(6); #else xos_interrupt_enable(6); #endif @@ -167,8 +173,8 @@ int32_t platform_interrupt_disable(uint32_t vector_id) { RL_ASSERT(0 <= disable_counter); -#ifdef FSL_RTOS_FREE_RTOS - xt_interrupt_disable(6); +#ifdef SDK_OS_BAREMETAL + _xtos_interrupt_disable(6); #else xos_interrupt_disable(6); #endif @@ -236,14 +242,18 @@ void *platform_patova(uint32_t addr) int32_t platform_init(void) { /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } /* Register interrupt handler for MU_B on HiFi4 */ -#ifdef FSL_RTOS_FREE_RTOS - xt_set_interrupt_handler(6, MU_B_IRQHandler, ((void *)0)); +#ifdef SDK_OS_BAREMETAL + _xtos_set_interrupt_handler(6, MU_B_IRQHandler); #else xos_register_interrupt_handler(6, MU_B_IRQHandler, ((void *)0)); #endif @@ -258,8 +268,8 @@ int32_t platform_init(void) */ int32_t platform_deinit(void) { -#ifdef FSL_RTOS_FREE_RTOS - xt_set_interrupt_handler(6, ((void *)0), ((void *)0)); +#ifdef SDK_OS_BAREMETAL + _xtos_set_interrupt_handler(6, ((void *)0)); #else xos_register_interrupt_handler(6, ((void *)0), ((void *)0)); #endif diff --git a/lib/rpmsg_lite/porting/platform/imxrt600_m33/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/imxrt600_m33/rpmsg_platform.c index 8bb62f4..be68f48 100644 --- a/lib/rpmsg_lite/porting/platform/imxrt600_m33/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/imxrt600_m33/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 NXP + * Copyright 2019-2021 NXP * All rights reserved. * * @@ -31,6 +31,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif #if defined(RL_USE_MCMGR_IPC_ISR_HANDLER) && (RL_USE_MCMGR_IPC_ISR_HANDLER == 1) static void mcmgr_event_handler(uint16_t vring_idx, void *context) @@ -279,7 +282,11 @@ int32_t platform_init(void) #endif /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/k32l3a6/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/k32l3a6/rpmsg_platform.c index d602b62..8d2b460 100644 --- a/lib/rpmsg_lite/porting/platform/k32l3a6/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/k32l3a6/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 NXP + * Copyright 2019-2021 NXP * All rights reserved. * * @@ -25,6 +25,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif #if defined(RL_USE_MCMGR_IPC_ISR_HANDLER) && (RL_USE_MCMGR_IPC_ISR_HANDLER == 1) static void mcmgr_event_handler(uint16_t vring_idx, void *context) @@ -328,7 +331,11 @@ int32_t platform_init(void) #endif /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/lpc5410x/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/lpc5410x/rpmsg_platform.c index 1ebd4ff..a01b31c 100644 --- a/lib/rpmsg_lite/porting/platform/lpc5410x/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/lpc5410x/rpmsg_platform.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -26,6 +26,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif #if defined(RL_USE_MCMGR_IPC_ISR_HANDLER) && (RL_USE_MCMGR_IPC_ISR_HANDLER == 1) static void mcmgr_event_handler(uint16_t vring_idx, void *context) @@ -310,7 +313,11 @@ int32_t platform_init(void) #endif /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform.c index 65be127..da6d9b6 100644 --- a/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -26,6 +26,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif #if defined(RL_USE_MCMGR_IPC_ISR_HANDLER) && (RL_USE_MCMGR_IPC_ISR_HANDLER == 1) static void mcmgr_event_handler(uint16_t vring_idx, void *context) @@ -310,7 +313,11 @@ int32_t platform_init(void) #endif /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform_zephyr_ipm.c b/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform_zephyr_ipm.c index 80fa30c..5433cd2 100644 --- a/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform_zephyr_ipm.c +++ b/lib/rpmsg_lite/porting/platform/lpc5411x/rpmsg_platform_zephyr_ipm.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * All rights reserved. * * @@ -20,6 +20,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif static struct device *ipm_handle = ((void *)0); void platform_ipm_callback(void *context, u32_t id, volatile void *data) @@ -232,7 +235,11 @@ int32_t platform_init(void) ipm_register_callback(ipm_handle, platform_ipm_callback, ((void *)0)); /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/porting/platform/lpc55s69/rpmsg_platform.c b/lib/rpmsg_lite/porting/platform/lpc55s69/rpmsg_platform.c index 38dd038..7720546 100644 --- a/lib/rpmsg_lite/porting/platform/lpc55s69/rpmsg_platform.c +++ b/lib/rpmsg_lite/porting/platform/lpc55s69/rpmsg_platform.c @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 NXP + * Copyright 2018-2021 NXP * All rights reserved. * * @@ -25,6 +25,9 @@ static int32_t isr_counter = 0; static int32_t disable_counter = 0; static void *platform_lock; +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +static LOCK_STATIC_CONTEXT platform_lock_static_ctxt; +#endif #if defined(RL_USE_MCMGR_IPC_ISR_HANDLER) && (RL_USE_MCMGR_IPC_ISR_HANDLER == 1) static void mcmgr_event_handler(uint16_t vring_idx, void *context) @@ -296,7 +299,11 @@ int32_t platform_init(void) #endif /* Create lock used in multi-instanced RPMsg */ +#if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) + if (0 != env_create_mutex(&platform_lock, 1, &platform_lock_static_ctxt)) +#else if (0 != env_create_mutex(&platform_lock, 1)) +#endif { return -1; } diff --git a/lib/rpmsg_lite/rpmsg_lite.c b/lib/rpmsg_lite/rpmsg_lite.c index 6aa65ee..1faa6ff 100644 --- a/lib/rpmsg_lite/rpmsg_lite.c +++ b/lib/rpmsg_lite/rpmsg_lite.c @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -102,8 +102,7 @@ struct virtqueue_ops /*! * @brief - * Create a new rpmsg endpoint, which can be used - * for communication. + * Traverse the linked list of endpoints to get the one with defined address. * * @param rpmsg_lite_dev RPMsg Lite instance * @param addr Local endpoint address @@ -1008,7 +1007,7 @@ struct rpmsg_lite_instance *rpmsg_lite_master_init(void *shmem_addr, } #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1, &rpmsg_lite_dev->lock_stack); + status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1, &rpmsg_lite_dev->lock_static_ctxt); #else status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1); #endif @@ -1192,7 +1191,7 @@ struct rpmsg_lite_instance *rpmsg_lite_remote_init(void *shmem_addr, uint32_t li } #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1, &rpmsg_lite_dev->lock_stack); + status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1, &rpmsg_lite_dev->lock_static_ctxt); #else status = env_create_mutex((LOCK *)&rpmsg_lite_dev->lock, 1); #endif diff --git a/lib/rpmsg_lite/rpmsg_queue.c b/lib/rpmsg_lite/rpmsg_queue.c index 082f0e1..0fdaf1d 100644 --- a/lib/rpmsg_lite/rpmsg_queue.c +++ b/lib/rpmsg_lite/rpmsg_queue.c @@ -2,7 +2,7 @@ * Copyright (c) 2014, Mentor Graphics Corporation * Copyright (c) 2015 Xilinx, Inc. * Copyright (c) 2016 Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * Copyright 2021 ACRIOS Systems s.r.o. * All rights reserved. * @@ -33,13 +33,6 @@ #include "rpmsg_lite.h" #include "rpmsg_queue.h" -typedef struct -{ - uint32_t src; - void *data; - uint32_t len; -} rpmsg_queue_rx_cb_data_t; - int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, void *priv) { rpmsg_queue_rx_cb_data_t msg; @@ -61,7 +54,9 @@ int32_t rpmsg_queue_rx_cb(void *payload, uint32_t payload_len, uint32_t src, voi } #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) -rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev, uint8_t *queue_stack, rpmsg_static_queue *rpmsg_queue) +rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev, + uint8_t *queue_storage, + rpmsg_static_queue_ctxt *queue_ctxt) #else rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev) #endif @@ -76,7 +71,8 @@ rpmsg_queue_handle rpmsg_queue_create(struct rpmsg_lite_instance *rpmsg_lite_dev /* create message queue for channel default endpoint */ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) - status = env_create_queue(&q, (int32_t)rpmsg_lite_dev->rvq->vq_nentries, (int32_t)sizeof(rpmsg_queue_rx_cb_data_t), queue_stack, rpmsg_queue); + status = env_create_queue(&q, (int32_t)rpmsg_lite_dev->rvq->vq_nentries, (int32_t)sizeof(rpmsg_queue_rx_cb_data_t), + queue_storage, queue_ctxt); #else status = env_create_queue(&q, (int32_t)rpmsg_lite_dev->rvq->vq_nentries, (int32_t)sizeof(rpmsg_queue_rx_cb_data_t)); #endif From dd10b34beb3b28d090fdebb95172db1a568ba313 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Thu, 16 Sep 2021 09:24:52 +0200 Subject: [PATCH 3/5] Fix Freertos include Signed-off-by: Cervenka Dusan --- lib/include/environment/freertos/rpmsg_env_specific.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/include/environment/freertos/rpmsg_env_specific.h b/lib/include/environment/freertos/rpmsg_env_specific.h index a9a1693..462fd30 100644 --- a/lib/include/environment/freertos/rpmsg_env_specific.h +++ b/lib/include/environment/freertos/rpmsg_env_specific.h @@ -20,12 +20,11 @@ #define RPMSG_ENV_SPECIFIC_H_ #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) +#include "FreeRTOS.h" + #if (configSUPPORT_STATIC_ALLOCATION == 0) #warning You have configured RPMsg_Lite to use static API but FreeRTOS is not configured for static allocations! Please switch the configSUPPORT_STATIC_ALLOCATION to 1 in your FreeRTOSConfig.h file. #endif - -#include "FreeRTOS.h" - typedef StaticSemaphore_t LOCK_STATIC_CONTEXT; typedef StaticQueue_t rpmsg_static_queue_ctxt; From 1c36453534bc9cd9cf4e6d8f48d667ffe388c804 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Thu, 16 Sep 2021 15:11:35 +0200 Subject: [PATCH 4/5] Added #include "rpmsg_default_config.h" tp rpmsg_env_specific.h Signed-off-by: Cervenka Dusan --- lib/include/environment/bm/rpmsg_env_specific.h | 2 ++ lib/include/environment/freertos/rpmsg_env_specific.h | 2 ++ lib/include/environment/qnx/rpmsg_env_specific.h | 1 + lib/include/environment/threadx/rpmsg_env_specific.h | 2 ++ lib/include/environment/xos/rpmsg_env_specific.h | 2 ++ lib/include/environment/zephyr/rpmsg_env_specific.h | 2 ++ 6 files changed, 11 insertions(+) diff --git a/lib/include/environment/bm/rpmsg_env_specific.h b/lib/include/environment/bm/rpmsg_env_specific.h index 4f35c30..c260d90 100644 --- a/lib/include/environment/bm/rpmsg_env_specific.h +++ b/lib/include/environment/bm/rpmsg_env_specific.h @@ -19,6 +19,8 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include "rpmsg_default_config.h" + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) typedef uint8_t LOCK_STATIC_CONTEXT; typedef uint8_t rpmsg_static_queue_ctxt; diff --git a/lib/include/environment/freertos/rpmsg_env_specific.h b/lib/include/environment/freertos/rpmsg_env_specific.h index 462fd30..0b913a1 100644 --- a/lib/include/environment/freertos/rpmsg_env_specific.h +++ b/lib/include/environment/freertos/rpmsg_env_specific.h @@ -19,6 +19,8 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include "rpmsg_default_config.h" + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include "FreeRTOS.h" diff --git a/lib/include/environment/qnx/rpmsg_env_specific.h b/lib/include/environment/qnx/rpmsg_env_specific.h index 64d6e5d..4a921b6 100644 --- a/lib/include/environment/qnx/rpmsg_env_specific.h +++ b/lib/include/environment/qnx/rpmsg_env_specific.h @@ -19,6 +19,7 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include "rpmsg_default_config.h" #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include diff --git a/lib/include/environment/threadx/rpmsg_env_specific.h b/lib/include/environment/threadx/rpmsg_env_specific.h index 66dee2d..1ab3ba7 100644 --- a/lib/include/environment/threadx/rpmsg_env_specific.h +++ b/lib/include/environment/threadx/rpmsg_env_specific.h @@ -19,6 +19,8 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include "rpmsg_default_config.h" + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include "tx_api.h" #include "tx_event_flags.h" diff --git a/lib/include/environment/xos/rpmsg_env_specific.h b/lib/include/environment/xos/rpmsg_env_specific.h index 860fc68..9ec58c1 100644 --- a/lib/include/environment/xos/rpmsg_env_specific.h +++ b/lib/include/environment/xos/rpmsg_env_specific.h @@ -19,6 +19,8 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include "rpmsg_default_config.h" + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include diff --git a/lib/include/environment/zephyr/rpmsg_env_specific.h b/lib/include/environment/zephyr/rpmsg_env_specific.h index 0dfe309..779591a 100644 --- a/lib/include/environment/zephyr/rpmsg_env_specific.h +++ b/lib/include/environment/zephyr/rpmsg_env_specific.h @@ -19,6 +19,8 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include "rpmsg_default_config.h" + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include From d484d8dd3acbe8c21d2c7189ee4c9111edb6462d Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Thu, 16 Sep 2021 15:15:57 +0200 Subject: [PATCH 5/5] Moved rpmsg_queue_rx_cb_data_t to rpmsg_env_specific.h Signed-off-by: Cervenka Dusan --- lib/include/environment/bm/rpmsg_env_specific.h | 8 ++++++++ lib/include/environment/freertos/rpmsg_env_specific.h | 8 ++++++++ lib/include/environment/qnx/rpmsg_env_specific.h | 8 ++++++++ lib/include/environment/threadx/rpmsg_env_specific.h | 8 ++++++++ lib/include/environment/xos/rpmsg_env_specific.h | 8 ++++++++ lib/include/rpmsg_queue.h | 7 ------- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/include/environment/bm/rpmsg_env_specific.h b/lib/include/environment/bm/rpmsg_env_specific.h index c260d90..f468403 100644 --- a/lib/include/environment/bm/rpmsg_env_specific.h +++ b/lib/include/environment/bm/rpmsg_env_specific.h @@ -19,8 +19,16 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include #include "rpmsg_default_config.h" +typedef struct +{ + uint32_t src; + void *data; + uint32_t len; +} rpmsg_queue_rx_cb_data_t; + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) typedef uint8_t LOCK_STATIC_CONTEXT; typedef uint8_t rpmsg_static_queue_ctxt; diff --git a/lib/include/environment/freertos/rpmsg_env_specific.h b/lib/include/environment/freertos/rpmsg_env_specific.h index 0b913a1..4f8722f 100644 --- a/lib/include/environment/freertos/rpmsg_env_specific.h +++ b/lib/include/environment/freertos/rpmsg_env_specific.h @@ -19,8 +19,16 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include #include "rpmsg_default_config.h" +typedef struct +{ + uint32_t src; + void *data; + uint32_t len; +} rpmsg_queue_rx_cb_data_t; + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include "FreeRTOS.h" diff --git a/lib/include/environment/qnx/rpmsg_env_specific.h b/lib/include/environment/qnx/rpmsg_env_specific.h index 4a921b6..d3a2bd4 100644 --- a/lib/include/environment/qnx/rpmsg_env_specific.h +++ b/lib/include/environment/qnx/rpmsg_env_specific.h @@ -19,8 +19,16 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include #include "rpmsg_default_config.h" +typedef struct +{ + uint32_t src; + void *data; + uint32_t len; +} rpmsg_queue_rx_cb_data_t; + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include #include diff --git a/lib/include/environment/threadx/rpmsg_env_specific.h b/lib/include/environment/threadx/rpmsg_env_specific.h index 1ab3ba7..29751b5 100644 --- a/lib/include/environment/threadx/rpmsg_env_specific.h +++ b/lib/include/environment/threadx/rpmsg_env_specific.h @@ -19,8 +19,16 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include #include "rpmsg_default_config.h" +typedef struct +{ + uint32_t src; + void *data; + uint32_t len; +} rpmsg_queue_rx_cb_data_t; + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include "tx_api.h" #include "tx_event_flags.h" diff --git a/lib/include/environment/xos/rpmsg_env_specific.h b/lib/include/environment/xos/rpmsg_env_specific.h index 9ec58c1..09fb761 100644 --- a/lib/include/environment/xos/rpmsg_env_specific.h +++ b/lib/include/environment/xos/rpmsg_env_specific.h @@ -19,8 +19,16 @@ #ifndef RPMSG_ENV_SPECIFIC_H_ #define RPMSG_ENV_SPECIFIC_H_ +#include #include "rpmsg_default_config.h" +typedef struct +{ + uint32_t src; + void *data; + uint32_t len; +} rpmsg_queue_rx_cb_data_t; + #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1) #include diff --git a/lib/include/rpmsg_queue.h b/lib/include/rpmsg_queue.h index 8836544..477b17e 100644 --- a/lib/include/rpmsg_queue.h +++ b/lib/include/rpmsg_queue.h @@ -44,13 +44,6 @@ */ typedef void *rpmsg_queue_handle; -typedef struct -{ - uint32_t src; - void *data; - uint32_t len; -} rpmsg_queue_rx_cb_data_t; - /* RL_API_HAS_ZEROCOPY has to be enabled for RPMsg Queue to work */ #if defined(RL_API_HAS_ZEROCOPY) && (RL_API_HAS_ZEROCOPY == 1)