1    /* --COPYRIGHT--,TI
     2     * Copyright (c) $(CPYYEAR)
     3     * Texas Instruments
     4     *
     5     *  All rights reserved.  Property of Texas Instruments
     6     *  Restricted rights to use, duplicate or disclose this code are
     7     *  granted through contract.
     8     * 
     9     * --/COPYRIGHT--*/
    10    /*
    11     *  ======== IomAdapter.xdc ========
    12     *
    13     *! Revision History
    14     *! ================
    15     *! 09-Feb-2006 czhao    fixed TinitFxn to Fxn  
    16     *! 05-Jan-2006 czhao    added Finalize 
    17     *! 29-Nov-2005 czhao    created
    18     *
    19     *  Open Issues:
    20     *  1. static policy not supported.
    21     *  2. Need to map errors, commands.
    22     *  3. Uarg vs Ptr
    23     */
    24    
    25    import xdc.runtime.Error;
    26    import ti.sdo.io.DriverTypes;
    27    
    28    /*!
    29     * Module through which legacy iom drivers can plug into BIOS 6.x
    30     *
    31     * The IomAdapter module maps iom.h to IDriver.xdc. A legacy iom
    32     * driver has to hook into BIOS 6.x using this module. This module
    33     * handles ALL legacy drivers in the system. This single module
    34     * takes care of several legacy driver modules. 
    35     * 
    36     * As part of its create the IomAdapter module will call mbBindDev for
    37     * each of the legacy drivers. {@link #open} will call mdCreateChan. 
    38     * {@link #close} will call mdDeleteChan. {@link #submit} will call
    39     * mdSubmitChan. {@link #control} will call mdControlChan. A delete call will
    40     * call mdUnbindDev.
    41     *
    42     */
    43    @ModuleStartup
    44    @InstanceFinalize
    45    
    46    module IomAdapter inherits ti.sdo.io.IDriver {      
    47    
    48        /*! Iom init function type definition. */
    49        typedef Void (*InitFunc)();
    50    
    51    instance:
    52    
    53        /*! Pointer to legacy iom function table */
    54        config Ptr iomFxns = null;
    55    
    56        /*! Legacy iom init function */
    57        config InitFunc initFxn = null;
    58    
    59        /*! Legacy deviceParams */
    60        config Ptr deviceParams = null;
    61        
    62        /*! deviceId for iom driver */
    63        config UInt deviceId = 0;
    64        
    65        /*!
    66         *  ======== create ========
    67         *  Create an IomAdapter instance
    68         */
    69        create();
    70        
    71    internal:
    72    
    73        Void driverCallback(Ptr cbArg, DriverTypes.Packet *packet);
    74    
    75        Void postInit(Object *obj);
    76        
    77        Error.Id mapStatus(Int status);
    78    
    79        struct ChanObj {
    80            Ptr                    iomChanHdl;
    81            DriverTypes.DoneFxn    cbFxn;
    82            UArg                   cbArg;
    83            DriverTypes.Packet     abortPkt;
    84        };
    85    
    86        struct Instance_State {
    87            Int            deviceId;
    88            Ptr            deviceParams;
    89            Ptr            deviceHandle;
    90            Ptr            iomFxns;
    91            InitFunc       initFxn;
    92        };
    93    }