Skip to content

Commit

Permalink
Dump DSP contents
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman authored and Raúl de Santos Rico committed Jul 12, 2023
1 parent 4df32d1 commit a3d86de
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ dkms.conf
/jr3mon
/reset
/test
/raw

# Miscellanea
/.vs/
/.vscode/

28 changes: 28 additions & 0 deletions jr3pci-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion jr3pci-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

11 changes: 9 additions & 2 deletions raw.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
Expand All @@ -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]);
Expand All @@ -32,5 +34,10 @@ int main(void) {
} else
perror("");

ret=ioctl(fd,IOCTL_JR3_DUMP_DSP);

if (ret==-1)
perror("");

close(fd);
}

0 comments on commit a3d86de

Please sign in to comment.