This is my program:
#include <stdio.h>
#define uart0 0x860
#define uart1 0x880
void send_char( int output )
{
int nothing;
//while write on uart1 is not ready, wait
while(!((*(uart1+8) & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
{
nothing = 0;
}
*(uart1+4) = output; // +4 eller +1? en byte (4 bitar)
}
int rec_charx(void)
{
if(!((*(uart1+8) & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
{
return *(uart1) & 0x000f;
}
else
{
return -1;
}
}
The compiler complains:
expected ')' before 'output'
Why? How can I fix it? I don't understand the complaint.
Update
We've rewritten to program but we still get compilation errors:
#include <stdio.h>
static int* const uart1 = (int*) 0x880;
void send_char( int output )
{
int nothing;
//while write on uart1 is not ready, wait
while(!((uart1[2] & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
{
//do nothing
nothing = 0;
}
uart1[1] = output; // skriv till uart1
}
int rec_charx(void)
{
if(!((*(uart1+8) & 0x0040) && 0x0040)) //+8 eller +2? 2 byte (8 bitar)
{
return *(uart1) & 0x000f;
}
else
{
return -1;
}
}