USB host library, support isochronous,bulk,interrupt and control.

Dependents:   BaseUsbHost_example BaseJpegDecode_example SimpleJpegDecode_example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BaseUsbHostDebug.h Source File

BaseUsbHostDebug.h

00001 // BaseUsbHostDebug.h 2013/1/2
00002 #pragma once
00003 
00004 #ifdef DEBUG
00005 #define DBG(...) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);fprintf(stderr,__VA_ARGS__);} while(0);
00006 #define DBG_PRINTF(...) do{fprintf(stderr,__VA_ARGS__);}while(0);
00007 #define DBG_TD(A) do{fprintf(stderr,"[%s@%d]\n",__PRETTY_FUNCTION__,__LINE__);print_td(stderr,A);}while(0);
00008 #define DBG_ED(A) do{fprintf(stderr,"[%s@%d]\n",__PRETTY_FUNCTION__,__LINE__);print_ed(stderr,A);}while(0);
00009 #define DBG_ITD(A) do{fprintf(stderr,"[%s@%d]\n",__PRETTY_FUNCTION__,__LINE__);print_itd(stderr,A);}while(0);
00010 #define DBG_IED(A) do{fprintf(stderr,"[%s@%d]\n",__PRETTY_FUNCTION__,__LINE__);print_ied(stderr,A);}while(0);
00011 #define DBG_BYTES(A,B,C) do{fprintf(stderr,"[%s@%d] ",__PRETTY_FUNCTION__,__LINE__);print_bytes(stderr,A,B,C);}while(0);
00012 #define DBG_HEX(A,B) do{fprintf(stderr,"[%s@%d]\n",__PRETTY_FUNCTION__,__LINE__);print_hex(stderr,A,B);}while(0);
00013 #define DBG_OHCI(A) do{fprintf(stderr,"[%s@%d] %s: %08X\n",__PRETTY_FUNCTION__,__LINE__,#A,A);}while(0);
00014 #else //DEBUG
00015 #define DBG(...)  while(0);
00016 #define DBG_PRINTF(...) while(0);
00017 #define DBG_TD(A) while(0);
00018 #define DBG_ED(A) while(0);
00019 #define DBG_ITD(A) while(0);
00020 #define DBG_IED(A) while(0);
00021 #define DBG_BYTES(A,B,C) while(0);
00022 #define DBG_HEX(A,B) while(0);
00023 #define DBG_OHCI(A) while(0);
00024 #endif //DEBUG
00025 
00026 void print_td(FILE* stream, HCTD* td);
00027 void print_ed(FILE* stream, HCED* ed);
00028 void print_itd(FILE* stream, HCITD* itd);
00029 void print_ied(FILE* stream, HCED* ed);
00030 void print_bytes(FILE* stream, char* s, uint8_t* buf, int len);
00031 void print_hex(FILE* stream, uint8_t* p, int len);