4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Junhwan An <jh48.an@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
26 #include "vdpram_dump.h"
30 static void hex_dump(const char *pad, int size, const void *data)
32 char buf[255] = {0, };
35 unsigned const char *p;
38 msg("%sno data", pad);
42 p = (unsigned const char *)data;
44 snprintf(buf, sizeof(buf), "%s%04X: ", pad, 0);
45 for (i = 0; i < size; i++) {
46 snprintf(hex, 4, "%02X ", p[i]);
47 strncat(buf, hex, sizeof(buf) - strlen(buf) - 1);
49 if ((i + 1) % 8 == 0) {
50 if ((i + 1) % 16 == 0) {
53 snprintf(buf, 255, "%s%04X: ", pad, i + 1);
55 strncat(buf, TAB_SPACE, strlen(TAB_SPACE));
63 void vdpram_hex_dump(int dir, unsigned short data_len, void *data)
76 //msg(" %s\tlen=%d\t%s", d, data_len, (char *)data);
77 hex_dump(" ", data_len, (const void *)data);