extract hal_init

This commit is contained in:
hathach 2012-12-02 00:41:12 +07:00
parent 8a1dee1b2e
commit a636d75fc6
2 changed files with 10 additions and 6 deletions

View File

@ -42,7 +42,6 @@
TUSB_Error_t hcd_init() TUSB_Error_t hcd_init()
{ {
return tERROR_NONE; return tERROR_NONE;
} }

View File

@ -32,15 +32,13 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE. * OF SUCH DAMAGE.
* *
* This file is part of the tiny usb stack. * This file is part of the tinyUSB stack.
*/ */
#include "tusb.h" #include "tusb.h"
TUSB_Error_t tusb_init(void) TUSB_Error_t hal_init()
{ {
/* HARDWARE INIT */
// TODO usb abstract later // TODO usb abstract later
/* Enable AHB clock to the USB block and USB RAM. */ /* Enable AHB clock to the USB block and USB RAM. */
LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27)); LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27));
@ -52,6 +50,13 @@ TUSB_Error_t tusb_init(void)
LPC_IOCON->PIO0_6 &= ~0x07; LPC_IOCON->PIO0_6 &= ~0x07;
LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */ LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */
return tERROR_NONE;
}
TUSB_Error_t tusb_init(void)
{
ASSERT_ERROR( hal_init() ) ; /* HARDWARE INIT */
#ifdef CFG_TUSB_HOST #ifdef CFG_TUSB_HOST
ASSERT_ERROR( hcd_init() ); ASSERT_ERROR( hcd_init() );
#endif #endif
@ -60,5 +65,5 @@ TUSB_Error_t tusb_init(void)
ASSERT_ERROR( dcd_init() ); ASSERT_ERROR( dcd_init() );
#endif #endif
return LPC_OK; return tERROR_NONE;
} }