13.07.2015 Views

TASKING VX-toolset for 8051 User Guide

TASKING VX-toolset for 8051 User Guide

TASKING VX-toolset for 8051 User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>8051</strong> <strong>User</strong> <strong>Guide</strong>The compiler always inlines the corresponding assembly instructions in the assembly source (rather thancalling it as a function).This avoids parameter passing and register saving instructions which are normallynecessary during function calls.Intrinsic functions produce very efficient assembly code. Though it is possible to inline assembly code byhand, intrinsic functions use registers even more efficiently. At the same time your C source remains veryreadable.You can use intrinsic functions in C as if they were ordinary C (library) functions. All intrinsics begin witha double underscore character (__).The <strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>8051</strong> C compiler recognizes the following intrinsic functions:__allocvoid * volatile __alloc( __size_t size );Allocate memory. Returns a pointer to space in external memory of size bytes length. NULL if there isnot enough space left. This function is used internally <strong>for</strong> variable length arrays, it is not to be used byend users.__dotdotdot__char * volatile __dotdotdot__( void );Variable argument '...' operator. Used in library function va_start(). Returns the stack offset to thevariable argument list.__freevoid volatile __free( void *p );Deallocates the memory pointed to by p. p must point to memory earlier allocated by a call to __alloc().__getbit__bit __getbit( operand, bitoffset );Returns the bit at bitoffset (range 0-7 <strong>for</strong> a char, 0-15 <strong>for</strong> an int or 0-31 <strong>for</strong> a long) of the bit-addressableoperand <strong>for</strong> usage in bit expressions. bitoffset must be an integral constant expression.Example:__bdata unsigned char byte;int i;if ( __getbit( byte, 3 ) )i = 1;__putbitvoid __putbit( __bit value, operand, bitoffset );42

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

Saved successfully!

Ooh no, something went wrong!