コード例 #1
0
ファイル: ce.c プロジェクト: Rauf-Kurbanov/trik-v4l2-dsp-fb
int codecEngineOpen(CodecEngine* _ce, const CodecEngineConfig* _config)
{
  if (_ce == NULL || _config == NULL)
    return EINVAL;

  if (_ce->m_handle != NULL)
    return EALREADY;

  Engine_Error ceError;
  Engine_Desc desc;
  Engine_initDesc(&desc);
  desc.name = "dsp-server";
  desc.remoteName = strdup(_config->m_serverPath);
  errno = 0;

  ceError = Engine_add(&desc);
  if (ceError != Engine_EOK)
  {
    free(desc.remoteName);
    fprintf(stderr, "Engine_add(%s) failed: %d/%"PRIi32"\n", _config->m_serverPath, errno, ceError);
    return ENOMEM;
  }
  free(desc.remoteName);

  if ((_ce->m_handle = Engine_open("dsp-server", NULL, &ceError)) == NULL)
  {
    fprintf(stderr, "Engine_open(%s) failed: %d/%"PRIi32"\n", _config->m_serverPath, errno, ceError);
    return ENOMEM;
  }

  return 0;
}
コード例 #2
0
/*
 *  ======== main ========
 */
Int main(Int argc, String argv[])
{
    String procId;
    String procSuffix;
    String engineName;
    String mapFileName = NULL;
    String inFile;
    String outFile;
    Char defaultEngineName[32];
    Bool useExtLoader = FALSE;  /* Set to TRUE if using external loader */
    String options = "e:m:p:s:";
    Int option;
    char serverName[MAXSERVERNAMELEN];
    Engine_Error retVal;
    Engine_Desc engDesc;

    /* Initialize defaults. */
    procId = "DSP";
    procSuffix = "x64P";
    engineName = defaultEngineName;
    sprintf(defaultEngineName, "remote_copy_%s", procId);
    inFile = "./in.dat";
    outFile = "./out.dat";

    while ((option = getopt(argc, argv, options)) != -1) {
        switch (option) {
          case 'e':
            engineName = optarg;

            break;

          case 'm':
              /*
               *  If specifying the slave's memory mapping, then assume that
               *  Codec Engine will be loading the slave.
               */
            mapFileName = optarg;
            useExtLoader = FALSE;

            break;

          case 'p':
            procId = optarg;
            sprintf(defaultEngineName, "remote_copy_%s", procId);

            break;

          case 's':
            procSuffix = optarg;

            break;

          default:
            Log_print1(Diags_USER7, " unrecognized option '%c'\n", option);

            break;
        }
    }

    if (argc == (optind + 1)) {
        inFile = argv[optind];
    }
    else if (argc == (optind + 2)) {
        inFile = argv[optind];
        outFile = argv[optind + 1];
    }
    else if (argc != optind) {
        fprintf(stderr, usage, argv[0]);
        exit(1);
    }

    /* init Codec Engine */
    CERuntime_init();

    /* Enable all trace for xdc.runtime.Main */
    Diags_setMask("xdc.runtime.Main+EX1234567");

    Log_print0(Diags_USER2, "main> ti.sdo.ce.examples.apps.universal_copy");

    /*
     * Create the Engine with a remote Server and add register the
     * appropriate stub functions.
     *
     * Note, this can also be done in a config script.
     */
    retVal = Engine_addStubFxns("UNIVERSAL_STUBS",
            (IALG_Fxns *)&UNIVERSAL_STUBS);
    if (retVal != Engine_EOK) {
        printf("App-> ERROR: Runtime Engine_addStubFxns() failed (0x%x)\n",
                retVal);
        /* don't continue */
        while (1) {}
    }

    Engine_initDesc(&engDesc);
    engDesc.name = engineName;
    engDesc.memMap = mapFileName;
    engDesc.useExtLoader = useExtLoader;
    sprintf(serverName, "all_%s.%s", procId, procSuffix);
    engDesc.remoteName = serverName;

    retVal = Engine_add(&engDesc);
    if (retVal != Engine_EOK) {
        Log_print1(Diags_ERROR, "main-> ERROR: Runtime Engine_add() "
                "failed (0x%x)\n", retVal);
        /* don't continue */
        while (1) {}
    }

    return (smain(argv[0], procId, engineName, inFile, outFile));
}
コード例 #3
0
/**
 *  @brief      The BIOS main() entry point.
 *
 *  @remark     The purpose of this function is to create a BIOS worker task
 *              to house our example.
 *
 *  @remark     This is called during BIOS_init, but before the scheduler
 *              has begun running.
 */
