summaryrefslogtreecommitdiffstats
path: root/mnsl/mns_encoder.h
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2016-12-08 13:51:04 +0100
committerChristian Gromm <christian.gromm@microchip.com>2016-12-08 13:51:04 +0100
commit8c5f2324d7aa61669324aec1a0ad091fe1379489 (patch)
tree29cbdcdbe3657e1400d596ec3d560a2573d80817 /mnsl/mns_encoder.h
parente89ba11bd9111f02a940f227cf979f1947e975ac (diff)
src: unicens: import sources
This patch adds the source tree of the NetworkManager v3.0.4. Additionally, it provides the needed configuration scripts. Change-Id: I23778b51423b51a4f87741957e0fb208bceb79b3 Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Diffstat (limited to 'mnsl/mns_encoder.h')
-rw-r--r--mnsl/mns_encoder.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/mnsl/mns_encoder.h b/mnsl/mns_encoder.h
new file mode 100644
index 0000000..439a622
--- /dev/null
+++ b/mnsl/mns_encoder.h
@@ -0,0 +1,118 @@
+/*
+ * MOST NetServices "Light" V3.2.7.0.1796 MultiInstance Patch
+ *
+ * Copyright (C) 2015 Microchip Technology Germany II GmbH & Co. KG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * You may also obtain this software under a propriety license from Microchip.
+ * Please contact Microchip for further information.
+ *
+ */
+
+/*!
+ * \file
+ * \brief Declaration of message encoder
+ *
+ * \cond MNS_INTERNAL_DOC
+ * \addtogroup G_ENCODER
+ * @{
+ */
+
+#ifndef MNS_ENCODER_H
+#define MNS_ENCODER_H
+
+/*------------------------------------------------------------------------------------------------*/
+/* Includes */
+/*------------------------------------------------------------------------------------------------*/
+#include "mns_message.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*------------------------------------------------------------------------------------------------*/
+/* Defines */
+/*------------------------------------------------------------------------------------------------*/
+#define ENC_MAX_SIZE_CONTENT 16U /*!< \brief Maximum content size in bytes, quadlet aligned */
+
+/*------------------------------------------------------------------------------------------------*/
+/* Types */
+/*------------------------------------------------------------------------------------------------*/
+/*! \brief Retrieves the size of a MOST message header
+ * \return The size of the MOST message header in bytes.
+ */
+typedef uint8_t (*Enc_GetSize_t)(void);
+
+/*! \brief Retrieves the content type of a MOST message header
+ * \return The content type of the MOST message header in bytes.
+ */
+typedef uint8_t (*Enc_GetContType_t)(void);
+
+/*! \brief Encodes a message telegram to the MOST message header
+ * \param tel_ptr Reference to the Msg_MostTel_t structure
+ * \param header The header buffer
+ */
+typedef void (*Enc_Encode_t)(Msg_MostTel_t *tel_ptr, uint8_t header[]);
+
+/*! \brief Decodes a MOST message header to a message telegram structure
+ * \param tel_ptr Reference to the Msg_MostTel_t structure
+ * \param header The header buffer
+ */
+typedef void (*Enc_Decode_t)(Msg_MostTel_t *tel_ptr, uint8_t header[]);
+
+/*------------------------------------------------------------------------------------------------*/
+/* Structures */
+/*------------------------------------------------------------------------------------------------*/
+/*! \brief Identifier for a MOST Message Content */
+typedef enum Enc_MsgContent_
+{
+ ENC_CONTENT_00 = 0x00, /*!< \brief Content Type "0x00": Uncompressed, excluding retry values */
+ ENC_CONTENT_80 = 0x80, /*!< \brief Content Type "0x80": Compressed, excluding retry values */
+ ENC_CONTENT_81 = 0x81 /*!< \brief Content Type "0x81": Compressed, including retry values */
+
+} Enc_MsgContent_t;
+
+/*! \brief Interface for message encoder */
+typedef struct IEncoder_
+{
+ Enc_MsgContent_t content_type; /*!< \brief Retrieves the content type of the MOST message header */
+ uint8_t pm_hdr_sz; /*!< \brief Retrieves the size of the Port Message header */
+ uint8_t msg_hdr_sz; /*!< \brief Retrieves the size of the MOST message header */
+ Enc_Encode_t encode_fptr; /*!< \brief Function required to encode a MOST message header */
+ Enc_Decode_t decode_fptr; /*!< \brief Function required to decode a MOST message header */
+
+} IEncoder;
+
+/*------------------------------------------------------------------------------------------------*/
+/* Function prototypes */
+/*------------------------------------------------------------------------------------------------*/
+extern IEncoder *Enc_GetEncoder(Enc_MsgContent_t type);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* #ifndef MNS_ENCODER_H */
+
+/*!
+ * @}
+ * \endcond
+ */
+
+/*------------------------------------------------------------------------------------------------*/
+/* End of file */
+/*------------------------------------------------------------------------------------------------*/
+