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

Once an appropriate SCSI thread is selected for execution, the SCSI manager<br />

despatches that thread and actual execution is handled by the controller-specific<br />

driver.<br />

Limitations<br />

The SCSI manager uses standard VxWorks ring buffers to manage SCSI requests.<br />

Using ring buffers is fast and efficient. The amount of SCSI work that can be<br />

queued depends upon the size of the allocated ring buffers. The SCSI manager also<br />

has some limitations such as the maximum number of threads allowed<br />

(scsiMaxNumThreads), the maximum number of SCSI requests from VxWorks<br />

tasks that can be put on the SCSI manager’s request queue<br />

(scsiMgrRequestQSize), the maximum number of SCSI bus events that can be put<br />

on the SCSI manager’s event queue (scsiMgrEventQSize), the maximum number<br />

of replies that can be put on the reply queue (scsiMgrReplyQSize), the maximum<br />

number of timeouts that can be put on the timeout queue (scsiMgrTimeoutQSize),<br />

and timeout values.<br />

Configuration<br />

It is possible to tune the size of the ring buffers and the number of SCSI threads to<br />

optimize a specific environment. In most cases, however, the default values are<br />

sufficient. These parameters—scsiMaxNumThreads, scsiMgrRequestQSize,<br />

scsiMgrReplyQSize, scsiMgrEventQSize, scsiMgrTimeoutQSize—are defined<br />

as global variables within the SCSI library and are assigned default values defined<br />

in scsiLib.h. These values can be reassigned in the <strong>BSP</strong> routine sysScsiInit( ) prior<br />

to the invocation of the driver’s xxxCtrlInit( ) routine. Then when scsiCtrlInit( )is<br />

invoked by the driver’s xxxCtrlInit( )routine, the new parameters are used for data<br />

structure allocation.<br />

The name, priority, and stack size of the scsiMgr task can also be customized from<br />

the controller driver’s xxxCtrlCreate( ) routine. Defaults are provided in scsiLib.h.<br />

For example, the default task name SCSI_DEF_TASK_NAME is tScsiTask, the<br />

default priority, SCSI_DEF_TASK_PRIORITY, is 5, and the default stack size,<br />

SCSI_DEF_TASK_STACK_SIZE, is 4000.<br />

I<br />

NOTE: The larger the number of expected VxWorks SCSI tasks, the larger the stack<br />

space required. Thought should be given to the stack size parameter when<br />

customizing the SCSI manager.<br />

323

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

Saved successfully!

Ooh no, something went wrong!