//-------------------------------------------------------------------------- // Write an array of bytes to the COM port, verify that it was // sent out. Assume that baud rate has been set. // // 'portnum' - number 0 to MAX_PORTNUM-1. This number was provided to // OpenCOM to indicate the port number. // 'outlen' - number of bytes to write to COM port // 'outbuf' - pointer ot an array of bytes to write // // Returns: TRUE(1) - success // FALSE(0) - failure // SMALLINT WriteCOM(int portnum, int outlen, uchar *outbuf) { int i = 0; switch (port_handle[portnum]) { case DS400_SERIAL0: for(; i<outlen; i++) { serial0_putchar(outbuf[i]); } break; case DS400_SERIAL1: for(; i<outlen; i++) { serial1_putchar(outbuf[i]); } break; case DS400_SERIAL2: for(; i<outlen; i++) { serial2_putchar(outbuf[i]); } break; } return (i==outlen?TRUE:FALSE); //unnecessary, but thinking ahead }
//-------------------------------------------------------------------------- // Write an array of bytes to the COM port, verify that it was // sent out. Assume that baud rate has been set. // // 'portnum' - number 0 to MAX_PORTNUM-1. This number was provided to // OpenCOM to indicate the port number. // 'outlen' - number of bytes to write to COM port // 'outbuf' - pointer ot an array of bytes to write // // Returns: TRUE(1) - success // FALSE(0) - failure // SMALLINT WriteCOM(int portnum, int outlen, uchar *outbuf) { int i = 0; if(portnum==0) { for(; i<outlen; i++) { serial0_putchar(outbuf[i]); } } else { for(; i<outlen; i++) { serial1_putchar(outbuf[i]); } } return (i==outlen?TRUE:FALSE); //unnecessary, but thinking ahead }