Skip to content

Commit

Permalink
RPMsg-Lite update 01/2021
Browse files Browse the repository at this point in the history
- Several MISRA C-2012 violations addressed
- Introduced RL_ALLOW_CONSUMED_BUFFERS_NOTIFICATION config option to allow opposite side notification sending each time received buffers are consumed and put into the queue of available buffers
- Added environment layers for Threadx
- Added support for i.MX8QM multicore platform
- Updated version to 3.1.1
  • Loading branch information
MichalPrincNXP committed Jan 11, 2021
1 parent cb56a06 commit f12ffe9
Show file tree
Hide file tree
Showing 25 changed files with 1,419 additions and 274 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ The RPMsg-Lite can be configured at the compile time. The default configuration
|RL_USE_MCMGR_IPC_ISR_HANDLER | (0) | When enabled IPC interrupts are managed by the Multicore Manager (IPC interrupts router), when disabled RPMsg-Lite manages IPC interrupts by itself. |
|RL_USE_ENVIRONMENT_CONTEXT | (0) | When enabled the environment layer uses its own context. Required for some environments (QNX). The default value is 0 (no context, saves some RAM). |
|RL_DEBUG_CHECK_BUFFERS | (0) | When enabled buffer debug checks in rpmsg_lite_send_nocopy() and rpmsg_lite_release_rx_buffer() functions are disabled. Do not use in RPMsg-Lite to Linux configuration. |
|RL_ALLOW_CONSUMED_BUFFERS_NOTIFICATION | (0) | When enabled the opposite side is notified each time received buffers are consumed and put into the queue of available buffers. Enable this option in RPMsg-Lite to Linux configuration to allow unblocking of the Linux blocking send. The default value is 0 (RPMsg-Lite to RPMsg-Lite communication). |
|RL_ASSERT | see rpmsg_default_config.h | Assert implementation. |

# Contributing to the rpmsg-lite project
Expand Down
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.rpmsglite
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "RPMsg-Lite User's Guide"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Rev. 3.1.0"
PROJECT_NUMBER = "Rev. 3.1.1"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
94 changes: 94 additions & 0 deletions lib/include/platform/imx8qm_m4/rpmsg_platform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright (c) 2016 Freescale Semiconductor, Inc.
* Copyright 2016-2019 NXP
* All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef RPMSG_PLATFORM_H_
#define RPMSG_PLATFORM_H_

#include <stdint.h>

/* RPMSG MU channel index */
#define RPMSG_MU_CHANNEL (1)

/*
* Linux requires the ALIGN to 0x1000(4KB) instead of 0x80
*/
#ifndef VRING_ALIGN
#define VRING_ALIGN (0x1000U)
#endif

/* contains pool of descriptors and two circular buffers */
#ifndef VRING_SIZE
#define VRING_SIZE (0x8000UL)
#endif

/* size of shared memory + 2*VRING size */
#define RL_VRING_OVERHEAD (2UL * VRING_SIZE)

/* VQ_ID in 8QM is defined as follows:
* com_id: [3:3] communication ID, used to identify the MU instance.
* vring_id: [2:1] vring ID, used to identify the vring.
* q_id: [0:0] queue ID, used to identify the tvq or rvq.
* com_id + vring_id = link_id
*/

#define RL_GET_VQ_ID(link_id, queue_id) (((queue_id)&0x1U) | (((link_id) << 1U) & 0xFFFFFFFEU))
#define RL_GET_LINK_ID(vq_id) ((vq_id) >> 1U)
#define RL_GET_COM_ID(vq_id) ((vq_id) >> 3U)
#define RL_GET_Q_ID(vq_id) ((vq_id)&0x1U)

#define RL_GEN_LINK_ID(com_id, vring_id) (((com_id) << 2U) | (vring_id))
#define RL_GEN_MU_MSG(vq_id) (uint32_t)(((vq_id)&0x7U) << 16U) /* com_id is discarded in msg */

#define RL_PLATFORM_IMX8QM_M4_A_COM_ID (0U)
#define RL_PLATFORM_IMX8QM_M4_M4_COM_ID (1U)

#define RL_PLATFORM_IMX8QM_M4_SRTM_VRING_ID (0U)
#define RL_PLATFORM_IMX8QM_M4_USER_VRING_ID (1U)

#define RL_PLATFORM_HIGHEST_LINK_ID RL_GEN_LINK_ID(RL_PLATFORM_IMX8QM_M4_M4_COM_ID, RL_PLATFORM_IMX8QM_M4_USER_VRING_ID)

#define RL_PLATFORM_IMX8QM_M4_A_SRTM_LINK_ID \
RL_GEN_LINK_ID(RL_PLATFORM_IMX8QM_M4_A_COM_ID, RL_PLATFORM_IMX8QM_M4_SRTM_VRING_ID)
#define RL_PLATFORM_IMX8QM_M4_A_USER_LINK_ID \
RL_GEN_LINK_ID(RL_PLATFORM_IMX8QM_M4_A_COM_ID, RL_PLATFORM_IMX8QM_M4_USER_VRING_ID)
#define RL_PLATFORM_IMX8QM_M4_M4_SRTM_LINK_ID \
RL_GEN_LINK_ID(RL_PLATFORM_IMX8QM_M4_M4_COM_ID, RL_PLATFORM_IMX8QM_M4_SRTM_VRING_ID)
#define RL_PLATFORM_IMX8QM_M4_M4_USER_LINK_ID \
RL_GEN_LINK_ID(RL_PLATFORM_IMX8QM_M4_M4_COM_ID, RL_PLATFORM_IMX8QM_M4_USER_VRING_ID)

