Simple USBHost WebCam for EA LPC4088 QSB/LPC1768 test program

Dependencies:   LPC4088-USBHost mbed

EA LPC4088 QSB/LPC1768をUSBホストにしてWebカメラからJPEG画像を読み取るテストプログラムです。

The usage is the same as KL46Z-USBHostC270_example.
使い方はKL46Z-USBHostC270_exampleと同じです。
動作確認: Logitech C270,Logitech Q200R(Qcam Orbit AF)
/media/uploads/va009039/lpc4088-c270-480x360.jpg

Committer:
va009039
Date:
Thu Apr 24 05:38:45 2014 +0000
Revision:
0:c972ee42b455
first commit,sync rev.29.

Who changed what in which revision?

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