⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dump.c

📁 freescale ppc sec2加解密单元驱动
💻 C
字号:
/**************************************************************************** * dump.c - Memory dumper for SEC2 driver tests **************************************************************************** * Copyright (c) 2004-2005 Freescale Semiconductor * All Rights Reserved. Proprietary and Confidential. * * NOTICE: The information contained in this file is proprietary * to Freescale Semiconductor, and is being made available to * Freescale's customers under strict license agreements. * Use or disclosure of this information is permissible only * under the terms of the existing license agreement. ***************************************************************************//* Revision History: *  1.1.0 Dec 05,2004 sec - prep for release *  1.2   02-Feb-2005 sec - fix output bug */#ifdef _LINUX_USERMODE_#include <memory.h> /* memcpy(), memset() */#include <stdio.h>  /* printf() */#endif#ifdef __KERNEL__#define printf printk#include <memory.h>#endif#ifdef VXWORKS#include <vxWorks.h>#endifvoid dumpm(unsigned char *csData, int nBytes){    int nHex, nAscii;    int nIndex;    char csOutputBuffer[80];    char *csLocalPtr;    if (csData == NULL) {        printf("00000000 Null pointer passed to dumpm()\n");        return;    }    nHex = nAscii = 0;    for (nIndex = 0; nIndex < nBytes; nIndex++) {        if (nIndex % 16 == 0) {            csOutputBuffer[nAscii] = 0;            if (nHex) printf("%s\n", csOutputBuffer);            memset(csOutputBuffer, ' ', sizeof(csOutputBuffer) - 1);            csLocalPtr = csData + nIndex;            sprintf(csOutputBuffer, "%08x", (unsigned long)csLocalPtr);            csOutputBuffer[8] = ' ';            nHex = 11;            nAscii = 63;        }        sprintf(&csOutputBuffer[nHex], "%02x", csData[nIndex]);        csOutputBuffer[nHex+2] = ' ';        if (csData[nIndex] >= 0x20 && csData[nIndex] < 0x7f)            csOutputBuffer[nAscii] = csData[nIndex];        else            csOutputBuffer[nAscii] = '.';        nAscii++, nHex += 3;        if (nIndex % 16 == 7)            nHex += 2;    }        if (nHex > 11) {        csOutputBuffer[nAscii] = 0;        printf("%s\n", csOutputBuffer);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -