Documentations about all .h files

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Documentations about all .h files

Postby lilltroll » Thu Jan 14, 2010 9:50 pm

The manual has a lot of answers on how to program in XC, but often h-files are included in the projects that doesn't belong to ANSI-C.

Some information can be found in the "XC Librares Reference", but it doesn't show examples how to use them. Is there som documentation about efficient use of all built in functions macros and other goodies that in the h files ??

An example: If you read the Programming XC on XMOS Devices it shows how to use Channels or Streaming channel. But you can also find the inuint() and outuint in xc.h
I understand how to use them, but not why, or when to use outuint instead of :> or <:

Code: Select all

**
 * Streams in a unsigned int from a channel end. If the next word of data
 * channel in the channel contains a control token then an exception is raised.
 * \param c The channel end to stream data in on.
 * \return The value received.
 */
unsigned inuint(chanend c);
#define inuint(c)                            __builtin_in_uint(c)
/
and

Code: Select all

/**
 * Streams out a value as an unsigned int on a channel end.
 * \param c The channel end to stream data out on.
 * \param val The value to output.
 */
void outuint(chanend c, unsigned val);
#define outuint(c, val)                     __builtin_out_uint(c, val)
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am

Postby paul » Fri Jan 15, 2010 12:55 am

The simple answer is that if you are using streaming channels using <: and :> you don't need inuint and outuint. They were used for streaming channels, but are now only there for legacy purposes - so old code will continue to compile. There should be no performance difference.
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Postby lilltroll » Fri Jan 15, 2010 6:21 am

And what about all the others in the h-file?

How much will the latest compiler do for you, and which things do you need to tune by hand ? (without moving to ASM)
Did I found the only functions used for legacy purposes, or are there more of them ?

Whats the way of thinking? First try to solve the problem the standard way, and if you end up with a special case or timing issues - start to search in the .h files ?
Probably not the most confused programmer anymore on the XCORE forum.

Who is online

Users browsing this forum: No registered users and 6 guests