On Wed, 17 May 2006 19:49:43 +0200
Alfonso Amato - Sintecnos srl <a.amato@sintecnos.com> wrote:
Has someone experienced what follows and has some workaround?
The board is a custom made by us, and uses a Sharp LH75400 with a Cirrus
CS8900A. The ecos is tailored for this board and uses free_bsd stack.
The application is running in some tasks with preemptive kernel.
I see that after some time working, mainly if there is some traffic on a
normal window ethernet environment, the tcp/ip communication locks. I
see the int pin locked high. In another testbed (without seeing the int
pin) i see the system locking on BusStat check while loop (the getreg
says that the address 312 decimal returns 0x0018 (instead of 0x0118,
that's the chip is ready to send NOW).
Any help, please?
Alfonso Amato
Sintecnos
I experienced endless loops in dev/eth/cl/cs8900a/current/src/if_cs8900a.c
cs8900a_send(). See line 508 in the current CVS. You have to put some kind of timeout
handling in the following loop:
---------------------------
508: do {
509: stat = get_reg(base, PP_BusStat);
510: } while (!(stat & PP_BusStat_TxRDY));
---------------------------
personally I changed it to
----------------------------
timeout = 0;
#ifdef CYGPKG_KERNEL
starttime = cyg_current_time();
#endif
do {
stat = get_reg(base, PP_BusStat);
timeout++;
#ifndef CYGPKG_KERNEL
if (timeout > 100000) {
//diag_printf("Timeout on the cs8900 driver!\n\n\n\n\n");
return;
}
#else
if (timeout > 100) {
//diag_printf("#\n");
timeout = 0;
if (starttime + 3 * 100 < cyg_current_time()) {
//diag_printf("Timeout on the cs8900 driver!\n\n\n\n\n");
return;
}
}
#endif
} while (!(stat & PP_BusStat_TxRDY));
------------------------------
where the two new variable is:
int timeout;
cyg_tick_count_t starttime;
Later I created a cs8900_reset function from a part of cs8900_init, and I called
this function before init, but now I'm simply return, I will look after it...
Hope this helps,
Ferenc Deak
PS
Ecos maintaners, please consider it as a bug report. The solution is not perfect, but the
something have to be done with this loop.