Skip to content

Commit

Permalink
eRPC 1.4.1. updates
Browse files Browse the repository at this point in the history
-- Added support for unions type non-wrapped by structure.
-- Added callbacks support.
-- Strip ZC from RPMSG Lite file and classes names.
-- Added support @external annotation for functions.
-- Added support @name annotation.
-- Changed @outputDir annotation to @output_dir annotation.
-- Tests from execution section test_others were moved into pytest section.
-- Updated documentation.
-- Added MU transport layer.
-- Added RPMSG Lite RTOS TTY transport layer.
-- Extended threading to support put from interrupts.
-- Improved doxygen comments handling.
-- Added version verification and IDL version verification between eRPC code and eRPC generated shim code.
-- Fixed IDL file examples.
  • Loading branch information
DusanCervenkaNXP committed Mar 28, 2017
1 parent 9454bd4 commit 9b7bd47
Show file tree
Hide file tree
Showing 179 changed files with 6,643 additions and 1,499 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Supported transports:
* NXP Kinetis SPI and DSPI
* POSIX and Windows serial port
* TCP/IP (mostly for testing)
* [OpenAMP RPMsg](https://github.com/OpenAMP/open-amp)
* [NXP RPMsg-Lite](https://github.com/NXPmicro/rpmsg-lite)

eRPC is available with an unrestrictive BSD 3-clause license. See the LICENSE file for the full license text.
Expand Down
4 changes: 3 additions & 1 deletion erpc_c/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-------------------------------------------------------------------------------
# Copyright (C) 2016 Freescale Semiconductor, Inc.
# Copyright 2016 NXP
# Copyright 2016-2017 NXP
# All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
Expand Down Expand Up @@ -53,6 +53,7 @@ INCLUDES += $(ERPC_C_ROOT)/config \
SOURCES += $(ERPC_C_ROOT)/infra/arbitrated_client_manager.cpp \
$(ERPC_C_ROOT)/infra/basic_codec.cpp \
$(ERPC_C_ROOT)/infra/client_manager.cpp \
$(ERPC_C_ROOT)/infra/crc16.cpp \
$(ERPC_C_ROOT)/infra/framed_transport.cpp \
$(ERPC_C_ROOT)/infra/message_buffer.cpp \
$(ERPC_C_ROOT)/infra/server.cpp \
Expand All @@ -74,6 +75,7 @@ HEADERS += $(ERPC_C_ROOT)/config/erpc_config.h \
$(ERPC_C_ROOT)/infra/basic_codec.h \
$(ERPC_C_ROOT)/infra/client_manager.h \
$(ERPC_C_ROOT)/infra/codec.h \
$(ERPC_C_ROOT)/infra/crc16.h \
$(ERPC_C_ROOT)/infra/erpc_common.h \
$(ERPC_C_ROOT)/infra/erpc_version.h \
$(ERPC_C_ROOT)/infra/framed_transport.h \
Expand Down
24 changes: 23 additions & 1 deletion erpc_c/infra/basic_codec.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* Copyright 2016 NXP
* Copyright 2016-2017 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -156,6 +156,17 @@ erpc_status_t BasicCodec::endWriteStruct()
return kErpcStatus_Success;
}

erpc_status_t BasicCodec::startWriteUnion(int32_t discriminator)
{
// Write the union discriminator as a u32.
return write(discriminator);
}

erpc_status_t BasicCodec::endWriteUnion()
{
return kErpcStatus_Success;
}

erpc_status_t BasicCodec::writeNullFlag(bool isNull)
{
return write(static_cast<uint8_t>(isNull ? kIsNull : kNotNull));
Expand Down Expand Up @@ -292,6 +303,17 @@ erpc_status_t BasicCodec::endReadStruct()
return kErpcStatus_Success;
}

erpc_status_t BasicCodec::startReadUnion(int32_t *discriminator)
{
// Read union discriminator as u32.
return read(discriminator);
}

erpc_status_t BasicCodec::endReadUnion()
{
return kErpcStatus_Success;
}

erpc_status_t BasicCodec::readNullFlag(bool *isNull)
{
uint8_t flag;
Expand Down
34 changes: 33 additions & 1 deletion erpc_c/infra/basic_codec.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* Copyright 2016 NXP
* Copyright 2016-2017 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -245,6 +245,22 @@ class BasicCodec : public Codec
*/
virtual erpc_status_t endWriteStruct();

/*!
* @brief Prototype for start write union.
*
* @param[in] discriminator Discriminator of union.
*
* @return Based on implementation.
*/
virtual erpc_status_t startWriteUnion(int32_t discriminator);

/*!
* @brief Prototype for end write union.
*
* @return Based on implementation.
*/
virtual erpc_status_t endWriteUnion();

/*!
* @brief Writes a flag indicating whether the next value is null.
*
Expand Down Expand Up @@ -428,6 +444,22 @@ class BasicCodec : public Codec
*/
virtual erpc_status_t endReadStruct();

/*!
* @brief Prototype for start read union.
*
* @param[in] discriminator Discriminator of union.
*
* @return Based on implementation.
*/
virtual erpc_status_t startReadUnion(int32_t *discriminator);

/*!
* @brief Prototype for end read Union.
*
* @return Based on implementation.
*/
virtual erpc_status_t endReadUnion();

/*!
* @brief Reads a flag indicating whether the next value is null.
*
Expand Down
46 changes: 39 additions & 7 deletions erpc_c/infra/codec.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014, Freescale Semiconductor, Inc.
* Copyright 2016 NXP
* Copyright 2016-2017 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -280,6 +280,22 @@ class Codec
*/
virtual erpc_status_t endWriteStruct() = 0;

/*!
* @brief Prototype for start write union.
*
* @param[in] discriminator Discriminator of union.
*
* @return Based on implementation.
*/
virtual erpc_status_t startWriteUnion(int32_t discriminator) = 0;

/*!
* @brief Prototype for end write union.
*
* @return Based on implementation.
*/
virtual erpc_status_t endWriteUnion() = 0;

/*!
* @brief Writes a flag indicating whether the next value is null.
*
Expand Down Expand Up @@ -386,12 +402,12 @@ class Codec
virtual erpc_status_t read(uint32_t *value) = 0;

/*!
* @brief Prototype for read uint64_t value.
*
* @param[in] value uint64_t typed value to read.
*
* @return Based on implementation.
*/
* @brief Prototype for read uint64_t value.
*
* @param[in] value uint64_t typed value to read.
*
* @return Based on implementation.
*/
virtual erpc_status_t read(uint64_t *value) = 0;

/*!
Expand Down Expand Up @@ -462,6 +478,22 @@ class Codec
*/
virtual erpc_status_t endReadStruct() = 0;

/*!
* @brief Prototype for start read union.
*
* @param[in] discriminator Discriminator of union.
*
* @return Based on implementation.
*/
virtual erpc_status_t startReadUnion(int32_t *discriminator) = 0;

/*!
* @brief Prototype for end read Union.
*
* @return Based on implementation.
*/
virtual erpc_status_t endReadUnion() = 0;

/*!
* @brief Reads a flag indicating whether the next value is null.
*
Expand Down
88 changes: 30 additions & 58 deletions test/test_others/test_others.erpc → erpc_c/infra/crc16.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* Copyright 2016 NXP
* Copyright 2017 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -29,70 +28,43 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
this is comment which is not tracked
*/
/*this is comment which is not tracked*/
@outputDir("erpc_outputs")
program test_others
#include "crc16.h"

import "imports/test2.erpc"
/*!
1 comment
*/
/*! 2 comment*/
/*!3 comment*/
/** 4 comment */
/**5 comment*/
/**
6 comment
*/
using namespace erpc;

/*!
7 comment
*/
//this is comment which is not tracked
// this is comment which is not tracked
/// 8 comment
///9 comment
//! 10 comment
//!11 comment
const int32 ii = 5 //!< 12 comment
////////////////////////////////////////////////////////////////////////////////
// Code
////////////////////////////////////////////////////////////////////////////////

/**
* 13 comment
*/
enum enumColor //!< 14 comment
Crc16::Crc16(uint32_t crcStart)
: m_crcStart(crcStart)
{
/** 15 comment */
/**
15 comment again
*/
red, /**< 16 comment */
green, /**<17 comment */
blue /*!< 18 comment */
}

/*!
19 comment
*/
struct A //!< 20 comment
Crc16::~Crc16()
{
///21 comment
int32 m //!< 22 comment
///23 comment
int32 n //!<24 comment
}

/// 25 comment
///26 comment
type ListType = list<int32> /*!<27 comment */

//! 28 comment
//!29 comment
interface DoxygenComments /*!<30 comment */
uint16_t Crc16::computeCRC16(const uint8_t *data, uint32_t lengthInBytes)
{
//! 31 comment
//!32 comment
sendReceiveInt(ListType a) -> ListType ///< 33 comment;
uint32_t crc = m_crcStart;

uint32_t j;
for (j = 0; j < lengthInBytes; ++j)
{
uint32_t i;
uint32_t byte = data[j];
crc ^= byte << 8;
for (i = 0; i < 8; ++i)
{
uint32_t temp = crc << 1;
if (crc & 0x8000)
{
temp ^= 0x1021;
}
crc = temp;
}
}

return crc;
}
79 changes: 79 additions & 0 deletions erpc_c/infra/crc16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright 2017 NXP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef _EMBEDDED_RPC__CRC16_H_
#define _EMBEDDED_RPC__CRC16_H_

#include <stdint.h>

/*!
* @addtogroup infra_transport
* @{
* @file
*/

////////////////////////////////////////////////////////////////////////////////
// Classes
////////////////////////////////////////////////////////////////////////////////

namespace erpc {

class Crc16
{
public:
/*!
* @brief Constructor.
*/
Crc16(uint32_t crcStart);

/*!
* @brief Codec destructor
*/
~Crc16();

/*!
* @brief Compute a ITU-CCITT CRC-16 over the provided data.
*
* This implementation is slow but small in size.
*
* @param[in] data Pointer to data used for crc16.
* @param[in] dataLength Data length.
*/
uint16_t computeCRC16(const uint8_t *data, uint32_t lengthInBytes);

protected:
uint32_t m_crcStart; /*!< CRC start number. */
};

} // namespace erpc

/*! @} */

#endif // _EMBEDDED_RPC__CRC16_H_
Loading

0 comments on commit 9b7bd47

Please sign in to comment.