Figured out what a couple bits in the mite channel control register
authorFrank Mori Hess <fmhess@speakeasy.net>
Fri, 17 Nov 2006 16:07:51 +0000 (16:07 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Fri, 17 Nov 2006 16:07:51 +0000 (16:07 +0000)
do (byte swapping).  Used them to make 32 bit pci transfers to
16 bit analog outputs practical.

comedi/drivers/mite.c
comedi/drivers/mite.h

index 558428ed6a48eabbefd602804352567e6d4886c2..d3eb63cd353d778a67f749adb69ed4792508bb56 100644 (file)
@@ -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;
        }
index d0c5e758d7e7991e268bfda3de7444f166b54e38..c8a7c1f7b0012eae54692d2edb01441cfb572a94 100644 (file)
@@ -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,