From d62cf44f575365c7e4ae3831190db46ec5afa7bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Adamczewski-Musch?= Date: Mon, 25 Apr 2016 15:49:03 +0200 Subject: [PATCH] pexor kernel module: introduced some ns sleepstates when polling for dma complete, as in other pexor DAQ driver variants. This may help for seldomly occuring read / dma errors? Still under test. Also more verbose codeversion information in sysfs. --- pexor/kernel-module/pexor_trb.c | 23 ++++++++++++++++------- pexor/kernel-module/pexor_trb.h | 3 ++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pexor/kernel-module/pexor_trb.c b/pexor/kernel-module/pexor_trb.c index 6beaa5f..34d2b83 100644 --- a/pexor/kernel-module/pexor_trb.c +++ b/pexor/kernel-module/pexor_trb.c @@ -73,8 +73,12 @@ struct dev_pexor unsigned char init_done; /* object is ready flag */ }; -#define PEXOR_DMA_MAXPOLLS 10000000 -#define PEXOR_DMA_POLLDELAY 0 +//#define PEXOR_DMA_MAXPOLLS 10000000 +// JAM 2016: introduced again polling delay to make it independent of host hardware speed... +#define PEXOR_DMA_MAXPOLLS 100000 +/** polling delay for each cycle in ns for dma complete bit*/ +#define PEXOR_DMA_POLLDELAY 20 + #define PEXOR_MEMWRITE_SIZE 128 #define UDELAY_TIME 1 @@ -282,8 +286,8 @@ ssize_t pexor_sysfs_codeversion_show(struct device* dev, char* buf) { return snprintf(buf, PAGE_SIZE, - "*** This is PEXOR driver version %s build on %s at %s \n\t", - PEXORVERSION, __DATE__, __TIME__); + "*** This is PEXOR TRBnet driver for HADES, version %s by %s, build on %s at %s \n\t", + PEXORVERSION, PEXORAUTHOR, __DATE__, __TIME__); } void test_pci(struct pci_dev* dev) @@ -1451,6 +1455,11 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata* priv, status = -201; goto OUT_IOCTL; } + + // JAM2016: try some slight waitstate before rereading the status + if (PEXOR_DMA_POLLDELAY) + ndelay(PEXOR_DMA_POLLDELAY); + } /* sync current sg-entry back to CPU */ @@ -1464,7 +1473,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata* priv, if (loops == PEXOR_DMA_MAXPOLLS) { pexor_msg(KERN_ERR "ERROR> wait_dma_complete: polling longer than %d cycles " - "(udelay %d mus) for dma complete! Status: 0x%08x\n", + "(ndelay %d nanos) for dma complete! Status: 0x%08x\n", PEXOR_DMA_MAXPOLLS, PEXOR_DMA_POLLDELAY, (unsigned int)dmastat); /* reset DMA */ @@ -1557,9 +1566,9 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata* priv, /* ---------------------------------------------------------------------- */ MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Joern Adamczewski-Musch / Ludwig Maier"); +MODULE_AUTHOR(PEXORAUTHOR); MODULE_DESCRIPTION("pexor device driver for HADES TRBNet"); -MODULE_VERSION("2.0.1"); +MODULE_VERSION(PEXORVERSION); MODULE_DEVICE_TABLE(pci, ids); module_init(pexor_init); diff --git a/pexor/kernel-module/pexor_trb.h b/pexor/kernel-module/pexor_trb.h index 7317e28..0cfb23a 100644 --- a/pexor/kernel-module/pexor_trb.h +++ b/pexor/kernel-module/pexor_trb.h @@ -95,7 +95,8 @@ #include -#define PEXORVERSION "2.0.1" +#define PEXORVERSION "2.0.2" +#define PEXORAUTHOR "Joern Adamczewski-Musch and Ludwig Maier" /* the states:*/ -- 2.43.0