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.
Fork of F401RE-USBHost by
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 #endif 00024 #ifndef DEBUG2 00025 #define DEBUG2 0 00026 #endif 00027 #define DEBUG_TRANSFER 0 00028 #define DEBUG_EP_STATE 0 00029 #define DEBUG_EVENT 0 00030 00031 #if (DEBUG > 3) 00032 #define USB_DBG(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0); 00033 //#define USB_DBG(x, ...) std::printf("[USB_DBG: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00034 #define USB_DBG_HEX(A,B) debug_hex(A,B) 00035 extern void debug_hex(uint8_t* buf, int size); 00036 #define USB_DBG_ERRSTAT() report.print_errstat(); 00037 #else 00038 #define USB_DBG(x, ...) 00039 #define USB_DBG_HEX(A,B) while(0) 00040 #define USB_DBG_ERRSTAT() while(0) 00041 #endif 00042 00043 #if (DEBUG2 > 3) 00044 #define USB_DBG2(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0); 00045 #else 00046 #define USB_DBG2(...) while(0); 00047 #endif 00048 00049 #if (DEBUG > 2) 00050 #define USB_INFO(...) do{fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");}while(0); 00051 //#define USB_INFO(x, ...) std::printf("[USB_INFO: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00052 #else 00053 #define USB_INFO(x, ...) 00054 #endif 00055 00056 #if (DEBUG > 1) 00057 #define USB_WARN(x, ...) std::printf("[USB_WARNING: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00058 #else 00059 #define USB_WARN(x, ...) 00060 #endif 00061 00062 #if (DEBUG > 0) 00063 #define USB_ERR(x, ...) std::printf("[USB_ERR: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00064 #else 00065 #define USB_ERR(x, ...) 00066 #endif 00067 00068 #if (DEBUG_TRANSFER) 00069 #define USB_DBG_TRANSFER(x, ...) std::printf("[USB_TRANSFER: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00070 #else 00071 #define USB_DBG_TRANSFER(x, ...) 00072 #endif 00073 00074 #if (DEBUG_EVENT) 00075 #define USB_DBG_EVENT(x, ...) std::printf("[USB_EVENT: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__); 00076 #else 00077 #define USB_DBG_EVENT(x, ...) 00078 #endif 00079 00080 #ifdef _USB_TEST 00081 #define USB_TEST_ASSERT(A) while(!(A)){fprintf(stderr,"\n\n%s@%d %s ASSERT!\n\n",__PRETTY_FUNCTION__,__LINE__,#A);exit(1);}; 00082 #define USB_TEST_ASSERT_FALSE(A) USB_TEST_ASSERT(!(A)) 00083 #else 00084 #define USB_TEST_ASSERT(A) while(0) 00085 #define USB_TEST_ASSERT_FALSE(A) while(0) 00086 #endif 00087 00088 #endif 00089
Generated on Tue Jul 12 2022 21:43:28 by
1.7.2
