mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 05:32:40 -05:00
usb-s3c6400: use more complete functions from usb-drv-as3525v2
update copyright git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31508 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
18bee1bafb
commit
fd5cb720c4
2 changed files with 25 additions and 34 deletions
|
|
@ -366,23 +366,6 @@ void INT_USB(void)
|
||||||
GINTSTS = sts;
|
GINTSTS = sts;
|
||||||
}
|
}
|
||||||
|
|
||||||
int usb_drv_port_speed(void)
|
|
||||||
{
|
|
||||||
static const uint8_t speed[4] = {
|
|
||||||
[DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ] = 1,
|
|
||||||
[DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ] = 0,
|
|
||||||
[DSTS_ENUMSPD_FS_PHY_48MHZ] = 0,
|
|
||||||
[DSTS_ENUMSPD_LS_PHY_6MHZ] = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned enumspd = extract(DSTS, enumspd);
|
|
||||||
|
|
||||||
if(enumspd == DSTS_ENUMSPD_LS_PHY_6MHZ)
|
|
||||||
panicf("usb-drv: LS is not supported");
|
|
||||||
|
|
||||||
return speed[enumspd & 3];
|
|
||||||
}
|
|
||||||
|
|
||||||
int usb_drv_request_endpoint(int type, int dir)
|
int usb_drv_request_endpoint(int type, int dir)
|
||||||
{
|
{
|
||||||
bool out = dir == USB_DIR_OUT;
|
bool out = dir == USB_DIR_OUT;
|
||||||
|
|
@ -456,10 +439,3 @@ int usb_drv_send(int ep, void *ptr, int len)
|
||||||
semaphore_wait(&endpoint->complete, TIMEOUT_BLOCK);
|
semaphore_wait(&endpoint->complete, TIMEOUT_BLOCK);
|
||||||
return endpoint->status;
|
return endpoint->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_drv_set_test_mode(int mode)
|
|
||||||
{
|
|
||||||
/* there is a perfect matching between usb test mode code
|
|
||||||
* and the register field value */
|
|
||||||
DCTL = (DCTL & ~bitm(DCTL, tstctl)) | (mode << DCTL_tstctl_bitp);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 by Michael Sparmann
|
* Copyright (C) 2009 by Michael Sparmann
|
||||||
|
* Copyright © 2010 Amaury Pouly
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
@ -81,6 +82,30 @@ int usb_drv_recv(int endpoint, void* ptr, int length)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int usb_drv_port_speed(void)
|
||||||
|
{
|
||||||
|
static const uint8_t speed[4] = {
|
||||||
|
[DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ] = 1,
|
||||||
|
[DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ] = 0,
|
||||||
|
[DSTS_ENUMSPD_FS_PHY_48MHZ] = 0,
|
||||||
|
[DSTS_ENUMSPD_LS_PHY_6MHZ] = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned enumspd = extract(DSTS, enumspd);
|
||||||
|
|
||||||
|
if(enumspd == DSTS_ENUMSPD_LS_PHY_6MHZ)
|
||||||
|
panicf("usb-drv: LS is not supported");
|
||||||
|
|
||||||
|
return speed[enumspd & 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_drv_set_test_mode(int mode)
|
||||||
|
{
|
||||||
|
/* there is a perfect matching between usb test mode code
|
||||||
|
* and the register field value */
|
||||||
|
DCTL = (DCTL & ~bitm(DCTL, tstctl)) | (mode << DCTL_tstctl_bitp);
|
||||||
|
}
|
||||||
|
|
||||||
#if CONFIG_CPU == AS3525v2 /* FIXME FIXME FIXME */
|
#if CONFIG_CPU == AS3525v2 /* FIXME FIXME FIXME */
|
||||||
# include "as3525/usb-drv-as3525v2.c"
|
# include "as3525/usb-drv-as3525v2.c"
|
||||||
#else
|
#else
|
||||||
|
|
@ -100,11 +125,6 @@ static union
|
||||||
unsigned char payload[64];
|
unsigned char payload[64];
|
||||||
} ctrlreq USB_DEVBSS_ATTR;
|
} ctrlreq USB_DEVBSS_ATTR;
|
||||||
|
|
||||||
int usb_drv_port_speed(void)
|
|
||||||
{
|
|
||||||
return (DSTS & 2) == 0 ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void reset_endpoints(int reinit)
|
static void reset_endpoints(int reinit)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
@ -331,11 +351,6 @@ void usb_drv_cancel_all_transfers(void)
|
||||||
restore_irq(flags);
|
restore_irq(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_drv_set_test_mode(int mode)
|
|
||||||
{
|
|
||||||
(void)mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void usb_drv_init(void)
|
void usb_drv_init(void)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++)
|
for (unsigned i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue