Beispiel #1
0
/******************************************************************************
 * Dmai_setLogLevel
 ******************************************************************************/
Int Dmai_setLogLevel(Dmai_LogLevel logLevel)
{
    /* Set the log level if global variable is not set */
    if (Dmai_debugLogLevel == Dmai_LogLevel_Notset) {
        switch (logLevel) {
            case 0: 
                GT_set("ti.sdo.dmai=");        
                break;
            case 1:
                GT_set("ti.sdo.dmai=67");
                break;
            case 2:
                GT_set("ti.sdo.dmai=01234567");
                break;
            default:
                /* Invalid level. */
                return Dmai_EINVAL;
        }
        
        Dmai_dbg1("Log level set to %d.\n", logLevel);
    }
    else {
        Dmai_dbg0("Using log level set by DMAI_DEBUG.\n");
    }
    
    return Dmai_EOK;
}
Beispiel #2
0
/******************************************************************************
 * Dmai_init
 ******************************************************************************/
Void Dmai_init()
{
    if (ti_sdo_dmai_GTMask.modName == NULL) {
        GT_init();
        Global_init();
        Memory_init();
        Sem_init();
        
        GT_create(&ti_sdo_dmai_GTMask, Dmai_gtname);

        if (Dmai_debugLogLevel != Dmai_LogLevel_Notset) {           
            switch (Dmai_debugLogLevel) {
                case 0: 
                    GT_set("ti.sdo.dmai=");         
                    break;
                case 1:
                    GT_set("ti.sdo.dmai=67");
                    break;
                case 2:
                    GT_set("ti.sdo.dmai=01234567");
                    break;
                default:
                    /* Invalid parameter. Do nothing. */   
                    break;
            }
            Dmai_dbg1("Dmai log level set to %d.\n", Dmai_debugLogLevel);
        }
    }
    
    return;
}
Beispiel #3
0
Int main(Int argc, String argv[])
{
    IRES_Status status;

    /* The 2 lines below, are if GT trace will be used to print trace from
       the app, not required if you will be using printfs in the apps files */
    GT_init();
    GT_create(&ti_sdo_fc_rman_examples_hdvicp,"ti.sdo.fc.rman.examples.hdvicp");

    /* GT_set lets you configure trace at different levels for different
       modules */
    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_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_main> Enter\n");

    /* Initialize Framework modules */
    status = RMAN_init();

    if (IRES_OK != status) {
        GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_7CLASS, "_main> RMAN "
                "Initialization failed \n");
        return (-1);
    }

    GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_main> Exit\n");

    return (rmanTask(argc, argv));
}
/* 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);
}
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status status;
    Int         size = 0;

    // TODO: Use Diags_setMask()
#if 0
    GT_init();
    GT_create(&CURTRACE, "ti.sdo.fc.rman.examples.hdvicp");
        GT_set(MOD_NAME "=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);
        System_abort("RMAN_init() failed, aborting...\n");
    }

    /*
     * Supply initialization information for the RESMAN while registering
     */
    size = sizeof(IRESMAN_HdVicpParams);

    configParams.baseConfig.allocFxn = RMAN_PARAMS.allocFxn;
    configParams.baseConfig.freeFxn = RMAN_PARAMS.freeFxn;
    configParams.baseConfig.size = size;

    /* Register the HDVICP protocol/resource manager with the
     * generic resource manager */

    status = RMAN_register(&IRESMAN_HDVICP, (IRESMAN_Params *)&configParams);

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

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

    BIOS_start();

    return(0);
}
Beispiel #6
0
Int main()
{
    IRES_Status status;
    Int size = 0;

    GT_init();
    GT_create(&ti_sdo_fc_rman_examples_hdvicp,"ti.sdo.fc.rman.examples.hdvicp");
        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");*/

    GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_main> Enter \n");

    status = RMAN_init(); 
    if (IRES_OK != status) {
        GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_7CLASS, "_main> RMAN "
                "Initialization failed \n");
        return -1;
    }

    /*
     * Supply initialization information for the RESMAN while registering
     */
    size = sizeof(IRESMAN_HdVicpParams);

    configParams.baseConfig.allocFxn = RMAN_PARAMS.allocFxn;
    configParams.baseConfig.freeFxn = RMAN_PARAMS.freeFxn;
    configParams.baseConfig.size = size;

    /* Register the HDVICP protocol/resource manager with the 
     * generic resource manager */

    status = RMAN_register(&IRESMAN_HDVICP, (IRESMAN_Params *)&configParams);

    if (IRES_OK != status) {
        GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_7CLASS, "_main> Protocol "
                "Initialization failed \n");
        return -1;
    }


    GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_main> Exit \n");

    return 0;

}
Beispiel #7
0
Datei: ce.c Projekt: guyz/dsp
static int ce_open(const char *name, AVCodecContext *cc,
                    struct frame_format *ff)
{
    char decName[16];

