mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-12 14:45:11 -05:00
FS#10226 - isp1583.c code cosmetics
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22866 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4221a7f22f
commit
9b2f4c3a65
1 changed files with 71 additions and 65 deletions
|
|
@ -109,7 +109,7 @@ static inline void usb_select_setup_endpoint(void)
|
||||||
|
|
||||||
static void usb_setup_endpoint(int idx, int max_pkt_size, int type)
|
static void usb_setup_endpoint(int idx, int max_pkt_size, int type)
|
||||||
{
|
{
|
||||||
if(epidx_n(idx)!=0)
|
if(epidx_n(idx)!=EP_CONTROL)
|
||||||
{
|
{
|
||||||
usb_select_endpoint(idx);
|
usb_select_endpoint(idx);
|
||||||
ISP1583_DFLOW_MAXPKSZ = max_pkt_size & 0x7FF;
|
ISP1583_DFLOW_MAXPKSZ = max_pkt_size & 0x7FF;
|
||||||
|
|
@ -135,7 +135,7 @@ static void usb_setup_endpoint(int idx, int max_pkt_size, int type)
|
||||||
|
|
||||||
static void usb_enable_endpoint(int idx)
|
static void usb_enable_endpoint(int idx)
|
||||||
{
|
{
|
||||||
if(epidx_n(idx)!=0)
|
if(epidx_n(idx)!=EP_CONTROL)
|
||||||
{
|
{
|
||||||
usb_select_endpoint(idx);
|
usb_select_endpoint(idx);
|
||||||
/* Enable interrupt */
|
/* Enable interrupt */
|
||||||
|
|
@ -336,8 +336,8 @@ static void usb_handle_setup_rx(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
usb_drv_stall(0, true, false);
|
usb_drv_stall(EP_CONTROL, true, false);
|
||||||
usb_drv_stall(0, true, true);
|
usb_drv_stall(EP_CONTROL, true, true);
|
||||||
logf("usb_handle_setup_rx() failed");
|
logf("usb_handle_setup_rx() failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -369,18 +369,24 @@ bool usb_drv_powered(void)
|
||||||
|
|
||||||
static void setup_endpoints(void)
|
static void setup_endpoints(void)
|
||||||
{
|
{
|
||||||
usb_setup_endpoint(ep_index(0, DIR_RX), 64, 0);
|
|
||||||
usb_setup_endpoint(ep_index(0, DIR_TX), 64, 0);
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
int max_pkt_size = (high_speed_mode ? 512 : 64);
|
||||||
|
|
||||||
|
usb_setup_endpoint(ep_index(EP_CONTROL, DIR_RX), 64,
|
||||||
|
USB_ENDPOINT_XFER_CONTROL);
|
||||||
|
usb_setup_endpoint(ep_index(EP_CONTROL, DIR_TX), 64,
|
||||||
|
USB_ENDPOINT_XFER_CONTROL);
|
||||||
|
|
||||||
for(i = 1; i < USB_NUM_ENDPOINTS-1; i++)
|
for(i = 1; i < USB_NUM_ENDPOINTS-1; i++)
|
||||||
{
|
{
|
||||||
usb_setup_endpoint(ep_index(i, DIR_RX), (high_speed_mode ? 512 : 64), 2); /* 2 = TYPE_BULK */
|
usb_setup_endpoint(ep_index(i, DIR_RX), max_pkt_size,
|
||||||
usb_setup_endpoint(ep_index(i, DIR_TX), (high_speed_mode ? 512 : 64), 2);
|
USB_ENDPOINT_XFER_BULK);
|
||||||
|
usb_setup_endpoint(ep_index(i, DIR_TX), max_pkt_size,
|
||||||
|
USB_ENDPOINT_XFER_BULK);
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_enable_endpoint(ep_index(0, DIR_RX));
|
usb_enable_endpoint(ep_index(EP_CONTROL, DIR_RX));
|
||||||
usb_enable_endpoint(ep_index(0, DIR_TX));
|
usb_enable_endpoint(ep_index(EP_CONTROL, DIR_TX));
|
||||||
|
|
||||||
for (i = 1; i < USB_NUM_ENDPOINTS-1; i++)
|
for (i = 1; i < USB_NUM_ENDPOINTS-1; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -517,7 +523,7 @@ static void in_callback(int ep, unsigned char *buf, int len)
|
||||||
int usb_drv_recv(int ep, void* ptr, int length)
|
int usb_drv_recv(int ep, void* ptr, int length)
|
||||||
{
|
{
|
||||||
logf("usb_drv_recv(%d, 0x%x, %d)", ep, (int)ptr, length);
|
logf("usb_drv_recv(%d, 0x%x, %d)", ep, (int)ptr, length);
|
||||||
if(ep == 0 && length == 0 && ptr == NULL)
|
if(ep == EP_CONTROL && length == 0 && ptr == NULL)
|
||||||
{
|
{
|
||||||
usb_status_ack(ep, DIR_TX);
|
usb_status_ack(ep, DIR_TX);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -527,7 +533,7 @@ int usb_drv_recv(int ep, void* ptr, int length)
|
||||||
endpoints[ep].in_max_len = length;
|
endpoints[ep].in_max_len = length;
|
||||||
endpoints[ep].in_min_len = length;
|
endpoints[ep].in_min_len = length;
|
||||||
endpoints[ep].in_ptr = 0;
|
endpoints[ep].in_ptr = 0;
|
||||||
if(ep == 0)
|
if(ep == EP_CONTROL)
|
||||||
{
|
{
|
||||||
usb_data_stage_enable(ep, DIR_RX);
|
usb_data_stage_enable(ep, DIR_RX);
|
||||||
return usb_receive(ep);
|
return usb_receive(ep);
|
||||||
|
|
@ -560,7 +566,7 @@ static void usb_drv_wait(int ep, bool send)
|
||||||
int usb_drv_send(int ep, void* ptr, int length)
|
int usb_drv_send(int ep, void* ptr, int length)
|
||||||
{
|
{
|
||||||
logf("usb_drv_send_nb(%d, 0x%x, %d)", ep, (int)ptr, length);
|
logf("usb_drv_send_nb(%d, 0x%x, %d)", ep, (int)ptr, length);
|
||||||
if(ep == 0 && length == 0 && ptr == NULL)
|
if(ep == EP_CONTROL && length == 0 && ptr == NULL)
|
||||||
{
|
{
|
||||||
usb_status_ack(ep, DIR_RX);
|
usb_status_ack(ep, DIR_RX);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -572,7 +578,7 @@ int usb_drv_send(int ep, void* ptr, int length)
|
||||||
endpoints[ep].out_len = length;
|
endpoints[ep].out_len = length;
|
||||||
endpoints[ep].out_ptr = 0;
|
endpoints[ep].out_ptr = 0;
|
||||||
endpoints[ep].out_in_progress = 1;
|
endpoints[ep].out_in_progress = 1;
|
||||||
if(ep == 0)
|
if(ep == EP_CONTROL)
|
||||||
{
|
{
|
||||||
int rc = usb_send(ep);
|
int rc = usb_send(ep);
|
||||||
usb_data_stage_enable(ep, DIR_TX);
|
usb_data_stage_enable(ep, DIR_TX);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue