as3525: bootloader USB mode

not working yet : an empty drive is detected
won't link on fuzev1: drivers allocated in usb_storage.c are too large

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26905 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-06-18 01:47:39 +00:00
parent 6470a9ffd1
commit b812465bff
4 changed files with 38 additions and 2 deletions

View file

@ -27,6 +27,11 @@
#include <inttypes.h>
#include "config.h"
#include "lcd.h"
#ifdef USE_ROCKBOX_USB
#include "usb.h"
#include "usb_core.h"
#include "sysfont.h"
#endif /* USE_ROCKBOX_USB */
#include "backlight.h"
#include "button-target.h"
#include "common.h"
@ -82,6 +87,29 @@ void main(void)
if(ret < 0)
error(EATA,ret);
#ifdef USE_ROCKBOX_USB
usb_init();
if(usb_detect() == USB_INSERTED)
{
const char msg[] = "Bootloader USB mode";
reset_screen();
lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * sizeof(msg))) / 2,
(LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
lcd_update();
usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true);
usb_enable(true);
while(usb_detect() == USB_INSERTED)
sleep(HZ);
usb_enable(false);
reset_screen();
lcd_update();
}
#endif /* USE_ROCKBOX_USB */
if(!disk_init(IF_MV(0)))
panicf("disk_init failed!");

View file

@ -916,7 +916,8 @@ Lyre prototype 1 */
#if (defined(TOSHIBA_GIGABEAT_S) || \
(defined(CREATIVE_ZVx) || \
defined(CPU_TCC77X) || defined(CPU_TCC780X))) || \
(CONFIG_USBOTG == USBOTG_JZ4740) || defined(IPOD_NANO2G)
(CONFIG_USBOTG == USBOTG_JZ4740) || defined(IPOD_NANO2G) || \
CONFIG_USBOTG == USBOTG_AS3525
#define USB_ENABLE_STORAGE
#endif

View file

@ -684,8 +684,10 @@ int usb_drv_recv(int ep, void *ptr, int len)
endpoints[ep][1].len = len;
endpoints[ep][1].rc = -1;
#ifndef BOOTLOADER
/* remove data buffer from cache */
invalidate_dcache();
#endif
/* DMA setup */
uc_desc->status = USB_DMA_DESC_BS_HST_RDY |
USB_DMA_DESC_LAST |
@ -734,8 +736,10 @@ void ep_send(int ep, void *ptr, int len)
endpoints[ep][0].len = len;
endpoints[ep][0].rc = -1;
#ifndef BOOTLOADER
/* Make sure data is committed to memory */
clean_dcache();
#endif
logf("xx%s\n", make_hex(ptr, len));
@ -843,10 +847,12 @@ static void handle_out_ep(int ep)
logf("EP%d OUT token, st:%08x len:%d frm:%x data=%s epstate=%d\n", ep,
dma_mst, dma_len, dma_frm, make_hex(uc_desc->data_ptr, dma_len),
endpoints[ep][1].state);
#ifndef BOOTLOADER
/*
* If parts of the just dmaed range are in cache, dump them now.
*/
dump_dcache_range(uc_desc->data_ptr, dma_len);
#endif
} else{
logf("EP%d OUT token, st:%08x frm:%x (no data)\n", ep,
dma_mst, dma_frm);

View file

@ -51,7 +51,8 @@
(defined(HAVE_USBSTACK) && (defined(OLYMPUS_MROBE_500))) || \
(defined(HAVE_USBSTACK) && (defined(IPOD_NANO2G))) || \
defined(CPU_TCC77X) || defined(CPU_TCC780X) || \
(CONFIG_USBOTG == USBOTG_JZ4740)
(CONFIG_USBOTG == USBOTG_JZ4740) || \
(defined(USE_ROCKBOX_USB) && CONFIG_USBOTG == USBOTG_AS3525)
#define USB_FULL_INIT
#endif