/** * @function ARB_Run * @brief start / resume the arbitrary handler * @param arb_st *arb: pointer to the arbitrary waveform handler * @return none */ void ARB_Run(arb_st *arb) { if(arb != NULL) { arb->run = 1; currentArb = arb; /*DDS on*/ AD9834_Resume(0); switch(arb->waveformType) { /*<noise> special case: overwrite frequency with MAX_SAMPLE_PER_SECOND*/ case ARB_WAVE_NOISE: TmrSetCallback(ARB_TIMER, ARB_IsrNoise); TmrSetFrequency(ARB_TIMER, MAX_SAMPLE_PER_SECOND); TmrLaunch(ARB_TIMER); break; /*<wav> special case: timer & ISR are directly handled by OpenWav()*/ case ARB_WAVE_WAV: if(WavGetStatus() == WAV_STOPPED) { OpenWav("waveform.wav"); } WavPlay(arb->pOut); break; /*analog in: special ISR*/ case ARB_WAVE_ANA_IN: TmrSetCallback(ARB_TIMER, ARB_IsrAnaIn); TmrLaunch(ARB_TIMER); break; /*for all other waveforms: just start the timer with the default ISR*/ default: TmrSetCallback(ARB_TIMER, ARB_IsrStd); TmrLaunch(ARB_TIMER); break; } } }
TInt E32Main() { TInt r; __UHEAP_MARK; Test.Title(); Test.Start(_L("Load")); if (Load()==KErrNotFound) { Test.Printf(_L("Shared chunk sound driver not supported - test skipped\r\n")); Test.End(); Test.Close(); __UHEAP_MARKEND; return(KErrNone); } __KHEAP_MARK; Test.Next(_L("Open playback channel")); r = TxSoundDevice.Open(KSoundScTxUnit0); if (r!=KErrNone) { Test.Printf(_L("Open playback channel error(%d)\r\n"),r); Test(0); } Test.Next(_L("Open record channel")); r = RxSoundDevice.Open(KSoundScRxUnit0); if (r!=KErrNone) { Test.Printf(_L("Open record channel error(%d)\r\n"),r); Test(0); } Test.Next(_L("Query play formats supported")); TxSoundDevice.Caps(PlayCapsBuf); TSoundFormatsSupportedV02 playCaps=PlayCapsBuf(); PrintCaps(playCaps,Test); Test.Next(_L("Query record formats supported")); RxSoundDevice.Caps(RecordCapsBuf); TSoundFormatsSupportedV02 recordCaps=RecordCapsBuf(); PrintCaps(recordCaps,Test); Test.Next(_L("Connect to the file server")); r = Fs.Connect(); if (r!=KErrNone) { Test.Printf(_L("Connect to the file server error(%d)\r\n"),r); Test(0); } if (User::CommandLineLength()) { User::CommandLine(CommandLine); TLex l(CommandLine); TPtrC token=l.NextToken(); TInt count=0; while (token.Length()!=0) { ++count; token.Set(l.NextToken()); } Test.Printf(_L("Command line %d parameters\r\n"),count); if (count==1) // If 1 parameter try playing a file r=WavPlay(); else if (count) // If there is more than 1 parameter, try recording r=WavRecord(); //TestWaveformGenerator(); } Fs.Close(); Test.Next(_L("Close channels")); RxSoundDevice.Close(); TxSoundDevice.Close(); __KHEAP_MARKEND; // Now that both the channels are closed, unload the LDD and the PDDs. TestUnloadDrivers(); Test(r==KErrNone); Test.End(); Test.Close(); Cleanup(); __UHEAP_MARKEND; return(KErrNone); }