Exemplo n.º 1
0
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status status;
    Int         size = 0;

    FCSettings_init();
    Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");
    Diags_setMask("xdc.runtime.Main+EX1234567");
    Diags_setMask("ti.sdo.fc.%+EX1234567");

    Log_print0(Diags_ENTRY, "[+E] _main> Enter");

    status = RMAN_init();
    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_init() failed [%d]",
                   (IArg)status);
        System_abort("RMAN_init() failed, aborting...\n");
    }

    Log_print0(Diags_EXIT, "[+X] main> Exit");

    BIOS_start();

    return(0);
}
Exemplo n.º 2
0
Void Ducati_AppTask (UArg arg1, UArg arg2)
{
	FCSettings_init();
	Diags_setMask(FCSETTINGS_MODNAME"+12345678LEXAIZFS");
	CESettings_init();
	Diags_setMask(CESETTINGS_MODNAME"+12345678LEXAIZFS");
//	Diags_setMask("ti.sdo.rcm.RcmServer-12");
//	Diags_setMask("ti.sysbios.utils.Load-4");

    init_IVAHDFrwk();
    HDVICP_Reset(NULL, NULL);
    platform_init();

    /* how do we know when to unload.. */
    while (1) {
        Task_sleep(0x7fffffff);
    }

    /*The test cases will run in this task's context in the init call.
    Once init returns, testcases have exited so do deinit*/
    platform_deinit();

    exit_IVAHDFrwk();

    System_exit(0);
}
Exemplo n.º 3
0
/*
 *  ======== IRESMAN_VICP_init ========
 */
IRES_Status IRESMAN_VICP_init(IRESMAN_Params * initArgs)
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
{
    int i;
    IRESMAN_VicpParams * resmanArgs = (IRESMAN_VicpParams *)initArgs;
    Registry_Result result;

    if (!regInit) {
        /*
         *  Enable logging. We only want to do this once, since there is
         *  no Registry_removeModule().
         */
        result = Registry_addModule(&ti_sdo_fc_ires_vicp_desc,
                VICP_MODNAME);

        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the FC default */
            FCSettings_init();
            FCSettings_setDiags(VICP_MODNAME);
        }
        regInit = 1;
    }

    Assert_isTrue(initArgs != NULL, (Assert_Id)NULL);

    /*  Check if already initialized */
    if (_initialized) {
       return IRES_EEXISTS;
    }

    /*
     * Information regarding the memory allocation/free functions
     * is stored as part of the internal state of the resource
     * manager
     */
    _resmanInternalState.allocFxn = resmanArgs->baseConfig.allocFxn;
    _resmanInternalState.freeFxn = resmanArgs->baseConfig.freeFxn;

    /*
     * Set resource status to default
     */
   _resmanInternalState.IMXbusy = IRESMAN_VICP_RESOURCEFREE;
   _resmanInternalState.VLCDbusy = IRESMAN_VICP_RESOURCEFREE;
   _resmanInternalState.SEQbusy = IRESMAN_VICP_RESOURCEFREE;

    for(i = 0; i < 3; i++) {
        _resmanInternalState.refCount[i] = 0;
    }

    /* Set Initalized flag to 1 if successful */
    _initialized = 1;

     return IRES_OK;
}
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status        status;

    /* Set default Diags mask to all, to get trace for init() functions */
    FCSettings_init();
    Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");

    buf = Memory_calloc(NULL, BUFSIZE, BUFALIGN, NULL);

    if (buf == NULL) {
        System_abort("Allocation of buffer for BUFRES failed. Aborting.\n");
    }

    status = RMAN_init();

    //Diags_setMask(RMAN_MODNAME"+EX1234567");

    if (IRES_OK != status) {
        System_printf("main> RMAN initialization Failed [%d]\n", status);
        System_abort("Aborting...\n");
    }

    config.iresConfig.size = sizeof(BUFRES_Params);
