[rtems commit] leon,grspw: fix for SET_PACKET_SIZE

Daniel Hellstrom danielh at rtems.org
Thu Mar 11 16:51:34 UTC 2021


Module:    rtems
Branch:    master
Commit:    e227ae53abc3721e6fc39473cf236cef46f0c532
Changeset: http://git.rtems.org/rtems/commit/?id=e227ae53abc3721e6fc39473cf236cef46f0c532

Author:    Daniel Hellstrom <daniel at gaisler.com>
Date:      Fri Apr 12 12:17:57 2019 +0200

leon,grspw: fix for SET_PACKET_SIZE

When the DMA table has been allocated dynamically, the IOCTL_SET_PACKETSIZE
will trigger an issue where pDev->rx and pDev->tx are not updated with
the new DMA tables base address. Instead the old pointers are used.

There is no point in reallocting the DMA tables because there is no
configuration option to it. Therefore the DMA tables allocation is
moved to a separate function never called from SET_PACKETSIZE.

---

 bsps/shared/grlib/spw/grspw.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
index 32740d4..bf1c823 100644
--- a/bsps/shared/grlib/spw/grspw.c
+++ b/bsps/shared/grlib/spw/grspw.c
@@ -261,6 +261,7 @@ static void check_rx_errors(GRSPW_DEV *pDev, int ctrl);
 static void grspw_rxnext(GRSPW_DEV *pDev);
 static void grspw_interrupt(void *arg);
 static int grspw_buffer_alloc(GRSPW_DEV *pDev);
+static int grspw_dmatables_alloc(GRSPW_DEV *pDev);
 
 static rtems_device_driver grspw_initialize(
         rtems_device_major_number  major,
@@ -554,6 +555,8 @@ int grspw_device_init(GRSPW_DEV *pDev)
 
 	if (grspw_buffer_alloc(pDev)) 
 		return RTEMS_NO_MEMORY;
+	if (grspw_dmatables_alloc(pDev))
+		return RTEMS_NO_MEMORY;
 
 	/* Create semaphores */
 	status = rtems_semaphore_create(
@@ -681,7 +684,11 @@ static int grspw_buffer_alloc(GRSPW_DEV *pDev)
 			(void **)&pDev->ptr_txhbuf0_remote,
 			pDev->txhbufsize * pDev->txbufcnt);
 	}
+	return 0;
+}
 
+static int grspw_dmatables_alloc(GRSPW_DEV *pDev)
+{
 	/* DMA DESCRIPTOR TABLES */
 	if (pDev->bd_dma_area & 1) {
 		/* Address given in remote address */



More information about the vc mailing list