this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Committer:
ocomeni
Date:
Fri Jul 19 16:49:26 2019 +0000
Branch:
PassingRegression
Revision:
129:590bdc2dcf5b
Parent:
122:62166886db5f
Implementation of Access token acquisition; 1. make request with credentials - DONE; 2. get response - DONE; 3. extract Id and refresh tokens from response - DONE; 4. integrate with code - DONE; Testing ongoing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ocomeni 103:7b566b522427 1 /**
ocomeni 103:7b566b522427 2 ******************************************************************************
ocomeni 103:7b566b522427 3 * @file debug.c
ocomeni 103:7b566b522427 4 * @brief Source file containing logic responsible for:
ocomeni 103:7b566b522427 5 * @details
ocomeni 103:7b566b522427 6 *
ocomeni 103:7b566b522427 7 ******************************************************************************
ocomeni 103:7b566b522427 8 * @author TTP
ocomeni 103:7b566b522427 9 * @copyright (c) 2017 TTP (The Technology Partnership) plc
ocomeni 103:7b566b522427 10 *
ocomeni 103:7b566b522427 11 ******************************************************************************
ocomeni 103:7b566b522427 12 */
ocomeni 103:7b566b522427 13
ocomeni 103:7b566b522427 14 //-------- Includes ----------------------------------------------------------//
ocomeni 103:7b566b522427 15
ocomeni 103:7b566b522427 16 #include "debug.h"
ocomeni 103:7b566b522427 17 #include <mbed.h>
ocomeni 103:7b566b522427 18 //#include "clocks.h"
ocomeni 103:7b566b522427 19
ocomeni 103:7b566b522427 20 //-------- Defines -----------------------------------------------------------//
ocomeni 103:7b566b522427 21
ocomeni 103:7b566b522427 22 #define FILE_CODE "dbgm"
ocomeni 103:7b566b522427 23 #define ERROR "err"
ocomeni 103:7b566b522427 24
ocomeni 103:7b566b522427 25 #define DBG_RX_BUFFER_SIZE_BYTES (1024)
ocomeni 103:7b566b522427 26 #define DBG_RX_BUFFER_MASK (DBG_RX_BUFFER_SIZE_BYTES - 1)
ocomeni 103:7b566b522427 27
ocomeni 103:7b566b522427 28 #define DBG_TX_BUFFER_SIZE_BYTES (1024)
ocomeni 103:7b566b522427 29
ocomeni 103:7b566b522427 30 #if (DBG_RX_BUFFER_SIZE_BYTES & DBG_RX_BUFFER_MASK)
ocomeni 103:7b566b522427 31 #error Rx buffer size is not power of 2
ocomeni 103:7b566b522427 32 #endif
ocomeni 103:7b566b522427 33
ocomeni 103:7b566b522427 34 //-------- Constants & enums -------------------------------------------------//
ocomeni 103:7b566b522427 35
ocomeni 103:7b566b522427 36
ocomeni 103:7b566b522427 37 //-------- Structs & typedefs ------------------------------------------------//
ocomeni 103:7b566b522427 38
ocomeni 103:7b566b522427 39 //-------- Global Variables --------------------------------------------------//
ocomeni 103:7b566b522427 40
ocomeni 103:7b566b522427 41 /**
ocomeni 103:7b566b522427 42 *@brief Global array of length ::DBG_TX_BUFFER_SIZE_BYTES to store
ocomeni 103:7b566b522427 43 * the current debug print statement of the firmware.
ocomeni 103:7b566b522427 44 */
ocomeni 103:7b566b522427 45 static char g_dbg_buffer[DBG_TX_BUFFER_SIZE_BYTES];
ocomeni 103:7b566b522427 46
ocomeni 103:7b566b522427 47 //-------- Static Variables --------------------------------------------------//
ocomeni 103:7b566b522427 48
ocomeni 103:7b566b522427 49 static const char dbg_tx_terminate_string[] = {'\n', '\r'}; ///<Array of characters representing the terminate sequence of a debug transmit string
ocomeni 103:7b566b522427 50
ocomeni 103:7b566b522427 51 static uint8_t current_debug_level; ///<Variable keeping track of the current debug level
ocomeni 103:7b566b522427 52
ocomeni 103:7b566b522427 53 static char fw_ver_string[REL_FW_VER_STRING_LEN_BYTES + SVN_FW_VER_STRING_LEN_BYTES];
ocomeni 103:7b566b522427 54 static uint8_t fw_ver_bytes[5];
ocomeni 103:7b566b522427 55
ocomeni 103:7b566b522427 56 static data_mode_e dbg_data_mode;
ocomeni 103:7b566b522427 57
ocomeni 103:7b566b522427 58 //Rx buffer to be used for both ASCII and binary mode
ocomeni 103:7b566b522427 59 static uint8_t dbg_rx_buffer[DBG_RX_BUFFER_SIZE_BYTES];
ocomeni 103:7b566b522427 60 static volatile uint16_t dbg_rx_pos;
ocomeni 103:7b566b522427 61 static volatile uint32_t dbg_rx_count;
ocomeni 103:7b566b522427 62 static volatile uint16_t dbg_rx_cmd_count;
ocomeni 103:7b566b522427 63
ocomeni 103:7b566b522427 64 //static char g_dbg_buffer[DBG_TX_BUFFER_SIZE_BYTES];
ocomeni 103:7b566b522427 65
ocomeni 103:7b566b522427 66 //-------- Static function prototypes ----------------------------------------//
ocomeni 103:7b566b522427 67
ocomeni 103:7b566b522427 68 static void set_fw_ver_string(void);
ocomeni 103:7b566b522427 69 static void set_fw_ver_bytes(void);
ocomeni 103:7b566b522427 70 static char get_rx_byte_from_buffer(void);
ocomeni 103:7b566b522427 71 static const char* debug_level_to_string(uint8_t debug_level);
ocomeni 103:7b566b522427 72
ocomeni 103:7b566b522427 73 //-------- Function implementations ------------------------------------------//
ocomeni 103:7b566b522427 74 #ifdef BOX_MICRO_CODE
ocomeni 103:7b566b522427 75 static inline void disable_dbg_rx_intrup(void)
ocomeni 103:7b566b522427 76 {
ocomeni 103:7b566b522427 77 __HAL_PCD_DISABLE(&hpcd_USB_OTG_FS);
ocomeni 103:7b566b522427 78 }
ocomeni 103:7b566b522427 79
ocomeni 103:7b566b522427 80 static inline void enable_dbg_rx_intrup(void)
ocomeni 103:7b566b522427 81 {
ocomeni 103:7b566b522427 82 __HAL_PCD_ENABLE(&hpcd_USB_OTG_FS);
ocomeni 103:7b566b522427 83 }
ocomeni 103:7b566b522427 84 #endif
ocomeni 103:7b566b522427 85 /**
ocomeni 103:7b566b522427 86 * @brief Starting function to supervise the
ocomeni 103:7b566b522427 87 * - Initialisation of UART2 responsible for acting as the debug port for the firmware
ocomeni 103:7b566b522427 88 * - Initialisation of the UART2 transmit and receive buffers
ocomeni 103:7b566b522427 89 * - Initial read from UART2
ocomeni 103:7b566b522427 90 *
ocomeni 103:7b566b522427 91 * @param None
ocomeni 103:7b566b522427 92 * @retval None
ocomeni 103:7b566b522427 93 */
ocomeni 107:f1a83fd41b17 94 //#define DEBUG_ENABLED
ocomeni 113:888e262ff0a9 95 void initialise_debug(uint8_t debug_level=NONE)
ocomeni 103:7b566b522427 96 {
ocomeni 103:7b566b522427 97 memset(g_dbg_buffer, 0, sizeof(g_dbg_buffer));
ocomeni 103:7b566b522427 98
ocomeni 103:7b566b522427 99 //. Set the version strings
ocomeni 103:7b566b522427 100 set_fw_ver_string();
ocomeni 103:7b566b522427 101 set_fw_ver_bytes();
ocomeni 104:11e9605093c9 102 #ifdef DEBUG_ENABLED
ocomeni 104:11e9605093c9 103 current_debug_level = (LOG | ERR | TXT | DBG); //NONE; //
ocomeni 104:11e9605093c9 104 #else
ocomeni 113:888e262ff0a9 105 current_debug_level = debug_level; //
ocomeni 104:11e9605093c9 106 #endif
ocomeni 103:7b566b522427 107 dbg_data_mode = DATA_ASCII;
ocomeni 103:7b566b522427 108 dbg_rx_pos = 0;
ocomeni 103:7b566b522427 109 dbg_rx_count = 0;
ocomeni 103:7b566b522427 110 dbg_rx_cmd_count = 0;
ocomeni 103:7b566b522427 111 }
ocomeni 103:7b566b522427 112
ocomeni 103:7b566b522427 113 /**
ocomeni 103:7b566b522427 114 * @brief
ocomeni 103:7b566b522427 115 * @param
ocomeni 103:7b566b522427 116 * @param
ocomeni 103:7b566b522427 117 * @retval
ocomeni 103:7b566b522427 118 */
ocomeni 103:7b566b522427 119 const char* get_dbg_tx_terminate_string(void)
ocomeni 103:7b566b522427 120 {
ocomeni 103:7b566b522427 121 if (dbg_data_mode == DATA_ASCII)
ocomeni 103:7b566b522427 122 {
ocomeni 103:7b566b522427 123 return dbg_tx_terminate_string;
ocomeni 103:7b566b522427 124 }
ocomeni 103:7b566b522427 125 else
ocomeni 103:7b566b522427 126 {
ocomeni 103:7b566b522427 127 return NULL;
ocomeni 103:7b566b522427 128 }
ocomeni 103:7b566b522427 129 }
ocomeni 103:7b566b522427 130
ocomeni 103:7b566b522427 131 /**
ocomeni 103:7b566b522427 132 * @brief
ocomeni 103:7b566b522427 133 * @param
ocomeni 103:7b566b522427 134 * @param
ocomeni 103:7b566b522427 135 * @retval
ocomeni 103:7b566b522427 136 */
ocomeni 103:7b566b522427 137 uint8_t get_dbg_tx_terminate_string_len(void)
ocomeni 103:7b566b522427 138 {
ocomeni 103:7b566b522427 139 if (dbg_data_mode == DATA_ASCII)
ocomeni 103:7b566b522427 140 {
ocomeni 103:7b566b522427 141 return sizeof(dbg_tx_terminate_string);
ocomeni 103:7b566b522427 142 }
ocomeni 103:7b566b522427 143 else
ocomeni 103:7b566b522427 144 {
ocomeni 103:7b566b522427 145 return 0;
ocomeni 103:7b566b522427 146 }
ocomeni 103:7b566b522427 147 }
ocomeni 103:7b566b522427 148
ocomeni 103:7b566b522427 149 static const char* debug_level_to_string(uint8_t debug_level)
ocomeni 103:7b566b522427 150 {
ocomeni 103:7b566b522427 151 switch(debug_level)
ocomeni 103:7b566b522427 152 {
ocomeni 103:7b566b522427 153 case LOG:
ocomeni 103:7b566b522427 154 return "LOG";
ocomeni 103:7b566b522427 155
ocomeni 103:7b566b522427 156 case ERR:
ocomeni 103:7b566b522427 157 return "ERR";
ocomeni 103:7b566b522427 158
ocomeni 103:7b566b522427 159 case DBG:
ocomeni 103:7b566b522427 160 return "DBG";
ocomeni 103:7b566b522427 161
ocomeni 103:7b566b522427 162 case TXT:
ocomeni 103:7b566b522427 163 return "TXT";
ocomeni 103:7b566b522427 164
ocomeni 103:7b566b522427 165 default:
ocomeni 103:7b566b522427 166 return "INV"; //Invalid
ocomeni 103:7b566b522427 167 }
ocomeni 103:7b566b522427 168 }
ocomeni 103:7b566b522427 169
ocomeni 103:7b566b522427 170
ocomeni 103:7b566b522427 171 //void dbg_printf(uint8_t debug_level, ...)
ocomeni 103:7b566b522427 172 //{
ocomeni 103:7b566b522427 173 // dbg_print(FILE_CODE, __LINE__, debug_level, ...);
ocomeni 103:7b566b522427 174 //}
ocomeni 104:11e9605093c9 175 void dbg_print(const char *file_code, uint16_t line_number,
ocomeni 104:11e9605093c9 176 uint8_t debug_level, const char *text, ...)
ocomeni 103:7b566b522427 177 {
ocomeni 103:7b566b522427 178 //const char *file_code, uint16_t line_number,
ocomeni 103:7b566b522427 179
ocomeni 103:7b566b522427 180 if (current_debug_level & debug_level)
ocomeni 103:7b566b522427 181 {
ocomeni 103:7b566b522427 182 //Re-init the gloabl debug buffer
ocomeni 103:7b566b522427 183 memset(g_dbg_buffer, 0, sizeof(g_dbg_buffer));
ocomeni 103:7b566b522427 184 uint16_t len_bytes = 0;
ocomeni 103:7b566b522427 185
ocomeni 103:7b566b522427 186 if (debug_level != TXT)
ocomeni 103:7b566b522427 187 {
ocomeni 104:11e9605093c9 188 //sprintf(g_dbg_buffer, "|%s|%10u|", debug_level_to_string(debug_level), Kernel::get_ms_count());
ocomeni 104:11e9605093c9 189 sprintf(g_dbg_buffer, "|%s|%s|%4d|%10u|", debug_level_to_string(debug_level), file_code, line_number, Kernel::get_ms_count());
ocomeni 103:7b566b522427 190 len_bytes = strlen(g_dbg_buffer);
ocomeni 103:7b566b522427 191 }
ocomeni 103:7b566b522427 192
ocomeni 103:7b566b522427 193 va_list args;
ocomeni 103:7b566b522427 194 va_start(args, text);
ocomeni 103:7b566b522427 195 vsnprintf(&g_dbg_buffer[len_bytes], (sizeof(g_dbg_buffer) - len_bytes - 2), text, args);
ocomeni 103:7b566b522427 196 printf("%s", g_dbg_buffer);
ocomeni 103:7b566b522427 197 va_end(args);
ocomeni 103:7b566b522427 198
ocomeni 103:7b566b522427 199 len_bytes = strlen(g_dbg_buffer);
ocomeni 103:7b566b522427 200 g_dbg_buffer[len_bytes++] = '\r';
ocomeni 103:7b566b522427 201 g_dbg_buffer[len_bytes++] = '\n';
ocomeni 103:7b566b522427 202 #ifdef WRITE_TO_FILE_ENABLED
ocomeni 103:7b566b522427 203 if (debug_level == LOG || debug_level == ERROR)
ocomeni 103:7b566b522427 204 {
ocomeni 103:7b566b522427 205 write_to_file(SYS_LOG, (const uint8_t *)g_dbg_buffer, len_bytes);
ocomeni 103:7b566b522427 206 }
ocomeni 103:7b566b522427 207
ocomeni 103:7b566b522427 208 if (dbg_data_mode == DATA_ASCII)
ocomeni 103:7b566b522427 209 {
ocomeni 103:7b566b522427 210 transmit_bytes_over_usb((uint8_t *)g_dbg_buffer, len_bytes);
ocomeni 103:7b566b522427 211 }
ocomeni 103:7b566b522427 212 #endif
ocomeni 103:7b566b522427 213 }
ocomeni 103:7b566b522427 214 }
ocomeni 103:7b566b522427 215
ocomeni 103:7b566b522427 216 /**
ocomeni 103:7b566b522427 217 Function used to send data during firmware update (in binary mode)
ocomeni 103:7b566b522427 218 */
ocomeni 103:7b566b522427 219 #ifdef WRITE_TO_FILE_ENABLED
ocomeni 103:7b566b522427 220 void debug_send_data(uint8_t *pData, uint16_t length)
ocomeni 103:7b566b522427 221 {
ocomeni 103:7b566b522427 222 transmit_bytes_over_usb(pData, length);
ocomeni 103:7b566b522427 223 }
ocomeni 103:7b566b522427 224 #endif
ocomeni 103:7b566b522427 225
ocomeni 103:7b566b522427 226 /**
ocomeni 103:7b566b522427 227 * @brief Function to set the debug level. Currently only 2 debug levels
ocomeni 103:7b566b522427 228 * are provided as mentioned in ::debug_log_level_e.
ocomeni 103:7b566b522427 229 * LOG is constantly enabled
ocomeni 103:7b566b522427 230 *
ocomeni 103:7b566b522427 231 * @param (uint8_t) debug_level
ocomeni 103:7b566b522427 232 * @retval None
ocomeni 103:7b566b522427 233 */
ocomeni 103:7b566b522427 234 void set_debug_level(uint8_t debug_level)
ocomeni 103:7b566b522427 235 {
ocomeni 103:7b566b522427 236 current_debug_level = (LOG | ERR | TXT | debug_level);
ocomeni 103:7b566b522427 237 dbg_printf(LOG, "Current debug level set to %02x", current_debug_level);
ocomeni 103:7b566b522427 238 }
ocomeni 103:7b566b522427 239
ocomeni 103:7b566b522427 240 /**
ocomeni 103:7b566b522427 241 * @brief Function to get the current debug level set.
ocomeni 103:7b566b522427 242 *
ocomeni 103:7b566b522427 243 * @param None
ocomeni 103:7b566b522427 244 * @retval (uint8_t) current_debug_level
ocomeni 103:7b566b522427 245 */
ocomeni 103:7b566b522427 246 uint8_t get_debug_level(void)
ocomeni 103:7b566b522427 247 {
ocomeni 103:7b566b522427 248 return current_debug_level;
ocomeni 103:7b566b522427 249 }
ocomeni 103:7b566b522427 250
ocomeni 103:7b566b522427 251 /**
ocomeni 103:7b566b522427 252 * @brief Function to set the micro firmware version
ocomeni 103:7b566b522427 253 * Firmware version follows the following format:
ocomeni 103:7b566b522427 254 * major.minor.patch.svn_revision
ocomeni 103:7b566b522427 255 *
ocomeni 103:7b566b522427 256 * If 'svnversion' is not installed on the machine, the svn
ocomeni 103:7b566b522427 257 * revision is returned null. In that instance, the svn revision
ocomeni 103:7b566b522427 258 * is set to n.a
ocomeni 103:7b566b522427 259 *
ocomeni 103:7b566b522427 260 * @param None
ocomeni 103:7b566b522427 261 * @retval None
ocomeni 103:7b566b522427 262 */
ocomeni 103:7b566b522427 263 static void set_fw_ver_string(void)
ocomeni 103:7b566b522427 264 {
ocomeni 103:7b566b522427 265 memset(fw_ver_string, 0, sizeof(fw_ver_string));
ocomeni 103:7b566b522427 266
ocomeni 103:7b566b522427 267 memcpy(fw_ver_string, REL_FW_VER_STRING, REL_FW_VER_STRING_LEN_BYTES);
ocomeni 103:7b566b522427 268
ocomeni 103:7b566b522427 269 uint8_t rel_fw_string_len_bytes = strlen(REL_FW_VER_STRING);
ocomeni 103:7b566b522427 270
ocomeni 103:7b566b522427 271 fw_ver_string[rel_fw_string_len_bytes] = '.';
ocomeni 103:7b566b522427 272 #ifdef BOX_MICRO_CODE
ocomeni 103:7b566b522427 273 if (strlen(SVN_FW_VERSION_STRING) == 0)
ocomeni 103:7b566b522427 274 {
ocomeni 103:7b566b522427 275 //svnversion is not installed on the machine
ocomeni 103:7b566b522427 276 memcpy(&fw_ver_string[rel_fw_string_len_bytes + 1], "n.a", 4);
ocomeni 103:7b566b522427 277 }
ocomeni 103:7b566b522427 278 else
ocomeni 103:7b566b522427 279 {
ocomeni 103:7b566b522427 280 memcpy(&fw_ver_string[rel_fw_string_len_bytes + 1], SVN_FW_VERSION_STRING, SVN_FW_VER_STRING_LEN_BYTES);
ocomeni 103:7b566b522427 281 }
ocomeni 103:7b566b522427 282 #endif
ocomeni 103:7b566b522427 283 }
ocomeni 103:7b566b522427 284
ocomeni 103:7b566b522427 285 /**
ocomeni 103:7b566b522427 286 * @brief Function to get the firmware version
ocomeni 103:7b566b522427 287 *
ocomeni 103:7b566b522427 288 * @param None
ocomeni 103:7b566b522427 289 * @retval (const char *) fw_ver_string
ocomeni 103:7b566b522427 290 */
ocomeni 103:7b566b522427 291 const char* get_fw_ver_string(void)
ocomeni 103:7b566b522427 292 {
ocomeni 103:7b566b522427 293 return fw_ver_string;
ocomeni 103:7b566b522427 294 }
ocomeni 103:7b566b522427 295
ocomeni 103:7b566b522427 296 static void set_fw_ver_bytes(void)
ocomeni 103:7b566b522427 297 {
ocomeni 103:7b566b522427 298 memset(fw_ver_bytes, 0, sizeof(fw_ver_bytes));
ocomeni 103:7b566b522427 299
ocomeni 103:7b566b522427 300 uint16_t val = 0;
ocomeni 103:7b566b522427 301 sscanf(fw_ver_string, "%hhx.%hhx.%hhx.%hx", &fw_ver_bytes[0], &fw_ver_bytes[1], &fw_ver_bytes[2], &val);
ocomeni 103:7b566b522427 302
ocomeni 103:7b566b522427 303 fw_ver_bytes[3] = (val >> 8) & 0xff;
ocomeni 103:7b566b522427 304 fw_ver_bytes[4] = val & 0xff;
ocomeni 103:7b566b522427 305 }
ocomeni 103:7b566b522427 306
ocomeni 103:7b566b522427 307 const uint8_t* get_fw_ver_bytes(void)
ocomeni 103:7b566b522427 308 {
ocomeni 103:7b566b522427 309 return fw_ver_bytes;
ocomeni 103:7b566b522427 310 }
ocomeni 103:7b566b522427 311
ocomeni 103:7b566b522427 312 void debug_setDataMode(data_mode_e mode)
ocomeni 103:7b566b522427 313 {
ocomeni 103:7b566b522427 314 dbg_data_mode = mode;
ocomeni 103:7b566b522427 315 }
ocomeni 103:7b566b522427 316
ocomeni 103:7b566b522427 317 void print_debug_hex(const uint8_t* p_buffer, uint16_t len)
ocomeni 103:7b566b522427 318 {
ocomeni 103:7b566b522427 319 //print out the rxvd EDM bytes
ocomeni 103:7b566b522427 320
ocomeni 103:7b566b522427 321 uint16_t quo = len / 8;
ocomeni 103:7b566b522427 322 uint16_t rem = len % 8;
ocomeni 103:7b566b522427 323
ocomeni 103:7b566b522427 324 uint16_t i = 0;
ocomeni 103:7b566b522427 325 uint16_t j = 0;
ocomeni 103:7b566b522427 326 for (i = 0; i < quo; i++)
ocomeni 103:7b566b522427 327 {
ocomeni 103:7b566b522427 328 dbg_printf(LOG, "[%3d]: %02x %02x %02x %02x %02x %02x %02x %02x", j,
ocomeni 103:7b566b522427 329 p_buffer[j + 0], p_buffer[j + 1], p_buffer[j + 2], p_buffer[j + 3],
ocomeni 103:7b566b522427 330 p_buffer[j + 4], p_buffer[j + 5], p_buffer[j + 6], p_buffer[j + 7]);
ocomeni 103:7b566b522427 331 j += 8;
ocomeni 103:7b566b522427 332 }
ocomeni 103:7b566b522427 333
ocomeni 103:7b566b522427 334 if (rem == 7)
ocomeni 103:7b566b522427 335 {
ocomeni 103:7b566b522427 336 dbg_printf(LOG, "[%3d]: %02x %02x %02x %02x %02x %02x %02x", j,
ocomeni 103:7b566b522427 337 p_buffer[j + 0], p_buffer[j + 1], p_buffer[j + 2], p_buffer[j + 3],
ocomeni 103:7b566b522427 338 p_buffer[j + 4], p_buffer[j + 5], p_buffer[j + 6]);
ocomeni 103:7b566b522427 339 }
ocomeni 103:7b566b522427 340 else if (rem == 6)
ocomeni 103:7b566b522427 341 {
ocomeni 103:7b566b522427 342 dbg_printf(LOG, "[%3d]: %02x %02x %02x %02x %02x %02x", j,
ocomeni 103:7b566b522427 343 p_buffer[j + 0], p_buffer[j + 1], p_buffer[j + 2], p_buffer[j + 3],
ocomeni 103:7b566b522427 344 p_buffer[j + 4], p_buffer[j + 5]);
ocomeni 103:7b566b522427 345 }
ocomeni 103:7b566b522427 346 else if (rem == 5)
ocomeni 103:7b566b522427 347 {
ocomeni 103:7b566b522427 348 dbg_printf(LOG, "[%3d]: %02x %02x %02x %02x %02x", j,
ocomeni 103:7b566b522427 349 p_buffer[j + 0], p_buffer[j + 1], p_buffer[j + 2], p_buffer[j + 3],
ocomeni 103:7b566b522427 350 p_buffer[j + 4]);
ocomeni 103:7b566b522427 351 }
ocomeni 103:7b566b522427 352 else if (rem == 4)
ocomeni 103:7b566b522427 353 {
ocomeni 103:7b566b522427 354 dbg_printf(LOG, "[%3d]: %02x %02x %02x %02x", j,
ocomeni 103:7b566b522427 355 p_buffer[j + 0], p_buffer[j + 1], p_buffer[j + 2], p_buffer[j + 3]);
ocomeni 103:7b566b522427 356 }
ocomeni 103:7b566b522427 357 else if (rem == 3)
ocomeni 103:7b566b522427 358 {
ocomeni 103:7b566b522427 359 dbg_printf(LOG, "[%3d]: %02x %02x %02x", j,
ocomeni 103:7b566b522427 360 p_buffer[j + 0], p_buffer[j + 1], p_buffer[j + 2]);
ocomeni 103:7b566b522427 361 }
ocomeni 103:7b566b522427 362 else if (rem == 2)
ocomeni 103:7b566b522427 363 {
ocomeni 103:7b566b522427 364 dbg_printf(LOG, "[%3d]: %02x %02x", j, p_buffer[j + 0], p_buffer[j + 1]);
ocomeni 103:7b566b522427 365 }
ocomeni 103:7b566b522427 366 else if (rem == 1)
ocomeni 103:7b566b522427 367 {
ocomeni 103:7b566b522427 368 dbg_printf(LOG, "[%3d]: %02x", j, p_buffer[j]);
ocomeni 103:7b566b522427 369 }
ocomeni 103:7b566b522427 370
ocomeni 103:7b566b522427 371 dbg_printf(LOG, "");
ocomeni 103:7b566b522427 372 }