//    config.iresConfig.allocFxn = _ALG_allocMemory;
//    config.iresConfig.freeFxn = _ALG_freeMemory;
    config.iresConfig.allocFxn = DSKT2_allocPersistent;
    config.iresConfig.freeFxn = DSKT2_freePersistent;

    config.base = buf;
    config.length = (UInt32)BUFSIZE;

    status = RMAN_register(&BUFRES_MGRFXNS, (IRESMAN_Params *)&config);

    /*
     *  Now that are resource is initialized,
     *  set default Diags mask to warnings and errors
     */
    Diags_setMask(FCSETTINGS_MODNAME"-EX12345");
    //Diags_setMask(BUFRES_MODNAME"-EX12345");

    if (status != IRES_OK) {
        /* Test failed */
        System_printf("BUFRES_init() failed [0x%x]\n", status);
        System_abort("Aborting.\n");
        return (-1);
    }

    smain(argc, argv);

    return (0);
}
/*
 *  ======== addModule ========
 */
static Void addModule()
{
    Registry_Result result;

    result = Registry_addModule(&ti_sdo_fc_memutils_desc,
            MEMUTILS_MODNAME);
    Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

    if (result == Registry_SUCCESS) {
        /* Set the diags mask to the FC default */
        FCSettings_init();
        FCSettings_setDiags(MEMUTILS_MODNAME);
    }
    regInit = 1;
}
Exemplo n.º 6
0
/*
 *  ======== RMP_init ========
 */
Void RMP_init(Void)
{
    Registry_Result result;

    if (refCount++ == 0) {
        FCSettings_init();

        result = Registry_addModule(&ti_sdo_fc_utils_rmmp_desc, RMMP_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the FC default */
            FCSettings_setDiags(RMMP_MODNAME);
        }
    }
}
Exemplo n.º 7
0
/*
 *  ======== initBuf ========
 *  Initialize the BUFRES resource manager.
 */
static IRES_Status initBuf(IRESMAN_Params *args)
{
    BUFRES_Params    *cArgs = (BUFRES_Params *)args;
    IRES_Status       status = IRES_OK;
    Registry_Result   result;
    static Int regInit = 0;  /* Registry_addModule() called */

    if (regInit == 0) {
        result = Registry_addModule(&bufres_desc, BUFRES_MODNAME);

        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the FC default */
            FCSettings_init();
            FCSettings_setDiags(BUFRES_MODNAME);
        }

        regInit = 1;
    }

    Log_print0(Diags_ENTRY, "[+E] BUFRES initBuf> entered");

    if (curInit++) {
        /* Already initialized */
        return (IRES_EINIT);
    }

    Assert_isTrue(args != NULL, (Assert_Id)NULL);
    Assert_isTrue(args->allocFxn != NULL, (Assert_Id)NULL);
    Assert_isTrue(args->freeFxn != NULL, (Assert_Id)NULL);

    allocFxn = args->allocFxn;
    freeFxn = args->freeFxn;

    /* Initialize the Buffer Resource Manager based on config params */
    buffer.base = cArgs->base;
    buffer.length = cArgs->length;
    buffer.scratchId = -1;
    buffer.refCount = 0;

    Log_print1(Diags_EXIT, "[+X] BUFRES initBuf> returning 0x%x",(IArg)status);

    return (status);
}
Exemplo n.º 8
0
/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{
    if (ceInit++ == 0) {

        CESettings_init();
        FCSettings_init();


        /* if CE_DEBUG is set, turn on tracing and DSP auto trace collection */
        if (Global_getenv("CE_DEBUG") != NULL) {
            extern Bool   Engine_alwaysCollectDspTrace;
            extern String Engine_ceDebugDspTraceMask;

            Engine_alwaysCollectDspTrace = TRUE;

            /*
             * Note the strategy for setting trace masks below...
             * For any mods not yet registered, we set the
             * [FC|CE]SETTINGS_MODNAME mask.  For any mods already
             * registered, we Diags_setMask() them.
             */

            if (Global_getenv("CE_DEBUG")[0] == '1') {
                /* Turn on CE/FC levels 6 and 7 */
                xdc_runtime_Diags_setMask(CESETTINGS_MODNAME"+67");
                xdc_runtime_Diags_setMask(FCSETTINGS_MODNAME"+67");
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+67");
                xdc_runtime_Diags_setMask("ti.sdo.fc.%+67");

                /* Same for any Servers */
                Engine_ceDebugDspTraceMask = "ti.sdo.ce.%+67;ti.sdo.fc.%+67";
            }
            else if (Global_getenv("CE_DEBUG")[0] == '2') {
                xdc_runtime_Diags_setMask(CESETTINGS_MODNAME"+EX1234567");
                xdc_runtime_Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+EX1234567");
                xdc_runtime_Diags_setMask("ti.sdo.fc.%+EX1234567");

                Engine_ceDebugDspTraceMask =
                    // Current Diags mask: (time=2 ==> display time in delta usec
                    "ti.sdo.ce.%+EX1234567;ti.sdo.fc.%+EX12345678;ti.sdo.ce.rms=67;ti.sdo.fc.dman3-2;ti.sdo.fc.dskt2-2;time=2";
            }
            else if (Global_getenv("CE_DEBUG")[0] == '0') {
                /* Don't set anything if someone tries to turn CE_DEBUG off */
            } else {
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+EX1234567");
                xdc_runtime_Diags_setMask("ti.sdo.fc.%+EX1234567");

                Engine_ceDebugDspTraceMask =
                    "time=2;ti.sdo.fc.%+EX1234567;ti.sdo.ce.%+EX1234567;ti.sdo.fc.dskt2-2";
            }
        }
        else {
            //xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-EX1234567");
            //xdc_runtime_Diags_setMask("ti.sdo.ce.VISA-EX1234567");
        }

        if (Global_getenv("CE_CHECK") != NULL) {
            extern Bool VISA_checked;

            /*
             * Currently just change _this_ processor's value... perhaps we
             * should enable remote processors as well?
             */
            if (Global_getenv("CE_CHECK")[0] == '1') {
                VISA_checked = TRUE;
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+7");
            } else if (Global_getenv("CE_CHECK")[0] == '0') {
                VISA_checked = FALSE;
            } else {
                /* leave it whatever it was. maybe we should drop a warning? */
            }
        }

        /* allow user to over-ride via CE_TRACE. */
        if (Global_getenv("CE_TRACE") != NULL) {
            xdc_runtime_Diags_setMask(Global_getenv("CE_TRACE"));
        }
        Global_init();


        ti_sdo_ce_osal_Memory_init();
        Comm_init();
        Processor_init();
        Algorithm_init();
        XdmUtils_init();

        Trace_init();
        RMS_init();
        Global_atexit((Fxn)RMS_exit);

        Engine_init();
        _VISA_init();
        Loader_init();
       Server_init();
        if ((Global_getenv("CE_DEBUG") != NULL) &&
                (Global_getenv("CE_DEBUG")[0] == '2')) {

            /*
             *  set up masks that must be deferred until the modules have been
             *  initialized.
             */
            //xdc_runtime_Diags_setMask(Comm_MODNAME"-EX12345");
            xdc_runtime_Diags_setMask("ti.sdo.ce.osal.%-EX123");
            //xdc_runtime_Diags_setMask(Algorithm_MODNAME"-EX12345");

            xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-3");
            xdc_runtime_Diags_setMask("ti.sdo.ce.ipc.Comm=67");
        }

        /*
         *  Allow user to over-ride via CE_TRACE. Putting this after module
         *  initialization, since it will have no effect if called before.
         *  Only wildcard settings seem to work when placed before module
         *  initialization.
         */
        if (Global_getenv("CE_TRACE") != NULL) {
            xdc_runtime_Diags_setMask(Global_getenv("CE_TRACE"));
        }
    }
}
Exemplo n.º 9
0
/*
 *  ======== IRESMAN_HDVICP_init ========
 * Function to initialize the device specific resource manager implementation
 */
IRES_Status IRESMAN_HDVICP_init(IRESMAN_Params * initArgs)
{
    IRESMAN_HdVicpParams * resmanArgs = (IRESMAN_HdVicpParams *)initArgs;
    Registry_Result result;

    if (!regInit) {
        /*
         *  Enable logging. We only want to do this once, since there is
         *  no Registry_removeModule().
         */
        result = Registry_addModule(&ti_sdo_fc_ires_hdvicp_desc,
                HDVICP_MODNAME);

        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the FC default */
            FCSettings_init();
            FCSettings_setDiags(HDVICP_MODNAME);
        }
        regInit = 1;
    }

    Log_print1(Diags_ENTRY, "[+E] IRESMAN_HDVICP_init> Enter (initArgs=0x%x)",
            (IArg)initArgs);

    Assert_isTrue(initArgs != NULL, (Assert_Id)NULL);

    /* Check if already initialized */
    if (_initialized) {
       Log_print0(Diags_EXIT,
               "[+X] IRESMAN_HDVICP_init> Exit (status=IRES_EEXISTS)");

       return (IRES_EEXISTS);
    }

    /*
     * Information regarding the memory allocation/free functions
     * is stored as part of the internal state of the resource
     * manager
     */
    allocFxn = resmanArgs->baseConfig.allocFxn;
    freeFxn = resmanArgs->baseConfig.freeFxn;

#ifdef xdc_target__os_Linux
    if (gate == NULL) {
        OsalSupport_createGate(_HDVICP_ipcKeyBase);
    }
    if (gate == NULL) {
        Log_print0(Diags_USER7,
                "[+7] IRESMAN_VICP2_init> Failed to create gate");

        Log_print0(Diags_EXIT,
                "[+X] IRESMAN_VICP2_init> Exit (status=IRES_EFAIL)");

        return (IRES_EFAIL);
    }
#endif

    getInternalState();

    if ((NULL == _resmanInternalState) ||
            (_resmanInternalState->sharedMemId == -1)) {

        Log_print0(Diags_USER7,
                "[+7] IRESMAN_VICP2_init> Failed to obtain Internal state "
                "Object");

        Log_print0(Diags_EXIT,
                "[+X] IRESMAN_VICP2_init> Exit (status=IRES_EFAIL)");

        return (IRES_EFAIL);
    }

    _resmanInternalState->numOpens++;

    if (sizeof(IRESMAN_Params) == resmanArgs->baseConfig.size) {
        _resmanInternalState->numResources = _HDVICP_NUMRESOURCES;
    }
    else {
        _resmanInternalState->numResources = resmanArgs->numResources;
    }

    Assert_isTrue(
            _resmanInternalState->numResources <= IRES_HDVICP_MAXRESOURCES,
            (Assert_Id)NULL);

    /* Set Initalized flag to 1 if successful */
     _initialized = 1;

     Log_print0(Diags_EXIT, "[+X] IRESMAN_HDVICP_init> Exit (status=IRES_OK)");

     return (IRES_OK);
}
Exemplo n.º 10
0
/*
 *  ======== RMAN_init ========
 *  Initialize the RMAN object with static information from the headers/
 *  configuration etc. This function has to return successfully before the
 *  other APIs can be called
 */
IRES_Status RMAN_init()
{
    Int             i = 0;
    IRES_Status     status;
    IRESMAN_Params  nullParams;
    Registry_Result regResult;


    /*
     *  Register the module name for logging only once. Do this before any
     *  Log functions are called.
     */
    if (regInit == 0) {
        regResult = Registry_addModule(&ti_sdo_fc_rman_desc, RMAN_MODNAME);

        Assert_isTrue(regResult == Registry_SUCCESS, (Assert_Id)NULL);

        /* Set diags mask to FC default */
        FCSettings_init();
        FCSettings_setDiags(RMAN_MODNAME);
        regInit = 1;
    }

    /* Ensure it is called/initialized at least once */
    if (rmanInit++) {
        Log_print0(Diags_ENTRY, "[+E] RMAN_init> Enter");
        Log_print0(Diags_EXIT, "[+X] RMAN_init> Exit (status=IRES_OK)");

        /* TODO: Return IRES_OK even if RMAN_init() failed earlier? */
        return (IRES_OK);
    }

    Log_print0(Diags_ENTRY, "[+E] RMAN_init> Enter");

    if ((NULL == RMAN_PARAMS.allocFxn) || (NULL == RMAN_PARAMS.freeFxn)) {
        Log_print0(Diags_USER7, "[+7] RMAN_init> RMAN_PARAMS not "
                "configured with allocFxn and freeFxn functions");

        initStatus = IRES_ENOMEM;
    }
    else {
        /* Set initStatus to IRES_OK so RMAN_register() can succeed. */
        initStatus = IRES_OK;
    }

    if (initStatus == IRES_OK) {
        /* Create a lock for protecting RMAN_data object */
        gate = OsalSupport_createGate(ti_sdo_fc_rman_RMAN_ipcKey);

        if (gate == NULL) {
            Log_print1(Diags_USER7,
                    "[+7] RMAN_init> Failed to create IPC gate, key = 0x%x",
                    ti_sdo_fc_rman_RMAN_ipcKey);

            initStatus = IRES_ENOMEM;
        }
    }

    if (initStatus == IRES_OK) {
        /*
         *  Register the NULL resource.
         */
        resTable.tableSize = RMAN_PARAMS.numRegistries;

        /* Initialize the registry table and the free index table */
        for (i = 0; i < resTable.tableSize; i++) {
            RMAN_TABLE[i] = NULL;
            RMAN_FREE_ENTRIES[i] = 0;
        }

        resTable.tableIndex = 0;
        resTable.freeIndex = -1;

        /* First pre-register the NULL resource */
        nullParams.allocFxn = RMAN_PARAMS.allocFxn;
        nullParams.freeFxn = RMAN_PARAMS.freeFxn;
        nullParams.size = sizeof(IRESMAN_Params);

        status = RMAN_register(&IRESMAN_NULLRES, &nullParams);
        if (status != IRES_OK) {
            Log_print1(Diags_USER7, "[+7] RMAN_init> Register failed "
                    "on NULL IRESMAN implementation: %d", (IArg)status);
            initStatus = status;
        }
    }

    if (initStatus == IRES_OK) {
        /*
         *  In this function, we can populate the RMAN_registryEntries,
         *  RMAN_registeryResmanArgs and fix RMAN_numRegistryEntries
         */
        initStatus = RMAN_autoRegister();
    }

    /*
     * Static registration of Resource Registry entries
     */
    if ((initStatus == IRES_OK) && (RMAN_registryEntries != NULL)) {

        Assert_isTrue(RMAN_numRegistryEntries < resTable.tableSize,
                (Assert_Id)NULL);
        Log_print0(Diags_USER2, "[+2] RMAN_init> Registering statically "
                "added resources");
        /*
         *  Copy the entries from the static configuration into the resource
         *  table.
         */
        for (i = 0; i < RMAN_numRegistryEntries; i++) {

            status = RMAN_register(RMAN_registryEntries[i],
                    RMAN_registryResmanArgs[i]);

            if (status != IRES_OK) {
                Log_print2(Diags_USER7, "[+7] RMAN_init> Register failed on "
                        "IRESMAN implementation 0x%x, status: %d",
                        (IArg)(RMAN_registryEntries[i]), (IArg)status);

                initStatus = status;
                break;
            }
        }
    }

    getInternalState();

    if (NULL == rmanInternalState) {
        initStatus = IRES_EFAIL;
    }

    Log_print1(Diags_EXIT, "[+X] RMAN_init> Exit (status=%d)",
            (IArg)initStatus);

    return (initStatus);
}