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

A Template Driver<br />

The following example shows a template for a basic SCSI controller driver, without<br />

any specific hardware constraints. The basic structure of the driver is like any other<br />

VxWorks driver. The main routines consist of the following:<br />

– AxxxCtrlCreate( ) routine, that is invoked from the <strong>BSP</strong> routine sysScsiInit( )<br />

located in the <strong>BSP</strong> file sysScsi.c.<br />

– An ISR called xxxIntr( ) that handles all the interrupts, deciphers what SCSI<br />

event has occurred, and passes that event information to the SCSI manager via<br />

the scsiMgrEventNotify( ) routine.<br />

The SCSI libraries instruct the driver via the xxxDevSelect( ) and xxxInfoXfer( )<br />

routines, and the controller driver communicates back to the libraries by means of<br />

the scsiMgrEventNotify( ) routine.<br />

Example I-1<br />

Basic SCSI Controller Driver<br />

/* xxxLib.c - XXX SCSI-Bus Interface Controller library (SCSI-2) */<br />

/* Copyright 1989-1996 Wind River Systems, Inc. */<br />

#include "copyright_wrs.h"<br />

/*<br />

modification history<br />

--------------------<br />

01a,12sep96,dds written<br />

*/<br />

/*<br />

DESCRIPTION<br />

This library contains part of the I/O driver for the XXX family of SCSI-2<br />

Bus Interface Controllers (SBIC). It is designed to work with scsi2Lib.<br />

The driver routines in this library depend on the SCSI-2 ANSI specification;<br />

for general driver routines and for overall SBIC documentation, see xxxLib.<br />

I<br />

INCLUDE FILES<br />

xxx.h<br />

SEE ALSO: scsiLib, scsi2Lib,<br />

.pG "I/O System"<br />

*/<br />

#include "vxWorks.h"<br />

#include "drv/scsi/xxx.h"<br />

typedef XXX_SCSI_CTRL SBIC; /* SBIC: SCSI Bus Interface Controller struct */<br />

/* globals */<br />

327

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

Saved successfully!

Ooh no, something went wrong!