Initial Commit
[apps/agl-service-unicens.git] / ucs2-lib / inc / ucs_lldpool.h
1 /*------------------------------------------------------------------------------------------------*/
2 /* UNICENS V2.1.0-3491                                                                            */
3 /* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG.                              */
4 /*                                                                                                */
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.                                                            */
9 /*                                                                                                */
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.                                                   */
14 /*                                                                                                */
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/>.                          */
17 /*                                                                                                */
18 /* You may also obtain this software under a propriety license from Microchip.                    */
19 /* Please contact Microchip for further information.                                              */
20 /*------------------------------------------------------------------------------------------------*/
21
22 /*!
23  * \file
24  * \brief Internal header file of LLD Message Pool
25  *
26  * \cond UCS_INTERNAL_DOC
27  * \addtogroup G_PMF
28  * @{
29  */
30
31 #ifndef UCS_LLDPOOL_H
32 #define UCS_LLDPOOL_H
33
34 /*------------------------------------------------------------------------------------------------*/
35 /* Includes                                                                                       */
36 /*------------------------------------------------------------------------------------------------*/
37 #include "ucs_rules.h"
38 #include "ucs_base.h"
39 #include "ucs_lld_pb.h"
40 #include "ucs_message.h"
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46
47 /*------------------------------------------------------------------------------------------------*/
48 /* Macros                                                                                         */
49 /*------------------------------------------------------------------------------------------------*/
50 /*! \brief Number of LLD Tx handles dedicated to each FIFO */
51 #define LLDP_NUM_HANDLES              5U
52
53 /*------------------------------------------------------------------------------------------------*/
54 /* Internal types                                                                                 */
55 /*------------------------------------------------------------------------------------------------*/
56 /*! \brief   Internal LLD Tx message */
57 typedef struct Lld_IntTxMsg_
58 {
59     Ucs_Lld_TxMsg_t lld_msg;    /*!< \brief     Contains the public LLD Tx message
60                                  *   \details   This attribute needs to be the first one in this structure
61                                  */
62     CDlNode     node;           /*!< \brief     Node required for queuing */
63     CMessage   *msg_ptr;        /*!< \brief     Reference to the associated common message object, or
64                                  *              \c NULL if the object is a command */
65     void       *owner_ptr;      /*!< \brief     Points to the FIFO which owns the message object 
66                                  *              or NULL if the object is a command */
67
68 } Lld_IntTxMsg_t;
69
70 /*! \brief  Internal LLD Rx message */
71 typedef struct Lld_IntRxMsg_
72 {
73     Ucs_Lld_RxMsg_t  lld_msg;   /*!< \brief     Contains the public LLD Rx message 
74                                  *   \details   This attribute needs to be the first one in this structure
75                                  */
76     CMessage        *msg_ptr;   /*!< \brief     Reference to the associated common message object*/
77
78 } Lld_IntRxMsg_t;
79
80 /*! \brief The class CLldPool*/
81 typedef struct CLldPool_
82
83     CDlList list;                             /*!< \brief Points to the first available message in Tx pool */
84     Lld_IntTxMsg_t messages[LLDP_NUM_HANDLES];/*!< \brief Available messages in Tx pool */
85
86 } CLldPool;
87
88 /*------------------------------------------------------------------------------------------------*/
89 /* Function prototypes                                                                            */
90 /*------------------------------------------------------------------------------------------------*/
91 extern void Lldp_Ctor(CLldPool *self, void *owner_ptr, void *ucs_user_ptr);
92 extern void Lldp_ReturnTxToPool(CLldPool *self, Lld_IntTxMsg_t *msg_ptr);
93 extern Lld_IntTxMsg_t* Lldp_GetTxFromPool(CLldPool *self);
94
95
96 #ifdef __cplusplus
97 }                                                   /* extern "C" */
98 #endif
99
100 #endif                                              /* UCS_LLDPOOL_H */
101
102 /*!
103  * @}
104  * \endcond
105  */
106
107 /*------------------------------------------------------------------------------------------------*/
108 /* End of file                                                                                    */
109 /*------------------------------------------------------------------------------------------------*/
110