-------------------------------------------------------------------------------
                       Matrox Imaging Library (MIL) 10.0
        MIL 9 to MIL 10 IO conversion table for the Matrox Radient eCL
                                 December, 2013
            (c) Copyright Matrox Electronic Systems Ltd., 1992-2013.
-------------------------------------------------------------------------------

MIL 10 has a new mechanism to control and inquire IO signals. It has unified 
some concepts under the M_IO_... constants of MdigControl/MdigInquire and 
generalized others that were being used for more than their original purpose 
(for example, M_GRAB_EXPOSURE_... to M_TIMER_...). 

Although the old mechanism still works, the old mechanism is deprecated. To 
port your code to the new mechanism, use the equivalence tables below.

Note that the concept of user-defined signals is now treated differently. To 
output a user-defined signal, you set a bit in a static user output register 
(M_USER_BIT_STATE). If you associate that bit with an output signal 
(M_IO_SOURCE), the state of the bit is routed onto the specified signal. To
inquire the state of an auxiliary input signal so that you can act upon it 
(user input), you inquire the status of the auxiliary signal directly 
(M_IO_STATUS); you don’t inquire a bit.

Contents

1. MIL 9 to MIL 10 conversion table.
2. MIL 9 to MIL 10 conversion examples.
   2.1 Setting a user-bit.
   2.2 Inquiring a user-bit.
   2.3 Hooking a callback function on a user-bit.
   2.4 Setting a grab trigger source.
   2.5 Setting a timer trigger source.


===============================================================================
1. MIL 9 to MIL 10 conversion table.

   M_HARDWARE_PORT0 is replaced by M_AUX_IO0
   M_HARDWARE_PORT1 is replaced by M_AUX_IO1
   M_HARDWARE_PORT2 is replaced by M_AUX_IO2
   M_HARDWARE_PORT3 is replaced by M_AUX_IO3
   M_HARDWARE_PORT4 is replaced by M_AUX_IO4
   M_HARDWARE_PORT5 is replaced by M_AUX_IO5
   M_HARDWARE_PORT6 is replaced by M_AUX_IO6
   M_HARDWARE_PORT7 is replaced by M_AUX_IO7
   M_HARDWARE_PORT8 is replaced by M_AUX_IO8
   M_HARDWARE_PORT9 is replaced by M_AUX_IO9
   M_HARDWARE_PORT10 is replaced by M_AUX_IO10
   M_HARDWARE_PORT11 is replaced by M_AUX_IO11
   M_HARDWARE_PORT12 is replaced by M_AUX_IO12
   M_HARDWARE_PORT13 is replaced by M_AUX_IO13

Note that the following table includes only equivalences for setting up output 
user-defined signals (or bidirectional signals set to output); see the 
subsequent table for inquiring user input signals (no corresponding register 
bit).
   MdigControl   M_USER_BIT_VALUE + 0 becomes M_USER_BIT_STATE + M_USER_BIT0
   MdigControl   M_USER_BIT_VALUE + 1 becomes M_USER_BIT_STATE + M_USER_BIT1
   MdigControl   M_USER_BIT_VALUE + 2 becomes M_USER_BIT_STATE + M_USER_BIT2
   MdigControl   M_USER_BIT_VALUE + 3 becomes M_USER_BIT_STATE + M_USER_BIT3
   MdigControl   M_USER_BIT_VALUE + 4 becomes M_USER_BIT_STATE + M_USER_BIT4
   MdigControl   M_USER_BIT_VALUE + 5 becomes M_USER_BIT_STATE + M_USER_BIT5
   MdigControl   M_USER_BIT_VALUE + M_CCn becomes M_USER_BIT_STATE + M_USER_BIT_CC_IOm 

Note that the following table includes only equivalences for reading the status 
of a user input signal (or a bidirectional signal set to input).
   MdigInquire   M_USER_BIT_VALUE + 2 becomes M_IO_STATUS + M_AUX_IO8    
   MdigInquire   M_USER_BIT_VALUE + 3 becomes M_IO_STATUS + M_AUX_IO9    
   MdigInquire   M_USER_BIT_VALUE + 4 becomes M_IO_STATUS + M_AUX_IO2    
   MdigInquire   M_USER_BIT_VALUE + 5 becomes M_IO_STATUS + M_AUX_IO3    
   MdigInquire   M_USER_BIT_VALUE + 6 becomes M_IO_STATUS + M_AUX_IO4    
   MdigInquire   M_USER_BIT_VALUE + 7 becomes M_IO_STATUS + M_AUX_IO5    
   MdigInquire   M_USER_BIT_VALUE + 8 becomes M_IO_STATUS + M_AUX_IO0    
   MdigInquire   M_USER_BIT_VALUE + 9 becomes M_IO_STATUS + M_AUX_IO1    
   MdigInquire   M_USER_BIT_VALUE + 10 becomes M_IO_STATUS + M_AUX_IO10  
   MdigInquire   M_USER_BIT_VALUE + 11 becomes M_IO_STATUS + M_AUX_IO11  
   MdigInquire   M_USER_BIT_VALUE + 12 becomes M_IO_STATUS + M_AUX_IO6   
   MdigInquire   M_USER_BIT_VALUE + 13 becomes M_IO_STATUS + M_AUX_IO7   

   MdigControl/Inquire   M_CAMERALINK_CCn_SOURCE with M_GRAB_EXPOSURE + M_TIMERm becomes M_IO_SOURCE + M_CC_IOn with M_TIMERm
   MdigControl/Inquire   M_CAMERALINK_CCn_SOURCE with M_USER_BIT_CC_A becomes M_IO_SOURCE + M_CC_IOn with M_USER_BIT_CC_IO0  
   MdigControl/Inquire   M_CAMERALINK_CCn_SOURCE with M_USER_BIT_CC_B becomes M_IO_SOURCE + M_CC_IOn with M_USER_BIT_CC_IO1   
   MdigControl/Inquire   M_CAMERALINK_CCn_SOURCE with M_HSYNC becomes M_IO_SOURCE + M_CC_IOn with M_HSYNC  
   MdigControl/Inquire   M_CAMERALINK_CCn_SOURCE with M_VSYNC becomes M_IO_SOURCE + M_CC_IOn with M_VSYNC  
   MdigControl/Inquire   M_CAMERALINK_CCn_SOURCE with M_PIXCLK becomes M_IO_SOURCE + M_CC_IOn with M_PIXCLK

   MdigHookFunction   M_USER_BIT_CHANGE becomes M_IO_CHANGE

Note that the following table includes only equivalences for inquiring which input signal
(or bidirectional signal set to input) caused the interrupt event.
   MdigGetHookInfo   M_USER_BIT  returns 2 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO8  
   MdigGetHookInfo   M_USER_BIT  returns 3 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO9  
   MdigGetHookInfo   M_USER_BIT  returns 4 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO2  
   MdigGetHookInfo   M_USER_BIT  returns 5 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO3  
   MdigGetHookInfo   M_USER_BIT  returns 6 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO4  
   MdigGetHookInfo   M_USER_BIT  returns 7 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO5  
   MdigGetHookInfo   M_USER_BIT  returns 8 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO0  
   MdigGetHookInfo   M_USER_BIT  returns 9 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO1  
   MdigGetHookInfo   M_USER_BIT  returns 10 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO10
   MdigGetHookInfo   M_USER_BIT  returns 11 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO11
   MdigGetHookInfo   M_USER_BIT  returns 12 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO6 
   MdigGetHookInfo   M_USER_BIT  returns 13 becomes M_IO_INTERRUPT_SOURCE returns M_AUX_IO7 

Note that the following table includes only equivalences for signals whose format can be
inquired.
   MdigInquire   M_USER_BIT_FORMAT + 0 becomes M_IO_FORMAT + M_AUX_IO12 
   MdigInquire   M_USER_BIT_FORMAT + 1 becomes M_IO_FORMAT + M_AUX_IO13 
   MdigInquire   M_USER_BIT_FORMAT + 2 becomes M_IO_FORMAT + M_AUX_IO8  
   MdigInquire   M_USER_BIT_FORMAT + 3 becomes M_IO_FORMAT + M_AUX_IO9  
   MdigInquire   M_USER_BIT_FORMAT + 4 becomes M_IO_FORMAT + M_AUX_IO2  
   MdigInquire   M_USER_BIT_FORMAT + 5 becomes M_IO_FORMAT + M_AUX_IO3  
   MdigInquire   M_USER_BIT_FORMAT + 6 becomes M_IO_FORMAT + M_AUX_IO4  
   MdigInquire   M_USER_BIT_FORMAT + 7 becomes M_IO_FORMAT + M_AUX_IO5  
   MdigInquire   M_USER_BIT_FORMAT + 8 becomes M_IO_FORMAT + M_AUX_IO0  
   MdigInquire   M_USER_BIT_FORMAT + 9 becomes M_IO_FORMAT + M_AUX_IO1  
   MdigInquire   M_USER_BIT_FORMAT + 10 becomes M_IO_FORMAT + M_AUX_IO10
   MdigInquire   M_USER_BIT_FORMAT + 11 becomes M_IO_FORMAT + M_AUX_IO11
   MdigInquire   M_USER_BIT_FORMAT + 12 becomes M_IO_FORMAT + M_AUX_IO6 
   MdigInquire   M_USER_BIT_FORMAT + 13 becomes M_IO_FORMAT + M_AUX_IO7 

