home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 3
/
FREEWARE.BIN
/
towns_os
/
whisper
/
source
/
rsb.c
< prev
next >
Wrap
Text File
|
1980-01-02
|
20KB
|
898 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "graphic.h"
#include "event.h"
#include "rsblib.h"
#include "coldef.h"
#define TRUE 1
#define FALSE 0
#define ERR (-1)
#define BUF_SIZ (1024*5) /* looking RSBLIB.ASM */
#define UCHAR unsigned char
char *macget();
char *MSG_getstr();
extern int port; /* RSBLIB.ASM Look! */
extern int rsb_ovr_flg;
int bps=ERR;
static RSB_PARA para;
void RSB_end(void)
{
if ( port != ERR )
RSB_close(port);
port = ERR;
}
void RSB_init(int pt)
{
RSB_end();
port = pt;
RSB_rdpara(port,(char *)¶);
RSB_open(port);
bps = para.baud;
rsb_ovr_flg = FALSE;
}
int RSB_reopen(int md,int bp)
{
int er;
para.mode = md; /* 通信モード */
para.baud = bp; /* ボーレート */
para.rbuf = 0; /* 受信バッファアドレス */
para.stime = 500; /* 送信タイムアウト */
para.rtime = 500; /* 受信タイムアウト */
para.rinfbuf = 0; /* 受信通知アドレス */
para.extmode = 0; /* 拡張モード */
para.xon = 0x11; /* XONコード */
para.xoff = 0x13; /* XOFFコード */
RSB_dtr(port,1); /* DTR信号の保持 */
RSB_close(port);
rsb_ovr_flg = FALSE;
if ( (er = RSB_setpara(port,(char *)¶)) == 0 )
er = RSB_open(port);
return er;
}
void RSB_get_para(int *pt,int *md,int *bp)
{
*pt = port;
*md = para.mode;
*bp = para.baud;
}
void RSB_putc(int ch)
{
unsigned st;
RSB_send(port,ch,&st);
}
int RSB_chk(void)
{
int len;
RSB_read(port,&len);
if ( rsb_ovr_flg == FALSE ) {
if ( len >= (BUF_SIZ-512) ) {
rsb_ovr_flg = TRUE;
RSB_ctrl(port,0x02);
DSP_string("\x1B\xED",370,4,COL_RED,COL_WHIS);
}
} else {
if ( len <= 512 ) {
rsb_ovr_flg = FALSE;
RSB_ctrl(port,0x22);
DSP_string(" ",370,4,COL_RED,COL_WHIS);
}
}
return len;
}
int RSB_getc(void)
{
unsigned st;
int ch;
RETRY:
RSB_receive(port,&ch,&st);
if ( ch == 0x05 ) {
BP_Term_ENQ();
goto RETRY;
} else if ( ch == 0x10 ) {
BP_DLE_Seen();
goto RETRY;
}
return ch;
}
void RSB_break_out(void)
{
RSB_break(port,macval("_BREAK_TIME"));
}
/*****************************************************
RS232C MODE SETUP WIND
******************************************************/
#define MENU_X 100
#define MENU_Y 70
#define MENU_COL COL_JACK
#define MENU_CHR COL_CHR
#define HIT_COL COL_JACK2
#define TTL_COL COL_CHR
static int rsb_event=ERR;
static char atcmd[3][80];
static struct {
int no;
int max;
char *ttl;
char *sub[8];
} menu[]={
{ 0,5,"ポ-ト番号"," 0 "," 1 "," 2 "," 3 "," 4 " },
{ 0,6," 速 度 "," 300 "," 600 "," 1200 "," 2400 "," 4800 "," 9600 " },
{ 0,2," ビット長 ","7 ビット","8 ビット" },
{ 0,3,"パリティ-"," なし "," 奇数 "," 偶数 " },
{ 0,2," ストップビット","1 ビット","2 ビット" },
{ 0,2," Xフロ-制御 "," なし "," あり " },
{ 0,4,"ブレ-ク時間 "," 500ms"," 1sec ","1.5sec"," 2sec " },
{ 0,6," 改行待ち "," なし "," 100ms"," 200ms"," 300ms"," 400ms"," 500ms" },
{ 0,6," ログ行数 "," 1000 "," 2000 "," 3000 "," 4000 "," 5000 ","無制限" },
{ 0,3,"モデムの種類"," 1200 "," 2400 "," MNP5 " },
{ 0,2,"電話の種類"," パルス "," ト-ン " },
{ 0,0,"ダイアルコマンド",atcmd[0] },
{ 0,0,"モデムコマンド1",atcmd[1] },
{ 0,0,"モデムコマンド2",atcmd[2] },
{ 0,0,NULL,NULL }
};
static char *help_msg[]={
"HELP_PORT", "HELP_BAUD", "HELP_BIT", "HELP_PARTY",
"HELP_STOP", "HELP_XFLOW", "HELP_BREAK", "HELP_WAIT",
"HELP_LOG", "HELP_MODEM", "HELP_DIAL", "HELP_ATCMD1",
"HELP_ATCMD2","HELP_ATCMD3" };
void RSB_set_event(EVENT *ep)
{
switch(ep->now) {
case EVT_CLIP_MOS:
EVT_clip_on(ep);
case EVT_ON_MOS:
DSP_mos(1);
break;
case EVT_SELECT_MOS:
EVT_clip_off(ep);
DSP_mos(0);
rsb_event = ep->no;
break;
case EVT_DOLACK_MOS:
ep->now = EVT_NON;
case EVT_MOVE_MOS:
EVT_clip_off(ep);
case EVT_OFF_MOS:
DSP_mos(0);
break;
}
}
void RSB_dsp_menu(int no)
{
int j,x1,y1,x2,y2;
y1 = MENU_Y+4+no*20;
y2 = y1+17;
for ( j = 0 ; j < menu[no].max ; j++ ) {
x1 = MENU_X+96+j*56;
x2 = x1+strlen(menu[no].sub[j])*8+4;
DSP_box(x1,y1,x2,y2,
COL_LINE,(menu[no].no == j ? HIT_COL:MENU_COL));
wrtstr(menu[no].sub[j],page_ofs,(x1+2)/2 + (y1+1) * 512,
col_cnv[MENU_CHR],
col_cnv[menu[no].no == j ? HIT_COL:MENU_COL],
16);
}
}
void RSB_dsp_string(int no)
{
char tmp[80];
sprintf(tmp,"%-41.41s",menu[no].sub[0]);
wrtstr(tmp,page_ofs,
(MENU_X+98)/2+(MENU_Y+5+no*20)*512,
col_cnv[MENU_CHR],col_cnv[MENU_COL],16);
}
void RSB_mode_set(void)
{
int i,j,mode;
BLOCK *vram_save;
char *p;
char tmp[80];
menu[0].no = port;
menu[1].no = para.baud;
menu[2].no = ((para.mode & 0x01) == 0 ? 0 : 1);
menu[3].no = ((para.mode & 0x02) == 0 ? 0:((para.mode & 0x04) == 0 ? 1:2));
menu[4].no = ((para.mode & 0x08) == 0 ? 0 : 1);
menu[5].no = ((para.mode & 0x10) == 0 ? 0 : 1);
menu[6].no = macval("_BREAK_TIME") / 500 - 1;
menu[7].no = macval("_CRWAIT") / 50;
menu[8].no = macval("_LOGMAX") / 1000 - 1;
menu[9].no = macval("_MODEM");
menu[10].no = macval("_POHN");
strcpy(atcmd[0],macget("_ATCMD1"));
strcpy(atcmd[1],macget("_ATCMD2"));
strcpy(atcmd[2],macget("_ATCMD3"));
MOS_disp(FALSE);
MOS_push(MENU_X,MENU_Y,MENU_X+432,MENU_Y+312);
vram_save = DSP_push_vram(MENU_X,MENU_Y,MENU_X+432,MENU_Y+312);
DSP_rbox(MENU_X,MENU_Y,MENU_X+432,MENU_Y+312,7,8,MENU_COL);
MOS_setpos(MENU_X+432/2,MENU_Y+312/2);
for ( i = 0 ; menu[i].ttl != NULL ; i++ ) {
EVT_big_sw(MENU_X+4,MENU_Y+4+i*20,menu[i].ttl,
TTL_COL,MENU_COL,600,RSB_set_event,i*10+9);
for ( j = 0 ; j < menu[i].max ; j++ ) {
EVT_big_sw(MENU_X+96+j*56,MENU_Y+4+i*20,menu[i].sub[j],
MENU_CHR,(menu[i].no == j ? HIT_COL:MENU_COL),
600,RSB_set_event,i*10+j);
}
if ( j == 0 ) {
sprintf(tmp,"%-41.41s",menu[i].sub[0]);
EVT_big_sw(MENU_X+96,MENU_Y+4+i*20,tmp,
MENU_CHR,MENU_COL,600,RSB_set_event,i*10);
}
}
EVT_big_sw(MENU_X+160,MENU_Y+290," 設定 ",
TTL_COL,MENU_COL,600,RSB_set_event,999);
EVT_big_sw(MENU_X+220,MENU_Y+290," 取消 ",
TTL_COL,MENU_COL,600,RSB_set_event,998);
MOS_disp(TRUE);
for ( ; ; ) {
rsb_event = ERR;
EVT_loop(600);
if ( rsb_event == ERR )
continue;
if ( rsb_event == 999 || rsb_event == 998 )
break;
i = rsb_event / 10;
j = rsb_event % 10;
if ( i >= 0 && i <= 8 ) {
if ( j == 9 ) {
MSG_wind(help_msg[i]);
} else if ( menu[i].no != j ) {
menu[i].no = j;
MOS_disp(FALSE);
RSB_dsp_menu(i);
MOS_disp(TRUE);
}
} else if ( i == 9 || i == 10 ) {
if ( j == 9 ) {
MSG_wind(help_msg[i]);
} else {
menu[i].no = j;
macvalset("BPS",menu[1].no);
macvalset("MODEM",menu[9].no);
macvalset("POHN",menu[10].no);
MSG_wind("MODEM_CHENG");
strcpy(atcmd[0],macget("ATCMD1"));
strcpy(atcmd[1],macget("ATCMD2"));
strcpy(atcmd[2],macget("ATCMD3"));
MOS_disp(FALSE);
RSB_dsp_menu(i);
menu[1].no = macval("BPS");
RSB_dsp_menu(1); /* Baud Cheng ? */
RSB_dsp_string(11);
RSB_dsp_string(12);
RSB_dsp_string(13);
MOS_disp(TRUE);
}
} else if ( i >= 11 && i <= 13 ) {
if ( j == 9 ) {
MSG_wind(help_msg[i]);
} else {
MOS_disp(FALSE);
p = menu[i].sub[0];
menu[i].sub[0] = "";
RSB_dsp_string(i);
strcpy( p,MSG_getstr(MENU_X+98,MENU_Y+5+i*20,
MENU_CHR,MENU_COL,p,40));
menu[i].sub[0] = p;
RSB_dsp_string(i);
MOS_disp(TRUE);
}
}
}
EVT_level_free(600);
MOS_disp(FALSE);
DSP_pop_vram(vram_save);
MOS_push(ERR,ERR,ERR,ERR);
if ( rsb_event != 999 )
return;
mode = 0;
if ( menu[2].no != 0 ) mode |= 0x01;
if ( menu[3].no == 1 ) mode |= 0x02;
if ( menu[3].no == 2 ) mode |= 0x06;
if ( menu[4].no != 0 ) mode |= 0x08;
if ( menu[5].no != 0 ) mode |= 0x10;
if ( menu[0].no != port )
RSB_init(menu[0].no);
RSB_reopen(mode,menu[1].no);
macvalset("_BREAK_TIME",(menu[6].no + 1) * 500);
macvalset("_CRWAIT",menu[7].no * 50);
macvalset("_LOGMAX",(menu[8].no + 1) * 1000);
macvalset("_MODEM",menu[9].no);
macvalset("_POHN",menu[10].no);
macset("_ATCMD1",atcmd[0]);
macset("_ATCMD2",atcmd[1]);
macset("_ATCMD3",atcmd[2]);
}
/**********************************************************
UP/DOWN LOAD WIND DISPLAY
***********************************************************/
#define DSP_X 128
#define DSP_Y 124
#define DSP_COL COL_JACK
#define SIZ_X1 136
#define SIZ_Y1 324
#define SIZ_X2 478
#define SIZ_Y2 (SIZ_Y1+11)
#define ABORT_X 484
#define ABORT_Y 324
#define STMsg 0
#define STFile 1
#define STUpDow 2
#define STType 3
#define STComSent 4
#define STDataSent 5
#define STErrSent 6
#define STPacSent 7
#define STComRate 8
#define STDataRate 9
#define STElapsed 10
#define STComRead 20
#define STDataRead 21
#define STErrRead 22
#define STPacRead 23
#define STUplSize 24
#define STDowSize 25
#define STUplRem 26
#define STDowRem 27
#define STRemTime 28
static int st_event=FALSE;
static BLOCK *save=NULL;
static int grp_size=0;
void cputs(char *str,int x,int y,int col)
{
MOS_disp(FALSE);
wrtstr(str,page_ofs,x*4+y*16*512,
col_cnv[col],col_cnv[DSP_COL],16);
MOS_disp(TRUE);
}
int ST_Check_Abort()
{
EVT_loop(600);
if ( st_event != FALSE )
return 1;
else
return 0;
}
void ST_Yes_or_No(arg,yn)
char *arg;
char *yn;
{
cputs(arg,17,20,COL_RED);
*yn = getch();
}
void ST_event(EVENT *ep)
{
switch(ep->now) {
case EVT_CLIP_MOS:
EVT_clip_on(ep);
case EVT_ON_MOS:
DSP_mos(1);
break;
case EVT_SELECT_MOS:
EVT_clip_off(ep);
DSP_mos(2);
st_event = TRUE;
break;
case EVT_DOLACK_MOS:
ep->now = EVT_NON;
case EVT_MOVE_MOS:
EVT_clip_off(ep);
case EVT_OFF_MOS:
DSP_mos(2);
break;
}
}
void ST_Initialize(int no)
{
int i;
static char *menu[]={
"Msg ","File ","UpDow ","Type ","ComSent ",
"DataSent","ErrSent ","PacSent ","ComRate ","DataRate",
"Elapsed ",
" "," ","ComRead ","DataRead","ErrRead ",
"PacRead ","UplSize ","DowSize ","UplRem ","DowRem ",
"RemTime " };
static char *ttl[]={
" <<< B Plus Protocol(SM) >>> ",
" <<< B Plus Protocol(SM) t >>> ",
" <<< Nomal Text Upload >>> ",
" <<< X-Modem Protocol Up >>> ",
" <<< X-Modem Protocol Down >>> "
};
if ( save != NULL )
return;
MOS_disp(FALSE);
save = DSP_push_vram(DSP_X,DSP_Y,DSP_X+50*8+8,DSP_Y+13*16+8);
DSP_rbox(DSP_X,DSP_Y,DSP_X+50*8+8,DSP_Y+13*16+8,7,8,DSP_COL);
cputs(ttl[no],17,8,COL_RED);
for ( i = 0 ; i < 22 ; i++ )
cputs(menu[i],17+(i/11)*24,9+(i%11),COL_JACK2);
EVT_level_free(600);
EVT_sw(ABORT_X,ABORT_Y,"ABORT",COL_RED,DSP_COL,600,ST_event,0);
st_event = FALSE;
macvalset("PROTOCOL",no);
MSG_wind("updown_start");
grp_size = 0;
DSP_mos(2);
MOS_disp(TRUE);
}
void ST_Terminate()
{
if ( save != NULL ) {
MOS_disp(FALSE);
EVT_level_free(600);
DSP_pop_vram(save);
save = NULL;
MSG_wind("updown_end");
DSP_mos(0);
MOS_disp(TRUE);
}
}
void ST_Display_String(no,str)
int no;
char *str;
{
if ( save != NULL )
cputs(str,27+(no/18)*24,9+(no%18),COL_JACK2);
}
void ST_Display_Value(no,val)
int no;
long val;
{
int n;
char tmp[20];
if ( no == STElapsed || no == STRemTime ) {
if ( val >= 3600 )
sprintf(tmp,"%2ld:%02ld:%02ld",val/3600,(val%3600)/60,val%60);
else if ( val >= 60 )
sprintf(tmp," %2ld:%02ld",val/60,val%60);
else
sprintf(tmp," %2ld",val);
} else if ( no == STUplRem || no == STDowRem ) {
if ( grp_size == 0 ) {
grp_size = val;
DSP_xline(SIZ_X1,SIZ_Y1,SIZ_X2,SIZ_Y2,COL_LINE,0);
} else {
n = (grp_size - val) * (SIZ_X2-SIZ_X1-2) / grp_size;
DSP_xline(SIZ_X1+1,SIZ_Y1+1,SIZ_X1+n+1,SIZ_Y2-1,COL_CHR,0);
}
sprintf(tmp,"%8ld",val);
} else
sprintf(tmp,"%8ld",val);
ST_Display_String(no,tmp);
}
int FILE_upload(char *file)
{
FILE *fp;
int ch,ct=0;
int file_size;
int up_size;
int byte_sec;
int total_time;
clock_t st;
if( (fp = fopen(file,"rb")) == NULL )
return ERR;
fseek(fp,0L,SEEK_END);
file_size = ftell(fp);
rewind(fp);
ST_Initialize(2);
ST_Display_String (STFile, file);
ST_Display_String (STUpDow, "Uploading ");
ST_Display_String (STType, "ASCII");
ST_Display_Value (STUplRem, file_size);
st = clock();
up_size = 0;
byte_sec = 200;
while ( (ch = getc(fp)) != EOF ) {
if ( ch == '\x1A' ) {
ST_Display_String (STMsg, "*** Transfer Complete ***");
break;
} else if ( ch == '\x0D' ) {
RSB_putc(ch);
if ( (total_time = (clock() - st) / CLK_TCK) > 0 ) {
byte_sec = up_size / total_time;
ST_Display_Value (STDataRate, byte_sec);
if ( byte_sec > 0 )
ST_Display_Value (STRemTime, file_size / byte_sec);
ST_Display_Value (STUplSize, up_size);
ST_Display_Value (STUplRem, file_size);
ST_Display_Value (STElapsed, total_time);
}
Soft_time(macval("_CRWAIT") * 100);
} else if ( ch != '\x0A' )
RSB_putc(ch);
up_size++;
file_size--;
if ( ++ct >= 50 ) {
while ( RSB_chk() )
RSB_getc();
ct = 0;
}
if ( ST_Check_Abort() ) {
ST_Display_String (STMsg, "Aborting download per your request");
break;
}
}
fclose(fp);
for ( ct = 0 ; ct < 50 ; ct++ ) {
while ( RSB_chk() )
RSB_getc();
}
ST_Terminate();
return FALSE;
}
/******************************************
X-Modem
*******************************************/
#define SOH '\x01'
#define STX '\x02'
#define EOT '\x04'
#define ACK '\x06'
#define NAK '\x15'
#define CAN '\x18'
#define CRC '\x43'
#define CR '\x0D'
static void Send(ch)
int ch;
{
unsigned int st;
RSB_send(port,ch,&st);
}
static void Send_str(arg,n)
UCHAR *arg;
int n;
{
unsigned int st;
while ( n-- > 0 )
RSB_send(port,(int)*(arg++),&st);
}
static int Recive()
{
int i,ch;
unsigned int st;
if ( RSB_receive(port,&ch,&st) != 0 )
return ERR;
else
return (ch & 0xFF);
}
static int Recive_str(arg,n)
UCHAR *arg;
int n;
{
int ch;
while ( n-- > 0 ) {
if ( (ch = Recive()) == ERR )
return ERR;
*(arg++) = ch;
}
return FALSE;
}
static int Send_blk(fp,bk)
FILE *fp;
int bk;
{
int i,j;
UCHAR head[3];
UCHAR *p,tmp[128];
head[0]=SOH;
head[1]=bk;
head[2]=255-bk;
if ( (i=fread(tmp,1,128,fp)) <= 0 ) {
Send(EOT);
return ERR;
}
for ( p=tmp+i ; i < 128 ; i++ )
*(p++)='\0';
for ( j = i = 0 ; i < 128 ; i++,j &= 0xff )
j += tmp[i];
Send_str(head,3);
Send_str(tmp,128);
Send(j);
return FALSE;
}
int XMODEM_upload(char *file)
{
int i,ch,bk,nk,ef,fg,md;
int byte_sec,total_time;
unsigned int ec;
FILE *fp;
long up_size,file_size;
clock_t st;
if ( (fp = fopen(file,"rb")) == NULL )
return ERR;
fseek(fp,0L,2);
file_size = (long)ftell(fp);
fseek(fp,0L,0);
ST_Initialize(3);
ST_Display_String (STFile, file);
ST_Display_String (STUpDow, "X-Modem Uploading ");
ST_Display_String (STType, "BINARY");
ST_Display_Value (STUplRem, file_size);
st = clock();
byte_sec = 200;
fg = FALSE;
md = para.mode;
RSB_reopen(md & 0xEF,para.baud);
for ( bk = 1, nk = 0, ef = FALSE, up_size = 0 ; ; ) {
if ( ST_Check_Abort() ) {
ST_Display_String (STMsg, "Aborting download per your request");
break;
}
for ( i = 0 ; i < 5 ; i++ ) {
if ( (ch = Recive()) != ERR )
break;
ST_Display_Value (STErrSent, i+1);
}
if ( i >= 5 ) {
ST_Display_String (STMsg, "Time over abort..");
break;
}
if ( ch == ACK ) {
up_size += 128;
file_size -= 128;
nk = 0;
if ( ++bk >= 256 )
bk = 0;
if ( ef != FALSE ) {
ST_Display_String (STMsg, "*** Transfer Complete ***");
break;
}
if ( Send_blk(fp,bk) != FALSE )
ef = TRUE;
else
fg = TRUE;
} else if ( ch == NAK ) {
nk++;
fseek(fp,up_size,SEEK_SET);
if ( Send_blk(fp,bk) != FALSE )
ef = TRUE;
else
fg = TRUE;
} else if ( ch == CAN ) {
ST_Display_String (STMsg, "Recive Cancel signal");
break;
}
if ( nk >= 10 ) {
ST_Display_String (STMsg, "ReTry over abort !!");
Send(CAN);
break;
}
if ( fg != FALSE && (total_time = (clock() - st) / CLK_TCK) > 0 ) {
byte_sec = (up_size + 128) / total_time;
ST_Display_Value (STDataRate, byte_sec);
if ( byte_sec > 0 )
ST_Display_Value (STRemTime, file_size / byte_sec);
ST_Display_Value (STUplSize, up_size + 128);
ST_Display_Value (STUplRem, file_size);
ST_Display_Value (STElapsed, total_time);
fg = FALSE;
}
}
RSB_reopen(md,para.baud);
fclose(fp);
ST_Terminate();
return FALSE;
}
int XMODEM_download(char *file)
{
int i,j,ch,bk,nk,ef,md;
unsigned int ec;
long size;
FILE *fp;
clock_t st;
int byte_sec,total_time;
UCHAR tmp[128];
if ( (fp = fopen(file,"wb")) == NULL )
return ERR;
ST_Initialize(4);
ST_Display_String (STFile, file);
ST_Display_String (STUpDow, "X-Modem Downloading ");
ST_Display_String (STType, "BINARY");
st = clock();
byte_sec = 200;
md = para.mode;
RSB_reopen(md & 0xEF,para.baud);
for ( ef = TRUE,bk = 1,size = 0,nk = 0 ; ; ) {
if ( ST_Check_Abort() ) {
ST_Display_String (STMsg, "Aborting download per your request");
break;
}
for ( i = 0 ; i < 5 ; i++ ) {
if ( ef == FALSE )
Send(ACK);
else
Send(NAK);
if ( (ch = Recive()) != ERR )
break;
ST_Display_Value (STErrSent, i+1);
}
if ( i >= 5 ) {
ST_Display_String (STMsg, "Time over abort..");
break;
}
if ( ch == EOT ) {
ST_Display_String (STMsg, "*** Transfer Complete ***");
Send(ACK);
break;
} else if ( ch == CAN ) {
ST_Display_String (STMsg, "Recive Cancel signal");
break;
} else if ( ch == SOH ) {
if ( Recive() != bk )
goto ERROR;
if ( (255 - Recive()) != bk )
goto ERROR;
if ( Recive_str(tmp,128) != FALSE )
goto ERROR;
for ( j = i = 0 ; i < 128 ; i++,j &= 0xff )
j += tmp[i];
if ( Recive() != j )
goto ERROR;
fwrite(tmp,1,128,fp);
size += 128;
ST_Display_Value (STDowSize, size);
if ( (total_time = (clock() - st) / CLK_TCK) > 0 ) {
byte_sec = (size + 128) / total_time;
ST_Display_Value (STDataRate, byte_sec);
ST_Display_Value (STElapsed, total_time);
}
ef = FALSE;
nk = 0;
if ( ++bk >= 256 )
bk = 0;
continue;
}
ERROR:
Recive_str(tmp,128); /* Dummy */
ef = TRUE;
ST_Display_Value (STErrRead, ++nk);
if ( nk >= 10 ) {
ST_Display_String (STMsg, "ReTry over abort !!");
Send(CAN);
break;
}
}
RSB_reopen(md,para.baud);
fclose(fp);
ST_Terminate();
return FALSE;
}