: Edited your post since the text placed within the code tags made it
: hard to read.
:
: As for those functions, they are common non-standard C functions.
: The format is usually like this:
:
: void outp (unsigned char* address, unsigned char data);
:
: unsigned char inp (unsigned char* address);
:
:
: So those functions are pretty easy to implement on most systems, you
: just read/write data to an address. Could as well write
:
: *address = data;
:
: The only kind of systems that will moan about that syntax is systems
: without direct memory access, ie Windows.
Thanks for the quick response, and the edit on my post for clarity.
I tried just using the functions within the program, but I get the errors "undefined reference to 'outp'" (or 'inp') If it helps, this is the sample code they give for it:
void PROM_AD_Sample()
{
unsigned char channel; /* AD channel to be sampled. Range 0-15 */
unsigned char mode; /* AD mode for the range, polarity, gain */
unsigned char LSB; /* Least Significant Byte. The 8 rightmost bits of
the 16 bit A/D code */
unsigned char MSB; /* Most Significant Byte. The 8 leftmost bits of
the 16 bit A/D code */
short Data; /* The 16 bit AD sample resulting from the combination of
LSB and MSB. Data range (-32768)-32767. Refer to user manual
on how to calculate voltage */
outp(base, 0x10); /* FIFO reset. Write 1 to RSTFIFO bit (bit 4).
Does not affect any of the other bits */
outp(base + 2, (channel << 4) | channel); /* set A/D channel; Low = High */
outp(base + 3, mode); /* set A/D mode which determines the gain */
while(inp(base + 3) & 0x20) /* wait for WAIT bit (bit 5) = 0 */
/*empty while*/;
outp(base + 0, 0x80); /* start A/D conversion; set STRTAD bit (bit 7) to high */
while(inp(base + 3) & 0x80) /* wait for A/D busy bit (bit 7) = 0 */
/*empty while*/;
LSB = inp(base + 0); /* read data LSB */
MSB = inp(base + 1); /* read data MSB */
Data = (MSB << 8) + LSB; /* combine LSB + MSB */
}
Problem is my compiler will not recognize outp() or inp() without some form of definition, and I'm not really sure how to do that, exactly. Sorry, I'm a little new to programming on this level, as you can probably tell. I understand the prototypes in that reply, but I get the messages "passing arg 1 of 'outp' makes pointer from integer without a cast" and "undefined reference to 'outp'".
for the record, I'm compiling for BlueCat embedded Linux, using their "Luminosity" dev kit. I'd use a more friendly compiler if I could, but in compiling specifically for BlueCat it's my only real choice.
Thanks again for the help!