Void main(Int argc, String argv[])
{
    Thread_Params threadParams;
    Engine_Desc    engDesc;
    Engine_AlgDesc algDesc;
    Engine_Error status;

    sprintf(ti_sdo_ce_osal_bios_Global_CE_DEBUG, "1");
    ti_sdo_ce_osal_bios_Global_CE_DEBUG[0] = '2';
    ti_sdo_ce_osal_bios_Global_CE_DEBUG[1] = '\0';

    /* init Codec Engine */
    CERuntime_init();

    /* Enable all trace for xdc.runtime.Main */
    Diags_setMask("xdc.runtime.Main+EX1234567");

    Log_print0(Diags_USER2, "main> ti.sdo.ce.examples.apps.speech1_copy");

    /*
     *  Create the Engine and add our sphdec1_copy and sphenc1_copy algs to
     *  it.  Note, this can also be done in a config script.
     */
     Engine_initDesc(&engDesc);
     engDesc.name = "speech1_copy";
     engDesc.remoteName = NULL;

    status = Engine_add(&engDesc);
    if (status != Engine_EOK) {
        Log_print1(Diags_ERROR, "main-> ERROR: Runtime Engine_add() "
                "failed (0x%x)\n", status);
        /* don't continue */
        while (1) {}
    }

    /*
         *  Add the "sphdecl_copy" and "sphenc1_copy" algs to the
         *  "speech1_copy" engine.
         */

    Engine_initAlgDesc(&algDesc); /* Set fields to defaults */

    algDesc.name = "sphdec1_copy";
    algDesc.fxns = (IALG_Fxns *)&SPHDEC1COPY_TI_ISPHDEC1COPY;
    algDesc.idmaFxns = NULL;
    algDesc.isLocal = TRUE;
    algDesc.groupId = 0;
    algDesc.iresFxns = NULL;
    algDesc.types = SPHDEC1_VISATYPE;

    status = Engine_addAlg("speech1_copy", NULL, NULL, &algDesc);

    if (status != Engine_EOK) {
        Log_print1(Diags_USER7, "App-> ERROR: can't add Alg (0x%x)\n",
                (IArg)status);
        /* don't continue */
        while (1) {}
    }

    algDesc.name = "sphenc1_copy";
    algDesc.fxns = (IALG_Fxns *)&SPHENC1COPY_TI_ISPHENC1COPY;
    algDesc.idmaFxns = NULL;
    algDesc.isLocal = TRUE;
    algDesc.groupId = 0;
    algDesc.iresFxns = NULL;
    algDesc.types = SPHENC1_VISATYPE;

    status = Engine_addAlg("speech1_copy", NULL, NULL, &algDesc);

    if (status != Engine_EOK) {
        Log_print1(Diags_USER7, "App-> ERROR: can't add Alg (0x%x)\n",
                (IArg)status);
        /* don't continue */
        while (1) {}
    }

    /* Spawn a task to run once the BIOS scheduler is started */
    Thread_Params_init(&threadParams);

    /* 6K stack size */
    threadParams.stackSize = 6 * 1024;
    /* task name */
    threadParams.instance->name = taskName;

    /* used for in/out file names */
    threadParams.arg = 0;

    if (Thread_create(workerFxn, &threadParams, NULL) == NULL) {
        System_abort("main: failed to create smain thread.");
    }

    /* Start the BIOS scheduler */
    BIOS_start();
}
コード例 #4
0
/*
 *  ======== main ========
 */
Int main(Int argc, String argv[])
{
    String procId;
    String engineName;
    String inFile;
    String outFile;
    Char defaultEngineName[32];
    String options = "e:p:";
    Int option;
    Engine_Desc    engDesc;
    Engine_AlgDesc algDesc;
    Engine_Error status;

    /* Initialize defaults. */
    procId = "DSP";
    engineName = defaultEngineName;
    sprintf(defaultEngineName, "speech1_copy");
    inFile = "./in.dat";
    outFile = "./out.dat";

    while ((option = getopt(argc, argv, options)) != -1) {
        switch (option) {
          case 'e':
            engineName = optarg;
            break;

          case 'p':
            procId = optarg;
            break;

          default:
            Log_print1(Diags_USER7, " unrecognized option '%c'\n", option);
            break;
        }
    }

    if (argc == (optind + 1)) {
        inFile = argv[optind];
    }
    else if (argc == (optind + 2)) {
        inFile = argv[optind];
        outFile = argv[optind + 1];
    }
    else if (argc != optind) {
        fprintf(stderr, usage, argv[0]);
        exit(1);
    }

    /* init Codec Engine */
    CERuntime_init();

    /* Enable all trace for xdc.runtime.Main */
    Diags_setMask("xdc.runtime.Main+EX1234567");

    Log_print0(Diags_USER2, "main> ti.sdo.ce.examples.apps.speech1_copy");

    /* Add a "speechl_copy" engine */
    Engine_initDesc(&engDesc);
    engDesc.name = "speech1_copy";

    status = Engine_add(&engDesc);
    if (status != Engine_EOK) {
        Log_print1(Diags_USER7, "App-> ERROR: can't add engine (0x%x)\n",
                (IArg)status);
        return (0);
    }

    /*
         *  Add the "sphdecl_copy" and "sphenc1_copy" algs to the
         *  "speech1_copy" engine.
         */

    Engine_initAlgDesc(&algDesc); /* Set fields to defaults */

    algDesc.name = "sphdec1_copy";
    algDesc.fxns = (IALG_Fxns *)&SPHDEC1COPY_TI_ISPHDEC1COPY;
    algDesc.idmaFxns = NULL;
    algDesc.isLocal = TRUE;
    algDesc.groupId = 0;
    algDesc.iresFxns = NULL;
    algDesc.types = SPHDEC1_VISATYPE;

    status = Engine_addAlg("speech1_copy", NULL, NULL, &algDesc);

    if (status != Engine_EOK) {
            Log_print1(Diags_USER7, "App-> ERROR: can't add Alg (0x%x)\n",
                (IArg)status);
            return (0);
    }

    algDesc.name = "sphenc1_copy";
    algDesc.fxns = (IALG_Fxns *)&SPHENC1COPY_TI_ISPHENC1COPY;
    algDesc.idmaFxns = NULL;
    algDesc.isLocal = TRUE;
    algDesc.groupId = 0;
    algDesc.iresFxns = NULL;
    algDesc.types = SPHENC1_VISATYPE;

    status = Engine_addAlg("speech1_copy", NULL, NULL, &algDesc);

    if (status == Engine_EOK) {
        return (smain(argv[0], procId, engineName, inFile, outFile));
    }
    else {
        Log_print1(Diags_USER7, "App-> ERROR: can't add Alg (0x%x)\n",
                (IArg)status);
    }

    Log_print0(Diags_USER1, "[+1] app done.");
    return (0);
}