/* ARGSUSED */
int main(Int argc, Char * argv[])
//int main(UArg argc, UArg argv)
{
    IRES_Status status;
    Int         size = 0;

#if 0
    // TODO: Convert to Diags_setMask()
    GT_set(MODNAME "=01234567");
    GT_set("ti.sdo.fc.rman" "=4567");
    GT_set("ti.sdo.fc.dskt2" "=67");
    GT_set("ti.sdo.fc.ires.hdvicp" "=01234567");
    /*      GT_set("ti.sdo.fc.dskt2" "=01234567");*/
#endif
    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);
        return (-1);
    }

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

    smain(argc, argv);

    return (0);
}
static Void workerFxn(IArg arg)
{
    Char inFile[MAXFILENAME];
    Char outFile[MAXFILENAME];

    sprintf(inFile, "./in%d.dat", arg);
    sprintf(outFile, "./out%d.dat", arg);

    smain("speech1_copy", "unused", "speech1_copy", "./in.dat", "./out.dat");
}
/* 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);
}
/*
 *  ======== main ========
 */
Int main(Int argc, String argv[])
{
    CERuntime_init();

    GT_create(&curMask, "ZZ");

    /* Enable all trace for this "ZZ" module */
    GT_set("ZZ=01234567");

    GT_0trace(curMask, GT_2CLASS, "main> Welcome to app's main().\n");

    return (smain(argc, argv));
}
static Void workerFxn(IArg arg)
{
    Char inFile[MAXFILENAME];
    Char outFile[MAXFILENAME];
    String procId;
    String engineName;

    sprintf(inFile, "./in%d.dat", arg);
    sprintf(outFile, "./out%d.dat", arg);

    procId = MultiProc_getName(arg);
    engineName = (arg == 0) ? "local_engine" : "audio1_copy";

    smain("audio1_copy", procId, engineName, inFile, outFile);
}
Beispiel #6
0
Int main(Int argc, String argv[])
{
    IRES_Status status;

    GT_create(&ti_sdo_fc_rman_examples_scratchEdma3_GTMask, 
            "ti.sdo.fc.rman.examples.scratchEdma3");
    GT_set(MOD_NAME "=4567");
    GT_init();
    status = RMAN_init(); 
    if (IRES_OK != status) {
        printf("RMAN initialization Failed \n");
        return -1;
    }

    return (smain(argc, argv));
}
Beispiel #7
0
/* ARGSUSED */
Int main(Int argc, Char * argv[])
{
    IRES_Status status;

    GT_create(&CURTRACE, "ti.sdo.fc.rman.examples.addrspace");

    //GT_set(ADDRSPACE_GTNAME   "=1234567");
    //GT_set(ADDRSPACE_GTNAME "=1234567");

    status = RMAN_init();
    if (IRES_OK != status) {
        printf("RMAN initialization Failed \n");
        return (-1);
    }

    return (smain(argc, argv));
}
Beispiel #8
0
/*
 *  ======== main ========
 */
Int main(Int argc, String argv[])
{
#ifdef LOCAL
    BUFRES_Params  config;
    IRES_Status     status;
#endif

    /* init Codec Engine */
    CERuntime_init();

    /* init trace */
    GT_init();

    /* create a mask to allow a trace-print welcome message below */
    GT_create(&curMask, MOD_NAME);

    /* Enable all trace for this module */
    GT_set(MOD_NAME "=01234567");

    GT_0trace(curMask, GT_2CLASS, "main> " MOD_NAME "\n");

#ifdef LOCAL
    RMAN_init();

    /*
     *  Configure and register BUFRES resource. This code is used for both
     *  local and remote Linux apps. In the remote case, registering will
     *  not have any affect, since the IRES codec will be run on the DSP.
     *
     *  This particular resource cannot be auto-registered, since it needs
     *  to be configured with a buffer.
     */
    config.iresConfig.size = sizeof(BUFRES_Params);
    config.iresConfig.allocFxn = _ALG_allocMemory;
    config.iresConfig.freeFxn = _ALG_freeMemory;

    config.base = (Void *)buffer;
    config.length = BUFLEN;

    status = RMAN_register(&BUFRES_MGRFXNS, (IRESMAN_Params *)&config);
    GT_1trace(curMask, GT_2CLASS, "main>  RMAN_register returned 0x%x\n",
              (IArg)status);
#endif
    return (smain(argc, argv));
}
/**
 *  @brief      The main() entry point.
 */
Int main(Int argc, String argv[])
{
    /* init Codec Engine */
    CERuntime_init();

    /* init trace */
    GT_init();

    /* create a mask to allow a trace-print welcome message below */
    GT_create(&curMask, MOD_NAME);

    /* Enable all trace for this module */
    GT_set(MOD_NAME "=01234567");

    GT_0trace(curMask, GT_2CLASS, "main> " MOD_NAME "\n");

    return (smain(argc, argv));
}
Beispiel #10
0
/* In windows, our main() flows through here, before calling the 'real' main, smain() in inspircd.cpp */
int main(int argc, char* argv[])
{
	/* Check for parameters */
	if (argc > 1)
	{
		for (int i = 1; i < argc; i++)
		{
			if(!_stricmp(argv[i], "--installservice"))
			{
				InstallService();
				return 0;
			}
			if(!_stricmp(argv[i], "--uninstallservice") || !_stricmp(argv[i], "--removeservice"))
			{
				UninstallService();
				return 0;
			}
		}
	}

	SERVICE_TABLE_ENTRY serviceTable[] =
	{
		{ TEXT("InspIRCd"), (LPSERVICE_MAIN_FUNCTION)ServiceMain },
		{ NULL, NULL }
	};

	g_bRunningAsService = true;
	if( !StartServiceCtrlDispatcher(serviceTable) )
	{
		// This error means that the program was not started as service.
		if( GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT )
		{
			g_bRunningAsService = false;
			return smain(argc, argv);
		}
		else
		{
			return EXIT_STATUS_SERVICE;
		}
	}
	return 0;
}
Beispiel #11
0
/** The main part of inspircd runs within this thread function. This allows the service part to run
 * separately on its own and to be able to kill the worker thread when its time to quit.
 */
