Invalidate cache lines associated with a data buffer


#include <sys/cache.h>

CACHE_INVAL(struct cache_ctrl *cinfo, 
            void *vaddr, 
            uint64_t paddr, 
            size_t len);


A pointer to the structure that was initially passed to cache_init().
The virtual address of the buffer; this is a pointer to the data in the driver's virtual address space.
The physical address of the buffer: this is typically in the same address space that the external device will use to reference the data. The physical address is obtained by calling mem_offset64(). Since this function is fairly costly, drivers typically allocate a pool of data buffers at initialization (e.g., by calling mmap() with the MAP_PHYS and MAP_ANON flags), and predetermine the physical addresses of the data.
The number of bytes in the buffer for which the associated cache lines should be invalidated.



Use the -l cache option to qcc to link against this library.


This macro is used to invalidate any cache lines associated with a data buffer. This routine ensures that any subsequent modifications that are made to the data by an external device will be not be corrupted by the CPU writing back cached data to the memory, and ensures that once the data has been modified, the CPU will fetch the updated data from memory, instead of retrieving stale data from the cache.

Note: This macro was added in QNX Momentics 6.3.0 SP2.

Before using the CACHE_*() macros on ARM platforms, the calling thread must:

Failing to do so may result in a SIGILL (illegal instruction) signal.

Environment variables:

The following environment variables, if they exist, affect the behavior of this function:

Instructs the library that the CACHE_FLUSH() and CACHE_INVAL() macros should have no effect.
Instructs the library that the CACHE_FLUSH() and CACHE_INVAL() macros should use the msync() C library call to perform cache synchronization.


QNX Neutrino

Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes


CACHE_INVAL() is implemented as a macro.