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

#include "semLib.h"<br />

#include "intLib.h"<br />

#include "errnoLib.h"<br />

#include "cacheLib.h"<br />

#include "taskLib.h"<br />

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

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

/* defines */<br />

typedef XXX_SCSI_CTRL SIOP;<br />

/* Configurable options */<br />

int xxxSingleStepSemOptions = SEM_Q_PRIORITY;<br />

char *xxxScsiTaskName<br />

= SCSI_DEF_TASK_NAME;<br />

int xxxScsiTaskOptions = SCSI_DEF_TASK_OPTIONS;<br />

int xxxScsiTaskPriority = SCSI_DEF_TASK_PRIORITY;<br />

int xxxScsiTaskStackSize = SCSI_DEF_TASK_STACK_SIZE;<br />

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

*<br />

* xxxCtrlCreate - create a control structure for the XXX SCSI controller<br />

*<br />

* This routine creates a SCSI controller data structure and must be called<br />

* before using a SCSI controller chip. It should be called once and only<br />

* once for a specified SCSI controller. Since it allocates memory<br />

* for a structure needed by all routines in xxxLib, it must be called before<br />

* any other routines in the library. After calling this routine,<br />

* xxxCtrlInit() should be called at least once before any SCSI transactions<br />

* are initiated using the SCSI controller.<br />

*<br />

* RETURNS: A pointer to XXX_SCSI_CTRL structure, or NULL if memory<br />

* is unavailable or there are invalid parameters.<br />

*/<br />

XXX_SCSI_CTRL *xxxCtrlCreate<br />

(<br />

UINT8 *baseAdrs, /* base address of the SCSI controller */<br />

UINT clkPeriod, /* clock controller period (nsec*100) */<br />

UINT16 devType /* XXX SCSI device type */<br />

)<br />

I<br />

{<br />

FAST SIOP *pSiop; /* ptr to SCSI controller info */<br />

/* check that dma buffers are cache-coherent */<br />

/* cacheDmaMalloc the controller structure and other driver structures */<br />

pScsiCtrl = (SCSI_CTRL *) pSiop;<br />

/* inform the SCSI libraries about the size of an XXX event and thread */<br />

pScsiCtrl->eventSize = sizeof (XXX_EVENT);<br />

pScsiCtrl->threadSize = sizeof (XXX_THREAD);<br />

339

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

Saved successfully!

Ooh no, something went wrong!