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

cache for the device data using the CACHE_USER_INVALIDATE macro before<br />

passing the data to the user.<br />

DEVICE_WRITES_ASYNCHRONOUSLY Attribute<br />

This attribute is only of concern when combined with the SHARED_CACHE_LINES<br />

attribute; see the next two sections.<br />

5<br />

SHARED_CACHE_LINES Attribute<br />

The driver can easily function with this attribute as long as the driver can<br />

synchronize all operations to the data fields that may share a cache line (if the<br />

driver cannot synchronize the operations, see the next section). If the device cannot<br />

write to the data fields until explicitly commanded by the driver, the driver can<br />

sequence the use of flush macros, invalidate macros, and device commands in a<br />

manner that ensures data integrity.<br />

DEVICE_WRITES_ASYNCHRONOUSLY and SHARED_CACHE_LINES Attributes<br />

The combination of DEVICE_WRITES_ASYNCHRONOUSLY and<br />

SHARED_CACHE_LINES attributes can cause problems. Because the driver cannot<br />

synchronize the write operations of the device, the potential exists for data<br />

corruption. This happens if the device performs a write operation, then the driver<br />

performs a flush operation. In this sequence, the data value written by the device<br />

is wiped out by the cache line flush operation.<br />

For this set of attributes, the driver cannot use the general CACHE_DRV_FLUSH<br />

and CACHE_DRV_INVALIDATE macros because the driver can no longer control<br />

the integrity of the shared memory. The shared memory must be obtained using<br />

the cacheDmaMalloc( ) routine. Furthermore, this routine must provide memory<br />

that is write-coherent because the driver cannot perform any flush operations. The<br />

driver can check the attributes of the memory provided by cacheDmaMalloc( ) by<br />

using the CACHE_DMA_IS_WRITE_COHERENT macro. If this macro evaluates to<br />

FALSE, the driver cannot function reliably and should abort.<br />

109

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

Saved successfully!

Ooh no, something went wrong!