-------------------------------------------------------------------------------
                       Matrox Imaging Library (MIL) 10.0
         MIL 9 to MIL 10 IO conversion table for the Matrox CronosPlus
                                 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 MsysControl/MsysInquire.

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). 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.

The following conversion table applies to the Matrox CronosPlus.

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.

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

For M_GRAB_TRIGGER_SOURCE:
   M_HARDWARE_PORT0 now becomes M_AUX_IO7

Note that the following table includes only equivalences for inquiring whether 
a signal is an input or an output.
   MsysInquire M_USER_BIT_MODE + n  becomes M_IO_MODE + M_AUX_IOn

Note that the following table includes only equivalences for setting up output 
user-defined signals; see the subsequent table for inquiring user input signals 
(no corresponding register bit).
   MsysControl M_USER_BIT_VALUE_OUT + 3  becomes M_USER_BIT_STATE + M_USER_BIT3
   MsysControl M_USER_BIT_VALUE_OUT + 4  becomes M_USER_BIT_STATE + M_USER_BIT4
   MsysControl M_USER_BIT_VALUE_OUT + 5  becomes M_USER_BIT_STATE + M_USER_BIT5
   MsysControl M_USER_BIT_VALUE_OUT + 6  becomes M_USER_BIT_STATE + M_USER_BIT6

Note that the following table includes only equivalences for reading the status 
of a user input signal.
   MsysInquire   M_USER_BIT_VALUE_IN + 0   becomes M_IO_STATUS + M_AUX_IO0
   MsysInquire   M_USER_BIT_VALUE_IN + 1   becomes M_IO_STATUS + M_AUX_IO1
   MsysInquire   M_USER_BIT_VALUE_IN + 2   becomes M_IO_STATUS + M_AUX_IO2

   MsysHookFunction   M_USER_BIT_CHANGE becomes M_IO_CHANGE


Note that the following table includes only equivalences for inquiring which 
input signal caused the interrupt event.
   MsysGetHookInfo   M_USER_BIT  returns 0  becomes  M_IO_INTERRUPT_SOURCE returns M_AUX_IO0

Note that the following table includes only equivalences for controlling/
inquiring whether an input signal should cause an interrupt. 
   MsysControl/Inquire   M_USER_BIT_INTERRUPT_STATE  + 0   becomes M_IO_INTERRUPT_STATE + M_AUX_IO0

Note that the following table includes only equivalences for controlling/
inquiring input signals that cause an interrupt.
   MsysControl/Inquire   M_USER_BIT_INTERRUPT_MODE  + 0   becomes M_IO_INTERRUPT_ACTIVATION + M_AUX_IO0


2. MIL 9 to MIL 10 conversion examples.

   2.1 Setting a user-bit.

      Using Mil 9 IO API:
         MsysControl(MilSystem, M_USER_BIT_VALUE_OUT + 4, M_ON);

      Using Mil 10 IO API:
         MsysControl(MilSystem, M_USER_BIT_STATE + M_USER_BIT4, M_ON);

   2.2 Inquiring a user-bit.

      Using Mil 9 IO API:
         MsysInquire(MilSystem, M_USER_BIT_VALUE_IN + 1, &Value);

      Using Mil 10 IO API:
         MsysInquire(MilSystem, M_IO_STATUS + M_AUX_IO1, &Value);

   2.3 Hooking a callback function on a user-bit.

      Using Mil 9 IO API:
         MsysControl(MilSystem, M_USER_BIT_INTERRUPT_MODE + 0, M_EDGE_RISING);
         MsysHookFunction(MilSystem, M_USER_BIT_CHANGE, HookHandlerFnc, &HookData);
         MsysControl(MilSystem, M_USER_BIT_INTERRUPT_STATE + 0, M_ENABLE);

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

      Using Mil 10 IO API:
         MsysControl(MilSystem, M_IO_INTERRUPT_ACTIVATION + M_AUX_IO0, M_EDGE_RISING);
         MsysHookFunction(MilSystem, M_IO_CHANGE, HookHandlerFnc, &HookData);
         MsysControl(MilSystem, M_IO_INTERRUPT_STATE + M_AUX_IO0, M_ENABLE);

         MIL_INT HookHandlerFnc(MIL_INT HookType, MIL_ID EventId, void *UserDataPtr)
            {
            MIL_INT IOSource = 0;
            MsysGetHookInfo(EventId, M_IO_INTERRUPT_SOURCE, &IOSource);
            // IOSource will be M_AUX_IO0 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_IO7);