Embed:
(wiki syntax)
Show/hide line numbers
debug.c
00001 /** 00002 * @file debug.c 00003 * @brief Debugging facilities 00004 * 00005 * @section License 00006 * 00007 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * as published by the Free Software Foundation; either version 2 00012 * of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software Foundation, 00021 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00022 * 00023 * @author Oryx Embedded SARL (www.oryx-embedded.com) 00024 * @version 1.7.6 00025 **/ 00026 00027 //Dependencies 00028 #include "debug.h" 00029 00030 00031 /** 00032 * @brief Display the contents of an array 00033 * @param[in] stream Pointer to a FILE object that identifies an output stream 00034 * @param[in] prepend String to prepend to the left of each line 00035 * @param[in] data Pointer to the data array 00036 * @param[in] length Number of bytes to display 00037 **/ 00038 00039 void debugDisplayArray(FILE *stream, 00040 const char_t *prepend, const void *data, size_t length) 00041 { 00042 uint_t i; 00043 00044 for(i = 0; i < length; i++) 00045 { 00046 //Beginning of a new line? 00047 if((i % 16) == 0) 00048 fprintf(stream, "%s", prepend); 00049 //Display current data byte 00050 fprintf(stream, "%02" PRIX8 " ", *((uint8_t *) data + i)); 00051 //End of current line? 00052 if((i % 16) == 15 || i == (length - 1)) 00053 fprintf(stream, "\r\n"); 00054 } 00055 } 00056
Generated on Tue Jul 12 2022 17:10:12 by
