PSI sics-cvs-psi-2008-10-02

This commit is contained in:
2008-10-02 00:00:00 +00:00
committed by Douglas Clowes
parent 6e926b813f
commit 4baffb9b7a
304 changed files with 77527 additions and 3612 deletions

View File

@@ -434,6 +434,42 @@ void getRS232Error(int iCode, char *errorBuffer,
}
}
/*--------------------------------------------------------------------*/
int fixRS232Error(prs232 self, int iCode){
int i, status, read;
char buffer[8192];
switch(iCode){
case BADMEMORY:
case FAILEDCONNECT:
return 0;
break;
case INCOMPLETE:
case TIMEOUT:
/*
* try to clear possibly pending stuff
*/
for(i = 0; i < 3; i++){
if(availableRS232(self)){
read = 8192;
readRS232(self,buffer,&read);
}
}
return 1;
break;
case NOTCONNECTED:
case BADSEND:
closeRS232(self);
status = initRS232(self);
if(status > 0){
return 1;
} else {
return 0;
}
break;
}
return 0;
}
/*--------------------------------------------------------------------*/
int getRS232Timeout(prs232 self){
return self->timeout;
}