mirror of https://github.com/PentHertz/srsLTE.git
PCAP expects packeted bitstream
This commit is contained in:
parent
1fa51912a7
commit
d2c30bc8dc
|
@ -60,7 +60,6 @@ class mac : public timer_callback
|
|||
{
|
||||
public:
|
||||
mac() : timers_db((uint32_t) NOF_MAC_TIMERS), tr_end_time(1024*10), tr_start_time(1024*10) {started=false;}
|
||||
~mac();
|
||||
bool init(phy *phy_h, tti_sync *ttisync, log *log_h, bool pcap_=false);
|
||||
void stop();
|
||||
int get_tti();
|
||||
|
|
|
@ -230,6 +230,7 @@ private:
|
|||
uint8_t ce_payload[MAX_CE_PAYLOAD_LEN*8];
|
||||
uint32_t sizeof_ce(uint32_t lcid, bool is_ul);
|
||||
uint8_t buff_size_table(uint32_t buffer_size);
|
||||
|
||||
};
|
||||
|
||||
class sch_pdu : public pdu<sch_subh>
|
||||
|
@ -250,6 +251,9 @@ public:
|
|||
bool update_space_sdu(uint32_t nbytes);
|
||||
bool update_space_sdu(uint32_t nbytes, bool is_first);
|
||||
void fprint(FILE *stream);
|
||||
private:
|
||||
uint8_t pdu_pcap_tmp[1024*64];
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -40,13 +40,6 @@
|
|||
namespace srslte {
|
||||
namespace ue {
|
||||
|
||||
mac::~mac()
|
||||
{
|
||||
if(pcap && pcap_file) {
|
||||
MAC_LTE_PCAP_Close(pcap_file);
|
||||
}
|
||||
}
|
||||
|
||||
bool mac::init(phy *phy_h_, tti_sync* ttisync_, log* log_h_, bool pcap_)
|
||||
{
|
||||
started = false;
|
||||
|
@ -83,6 +76,10 @@ bool mac::init(phy *phy_h_, tti_sync* ttisync_, log* log_h_, bool pcap_)
|
|||
|
||||
void mac::stop()
|
||||
{
|
||||
if (pcap && pcap_file) {
|
||||
MAC_LTE_PCAP_Close(pcap_file);
|
||||
printf("Closing MAC PCAP file\n");
|
||||
}
|
||||
started = false;
|
||||
pthread_join(mac_thread, NULL);
|
||||
}
|
||||
|
@ -159,7 +156,7 @@ void* mac::mac_thread_fnc(void *arg) {
|
|||
|
||||
void mac::main_radio_loop() {
|
||||
setup_timers();
|
||||
while(1) {
|
||||
while(started) {
|
||||
if (!is_synchronized) {
|
||||
srslte_cell_t cell;
|
||||
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
||||
|
|
|
@ -100,7 +100,8 @@ void sch_pdu::parse_packet(uint8_t *ptr, FILE *pcap_file)
|
|||
4 /* Subframe number */
|
||||
};
|
||||
|
||||
MAC_LTE_PCAP_WritePDU(pcap_file, &context, ptr, pdu_len);
|
||||
srslte_bit_unpack_vector(ptr, pdu_pcap_tmp, pdu_len*8);
|
||||
MAC_LTE_PCAP_WritePDU(pcap_file, &context, pdu_pcap_tmp, pdu_len);
|
||||
fprintf(stdout, "Wrote DL MAC PDU, len=%d\n", pdu_len);
|
||||
}
|
||||
|
||||
|
@ -202,7 +203,8 @@ bool sch_pdu::write_packet(uint8_t* ptr, FILE *pcap_file)
|
|||
4 /* Subframe number */
|
||||
};
|
||||
|
||||
MAC_LTE_PCAP_WritePDU(pcap_file, &context, init_ptr, pdu_len);
|
||||
srslte_bit_unpack_vector(init_ptr, pdu_pcap_tmp, pdu_len*8);
|
||||
MAC_LTE_PCAP_WritePDU(pcap_file, &context, pdu_pcap_tmp, pdu_len);
|
||||
fprintf(stdout, "Wrote UL MAC PDU, len=%d\n", pdu_len);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,18 +308,22 @@ srslte::radio_uhd radio_uhd;
|
|||
srslte::ue::phy phy;
|
||||
srslte::ue::mac mac;
|
||||
|
||||
prog_args_t prog_args;
|
||||
|
||||
void sig_int_handler(int signo)
|
||||
{
|
||||
if (prog_args.do_trace) {
|
||||
//radio_uhd.write_trace("radio");
|
||||
phy.write_trace("phy");
|
||||
mac.write_trace("mac");
|
||||
}
|
||||
mac.stop();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
prog_args_t prog_args;
|
||||
srslte::ue::tti_sync_cv ttisync(10240);
|
||||
srslte::log_stdout mac_log("MAC"), phy_log("PHY");
|
||||
|
||||
|
@ -336,9 +340,9 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
if (prog_args.do_trace) {
|
||||
// Capture SIGINT to write traces
|
||||
signal(SIGINT, sig_int_handler);
|
||||
if (prog_args.do_trace) {
|
||||
//radio_uhd.start_trace();
|
||||
phy.start_trace();
|
||||
mac.start_trace();
|
||||
|
@ -356,7 +360,7 @@ int main(int argc, char *argv[])
|
|||
phy.init_agc(&radio_uhd, &ttisync, &phy_log);
|
||||
}
|
||||
// Init MAC
|
||||
mac.init(&phy, &ttisync, &mac_log);
|
||||
mac.init(&phy, &ttisync, &mac_log, true);
|
||||
|
||||
// Set RX freq
|
||||
radio_uhd.set_rx_freq(prog_args.uhd_rx_freq);
|
||||
|
|
Loading…
Reference in New Issue