From d8a707bc6741d380b5c62bdd8df984848c9bb019 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Sat, 6 Jul 2024 09:07:46 -0700 Subject: [PATCH] resolving c++ linter Extra space after ( in XXXX call [whitespace/parens] --- CPPLINT.cfg | 1 - common/driver/axis_gen2.c | 12 ++++++------ common/driver/axis_gen2.h | 14 +++++++------- common/driver/dma_buffer.c | 10 +++++----- common/driver/dma_common.c | 8 ++++---- common/driver/dma_common.h | 6 +++--- common/driver/gpu_async.c | 4 ++-- data_dev/app/src/dmaRate.cpp | 2 +- data_dev/driver/src/data_dev_top.c | 4 ++-- data_gpu/driver/src/data_gpu_top.c | 4 ++-- rce_memmap/driver/src/rce_map.c | 2 +- rce_stream/app/src/dmaLoopTest.cpp | 24 ++++++++++++------------ rce_stream/app/src/dmaRead.cpp | 8 ++++---- rce_stream/app/src/dmaSetDebug.cpp | 6 +++--- rce_stream/app/src/dmaWrite.cpp | 8 ++++---- rce_stream/driver/src/axis_gen1.c | 12 ++++++------ rce_stream/driver/src/rce_top.c | 2 +- 17 files changed, 63 insertions(+), 64 deletions(-) diff --git a/CPPLINT.cfg b/CPPLINT.cfg index d0408aa..dd59e08 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -39,4 +39,3 @@ filter=-whitespace/indent filter=-whitespace/newline filter=-whitespace/comma filter=-whitespace/comments -filter=-whitespace/parens diff --git a/common/driver/axis_gen2.c b/common/driver/axis_gen2.c index b82a2d3..ca0145f 100755 --- a/common/driver/axis_gen2.c +++ b/common/driver/axis_gen2.c @@ -67,7 +67,7 @@ struct hardware_functions AxisG2_functions = { * * Return: Status of the mapping (0 for failure, 1 for success). */ -inline uint8_t AxisG2_MapReturn ( struct DmaDevice * dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring) { +inline uint8_t AxisG2_MapReturn(struct DmaDevice * dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring) { uint32_t * ptr; uint32_t chan; uint32_t dest; @@ -124,7 +124,7 @@ inline uint8_t AxisG2_MapReturn ( struct DmaDevice * dev, struct AxisG2Return *r * of free buffers. It writes the buffer index and, if enabled, the buffer handle * to the device's write FIFOs to mark the buffer as free. */ -inline void AxisG2_WriteFree ( struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En ) { +inline void AxisG2_WriteFree(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En) { uint32_t wrData[2]; // Mask the buffer index to fit within the 28-bit field @@ -219,7 +219,7 @@ inline void AxisG2_WriteTx(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32 * * Returns: Number of processed items */ -uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData ) { +uint32_t AxisG2_Process(struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData) { struct DmaDesc *desc; struct DmaBuffer *buff; struct AxisG2Return ret; @@ -241,7 +241,7 @@ uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct A // Attempt to find buffer in tx pool and return. otherwise return rx entry to hw. // Must adjust counters here and check for buffer need - if ((buff = dmaRetBufferIdxIrq (dev,ret.index)) != NULL) { + if ((buff = dmaRetBufferIdxIrq(dev,ret.index)) != NULL) { // Add to receive/write software queue if ( hwData->hwWrBuffCnt >= (hwData->addrCount-1) ) { dmaQueuePushIrq(&(hwData->wrQueue),buff); @@ -340,7 +340,7 @@ uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct A AxisG2_WriteFree(hwData->buffList[x],reg,hwData->desc128En); ++hwData->hwWrBuffCnt; } - } while(bCnt > 0); + } while (bCnt > 0); } return handleCount; @@ -430,7 +430,7 @@ void AxisG2_Init(struct DmaDevice *dev) { size = hwData->addrCount*(hwData->desc128En?16:8); // Allocate DMA buffers based on configuration mode - if(dev->cfgMode & AXIS2_RING_ACP) { + if (dev->cfgMode & AXIS2_RING_ACP) { // Allocate read and write buffers in contiguous physical memory hwData->readAddr = kzalloc(size, GFP_DMA | GFP_KERNEL); hwData->readHandle = virt_to_phys(hwData->readAddr); diff --git a/common/driver/axis_gen2.h b/common/driver/axis_gen2.h index 8fb5a9d..c7894fd 100755 --- a/common/driver/axis_gen2.h +++ b/common/driver/axis_gen2.h @@ -210,10 +210,10 @@ struct AxisG2Data { }; // Function prototypes -inline uint8_t AxisG2_MapReturn ( struct DmaDevice *dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring); -inline void AxisG2_WriteFree ( struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En ); -inline void AxisG2_WriteTx ( struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En ); -uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData ); +inline uint8_t AxisG2_MapReturn(struct DmaDevice *dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring); +inline void AxisG2_WriteFree(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En); +inline void AxisG2_WriteTx(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En); +uint32_t AxisG2_Process(struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData); irqreturn_t AxisG2_Irq(int irq, void *dev_id); void AxisG2_Init(struct DmaDevice *dev); void AxisG2_Enable(struct DmaDevice *dev); @@ -223,8 +223,8 @@ int32_t AxisG2_SendBuffer(struct DmaDevice *dev, struct DmaBuffer **buff, uint32 int32_t AxisG2_Command(struct DmaDevice *dev, uint32_t cmd, uint64_t arg); void AxisG2_SeqShow(struct seq_file *s, struct DmaDevice *dev); extern struct hardware_functions AxisG2_functions; -void AxisG2_WqTask_IrqForce ( struct work_struct *work ); -void AxisG2_WqTask_Poll ( struct work_struct *work ); -void AxisG2_WqTask_Service ( struct work_struct *work ); +void AxisG2_WqTask_IrqForce(struct work_struct *work); +void AxisG2_WqTask_Poll(struct work_struct *work); +void AxisG2_WqTask_Service(struct work_struct *work); #endif // __AXIS_GEN2_H__ diff --git a/common/driver/dma_buffer.c b/common/driver/dma_buffer.c index 165aee2..b64f893 100755 --- a/common/driver/dma_buffer.c +++ b/common/driver/dma_buffer.c @@ -45,7 +45,7 @@ * * Return: the count of successfully allocated buffers, or 0 on failure. */ -size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list, +size_t dmaAllocBuffers(struct DmaDevice *dev, struct DmaBufferList *list, uint32_t count, uint32_t baseIdx, enum dma_data_direction direction) { uint32_t x; uint32_t sl; @@ -66,7 +66,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list, if ( count == 0 ) return 0; // Allocate first level pointers - if ((list->indexed = (struct DmaBuffer ***) kzalloc(sizeof(struct DmaBuffer**) * list->subCount, GFP_KERNEL)) == NULL ) { + if ((list->indexed = (struct DmaBuffer ***)kzalloc(sizeof(struct DmaBuffer**) * list->subCount, GFP_KERNEL)) == NULL) { dev_err(dev->device,"dmaAllocBuffers: Failed to allocate indexed list pointer. Count=%u.\n",list->subCount); goto cleanup_forced_exit; } @@ -89,7 +89,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list, for (x=0; x < count; x++) { sl = x / BUFFERS_PER_LIST; sli = x % BUFFERS_PER_LIST; - if ( (buff = (struct DmaBuffer *) kzalloc(sizeof(struct DmaBuffer), GFP_KERNEL)) == NULL) { + if ((buff = (struct DmaBuffer *)kzalloc(sizeof(struct DmaBuffer), GFP_KERNEL)) == NULL) { dev_err(dev->device,"dmaAllocBuffers: Failed to create buffer structure index %ui. Unloading.\n",x); goto cleanup_buffers; } @@ -139,7 +139,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list, } // Alloc or mapping failed - if ( buff->buffAddr == NULL || buff->buffHandle == 0) { + if (buff->buffAddr == NULL || buff->buffHandle == 0) { dev_err(dev->device,"dmaAllocBuffers: Failed to create stream buffer and dma mapping.\n"); goto cleanup_buffers; } @@ -905,7 +905,7 @@ uint32_t dmaQueuePushListIrq(struct DmaQueue *queue, struct DmaBuffer **buff, si * * Return: A pointer to a DmaBuffer if available; NULL if the queue is empty. */ -struct DmaBuffer * dmaQueuePop ( struct DmaQueue *queue ) { +struct DmaBuffer * dmaQueuePop(struct DmaQueue *queue ) { unsigned long iflags; struct DmaBuffer * ret; diff --git a/common/driver/dma_common.c b/common/driver/dma_common.c index 1fb4b7f..7475d06 100755 --- a/common/driver/dma_common.c +++ b/common/driver/dma_common.c @@ -264,7 +264,7 @@ int Dma_Init(struct DmaDevice *dev) { // Setup /proc - if ( NULL == proc_create_data(dev->devName, 0, NULL, &DmaProcOps, dev)) { + if (NULL == proc_create_data(dev->devName, 0, NULL, &DmaProcOps, dev)) { dev_err(dev->device,"Init: Failed to create proc entry.\n"); goto cleanup_device_create; } @@ -286,7 +286,7 @@ int Dma_Init(struct DmaDevice *dev) { // Create TX buffers dev_info(dev->device,"Init: Creating %i TX Buffers. Size=%i Bytes. Mode=%i.\n", dev->cfgTxCount,dev->cfgSize,dev->cfgMode); - res = dmaAllocBuffers (dev, &(dev->txBuffers), dev->cfgTxCount, 0, DMA_TO_DEVICE ); + res = dmaAllocBuffers(dev, &(dev->txBuffers), dev->cfgTxCount, 0, DMA_TO_DEVICE); tot = res * dev->cfgSize; dev_info(dev->device,"Init: Created %i out of %i TX Buffers. %llu Bytes.\n", res,dev->cfgTxCount,tot); @@ -309,7 +309,7 @@ int Dma_Init(struct DmaDevice *dev) { // Create RX buffers, bidirectional because RX buffers can be passed to TX dev_info(dev->device,"Init: Creating %i RX Buffers. Size=%i Bytes. Mode=%i.\n", dev->cfgRxCount,dev->cfgSize,dev->cfgMode); - res = dmaAllocBuffers (dev, &(dev->rxBuffers), dev->cfgRxCount, dev->txBuffers.count, DMA_BIDIRECTIONAL); + res = dmaAllocBuffers(dev, &(dev->rxBuffers), dev->cfgRxCount, dev->txBuffers.count, DMA_BIDIRECTIONAL); tot = res * dev->cfgSize; dev_info(dev->device,"Init: Created %i out of %i RX Buffers. %llu Bytes.\n", res,dev->cfgRxCount,tot); @@ -324,7 +324,7 @@ int Dma_Init(struct DmaDevice *dev) { // Set interrupt if ( dev->irq != 0 ) { dev_info(dev->device,"Init: IRQ %d\n", dev->irq); - res = request_irq( dev->irq, dev->hwFunc->irq, IRQF_SHARED, dev->devName, (void*)dev); + res = request_irq(dev->irq, dev->hwFunc->irq, IRQF_SHARED, dev->devName, (void*)dev); // Result of request IRQ from OS. if (res < 0) { diff --git a/common/driver/dma_common.h b/common/driver/dma_common.h index f9c886f..f4091c7 100755 --- a/common/driver/dma_common.h +++ b/common/driver/dma_common.h @@ -204,7 +204,7 @@ extern struct file_operations DmaFunctions; // Function prototypes char *Dma_DevNode(struct device *dev, umode_t *mode); -int Dma_MapReg ( struct DmaDevice *dev ); +int Dma_MapReg(struct DmaDevice *dev); int Dma_Init(struct DmaDevice *dev); void Dma_Clean(struct DmaDevice *dev); int Dma_Open(struct inode *inode, struct file *filp); @@ -212,7 +212,7 @@ int Dma_Release(struct inode *inode, struct file *filp); ssize_t Dma_Read(struct file *filp, char *buffer, size_t count, loff_t *f_pos); ssize_t Dma_Write(struct file *filp, const char* buffer, size_t count, loff_t* f_pos); ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg); -uint32_t Dma_Poll(struct file *filp, poll_table *wait ); +uint32_t Dma_Poll(struct file *filp, poll_table *wait); int Dma_Mmap(struct file *filp, struct vm_area_struct *vma); int Dma_Fasync(int fd, struct file *filp, int mode); int Dma_ProcOpen(struct inode *inode, struct file *file); @@ -220,7 +220,7 @@ void * Dma_SeqStart(struct seq_file *s, loff_t *pos); void * Dma_SeqNext(struct seq_file *s, void *v, loff_t *pos); void Dma_SeqStop(struct seq_file *s, void *v); int Dma_SeqShow(struct seq_file *s, void *v); -int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t * mask ); +int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t * mask); int32_t Dma_WriteRegister(struct DmaDevice *dev, uint64_t arg); int32_t Dma_ReadRegister(struct DmaDevice *dev, uint64_t arg); diff --git a/common/driver/gpu_async.c b/common/driver/gpu_async.c index 0b4cee2..58f2189 100755 --- a/common/driver/gpu_async.c +++ b/common/driver/gpu_async.c @@ -178,12 +178,12 @@ int32_t Gpu_AddNvidia(struct DmaDevice *dev, uint64_t arg) { x = 0; - if (data->writeBuffers.count > 0 ) { + if (data->writeBuffers.count > 0) { x |= 0x00000100; x |= (data->writeBuffers.count-1); } - if (data->readBuffers.count > 0 ) { + if (data->readBuffers.count > 0) { x |= 0x01000000; x |= (data->readBuffers.count-1) << 16; } diff --git a/data_dev/app/src/dmaRate.cpp b/data_dev/app/src/dmaRate.cpp index 486509b..8e33a23 100644 --- a/data_dev/app/src/dmaRate.cpp +++ b/data_dev/app/src/dmaRate.cpp @@ -56,7 +56,7 @@ static struct argp_option options[] = { error_t parseArgs(int key, char *arg, struct argp_state *state) { struct PrgArgs *args = (struct PrgArgs *)state->input; - switch(key) { + switch (key) { case 'p': args->path = arg; break; case 'c': args->count = atoi(arg); break; default: return ARGP_ERR_UNKNOWN; break; diff --git a/data_dev/driver/src/data_dev_top.c b/data_dev/driver/src/data_dev_top.c index 03b6d69..06301ac 100755 --- a/data_dev/driver/src/data_dev_top.c +++ b/data_dev/driver/src/data_dev_top.c @@ -215,8 +215,8 @@ int DataDev_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { pci_set_master(pcidev); // Set the device as bus master // Retrieve and store the base address and size of the device's register space - dev->baseAddr = pci_resource_start (pcidev, 0); - dev->baseSize = pci_resource_len (pcidev, 0); + dev->baseAddr = pci_resource_start(pcidev, 0); + dev->baseSize = pci_resource_len(pcidev, 0); // Map the device's register space for use in the driver if ( Dma_MapReg(dev) < 0 ) { diff --git a/data_gpu/driver/src/data_gpu_top.c b/data_gpu/driver/src/data_gpu_top.c index 615a94c..810f02b 100755 --- a/data_gpu/driver/src/data_gpu_top.c +++ b/data_gpu/driver/src/data_gpu_top.c @@ -195,8 +195,8 @@ int DataGpu_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { pci_set_master(pcidev); // Set the device as bus master // Retrieve and store the base address and size of the device's register space - dev->baseAddr = pci_resource_start (pcidev, 0); - dev->baseSize = pci_resource_len (pcidev, 0); + dev->baseAddr = pci_resource_start(pcidev, 0); + dev->baseSize = pci_resource_len(pcidev, 0); // Map the device's register space for use in the driver if ( Dma_MapReg(dev) < 0 ) { diff --git a/rce_memmap/driver/src/rce_map.c b/rce_memmap/driver/src/rce_map.c index 187803b..a453879 100755 --- a/rce_memmap/driver/src/rce_map.c +++ b/rce_memmap/driver/src/rce_map.c @@ -118,7 +118,7 @@ int Map_Init(void) { // Map space dev.maps->base = ioremap_wc(dev.maps->addr, MAP_SIZE); - if (!dev.maps->base ) { + if (!dev.maps->base) { printk(KERN_ERR MOD_NAME " Init: Could not map memory addr %p with size 0x%x.\n",(void *)dev.maps->addr,MAP_SIZE); kfree(dev.maps); return (-1); diff --git a/rce_stream/app/src/dmaLoopTest.cpp b/rce_stream/app/src/dmaLoopTest.cpp index 9674178..c4e943b 100644 --- a/rce_stream/app/src/dmaLoopTest.cpp +++ b/rce_stream/app/src/dmaLoopTest.cpp @@ -69,10 +69,10 @@ static struct argp_option options[] = { {0} }; -error_t parseArgs ( int key, char *arg, struct argp_state *state ) { +error_t parseArgs(int key, char *arg, struct argp_state *state) { struct PrgArgs *args = (struct PrgArgs *)state->input; - switch(key) { + switch (key) { case 'p': args->path = arg; break; case 'm': args->dest = arg; break; case 's': args->size = strtol(arg,NULL,10); break; @@ -107,7 +107,7 @@ class RunData { bool running; }; -void *runWrite ( void *t ) { +void *runWrite(void *t) { fd_set fds; struct timeval timeout; int32_t ret; @@ -122,20 +122,20 @@ void *runWrite ( void *t ) { RunData *txData = (RunData *)t; - if ( (fd = open(txData->dev, O_RDWR )) < 0 ) { + if ((fd = open(txData->dev, O_RDWR)) < 0) { printf("Error opening device\n"); txData->running = false; return(NULL); } if ( txData->idxEn ) { - if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL ) { + if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL) { printf("Write failed to map dma buffer\n"); txData->running = false; return(NULL); } } else { - if ((data = malloc(txData->size)) == NULL ) { + if ((data = malloc(txData->size)) == NULL) { printf("Write failed to allocate buffer\n"); txData->running = false; return(NULL); @@ -199,7 +199,7 @@ void *runWrite ( void *t ) { } -void *runRead ( void *t ) { +void *runRead(void *t) { fd_set fds; struct timeval timeout; int32_t ret; @@ -224,20 +224,20 @@ void *runRead ( void *t ) { maxSize = rxData->size*2; idxEn = rxData->idxEn; - if ( (fd = open(rxData->dev, O_RDWR )) < 0 ) { + if ( (fd = open(rxData->dev, O_RDWR)) < 0 ) { printf("Error opening device\n"); rxData->running = false; return NULL; } if ( rxData->idxEn ) { - if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL ) { + if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL) { printf("Read failed to map dma buffer\n"); rxData->running = false; return(NULL); } } else { - if ((data = malloc(maxSize)) == NULL ) { + if ((data = malloc(maxSize)) == NULL) { printf("Read failed to allocate buffer\n"); rxData->running = false; return(NULL); @@ -286,7 +286,7 @@ void *runRead ( void *t ) { if ( idxEn ) dmaRetIndex(fd,dmaIndex); // Stop on size mismatch or frame errors - if ( ret != (int)rxData->size || rxDest != rxData->dest || rxData->fuser != rxFuser || rxData->luser != rxLuser) { + if (ret != (int)rxData->size || rxDest != rxData->dest || rxData->fuser != rxFuser || rxData->luser != rxLuser) { printf("Read Error. Dest=%i, ExpDest=%i, Ret=%i, Exp=%i, Fuser=0x%.2x, Luser=0x%.2x\n", rxDest,rxData->dest,ret,rxData->size,rxFuser,rxLuser); break; @@ -310,7 +310,7 @@ void *runRead ( void *t ) { return(NULL); } -int main (int argc, char **argv) { +int main(int argc, char **argv) { RunData * txData[DMA_MASK_SIZE]; RunData * rxData[DMA_MASK_SIZE]; pthread_t txThread[DMA_MASK_SIZE]; diff --git a/rce_stream/app/src/dmaRead.cpp b/rce_stream/app/src/dmaRead.cpp index d5dc38d..fd3c9e4 100644 --- a/rce_stream/app/src/dmaRead.cpp +++ b/rce_stream/app/src/dmaRead.cpp @@ -56,10 +56,10 @@ static struct argp_option options[] = { {0} }; -error_t parseArgs ( int key, char *arg, struct argp_state *state ) { +error_t parseArgs(int key, char *arg, struct argp_state *state) { struct PrgArgs *args = (struct PrgArgs *)state->input; - switch(key) { + switch (key) { case 'p': args->path = arg; break; case 'm': args->dest = arg; break; case 'd': args->prbsDis = 1; break; @@ -72,7 +72,7 @@ error_t parseArgs ( int key, char *arg, struct argp_state *state ) { static struct argp argp = {options,parseArgs,args_doc,doc}; -int main (int argc, char **argv) { +int main(int argc, char **argv) { uint8_t mask[DMA_MASK_SIZE]; int32_t s; int32_t ret; @@ -128,7 +128,7 @@ int main (int argc, char **argv) { return(0); } } else { - if ((rxData = malloc(maxSize)) == NULL ) { + if ((rxData = malloc(maxSize)) == NULL) { printf("Failed to allocate rxData!\n"); return(0); } diff --git a/rce_stream/app/src/dmaSetDebug.cpp b/rce_stream/app/src/dmaSetDebug.cpp index 037c526..f06f45f 100755 --- a/rce_stream/app/src/dmaSetDebug.cpp +++ b/rce_stream/app/src/dmaSetDebug.cpp @@ -49,10 +49,10 @@ static struct argp_option options[] = { {0} }; -error_t parseArgs ( int key, char *arg, struct argp_state *state ) { +error_t parseArgs(int key, char *arg, struct argp_state *state) { struct PrgArgs *args = (struct PrgArgs *)state->input; - switch(key) { + switch (key) { case 'p': args->path = arg; break; case ARGP_KEY_ARG: switch (state->arg_num) { @@ -70,7 +70,7 @@ error_t parseArgs ( int key, char *arg, struct argp_state *state ) { static struct argp argp = {options,parseArgs,args_doc,doc}; -int main (int argc, char **argv) { +int main(int argc, char **argv) { int s; struct PrgArgs args; diff --git a/rce_stream/app/src/dmaWrite.cpp b/rce_stream/app/src/dmaWrite.cpp index 62b028b..ab7297d 100644 --- a/rce_stream/app/src/dmaWrite.cpp +++ b/rce_stream/app/src/dmaWrite.cpp @@ -63,10 +63,10 @@ static struct argp_option options[] = { {0} }; -error_t parseArgs ( int key, char *arg, struct argp_state *state ) { +error_t parseArgs(int key, char *arg, struct argp_state *state) { struct PrgArgs *args = (struct PrgArgs *)state->input; - switch(key) { + switch (key) { case 'p': args->path = arg; break; case 'd': args->prbsDis = 1; break; case 's': args->size = strtol(arg,NULL,10); break; @@ -91,7 +91,7 @@ error_t parseArgs ( int key, char *arg, struct argp_state *state ) { static struct argp argp = {options,parseArgs,args_doc,doc}; -int main (int argc, char **argv) { +int main(int argc, char **argv) { int32_t s; int32_t ret; uint32_t count; @@ -122,7 +122,7 @@ int main (int argc, char **argv) { return(0); } } else { - if ((txData = malloc(args.size)) == NULL ) { + if ((txData = malloc(args.size)) == NULL) { printf("Failed to allocate rxData!\n"); return(0); } diff --git a/rce_stream/driver/src/axis_gen1.c b/rce_stream/driver/src/axis_gen1.c index a7314d1..8e6bc5e 100755 --- a/rce_stream/driver/src/axis_gen1.c +++ b/rce_stream/driver/src/axis_gen1.c @@ -64,14 +64,14 @@ irqreturn_t AxisG1_Irq(int irq, void *dev_id) { // Transmit return if ( (stat & 0x2) != 0 ) { // Read handle - if (((handle = ioread32(&(reg->txFree))) & 0x80000000) != 0 ) { + if (((handle = ioread32(&(reg->txFree))) & 0x80000000) != 0) { handle &= 0x7FFFFFFC; if ( dev->debug > 0 ) dev_info(dev->device,"Irq: Return TX Status Value 0x%.8x.\n",handle); // Attempt to find buffer in tx pool and return. otherwise return rx entry to hw. - if ((buff = dmaRetBufferIrq (dev,handle)) != NULL) { + if ((buff = dmaRetBufferIrq(dev,handle)) != NULL) { iowrite32(handle,&(reg->rxFree)); } } @@ -80,7 +80,7 @@ irqreturn_t AxisG1_Irq(int irq, void *dev_id) { // Receive data if ( (stat & 0x1) != 0 ) { // Read handle - while (((handle = ioread32(&(reg->rxPend))) & 0x80000000) != 0 ) { + while (((handle = ioread32(&(reg->rxPend))) & 0x80000000) != 0) { handle &= 0x7FFFFFFC; // Read size @@ -107,12 +107,12 @@ irqreturn_t AxisG1_Irq(int irq, void *dev_id) { } // Find RX buffer entry - if ((buff = dmaFindBufferList (&(dev->rxBuffers),handle)) != NULL) { + if ((buff = dmaFindBufferList(&(dev->rxBuffers),handle)) != NULL) { // Extract data from descriptor buff->count++; buff->size = size; buff->flags = (status >> 8) & 0xFFFF; // 15:8 = luser, 7:0 = fuser - buff->dest = (status ) & 0xFF; + buff->dest = (status >> 0) & 0x00FF; buff->error = (size == 0)?DMA_ERR_FIFO:0; // Check for errors @@ -261,7 +261,7 @@ int32_t AxisG1_SendBuffer(struct DmaDevice *dev, struct DmaBuffer **buff, uint32 for (x=0; x < count; x++) { // Create descriptor - control = (buff[x]->dest ) & 0x000000FF; + control = (buff[x]->dest << 0) & 0x000000FF; control += (buff[x]->flags << 8) & 0x00FFFF00; // flags[15:9] = luser, flags[7:0] = fuser if ( dmaBufferToHw(buff[x]) < 0 ) { diff --git a/rce_stream/driver/src/rce_top.c b/rce_stream/driver/src/rce_top.c index feafc4b..648b3ae 100755 --- a/rce_stream/driver/src/rce_top.c +++ b/rce_stream/driver/src/rce_top.c @@ -195,7 +195,7 @@ int Rce_Probe(struct platform_device *pdev) { // Coherent /* not available on arm64 */ #if !defined( __aarch64__) - if( (dev->cfgMode & BUFF_ARM_ACP) || (dev->cfgMode & AXIS2_RING_ACP) ) { + if ( (dev->cfgMode & BUFF_ARM_ACP) || (dev->cfgMode & AXIS2_RING_ACP) ) { set_dma_ops(&pdev->dev,&arm_coherent_dma_ops); dev_info(dev->device,"Probe: Set COHERENT DMA =%i\n",dev->cfgMode); }