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

* xxxCommand - write a command code to the SCSI controller Command Register<br />

*<br />

*/<br />

LOCAL void xxxCommand<br />

(<br />

SBIC *pSbic, /* ptr to SBIC info */<br />

UINT8 cmdCode /* new command code */<br />

)<br />

{<br />

/* set the appropriate SCSI controller registers */<br />

}<br />

/***************************************************************************<br />

*<br />

* xxxIntr - interrupt service routine for the SCSI controller<br />

*<br />

*/<br />

LOCAL void xxxIntr<br />

(<br />

SBIC *pSbic /* ptr to SBIC info */<br />

)<br />

{<br />

SCSI_EVENT event;<br />

/* Check the SCSI status. Handle state transitions */<br />

switch (scsiStatus)<br />

{<br />

...<br />

/* the list of event types is defined is scsi2Lib.h */<br />

case ...<br />

event.type = SCSI_EVENT_XFER_REQUEST;<br />

event.phase = busPhase;<br />

break;<br />

I<br />

case ...<br />

}<br />

/* Synchronize with task-level code */<br />

semGive (&pSbic->xferDoneSem);<br />

/* Post event to SCSI manager for further processing */<br />

scsiMgrEventNotify ((SCSI_CTRL *)pSbic, &event, sizeof (event));<br />

}<br />

/***************************************************************************<br />

*<br />

* xxxRegRead - Get the contents of a specified SCSI controller register<br />

*/<br />

333

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

Saved successfully!

Ooh no, something went wrong!