Commit 6d75ca8e authored by Robert Schmidt's avatar Robert Schmidt

Move fhstate into eth structure

fhstate is only used in the ETHERNET library, so move it to a smaller
scope. In AW2S it is write-only, so we can remove it.
Signed-off-by: default avatarRobert Schmidt <robert.schmidt@openairinterface.org>
parent 9c0577ad
...@@ -410,7 +410,8 @@ int aw2s_startstreaming(openair0_device_t *device) ...@@ -410,7 +410,8 @@ int aw2s_startstreaming(openair0_device_t *device)
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result)); printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
} }
device->fhstate.active = 1; eth_state_t *eth = device->priv;
eth->fhstate.active = 1;
return (0); return (0);
} }
......
...@@ -320,19 +320,6 @@ typedef struct { ...@@ -320,19 +320,6 @@ typedef struct {
bool write_thread_exit; bool write_thread_exit;
} openair0_thread_t; } openair0_thread_t;
typedef struct fhstate_s {
openair0_timestamp_t TS[8];
openair0_timestamp_t TS0;
openair0_timestamp_t olddeltaTS[8];
openair0_timestamp_t oldTS[8];
openair0_timestamp_t TS_read;
int first_read;
uint32_t *buff[8];
uint32_t buff_size;
int r[8];
int active;
} fhstate_t;
#define WRITE_QUEUE_SZ 20 #define WRITE_QUEUE_SZ 20
typedef struct { typedef struct {
bool initDone; bool initDone;
...@@ -379,9 +366,6 @@ struct openair0_device { ...@@ -379,9 +366,6 @@ struct openair0_device {
/*!brief Can be used by driver to hold internal structure*/ /*!brief Can be used by driver to hold internal structure*/
void *priv; void *priv;
/*!brief pointer to FH state, used in ECPRI split 8*/
fhstate_t fhstate;
/* Functions API, which are called by the application*/ /* Functions API, which are called by the application*/
/*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error /*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error
......
...@@ -280,7 +280,7 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem) ...@@ -280,7 +280,7 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem)
int bytes_sent=0; int bytes_sent=0;
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int sendto_flag =0; int sendto_flag =0;
fhstate_t *fhstate = &device->fhstate; fhstate_t *fhstate = &eth->fhstate;
//sendto_flag|=flags; //sendto_flag|=flags;
eth->tx_nsamps=nsamps; eth->tx_nsamps=nsamps;
...@@ -413,7 +413,7 @@ void *udp_read_thread(void *arg) ...@@ -413,7 +413,7 @@ void *udp_read_thread(void *arg)
udp_ctx_t *u = (udp_ctx_t *)arg; udp_ctx_t *u = (udp_ctx_t *)arg;
openair0_device_t *device=u->device; openair0_device_t *device=u->device;
eth_state_t *eth = device->priv; eth_state_t *eth = device->priv;
fhstate_t *fhstate = &device->fhstate; fhstate_t *fhstate = &eth->fhstate;
char buffer[UDP_PACKET_SIZE_BYTES(256)]; char buffer[UDP_PACKET_SIZE_BYTES(256)];
int first_read=0; int first_read=0;
while (oai_exit == 0) { while (oai_exit == 0) {
...@@ -476,7 +476,8 @@ void *udp_read_thread(void *arg) ...@@ -476,7 +476,8 @@ void *udp_read_thread(void *arg)
int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *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; eth_state_t *eth = device->priv;
fhstate_t *fhstate = &eth->fhstate;
openair0_timestamp_t prev_read_TS= fhstate->TS_read; openair0_timestamp_t prev_read_TS= fhstate->TS_read;
volatile openair0_timestamp_t min_TS; volatile openair0_timestamp_t min_TS;
// block until FH is ready // block until FH is ready
......
...@@ -492,10 +492,10 @@ int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, e ...@@ -492,10 +492,10 @@ int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, e
device->trx_read_func2 = trx_eth_read_udp; device->trx_read_func2 = trx_eth_read_udp;
device->trx_ctlsend_func = trx_eth_ctlsend_udp; device->trx_ctlsend_func = trx_eth_ctlsend_udp;
device->trx_ctlrecv_func = trx_eth_ctlrecv_udp; device->trx_ctlrecv_func = trx_eth_ctlrecv_udp;
memset((void *)&device->fhstate, 0, sizeof(device->fhstate)); memset(&eth->fhstate, 0, sizeof(eth->fhstate));
printf("Setting %d RX channels to waiting\n", openair0_cfg->rx_num_channels); printf("Setting %d RX channels to waiting\n", openair0_cfg->rx_num_channels);
for (int i = openair0_cfg->rx_num_channels; i < 8; i++) for (int i = openair0_cfg->rx_num_channels; i < 8; i++)
device->fhstate.r[i] = 1; eth->fhstate.r[i] = 1;
} else if (eth->flags == ETH_RAW_IF4p5_MODE) { } else if (eth->flags == ETH_RAW_IF4p5_MODE) {
device->trx_write_func = trx_eth_write_raw_IF4p5; device->trx_write_func = trx_eth_write_raw_IF4p5;
device->trx_read_func = trx_eth_read_raw_IF4p5; device->trx_read_func = trx_eth_read_raw_IF4p5;
......
...@@ -38,6 +38,19 @@ typedef struct { ...@@ -38,6 +38,19 @@ typedef struct {
notifiedFIFO_t *resp; notifiedFIFO_t *resp;
} udp_ctx_t; } udp_ctx_t;
typedef struct fhstate_s {
openair0_timestamp_t TS[8];
openair0_timestamp_t TS0;
openair0_timestamp_t olddeltaTS[8];
openair0_timestamp_t oldTS[8];
openair0_timestamp_t TS_read;
int first_read;
uint32_t *buff[8];
uint32_t buff_size;
int r[8];
int active;
} fhstate_t;
/*!\brief opaque ethernet data structure */ /*!\brief opaque ethernet data structure */
typedef struct { typedef struct {
...@@ -52,7 +65,7 @@ typedef struct { ...@@ -52,7 +65,7 @@ typedef struct {
/*!\brief buffer size */ /*!\brief buffer size */
unsigned int buffer_size; unsigned int buffer_size;
/*!\brief Fronthaul state */ /*!\brief Fronthaul state */
fhstate_t *fhstate; fhstate_t fhstate;
/*!\brief destination address (control) for UDP socket*/ /*!\brief destination address (control) for UDP socket*/
struct sockaddr_in dest_addrc; struct sockaddr_in dest_addrc;
/*!\brief local address (control) for UDP socket*/ /*!\brief local address (control) for UDP socket*/
......
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