mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
				synced 2025-11-04 06:03:17 +00:00 
			
		
		
		
	Transceiver: Move nbits burst size calculation to pullRadioVector()
That's where all the filling logic happens, while in driveReceiveFIFO we mostly want to take the burst, generate a message and sent it over the socket. Related: OS#4006 Change-Id: Ib1df10c40d737954904290f57d58b1c77d65f82e
This commit is contained in:
		@@ -643,6 +643,12 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
 | 
				
			|||||||
  bi->toa = toa;
 | 
					  bi->toa = toa;
 | 
				
			||||||
  bi->rxBurst = demodAnyBurst(*burst, mSPSRx, amp, toa, type);
 | 
					  bi->rxBurst = demodAnyBurst(*burst, mSPSRx, amp, toa, type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* EDGE demodulator returns 444 (gSlotLen * 3) bits */
 | 
				
			||||||
 | 
					  if (bi->rxBurst->size() == EDGE_BURST_NBITS)
 | 
				
			||||||
 | 
					    bi->nbits = EDGE_BURST_NBITS;
 | 
				
			||||||
 | 
					  else /* size() here is actually gSlotLen + 8, due to guard periods */
 | 
				
			||||||
 | 
					    bi->nbits = gSlotLen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  delete radio_burst;
 | 
					  delete radio_burst;
 | 
				
			||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -917,7 +923,6 @@ void Transceiver::driveReceiveFIFO(size_t chan)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  double dBm;  // in dBm
 | 
					  double dBm;  // in dBm
 | 
				
			||||||
  int TOAint;  // in 1/256 symbols
 | 
					  int TOAint;  // in 1/256 symbols
 | 
				
			||||||
  unsigned nbits = gSlotLen;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  struct trx_ul_burst_ind bi;
 | 
					  struct trx_ul_burst_ind bi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -927,18 +932,12 @@ void Transceiver::driveReceiveFIFO(size_t chan)
 | 
				
			|||||||
  // Convert -1..+1 soft bits to 0..1 soft bits
 | 
					  // Convert -1..+1 soft bits to 0..1 soft bits
 | 
				
			||||||
  vectorSlicer(bi.rxBurst);
 | 
					  vectorSlicer(bi.rxBurst);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*
 | 
					 | 
				
			||||||
   * EDGE demodulator returns 444 (148 * 3) bits
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  if (bi.rxBurst->size() == gSlotLen * 3)
 | 
					 | 
				
			||||||
    nbits = gSlotLen * 3;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  dBm = bi.rssi + rssiOffset;
 | 
					  dBm = bi.rssi + rssiOffset;
 | 
				
			||||||
  logRxBurst(chan, &bi, dBm);
 | 
					  logRxBurst(chan, &bi, dBm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TOAint = (int) (bi.toa * 256.0 + 0.5); // round to closest integer
 | 
					  TOAint = (int) (bi.toa * 256.0 + 0.5); // round to closest integer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  char burstString[sizeof(struct trxd_hdr_v0) + nbits + 2];
 | 
					  char burstString[sizeof(struct trxd_hdr_v0) + bi.nbits + 2];
 | 
				
			||||||
  struct trxd_hdr_v0* pkt = (struct trxd_hdr_v0*)burstString;
 | 
					  struct trxd_hdr_v0* pkt = (struct trxd_hdr_v0*)burstString;
 | 
				
			||||||
  pkt->common.version = 0;
 | 
					  pkt->common.version = 0;
 | 
				
			||||||
  pkt->common.reserved = 0;
 | 
					  pkt->common.reserved = 0;
 | 
				
			||||||
@@ -948,14 +947,14 @@ void Transceiver::driveReceiveFIFO(size_t chan)
 | 
				
			|||||||
  osmo_store16be(TOAint, &pkt->v0.toa);
 | 
					  osmo_store16be(TOAint, &pkt->v0.toa);
 | 
				
			||||||
  SoftVector::iterator burstItr = bi.rxBurst->begin();
 | 
					  SoftVector::iterator burstItr = bi.rxBurst->begin();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (unsigned i = 0; i < nbits; i++)
 | 
					  for (unsigned i = 0; i < bi.nbits; i++)
 | 
				
			||||||
    pkt->soft_bits[i] = (char) round((*burstItr++) * 255.0);
 | 
					    pkt->soft_bits[i] = (char) round((*burstItr++) * 255.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* +1: Historical reason. There's an uninitizalied byte in there: pkt->soft_bits[bi.nbits] */
 | 
					  /* +1: Historical reason. There's an uninitizalied byte in there: pkt->soft_bits[bi.nbits] */
 | 
				
			||||||
  pkt->soft_bits[nbits + 1] = '\0';
 | 
					  pkt->soft_bits[bi.nbits + 1] = '\0';
 | 
				
			||||||
  delete bi.rxBurst;
 | 
					  delete bi.rxBurst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mDataSockets[chan]->write(burstString, sizeof(struct trxd_hdr_v0) + nbits + 2);
 | 
					  mDataSockets[chan]->write(burstString, sizeof(struct trxd_hdr_v0) + bi.nbits + 2);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Transceiver::driveTxFIFO()
 | 
					void Transceiver::driveTxFIFO()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,7 @@ extern "C" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct trx_ul_burst_ind {
 | 
					struct trx_ul_burst_ind {
 | 
				
			||||||
        SoftVector *rxBurst;
 | 
					        SoftVector *rxBurst;
 | 
				
			||||||
 | 
					        unsigned nbits; // number of symbols per slot in rxBurst, not counting guard periods
 | 
				
			||||||
        GSM::Time burstTime;
 | 
					        GSM::Time burstTime;
 | 
				
			||||||
        double rssi; // in dBFS
 | 
					        double rssi; // in dBFS
 | 
				
			||||||
        double toa;  // in symbols
 | 
					        double toa;  // in symbols
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user