Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/daplink/error.h@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file error.h |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief collection of known errors and accessor for the friendly string |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #ifndef ERROR_H |
Pawel Zarembski |
0:01f31e923fe2 | 23 | #define ERROR_H |
Pawel Zarembski |
0:01f31e923fe2 | 24 | |
Pawel Zarembski |
0:01f31e923fe2 | 25 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 26 | extern "C" { |
Pawel Zarembski |
0:01f31e923fe2 | 27 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 28 | |
Pawel Zarembski |
0:01f31e923fe2 | 29 | // Keep in sync with the lists error_message and error_type |
Pawel Zarembski |
0:01f31e923fe2 | 30 | typedef enum { |
Pawel Zarembski |
0:01f31e923fe2 | 31 | /* Shared errors */ |
Pawel Zarembski |
0:01f31e923fe2 | 32 | ERROR_SUCCESS = 0, |
Pawel Zarembski |
0:01f31e923fe2 | 33 | ERROR_FAILURE, |
Pawel Zarembski |
0:01f31e923fe2 | 34 | ERROR_INTERNAL, |
Pawel Zarembski |
0:01f31e923fe2 | 35 | |
Pawel Zarembski |
0:01f31e923fe2 | 36 | /* VFS user errors */ |
Pawel Zarembski |
0:01f31e923fe2 | 37 | ERROR_ERROR_DURING_TRANSFER, |
Pawel Zarembski |
0:01f31e923fe2 | 38 | ERROR_TRANSFER_TIMEOUT, |
Pawel Zarembski |
0:01f31e923fe2 | 39 | ERROR_FILE_BOUNDS, |
Pawel Zarembski |
0:01f31e923fe2 | 40 | ERROR_OOO_SECTOR, |
Pawel Zarembski |
0:01f31e923fe2 | 41 | |
Pawel Zarembski |
0:01f31e923fe2 | 42 | /* Target flash errors */ |
Pawel Zarembski |
0:01f31e923fe2 | 43 | ERROR_RESET, |
Pawel Zarembski |
0:01f31e923fe2 | 44 | ERROR_ALGO_DL, |
Pawel Zarembski |
0:01f31e923fe2 | 45 | ERROR_ALGO_MISSING, |
Pawel Zarembski |
0:01f31e923fe2 | 46 | ERROR_ALGO_DATA_SEQ, |
Pawel Zarembski |
0:01f31e923fe2 | 47 | ERROR_INIT, |
Pawel Zarembski |
0:01f31e923fe2 | 48 | ERROR_UNINIT, |
Pawel Zarembski |
0:01f31e923fe2 | 49 | ERROR_SECURITY_BITS, |
Pawel Zarembski |
0:01f31e923fe2 | 50 | ERROR_UNLOCK, |
Pawel Zarembski |
0:01f31e923fe2 | 51 | ERROR_ERASE_SECTOR, |
Pawel Zarembski |
0:01f31e923fe2 | 52 | ERROR_ERASE_ALL, |
Pawel Zarembski |
0:01f31e923fe2 | 53 | ERROR_WRITE, |
Pawel Zarembski |
0:01f31e923fe2 | 54 | ERROR_WRITE_VERIFY, |
Pawel Zarembski |
0:01f31e923fe2 | 55 | |
Pawel Zarembski |
0:01f31e923fe2 | 56 | /* File stream errors */ |
Pawel Zarembski |
0:01f31e923fe2 | 57 | ERROR_SUCCESS_DONE, |
Pawel Zarembski |
0:01f31e923fe2 | 58 | ERROR_SUCCESS_DONE_OR_CONTINUE, |
Pawel Zarembski |
0:01f31e923fe2 | 59 | ERROR_HEX_CKSUM, |
Pawel Zarembski |
0:01f31e923fe2 | 60 | ERROR_HEX_PARSER, |
Pawel Zarembski |
0:01f31e923fe2 | 61 | ERROR_HEX_PROGRAM, |
Pawel Zarembski |
0:01f31e923fe2 | 62 | ERROR_HEX_INVALID_ADDRESS, |
Pawel Zarembski |
0:01f31e923fe2 | 63 | ERROR_HEX_INVALID_APP_OFFSET, |
Pawel Zarembski |
0:01f31e923fe2 | 64 | |
Pawel Zarembski |
0:01f31e923fe2 | 65 | /* Flash decoder error */ |
Pawel Zarembski |
0:01f31e923fe2 | 66 | ERROR_FD_BL_UPDT_ADDR_WRONG, |
Pawel Zarembski |
0:01f31e923fe2 | 67 | ERROR_FD_INTF_UPDT_ADDR_WRONG, |
Pawel Zarembski |
0:01f31e923fe2 | 68 | ERROR_FD_UNSUPPORTED_UPDATE, |
Pawel Zarembski |
0:01f31e923fe2 | 69 | |
Pawel Zarembski |
0:01f31e923fe2 | 70 | /* Flash IAP interface */ |
Pawel Zarembski |
0:01f31e923fe2 | 71 | ERROR_IAP_INIT, |
Pawel Zarembski |
0:01f31e923fe2 | 72 | ERROR_IAP_UNINIT, |
Pawel Zarembski |
0:01f31e923fe2 | 73 | ERROR_IAP_WRITE, |
Pawel Zarembski |
0:01f31e923fe2 | 74 | ERROR_IAP_ERASE_SECTOR, |
Pawel Zarembski |
0:01f31e923fe2 | 75 | ERROR_IAP_ERASE_ALL, |
Pawel Zarembski |
0:01f31e923fe2 | 76 | ERROR_IAP_OUT_OF_BOUNDS, |
Pawel Zarembski |
0:01f31e923fe2 | 77 | ERROR_IAP_UPDT_NOT_SUPPORTED, |
Pawel Zarembski |
0:01f31e923fe2 | 78 | ERROR_IAP_UPDT_INCOMPLETE, |
Pawel Zarembski |
0:01f31e923fe2 | 79 | ERROR_IAP_NO_INTERCEPT, |
Pawel Zarembski |
0:01f31e923fe2 | 80 | ERROR_BL_UPDT_BAD_CRC, |
Pawel Zarembski |
0:01f31e923fe2 | 81 | |
Pawel Zarembski |
0:01f31e923fe2 | 82 | // Add new values here |
Pawel Zarembski |
0:01f31e923fe2 | 83 | |
Pawel Zarembski |
0:01f31e923fe2 | 84 | ERROR_COUNT |
Pawel Zarembski |
0:01f31e923fe2 | 85 | } error_t; |
Pawel Zarembski |
0:01f31e923fe2 | 86 | |
Pawel Zarembski |
0:01f31e923fe2 | 87 | const char *error_get_string(error_t error); |
Pawel Zarembski |
0:01f31e923fe2 | 88 | |
Pawel Zarembski |
0:01f31e923fe2 | 89 | typedef unsigned char error_type_t; |
Pawel Zarembski |
0:01f31e923fe2 | 90 | |
Pawel Zarembski |
0:01f31e923fe2 | 91 | #define ERROR_TYPE_INTERNAL 0x1 |
Pawel Zarembski |
0:01f31e923fe2 | 92 | #define ERROR_TYPE_TRANSIENT 0x2 |
Pawel Zarembski |
0:01f31e923fe2 | 93 | #define ERROR_TYPE_USER 0x4 |
Pawel Zarembski |
0:01f31e923fe2 | 94 | #define ERROR_TYPE_TARGET 0x8 |
Pawel Zarembski |
0:01f31e923fe2 | 95 | #define ERROR_TYPE_INTERFACE 0x10 |
Pawel Zarembski |
0:01f31e923fe2 | 96 | // If you add another error type: |
Pawel Zarembski |
0:01f31e923fe2 | 97 | // 1. update error_type_names, used by read_file_fail_txt() |
Pawel Zarembski |
0:01f31e923fe2 | 98 | // 2. update ERROR_TYPE_MASK |
Pawel Zarembski |
0:01f31e923fe2 | 99 | // 3. make sure that error type bits still fit inside of error_type_t |
Pawel Zarembski |
0:01f31e923fe2 | 100 | #define ERROR_TYPE_MASK 0x1F |
Pawel Zarembski |
0:01f31e923fe2 | 101 | |
Pawel Zarembski |
0:01f31e923fe2 | 102 | error_type_t error_get_type(error_t error); |
Pawel Zarembski |
0:01f31e923fe2 | 103 | |
Pawel Zarembski |
0:01f31e923fe2 | 104 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 105 | } |
Pawel Zarembski |
0:01f31e923fe2 | 106 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 107 | |
Pawel Zarembski |
0:01f31e923fe2 | 108 | #endif |