Commit 05f63dea authored by Joanne Hugé's avatar Joanne Hugé

wip: structs

parent 9b28bca2
...@@ -399,6 +399,7 @@ static void *recv_thread(void *p) { ...@@ -399,6 +399,7 @@ static void *recv_thread(void *p) {
cpu_set_t mask; cpu_set_t mask;
int stop = 0; int stop = 0;
int prev_seq_id = -1; int prev_seq_id = -1;
uint16_t antenna_id;
struct mmsghdr msgh[MAX_RX_BURST]; struct mmsghdr msgh[MAX_RX_BURST];
struct iovec msgv[MAX_RX_BURST]; struct iovec msgv[MAX_RX_BURST];
ecpri_header * header; ecpri_header * header;
...@@ -471,21 +472,22 @@ static void *recv_thread(void *p) { ...@@ -471,21 +472,22 @@ static void *recv_thread(void *p) {
stop = 1; break; stop = 1; break;
} }
// Exit if antenna ID is not in range // Exit if antenna ID is not in range
if(header->antenna_id > s->rx_n_channel || header->antenna_id < 0) { antenna_id = ntohs(header->antenna_id);
log_info("DECODE_THREAD", "Wrong Antenna ID: %d\n", header->antenna_id); if(antenna_id > s->rx_n_channel || antenna_id < 0) {
log_info("DECODE_THREAD", "Wrong Antenna ID: %d\n", antenna_id);
stop = 1; break; stop = 1; break;
} }
// Exit if there is no more space in the buffer // Exit if there is no more space in the buffer
if(!rbuf_write_amount(&trxr_rbuf[header->antenna_id])) if(!rbuf_write_amount(&trxr_rbuf[antenna_id]))
log_exit("DECODE_THREAD", "No more space in %s buffer", log_exit("DECODE_THREAD", "No more space in %s buffer",
trxr_rbuf[header->antenna_id].name); trxr_rbuf[antenna_id].name);
prev_seq_id = header->seq_id; prev_seq_id = header->seq_id;
iq_packet = (ecpri_iq_packet*) (rx_buf + j * PACKET_SIZE); iq_packet = (ecpri_iq_packet*) (rx_buf + j * PACKET_SIZE);
memcpy(trxr_rbuf[header->antenna_id].buffer, memcpy(trxr_rbuf[antenna_id].buffer,
iq_packet->iq_samples, iq_packet->iq_samples,
IQ_PAYLOAD); IQ_PAYLOAD);
rbuf_increment_write(&trxr_rbuf[header->antenna_id], IQ_PAYLOAD); rbuf_increment_write(&trxr_rbuf[antenna_id], IQ_PAYLOAD);
update_counter(&recv_counter, 1); update_counter(&recv_counter, 1);
} }
if(stop) { if(stop) {
...@@ -548,7 +550,7 @@ static void *send_thread(void *p) { ...@@ -548,7 +550,7 @@ static void *send_thread(void *p) {
iq_packet = (ecpri_iq_packet*) (tx_buf + encoded * PACKET_SIZE); iq_packet = (ecpri_iq_packet*) (tx_buf + encoded * PACKET_SIZE);
// PC_ID // PC_ID
iq_packet->antenna_id = ntohs(antenna_id); iq_packet->antenna_id = htons(antenna_id);
// SEQ_ID // SEQ_ID
iq_packet->seq_id = (uint8_t) tx_seq_id; iq_packet->seq_id = (uint8_t) tx_seq_id;
tx_seq_id = (tx_seq_id + 1) % 256; tx_seq_id = (tx_seq_id + 1) % 256;
...@@ -796,6 +798,7 @@ int start(TRXEcpriState * s) { ...@@ -796,6 +798,7 @@ int start(TRXEcpriState * s) {
/* Common Header */ /* Common Header */
iq_packet.ecpri_version = 0x10; // Version 0x1, Reserved = 0, C = 0 iq_packet.ecpri_version = 0x10; // Version 0x1, Reserved = 0, C = 0
iq_packet.ecpri_type = 0x00; // Message type (IQ data) iq_packet.ecpri_type = 0x00; // Message type (IQ data)
iq_packet.payload_size = (uint16_t) IQ_PAYLOAD;
iq_packet.seq_id_fixed = 0x80; iq_packet.seq_id_fixed = 0x80;
/* ORAN HEADER */ /* ORAN HEADER */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment