RTEMS Q returns RTEMS_SUCCESSFUL but with length of message zero
Joel Sherrill
joel.sherrill at OARcorp.com
Fri May 10 18:08:06 UTC 2002
John Bebbington wrote:
>
> Hi,
>
> I have been using RTEMS for some time now with very good results.
> Unfortunately I still have an unexplained event which I currently have a
> work-around for in the application but would like to ask if perhaps the
> behaviour is correct or not.
You are always beating the message queue up. :)
> When using rtems_message_queue_receive(..) with no blocking (polling) I get
> a return code RTEMS_SUCCESSFUL but when I check the length of the message it
> is zero!
What version of RTEMS are you using? Just in case something has been
reported since this.
What specific calls are you making at the task/receive level and
ISR/send
level?
What CPU are you on? There was a recent patch against the m68k to
address a
VERY m68k specific problem in honoring RTEMS protocol in recording ISR
level.
My gut feeling is to do a source examination for potential windows.
> The example below shows the call and the additional plaus test I am doing as
> a work-around.
>
> Additional Information:
> ========================
>
> o The system is being interrupted by about 5 levels of interrupt handlers
> which all are attached to RTEMS via the
> rtems_interrupt_catch directive.
> o When The CPU duty is approx 12% the error does not occur, but with
> additional transmits and a duty of 49% the
> errors start occurring.
>
> The question is, is the call to rtems_message_queue_receive() "managed" to
> the extend that the RTEMS_SUCESSFUL can only be returned when there is a
> message available.
>
> -----start of code snippit ---------------
>
> rtems_status_code status ;
> unsigned32 size = 0;
> bool newmsg;
>
> // Check for new messages on the input Q but do not WAIT!!!
> status = (
> QueueID[q_BIT_HISTORY_Q],
> rec,
> &size,
> RTEMS_NO_WAIT,
> 0
> );
>
> switch (status){
> case RTEMS_SUCCESSFUL:
> newmsg = true;
> break;
> case RTEMS_UNSATISFIED:
> newmsg = false;
> break;
> default:
> newmsg = false;
> ON_RTEMS_ERROR_LOG2( status, E_RTEMS_Q_READ, 0x0001 );
> break;
> };
>
> if ( newmsg && (size == 0) ){
>
> // Extra check for plausibility.
> // =============================
> // We sometimes get a message with length = 0
> // but with status RTEMS_SUCCESSFUL, this is not logical.
> // In this case we shall ignore the zeroed message and log the error.
>
> newmsg = false;
> LOG2( E_RTEMS_Q_RETURNS_OK_BUT_LEN_ZERO,0x0001);
> }
>
> -----end of code snippit ---------------
>
> John Bebbington
> Freelance Software Engineer
> Black Forest
> Germany
> web-site : www.rtss.de
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list