On Sat, 19 Jan 2008 18:52:47 -0800, NewToFPGA wrote:
> Hi,
>
> I have just started working on programming on low level in the embedded
> systems. I understand some basic stuff and trying to get my self
> familiarize with some low level programming aspects. Below are some of
> the questions I have:
>
> How expensive are task switchings in a 400 MHz processor (MPC82xx based
> processor)?
As expensive as your RTOS makes them. This should be part of the RTOS
documentation.
> How much time this processor takes to run one assembly instrustion?
That depends on your processor, and should be in the processor
documentation, or is at least something that you can benchmark.
Generally the execution time will vary with instruction, and for
processors with pipelines the execution time will depend on the
instructions that precede and follow the instruction in question, which
makes it very difficult to predict how long it will take to execute.
> Can I implement a polling interms of micro seconds?
That depends on your environment. If you have a 400MHz processor,
probably -- but if you're polling once every 1us you'll find that you'll
use a lot of clock ticks just for the polling.
> If I have the
> polling implemented in the task (or thread) level code what are the
> common problem that I would face? If not at the task level, is there
> anything I can do in the hardware configuration that I can request a
> timed interrupt?
That depends on your processor, and should be in its documentation. Does
it have hardware timers? Can the timers throw interrupts?
> How do I configure some interrupts so that an FPGA can raise it when
> there some data for the software to read?
>
You read the processor documentation, and maybe some applications notes,
and you figure it out.
I'm not trying to be snide here -- every processor has the World's Most
Clever way of turning on interrupts, and every processor designer thinks
that all the rest are idiots -- so techniques vary.
Usually you have to set (or clear) a global interrupt mask, and set (or
clear) an interrupt mask for the specific interrupt you want to enable.
You'll have to specify where the ISR is to the processor, unless your
processor vectors to fixed locations. On many microcontrollers, each pin
can do approximately one bazzilion different things, so you also have to
configure the pin correctly as an interrupt input.
Finally, you have to spend a week or two struggling with the one
important part that got left out of the manual, or is in the manual for
some seemingly unrelated part of the processor. Usually this involves
flipping the default value of one frigging little bit in an obscure
register someplace, but sometimes it requires completely rewriting all
your code.
--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com
Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes,
http://www.wescottdesign.com/actfes/actfes.html