    switch (cc->codec_id) {
	case CODEC_ID_H264:
	     codecModule = &h264_codec;
	     strcpy(decName, "h264dec");
	     break;
	case CODEC_ID_MPEG4:
	     codecModule = &mpeg4_codec;
	     strcpy(decName, "mpeg4dec");
	     break;
	default:
             fprintf(stderr, "ERROR: unsupported CE codec %d\n", cc->codec_id);
             return -1;
    }

    /* init Codec Engine */
    CERuntime_init();

    if ((ce = Engine_open(engineName, NULL, NULL)) == NULL) {
        fprintf(stderr, "ERROR: can't open engine ceEngine\n");
        return -1;
    }

    // Debug
    GT_set(Memory_GTNAME "+5");

    return codecModule->open(decName, cc, ff);
}
Beispiel #8
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.
 */
Int main(Int argc, String argv[])
{
    TSK_Attrs attrs = TSK_ATTRS;
    attrs.stacksize = 6 * 1024;
    attrs.name = taskName;

    /* 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");

    if (TSK_create((Fxn)smain, &attrs, argc, argv) == NULL) {
        SYS_abort("main: failed to create smain thread.");
    }

    return (0);
}
Beispiel #9
0
/*
 *  ======== main ========
 */
Void main(Int argc, Char *argv[])
{
    /* init Codec Engine */
    CERuntime_init();

    /* init trace */
    GT_init();

    /* create a mask to allow a trace-print welcome message below */
    GT_create(&gtMask, "audio1_ires_server");

    /* ...and initialize all masks in this module to "on" */
    GT_set("audio1_ires_server=01234567");

    GT_0trace(gtMask, GT_4CLASS, "main> Welcome to DSP server's main().\n");

    /* Configure and register BUFRES resource with RMAN */

    /*
     * Note that we can't use RMAN's auto-register with the BUFRES resource
     * because it takes runtime config params that don't have logical
     * defaults.
     */
    config.iresConfig.size = sizeof(BUFRES_Params);
    config.iresConfig.allocFxn = DSKT2_allocPersistent;
    config.iresConfig.freeFxn = DSKT2_freePersistent;

    config.base = (Void *)&BUFMEM_base;
    config.length = (UInt32)&BUFMEM_end - (UInt32)&BUFMEM_base + 1;

    RMAN_register(&BUFRES_MGRFXNS, (IRESMAN_Params *)&config);
}
/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{

    GT_init();



    /* allow user to over-ride via CE_TRACE. */
    GT_set(Global_getenv("CE_TRACE"));
    Global_init();

    Sem_init();
    SemMP_init();


    Memory_init();
    Queue_init();
    Comm_init();
    Thread_init();
    Processor_init();
    LockMP_init();  /* Must be called before DMAN3_init() */
    Algorithm_init();
    XdmUtils_init();
    Lock_init();

    Engine_init();
    Server_init();

}
/*
 *  ======== 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));
}
Beispiel #12
0
/*
 *  ======== main ========
 */
Void main(Int argc, Char *argv[])
{
    /* init Codec Engine */
    CERuntime_init();

    /* init trace */
    GT_init();

    /* create a mask to allow a trace-print welcome message below */
    GT_create(&gtMask, "ti.sdo.ce.examples.servers.all_codecs");

    /* ...and initialize all masks in this module to "on" */
    GT_set("ti.sdo.ce.examples.servers.all_codecs=01234567");

    GT_0trace(gtMask, GT_4CLASS, "main> Welcome to DSP server's main().\n");
}
Beispiel #13
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 #14
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));
}
Beispiel #15
0
Int main()
{
    Int size = 0;
    IRES_Status status;
    IRESMAN_Edma3ChanParams configParams; 
    Int i = 0;

    GT_set(MOD_NAME "=01234567");
/*
 * Call to _DSKT2_init is required as it leaks memory when DSKT2 is actually . 
 * Call it before you do MEM_stat
 */
    printf("Testing for Memory Leaks\n");
    _DSKT2_init();
    for (i = 0; i < MAXMEMSEGMENTS; i++) {
        if (!MEM_stat(i, &memStat[i])) {
            memStat[i].size =  memStat[i].used = 0;
            memStat[i].length = 0;
        }
    }

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

    /*
     * Supply initialization information for the EDMA3 RESMAN while registering
     */
    size = sizeof(IRESMAN_Edma3ChanParams);

    configParams.baseConfig.allocFxn = RMAN_PARAMS.allocFxn;
    configParams.baseConfig.freeFxn = RMAN_PARAMS.freeFxn;
    configParams.baseConfig.size = size;

    status = RMAN_register(&IRESMAN_EDMA3CHAN, (IRESMAN_Params *)&configParams);

    if (IRES_OK != status) {
        printf("Protocol Registration Failed \n");
        return -1;
    }

    return 0;
}
/**
 *  @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));
}
/*
 * ======== TraceUtil_init ========
 */
