コード例 #1
0
ファイル: main.cpp プロジェクト: uestclx/Protocol_PC_Card
int main(int argc, char *argv[])
{
    //Initialisation 
    dspReset();
    dspInit();
    dsp_fir_init(&delay_bb_ai[0], FIR_SIZE);
    dsp_fir_init(&delay_bb_ai2[0], FIR_SIZE);
 
    int i;	

    pthread_t mont_rec;
    pthread_t mont_trait;

    //Création et initialisation du buffer
    rec *args =static_cast<rec *> (malloc(sizeof *args));
    (*args).k=0;
    for(i=0;i<nb;i++){
      (*args).start[i]=0;
    }
    
    //Céation des threads
    pthread_create(&mont_trait,NULL,t_trait,args);
    pthread_create(&mont_rec,NULL,t_rec,args);

    pthread_join (mont_rec, NULL);
    pthread_join (mont_trait, NULL);

    return 0;
}
コード例 #2
0
ファイル: ndsp.c プロジェクト: Bownairo/ctrulib
Result ndspInit(void)
{
	Result rc = 0;
	if (AtomicPostIncrement(&ndspRefCount)) return 0;

	if (!componentBin && !ndspFindAndLoadComponent())
	{
		rc = MAKERESULT(RL_PERMANENT, RS_NOTFOUND, 41, RD_NOT_FOUND);
		goto _fail0;
	}

	LightLock_Init(&ndspMutex);
	ndspInitMaster();
	ndspiInitChn();

	rc = cfguInit();
	if (R_SUCCEEDED(rc))
	{
		u8 outMode;
		rc = CFGU_GetConfigInfoBlk2(sizeof(outMode), 0x70001, &outMode);
		if (R_SUCCEEDED(rc))
			ndspMaster.outputMode = outMode;
		cfguExit();
	}

	rc = dspInit();
	if (R_FAILED(rc)) return rc;

	rc = ndspInitialize(false);
	if (R_FAILED(rc)) goto _fail1;

	rc = svcCreateEvent(&sleepEvent, 0);
	if (R_FAILED(rc)) goto _fail2;

	ndspThread = threadCreate(ndspThreadMain, 0x0, NDSP_THREAD_STACK_SIZE, 0x18, -2, true);
	if (!ndspThread) goto _fail3;

	aptHook(&aptCookie, ndspAptHook, NULL);
	return 0;

_fail3:
	svcCloseHandle(sleepEvent);
_fail2:
	ndspFinalize(false);
_fail1:
	dspExit();
	if (componentFree)
	{
		free((void*)componentBin);
		componentBin = NULL;
	}
_fail0:
	AtomicDecrement(&ndspRefCount);
	return rc;
}
コード例 #3
0
void mp45dt02Init(mp45dt02Config *config)
{
#if 0
    PRINT("Initialising mp45dt02.\n\r"
          "mp45dt02I2sData.buffer size: %u words %u bytes\n\r"
          "mp45dt02ExpandedBuffer size: %u words %u bytes\n\r"
          "MP45DT02_DECIMATED_BUFFER_SIZE: %u",
          MP45DT02_I2S_BUFFER_SIZE_2B, sizeof(mp45dt02I2sData.buffer),
          MP45DT02_EXPANDED_BUFFER_SIZE, sizeof(mp45dt02ExpandedBuffer),
          MP45DT02_DECIMATED_BUFFER_SIZE);
#endif

    initConfig = *config;

    chSemObjectInit(&mp45dt02ProcessingSem, 0);

    pMp45dt02ProcessingThd = chThdCreateStatic(mp45dt02ProcessingThdWA,
                                               sizeof(mp45dt02ProcessingThdWA),
                                               NORMALPRIO,
                                               mp45dt02ProcessingThd, NULL);

    dspInit();

    memset(&mp45dt02I2sData, 0, sizeof(mp45dt02I2sData));
    mp45dt02I2sData.guard = MEMORY_GUARD;

    memset(&mp45dt02I2SConfig, 0, sizeof(mp45dt02I2SConfig));
    mp45dt02I2SConfig.tx_buffer = NULL;
    mp45dt02I2SConfig.rx_buffer = mp45dt02I2sData.buffer;
    mp45dt02I2SConfig.size      = MP45DT02_I2S_BUFFER_SIZE_2B;
    mp45dt02I2SConfig.end_cb    = mp45dt02Cb;

    mp45dt02I2SConfig.i2scfgr   = I2SCFG_MODE_MASTER_RECEIVE    |
                                  I2SCFG_STD_MSB_JUSTIFIED      |
                                  I2SCFG_CKPOL_STEADY_HIGH;

    mp45dt02I2SConfig.i2spr     = (SPI_I2SPR_I2SDIV & MP45DT02_I2SDIV) |
                                  (SPI_I2SPR_ODD & (MP45DT02_I2SODD << I2SPR_I2SODD_SHIFT));

    i2sStart(&MP45DT02_I2S_DRIVER, &mp45dt02I2SConfig);
    i2sStartExchange(&MP45DT02_I2S_DRIVER);
}
コード例 #4
0
ファイル: screen.c プロジェクト: IlGuru/Console
void scrInit( FNINPUT fScreenRepaint ) {
	
	dspInit();

	p_screen->x_max		= SCR_XMAX_SIZE;
	p_screen->y_max		= SCR_YMAX_SIZE;
	
	SETBIT(p_screen->status,f_srcContentChanged);
	
	scrClearMemBuf();

#ifdef THREAD_SCREEN_REPAINT
	scrCreateThread( fScreenRepaint );
#else
	if ( fScreenRepaint != NULL ) {
		fScreenRepaint();
	} else {
		scrRepaint();
	}
#endif
	
}