* dump hex format data to console device * * @param name name for hex object, it will show on log header * @param buf hex buffer * @param size buffer size */
| 21 | * @param size buffer size |
| 22 | */ |
| 23 | void at_print_raw_cmd(const char *name, const char *buf, rt_size_t size) |
| 24 | { |
| 25 | #define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ') |
| 26 | #define WIDTH_SIZE 32 |
| 27 | |
| 28 | rt_size_t i, j; |
| 29 | |
| 30 | for (i = 0; i < size; i += WIDTH_SIZE) |
| 31 | { |
| 32 | rt_kprintf("[D/AT] %s: %04X-%04X: ", name, i, i + WIDTH_SIZE); |
| 33 | for (j = 0; j < WIDTH_SIZE; j++) |
| 34 | { |
| 35 | if (i + j < size) |
| 36 | { |
| 37 | rt_kprintf("%02X ", (unsigned char)buf[i + j]); |
| 38 | } |
| 39 | else |
| 40 | { |
| 41 | rt_kprintf(" "); |
| 42 | } |
| 43 | if ((j + 1) % 8 == 0) |
| 44 | { |
| 45 | rt_kprintf(" "); |
| 46 | } |
| 47 | } |
| 48 | rt_kprintf(" "); |
| 49 | for (j = 0; j < WIDTH_SIZE; j++) |
| 50 | { |
| 51 | if (i + j < size) |
| 52 | { |
| 53 | rt_kprintf("%c", __is_print(buf[i + j]) ? buf[i + j] : '.'); |
| 54 | } |
| 55 | } |
| 56 | rt_kprintf("\n"); |
| 57 | } |
| 58 | } |
| 59 | rt_weak rt_size_t at_utils_send(rt_device_t dev, |
| 60 | rt_off_t pos, |
| 61 | const void *buffer, |
no test coverage detected