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

return (ERROR);<br />

#if (USER_D_CACHE_MODE & CACHE_SNOOP_ENABLE)<br />

#else<br />

#endif<br />

scsiCacheSnoopEnable ((SCSI_CTRL *) pSysScsiCtrl);<br />

scsiCacheSnoopDisable ((SCSI_CTRL *) pSysScsiCtrl);<br />

/* Set the appropriate board specific hardware registers for the SIOP */<br />

if (xxxSetHwRegister ((XXX_SCSI_CTRL *)pSysScsiCtrl, &hwRegs)<br />

== ERROR)<br />

return(ERROR);<br />

/* Include tape support if configured in config.h */<br />

#ifdef INCLUDE_TAPEFS<br />

tapeFsInit (); /* initialize tapeFs */<br />

#endif /* INCLUDE_TAPEFS */<br />

return (OK);<br />

}<br />

I.6 <strong>Guide</strong>lines for Developing a SCSI Driver<br />

This section provides useful tips on how to develop a new SCSI controller.<br />

Breaking the project up into small easily managed steps is generally the best<br />

approach.<br />

1. Understand the template drivers and the interfaces with the SCSI libraries.<br />

2. Copy the template driver into your new driver directory. Replace the variable<br />

routine and macro names with your chosen driver name (for example,<br />

xxxShow( ) might become myDriverShow( )).<br />

3. Make sure that the interrupt mechanism is working correctly so that upon<br />

getting a SCSI interrupt, the driver’s ISR is invoked. A good method to ensure<br />

that the ISR is invoked is to write to a well known location in memory or<br />

NVRAM so that upon re-initialization of the board the developer can tell that<br />

the ISR was entered. Getting the ISR to work is a major milestone.<br />

I<br />

359

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

Saved successfully!

Ooh no, something went wrong!