void TransmitPacket(u_char *buffer,u_short len) { int event=0,i; u_short data,*ptr; u_char tmp; //write TxCMD register IOWRITE(TxCMD, TX_CMD_START_ALL | TX_CMD_LOW_BITS); IOWRITE(TxLength, len); //read BusST register while (1) { data=ReadPktPageReg(PKTPG_BUS_ST); if (data & BUS_ST_RDY_4_TX_NOW) break; else ++event; if (event>100) return; } ptr=(u_short *)buffer; //transmit packet 2 bytes a round while (len>0) { IOWRITE(IODATA0, *ptr); len-=2; ++ptr; if (len==1) { tmp=*((char *)ptr); IOWRITE(IODATA0, tmp); break; } } //printf("Transmit packet success\n\r"); }
void command(int axis,int cmd) { IOWRITE(wr0,(axis<<8)+cmd); }
void wreg3(int axis,int wdata) { IOWRITE(wr0,(axis<<8)+0xf); IOWRITE(wr3,wdata); }