hathach 13 лет назад
Родитель
Сommit
a636d75fc6
2 измененных файлов с 10 добавлено и 6 удалено
  1. 0 1
      tinyusb/host/hcd.c
  2. 10 5
      tinyusb/tusb.c

+ 0 - 1
tinyusb/host/hcd.c

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

+ 10 - 5
tinyusb/tusb.c

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