文件名称:Linux Serial
文件大小:3KB
文件格式:H
更新时间:2015-08-31 16:20:51
Linux Serial
void local_recv(void) { int recv_len, probe_len, frm_len; int slide; char rx_buff[BF_MAX_LEN * 2]; int tx_len; char tx_buff[BF_MAX_LEN * 2]; if ((recv_len = read(mifs.fd_t[FD_LOCAL], rx_buff, BF_MAX_LEN)) <= 0) return; enter_rcb_critical_sec(&gd;_local_trx_cbuf, USRVIEW); rxcbuf_write_and_wait(&gd;_local_trx_cbuf, rx_buff, recv_len, USRVIEW); if ((recv_len = rcb_not_empty(&gd;_local_trx_cbuf, USRVIEW)) > 0) { do { if ((probe_len = probe_cbuf(&gd;_local_trx_cbuf, rx_buff, recv_len, USRVIEW)) == 0) break; if ((frm_len = search_window_m2m(rx_buff, probe_len, &slide;)) > 0) { /*DEBUG*/printf("%d bytes received from local\r\n", frm_len); tx_len = m2m_frm_analysis(rx_buff + slide, frm_len, tx_buff); if (tx_len) local_send(tx_buff, tx_len); slide += frm_len; } discard_cbuf(&gd;_local_trx_cbuf, slide, USRVIEW); } while (slide != 0); } leave_rcb_critical_sec(&gd;_local_trx_cbuf, USRVIEW); }