cyg_io_read返回值是0,因为读到的字节长度在参数中

len = cyg_io_read(ser_handle1, ucMasterRTURcvBuftmp, &len);//

len等于0,cyg_io_read读到的字节数在参数中的红色的len,而不是前面的len

cyg_io_read函数的说明中有:

Syntax:
Cyg_ErrNo
cyg_io_read(
 cyg_io_handle_t handle,
 void *buf,
 cyg_uint32 *len
 );
Parameters:        handle—handle to the device.
buf—pointer to the buffer to store the data.
len—pointer to the size of data to receive. When the function returns, this parameter con-
tains the actual size of data received.
Description:       Receive data from the device specified by the handle parameter. If ENOERR is returned,
the write operation completed successfully. The actual number of bytes read is returned in
the len parameter.

posted on 2014-07-29 09:05  flying06  阅读(460)  评论(0编辑  收藏  举报