fix some doxygen settings and stuffs add prepacked for IAR compiler

This commit is contained in:
hathach
2012-12-03 16:51:14 +07:00
parent aff644b7c3
commit b698b09a67
19 changed files with 261 additions and 36 deletions

75
tinyusb/common/arch/hal.h Normal file
View File

@@ -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_ */
/** @} */

View File

@@ -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

View File

@@ -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_ */
/** @} */
/** @} */

View File

@@ -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_ */

View File

@@ -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

View File

@@ -42,7 +42,7 @@
*/
/** \ingroup Group_Common
* \defgroup Group_Error tinyUSB Error Codes
* \defgroup Group_Error Error Codes
* @{
*/