From c0b43a5ac2fcda473800b9c9a4036c5348ac5084 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Fri, 21 Nov 2008 12:50:06 +0000 Subject: Commit some USB and ATA rework/refactoring (+ USB GPIO detection). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19165 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-ondavx747.h | 6 +-- firmware/export/jz4740.h | 18 +++---- firmware/target/mips/ingenic_jz47xx/ata-jz4740.c | 6 +-- .../target/mips/ingenic_jz47xx/ata-sd-jz4740.c | 44 +++++++---------- .../target/mips/ingenic_jz47xx/ata-sd-target.h | 39 --------------- .../mips/ingenic_jz47xx/onda_vx747/ata-sd-target.h | 55 ++++++++++++++++++++++ .../onda_vx747/backlight-onda_vx747.c | 3 +- .../mips/ingenic_jz47xx/onda_vx747/usb-target.h | 48 +++++++++++++++++++ .../mips/ingenic_jz47xx/onda_vx767/ata-sd-target.h | 55 ++++++++++++++++++++++ .../mips/ingenic_jz47xx/onda_vx767/usb-target.h | 48 +++++++++++++++++++ firmware/target/mips/ingenic_jz47xx/usb-jz4740.c | 49 +++++++++++++++---- firmware/target/mips/ingenic_jz47xx/usb-target.h | 25 ---------- firmware/usb.c | 3 +- 13 files changed, 279 insertions(+), 120 deletions(-) delete mode 100644 firmware/target/mips/ingenic_jz47xx/ata-sd-target.h create mode 100644 firmware/target/mips/ingenic_jz47xx/onda_vx747/ata-sd-target.h create mode 100644 firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h create mode 100644 firmware/target/mips/ingenic_jz47xx/onda_vx767/ata-sd-target.h create mode 100644 firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h delete mode 100644 firmware/target/mips/ingenic_jz47xx/usb-target.h (limited to 'firmware') diff --git a/firmware/export/config-ondavx747.h b/firmware/export/config-ondavx747.h index 3d7628fa8f..e92e5a9829 100644 --- a/firmware/export/config-ondavx747.h +++ b/firmware/export/config-ondavx747.h @@ -33,8 +33,8 @@ /* For Rolo and boot loader */ #define MODEL_NUMBER 35 -#define HAVE_ATA_SD -#define HAVE_HOTSWAP +//#define HAVE_ATA_SD +//#define HAVE_HOTSWAP //#define CONFIG_STORAGE (STORAGE_NAND | STORAGE_SD) #define CONFIG_STORAGE STORAGE_RAMDISK /* Multivolume currently handled at firmware/target/ level */ @@ -156,7 +156,7 @@ #define BOOTFILE "rockbox." BOOTFILE_EXT #define BOOTDIR "/.rockbox" -#define CONFIG_USBOTG USBOTG_INGENIC +#define CONFIG_USBOTG USBOTG_JZ4740 #define HAVE_USBSTACK #define USB_VENDOR_ID 0x041e #define USB_PRODUCT_ID 0x4133 diff --git a/firmware/export/jz4740.h b/firmware/export/jz4740.h index 45767b26cc..55c0ac7b1d 100644 --- a/firmware/export/jz4740.h +++ b/firmware/export/jz4740.h @@ -383,7 +383,7 @@ #define REG_TCU_TCNT4 REG16(TCU_TCNT4) #define REG_TCU_TCSR4 REG16(TCU_TCSR4) -// n = 0,1,2,3,4,5 +// n = 0,1,2,3,4,5,6,7 #define TCU_TDFR(n) (TCU_BASE + (0x40 + (n)*0x10)) /* Timer Data Full Reg */ #define TCU_TDHR(n) (TCU_BASE + (0x44 + (n)*0x10)) /* Timer Data Half Reg */ #define TCU_TCNT(n) (TCU_BASE + (0x48 + (n)*0x10)) /* Timer Counter Reg */ @@ -2903,11 +2903,11 @@ do { \ /* * MSC_CMD, MSC_CLK, MSC_D0 ~ MSC_D3 */ -#define __gpio_as_msc() \ -do { \ +#define __gpio_as_msc() \ +do { \ REG_GPIO_PXFUNS(3) = 0x00003f00; \ REG_GPIO_PXSELC(3) = 0x00003f00; \ - REG_GPIO_PXPES(3) = 0x00003f00; \ + REG_GPIO_PXPES(3) = 0x00003f00; \ } while (0) /* @@ -3027,8 +3027,8 @@ do { \ REG_GPIO_PXDIRS(p) = (1 << (o)); \ } while (0) -#define __gpio_port_as_input(p, o) \ -do { \ +#define __gpio_port_as_input(p, o) \ +do { \ REG_GPIO_PXFUNC(p) = (1 << (o)); \ REG_GPIO_PXSELC(p) = (1 << (o)); \ REG_GPIO_PXDIRC(p) = (1 << (o)); \ @@ -4168,9 +4168,9 @@ do { \ #define __msc_rd_rxfifo() ( REG_MSC_RXFIFO ) #define __msc_wr_txfifo(v) ( REG_MSC_TXFIFO = v ) -#define __msc_reset() \ -do { \ - REG_MSC_STRPCL = MSC_STRPCL_RESET; \ +#define __msc_reset() \ +do { \ + REG_MSC_STRPCL = MSC_STRPCL_RESET; \ while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \ } while (0) diff --git a/firmware/target/mips/ingenic_jz47xx/ata-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-jz4740.c index dd14a4c651..4c177d8ded 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-jz4740.c @@ -32,7 +32,7 @@ int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* bu case 0: return nand_read_sectors(start, count, buf); case 1: - return sd_read_sectors(start, count, buf); + return _sd_read_sectors(start, count, buf); default: panicf("ata_read_sectors: Drive %d unhandled!", drive); return -1; @@ -46,7 +46,7 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const v case 0: return nand_write_sectors(start, count, buf); case 1: - return sd_write_sectors(start, count, buf); + return _sd_write_sectors(start, count, buf); default: panicf("ata_write_sectors: Drive %d unhandled!", drive); return -1; @@ -55,7 +55,7 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const v int ata_init(void) { - if(sd_init() != 0) + if(_sd_init() != 0) return -1; if(nand_init() != 0) return -2; diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c index ccd71630a6..22e274b4d1 100644 --- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c @@ -23,6 +23,7 @@ #include "jz4740.h" #include "ata.h" #include "ata-sd-target.h" +#include "sd.h" #include "system.h" #include "kernel.h" #include "panic.h" @@ -36,10 +37,7 @@ static struct wakeup sd_wakeup; //#define DEBUG(x...) DEBUGF(x); #define DEBUG(x...) printf(x); -#define MMC_CD_PIN (29 + 1 * 32) /* Pin to check card insertion */ -#define MMC_POWER_PIN (30 + 1 * 32) /* Pin to enable/disable card power */ -//#define MMC_PW_PIN (14 + 3 * 32) /* Pin to check protect card */ - +#ifdef MMC_POWER_PIN #define MMC_POWER_OFF() \ do { \ __gpio_set_pin(MMC_POWER_PIN); \ @@ -49,8 +47,11 @@ do { \ do { \ __gpio_clear_pin(MMC_POWER_PIN); \ } while (0) +#endif +#ifdef MMC_CD_PIN #define MMC_INSERT_STATUS() __gpio_get_pin(MMC_CD_PIN) +#endif #define MMC_RESET() __msc_reset() @@ -60,24 +61,6 @@ do { \ REG_MSC_IREG = 0xffff; \ } while (0) -static inline void mmc_init_gpio(void) -{ - __gpio_as_msc(); -#ifdef MMC_POWER_PIN - __gpio_as_output(MMC_POWER_PIN); - __gpio_disable_pull(MMC_POWER_PIN); - __gpio_set_pin(MMC_POWER_PIN); -#endif -#ifdef MMC_CD_PIN - __gpio_as_input(MMC_CD_PIN); - __gpio_disable_pull(MMC_CD_PIN); -#endif -#ifdef MMC_PW_PIN - __gpio_as_input(MMC_PW_PIN); - __gpio_disable_pull(MMC_PW_PIN); -#endif -} - /* Error codes */ enum mmc_result_t { @@ -509,7 +492,7 @@ static void jz_mmc_get_response(struct mmc_request *request) buf[i] = (data >> 8) & 0xff; buf[i + 1] = data & 0xff; } - DEBUG("request %d, response [", request->rtype); + DEBUG("request %d, response []", request->rtype); break; } case RESPONSE_NONE: @@ -768,12 +751,14 @@ static int jz_mmc_exec_cmd(struct mmc_request *request) /* On reset, stop MMC clock */ jz_mmc_stop_clock(); } +#if 0 if (request->cmd == MMC_SEND_OP_COND) { DEBUG("Have a MMC card"); /* always use 1bit for MMC */ use_4bit = 0; } +#endif if (request->cmd == SET_BUS_WIDTH) { if (request->arg == 0x2) @@ -1070,13 +1055,16 @@ void MSC(void) static void jz_mmc_hardware_init(void) { mmc_init_gpio(); /* init GPIO */ +#ifdef MMC_POWER_ON MMC_POWER_ON(); /* turn on power of card */ +#endif MMC_RESET(); /* reset mmc/sd controller */ MMC_IRQ_MASK(); /* mask all IRQs */ jz_mmc_stop_clock(); /* stop MMC/SD clock */ + __cpm_start_msc(); #ifdef MMC_DMA_ENABLE - __cpm_start_dmac(); - __dmac_enable_module(); +// __cpm_start_dmac(); +// __dmac_enable_module(); // REG_DMAC_DMACR = DMAC_DMACR_DME; #if MMC_DMA_INTERRUPT mmc_dma_rx_sem = OSSemCreate(0); @@ -1105,7 +1093,7 @@ static void mmc_send_cmd(struct mmc_request *request, int cmd, unsigned int arg, } static bool inited = false; -int sd_init(void) +int _sd_init(void) { if(!inited) { @@ -1150,7 +1138,7 @@ tCardInfo* card_get_info_target(int card_no) } /* TODO */ -int sd_read_sectors(unsigned long start, int count, void* buf) +int _sd_read_sectors(unsigned long start, int count, void* buf) { (void)start; (void)count; @@ -1159,7 +1147,7 @@ int sd_read_sectors(unsigned long start, int count, void* buf) } /* TODO */ -int sd_write_sectors(unsigned long start, int count, const void* buf) +int _sd_write_sectors(unsigned long start, int count, const void* buf) { (void)start; (void)count; diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-target.h b/firmware/target/mips/ingenic_jz47xx/ata-sd-target.h deleted file mode 100644 index f788fd6a41..0000000000 --- a/firmware/target/mips/ingenic_jz47xx/ata-sd-target.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 by Maurus Cuelenaere - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef ATA_SD_TARGET_H -#define ATA_SD_TARGET_H - -#include "inttypes.h" -#include "hotswap.h" - -tCardInfo *card_get_info_target(int card_no); -bool card_detect_target(void); - -#ifdef HAVE_HOTSWAP -void card_enable_monitoring_target(bool on); -void microsd_int(void); /* ??? */ -#endif - -int sd_read_sectors(unsigned long start, int count, void* buf); -int sd_write_sectors(unsigned long start, int count, const void* buf); -int sd_init(void); - -#endif diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/ata-sd-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/ata-sd-target.h new file mode 100644 index 0000000000..cc6bd8a773 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/ata-sd-target.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Maurus Cuelenaere + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef ATA_SD_TARGET_H +#define ATA_SD_TARGET_H + +#include "inttypes.h" +#include "hotswap.h" +#include "jz4740.h" + +tCardInfo *card_get_info_target(int card_no); +bool card_detect_target(void); + +#ifdef HAVE_HOTSWAP +void card_enable_monitoring_target(bool on); +void microsd_int(void); /* ??? */ +#endif + +int _sd_read_sectors(unsigned long start, int count, void* buf); +int _sd_write_sectors(unsigned long start, int count, const void* buf); +int _sd_init(void); + +#define MMC_CD_PIN (29 + 1 * 32) /* Pin to check card insertion */ +//#define MMC_POWER_PIN (30 + 1 * 32) /* Pin to enable/disable card power */ +//#define MMC_PW_PIN (14 + 3 * 32) /* Pin to check protect card */ + +static inline void mmc_init_gpio(void) +{ + __gpio_as_msc(); + __gpio_as_input(MMC_CD_PIN); + __gpio_enable_pull(32*3+29); + __gpio_enable_pull(32*3+10); + __gpio_enable_pull(32*3+11); + __gpio_enable_pull(32*3+12); +} + +#endif diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c index 598fa1a0eb..501a90551e 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c @@ -23,8 +23,7 @@ #include "jz4740.h" #include "backlight-target.h" -#define GPIO_PWM (32*3)+31 -#define PWM_CHN 7 +#define PWM_CHN 7 /* PWM_CHN7 == GPIO(32*3 + 31) */ #define __gpio_as_PWM_CHN __gpio_as_pwm7 static void set_backlight(int val) diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h new file mode 100644 index 0000000000..c681bdaa12 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/usb-target.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Maurus Cuelenaere + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __USB_TARGET_H +#define __USB_TARGET_H + +#include "config.h" + +#define __gpio_as_usb_detect() \ +do { \ + REG_GPIO_PXFUNS(3) = 0x10000000; \ + REG_GPIO_PXSELS(3) = 0x10000000; \ + REG_GPIO_PXPES(3) = 0x10000000; \ +} while (0) + +#define GPIO_UDC_DETE (32 * 3 + 28) +#define IRQ_GPIO_UDC_DETE (IRQ_GPIO_0 + GPIO_UDC_DETE) + +static inline void usb_init_gpio(void) +{ + __gpio_as_usb_detect(); + system_enable_irq(IRQ_UDC); + __gpio_as_input(GPIO_UDC_DETE); +} + +int usb_detect(void); +void usb_init_device(void); +bool usb_drv_connected(void); + +#endif diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/ata-sd-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx767/ata-sd-target.h new file mode 100644 index 0000000000..cc6bd8a773 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/ata-sd-target.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Maurus Cuelenaere + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef ATA_SD_TARGET_H +#define ATA_SD_TARGET_H + +#include "inttypes.h" +#include "hotswap.h" +#include "jz4740.h" + +tCardInfo *card_get_info_target(int card_no); +bool card_detect_target(void); + +#ifdef HAVE_HOTSWAP +void card_enable_monitoring_target(bool on); +void microsd_int(void); /* ??? */ +#endif + +int _sd_read_sectors(unsigned long start, int count, void* buf); +int _sd_write_sectors(unsigned long start, int count, const void* buf); +int _sd_init(void); + +#define MMC_CD_PIN (29 + 1 * 32) /* Pin to check card insertion */ +//#define MMC_POWER_PIN (30 + 1 * 32) /* Pin to enable/disable card power */ +//#define MMC_PW_PIN (14 + 3 * 32) /* Pin to check protect card */ + +static inline void mmc_init_gpio(void) +{ + __gpio_as_msc(); + __gpio_as_input(MMC_CD_PIN); + __gpio_enable_pull(32*3+29); + __gpio_enable_pull(32*3+10); + __gpio_enable_pull(32*3+11); + __gpio_enable_pull(32*3+12); +} + +#endif diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h b/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h new file mode 100644 index 0000000000..c681bdaa12 --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx767/usb-target.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Maurus Cuelenaere + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __USB_TARGET_H +#define __USB_TARGET_H + +#include "config.h" + +#define __gpio_as_usb_detect() \ +do { \ + REG_GPIO_PXFUNS(3) = 0x10000000; \ + REG_GPIO_PXSELS(3) = 0x10000000; \ + REG_GPIO_PXPES(3) = 0x10000000; \ +} while (0) + +#define GPIO_UDC_DETE (32 * 3 + 28) +#define IRQ_GPIO_UDC_DETE (IRQ_GPIO_0 + GPIO_UDC_DETE) + +static inline void usb_init_gpio(void) +{ + __gpio_as_usb_detect(); + system_enable_irq(IRQ_UDC); + __gpio_as_input(GPIO_UDC_DETE); +} + +int usb_detect(void); +void usb_init_device(void); +bool usb_drv_connected(void); + +#endif diff --git a/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c b/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c index 7cefdadbe3..f0b4eb4694 100644 --- a/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c @@ -25,6 +25,7 @@ #include "usb_ch9.h" #include "usb_drv.h" #include "usb_core.h" +#include "usb-target.h" #include "jz4740.h" #include "thread.h" @@ -33,10 +34,6 @@ #define EP1_INTR_BIT 2 #define EP_FIFO_NOEMPTY 2 -#define GPIO_UDC_DETE_PIN (32 * 3 + 6) -#define GPIO_UDC_DETE GPIO_UDC_DETE_PIN -#define IRQ_GPIO_UDC_DETE (IRQ_GPIO_0 + GPIO_UDC_DETE) - #define IS_CACHE(x) (x < 0xa0000000) #define USB_EP0_IDLE 0 @@ -81,7 +78,7 @@ static inline void select_endpoint(int ep) } static void readFIFO(struct usb_endpoint *ep, unsigned int size) -{ +{ unsigned int *d = (unsigned int *)ep->ptr; unsigned int s; s = (size + 3) >> 2; @@ -90,7 +87,7 @@ static void readFIFO(struct usb_endpoint *ep, unsigned int size) } static void writeFIFO(struct usb_endpoint *ep, unsigned int size) -{ +{ unsigned int *d = (unsigned int *)ep->ptr; unsigned char *c; int s, q; @@ -359,7 +356,7 @@ bool usb_drv_connected(void) int usb_detect(void) { - if(__gpio_get_pin(GPIO_UDC_DETE) == 1) + if(usb_drv_connected()) return USB_INSERTED; else return USB_EXTRACTED; @@ -367,9 +364,7 @@ int usb_detect(void) void usb_init_device(void) { - system_enable_irq(IRQ_UDC); - __gpio_as_input(GPIO_UDC_DETE_PIN); - return; + usb_init_gpio(); } void usb_enable(bool on) @@ -442,6 +437,40 @@ void usb_drv_set_address(int address) REG_USB_REG_FADDR = address; } +int usb_drv_send(int endpoint, void* ptr, int length) +{ + return 0; +} + +int usb_drv_recv(int endpoint, void* ptr, int length) +{ + return 0; +} + +void usb_drv_set_test_mode(int mode) +{ + +} + +int usb_drv_port_speed(void) +{ + return ((REG_USB_REG_POWER & USB_POWER_HSMODE) != 0) ? 1 : 0; +} + +void usb_drv_cancel_all_transfers(void) +{ + int i; + for(i=0; i<5; i++) + { + endpoints[i].ptr = endpoints[i].buf; + endpoints[i].length = 0; + } +} + +void usb_drv_release_endpoint(int ep) +{ + +} #else diff --git a/firmware/target/mips/ingenic_jz47xx/usb-target.h b/firmware/target/mips/ingenic_jz47xx/usb-target.h deleted file mode 100644 index ec700de892..0000000000 --- a/firmware/target/mips/ingenic_jz47xx/usb-target.h +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 by Maurus Cuelenaere - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include -int usb_detect(void); -void usb_init_device(void); -bool usb_drv_connected(void); diff --git a/firmware/usb.c b/firmware/usb.c index b37ef3c5a5..fe89d223d3 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -51,7 +51,8 @@ #if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \ (defined(TOSHIBA_GIGABEAT_S) && defined(USE_ROCKBOX_USB) && defined(USB_STORAGE)) || \ (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx) || \ - defined(CPU_TCC77X) || defined(CPU_TCC780X))) + defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \ + (CONFIG_USBOTG == USBOTG_JZ4740) #define USB_FULL_INIT #endif -- cgit v1.2.3