Note that the following table includes only equivalences for controlling/inquiring whether an input
signal (or bidirectional signal set to input) should cause an interrupt. 
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 2 becomes M_IO_INTERRUPT_STATE + M_AUX_IO8  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 3 becomes M_IO_INTERRUPT_STATE + M_AUX_IO9  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 4 becomes M_IO_INTERRUPT_STATE + M_AUX_IO2  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 5 becomes M_IO_INTERRUPT_STATE + M_AUX_IO3  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 6 becomes M_IO_INTERRUPT_STATE + M_AUX_IO4  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 7 becomes M_IO_INTERRUPT_STATE + M_AUX_IO5  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 8 becomes M_IO_INTERRUPT_STATE + M_AUX_IO0  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 9 becomes M_IO_INTERRUPT_STATE + M_AUX_IO1  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 10 becomes M_IO_INTERRUPT_STATE + M_AUX_IO10
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 11 becomes M_IO_INTERRUPT_STATE + M_AUX_IO11
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 12 becomes M_IO_INTERRUPT_STATE + M_AUX_IO6 
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 13 becomes M_IO_INTERRUPT_STATE + M_AUX_IO7 

Note that the following table includes only equivalences for controlling/
inquiring whether a bidirectional signal should be set to input or to output.
   MdigControl/Inquire   M_USER_BIT_MODE  + 2 becomes M_IO_MODE + M_AUX_IO8   
   MdigControl/Inquire   M_USER_BIT_MODE  + 3 becomes M_IO_MODE + M_AUX_IO9   
   MdigControl/Inquire   M_USER_BIT_MODE  + 4 becomes M_IO_MODE + M_AUX_IO2   
   MdigControl/Inquire   M_USER_BIT_MODE  + 5 becomes M_IO_MODE + M_AUX_IO3   

Note that the following table includes only equivalences for controlling/
inquiring input signals (or bidirectional signal set to input) that cause an 
interrupt.               
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 2 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO8  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 3 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO9  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 4 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO2  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 5 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO3  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 6 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO4  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 7 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO5  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 8 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO0  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 9 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO1  
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 10 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO10
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 11 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO11
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 12 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO6 
   MdigControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 13 becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO7 

   MdigControl           M_GRAB_TRIGGER with M_ACTIVATE becomes M_GRAB_TRIGGER_SOFTWARE with M_ACTIVATE 

   MdigGetHookInfo       M_GRAB_EXPOSURE_TRIGGER_MISSED becomes M_TIMER_TRIGGER_MISSED 

   MdigControl/Inquire   M_GRAB_EXPOSURE + M_TIMERn                       becomes M_TIMER_STATE + M_TIMERn         
   MdigControl           M_GRAB_EXPOSURE + M_TIMERn with M_ACTIVATE       becomes M_TIMER_TRIGGER_SOFTWARE + M_TIMERn with M_ACTIVATE         
   MdigControl/Inquire   M_GRAB_EXPOSURE_SOURCE + M_TIMERn                becomes M_TIMER_TRIGGER_SOURCE + M_TIMERn         
   MdigControl/Inquire   M_GRAB_EXPOSURE_MODE + M_TIMERn                  becomes M_TIMER_OUTPUT_INVERTER + M_TIMERn         
   MdigControl/Inquire   M_GRAB_EXPOSURE_DELAY_CLOCK_MODE + M_TIMERn      becomes M_TIMER_DELAY_CLOCK_ACTIVATION + M_TIMERn         
   MdigControl/Inquire   M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE + M_TIMERn    becomes M_TIMER_DELAY_CLOCK_SOURCE + M_TIMERn         
   MdigControl/Inquire   M_GRAB_EXPOSURE_TRIGGER_MODE + M_TIMERn          becomes M_TIMER_TRIGGER_ACTIVATION + M_TIMERn         
   MdigControl/Inquire   M_GRAB_EXPOSURE_CLOCK_SOURCE + M_TIMERn          becomes M_TIMER_CLOCK_SOURCE + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_USAGE + M_TIMERn                 becomes M_TIMER_USAGE + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TRIGGER_MISSED + M_TIMERn        becomes M_TIMER_TRIGGER_MISSED + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS + M_TIMERn becomes M_TIMER_TRIGGER_MISSED_STATUS + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TRIGGER_DIVIDER + M_TIMERn       becomes M_TIMER_TRIGGER_RATE_DIVIDER + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_ARM + M_TIMERn                   becomes M_TIMER_ARM + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_ARM + M_TIMERn with M_ACTIVATE   becomes M_TIMER_ARM_SOFTWARE + M_TIMERn with M_ACTIVATE
   MdigControl/Inquire   M_GRAB_EXPOSURE_ARM_SOURCE + M_TIMERn            becomes M_TIMER_ARM_SOURCE + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_ARM_MODE + M_TIMERn              becomes M_TIMER_ARM_ACTIVATION + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TIME_MAX + M_TIMERn              becomes M_TIMER_DURATION_MAX + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TIME + M_TIMERn                  becomes M_TIMER_DURATION + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TIME_DELAY + M_TIMERn            becomes M_TIMER_DELAY + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_CLOCK_FREQUENCY + M_TIMERn       becomes M_TIMER_CLOCK_FREQUENCY + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_TIMEOUT + M_TIMERn               becomes M_TIMER_TIMEOUT + M_TIMERn
   MdigControl/Inquire   M_GRAB_EXPOSURE_MEASURED + M_TIMERn              becomes M_TIMER_VALUE + M_TIMERn


