From a3d86de2ce72ba6faff1bec092fc2d0f01176b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20=C5=81ukawski?= Date: Wed, 12 Jul 2023 18:45:29 +0200 Subject: [PATCH] Dump DSP contents --- .gitignore | 6 ++++++ jr3pci-ioctl.c | 28 ++++++++++++++++++++++++++++ jr3pci-ioctl.h | 4 +++- raw.cpp | 11 +++++++++-- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7b57fe0..4199b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,9 @@ dkms.conf /jr3mon /reset /test +/raw + +# Miscellanea +/.vs/ +/.vscode/ + diff --git a/jr3pci-ioctl.c b/jr3pci-ioctl.c index a113933..104c729 100644 --- a/jr3pci-ioctl.c +++ b/jr3pci-ioctl.c @@ -111,6 +111,30 @@ int jr3GetForceAndRaw(unsigned long arg) { return ret; } +int jr3DumpDsp(void) { + int i; + int card; + + for (card = 0; card < 4; card++) + { + for (i = 0; i < 0xFF; i += 8) { + printk(KERN_INFO "jr3pci(%d): [0x%02X] 0x%04X 0x%04X 0x%04X 0x%04X 0x%04X 0x%04X 0x%04X 0x%04X", + card, i, + (unsigned short)readData(JR3_RAWCHANNELS + i, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 1, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 2, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 3, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 4, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 5, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 6, card), + (unsigned short)readData(JR3_RAWCHANNELS + i + 7, card) + ); + } + } + + return 0; +} + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) int jr3_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) #else @@ -352,6 +376,10 @@ long jr3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) else ret=-1; break; + case IOCTL_JR3_DUMP_DSP: + ret = jr3DumpDsp(); + break; + default: return -ENOTTY; } diff --git a/jr3pci-ioctl.h b/jr3pci-ioctl.h index 785e813..a38dd2f 100644 --- a/jr3pci-ioctl.h +++ b/jr3pci-ioctl.h @@ -78,6 +78,8 @@ typedef struct force_and_raw_array { #define IOCTL3_JR3_GET_FULL_SCALES _IOR( JR3_TYPE, 43, struct force_array ) #define IOCTL3_JR3_SET_FULL_SCALES _IOW( JR3_TYPE, 44, struct force_array ) -#define IOCTL_JR3_MAXNR 45 +#define IOCTL_JR3_DUMP_DSP _IO ( JR3_TYPE, 45 ) + +#define IOCTL_JR3_MAXNR 46 #endif diff --git a/raw.cpp b/raw.cpp index ef8d46b..e6bf0fa 100644 --- a/raw.cpp +++ b/raw.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -20,8 +21,9 @@ int main(void) { ret=ioctl(fd,IOCTL0_JR3_GET_FORCE_AND_RAW,&fr); if (ret!=-1) { - for (i=0;i<16;i++) { - printf("channel %d: time = %u, value = %d\n",i,fr.raw_channels[i].raw_time,fr.raw_channels[i].raw_data); + for (i=0;i<8;i++) { + printf("channel %d: time = %u, value = 0x%04X, signed = %d\n", + i, fr.raw_channels[i].raw_time, (uint16_t)(fr.raw_channels[i].raw_data), (int16_t)(fr.raw_channels[i].raw_data)); } for (i=0;i<3;i++) { printf("f[%d] = %d\n",i,fr.filtered.f[i]); @@ -32,5 +34,10 @@ int main(void) { } else perror(""); + ret=ioctl(fd,IOCTL_JR3_DUMP_DSP); + + if (ret==-1) + perror(""); + close(fd); }