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 81<br />

endpoints: endpoint 0 (ep0) through which a USB host controls the UDC‚<br />

endpoint 1 (ep1) which is the transmit FIFO and end point 2 (ep2) which is<br />

the receive FIFO.<br />

The Linux UDC (USB <strong>de</strong>vice controller) driver (ported to Strong-Arm<br />

SA1100) implements USB <strong>de</strong>vice protocol [11] (data transfer and USB<br />

connection setup) through coordination with the UDC hardware. An Ethernet<br />

<strong>de</strong>vice driver interface has been implemented on top of the USB data flow.<br />

To evaluate our methodology‚ we mo<strong>de</strong>led UDC and synthesized a UDC<br />

Linux <strong>de</strong>vice driver that has an Ethernet driver interface and manages data<br />

transfer and USB connection setup. UDC ep1 is mo<strong>de</strong>led as an OUT data path.<br />

Its data unit is a data packet of no more than 64 bytes transferred via DMA.<br />

Similarly UDC ep2 is mo<strong>de</strong>led as an IN data path. The UDC control has 4<br />

state machines: one state machine <strong>for</strong> each endpoint and one state machine<br />

managing the USB protocol state of the <strong>de</strong>vice. The state machines <strong>for</strong> data<br />

flow ep1 and ep2 are implicitly generated. Table 6-1 shows a comparison of<br />

co<strong>de</strong> sizes <strong>for</strong> the original Linux driver‚ the specification in our framework<br />

and the final synthesized driver.<br />

The reduction in co<strong>de</strong> size is one measure of increased productivity. More<br />

importantly‚ the <strong>for</strong>mat and <strong>de</strong>finition of the specification enables less<br />

experienced <strong>de</strong>signers to relatively easily specify the <strong>de</strong>vice behavior. The<br />

<strong>de</strong>clarative feature of our specification also enables easy synthesis of drivers<br />

of different styles. For example‚ the original UDC character <strong>de</strong>vice driver<br />

interface (without comments and blank lines) has 498 lines of co<strong>de</strong> while<br />

our specification only requires a few extra lines. Furthermore‚ the co<strong>de</strong><br />

synthesized is only slightly bigger than the original co<strong>de</strong>.<br />

The correctness of the synthesized UDC driver is tested on a HP iPaq3600<br />

handheld‚ a SA1100 based <strong>de</strong>vice. We setup a USB connection between the<br />

handheld and a 686 based <strong>de</strong>sktop through a USB cradle. Familiar v0.5.3 of<br />

Linux kernel 2.4.17 is installed on the iPaq and RedHat 7.2 of Linux kernel<br />

2.4.9 is installed on the <strong>de</strong>sktop. We compiled the synthesized co<strong>de</strong> to a<br />

loadable kernel module with a cross-compiler <strong>for</strong> ARM‚ loa<strong>de</strong>d the newly<br />

created module on the iPaq‚ bound IP socket layer over our module and<br />

successfully tested the correctness with the standard TCP/IP command ping.<br />

7. CONCLUSIONS<br />

Device driver <strong>de</strong>velopment has traditionally been cumbersome and error prone.<br />

This trend is only worsening with IP based embed<strong>de</strong>d system <strong>de</strong>sign where<br />

Table 6-1. Comparison of co<strong>de</strong> size.<br />

Linux UDC driver<br />

Iris specification<br />

Driver synthesized<br />

Line count<br />

2002<br />

585<br />

2157

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

Saved successfully!

Ooh no, something went wrong!