CacheControl()

QNX SDP8.0C Library ReferenceAPIDeveloper

Flush the data cache and/or invalidate the instruction and/or the data cache.

Note:
Don't use the CacheControl() kernel call directly; instead, use the POSIX function msync().

Synopsis:

#include <sys/neutrino.h>

int CacheControl( void * addr,
                  size_t len,
                  unsigned flags );

Arguments:

addr
The beginning of the range of addresses you want to flush and/or invalidate.
len
The length of the range of addresses, in bytes.
flags
A bitwise inclusive OR of one or more of the following flags:
  • MS_SYNC — perform synchronous writes. The function doesn't return until all write operations are completed.
  • MS_ASYNC — perform asynchronous writes. The function returns immediately once all the write operations are initiated or queued for servicing.
  • MS_INVALIDATE — invalidate cached data. Invalidates all cached copies of mapped data that are inconsistent with the permanent storage locations.
  • MS_INVALIDATE_ICACHE — invalidates the instruction cache.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The CacheControl() function can flush the data cache and/or invalidate the instruction and/or data cache. When a flush operation is performed, the cache data is written back to memory. On the other hand, an invalidate operation only marks the cache entry as invalid without writing back to memory.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EFAULT
The addresses in the range starting at addr and continuing for len bytes are invalid.

Classification:

QNX OS

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: