Skip to content

Commit

Permalink
Merge branch 'develop' into feature/improve_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalPrincNXP authored Feb 9, 2024
2 parents fd7b841 + 32ce7f2 commit 48ab2e6
Show file tree
Hide file tree
Showing 256 changed files with 17,499 additions and 171 deletions.
1 change: 1 addition & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
- uses: DoozyX/[email protected]
with:
source: '.'
exclude: './examples/zephyr/matrix_multiply_rpmsglite/remote/src/service ./examples/zephyr/matrix_multiply_rpmsglite/src/service ./examples/zephyr/matrix_multiply_uart/src/service'
clangFormatVersion: 16
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,4 @@ Repository on Github contains two main branches: __main__ and __develop__. Code
---
Copyright 2014-2016 Freescale Semiconductor, Inc.

Copyright 2016-2023 NXP
Copyright 2016-2024 NXP
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.erpc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "eRPC API Reference"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Rev. 1.11.0"
PROJECT_NUMBER = "Rev. 1.12.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion doxygen/Doxyfile.erpcgen
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "eRPC Generator (erpcgen)"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "Rev. 1.11.0"
PROJECT_NUMBER = "Rev. 1.12.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
14 changes: 9 additions & 5 deletions erpc_c/infra/erpc_message_buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
* Copyright 2016-2021 NXP
* Copyright 2016-2023 NXP
* Copyright 2021 ACRIOS Systems s.r.o.
* All rights reserved.
*
Expand Down Expand Up @@ -110,13 +110,17 @@ void MessageBuffer::swap(MessageBuffer *other)

void Cursor::setBuffer(MessageBuffer &buffer, uint8_t reserved)
{
erpc_assert(buffer != NULL);

m_buffer = buffer;
// 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.
m_pos = buffer.get() + reserved;

// erpc_assert(buffer != NULL);

m_buffer = buffer;
if (buffer != NULL)
{
m_pos = buffer.get() + reserved;
}
}

MessageBuffer Cursor::getBuffer(void)
Expand Down
4 changes: 2 additions & 2 deletions erpc_c/infra/erpc_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
////////////////////////////////////////////////////////////////////////////////

//! @brief String version of eRPC.
#define ERPC_VERSION "1.11.0"
#define ERPC_VERSION "1.12.0"
//! @brief Integer version of eRPC.
#define ERPC_VERSION_NUMBER 11100
#define ERPC_VERSION_NUMBER 11200

/*! @} */

Expand Down
4 changes: 2 additions & 2 deletions erpc_c/port/erpc_port_zephyr.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 NXP
* Copyright 2017-2023 NXP
* Copyright 2021 ACRIOS Systems s.r.o.
* All rights reserved.
*
Expand All @@ -12,7 +12,7 @@
#include <new>

extern "C" {
#include "kernel.h"
#include <zephyr/kernel.h>
};

using namespace std;
Expand Down
16 changes: 9 additions & 7 deletions erpc_c/port/erpc_threading.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
* Copyright 2016-2021 NXP
* Copyright 2016-2023 NXP
* Copyright 2021 ACRIOS Systems s.r.o.
* All rights reserved.
*
Expand All @@ -25,7 +25,7 @@
#include "semphr.h"
#include "task.h"
#elif ERPC_THREADS_IS(ZEPHYR)
#include "kernel.h"
#include <zephyr/kernel.h>
#elif ERPC_THREADS_IS(MBED)
#if MBED_CONF_RTOS_PRESENT
#include "rtos.h"
Expand Down Expand Up @@ -99,7 +99,7 @@ class Thread
* @param[in] stackPtr Mandatory task stack pointer for static api usage.
*/
Thread(thread_entry_t entry, uint32_t priority = 0, uint32_t stackSize = 0, const char *name = 0,
thread_stack_pointer stackPtr = 0);
thread_stack_pointer stackPtr = NULL);

/*!
* @brief Destructor.
Expand Down Expand Up @@ -128,7 +128,8 @@ class Thread
* @param[in] stackSize Stack size.
* @param[in] stackPtr Mandatory task stack pointer for static api usage.
*/
void init(thread_entry_t entry, uint32_t priority = 0, uint32_t stackSize = 0, thread_stack_pointer stackPtr = 0);
void init(thread_entry_t entry, uint32_t priority = 0, uint32_t stackSize = 0,
thread_stack_pointer stackPtr = NULL);