/* platform interrupt related functions */
int32_t platform_init_interrupt(uint32_t vector_id, void *isr_data);
int32_t platform_deinit_interrupt(uint32_t vector_id);
int32_t platform_interrupt_enable(uint32_t vector_id);
int32_t platform_interrupt_disable(uint32_t vector_id);
int32_t platform_in_isr(void);
void platform_notify(uint32_t vector_id);

/* platform low-level time-delay (busy loop) */
void platform_time_delay(uint32_t num_msec);

/* platform memory functions */
void platform_map_mem_region(uint32_t vrt_addr, uint32_t phy_addr, uint32_t size, uint32_t flags);
void platform_cache_all_flush_invalidate(void);
void platform_cache_disable(void);
uint32_t platform_vatopa(void *addr);
void *platform_patova(uint32_t addr);

/* platform init/deinit */
int32_t platform_init(void);
int32_t platform_deinit(void);

#if defined(MIMX8QM_CM4_CORE0)
int32_t LSIO_MU5_INT_B_IRQHandler(void);
int32_t LSIO_MU7_INT_A_IRQHandler(void);
#elif defined(MIMX8QM_CM4_CORE1)
int32_t LSIO_MU6_INT_B_IRQHandler(void);
int32_t LSIO_MU7_INT_B_IRQHandler(void);
#endif

#endif /* RPMSG_PLATFORM_H_ */
13 changes: 4 additions & 9 deletions lib/include/platform/imxrt600_hifi4/rpmsg_platform.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 NXP
* Copyright 2019-2020 NXP
* All rights reserved.
*
*
Expand All @@ -11,13 +11,8 @@

#include <stdint.h>

/* RPMSG MU channel index */
#define RPMSG_MU_CHANNEL (1)

#define RPMSG_LITE_LINK_ID 0x1

/*
* No need to align the VRING as defined in Linux because LPCNEXT0 is not intended
* No need to align the VRING as defined in Linux because RT600 is not intended
* to run the Linux
*/
#ifndef VRING_ALIGN
Expand All @@ -36,8 +31,8 @@
#define RL_GET_LINK_ID(id) (((id)&0xFFFFFFFEU) >> 1U)
#define RL_GET_Q_ID(id) ((id)&0x1U)

#define RL_PLATFORM_LPCNEXT0_LINK_ID (0U)
#define RL_PLATFORM_HIGHEST_LINK_ID (1U)
#define RL_PLATFORM_IMXRT600_LINK_ID (0U)
#define RL_PLATFORM_HIGHEST_LINK_ID (0U)

/* platform interrupt related functions */
int32_t platform_init_interrupt(uint32_t vector_id, void *isr_data);
Expand Down
11 changes: 4 additions & 7 deletions lib/include/platform/imxrt600_m33/rpmsg_platform.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 NXP
* Copyright 2019-2020 NXP
* All rights reserved.
*
*
Expand All @@ -10,11 +10,8 @@

#include <stdint.h>

/* RPMSG MU channel index */
#define RPMSG_MU_CHANNEL (1)

/*
* No need to align the VRING as defined in Linux because LPC6324 is not intended
* No need to align the VRING as defined in Linux because RT600 is not intended
* to run the Linux
*/
#ifndef VRING_ALIGN
Expand All @@ -33,8 +30,8 @@
#define RL_GET_LINK_ID(id) (((id)&0xFFFFFFFEU) >> 1U)
#define RL_GET_Q_ID(id) ((id)&0x1U)

#define RL_PLATFORM_LPC6324_M33_DSP_LINK_ID (0U)
#define RL_PLATFORM_HIGHEST_LINK_ID (0U)
#define RL_PLATFORM_IMXRT600_LINK_ID (0U)
#define RL_PLATFORM_HIGHEST_LINK_ID (0U)

/* platform interrupt related functions */
int32_t platform_init_interrupt(uint32_t vector_id, void *isr_data);
Expand Down
13 changes: 12 additions & 1 deletion lib/include/rpmsg_default_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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-2020 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -124,6 +124,17 @@
#define RL_DEBUG_CHECK_BUFFERS (0)
#endif

//! @def RL_ALLOW_CONSUMED_BUFFERS_NOTIFICATION
//!
//! When enabled the opposite side is notified each time received buffers
//! are consumed and put into the queue of available buffers.
//! Enable this option in RPMsg-Lite to Linux configuration to allow unblocking
//! of the Linux blocking send.
//! The default value is 0 (RPMsg-Lite to RPMsg-Lite communication).
#ifndef RL_ALLOW_CONSUMED_BUFFERS_NOTIFICATION
#define RL_ALLOW_CONSUMED_BUFFERS_NOTIFICATION (0)
#endif

//! @def RL_HANG
//!
//! Default implementation of hang assert function
Expand Down
2 changes: 1 addition & 1 deletion lib/include/rpmsg_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern "C" {
* Definitions
******************************************************************************/

#define RL_VERSION "3.1.0" /*!< Current RPMsg Lite version */
#define RL_VERSION "3.1.1" /*!< Current RPMsg Lite version */

/* Shared memory "allocator" parameters */
#define RL_WORD_SIZE (sizeof(uint32_t))
Expand Down
2 changes: 1 addition & 1 deletion lib/rpmsg_lite/porting/environment/rpmsg_env_bm.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**************************************************************************
* FILE NAME
*
* bm_env.c
* rpmsg_env_bm.c
*
*
* DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion lib/rpmsg_lite/porting/environment/rpmsg_env_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**************************************************************************
* FILE NAME
*
* freertos_env.c
* rpmsg_env_freertos.c
*
*
* DESCRIPTION
Expand Down
Loading

0 comments on commit f12ffe9

Please sign in to comment.