Simple USBHost library for STM32F746NG Discovery board. Only either the Fastspeed or the Highspeed port can be used( not both together)

Dependents:   DISCO-F746NG_USB_Host

Fork of KL46Z-USBHost by Norimasa Okamoto

Committer:
DieterGraef
Date:
Fri Jun 17 09:00:35 2016 +0000
Revision:
25:7d6d9fc471bf
Parent:
24:5396b6a93262
USB Host now works with both Interfaces even in parallel. Some changes in the USB MSD driver to make it operable

Who changed what in which revision?

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