EIE 322 Interface and Embedded Systems - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

EIE 322 Interface and Embedded Systems

Description:

Which kind of architecture to choose largely depends on the control you need to ... very simple devices, such as toys, calculators, alarm clocks and digital watches. ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 29
Provided by: mhas1
Category:

less

Transcript and Presenter's Notes

Title: EIE 322 Interface and Embedded Systems


1
EIE 322 Interface and Embedded Systems
Embedded-software architectures
Chapter 5 of D. Simon E. An Embedded
Software Primer QA76.6.S5726 1999
2
Embedded Software Architectures
  • Which kind of architecture to choose largely
    depends on the control you need to have over
    system response.
  • How hard is it to achieve good response?
  • Depends on
  • responses needed specified in absolute time
  • speed of your microprocessor
  • other processing requirements

3
Round-Robin
  • This is effectively a large main program loop
    that checks conditions successively and perform
    needed actions. (Figure 5.1)
  • No interrupts, no shared data, no latency
    concerns.
  • Main advantage over other architectures
    Simplicity.
  • It is an attractive potential architecture, if it
    can satisfy the systems performance
    requirements. Example Digital Multimeter p.116

4
Round-Robin (cont)
  • Disadvantages
  • Worst case response time is the time it takes the
    microprocessor to get once around the main loop
    in the worst-case.
  • Even when response times are not critical, the
    system may not perform well if there is any
    lengthy processing to do.
  • This architecture is fragile. Addition of a
    device or requirement may break everything.
  • It is chosen only for very simple devices, such
    as toys, calculators, alarm clocks and digital
    watches.

5
Round-Robin with Interrupts
  • In this architecture, interrupt routines deal
    with the very urgent needs of the hardware and
    then set flags the main loop polls the flags and
    does any follow-up processing required by the
    interrupts. (Figure 5.4)
  • Compare to the Round-Robin architecture this one
    has more control over priorities.
  • As all of the task code executes at the same
    priority, device B will need to wait after the
    execution of device A before it can start to
    execute.

6
Shared-data Problem
  • Shared-data problems can occur.
  • You need to use the various techniques that
    discussed in last lecture for dealing with shared
    data.

7
Example 1 A simple bridge
  • Consider a two-ported communications bridge that
    forwards data traffic received on the first port
    to the second and vice versa. (Figure 5.6 in
    book)
  • The data on one of the ports is encrypted and
    that it is the job of the bridge to encrypt and
    decrypt the data as it passes it through.
  • Code for a very simple bridge is shown in Figure
    5.7 of book.

8
Example 2 Cordless Bar-Code Scanner
  • Although more complicated, a bar-code scanner is
    essentially a device that gets the data from the
    laser that reads the bar codes and sends that
    data out to the radio.
  • As in the bridge, the only real response
    requirement is to service the hardware quickly
    enough. The task can be done quickly enough by a
    round-robin loop.

9
Disadvantages
  • What is the worst-case response for the task code
    for any given device ?
  • Worst-case response occurs when the target
    devices interrupt is asserted just after the
    round-robin loop have skipped the devices task
    code, and every other device needs service before
    the target device will be checked again.
  • The worst-case response is at least the sum of
    the execution times of the task code for every
    other device

10
Disadvantages (cont)
  • Examples of systems for which the
    round-robin-with interrupts architecture does not
    work well include the following ones
  • A laser printer
  • Why? ANS.
  • Hint calculating the locations where the black
    dots go is very time-consuming.
  • The underground tank-monitoring system
  • Why? ANS.

11
Function-Queue-Scheduling Architecture
  • Figure 5.8 shows another, yet more sophisticated
    architecture.
  • Upon occurrence of an event, the interrupt
    routines add function pointers to a queue of
    function pointers .
  • The main loop repeatedly fetch pointers from the
    queue to call the functions.

12
Function-Queue-Scheduling Architecture (cont)
  • Advantages
  • The main loop can call functions based on any
    priority scheme that suits your purposes. Any
    task code functions that need quicker response
    can be executed earlier.
  • Draw backs
  • If one of the lower-priority task code functions
    is quite long, it will affect the response for
    the higher-priority functions.

13
Real-Time Operating System Architecture
  • A very simple sketch of how it works is shown in
    Figure 5.9.
  • The differences between this architecture and the
    previous ones are that
  • Signaling between the interrupt routines and the
    task code is handled by the real-time operating
    system. Share variables can also be omitted.

14
Real-Time Operating System Architecture (cont)
  • What needs to be done next is not decided by a
    main loop.
  • The real-time operating system decides which of
    the task code functions should run next.
  • The real-time operating system knows which task
    is more urgent.
  • The real-time operating system can suspend on
    task code subroutine in the middle of its
    processing in order to run a higher priority one.
  • Sophisticated uses of this architecture will be
    discuss more in later lectures.

15
Advantages
  • Advantages
  • System using the real-time-operating-system
    architecture can control task code response as
    well as interrupt routine response. The possible
    priority levels for a real-time operating system
    architecture is shown in Figure 5.10.
  • Changes to lower-priority functions do not
    generally affect the response of higher-priority
    functions.

16
Disadvantages
  • Disadvantages
  • The primary disadvantage is that the real-time
    operating system is a big piece of code and
    itself uses a certain amount of processing time.
    You are getting better response at the expense of
    code memory and some processing time.

17
Characteristics of Various Software Architectures
  • Priorities
  • Response
  • Stability
  • Simplicity

18
Selecting an Architecture
  • Suggestions about selecting an architecture for
    your system.
  • Select the simplest architecture that will meet
    your response requirement.
  • If your system has many tasks of wide response
    requirements, you should then consider using a
    real-time operating system.

19
Selecting an Architecture
  • Hybrid architectures can make sense for some
    systems. Example even if you are using a
    real-time operating system, you can let a
    low-priority task to poll those parts of the
    hardware(e. g. keypad) that do not need fast
    response.

20
(No Transcript)
21
(No Transcript)
22
(No Transcript)
23
Capture event A Enqueue pointer_to_function_A
Capture event B Enqueue pointer_to_function_B
Main
Call up functions in the queue
Actions for A
Actions for B
24
(No Transcript)
25
(No Transcript)
26
(No Transcript)
27
Answer A laser printer
  • Since calculating the locations where the black
    dots go is very time-consuming the only code
    that will get good response is code in interrupt
    routines.
  • Any task code may potentially be stuck while the
    system calculates more locations for black dots.
  • Back to the question

28
Answer the underground tank-monitoring system
  • Similar to the laser printer, the tank-monitoring
    system has a processor hog the code that
    calculates how much gasoline is in the tanks.
  • To avoid putting all the rest of the code into
    interrupt routines, a more sophisticated
    architecture is required for this system as well.
  • Back to the question
Write a Comment
User Comments (0)
About PowerShow.com