1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 #ifndef __BOOTUTIL_SERIAL_PRIV_H__ 21 #define __BOOTUTIL_SERIAL_PRIV_H__ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* 28 * From shell.h 29 */ 30 #define SHELL_NLIP_PKT_START1 6 31 #define SHELL_NLIP_PKT_START2 9 32 33 #define SHELL_NLIP_DATA_START1 4 34 #define SHELL_NLIP_DATA_START2 20 35 36 /* 37 * From newtmgr.h 38 */ 39 #define MGMT_ERR_EINVAL 3 40 41 #define NMGR_OP_READ 0 42 #define NMGR_OP_WRITE 2 43 44 #define MGMT_GROUP_ID_DEFAULT 0 45 #define MGMT_GROUP_ID_IMAGE 1 46 47 #define NMGR_ID_CONS_ECHO_CTRL 1 48 #define NMGR_ID_RESET 5 49 50 struct nmgr_hdr { 51 uint8_t nh_op; /* NMGR_OP_XXX */ 52 uint8_t nh_flags; 53 uint16_t nh_len; /* length of the payload */ 54 uint16_t nh_group; /* NMGR_GROUP_XXX */ 55 uint8_t nh_seq; /* sequence number */ 56 uint8_t nh_id; /* message ID within group */ 57 }; 58 59 /* 60 * From imgmgr.h 61 */ 62 #define IMGMGR_NMGR_ID_STATE 0 63 #define IMGMGR_NMGR_ID_UPLOAD 1 64 65 void boot_serial_input(char *buf, int len); 66 extern const struct boot_uart_funcs *boot_uf; 67 68 #ifdef __cplusplus 69 } 70 #endif 71 72 #endif /* __BOOTUTIL_SERIAL_PRIV_H__ */ 73