On 1/21/19 11:33 AM, Sebastian Huber wrote:
> On 21/01/2019 11:30, Jiri Gaisler wrote:
>> diff --git a/bsps/shared/grlib/spw/grspw.c
>> b/bsps/shared/grlib/spw/grspw.c
>> index fbaadd1e13..7d99831e71 100644
>> --- a/bsps/shared/grlib/spw/grspw.c
>> +++ b/bsps/shared/grlib/spw/grspw.c
>> @@ -25,8 +25,8 @@
>> #include <grlib/grlib_impl.h>
>> -#ifndef CPU_SPARC_HAS_SNOOPING
>> -#define CPU_SPARC_HAS_SNOOPING 1
>> +#ifndef GRLIB_DMA_IS_CACHE_COHERENT
>> +#define GRLIB_DMA_IS_CACHE_COHERENT 1
>> #endif
>>
>
> I would remove this block. Things should be only defined in one place.
True, How about this?
diff --git a/bsps/include/grlib/grlib_impl.h b/bsps/include/grlib/grlib_impl.h
index f1260671e0..68cc292886 100644
--- a/bsps/include/grlib/grlib_impl.h
+++ b/bsps/include/grlib/grlib_impl.h
@@ -121,6 +121,9 @@ RTEMS_INLINE_ROUTINE unsigned int grlib_read_uncached32(unsigned int address)
);
return tmp;
}
+
+#define GRLIB_DMA_IS_CACHE_COHERENT CPU_SPARC_HAS_SNOOPING
+
#else
static unsigned char __inline__ grlib_read_uncached8(unsigned int address)
@@ -140,6 +143,8 @@ RTEMS_INLINE_ROUTINE unsigned int grlib_read_uncached32(unsigned int address)
return tmp;
}
+#define GRLIB_DMA_IS_CACHE_COHERENT 1
+
#endif
extern struct ambapp_bus ambapp_plb;
diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
index fbaadd1e13..2e1e8e90e9 100644
--- a/bsps/shared/grlib/spw/grspw.c
+++ b/bsps/shared/grlib/spw/grspw.c
@@ -25,10 +25,6 @@
#include <grlib/grlib_impl.h>
-#ifndef CPU_SPARC_HAS_SNOOPING
-#define CPU_SPARC_HAS_SNOOPING 1
-#endif
-
#define DBGSPW_IOCALLS 1
#define DBGSPW_TX 2
#define DBGSPW_RX 4
@@ -1897,7 +1893,7 @@ static int grspw_hw_receive(GRSPW_DEV *pDev, char *b, int c) {
if (rxlen > c) {
rxlen = c;
}
- if (CPU_SPARC_HAS_SNOOPING) {
+ if (GRLIB_DMA_IS_CACHE_COHERENT) {
/* if ( 1 ) {*/
/*printf("RX_MEMCPY(0x%x, 0x%x, 0x%x)\n", (unsigned int)b, (unsigned int)(rxb+pDev->rxbufcur), (unsigned int)rxlen);*/
memcpy(b, rxb+pDev->rxbufcur, rxlen);
_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel