/*
 *  ======== Processor_create ========
 */
Processor_Handle Processor_create(String imageName, String memMap,
    Processor_Attrs *attrs)
{
    Processor_Handle proc = NULL;
    struct stat statBuf;

    Assert_isTrue(curInit == TRUE, (Assert_Id)NULL);

    Log_print3(Diags_ENTRY, "[+E] Processor_create> "
            "Enter(imageName='%s', memMap='%s', attrs=0x%x)",
            (IArg)imageName, (IArg)memMap, (IArg)attrs);

    if (attrs == NULL) {
        attrs = &Processor_ATTRS;
    }

    if (stat(imageName, &statBuf) != 0) {
        Log_print1(Diags_USER7, "[+7] Processor_create> "
                "ERROR: cannot access file %s", (IArg)imageName);
        return (NULL);
    }

    proc = Memory_alloc(sizeof(Processor_Obj), NULL);
    if (proc == NULL) {
        Log_print0(Diags_USER7, "[+7] Processor_create> "
                "ERROR: Memory_alloc failed");
        return (NULL);
    }

    proc->attrs = *attrs;
    proc->imageName = imageName;
    proc->memMapName = memMap;
    proc->loaded = FALSE;
    proc->fileId = 0xffffffff;
    proc->heapH = NULL;
    proc->procMgrH = NULL;
    proc->heapId = Processor_INVALID;
    proc->loadCallBackStatus = -1;
    proc->startCallBackStatus = -1;
    proc->useExtLoader = attrs->useExtLoader;

    if (doCmd(CREATE, proc) != SUCCESS) {
        Processor_delete(proc);
        return (NULL);
    }
    proc->loaded = TRUE;

    Log_print1(Diags_EXIT, "[+X] Processor_create> return (0x%x)", (IArg)proc);

    return (proc);
}
Beispiel #2
0
/*
 *  ======== Processor_create ========
 */
Processor_Handle Processor_create(String imageName, String linkCfg,
    Processor_Attrs *attrs)
{
    Processor_Handle proc = NULL;
    File_Stat statBuf;

    GT_assert(curTrace, curInit == TRUE);

    GT_3trace(curTrace, GT_ENTER, "Processor_create> "
        "Enter(imageName='%s', linkCfg='%s', attrs=0x%x)\n", imageName,
        linkCfg, attrs);

    if (attrs == NULL) {
        attrs = &Processor_ATTRS;
    }

    if ((!Global_useLinkArbiter) &&
            (File_stat(imageName, &statBuf) != File_EOK)) {
        GT_1trace(curTrace, GT_7CLASS, "Processor_create> "
            "ERROR: cannot access file %s\n", imageName);
        return (NULL);
    }

    if ((proc = Memory_alloc(sizeof(Processor_Obj), NULL)) == NULL) {
        GT_0trace(curTrace, GT_7CLASS, "Processor_create> "
            "ERROR: Memory_alloc failed\n");
        return (NULL);
    }

    proc->attrs = *attrs;
    proc->imageName = imageName;
    proc->linkConfigName = linkCfg;
    proc->loaded = FALSE;
    proc->powerHandle = NULL;
    proc->connected = FALSE;

    if (doCmd(CREATE, proc) != SUCCESS) {
        Processor_delete(proc);
        return (NULL);
    }
    proc->loaded = TRUE;

    GT_1trace(curTrace, GT_ENTER, "Processor_create> return (0x%x)\n", proc);

    return (proc);
}
/*
 *  ======== Processor_create ========
 */
Processor_Handle Processor_create(String imageName, String linkCfg,
    Processor_Attrs *attrs)
{
    Processor_Handle proc = NULL;

    Log_print3(Diags_ENTRY, "[+E] Processor_create> "
            "Enter(imageName='%s', linkCfg='%s', attrs=0x%x)",
            (IArg)imageName, (IArg)linkCfg, (IArg)attrs);

#if MESSAGEQ_ENABLED
    /* This implementation requires attrs->name to be provided */
    if ((attrs == NULL) || (attrs->cpuId == NULL)) {
        Log_print0(Diags_USER7, "[+7] Processor_create> ERROR: invalid attrs");
        return (NULL);
    }

    if ((proc = xdc_runtime_Memory_alloc(NULL, sizeof(Processor_Obj),
            0, NULL)) == NULL) {
        Log_print0(Diags_USER7, "[+7] Processor_create> "
                "ERROR: Memory_alloc failed");
        return (NULL);
    }

    proc->hHeap = NULL;
    proc->heapId = (UInt16)Processor_INVALID;

    if (!procCreate(proc, attrs->cpuId)) {
        Processor_delete(proc);
        return (NULL);
    }
#endif

    Log_print1(Diags_EXIT, "[+X] Processor_create> return (0x%x)", (IArg)proc);

    return (proc);
}