これは私のプログラムです:
#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;
}
}
コンパイラは文句を言います:
'出力'の前に')'が必要です
なんで?どうすれば修正できますか?苦情がわかりません。
アップデート
プログラムに書き直しましたが、それでもコンパイルエラーが発生します。
#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;
}
}