forked from len0rd/rockbox
Simpilify the uncached buffer allocation for the USB stack using NOCACHEBSS_ATTR. This will probably get abstracted since the appropriate way to handle it will be somewhat target-specific.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17140 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
735790fde0
commit
5ff61eee6a
2 changed files with 14 additions and 18 deletions
|
|
@ -302,8 +302,8 @@ struct transfer_descriptor {
|
||||||
unsigned int reserved;
|
unsigned int reserved;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
static struct transfer_descriptor _td_array[NUM_ENDPOINTS*2] __attribute((aligned (32)));
|
static struct transfer_descriptor td_array[NUM_ENDPOINTS*2]
|
||||||
static struct transfer_descriptor* td_array;
|
NOCACHEBSS_ATTR;
|
||||||
|
|
||||||
/* manual: 32.13.1 Endpoint Queue Head (dQH) */
|
/* manual: 32.13.1 Endpoint Queue Head (dQH) */
|
||||||
struct queue_head {
|
struct queue_head {
|
||||||
|
|
@ -318,8 +318,9 @@ struct queue_head {
|
||||||
unsigned int wait; /* for softwate use, indicates if the transfer is blocking */
|
unsigned int wait; /* for softwate use, indicates if the transfer is blocking */
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
static struct queue_head _qh_array[NUM_ENDPOINTS*2] __attribute((aligned (2048)));
|
static struct queue_head qh_array[NUM_ENDPOINTS*2]
|
||||||
static struct queue_head* qh_array;
|
NOCACHEBSS_ATTR __attribute((aligned (2048)));
|
||||||
|
|
||||||
static struct event_queue transfer_completion_queue[NUM_ENDPOINTS*2];
|
static struct event_queue transfer_completion_queue[NUM_ENDPOINTS*2];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -367,10 +368,8 @@ void usb_drv_init(void)
|
||||||
REG_PORTSC1 |= PORTSCX_PORT_FORCE_FULL_SPEED;
|
REG_PORTSC1 |= PORTSCX_PORT_FORCE_FULL_SPEED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
td_array = (struct transfer_descriptor*)UNCACHED_ADDR(&_td_array);
|
|
||||||
qh_array = (struct queue_head*)UNCACHED_ADDR(&_qh_array);
|
|
||||||
init_control_queue_heads();
|
init_control_queue_heads();
|
||||||
memset(td_array, 0, sizeof _td_array);
|
memset(td_array, 0, sizeof td_array);
|
||||||
|
|
||||||
REG_ENDPOINTLISTADDR = (unsigned int)qh_array;
|
REG_ENDPOINTLISTADDR = (unsigned int)qh_array;
|
||||||
REG_DEVICEADDR = 0;
|
REG_DEVICEADDR = 0;
|
||||||
|
|
@ -646,7 +645,7 @@ void usb_drv_cancel_all_transfers(void)
|
||||||
REG_ENDPTFLUSH = ~0;
|
REG_ENDPTFLUSH = ~0;
|
||||||
while (REG_ENDPTFLUSH);
|
while (REG_ENDPTFLUSH);
|
||||||
|
|
||||||
memset(td_array, 0, sizeof _td_array);
|
memset(td_array, 0, sizeof td_array);
|
||||||
for(i=0;i<NUM_ENDPOINTS*2;i++) {
|
for(i=0;i<NUM_ENDPOINTS*2;i++) {
|
||||||
if(qh_array[i].wait) {
|
if(qh_array[i].wait) {
|
||||||
qh_array[i].wait=0;
|
qh_array[i].wait=0;
|
||||||
|
|
@ -776,7 +775,7 @@ static void bus_reset(void)
|
||||||
static void init_control_queue_heads(void)
|
static void init_control_queue_heads(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
memset(qh_array, 0, sizeof _qh_array);
|
memset(qh_array, 0, sizeof qh_array);
|
||||||
|
|
||||||
/*** control ***/
|
/*** control ***/
|
||||||
qh_array[EP_CONTROL].max_pkt_length = 64 << QH_MAX_PKT_LEN_POS | QH_IOS;
|
qh_array[EP_CONTROL].max_pkt_length = 64 << QH_MAX_PKT_LEN_POS | QH_IOS;
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ static const struct usb_qualifier_descriptor __attribute__((aligned(2)))
|
||||||
.bNumConfigurations = 1
|
.bNumConfigurations = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_string_descriptor __attribute__((aligned(2)))
|
static const struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
usb_string_iManufacturer =
|
usb_string_iManufacturer =
|
||||||
{
|
{
|
||||||
24,
|
24,
|
||||||
|
|
@ -129,7 +129,7 @@ static struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
{'R','o','c','k','b','o','x','.','o','r','g'}
|
{'R','o','c','k','b','o','x','.','o','r','g'}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_string_descriptor __attribute__((aligned(2)))
|
static const struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
usb_string_iProduct =
|
usb_string_iProduct =
|
||||||
{
|
{
|
||||||
42,
|
42,
|
||||||
|
|
@ -152,7 +152,7 @@ static struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
/* Generic for all targets */
|
/* Generic for all targets */
|
||||||
|
|
||||||
/* this is stringid #0: languages supported */
|
/* this is stringid #0: languages supported */
|
||||||
static struct usb_string_descriptor __attribute__((aligned(2)))
|
static const struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
lang_descriptor =
|
lang_descriptor =
|
||||||
{
|
{
|
||||||
4,
|
4,
|
||||||
|
|
@ -160,7 +160,7 @@ static struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
{0x0409} /* LANGID US English */
|
{0x0409} /* LANGID US English */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_string_descriptor __attribute__((aligned(2)))
|
static const struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
usb_string_charging_only =
|
usb_string_charging_only =
|
||||||
{
|
{
|
||||||
28,
|
28,
|
||||||
|
|
@ -168,7 +168,7 @@ static struct usb_string_descriptor __attribute__((aligned(2)))
|
||||||
{'C','h','a','r','g','i','n','g',' ','o','n','l','y'}
|
{'C','h','a','r','g','i','n','g',' ','o','n','l','y'}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct usb_string_descriptor* usb_strings[] =
|
static struct usb_string_descriptor* const usb_strings[] =
|
||||||
{
|
{
|
||||||
&lang_descriptor,
|
&lang_descriptor,
|
||||||
&usb_string_iManufacturer,
|
&usb_string_iManufacturer,
|
||||||
|
|
@ -244,8 +244,7 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
|
||||||
static void usb_core_control_request_handler(struct usb_ctrlrequest* req);
|
static void usb_core_control_request_handler(struct usb_ctrlrequest* req);
|
||||||
static int ack_control(struct usb_ctrlrequest* req);
|
static int ack_control(struct usb_ctrlrequest* req);
|
||||||
|
|
||||||
static unsigned char *response_data;
|
static unsigned char response_data[256] NOCACHEBSS_ATTR;
|
||||||
static unsigned char __response_data[CACHEALIGN_UP(256)] CACHEALIGN_ATTR;
|
|
||||||
|
|
||||||
static struct usb_transfer_completion_event_data events[NUM_ENDPOINTS];
|
static struct usb_transfer_completion_event_data events[NUM_ENDPOINTS];
|
||||||
|
|
||||||
|
|
@ -317,8 +316,6 @@ void usb_core_init(void)
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
response_data = (void*)UNCACHED_ADDR(&__response_data);
|
|
||||||
|
|
||||||
usb_drv_init();
|
usb_drv_init();
|
||||||
|
|
||||||
/* class driver init functions should be safe to call even if the driver
|
/* class driver init functions should be safe to call even if the driver
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue