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.

5<br />

Driver <strong>Guide</strong>lines<br />

5.8 Driver Use of the Cache Library<br />

Before reading this section, review the reference entry for cacheLib. This section<br />

describes how to maintain data cache coherency for device drivers by using the<br />

VxWorks cache library (cacheLib). It also describes the cacheLib mechanism for<br />

controlling the side effects of CPU write piping, and provides additional hints for<br />

handling cache-related issues in your device driver.<br />

5<br />

5.8.1 Review of cacheLib Facilities<br />

The cacheLib reference entries describe the library’s facilities in detail. This section<br />

provides a brief definition of the facilities discussed in this document. Remember<br />

that the cacheLib.h header file contains the function prototypes and macros need<br />

to make use of the cacheLib facilities. Include this file in your driver code.<br />

This document also references the following routine and macros:<br />

■<br />

The cacheDmaMalloc( ) routine allocates memory from the system. It<br />

attempts to use the underlying hardware features to provide a memory region<br />

that is safe from cache coherency issues. This memory region is guaranteed to<br />

start on a cache line boundary, and not to overlap cache lines with adjacent<br />

regions.<br />

■<br />

■<br />

■<br />

The CACHE_DMA_xxxx macros (such as CACHE_DMA_FLUSH) flush,<br />

invalidate, and learn attributes of memory regions provided by the<br />

cacheDmaMalloc( ) routine.<br />

The CACHE_DRV_xxxx macros (such as CACHE_DRV_INVALIDATE) flush,<br />

invalidate, and learn attributes of ordinary memory that the driver controls.<br />

The CACHE_USER_xxxx macros (such as<br />

CACHE_USER_IS_WRITE_COHERENT) flush and invalidate user memory that<br />

is outside the domain of the driver.<br />

5.8.2 Conducting Driver Analysis<br />

Each driver has a set of attributes that define its behavior relative to the cache. This<br />

section provides some guidelines for analyzing your driver for potential cache<br />

coherency problems. When you know the driver’s attributes, you can create a<br />

strategy for use of the cacheLib routines in the driver.<br />

103

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

Saved successfully!

Ooh no, something went wrong!