Void TraceUtil_init()
{
    String mask;
    String fileName;
    String flags;
    String s;
    Char   armTraceFileName[ MAXCMDLINESIZE ];

    extern Void GT_config_setOutTrace(FILE *newOutTrace);

    if (getenv( "CE_DEBUG" ) != NULL) {
        return;
    }

    if (curInit == TRUE) {
        return;
    }
    curInit = TRUE;

    s = getenv("TRACEUTIL_VERBOSE");
    if (s != NULL) {
        verbose = (s[0] == '2' ? 2 : 1);
    }

    INFO("Relevant environment variables:\n");
    #define INFO_ENV(env,pad) INFO("%s %s= %s\n", \
            (env), (pad), getenv(env) ? getenv(env) : "undefined")
    INFO_ENV("CE_TRACE", "               ");
    INFO_ENV("CE_TRACEFILE", "           ");
    INFO_ENV("TRACEUTIL_DSP0TRACEFILE", "");
    INFO_ENV("TRACEUTIL_DSP0BIOSFILE", " ");
    INFO_ENV("TRACEUTIL_DSP0TRACEMASK", "");
    INFO_ENV("TRACEUTIL_REFRESHPERIOD", "");
    INFO_ENV("CE_TRACEFILEFLAGS", "      ");
    INFO_ENV("TRACEUTIL_CMDPIPE", "      ");
    INFO_ENV("TRACEUTIL_VERBOSE", "      ");

    /*
     * We run after GT has performed initialization but before
     * anything has been printed yet.
     */

    flags = getenv("CE_TRACEFILEFLAGS");

    if (flags == NULL) {
        flags = TraceUtil_traceFileFlags;
    }
    if (flags == NULL || flags[0] == '\0') {
        flags = "w";
    }

    /* Local trace file */
    fileName = getenv("CE_TRACEFILE");

    if (fileName == NULL) {
        fileName = TraceUtil_localTraceFile;
    }

    INFO("Local trace file name: %s\n", (fileName && fileName[0]) ?
         fileName : "stdout");

    armTraceFileName[0] = '\0';

    /* NULL means stdout */
    if (fileName != NULL && fileName[0] != '\0') {
        localTraceFilePtr = fopen(fileName, flags);

        if (localTraceFilePtr == NULL) {
            WARN("Failed to open local log file \"%s\", using stdout\n",
                fileName);
            localTraceFilePtr = stdout;
        } else {
            strncpy(armTraceFileName, fileName, MAXCMDLINESIZE);
            fileSetCloseOnExec(localTraceFilePtr);
        }
    }
    else {
        localTraceFilePtr = stdout;
    }

    GT_config_setOutTrace(localTraceFilePtr);

    /* DSP CE trace file */
    fileName = getenv("TRACEUTIL_DSP0TRACEFILE");

    if (fileName == NULL) {
        fileName = TraceUtil_dsp0TraceFile;
    }

    INFO("DSP CE trace file name: %s\n", (fileName && fileName[0]) ?
         fileName : "stdout");

    /* NULL means stdout */
    if (fileName != NULL && fileName[0] != '\0') {

        if (!strcmp(armTraceFileName, fileName)) {
            /* local and DSP trace names are the same */
            dsp0TraceFilePtr = localTraceFilePtr;
        } else {
            dsp0TraceFilePtr = fopen(fileName, flags);
            if (dsp0TraceFilePtr == NULL) {
                WARN("Failed to open dsp CE log file \"%s\", using stdout\n",
                    fileName);
                dsp0TraceFilePtr = stdout;
            } else {
                fileSetCloseOnExec(dsp0TraceFilePtr);
            }
        }
    }
    else {
        dsp0TraceFilePtr = stdout;
    }

    /* DSP/BIOS trace file */
    fileName = getenv("TRACEUTIL_DSP0BIOSFILE");

    if (fileName == NULL) {
        fileName = TraceUtil_dsp0BiosFile;
    }

    INFO("DSP/BIOS log file name: %s\n", (fileName && fileName[0]) ?
         fileName : "none");

    if (fileName != NULL && fileName[0] != '\0') {
        dsp0BiosFilePtr = fopen(fileName, flags);

        if (dsp0BiosFilePtr == NULL) {
            WARN("Failed to open dsp/bios log file \"%s\", disabling log\n",
                fileName);
        } else {
            fileSetCloseOnExec(dsp0BiosFilePtr);
        }
    }

    /* trace command pipe we open in the separate thread -- because whoever comes
     * first to the pipe is blocked until another pipe party arives. So we don't
     * want to block here, in the main thread, and we only determine its name.
     */
    cmdPipeFile = getenv("TRACEUTIL_CMDPIPE");

    if (cmdPipeFile == NULL) {
        cmdPipeFile = TraceUtil_cmdPipeFile;
    }
    INFO("Command pipe name: %s\n", (cmdPipeFile && cmdPipeFile[0]) ?
         cmdPipeFile : "none");

    /* Set the local trace mask */
    mask = getenv("CE_TRACE");

    if (mask == NULL) {
        mask = TraceUtil_localTraceMask;
    }

    INFO("Arm trace mask: \"%s\"\n", mask);
    GT_set(mask);

    /* Set the remote trace mask */
    dsp0mask = getenv("TRACEUTIL_DSP0TRACEMASK");

    if (dsp0mask == NULL) {
        dsp0mask = TraceUtil_dsp0TraceMask;
    }

    INFO("DSP trace mask: \"%s\"\n", dsp0mask);
    setenv("CE_DSP0TRACE", dsp0mask, 1);

    Global_atexit((Fxn)TraceUtil_exit);
}
/*
 * ======== processPipeCommand ========
 */
