Information Technology Reference
In-Depth Information
if it is interrupted by another routine, the original's program return address is pushed
onto the stack and the other subroutine executes. When the subroutine is finished,
the run-time stack pops the address of the previous routine and it continues with its
execution. The operating system is responsible for allocating memory for use by the
run-time stack. A stack is a data structure that follows a last-in, first-out of data return.
In other words, the information that is stored on the stack most recently is returned
first. Table 3.1 shows a comparison for several memory management design options.
3.3.2
Peripheral Communication (Input / Output)
There are several different ways for a system to communicate with its peripherals.
Peripherals are considered external to the system, but either input or output provides
vital information to the system or takes data from the system and performs a task
with it. With an embedded system, there is a microprocessor performing the tasks
for the system, but many times, it requires data from outside the system. These data
can be provided by analog sensors such as voltage or current sensors. Some sensors
may measure brightness or wind speed. Depending on the purpose of the embedded
system, a variety of sensors and/or actuators may be required. Although sensors are
input devices, meaning the data are inputted into the microprocessor, other devices
such as switches and actuators are output devices. Output devices are controlled by the
microprocessor and the microprocessor controls these outputs by sending different
signals to it.
Real-time operating systems provide different methods to communicate with
peripherals; these methods include interrupts, polling, and direct memory access
(DMA). Depending on the operating system design, an operating system may offer
one or all of these methods.
Arguably, one of the most popular methods of notifying the system that hardware
requires service is interrupts. The operating system must be prepared to handle
interrupts as they occur, and most hardware interrupts occur asynchronously or at
any time. The operating system must store the data in memory so it can be processed
by the application at a later time. There are two main types of interrupts, hardware
and software. With hardware interrupts, the operating system is not responsible for
executing code to handle the interrupt. Instead the CPU usually handles the interrupt
without the assistance of any software. However, the operating system does handle
two things for the interrupt; it loads the program counter with the memory address
of the Interrupt Service Routine (ISR), and when the ISR completes, it loads the
program counter with the next instruction of the task it interrupted. An interrupt
vector is needed when there are more than one hardware interrupt lines in the system.
The addresses of the interrupt service routines are stored in the interrupt vector, and
when a particular interrupt occurs, the vector points to its corresponding service
routine. In a system with only one hardware interrupt, an interrupt vector is not
needed and control is passed to the one service routine.
Hardware interrupts can be either edge-triggered or level-triggered. An edge-
triggered interrupt is when the interrupt is recognized during a transition from high
to low or vice versa. The device that needs to cause an interrupt sends a pulse on the
Search WWH ::




Custom Search