static int gpib_send_cmd(char data) { hal_gpib_set_signal_true(ATN_PIN); int val = gpib_send(data); hal_gpib_set_signal_false(ATN_PIN); return val; }
void analyzer(unsigned int gpib_card,unsigned int gpib_device,unsigned int freqband,LTE_DL_FRAME_PARMS *frame_parms,DCI_ALLOC_t *dci_alloc) { char string[256]; //Start the remote control gpib_send(gpib_card,gpib_device,"*RST;*CLS"); //reset and configure the signal analyzer gpib_send(gpib_card,gpib_device,"CONF:PRES"); gpib_send(gpib_card,gpib_device,"CALC1:FEED 'CONS:CONS'"); gpib_send(gpib_card,gpib_device,"INIT"); //select the duplexing mode if (frame_parms->frame_type == 0) gpib_send(gpib_card,gpib_device,"CONF:DUPL FDD"); else gpib_send(gpib_card,gpib_device,"CONF:DUPL TDD"); //set the direction into DL gpib_send(gpib_card,gpib_device,"CONF:LDIR DL"); //carrier frequency gpib_send(gpib_card,gpib_device,"FREQ:CENT 1.2GHZ"); //input source gpib_send(gpib_card,gpib_device,"INP RF"); //RF attenuation gpib_send(gpib_card,gpib_device,"INP:ATT 0"); ////Using a Trigger gpib_send(gpib_card,gpib_device,"TRIG:MODE IMM"); //Selects free run trigger source // number of frames to be selected gpib_send(gpib_card,gpib_device,"FRAM:COUN:STAT ON"); gpib_send(gpib_card,gpib_device,"FRAM:COUN 4"); //select all the subframes gpib_send(gpib_card,gpib_device,"SUBF:SEL ALL"); //Identifies the configuration according to the data in the PDCCH DCIs gpib_send(gpib_card,gpib_device,"DL:FORM:PSCD PDCCH"); //sets the number of resource blocks to 25 sprintf(string,"CONF:DL:NORB %d",frame_parms->N_RB_DL); gpib_send(gpib_card,gpib_device,string); //set the prefix of the subframes if (frame_parms->Ncp == 0) gpib_send(gpib_card,gpib_device,"CONF:DL:CYCP NORM"); else gpib_send(gpib_card,gpib_device,"CONF:DL:CYCP EXT"); //select the UL/DL subframe configuration for downlink signals sprintf(string,"CONF:DL:TDD:UDC %d",frame_parms->tdd_config); gpib_send(gpib_card,gpib_device,string); //sets the UL/DL configuration into 3 //Selects the configuration of a TDD special subframe sprintf(string,"CONF:DL:TDD:UDC %d",frame_parms->tdd_config_S); gpib_send(gpib_card,gpib_device,string); //sets the special subframe configuration into 0 }
void pucchsignalG(unsigned int gpib_card,unsigned int gpib_device,unsigned int freqband,LTE_DL_FRAME_PARMS *frame_parms,PUCCH_FMT_t pucch_format){ char string[256]; //void *DLSCH_alloc_pdu = (void *)dci_alloc[0].dci_pdu; //Start the configuration gpib_send(gpib_card,gpib_device,"*RST;*CLS"); //reset and configure the signal generator gpib_send(gpib_card,gpib_device,"BB:EUTR:PRES"); gpib_send(gpib_card,gpib_device,"BB:EUTR:STAT ON"); gpib_send(gpib_card,gpib_device,"POW -70dBm"); // set output signal power //gpib_send(gpib_card,gpib_device,"FREQ 1.91"); // set frequency //Selects the duplexing mode if (frame_parms->frame_type == 0) gpib_send(gpib_card,gpib_device,"BB:EUTR:DUPL FDD"); else gpib_send(gpib_card,gpib_device,"BB:EUTR:DUPL TDD"); gpib_send(gpib_card,gpib_device,"BB:EUTR:LINK UP"); gpib_send(gpib_card,gpib_device,"BB:EUTR:SLEN 4"); //sequence length of the signal in number of frames // General EUTRA/LTE Settings sprintf(string,"BB:EUTR:TDD:UDC %d",frame_parms->tdd_config); gpib_send(gpib_card,gpib_device,string); //sets the UL/DL configuration into 3 sprintf(string,"BB:EUTR:TDD:SPSC %d",frame_parms->tdd_config_S); gpib_send(gpib_card,gpib_device,string); //sets the special subframe configuration into 0 //General EUTRA/LTE UPlink Settings gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:BW USER"); //set the bandwidth into 5 MHz ?? sprintf(string,"BB:EUTR:UL:NORB %d",frame_parms->N_RB_UL); //sets the number of resource blocks to 25 gpib_send(gpib_card,gpib_device,string); sprintf(string,"BB:EUTR:UL:PLC:CID %d",frame_parms->Nid_cell); //sets the Cell ID 0 gpib_send(gpib_card,gpib_device,string); if (frame_parms->Ncp == 0) gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:CPC NORM"); //set the prefix of the subframes else gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:CPC EXT"); gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:REFS:GRPH OFF"); //disables group hopping gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:REFS:SEQH OFF"); //disables sequence hopping gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:REFS:SRS:ANST OFF"); //disables the A/N ans SRS simultaneous transmission for UE2 //UL Frame Configuration pucch gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:CONS 10");//10 UL subframes of a frame are configurable gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:SUBF2:ALL0:STAT ON"); //Sets the allocation state to active gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:SUBF2:ALL0:CONT PUCC"); //pucch format if(pucch_format==pucch_format1) { gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:SUBF2:ALL0:FORM F1"); } if(pucch_format==pucch_format1a) { gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:SUBF2:ALL0:FORM F1A"); } if(pucch_format==pucch_format1b) { gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:SUBF2:ALL0:FORM F1B"); } gpib_send(gpib_card,gpib_device,"BB:EUTR:UL:SUBF2:ALL0:VRB 2"); //sets the VRB Offset //RF signal setting gpib_send(gpib_card,gpib_device,"FREQ 1.2GHz"); gpib_send(gpib_card,gpib_device,"SOUR:POW:POW -50"); gpib_send(gpib_card,gpib_device,"SYSTem:ERRor?"); gpib_send(gpib_card,gpib_device,"OUTP ON"); }
void calibration(unsigned int gpib_card,unsigned int gpib_device,unsigned int freqband,LTE_DL_FRAME_PARMS *frame_parms,DCI_ALLOC_t *dci_alloc){ char string[256]; void *DLSCH_alloc_pdu = (void *)dci_alloc[0].dci_pdu; //Start the configuration gpib_send(gpib_card,gpib_device,"*RST;*CLS"); //reset and configure the signal generator gpib_send(gpib_card,gpib_device,"BB:EUTR:PRES"); gpib_send(gpib_card,gpib_device,"BB:EUTR:STAT ON"); gpib_send(gpib_card,gpib_device,"POW -70dBm"); // set output signal power //gpib_send(gpib_card,gpib_device,"FREQ 1.91"); // set frequency //Selects the duplexing mode if (frame_parms->frame_type == 0) gpib_send(gpib_card,gpib_device,"BB:EUTR:DUPL FDD"); else gpib_send(gpib_card,gpib_device,"BB:EUTR:DUPL TDD"); gpib_send(gpib_card,gpib_device,"BB:EUTR:LINK DOWN"); //gpib_send(gpib_card,gpib_device,"BB:EUTR:SETT:TMOD:DL 'E-TM1_1__20MHz'"); //EUTRA test model gpib_send(gpib_card,gpib_device,"BB:EUTR:SLEN 4"); //sequence length of the signal in number of frames /* //Filter/Clipping/Power Settings gpib_send(gpib_card,gpib_device,"BB:EUTR:FILT:TYPE LTEF"); //set the filter type into LET filter gpib_send(gpib_card,gpib_device,"BB:EUTR:FILT:MODE RT"); //select a realtime filter mode gpib_send(gpib_card,gpib_device,"BB:EUTR:FILT:PAR:LTE:COFF 0.35"); // set the roll-off factor for LTE filter gpib_send(gpib_card,gpib_device,"BB:EUTR:FILT:PAR:LTE:COFS -0.3"); //set the cut of the frequency for LET filter, here -0.3 the BW is 20 MHz gpib_send(gpib_card,gpib_device,"BB:EUTR:FILT:PAR:LTE:OPT ACPN"); //selects ACP (Narrow) optimization gpib_send(gpib_card,gpib_device,"BB:EUTR:FILT:PAR:LTE:ROF 0.2"); //the roll-off factor is set to 0.2. // the clock setting gpib_send(gpib_card,gpib_device,"BB:EUTR:CLOC:SOUR EXT"); //Selects the clock source gpib_send(gpib_card,gpib_device,"BB:EUTR:CLOC:MODE SAMP"); //selects clock type SAMPle gpib_send(gpib_card,gpib_device,"BB:EUTR:CLOC:SYNC:MODE MAST"); //the instrument is configured to work as a master one. gpib_send(gpib_card,gpib_device,"BB:EUTR:CLOCK:SYNC:EXEC"); //all synchronization's settings are adjusted accordingly */ // General EUTRA/LTE Settings sprintf(string,"BB:EUTR:TDD:UDC %d",frame_parms->tdd_config); gpib_send(gpib_card,gpib_device,string); //sets the UL/DL configuration into 3 sprintf(string,"BB:EUTR:TDD:SPSC %d",frame_parms->tdd_config_S); gpib_send(gpib_card,gpib_device,string); //sets the special subframe configuration into 0 //General EUTRA/LTE Downlink Settings gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:CONF:MODE AUTO"); //Determines whether the configuration and scheduling of the different PDSCH allocations //inside of the DL allocation table is performed manual or according to the configuration //made for the DCIs //sets the MIMO configuration to 1 TxAntenna sprintf(string,"BB:EUTR:DL:MIMO:CONF TX%d",frame_parms->nb_antennas_tx); gpib_send(gpib_card,gpib_device,string); gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:MIMO:ANTA ANT1"); //Sets the simulated antenna for path A, selesct antenna 1 gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:MIMO:ANTB NONE"); //Set the Simulation antenna for path B, we Just have one antenna, so for path B, no antenna gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SYNC:TXAN ALL"); //enables all antennas port to transmit P-/S-SYNC gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:BW USER"); //selects a downlink frequency band of USER //sets the number of resource blocks to 25 sprintf(string,"BB:EUTR:DL:NORB %d",frame_parms->N_RB_DL); gpib_send(gpib_card,gpib_device,string); //size of FFT //sprintf(string,"BB:EUTR:DL:FFT %d",frame_parms->ofdm_symbol_size); //depends on the number of resource block //gpib_send(gpib_card,gpib_device,string); //sets the Cell ID 0 sprintf(string,"BB:EUTR:DL:PLC:CID %d",frame_parms->Nid_cell); gpib_send(gpib_card,gpib_device,string); //gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:PLC:PLID 2"); //physical layer is 2 //set the prefix of the subframes if (frame_parms->Ncp == 0) gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:CPC NORM"); else gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:CPC EXT"); //DL Frame Configuration gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:VIEW:MODE PRB"); //Determines the time plan shows the allocated Physical Resource Blocks gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:BUR DUD"); //the unscheduled resource elements are filled with dummy data. gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SFS 6"); //displays subframe 6 in the allocation list view. gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ALC 1"); gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ALL1:CW:AOC ON"); gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ALL1:CW:CONT PDSC"); //selects PDSCH as type for the selected allocation gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ALL1:CW1:MOD QPSK");//choose modulation QPSK gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF4:ALL1:CW:DATA USER1"); // user1 is the data source for the selected allocation gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ALL1:CW:STAT ON"); //activates the selected allocation. //PDCCH & PSCH configuration gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:STAT ON"); //enables PDCCH allocation //gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PREC:SCH TXD"); gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:SCR:STAT ON"); //enables scrambling gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:FORM VAR"); //sets the PDCCH format into VAR gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:RES"); //reset the table table //gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:SIT 0"); //selects the first row in the DCI table gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:APP"); //sets the n_RNTI into 1234 sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:UEID %d",dci_alloc->rnti); gpib_send(gpib_card,gpib_device,string); sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:UEID %d",dci_alloc->rnti); gpib_send(gpib_card,gpib_device,string); //sets the DCI format into 1 sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIF F%d",dci_alloc->format); gpib_send(gpib_card,gpib_device,string); gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:PFMT 0"); //Sets the PDCCH format for the selected PDCCH into 0 gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:F1AM PDSC");//Selects the mode of the DCI format //gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF1:ENCC:PDCC:EXTC:USER USER1"); //the DCI is dedicated to User 1 gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:SESP OFF"); //the DCI is transmitted within the common or UE-specific search OFF if(dci_alloc->format==format1){ //sets the HARQ process number sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:HPN %d",((DCI1_5MHz_TDD_t*) DLSCH_alloc_pdu)->harq_pid); gpib_send(gpib_card,gpib_device,string); //sets the Modulation and Coding Scheme sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:MCSR %d",((DCI1_5MHz_TDD_t*)DLSCH_alloc_pdu)->mcs); gpib_send(gpib_card,gpib_device,string); //sets the New Data Indicator if(((DCI1_5MHz_TDD_t*)DLSCH_alloc_pdu)->ndi==1) gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:NDI ON"); else gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:NDI OFF"); //disables Resource Allocation Header if(((DCI1_5MHz_TDD_t*)DLSCH_alloc_pdu)->rah==1) gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:RAH ON"); else gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:RAH OFF"); //sets Resource Block Assignment sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:RBA %d",((DCI1_5MHz_TDD_t*)DLSCH_alloc_pdu)->rballoc ); gpib_send(gpib_card,gpib_device,string); //sets the Redundancy Version sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:RV %d",((DCI1_5MHz_TDD_t*)DLSCH_alloc_pdu)->rv ); gpib_send(gpib_card,gpib_device,string); //sets the TPC Command for PUSCH sprintf(string,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:ITEM1:DCIC:TPCC %d",((DCI1_5MHz_TDD_t*)DLSCH_alloc_pdu)->TPC ); gpib_send(gpib_card,gpib_device,string); } gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:SIT 0"); gpib_send(gpib_card,gpib_device,"BB:EUTR:DL:SUBF6:ENCC:PDCC:EXTC:DEL"); //gpib_send(gpib_card,gpib_device,"AWGN:STAT ON"); // to add noise in the system gpib_send(gpib_card,gpib_device,"FREQ 1.2GHz"); gpib_send(gpib_card,gpib_device,"SOUR:POW:POW -50"); gpib_send(gpib_card,gpib_device,"SYSTem:ERRor?"); gpib_send(gpib_card,gpib_device,"OUTP ON"); }
int GPIB_Send(GPIB_Command cmd, char data) { char code; switch (cmd) { case ATN: if (data) hal_gpib_set_signal_true(ATN_PIN); else hal_gpib_set_signal_false(ATN_PIN); break; case IFC: if (data) hal_gpib_set_signal_true(IFC_PIN); else hal_gpib_set_signal_false(IFC_PIN); break; case SRQ: if (data) hal_gpib_set_signal_true(SRQ_PIN); else hal_gpib_set_signal_false(SRQ_PIN); break; case REN: if (data) hal_gpib_set_signal_true(REN_PIN); else hal_gpib_set_signal_false(REN_PIN); break; case EOI: if (data) hal_gpib_set_signal_true(EOI_PIN); else hal_gpib_set_signal_false(EOI_PIN); break; case MLA: code = MLA_CODE; break; case MTA: code = MTA_CODE; break; case LAD: code = LAD_CODE + data; break; case UNL: code = UNL_CODE; break; case TAD: code = TAD_CODE + data; break; case UNT: code = UNT_CODE; break; case SAD: code = SAD_CODE + data; break; case LLO: code = LLO_CODE; break; case DCL: code = DCL_CODE; break; case PPU: code = PPU_CODE; break; case _SPE: code = SPE_CODE; break; case SPD: code = SPD_CODE; break; case GTL: code = GTL_CODE; break; case SDC: code = SDC_CODE; break; case PPC: code = PPC_CODE; break; case GET: code = GET_CODE; break; case TCT: code = TCT_CODE; break; case PPE: code = PPE_CODE; break; case PPD: code = PPD_CODE; break; case DAB: hal_gpib_set_signal_false(ATN_PIN); return gpib_send(data); default: assert(0); } return gpib_send_cmd(code); }