Figure 29 shows the sample code that initializes and configures UMX.
void RadioConfig()
{
SoraURadioStart(TARGET_RADIO);
SoraURadioSetRxPA (TARGET_RADIO, SORA_RADIO_DEFAULT_RX_PA);
SoraURadioSetRxGain (TARGET_RADIO, SORA_RADIO_DEFAULT_RX_GAIN);
SoraURadioSetTxGain (TARGET_RADIO, SORA_RADIO_DEFAULT_TX_GAIN);
SoraURadioSetCentralFreq (TARGET_RADIO, 2422 * 1000);//central frequency: 2422MHz
SoraURadioSetFreqOffset (TARGET_RADIO, -5 * 1000 * 1000); //frequency offset: -5MHz
SoraURadioSetSampleRate (TARGET_RADIO, 40); //sample rate: 40MHz
}
int __cdecl main(int argc, char *argv[])
{
BOOLEAN isTx = FALSE;
// Initialize Sora user mode extension
BOOLEAN succ = SoraUInitUserExtension("\\\\.\\HWTest");
if (!succ)
{
printf("Error: fail to find a Sora UMX capable device!\n");
return -1;
}
RadioConfig();
…
SoraUCleanUserExtension();
return 0;
}
Figure 29. Sample code to initialize and configure UMX.
7.2 Reception
To access the RX channel of a radio object, the UMX application should first call
SoraURadioMapRxSampleBuf to obtain a pointer to the receiving buffer as well as the buffer
size. Then, the UMX application can get a RX_STREAM from the receiving buffer using
SoraURadioAllocRxStream, from which it can read I/Q samples. To read a signal block, the UMX
application needs to call SoraRadioReadRxStream. Before exiting, the UMX application should
call SoraURadioReleaseRxStream to release a RX_STREAM and SoraURadioUnmapRxSampleBuf
to release the memory mapped to the RX buffer of a radio.
Figure 30 shows an example to receive I/Q samples using UMX.
Comments to this Manuals