From e65023cf59c442a3f230b64f84f6058a90654000 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 17 Nov 2006 16:07:51 +0000 Subject: [PATCH] Figured out what a couple bits in the mite channel control register do (byte swapping). Used them to make 32 bit pci transfers to 16 bit analog outputs practical. --- comedi/drivers/mite.c | 7 ++++++- comedi/drivers/mite.h | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/comedi/drivers/mite.c b/comedi/drivers/mite.c index 558428ed..d3eb63cd 100644 --- a/comedi/drivers/mite.c +++ b/comedi/drivers/mite.c @@ -313,7 +313,12 @@ void mite_prep_dma( struct mite_struct *mite, unsigned int channel, * "read()" to calculate the number of bytes available. */ chcr |= CHCR_SET_LC_IE; - + if(num_memory_bits == 32 && num_device_bits == 16) + { + /* Doing a combined 32 and 16 bit byteswap gets the 16 bit samples into the fifo in the right order. + Tested doing 32 bit memory to 16 bit device transfers to the analog out of a pxi-6281 */ + chcr |= CHCR_BYTE_SWAP16 | CHCR_BYTE_SWAP32; + } if(mite_chan->dir == COMEDI_INPUT){ chcr |= CHCR_DEV_TO_MEM; } diff --git a/comedi/drivers/mite.h b/comedi/drivers/mite.h index d0c5e758..c8a7c1f7 100644 --- a/comedi/drivers/mite.h +++ b/comedi/drivers/mite.h @@ -30,7 +30,7 @@ #define PCI_VENDOR_ID_NATINST 0x1093 -//#define DEBUG_MITE +// #define DEBUG_MITE #define PCIMIO_COMPAT #ifdef DEBUG_MITE @@ -286,8 +286,8 @@ enum MITE_CHCR_bits CHCR_FIFO_ON = 0, CHCR_BURSTEN = (1<<14), CHCR_NO_BURSTEN = 0, - CHCR_CHEND1 = (1<<5), - CHCR_CHEND0 = (1<<4), + CHCR_BYTE_SWAP16 = (1 << 6), + CHCR_BYTE_SWAP32 = (1 << 4), CHCR_DIR = (1<<3), CHCR_DEV_TO_MEM = CHCR_DIR, CHCR_MEM_TO_DEV = 0, -- 2.26.2