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.

VxWorks 5.5<br />

<strong>BSP</strong> Developer’s <strong>Guide</strong><br />

Device drivers are one of the module types in a VxWorks system that can have<br />

problems with data cache coherency. (Note that the CPU instruction cache<br />

coherency is maintained elsewhere in the system.) This document describes the<br />

issues of concern to the driver writer and describes how to use the cacheLib to deal<br />

with these issues.<br />

This document also describes how to enable the virtual memory library. This is<br />

necessary if you are using 68K or SPARC architectures. In these architectures, the<br />

VxWorks cache library controls the cache by calling the virtual memory library to<br />

manipulate the memory management unit (MMU).<br />

Only drivers using direct memory access (DMA) need to be concerned with cache<br />

issues. It is only in the area of DMA that caching is a consideration for a device<br />

driver. On architectures that do write-buffering, the driver needs to consider issues<br />

related to WRITE_PIPING.<br />

NOTE: If your target architecture includes an MMU, and you disable virtual<br />

memory support but enable the data cache, then cacheDmaMalloc( ) is unable to<br />

provide buffers safe from cache coherency issues.<br />

NOTE: If you use an MMU, the cache modes are controlled by the cache mode<br />

values in the sysPhysMemDesc[ ] table and not by the configuration macros<br />

USER_I_CACHE_MODE and USER_D_CACHE_MODE. It is a common mistake to<br />

assume these macros always control the cache operating mode.<br />

5.7 Helpful Hints<br />

■<br />

Avoiding printf( ) in drivers<br />

Avoid use of printf( ) in drivers, even for debugging purposes. Use logMsg( )<br />

instead. There may be system interactions between the driver and the I/O<br />

system that would cause printf( ) to crash the system.<br />

■<br />

Calling intConnect( )<br />

Do not call intConnect( )—or any other routine that calls malloc( )—from<br />

within sysHwInit( ). The memory partition library is not initialized and the<br />

system crashes.<br />

102

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

Saved successfully!

Ooh no, something went wrong!