Mercurial > ecos
changeset 1445:85afbe4f7f1c
Fix diag I/O when buffers are cacheable
| author | gthomas |
|---|---|
| date | Tue, 16 Dec 2003 14:33:17 +0000 |
| parents | d9e058a49f03 |
| children | 9f065ea84515 |
| files | packages/hal/powerpc/mpc8xxx/current/ChangeLog packages/hal/powerpc/mpc8xxx/current/src/quicc2_diag.c |
| diffstat | 2 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/hal/powerpc/mpc8xxx/current/ChangeLog +++ b/packages/hal/powerpc/mpc8xxx/current/ChangeLog @@ -1,3 +1,8 @@ +2003-12-16 Gary Thomas <gary@mlbassoc.com> + + * src/quicc2_diag.c: Need to flush/invalidate cache for character + buffers (since they may be cacheable if the serial driver is running) + 2003-11-19 Gary Thomas <gary@mlbassoc.com> * include/mpc8xxx.h: Add definitions for CPM timers.
--- a/packages/hal/powerpc/mpc8xxx/current/src/quicc2_diag.c +++ b/packages/hal/powerpc/mpc8xxx/current/src/quicc2_diag.c @@ -60,6 +60,7 @@ #include <cyg/hal/drv_api.h> // CYG_ISR_HANDLED #include <cyg/hal/hal_intr.h> +#include <cyg/hal/hal_cache.h> #include <cyg/hal/mpc8xxx.h> // Needed for IMMR structure #define PORT_IS_SMC 1 @@ -420,7 +421,7 @@ cyg_hal_plf_serial_putc(void* __ch_data, volatile struct cp_bufdesc *bd; struct port_info *info = (struct port_info *)__ch_data; volatile t_Scc_Pram *uart_pram = (volatile t_Scc_Pram *)((char *)IMM + info->pram); -// int cache_state; + int cache_state; /* tx buffer descriptor */ bd = (struct cp_bufdesc *)((char *)IMM + uart_pram->tbptr); @@ -431,15 +432,15 @@ cyg_hal_plf_serial_putc(void* __ch_data, } bd->length = 1; bd->buffer[0] = ch; - bd->ctrl |= _BD_CTL_Ready; -#if 0 //?? + // Flush cache if necessary - buffer may be in cacheable memory HAL_DCACHE_IS_ENABLED(cache_state); if (cache_state) { HAL_DCACHE_FLUSH(bd->buffer, 1); } -#endif + bd->ctrl |= _BD_CTL_Ready; + while (bd->ctrl & _BD_CTL_Ready) ; // Wait for buffer free } static cyg_bool @@ -448,7 +449,7 @@ cyg_hal_plf_serial_getc_nonblock(void* _ volatile struct cp_bufdesc *bd; struct port_info *info = (struct port_info *)__ch_data; volatile t_Scc_Pram *uart_pram = (volatile t_Scc_Pram *)((char *)IMM + info->pram); -// int cache_state; + int cache_state; /* rx buffer descriptor */ bd = info->next_rxbd; @@ -468,13 +469,12 @@ cyg_hal_plf_serial_getc_nonblock(void* _ } info->next_rxbd = bd; -#if 0 - // Note: the MBX860 does not seem to snoop/invalidate the data cache properly! + // Note: the MPC8xxx does not seem to snoop/invalidate the data cache properly! HAL_DCACHE_IS_ENABLED(cache_state); if (cache_state) { HAL_DCACHE_INVALIDATE(bd->buffer, uart_pram->mrblr); // Make sure no stale data } -#endif + return true; }
