Make the fore_dnld program more robust and reliable.

In particular HZ=1000 would seem to break it before.
This commit is contained in:
Poul-Henning Kamp 2000-03-17 17:09:55 +00:00
parent 63909a9015
commit ac989b7073
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58172

View File

@ -169,7 +169,7 @@ int prn;
/*
* We need to introduce a delay in here or things tend to hang...
*/
delay(10);
delay(10000);
if ( lineptr >= sizeof(line) )
lineptr = 0;
@ -242,10 +242,13 @@ int dn;
{
if ( CP_READ(Uart->mon_xmithost) & UART_VALID )
getbyte ( 0 );
if ( !dn ) delay ( 1000 );
if ( !dn ) delay ( 10000 );
}
val = ( c | UART_VALID );
Uart->mon_xmitmon = CP_WRITE( val );
if ( !dn ) delay ( 10000 );
if ( CP_READ(Uart->mon_xmithost) & UART_VALID )
getbyte ( 0 );
}
@ -756,7 +759,7 @@ u_char *ram;
xmit_to_i960 ( cmd, strlen ( cmd ), 0 );
while ( strncmp ( line, cmd, strlen(cmd) - 3 ) != 0 )
while ( strncmp ( line, cmd, strlen(cmd) - 3 ) != 0 )
getline ( verbose );
if ( verbose )
@ -1083,7 +1086,7 @@ char *argv[];
#else
ram = (u_char *) mmap(0, air->acp_ramsize,
#endif
PROT_READ | PROT_WRITE, MAP_SHARED,
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_HASSEMAPHORE,
fd, air->acp_ram);
if (ram == (u_char *)-1) {
perror ( "mmap ram" );
@ -1330,14 +1333,20 @@ char *argv[];
*/
aap = (Aali *)(ram + CP_READ(Mon->mon_appl));
for (i = 0; i < MAX_CHECK; i++, sleep(1)) {
u_long hb1, hb2;
u_long hb1, hb2, hb3;
if (CP_READ(Mon->mon_bstat) != BOOT_RUNNING)
hb3 = CP_READ(Mon->mon_bstat);
if (hb3 != BOOT_RUNNING) {
if (verbose)
printf("bstat %x\n", hb3);
continue;
}
hb1 = CP_READ(aap->aali_heartbeat);
delay(1);
hb2 = CP_READ(aap->aali_heartbeat);
if (verbose)
printf("hb %x %x\n", hb1, hb2);
if (hb1 < hb2)
break;
}