Initial Commit
[apps/agl-service-unicens.git] / ucs2-lib / inc / ucs_ret_pb.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 This header file contains standard return values used by UNICENS functions 
25  *        and methods.
26  * \addtogroup G_UCS_INIT_AND_SRV_TYPES
27  * @{
28  */
29
30 #ifndef UCS_RET_H
31 #define UCS_RET_H
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 /*------------------------------------------------------------------------------------------------*/
39 /* Enumerations                                                                                   */
40 /*------------------------------------------------------------------------------------------------*/
41 /*! \brief Standard return codes used for synchronous response */
42 typedef enum Ucs_Return_
43 {
44     UCS_RET_SUCCESS             = 0x00,     /*!< \brief Operation successfully completed */
45     UCS_RET_ERR_PARAM           = 0x01,     /*!< \brief At least one parameter exceeds its 
46                                                         admissible range */
47     UCS_RET_ERR_BUFFER_OVERFLOW = 0x02,     /*!< \brief Buffer overflow or service busy */
48     UCS_RET_ERR_NOT_AVAILABLE   = 0x03,     /*!< \brief Functionality not available */
49     UCS_RET_ERR_NOT_SUPPORTED   = 0x04,     /*!< \brief This function is not supported by this 
50                                                         derivative of INIC / physical layer / MOST 
51                                                         speed */
52     UCS_RET_ERR_INVALID_SHADOW  = 0x05,     /*!< \brief The requested information is not yet 
53                                                         available */
54     UCS_RET_ERR_ALREADY_SET     = 0x06,     /*!< \brief The value to be set is already set. The 
55                                                         application can therefore be aware that no 
56                                                         message will be send to INIC and no 
57                                                         callback will be called */
58     UCS_RET_ERR_API_LOCKED      = 0x07,     /*!< \brief INIC performs already requested function. */
59     UCS_RET_ERR_NOT_INITIALIZED = 0x08      /*!< \brief UNICENS is not initialized */
60
61 } Ucs_Return_t;
62
63 /*! \brief Result codes used for asynchronous response */
64 typedef enum Ucs_Result_
65 {
66     UCS_RES_SUCCESS           = 0x00,       /*!< \brief Operation successfully completed */
67     UCS_RES_ERR_MOST_STANDARD = 0x01,       /*!< \brief MOST standard error occurred */
68     UCS_RES_ERR_BUSY          = 0x02,       /*!< \brief Function currently busy */
69     UCS_RES_ERR_PROCESSING    = 0x03,       /*!< \brief Processing error occurred */
70     UCS_RES_ERR_CONFIGURATION = 0x04,       /*!< \brief Configuration error occurred */
71     UCS_RES_ERR_SYSTEM        = 0x05,       /*!< \brief System error occurred */
72     UCS_RES_ERR_TIMEOUT       = 0x06,       /*!< \brief Timeout occurred */
73     UCS_RES_ERR_TRANSMISSION  = 0x07        /*!< \brief Transmission error occurred */
74
75 } Ucs_Result_t;
76
77 /*! \brief Result values of initialization result callback function */
78 typedef enum Ucs_InitResult_
79 {
80     UCS_INIT_RES_SUCCESS          = 0x00U,      /*!< \brief Initialization succeeded */
81     UCS_INIT_RES_ERR_BUF_OVERFLOW = 0x01U,      /*!< \brief No message buffer available */
82     UCS_INIT_RES_ERR_INIC_SYNC    = 0x02U,      /*!< \brief INIC synchronization failed */
83     UCS_INIT_RES_ERR_INIC_VERSION = 0x03U,      /*!< \brief INIC device version check failed */
84     UCS_INIT_RES_ERR_INIC_SYSTEM  = 0x04U,      /*!< \brief Device attach failed due to an INIC 
85                                                  *          system error
86                                                  */
87     UCS_INIT_RES_ERR_DEV_ATT_CFG  = 0x05U,      /*!< \brief INIC device attach failed due to an 
88                                                  *          configuration error
89                                                  */
90     UCS_INIT_RES_ERR_DEV_ATT_PROC = 0x06U,      /*!< \brief Device attach failed due to a 
91                                                  *          processing error
92                                                  */
93     UCS_INIT_RES_ERR_NET_CFG      = 0x07U,      /*!< \brief Network Configuration request failed */
94     UCS_INIT_RES_ERR_INTERNAL     = 0x0AU,      /*!< \brief Internal error occurred */
95     UCS_INIT_RES_ERR_TIMEOUT      = 0x0BU       /*!< \brief Initialization timeout occurred */
96
97 } Ucs_InitResult_t;
98
99 /*------------------------------------------------------------------------------------------------*/
100 /* Structures                                                                                     */
101 /*------------------------------------------------------------------------------------------------*/
102 /*! \brief  Standard result structure which provides fields for detailed status and 
103  *          error information
104  */
105 typedef struct Ucs_StdResult_
106 {
107     Ucs_Result_t code;  /*!< \brief Result/Error code */
108     uint8_t *info_ptr;  /*!< \brief INIC error data */
109     uint8_t info_size;  /*!< \brief Size of the INIC error data in bytes */
110
111 } Ucs_StdResult_t;
112
113 /*------------------------------------------------------------------------------------------------*/
114 /* Types                                                                                          */
115 /*------------------------------------------------------------------------------------------------*/
116 /*! \brief  Function signature used for UNICENS standard result callbacks
117  *  \param  result      Result of the callback
118  *  \param  user_ptr    User reference provided in \ref Ucs_InitData_t "Ucs_InitData_t::user_ptr"
119  */
120 typedef void (*Ucs_StdResultCb_t)(Ucs_StdResult_t result, void *user_ptr);
121
122 /*! \brief  Function signature used for UNICENS standard result callbacks
123  *  \param  result      Result of the callback
124  *  \param  user_ptr    User reference provided in \ref Ucs_InitData_t "Ucs_InitData_t::user_ptr"
125  */
126 typedef void (*Ucs_InitResultCb_t)(Ucs_InitResult_t result, void *user_ptr);
127
128 #ifdef __cplusplus
129 }   /* extern "C" */
130 #endif
131
132 #endif  /* #ifndef UCS_RET_H */
133
134 /*!
135  * @}
136  */
137
138 /*------------------------------------------------------------------------------------------------*/
139 /* End of file                                                                                    */
140 /*------------------------------------------------------------------------------------------------*/
141