static Void processPipeCommand(String command)
{
    Int    i, j, n;
    String mask;
    IArg key;

    DBG( "Processing pipe command '%s'\n", command );

    /* first check if this command is an alias */
    for (i = 0; TraceUtil_cmdAliases[i] != NULL; i++) {
        if (!strcmp( TraceUtil_cmdAliases[i][0], command )) {
            for (j = 1; TraceUtil_cmdAliases[i][j] != NULL; j++) {
                processPipeCommand( TraceUtil_cmdAliases[i][j] );
            }
            return; /* we have finished processing the alias */
        }
    }

    if (strstr( command, TRACECMD_ARMTRACEMASK ) == command) {
        mask = command + strlen( TRACECMD_ARMTRACEMASK );

        INFO( "Setting Arm trace mask to '%s'\n", mask );
        GT_set( mask );
    }
    else if (strstr( command, TRACECMD_DSP0TRACEMASK ) == command) {
        mask = command + strlen( TRACECMD_DSP0TRACEMASK );

        INFO( "Setting DSP0 trace mask to '%s'\n", mask );

        key = Gate_enterModule();

        Engine_setTrace(hEngine, mask);

        Gate_leaveModule(key);
    }
    else if (strstr( command, TRACECMD_REFRESHPERIOD ) == command) {
        n = atoi( command + strlen( TRACECMD_REFRESHPERIOD ) );

        INFO( "Setting trace refresh period to %d ms.\n", n );

        refresh = n * 1000;
    }
    else if (strstr( command, TRACECMD_RESETFILES ) == command) {
        INFO( "Resetting trace/log files.\n" );
        if (localTraceFilePtr != NULL   &&
            localTraceFilePtr != stdout &&
            localTraceFilePtr != stderr) {
            DBG( "Resetting Arm trace file.\n" );

            /* rewind file (stdio operation) then truncate it (OS operation) */
            rewind( localTraceFilePtr );
            ftruncate( fileno( localTraceFilePtr ), 0L );
        }
        if (dsp0TraceFilePtr != NULL   &&
            dsp0TraceFilePtr != stdout &&
            dsp0TraceFilePtr != stderr) {
            DBG("Resetting DSP trace file.\n");
            rewind(dsp0TraceFilePtr);
            ftruncate(fileno(dsp0TraceFilePtr), 0L);
        }
        if (dsp0BiosFilePtr != NULL) {
            DBG("Resetting DSP log file.\n");
            rewind(dsp0BiosFilePtr);
            ftruncate(fileno(dsp0BiosFilePtr), 0L);
        }
    }
    else {
        WARN("Unknown trace pipe command '%s'\n", command);
    }

}
/*
 *  ======== 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 ;
}   
Beispiel #20
0
/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{
    extern Void IPC_generatedInit();

    GT_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;



        if (Global_getenv("CE_DEBUG")[0] == '1') {
            GT_set("*+67,CE-3,GT_time=0,GT_prefix=1235");
            Engine_ceDebugDspTraceMask = "*+67,GT_prefix=1235,GT_time=3";
        }
        else if (Global_getenv("CE_DEBUG")[0] == '2') {
            GT_set(
                "*+01234567,CE-3,ti.sdo.ce.osal.SemMP=67,OG=467,OM=4567,OC=67,GT_time=0,GT_prefix=1235");
            Engine_ceDebugDspTraceMask =
                "*+01234567,CR=67,ti.sdo.fc.dman3-2,ti.sdo.fc.dskt2-2,GT_prefix=1235,GT_time=3";
        } else {
            GT_set("*+01234567,CE-3,GT_time=0,GT_prefix=12345");
            Engine_ceDebugDspTraceMask = "*+01234567,GT_prefix=12345,GT_time=3";
        }
    }

    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;
            /* turn on all GT_7CLASS trace (errors) */
            GT_set("*+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. */
    GT_set(Global_getenv("CE_TRACE"));
    IPC_generatedInit();
    Global_init();

    Sem_init();
    SemMP_init();


    Memory_init();
    Queue_init();
    Comm_init();
    Thread_init();
    Processor_init();
    LockMP_init();  /* Must be called before DMAN3_init() */
    Algorithm_init();
    XdmUtils_init();
    Lock_init();

    Engine_init();
    Server_init();

}
static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)
{
	int status;
	u32 initStatus;
	u32 temp;
	dev_t   dev = 0 ;
	int     result;
	struct dspbridge_platform_data *pdata = pdev->dev.platform_data;

	omap_dspbridge_dev = pdev;

	/* use 2.6 device model */
	result = alloc_chrdev_region(&dev, 0, 1, driver_name);
	if (result < 0) {
		pr_err("%s: Can't get major %d\n", __func__, driver_major);
		goto err1;
	}

	driver_major = MAJOR(dev);

	cdev_init(&bridge_cdev, &bridge_fops);
	bridge_cdev.owner = THIS_MODULE;

	status = cdev_add(&bridge_cdev, dev, 1);
	if (status) {
		pr_err("%s: Failed to add bridge device\n", __func__);
		goto err2;
	}

	/* udev support */
	bridge_class = class_create(THIS_MODULE, "ti_bridge");

	if (IS_ERR(bridge_class))
		pr_err("%s: Error creating bridge class\n", __func__);

	device_create(bridge_class, NULL, MKDEV(driver_major, 0),
			NULL, "DspBridge");

	bridge_create_sysfs();

	GT_init();
	GT_create(&driverTrace, "LD");

#ifdef CONFIG_BRIDGE_DEBUG
	if (GT_str)
		GT_set(GT_str);
#elif defined(DDSP_DEBUG_PRODUCT) && GT_TRACE
	GT_set("**=67");
#endif

#ifdef CONFIG_PM
	/* Initialize the wait queue */
	bridge_suspend_data.suspended = 0;
	init_waitqueue_head(&bridge_suspend_data.suspend_wq);
#endif

	SERVICES_Init();

	/*  Autostart flag.  This should be set to true if the DSP image should
	 *  be loaded and run during bridge module initialization  */

	if (base_img) {
		temp = true;
		REG_SetValue(AUTOSTART, (u8 *)&temp, sizeof(temp));
		REG_SetValue(DEFEXEC, (u8 *)base_img, strlen(base_img) + 1);
	} else {
		temp = false;
		REG_SetValue(AUTOSTART, (u8 *)&temp, sizeof(temp));
		REG_SetValue(DEFEXEC, (u8 *) "\0", (u32)2);
	}

	if (shm_size >= 0x10000) {	/* 64 KB */
		initStatus = REG_SetValue(SHMSIZE, (u8 *)&shm_size,
				sizeof(shm_size));
	} else {
		initStatus = DSP_EINVALIDARG;
		status = -1;
		pr_err("%s: SHM size must be at least 64 KB\n", __func__);
	}
	GT_1trace(driverTrace, GT_7CLASS,
		 "requested shm_size = 0x%x\n", shm_size);

	if (pdata->phys_mempool_base && pdata->phys_mempool_size) {
		phys_mempool_base = pdata->phys_mempool_base;
		phys_mempool_size = pdata->phys_mempool_size;
	}

	GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_base = 0x%x \n",
		 phys_mempool_base);

	GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_size = 0x%x\n",
		 phys_mempool_base);

	if ((phys_mempool_base > 0x0) && (phys_mempool_size > 0x0))
		MEM_ExtPhysPoolInit(phys_mempool_base, phys_mempool_size);
	if (tc_wordswapon) {
		GT_0trace(driverTrace, GT_7CLASS, "TC Word Swap is enabled\n");
		REG_SetValue(TCWORDSWAP, (u8 *)&tc_wordswapon,
				sizeof(tc_wordswapon));
	} else {
		GT_0trace(driverTrace, GT_7CLASS, "TC Word Swap is disabled\n");
		REG_SetValue(TCWORDSWAP, (u8 *)&tc_wordswapon,
				sizeof(tc_wordswapon));
	}
	if (DSP_SUCCEEDED(initStatus)) {
#ifdef CONFIG_BRIDGE_DVFS
		clk_handle = clk_get(NULL, "iva2_ck");
		if (!clk_handle)
			pr_err("%s: clk_get failed to get iva2_ck\n", __func__);

		if (clk_notifier_register(clk_handle, &iva_clk_notifier))
			pr_err("%s: clk_notifier_register failed for iva2_ck\n",
								__func__);

		if (!min_dsp_freq)
			min_dsp_freq = pdata->mpu_min_speed;
#endif
		driverContext = DSP_Init(&initStatus);
		if (DSP_FAILED(initStatus)) {
			status = -1;
			pr_err("DSP Bridge driver initialization failed\n");
		} else {
			pr_info("DSP Bridge driver loaded\n");
		}
	}
#ifdef CONFIG_BRIDGE_RECOVERY
	bridge_rec_queue = create_workqueue("bridge_rec_queue");
	INIT_WORK(&bridge_recovery_work, bridge_recover);
	INIT_COMPLETION(bridge_comp);
#endif

	DBC_Assert(status == 0);
	DBC_Assert(DSP_SUCCEEDED(initStatus));

	return 0;

err2:
	unregister_chrdev_region(dev, 1);
err1:
	return result;
}