Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
dbg.h
00001 /* mbed USBHost Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef USB_DEBUG_H 00018 #define USB_DEBUG_H 00019 00020 //Debug is disabled by default 00021 #ifndef DEBUG 00022 //#define DEBUG 3 /*INFO,ERR,WARN*/ 00023 #define DEBUG 0 00024 #endif 00025 #ifndef DEBUG2 00026 #define DEBUG2 0 00027 #endif 00028 #define DEBUG_TRANSFER 0 00029 #define DEBUG_EP_STATE 0 00030 #define DEBUG_EVENT 0 00031 00032 #if (DEBUG > 3) 00033 #define USB_DBG(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0); 00034 //#define USB_DBG(x, ...) std::printf("[USB_DBG: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00035 #define USB_DBG_HEX(A,B) debug_hex(A,B) 00036 extern void debug_hex(uint8_t* buf, int size); 00037 #define USB_DBG_ERRSTAT() report.print_errstat(); 00038 #else 00039 #define USB_DBG(x, ...) 00040 #define USB_DBG_HEX(A,B) while(0) 00041 #define USB_DBG_ERRSTAT() while(0) 00042 #endif 00043 00044 #if (DEBUG2 > 3) 00045 #define USB_DBG2(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0); 00046 #else 00047 #define USB_DBG2(...) while(0); 00048 #endif 00049 00050 #if (DEBUG > 2) 00051 #define USB_INFO(...) do{fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");}while(0); 00052 //#define USB_INFO(x, ...) std::printf("[USB_INFO: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00053 #else 00054 #define USB_INFO(x, ...) 00055 #endif 00056 00057 #if (DEBUG > 1) 00058 #define USB_WARN(x, ...) std::printf("[USB_WARNING: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00059 #else 00060 #define USB_WARN(x, ...) 00061 #endif 00062 00063 #if (DEBUG > 0) 00064 #define USB_ERR(x, ...) std::printf("[USB_ERR: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00065 #else 00066 #define USB_ERR(x, ...) 00067 #endif 00068 00069 #if (DEBUG_TRANSFER) 00070 #define USB_DBG_TRANSFER(x, ...) std::printf("[USB_TRANSFER: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00071 #else 00072 #define USB_DBG_TRANSFER(x, ...) 00073 #endif 00074 00075 #if (DEBUG_EVENT) 00076 #define USB_DBG_EVENT(x, ...) std::printf("[USB_EVENT: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00077 #else 00078 #define USB_DBG_EVENT(x, ...) 00079 #endif 00080 00081 #ifdef _USB_TEST 00082 #define USB_TEST_ASSERT(A) while(!(A)){fprintf(stderr,"\n\n%s@%d %s ASSERT!\n\n",__PRETTY_FUNCTION__,__LINE__,#A);exit(1);}; 00083 #define USB_TEST_ASSERT_FALSE(A) USB_TEST_ASSERT(!(A)) 00084 #else 00085 #define USB_TEST_ASSERT(A) while(0) 00086 #define USB_TEST_ASSERT_FALSE(A) while(0) 00087 #endif 00088 00089 #endif 00090 00091
Generated on Thu Jul 14 2022 09:06:30 by
