View topic - 4 bytes Bulk problem in 6.2.1

4 bytes Bulk problem in 6.2.1

Read-only archive of qnx.ddk (Writing device drivers for scanners, video card, optical mouse, etc) at inn.qnx.com

4 bytes Bulk problem in 6.2.1

Postby Guest » Tue Mar 16, 2004 11:55 am

Hello everyone, i'v got a folowing code for bulk endpoint that was created from interrupt endpoint, hardware buffer is 4 bytes,
USB_TIMEOUT = USBD_TIME_INFINITY:

usbd_setup_bulk(dc[cn]->int_ep6_urb, URB_DIR_IN , dc[cn]->int_ep6_mem, dc[cn]->int_ep6_size);
while (1) {
if (usbd_io(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe, dc_int_cbf_ep6, dc[cn]->int_ep6_mem, USB_TIMEOUT)==EOK){
ds_int_wait_ep6(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe);
} else {
printf("ERROR !\n");
}
}
-------------
CallBack and Wait function are:
void dc_int_cbf_ep6( struct usbd_urb *urb, struct usbd_pipe *pipe, void *hdl )
{
pipe = pipe, hdl = hdl;

pthread_sleepon_lock( );
pthread_sleepon_signal( urb );
pthread_sleepon_unlock( );

return;
}

int ds_int_wait_ep6(struct usbd_urb *urb, struct usbd_pipe *pipe) {
_uint32 ustatus;
_uint32 alen;
int status;

pthread_sleepon_lock( );
while( ( status = usbd_urb_status( urb, &ustatus, &alen )) == EBUSY ) {
pthread_sleepon_wait( urb );
}
pthread_sleepon_unlock( );

if( ( ustatus & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL ) {
status = usbd_reset_pipe( pipe );
printf("Reset Pipe... 0x%x\n", status);
}
return(alen);
}

So, the problem is: after a few calls of usbd_io it returns !=OK value. What can it be? In WinXX all works OK.
Guest
 

Re: 4 bytes Bulk problem in 6.2.1

Postby Henry VanDyke » Tue Mar 16, 2004 3:05 pm

You should move the usbd_setup_bulk function inside the while loop.
Is this an interrupt endpoint or bulk ?
You should use usbd_setup_interrupt() for an interrupt endpoint.

Alexander Arkhipov <arkhipov@tst.spb.su> wrote in message
news:c36pvu$iek$1@inn.qnx.com...
Hello everyone, i'v got a folowing code for bulk endpoint that was created
from interrupt endpoint, hardware buffer is 4 bytes,
USB_TIMEOUT = USBD_TIME_INFINITY:

usbd_setup_bulk(dc[cn]->int_ep6_urb, URB_DIR_IN , dc[cn]->int_ep6_mem,
dc[cn]->int_ep6_size);
while (1) {
if (usbd_io(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe, dc_int_cbf_ep6,
dc[cn]->int_ep6_mem, USB_TIMEOUT)==EOK){
ds_int_wait_ep6(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe);
} else {
printf("ERROR !\n");
}
}
-------------
CallBack and Wait function are:
void dc_int_cbf_ep6( struct usbd_urb *urb, struct usbd_pipe *pipe, void
*hdl )
{
pipe = pipe, hdl = hdl;

pthread_sleepon_lock( );
pthread_sleepon_signal( urb );
pthread_sleepon_unlock( );

return;
}

int ds_int_wait_ep6(struct usbd_urb *urb, struct usbd_pipe *pipe) {
_uint32 ustatus;
_uint32 alen;
int status;

pthread_sleepon_lock( );
while( ( status = usbd_urb_status( urb, &ustatus, &alen )) == EBUSY ) {
pthread_sleepon_wait( urb );
}
pthread_sleepon_unlock( );

if( ( ustatus & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL ) {
status = usbd_reset_pipe( pipe );
printf("Reset Pipe... 0x%x\n", status);
}
return(alen);
}

So, the problem is: after a few calls of usbd_io it returns !=OK value.
What can it be? In WinXX all works OK.
Henry VanDyke
 

RE:Re: 4 bytes Bulk problem in 6.2.1

Postby Guest » Tue Mar 16, 2004 3:16 pm

This endpoint was reconfigurated from interrupt to bulk, but I still have the problem.
I have allready tryed to move the usbd_setup_bulk to the loop, but it doesn't helps.

We have a device with Control+4 endpoints:
02) Bulk_IN 64 bytes
04) Bulk_IN 64 bytes
06) Bulk_IN 4 bytes
08) Interrupt_OUT 4 bytes

From 02,04 endpoint we need to get a stream 128Kb/sec - OK!
From 06 endpoint only 150bytes/sec - OK!

The problem is:
when I'm working with 02,04 and 06 at the same time after a few minutes
the usbd_io at endpoint 06 returns an error. The same situation happens in
case of device with 06 endpoint configured as Interrupt_IN.

What can it be?

You should move the usbd_setup_bulk function inside the while loop.
Is this an interrupt endpoint or bulk ?
You should use usbd_setup_interrupt() for an interrupt endpoint.

