diff options
| author | hathach <[email protected]> | 2013-05-14 21:32:13 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-05-14 21:32:13 +0700 |
| commit | 40503b913b1f45dd5b508b134ec39b0febca6e93 (patch) | |
| tree | 51c59e7e6ec5073652c30a7082f0e02a26b49ae5 | |
| parent | f8d1c3da3ea65853bed37a22d438407df95c75f8 (diff) | |
abstract os priority for application tasks
| -rw-r--r-- | demos/host/host_freertos/.cproject | 16 | ||||
| -rw-r--r-- | demos/host/host_freertos/app_os_prio.h | 70 | ||||
| -rw-r--r-- | demos/host/host_os_none/.cproject | 3 | ||||
| -rw-r--r-- | demos/host/src/keyboard_app.c | 1 | ||||
| -rw-r--r-- | demos/host/src/main.c | 2 | ||||
| -rw-r--r-- | demos/host/src/mouse_app.c | 1 | ||||
| -rw-r--r-- | demos/host/src/tusb_config.h | 2 | ||||
| -rw-r--r-- | tinyusb/class/hid_host.c | 11 | ||||
| -rw-r--r-- | tinyusb/class/hid_host.h | 7 |
9 files changed, 99 insertions, 14 deletions
diff --git a/demos/host/host_freertos/.cproject b/demos/host/host_freertos/.cproject index 8ca8d5fbb..c2dd0a6e9 100644 --- a/demos/host/host_freertos/.cproject +++ b/demos/host/host_freertos/.cproject @@ -40,15 +40,13 @@ <listOptionValue builtIn="false" value="BOARD=BOARD_NGX4330"/> <listOptionValue builtIn="false" value="TUSB_CFG_OS=TUSB_OS_FREERTOS"/> <listOptionValue builtIn="false" value="TUSB_CFG_OS_TASK_PRIO=(configMAX_PRIORITIES-5)"/> - <listOptionValue builtIn="false" value="KEYBOARD_APP_TASK_PRIO=(configMAX_PRIORITIES-6)"/> - <listOptionValue builtIn="false" value="MOUSE_APP_TASK_PRIO=(configMAX_PRIORITIES-7)"/> - <listOptionValue builtIn="false" value="LED_BLINKING_APP_TASK_PRIO=tskIDLE_PRIORITY+1"/> <listOptionValue builtIn="false" value="DEBUG"/> <listOptionValue builtIn="false" value="__CODE_RED"/> </option> <option id="gnu.c.compiler.option.misc.other.898778785" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/> <option id="gnu.c.compiler.option.include.paths.970795437" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos/freertos/Source/include}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp}""/> @@ -78,8 +76,8 @@ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/> <listOptionValue builtIn="false" value="--gc-sections"/> </option> - <option id="gnu.c.link.option.libs.1088600788" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs"/> - <option id="gnu.c.link.option.paths.1352371726" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths"/> + <option id="gnu.c.link.option.libs.1088600788" name="Libraries (-l)" superClass="gnu.c.link.option.libs"/> + <option id="gnu.c.link.option.paths.1352371726" name="Library search path (-L)" superClass="gnu.c.link.option.paths"/> <option id="com.crt.advproject.link.gcc.hdrlib.1912639139" name="Use C library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.semihost" valueType="enumerated"/> <option id="com.crt.advproject.link.fpu.1071054814" name="Floating point" superClass="com.crt.advproject.link.fpu" value="com.crt.advproject.link.fpu.fpv4" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1768732506" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> @@ -703,15 +701,13 @@ <listOptionValue builtIn="false" value="BOARD=BOARD_EA4357"/> <listOptionValue builtIn="false" value="TUSB_CFG_OS=TUSB_OS_FREERTOS"/> <listOptionValue builtIn="false" value="TUSB_CFG_OS_TASK_PRIO=(configMAX_PRIORITIES-5)"/> - <listOptionValue builtIn="false" value="KEYBOARD_APP_TASK_PRIO=(configMAX_PRIORITIES-6)"/> - <listOptionValue builtIn="false" value="MOUSE_APP_TASK_PRIO=(configMAX_PRIORITIES-7)"/> - <listOptionValue builtIn="false" value="LED_BLINKING_APP_TASK_PRIO=tskIDLE_PRIORITY+1"/> <listOptionValue builtIn="false" value="DEBUG"/> <listOptionValue builtIn="false" value="__CODE_RED"/> </option> <option id="gnu.c.compiler.option.misc.other.740032111" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/> <option id="gnu.c.compiler.option.include.paths.967143576" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos/freertos/Source/include}""/> @@ -741,8 +737,8 @@ <listOptionValue builtIn="false" value="-Map="${BuildArtifactFileBaseName}.map""/> <listOptionValue builtIn="false" value="--gc-sections"/> </option> - <option id="gnu.c.link.option.libs.1825587478" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs"/> - <option id="gnu.c.link.option.paths.916077707" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths"/> + <option id="gnu.c.link.option.libs.1825587478" name="Libraries (-l)" superClass="gnu.c.link.option.libs"/> + <option id="gnu.c.link.option.paths.916077707" name="Library search path (-L)" superClass="gnu.c.link.option.paths"/> <option id="com.crt.advproject.link.gcc.hdrlib.1015545513" name="Use C library" superClass="com.crt.advproject.link.gcc.hdrlib" value="com.crt.advproject.gcc.link.hdrlib.codered.nohost" valueType="enumerated"/> <option id="com.crt.advproject.link.fpu.834301167" name="Floating point" superClass="com.crt.advproject.link.fpu" value="com.crt.advproject.link.fpu.fpv4" valueType="enumerated"/> <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.388300407" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> diff --git a/demos/host/host_freertos/app_os_prio.h b/demos/host/host_freertos/app_os_prio.h new file mode 100644 index 000000000..25af31f6a --- /dev/null +++ b/demos/host/host_freertos/app_os_prio.h @@ -0,0 +1,70 @@ +/**************************************************************************/ +/*! + @file app_os_prio.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, hathach (tinyusb.org) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This file is part of the tinyusb stack. +*/ +/**************************************************************************/ + +/** \file + * \brief TBD + * + * \note TBD + */ + +/** \ingroup TBD + * \defgroup TBD + * \brief TBD + * + * @{ + */ + +#ifndef _TUSB_APP_OS_PRIO_H_ +#define _TUSB_APP_OS_PRIO_H_ + + +#ifdef __cplusplus + extern "C" { +#endif + +#define KEYBOARD_APP_TASK_PRIO (TUSB_CFG_OS_TASK_PRIO-1) +#define MOUSE_APP_TASK_PRIO (KEYBOARD_APP_TASK_PRIO-1) +#define LED_BLINKING_APP_TASK_PRIO (tskIDLE_PRIORITY+1) + +#ifdef __cplusplus + } +#endif + +#endif /* _TUSB_APP_OS_PRIO_H_ */ + +/** @} */ diff --git a/demos/host/host_os_none/.cproject b/demos/host/host_os_none/.cproject index 31324ae82..0ddc27c3d 100644 --- a/demos/host/host_os_none/.cproject +++ b/demos/host/host_os_none/.cproject @@ -45,6 +45,7 @@ <option id="gnu.c.compiler.option.misc.other.898778785" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/> <option id="gnu.c.compiler.option.include.paths.970795437" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/tinyusb}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> @@ -1149,6 +1150,7 @@ <option id="gnu.c.compiler.option.misc.other.740032111" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/> <option id="gnu.c.compiler.option.include.paths.967143576" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/tinyusb}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> @@ -2256,6 +2258,7 @@ <option id="gnu.c.compiler.option.misc.other.1668294800" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections" valueType="string"/> <option id="gnu.c.compiler.option.include.paths.1253844820" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp/lpc43xx/CMSISv2p10_LPC43xx_DriverLib/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/bsp}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/tinyusb}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> diff --git a/demos/host/src/keyboard_app.c b/demos/host/src/keyboard_app.c index 010ad4dcd..34c0c07a2 100644 --- a/demos/host/src/keyboard_app.c +++ b/demos/host/src/keyboard_app.c @@ -40,6 +40,7 @@ // INCLUDE //--------------------------------------------------------------------+ #include "keyboard_app.h" +#include "app_os_prio.h" #if TUSB_CFG_HOST_HID_KEYBOARD diff --git a/demos/host/src/main.c b/demos/host/src/main.c index 4ac0e164e..8df3c76da 100644 --- a/demos/host/src/main.c +++ b/demos/host/src/main.c @@ -46,6 +46,8 @@ #include "boards/board.h" #include "tusb.h" +#include "app_os_prio.h" + #include "mouse_app.h" #include "keyboard_app.h" diff --git a/demos/host/src/mouse_app.c b/demos/host/src/mouse_app.c index 4456aba67..b5a48119d 100644 --- a/demos/host/src/mouse_app.c +++ b/demos/host/src/mouse_app.c @@ -40,6 +40,7 @@ // INCLUDE //--------------------------------------------------------------------+ #include "mouse_app.h" +#include "app_os_prio.h" #if TUSB_CFG_HOST_HID_MOUSE diff --git a/demos/host/src/tusb_config.h b/demos/host/src/tusb_config.h index 2297a6213..580870fc4 100644 --- a/demos/host/src/tusb_config.h +++ b/demos/host/src/tusb_config.h @@ -76,7 +76,7 @@ #define TUSB_CFG_HOST_HID_KEYBOARD 1 #define TUSB_CFG_HOST_HID_MOUSE 1 #define TUSB_CFG_HOST_HID_GENERIC 0 -#define TUSB_CFG_HOST_MSC 1 +#define TUSB_CFG_HOST_MSC 0 //--------------------------------------------------------------------+ // DEVICE CONFIGURATION diff --git a/tinyusb/class/hid_host.c b/tinyusb/class/hid_host.c index a45861006..296d26ee0 100644 --- a/tinyusb/class/hid_host.c +++ b/tinyusb/class/hid_host.c @@ -170,6 +170,17 @@ tusb_interface_status_t tusbh_hid_mouse_status(uint8_t dev_addr, uint8_t instanc #endif //--------------------------------------------------------------------+ +// GENERIC +//--------------------------------------------------------------------+ +#if TUSB_CFG_HOST_HID_GENERIC + +//STATIC_ struct { +// hidh_interface_info_t +//} generic_data[TUSB_CFG_HOST_DEVICE_MAX]; + +#endif + +//--------------------------------------------------------------------+ // CLASS-USBD API (don't require to verify parameters) //--------------------------------------------------------------------+ void hidh_init(void) diff --git a/tinyusb/class/hid_host.h b/tinyusb/class/hid_host.h index b67a20425..bf13826af 100644 --- a/tinyusb/class/hid_host.h +++ b/tinyusb/class/hid_host.h @@ -78,9 +78,10 @@ void tusbh_hid_mouse_isr(uint8_t dev_addr, uint8_t instance_num, tusb_event_t ev // GENERIC Application API //--------------------------------------------------------------------+ bool tusbh_hid_generic_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT; -tusb_error_t tusbh_hid_generic_get_report(uint8_t dev_addr, uint8_t instance_num, void* report) ATTR_WARN_UNUSED_RESULT; -tusb_error_t tusbh_hid_generic_set_report(uint8_t dev_addr, uint8_t instance_num, void* report) ATTR_WARN_UNUSED_RESULT; -tusb_interface_status_t tusbh_hid_generic_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT; +tusb_error_t tusbh_hid_generic_get_report(uint8_t dev_addr, uint8_t instance_num, void* report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; +tusb_error_t tusbh_hid_generic_set_report(uint8_t dev_addr, uint8_t instance_num, void* report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; +tusb_interface_status_t tusbh_hid_generic_get_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT; +tusb_interface_status_t tusbh_hid_generic_set_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT; //------------- Application Callback -------------// void tusbh_hid_generic_isr(uint8_t dev_addr, uint8_t instance_num, tusb_event_t event) ATTR_WEAK; |
