Page 1 of 1

sdWrite behavoir

Posted: Mon May 30, 2016 12:37 pm
by neums
Hi,
is the sdWrite function blocking until the data is transferred? In my application it does not block.

I use my own task scheduler and the osless-osal. When i get a task overrun the software shall lead into an endless loop until the watchdog gets active. Before entering this loop i want to disable the interrupts globally by osalSysDisable().

Before disabling the interrupt i want to send an error message via the serial driver. But i just get a few letters...

Thanks

Re: sdWrite behavoir

Posted: Mon May 30, 2016 1:08 pm
by Giovanni
Hi,

sdWrite() blocks until all the data has been written on the output buffer, this does not mean actually transmitted.

If you need to synchronize with the physical transmission look for the serial driver events, there is an event signalling that

Giovanni

Re: sdWrite behavoir

Posted: Mon May 30, 2016 2:19 pm
by neums
Hi,
thanks. I wrote a little helper for this usecase:

Code: Select all

#define sdBlockingWrite(sdp, b, n)                       \
  sdp->event.flags &= ~CHN_TRANSMISSION_END;             \
  oqWriteTimeout(&(sdp)->oqueue, b, n, TIME_INFINITE);   \
  while((sdp->event.flags & CHN_TRANSMISSION_END) == 0)


Maybe it is interesting.

Re: sdWrite behavoir

Posted: Mon May 30, 2016 2:34 pm
by Giovanni
Hi,

There is no need to poll for the event, you could use event wait functions for this.

Giovanni

Re: sdWrite behavoir

Posted: Mon May 30, 2016 2:57 pm
by neums
Which is the function without RT? I just use the os-less osal. Is there a function like chEvtWaitOne without RT?

Re: sdWrite behavoir

Posted: Mon May 30, 2016 3:34 pm
by Giovanni
There is no such function, without OS events are implemented as callbacks. See the details in OSAL.

Giovanni