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

/* fill in generic SCSI info for this controller */<br />

xxxCtrlInit (&pSbic->scsiCtrl);<br />

/* initialize SBIC info transfer synchronization semaphore */<br />

if (semBInit (&pSbic->xferDoneSem, xxxXferDoneSemOptions, SEM_EMPTY)<br />

== ERROR)<br />

{<br />

(void) free ((char *) pSbic);<br />

return ((XXX_SCSI_CTRL *) NULL);<br />

}<br />

/* initialize state variables */<br />

/* fill in board-specific SCSI bus reset and DMA xfer routines */<br />

/* spawn SCSI manager - use generic code from "scsiLib.c" */<br />

pSbic->scsiCtrl.scsiMgrId = taskSpawn (xxxTaskName,<br />

xxxTaskPriority,<br />

xxxTaskOptions,<br />

xxxTaskStackSize,<br />

(FUNCPTR) scsiMgr,<br />

(int) pSbic,<br />

0, 0, 0, 0, 0, 0, 0, 0, 0);<br />

return (pSbic);<br />

}<br />

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

*<br />

* xxxCtrlInit - initialize a SCSI controller structure<br />

*<br />

* After a SCSI controller structure is created with xxxCtrlCreate, but<br />

* before using the SCSI controller, it must be initialized by calling this<br />

* routine.<br />

* It may be called more than once if desired. However, it should only be<br />

* called while there is no activity on the SCSI interface.<br />

*<br />

* RETURNS: OK, or ERROR if out-of-range parameter(s).<br />

*/<br />

I<br />

LOCAL STATUS xxxCtrlInit<br />

(<br />

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

FAST int scsiCtrlBusId, /* SCSI bus ID of this SBIC */<br />

FAST UINT defaultSelTimeOut /* default dev. select timeout (microsec) */<br />

)<br />

{<br />

pSbic->scsiCtrl.scsiCtrlBusId = scsiCtrlBusId;<br />

/* initialize the SBIC hardware */<br />

xxxHwInit (pSbic);<br />

329

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

Saved successfully!

Ooh no, something went wrong!