Skip to content
Snippets Groups Projects
Commit 82235bef authored by Cédric Roux's avatar Cédric Roux
Browse files

save

parent bd5e1aa1
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ PROG=oran
OBJS=main.o dl.o ul.o shared_buffer.o utils.o nr.o packetize.o
$(PROG) : $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) -lm
%.o: %.c
$(CC) $(CFLAGS) -c $<
......
......@@ -10,6 +10,9 @@
#include <errno.h>
/* todo: remove, this is for testing */
#include <math.h>
#include "utils.h"
#include "nr.h"
#include "packetize.h"
......@@ -112,6 +115,16 @@ void transmit_dl_u_plane(processor_t *p, int frame, int subframe, int slot, int
rb_count = 100;
next:
int v;
if (rb_start == 100) {
v = 4000;
} else {
v = 0;
}
short *z = (short *)iq;
int pos = 36*12 + cos(2*M_PI*(frame*10+subframe)/(1024))*100;
z[pos*2] = v;
p->st.frame = frame;
p->st.subframe = subframe;
p->st.slot = slot;
......@@ -130,11 +143,14 @@ next:
addr.sll_ifindex = p->interface_index;
errno = 0;
#if 0
{
printf(" f/sf/slot/symbol %d.%d.%d.%d [%d] (start %3d count %3d next seq %d)", frame, subframe, slot, symbol, len, rb_start, rb_count, p->st.seq_id_up_dl);
for (int i = 0; i < 50; i++) printf(" %2.2x", (unsigned char)b[i]);
printf("\n");
}
#endif
if (sendto(p->socket, b, len, 0, (struct sockaddr *)&addr, sizeof(addr)) != len) { perror("send"); }
rb_start += 100;
......
......@@ -11,7 +11,6 @@
} while (0)
#define PUT_BIT(b) do { \
printf("b %d ret %d bit %d out %p\n", (b), ret, bit, out); \
if (ret == size) { printf("buffer too small\n"); return -1; } \
out[ret] &= ~((1) << (7 - bit)); \
out[ret] |= (b) << (7 - bit); \
......@@ -71,13 +70,7 @@ static int make_cp_uldl(packet_config_t *cfg, packet_state_t *st, char *out, int
data_start = ret;
PUT_BITS(cfg->eaxc_id_dl, 16);
if (dl) {
PUT_BITS(st->seq_id_cp_dl, 8);
// st->seq_id_cp_dl++;
} else {
PUT_BITS(st->seq_id_cp_ul, 8);
// st->seq_id_cp_ul++;
}
PUT_BITS(dl ? st->seq_id_cp_dl : st->seq_id_cp_ul, 8);
PUT_BITS(1, 1); /* E bit, always 1 */
PUT_BITS(0, 7); /* subsequence ID, always 0 */
......@@ -121,7 +114,7 @@ static int make_cp_uldl(packet_config_t *cfg, packet_state_t *st, char *out, int
PUT_BITS(0, 1); /* ef = 0 (no extension) */
PUT_BITS(0, 15); /* beam id */
/* put payload size at the right position */
/* put payload size */
payload_size = ret - data_start;
out_payload_size[0] = payload_size >> 8;
out_payload_size[1] = payload_size & 255;
......@@ -146,7 +139,6 @@ void make_cp_prach()
int make_up_dl(packet_config_t *cfg, packet_state_t *st, char *out, int size,
char *iq, int rb_start, int rb_count, int symbol_id)
{
printf("make_up_dl start %d count %d\n", rb_start, rb_count);
int ret = 0;
int bit = 0;
int data_start;
......@@ -173,7 +165,6 @@ printf("make_up_dl start %d count %d\n", rb_start, rb_count);
PUT_BITS(cfg->eaxc_id_dl, 16);
PUT_BITS(st->seq_id_up_dl, 8);
// st->seq_id_up_dl++;
PUT_BITS(1, 1); /* E bit, always 1 */
PUT_BITS(0, 7); /* subsequence ID, always 0 */
......@@ -208,7 +199,7 @@ printf("make_up_dl start %d count %d\n", rb_start, rb_count);
ret += iq_size;
/* put payload size at the right position */
/* put payload size */
payload_size = ret - data_start;
out_payload_size[0] = payload_size >> 8;
out_payload_size[1] = payload_size & 255;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment