int comfd = open("/tyCo/0",O_RDWR,0);
if (ERROR==comfd)
{
printf("can not open serious device!\n");
return 0;
}
else {printf("com1 open!\n");}
if (ERROR==ioctl(comfd,FIOBAUDRATE,19200))
{
printf("can not set BARDRATE!\n");
return 0;
}
taskSpawn("send",110,0,1024,(FUNCPTR)demoSend,comfd,0,0,0,0,0,0,0,0,0);
return (1);
}
void demoSend( int comfd )
{
int fd;
fd=comfd;
FOREVER
{
write(fd,"hello!",7);
taskDelay(60);
}
}
********************************************************
shell下显示:
-> demo
com1 open!
value = 1 = 0x1
-> devs
drv name
0 /null
1 /tyCo/0
3 host:
4 /vio
5 /tgtsvr
value = 0 = 0x0
-> iosFdShow
fd name drv
3 /tyCo/0 1
4 /vio/1 4
5 /tyCo/0 1
value = 0 = 0x0
->