1 /*------------------------------------------------------------------------------------------------*/
2 /* UNICENS V2.1.0-3491 */
3 /* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG. */
5 /* This program is free software: you can redistribute it and/or modify */
6 /* it under the terms of the GNU General Public License as published by */
7 /* the Free Software Foundation, either version 2 of the License, or */
8 /* (at your option) any later version. */
10 /* This program is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU General Public License for more details. */
15 /* You should have received a copy of the GNU General Public License */
16 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* You may also obtain this software under a propriety license from Microchip. */
19 /* Please contact Microchip for further information. */
20 /*------------------------------------------------------------------------------------------------*/
24 * \brief Declaration of message encoder
26 * \cond UCS_INTERNAL_DOC
27 * \addtogroup G_ENCODER
34 /*------------------------------------------------------------------------------------------------*/
36 /*------------------------------------------------------------------------------------------------*/
37 #include "ucs_message.h"
44 /*------------------------------------------------------------------------------------------------*/
46 /*------------------------------------------------------------------------------------------------*/
47 #define ENC_MAX_SIZE_CONTENT 16U /*!< \brief Maximum content size in bytes, quadlet aligned */
49 /*------------------------------------------------------------------------------------------------*/
51 /*------------------------------------------------------------------------------------------------*/
52 /*! \brief Retrieves the size of a MOST message header
53 * \return The size of the MOST message header in bytes.
55 typedef uint8_t (*Enc_GetSize_t)(void);
57 /*! \brief Retrieves the content type of a MOST message header
58 * \return The content type of the MOST message header in bytes.
60 typedef uint8_t (*Enc_GetContType_t)(void);
62 /*! \brief Encodes a message telegram to the MOST message header
63 * \param tel_ptr Reference to the Msg_MostTel_t structure
64 * \param header The header buffer
66 typedef void (*Enc_Encode_t)(Msg_MostTel_t *tel_ptr, uint8_t header[]);
68 /*! \brief Decodes a MOST message header to a message telegram structure
69 * \param tel_ptr Reference to the Msg_MostTel_t structure
70 * \param header The header buffer
72 typedef void (*Enc_Decode_t)(Msg_MostTel_t *tel_ptr, uint8_t header[]);
74 /*------------------------------------------------------------------------------------------------*/
76 /*------------------------------------------------------------------------------------------------*/
77 /*! \brief Identifier for a MOST Message Content */
78 typedef enum Enc_MsgContent_
80 ENC_CONTENT_00 = 0x00, /*!< \brief Content Type "0x00": Uncompressed, excluding retry values */
81 ENC_CONTENT_80 = 0x80, /*!< \brief Content Type "0x80": Compressed, excluding retry values */
82 ENC_CONTENT_81 = 0x81 /*!< \brief Content Type "0x81": Compressed, including retry values */
86 /*! \brief Interface for message encoder */
87 typedef struct IEncoder_
89 Enc_MsgContent_t content_type; /*!< \brief Retrieves the content type of the MOST message header */
90 uint8_t pm_hdr_sz; /*!< \brief Retrieves the size of the Port Message header */
91 uint8_t msg_hdr_sz; /*!< \brief Retrieves the size of the MOST message header */
92 Enc_Encode_t encode_fptr; /*!< \brief Function required to encode a MOST message header */
93 Enc_Decode_t decode_fptr; /*!< \brief Function required to decode a MOST message header */
97 /*------------------------------------------------------------------------------------------------*/
98 /* Function prototypes */
99 /*------------------------------------------------------------------------------------------------*/
100 extern IEncoder *Enc_GetEncoder(Enc_MsgContent_t type);
106 #endif /* #ifndef UCS_ENCODER_H */
113 /*------------------------------------------------------------------------------------------------*/
115 /*------------------------------------------------------------------------------------------------*/