/*!
* @brief This function starts thread execution.
Expand Down Expand Up @@ -156,7 +157,7 @@ class Thread
#elif ERPC_THREADS_IS(FREERTOS)
return reinterpret_cast<thread_id_t>(m_task);
#elif ERPC_THREADS_IS(ZEPHYR)
return reinterpret_cast<thread_id_t>(m_thread);
return reinterpret_cast<thread_id_t>(m_thread_id);
#elif ERPC_THREADS_IS(MBED)
return reinterpret_cast<thread_id_t>(m_thread->get_id());
#elif ERPC_THREADS_IS(WIN32)
Expand Down Expand Up @@ -238,7 +239,8 @@ class Thread
StaticTask_t m_staticTask; /*!< Hold static task data. */
#endif
#elif ERPC_THREADS_IS(ZEPHYR)
struct k_thread m_thread; /*!< Current thread. */
struct k_thread m_thread; /*!< Current thread. */
k_tid_t m_thread_id;
k_thread_stack_t *m_stack; /*!< Pointer to stack. */
#elif ERPC_THREADS_IS(MBED)
rtos::Thread *m_thread; /*!< Underlying Thread instance */
Expand Down Expand Up @@ -282,7 +284,7 @@ class Thread
* @param[in] arg2
* @param[in] arg3
*/
static void *threadEntryPointStub(void *arg1, void *arg2, void *arg3);
static void threadEntryPointStub(void *arg1, void *arg2, void *arg3);

#elif ERPC_THREADS_IS(MBED)

Expand Down
6 changes: 3 additions & 3 deletions erpc_c/port/erpc_threading_freertos.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* Copyright 2016-2021 NXP
* Copyright 2016-2023 NXP
* Copyright 2021 ACRIOS Systems s.r.o.
* All rights reserved.
*
Expand All @@ -27,14 +27,14 @@ Thread *Thread::s_first = NULL;
////////////////////////////////////////////////////////////////////////////////

Thread::Thread(const char *name) :
m_name(name), m_entry(0), m_arg(0), m_stackSize(0), m_priority(0), m_task(0), m_next(0)
m_name(name), m_entry(NULL), m_arg(0), m_stackSize(0), m_priority(0), m_stackPtr(NULL), m_task(0), m_next(0)
{
}

Thread::Thread(thread_entry_t entry, uint32_t priority, uint32_t stackSize, const char *name,
thread_stack_pointer stackPtr) :
m_name(name),
m_entry(entry), m_arg(0), m_stackSize(stackSize), m_priority(priority), m_task(0), m_next(0)
m_entry(entry), m_arg(0), m_stackSize(stackSize), m_priority(priority), m_stackPtr(stackPtr), m_task(0), m_next(0)
{
}

Expand Down
23 changes: 12 additions & 11 deletions erpc_c/port/erpc_threading_zephyr.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 NXP
* Copyright 2017-2023 NXP
* Copyright 2021 ACRIOS Systems s.r.o.
* All rights reserved.
*
Expand All @@ -18,14 +18,14 @@ using namespace erpc;
////////////////////////////////////////////////////////////////////////////////

Thread::Thread(const char *name) :
m_name(name), m_entry(0), m_arg(0), m_stackSize(0), m_priority(0), m_thread(0), m_stack(0)
m_name(name), m_entry(0), m_arg(0), m_stackSize(0), m_priority(0), m_thread(), m_stack(0)
{
}

Thread::Thread(thread_entry_t entry, uint32_t priority, uint32_t stackSize, const char *name,
thread_stack_pointer stackPtr) :
m_name(name),
m_entry(entry), m_arg(0), m_stackSize(stackSize), m_priority(priority), m_thread(0), m_stack(0)
m_entry(entry), m_arg(0), m_stackSize(stackSize), m_priority(priority), m_thread(), m_stack(0)
{
}

Expand All @@ -44,12 +44,13 @@ void Thread::start(void *arg)
m_arg = arg;

erpc_assert((m_stack != NULL) && ("Set stack address" != NULL));
k_thread_create(&m_thread, m_stack, m_stackSize, threadEntryPointStub, this, NULL, NULL, m_priority, 0, K_NO_WAIT);
m_thread_id = k_thread_create(&m_thread, m_stack, m_stackSize, threadEntryPointStub, this, NULL, NULL, m_priority,
0, K_NO_WAIT);
}

bool Thread::operator==(Thread &o)
{
return m_thread == o.m_thread;
return &m_thread == &o.m_thread;
}

Thread *Thread::getCurrentThread(void)
Expand All @@ -59,7 +60,7 @@ Thread *Thread::getCurrentThread(void)

void Thread::sleep(uint32_t usecs)
{
k_sleep(usecs / 1000);
k_sleep(K_USEC(usecs));
}

void Thread::threadEntryPoint(void)
Expand All @@ -70,7 +71,7 @@ void Thread::threadEntryPoint(void)
}
}

void *Thread::threadEntryPointStub(void *arg1, void *arg2, void *arg3)
void Thread::threadEntryPointStub(void *arg1, void *arg2, void *arg3)
{
Thread *_this = reinterpret_cast<Thread *>(arg1);
erpc_assert((_this != NULL) && ("Reinterpreting 'void *arg1' to 'Thread *' failed." != NULL));
Expand All @@ -81,7 +82,7 @@ void *Thread::threadEntryPointStub(void *arg1, void *arg2, void *arg3)
k_thread_abort(k_current_get());
}

Mutex::Mutex(void) : m_mutex(0)
Mutex::Mutex(void) : m_mutex()
{
k_mutex_init(&m_mutex);
}
Expand All @@ -104,7 +105,7 @@ bool Mutex::unlock(void)
return true;
}

