[ECOS] How to debug synchronisation in the usbs.c in a new usb-driver for the ARM at91sam7s...
oliver munz @ s p e a g
munz@speag.ch
Thu Feb 16 02:56:00 GMT 2006
I need a hint, what can go wrong in the usbs.c, or how to debug
condition-variables...
My problem is, that my code works reliable, if i use it whitout
kernel-objects, and that it works only a while in the usbs.c infrastructur,
and then blocks for ever...
When the usbs_devtab_cwrite() blocks, i see, that the complete-function is
called, but the thread never leave cyg_drv_cond_wait(&wait.signal);...
Beacuse the blocking is random after 5..20 transmissions, i can't set a
breake point on a interessting point, if i halt the system in the gdb i see
the empty thread...
what can be the reason for not realeasing the thread?
/* THIS WORKS FOR AT LEAST 24H RESTLESS TRANSMISSION */
static void usbs_callback(void *arg, int result){
*(int *) arg = result;
if (!result){
*(int *) arg = -EIO;
}
}
void usb_write_wo_io(cyg_addrword_t data){
int retcode;
const char str[] = "configuration points supported by eCos resulted in
systems that were faster to build (all"
"the hard work was coded into the configuration rules) and
resulted in smaller systems than manual"
"methods could produce (because the automated rules were more
all-seeing and all-knowing";
while (true){
if (usbs_sam7_ep0.state == USBS_STATE_CONFIGURED){
retcode = 0;
usbs_sam7_ep2.buffer = str;
usbs_sam7_ep2.buffer_size = sizeof(str);
usbs_sam7_ep2.complete_fn = usbs_callback;
usbs_sam7_ep2.complete_data = (void *) &retcode;
usbs_sam7_ep2.start_rx_fn(&usbs_sam7_ep2);
while (!retcode){
}
}
}
}
/* THIS BLOCKS AFTER A FEW TRANSMISSIONS */
void usb_write(cyg_addrword_t data){
Cyg_ErrNo retcode;
cyg_uint32 n;
const char str[] = "configuration points supported by eCos resulted in
systems that were faster to build (all"
"the hard work was coded into the configuration rules) and
resulted in smaller systems than manual"
"methods could produce (because the automated rules were more
all-seeing and all-knowing";
while (true){
if (usbs_sam7_ep0.state == USBS_STATE_CONFIGURED){
n = sizeof(str);
retcode = cyg_io_write(husbs[2], (void *) str, &n); /* handle to
the usbs-write-endpoint */
}
}
}
Thanks for any hint...
Oliver Munz
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usbs_at91sam7s.c
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20060216/b0c056b4/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usbs_at91sam7s_data.cxx
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20060216/b0c056b4/attachment.cxx>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usbs_at91sam7s.h
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20060216/b0c056b4/attachment.h>
-------------- next part --------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list