/* say "bibi" to the receiver */
static void zsay_bibi(void)
{
	for (;;) 
	{
		zput_pos(0L);	            	      /* reninit position of next file*/
		zsend_hex_header(ZFIN, tx_header);	  /* send finished session cmd */
		switch (zget_header(rx_header)) 
		{
		case ZFIN:
			zsend_line('O'); 
			zsend_line('O'); 
		case ZCAN:
		case TIMEOUT:
			return;
		}
	}
}
Exemple #2
0
/*
 * send a string to the modem, processing for \336 (sleep 1 sec)
 *   and \335 (break signal)
 */
void zsend_break(char *cmd)
{
   
	while (*cmd++) 
	{
		switch (*cmd) 
		{
		case '\336':
			 continue;
		case '\335':
		     rt_thread_delay(RT_TICK_PER_SECOND);
			 continue;
		default:
			 zsend_line(*cmd);
			 break;
		}
	}
}
Exemple #3
0
/* receive file data,continously, no ack */
static rt_err_t zrec_file_data(rt_uint8_t *buf, struct zfile *zf)
{
    rt_err_t res = -RT_ERROR;

more_data:
	res = zget_data(buf,RX_BUFFER_SIZE);
	switch(res)
	{
	case GOTCRCW:						   /* zack received */
		 zwrite_file(buf,Rxcount,zf);
		 zf->bytes_received += Rxcount;
		 zput_pos(zf->bytes_received);
		 zsend_line(XON);
		 zsend_hex_header(ZACK, tx_header);
		 return RT_EOK;
	case GOTCRCQ:
		 zwrite_file(buf,Rxcount,zf);
		 zf->bytes_received += Rxcount;
		 zput_pos(zf->bytes_received);
		 zsend_hex_header(ZACK, tx_header);
		 goto more_data;
	case GOTCRCG:
		 zwrite_file(buf,Rxcount,zf);
		 zf->bytes_received += Rxcount;
		 goto more_data;
	case GOTCRCE:
		 zwrite_file(buf,Rxcount,zf);
		 zf->bytes_received += Rxcount;
		 return RT_EOK;
	case GOTCAN:
#ifdef ZDEBUG
	     rt_kprintf("error code : ZCAN \r\n");
#endif
		 return res;
	case TIMEOUT:
	     return res;
    case -RT_ERROR:
	     zsend_break(Attn);
	     return res;
	default:
	     return res;
	}
}