From 451ab16470e3ea42139c1f1ee9d138d92de89683 Mon Sep 17 00:00:00 2001 From: Larry Ruckman <ruckman@slac.stanford.edu> Date: Fri, 31 Jan 2025 08:19:54 -0800 Subject: [PATCH 1/2] Update AxisDriver.h ### Description - Synchronizing the copy of AxisDriver.h from aes-stream-drivers - No behavioral changes made, only formatting --- include/rogue/hardware/drivers/AxisDriver.h | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/include/rogue/hardware/drivers/AxisDriver.h b/include/rogue/hardware/drivers/AxisDriver.h index 21107b3d5..f03690247 100644 --- a/include/rogue/hardware/drivers/AxisDriver.h +++ b/include/rogue/hardware/drivers/AxisDriver.h @@ -20,13 +20,13 @@ * ---------------------------------------------------------------------------- **/ -#ifndef __ASIS_DRIVER_H__ -#define __ASIS_DRIVER_H__ +#ifndef __AXIS_DRIVER_H__ +#define __AXIS_DRIVER_H__ #include "DmaDriver.h" // Command definitions -#define AXIS_Read_Ack 0x2001 // Command to acknowledge read -#define AXIS_Write_ReqMissed 0x2002 // Command to indicate a missed write request +#define AXIS_Read_Ack 0x2001 // Command to acknowledge read +#define AXIS_Write_ReqMissed 0x2002 // Command to indicate a missed write request // Only define the following if not compiling for kernel space #ifndef DMA_IN_KERNEL @@ -41,14 +41,14 @@ * @return The combined flags value. */ static inline uint32_t axisSetFlags(uint32_t fuser, uint32_t luser, uint32_t cont) { - uint32_t flags; + uint32_t flags; - // Set flags based on input parameters, ensuring each is in its correct position - flags = fuser & 0xFF; // First user-defined flag - flags |= (luser << 8) & 0xFF00; // Last user-defined flag - flags |= (cont << 16) & 0x10000; // Continuation flag + // Set flags based on input parameters, ensuring each is in its correct position + flags = fuser & 0xFF; // First user-defined flag + flags |= (luser << 8) & 0xFF00; // Last user-defined flag + flags |= (cont << 16) & 0x10000; // Continuation flag - return flags; + return flags; } /** @@ -59,7 +59,7 @@ static inline uint32_t axisSetFlags(uint32_t fuser, uint32_t luser, uint32_t con * @return The first user-defined flag. */ static inline uint32_t axisGetFuser(uint32_t flags) { - return flags & 0xFF; + return flags & 0xFF; } /** @@ -70,7 +70,7 @@ static inline uint32_t axisGetFuser(uint32_t flags) { * @return The last user-defined flag. */ static inline uint32_t axisGetLuser(uint32_t flags) { - return (flags >> 8) & 0xFF; + return (flags >> 8) & 0xFF; } /** @@ -81,7 +81,7 @@ static inline uint32_t axisGetLuser(uint32_t flags) { * @return The continuation flag. */ static inline uint32_t axisGetCont(uint32_t flags) { - return (flags >> 16) & 0x1; + return (flags >> 16) & 0x1; } /** @@ -90,7 +90,7 @@ static inline uint32_t axisGetCont(uint32_t flags) { * @param fd File descriptor for the AXIS device. */ static inline void axisReadAck(int32_t fd) { - ioctl(fd, AXIS_Read_Ack, 0); + ioctl(fd, AXIS_Read_Ack, 0); } /** @@ -99,8 +99,8 @@ static inline void axisReadAck(int32_t fd) { * @param fd File descriptor for the AXIS device. */ static inline void axisWriteReqMissed(int32_t fd) { - ioctl(fd, AXIS_Write_ReqMissed, 0); + ioctl(fd, AXIS_Write_ReqMissed, 0); } #endif // !DMA_IN_KERNEL -#endif // __ASIS_DRIVER_H__ +#endif // __AXIS_DRIVER_H__ From b1ec4d43e4cbee43cd6fadfe40fe945d01ab6338 Mon Sep 17 00:00:00 2001 From: Larry Ruckman <ruckman@slac.stanford.edu> Date: Fri, 31 Jan 2025 08:22:09 -0800 Subject: [PATCH 2/2] Update DmaDriver.h --- include/rogue/hardware/drivers/DmaDriver.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/rogue/hardware/drivers/DmaDriver.h b/include/rogue/hardware/drivers/DmaDriver.h index 4e400886c..858f44ed3 100644 --- a/include/rogue/hardware/drivers/DmaDriver.h +++ b/include/rogue/hardware/drivers/DmaDriver.h @@ -133,6 +133,10 @@ struct DmaRegisterData { // Conditional inclusion for non-kernel environments #ifndef DMA_IN_KERNEL + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> #include <sys/fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> @@ -140,11 +144,6 @@ struct DmaRegisterData { #include <sys/socket.h> #include <unistd.h> - #include <csignal> - #include <cstdio> - #include <cstdlib> - #include <cstring> - /** * dmaWrite - Writes data to a DMA channel. * @fd: File descriptor for the DMA device. @@ -168,7 +167,7 @@ static inline ssize_t dmaWrite(int32_t fd, const void* buf, size_t size, uint32_ w.flags = flags; w.size = size; w.is32 = (sizeof(void*) == 4); - w.data = (uint64_t)buf; // NOLINT + w.data = (uint64_t)buf;//NOLINT return (write(fd, &w, sizeof(struct DmaWriteData))); } @@ -238,7 +237,7 @@ static inline ssize_t dmaWriteVector(int32_t fd, w.flags = (x == 0) ? begFlags : ((x == (iovlen - 1)) ? endFlags : midFlags); w.size = iov[x].iov_len; w.is32 = (sizeof(void*) == 4); - w.data = (uint64_t)iov[x].iov_base; // NOLINT + w.data = (uint64_t)iov[x].iov_base;//NOLINT do { res = write(fd, &w, sizeof(struct DmaWriteData)); @@ -289,7 +288,7 @@ static inline ssize_t dmaWriteIndexVector(int32_t fd, w.flags = (x == 0) ? begFlags : ((x == (iovlen - 1)) ? endFlags : midFlags); w.size = iov[x].iov_len; w.is32 = (sizeof(void*) == 4); - w.index = (uint32_t)(((uint64_t)iov[x].iov_base) & 0xFFFFFFFF); // NOLINT + w.index = (uint32_t)(((uint64_t)iov[x].iov_base) & 0xFFFFFFFF);//NOLINT do { res = write(fd, &w, sizeof(struct DmaWriteData)); @@ -325,7 +324,7 @@ static inline ssize_t dmaRead(int32_t fd, void* buf, size_t maxSize, uint32_t* f memset(&r, 0, sizeof(struct DmaReadData)); r.size = maxSize; r.is32 = (sizeof(void*) == 4); - r.data = (uint64_t)buf; // NOLINT + r.data = (uint64_t)buf;//NOLINT ret = read(fd, &r, sizeof(struct DmaReadData));