Adaptation of the official mbed USBHost repository to work with the LPC4088 Display Module

Dependents:   DMSupport DMSupport DMSupport DMSupport

Fork of DM_USBHost by EmbeddedArtists AB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dbg.h Source File

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 #include "DMBoard.h" // To replace the std::printf calls
00021 
00022 //Debug is disabled by default
00023 #define DEBUG 2 /*ERR,WARN*/
00024 #define DEBUG_TRANSFER 0
00025 #define DEBUG_EP_STATE 0
00026 #define DEBUG_EVENT 0
00027 
00028 #if (DEBUG > 3)
00029 #define USB_DBG(x, ...) DMBoard::instance().logger()->printf("[USB_DBG: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
00030 #define USB_DBG_X(...)  DMBoard::instance().logger()->printf(__VA_ARGS__)
00031 #else
00032 #define USB_DBG(x, ...)
00033 #endif
00034 
00035 #if (DEBUG > 2)
00036 #define USB_INFO(x, ...) DMBoard::instance().logger()->printf("[USB_INFO: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
00037 #else
00038 #define USB_INFO(x, ...)
00039 #endif
00040 
00041 #if (DEBUG > 1)
00042 #define USB_WARN(x, ...) DMBoard::instance().logger()->printf("[USB_WARNING: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
00043 #else
00044 #define USB_WARN(x, ...)
00045 #endif
00046 
00047 #if (DEBUG > 0)
00048 #define USB_ERR(x, ...) DMBoard::instance().logger()->printf("[USB_ERR: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
00049 #else
00050 #define USB_ERR(x, ...)
00051 #endif
00052 
00053 #if (DEBUG_TRANSFER)
00054 #define USB_DBG_TRANSFER(x, ...) DMBoard::instance().logger()->printf("[USB_TRANSFER: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
00055 #else
00056 #define USB_DBG_TRANSFER(x, ...)
00057 #endif
00058 
00059 #if (DEBUG_EVENT)
00060 #define USB_DBG_EVENT(x, ...) DMBoard::instance().logger()->printf("[USB_EVENT: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__)
00061 #else
00062 #define USB_DBG_EVENT(x, ...)
00063 #endif
00064 
00065 
00066 void assert_mem_region(uint32_t ptr);
00067 #define ASSERT_MEM_REGION(__x) assert_mem_region((uint32_t)(__x))
00068 
00069 #endif
00070