Embedded System
Embedded System
EMBEDDED SOFTWARE
Device driver definition:
A device driver is software or opening, connecting or binding, reading,
writing and closing or controlling action of a device. It is software written in high
level language. It controls functions for device open (configure), connect, bind,
listen, read or write or close. The device driver executes after the programming of
the control register (or word) of a peripheral or virtual device. The driver reads
the status register, gets the inputs and writes the outputs.
A driver controls three functions
1) Initialling which is activated by placing appropriate bit at the control register
2) Calling an ISR on interrupt or on setting a status flag in the status register and
running the ISR (Interrupt Handler Routine)
3) Resetting the status flag after an interrupt service.
NEED FOR DEVICE DRIVERS:
For designing embedded software, two types of devices are considered: physical
and virtual. Physical devices eg : keyboard, printer or display unit virtual devices
Eg: A file or pipe or socket or RAM disk Each device in a system needs device
driver routines. An ISR relates to a device driver function. The examples of
generic functions used for the commands to the device are device create (), open
(), connect (), Bind (), Read (), write (). IOctl (), delete () and close(). Device
driver can be considered as a function in software layer of an application
program and the device. Ex the application sends the commands to write on a
display screen of a mobile. The contact names from the contact database.
A common driver or separate drivers for each device function are required.
Device drivers and their corresponding ISRs are the important routines in most
systems.
The driver has the following features.
1. The driver provides a software layer (interface) between the application and
actual device:
2. The driver facilitates the use of a device by executing an ISR: The driver
function is usually written in such a manner that it can be used like a black
box by an application developer.
Writing physical device driving ISRs in a system
For writing the software for driver in assembly, the following points must be
clear.
1.information about how the device communicates.
2information about the three sets of device registers data registers or buffers,
control registers and status registers
3.Information of other registers and common address to a device register.
4.Control register bits control all actions of the device.
5.Status register bits reflect the flags for status of the device at an instant and
changes after performing actions as per the device driver.
6.Ether setting of an enable bit(interrupt control flag ) is used by the system to
initiate a call for executing an ISR related to the device drive function.
Virtual device drivers
Virtual device drivers emulate the hardware
Eg: hard disk and generate software interrupts similar to physical device drivers.
T he file and pipe are two two examples of virtual device drivers.
Consider the analogies of a files device with a physical device.
Eg: just as a file needs to be opened to enable read and write operations , a
device may need to sent an interrupt call for initializing and configuring
it(opening, registering or attaching it. Setting control bits appropriately does
this).The concept of virtual(software) device drivers is very important in
programming. Eg: A memory block can have data buffers in analogy to buffers
in analogy to buffers at an IO device and can be accessed from a char driver or a
block driver. The device is called the device or the block device when it can
access a character or a block of character, respectively.
parallel port drivers in a system
device driver read() function can be implemented by calling an ISR is
Port_ISR_Input, which handle the port input. The below figure1 shows control
and status bits used in the ISRs in the device drivers and port pins interface with
the at a bus
figure 2 shows step A for port initialization, step B for calling the driver
and steps 0 to 5 for driver Port_ISR_input.
4. PC vs PCB
Though embedded developers work on PC they are not writing software
for PCs. They use the PC to build their software which eventually runs on
another platform (a Printed Circuit Board with a Micro controller). Embedded
software engineers develop software for these BOARDS and move the
executable binary from the PC to the board using debugging tools or specific
connectivity options. Software developers develop software that run on PCs or
PC equivalents (like servers). Whether the software runs in a bank, shipyard, our
fedex store, Airport or Grocery store it runs on a computer. May be nowadays
they run on Mobile phones and tablets too. From an embedded perspective
today's tablets and mobiles don't differ much from PCs as they are all are more
General Purpose.
5. Oscilloscopes vs Breakpoints
Embedded C
It is a set of language extensions for the C Programming language by the C
Standards committee to address commonality issues that exist between C
extensions
for
different embedded
systems.
Historically,
embedded
It is fairly efficient
Compilers
for
(ANSI
C)
typically
generate
OS
dependant