User`s manual

ThinkCore IA241/240 Linux User’s Manual Programmer’s Guide
6-14
}
}
} while(1);
pthread_exit(NULL);
}
void init_sigaction(void)
{
struct sigaction act;
act.sa_handler=dout_control;
act.sa_flags=0;
sigemptyset(&act.sa_mask);
sigaction(SIGALRM,&act,NULL);
}
int main(int argc, char * argv[])
{
pthread_t dio_test;
init_sigaction();
set_dout_state(0, 0); // set the DOUT0 as high
set_din_event(0, low2highevent, DIN_EVENT_LOW_TO_HIGH, duration[1][0]);
dio_test_function();
while( nDuration < DURATION_NUM )
usleep(100000);
}
DIO Program Make File Example
FNAME=tdio
FNAME1=tduration
CC=arm-linux-gcc
STRIP=arm-linux-strip
release:
$(CC) -o $(FNAME) $(FNAME).c -lmoxalib -lpthread
$(CC) -o $(FNAME1) $(FNAME1).c -lmoxalib -lpthread
$(STRIP) -s $(FNAME)
$(STRIP) -s $(FNAME1)
debug:
$(CC) -DDEBUG -o $(FNAME)-dbg $(FNAME).cxx -lmoxalib -lpthread
$(CC) -DDEBUG -o $(FNAME1)-dbg $(FNAME1).cxx -lmoxalib -lpthread
clean:
/bin/rm -f $(FNAME) $(FNAME)-dbg $(FNAME1) $(FNAME1)-dbg *.o
Make File Example
The following Makefile file example codes are copied from the Hello example on the IA241/240’s
CD-ROM.
CC = /usr/local/arm-linux/bin/arm-linux-gcc
CPP = /usr/local/arm-linux/bin/arm-linux-gcc
SOURCES = hello.c
OBJS = $(SOURCES:.c=.o)
all: hello
hello: $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)