1 /*
2  * Copyright 2016-2023, Cypress Semiconductor Corporation or
3  * an affiliate of Cypress Semiconductor Corporation.  All rights reserved.
4  *
5  * This software, including source code, documentation and related
6  * materials ("Software") is owned by Cypress Semiconductor Corporation
7  * or one of its affiliates ("Cypress") and is protected by and subject to
8  * worldwide patent protection (United States and foreign),
9  * United States copyright laws and international treaty provisions.
10  * Therefore, you may use this Software only as provided in the license
11  * agreement accompanying the software package from which you
12  * obtained this Software ("EULA").
13  * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
14  * non-transferable license to copy, modify, and compile the Software
15  * source code solely for use in connection with Cypress's
16  * integrated circuit products.  Any reproduction, modification, translation,
17  * compilation, or representation of this Software except as specified
18  * above is prohibited without the express written permission of Cypress.
19  *
20  * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
22  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
23  * reserves the right to make changes to the Software without notice. Cypress
24  * does not assume any liability arising out of the application or use of the
25  * Software or any product or circuit described in the Software. Cypress does
26  * not authorize its products for use in any products where a malfunction or
27  * failure of the Cypress product may reasonably be expected to result in
28  * significant property damage, injury or death ("High Risk Product"). By
29  * including Cypress's product in a High Risk Product, the manufacturer
30  * of such system or application assumes all risk of such use and in doing
31  * so agrees to indemnify Cypress against all liability.
32  */
33 
34 /** @file
35  *
36  * Generic types
37  *
38  *
39  */
40 
41 #pragma once
42 #include "wiced_bt_constants.h"
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /******************************************************
48  * @cond      Macros
49  ******************************************************/
50 
51 #ifndef RESULT_ENUM
52 #define RESULT_ENUM( prefix, name, value )  prefix ## name = (value)
53 #endif /* ifndef RESULT_ENUM */
54 
55 /**
56  *  @addtogroup  WICED Result list       WICED result list
57  *  @ingroup     gentypes
58  *
59  *  <b> WICED Result list </b> for Bluetooth BR/EDR and LE @b .
60  *
61  *  @{
62  */
63 /*************************************************************************/
64 
65 /** WICED result list */
66 #define WICED_RESULT_LIST( prefix ) \
67     RESULT_ENUM( prefix, SUCCESS,                       0x00 ),   /**< Success */                       \
68     RESULT_ENUM( prefix, DELETED                       ,0x01 ),   /**< Deleted */                       \
69     RESULT_ENUM( prefix, NO_MEMORY                     ,0x10 ),   /**< No Memory */                     \
70     RESULT_ENUM( prefix, POOL_ERROR                    ,0x02 ),   /**< Pool Error */                    \
71     RESULT_ENUM( prefix, PTR_ERROR                     ,0x03 ),   /**< Pointer Error */                 \
72     RESULT_ENUM( prefix, WAIT_ERROR                    ,0x04 ),   /**< Wait Error */                    \
73     RESULT_ENUM( prefix, SIZE_ERROR                    ,0x05 ),   /**< Size Error */                    \
74     RESULT_ENUM( prefix, GROUP_ERROR                   ,0x06 ),   /**< Group Error */                   \
75     RESULT_ENUM( prefix, NO_EVENTS                     ,0x07 ),   /**< No Event */                      \
76     RESULT_ENUM( prefix, OPTION_ERROR                  ,0x08 ),   /**< Option Error */                  \
77     RESULT_ENUM( prefix, QUEUE_ERROR                   ,0x09 ),   /**< Queue Error */                   \
78     RESULT_ENUM( prefix, QUEUE_EMPTY                   ,0x0A ),   /**< Queue Empty */                   \
79     RESULT_ENUM( prefix, QUEUE_FULL                    ,0x0B ),   /**< Queue Full */                    \
80     RESULT_ENUM( prefix, SEMAPHORE_ERROR               ,0x0C ),   /**< Semaphore Error */               \
81     RESULT_ENUM( prefix, NO_INSTANCE                   ,0x0D ),   /**< No Instance */                   \
82     RESULT_ENUM( prefix, THREAD_ERROR                  ,0x0E ),   /**< Thread Error */                  \
83     RESULT_ENUM( prefix, PRIORITY_ERROR                ,0x0F ),   /**< Priority Error */                \
84     RESULT_ENUM( prefix, START_ERROR                   ,0x10 ),   /**< Start Error */                   \
85     RESULT_ENUM( prefix, DELETE_ERROR                  ,0x11 ),   /**< Delete Error */                  \
86     RESULT_ENUM( prefix, RESUME_ERROR                  ,0x12 ),   /**< Resume Error */                  \
87     RESULT_ENUM( prefix, CALLER_ERROR                  ,0x13 ),   /**< Caller Error */                  \
88     RESULT_ENUM( prefix, SUSPEND_ERROR                 ,0x14 ),   /**< Suspend Error */                 \
89     RESULT_ENUM( prefix, TIMER_ERROR                   ,0x15 ),   /**< Timer Error */                   \
90     RESULT_ENUM( prefix, TICK_ERROR                    ,0x16 ),   /**< Tick Error */                    \
91     RESULT_ENUM( prefix, ACTIVATE_ERROR                ,0x17 ),   /**< Activate Error */                \
92     RESULT_ENUM( prefix, THRESH_ERROR                  ,0x18 ),   /**< Thresh Error */                  \
93     RESULT_ENUM( prefix, SUSPEND_LIFTED                ,0x19 ),   /**< Suspend Lifted */                \
94     RESULT_ENUM( prefix, WAIT_ABORTED                  ,0x1A ),   /**< Wait Aborted */                  \
95     RESULT_ENUM( prefix, WAIT_ABORT_ERROR              ,0x1B ),   /**< Wait Abort Error */              \
96     RESULT_ENUM( prefix, MUTEX_ERROR                   ,0x1C ),   /**< Mutex Error */                   \
97     RESULT_ENUM( prefix, NOT_AVAILABLE                 ,0x1D ),   /**< Not Avilable */                  \
98     RESULT_ENUM( prefix, NOT_OWNED                     ,0x1E ),   /**< Not Owned */                     \
99     RESULT_ENUM( prefix, INHERIT_ERROR                 ,0x1F ),   /**< Inherit Error */                 \
100     RESULT_ENUM( prefix, NOT_DONE                      ,0x20 ),   /**< Not Done */                      \
101     RESULT_ENUM( prefix, CEILING_EXCEEDED              ,0x21 ),   /**< Ceiling Exceeded */              \
102     RESULT_ENUM( prefix, INVALID_CEILING               ,0x22 ),   /**< Invalid Ceiling */               \
103     RESULT_ENUM( prefix, STA_JOIN_FAILED               ,0x23),   /**< Join failed */                    \
104     RESULT_ENUM( prefix, SLEEP_ERROR                   ,0x24),   /**< Sleep Error */                    \
105     RESULT_ENUM( prefix, PENDING,                       0x25),   /**< Pending */                        \
106     RESULT_ENUM( prefix, TIMEOUT,                       0x26),   /**< Timeout */                        \
107     RESULT_ENUM( prefix, PARTIAL_RESULTS,               0x27),   /**< Partial results */                \
108     RESULT_ENUM( prefix, ERROR,                         0x28),   /**< Error */                          \
109     RESULT_ENUM( prefix, BADARG,                        0x29),   /**< Bad Arguments */                  \
110     RESULT_ENUM( prefix, BADOPTION,                     0x2A),   /**< Mode not supported */             \
111     RESULT_ENUM( prefix, UNSUPPORTED,                   0x2B),   /**< Unsupported function */           \
112     RESULT_ENUM( prefix, OUT_OF_HEAP_SPACE,             0x2C),   /**< Dynamic memory space exhausted */ \
113     RESULT_ENUM( prefix, NOTUP,                         0x2D),   /**< Interface is not currently Up */  \
114     RESULT_ENUM( prefix, UNFINISHED,                    0x2E),   /**< Operation not finished yet */     \
115     RESULT_ENUM( prefix, CONNECTION_LOST,               0x2F),   /**< Connection to server lost */      \
116     RESULT_ENUM( prefix, NOT_FOUND,                     0x30),   /**< Item not found */                 \
117     RESULT_ENUM( prefix, PACKET_BUFFER_CORRUPT,         0x31),   /**< Packet buffer corrupted */        \
118     RESULT_ENUM( prefix, ROUTING_ERROR,                 0x32),   /**< Routing error */                  \
119     RESULT_ENUM( prefix, BADVALUE,                      0x33),   /**< Bad value */                      \
120     RESULT_ENUM( prefix, WOULD_BLOCK,                   0x34),   /**< Function would block */           \
121     RESULT_ENUM( prefix, ABORTED,                       0x35),   /**< Operation aborted */              \
122     RESULT_ENUM( prefix, CONNECTION_RESET,              0x36),   /**< Connection has been reset */      \
123     RESULT_ENUM( prefix, CONNECTION_CLOSED,             0x37),   /**< Connection is closed */           \
124     RESULT_ENUM( prefix, NOT_CONNECTED,                 0x38),   /**< Connection is not connected */    \
125     RESULT_ENUM( prefix, ADDRESS_IN_USE,                0x39),   /**< Address is in use */              \
126     RESULT_ENUM( prefix, NETWORK_INTERFACE_ERROR,       0x3A),   /**< Network interface error */        \
127     RESULT_ENUM( prefix, ALREADY_CONNECTED,             0x3B),   /**< Socket is already connected */    \
128     RESULT_ENUM( prefix, INVALID_INTERFACE,             0x3C),   /**< Interface specified in invalid */ \
129     RESULT_ENUM( prefix, SOCKET_CREATE_FAIL,            0x3D),   /**< Socket creation failed */         \
130     RESULT_ENUM( prefix, INVALID_SOCKET,                0x3E),   /**< Socket is invalid */              \
131     RESULT_ENUM( prefix, CORRUPT_PACKET_BUFFER,         0x3F),   /**< Packet buffer is corrupted */     \
132     RESULT_ENUM( prefix, UNKNOWN_NETWORK_STACK_ERROR,   0x40),   /**< Unknown network stack error */    \
133     RESULT_ENUM( prefix, NO_STORED_AP_IN_DCT,           0x41),   /**< DCT contains no AP credentials */ \
134     RESULT_ENUM( prefix, ALREADY_INITIALIZED,           0x42),   /**< Already initialized*/             \
135     RESULT_ENUM( prefix, FEATURE_NOT_ENABLED           ,0xFF ),  /**< Feature not enabled */
136 
137 /**@}  WICED result list */
138 
139 /** File result list */
140 #define FILESYSTEM_RESULT_LIST( prefix ) \
141         RESULT_ENUM( prefix, SUCCESS,                   10000 ),   /**< Success */               \
142         RESULT_ENUM( prefix, PENDING,                   10001 ),   /**< Pending */               \
143         RESULT_ENUM( prefix, TIMEOUT,                   10002 ),   /**< Timeout */               \
144         RESULT_ENUM( prefix, PARTIAL_RESULTS,           10003 ),   /**< Partial results */       \
145         RESULT_ENUM( prefix, ERROR,                     10004 ),   /**< Error */                 \
146         RESULT_ENUM( prefix, BADARG,                    10005 ),   /**< Bad Arguments */         \
147         RESULT_ENUM( prefix, BADOPTION,                 10006 ),   /**< Mode not supported */    \
148         RESULT_ENUM( prefix, UNSUPPORTED,               10007 ),   /**< Unsupported function */  \
149         RESULT_ENUM( prefix, DISK_ERROR,                10008 ),   /**< Low level error accessing media */        \
150         RESULT_ENUM( prefix, PATH_NOT_FOUND,            10009 ),   /**< Path was not found in filesystem */        \
151         RESULT_ENUM( prefix, MEDIA_NOT_READY,           10010 ),   /**< Media is not present or ready for access */          \
152         RESULT_ENUM( prefix, ACCESS_DENIED,             10011 ),   /**< Access denied due to permissions  */      \
153         RESULT_ENUM( prefix, WRITE_PROTECTED,           10012 ),   /**< Media is write protected */    \
154         RESULT_ENUM( prefix, OUT_OF_SPACE,              10013 ),   /**< No free space left on media  */ \
155         RESULT_ENUM( prefix, FILENAME_BUFFER_TOO_SMALL, 10014 ),   /**< Filename buffer was too small when retrieving directory contents  */ \
156         RESULT_ENUM( prefix, END_OF_RESOURCE,           10015 ),   /**< End of file/directory reached  */ \
157         RESULT_ENUM( prefix, FILESYSTEM_INVALID,        10016 ),   /**< Filesystem has an unrecoverable error */ \
158         RESULT_ENUM( prefix, BLOCK_SIZE_BAD,            10017 ),   /**< Block size is invalid - not a multiple or sub-multiple of DEFAULT_SECTOR_SIZE */
159 
160 /******************************************************
161  * @endcond
162  ******************************************************/
163 
164 /**
165  *  Common Bluetooth definitions
166  *  @defgroup gentypes   Common Bluetooth definitions
167  *  @addtogroup  Result       WICED result
168  *  @ingroup     gentypes
169  *
170  *  <b> Result types </b> See wiced_result.h
171  *
172  *  @{
173  */
174 
175 /** WICED result */
176 typedef enum
177 {
178     WICED_RESULT_LIST ( WICED_ )                 /**< Generic Error */
179     BT_RESULT_LIST      (  WICED_BT_       )     /**< BT specific Error. Range: 8000 - 8999 */
180     FILESYSTEM_RESULT_LIST( WICED_FILESYSTEM_ )  /**< 10000 - 10999 */
181 } wiced_result_t;
182 
183 /**@}  WICED Result */
184 
185 /******************************************************
186  *            Structures
187  ******************************************************/
188 
189 /******************************************************
190  *            Function Declarations
191  ******************************************************/
192 
193 #ifdef __cplusplus
194 } /*extern "C" */
195 #endif
196