diff options
| author | hathach <[email protected]> | 2013-05-25 16:03:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-05-25 16:03:40 +0700 |
| commit | ae02263d817a7b2f37c7e9c5026fd067b9d75fcc (patch) | |
| tree | 6d3f39a6f2ecffbf955acc022785b099a0bbe6cf /tinyusb | |
| parent | 9b7f24bef27833d753217dcb76464aec7d15391e (diff) | |
add stub function to able to build device with EA4357
- dcd_controller_reset
- dcd_controller_connect
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/class/hid.h | 66 | ||||
| -rw-r--r-- | tinyusb/device/dcd.h | 5 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc43xx.c | 78 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc43xx.h | 63 | ||||
| -rw-r--r-- | tinyusb/hal/hal.h | 4 | ||||
| -rw-r--r-- | tinyusb/hal/hal_lpc43xx.c | 19 |
6 files changed, 194 insertions, 41 deletions
diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index cf70f66aa..2e876c8d8 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -51,17 +51,17 @@ #ifdef __cplusplus extern "C" { #endif - -enum { - HID_SUBCLASS_NONE = 0, - HID_SUBCLASS_BOOT = 1 -}; - -enum { - HID_PROTOCOL_NONE = 0, - HID_PROTOCOL_KEYBOARD = 1, - HID_PROTOCOL_MOUSE = 2 -}; +// +//enum { +// HID_SUBCLASS_NONE = 0, +// HID_SUBCLASS_BOOT = 1 +//}; +// +//enum { +// HID_PROTOCOL_NONE = 0, +// HID_PROTOCOL_KEYBOARD = 1, +// HID_PROTOCOL_MOUSE = 2 +//}; enum { HID_DESC_HID = 0x21, @@ -382,28 +382,28 @@ enum { HID_USAGE_PAGE_DESKTOP = 0x01, HID_USAGE_PAGE_SIMULATE = 0x02, HID_USAGE_PAGE_VIRTUAL_REALITY = 0x03, - HID_USAGE_PAGE_SPORT = 0x04, - HID_USAGE_PAGE_GAME = 0x05, - HID_USAGE_PAGE_GENERIC_DEVICE = 0x06, - HID_USAGE_PAGE_KEYBOARD = 0x07, - HID_USAGE_PAGE_LED = 0x08, - HID_USAGE_PAGE_BUTTON = 0x09, - HID_USAGE_PAGE_ORDINAL = 0x0a, - HID_USAGE_PAGE_TELEPHONY = 0x0b, - HID_USAGE_PAGE_CONSUMER = 0x0c, - HID_USAGE_PAGE_DIGITIZER = 0x0d, - HID_USAGE_PAGE_PID = 0x0f, - HID_USAGE_PAGE_UNICODE = 0x10, - HID_USAGE_PAGE_ALPHA_DISPLAY = 0x14, - HID_USAGE_PAGE_MEDICAL = 0x40, - HID_USAGE_PAGE_MONITOR = 0x80, //0x80 - 0x83 - HID_USAGE_PAGE_POWER = 0x84, // 0x084 - 0x87 - HID_USAGE_PAGE_BARCODE_SCANNER = 0x8c, - HID_USAGE_PAGE_SCALE = 0x8d, - HID_USAGE_PAGE_MSR = 0x8e, - HID_USAGE_PAGE_CAMERA = 0x90, - HID_USAGE_PAGE_ARCADE = 0x91, - HID_USAGE_PAGE_VENDOR = 0xFFFF // 0xFF00 - 0xFFFF +// HID_USAGE_PAGE_SPORT = 0x04, +// HID_USAGE_PAGE_GAME = 0x05, +// HID_USAGE_PAGE_GENERIC_DEVICE = 0x06, +// HID_USAGE_PAGE_KEYBOARD = 0x07, +// HID_USAGE_PAGE_LED = 0x08, +// HID_USAGE_PAGE_BUTTON = 0x09, +// HID_USAGE_PAGE_ORDINAL = 0x0a, +// HID_USAGE_PAGE_TELEPHONY = 0x0b, +// HID_USAGE_PAGE_CONSUMER = 0x0c, +// HID_USAGE_PAGE_DIGITIZER = 0x0d, +// HID_USAGE_PAGE_PID = 0x0f, +// HID_USAGE_PAGE_UNICODE = 0x10, +// HID_USAGE_PAGE_ALPHA_DISPLAY = 0x14, +// HID_USAGE_PAGE_MEDICAL = 0x40, +// HID_USAGE_PAGE_MONITOR = 0x80, //0x80 - 0x83 +// HID_USAGE_PAGE_POWER = 0x84, // 0x084 - 0x87 +// HID_USAGE_PAGE_BARCODE_SCANNER = 0x8c, +// HID_USAGE_PAGE_SCALE = 0x8d, +// HID_USAGE_PAGE_MSR = 0x8e, +// HID_USAGE_PAGE_CAMERA = 0x90, +// HID_USAGE_PAGE_ARCADE = 0x91, +// HID_USAGE_PAGE_VENDOR = 0xFFFF // 0xFF00 - 0xFFFF }; /// HID Usage Table - Table 6: Generic Desktop Page diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index f533bd683..b040bed77 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -73,6 +73,11 @@ tusb_error_t dcd_init(uint8_t coreid) ATTR_WARN_UNUSED_RESULT; +tusb_error_t dcd_controller_reset(uint8_t coreid) ATTR_WARN_UNUSED_RESULT; +tusb_error_t dcd_controller_connect(uint8_t coreid) ATTR_WARN_UNUSED_RESULT; + +void dcd_isr(uint8_t hostid); + #ifdef __cplusplus } #endif diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c new file mode 100644 index 000000000..0d38740ba --- /dev/null +++ b/tinyusb/device/dcd_lpc43xx.c @@ -0,0 +1,78 @@ +/**************************************************************************/ +/*! + @file dcd_lpc43xx.c + @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. +*/ +/**************************************************************************/ + +#include "tusb_option.h" + +#if MODE_DEVICE_SUPPORTED && (MCU == MCU_LPC43XX) + +#define _TINY_USB_SOURCE_FILE_ + +//--------------------------------------------------------------------+ +// INCLUDE +//--------------------------------------------------------------------+ +#include "dcd_lpc43xx.h" + +//--------------------------------------------------------------------+ +// MACRO CONSTANT TYPEDEF +//--------------------------------------------------------------------+ + +//--------------------------------------------------------------------+ +// INTERNAL OBJECT & FUNCTION DECLARATION +//--------------------------------------------------------------------+ + +//--------------------------------------------------------------------+ +// IMPLEMENTATION +//--------------------------------------------------------------------+ +tusb_error_t dcd_controller_reset(uint8_t hostid) +{ + + return TUSB_ERROR_NONE; +} + +tusb_error_t dcd_controller_connect(uint8_t coreid) +{ + return TUSB_ERROR_NONE; +} + +void dcd_isr(uint8_t hostid) +{ + +} + +#endif + diff --git a/tinyusb/device/dcd_lpc43xx.h b/tinyusb/device/dcd_lpc43xx.h new file mode 100644 index 000000000..777626743 --- /dev/null +++ b/tinyusb/device/dcd_lpc43xx.h @@ -0,0 +1,63 @@ +/**************************************************************************/ +/*! + @file dcd_lpc43xx.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. +*/ +/**************************************************************************/ + +/** \ingroup TBD + * \defgroup TBD + * \brief TBD + * + * @{ + */ + +#ifndef _TUSB_DCD_LPC43XX_H_ +#define _TUSB_DCD_LPC43XX_H_ + +#include "common/common.h" + +#ifdef __cplusplus + extern "C" { +#endif + + + +#ifdef __cplusplus + } +#endif + +#endif /* _TUSB_DCD_LPC43XX_H_ */ + +/** @} */ diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h index 2e7cc55ea..d97f5463f 100644 --- a/tinyusb/hal/hal.h +++ b/tinyusb/hal/hal.h @@ -58,13 +58,15 @@ #include "common/compiler/compiler.h" #if MCU == 0 - #error MCU is not defined or supported + #error MCU is not defined or supported yet #elif MCU == MCU_LPC11UXX #include "hal_lpc11uxx.h" #elif MCU == MCU_LPC13UXX #include "hal_lpc13uxx.h" #elif MCU == MCU_LPC43XX #include "hal_lpc43xx.h" +#else + #error MCU is not defined or supported yet #endif #ifdef __cplusplus diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c index 320be6fd7..2863aba0a 100644 --- a/tinyusb/hal/hal_lpc43xx.c +++ b/tinyusb/hal/hal_lpc43xx.c @@ -66,10 +66,12 @@ tusb_error_t hal_init(void) // reset controller & set role #if TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST - hcd_controller_reset(0); // TODO where to place prototype - LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5); + hcd_controller_reset(0); // TODO where to place prototype + LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5); #else // TODO OTG - #error device mode is not supported + dcd_controller_reset(0); + LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE; + dcd_controller_connect(0); #endif hal_interrupt_enable(0); @@ -77,6 +79,7 @@ tusb_error_t hal_init(void) //------------- USB1 Clock, only use on-chip FS PHY -------------// #if TUSB_CFG_CONTROLLER1_MODE + // TODO confirm whether device mode require P2_5 or not scu_pinmux(0x2, 5, MD_PLN | MD_EZI | MD_ZI, FUNC2); // USB1_VBUS monitor presence, must be high for bus reset occur /* connect CLK_USB1 to 60 MHz clock */ @@ -85,10 +88,12 @@ tusb_error_t hal_init(void) LPC_SCU->SFSUSB = (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST) ? 0x16 : 0x12; // enable USB1 with on-chip FS PHY #if TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST - hcd_controller_reset(1); // TODO where to place prototype - LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5); - #else - + hcd_controller_reset(1); // TODO where to place prototype + LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5); + #else // TODO OTG + dcd_controller_reset(1); + LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE; + dcd_controller_connect(1); #endif LPC_USB1->PORTSC1_D |= (1<<24); // TODO abtract, force port to fullspeed |
