diff options
| author | William D. Jones <[email protected]> | 2019-01-10 09:58:06 -0500 |
|---|---|---|
| committer | William D. Jones <[email protected]> | 2019-01-10 09:58:06 -0500 |
| commit | b367baeaf1d64930654f136a2409f1322fc73ab2 (patch) | |
| tree | 710698145d52c72b807971d05512330fde2cc9b1 /examples/obsolete/host | |
| parent | e4d6f336f0d5004fd9ee3074305b7980ba777dfd (diff) | |
| parent | 5804e56e3c2ab4480bf72d94d997f769a645af47 (diff) | |
Merge branch 'master' of https://github.com/hathach/tinyusb into stm32f4
Diffstat (limited to 'examples/obsolete/host')
| -rw-r--r-- | examples/obsolete/host/readme.md | 95 | ||||
| -rw-r--r-- | examples/obsolete/host/src/cdc_serial_host_app.c | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/cdc_serial_host_app.h | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/keyboard_host_app.c | 4 | ||||
| -rw-r--r-- | examples/obsolete/host/src/keyboard_host_app.h | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/main.c | 10 | ||||
| -rw-r--r-- | examples/obsolete/host/src/mouse_host_app.c | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/mouse_host_app.h | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/msc_cli.c | 4 | ||||
| -rw-r--r-- | examples/obsolete/host/src/msc_host_app.c | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/msc_host_app.h | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/rndis_host_app.c | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/rndis_host_app.h | 2 | ||||
| -rw-r--r-- | examples/obsolete/host/src/tusb_config.h | 12 |
14 files changed, 23 insertions, 120 deletions
diff --git a/examples/obsolete/host/readme.md b/examples/obsolete/host/readme.md deleted file mode 100644 index 1b6dd8302..000000000 --- a/examples/obsolete/host/readme.md +++ /dev/null @@ -1,95 +0,0 @@ -# Host Demos # - -<!-- START doctoc generated TOC please keep comment here to allow auto update --> -<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> -**Table of Contents** - -- [Prerequisites](#prerequisites) -- [Hub](#hub) -- [Human Interface Device (HID)](#human-interface-device-hid) - - [Keyboard](#keyboard) - - [Mouse](#mouse) -- [Mass Storage Class Device (MSC)](#mass-storage-class-device-msc) -- [Communication Class Device (CDC)](#communication-class-device-cdc) - - [Serial](#serial) - -<!-- END doctoc generated TOC please keep comment here to allow auto update --> - -host application code is store at *demos/host/src* containing - -File | Description ------ | ------------- -main.c | Initialization (board, stack) and a RTOS task scheduler call or just simple a indefinite loop for non OS to invoke class-specific tasks. -tusb_config.h | tinyusb stack configuration. -app_os_prio.h | RTOS task priority definitions -Class-specific | Application files for supported classes. - -Firstly connect your ansi-escaped supported terminal (see below) to the UART of the evaluation board since all the user interaction happens there. The default UART configure is -- Baudrate = 115200 -- Data = 8 bits -- Parity = none -- Stop = 1 bit -- Flow control = none - -The demo will start with the greeting of enabled classes and chosen RTOS then start to blink an LED at 1 Hz. When any of supported devices is plugged or un-plugged either directly or via a hub, demo application will print out a short message. Notes: if usb device is composed of supported and unsupported classes such as a keyboard and a camera, the keyboard interface is still mounted as usual without any issues. - -**NOTE** Host demo is quite power hunger, especially when you plug a hub with several devices on it. Make sure you have enough power before filing any bugs. - -## Prerequisites ## - -In order to run application demo, you would need - -- A [supported development board](../../boards/readme.md). -- A supported toolchain: LPCXpresso, Keil, IAR. -- A [ANSI escape](http://en.wikipedia.org/wiki/ANSI_escape_code) supported terminal such as [Tera Term](http://en.sourceforge.jp/projects/ttssh2/) to demonstrate properly. - -## Hub - -Hub is internally handled by tinyusb stack, application code does not have to worry on how to get hub operated. However, application must be written to handle multiple devices simultaneously. - -## Human Interface Device (HID) - -### Keyboard - -When a keyboard device is enumerated, any keys pressed on the device will be echoed to the UART terminal. - - - -### Mouse - -When a mouse device is enumerated, any movements or clicks on the device will be reflected on the terminal. Only make sure the terminal's windows is active on your host OS and it supports ANSI escape code. - - - -## Mass Storage Class Device (MSC) - -Mass storage demo application only supports device with FAT file system by the help of fatfs (source in *vendor/fatfs*). In addition, it also includes a minimal command line interface *msc_cli.c* to allow user to navigate and execute several basic file operations. When mass storage device is plugged, CLI will be activated, type "help" for the usage. Some are - -Command | Description ------ | ------------- -cls | clear screen -ls | List information of the FILEs, only supported current directory. -cd | change the current directory. -cat | display contents of a file. -cp | copy files to another location. -mkdir | create a directory, if it does not already exist. -mv | rename or move a directory or a file. -rm | remove (delete) an empty directory or file - -Furthermore, the demo's CLI also supports multiple mass storage devices. You could *cd* between disk drives, and copy a file from one to another. - - - -## Communication Class Device (CDC) - -CDC has several subclass, currently tinyusb only supports the popular *Abstract Control Model (ACM)* - -### Serial - -A virtual serial of CDC-ACM is supported such as those built with tinyusb device stack. The host demo literally does 2 things -- Echo back any thing it received from the device to the terminal -- Receive data from terminal and send it to device. - -Notes: FTDI is a vendor-specific class, which is not currently supported. - - diff --git a/examples/obsolete/host/src/cdc_serial_host_app.c b/examples/obsolete/host/src/cdc_serial_host_app.c index 85604dcdf..1be2e9d8b 100644 --- a/examples/obsolete/host/src/cdc_serial_host_app.c +++ b/examples/obsolete/host/src/cdc_serial_host_app.c @@ -39,7 +39,7 @@ #include "cdc_serial_host_app.h" #include "app_os_prio.h" -#if CFG_TUSB_HOST_CDC +#if CFG_TUH_CDC #define QUEUE_SERIAL_DEPTH 100 diff --git a/examples/obsolete/host/src/cdc_serial_host_app.h b/examples/obsolete/host/src/cdc_serial_host_app.h index eef00bb55..f95cbbdab 100644 --- a/examples/obsolete/host/src/cdc_serial_host_app.h +++ b/examples/obsolete/host/src/cdc_serial_host_app.h @@ -53,7 +53,7 @@ extern "C" { #endif -#if CFG_TUSB_HOST_CDC +#if CFG_TUH_CDC void cdc_serial_host_app_init(void); void cdc_serial_host_app_task(void* param); diff --git a/examples/obsolete/host/src/keyboard_host_app.c b/examples/obsolete/host/src/keyboard_host_app.c index fd51548c3..f6cd20fda 100644 --- a/examples/obsolete/host/src/keyboard_host_app.c +++ b/examples/obsolete/host/src/keyboard_host_app.c @@ -42,7 +42,7 @@ #include "keyboard_host_app.h" #include "app_os_prio.h" -#if CFG_TUSB_HOST_HID_KEYBOARD +#if CFG_TUH_HID_KEYBOARD //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF @@ -55,7 +55,7 @@ static osal_queue_t queue_kbd_hdl; CFG_TUSB_MEM_SECTION static hid_keyboard_report_t usb_keyboard_report; -static inline uint8_t keycode_to_ascii(uint8_t modifier, uint8_t keycode) ATTR_CONST ATTR_ALWAYS_INLINE; +static inline uint8_t keycode_to_ascii(uint8_t modifier, uint8_t keycode); static inline void process_kbd_report(hid_keyboard_report_t const * report); //--------------------------------------------------------------------+ diff --git a/examples/obsolete/host/src/keyboard_host_app.h b/examples/obsolete/host/src/keyboard_host_app.h index ff20d75df..965cd45cc 100644 --- a/examples/obsolete/host/src/keyboard_host_app.h +++ b/examples/obsolete/host/src/keyboard_host_app.h @@ -59,7 +59,7 @@ extern "C" { #endif -#if CFG_TUSB_HOST_HID_KEYBOARD +#if CFG_TUH_HID_KEYBOARD void keyboard_host_app_init(void); void keyboard_host_app_task(void* param); diff --git a/examples/obsolete/host/src/main.c b/examples/obsolete/host/src/main.c index 90c64f849..5da98fb68 100644 --- a/examples/obsolete/host/src/main.c +++ b/examples/obsolete/host/src/main.c @@ -135,9 +135,9 @@ void print_greeting(void) puts("This HOST demo is configured to support:"); printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]); - if (CFG_TUSB_HOST_HUB ) puts(" - Hub (1 level only)"); - if (CFG_TUSB_HOST_HID_MOUSE ) puts(" - HID Mouse"); - if (CFG_TUSB_HOST_HID_KEYBOARD ) puts(" - HID Keyboard"); - if (CFG_TUSB_HOST_MSC ) puts(" - Mass Storage"); - if (CFG_TUSB_HOST_CDC ) puts(" - Communication Device Class"); + if (CFG_TUH_HUB ) puts(" - Hub (1 level only)"); + if (CFG_TUH_HID_MOUSE ) puts(" - HID Mouse"); + if (CFG_TUH_HID_KEYBOARD ) puts(" - HID Keyboard"); + if (CFG_TUH_MSC ) puts(" - Mass Storage"); + if (CFG_TUH_CDC ) puts(" - Communication Device Class"); } diff --git a/examples/obsolete/host/src/mouse_host_app.c b/examples/obsolete/host/src/mouse_host_app.c index 819c2b290..79af898c7 100644 --- a/examples/obsolete/host/src/mouse_host_app.c +++ b/examples/obsolete/host/src/mouse_host_app.c @@ -42,7 +42,7 @@ #include "mouse_host_app.h" #include "app_os_prio.h" -#if CFG_TUSB_HOST_HID_MOUSE +#if CFG_TUH_HID_MOUSE //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF diff --git a/examples/obsolete/host/src/mouse_host_app.h b/examples/obsolete/host/src/mouse_host_app.h index c5e9977ae..823107a5e 100644 --- a/examples/obsolete/host/src/mouse_host_app.h +++ b/examples/obsolete/host/src/mouse_host_app.h @@ -62,7 +62,7 @@ extern "C" { #endif -#if CFG_TUSB_HOST_HID_MOUSE +#if CFG_TUH_HID_MOUSE void mouse_host_app_init(void); void mouse_host_app_task(void* param); diff --git a/examples/obsolete/host/src/msc_cli.c b/examples/obsolete/host/src/msc_cli.c index 75dbb1c01..0ab42e3f1 100644 --- a/examples/obsolete/host/src/msc_cli.c +++ b/examples/obsolete/host/src/msc_cli.c @@ -39,7 +39,7 @@ #include "msc_cli.h" #include "ctype.h" -#if CFG_TUSB_HOST_MSC +#if CFG_TUH_MSC #include "ff.h" #include "diskio.h" @@ -145,7 +145,6 @@ CFG_TUSB_MEM_SECTION uint8_t fileread_buffer[CLI_FILE_READ_BUFFER]; static char cli_buffer[CLI_MAX_BUFFER]; static char volume_label[20]; -static inline void drive_number2letter(char * p_path) ATTR_ALWAYS_INLINE; static inline void drive_number2letter(char * p_path) { if (p_path[1] == ':') @@ -154,7 +153,6 @@ static inline void drive_number2letter(char * p_path) } } -static inline void drive_letter2number(char * p_path) ATTR_ALWAYS_INLINE; static inline void drive_letter2number(char * p_path) { if (p_path[1] == ':') diff --git a/examples/obsolete/host/src/msc_host_app.c b/examples/obsolete/host/src/msc_host_app.c index 1cfe9ec60..89993cefe 100644 --- a/examples/obsolete/host/src/msc_host_app.c +++ b/examples/obsolete/host/src/msc_host_app.c @@ -42,7 +42,7 @@ #include "msc_host_app.h" #include "app_os_prio.h" -#if CFG_TUSB_HOST_MSC +#if CFG_TUH_MSC #include "msc_cli.h" #include "ff.h" diff --git a/examples/obsolete/host/src/msc_host_app.h b/examples/obsolete/host/src/msc_host_app.h index c6e508e6c..0e153fc1d 100644 --- a/examples/obsolete/host/src/msc_host_app.h +++ b/examples/obsolete/host/src/msc_host_app.h @@ -54,7 +54,7 @@ extern "C" { #endif -#if CFG_TUSB_HOST_MSC +#if CFG_TUH_MSC void msc_host_app_init(void); void msc_host_app_task(void* param); diff --git a/examples/obsolete/host/src/rndis_host_app.c b/examples/obsolete/host/src/rndis_host_app.c index 5bb60182c..374e13a2a 100644 --- a/examples/obsolete/host/src/rndis_host_app.c +++ b/examples/obsolete/host/src/rndis_host_app.c @@ -39,7 +39,7 @@ #include "rndis_host_app.h" #include "app_os_prio.h" -#if CFG_TUSB_HOST_CDC && CFG_TUSB_HOST_CDC_RNDIS +#if CFG_TUH_CDC && CFG_TUH_CDC_RNDIS //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF diff --git a/examples/obsolete/host/src/rndis_host_app.h b/examples/obsolete/host/src/rndis_host_app.h index 9fa19351e..2e8437651 100644 --- a/examples/obsolete/host/src/rndis_host_app.h +++ b/examples/obsolete/host/src/rndis_host_app.h @@ -53,7 +53,7 @@ extern "C" { #endif -#if CFG_TUSB_HOST_CDC && CFG_TUSB_HOST_CDC_RNDIS +#if CFG_TUH_CDC && CFG_TUH_CDC_RNDIS void rndis_host_app_init(void); void rndis_host_app_task(void* param); diff --git a/examples/obsolete/host/src/tusb_config.h b/examples/obsolete/host/src/tusb_config.h index f39fa26b4..7a7951f89 100644 --- a/examples/obsolete/host/src/tusb_config.h +++ b/examples/obsolete/host/src/tusb_config.h @@ -54,14 +54,14 @@ //--------------------------------------------------------------------+ //------------- CLASS -------------// -#define CFG_TUSB_HOST_HUB 1 -#define CFG_TUSB_HOST_HID_KEYBOARD 1 -#define CFG_TUSB_HOST_HID_MOUSE 1 +#define CFG_TUH_HUB 1 +#define CFG_TUH_HID_KEYBOARD 1 +#define CFG_TUH_HID_MOUSE 1 #define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported) -#define CFG_TUSB_HOST_MSC 1 -#define CFG_TUSB_HOST_CDC 1 +#define CFG_TUH_MSC 1 +#define CFG_TUH_CDC 1 -#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUSB_HOST_HUB ? 5 : 1) // normal hub has 4 ports +#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports //--------------------------------------------------------------------+ // COMMON CONFIGURATION |
