diff options
| author | hathach <[email protected]> | 2012-12-03 16:51:14 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2012-12-03 16:51:14 +0700 |
| commit | b698b09a67251c8ed8ed81120e85ea21c5d88b10 (patch) | |
| tree | 5da27b3529f66f07095623ef160279b5cb5e9760 /tinyusb/common | |
| parent | aff644b7c3083cb3b943276d046729b80233e9f9 (diff) | |
fix some doxygen settings and stuffs add prepacked for IAR compiler
Diffstat (limited to 'tinyusb/common')
| -rw-r--r-- | tinyusb/common/arch/hal.h | 75 | ||||
| -rw-r--r-- | tinyusb/common/arch/hal_lpc134x.c | 58 | ||||
| -rw-r--r-- | tinyusb/common/common.h | 9 | ||||
| -rw-r--r-- | tinyusb/common/compiler/compiler.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/compiler/compiler_gcc.h | 3 | ||||
| -rw-r--r-- | tinyusb/common/errors.h | 2 |
6 files changed, 142 insertions, 7 deletions
diff --git a/tinyusb/common/arch/hal.h b/tinyusb/common/arch/hal.h new file mode 100644 index 000000000..4229f6ea1 --- /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 000000000..10acd3388 --- /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 9500d39a6..dbe99b2dd 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 61db9a936..5a29a2138 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 ee651140b..1ae97f242 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 4a33aeb4f..22db0721a 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 * @{ */ |
