02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

I<br />

Writing a SCSI-2 Device Driver<br />

The Programming Interface<br />

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

SCSI libraries consists of routines that must be supplied by the driver and library<br />

routines which are invoked by the driver. The driver routines are not required to<br />

conform to the naming convention used here, because the routines are accessed by<br />

means of function pointers which are set in the xxxCtrlCreate( ) routine. However,<br />

this naming convention is recommended. The routines (or equivalents) that the<br />

driver must supply are:<br />

xxxEventProc( ) 1<br />

This routine is invoked by the SCSI manager to parse events and take<br />

appropriate action.<br />

xxxThreadInit( )<br />

This routine initializes the SCSI thread structures and adds any driver-specific<br />

initialization required beyond what is provided by scsiThreadInit( ).<br />

xxxThreadActivate( )<br />

This routine activates a SCSI connection, setting the appropriate thread context<br />

in the SCSI_THREAD data structure and setting all the controller registers with<br />

the appropriate values. It may call other driver routines as well as SCSI library<br />

routines.<br />

xxxThreadAbort( )<br />

If the thread is not actually connected, this routine does nothing. If the thread<br />

is connected, it sends an ABORT TAG message which causes the SCSI target to<br />

disconnect.<br />

xxxBusControl( )<br />

This routine controls some of the SCSI bus lines from the controller. This<br />

routine must reset the SCSI bus, assert ATN, or negate ACK.<br />

xxxXferParamsQuery( )<br />

This routine updates the synchronous data transfer parameters to match the<br />

capabilities of the driver and returns the optimal synchronous offset and<br />

period.<br />

xxxXferParamsSet( )<br />

This routine sets the synchronous data transfer parameters on the SCSI<br />

controller.<br />

I<br />

1. The xxx in the function name is just a place holder for whatever prefix you assign to your<br />

SCSI driver module.<br />

335

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

Saved successfully!

Ooh no, something went wrong!