Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers error.h Source File

error.h

Go to the documentation of this file.
00001 /**
00002  * @file    error.h
00003  * @brief   collection of known errors and accessor for the friendly string
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #ifndef ERROR_H
00023 #define ERROR_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 // Keep in sync with the lists error_message and error_type
00030 typedef enum {
00031     /* Shared errors */
00032     ERROR_SUCCESS = 0,
00033     ERROR_FAILURE,
00034     ERROR_INTERNAL,
00035 
00036     /* VFS user errors */
00037     ERROR_ERROR_DURING_TRANSFER,
00038     ERROR_TRANSFER_TIMEOUT,
00039     ERROR_FILE_BOUNDS,
00040     ERROR_OOO_SECTOR,
00041 
00042     /* Target flash errors */
00043     ERROR_RESET,
00044     ERROR_ALGO_DL,
00045     ERROR_ALGO_MISSING,
00046     ERROR_ALGO_DATA_SEQ,
00047     ERROR_INIT,
00048     ERROR_UNINIT,
00049     ERROR_SECURITY_BITS,
00050     ERROR_UNLOCK,
00051     ERROR_ERASE_SECTOR,
00052     ERROR_ERASE_ALL,
00053     ERROR_WRITE,
00054     ERROR_WRITE_VERIFY,
00055 
00056     /* File stream errors */
00057     ERROR_SUCCESS_DONE,
00058     ERROR_SUCCESS_DONE_OR_CONTINUE,
00059     ERROR_HEX_CKSUM,
00060     ERROR_HEX_PARSER,
00061     ERROR_HEX_PROGRAM,
00062     ERROR_HEX_INVALID_ADDRESS,
00063     ERROR_HEX_INVALID_APP_OFFSET,
00064 
00065     /* Flash decoder error */
00066     ERROR_FD_BL_UPDT_ADDR_WRONG,
00067     ERROR_FD_INTF_UPDT_ADDR_WRONG,
00068     ERROR_FD_UNSUPPORTED_UPDATE,
00069 
00070     /* Flash IAP interface */
00071     ERROR_IAP_INIT,
00072     ERROR_IAP_UNINIT,
00073     ERROR_IAP_WRITE,
00074     ERROR_IAP_ERASE_SECTOR,
00075     ERROR_IAP_ERASE_ALL,
00076     ERROR_IAP_OUT_OF_BOUNDS,
00077     ERROR_IAP_UPDT_NOT_SUPPORTED,
00078     ERROR_IAP_UPDT_INCOMPLETE,
00079     ERROR_IAP_NO_INTERCEPT,
00080     ERROR_BL_UPDT_BAD_CRC,
00081 
00082     // Add new values here
00083 
00084     ERROR_COUNT
00085 } error_t;
00086 
00087 const char *error_get_string(error_t error);
00088 
00089 typedef unsigned char error_type_t;
00090 
00091 #define ERROR_TYPE_INTERNAL 0x1
00092 #define ERROR_TYPE_TRANSIENT 0x2
00093 #define ERROR_TYPE_USER 0x4
00094 #define ERROR_TYPE_TARGET 0x8
00095 #define ERROR_TYPE_INTERFACE 0x10
00096 // If you add another error type:
00097 // 1. update error_type_names, used by read_file_fail_txt()
00098 // 2. update ERROR_TYPE_MASK
00099 // 3. make sure that error type bits still fit inside of error_type_t
00100 #define ERROR_TYPE_MASK 0x1F
00101 
00102 error_type_t error_get_type(error_t error);
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107 
00108 #endif