Semaphore::Semaphore(int count) : m_sem(0)
Semaphore::Semaphore(int count) : m_sem()
{
// Set max count to highest signed int.
k_sem_init(&m_sem, count, 0x7fffffff);
Expand All @@ -131,12 +132,12 @@ bool Semaphore::get(uint32_t timeoutUsecs)
}
}

return (k_sem_take(&m_sem, timeoutUsecs) == 0);
return (k_sem_take(&m_sem, K_USEC(timeoutUsecs)) == 0);
}

int Semaphore::getCount(void) const
{
return k_sem_count_get(m_sem);
return k_sem_count_get(const_cast<k_sem *>(&m_sem));
}
#endif /* ERPC_THREADS_IS(ZEPHYR) */

Expand Down
42 changes: 38 additions & 4 deletions erpc_c/setup/erpc_setup_lpi2c_slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,49 @@ using namespace erpc;
// Variables
////////////////////////////////////////////////////////////////////////////////

static ManuallyConstructed<LPI2cSlaveTransport> s_transport;
ERPC_MANUALLY_CONSTRUCTED_STATIC(LPI2cSlaveTransport, s_lpi2cTransport);

////////////////////////////////////////////////////////////////////////////////
// Code
////////////////////////////////////////////////////////////////////////////////

erpc_transport_t erpc_transport_lpi2c_slave_init(void *baseAddr, uint32_t baudRate, uint32_t srcClock_Hz)
{
s_transport.construct(reinterpret_cast<LPI2C_Type *>(baseAddr), baudRate, srcClock_Hz);
(void)s_transport->init();
return reinterpret_cast<erpc_transport_t>(s_transport.get());
LPI2cSlaveTransport *lpi2cTransport;

#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
if (s_lpi2cTransport.isUsed())
{
lpi2cTransport = NULL;
}
else
{
s_lpi2cTransport.construct(reinterpret_cast<LPI2C_Type *>(baseAddr), baudRate, srcClock_Hz);
lpi2cTransport = s_lpi2cTransport.get();
}
#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
lpi2cTransport = new LPI2cSlaveTransport(reinterpret_cast<LPI2C_Type *>(baseAddr), baudRate, srcClock_Hz);
#else
#error "Unknown eRPC allocation policy!"
#endif

if (lpi2cTransport != NULL)
{
(void)lpi2cTransport->init();
}

return reinterpret_cast<erpc_transport_t>(lpi2cTransport);
}
void erpc_transport_lpi2c_slave_deinit(erpc_transport_t transport)
{
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
(void)transport;
s_lpi2cTransport.destroy();
#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
erpc_assert(transport != NULL);

LPI2cSlaveTransport *lpi2cTransport = reinterpret_cast<LPI2cSlaveTransport *>(transport);

delete lpi2cTransport;
#endif
}
43 changes: 39 additions & 4 deletions erpc_c/setup/erpc_setup_lpspi_slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,50 @@ using namespace erpc;
// Variables
////////////////////////////////////////////////////////////////////////////////

ERPC_MANUALLY_CONSTRUCTED(LPSpiSlaveTransport, s_transport);
ERPC_MANUALLY_CONSTRUCTED_STATIC(LPSpiSlaveTransport, s_lpspiTransport);

////////////////////////////////////////////////////////////////////////////////
// Code
////////////////////////////////////////////////////////////////////////////////

erpc_transport_t erpc_transport_lpspi_slave_init(void *baseAddr, uint32_t baudRate, uint32_t srcClock_Hz)
{
s_transport.construct(reinterpret_cast<LPSPI_Type *>(baseAddr), baudRate, srcClock_Hz);
(void)s_transport->init();
return reinterpret_cast<erpc_transport_t>(s_transport.get());
LPSpiSlaveTransport *lpspiTransport;

#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
if (s_lpspiTransport.isUsed())
{
lpspiTransport = NULL;
}
else
{
s_lpspiTransport.construct(reinterpret_cast<LPSPI_Type *>(baseAddr), baudRate, srcClock_Hz);
lpspiTransport = s_lpspiTransport.get();
}
#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
lpspiTransport = new LPSpiSlaveTransport(reinterpret_cast<LPSPI_Type *>(baseAddr), baudRate, srcClock_Hz);
#else
#error "Unknown eRPC allocation policy!"
#endif

if (lpspiTransport != NULL)
{
(void)lpspiTransport->init();
}

return reinterpret_cast<erpc_transport_t>(lpspiTransport);
}

void erpc_transport_lpspi_slave_deinit(erpc_transport_t transport)
{
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_STATIC
(void)transport;
s_lpspiTransport.destroy();
#elif ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
erpc_assert(transport != NULL);

LPSpiSlaveTransport *lpspiTransport = reinterpret_cast<LPSpiSlaveTransport *>(transport);

delete lpspiTransport;
#endif
}
Loading

0 comments on commit 48ab2e6

Please sign in to comment.