diff options
| author | Yun Park <yunp@qca.qualcomm.com> | 2015-10-30 11:20:52 -0700 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2015-11-06 18:12:26 +0530 |
| commit | 70bad430dd511cd94099f158f399f820ee7a5e98 (patch) | |
| tree | 7dc6bcb664cc694d811a1de1a4c5a5c6eadd7409 | |
| parent | 5fe0422c7570647b2b87ebb193bee1ab6b068528 (diff) | |
qcacld: Change vos_trace_hex_dump to use hex_dump_to_buffer
Change vos_trace_hex_dump to use hex_dump_to_buffer.
This will print one line even if buffer size is less than 16 bytes.
Change-Id: I2dec78048d52f96d494c9e0ce133c4c18f48e954
CRs-fixed: 933157
| -rw-r--r-- | CORE/VOSS/src/vos_trace.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/CORE/VOSS/src/vos_trace.c b/CORE/VOSS/src/vos_trace.c index e2bd15d74d5d..2b9241518ebc 100644 --- a/CORE/VOSS/src/vos_trace.c +++ b/CORE/VOSS/src/vos_trace.c @@ -333,6 +333,10 @@ void vos_trace_display(void) } } +#define ROW_SIZE 16 +/* Buffer size = data bytes(2 hex chars plus space) + NULL */ +#define BUFFER_SIZE ((ROW_SIZE * 3) + 1) + /*---------------------------------------------------------------------------- \brief vos_trace_hex_dump() - Externally called hex dump function @@ -356,43 +360,25 @@ void vos_trace_display(void) \sa --------------------------------------------------------------------------*/ void vos_trace_hex_dump( VOS_MODULE_ID module, VOS_TRACE_LEVEL level, - void *data, int buf_len ) + void *data, int buf_len ) { - char *buf = (char *)data; - int i; + const u8 *ptr = data; + int i, linelen, remaining = buf_len; + unsigned char linebuf[BUFFER_SIZE]; - if (!(gVosTraceInfo[module].moduleTraceLevel & - VOS_TRACE_LEVEL_TO_MODULE_BITMASK(level))) - return; + if (!(gVosTraceInfo[module].moduleTraceLevel & + VOS_TRACE_LEVEL_TO_MODULE_BITMASK(level))) + return; - for (i=0; (i+15)< buf_len; i+=16) - { - vos_trace_msg( module, level, - "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", - buf[i], - buf[i+1], - buf[i+2], - buf[i+3], - buf[i+4], - buf[i+5], - buf[i+6], - buf[i+7], - buf[i+8], - buf[i+9], - buf[i+10], - buf[i+11], - buf[i+12], - buf[i+13], - buf[i+14], - buf[i+15]); - } + for (i = 0; i < buf_len; i += ROW_SIZE) { + linelen = min(remaining, ROW_SIZE); + remaining -= ROW_SIZE; - // Dump the bytes in the last line - for (; i < buf_len; i++) - { - vos_trace_msg( module, level, "%02x ", buf[i]); - } + hex_dump_to_buffer(ptr + i, linelen, ROW_SIZE, 1, + linebuf, sizeof(linebuf), false); + vos_trace_msg(module, level, "%.8x: %s", i, linebuf); + } } #endif |