Alexander Arkhipov <arkhipov@tst.spb.su> wrote in message
news:c36pvu$iek$1@inn.qnx.com...

Hello everyone, i'v got a folowing code for bulk endpoint that was created
from interrupt endpoint, hardware buffer is 4 bytes,
USB_TIMEOUT = USBD_TIME_INFINITY:

usbd_setup_bulk(dc[cn]->int_ep6_urb, URB_DIR_IN , dc[cn]->int_ep6_mem,
dc[cn]->int_ep6_size);
while (1) {
if (usbd_io(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe, dc_int_cbf_ep6,
dc[cn]->int_ep6_mem, USB_TIMEOUT)==EOK){
ds_int_wait_ep6(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe);
} else {
printf("ERROR !\n");
}
}
-------------
CallBack and Wait function are:
void dc_int_cbf_ep6( struct usbd_urb *urb, struct usbd_pipe *pipe, void
*hdl )
{
pipe = pipe, hdl = hdl;

pthread_sleepon_lock( );
pthread_sleepon_signal( urb );
pthread_sleepon_unlock( );

return;
}

int ds_int_wait_ep6(struct usbd_urb *urb, struct usbd_pipe *pipe) {
_uint32 ustatus;
_uint32 alen;
int status;

pthread_sleepon_lock( );
while( ( status = usbd_urb_status( urb, &ustatus, &alen )) == EBUSY ) {
pthread_sleepon_wait( urb );
}
pthread_sleepon_unlock( );

if( ( ustatus & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL ) {
status = usbd_reset_pipe( pipe );
printf("Reset Pipe... 0x%x\n", status);
}
return(alen);
}

So, the problem is: after a few calls of usbd_io it returns !=OK value.
What can it be? In WinXX all works OK.


.
Guest
 

Re: RE:Re: 4 bytes Bulk problem in 6.2.1

Postby Henry VanDyke » Tue Mar 16, 2004 8:27 pm

what is the error number that is returned ?

Alexander Arkhipov <arkhipov@tst.spb.su> wrote in message
news:c375ni$t7s$1@inn.qnx.com...
This endpoint was reconfigurated from interrupt to bulk, but I still have
the problem.
I have allready tryed to move the usbd_setup_bulk to the loop, but it
doesn't helps.

We have a device with Control+4 endpoints:
02) Bulk_IN 64 bytes
04) Bulk_IN 64 bytes
06) Bulk_IN 4 bytes
08) Interrupt_OUT 4 bytes

From 02,04 endpoint we need to get a stream 128Kb/sec - OK!
From 06 endpoint only 150bytes/sec - OK!

The problem is:
when I'm working with 02,04 and 06 at the same time after a few minutes
the usbd_io at endpoint 06 returns an error. The same situation happens in
case of device with 06 endpoint configured as Interrupt_IN.

What can it be?

You should move the usbd_setup_bulk function inside the while loop.
Is this an interrupt endpoint or bulk ?
You should use usbd_setup_interrupt() for an interrupt endpoint.

Alexander Arkhipov <arkhipov@tst.spb.su> wrote in message
news:c36pvu$iek$1@inn.qnx.com...

Hello everyone, i'v got a folowing code for bulk endpoint that was
created
from interrupt endpoint, hardware buffer is 4 bytes,
USB_TIMEOUT = USBD_TIME_INFINITY:

usbd_setup_bulk(dc[cn]->int_ep6_urb, URB_DIR_IN , dc[cn]->int_ep6_mem,
dc[cn]->int_ep6_size);
while (1) {
if (usbd_io(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe, dc_int_cbf_ep6,
dc[cn]->int_ep6_mem, USB_TIMEOUT)==EOK){
ds_int_wait_ep6(dc[cn]->int_ep6_urb, dc[cn]->int_ep6_pipe);
} else {
printf("ERROR !\n");
}
}
-------------
CallBack and Wait function are:
void dc_int_cbf_ep6( struct usbd_urb *urb, struct usbd_pipe *pipe,
void
*hdl )
{
pipe = pipe, hdl = hdl;

pthread_sleepon_lock( );
pthread_sleepon_signal( urb );
pthread_sleepon_unlock( );

return;
}

int ds_int_wait_ep6(struct usbd_urb *urb, struct usbd_pipe *pipe) {
_uint32 ustatus;
_uint32 alen;
int status;

pthread_sleepon_lock( );
while( ( status = usbd_urb_status( urb, &ustatus, &alen )) == EBUSY )
{
pthread_sleepon_wait( urb );
}
pthread_sleepon_unlock( );

if( ( ustatus & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL ) {
status = usbd_reset_pipe( pipe );
printf("Reset Pipe... 0x%x\n", status);
}
return(alen);
}

So, the problem is: after a few calls of usbd_io it returns !=OK
value.
What can it be? In WinXX all works OK.


.
Henry VanDyke
 


Return to qnx.ddk

Who is online

Users browsing this forum: No registered users and 1 guest