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 Internal header file of the MNS Factory.
26 * \cond UCS_INTERNAL_DOC
35 /*------------------------------------------------------------------------------------------------*/
37 /*------------------------------------------------------------------------------------------------*/
41 #include "ucs_ret_pb.h"
47 #include "ucs_xrmpool.h"
54 /*------------------------------------------------------------------------------------------------*/
56 /*------------------------------------------------------------------------------------------------*/
57 /*! \def FAC_NUM_DEVICES
58 * \brief Defines the number of remote devices.
59 * \details The number of remote devices required by the application for remote jobs. The
60 * default value is 0 in MNS configuration file ucs_cfg.h. The user can adjust this
61 * value by defining the macro \ref UCS_NUM_REMOTE_DEVICES. Valid values are in
62 * the range from 0 to 63.
65 #define FAC_NUM_DEVICES ((uint8_t)UCS_NUM_REMOTE_DEVICES + 1U)
68 /*------------------------------------------------------------------------------------------------*/
70 /*------------------------------------------------------------------------------------------------*/
71 /*! \brief Factory Instances type. */
72 typedef enum Fac_Inst_
74 FAC_INST_INIC, /*!< \brief Corresponds to the INIC Instance type */
75 FAC_INST_RSM, /*!< \brief Corresponds to the RSM Instance type */
76 FAC_INST_XRM, /*!< \brief Corresponds to the XRM Instance type */
77 FAC_INST_GPIO, /*!< \brief Corresponds to the GPIO Instance type */
78 FAC_INST_I2C, /*!< \brief Corresponds to the I2C Instance type */
79 FAC_INST_NSM /*!< \brief Corresponds to the NSM Instance type */
82 /*------------------------------------------------------------------------------------------------*/
83 /* Type definitions */
84 /*------------------------------------------------------------------------------------------------*/
85 /*! \brief Callback signature used by the foreach-function of the factory class.
86 * \param inst_type The instance type to be looked for.
87 * \param inst_ptr Reference to the current instance.
88 * \param ud_ptr Reference to the user data
89 * \return true: Stop the for-each-loop
90 * \return false: Continue the for-each-loop
92 typedef bool (*Fac_ForeachFunc_t)(Fac_Inst_t inst_type, void *inst_ptr, void *ud_ptr);
94 /*------------------------------------------------------------------------------------------------*/
96 /*------------------------------------------------------------------------------------------------*/
97 /*! \brief Stores data required by the Factory during initialization. */
98 typedef struct Fac_InitData_
100 CBase *base_ptr; /*!< \brief Reference to base instance */
101 CNetworkManagement *net_ptr; /*!< \brief Reference to Network instance */
102 CXrmPool * xrmp_ptr; /*!< \brief Reference to the XRM Pool instance */
103 CTransceiver * icm_transceiver; /*!< \brief Reference to ICM transceiver */
104 CTransceiver * rcm_transceiver; /*!< \brief Reference to MCM transceiver */
108 /*! \brief Class structure of the MNS Factory. */
109 typedef struct CFactory_
111 /*! \brief FBlock INIC list */
112 CInic fbi_list[FAC_NUM_DEVICES];
113 /*! \brief XRM list */
114 CExtendedResourceManager xrm_list[FAC_NUM_DEVICES];
115 /*! \brief RSM list */
116 CRemoteSyncManagement rsm_list[FAC_NUM_DEVICES];
117 /*! \brief GPIO list */
118 CGpio gpio_list[FAC_NUM_DEVICES];
119 /*! \brief I2C list */
120 CI2c i2c_list[FAC_NUM_DEVICES];
121 /*! \brief Node Scripting list */
122 CNodeScriptManagement nsm_list[FAC_NUM_DEVICES];
123 /*! \brief Reference to a base instance */
125 /*! \brief Reference to a network instance */
126 CNetworkManagement *net_ptr;
127 /*!< \brief Reference to the XRM Pool instance */
129 /*! \brief The ICM transceiver */
130 CTransceiver * icm_transceiver;
131 /*! \brief The RCM transceiver */
132 CTransceiver * rcm_transceiver;
136 /*------------------------------------------------------------------------------------------------*/
137 /* Prototypes of class CFactory */
138 /*------------------------------------------------------------------------------------------------*/
139 extern void Fac_Ctor(CFactory * self, Fac_InitData_t * init_ptr);
140 extern CExtendedResourceManager * Fac_GetXrm(CFactory * self, uint16_t address, Ucs_Xrm_ResourceDebugCb_t res_debugging_fptr, Ucs_Xrm_CheckUnmuteCb_t check_unmute_fptr);
141 extern CExtendedResourceManager * Fac_GetXrmByJobList(CFactory * self, UCS_XRM_CONST Ucs_Xrm_ResObject_t *resource_object_list[]);
142 extern CExtendedResourceManager * Fac_GetXrmLegacy(CFactory * self, uint16_t address, Ucs_Xrm_CheckUnmuteCb_t check_unmute_fptr);
143 extern CInic * Fac_GetInic(CFactory * self, uint16_t address);
144 extern CInic * Fac_FindInic(CFactory * self, uint16_t address);
145 extern CNodeScriptManagement * Fac_GetNsm(CFactory * self, uint16_t address);
146 extern CNodeScriptManagement * Fac_FindNsm(CFactory * self, uint16_t address);
147 extern CRemoteSyncManagement * Fac_GetRsm(CFactory * self, uint16_t address);
148 extern CRemoteSyncManagement * Fac_FindRsm(CFactory * self, uint16_t address);
149 extern CGpio * Fac_GetGpio(CFactory * self, uint16_t address, Ucs_Gpio_TriggerEventResultCb_t trigger_event_status_fptr);
150 extern CI2c * Fac_GetI2c(CFactory * self, uint16_t address, Ucs_I2c_IntEventReportCb_t i2c_interrupt_report_fptr);
151 extern void Fac_Foreach(CFactory * self, Fac_Inst_t inst_type, Fac_ForeachFunc_t func_ptr, void *user_data_ptr);
157 #endif /* #ifndef UCS_RSM_H */
164 /*------------------------------------------------------------------------------------------------*/
166 /*------------------------------------------------------------------------------------------------*/