EmbeddedRelated.com
Forums

waitfor(writeUserBlock) within costate

Started by gpyl2003 October 18, 2004

Hello,

I wish to write 160 chars into the user block area
of a BL2000 board within a costate statement as follows:

char ProgInfo[160];

costate {
waitfor(getOk = writeUserBlock(0, &ProgInfo, 160));
..
..
}

Is this logical to do because i get a communication timeout
error whilst debugging?

Kind regards,
Jerry



Writing to the userblock is SLOW, writing 1024 bytes can
take approx one second. If I'm correct interrupts are disabled
while writing the userblock, which can kill DC's serial link.

Matt

On Mon, 18 Oct 2004 07:59:36 -0000, gpyl2003 wrote:

>
>
>Hello,
>
>I wish to write 160 chars into the user block area
>of a BL2000 board within a costate statement as follows:
>
>char ProgInfo[160];
>
>costate {
> waitfor(getOk = writeUserBlock(0, &ProgInfo, 160));
>..
>..
>}
>
>Is this logical to do because i get a communication timeout
>error whilst debugging?
>
>Kind regards,
>Jerry



At 09:37 AM 10/18/2004, you wrote:
> >
> >
> >Hello,
> >
> >I wish to write 160 chars into the user block area
> >of a BL2000 board within a costate statement as follows:
> >
> >char ProgInfo[160];
> >
> >costate {
> > waitfor(getOk = writeUserBlock(0, &ProgInfo, 160));
> >..
> >..
> >}
> >
> >Is this logical to do because i get a communication timeout
> >error whilst debugging?
> >
> >Kind regards,
> >Jerry

Why use a waitfor?

waitfor() loops until the function returns true. writeUserBlock() returns 0
on success; so, the code will loop forever rewriting the user block.

Either remove the waitfor or change the line to:

waitfor(getOk = writeUserBlock(0, &ProgInfo, 160)==0);

I would remove the waitfor.

<Scott



Thank you all.

Regards,
Jerry

--- In rabbit-semi@rabb..., Scott Henion <shenion@s...> wrote:
> At 09:37 AM 10/18/2004, you wrote:
> > >
> > >
> > >Hello,
> > >
> > >I wish to write 160 chars into the user block area
> > >of a BL2000 board within a costate statement as follows:
> > >
> > >char ProgInfo[160];
> > >
> > >costate {
> > > waitfor(getOk = writeUserBlock(0, &ProgInfo, 160));
> > >..
> > >..
> > >}
> > >
> > >Is this logical to do because i get a communication timeout
> > >error whilst debugging?
> > >
> > >Kind regards,
> > >Jerry
>
> Why use a waitfor?
>
> waitfor() loops until the function returns true. writeUserBlock()
returns 0
> on success; so, the code will loop forever rewriting the user block.
>
> Either remove the waitfor or change the line to:
>
> waitfor(getOk = writeUserBlock(0, &ProgInfo, 160)==0);
>
> I would remove the waitfor.
>
> <Scott>