Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cy_result_mw.h Source File

cy_result_mw.h

00001 /*
00002  * Copyright 2019-2021, Cypress Semiconductor Corporation (an Infineon company) or
00003  * an affiliate of Cypress Semiconductor Corporation.  All rights reserved.
00004  *
00005  * This software, including source code, documentation and related
00006  * materials ("Software") is owned by Cypress Semiconductor Corporation
00007  * or one of its affiliates ("Cypress") and is protected by and subject to
00008  * worldwide patent protection (United States and foreign),
00009  * United States copyright laws and international treaty provisions.
00010  * Therefore, you may use this Software only as provided in the license
00011  * agreement accompanying the software package from which you
00012  * obtained this Software ("EULA").
00013  * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
00014  * non-transferable license to copy, modify, and compile the Software
00015  * source code solely for use in connection with Cypress's
00016  * integrated circuit products.  Any reproduction, modification, translation,
00017  * compilation, or representation of this Software except as specified
00018  * above is prohibited without the express written permission of Cypress.
00019  *
00020  * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
00021  * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
00022  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
00023  * reserves the right to make changes to the Software without notice. Cypress
00024  * does not assume any liability arising out of the application or use of the
00025  * Software or any product or circuit described in the Software. Cypress does
00026  * not authorize its products for use in any products where a malfunction or
00027  * failure of the Cypress product may reasonably be expected to result in
00028  * significant property damage, injury or death ("High Risk Product"). By
00029  * including Cypress's product in a High Risk Product, the manufacturer
00030  * of such system or application assumes all risk of such use and in doing
00031  * so agrees to indemnify Cypress against all liability.
00032  */
00033 #pragma once
00034 
00035 #include <stdint.h>
00036 #include "cy_result.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 /**
00043  *
00044  * @addtogroup group_utils_enums
00045  *
00046  * Cypress middleware APIs return results of type cy_rslt_t and comprise of three parts:
00047  * - module base
00048  * - type
00049  * - error code
00050  *
00051  * \par Result Format
00052  *
00053    \verbatim
00054               Module base             Type    Library specific error code
00055       +------------------------------+------+------------------------------+
00056       |CY_RSLT_MODULE_MIDDLEWARE_BASE| 0x2  |           Error Code         |
00057       +------------------------------+------+------------------------------+
00058                 14-bits               2-bits            16-bits
00059 
00060    Refer to the macro section of this document for library specific error codes.
00061    \endverbatim
00062  *
00063  * The data structure cy_rslt_t is part of cy_result.h located in <core_lib/include>
00064  *
00065  * Module base: This base is derived from CY_RSLT_MODULE_MIDDLEWARE_BASE (defined in cy_result.h) and is an offset of the CY_RSLT_MODULE_MIDDLEWARE_BASE
00066  *              The details of the offset and the middleware base are defined below
00067  *
00068  * Type: This type is defined in cy_result.h and can be one of CY_RSLT_TYPE_FATAL, CY_RSLT_TYPE_ERROR, CY_RSLT_TYPE_WARNING or CY_RSLT_TYPE_INFO. AWS library error codes are of type CY_RSLT_TYPE_ERROR
00069  *
00070  * Library specific error code: These error codes are library specific and defined in macro section of the respetcive libraries
00071  *
00072  * Helper macros used for creating the library specific result are provided as part of cy_result.h
00073  *
00074  * Each middleware module has been reserved with 128 error codes
00075  *
00076  *
00077  *
00078  * @{
00079  */
00080  /* !!! ALWAYS ADD MODULE BASES AT THE END. DO NOT INSERT NEW MODULES IN BETWEEN EXISTING MODULES !!!
00081  * The expectation is that all middleware modules shall define their base out of this file so
00082  * that the error code space can be reserved and allotted efficiently
00083  */
00084 
00085 /** MDNS module base */
00086 #define CY_RSLT_MODULE_MDNS_BASE                         CY_RSLT_MODULE_MIDDLEWARE_BASE
00087 /** AWS IoT module base */
00088 #define CY_RSLT_MODULE_AWS_BASE                          CY_RSLT_MODULE_MIDDLEWARE_BASE + 1
00089 /** JSON parser module base */
00090 #define CY_RSLT_MODULE_JSON_BASE                         CY_RSLT_MODULE_MIDDLEWARE_BASE + 2
00091 /** Linked list module base */
00092 #define CY_RSLT_MODULE_LINKED_LIST_BASE                  CY_RSLT_MODULE_MIDDLEWARE_BASE + 3
00093 /** command console module base */
00094 #define CY_RSLT_MODULE_COMMAND_CONSOLE_BASE              CY_RSLT_MODULE_MIDDLEWARE_BASE + 4
00095 /** HTTP server module base */
00096 #define CY_RSLT_MODULE_HTTP_SERVER                       CY_RSLT_MODULE_MIDDLEWARE_BASE + 5
00097 /** Enterprise Security base */
00098 #define CY_RSLT_MODULE_ENTERPRISE_SECURITY_BASE          CY_RSLT_MODULE_MIDDLEWARE_BASE + 6
00099 /** TCP/IP module base */
00100 #define CY_RSLT_MODULE_TCPIP_BASE                        CY_RSLT_MODULE_MIDDLEWARE_BASE + 7
00101 /** Generic middleware module base */
00102 #define CY_RSLT_MODULE_MW_BASE                           CY_RSLT_MODULE_MIDDLEWARE_BASE + 8
00103 /** TLS module base */
00104 #define CY_RSLT_MODULE_TLS_BASE                          CY_RSLT_MODULE_MIDDLEWARE_BASE + 9
00105 /** Secure Sockets module base */
00106 #define CY_RSLT_MODULE_SECURE_SOCKETS_BASE               CY_RSLT_MODULE_MIDDLEWARE_BASE + 10
00107 /** WiFi Connection Manager (WCM) module base */
00108 #define CY_RSLT_MODULE_WCM_BASE                          CY_RSLT_MODULE_MIDDLEWARE_BASE + 11
00109 /** lwIP WHD port module base */
00110 #define CY_RSLT_MODULE_LWIP_WHD_PORT_BASE                CY_RSLT_MODULE_MIDDLEWARE_BASE + 12
00111 /** Over The Air Update Module base (OTA) */
00112 #define CY_RSLT_MODULE_OTA_UPDATE_BASE                   CY_RSLT_MODULE_MIDDLEWARE_BASE + 13
00113 /** HTTP Client module base */
00114 #define CY_RSLT_MODULE_HTTP_CLIENT                       CY_RSLT_MODULE_MIDDLEWARE_BASE + 14
00115 
00116 /**
00117  * @}
00118  */
00119 
00120 /**
00121  * @defgroup generic_mw_defines generic middleware results/error codes
00122  * @ingroup group_utils_enums
00123  * @{
00124  * List of all the generic result/error codes defined by the connectivity-utilities library.
00125  */
00126 /** Generic middleware error code start */
00127 #define CY_RSLT_MODULE_MW_ERR_CODE_START       (0)
00128 /** Generic middleware base error code */
00129 #define CY_RSLT_MW_ERR_BASE                   CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MW_BASE, CY_RSLT_MODULE_MW_ERR_CODE_START)
00130 /** Generic middleware error */
00131 #define CY_RSLT_MW_ERROR                      ( CY_RSLT_MW_ERR_BASE + 1 )
00132 /** Generic middleware timeout */
00133 #define CY_RSLT_MW_TIMEOUT                    ( CY_RSLT_MW_ERR_BASE + 2 )
00134 /** Generic middleware bad argument */        
00135 #define CY_RSLT_MW_BADARG                     ( CY_RSLT_MW_ERR_BASE + 3 )
00136 /** Generic middleware out of heap memory */        
00137 #define CY_RSLT_MW_OUT_OF_HEAP_SPACE          ( CY_RSLT_MW_ERR_BASE + 4 )
00138 /** Generic middleware pending operation */        
00139 #define CY_RSLT_MW_PENDNG                     ( CY_RSLT_MW_ERR_BASE + 5 )
00140 /** Generic middleware unsupported method */        
00141 #define CY_RSLT_MW_UNSUPPORTED                ( CY_RSLT_MW_ERR_BASE + 6 )
00142 /** Generic middleware buffer unavailable */        
00143 #define CY_RSLT_MW_BUFFER_UNAVAIL_TEMPORARILY ( CY_RSLT_MW_ERR_BASE + 7 )
00144 
00145 /**
00146  * @}
00147  */
00148 
00149 /** 
00150  * @defgroup tcpip_mw_defines TCP/IP socket results/error codes
00151  * @ingroup group_utils_enums
00152  * @{
00153  * List of all the socket result/error codes defined by the connectivity-utilities library.
00154  */
00155 /** TCP/IP error code start */
00156 #define CY_RSLT_MODULE_TCPIP_ERR_CODE_START       (0)
00157 /** TCPIP/IP base error code */
00158 #define CY_RSLT_TCPIP_ERR_BASE                CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_TCPIP_BASE, CY_RSLT_MODULE_TCPIP_ERR_CODE_START)
00159 /** TCP/IP generic error */
00160 #define CY_RSLT_TCPIP_ERROR                   ( CY_RSLT_TCPIP_ERR_BASE + 1 )
00161 /** TCP/IP timeout */
00162 #define CY_RSLT_TCPIP_TIMEOUT                 ( CY_RSLT_TCPIP_ERR_BASE + 2 )
00163 /** TCP/IP out of memory */
00164 #define CY_RSLT_TCPIP_ERROR_NO_MEMORY         ( CY_RSLT_TCPIP_ERR_BASE + 3 )
00165 /** TCP/IP error opening socket */
00166 #define CY_RSLT_TCPIP_ERROR_SOCKET_OPEN       ( CY_RSLT_TCPIP_ERR_BASE + 4 )
00167 /** TCP/IP error binding socket */
00168 #define CY_RSLT_TCPIP_ERROR_SOCKET_BIND       ( CY_RSLT_TCPIP_ERR_BASE + 5 )
00169 /** TCP/IP error listening to socket */
00170 #define CY_RSLT_TCPIP_ERROR_SOCKET_LISTEN     ( CY_RSLT_TCPIP_ERR_BASE + 6 )
00171 /** TCP/IP error accepting socket */
00172 #define CY_RSLT_TCPIP_ERROR_SOCKET_ACCEPT     ( CY_RSLT_TCPIP_ERR_BASE + 7 )
00173 /** TCP/IP error with TLS operation */
00174 #define CY_RSLT_TCPIP_ERROR_TLS_OPERATION     ( CY_RSLT_TCPIP_ERR_BASE + 8 )
00175 /** TCP/IP max sockets bound */
00176 #define CY_RSLT_TCPIP_ERROR_NO_MORE_SOCKET    ( CY_RSLT_TCPIP_ERR_BASE + 9 )
00177 /** TCP/IP error sending data */
00178 #define CY_RSLT_TCPIP_ERROR_SEND              ( CY_RSLT_TCPIP_ERR_BASE + 10)
00179 /** TCP/IP error receiving data */
00180 #define CY_RSLT_TCPIP_ERROR_RECEIVE           ( CY_RSLT_TCPIP_ERR_BASE + 11)
00181 /** TCP/IP error in setting socket options */
00182 #define CY_RSLT_TCPIP_ERROR_SOCKET_OPTIONS    ( CY_RSLT_TCPIP_ERR_BASE + 12 )
00183 /** TCP/IP error bad argument */
00184 #define CY_RSLT_TCPIP_ERROR_BAD_ARG           ( CY_RSLT_TCPIP_ERR_BASE + 13 )
00185 /** TCP/IP error socket closed */
00186 #define CY_RSLT_TCPIP_ERROR_SOCKET_CLOSED     ( CY_RSLT_TCPIP_ERR_BASE + 14 )
00187 
00188 /**
00189  * @}
00190  */
00191 
00192 /** 
00193  * @defgroup tls_mw_defines TLS results/error codes
00194  * @ingroup group_utils_enums
00195  * @{
00196  * List of all the TLS result/error codes defined by the connectivity-utilities library.
00197  */
00198 /** TLS error code start */
00199 #define CY_RSLT_MODULE_TLS_ERR_CODE_START        (0)
00200 /** TLS base error code */
00201 #define CY_RSLT_TLS_ERR_BASE                     CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_TLS_BASE, CY_RSLT_MODULE_TLS_ERR_CODE_START)
00202 /** TLS generic error */
00203 #define CY_RSLT_MODULE_TLS_ERROR                 ( CY_RSLT_TLS_ERR_BASE + 1 )
00204 /** TLS timeout error */
00205 #define CY_RSLT_MODULE_TLS_TIMEOUT               ( CY_RSLT_TLS_ERR_BASE + 2 )
00206 /** TLS bad argument */
00207 #define CY_RSLT_MODULE_TLS_BADARG                ( CY_RSLT_TLS_ERR_BASE + 3 )
00208 /** TLS out of memory */
00209 #define CY_RSLT_MODULE_TLS_OUT_OF_HEAP_SPACE     ( CY_RSLT_TLS_ERR_BASE + 4 )
00210 /** TLS bad input */
00211 #define CY_RSLT_MODULE_TLS_BAD_INPUT_DATA        ( CY_RSLT_TLS_ERR_BASE + 5 )
00212 /** TLS error parsing private key */
00213 #define CY_RSLT_MODULE_TLS_PARSE_KEY             ( CY_RSLT_TLS_ERR_BASE + 6 )
00214 /** TLS error parsing certificate */
00215 #define CY_RSLT_MODULE_TLS_PARSE_CERTIFICATE     ( CY_RSLT_TLS_ERR_BASE + 7 )
00216 /** TLS unsupported method */
00217 #define CY_RSLT_MODULE_TLS_UNSUPPORTED           ( CY_RSLT_TLS_ERR_BASE + 8 )
00218 /** TLS handshake failure */
00219 #define CY_RSLT_MODULE_TLS_HANDSHAKE_FAILURE     ( CY_RSLT_TLS_ERR_BASE + 9 )
00220 /** TLS socket connection closed by peer */
00221 #define CY_RSLT_MODULE_TLS_CONNECTION_CLOSED     ( CY_RSLT_TLS_ERR_BASE + 10 )
00222 /** TLS socket not connected */
00223 #define CY_RSLT_MODULE_TLS_SOCKET_NOT_CONNECTED  ( CY_RSLT_TLS_ERR_BASE + 11 )
00224 /** PKCS11 generic error */
00225 #define CY_RSLT_MODULE_TLS_PKCS_ERROR            ( CY_RSLT_TLS_ERR_BASE + 12 )
00226 
00227 /**
00228  * @}
00229  */
00230 
00231 #ifdef __cplusplus
00232 } /*extern "C" */
00233 #endif        
00234