int Sora_SwitchTXFrequency(BlinkParams *params, bool center) { int status = 0; if (true == center) { SoraURadioSetCentralFreq(params->radioParams.radioId, params->radioParams.CentralFrequency); } else { SoraURadioSetCentralFreq(params->radioParams.radioId, params->radioParams.CentralFrequency + 40); } return status; }
void RadioStart(BlinkParams *params) { // Initialize Sora user mode extension BOOLEAN succ = SoraUInitUserExtension("\\\\.\\HWTest"); if (!succ) { printf("Error: fail to find a Sora UMX capable device!\n"); exit(1); } // always start radio first, it will reset radio to the default setting SoraURadioStart(params->radioParams.radioId); SoraURadioSetRxPA(params->radioParams.radioId, params->radioParams.RXpa); SoraURadioSetRxGain(params->radioParams.radioId, params->radioParams.RXgain); SoraURadioSetTxGain(params->radioParams.radioId, params->radioParams.TXgain); SoraURadioSetCentralFreq(params->radioParams.radioId, params->radioParams.CentralFrequency); SoraURadioSetFreqOffset(params->radioParams.radioId, params->radioParams.FreqencyOffset); SoraURadioSetSampleRate(params->radioParams.radioId, params->radioParams.SampleRate); params->TXBuffer = NULL; params->pRxBuf = NULL; // DEBUG printf("RadioID: %ld, RX_PA: %ld, RX_Gain: %ld, TX_Gain: %ld, Central Freq: %ld, Freq Offset: %ld, Sample Rate: %ld\n", params->radioParams.radioId, params->radioParams.RXpa, params->radioParams.RXgain, params->radioParams.TXgain, params->radioParams.CentralFrequency, params->radioParams.FreqencyOffset, params->radioParams.SampleRate); }
void RadioStart(BlinkParams *params) { // always start radio first, it will reset radio to the default setting SoraURadioStart(params->radioParams.radioId); if (params->radioParams.radioId == TARGET_RADIO_RX) { SoraURadioSetRxPA(params->radioParams.radioId, params->radioParams.RXpa); SoraURadioSetRxGain(params->radioParams.radioId, params->radioParams.RXgain); } if (params->radioParams.radioId == TARGET_RADIO_TX) { printf("RADIO=%lu, GAIN=%lu\n", params->radioParams.radioId, params->radioParams.TXgain); SoraURadioSetTxGain(params->radioParams.radioId, params->radioParams.TXgain); } // DEBUG SoraURadioSetCentralFreq(params->radioParams.radioId, params->radioParams.CentralFrequency); //SoraUWriteRadioRegister(TARGET_RADIO_TX, 0x07, params->radioParams.CentralFrequency); // This is not supported with TVWS MIMO: //SoraURadioSetFreqOffset(params->radioParams.radioId, params->radioParams.FreqencyOffset); // Instead we write this (where FreqencyOffset is in 1/4096 MHz): SoraUWriteRadioRegister(params->radioParams.radioId, 0x09, params->radioParams.FreqencyOffset); /* if (params->radioParams.radioId == TARGET_RADIO_TX) { //SoraUWriteRadioRegister(TARGET_RADIO_TX, 0x07, 500); //SoraUWriteRadioRegister(TARGET_RADIO_TX, 0x09, params->radioParams.FreqencyOffset); //SoraUWriteRadioRegister(TARGET_RADIO_TX, 0x09, 600); SoraUWriteRadioRegister(TARGET_RADIO_TX, 0x09, params->radioParams.FreqencyOffset); } */ SoraURadioSetSampleRate(params->radioParams.radioId, params->radioParams.SampleRate); params->TXBuffer = NULL; params->pRxBuf = NULL; // DEBUG printf("RadioID: %ld, RXpa: %ld, RXgain: %ld, TXgain: %ld, CentralFrequency: %ld, FreqencyOffset: %ld, SampleRate: %ld\n", params->radioParams.radioId, params->radioParams.RXpa, params->radioParams.RXgain, params->radioParams.TXgain, params->radioParams.CentralFrequency, params->radioParams.FreqencyOffset, params->radioParams.SampleRate); hDeviceHandle = GetDeviceHandle(DEVNAME); if (hDeviceHandle == INVALID_HANDLE_VALUE) { printf("Can't find device %s\n", DEVNAME); exit(1); } }
void ConfigureRadio () { // Start Radio SoraURadioStart (TARGET_RADIO); Sleep (10); SoraURadioSetCentralFreq (TARGET_RADIO, gRadioInfo.CentralFreq() * 1000); // Set Tx Gain to a fixed value SoraURadioSetTxGain ( TARGET_RADIO, gRadioInfo.TxGain () ); // Set the Receiver Gain SoraURadioSetRxPA (TARGET_RADIO, gRadioInfo.RxPA() ); SoraURadioSetRxGain (TARGET_RADIO, gRadioInfo.RxGain() ); }