diff --git a/.cproject b/.cproject
index 7f0571ac..eda7dda7 100644
--- a/.cproject
+++ b/.cproject
@@ -59,7 +59,7 @@
-
+
@@ -454,7 +454,7 @@
-
+
diff --git a/demos/device/keyboard/descriptors.h b/demos/device/keyboard/descriptors.h
index 27780643..4b3e8b4d 100644
--- a/demos/device/keyboard/descriptors.h
+++ b/demos/device/keyboard/descriptors.h
@@ -83,7 +83,7 @@ typedef PRE_PACK struct POST_PACK _USB_INTERFACE_ASSOCIATION_DESCRIPTOR
///////////////////////////////////////////////////////////////////////
// Interface Assosication Descriptor if device is CDC + other class
-#define IAD_DESC_REQUIRED ( defined(CFG_CLASS_CDC) && (CLASS_HID) )
+#define IAD_DESC_REQUIRED ( defined(CFG_CLASS_CDC) && (TUSB_CLASS_HID) )
#ifdef CFG_CLASS_CDC
#define INTERFACES_OF_CDC 2
diff --git a/doxygen.Doxyfile b/doxygen.Doxyfile
index 344d965d..864763e5 100644
--- a/doxygen.Doxyfile
+++ b/doxygen.Doxyfile
@@ -375,7 +375,7 @@ EXTRACT_PACKAGE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
-EXTRACT_STATIC = YES
+EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
@@ -661,7 +661,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = tinyusb/class tinyusb/common tinyusb/host tinyusb/common/arch tinyusb/common/compiler tinyusb tinyusb\device overview.md license.md
+INPUT = tinyusb overview.md license.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -685,7 +685,7 @@ FILE_PATTERNS =
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
-RECURSIVE = NO
+RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be
# excluded from the INPUT source files. This way you can easily exclude a
@@ -693,7 +693,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE = tinyusb/device/romdriver
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -1491,7 +1491,7 @@ ENABLE_PREPROCESSING = YES
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
-MACRO_EXPANSION = NO
+MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
@@ -1525,7 +1525,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
-PREDEFINED =
+PREDEFINED = __attribute__(x)= __attribute__((x))= ATTR_ALIGNED(x)=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
diff --git a/tinyusb/class/cdc.h b/tinyusb/class/cdc.h
index 668e2bf2..5bcad17a 100644
--- a/tinyusb/class/cdc.h
+++ b/tinyusb/class/cdc.h
@@ -41,7 +41,7 @@
* \note TBD
*/
-/** \ingroup Group_TinyUSB
+/**
* \addtogroup Group_ClassDriver Class Driver
* @{
* \defgroup Group_CDC Communication Device Class
diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h
index bde715b8..4e56ffb4 100644
--- a/tinyusb/class/hid.h
+++ b/tinyusb/class/hid.h
@@ -41,7 +41,7 @@
* \note TBD
*/
-/** \ingroup Group_TinyUSB
+/**
* \addtogroup Group_ClassDriver Class Driver
* @{
* \defgroup Group_HID Human Interface Device
diff --git a/tinyusb/common/arch/hal.h b/tinyusb/common/arch/hal.h
new file mode 100644
index 00000000..4229f6ea
--- /dev/null
+++ b/tinyusb/common/arch/hal.h
@@ -0,0 +1,75 @@
+/*
+ * hal.h
+ *
+ * Created on: Dec 2, 2012
+ * Author: hathach
+ */
+
+/*
+ * Software License Agreement (BSD License)
+ * Copyright (c) 2012, hathach (tinyusb.net)
+ * 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. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 tiny usb stack.
+ */
+
+/** \file
+ * \brief TBD
+ *
+ * \note TBD
+ */
+
+/**
+ * \defgroup Group_HAL Hardware Abtract Layer
+ * \brief Hardware dependent layer
+ *
+ * @{
+ */
+
+#ifndef _TUSB_HAL_H_
+#define _TUSB_HAL_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#include "common/errors.h"
+
+/** \brief USB hardware init
+ *
+ * \param[in] para1
+ * \param[out] para2
+ * \return Error Code of the \ref TUSB_ERROR enum
+ * \note
+ */
+TUSB_Error_t hal_init();
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _TUSB_HAL_H_ */
+
+/** @} */
diff --git a/tinyusb/common/arch/hal_lpc134x.c b/tinyusb/common/arch/hal_lpc134x.c
new file mode 100644
index 00000000..10acd338
--- /dev/null
+++ b/tinyusb/common/arch/hal_lpc134x.c
@@ -0,0 +1,58 @@
+/*
+ * hal_lpc134x.c
+ *
+ * Created on: Dec 2, 2012
+ * Author: hathach
+ */
+
+/*
+ * Software License Agreement (BSD License)
+ * Copyright (c) 2012, hathach (tinyusb.net)
+ * 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. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 tiny usb stack.
+ */
+
+#include "common/common.h"
+
+#ifdef ARCH_LPC134X
+
+TUSB_Error_t hal_init()
+{
+ // TODO usb abstract later
+ /* Enable AHB clock to the USB block and USB RAM. */
+ LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27));
+
+ /* Pull-down is needed, or internally, VBUS will be floating. This is to
+ address the wrong status in VBUSDebouncing bit in CmdStatus register. */
+ LPC_IOCON->PIO0_3 &= ~0x1F;
+ LPC_IOCON->PIO0_3 |= (0x01<<0); /* Secondary function VBUS */
+ LPC_IOCON->PIO0_6 &= ~0x07;
+ LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
+
+ return tERROR_NONE;
+}
+
+#endif
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index 9500d39a..dbe99b2d 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -41,9 +41,10 @@
* \note TBD
*/
-/**
- * \defgroup Group_Common Common Files
- * \brief Group_Common brief
+/** \defgroup Group_Common Common Files
+ * @{
+ *
+ * \defgroup Group_CommonH common.h
*
* @{
*/
@@ -65,6 +66,7 @@
#include "arch/hal.h"
#include "compiler/compiler.h"
#include "errors.h"
+#include "core/tusb_types.h"
/// min value
#ifndef MIN
@@ -126,3 +128,4 @@
#endif /* _TUSB_COMMON_H_ */
/** @} */
+/** @} */
diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h
index 61db9a93..5a29a213 100644
--- a/tinyusb/common/compiler/compiler.h
+++ b/tinyusb/common/compiler/compiler.h
@@ -53,6 +53,8 @@
#if defined(__GNUC__)
#include "compiler_gcc.h"
+#elif deinfed __ICCARM__ // IAR compiler
+ #include "compiler_iar.h"
#endif
#endif /* _TUSB_COMPILER_H_ */
diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h
index ee651140..1ae97f24 100644
--- a/tinyusb/common/compiler/compiler_gcc.h
+++ b/tinyusb/common/compiler/compiler_gcc.h
@@ -37,8 +37,6 @@
/** \file
* \brief GCC Header
- *
- * \note TBD
*/
/** \ingroup Group_Compiler
@@ -74,7 +72,6 @@
#define ATTR_PACKED __attribute__ ((packed))
#define ATTR_PREPACKED
-#define ATTR_POSTPACKED ATTR_PACKED
/** @} */
/** \ingroup Group_GCC
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index 4a33aeb4..22db0721 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -42,7 +42,7 @@
*/
/** \ingroup Group_Common
- * \defgroup Group_Error tinyUSB Error Codes
+ * \defgroup Group_Error Error Codes
* @{
*/
diff --git a/tinyusb/core/tusb_types.h b/tinyusb/core/tusb_types.h
new file mode 100644
index 00000000..4a73adba
--- /dev/null
+++ b/tinyusb/core/tusb_types.h
@@ -0,0 +1,86 @@
+/*
+ * tusb_types.h
+ *
+ * Created on: Dec 3, 2012
+ * Author: hathach
+ */
+
+/*
+ * Software License Agreement (BSD License)
+ * Copyright (c) 2012, hathach (tinyusb.net)
+ * 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. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 tiny usb stack.
+ */
+
+/** \file
+ * \brief TBD
+ */
+
+/** \ingroup Group_Core
+ * \defgroup Group_USBTypes USB Types
+ * \brief TBD
+ *
+ * @{
+ */
+
+#ifndef _TUSB_TUSB_TYPES_H_
+#define _TUSB_TUSB_TYPES_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/// defined base on EHCI specs value for Endpoint Speed
+typedef enum {
+ FULL_SPEED =0,
+ LOWS_PEED,
+ HIGH_SPEED
+}TUSB_Speed_t;
+
+/// defined base on USB Specs Endpoint's bmAttributes
+typedef enum {
+ CONTROL_TYPE = 0,
+ ISOCHRONOUS_TYPE,
+ BULK_TYPE,
+ INTERRUPT_TYPE
+}TUSB_TransferType_t;
+
+/// TBD
+typedef enum {
+ SETUP_TOKEN,
+ IN_TOKEN,
+ OUT_TOKEN
+}TUSB_PID_t;
+
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _TUSB_TUSB_TYPES_H_ */
+
+/** @} */
diff --git a/tinyusb/device/dcd.c b/tinyusb/device/dcd.c
index eb007721..ca6fafe7 100644
--- a/tinyusb/device/dcd.c
+++ b/tinyusb/device/dcd.c
@@ -84,7 +84,7 @@ ErrorCode_t USB_Reset_Event (USBD_HANDLE_T hUsb)
return LPC_OK;
}
-TUSB_Error_t dcd_init()
+TUSB_Error_t dcd_init(uint8_t coreid)
{
/* ROM DRIVER INIT */
uint32_t membase = (uint32_t) usb_RomDriver_buffer;
diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h
index 79d646f9..65eb80da 100644
--- a/tinyusb/device/dcd.h
+++ b/tinyusb/device/dcd.h
@@ -41,7 +41,7 @@
* \note TBD
*/
-/** \ingroup Group_TinyUSB
+/**
* \defgroup Group_DCD Device Controller Driver
* \brief Device Controller Driver
*
@@ -72,7 +72,7 @@
* \note
*/
-TUSB_Error_t dcd_init() ATTR_WARN_UNUSED_RESULT;
+TUSB_Error_t dcd_init(uint8_t coreid) ATTR_WARN_UNUSED_RESULT;
#ifdef __cplusplus
}
diff --git a/tinyusb/host/hcd.c b/tinyusb/host/hcd.c
index 25b37848..9ff96d5c 100644
--- a/tinyusb/host/hcd.c
+++ b/tinyusb/host/hcd.c
@@ -39,7 +39,7 @@
#ifdef CFG_TUSB_HOST
-TUSB_Error_t hcd_init()
+TUSB_Error_t hcd_init(uint8_t coreid)
{
return tERROR_NONE;
diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h
index a5fe3162..dfe65985 100644
--- a/tinyusb/host/hcd.h
+++ b/tinyusb/host/hcd.h
@@ -41,7 +41,7 @@
* \note TBD
*/
-/** \ingroup Group_TinyUSB
+/**
* \defgroup Group_HCD Host Controller Driver
* \brief Host Controller Driver
*
@@ -56,6 +56,7 @@
#endif
#include "common/common.h"
+#include "core/tusb_types.h"
/** \brief Initialize HCD
*
@@ -65,7 +66,15 @@
* \note
*/
-TUSB_Error_t hcd_init() ATTR_WARN_UNUSED_RESULT;
+TUSB_Error_t hcd_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
+
+TUSB_Error_t hcd_pipe_open(
+ uint8_t hostid, uint8_t device_address,
+
+ )ATTR_WARN_UNUSED_RESULT;
+TUSB_Error_t hcd_pipe_close()ATTR_WARN_UNUSED_RESULT;
+TUSB_Error_t hcd_pipe_transfer()ATTR_WARN_UNUSED_RESULT;
+TUSB_Error_t hcd_pipe_cancel()ATTR_WARN_UNUSED_RESULT;
#ifdef __cplusplus
}
diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c
index 22add472..8a9bd543 100644
--- a/tinyusb/tusb.c
+++ b/tinyusb/tusb.c
@@ -42,11 +42,11 @@ TUSB_Error_t tusb_init(void)
ASSERT_ERROR( hal_init() ) ; /* HARDWARE INIT */
#ifdef CFG_TUSB_HOST
- ASSERT_ERROR( hcd_init() );
+ ASSERT_ERROR( hcd_init(0) );
#endif
#ifdef CFG_TUSB_DEVICE
- ASSERT_ERROR( dcd_init() );
+ ASSERT_ERROR( dcd_init(0) );
#endif
return tERROR_NONE;
diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h
index 81affc6c..285e6f56 100644
--- a/tinyusb/tusb.h
+++ b/tinyusb/tusb.h
@@ -41,12 +41,6 @@
* \note Tiny USB header Note
*/
-/** \defgroup Group_TinyUSB Tiny USB
- * \brief Group_TinyUSB brief
- *
- * @{
- */
-
#ifndef _TUSB_H_
#define _TUSB_H_
@@ -77,5 +71,3 @@
#endif
#endif /* _TUSB_H_ */
-
-/** @} */
diff --git a/tinyusb/tusb_cfg.h b/tinyusb/tusb_cfg.h
index b172c4b3..b31246ea 100644
--- a/tinyusb/tusb_cfg.h
+++ b/tinyusb/tusb_cfg.h
@@ -41,7 +41,7 @@
* \note TBD
*/
-/** \ingroup Group_TinyUSB
+/**
* \defgroup Group_TinyUSB_Configure Configuration tusb_cfg.h
* @{
*/
@@ -71,7 +71,10 @@
/// Enable HID Mouse support
#define CFG_CLASS_HID_MOUSE
-#define CLASS_HID ( (defined CFG_CLASS_HID_KEYBOARD) || (defined CFG_CLASS_HID_MOUSE) )
+#define TUSB_CLASS_HID ( (defined CFG_CLASS_HID_KEYBOARD) || (defined CFG_CLASS_HID_MOUSE) )
+#define TUSB_EHCI
+
+
// TODO APP
#define USB_MAX_IF_NUM 8