2. MIL 9 to MIL 10 conversion examples.

   2.1 Setting a user-bit.

      Using Mil 9 IO API:
         MdigControl(MilDigitizer, M_USER_BIT_VALUE + 2, M_ON);
         MdigControl(MilDigitizer, M_USER_BIT_MODE  + 2, M_OUTPUT);

      Using Mil 10 IO API:
         MdigControl(MilDigitizer, M_USER_BIT_STATE + M_USER_BIT2, M_ON);
         MdigControl(MilDigitizer, M_IO_SOURCE + M_AUX_IO8, M_USER_BIT2);
         MdigControl(MilDigitizer, M_IO_MODE + M_AUX_IO8, M_OUTPUT);

   2.2 Inquiring a user-bit.

      Using Mil 9 IO API:
         MdigControl(MilDigitizer, M_USER_BIT_MODE  + 2, M_INPUT);
         MdigInquire(MilDigitizer, M_USER_BIT_VALUE + 2, &Value);

      Using Mil 10 IO API:
         MdigControl(MilDigitizer, M_IO_MODE + M_AUX_IO8, M_INPUT);
         MdigInquire(MilDigitizer, M_IO_STATUS + M_AUX_IO8, &Value);

   2.3 Hooking a callback function on a user-bit.

      Using Mil 9 IO API:
         MdigControl(MilDigitizer, M_USER_BIT_MODE  + 2, M_INPUT);
         MdigControl(MilDigitizer, M_USER_BIT_INTERRUPT_MODE + 2, M_EDGE_RISING);
         MdigHookFunction(MilDigitizer, M_USER_BIT_CHANGE, HookHandlerFnc, &HookData);
         MdigControl(MilDigitizer, M_USER_BIT_INTERRUPT_STATE + 2, M_ENABLE);

         MIL_INT HookHandlerFnc(MIL_INT HookType, MIL_ID EventId, void *UserDataPtr)
            {
            MIL_INT UserBit = 0;
            MdigGetHookInfo(EventId, M_USER_BIT, &UserBit);
            // UserBit will be 2 when interrupt is fired.
            }

      Using Mil 10 IO API:
         MdigControl(MilDigitizer, M_IO_MODE + M_AUX_IO8, M_INPUT);
         MdigControl(MilDigitizer, M_IO_INTERRUPT_ACTIVATION + M_AUX_IO8, M_EDGE_RISING);
         MdigHookFunction(MilDigitizer, M_IO_CHANGE, HookHandlerFnc, &HookData);
         MdigControl(MilDigitizer, M_IO_INTERRUPT_STATE + M_AUX_IO8, M_ENABLE);

         MIL_INT HookHandlerFnc(MIL_INT HookType, MIL_ID EventId, void *UserDataPtr)
            {
            MIL_INT IOSource = 0;
            MdigGetHookInfo(EventId, M_IO_INTERRUPT_SOURCE , &IOSource);
            // IOSource will be M_AUX_IO8 when interrupt is fired.
            }

   2.4 Setting a grab trigger source.

      Using Mil 9 IO API:
         MdigControl(MilDigitizer, M_GRAB_TRIGGER_SOURCE, M_HARDWARE_PORT0);

      Using Mil 10 IO API:
         MdigControl(MilDigitizer, M_GRAB_TRIGGER_SOURCE, M_AUX_IO0);

   2.5 Setting a timer trigger source.

      Using Mil 9 IO API:
         MdigControl(MilDigitizer, M_GRAB_EXPOSURE_SOURCE, M_HARDWARE_PORT0);

      Using Mil 10 IO API:
         MdigControl(MilDigitizer, M_TIMER_TRIGGER_SOURCE, M_AUX_IO0);