1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: common define of shell cmds 15 * Author: none 16 * Create: 2020 17 */ 18 19 #ifndef LWIP_UTILITY_H 20 #define LWIP_UTILITY_H 21 22 #include "arch/cc.h" 23 #include "lwip/opt.h" 24 25 #ifdef CUSTOM_AT_COMMAND 26 #include "soc_at.h" 27 #endif 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #define MACADDR_BUF_LEN 32 34 #define TYPE_VAL_ARGS 2 35 36 #ifndef PRINT_USE_CRLF 37 #define PRINT_USE_CRLF 1 38 #endif 39 40 #if PRINT_USE_CRLF 41 #define CRLF "\r\n" 42 #else 43 #define CRLF "\n" 44 #endif 45 46 #ifdef LWIP_DEBUG_OPEN 47 #undef PRINTK 48 #define PRINTK (void)uapi_at_printf 49 #endif 50 51 #ifndef LWIP_STATIC 52 #define LWIP_STATIC static 53 #endif 54 55 #define API_SHELL_ERRCODE_USAGE "201 invalid usage" 56 #define API_SHELL_ERRCODE_TCPIP_UNINTED "202 tcpip_init do not init" 57 #define API_SHELL_ERRCODE_MEM_ERR "203 mem malloc failed" 58 #define API_SHELL_ERRCODE_SEM_ERR "204 sem create failed" 59 #define API_SHELL_ERRCODE_DEV_NOT_FOUND "205 net device not found" 60 #define API_SHELL_ERRCODE_DEV_NOT_READY "206 net device not ready" 61 #define API_SHELL_ERRCODE_INVALID "207 invalid parameter" 62 #define API_SHELL_ERRCODE_SERVICE_FAILURE "208 service failure" 63 #define API_SHELL_ERRCODE_IP_CONFLICT "209 IP conflict" 64 #define API_SHELL_ERRCODE_DUPLICATE_NETWORK "210 duplicate network" 65 #define API_SHELL_ERRCODE_NO_ROUTE "211 not route found" 66 67 #ifndef PRINT_ERRCODE 68 #define PRINT_ERRCODE(x) LWIP_PLATFORM_PRINT("ERR:%s"CRLF, (x)) 69 #endif 70 71 #define PRINT_BUF_LEN 1024 72 #define MAX_MACADDR_STRING_LENGTH 18 /* including NULL */ 73 74 int convert_string_to_hex(const char *src, unsigned char *dest); 75 76 s32_t lwip_isdigitstr(const s8_t* str); 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* LWIP_UTILITY_H */ 82