This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to debug synchronisation in the usbs.c in a new usb-driver for the ARM at91sam7s...


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

Attachment: usbs_at91sam7s.c
Description: Text document

Attachment: usbs_at91sam7s_data.cxx
Description: Text document

Attachment: usbs_at91sam7s.h
Description: Text document

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]