02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

I<br />

Writing a SCSI-2 Device Driver<br />

I.3.6 An Execution Example<br />

Let us take a brief look at what happens when a VxWorks task requests SCSI<br />

service by invoking a SCSI library routine such as scsiInquiry( ). Since we are<br />

assuming a SCSI-2 configuration, first the scsi2Inquiry( ) routine is invoked which<br />

in turn invokes scsiTransact( ) (see Forming SCSI Commands, p.321). scsiTransact( )<br />

invokes scsiCommand( ), the routine that allocates a SCSI thread, executes the<br />

thread, and then deletes it.<br />

The execution of the thread via scsiThreadExecute( ) causes the SCSI manager to<br />

be informed of a new thread to execute, and subsequent blocking of that VxWorks<br />

task on a message queue until a response has been received. This is the boundary<br />

where a VxWorks task is blocked and the SCSI manager is awakened to start the<br />

execution of a new thread as well as management of any other threads that it may<br />

be dealing with.<br />

After the SCSI thread has executed and has received a response, the calling<br />

VxWorks task is unblocked and eventually the SCSI thread associated with that<br />

task is deleted.<br />

I.4 The SCSI Driver Programming Interface<br />

To better explain the interface between the controller driver and the SCSI libraries<br />

for the two types of SCSI controllers (basic and advanced), this section discusses<br />

each type of driver separately. A skeletal driver is provided along with the<br />

programming interface between the SCSI libraries and the controller driver. The<br />

controller driver routines provide all the hardware register accesses and<br />

controller-specific functionality. For the sake of simplicity, such accesses and<br />

controller-specific information have not been shown. It is the purpose of the<br />

template drivers to show the overall structure and programming interface<br />

between the driver, the SCSI libraries, and the <strong>BSP</strong>.<br />

I<br />

I.4.1 Basic SCSI Controller Driver<br />

This section presents the basic programming interface SCSI controller and the SCSI<br />

libraries. Following that description, this section presents a template you should<br />

use when writing your own SCSI controller driver.<br />

325

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

Saved successfully!

Ooh no, something went wrong!