29.01.2015 Views

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Mo<strong>de</strong>ling and Integration of Peripheral Devices 75<br />

4.2. Device control<br />

The <strong>de</strong>vice control specifies the state changes of a <strong>de</strong>vice. Because a <strong>de</strong>vice<br />

may be composed of several sub-<strong>de</strong>vices operating in parallel‚ we use a<br />

concurrency mo<strong>de</strong>l‚ event driven finite state machines [5]‚ to <strong>for</strong>mally mo<strong>de</strong>l<br />

the <strong>de</strong>vice control. It has several synchronization properties: (1) the execution<br />

of event handlers and state transitions are free of race conditions‚ and<br />

(2) finite state machines do not share data and communicate through events<br />

if necessary. The synthesizer en<strong>for</strong>ces the race condition free property by<br />

disabling the context switches appropriately. Figure 6-5 gives the sketch of<br />

an example of <strong>de</strong>vice control specification of a sub-component‚ USB setup<br />

protocol‚ of SA1100 UDC. Again‚ <strong>de</strong>tailed syntax and semantics of the<br />

specification are beyond the scope of this paper‚ we will focus on illustrating<br />

the salient features of the specification.<br />

There are four types of events: hardware events‚ input events‚ output events<br />

and internal events. Devices generate hardware events to indicate changes of<br />

hardware states. A typical hardware event is an interrupt. Higher layer modules<br />

send input events (also called service requests) to the driver. Events sent to<br />

higher-layer modules are called output events. As an example‚ USB host<br />

assigns a USB address to the UDC. The driver can emit an output event that<br />

carries the address in<strong>for</strong>mation when the host assigns the address. The upperlayer<br />

software observes the USB address of the <strong>de</strong>vice through the output<br />

event. All other events are internal. Events can be consi<strong>de</strong>red as messages<br />

conveying in<strong>for</strong>mation. In addition to the event name‚ an event may convey<br />

in<strong>for</strong>mation by carrying a parameter. Events are stored in a global event queue.<br />

As shown in Figure 6-5‚ an event handler handles a particular event <strong>for</strong> a<br />

particular state of a state machine. The event handlers of a finite state machine

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!