Subject:
|
Re: LNP Packet Handlers on RCX
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 20 Oct 2000 22:21:20 GMT
|
Viewed:
|
1366 times
|
| |
| |
Hi,
I think some things need clearification:
1. lnp_address_handler() is called from interrupt. It may not
sleep. There is sample code how to do the packet handling,
sleeping and malloc()'ing in legOS/kernel/program.c
2. Interrupts or functions called by interrupts may not sleep,
this means exactly may not be rescheduled. Doing a reschedule
in a function called on an interrupt will confuse any thread's
stack, and thus scheduling in a whole in legOS.
This is the complete problem. It will crash your system.
Not sleeping implies: no semaphores, no malloc, no yield, any
such stuff...
My $0.02
>
> > > I remember reading somewhere a while back, when I first started dabbling
> > > with LNP, that LNP handlers on the RCX side were called from interrupts
> >
> > In legOS v0.2.3 and probably in v0.2.4 they are still called from the
> > interrupt handler (rx_handler).
>
> Yes. lnp_integrity_handler() and lnp_address_handler()s are still
> called from IR byte receiving interrupt. No problem in the actual
> implementation (taking care of it) but it should be a nice thing
> to separate byte receiving from packet handling. Should be in the
> TODO file... :-)
>
> > The interrupt handling should be fast, hence any heavy proccessing in
> > lnp_handler is discouraged. Msleep, malloc and similiar functions can block the
> > lnp_handler, so they also shouldn't be called in lnp_handler. Otherwise your
> > programs can behave randomly:
> > sometimes they execute correctly, sometimes they hang up .
>
> I think so. It's a bad behavier using msleep() in a interrupt
> handler.
>
> > Thread safe does not mean the interrupt safe. These are two distinct cases.
> > Msleep, malloc, free are , or at least should be, the thread safe functions,
> > as there are few semaphores to control the resources.
>
> They are.
>
> > Multitask writing in LNP of legOS v 0.2.3 was not a thread safe because
> > there was a small bug in the kernel (Martin Cornelius provided a patch
> > with LNPD).
>
> This patch is already included in legOS 0.2.4. I've personally
> verified this piece of code.
>
> Bye,
> Paolo.
>
> ---
> Fett's Law: Never replicate a successful experiment.
Eddie C. Dost
ecd@skynet.be
|
|
Message is in Reply To:
| | Re: LNP Packet Handlers on RCX
|
| (...) started dabbling (...) interrupts (...) from the (...) Yes. lnp_integrity_handler() and lnp_address_handler()s are still called from IR byte receiving interrupt. No problem in the actual implementation (taking care of it) but it should be a (...) (24 years ago, 20-Oct-00, to lugnet.robotics.rcx.legos)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|