DWORD WINAPI WorkerThread(LPVOID param)
{
	smain(g_ServiceData.argc, g_ServiceData.argv);
	return 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));
}
Beispiel #13
0
static Void workerFxn(IArg arg)
{
    smain("image_copy", "unused", "image_copy", "./in.dat", "./out.dat");
}
static Void workerFxn(IArg arg)
{
    smain("scale", "unused", "scale", "./in.dat", "./out.dat");
}
/*
 *  ======== main ========
 */
Int main(Int argc, String argv[])
{
    
    CERuntime_init();

    GT_create(&curMask, "ZZ");

    /* Enable all trace for this "ZZ" module */
    GT_set("ZZ=01234567");

    GT_0trace(curMask, GT_2CLASS, "main> Welcome to app's main().\n");

    



// those code is support Qt display , the RGB display is OK , but grayscale is not my I wish !! because the pixel is error I guess!! 
#if 0     
    /*
    QApplication app(argc,argv,true);
    QLabel label;
    QImage qimage;
    QSplashScreen *splash = new QSplashScreen;
    QVector<QRgb> grayColourTable;
    QRgb *colourtable = new QRgb[256];*/

    unsigned char *frame_buffer_video = (unsigned char*)malloc(300*320*240*3*sizeof(unsigned char));
    unsigned char *frame_buffer_3_channel_gray = (unsigned char*)malloc(320*240*3*sizeof(unsigned char));
    int count , i , j;
    
    //cat the video by the smain function  , the video include 300 frame
    frame_buffer_video  = smain(argc,argv);
  
     
    //show the video capture by using Qt  ,  the video include 300 frame
    
    for(count=0;count<300; count++ )
    {
     
        //  (R1,G1,B1)  ---->  (Gray1,Gray1,Gray1)
	/*for(i=0;i<320*240;i++)
	{    
          for(j=0;j<3;j++)
          {frame_buffer_3_channel[j+i*3] = frame_buffer_video[i + count*320*240];} 
	}*/
    

         //RGB888 to GrayScale 
         for (i=0;i<320*240;i++)
         { 
          for(j=0;j<3;j++)
          {
           (frame_buffer_3_channel_gray[j+i*3]) = ( *(frame_buffer_video + count*320*240*3+i)*0.299 + *(frame_buffer_video + count*320*240*3 +i +1)*0.587  + *(frame_buffer_video + count*320*240*3 +i +2)*0.114);
          }
         }
        qimage =QImage((uchar*)(frame_buffer_3_channel_gray),320,240,QImage::Format_RGB888);



        /*==========================greyscale channel but have a problem================*/
       
        /*for(i=0;i<256;i++)
	{    
          colourtable[i]=qRgb(i,i,i);
          grayColourTable.append(colourtable[i]);
	}*/
        //qimage =QImage((uchar*)(frame_buffer_video + count*320*240),320,240,QImage::Format_Indexed8);
        //qimage.setColorTable(grayColourTable);
	
    splash->setPixmap(QPixmap::fromImage(qimage));  
    splash->show();
    sleep(1);
    }
    
    //free(frame_buffer_video);
    //free(frame_buffer);

#endif
    


    GT_0trace(curMask, GT_2CLASS, "ending by this app.\n");

    
    //return 0 ;
    //return (smain(argc, argv));
    smain(argc, argv);
    return 0 ;
}   
/*
 *  ======== main ========
 */
Int main(Int argc, String argv[])
{
    CERuntime_init();

    return (smain(argc, argv));
}
/*
 *  ======== 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 */
    Engine_Error status;
    String options = "e:m:p:s:";
    Int option;
    Engine_Desc desc;

    /* 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 this "xdc.runtime.Main" module */
    Diags_setMask("xdc.runtime.Main+EX1234567");

    Log_print0(Diags_USER2, "[+2] main> Welcome to app's main().");

    /*
     *  Set the memory map in the engine's descriptor, and change to use
     *  (or not use) an external loader for loading.  If using an external
     *  loader, then desc.memMap should be set to NULL;
     */
    status = Engine_getDesc(engineName, &desc);
    desc.useExtLoader = useExtLoader;
    desc.memMap = mapFileName;

    status = Engine_setDesc(engineName, &desc);
    if (status != Engine_EOK) {
        Log_print2(Diags_USER6, "[+2] main> Unable to change \'useExtLoader\' "
                "in descriptor for engine %s to %s", (IArg)engineName,
                (IArg)(useExtLoader ? "TRUE" : "FALSE"));
    }

    return (smain(argv[0], procId, engineName, inFile, outFile));
}
/*
 *  ======== 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);
}