consistenty use suffix _t for openair0_* types
This commit is contained in:
+31
-40
@@ -52,8 +52,8 @@
|
||||
//int addr_len[MAX_INST];
|
||||
//struct ifreq if_index[MAX_INST];
|
||||
|
||||
int eth_socket_init_raw(openair0_device *device) {
|
||||
|
||||
int eth_socket_init_raw(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
const char *local_mac, *remote_mac;
|
||||
int sock_dom=0;
|
||||
@@ -125,8 +125,8 @@ int eth_socket_init_raw(openair0_device *device) {
|
||||
}
|
||||
|
||||
/* 09/03/2019: fix obvious inconsistencies, but this code hasn't be tested for sure */
|
||||
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) {
|
||||
|
||||
int trx_eth_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int bytes_sent=0;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
int sendto_flag =0;
|
||||
@@ -148,12 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
|
||||
/* we don't want to ovewrite with the header info the previous tx buffer data so we store it*/
|
||||
struct ether_header temp = *(struct ether_header *)buff2;
|
||||
int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES);
|
||||
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
|
||||
openair0_timestamp_t temp1 = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
|
||||
bytes_sent = 0;
|
||||
memcpy(buff2,(void*)ð->ehd,MAC_HEADER_SIZE_BYTES);
|
||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1);
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
|
||||
|
||||
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
|
||||
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
|
||||
@@ -180,15 +180,13 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
|
||||
/* tx buffer values restored */
|
||||
*(struct ether_header *)buff2 = temp;
|
||||
*(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES) = temp0;
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
}
|
||||
return (bytes_sent-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES)>>2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
int trx_eth_write_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int nblocks = nsamps;
|
||||
int bytes_sent = 0;
|
||||
|
||||
@@ -225,13 +223,11 @@ int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestam
|
||||
eth->tx_count++;
|
||||
}
|
||||
|
||||
return (bytes_sent-MAC_HEADER_SIZE_BYTES);
|
||||
return (bytes_sent-MAC_HEADER_SIZE_BYTES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int trx_eth_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int ret;
|
||||
int bytes_received=0;
|
||||
int i=0;
|
||||
@@ -251,7 +247,7 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
/* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/
|
||||
struct ether_header temp = *(struct ether_header *)buff2;
|
||||
int32_t temp0 = *(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES);
|
||||
openair0_timestamp temp1 = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
openair0_timestamp_t temp1 = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
|
||||
bytes_received=0;
|
||||
int receive_bytes;
|
||||
@@ -299,18 +295,18 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
} else {
|
||||
bytes_received+=ret;
|
||||
/* store the timestamp value from packet's header */
|
||||
*timestamp = *(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
*timestamp = *(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t));
|
||||
eth->rx_actual_nsamps=bytes_received>>2;
|
||||
eth->rx_count++;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
printf("------- RX------: nu=%x an_id=%d ts%d bytes_recv=%d \n",
|
||||
*(uint8_t *)(buff2+ETH_ALEN),
|
||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
|
||||
bytes_received);
|
||||
*(uint8_t *)(buff2 + ETH_ALEN),
|
||||
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
|
||||
bytes_received);
|
||||
|
||||
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, RAW_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
|
||||
|
||||
@@ -319,15 +315,13 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
/* tx buffer values restored */
|
||||
*(struct ether_header *)buff2 = temp;
|
||||
*(int32_t *)(buff2 + MAC_HEADER_SIZE_BYTES) = temp0;
|
||||
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
*(openair0_timestamp_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = temp1;
|
||||
}
|
||||
return (bytes_received-APP_HEADER_SIZE_BYTES-MAC_HEADER_SIZE_BYTES)>>2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int trx_eth_read_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
int ret;
|
||||
// Read nblocks info from packet itself
|
||||
int nblocks = nsamps;
|
||||
@@ -413,9 +407,8 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam
|
||||
return(bytes_received);
|
||||
}
|
||||
|
||||
|
||||
int eth_set_dev_conf_raw(openair0_device *device) {
|
||||
|
||||
int eth_set_dev_conf_raw(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
void *msg;
|
||||
ssize_t msg_len;
|
||||
@@ -443,9 +436,8 @@ int eth_set_dev_conf_raw(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device *device) {
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device_t *device)
|
||||
{
|
||||
// use for cc_id info
|
||||
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
@@ -475,9 +467,8 @@ int eth_set_dev_conf_raw_IF4p5(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int eth_get_dev_conf_raw(openair0_device *device) {
|
||||
|
||||
int eth_get_dev_conf_raw(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
void *msg;
|
||||
ssize_t msg_len;
|
||||
@@ -503,8 +494,8 @@ int eth_get_dev_conf_raw(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device *device) {
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device_t *device)
|
||||
{
|
||||
// use for cc_id info
|
||||
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
+29
-28
@@ -58,8 +58,8 @@ uint16_t pck_seq_num = 1;
|
||||
uint16_t pck_seq_num_cur=0;
|
||||
uint16_t pck_seq_num_prev=0;
|
||||
|
||||
int eth_socket_init_udp(openair0_device *device) {
|
||||
|
||||
int eth_socket_init_udp(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
eth_params_t *eth_params = device->eth_params;
|
||||
|
||||
@@ -192,8 +192,8 @@ int eth_socket_init_udp(openair0_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
int trx_eth_read_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc)
|
||||
{
|
||||
// Read nblocks info from packet itself
|
||||
int nblocks = nsamps;
|
||||
int bytes_received=-1;
|
||||
@@ -244,8 +244,8 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam
|
||||
return(bytes_received);
|
||||
}
|
||||
|
||||
int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
int trx_eth_write_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags)
|
||||
{
|
||||
int nblocks = nsamps;
|
||||
int bytes_sent = 0;
|
||||
|
||||
@@ -294,10 +294,10 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
|
||||
|
||||
|
||||
|
||||
void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) {
|
||||
|
||||
openair0_device *device=udpTXelem->device;
|
||||
openair0_timestamp timestamp = udpTXelem->timestamp;
|
||||
void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem)
|
||||
{
|
||||
openair0_device_t *device=udpTXelem->device;
|
||||
openair0_timestamp_t timestamp = udpTXelem->timestamp;
|
||||
void **buff = udpTXelem->buff;
|
||||
int nsamps = udpTXelem->nsamps;
|
||||
int nant = udpTXelem->nant;
|
||||
@@ -331,7 +331,7 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) {
|
||||
// ECPRI Message type (1 byte)
|
||||
*(uint8_t *)(buff2 + 1) = 64;
|
||||
|
||||
openair0_timestamp TS = timestamp + fhstate->TS0;
|
||||
openair0_timestamp_t TS = timestamp + fhstate->TS0;
|
||||
TS = (6*device->sampling_rate_ratio_d*TS)/device->sampling_rate_ratio_n;
|
||||
TS -= device->txrx_offset;
|
||||
int TSinc = (6*256*device->sampling_rate_ratio_d)/device->sampling_rate_ratio_n;
|
||||
@@ -386,8 +386,8 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant) {
|
||||
|
||||
int trx_eth_write_udp(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int fd_ind, int nsamps, int flags, int nant)
|
||||
{
|
||||
union udpTXReqUnion id = {.s={(uint64_t)timestamp,nsamps,0}};
|
||||
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(udpTXelem_t), id.p, device->utx[fd_ind]->resp,NULL);
|
||||
udpTXelem_t * udptxelem=(udpTXelem_t *) NotifiedFifoData(req);
|
||||
@@ -425,12 +425,13 @@ void *udp_write_thread(void *arg) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void *udp_read_thread(void *arg) {
|
||||
openair0_timestamp TS;
|
||||
void *udp_read_thread(void *arg)
|
||||
{
|
||||
openair0_timestamp_t TS;
|
||||
|
||||
int aid;
|
||||
udp_ctx_t *u = (udp_ctx_t *)arg;
|
||||
openair0_device *device=u->device;
|
||||
openair0_device_t *device=u->device;
|
||||
fhstate_t *fhstate = &device->fhstate;
|
||||
char buffer[UDP_PACKET_SIZE_BYTES(256)];
|
||||
int first_read=0;
|
||||
@@ -457,7 +458,7 @@ void *udp_read_thread(void *arg) {
|
||||
if (oai_exit)
|
||||
break;
|
||||
aid = *(uint16_t*)(&buffer[ECPRICOMMON_BYTES]);
|
||||
TS = *(openair0_timestamp *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]);
|
||||
TS = *(openair0_timestamp_t *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]);
|
||||
// convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application
|
||||
TS = (device->sampling_rate_ratio_n*TS)/(device->sampling_rate_ratio_d*6);
|
||||
AssertFatal(aid < 8,"Cannot handle more than 8 antennas, got aid %d\n",aid);
|
||||
@@ -487,24 +488,24 @@ void *udp_read_thread(void *arg) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps) {
|
||||
|
||||
int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps)
|
||||
{
|
||||
fhstate_t *fhstate = &device->fhstate;
|
||||
openair0_timestamp prev_read_TS= fhstate->TS_read;
|
||||
volatile openair0_timestamp min_TS;
|
||||
openair0_timestamp_t prev_read_TS= fhstate->TS_read;
|
||||
volatile openair0_timestamp_t min_TS;
|
||||
// block until FH is ready
|
||||
while (fhstate->r[0] == 0 || fhstate->r[1] == 0 || fhstate->r[2] == 0 || fhstate->r[3] == 0 ||
|
||||
fhstate->r[4] == 0 || fhstate->r[5] == 0 || fhstate->r[6] == 0 || fhstate->r[7] == 0) usleep(100);
|
||||
|
||||
// get minimum TS over all antennas
|
||||
min_TS = (volatile openair0_timestamp)fhstate->TS[0];
|
||||
min_TS = (volatile openair0_timestamp_t)fhstate->TS[0];
|
||||
for (int i=1;i<device->openair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,fhstate->TS[i]);
|
||||
// poll/sleep until we accumulated enough samples on each antenna port
|
||||
int count=0;
|
||||
while (fhstate->first_read == 1 && min_TS < (fhstate->TS0+prev_read_TS + nsamps)) {
|
||||
usleep(10);
|
||||
min_TS = (volatile openair0_timestamp)fhstate->TS[0];
|
||||
for (int i=1;i<device->openair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp)fhstate->TS[i]);
|
||||
min_TS = (volatile openair0_timestamp_t)fhstate->TS[0];
|
||||
for (int i=1;i<device->openair0_cfg->rx_num_channels;i++) min_TS = min(min_TS,(volatile openair0_timestamp_t)fhstate->TS[i]);
|
||||
count++;
|
||||
}
|
||||
if (fhstate->first_read == 0) {
|
||||
@@ -524,8 +525,8 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uin
|
||||
|
||||
|
||||
|
||||
int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len) {
|
||||
|
||||
int trx_eth_ctlsend_udp(openair0_device_t *device, void *msg, ssize_t msg_len)
|
||||
{
|
||||
return(sendto(((eth_state_t*)device->priv)->sockfdc,
|
||||
msg,
|
||||
msg_len,
|
||||
@@ -535,8 +536,8 @@ int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len) {
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len) {
|
||||
|
||||
int trx_eth_ctlrecv_udp(openair0_device_t *device, void *msg, ssize_t msg_len)
|
||||
{
|
||||
return (recvfrom(((eth_state_t*)device->priv)->sockfdc,
|
||||
msg,
|
||||
msg_len,
|
||||
|
||||
@@ -51,12 +51,9 @@ int num_devices_eth = 0;
|
||||
struct sockaddr_in dest_addr[MAX_INST];
|
||||
int dest_addr_len[MAX_INST];
|
||||
|
||||
int load_lib(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg,
|
||||
eth_params_t *cfg,
|
||||
uint8_t flag);
|
||||
int load_lib(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *cfg, uint8_t flag);
|
||||
|
||||
int trx_eth_start(openair0_device *device)
|
||||
int trx_eth_start(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
@@ -225,8 +222,7 @@ int trx_eth_start(openair0_device *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void trx_eth_end(openair0_device *device)
|
||||
void trx_eth_end(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
/* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */
|
||||
@@ -239,9 +235,8 @@ void trx_eth_end(openair0_device *device)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int trx_eth_stop(openair0_device *device) {
|
||||
int trx_eth_stop(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) {
|
||||
@@ -251,38 +246,32 @@ int trx_eth_stop(openair0_device *device) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_set_freq(openair0_device* device, openair0_config_t *openair0_cfg)
|
||||
int trx_eth_set_freq(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_set_gains(openair0_device* device, openair0_config_t *openair0_cfg)
|
||||
int trx_eth_set_gains(openair0_device_t *device, openair0_config_t *openair0_cfg)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_get_stats(openair0_device* device)
|
||||
int trx_eth_get_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int trx_eth_reset_stats(openair0_device* device)
|
||||
int trx_eth_reset_stats(openair0_device_t *device)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int trx_eth_write_init(openair0_device *device)
|
||||
int trx_eth_write_init(openair0_device_t *device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ethernet_tune(openair0_device *device,
|
||||
unsigned int option,
|
||||
int value)
|
||||
int ethernet_tune(openair0_device_t *device, unsigned int option, int value)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
struct timeval timeout;
|
||||
@@ -471,10 +460,7 @@ int ethernet_tune(openair0_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int transport_init(openair0_device *device,
|
||||
openair0_config_t *openair0_cfg,
|
||||
eth_params_t * eth_params )
|
||||
int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t));
|
||||
memset(eth, 0, sizeof(eth_state_t));
|
||||
@@ -496,7 +482,7 @@ int transport_init(openair0_device *device,
|
||||
|
||||
eth->num_fd = 1;
|
||||
|
||||
printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
|
||||
printf("[ETHERNET]: Initializing openair0_device_t for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU" : "RRU"));
|
||||
printf("[ETHERNET]: num_fd %d\n",eth->num_fd);
|
||||
device->Mod_id = 0;//num_devices_eth++;
|
||||
device->transp_type = ETHERNET_TP;
|
||||
@@ -577,8 +563,7 @@ unsigned short calc_csum (unsigned short *buf,
|
||||
return ~sum;
|
||||
}
|
||||
|
||||
|
||||
void dump_dev(openair0_device *device)
|
||||
void dump_dev(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
@@ -594,27 +579,21 @@ void dump_dev(openair0_device *device)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void inline dump_txcounters(openair0_device *device)
|
||||
void inline dump_txcounters(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg->Mod_id);
|
||||
printf(" Sent packets: %llu send errors: %i\n", (long long unsigned int)eth->tx_count, eth->num_tx_errors);
|
||||
}
|
||||
|
||||
|
||||
void inline dump_rxcounters(openair0_device *device)
|
||||
void inline dump_rxcounters(openair0_device_t *device)
|
||||
{
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg->Mod_id);
|
||||
printf(" Received packets: %llu missed packets errors: %i\n", (long long unsigned int)eth->rx_count, eth->num_underflows);
|
||||
}
|
||||
|
||||
|
||||
void inline dump_buff(openair0_device *device,
|
||||
char *buff,
|
||||
unsigned int tx_rx_flag,
|
||||
int nsamps)
|
||||
void inline dump_buff(openair0_device_t *device, char *buff, unsigned int tx_rx_flag, int nsamps)
|
||||
{
|
||||
char *strptr;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include "if_defs.h"
|
||||
#define ECPRICOMMON_BYTES 4
|
||||
#define ECPRIPCID_BYTES 2
|
||||
#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp))
|
||||
#define APP_HEADER_SIZE_BYTES (ECPRICOMMON_BYTES + ECPRIPCID_BYTES + sizeof(openair0_timestamp_t))
|
||||
#define ECPRIREV 1 // ECPRI Version 1, C=0 - single ECPRI message per OAI TX packet
|
||||
|
||||
/*!\brief opaque ethernet data structure */
|
||||
@@ -111,11 +111,11 @@ typedef struct {
|
||||
int num_rx_errors;
|
||||
/*!\brief number of errors in interface's transmitter */
|
||||
int num_tx_errors;
|
||||
|
||||
/*!\brief current TX timestamp */
|
||||
openair0_timestamp tx_current_ts;
|
||||
/*!\brief socket file desc */
|
||||
openair0_timestamp rx_current_ts;
|
||||
|
||||
/*!\brief current TX timestamp */
|
||||
openair0_timestamp_t tx_current_ts;
|
||||
/*!\brief socket file desc */
|
||||
openair0_timestamp_t rx_current_ts;
|
||||
/*!\brief actual number of samples transmitted */
|
||||
uint64_t tx_actual_nsamps;
|
||||
/*!\brief actual number of samples received */
|
||||
@@ -150,8 +150,8 @@ typedef struct {
|
||||
uint16_t seq_num ;
|
||||
/*!\brief antenna port used to resynchronize */
|
||||
uint16_t antenna_id;
|
||||
/*!\brief packet's timestamp */
|
||||
openair0_timestamp timestamp;
|
||||
/*!\brief packet's timestamp */
|
||||
openair0_timestamp_t timestamp;
|
||||
} header_t;
|
||||
|
||||
/*!\brief different options for ethernet tuning in socket and driver level */
|
||||
@@ -204,8 +204,8 @@ typedef struct {
|
||||
} iqoai_t ;
|
||||
|
||||
typedef struct udpTXelem_s {
|
||||
openair0_device *device;
|
||||
openair0_timestamp timestamp;
|
||||
openair0_device_t *device;
|
||||
openair0_timestamp_t timestamp;
|
||||
void **buff;
|
||||
int fd_ind;
|
||||
int nant;
|
||||
@@ -227,17 +227,17 @@ union udpTXReqUnion {
|
||||
|
||||
void dump_packet(char *title, unsigned char* pkt, int bytes, unsigned int tx_rx_flag);
|
||||
unsigned short calc_csum (unsigned short *buf, int nwords);
|
||||
void dump_dev(openair0_device *device);
|
||||
/*void inline dump_buff(openair0_device *device, char *buff,unsigned int tx_rx_flag,int nsamps);
|
||||
void inline dump_rxcounters(openair0_device *device);
|
||||
void inline dump_txcounters(openair0_device *device);
|
||||
void dump_dev(openair0_device_t *device);
|
||||
/*void inline dump_buff(openair0_device_t *device, char *buff,unsigned int tx_rx_flag,int nsamps);
|
||||
void inline dump_rxcounters(openair0_device_t *device);
|
||||
void inline dump_txcounters(openair0_device_t *device);
|
||||
*/
|
||||
void dump_iqs(char * buff, int iq_cnt);
|
||||
|
||||
void *udp_read_thread(void *arg);
|
||||
void *udp_write_thread(void *arg);
|
||||
|
||||
/*! \fn int ethernet_tune (openair0_device *device, unsigned int option, int value);
|
||||
/*! \fn int ethernet_tune (openair0_device_t *device, unsigned int option, int value);
|
||||
* \brief this function allows you to configure certain ethernet parameters in socket or device level
|
||||
* \param[in] device device which bears the socket
|
||||
* \param[in] option of parameter to configure
|
||||
@@ -246,34 +246,39 @@ void *udp_write_thread(void *arg);
|
||||
* \note
|
||||
* @ingroup _oai
|
||||
*/
|
||||
int ethernet_tune(openair0_device *device, unsigned int option, int value);
|
||||
int ethernet_tune(openair0_device_t *device, unsigned int option, int value);
|
||||
|
||||
/*! \fn int eth_socket_init_udp(openair0_device *device)
|
||||
/*! \fn int eth_socket_init_udp(openair0_device_t *device)
|
||||
* \brief initialization of UDP Socket to communicate with one destination
|
||||
* \param[in] device openair device for which the socket will be created
|
||||
* \return 0 on success, otherwise -1
|
||||
* \note
|
||||
* @ingroup _oai
|
||||
*/
|
||||
int eth_socket_init_udp(openair0_device *device);
|
||||
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buf, int fd_ind, int nsamps, int flags,int nant);
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps);
|
||||
int eth_socket_init_udp(openair0_device_t *device);
|
||||
int trx_eth_write_udp(openair0_device_t *device,
|
||||
openair0_timestamp_t timestamp,
|
||||
void **buf,
|
||||
int fd_ind,
|
||||
int nsamps,
|
||||
int flags,
|
||||
int nant);
|
||||
int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps);
|
||||
|
||||
int eth_socket_init_raw(openair0_device_t *device);
|
||||
int trx_eth_write_raw(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags);
|
||||
int trx_eth_read_raw(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags);
|
||||
int trx_eth_read_raw_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_read_raw_IF5_mobipass(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t timestamp, void **buff, int nsamps, int cc, int flags);
|
||||
int trx_eth_read_udp_IF4p5(openair0_device_t *device, openair0_timestamp_t *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_ctlsend_udp(openair0_device_t *device, void *msg, ssize_t msg_len);
|
||||
int trx_eth_ctlrecv_udp(openair0_device_t *device, void *msg, ssize_t msg_len);
|
||||
|
||||
int eth_socket_init_raw(openair0_device *device);
|
||||
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_read_raw_IF5_mobipass(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
|
||||
int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len);
|
||||
int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len);
|
||||
|
||||
int eth_get_dev_conf_raw(openair0_device *device);
|
||||
int eth_set_dev_conf_raw(openair0_device *device);
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device *device);
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device *device);
|
||||
int eth_get_dev_conf_raw(openair0_device_t *device);
|
||||
int eth_set_dev_conf_raw(openair0_device_t *device);
|
||||
int eth_get_dev_conf_raw_IF4p5(openair0_device_t *device);
|
||||
int eth_set_dev_conf_raw_IF4p5(openair0_device_t *device);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user