1 /* 2 * Copyright (c) 2019,2020 Linaro Limited 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef _SFORMAT_H_ 8 #define _SFORMAT_H_ 9 10 #include <stdint.h> 11 #include <zephyr/kernel.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 /** 18 * @brief Indicates how hex data should be rendered in tabular format. 19 */ 20 struct sf_hex_tbl_fmt { 21 /** Whether or not to render ASCII equivalents. */ 22 uint8_t ascii : 1; 23 /** Whether or not to add address labels to the output. */ 24 uint8_t addr_label : 1; 25 /** The starting value for the address labels. */ 26 uint32_t addr; 27 } __packed; 28 29 /** 30 * @brief Prints a 16-value wide tabular rendering of 8-bit hex data, with 31 * optional ascii equivalents and address labels. 32 * 33 * @param fmt Pointer to thee sf_hex_tbl_fmt struct indicating how the 34 * table should be rendered. 35 * @param data Pointer to the data to render. 36 * @param len The number of bytes to render from data. 37 */ 38 void sf_hex_tabulate_16(struct sf_hex_tbl_fmt *fmt, unsigned char *data, 39 size_t len); 40 41 #ifdef __cplusplus 42 } 43 #endif 44 45 #endif /* _SFORMAT_H_ */ 46