final

Dependencies:   mbed FATFileSystem

Fork of KL46Z-USBHostMSD_HelloWorld by Norimasa Okamoto

Committer:
homzovam
Date:
Sat Apr 04 20:16:39 2015 +0000
Revision:
4:77d6450f34d7
prijimac-funkcni final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
homzovam 4:77d6450f34d7 1 /* mbed USBHost Library
homzovam 4:77d6450f34d7 2 * Copyright (c) 2006-2013 ARM Limited
homzovam 4:77d6450f34d7 3 *
homzovam 4:77d6450f34d7 4 * Licensed under the Apache License, Version 2.0 (the "License");
homzovam 4:77d6450f34d7 5 * you may not use this file except in compliance with the License.
homzovam 4:77d6450f34d7 6 * You may obtain a copy of the License at
homzovam 4:77d6450f34d7 7 *
homzovam 4:77d6450f34d7 8 * http://www.apache.org/licenses/LICENSE-2.0
homzovam 4:77d6450f34d7 9 *
homzovam 4:77d6450f34d7 10 * Unless required by applicable law or agreed to in writing, software
homzovam 4:77d6450f34d7 11 * distributed under the License is distributed on an "AS IS" BASIS,
homzovam 4:77d6450f34d7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
homzovam 4:77d6450f34d7 13 * See the License for the specific language governing permissions and
homzovam 4:77d6450f34d7 14 * limitations under the License.
homzovam 4:77d6450f34d7 15 */
homzovam 4:77d6450f34d7 16
homzovam 4:77d6450f34d7 17 #ifndef USB_DEBUG_H
homzovam 4:77d6450f34d7 18 #define USB_DEBUG_H
homzovam 4:77d6450f34d7 19
homzovam 4:77d6450f34d7 20 //Debug is disabled by default
homzovam 4:77d6450f34d7 21 #ifndef DEBUG
homzovam 4:77d6450f34d7 22 #define DEBUG 3 /*INFO,ERR,WARN*/
homzovam 4:77d6450f34d7 23 #endif
homzovam 4:77d6450f34d7 24 #ifndef DEBUG2
homzovam 4:77d6450f34d7 25 #define DEBUG2 0
homzovam 4:77d6450f34d7 26 #endif
homzovam 4:77d6450f34d7 27 #define DEBUG_TRANSFER 0
homzovam 4:77d6450f34d7 28 #define DEBUG_EP_STATE 0
homzovam 4:77d6450f34d7 29 #define DEBUG_EVENT 0
homzovam 4:77d6450f34d7 30
homzovam 4:77d6450f34d7 31 #if (DEBUG > 3)
homzovam 4:77d6450f34d7 32 #define USB_DBG(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0);
homzovam 4:77d6450f34d7 33 //#define USB_DBG(x, ...) std::printf("[USB_DBG: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
homzovam 4:77d6450f34d7 34 #define USB_DBG_HEX(A,B) debug_hex(A,B)
homzovam 4:77d6450f34d7 35 extern void debug_hex(uint8_t* buf, int size);
homzovam 4:77d6450f34d7 36 #define USB_DBG_ERRSTAT() report.print_errstat();
homzovam 4:77d6450f34d7 37 #else
homzovam 4:77d6450f34d7 38 #define USB_DBG(x, ...)
homzovam 4:77d6450f34d7 39 #define USB_DBG_HEX(A,B) while(0)
homzovam 4:77d6450f34d7 40 #define USB_DBG_ERRSTAT() while(0)
homzovam 4:77d6450f34d7 41 #endif
homzovam 4:77d6450f34d7 42
homzovam 4:77d6450f34d7 43 #if (DEBUG2 > 3)
homzovam 4:77d6450f34d7 44 #define USB_DBG2(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");} while(0);
homzovam 4:77d6450f34d7 45 #else
homzovam 4:77d6450f34d7 46 #define USB_DBG2(...) while(0);
homzovam 4:77d6450f34d7 47 #endif
homzovam 4:77d6450f34d7 48
homzovam 4:77d6450f34d7 49 #if (DEBUG > 2)
homzovam 4:77d6450f34d7 50 #define USB_INFO(...) do{fprintf(stderr,__VA_ARGS__);fprintf(stderr,"\r\n");}while(0);
homzovam 4:77d6450f34d7 51 //#define USB_INFO(x, ...) std::printf("[USB_INFO: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
homzovam 4:77d6450f34d7 52 #else
homzovam 4:77d6450f34d7 53 #define USB_INFO(x, ...)
homzovam 4:77d6450f34d7 54 #endif
homzovam 4:77d6450f34d7 55
homzovam 4:77d6450f34d7 56 #if (DEBUG > 1)
homzovam 4:77d6450f34d7 57 //#define USB_WARN(x, ...) std::printf("[USB_WARNING: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
homzovam 4:77d6450f34d7 58 #else
homzovam 4:77d6450f34d7 59 #define USB_WARN(x, ...)
homzovam 4:77d6450f34d7 60 #endif
homzovam 4:77d6450f34d7 61
homzovam 4:77d6450f34d7 62 #if (DEBUG > 0)
homzovam 4:77d6450f34d7 63 //#define USB_ERR(x, ...) std::printf("[USB_ERR: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
homzovam 4:77d6450f34d7 64 #else
homzovam 4:77d6450f34d7 65 #define USB_ERR(x, ...)
homzovam 4:77d6450f34d7 66 #endif
homzovam 4:77d6450f34d7 67
homzovam 4:77d6450f34d7 68 #if (DEBUG_TRANSFER)
homzovam 4:77d6450f34d7 69 //#define USB_DBG_TRANSFER(x, ...) std::printf("[USB_TRANSFER: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
homzovam 4:77d6450f34d7 70 #else
homzovam 4:77d6450f34d7 71 #define USB_DBG_TRANSFER(x, ...)
homzovam 4:77d6450f34d7 72 #endif
homzovam 4:77d6450f34d7 73
homzovam 4:77d6450f34d7 74 #if (DEBUG_EVENT)
homzovam 4:77d6450f34d7 75 //#define USB_DBG_EVENT(x, ...) std::printf("[USB_EVENT: %s:%d]" x "\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
homzovam 4:77d6450f34d7 76 #else
homzovam 4:77d6450f34d7 77 #define USB_DBG_EVENT(x, ...)
homzovam 4:77d6450f34d7 78 #endif
homzovam 4:77d6450f34d7 79
homzovam 4:77d6450f34d7 80 template <bool>struct CtAssert;
homzovam 4:77d6450f34d7 81 template <>struct CtAssert<true> {};
homzovam 4:77d6450f34d7 82 #define CTASSERT(A) CtAssert<A>();
homzovam 4:77d6450f34d7 83
homzovam 4:77d6450f34d7 84 #ifdef _USB_TEST
homzovam 4:77d6450f34d7 85 #define USB_TEST_ASSERT(A) while(!(A)){fprintf(stderr,"\n\n%s@%d %s ASSERT!\n\n",__PRETTY_FUNCTION__,__LINE__,#A);exit(1);};
homzovam 4:77d6450f34d7 86 #define USB_TEST_ASSERT_FALSE(A) USB_TEST_ASSERT(!(A))
homzovam 4:77d6450f34d7 87 #else
homzovam 4:77d6450f34d7 88 #define USB_TEST_ASSERT(A) while(0)
homzovam 4:77d6450f34d7 89 #define USB_TEST_ASSERT_FALSE(A) while(0)
homzovam 4:77d6450f34d7 90 #endif
homzovam 4:77d6450f34d7 91
homzovam 4:77d6450f34d7 92 #endif
homzovam 4:77d6450f34d7 93