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

#ifdef _WRS_GNU_VAR_MACROS /* GNU Syntax */<br />

#define MY_MACRO(x, y, args...) printf (x, y, args)<br />

#else /* ANSI Syntax */<br />

#define MY_MACRO(x, y, ...) printf (x, y, __VA_ARG__)<br />

#endif<br />

In the future, when the GNU toolchain does support the ANSI standard, the<br />

#ifdefs based on this macro can be removed from the code base.<br />

_WRS_ALIGNOF(item)<br />

This macro returns the alignment of the specified item, or item type, in byte units.<br />

Most structures have alignment values of 4, which is the normal alignment of a<br />

longword data value. Data items or types with greater alignment values return an<br />

appropriate alignment value, which is expected to be a power of two (1, 2, 4, 8, 16,<br />

and so on).<br />

_WRS_ALIGN_CHECK(ptr, type)<br />

This macro returns a boolean value, either TRUE or FALSE. A return of TRUE<br />

indicates that the pointer value is sufficiently aligned to be a valid pointer to the<br />

data item or type. The expected implementation is to examine the low-order bits<br />

of the pointer value to see whether it is a proper modulo of the alignment for the<br />

given type.<br />

_WRS_UNALIGNED_COPY(pSrc, pDst, size)<br />

This macro is a compiler-optimized version of the standard Wind River bcopy<br />

operation. It moves a data block from the source location to the destination<br />

location. This macro allows the compiler to optimize the copy operation based on<br />

the data types of the pointers and the size of the block. This macro is designed to<br />

be used in high-performance situations; the size of the block is expected to be<br />

small. Misuse of the macro for other situations should be avoided.<br />

170

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

Saved successfully!

Ooh no, something went wrong!